diff options
author | Sjur Braendeland <sjur.brandeland@stericsson.com> | 2010-03-30 09:56:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-03-30 22:08:44 -0400 |
commit | f671c54207d8a47129f35a84569fdfda614d2439 (patch) | |
tree | a69b987be7d2465dd0c38061415b648c02d74162 /include/linux/caif | |
parent | 70596b612c04694806a31dd389bd796c035085fa (diff) |
net-caif: add CAIF socket and configuration headers
Add CAIF types for Socket Address, Socket Options,
and configuration parameters for the GPRS IP network interface.
Signed-off-by: Sjur Braendeland <sjur.brandeland@stericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/caif')
-rw-r--r-- | include/linux/caif/caif_socket.h | 164 | ||||
-rw-r--r-- | include/linux/caif/if_caif.h | 34 |
2 files changed, 198 insertions, 0 deletions
diff --git a/include/linux/caif/caif_socket.h b/include/linux/caif/caif_socket.h new file mode 100644 index 000000000000..8e5c8444a3f4 --- /dev/null +++ b/include/linux/caif/caif_socket.h | |||
@@ -0,0 +1,164 @@ | |||
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/ 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> | ||
12 | |||
13 | #ifdef __KERNEL__ | ||
14 | #include <linux/socket.h> | ||
15 | #else | ||
16 | #include <sys/socket.h> | ||
17 | #endif | ||
18 | |||
19 | |||
20 | /** | ||
21 | * enum caif_link_selector - Physical Link Selection. | ||
22 | * @CAIF_LINK_HIGH_BANDW: Physical interface for high-bandwidth | ||
23 | * traffic. | ||
24 | * @CAIF_LINK_LOW_LATENCY: Physical interface for low-latency | ||
25 | * traffic. | ||
26 | * | ||
27 | * CAIF Link Layers can register their link properties. | ||
28 | * This enum is used for choosing between CAIF Link Layers when | ||
29 | * setting up CAIF Channels when multiple CAIF Link Layers exists. | ||
30 | */ | ||
31 | enum caif_link_selector { | ||
32 | CAIF_LINK_HIGH_BANDW, | ||
33 | CAIF_LINK_LOW_LATENCY | ||
34 | }; | ||
35 | |||
36 | /** | ||
37 | * enum caif_channel_priority - CAIF channel priorities. | ||
38 | * | ||
39 | * @CAIF_PRIO_MIN: Min priority for a channel. | ||
40 | * @CAIF_PRIO_LOW: Low-priority channel. | ||
41 | * @CAIF_PRIO_NORMAL: Normal/default priority level. | ||
42 | * @CAIF_PRIO_HIGH: High priority level | ||
43 | * @CAIF_PRIO_MAX: Max priority for channel | ||
44 | * | ||
45 | * Priority can be set on CAIF Channels in order to | ||
46 | * prioritize between traffic on different CAIF Channels. | ||
47 | * These priority levels are recommended, but the priority value | ||
48 | * is not restricted to the values defined in this enum, any value | ||
49 | * between CAIF_PRIO_MIN and CAIF_PRIO_MAX could be used. | ||
50 | */ | ||
51 | enum caif_channel_priority { | ||
52 | CAIF_PRIO_MIN = 0x01, | ||
53 | CAIF_PRIO_LOW = 0x04, | ||
54 | CAIF_PRIO_NORMAL = 0x0f, | ||
55 | CAIF_PRIO_HIGH = 0x14, | ||
56 | CAIF_PRIO_MAX = 0x1F | ||
57 | }; | ||
58 | |||
59 | /** | ||
60 | * enum caif_protocol_type - CAIF Channel type. | ||
61 | * @CAIFPROTO_AT: Classic AT channel. | ||
62 | * @CAIFPROTO_DATAGRAM: Datagram channel. | ||
63 | * @CAIFPROTO_DATAGRAM_LOOP: Datagram loopback channel, used for testing. | ||
64 | * @CAIFPROTO_UTIL: Utility (Psock) channel. | ||
65 | * @CAIFPROTO_RFM: Remote File Manager | ||
66 | * | ||
67 | * This enum defines the CAIF Channel type to be used. This defines | ||
68 | * the service to connect to on the modem. | ||
69 | */ | ||
70 | enum caif_protocol_type { | ||
71 | CAIFPROTO_AT, | ||
72 | CAIFPROTO_DATAGRAM, | ||
73 | CAIFPROTO_DATAGRAM_LOOP, | ||
74 | CAIFPROTO_UTIL, | ||
75 | CAIFPROTO_RFM, | ||
76 | _CAIFPROTO_MAX | ||
77 | }; | ||
78 | #define CAIFPROTO_MAX _CAIFPROTO_MAX | ||
79 | |||
80 | /** | ||
81 | * enum caif_at_type - AT Service Endpoint | ||
82 | * @CAIF_ATTYPE_PLAIN: Connects to a plain vanilla AT channel. | ||
83 | */ | ||
84 | enum caif_at_type { | ||
85 | CAIF_ATTYPE_PLAIN = 2 | ||
86 | }; | ||
87 | |||
88 | /** | ||
89 | * struct sockaddr_caif - the sockaddr structure for CAIF sockets. | ||
90 | * @u: Union of address data 'switched' by family. | ||
91 | * : | ||
92 | * @u.at: Applies when family = CAIFPROTO_AT. | ||
93 | * | ||
94 | * @u.at.type: Type of AT link to set up (enum caif_at_type). | ||
95 | * | ||
96 | * @u.util: Applies when family = CAIFPROTO_UTIL | ||
97 | * | ||
98 | * @u.util.service: Utility service name. | ||
99 | * | ||
100 | * @u.dgm: Applies when family = CAIFPROTO_DATAGRAM | ||
101 | * | ||
102 | * @u.dgm.connection_id: Datagram connection id. | ||
103 | * | ||
104 | * @u.dgm.nsapi: NSAPI of the PDP-Context. | ||
105 | * | ||
106 | * @u.rfm: Applies when family = CAIFPROTO_RFM | ||
107 | * | ||
108 | * @u.rfm.connection_id: Connection ID for RFM. | ||
109 | * | ||
110 | * @u.rfm.volume: Volume to mount. | ||
111 | * | ||
112 | * Description: | ||
113 | * This structure holds the connect parameters used for setting up a | ||
114 | * CAIF Channel. It defines the service to connect to on the modem. | ||
115 | */ | ||
116 | struct sockaddr_caif { | ||
117 | sa_family_t family; | ||
118 | union { | ||
119 | struct { | ||
120 | __u8 type; /* type: enum caif_at_type */ | ||
121 | } at; /* CAIFPROTO_AT */ | ||
122 | struct { | ||
123 | char service[16]; | ||
124 | } util; /* CAIFPROTO_UTIL */ | ||
125 | union { | ||
126 | __u32 connection_id; | ||
127 | __u8 nsapi; | ||
128 | } dgm; /* CAIFPROTO_DATAGRAM(_LOOP)*/ | ||
129 | struct { | ||
130 | __u32 connection_id; | ||
131 | char volume[16]; | ||
132 | } rfm; /* CAIFPROTO_RFM */ | ||
133 | } u; | ||
134 | }; | ||
135 | |||
136 | /** | ||
137 | * enum caif_socket_opts - CAIF option values for getsockopt and setsockopt. | ||
138 | * | ||
139 | * @CAIFSO_LINK_SELECT: Selector used if multiple CAIF Link layers are | ||
140 | * available. Either a high bandwidth | ||
141 | * link can be selected (CAIF_LINK_HIGH_BANDW) or | ||
142 | * or a low latency link (CAIF_LINK_LOW_LATENCY). | ||
143 | * This option is of type __u32. | ||
144 | * Alternatively SO_BINDTODEVICE can be used. | ||
145 | * | ||
146 | * @CAIFSO_REQ_PARAM: Used to set the request parameters for a | ||
147 | * utility channel. (maximum 256 bytes). This | ||
148 | * option must be set before connecting. | ||
149 | * | ||
150 | * @CAIFSO_RSP_PARAM: Gets the response parameters for a utility | ||
151 | * channel. (maximum 256 bytes). This option | ||
152 | * is valid after a successful connect. | ||
153 | * | ||
154 | * | ||
155 | * This enum defines the CAIF Socket options to be used on a socket | ||
156 | * | ||
157 | */ | ||
158 | enum caif_socket_opts { | ||
159 | CAIFSO_LINK_SELECT = 127, | ||
160 | CAIFSO_REQ_PARAM = 128, | ||
161 | CAIFSO_RSP_PARAM = 129, | ||
162 | }; | ||
163 | |||
164 | #endif /* _LINUX_CAIF_SOCKET_H */ | ||
diff --git a/include/linux/caif/if_caif.h b/include/linux/caif/if_caif.h new file mode 100644 index 000000000000..5e7eed4edf51 --- /dev/null +++ b/include/linux/caif/if_caif.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson AB 2010 | ||
3 | * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com | ||
4 | * License terms: GNU General Public License (GPL) version 2 | ||
5 | */ | ||
6 | |||
7 | #ifndef IF_CAIF_H_ | ||
8 | #define IF_CAIF_H_ | ||
9 | #include <linux/sockios.h> | ||
10 | #include <linux/types.h> | ||
11 | #include <linux/socket.h> | ||
12 | |||
13 | /** | ||
14 | * enum ifla_caif - CAIF NetlinkRT parameters. | ||
15 | * @IFLA_CAIF_IPV4_CONNID: Connection ID for IPv4 PDP Context. | ||
16 | * The type of attribute is NLA_U32. | ||
17 | * @IFLA_CAIF_IPV6_CONNID: Connection ID for IPv6 PDP Context. | ||
18 | * The type of attribute is NLA_U32. | ||
19 | * @IFLA_CAIF_LOOPBACK: If different from zero, device is doing loopback | ||
20 | * The type of attribute is NLA_U8. | ||
21 | * | ||
22 | * When using RT Netlink to create, destroy or configure a CAIF IP interface, | ||
23 | * enum ifla_caif is used to specify the configuration attributes. | ||
24 | */ | ||
25 | enum ifla_caif { | ||
26 | __IFLA_CAIF_UNSPEC, | ||
27 | IFLA_CAIF_IPV4_CONNID, | ||
28 | IFLA_CAIF_IPV6_CONNID, | ||
29 | IFLA_CAIF_LOOPBACK, | ||
30 | __IFLA_CAIF_MAX | ||
31 | }; | ||
32 | #define IFLA_CAIF_MAX (__IFLA_CAIF_MAX-1) | ||
33 | |||
34 | #endif /*IF_CAIF_H_*/ | ||