lcp.h revision 1.2
1/*	$OpenBSD: lcp.h,v 1.2 1996/03/25 15:55:47 niklas Exp $	*/
2
3/*
4 * lcp.h - Link Control Protocol definitions.
5 *
6 * Copyright (c) 1989 Carnegie Mellon University.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms are permitted
10 * provided that the above copyright notice and this paragraph are
11 * duplicated in all such forms and that any documentation,
12 * advertising materials, and other materials related to such
13 * distribution and use acknowledge that the software was developed
14 * by Carnegie Mellon University.  The name of the
15 * University may not be used to endorse or promote products derived
16 * from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
19 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 */
21
22/*
23 * Options.
24 */
25#define CI_MRU		1	/* Maximum Receive Unit */
26#define CI_ASYNCMAP	2	/* Async Control Character Map */
27#define CI_AUTHTYPE	3	/* Authentication Type */
28#define CI_QUALITY	4	/* Quality Protocol */
29#define CI_MAGICNUMBER	5	/* Magic Number */
30#define CI_PCOMPRESSION	7	/* Protocol Field Compression */
31#define CI_ACCOMPRESSION 8	/* Address/Control Field Compression */
32
33/*
34 * LCP-specific packet types.
35 */
36#define PROTREJ		8	/* Protocol Reject */
37#define ECHOREQ		9	/* Echo Request */
38#define ECHOREP		10	/* Echo Reply */
39#define DISCREQ		11	/* Discard Request */
40
41/*
42 * The state of options is described by an lcp_options structure.
43 */
44typedef struct lcp_options {
45    int passive : 1;		/* Don't die if we don't get a response */
46    int silent : 1;		/* Wait for the other end to start first */
47    int restart : 1;		/* Restart vs. exit after close */
48    int neg_mru : 1;		/* Negotiate the MRU? */
49    int neg_asyncmap : 1;	/* Negotiate the async map? */
50    int neg_upap : 1;		/* Ask for UPAP authentication? */
51    int neg_chap : 1;		/* Ask for CHAP authentication? */
52    int neg_magicnumber : 1;	/* Ask for magic number? */
53    int neg_pcompression : 1;	/* HDLC Protocol Field Compression? */
54    int neg_accompression : 1;	/* HDLC Address/Control Field Compression? */
55    int neg_lqr : 1;		/* Negotiate use of Link Quality Reports */
56    u_short mru;		/* Value of MRU */
57    u_char chap_mdtype;		/* which MD type (hashing algorithm) */
58    u_int32_t asyncmap;		/* Value of async map */
59    u_int32_t magicnumber;
60    int numloops;		/* Number of loops during magic number neg. */
61    u_int32_t lqr_period;	/* Reporting period for LQR 1/100ths second */
62} lcp_options;
63
64extern fsm lcp_fsm[];
65extern lcp_options lcp_wantoptions[];
66extern lcp_options lcp_gotoptions[];
67extern lcp_options lcp_allowoptions[];
68extern lcp_options lcp_hisoptions[];
69extern u_int32_t xmit_accm[][8];
70
71#define DEFMRU	1500		/* Try for this */
72#define MINMRU	128		/* No MRUs below this */
73#define MAXMRU	16384		/* Normally limit MRU to this */
74
75void lcp_init __P((int));
76void lcp_open __P((int));
77void lcp_close __P((int, char *));
78void lcp_lowerup __P((int));
79void lcp_lowerdown __P((int));
80void lcp_input __P((int, u_char *, int));
81void lcp_protrej __P((int));
82void lcp_sprotrej __P((int, u_char *, int));
83int  lcp_printpkt __P((u_char *, int,
84		       void (*) __P((void *, char *, ...)), void *));
85
86extern struct protent lcp_protent;
87
88/* Default number of times we receive our magic number from the peer
89   before deciding the link is looped-back. */
90#define DEFLOOPBACKFAIL	5
91