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.19 2002/12/04 23:03:32 paulus Exp $
43 */
44
45/*
46 * Options.
47 */
48#define CI_MRU		1	/* Maximum Receive Unit */
49#define CI_ASYNCMAP	2	/* Async Control Character Map */
50#define CI_AUTHTYPE	3	/* Authentication Type */
51#define CI_QUALITY	4	/* Quality Protocol */
52#define CI_MAGICNUMBER	5	/* Magic Number */
53#define CI_PCOMPRESSION	7	/* Protocol Field Compression */
54#define CI_ACCOMPRESSION 8	/* Address/Control Field Compression */
55#define CI_CALLBACK	13	/* callback */
56#define CI_MRRU		17	/* max reconstructed receive unit; multilink */
57#define CI_SSNHF	18	/* short sequence numbers for multilink */
58#define CI_EPDISC	19	/* endpoint discriminator */
59
60/*
61 * LCP-specific packet types.
62 */
63#define PROTREJ		8	/* Protocol Reject */
64#define ECHOREQ		9	/* Echo Request */
65#define ECHOREP		10	/* Echo Reply */
66#define DISCREQ		11	/* Discard Request */
67#define CBCP_OPT	6	/* Use callback control protocol */
68
69/*
70 * The state of options is described by an lcp_options structure.
71 */
72typedef struct lcp_options {
73    bool passive;		/* Don't die if we don't get a response */
74    bool silent;		/* Wait for the other end to start first */
75    bool restart;		/* Restart vs. exit after close */
76    bool neg_mru;		/* Negotiate the MRU? */
77    bool neg_asyncmap;		/* Negotiate the async map? */
78    bool neg_upap;		/* Ask for UPAP authentication? */
79    bool neg_chap;		/* Ask for CHAP authentication? */
80    bool neg_eap;		/* Ask for EAP authentication? */
81    bool neg_magicnumber;	/* Ask for magic number? */
82    bool neg_pcompression;	/* HDLC Protocol Field Compression? */
83    bool neg_accompression;	/* HDLC Address/Control Field Compression? */
84    bool neg_lqr;		/* Negotiate use of Link Quality Reports */
85    bool neg_cbcp;		/* Negotiate use of CBCP */
86    bool neg_mrru;		/* negotiate multilink MRRU */
87    bool neg_ssnhf;		/* negotiate short sequence numbers */
88    bool neg_endpoint;		/* negotiate endpoint discriminator */
89    int  mru;			/* Value of MRU */
90    int	 mrru;			/* Value of MRRU, and multilink enable */
91    u_char chap_mdtype;		/* which MD types (hashing algorithm) */
92    u_int32_t asyncmap;		/* Value of async map */
93    u_int32_t magicnumber;
94    int  numloops;		/* Number of loops during magic number neg. */
95    u_int32_t lqr_period;	/* Reporting period for LQR 1/100ths second */
96    struct epdisc endpoint;	/* endpoint discriminator */
97} lcp_options;
98
99extern fsm lcp_fsm[];
100extern lcp_options lcp_wantoptions[];
101extern lcp_options lcp_gotoptions[];
102extern lcp_options lcp_allowoptions[];
103extern lcp_options lcp_hisoptions[];
104
105#define DEFMRU	1500		/* Try for this */
106#define MINMRU	128		/* No MRUs below this */
107#define MAXMRU	16384		/* Normally limit MRU to this */
108
109void lcp_open __P((int));
110void lcp_close __P((int, char *));
111void lcp_lowerup __P((int));
112void lcp_lowerdown __P((int));
113void lcp_sprotrej __P((int, u_char *, int));	/* send protocol reject */
114
115extern struct protent lcp_protent;
116
117/* Default number of times we receive our magic number from the peer
118   before deciding the link is looped-back. */
119#define DEFLOOPBACKFAIL	10
120