1 |
786 |
skrzyp |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// include/lcp.h
|
4 |
|
|
//
|
5 |
|
|
//==========================================================================
|
6 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
7 |
|
|
// -------------------------------------------
|
8 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
9 |
|
|
// Copyright (C) 2003 Free Software Foundation, Inc.
|
10 |
|
|
//
|
11 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
12 |
|
|
// the terms of the GNU General Public License as published by the Free
|
13 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
14 |
|
|
// version.
|
15 |
|
|
//
|
16 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
17 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
18 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
19 |
|
|
// for more details.
|
20 |
|
|
//
|
21 |
|
|
// You should have received a copy of the GNU General Public License
|
22 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
23 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
24 |
|
|
//
|
25 |
|
|
// As a special exception, if other files instantiate templates or use
|
26 |
|
|
// macros or inline functions from this file, or you compile this file
|
27 |
|
|
// and link it with other works to produce a work based on this file,
|
28 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
29 |
|
|
// the GNU General Public License. However the source code for this file
|
30 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
31 |
|
|
// General Public License v2.
|
32 |
|
|
//
|
33 |
|
|
// This exception does not invalidate any other reasons why a work based
|
34 |
|
|
// on this file might be covered by the GNU General Public License.
|
35 |
|
|
// -------------------------------------------
|
36 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
37 |
|
|
// ####BSDALTCOPYRIGHTBEGIN####
|
38 |
|
|
// -------------------------------------------
|
39 |
|
|
// Portions of this software may have been derived from FreeBSD, OpenBSD,
|
40 |
|
|
// or other sources, and if so are covered by the appropriate copyright
|
41 |
|
|
// and license included herein.
|
42 |
|
|
// -------------------------------------------
|
43 |
|
|
// ####BSDALTCOPYRIGHTEND####
|
44 |
|
|
//==========================================================================
|
45 |
|
|
|
46 |
|
|
/*
|
47 |
|
|
* lcp.h - Link Control Protocol definitions.
|
48 |
|
|
*
|
49 |
|
|
* Copyright (c) 1989 Carnegie Mellon University.
|
50 |
|
|
* All rights reserved.
|
51 |
|
|
*
|
52 |
|
|
* Redistribution and use in source and binary forms are permitted
|
53 |
|
|
* provided that the above copyright notice and this paragraph are
|
54 |
|
|
* duplicated in all such forms and that any documentation,
|
55 |
|
|
* advertising materials, and other materials related to such
|
56 |
|
|
* distribution and use acknowledge that the software was developed
|
57 |
|
|
* by Carnegie Mellon University. The name of the
|
58 |
|
|
* University may not be used to endorse or promote products derived
|
59 |
|
|
* from this software without specific prior written permission.
|
60 |
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
61 |
|
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
62 |
|
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
63 |
|
|
*
|
64 |
|
|
* $FreeBSD: src/usr.sbin/pppd/lcp.h,v 1.7 1999/08/28 01:19:05 peter 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 |
|
|
|
79 |
|
|
/*
|
80 |
|
|
* LCP-specific packet types.
|
81 |
|
|
*/
|
82 |
|
|
#define PROTREJ 8 /* Protocol Reject */
|
83 |
|
|
#define ECHOREQ 9 /* Echo Request */
|
84 |
|
|
#define ECHOREP 10 /* Echo Reply */
|
85 |
|
|
#define DISCREQ 11 /* Discard Request */
|
86 |
|
|
#define CBCP_OPT 6 /* Use callback control protocol */
|
87 |
|
|
|
88 |
|
|
/*
|
89 |
|
|
* The state of options is described by an lcp_options structure.
|
90 |
|
|
*/
|
91 |
|
|
typedef struct lcp_options {
|
92 |
|
|
int passive : 1; /* Don't die if we don't get a response */
|
93 |
|
|
int silent : 1; /* Wait for the other end to start first */
|
94 |
|
|
int restart : 1; /* Restart vs. exit after close */
|
95 |
|
|
int neg_mru : 1; /* Negotiate the MRU? */
|
96 |
|
|
int neg_asyncmap : 1; /* Negotiate the async map? */
|
97 |
|
|
int neg_upap : 1; /* Ask for UPAP authentication? */
|
98 |
|
|
int neg_chap : 1; /* Ask for CHAP authentication? */
|
99 |
|
|
int neg_magicnumber : 1; /* Ask for magic number? */
|
100 |
|
|
int neg_pcompression : 1; /* HDLC Protocol Field Compression? */
|
101 |
|
|
int neg_accompression : 1; /* HDLC Address/Control Field Compression? */
|
102 |
|
|
int neg_lqr : 1; /* Negotiate use of Link Quality Reports */
|
103 |
|
|
int neg_cbcp : 1; /* Negotiate use of CBCP */
|
104 |
|
|
u_short mru; /* Value of MRU */
|
105 |
|
|
u_char chap_mdtype; /* which MD type (hashing algorithm) */
|
106 |
|
|
u_int32_t asyncmap; /* Value of async map */
|
107 |
|
|
u_int32_t magicnumber;
|
108 |
|
|
int numloops; /* Number of loops during magic number neg. */
|
109 |
|
|
u_int32_t lqr_period; /* Reporting period for LQR 1/100ths second */
|
110 |
|
|
} lcp_options;
|
111 |
|
|
|
112 |
|
|
extern fsm lcp_fsm[];
|
113 |
|
|
extern lcp_options lcp_wantoptions[];
|
114 |
|
|
extern lcp_options lcp_gotoptions[];
|
115 |
|
|
extern lcp_options lcp_allowoptions[];
|
116 |
|
|
extern lcp_options lcp_hisoptions[];
|
117 |
|
|
extern u_int32_t xmit_accm[][8];
|
118 |
|
|
|
119 |
|
|
#define DEFMRU 1500 /* Try for this */
|
120 |
|
|
#define MINMRU 128 /* No MRUs below this */
|
121 |
|
|
#define MAXMRU 16384 /* Normally limit MRU to this */
|
122 |
|
|
|
123 |
|
|
void lcp_open __P((int));
|
124 |
|
|
void lcp_close __P((int, char *));
|
125 |
|
|
void lcp_lowerup __P((int));
|
126 |
|
|
void lcp_lowerdown __P((int));
|
127 |
|
|
void lcp_sprotrej __P((int, u_char *, int)); /* send protocol reject */
|
128 |
|
|
|
129 |
|
|
extern struct protent lcp_protent;
|
130 |
|
|
|
131 |
|
|
/* Default number of times we receive our magic number from the peer
|
132 |
|
|
before deciding the link is looped-back. */
|
133 |
|
|
#define DEFLOOPBACKFAIL 10
|