1
2
3
4
5
6
7
8
9
10
11
12#ifndef _UAPI_LINUX_ATM_H
13#define _UAPI_LINUX_ATM_H
14
15
16
17
18
19
20#include <linux/compiler.h>
21#include <linux/atmapi.h>
22#include <linux/atmsap.h>
23#include <linux/atmioc.h>
24#include <linux/types.h>
25
26
27
28#define ATM_CELL_SIZE 53
29#define ATM_CELL_PAYLOAD 48
30#define ATM_AAL0_SDU 52
31#define ATM_MAX_AAL34_PDU 65535
32#define ATM_AAL5_TRAILER 8
33#define ATM_MAX_AAL5_PDU 65535
34#define ATM_MAX_CDV 9999
35#define ATM_NOT_RSV_VCI 32
36
37#define ATM_MAX_VPI 255
38#define ATM_MAX_VPI_NNI 4096
39#define ATM_MAX_VCI 65535
40
41
42
43#define ATM_NO_AAL 0
44#define ATM_AAL0 13
45#define ATM_AAL1 1
46#define ATM_AAL2 2
47#define ATM_AAL34 3
48#define ATM_AAL5 5
49
50
51
52
53
54
55
56
57
58#define __SO_ENCODE(l,n,t) ((((l) & 0x1FF) << 22) | ((n) << 16) | \
59 sizeof(t))
60#define __SO_LEVEL_MATCH(c,m) (((c) >> 22) == ((m) & 0x1FF))
61#define __SO_NUMBER(c) (((c) >> 16) & 0x3f)
62#define __SO_SIZE(c) ((c) & 0x3fff)
63
64
65
66
67
68#define SO_SETCLP __SO_ENCODE(SOL_ATM,0,int)
69
70#define SO_CIRANGE __SO_ENCODE(SOL_ATM,1,struct atm_cirange)
71
72
73#define SO_ATMQOS __SO_ENCODE(SOL_ATM,2,struct atm_qos)
74
75#define SO_ATMSAP __SO_ENCODE(SOL_ATM,3,struct atm_sap)
76
77#define SO_ATMPVC __SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc)
78
79#define SO_MULTIPOINT __SO_ENCODE(SOL_ATM, 5, int)
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94#define ATM_HDR_GFC_MASK 0xf0000000
95#define ATM_HDR_GFC_SHIFT 28
96#define ATM_HDR_VPI_MASK 0x0ff00000
97#define ATM_HDR_VPI_SHIFT 20
98#define ATM_HDR_VCI_MASK 0x000ffff0
99#define ATM_HDR_VCI_SHIFT 4
100#define ATM_HDR_PTI_MASK 0x0000000e
101#define ATM_HDR_PTI_SHIFT 1
102#define ATM_HDR_CLP 0x00000001
103
104
105
106
107
108
109#define ATM_PTI_US0 0
110#define ATM_PTI_US1 1
111#define ATM_PTI_UCES0 2
112#define ATM_PTI_UCES1 3
113#define ATM_PTI_SEGF5 4
114#define ATM_PTI_E2EF5 5
115#define ATM_PTI_RSV_RM 6
116#define ATM_PTI_RSV 7
117
118
119
120
121
122
123
124
125
126
127#define ATM_NONE 0
128#define ATM_UBR 1
129#define ATM_CBR 2
130#define ATM_VBR 3
131#define ATM_ABR 4
132#define ATM_ANYCLASS 5
133
134#define ATM_MAX_PCR -1
135
136struct atm_trafprm {
137 unsigned char traffic_class;
138 int max_pcr;
139 int pcr;
140 int min_pcr;
141 int max_cdv;
142 int max_sdu;
143
144 unsigned int icr;
145 unsigned int tbe;
146 unsigned int frtt : 24;
147 unsigned int rif : 4;
148 unsigned int rdf : 4;
149 unsigned int nrm_pres :1;
150 unsigned int trm_pres :1;
151 unsigned int adtf_pres :1;
152 unsigned int cdf_pres :1;
153 unsigned int nrm :3;
154 unsigned int trm :3;
155 unsigned int adtf :10;
156 unsigned int cdf :3;
157 unsigned int spare :9;
158};
159
160struct atm_qos {
161 struct atm_trafprm txtp;
162 struct atm_trafprm rxtp __ATM_API_ALIGN;
163
164 unsigned char aal __ATM_API_ALIGN;
165};
166
167
168
169#define ATM_ITF_ANY -1
170#define ATM_VPI_ANY -1
171#define ATM_VCI_ANY -1
172#define ATM_VPI_UNSPEC -2
173#define ATM_VCI_UNSPEC -2
174
175
176struct sockaddr_atmpvc {
177 unsigned short sap_family;
178 struct {
179 short itf;
180 short vpi;
181 int vci;
182 } sap_addr __ATM_API_ALIGN;
183};
184
185
186
187#define ATM_ESA_LEN 20
188#define ATM_E164_LEN 12
189
190#define ATM_AFI_DCC 0x39
191#define ATM_AFI_ICD 0x47
192#define ATM_AFI_E164 0x45
193#define ATM_AFI_LOCAL 0x49
194
195#define ATM_AFI_DCC_GROUP 0xBD
196#define ATM_AFI_ICD_GROUP 0xC5
197#define ATM_AFI_E164_GROUP 0xC3
198#define ATM_AFI_LOCAL_GROUP 0xC7
199
200#define ATM_LIJ_NONE 0
201#define ATM_LIJ 1
202#define ATM_LIJ_RPJ 2
203#define ATM_LIJ_NJ 3
204
205
206struct sockaddr_atmsvc {
207 unsigned short sas_family;
208 struct {
209 unsigned char prv[ATM_ESA_LEN];
210 char pub[ATM_E164_LEN+1];
211
212 char lij_type;
213 __u32 lij_id;
214 } sas_addr __ATM_API_ALIGN;
215};
216
217
218static __inline__ int atmsvc_addr_in_use(struct sockaddr_atmsvc addr)
219{
220 return *addr.sas_addr.prv || *addr.sas_addr.pub;
221}
222
223
224static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr)
225{
226 return addr.sap_addr.itf || addr.sap_addr.vpi || addr.sap_addr.vci;
227}
228
229
230
231
232
233
234struct atmif_sioc {
235 int number;
236 int length;
237 void __user *arg;
238};
239
240
241typedef unsigned short atm_backend_t;
242#endif
243