caif_socket.h 5.7 KB

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