1 /* PPTP constants and structs */
2 #ifndef _NF_CONNTRACK_PPTP_H
3 #define _NF_CONNTRACK_PPTP_H
5 #include <linux/netfilter/nf_conntrack_common.h>
7 extern const char *const pptp_msg_name[];
9 /* state of the control session */
10 enum pptp_ctrlsess_state {
11 PPTP_SESSION_NONE, /* no session present */
12 PPTP_SESSION_ERROR, /* some session error */
13 PPTP_SESSION_STOPREQ, /* stop_sess request seen */
14 PPTP_SESSION_REQUESTED, /* start_sess request seen */
15 PPTP_SESSION_CONFIRMED, /* session established */
18 /* state of the call inside the control session */
19 enum pptp_ctrlcall_state {
30 /* conntrack private data */
31 struct nf_ct_pptp_master {
32 enum pptp_ctrlsess_state sstate; /* session state */
33 enum pptp_ctrlcall_state cstate; /* call state */
34 __be16 pac_call_id; /* call id of PAC */
35 __be16 pns_call_id; /* call id of PNS */
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 nf_ct_gre_keymap *keymap[IP_CT_DIR_MAX];
43 __be16 pns_call_id; /* NAT'ed PNS call id */
44 __be16 pac_call_id; /* NAT'ed PAC call id */
49 #define PPTP_CONTROL_PORT 1723
51 #define PPTP_PACKET_CONTROL 1
52 #define PPTP_PACKET_MGMT 2
54 #define PPTP_MAGIC_COOKIE 0x1a2b3c4d
62 /* PptpControlMessageType values */
63 #define PPTP_START_SESSION_REQUEST 1
64 #define PPTP_START_SESSION_REPLY 2
65 #define PPTP_STOP_SESSION_REQUEST 3
66 #define PPTP_STOP_SESSION_REPLY 4
67 #define PPTP_ECHO_REQUEST 5
68 #define PPTP_ECHO_REPLY 6
69 #define PPTP_OUT_CALL_REQUEST 7
70 #define PPTP_OUT_CALL_REPLY 8
71 #define PPTP_IN_CALL_REQUEST 9
72 #define PPTP_IN_CALL_REPLY 10
73 #define PPTP_IN_CALL_CONNECT 11
74 #define PPTP_CALL_CLEAR_REQUEST 12
75 #define PPTP_CALL_DISCONNECT_NOTIFY 13
76 #define PPTP_WAN_ERROR_NOTIFY 14
77 #define PPTP_SET_LINK_INFO 15
79 #define PPTP_MSG_MAX 15
81 /* PptpGeneralError values */
82 #define PPTP_ERROR_CODE_NONE 0
83 #define PPTP_NOT_CONNECTED 1
84 #define PPTP_BAD_FORMAT 2
85 #define PPTP_BAD_VALUE 3
86 #define PPTP_NO_RESOURCE 4
87 #define PPTP_BAD_CALLID 5
88 #define PPTP_REMOVE_DEVICE_ERROR 6
90 struct PptpControlHeader {
95 /* FramingCapability Bitmap Values */
96 #define PPTP_FRAME_CAP_ASYNC 0x1
97 #define PPTP_FRAME_CAP_SYNC 0x2
99 /* BearerCapability Bitmap Values */
100 #define PPTP_BEARER_CAP_ANALOG 0x1
101 #define PPTP_BEARER_CAP_DIGITAL 0x2
103 struct PptpStartSessionRequest {
104 __be16 protocolVersion;
106 __be32 framingCapability;
107 __be32 bearerCapability;
109 __be16 firmwareRevision;
111 __u8 vendorString[64];
114 /* PptpStartSessionResultCode Values */
115 #define PPTP_START_OK 1
116 #define PPTP_START_GENERAL_ERROR 2
117 #define PPTP_START_ALREADY_CONNECTED 3
118 #define PPTP_START_NOT_AUTHORIZED 4
119 #define PPTP_START_UNKNOWN_PROTOCOL 5
121 struct PptpStartSessionReply {
122 __be16 protocolVersion;
124 __u8 generalErrorCode;
125 __be32 framingCapability;
126 __be32 bearerCapability;
128 __be16 firmwareRevision;
130 __u8 vendorString[64];
133 /* PptpStopReasons */
134 #define PPTP_STOP_NONE 1
135 #define PPTP_STOP_PROTOCOL 2
136 #define PPTP_STOP_LOCAL_SHUTDOWN 3
138 struct PptpStopSessionRequest {
144 /* PptpStopSessionResultCode */
145 #define PPTP_STOP_OK 1
146 #define PPTP_STOP_GENERAL_ERROR 2
148 struct PptpStopSessionReply {
150 __u8 generalErrorCode;
154 struct PptpEchoRequest {
158 /* PptpEchoReplyResultCode */
159 #define PPTP_ECHO_OK 1
160 #define PPTP_ECHO_GENERAL_ERROR 2
162 struct PptpEchoReply {
165 __u8 generalErrorCode;
169 /* PptpFramingType */
170 #define PPTP_ASYNC_FRAMING 1
171 #define PPTP_SYNC_FRAMING 2
172 #define PPTP_DONT_CARE_FRAMING 3
174 /* PptpCallBearerType */
175 #define PPTP_ANALOG_TYPE 1
176 #define PPTP_DIGITAL_TYPE 2
177 #define PPTP_DONT_CARE_BEARER_TYPE 3
179 struct PptpOutCallRequest {
181 __be16 callSerialNumber;
187 __be16 packetProcDelay;
188 __be16 phoneNumberLength;
190 __u8 phoneNumber[64];
194 /* PptpCallResultCode */
195 #define PPTP_OUTCALL_CONNECT 1
196 #define PPTP_OUTCALL_GENERAL_ERROR 2
197 #define PPTP_OUTCALL_NO_CARRIER 3
198 #define PPTP_OUTCALL_BUSY 4
199 #define PPTP_OUTCALL_NO_DIAL_TONE 5
200 #define PPTP_OUTCALL_TIMEOUT 6
201 #define PPTP_OUTCALL_DONT_ACCEPT 7
203 struct PptpOutCallReply {
207 __u8 generalErrorCode;
211 __be16 packetProcDelay;
212 __be32 physChannelID;
215 struct PptpInCallRequest {
217 __be16 callSerialNumber;
218 __be32 callBearerType;
219 __be32 physChannelID;
220 __be16 dialedNumberLength;
221 __be16 dialingNumberLength;
222 __u8 dialedNumber[64];
223 __u8 dialingNumber[64];
227 /* PptpInCallResultCode */
228 #define PPTP_INCALL_ACCEPT 1
229 #define PPTP_INCALL_GENERAL_ERROR 2
230 #define PPTP_INCALL_DONT_ACCEPT 3
232 struct PptpInCallReply {
236 __u8 generalErrorCode;
238 __be16 packetProcDelay;
242 struct PptpInCallConnected {
247 __be16 packetProcDelay;
248 __be32 callFramingType;
251 struct PptpClearCallRequest {
256 struct PptpCallDisconnectNotify {
259 __u8 generalErrorCode;
262 __u8 callStatistics[128];
265 struct PptpWanErrorNotify {
269 __be32 framingErrors;
270 __be32 hardwareOverRuns;
271 __be32 bufferOverRuns;
272 __be32 timeoutErrors;
273 __be32 alignmentErrors;
276 struct PptpSetLinkInfo {
283 union pptp_ctrl_union {
284 struct PptpStartSessionRequest sreq;
285 struct PptpStartSessionReply srep;
286 struct PptpStopSessionRequest streq;
287 struct PptpStopSessionReply strep;
288 struct PptpOutCallRequest ocreq;
289 struct PptpOutCallReply ocack;
290 struct PptpInCallRequest icreq;
291 struct PptpInCallReply icack;
292 struct PptpInCallConnected iccon;
293 struct PptpClearCallRequest clrreq;
294 struct PptpCallDisconnectNotify disc;
295 struct PptpWanErrorNotify wanerr;
296 struct PptpSetLinkInfo setlink;
299 /* crap needed for nf_conntrack_compat.h */
301 struct nf_conntrack_expect;
304 (*nf_nat_pptp_hook_outbound)(struct sk_buff *skb,
305 struct nf_conn *ct, enum ip_conntrack_info ctinfo,
306 struct PptpControlHeader *ctlh,
307 union pptp_ctrl_union *pptpReq);
310 (*nf_nat_pptp_hook_inbound)(struct sk_buff *skb,
311 struct nf_conn *ct, enum ip_conntrack_info ctinfo,
312 struct PptpControlHeader *ctlh,
313 union pptp_ctrl_union *pptpReq);
316 (*nf_nat_pptp_hook_exp_gre)(struct nf_conntrack_expect *exp_orig,
317 struct nf_conntrack_expect *exp_reply);
320 (*nf_nat_pptp_hook_expectfn)(struct nf_conn *ct,
321 struct nf_conntrack_expect *exp);
323 #endif /* __KERNEL__ */
324 #endif /* _NF_CONNTRACK_PPTP_H */