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