1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
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
9 #ifndef _LINUX_CAIF_SOCKET_H
10 #define _LINUX_CAIF_SOCKET_H
12 #include <linux/types.h>
13 #include <linux/socket.h>
16 * enum caif_link_selector - Physical Link Selection.
17 * @CAIF_LINK_HIGH_BANDW: Physical interface for high-bandwidth
19 * @CAIF_LINK_LOW_LATENCY: Physical interface for low-latency
22 * CAIF Link Layers can register their link properties.
23 * This enum is used for choosing between CAIF Link Layers when
24 * setting up CAIF Channels when multiple CAIF Link Layers exists.
26 enum caif_link_selector {
32 * enum caif_channel_priority - CAIF channel priorities.
34 * @CAIF_PRIO_MIN: Min priority for a channel.
35 * @CAIF_PRIO_LOW: Low-priority channel.
36 * @CAIF_PRIO_NORMAL: Normal/default priority level.
37 * @CAIF_PRIO_HIGH: High priority level
38 * @CAIF_PRIO_MAX: Max priority for channel
40 * Priority can be set on CAIF Channels in order to
41 * prioritize between traffic on different CAIF Channels.
42 * These priority levels are recommended, but the priority value
43 * is not restricted to the values defined in this enum, any value
44 * between CAIF_PRIO_MIN and CAIF_PRIO_MAX could be used.
46 enum caif_channel_priority {
49 CAIF_PRIO_NORMAL = 0x0f,
50 CAIF_PRIO_HIGH = 0x14,
55 * enum caif_protocol_type - CAIF Channel type.
56 * @CAIFPROTO_AT: Classic AT channel.
57 * @CAIFPROTO_DATAGRAM: Datagram channel.
58 * @CAIFPROTO_DATAGRAM_LOOP: Datagram loopback channel, used for testing.
59 * @CAIFPROTO_UTIL: Utility (Psock) channel.
60 * @CAIFPROTO_RFM: Remote File Manager
61 * @CAIFPROTO_DEBUG: Debug link
63 * This enum defines the CAIF Channel type to be used. This defines
64 * the service to connect to on the modem.
66 enum caif_protocol_type {
69 CAIFPROTO_DATAGRAM_LOOP,
75 #define CAIFPROTO_MAX _CAIFPROTO_MAX
78 * enum caif_at_type - AT Service Endpoint
79 * @CAIF_ATTYPE_PLAIN: Connects to a plain vanilla AT channel.
85 * enum caif_debug_type - Content selection for debug connection
86 * @CAIF_DEBUG_TRACE_INTERACTIVE: Connection will contain
87 * both trace and interactive debug.
88 * @CAIF_DEBUG_TRACE: Connection contains trace only.
89 * @CAIF_DEBUG_INTERACTIVE: Connection to interactive debug.
91 enum caif_debug_type {
92 CAIF_DEBUG_TRACE_INTERACTIVE = 0,
94 CAIF_DEBUG_INTERACTIVE,
98 * enum caif_debug_service - Debug Service Endpoint
99 * @CAIF_RADIO_DEBUG_SERVICE: Debug service on the Radio sub-system
100 * @CAIF_APP_DEBUG_SERVICE: Debug for the applications sub-system
102 enum caif_debug_service {
103 CAIF_RADIO_DEBUG_SERVICE = 1,
104 CAIF_APP_DEBUG_SERVICE
108 * struct sockaddr_caif - the sockaddr structure for CAIF sockets.
109 * @family: Address family number, must be AF_CAIF.
110 * @u: Union of address data 'switched' by family.
112 * @u.at: Applies when family = CAIFPROTO_AT.
114 * @u.at.type: Type of AT link to set up (enum caif_at_type).
116 * @u.util: Applies when family = CAIFPROTO_UTIL
118 * @u.util.service: Utility service name.
120 * @u.dgm: Applies when family = CAIFPROTO_DATAGRAM
122 * @u.dgm.connection_id: Datagram connection id.
124 * @u.dgm.nsapi: NSAPI of the PDP-Context.
126 * @u.rfm: Applies when family = CAIFPROTO_RFM
128 * @u.rfm.connection_id: Connection ID for RFM.
130 * @u.rfm.volume: Volume to mount.
132 * @u.dbg: Applies when family = CAIFPROTO_DEBUG.
134 * @u.dbg.type: Type of debug connection to set up
137 * @u.dbg.service: Service sub-system to connect (caif_debug_service
139 * This structure holds the connect parameters used for setting up a
140 * CAIF Channel. It defines the service to connect to on the modem.
142 struct sockaddr_caif {
143 __kernel_sa_family_t family;
146 __u8 type; /* type: enum caif_at_type */
147 } at; /* CAIFPROTO_AT */
150 } util; /* CAIFPROTO_UTIL */
154 } dgm; /* CAIFPROTO_DATAGRAM(_LOOP)*/
158 } rfm; /* CAIFPROTO_RFM */
160 __u8 type; /* type:enum caif_debug_type */
161 __u8 service; /* service:caif_debug_service */
162 } dbg; /* CAIFPROTO_DEBUG */
167 * enum caif_socket_opts - CAIF option values for getsockopt and setsockopt.
169 * @CAIFSO_LINK_SELECT: Selector used if multiple CAIF Link layers are
170 * available. Either a high bandwidth
171 * link can be selected (CAIF_LINK_HIGH_BANDW) or
172 * or a low latency link (CAIF_LINK_LOW_LATENCY).
173 * This option is of type __u32.
174 * Alternatively SO_BINDTODEVICE can be used.
176 * @CAIFSO_REQ_PARAM: Used to set the request parameters for a
177 * utility channel. (maximum 256 bytes). This
178 * option must be set before connecting.
180 * @CAIFSO_RSP_PARAM: Gets the response parameters for a utility
181 * channel. (maximum 256 bytes). This option
182 * is valid after a successful connect.
185 * This enum defines the CAIF Socket options to be used on a socket
189 enum caif_socket_opts {
190 CAIFSO_LINK_SELECT = 127,
191 CAIFSO_REQ_PARAM = 128,
192 CAIFSO_RSP_PARAM = 129,
195 #endif /* _LINUX_CAIF_SOCKET_H */