xref: /minix/minix/lib/liblwip/dist/src/include/netif/ppp/lcp.h (revision e4dbab1e)
1 /*
2  * lcp.h - Link Control Protocol definitions.
3  *
4  * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the
16  *    distribution.
17  *
18  * 3. The name "Carnegie Mellon University" must not be used to
19  *    endorse or promote products derived from this software without
20  *    prior written permission. For permission or any legal
21  *    details, please contact
22  *      Office of Technology Transfer
23  *      Carnegie Mellon University
24  *      5000 Forbes Avenue
25  *      Pittsburgh, PA  15213-3890
26  *      (412) 268-4387, fax: (412) 268-7395
27  *      tech-transfer@andrew.cmu.edu
28  *
29  * 4. Redistributions of any form whatsoever must retain the following
30  *    acknowledgment:
31  *    "This product includes software developed by Computing Services
32  *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
33  *
34  * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
35  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
36  * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
37  * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
38  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
39  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
40  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
41  *
42  * $Id: lcp.h,v 1.20 2004/11/14 22:53:42 carlsonj Exp $
43  */
44 
45 #include "netif/ppp/ppp_opts.h"
46 #if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
47 
48 #ifndef LCP_H
49 #define	LCP_H
50 
51 #include "ppp.h"
52 
53 /*
54  * Options.
55  */
56 #define CI_VENDOR	0	/* Vendor Specific */
57 #define CI_MRU		1	/* Maximum Receive Unit */
58 #define CI_ASYNCMAP	2	/* Async Control Character Map */
59 #define CI_AUTHTYPE	3	/* Authentication Type */
60 #define CI_QUALITY	4	/* Quality Protocol */
61 #define CI_MAGICNUMBER	5	/* Magic Number */
62 #define CI_PCOMPRESSION	7	/* Protocol Field Compression */
63 #define CI_ACCOMPRESSION 8	/* Address/Control Field Compression */
64 #define CI_FCSALTERN	9	/* FCS-Alternatives */
65 #define CI_SDP		10	/* Self-Describing-Pad */
66 #define CI_NUMBERED	11	/* Numbered-Mode */
67 #define CI_CALLBACK	13	/* callback */
68 #define CI_MRRU		17	/* max reconstructed receive unit; multilink */
69 #define CI_SSNHF	18	/* short sequence numbers for multilink */
70 #define CI_EPDISC	19	/* endpoint discriminator */
71 #define CI_MPPLUS	22	/* Multi-Link-Plus-Procedure */
72 #define CI_LDISC	23	/* Link-Discriminator */
73 #define CI_LCPAUTH	24	/* LCP Authentication */
74 #define CI_COBS		25	/* Consistent Overhead Byte Stuffing */
75 #define CI_PREFELIS	26	/* Prefix Elision */
76 #define CI_MPHDRFMT	27	/* MP Header Format */
77 #define CI_I18N		28	/* Internationalization */
78 #define CI_SDL		29	/* Simple Data Link */
79 
80 /*
81  * LCP-specific packet types (code numbers).
82  */
83 #define PROTREJ		8	/* Protocol Reject */
84 #define ECHOREQ		9	/* Echo Request */
85 #define ECHOREP		10	/* Echo Reply */
86 #define DISCREQ		11	/* Discard Request */
87 #define IDENTIF		12	/* Identification */
88 #define TIMEREM		13	/* Time Remaining */
89 
90 /* Value used as data for CI_CALLBACK option */
91 #define CBCP_OPT	6	/* Use callback control protocol */
92 
93 #if 0 /* moved to ppp_opts.h */
94 #define DEFMRU	1500		/* Try for this */
95 #define MINMRU	128		/* No MRUs below this */
96 #define MAXMRU	16384		/* Normally limit MRU to this */
97 #endif /* moved to ppp_opts.h */
98 
99 /* An endpoint discriminator, used with multilink. */
100 #define MAX_ENDP_LEN	20	/* maximum length of discriminator value */
101 struct epdisc {
102     unsigned char	class_; /* -- The word "class" is reserved in C++. */
103     unsigned char	length;
104     unsigned char	value[MAX_ENDP_LEN];
105 };
106 
107 /*
108  * The state of options is described by an lcp_options structure.
109  */
110 typedef struct lcp_options {
111     unsigned int passive           :1; /* Don't die if we don't get a response */
112     unsigned int silent            :1; /* Wait for the other end to start first */
113 #if 0 /* UNUSED */
114     unsigned int restart           :1; /* Restart vs. exit after close */
115 #endif /* UNUSED */
116     unsigned int neg_mru           :1; /* Negotiate the MRU? */
117     unsigned int neg_asyncmap      :1; /* Negotiate the async map? */
118 #if PAP_SUPPORT
119     unsigned int neg_upap          :1; /* Ask for UPAP authentication? */
120 #endif /* PAP_SUPPORT */
121 #if CHAP_SUPPORT
122     unsigned int neg_chap          :1; /* Ask for CHAP authentication? */
123 #endif /* CHAP_SUPPORT */
124 #if EAP_SUPPORT
125     unsigned int neg_eap           :1; /* Ask for EAP authentication? */
126 #endif /* EAP_SUPPORT */
127     unsigned int neg_magicnumber   :1; /* Ask for magic number? */
128     unsigned int neg_pcompression  :1; /* HDLC Protocol Field Compression? */
129     unsigned int neg_accompression :1; /* HDLC Address/Control Field Compression? */
130 #if LQR_SUPPORT
131     unsigned int neg_lqr           :1; /* Negotiate use of Link Quality Reports */
132 #endif /* LQR_SUPPORT */
133     unsigned int neg_cbcp          :1; /* Negotiate use of CBCP */
134 #ifdef HAVE_MULTILINK
135     unsigned int neg_mrru          :1; /* negotiate multilink MRRU */
136 #endif /* HAVE_MULTILINK */
137     unsigned int neg_ssnhf         :1; /* negotiate short sequence numbers */
138     unsigned int neg_endpoint      :1; /* negotiate endpoint discriminator */
139 
140     u16_t mru;			/* Value of MRU */
141 #ifdef HAVE_MULTILINK
142     u16_t mrru;			/* Value of MRRU, and multilink enable */
143 #endif /* MULTILINK */
144 #if CHAP_SUPPORT
145     u8_t chap_mdtype;		/* which MD types (hashing algorithm) */
146 #endif /* CHAP_SUPPORT */
147     u32_t asyncmap;		/* Value of async map */
148     u32_t magicnumber;
149     u8_t  numloops;		/* Number of loops during magic number neg. */
150 #if LQR_SUPPORT
151     u32_t lqr_period;	/* Reporting period for LQR 1/100ths second */
152 #endif /* LQR_SUPPORT */
153     struct epdisc endpoint;	/* endpoint discriminator */
154 } lcp_options;
155 
156 void lcp_open(ppp_pcb *pcb);
157 void lcp_close(ppp_pcb *pcb, const char *reason);
158 void lcp_lowerup(ppp_pcb *pcb);
159 void lcp_lowerdown(ppp_pcb *pcb);
160 void lcp_sprotrej(ppp_pcb *pcb, u_char *p, int len);    /* send protocol reject */
161 
162 extern const struct protent lcp_protent;
163 
164 #if 0 /* moved to ppp_opts.h */
165 /* Default number of times we receive our magic number from the peer
166    before deciding the link is looped-back. */
167 #define DEFLOOPBACKFAIL	10
168 #endif /* moved to ppp_opts.h */
169 
170 #endif /* LCP_H */
171 #endif /* PPP_SUPPORT */
172