1 /* PPTP constants and structs */
2 #ifndef _CONNTRACK_PPTP_H
3 #define _CONNTRACK_PPTP_H
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 */
14 /* state of the call inside the control session */
15 enum pptp_ctrlcall_state {
27 /* conntrack private data */
28 struct ip_ct_pptp_master {
29 enum pptp_ctrlsess_state sstate; /* session state */
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 */
37 /* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack
38 * and therefore imposes a fixed limit on the number of maps */
39 struct ip_ct_gre_keymap *keymap_orig, *keymap_reply;
42 /* conntrack_expect private member */
43 struct ip_ct_pptp_expect {
44 enum pptp_ctrlcall_state cstate; /* call state */
45 u_int16_t pac_call_id; /* call id of PAC */
46 u_int16_t pns_call_id; /* call id of PNS */
53 #include <linux/netfilter_ipv4/lockhelp.h>
54 DECLARE_LOCK_EXTERN(ip_pptp_lock);
56 #define IP_CONNTR_PPTP PPTP_CONTROL_PORT
58 #define PPTP_CONTROL_PORT 1723
60 #define PPTP_PACKET_CONTROL 1
61 #define PPTP_PACKET_MGMT 2
63 #define PPTP_MAGIC_COOKIE 0x1a2b3c4d
71 /* PptpControlMessageType values */
72 #define PPTP_START_SESSION_REQUEST 1
73 #define PPTP_START_SESSION_REPLY 2
74 #define PPTP_STOP_SESSION_REQUEST 3
75 #define PPTP_STOP_SESSION_REPLY 4
76 #define PPTP_ECHO_REQUEST 5
77 #define PPTP_ECHO_REPLY 6
78 #define PPTP_OUT_CALL_REQUEST 7
79 #define PPTP_OUT_CALL_REPLY 8
80 #define PPTP_IN_CALL_REQUEST 9
81 #define PPTP_IN_CALL_REPLY 10
82 #define PPTP_IN_CALL_CONNECT 11
83 #define PPTP_CALL_CLEAR_REQUEST 12
84 #define PPTP_CALL_DISCONNECT_NOTIFY 13
85 #define PPTP_WAN_ERROR_NOTIFY 14
86 #define PPTP_SET_LINK_INFO 15
88 #define PPTP_MSG_MAX 15
90 /* PptpGeneralError values */
91 #define PPTP_ERROR_CODE_NONE 0
92 #define PPTP_NOT_CONNECTED 1
93 #define PPTP_BAD_FORMAT 2
94 #define PPTP_BAD_VALUE 3
95 #define PPTP_NO_RESOURCE 4
96 #define PPTP_BAD_CALLID 5
97 #define PPTP_REMOVE_DEVICE_ERROR 6
99 struct PptpControlHeader {
104 /* FramingCapability Bitmap Values */
105 #define PPTP_FRAME_CAP_ASYNC 0x1
106 #define PPTP_FRAME_CAP_SYNC 0x2
108 /* BearerCapability Bitmap Values */
109 #define PPTP_BEARER_CAP_ANALOG 0x1
110 #define PPTP_BEARER_CAP_DIGITAL 0x2
112 struct PptpStartSessionRequest {
113 __u16 protocolVersion;
116 __u32 framingCapability;
117 __u32 bearerCapability;
119 __u16 firmwareRevision;
121 __u8 vendorString[64];
124 /* PptpStartSessionResultCode Values */
125 #define PPTP_START_OK 1
126 #define PPTP_START_GENERAL_ERROR 2
127 #define PPTP_START_ALREADY_CONNECTED 3
128 #define PPTP_START_NOT_AUTHORIZED 4
129 #define PPTP_START_UNKNOWN_PROTOCOL 5
131 struct PptpStartSessionReply {
132 __u16 protocolVersion;
134 __u8 generalErrorCode;
135 __u32 framingCapability;
136 __u32 bearerCapability;
138 __u16 firmwareRevision;
140 __u8 vendorString[64];
143 /* PptpStopReasons */
144 #define PPTP_STOP_NONE 1
145 #define PPTP_STOP_PROTOCOL 2
146 #define PPTP_STOP_LOCAL_SHUTDOWN 3
148 struct PptpStopSessionRequest {
152 /* PptpStopSessionResultCode */
153 #define PPTP_STOP_OK 1
154 #define PPTP_STOP_GENERAL_ERROR 2
156 struct PptpStopSessionReply {
158 __u8 generalErrorCode;
161 struct PptpEchoRequest {
165 /* PptpEchoReplyResultCode */
166 #define PPTP_ECHO_OK 1
167 #define PPTP_ECHO_GENERAL_ERROR 2
169 struct PptpEchoReply {
172 __u8 generalErrorCode;
176 /* PptpFramingType */
177 #define PPTP_ASYNC_FRAMING 1
178 #define PPTP_SYNC_FRAMING 2
179 #define PPTP_DONT_CARE_FRAMING 3
181 /* PptpCallBearerType */
182 #define PPTP_ANALOG_TYPE 1
183 #define PPTP_DIGITAL_TYPE 2
184 #define PPTP_DONT_CARE_BEARER_TYPE 3
186 struct PptpOutCallRequest {
188 __u16 callSerialNumber;
194 __u16 packetProcDelay;
196 __u16 phoneNumberLength;
198 __u8 phoneNumber[64];
202 /* PptpCallResultCode */
203 #define PPTP_OUTCALL_CONNECT 1
204 #define PPTP_OUTCALL_GENERAL_ERROR 2
205 #define PPTP_OUTCALL_NO_CARRIER 3
206 #define PPTP_OUTCALL_BUSY 4
207 #define PPTP_OUTCALL_NO_DIAL_TONE 5
208 #define PPTP_OUTCALL_TIMEOUT 6
209 #define PPTP_OUTCALL_DONT_ACCEPT 7
211 struct PptpOutCallReply {
215 __u8 generalErrorCode;
219 __u16 packetProcDelay;
223 struct PptpInCallRequest {
225 __u16 callSerialNumber;
226 __u32 callBearerType;
228 __u16 dialedNumberLength;
229 __u16 dialingNumberLength;
230 __u8 dialedNumber[64];
231 __u8 dialingNumber[64];
235 /* PptpInCallResultCode */
236 #define PPTP_INCALL_ACCEPT 1
237 #define PPTP_INCALL_GENERAL_ERROR 2
238 #define PPTP_INCALL_DONT_ACCEPT 3
240 struct PptpInCallReply {
244 __u8 generalErrorCode;
246 __u16 packetProcDelay;
250 struct PptpInCallConnected {
255 __u16 packetProcDelay;
256 __u32 callFramingType;
259 struct PptpClearCallRequest {
264 struct PptpCallDisconnectNotify {
267 __u8 generalErrorCode;
270 __u8 callStatistics[128];
273 struct PptpWanErrorNotify {
278 __u32 hardwareOverRuns;
279 __u32 bufferOverRuns;
281 __u32 alignmentErrors;
284 struct PptpSetLinkInfo {
292 struct pptp_priv_data {
298 union pptp_ctrl_union {
299 struct PptpStartSessionRequest sreq;
300 struct PptpStartSessionReply srep;
301 struct PptpStopSessionRequest streq;
302 struct PptpStopSessionReply strep;
303 struct PptpOutCallRequest ocreq;
304 struct PptpOutCallReply ocack;
305 struct PptpInCallRequest icreq;
306 struct PptpInCallReply icack;
307 struct PptpInCallConnected iccon;
308 struct PptpClearCallRequest clrreq;
309 struct PptpCallDisconnectNotify disc;
310 struct PptpWanErrorNotify wanerr;
311 struct PptpSetLinkInfo setlink;
317 (*ip_nat_pptp_hook_outbound)(struct sk_buff **pskb,
318 struct ip_conntrack *ct,
319 enum ip_conntrack_info ctinfo,
320 struct PptpControlHeader *ctlh,
321 union pptp_ctrl_union *pptpReq);
324 (*ip_nat_pptp_hook_inbound)(struct sk_buff **pskb,
325 struct ip_conntrack *ct,
326 enum ip_conntrack_info ctinfo,
327 struct PptpControlHeader *ctlh,
328 union pptp_ctrl_union *pptpReq);
331 (*ip_nat_pptp_hook_exp_gre)(struct ip_conntrack_expect *exp_orig,
332 struct ip_conntrack_expect *exp_reply);
335 (*ip_nat_pptp_hook_expectfn)(struct ip_conntrack *ct,
336 struct ip_conntrack_expect *exp);
337 #endif /* __KERNEL__ */
338 #endif /* _CONNTRACK_PPTP_H */