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