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