Annotation of embedaddon/libpdel/ppp/ppp_l2tp_avp.h, revision 1.1
1.1 ! misho 1:
! 2: /*
! 3: * Copyright (c) 2001-2002 Packet Design, LLC.
! 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: * Packet Design; provided, however, that:
! 10: *
! 11: * (i) Any and all reproductions of the source or object code
! 12: * must include the copyright notice above and the following
! 13: * disclaimer of warranties; and
! 14: * (ii) No rights are granted, in any manner or form, to use
! 15: * Packet Design trademarks, including the mark "PACKET DESIGN"
! 16: * on advertising, endorsements, or otherwise except as such
! 17: * appears in the above copyright notice or in the software.
! 18: *
! 19: * THIS SOFTWARE IS BEING PROVIDED BY PACKET DESIGN "AS IS", AND
! 20: * TO THE MAXIMUM EXTENT PERMITTED BY LAW, PACKET DESIGN MAKES NO
! 21: * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING
! 22: * THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED
! 23: * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
! 24: * OR NON-INFRINGEMENT. PACKET DESIGN DOES NOT WARRANT, GUARANTEE,
! 25: * OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS
! 26: * OF THE USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY,
! 27: * RELIABILITY OR OTHERWISE. IN NO EVENT SHALL PACKET DESIGN BE
! 28: * LIABLE FOR ANY DAMAGES RESULTING FROM OR ARISING OUT OF ANY USE
! 29: * OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY DIRECT,
! 30: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL
! 31: * DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF
! 32: * USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY THEORY OF
! 33: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
! 34: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
! 35: * THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
! 36: * THE POSSIBILITY OF SUCH DAMAGE.
! 37: *
! 38: * Author: Archie Cobbs <archie@freebsd.org>
! 39: */
! 40:
! 41: #ifndef _PPP_L2TP_PDEL_PPP_PPP_L2TP_AVP_H_
! 42: #define _PPP_L2TP_PDEL_PPP_PPP_L2TP_AVP_H_
! 43:
! 44: /***********************************************************************
! 45: AVP STRUCTURE DEFINITIONS
! 46: ***********************************************************************/
! 47:
! 48: /* Constants defined in RFC 2661 */
! 49: #define L2TP_PROTO_VERS 1
! 50: #define L2TP_PROTO_REV 0
! 51: #define L2TP_DEFAULT_PEER_WIN 4
! 52: #define L2TP_BEARER_DIGITAL 0x00000001
! 53: #define L2TP_BEARER_ANALOG 0x00000002
! 54: #define L2TP_FRAMING_SYNC 0x00000001
! 55: #define L2TP_FRAMING_ASYNC 0x00000002
! 56:
! 57: #define AVP_MANDATORY 0x8000
! 58: #define AVP_HIDDEN 0x4000
! 59: #define AVP_RESERVED 0x3c00
! 60: #define AVP_LENGTH_MASK 0x03ff
! 61: #define AVP_MAX_LENGTH 1023
! 62: #define AVP_MAX_VLEN (AVP_MAX_LENGTH - 6)
! 63:
! 64: struct ppp_l2tp_avp_info;
! 65: struct ppp_l2tp_avp;
! 66:
! 67: /* AVP decoder function type */
! 68: typedef void ppp_l2tp_avp_decode_t(const struct ppp_l2tp_avp_info *info,
! 69: const struct ppp_l2tp_avp *avp, char *buf, size_t bmax);
! 70:
! 71: /* Structure describing one AVP type */
! 72: struct ppp_l2tp_avp_info {
! 73: const char *name; /* textual name */
! 74: ppp_l2tp_avp_decode_t *decode; /* decode contents */
! 75: u_int16_t vendor; /* vendor id */
! 76: u_int16_t type; /* attribute type */
! 77: u_char hidden_ok; /* avp allowed to be hidden */
! 78: u_char mandatory; /* set mandatory bit (xmit) */
! 79: u_int16_t min_length; /* minimum length of value */
! 80: u_int16_t max_length; /* maximum length of value */
! 81: };
! 82:
! 83: /* Structure describing one AVP */
! 84: struct ppp_l2tp_avp {
! 85: u_char mandatory; /* mandatory bit */
! 86: u_int16_t vendor; /* vendor id */
! 87: u_int16_t type; /* attribute type */
! 88: u_int16_t vlen; /* length of attribute value */
! 89: void *value; /* attribute value */
! 90: };
! 91:
! 92: /* Structure describing a list of AVP's */
! 93: struct ppp_l2tp_avp_list {
! 94: u_int length; /* length of list */
! 95: struct ppp_l2tp_avp *avps; /* array of avps in list */
! 96: };
! 97:
! 98: /* Individual AVP structures */
! 99: struct messagetype_avp {
! 100: u_int16_t mesgtype;
! 101: };
! 102:
! 103: struct codesresulterror_avp {
! 104: u_int16_t result;
! 105: u_int16_t error;
! 106: char errmsg[0];
! 107: };
! 108:
! 109: struct protoversion_avp {
! 110: u_int8_t version;
! 111: u_int8_t revision;
! 112: };
! 113:
! 114: struct framecap_avp {
! 115: u_char async;
! 116: u_char sync;
! 117: };
! 118:
! 119: struct bearercap_avp {
! 120: u_char analog;
! 121: u_char digital;
! 122: };
! 123:
! 124: struct tiebreaker_avp {
! 125: u_char value[8];
! 126: };
! 127:
! 128: struct firmware_avp {
! 129: u_int16_t revision;
! 130: };
! 131:
! 132: struct hostname_avp {
! 133: char hostname[0];
! 134: };
! 135:
! 136: struct vendorname_avp {
! 137: char vendorname[0];
! 138: };
! 139:
! 140: struct tunnelid_avp {
! 141: u_int16_t id;
! 142: };
! 143:
! 144: struct sessionid_avp {
! 145: u_int16_t id;
! 146: };
! 147:
! 148: struct windowsize_avp {
! 149: u_int16_t size;
! 150: };
! 151:
! 152: struct challenge_avp {
! 153: u_int length;
! 154: u_char value[0];
! 155: };
! 156:
! 157: struct challengeresp_avp {
! 158: u_char value[16];
! 159: };
! 160:
! 161: struct causecode_avp {
! 162: u_int16_t causecode;
! 163: u_int8_t causemsg;
! 164: char message[0];
! 165: };
! 166:
! 167: struct serialnum_avp {
! 168: u_int32_t serialnum;
! 169: };
! 170:
! 171: struct minbps_avp {
! 172: u_int32_t minbps;
! 173: };
! 174:
! 175: struct maxbps_avp {
! 176: u_int32_t maxbps;
! 177: };
! 178:
! 179: struct bearer_avp {
! 180: u_char analog;
! 181: u_char digital;
! 182: };
! 183:
! 184: struct framing_avp {
! 185: u_char async;
! 186: u_char sync;
! 187: };
! 188:
! 189: struct callednum_avp {
! 190: char number[0];
! 191: };
! 192:
! 193: struct callingnum_avp {
! 194: char number[0];
! 195: };
! 196:
! 197: struct subaddress_avp {
! 198: char number[0];
! 199: };
! 200:
! 201: struct txconnect_avp {
! 202: u_int32_t bps;
! 203: };
! 204:
! 205: struct rxconnect_avp {
! 206: u_int32_t bps;
! 207: };
! 208:
! 209: struct channelid_avp {
! 210: u_int32_t channel;
! 211: };
! 212:
! 213: struct groupid_avp {
! 214: u_int length;
! 215: u_char data[0];
! 216: };
! 217:
! 218: struct recvlcp_avp {
! 219: u_int length;
! 220: u_char data[0];
! 221: };
! 222:
! 223: struct lastsentlcp_avp {
! 224: u_int length;
! 225: u_char data[0];
! 226: };
! 227:
! 228: struct lastrecvlcp_avp {
! 229: u_int length;
! 230: u_char data[0];
! 231: };
! 232:
! 233: struct proxyauth_avp {
! 234: u_int16_t type;
! 235: };
! 236:
! 237: struct proxyname_avp {
! 238: u_int length;
! 239: u_char data[0];
! 240: };
! 241:
! 242: struct proxychallenge_avp {
! 243: u_int length;
! 244: u_char data[0];
! 245: };
! 246:
! 247: struct proxyid_avp {
! 248: u_int16_t id;
! 249: };
! 250:
! 251: struct proxyresp_avp {
! 252: u_int length;
! 253: u_char data[0];
! 254: };
! 255:
! 256: struct callerror_avp {
! 257: u_int32_t crc;
! 258: u_int32_t frame;
! 259: u_int32_t overrun;
! 260: u_int32_t buffer;
! 261: u_int32_t timeout;
! 262: u_int32_t alignment;
! 263: };
! 264:
! 265: struct accm_avp {
! 266: u_int32_t xmit;
! 267: u_int32_t recv;
! 268: };
! 269:
! 270: struct seqrequired_avp {
! 271: };
! 272:
! 273: /*
! 274: * This structure describes a suite of AVPs in host-friendly format.
! 275: * Typically only a sub-set of the AVPs listed will be used.
! 276: */
! 277: struct ppp_l2tp_avp_ptrs {
! 278: struct messagetype_avp *message;
! 279: struct codesresulterror_avp *errresultcode;
! 280: struct protoversion_avp *protocol;
! 281: struct framecap_avp *framingcap;
! 282: struct bearercap_avp *bearercap;
! 283: struct tiebreaker_avp *tiebreaker;
! 284: struct firmware_avp *firmware;
! 285: struct hostname_avp *hostname;
! 286: struct vendorname_avp *vendor;
! 287: struct tunnelid_avp *tunnelid;
! 288: struct sessionid_avp *sessionid;
! 289: struct windowsize_avp *winsize;
! 290: struct challenge_avp *challenge;
! 291: struct challengeresp_avp *challengresp;
! 292: struct causecode_avp *causecode;
! 293: struct serialnum_avp *serialnum;
! 294: struct minbps_avp *minbps;
! 295: struct maxbps_avp *maxbps;
! 296: struct bearer_avp *bearer;
! 297: struct framing_avp *framing;
! 298: struct callednum_avp *callednum;
! 299: struct callingnum_avp *callingnum;
! 300: struct subaddress_avp *subaddress;
! 301: struct txconnect_avp *txconnect;
! 302: struct rxconnect_avp *rxconnect;
! 303: struct channelid_avp *channelid;
! 304: struct groupid_avp *groupid;
! 305: struct recvlcp_avp *recvlcp;
! 306: struct lastsentlcp_avp *lastsendlcp;
! 307: struct lastrecvlcp_avp *lastrecvlcp;
! 308: struct proxyauth_avp *proxyauth;
! 309: struct proxyname_avp *proxyname;
! 310: struct proxychallenge_avp *proxychallenge;
! 311: struct proxyid_avp *proxyid;
! 312: struct proxyresp_avp *proxyres;
! 313: struct callerror_avp *callerror;
! 314: struct accm_avp *accm;
! 315: struct seqrequired_avp *seqrequired;
! 316: };
! 317:
! 318: /* L2TP result codes for StopCCN messages */
! 319: #define L2TP_RESULT_CLEARED 1 /* general reqst. to clear connection */
! 320: #define L2TP_RESULT_ERROR 2 /* general error: see error code */
! 321: #define L2TP_RESULT_DUP_CTRL 3 /* dupliate control channel */
! 322: #define L2TP_RESULT_NOT_AUTH 4 /* control channel not authorized */
! 323: #define L2TP_RESULT_PROTO_VERS 5 /* unsupported protocol: max=err code */
! 324: #define L2TP_RESULT_SHUTDOWN 6 /* being shut down */
! 325: #define L2TP_RESULT_FSM 7 /* fsm error */
! 326:
! 327: /* L2TP result codes for CDN messages */
! 328: #define L2TP_RESULT_DRP_CARRIER 1 /* lost carrier */
! 329: #define L2TP_RESULT_ERROR 2 /* general error: see error code */
! 330: #define L2TP_RESULT_ADMIN 3 /* administrative disconnect */
! 331: #define L2TP_RESULT_AVAIL_TEMP 4 /* temp. lack of available resources */
! 332: #define L2TP_RESULT_AVAIL_PERM 5 /* perm. lack of available resources */
! 333: #define L2TP_RESULT_DEST 6 /* invalid destination */
! 334: #define L2TP_RESULT_NO_CARRIER 7 /* no carrier detected */
! 335: #define L2TP_RESULT_BUSY 8 /* busy signal */
! 336: #define L2TP_RESULT_NO_DIALTONE 9 /* no dial tone */
! 337: #define L2TP_RESULT_TIMEOUT 10 /* timeout during establishment */
! 338: #define L2TP_RESULT_NO_FRAMING 11 /* no appropriate framing detected */
! 339:
! 340: /* L2TP error codes */
! 341: #define L2TP_ERROR_NO_CTRL 1 /* no control connection exists */
! 342: #define L2TP_ERROR_LENGTH 2 /* length is wrong */
! 343: #define L2TP_ERROR_BAD_VALUE 3 /* invalid or field non-zero resv. */
! 344: #define L2TP_ERROR_RESOURCES 4 /* insufficient resources */
! 345: #define L2TP_ERROR_INVALID_ID 5 /* invalid session id */
! 346: #define L2TP_ERROR_GENERIC 6 /* generic vendor-specific error */
! 347: #define L2TP_ERROR_TRY_ANOTHER 7 /* try another lns */
! 348: #define L2TP_ERROR_MANDATORY 8 /* rec'd unknown mandatory avp */
! 349:
! 350: /***********************************************************************
! 351: AVP TYPES
! 352: ***********************************************************************/
! 353:
! 354: enum ppp_l2tp_avp_type {
! 355: AVP_MESSAGE_TYPE =0,
! 356: AVP_RESULT_CODE =1,
! 357: AVP_PROTOCOL_VERSION =2,
! 358: AVP_FRAMING_CAPABILITIES =3,
! 359: AVP_BEARER_CAPABILITIES =4,
! 360: AVP_TIE_BREAKER =5,
! 361: AVP_FIRMWARE_REVISION =6,
! 362: AVP_HOST_NAME =7,
! 363: AVP_VENDOR_NAME =8,
! 364: AVP_ASSIGNED_TUNNEL_ID =9,
! 365: AVP_RECEIVE_WINDOW_SIZE =10,
! 366: AVP_CHALLENGE =11,
! 367: AVP_CAUSE_CODE =12,
! 368: AVP_CHALLENGE_RESPONSE =13,
! 369: AVP_ASSIGNED_SESSION_ID =14,
! 370: AVP_CALL_SERIAL_NUMBER =15,
! 371: AVP_MINIMUM_BPS =16,
! 372: AVP_MAXIMUM_BPS =17,
! 373: AVP_BEARER_TYPE =18,
! 374: AVP_FRAMING_TYPE =19,
! 375: AVP_CALLED_NUMBER =21,
! 376: AVP_CALLING_NUMBER =22,
! 377: AVP_SUB_ADDRESS =23,
! 378: AVP_TX_CONNECT_SPEED =24,
! 379: AVP_PHYSICAL_CHANNEL_ID =25,
! 380: AVP_INITIAL_RECV_CONFREQ =26,
! 381: AVP_LAST_SENT_CONFREQ =27,
! 382: AVP_LAST_RECV_CONFREQ =28,
! 383: AVP_PROXY_AUTHEN_TYPE =29,
! 384: AVP_PROXY_AUTHEN_NAME =30,
! 385: AVP_PROXY_AUTHEN_CHALLENGE =31,
! 386: AVP_PROXY_AUTHEN_ID =32,
! 387: AVP_PROXY_AUTHEN_RESPONSE =33,
! 388: AVP_CALL_ERRORS =34,
! 389: AVP_ACCM =35,
! 390: AVP_RANDOM_VECTOR =36,
! 391: AVP_PRIVATE_GROUP_ID =37,
! 392: AVP_RX_CONNECT_SPEED =38,
! 393: AVP_SEQUENCING_REQUIRED =39,
! 394: AVP_MAX =40,
! 395: };
! 396:
! 397: /***********************************************************************
! 398: AVP FUNCTIONS
! 399: ***********************************************************************/
! 400:
! 401: __BEGIN_DECLS
! 402:
! 403: /*
! 404: * Create an AVP pointers structure from an AVP list.
! 405: *
! 406: * AVP's not listed in the pointers structure are simply omitted.
! 407: *
! 408: * Returns:
! 409: * NULL If failure (errno is set)
! 410: * ptrs New pointers structure
! 411: */
! 412: extern struct ppp_l2tp_avp_ptrs *ppp_l2tp_avp_list2ptrs(
! 413: const struct ppp_l2tp_avp_list *list);
! 414:
! 415: /*
! 416: * Destroy an AVP pointers structure.
! 417: *
! 418: * Arguments:
! 419: * ptrsp Pointer to 'AVP pointers' pointer; it gets set to NULL
! 420: */
! 421: extern void ppp_l2tp_avp_ptrs_destroy(struct ppp_l2tp_avp_ptrs **ptrsp);
! 422:
! 423: /*
! 424: * Create a new AVP structure.
! 425: *
! 426: * Arguments:
! 427: * mandatory Set mandatory bit
! 428: * vendor Attribute vendor
! 429: * type Attribute type
! 430: * value Value contents
! 431: * vlen Length of value contents
! 432: *
! 433: * Returns:
! 434: * NULL If failure (errno is set)
! 435: * avp New AVP structure
! 436: */
! 437: extern struct ppp_l2tp_avp *ppp_l2tp_avp_create(int mandatory,
! 438: u_int16_t vendor, u_int16_t type, const void *value,
! 439: size_t vlen);
! 440:
! 441: /*
! 442: * Copy an AVP struture.
! 443: *
! 444: * Returns:
! 445: * NULL If failure (errno is set)
! 446: * ptr New AVP structure
! 447: */
! 448: extern struct ppp_l2tp_avp *ppp_l2tp_avp_copy(const struct ppp_l2tp_avp *avp);
! 449:
! 450: /*
! 451: * Destroy an AVP structure.
! 452: *
! 453: * Arguments:
! 454: * avpp Pointer to AVP pointer; it gets set to NULL
! 455: */
! 456: extern void ppp_l2tp_avp_destroy(struct ppp_l2tp_avp **avpp);
! 457:
! 458: /*
! 459: * Create a new AVP list.
! 460: *
! 461: * Returns:
! 462: * NULL If failure (errno is set)
! 463: * ptr New AVP list structure
! 464: */
! 465: extern struct ppp_l2tp_avp_list *ppp_l2tp_avp_list_create(void);
! 466:
! 467: /*
! 468: * Insert an AVP into a list.
! 469: *
! 470: * Arguments:
! 471: * list List to insert AVP into
! 472: * avpp Pointer to AVP pointer; it gets set to NULL if successful
! 473: * index Where in list to insert; special case -1 means 'at the end'
! 474: *
! 475: * Returns:
! 476: * 0 Successful
! 477: * -1 If failure (errno is set)
! 478: */
! 479: extern int ppp_l2tp_avp_list_insert(struct ppp_l2tp_avp_list *list,
! 480: struct ppp_l2tp_avp **avpp, int index);
! 481:
! 482: /*
! 483: * Create a new AVP and add it to the end of the given list. That is, this
! 484: * ia a combination of ppp_l2tp_avp_create() and ppp_l2tp_avp_list_insert()
! 485: * added for convenience in a common operation.
! 486: *
! 487: * Arguments:
! 488: * list List to append AVP to
! 489: * mandatory Set mandatory bit
! 490: * vendor Attribute vendor
! 491: * type Attribute type
! 492: * value Value contents
! 493: * vlen Length of value contents
! 494: *
! 495: * Returns:
! 496: * 0 Successful
! 497: * -1 If failure (errno is set)
! 498: */
! 499: extern int ppp_l2tp_avp_list_append(struct ppp_l2tp_avp_list *list,
! 500: int mandatory, u_int16_t vendor, u_int16_t type,
! 501: const void *value, size_t vlen);
! 502:
! 503: /*
! 504: * Extract an AVP from a list.
! 505: *
! 506: * Arguments:
! 507: * list List to extract AVP from
! 508: * index Which item to extract
! 509: *
! 510: * Returns:
! 511: * avp If 'index' is valid, extracted item
! 512: * NULL If 'index' is out of range
! 513: */
! 514: extern struct ppp_l2tp_avp *ppp_l2tp_avp_list_extract(
! 515: struct ppp_l2tp_avp_list *list, u_int index);
! 516:
! 517: /*
! 518: * Remove and destroy an AVP from a list.
! 519: *
! 520: * Arguments:
! 521: * list List to remove AVP from
! 522: * index Which item to remove
! 523: *
! 524: * Returns:
! 525: * 0 If 'index' is valid and AVP was removed
! 526: * -1 If 'index' is out of range
! 527: */
! 528: extern int ppp_l2tp_avp_list_remove(
! 529: struct ppp_l2tp_avp_list *list, u_int index);
! 530:
! 531: /*
! 532: * Find an AVP in a list.
! 533: *
! 534: * Arguments:
! 535: * list List of AVP's
! 536: * vendor AVP vendor
! 537: * type AVP attribute type
! 538: *
! 539: * Returns:
! 540: * index If found, index of AVP in list
! 541: * -1 If not found.
! 542: */
! 543: extern int ppp_l2tp_avp_list_find(const struct ppp_l2tp_avp_list *list,
! 544: u_int16_t vendor, u_int16_t type);
! 545:
! 546: /*
! 547: * Copy an AVP list.
! 548: *
! 549: * Returns:
! 550: * NULL If failure (errno is set)
! 551: * ptr New AVP list structure
! 552: */
! 553: extern struct ppp_l2tp_avp_list *ppp_l2tp_avp_list_copy(
! 554: const struct ppp_l2tp_avp_list *list);
! 555:
! 556: /*
! 557: * Destroy an AVP list.
! 558: *
! 559: * Arguments:
! 560: * listp Pointer to AVP list pointer; it gets set to NULL
! 561: */
! 562: extern void ppp_l2tp_avp_list_destroy(struct ppp_l2tp_avp_list **listp);
! 563:
! 564: /*
! 565: * Encode a list of AVP's into a single buffer, preserving the order
! 566: * of the AVP's. If a shared secret is supplied, and any of the AVP's
! 567: * are hidden, then any required random vector AVP's are created and
! 568: * inserted automatically.
! 569: *
! 570: * Arguments:
! 571: * info AVP info list, terminated with NULL name
! 572: * list List of AVP structures to encode
! 573: * secret Shared secret for hiding AVP's, or NULL for none.
! 574: * slen Length of shared secret (if secret != NULL)
! 575: * buf Buffer for the data, or NULL to only compute length.
! 576: *
! 577: * Returns:
! 578: * -1 If failure (errno is set)
! 579: * length If successful, length of encoded data (in bytes)
! 580: *
! 581: * Possibilities for errno:
! 582: * EILSEQ Invalid data format
! 583: */
! 584: extern int ppp_l2tp_avp_pack(const struct ppp_l2tp_avp_info *info,
! 585: const struct ppp_l2tp_avp_list *list,
! 586: const u_char *secret, size_t slen, u_char *buf);
! 587:
! 588: /*
! 589: * Decode a packet into an array of unpacked AVP structures, preserving
! 590: * the order of the AVP's. Random vector AVP's are automatically removed.
! 591: *
! 592: * Arguments:
! 593: * info AVP info list, terminated with NULL name
! 594: * data Original packed AVP data packet
! 595: * dlen Length of the data pointed to by 'data'
! 596: * secret Shared secret for unhiding AVP's, or NULL for none.
! 597: * slen Length of shared secret (if secret != NULL)
! 598: *
! 599: * Returns:
! 600: * NULL If failure (errno is set)
! 601: * length If successful, the unpacked list
! 602: *
! 603: * Possibilities for errno:
! 604: * EILSEQ Invalid data format
! 605: * EAUTH Hidden AVP found but no shared secret was provided
! 606: * ENOSYS Mandatory but unrecognized AVP seen (i.e., AVP not in list)
! 607: */
! 608: extern struct ppp_l2tp_avp_list *ppp_l2tp_avp_unpack(
! 609: const struct ppp_l2tp_avp_info *info,
! 610: const u_char *data, size_t dlen,
! 611: const u_char *secret, size_t slen);
! 612:
! 613: /*
! 614: * AVP decoders
! 615: */
! 616: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_MESSAGE_TYPE;
! 617: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_RESULT_CODE;
! 618: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_PROTOCOL_VERSION;
! 619: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_FRAMING_CAPABILITIES;
! 620: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_BEARER_CAPABILITIES;
! 621: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_TIE_BREAKER;
! 622: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_FIRMWARE_REVISION;
! 623: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_HOST_NAME;
! 624: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_VENDOR_NAME;
! 625: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_ASSIGNED_TUNNEL_ID;
! 626: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_RECEIVE_WINDOW_SIZE;
! 627: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_CHALLENGE;
! 628: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_CAUSE_CODE;
! 629: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_CHALLENGE_RESPONSE;
! 630: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_ASSIGNED_SESSION_ID;
! 631: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_CALL_SERIAL_NUMBER;
! 632: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_MINIMUM_BPS;
! 633: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_MAXIMUM_BPS;
! 634: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_BEARER_TYPE;
! 635: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_FRAMING_TYPE;
! 636: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_CALLED_NUMBER;
! 637: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_CALLING_NUMBER;
! 638: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_SUB_ADDRESS;
! 639: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_TX_CONNECT_SPEED;
! 640: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_PHYSICAL_CHANNEL_ID;
! 641: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_INITIAL_RECV_CONFREQ;
! 642: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_LAST_SENT_CONFREQ;
! 643: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_LAST_RECV_CONFREQ;
! 644: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_PROXY_AUTHEN_TYPE;
! 645: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_PROXY_AUTHEN_NAME;
! 646: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_PROXY_AUTHEN_CHALLENGE;
! 647: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_PROXY_AUTHEN_ID;
! 648: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_PROXY_AUTHEN_RESPONSE;
! 649: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_CALL_ERRORS;
! 650: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_ACCM;
! 651: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_RANDOM_VECTOR;
! 652: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_PRIVATE_GROUP_ID;
! 653: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_RX_CONNECT_SPEED;
! 654: extern ppp_l2tp_avp_decode_t ppp_l2tp_avp_decode_SEQUENCING_REQUIRED;
! 655:
! 656: __END_DECLS
! 657:
! 658: #endif /* _PPP_L2TP_PDEL_PPP_PPP_L2TP_AVP_H_ */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>