1/*
2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * lcp.h - Link Control Protocol definitions.
25 *
26 * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
27 *
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
30 * are met:
31 *
32 * 1. Redistributions of source code must retain the above copyright
33 *    notice, this list of conditions and the following disclaimer.
34 *
35 * 2. Redistributions in binary form must reproduce the above copyright
36 *    notice, this list of conditions and the following disclaimer in
37 *    the documentation and/or other materials provided with the
38 *    distribution.
39 *
40 * 3. The name "Carnegie Mellon University" must not be used to
41 *    endorse or promote products derived from this software without
42 *    prior written permission. For permission or any legal
43 *    details, please contact
44 *      Office of Technology Transfer
45 *      Carnegie Mellon University
46 *      5000 Forbes Avenue
47 *      Pittsburgh, PA  15213-3890
48 *      (412) 268-4387, fax: (412) 268-7395
49 *      tech-transfer@andrew.cmu.edu
50 *
51 * 4. Redistributions of any form whatsoever must retain the following
52 *    acknowledgment:
53 *    "This product includes software developed by Computing Services
54 *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
55 *
56 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
57 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
58 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
59 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
60 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
61 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
62 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
63 *
64 * $Id: lcp.h,v 1.7 2004/02/10 19:29:23 callie Exp $
65 */
66
67/*
68 * Options.
69 */
70#define CI_MRU		1	/* Maximum Receive Unit */
71#define CI_ASYNCMAP	2	/* Async Control Character Map */
72#define CI_AUTHTYPE	3	/* Authentication Type */
73#define CI_QUALITY	4	/* Quality Protocol */
74#define CI_MAGICNUMBER	5	/* Magic Number */
75#define CI_PCOMPRESSION	7	/* Protocol Field Compression */
76#define CI_ACCOMPRESSION 8	/* Address/Control Field Compression */
77#define CI_CALLBACK	13	/* callback */
78#define CI_MRRU		17	/* max reconstructed receive unit; multilink */
79#define CI_SSNHF	18	/* short sequence numbers for multilink */
80#define CI_EPDISC	19	/* endpoint discriminator */
81
82/*
83 * LCP-specific packet types.
84 */
85#define PROTREJ		8	/* Protocol Reject */
86#define ECHOREQ		9	/* Echo Request */
87#define ECHOREP		10	/* Echo Reply */
88#define DISCREQ		11	/* Discard Request */
89#define TIMEREMAINING	13	/* Time-remaining LCP maintenance packet. See RFC 1570 */
90#define CBCP_OPT	6	/* Use callback control protocol */
91
92/*
93 * The state of options is described by an lcp_options structure.
94 */
95typedef struct lcp_options {
96    bool passive;		/* Don't die if we don't get a response */
97    bool silent;		/* Wait for the other end to start first */
98    bool restart;		/* Restart vs. exit after close */
99    bool neg_mru;		/* Negotiate the MRU? */
100    bool neg_asyncmap;		/* Negotiate the async map? */
101    bool neg_upap;		/* Ask for UPAP authentication? */
102    bool neg_chap;		/* Ask for CHAP authentication? */
103    bool neg_eap;		/* Ask for EAP authentication? */
104    bool neg_magicnumber;	/* Ask for magic number? */
105    bool neg_pcompression;	/* HDLC Protocol Field Compression? */
106    bool neg_accompression;	/* HDLC Address/Control Field Compression? */
107    bool neg_lqr;		/* Negotiate use of Link Quality Reports */
108    bool neg_cbcp;		/* Negotiate use of CBCP */
109    bool neg_mrru;		/* negotiate multilink MRRU */
110    bool neg_ssnhf;		/* negotiate short sequence numbers */
111    bool neg_endpoint;		/* negotiate endpoint discriminator */
112    int  mru;			/* Value of MRU */
113    int	 mrru;			/* Value of MRRU, and multilink enable */
114    u_char chap_mdtype;		/* which MD types (hashing algorithm) */
115    u_int32_t asyncmap;		/* Value of async map */
116    u_int32_t magicnumber;
117    int  numloops;		/* Number of loops during magic number neg. */
118    u_int32_t lqr_period;	/* Reporting period for LQR 1/100ths second */
119    struct epdisc endpoint;	/* endpoint discriminator */
120} lcp_options;
121
122extern fsm lcp_fsm[];
123extern lcp_options lcp_wantoptions[];
124extern lcp_options lcp_gotoptions[];
125extern lcp_options lcp_allowoptions[];
126extern lcp_options lcp_hisoptions[];
127
128#define DEFMRU	1500		/* Try for this */
129#define MINMRU	128		/* No MRUs below this */
130#define MAXMRU	16384		/* Normally limit MRU to this */
131
132void lcp_open __P((int));
133void lcp_close __P((int, char *));
134void lcp_lowerup __P((int));
135void lcp_lowerdown __P((int));
136void lcp_sprotrej __P((int, u_char *, int));	/* send protocol reject */
137
138extern struct protent lcp_protent;
139
140/* Default number of times we receive our magic number from the peer
141   before deciding the link is looped-back. */
142#define DEFLOOPBACKFAIL	10
143