caif_socket.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /* linux/caif_socket.h
  2. * CAIF Definitions for CAIF socket and network layer
  3. * Copyright (C) ST-Ericsson AB 2010
  4. * Author: Sjur Brendeland
  5. * License terms: GNU General Public License (GPL) version 2
  6. */
  7. #ifndef _LINUX_CAIF_SOCKET_H
  8. #define _LINUX_CAIF_SOCKET_H
  9. #include <linux/types.h>
  10. #include <linux/socket.h>
  11. /**
  12. * enum caif_link_selector - Physical Link Selection.
  13. * @CAIF_LINK_HIGH_BANDW: Physical interface for high-bandwidth
  14. * traffic.
  15. * @CAIF_LINK_LOW_LATENCY: Physical interface for low-latency
  16. * traffic.
  17. *
  18. * CAIF Link Layers can register their link properties.
  19. * This enum is used for choosing between CAIF Link Layers when
  20. * setting up CAIF Channels when multiple CAIF Link Layers exists.
  21. */
  22. enum caif_link_selector {
  23. CAIF_LINK_HIGH_BANDW,
  24. CAIF_LINK_LOW_LATENCY
  25. };
  26. /**
  27. * enum caif_channel_priority - CAIF channel priorities.
  28. *
  29. * @CAIF_PRIO_MIN: Min priority for a channel.
  30. * @CAIF_PRIO_LOW: Low-priority channel.
  31. * @CAIF_PRIO_NORMAL: Normal/default priority level.
  32. * @CAIF_PRIO_HIGH: High priority level
  33. * @CAIF_PRIO_MAX: Max priority for channel
  34. *
  35. * Priority can be set on CAIF Channels in order to
  36. * prioritize between traffic on different CAIF Channels.
  37. * These priority levels are recommended, but the priority value
  38. * is not restricted to the values defined in this enum, any value
  39. * between CAIF_PRIO_MIN and CAIF_PRIO_MAX could be used.
  40. */
  41. enum caif_channel_priority {
  42. CAIF_PRIO_MIN = 0x01,
  43. CAIF_PRIO_LOW = 0x04,
  44. CAIF_PRIO_NORMAL = 0x0f,
  45. CAIF_PRIO_HIGH = 0x14,
  46. CAIF_PRIO_MAX = 0x1F
  47. };
  48. /**
  49. * enum caif_protocol_type - CAIF Channel type.
  50. * @CAIFPROTO_AT: Classic AT channel.
  51. * @CAIFPROTO_DATAGRAM: Datagram channel.
  52. * @CAIFPROTO_DATAGRAM_LOOP: Datagram loopback channel, used for testing.
  53. * @CAIFPROTO_UTIL: Utility (Psock) channel.
  54. * @CAIFPROTO_RFM: Remote File Manager
  55. * @CAIFPROTO_DEBUG: Debug link
  56. *
  57. * This enum defines the CAIF Channel type to be used. This defines
  58. * the service to connect to on the modem.
  59. */
  60. enum caif_protocol_type {
  61. CAIFPROTO_AT,
  62. CAIFPROTO_DATAGRAM,
  63. CAIFPROTO_DATAGRAM_LOOP,
  64. CAIFPROTO_UTIL,
  65. CAIFPROTO_RFM,
  66. CAIFPROTO_DEBUG,
  67. _CAIFPROTO_MAX
  68. };
  69. #define CAIFPROTO_MAX _CAIFPROTO_MAX
  70. /**
  71. * enum caif_at_type - AT Service Endpoint
  72. * @CAIF_ATTYPE_PLAIN: Connects to a plain vanilla AT channel.
  73. */
  74. enum caif_at_type {
  75. CAIF_ATTYPE_PLAIN = 2
  76. };
  77. /**
  78. * enum caif_debug_type - Content selection for debug connection
  79. * @CAIF_DEBUG_TRACE_INTERACTIVE: Connection will contain
  80. * both trace and interactive debug.
  81. * @CAIF_DEBUG_TRACE: Connection contains trace only.
  82. * @CAIF_DEBUG_INTERACTIVE: Connection to interactive debug.
  83. */
  84. enum caif_debug_type {
  85. CAIF_DEBUG_TRACE_INTERACTIVE = 0,
  86. CAIF_DEBUG_TRACE,
  87. CAIF_DEBUG_INTERACTIVE,
  88. };
  89. /**
  90. * enum caif_debug_service - Debug Service Endpoint
  91. * @CAIF_RADIO_DEBUG_SERVICE: Debug service on the Radio sub-system
  92. * @CAIF_APP_DEBUG_SERVICE: Debug for the applications sub-system
  93. */
  94. enum caif_debug_service {
  95. CAIF_RADIO_DEBUG_SERVICE = 1,
  96. CAIF_APP_DEBUG_SERVICE
  97. };
  98. /**
  99. * struct sockaddr_caif - the sockaddr structure for CAIF sockets.
  100. * @family: Address family number, must be AF_CAIF.
  101. * @u: Union of address data 'switched' by family.
  102. * :
  103. * @u.at: Applies when family = CAIFPROTO_AT.
  104. *
  105. * @u.at.type: Type of AT link to set up (enum caif_at_type).
  106. *
  107. * @u.util: Applies when family = CAIFPROTO_UTIL
  108. *
  109. * @u.util.service: Utility service name.
  110. *
  111. * @u.dgm: Applies when family = CAIFPROTO_DATAGRAM
  112. *
  113. * @u.dgm.connection_id: Datagram connection id.
  114. *
  115. * @u.dgm.nsapi: NSAPI of the PDP-Context.
  116. *
  117. * @u.rfm: Applies when family = CAIFPROTO_RFM
  118. *
  119. * @u.rfm.connection_id: Connection ID for RFM.
  120. *
  121. * @u.rfm.volume: Volume to mount.
  122. *
  123. * @u.dbg: Applies when family = CAIFPROTO_DEBUG.
  124. *
  125. * @u.dbg.type: Type of debug connection to set up
  126. * (caif_debug_type).
  127. *
  128. * @u.dbg.service: Service sub-system to connect (caif_debug_service
  129. * Description:
  130. * This structure holds the connect parameters used for setting up a
  131. * CAIF Channel. It defines the service to connect to on the modem.
  132. */
  133. struct sockaddr_caif {
  134. __kernel_sa_family_t family;
  135. union {
  136. struct {
  137. __u8 type; /* type: enum caif_at_type */
  138. } at; /* CAIFPROTO_AT */
  139. struct {
  140. char service[16];
  141. } util; /* CAIFPROTO_UTIL */
  142. union {
  143. __u32 connection_id;
  144. __u8 nsapi;
  145. } dgm; /* CAIFPROTO_DATAGRAM(_LOOP)*/
  146. struct {
  147. __u32 connection_id;
  148. char volume[16];
  149. } rfm; /* CAIFPROTO_RFM */
  150. struct {
  151. __u8 type; /* type:enum caif_debug_type */
  152. __u8 service; /* service:caif_debug_service */
  153. } dbg; /* CAIFPROTO_DEBUG */
  154. } u;
  155. };
  156. /**
  157. * enum caif_socket_opts - CAIF option values for getsockopt and setsockopt.
  158. *
  159. * @CAIFSO_LINK_SELECT: Selector used if multiple CAIF Link layers are
  160. * available. Either a high bandwidth
  161. * link can be selected (CAIF_LINK_HIGH_BANDW) or
  162. * or a low latency link (CAIF_LINK_LOW_LATENCY).
  163. * This option is of type __u32.
  164. * Alternatively SO_BINDTODEVICE can be used.
  165. *
  166. * @CAIFSO_REQ_PARAM: Used to set the request parameters for a
  167. * utility channel. (maximum 256 bytes). This
  168. * option must be set before connecting.
  169. *
  170. * @CAIFSO_RSP_PARAM: Gets the response parameters for a utility
  171. * channel. (maximum 256 bytes). This option
  172. * is valid after a successful connect.
  173. *
  174. *
  175. * This enum defines the CAIF Socket options to be used on a socket
  176. * of type PF_CAIF.
  177. *
  178. */
  179. enum caif_socket_opts {
  180. CAIFSO_LINK_SELECT = 127,
  181. CAIFSO_REQ_PARAM = 128,
  182. CAIFSO_RSP_PARAM = 129,
  183. };
  184. #endif /* _LINUX_CAIF_SOCKET_H */