1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * lcp.h - Link Control Protocol definitions. 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * Copyright (c) 2000 by Sun Microsystems, Inc. 5*7c478bd9Sstevel@tonic-gate * All rights reserved. 6*7c478bd9Sstevel@tonic-gate * 7*7c478bd9Sstevel@tonic-gate * Copyright (c) 1989 Carnegie Mellon University. 8*7c478bd9Sstevel@tonic-gate * All rights reserved. 9*7c478bd9Sstevel@tonic-gate * 10*7c478bd9Sstevel@tonic-gate * Redistribution and use in source and binary forms are permitted 11*7c478bd9Sstevel@tonic-gate * provided that the above copyright notice and this paragraph are 12*7c478bd9Sstevel@tonic-gate * duplicated in all such forms and that any documentation, 13*7c478bd9Sstevel@tonic-gate * advertising materials, and other materials related to such 14*7c478bd9Sstevel@tonic-gate * distribution and use acknowledge that the software was developed 15*7c478bd9Sstevel@tonic-gate * by Carnegie Mellon University. The name of the 16*7c478bd9Sstevel@tonic-gate * University may not be used to endorse or promote products derived 17*7c478bd9Sstevel@tonic-gate * from this software without specific prior written permission. 18*7c478bd9Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 19*7c478bd9Sstevel@tonic-gate * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 20*7c478bd9Sstevel@tonic-gate * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 21*7c478bd9Sstevel@tonic-gate * 22*7c478bd9Sstevel@tonic-gate * $Id: lcp.h,v 1.15 2000/04/04 07:06:51 paulus Exp $ 23*7c478bd9Sstevel@tonic-gate */ 24*7c478bd9Sstevel@tonic-gate 25*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef __LCP_H_ 28*7c478bd9Sstevel@tonic-gate #define __LCP_H_ 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 31*7c478bd9Sstevel@tonic-gate extern "C" { 32*7c478bd9Sstevel@tonic-gate #endif 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate /* 35*7c478bd9Sstevel@tonic-gate * Options. 36*7c478bd9Sstevel@tonic-gate */ 37*7c478bd9Sstevel@tonic-gate #define CI_MRU 1 /* Maximum Receive Unit */ 38*7c478bd9Sstevel@tonic-gate #define CI_ASYNCMAP 2 /* Async Control Character Map */ 39*7c478bd9Sstevel@tonic-gate #define CI_AUTHTYPE 3 /* Authentication Type */ 40*7c478bd9Sstevel@tonic-gate #define CI_QUALITY 4 /* Quality Protocol */ 41*7c478bd9Sstevel@tonic-gate #define CI_MAGICNUMBER 5 /* Magic Number */ 42*7c478bd9Sstevel@tonic-gate #define CI_PCOMPRESSION 7 /* Protocol Field Compression */ 43*7c478bd9Sstevel@tonic-gate #define CI_ACCOMPRESSION 8 /* Address/Control Field Compression */ 44*7c478bd9Sstevel@tonic-gate #define CI_FCSALTERN 9 /* FCS Alternatives */ 45*7c478bd9Sstevel@tonic-gate #define CI_NUMBERED 11 /* Numbered Mode */ 46*7c478bd9Sstevel@tonic-gate #define CI_CALLBACK 13 /* callback */ 47*7c478bd9Sstevel@tonic-gate #define CI_MRRU 17 /* max reconstructed receive unit; multilink */ 48*7c478bd9Sstevel@tonic-gate #define CI_SSNHF 18 /* short sequence numbers for multilink */ 49*7c478bd9Sstevel@tonic-gate #define CI_EPDISC 19 /* endpoint discriminator */ 50*7c478bd9Sstevel@tonic-gate #define CI_LINKDISC 23 /* Link Discriminator (BACP) */ 51*7c478bd9Sstevel@tonic-gate #define CI_COBS 25 /* Consistent Overhead Byte Stuffing */ 52*7c478bd9Sstevel@tonic-gate #define CI_PFXELISION 26 /* Prefix Elision */ 53*7c478bd9Sstevel@tonic-gate #define CI_MPHDRFMT 27 /* Multilink Header Format */ 54*7c478bd9Sstevel@tonic-gate #define CI_I18N 28 /* Internationalization */ 55*7c478bd9Sstevel@tonic-gate #define CI_SDL 29 /* Simple Data Link */ 56*7c478bd9Sstevel@tonic-gate #define CI_MUXING 30 /* PPP Muxing */ 57*7c478bd9Sstevel@tonic-gate 58*7c478bd9Sstevel@tonic-gate /* 59*7c478bd9Sstevel@tonic-gate * LCP-specific packet types. 60*7c478bd9Sstevel@tonic-gate */ 61*7c478bd9Sstevel@tonic-gate #define CODE_PROTREJ 8 /* Protocol Reject */ 62*7c478bd9Sstevel@tonic-gate #define CODE_ECHOREQ 9 /* Echo Request */ 63*7c478bd9Sstevel@tonic-gate #define CODE_ECHOREP 10 /* Echo Reply */ 64*7c478bd9Sstevel@tonic-gate #define CODE_DISCREQ 11 /* Discard Request */ 65*7c478bd9Sstevel@tonic-gate #define CODE_IDENT 12 /* Identification */ 66*7c478bd9Sstevel@tonic-gate #define CODE_TIMEREMAIN 13 /* Time Remaining */ 67*7c478bd9Sstevel@tonic-gate 68*7c478bd9Sstevel@tonic-gate /* 69*7c478bd9Sstevel@tonic-gate * Callback operation field values 70*7c478bd9Sstevel@tonic-gate */ 71*7c478bd9Sstevel@tonic-gate #define CBOP_AUTH 0 /* Location determined by user auth */ 72*7c478bd9Sstevel@tonic-gate #define CBOP_DIALSTR 1 /* Dialing string */ 73*7c478bd9Sstevel@tonic-gate #define CBOP_LOCATION 2 /* Location identifier */ 74*7c478bd9Sstevel@tonic-gate #define CBOP_E164 3 /* E.164 number */ 75*7c478bd9Sstevel@tonic-gate #define CBOP_X500 4 /* X.500 distinguished name */ 76*7c478bd9Sstevel@tonic-gate #define CBOP_CBCP 6 /* Use callback control protocol */ 77*7c478bd9Sstevel@tonic-gate 78*7c478bd9Sstevel@tonic-gate /* FCS-Alternatives bits (RFC 1570) */ 79*7c478bd9Sstevel@tonic-gate #define FCSALT_NULL 1 /* None for network data; default otherwise */ 80*7c478bd9Sstevel@tonic-gate #define FCSALT_16 2 /* CRC-16 */ 81*7c478bd9Sstevel@tonic-gate #define FCSALT_32 4 /* CRC-32 */ 82*7c478bd9Sstevel@tonic-gate 83*7c478bd9Sstevel@tonic-gate /* An endpoint discriminator, used with multilink. */ 84*7c478bd9Sstevel@tonic-gate #define MAX_ENDP_LEN 20 /* maximum length of discriminator value */ 85*7c478bd9Sstevel@tonic-gate struct epdisc { 86*7c478bd9Sstevel@tonic-gate unsigned char class; 87*7c478bd9Sstevel@tonic-gate unsigned char length; 88*7c478bd9Sstevel@tonic-gate unsigned char value[MAX_ENDP_LEN]; 89*7c478bd9Sstevel@tonic-gate }; 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate /* values for epdisc.class */ 92*7c478bd9Sstevel@tonic-gate #define EPD_NULL 0 /* null discriminator, no data */ 93*7c478bd9Sstevel@tonic-gate #define EPD_LOCAL 1 94*7c478bd9Sstevel@tonic-gate #define EPD_IP 2 95*7c478bd9Sstevel@tonic-gate #define EPD_MAC 3 96*7c478bd9Sstevel@tonic-gate #define EPD_MAGIC 4 97*7c478bd9Sstevel@tonic-gate #define EPD_PHONENUM 5 98*7c478bd9Sstevel@tonic-gate 99*7c478bd9Sstevel@tonic-gate /* 100*7c478bd9Sstevel@tonic-gate * The state of options is described by an lcp_options structure. 101*7c478bd9Sstevel@tonic-gate * 102*7c478bd9Sstevel@tonic-gate * We encode CHAP/MS-CHAP/MS-CHAPv2 options as Booleans. This is done 103*7c478bd9Sstevel@tonic-gate * so that we can represent the choices of requiring or refusing each 104*7c478bd9Sstevel@tonic-gate * separately. The chap_mdtype value can't do that. 105*7c478bd9Sstevel@tonic-gate */ 106*7c478bd9Sstevel@tonic-gate typedef struct lcp_options { 107*7c478bd9Sstevel@tonic-gate bool passive; /* Don't die if we don't get a response */ 108*7c478bd9Sstevel@tonic-gate bool silent; /* Wait for the other end to start first */ 109*7c478bd9Sstevel@tonic-gate bool restart; /* Restart vs. exit after close */ 110*7c478bd9Sstevel@tonic-gate bool neg_mru; /* Negotiate the MRU? */ 111*7c478bd9Sstevel@tonic-gate bool neg_asyncmap; /* Negotiate the async map? */ 112*7c478bd9Sstevel@tonic-gate bool neg_upap; /* Ask for UPAP authentication? */ 113*7c478bd9Sstevel@tonic-gate bool neg_chap; /* Ask for CHAP authentication? */ 114*7c478bd9Sstevel@tonic-gate bool neg_mschap; /* Ask for MS-CHAPv1 authentication? */ 115*7c478bd9Sstevel@tonic-gate bool neg_mschapv2; /* Ask for MS-CHAPv2 authentication? */ 116*7c478bd9Sstevel@tonic-gate bool neg_magicnumber; /* Ask for magic number? */ 117*7c478bd9Sstevel@tonic-gate bool neg_pcompression; /* HDLC Protocol Field Compression? */ 118*7c478bd9Sstevel@tonic-gate bool neg_accompression; /* HDLC Address/Control Field Compression? */ 119*7c478bd9Sstevel@tonic-gate bool neg_lqr; /* Negotiate use of Link Quality Reports */ 120*7c478bd9Sstevel@tonic-gate bool neg_cbcp; /* Negotiate use of CBCP */ 121*7c478bd9Sstevel@tonic-gate bool neg_mrru; /* negotiate multilink MRRU */ 122*7c478bd9Sstevel@tonic-gate #ifdef MUX_FRAME 123*7c478bd9Sstevel@tonic-gate u_int32_t pppmux; /* Negotiate for PPP Multiplexing option */ 124*7c478bd9Sstevel@tonic-gate #endif 125*7c478bd9Sstevel@tonic-gate bool neg_ssnhf; /* negotiate short sequence numbers */ 126*7c478bd9Sstevel@tonic-gate bool neg_endpoint; /* negotiate endpoint discriminator */ 127*7c478bd9Sstevel@tonic-gate bool neg_fcs; /* negotiate FCS alternatives */ 128*7c478bd9Sstevel@tonic-gate int mru; /* Value of MRU */ 129*7c478bd9Sstevel@tonic-gate int mrru; /* Value of MRRU, and multilink enable */ 130*7c478bd9Sstevel@tonic-gate u_char chap_mdtype; /* which MD type (hashing algorithm) */ 131*7c478bd9Sstevel@tonic-gate u_char fcs_type; /* selected FCS type(s) */ 132*7c478bd9Sstevel@tonic-gate u_int32_t asyncmap; /* Value of async map */ 133*7c478bd9Sstevel@tonic-gate u_int32_t magicnumber; 134*7c478bd9Sstevel@tonic-gate int numloops; /* Number of loops during magic number neg. */ 135*7c478bd9Sstevel@tonic-gate u_int32_t lqr_period; /* Reporting period for LQR 1/100ths second */ 136*7c478bd9Sstevel@tonic-gate struct epdisc endpoint; /* endpoint discriminator */ 137*7c478bd9Sstevel@tonic-gate } lcp_options; 138*7c478bd9Sstevel@tonic-gate 139*7c478bd9Sstevel@tonic-gate /* 140*7c478bd9Sstevel@tonic-gate * The structure passed to lcp_settimeremaining(), holds the unit 141*7c478bd9Sstevel@tonic-gate * number of the link being timed, and the time remaining for that 142*7c478bd9Sstevel@tonic-gate * connection. 143*7c478bd9Sstevel@tonic-gate */ 144*7c478bd9Sstevel@tonic-gate struct lcp_timer { 145*7c478bd9Sstevel@tonic-gate int unit; 146*7c478bd9Sstevel@tonic-gate u_int32_t tr; 147*7c478bd9Sstevel@tonic-gate }; 148*7c478bd9Sstevel@tonic-gate 149*7c478bd9Sstevel@tonic-gate extern fsm lcp_fsm[]; 150*7c478bd9Sstevel@tonic-gate extern lcp_options lcp_wantoptions[]; 151*7c478bd9Sstevel@tonic-gate extern lcp_options lcp_gotoptions[]; 152*7c478bd9Sstevel@tonic-gate extern lcp_options lcp_allowoptions[]; 153*7c478bd9Sstevel@tonic-gate extern lcp_options lcp_hisoptions[]; 154*7c478bd9Sstevel@tonic-gate extern u_int32_t xmit_accm[][8]; 155*7c478bd9Sstevel@tonic-gate 156*7c478bd9Sstevel@tonic-gate void lcp_open __P((int)); 157*7c478bd9Sstevel@tonic-gate void lcp_close __P((int, char *)); 158*7c478bd9Sstevel@tonic-gate void lcp_lowerup __P((int)); 159*7c478bd9Sstevel@tonic-gate void lcp_lowerdown __P((int)); 160*7c478bd9Sstevel@tonic-gate void lcp_sprotrej __P((int, u_char *, int)); /* send protocol reject */ 161*7c478bd9Sstevel@tonic-gate void lcp_settimeremaining __P((int, u_int32_t, u_int32_t)); 162*7c478bd9Sstevel@tonic-gate 163*7c478bd9Sstevel@tonic-gate /* 164*7c478bd9Sstevel@tonic-gate * Procedures exported from multilink.c 165*7c478bd9Sstevel@tonic-gate */ 166*7c478bd9Sstevel@tonic-gate extern char *epdisc_to_str __P((struct epdisc *)); 167*7c478bd9Sstevel@tonic-gate /* string from endpoint discriminator */ 168*7c478bd9Sstevel@tonic-gate extern int str_to_epdisc __P((struct epdisc *, char *)); 169*7c478bd9Sstevel@tonic-gate /* endpt discriminator from str */ 170*7c478bd9Sstevel@tonic-gate 171*7c478bd9Sstevel@tonic-gate extern struct protent lcp_protent; 172*7c478bd9Sstevel@tonic-gate 173*7c478bd9Sstevel@tonic-gate /* Default number of times we receive our magic number from the peer 174*7c478bd9Sstevel@tonic-gate before deciding the link is looped-back. */ 175*7c478bd9Sstevel@tonic-gate #define DEFLOOPBACKFAIL 10 176*7c478bd9Sstevel@tonic-gate 177*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 178*7c478bd9Sstevel@tonic-gate } 179*7c478bd9Sstevel@tonic-gate #endif 180*7c478bd9Sstevel@tonic-gate 181*7c478bd9Sstevel@tonic-gate #endif /* __LCP_H_ */ 182