This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / linux / netfilter_ipv4 / ip_conntrack_pptp.h
1 /* PPTP constants and structs */
2 #ifndef _CONNTRACK_PPTP_H
3 #define _CONNTRACK_PPTP_H
4
5 /* state of the control session */
6 enum pptp_ctrlsess_state {
7         PPTP_SESSION_NONE,                      /* no session present */
8         PPTP_SESSION_ERROR,                     /* some session error */
9         PPTP_SESSION_STOPREQ,                   /* stop_sess request seen */
10         PPTP_SESSION_REQUESTED,                 /* start_sess request seen */
11         PPTP_SESSION_CONFIRMED,                 /* session established */
12 };
13
14 /* state of the call inside the control session */
15 enum pptp_ctrlcall_state {
16         PPTP_CALL_NONE,
17         PPTP_CALL_ERROR,
18         PPTP_CALL_OUT_REQ,
19         PPTP_CALL_OUT_CONF,
20         PPTP_CALL_IN_REQ,
21         PPTP_CALL_IN_REP,
22         PPTP_CALL_IN_CONF,
23         PPTP_CALL_CLEAR_REQ,
24 };
25
26
27 /* conntrack private data */
28 struct ip_ct_pptp_master {
29         enum pptp_ctrlsess_state sstate;        /* session state */
30
31         /* everything below is going to be per-expectation in newnat,
32          * since there could be more than one call within one session */
33         enum pptp_ctrlcall_state cstate;        /* call state */
34         u_int16_t pac_call_id;                  /* call id of PAC, host byte order */
35         u_int16_t pns_call_id;                  /* call id of PNS, host byte order */
36 };
37
38 /* conntrack_expect private member */
39 struct ip_ct_pptp_expect {
40         enum pptp_ctrlcall_state cstate;        /* call state */
41         u_int16_t pac_call_id;                  /* call id of PAC */
42         u_int16_t pns_call_id;                  /* call id of PNS */
43 };
44
45
46 #ifdef __KERNEL__
47
48 #include <linux/netfilter_ipv4/lockhelp.h>
49 DECLARE_LOCK_EXTERN(ip_pptp_lock);
50
51 #define IP_CONNTR_PPTP          PPTP_CONTROL_PORT
52
53 #define PPTP_CONTROL_PORT       1723
54
55 #define PPTP_PACKET_CONTROL     1
56 #define PPTP_PACKET_MGMT        2
57
58 #define PPTP_MAGIC_COOKIE       0x1a2b3c4d
59
60 struct pptp_pkt_hdr {
61         __u16   packetLength;
62         __u16   packetType;
63         __u32   magicCookie;
64 };
65
66 /* PptpControlMessageType values */
67 #define PPTP_START_SESSION_REQUEST      1
68 #define PPTP_START_SESSION_REPLY        2
69 #define PPTP_STOP_SESSION_REQUEST       3
70 #define PPTP_STOP_SESSION_REPLY         4
71 #define PPTP_ECHO_REQUEST               5
72 #define PPTP_ECHO_REPLY                 6
73 #define PPTP_OUT_CALL_REQUEST           7
74 #define PPTP_OUT_CALL_REPLY             8
75 #define PPTP_IN_CALL_REQUEST            9
76 #define PPTP_IN_CALL_REPLY              10
77 #define PPTP_IN_CALL_CONNECT            11
78 #define PPTP_CALL_CLEAR_REQUEST         12
79 #define PPTP_CALL_DISCONNECT_NOTIFY     13
80 #define PPTP_WAN_ERROR_NOTIFY           14
81 #define PPTP_SET_LINK_INFO              15
82
83 #define PPTP_MSG_MAX                    15
84
85 /* PptpGeneralError values */
86 #define PPTP_ERROR_CODE_NONE            0
87 #define PPTP_NOT_CONNECTED              1
88 #define PPTP_BAD_FORMAT                 2
89 #define PPTP_BAD_VALUE                  3
90 #define PPTP_NO_RESOURCE                4
91 #define PPTP_BAD_CALLID                 5
92 #define PPTP_REMOVE_DEVICE_ERROR        6
93
94 struct PptpControlHeader {
95         __u16   messageType;
96         __u16   reserved;
97 };
98
99 /* FramingCapability Bitmap Values */
100 #define PPTP_FRAME_CAP_ASYNC            0x1
101 #define PPTP_FRAME_CAP_SYNC             0x2
102
103 /* BearerCapability Bitmap Values */
104 #define PPTP_BEARER_CAP_ANALOG          0x1
105 #define PPTP_BEARER_CAP_DIGITAL         0x2
106
107 struct PptpStartSessionRequest {
108         __u16   protocolVersion;
109         __u8    reserved1;
110         __u8    reserved2;
111         __u32   framingCapability;
112         __u32   bearerCapability;
113         __u16   maxChannels;
114         __u16   firmwareRevision;
115         __u8    hostName[64];
116         __u8    vendorString[64];
117 };
118
119 /* PptpStartSessionResultCode Values */
120 #define PPTP_START_OK                   1
121 #define PPTP_START_GENERAL_ERROR        2
122 #define PPTP_START_ALREADY_CONNECTED    3
123 #define PPTP_START_NOT_AUTHORIZED       4
124 #define PPTP_START_UNKNOWN_PROTOCOL     5
125
126 struct PptpStartSessionReply {
127         __u16   protocolVersion;
128         __u8    resultCode;
129         __u8    generalErrorCode;
130         __u32   framingCapability;
131         __u32   bearerCapability;
132         __u16   maxChannels;
133         __u16   firmwareRevision;
134         __u8    hostName[64];
135         __u8    vendorString[64];
136 };
137
138 /* PptpStopReasons */
139 #define PPTP_STOP_NONE                  1
140 #define PPTP_STOP_PROTOCOL              2
141 #define PPTP_STOP_LOCAL_SHUTDOWN        3
142
143 struct PptpStopSessionRequest {
144         __u8    reason;
145 };
146
147 /* PptpStopSessionResultCode */
148 #define PPTP_STOP_OK                    1
149 #define PPTP_STOP_GENERAL_ERROR         2
150
151 struct PptpStopSessionReply {
152         __u8    resultCode;
153         __u8    generalErrorCode;
154 };
155
156 struct PptpEchoRequest {
157         __u32 identNumber;
158 };
159
160 /* PptpEchoReplyResultCode */
161 #define PPTP_ECHO_OK                    1
162 #define PPTP_ECHO_GENERAL_ERROR         2
163
164 struct PptpEchoReply {
165         __u32   identNumber;
166         __u8    resultCode;
167         __u8    generalErrorCode;
168         __u16   reserved;
169 };
170
171 /* PptpFramingType */
172 #define PPTP_ASYNC_FRAMING              1
173 #define PPTP_SYNC_FRAMING               2
174 #define PPTP_DONT_CARE_FRAMING          3
175
176 /* PptpCallBearerType */
177 #define PPTP_ANALOG_TYPE                1
178 #define PPTP_DIGITAL_TYPE               2
179 #define PPTP_DONT_CARE_BEARER_TYPE      3
180
181 struct PptpOutCallRequest {
182         __u16   callID;
183         __u16   callSerialNumber;
184         __u32   minBPS;
185         __u32   maxBPS;
186         __u32   bearerType;
187         __u32   framingType;
188         __u16   packetWindow;
189         __u16   packetProcDelay;
190         __u16   reserved1;
191         __u16   phoneNumberLength;
192         __u16   reserved2;
193         __u8    phoneNumber[64];
194         __u8    subAddress[64];
195 };
196
197 /* PptpCallResultCode */
198 #define PPTP_OUTCALL_CONNECT            1
199 #define PPTP_OUTCALL_GENERAL_ERROR      2
200 #define PPTP_OUTCALL_NO_CARRIER         3
201 #define PPTP_OUTCALL_BUSY               4
202 #define PPTP_OUTCALL_NO_DIAL_TONE       5
203 #define PPTP_OUTCALL_TIMEOUT            6
204 #define PPTP_OUTCALL_DONT_ACCEPT        7
205
206 struct PptpOutCallReply {
207         __u16   callID;
208         __u16   peersCallID;
209         __u8    resultCode;
210         __u8    generalErrorCode;
211         __u16   causeCode;
212         __u32   connectSpeed;
213         __u16   packetWindow;
214         __u16   packetProcDelay;
215         __u32   physChannelID;
216 };
217
218 struct PptpInCallRequest {
219         __u16   callID;
220         __u16   callSerialNumber;
221         __u32   callBearerType;
222         __u32   physChannelID;
223         __u16   dialedNumberLength;
224         __u16   dialingNumberLength;
225         __u8    dialedNumber[64];
226         __u8    dialingNumber[64];
227         __u8    subAddress[64];
228 };
229
230 /* PptpInCallResultCode */
231 #define PPTP_INCALL_ACCEPT              1
232 #define PPTP_INCALL_GENERAL_ERROR       2
233 #define PPTP_INCALL_DONT_ACCEPT         3
234
235 struct PptpInCallReply {
236         __u16   callID;
237         __u16   peersCallID;
238         __u8    resultCode;
239         __u8    generalErrorCode;
240         __u16   packetWindow;
241         __u16   packetProcDelay;
242         __u16   reserved;
243 };
244
245 struct PptpInCallConnected {
246         __u16   peersCallID;
247         __u16   reserved;
248         __u32   connectSpeed;
249         __u16   packetWindow;
250         __u16   packetProcDelay;
251         __u32   callFramingType;
252 };
253
254 struct PptpClearCallRequest {
255         __u16   callID;
256         __u16   reserved;
257 };
258
259 struct PptpCallDisconnectNotify {
260         __u16   callID;
261         __u8    resultCode;
262         __u8    generalErrorCode;
263         __u16   causeCode;
264         __u16   reserved;
265         __u8    callStatistics[128];
266 };
267
268 struct PptpWanErrorNotify {
269         __u16   peersCallID;
270         __u16   reserved;
271         __u32   crcErrors;
272         __u32   framingErrors;
273         __u32   hardwareOverRuns;
274         __u32   bufferOverRuns;
275         __u32   timeoutErrors;
276         __u32   alignmentErrors;
277 };
278
279 struct PptpSetLinkInfo {
280         __u16   peersCallID;
281         __u16   reserved;
282         __u32   sendAccm;
283         __u32   recvAccm;
284 };
285
286
287 struct pptp_priv_data {
288         __u16   call_id;
289         __u16   mcall_id;
290         __u16   pcall_id;
291 };
292
293 union pptp_ctrl_union {
294                 struct PptpStartSessionRequest  sreq;
295                 struct PptpStartSessionReply    srep;
296                 struct PptpStopSessionRequest   streq;
297                 struct PptpStopSessionReply     strep;
298                 struct PptpOutCallRequest       ocreq;
299                 struct PptpOutCallReply         ocack;
300                 struct PptpInCallRequest        icreq;
301                 struct PptpInCallReply          icack;
302                 struct PptpInCallConnected      iccon;
303                 struct PptpClearCallRequest     clrreq;
304                 struct PptpCallDisconnectNotify disc;
305                 struct PptpWanErrorNotify       wanerr;
306                 struct PptpSetLinkInfo          setlink;
307 };
308
309 #endif /* __KERNEL__ */
310 #endif /* _CONNTRACK_PPTP_H */