linux/include/linux/netfilter/nf_conntrack_pptp.h
<<
>>
Prefs
   1/* PPTP constants and structs */
   2#ifndef _NF_CONNTRACK_PPTP_H
   3#define _NF_CONNTRACK_PPTP_H
   4
   5#include <linux/netfilter/nf_conntrack_common.h>
   6
   7extern const char *const pptp_msg_name[];
   8
   9/* state of the control session */
  10enum 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 */
  16};
  17
  18/* state of the call inside the control session */
  19enum pptp_ctrlcall_state {
  20        PPTP_CALL_NONE,
  21        PPTP_CALL_ERROR,
  22        PPTP_CALL_OUT_REQ,
  23        PPTP_CALL_OUT_CONF,
  24        PPTP_CALL_IN_REQ,
  25        PPTP_CALL_IN_REP,
  26        PPTP_CALL_IN_CONF,
  27        PPTP_CALL_CLEAR_REQ,
  28};
  29
  30/* conntrack private data */
  31struct 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 */
  36
  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];
  40};
  41
  42struct nf_nat_pptp {
  43        __be16 pns_call_id;                     /* NAT'ed PNS call id */
  44        __be16 pac_call_id;                     /* NAT'ed PAC call id */
  45};
  46
  47#ifdef __KERNEL__
  48
  49#define PPTP_CONTROL_PORT       1723
  50
  51#define PPTP_PACKET_CONTROL     1
  52#define PPTP_PACKET_MGMT        2
  53
  54#define PPTP_MAGIC_COOKIE       0x1a2b3c4d
  55
  56struct pptp_pkt_hdr {
  57        __u16   packetLength;
  58        __be16  packetType;
  59        __be32  magicCookie;
  60};
  61
  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
  78
  79#define PPTP_MSG_MAX                    15
  80
  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
  89
  90struct PptpControlHeader {
  91        __be16  messageType;
  92        __u16   reserved;
  93};
  94
  95/* FramingCapability Bitmap Values */
  96#define PPTP_FRAME_CAP_ASYNC            0x1
  97#define PPTP_FRAME_CAP_SYNC             0x2
  98
  99/* BearerCapability Bitmap Values */
 100#define PPTP_BEARER_CAP_ANALOG          0x1
 101#define PPTP_BEARER_CAP_DIGITAL         0x2
 102
 103struct PptpStartSessionRequest {
 104        __be16  protocolVersion;
 105        __u16   reserved1;
 106        __be32  framingCapability;
 107        __be32  bearerCapability;
 108        __be16  maxChannels;
 109        __be16  firmwareRevision;
 110        __u8    hostName[64];
 111        __u8    vendorString[64];
 112};
 113
 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
 120
 121struct PptpStartSessionReply {
 122        __be16  protocolVersion;
 123        __u8    resultCode;
 124        __u8    generalErrorCode;
 125        __be32  framingCapability;
 126        __be32  bearerCapability;
 127        __be16  maxChannels;
 128        __be16  firmwareRevision;
 129        __u8    hostName[64];
 130        __u8    vendorString[64];
 131};
 132
 133/* PptpStopReasons */
 134#define PPTP_STOP_NONE                  1
 135#define PPTP_STOP_PROTOCOL              2
 136#define PPTP_STOP_LOCAL_SHUTDOWN        3
 137
 138struct PptpStopSessionRequest {
 139        __u8    reason;
 140        __u8    reserved1;
 141        __u16   reserved2;
 142};
 143
 144/* PptpStopSessionResultCode */
 145#define PPTP_STOP_OK                    1
 146#define PPTP_STOP_GENERAL_ERROR         2
 147
 148struct PptpStopSessionReply {
 149        __u8    resultCode;
 150        __u8    generalErrorCode;
 151        __u16   reserved1;
 152};
 153
 154struct PptpEchoRequest {
 155        __be32 identNumber;
 156};
 157
 158/* PptpEchoReplyResultCode */
 159#define PPTP_ECHO_OK                    1
 160#define PPTP_ECHO_GENERAL_ERROR         2
 161
 162struct PptpEchoReply {
 163        __be32  identNumber;
 164        __u8    resultCode;
 165        __u8    generalErrorCode;
 166        __u16   reserved;
 167};
 168
 169/* PptpFramingType */
 170#define PPTP_ASYNC_FRAMING              1
 171#define PPTP_SYNC_FRAMING               2
 172#define PPTP_DONT_CARE_FRAMING          3
 173
 174/* PptpCallBearerType */
 175#define PPTP_ANALOG_TYPE                1
 176#define PPTP_DIGITAL_TYPE               2
 177#define PPTP_DONT_CARE_BEARER_TYPE      3
 178
 179struct PptpOutCallRequest {
 180        __be16  callID;
 181        __be16  callSerialNumber;
 182        __be32  minBPS;
 183        __be32  maxBPS;
 184        __be32  bearerType;
 185        __be32  framingType;
 186        __be16  packetWindow;
 187        __be16  packetProcDelay;
 188        __be16  phoneNumberLength;
 189        __u16   reserved1;
 190        __u8    phoneNumber[64];
 191        __u8    subAddress[64];
 192};
 193
 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
 202
 203struct PptpOutCallReply {
 204        __be16  callID;
 205        __be16  peersCallID;
 206        __u8    resultCode;
 207        __u8    generalErrorCode;
 208        __be16  causeCode;
 209        __be32  connectSpeed;
 210        __be16  packetWindow;
 211        __be16  packetProcDelay;
 212        __be32  physChannelID;
 213};
 214
 215struct PptpInCallRequest {
 216        __be16  callID;
 217        __be16  callSerialNumber;
 218        __be32  callBearerType;
 219        __be32  physChannelID;
 220        __be16  dialedNumberLength;
 221        __be16  dialingNumberLength;
 222        __u8    dialedNumber[64];
 223        __u8    dialingNumber[64];
 224        __u8    subAddress[64];
 225};
 226
 227/* PptpInCallResultCode */
 228#define PPTP_INCALL_ACCEPT              1
 229#define PPTP_INCALL_GENERAL_ERROR       2
 230#define PPTP_INCALL_DONT_ACCEPT         3
 231
 232struct PptpInCallReply {
 233        __be16  callID;
 234        __be16  peersCallID;
 235        __u8    resultCode;
 236        __u8    generalErrorCode;
 237        __be16  packetWindow;
 238        __be16  packetProcDelay;
 239        __u16   reserved;
 240};
 241
 242struct PptpInCallConnected {
 243        __be16  peersCallID;
 244        __u16   reserved;
 245        __be32  connectSpeed;
 246        __be16  packetWindow;
 247        __be16  packetProcDelay;
 248        __be32  callFramingType;
 249};
 250
 251struct PptpClearCallRequest {
 252        __be16  callID;
 253        __u16   reserved;
 254};
 255
 256struct PptpCallDisconnectNotify {
 257        __be16  callID;
 258        __u8    resultCode;
 259        __u8    generalErrorCode;
 260        __be16  causeCode;
 261        __u16   reserved;
 262        __u8    callStatistics[128];
 263};
 264
 265struct PptpWanErrorNotify {
 266        __be16  peersCallID;
 267        __u16   reserved;
 268        __be32  crcErrors;
 269        __be32  framingErrors;
 270        __be32  hardwareOverRuns;
 271        __be32  bufferOverRuns;
 272        __be32  timeoutErrors;
 273        __be32  alignmentErrors;
 274};
 275
 276struct PptpSetLinkInfo {
 277        __be16  peersCallID;
 278        __u16   reserved;
 279        __be32  sendAccm;
 280        __be32  recvAccm;
 281};
 282
 283union 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;
 297};
 298
 299/* crap needed for nf_conntrack_compat.h */
 300struct nf_conn;
 301struct nf_conntrack_expect;
 302
 303extern int
 304(*nf_nat_pptp_hook_outbound)(struct sk_buff *skb,
 305                             struct nf_conn *ct, enum ip_conntrack_info ctinfo,
 306                             unsigned int protoff,
 307                             struct PptpControlHeader *ctlh,
 308                             union pptp_ctrl_union *pptpReq);
 309
 310extern int
 311(*nf_nat_pptp_hook_inbound)(struct sk_buff *skb,
 312                            struct nf_conn *ct, enum ip_conntrack_info ctinfo,
 313                            unsigned int protoff,
 314                            struct PptpControlHeader *ctlh,
 315                            union pptp_ctrl_union *pptpReq);
 316
 317extern void
 318(*nf_nat_pptp_hook_exp_gre)(struct nf_conntrack_expect *exp_orig,
 319                            struct nf_conntrack_expect *exp_reply);
 320
 321extern void
 322(*nf_nat_pptp_hook_expectfn)(struct nf_conn *ct,
 323                             struct nf_conntrack_expect *exp);
 324
 325#endif /* __KERNEL__ */
 326#endif /* _NF_CONNTRACK_PPTP_H */
 327