caif: Use link layer MTU instead of fixed MTU
[linux-2.6-block.git] / include / linux / caif / caif_socket.h
CommitLineData
f671c542
SB
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
f671c542
SB
19/**
20 * enum caif_link_selector - Physical Link Selection.
21 * @CAIF_LINK_HIGH_BANDW: Physical interface for high-bandwidth
22 * traffic.
23 * @CAIF_LINK_LOW_LATENCY: Physical interface for low-latency
24 * traffic.
25 *
26 * CAIF Link Layers can register their link properties.
27 * This enum is used for choosing between CAIF Link Layers when
28 * setting up CAIF Channels when multiple CAIF Link Layers exists.
29 */
30enum caif_link_selector {
31 CAIF_LINK_HIGH_BANDW,
32 CAIF_LINK_LOW_LATENCY
33};
34
35/**
36 * enum caif_channel_priority - CAIF channel priorities.
37 *
38 * @CAIF_PRIO_MIN: Min priority for a channel.
39 * @CAIF_PRIO_LOW: Low-priority channel.
40 * @CAIF_PRIO_NORMAL: Normal/default priority level.
41 * @CAIF_PRIO_HIGH: High priority level
42 * @CAIF_PRIO_MAX: Max priority for channel
43 *
44 * Priority can be set on CAIF Channels in order to
45 * prioritize between traffic on different CAIF Channels.
46 * These priority levels are recommended, but the priority value
47 * is not restricted to the values defined in this enum, any value
48 * between CAIF_PRIO_MIN and CAIF_PRIO_MAX could be used.
49 */
50enum caif_channel_priority {
51 CAIF_PRIO_MIN = 0x01,
52 CAIF_PRIO_LOW = 0x04,
53 CAIF_PRIO_NORMAL = 0x0f,
54 CAIF_PRIO_HIGH = 0x14,
55 CAIF_PRIO_MAX = 0x1F
56};
57
58/**
59 * enum caif_protocol_type - CAIF Channel type.
60 * @CAIFPROTO_AT: Classic AT channel.
bece7b23 61 * @CAIFPROTO_DATAGRAM: Datagram channel.
f671c542
SB
62 * @CAIFPROTO_DATAGRAM_LOOP: Datagram loopback channel, used for testing.
63 * @CAIFPROTO_UTIL: Utility (Psock) channel.
64 * @CAIFPROTO_RFM: Remote File Manager
65 *
66 * This enum defines the CAIF Channel type to be used. This defines
67 * the service to connect to on the modem.
68 */
69enum caif_protocol_type {
70 CAIFPROTO_AT,
71 CAIFPROTO_DATAGRAM,
72 CAIFPROTO_DATAGRAM_LOOP,
73 CAIFPROTO_UTIL,
74 CAIFPROTO_RFM,
75 _CAIFPROTO_MAX
76};
77#define CAIFPROTO_MAX _CAIFPROTO_MAX
78
79/**
80 * enum caif_at_type - AT Service Endpoint
81 * @CAIF_ATTYPE_PLAIN: Connects to a plain vanilla AT channel.
82 */
83enum caif_at_type {
84 CAIF_ATTYPE_PLAIN = 2
85};
86
87/**
88 * struct sockaddr_caif - the sockaddr structure for CAIF sockets.
bece7b23 89 * @family: Address family number, must be AF_CAIF.
f671c542
SB
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 */
116struct 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
bece7b23 156 * of type PF_CAIF.
f671c542
SB
157 *
158 */
159enum caif_socket_opts {
160 CAIFSO_LINK_SELECT = 127,
161 CAIFSO_REQ_PARAM = 128,
162 CAIFSO_RSP_PARAM = 129,
163};
164
165#endif /* _LINUX_CAIF_SOCKET_H */