1 /* PPTP constants and structs */
2 #ifndef _NF_CONNTRACK_PPTP_H
3 #define _NF_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 {
26 /* conntrack private data */
27 struct nf_ct_pptp_master {
28 enum pptp_ctrlsess_state sstate; /* session state */
29 enum pptp_ctrlcall_state cstate; /* call state */
30 __be16 pac_call_id; /* call id of PAC */
31 __be16 pns_call_id; /* call id of PNS */
33 /* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack
34 * and therefore imposes a fixed limit on the number of maps */
35 struct nf_ct_gre_keymap *keymap[IP_CT_DIR_MAX];
39 __be16 pns_call_id; /* NAT'ed PNS call id */
40 __be16 pac_call_id; /* NAT'ed PAC call id */
45 #define PPTP_CONTROL_PORT 1723
47 #define PPTP_PACKET_CONTROL 1
48 #define PPTP_PACKET_MGMT 2
50 #define PPTP_MAGIC_COOKIE 0x1a2b3c4d
58 /* PptpControlMessageType values */
59 #define PPTP_START_SESSION_REQUEST 1
60 #define PPTP_START_SESSION_REPLY 2
61 #define PPTP_STOP_SESSION_REQUEST 3
62 #define PPTP_STOP_SESSION_REPLY 4
63 #define PPTP_ECHO_REQUEST 5
64 #define PPTP_ECHO_REPLY 6
65 #define PPTP_OUT_CALL_REQUEST 7
66 #define PPTP_OUT_CALL_REPLY 8
67 #define PPTP_IN_CALL_REQUEST 9
68 #define PPTP_IN_CALL_REPLY 10
69 #define PPTP_IN_CALL_CONNECT 11
70 #define PPTP_CALL_CLEAR_REQUEST 12
71 #define PPTP_CALL_DISCONNECT_NOTIFY 13
72 #define PPTP_WAN_ERROR_NOTIFY 14
73 #define PPTP_SET_LINK_INFO 15
75 #define PPTP_MSG_MAX 15
77 /* PptpGeneralError values */
78 #define PPTP_ERROR_CODE_NONE 0
79 #define PPTP_NOT_CONNECTED 1
80 #define PPTP_BAD_FORMAT 2
81 #define PPTP_BAD_VALUE 3
82 #define PPTP_NO_RESOURCE 4
83 #define PPTP_BAD_CALLID 5
84 #define PPTP_REMOVE_DEVICE_ERROR 6
86 struct PptpControlHeader {
91 /* FramingCapability Bitmap Values */
92 #define PPTP_FRAME_CAP_ASYNC 0x1
93 #define PPTP_FRAME_CAP_SYNC 0x2
95 /* BearerCapability Bitmap Values */
96 #define PPTP_BEARER_CAP_ANALOG 0x1
97 #define PPTP_BEARER_CAP_DIGITAL 0x2
99 struct PptpStartSessionRequest {
100 __be16 protocolVersion;
102 __be32 framingCapability;
103 __be32 bearerCapability;
105 __be16 firmwareRevision;
107 __u8 vendorString[64];
110 /* PptpStartSessionResultCode Values */
111 #define PPTP_START_OK 1
112 #define PPTP_START_GENERAL_ERROR 2
113 #define PPTP_START_ALREADY_CONNECTED 3
114 #define PPTP_START_NOT_AUTHORIZED 4
115 #define PPTP_START_UNKNOWN_PROTOCOL 5
117 struct PptpStartSessionReply {
118 __be16 protocolVersion;
120 __u8 generalErrorCode;
121 __be32 framingCapability;
122 __be32 bearerCapability;
124 __be16 firmwareRevision;
126 __u8 vendorString[64];
129 /* PptpStopReasons */
130 #define PPTP_STOP_NONE 1
131 #define PPTP_STOP_PROTOCOL 2
132 #define PPTP_STOP_LOCAL_SHUTDOWN 3
134 struct PptpStopSessionRequest {
140 /* PptpStopSessionResultCode */
141 #define PPTP_STOP_OK 1
142 #define PPTP_STOP_GENERAL_ERROR 2
144 struct PptpStopSessionReply {
146 __u8 generalErrorCode;
150 struct PptpEchoRequest {
154 /* PptpEchoReplyResultCode */
155 #define PPTP_ECHO_OK 1
156 #define PPTP_ECHO_GENERAL_ERROR 2
158 struct PptpEchoReply {
161 __u8 generalErrorCode;
165 /* PptpFramingType */
166 #define PPTP_ASYNC_FRAMING 1
167 #define PPTP_SYNC_FRAMING 2
168 #define PPTP_DONT_CARE_FRAMING 3
170 /* PptpCallBearerType */
171 #define PPTP_ANALOG_TYPE 1
172 #define PPTP_DIGITAL_TYPE 2
173 #define PPTP_DONT_CARE_BEARER_TYPE 3
175 struct PptpOutCallRequest {
177 __be16 callSerialNumber;
183 __be16 packetProcDelay;
184 __be16 phoneNumberLength;
186 __u8 phoneNumber[64];
190 /* PptpCallResultCode */
191 #define PPTP_OUTCALL_CONNECT 1
192 #define PPTP_OUTCALL_GENERAL_ERROR 2
193 #define PPTP_OUTCALL_NO_CARRIER 3
194 #define PPTP_OUTCALL_BUSY 4
195 #define PPTP_OUTCALL_NO_DIAL_TONE 5
196 #define PPTP_OUTCALL_TIMEOUT 6
197 #define PPTP_OUTCALL_DONT_ACCEPT 7
199 struct PptpOutCallReply {
203 __u8 generalErrorCode;
207 __be16 packetProcDelay;
208 __be32 physChannelID;
211 struct PptpInCallRequest {
213 __be16 callSerialNumber;
214 __be32 callBearerType;
215 __be32 physChannelID;
216 __be16 dialedNumberLength;
217 __be16 dialingNumberLength;
218 __u8 dialedNumber[64];
219 __u8 dialingNumber[64];
223 /* PptpInCallResultCode */
224 #define PPTP_INCALL_ACCEPT 1
225 #define PPTP_INCALL_GENERAL_ERROR 2
226 #define PPTP_INCALL_DONT_ACCEPT 3
228 struct PptpInCallReply {
232 __u8 generalErrorCode;
234 __be16 packetProcDelay;
238 struct PptpInCallConnected {
243 __be16 packetProcDelay;
244 __be32 callFramingType;
247 struct PptpClearCallRequest {
252 struct PptpCallDisconnectNotify {
255 __u8 generalErrorCode;
258 __u8 callStatistics[128];
261 struct PptpWanErrorNotify {
265 __be32 framingErrors;
266 __be32 hardwareOverRuns;
267 __be32 bufferOverRuns;
268 __be32 timeoutErrors;
269 __be32 alignmentErrors;
272 struct PptpSetLinkInfo {
279 union pptp_ctrl_union {
280 struct PptpStartSessionRequest sreq;
281 struct PptpStartSessionReply srep;
282 struct PptpStopSessionRequest streq;
283 struct PptpStopSessionReply strep;
284 struct PptpOutCallRequest ocreq;
285 struct PptpOutCallReply ocack;
286 struct PptpInCallRequest icreq;
287 struct PptpInCallReply icack;
288 struct PptpInCallConnected iccon;
289 struct PptpClearCallRequest clrreq;
290 struct PptpCallDisconnectNotify disc;
291 struct PptpWanErrorNotify wanerr;
292 struct PptpSetLinkInfo setlink;
295 /* crap needed for nf_conntrack_compat.h */
297 struct nf_conntrack_expect;
298 enum ip_conntrack_info;
301 (*nf_nat_pptp_hook_outbound)(struct sk_buff **pskb,
302 struct nf_conn *ct, enum ip_conntrack_info ctinfo,
303 struct PptpControlHeader *ctlh,
304 union pptp_ctrl_union *pptpReq);
307 (*nf_nat_pptp_hook_inbound)(struct sk_buff **pskb,
308 struct nf_conn *ct, enum ip_conntrack_info ctinfo,
309 struct PptpControlHeader *ctlh,
310 union pptp_ctrl_union *pptpReq);
313 (*nf_nat_pptp_hook_exp_gre)(struct nf_conntrack_expect *exp_orig,
314 struct nf_conntrack_expect *exp_reply);
317 (*nf_nat_pptp_hook_expectfn)(struct nf_conn *ct,
318 struct nf_conntrack_expect *exp);
320 #endif /* __KERNEL__ */
321 #endif /* _NF_CONNTRACK_PPTP_H */