Annotation of embedaddon/libpdel/ppp/ppp_pptp_ctrl_defs.h, revision 1.1

1.1     ! misho       1: 
        !             2: /*
        !             3:  * Copyright (c) 1995-1999 Whistle Communications, Inc.
        !             4:  * All rights reserved.
        !             5:  * 
        !             6:  * Subject to the following obligations and disclaimer of warranty,
        !             7:  * use and redistribution of this software, in source or object code
        !             8:  * forms, with or without modifications are expressly permitted by
        !             9:  * Whistle Communications; provided, however, that:   (i) any and
        !            10:  * all reproductions of the source or object code must include the
        !            11:  * copyright notice above and the following disclaimer of warranties;
        !            12:  * and (ii) no rights are granted, in any manner or form, to use
        !            13:  * Whistle Communications, Inc. trademarks, including the mark "WHISTLE
        !            14:  * COMMUNICATIONS" on advertising, endorsements, or otherwise except
        !            15:  * as such appears in the above copyright notice or in the software.
        !            16:  * 
        !            17:  * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS",
        !            18:  * AND TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS
        !            19:  * MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
        !            20:  * REGARDING THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY AND
        !            21:  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
        !            22:  * PURPOSE, OR NON-INFRINGEMENT.  WHISTLE COMMUNICATIONS DOES NOT
        !            23:  * WARRANT, GUARANTEE, OR MAKE ANY REPRESENTATIONS REGARDING THE USE
        !            24:  * OF, OR THE RESULTS OF THE USE OF THIS SOFTWARE IN TERMS OF ITS
        !            25:  * CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.  IN NO EVENT
        !            26:  * SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES RESULTING
        !            27:  * FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING WITHOUT
        !            28:  * LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
        !            29:  * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE
        !            30:  * GOODS OR SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED
        !            31:  * AND UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            32:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
        !            33:  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS
        !            34:  * IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        !            35:  *
        !            36:  * Author: <archie@freebsd.org>
        !            37:  */
        !            38: 
        !            39: #ifndef _WANT_PPTP_FIELDS
        !            40: 
        !            41: /*
        !            42:  * DEFINITIONS
        !            43:  */
        !            44: 
        !            45: /* Definitions per the spec */
        !            46: #define PPTP_PORT              1723
        !            47: #define PPTP_MTU               1532
        !            48: #define PPTP_PROTO_VERS                0x0100
        !            49: #define PPTP_MAGIC             0x1a2b3c4d
        !            50: #define PPTP_IDLE_TIMEOUT      60
        !            51: 
        !            52: #define PPTP_HOSTNAME_LEN      64
        !            53: #define PPTP_VENDOR_LEN                64
        !            54: #define PPTP_PHONE_LEN         64
        !            55: #define PPTP_SUBADDR_LEN       64
        !            56: #define PPTP_STATS_LEN         128
        !            57: 
        !            58: /* Control message header type */
        !            59: #define PPTP_CTRL_MSG_TYPE     1
        !            60: 
        !            61: /* Control messages */
        !            62: enum {
        !            63:        PPTP_StartCtrlConnRequest = 1,
        !            64:        PPTP_StartCtrlConnReply = 2,
        !            65:        PPTP_StopCtrlConnRequest = 3,
        !            66:        PPTP_StopCtrlConnReply = 4,
        !            67:        PPTP_EchoRequest = 5,
        !            68:        PPTP_EchoReply = 6,
        !            69:        PPTP_OutCallRequest = 7,
        !            70:        PPTP_OutCallReply = 8,
        !            71:        PPTP_InCallRequest = 9,
        !            72:        PPTP_InCallReply = 10,
        !            73:        PPTP_InCallConn = 11,
        !            74:        PPTP_CallClearRequest = 12,
        !            75:        PPTP_CallDiscNotify = 13,
        !            76:        PPTP_WanErrorNotify = 14,
        !            77:        PPTP_SetLinkInfo = 15,
        !            78: };
        !            79: 
        !            80: #define PPTP_MIN_CTRL_TYPE             1
        !            81: #define PPTP_MAX_CTRL_TYPE             16
        !            82: 
        !            83: #define PPTP_VALID_CTRL_TYPE(x)        \
        !            84:        ((x) >= PPTP_MIN_CTRL_TYPE && (x) < PPTP_MAX_CTRL_TYPE)
        !            85: 
        !            86: /* Framing capabilities */
        !            87: #define PPTP_FRAMECAP_ASYNC            0x01
        !            88: #define PPTP_FRAMECAP_SYNC             0x02
        !            89: #define PPTP_FRAMECAP_ANY              0x03
        !            90: 
        !            91: /* Bearer capabilities */
        !            92: #define PPTP_BEARCAP_ANALOG            0x01
        !            93: #define PPTP_BEARCAP_DIGITAL           0x02
        !            94: #define PPTP_BEARCAP_ANY               0x03
        !            95: 
        !            96: /* General error codes */
        !            97: #define PPTP_ERROR_NONE                        0
        !            98: #define PPTP_ERROR_NOT_CONNECTED       1
        !            99: #define PPTP_ERROR_BAD_FORMAT          2
        !           100: #define PPTP_ERROR_BAD_VALUE           3
        !           101: #define PPTP_ERROR_NO_RESOURCE         4
        !           102: #define PPTP_ERROR_BAD_CALL_ID         5
        !           103: #define PPTP_ERROR_PAC_ERROR           6
        !           104: 
        !           105: /* All reserved fields have this prefix */
        !           106: #define PPTP_RESV_PREF                 "resv"
        !           107: 
        !           108: /* Message structures */
        !           109: struct pptpMsgHead {
        !           110:        u_int16_t       length;                 /* total length */
        !           111:        u_int16_t       msgType;                /* pptp message type */
        !           112:        u_int32_t       magic;                  /* magic cookie */
        !           113:        u_int16_t       type;                   /* control message type */
        !           114:        u_int16_t       resv0;                  /* reserved */
        !           115: };
        !           116: typedef struct pptpMsgHead *PptpMsgHead;
        !           117: 
        !           118: #else
        !           119:   { { "len", 2 }, { "msgType", 2 }, { "magic", 4 }, { "type", 2 },
        !           120:     { PPTP_RESV_PREF "0", 2 }, { NULL, 0 } },
        !           121: #endif
        !           122: #ifndef _WANT_PPTP_FIELDS
        !           123: 
        !           124: struct pptpStartCtrlConnRequest {
        !           125:        u_int16_t       vers;                   /* protocol version */
        !           126:        u_int16_t       resv0;                  /* reserved */
        !           127:        u_int32_t       frameCap;               /* framing capabilities */
        !           128:        u_int32_t       bearCap;                /* bearer capabilities */
        !           129:        u_int16_t       maxChan;                /* maximum # channels */
        !           130:        u_int16_t       firmware;               /* firmware revision */
        !           131:        char            host[PPTP_HOSTNAME_LEN];        /* host name */
        !           132:        char            vendor[PPTP_VENDOR_LEN];        /* vendor name */
        !           133: };
        !           134: 
        !           135: #else
        !           136:   { { "vers", 2 }, { PPTP_RESV_PREF "0", 2 }, { "frameCap", 4 },
        !           137:     { "bearCap", 4 }, { "maxChan", 2 }, { "firm", 2 },
        !           138:     { "host", PPTP_HOSTNAME_LEN }, { "vend", PPTP_VENDOR_LEN }, { NULL, 0 } },
        !           139: #endif
        !           140: #ifndef _WANT_PPTP_FIELDS
        !           141: 
        !           142: struct pptpStartCtrlConnReply {
        !           143:        u_int16_t       vers;                   /* protocol version */
        !           144:        u_int8_t        result;                 /* result code */
        !           145:        u_int8_t        err;                    /* error code */
        !           146:        u_int32_t       frameCap;               /* framing capabilities */
        !           147:        u_int32_t       bearCap;                /* bearer capabilities */
        !           148:        u_int16_t       maxChan;                /* maximum # channels */
        !           149:        u_int16_t       firmware;               /* firmware revision */
        !           150:        char            host[PPTP_HOSTNAME_LEN];        /* host name */
        !           151:        char            vendor[PPTP_VENDOR_LEN];        /* vendor name */
        !           152: };
        !           153: 
        !           154: #else
        !           155:   { { "vers", 2 }, { "result", 1 }, { "err", 1 }, { "frameCap", 4 },
        !           156:     { "bearCap", 4 }, { "maxChan", 2 }, { "firm", 2 },
        !           157:     { "host", PPTP_HOSTNAME_LEN }, { "vend", PPTP_VENDOR_LEN }, { NULL, 0 } },
        !           158: #endif
        !           159: #ifndef _WANT_PPTP_FIELDS
        !           160: 
        !           161: #define PPTP_SCCR_RESL_OK              1       /* channel established */
        !           162: #define PPTP_SCCR_RESL_ERR             2       /* general error; see code */
        !           163: #define PPTP_SCCR_RESL_EXISTS          3       /* command channel exists */
        !           164: #define PPTP_SCCR_RESL_AUTH            4       /* not authorized */
        !           165: #define PPTP_SCCR_RESL_VERS            5       /* incompatible version */
        !           166: 
        !           167: struct pptpStopCtrlConnRequest {
        !           168:        u_int8_t        reason;                 /* reason */
        !           169:        u_int8_t        resv0;                  /* reserved */
        !           170:        u_int16_t       resv1;                  /* reserved */
        !           171: };
        !           172: 
        !           173: #else
        !           174:   { { "reason", 1 }, { PPTP_RESV_PREF "0", 1 }, { PPTP_RESV_PREF "1", 2 },
        !           175:     { NULL, 0 } },
        !           176: #endif
        !           177: #ifndef _WANT_PPTP_FIELDS
        !           178: 
        !           179: #define PPTP_SCCR_REAS_NONE            1       /* general */
        !           180: #define PPTP_SCCR_REAS_PROTO           2       /* incompatible version */
        !           181: #define PPTP_SCCR_REAS_LOCAL           3       /* local shutdown */
        !           182: 
        !           183: struct pptpStopCtrlConnReply {
        !           184:        u_int8_t        result;                 /* result code */
        !           185:        u_int8_t        err;                    /* error code */
        !           186:        u_int16_t       resv0;                  /* reserved */
        !           187: };
        !           188: 
        !           189: #else
        !           190:   { { "result", 1 }, { "err", 1 }, { PPTP_RESV_PREF "0", 2 }, { NULL, 0 } },
        !           191: #endif
        !           192: #ifndef _WANT_PPTP_FIELDS
        !           193: 
        !           194: struct pptpEchoRequest {
        !           195:        u_int32_t       id;                     /* identifier */
        !           196: };
        !           197: 
        !           198: #else
        !           199:   { { "id", 4 }, { NULL, 0 } },
        !           200: #endif
        !           201: #ifndef _WANT_PPTP_FIELDS
        !           202: 
        !           203: struct pptpEchoReply {
        !           204:        u_int32_t       id;                     /* identifier */
        !           205:        u_int8_t        result;                 /* result code */
        !           206:        u_int8_t        err;                    /* error code */
        !           207:        u_int16_t       resv0;                  /* reserved */
        !           208: };
        !           209: 
        !           210: #else
        !           211:   { { "id", 4 }, { "result", 1 }, { "err", 1 },
        !           212:     { "ignore", 2 }, { NULL, 0 } },
        !           213: #endif
        !           214: #ifndef _WANT_PPTP_FIELDS
        !           215: 
        !           216: #define PPTP_ECHO_RESL_OK              1       /* echo reply is valid */
        !           217: #define PPTP_ECHO_RESL_ERR             2       /* general error; see code */
        !           218: 
        !           219: struct pptpOutCallRequest {
        !           220:        u_int16_t       cid;                    /* call id */
        !           221:        u_int16_t       serno;                  /* call serial # */
        !           222:        u_int32_t       minBps;                 /* minimum BPS */
        !           223:        u_int32_t       maxBps;                 /* maximum BPS */
        !           224:        u_int32_t       frameType;              /* framing type */
        !           225:        u_int32_t       bearType;               /* bearer type */
        !           226:        u_int16_t       recvWin;                /* pkt receive window size */
        !           227:        u_int16_t       ppd;                    /* pkt processing delay */
        !           228:        u_int16_t       numLen;                 /* phone number length */
        !           229:        u_int16_t       resv0;                  /* reserved */
        !           230:        char            phone[PPTP_PHONE_LEN];          /* phone number */
        !           231:        char            subaddr[PPTP_SUBADDR_LEN];      /* sub-address */
        !           232: };
        !           233: 
        !           234: #else
        !           235:   { { "cid", 2 }, { "serno", 2 }, { "minBPS", 4 }, { "maxBPS", 4 },
        !           236:     { "frameType", 4 }, { "bearType", 4 }, { "recvWin", 2 }, { "ppd", 2 },
        !           237:     { "numLen", 2 }, { PPTP_RESV_PREF "0", 2 },
        !           238:     { "phone", PPTP_PHONE_LEN }, { "subaddr", PPTP_SUBADDR_LEN },
        !           239:     { NULL, 0 } },
        !           240: #endif
        !           241: #ifndef _WANT_PPTP_FIELDS
        !           242: 
        !           243: struct pptpOutCallReply {
        !           244:        u_int16_t       cid;                    /* call id */
        !           245:        u_int16_t       peerCid;                /* peer call id */
        !           246:        u_int8_t        result;                 /* result code */
        !           247:        u_int8_t        err;                    /* error code */
        !           248:        u_int16_t       cause;                  /* cause code */
        !           249:        u_int32_t       speed;                  /* cause code */
        !           250:        u_int16_t       recvWin;                /* pkt receive window size */
        !           251:        u_int16_t       ppd;                    /* pkt processing delay */
        !           252:        u_int32_t       channel;                /* physical channel id */
        !           253: };
        !           254: 
        !           255: #else
        !           256:   { { "cid", 2 }, { "peerCid", 2 }, { "result", 1 }, { "err", 1 },
        !           257:     { "cause", 2 }, { "speed", 4 }, { "recvWin", 2 }, { "ppd", 2 },
        !           258:     { "channel", 4 }, { NULL, 0 } },
        !           259: #endif
        !           260: #ifndef _WANT_PPTP_FIELDS
        !           261: 
        !           262: #define PPTP_OCR_RESL_OK               1       /* call established OK */
        !           263: #define PPTP_OCR_RESL_ERR              2       /* general error; see code */
        !           264: #define PPTP_OCR_RESL_NOCARR           3       /* no carrier */
        !           265: #define PPTP_OCR_RESL_BUSY             4       /* busy */
        !           266: #define PPTP_OCR_RESL_NODIAL           5       /* no dialtone */
        !           267: #define PPTP_OCR_RESL_TIMED            6       /* timed out */
        !           268: #define PPTP_OCR_RESL_ADMIN            7       /* administratvely prohibited */
        !           269: 
        !           270: struct pptpInCallRequest {
        !           271:        u_int16_t       cid;                    /* call id */
        !           272:        u_int16_t       serno;                  /* call serial # */
        !           273:        u_int32_t       bearType;               /* bearer type */
        !           274:        u_int32_t       channel;                /* physical channel id */
        !           275:        u_int16_t       dialedLen;              /* dialed number len */
        !           276:        u_int16_t       dialingLen;             /* dialing number len */
        !           277:        char            dialed[PPTP_PHONE_LEN];         /* dialed number */
        !           278:        char            dialing[PPTP_PHONE_LEN];        /* dialing number */
        !           279:        char            subaddr[PPTP_SUBADDR_LEN];      /* sub-address */
        !           280: };
        !           281: 
        !           282: #else
        !           283:   { { "cid", 2 }, { "serno", 2 }, { "bearType", 4 }, { "channel", 4 },
        !           284:     { "dialedLen", 2 }, { "dialingLen", 2 }, { "dialed", PPTP_PHONE_LEN },
        !           285:     { "dialing", PPTP_PHONE_LEN }, { "subaddr", PPTP_SUBADDR_LEN },
        !           286:     { NULL, 0 } },
        !           287: #endif
        !           288: #ifndef _WANT_PPTP_FIELDS
        !           289: 
        !           290: struct pptpInCallReply {
        !           291:        u_int16_t       cid;                    /* call id */
        !           292:        u_int16_t       peerCid;                /* peer call id */
        !           293:        u_int8_t        result;                 /* result code */
        !           294:        u_int8_t        err;                    /* error code */
        !           295:        u_int16_t       recvWin;                /* pkt receive window size */
        !           296:        u_int16_t       ppd;                    /* pkt processing delay */
        !           297:        u_int16_t       resv0;                  /* reserved */
        !           298: };
        !           299: 
        !           300: #else
        !           301:   { { "cid", 2 }, { "peerCid", 2 }, { "result", 1 }, { "err", 1 },
        !           302:     { "recvWin", 2 }, { "ppd", 2 }, { PPTP_RESV_PREF "0", 2 },
        !           303:     { NULL, 0 } },
        !           304: #endif
        !           305: #ifndef _WANT_PPTP_FIELDS
        !           306: 
        !           307: #define PPTP_ICR_RESL_OK               1       /* call established OK */
        !           308: #define PPTP_ICR_RESL_ERR              2       /* general error; see code */
        !           309: #define PPTP_ICR_RESL_NAK              3       /* do not accept */
        !           310: 
        !           311: struct pptpInCallConn {
        !           312:        u_int16_t       peerCid;                /* peer call id */
        !           313:        u_int16_t       resv0;                  /* reserved */
        !           314:        u_int32_t       speed;                  /* connect speed */
        !           315:        u_int16_t       recvWin;                /* pkt receive window size */
        !           316:        u_int16_t       ppd;                    /* pkt processing delay */
        !           317:        u_int32_t       frameType;              /* framing type */
        !           318: };
        !           319: 
        !           320: #else
        !           321:   { { "peerCid", 2 }, { PPTP_RESV_PREF "0", 2 }, { "speed", 4 },
        !           322:     { "recvWin", 2 }, { "ppd", 2 }, { "frameType", 4 }, { NULL, 0 } },
        !           323: #endif
        !           324: #ifndef _WANT_PPTP_FIELDS
        !           325: 
        !           326: struct pptpCallClearRequest {
        !           327:        u_int16_t       cid;                    /* pns assigned call id */
        !           328:        u_int16_t       resv0;                  /* reserved */
        !           329: };
        !           330: 
        !           331: #else
        !           332:   { { "cid", 2 }, { PPTP_RESV_PREF "0", 2 }, { NULL, 0 } },
        !           333: #endif
        !           334: #ifndef _WANT_PPTP_FIELDS
        !           335: 
        !           336: struct pptpCallDiscNotify {
        !           337:        u_int16_t       cid;                    /* pac assigned call id */
        !           338:        u_int8_t        result;                 /* result code */
        !           339:        u_int8_t        err;                    /* error code */
        !           340:        u_int16_t       cause;                  /* cause code */
        !           341:        u_int16_t       resv0;                  /* reserved */
        !           342:        char            stats[PPTP_STATS_LEN];  /* call stats */
        !           343: };
        !           344: 
        !           345: #else
        !           346:   { { "cid", 2 }, { "result", 1 }, { "err", 1 }, { "cause", 2 },
        !           347:     { PPTP_RESV_PREF "0", 2 }, { "stats", PPTP_STATS_LEN },
        !           348:     { NULL, 0 } },
        !           349: #endif
        !           350: #ifndef _WANT_PPTP_FIELDS
        !           351: 
        !           352: #define PPTP_CDN_RESL_CARR             1       /* lost carrier */
        !           353: #define PPTP_CDN_RESL_ERR              2       /* general error; see code */
        !           354: #define PPTP_CDN_RESL_ADMIN            3       /* administrative reason */
        !           355: #define PPTP_CDN_RESL_REQ              4       /* received disconnect req. */
        !           356: 
        !           357: struct pptpWanErrorNotify {
        !           358:        u_int16_t       cid;                    /* pns assigned call id */
        !           359:        u_int16_t       resv0;                  /* reserved */
        !           360:        u_int32_t       crc;                    /* crc errors */
        !           361:        u_int32_t       frame;                  /* framing errors */
        !           362:        u_int32_t       hdw;                    /* hardware errors */
        !           363:        u_int32_t       ovfl;                   /* buffer overrun errors */
        !           364:        u_int32_t       timeout;                /* timeout errors */
        !           365:        u_int32_t       align;                  /* alignment errors */
        !           366: };
        !           367: 
        !           368: #else
        !           369:   { { "cid", 2 }, { PPTP_RESV_PREF "0", 2 }, { "crc", 4 },
        !           370:     { "frame", 4 }, { "hdw", 4 }, { "ovfl", 4 }, { "timeout", 4 },
        !           371:     { "align", 4 }, { NULL, 0 } },
        !           372: #endif
        !           373: #ifndef _WANT_PPTP_FIELDS
        !           374: 
        !           375: struct pptpSetLinkInfo {
        !           376:        u_int16_t       cid;                    /* call id */
        !           377:        u_int16_t       resv0;                  /* reserved */
        !           378:        u_int32_t       sendAccm;               /* send accm */
        !           379:        u_int32_t       recvAccm;               /* receive accm */
        !           380: };
        !           381: 
        !           382: #else
        !           383:   { { "cid", 2 }, { PPTP_RESV_PREF "0", 2 }, { "sendAccm", 4 },
        !           384:     { "recvAccm", 4 }, { NULL, 0 } },
        !           385: #endif
        !           386: #ifndef _WANT_PPTP_FIELDS
        !           387: 
        !           388: #define PPTP_CTRL_MAX_FRAME \
        !           389:        (sizeof(struct pptpMsgHead) + sizeof(struct pptpInCallRequest))
        !           390: #define PPTP_CTRL_MAX_FIELDS           14
        !           391: 
        !           392: /* Describes one field of a PPTP control message structure */
        !           393: struct pptpfield {
        !           394:        const char      *name;
        !           395:        u_short         length;
        !           396: };
        !           397: typedef const  struct pptpfield *PptpField;
        !           398: 
        !           399: #endif
        !           400: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>