1 |
583 |
jeremybenn |
/*****************************************************************************
|
2 |
|
|
* lcp.h - Network Link Control Protocol header file.
|
3 |
|
|
*
|
4 |
|
|
* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
|
5 |
|
|
* portions Copyright (c) 1997 Global Election Systems Inc.
|
6 |
|
|
*
|
7 |
|
|
* The authors hereby grant permission to use, copy, modify, distribute,
|
8 |
|
|
* and license this software and its documentation for any purpose, provided
|
9 |
|
|
* that existing copyright notices are retained in all copies and that this
|
10 |
|
|
* notice and the following disclaimer are included verbatim in any
|
11 |
|
|
* distributions. No written agreement, license, or royalty fee is required
|
12 |
|
|
* for any of the authorized uses.
|
13 |
|
|
*
|
14 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
|
15 |
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
16 |
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
17 |
|
|
* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
18 |
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
19 |
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
20 |
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
21 |
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
22 |
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
23 |
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
24 |
|
|
*
|
25 |
|
|
******************************************************************************
|
26 |
|
|
* REVISION HISTORY
|
27 |
|
|
*
|
28 |
|
|
* 03-01-01 Marc Boucher <marc@mbsi.ca>
|
29 |
|
|
* Ported to lwIP.
|
30 |
|
|
* 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
|
31 |
|
|
* Original derived from BSD codes.
|
32 |
|
|
*****************************************************************************/
|
33 |
|
|
/*
|
34 |
|
|
* lcp.h - Link Control Protocol definitions.
|
35 |
|
|
*
|
36 |
|
|
* Copyright (c) 1989 Carnegie Mellon University.
|
37 |
|
|
* All rights reserved.
|
38 |
|
|
*
|
39 |
|
|
* Redistribution and use in source and binary forms are permitted
|
40 |
|
|
* provided that the above copyright notice and this paragraph are
|
41 |
|
|
* duplicated in all such forms and that any documentation,
|
42 |
|
|
* advertising materials, and other materials related to such
|
43 |
|
|
* distribution and use acknowledge that the software was developed
|
44 |
|
|
* by Carnegie Mellon University. The name of the
|
45 |
|
|
* University may not be used to endorse or promote products derived
|
46 |
|
|
* from this software without specific prior written permission.
|
47 |
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
48 |
|
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
49 |
|
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
50 |
|
|
*
|
51 |
|
|
* $Id: lcp.h 2 2011-07-17 20:13:17Z filepang@gmail.com $
|
52 |
|
|
*/
|
53 |
|
|
|
54 |
|
|
#ifndef LCP_H
|
55 |
|
|
#define LCP_H
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
/*************************
|
59 |
|
|
*** PUBLIC DEFINITIONS ***
|
60 |
|
|
*************************/
|
61 |
|
|
/*
|
62 |
|
|
* Options.
|
63 |
|
|
*/
|
64 |
|
|
#define CI_MRU 1 /* Maximum Receive Unit */
|
65 |
|
|
#define CI_ASYNCMAP 2 /* Async Control Character Map */
|
66 |
|
|
#define CI_AUTHTYPE 3 /* Authentication Type */
|
67 |
|
|
#define CI_QUALITY 4 /* Quality Protocol */
|
68 |
|
|
#define CI_MAGICNUMBER 5 /* Magic Number */
|
69 |
|
|
#define CI_PCOMPRESSION 7 /* Protocol Field Compression */
|
70 |
|
|
#define CI_ACCOMPRESSION 8 /* Address/Control Field Compression */
|
71 |
|
|
#define CI_CALLBACK 13 /* callback */
|
72 |
|
|
#define CI_MRRU 17 /* max reconstructed receive unit; multilink */
|
73 |
|
|
#define CI_SSNHF 18 /* short sequence numbers for multilink */
|
74 |
|
|
#define CI_EPDISC 19 /* endpoint discriminator */
|
75 |
|
|
|
76 |
|
|
/*
|
77 |
|
|
* LCP-specific packet types.
|
78 |
|
|
*/
|
79 |
|
|
#define PROTREJ 8 /* Protocol Reject */
|
80 |
|
|
#define ECHOREQ 9 /* Echo Request */
|
81 |
|
|
#define ECHOREP 10 /* Echo Reply */
|
82 |
|
|
#define DISCREQ 11 /* Discard Request */
|
83 |
|
|
#define CBCP_OPT 6 /* Use callback control protocol */
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
/************************
|
87 |
|
|
*** PUBLIC DATA TYPES ***
|
88 |
|
|
************************/
|
89 |
|
|
|
90 |
|
|
/*
|
91 |
|
|
* The state of options is described by an lcp_options structure.
|
92 |
|
|
*/
|
93 |
|
|
typedef struct lcp_options {
|
94 |
|
|
u_int passive : 1; /* Don't die if we don't get a response */
|
95 |
|
|
u_int silent : 1; /* Wait for the other end to start first */
|
96 |
|
|
u_int restart : 1; /* Restart vs. exit after close */
|
97 |
|
|
u_int neg_mru : 1; /* Negotiate the MRU? */
|
98 |
|
|
u_int neg_asyncmap : 1; /* Negotiate the async map? */
|
99 |
|
|
u_int neg_upap : 1; /* Ask for UPAP authentication? */
|
100 |
|
|
u_int neg_chap : 1; /* Ask for CHAP authentication? */
|
101 |
|
|
u_int neg_magicnumber : 1; /* Ask for magic number? */
|
102 |
|
|
u_int neg_pcompression : 1; /* HDLC Protocol Field Compression? */
|
103 |
|
|
u_int neg_accompression : 1; /* HDLC Address/Control Field Compression? */
|
104 |
|
|
u_int neg_lqr : 1; /* Negotiate use of Link Quality Reports */
|
105 |
|
|
u_int neg_cbcp : 1; /* Negotiate use of CBCP */
|
106 |
|
|
#ifdef PPP_MULTILINK
|
107 |
|
|
u_int neg_mrru : 1; /* Negotiate multilink MRRU */
|
108 |
|
|
u_int neg_ssnhf : 1; /* Negotiate short sequence numbers */
|
109 |
|
|
u_int neg_endpoint : 1; /* Negotiate endpoint discriminator */
|
110 |
|
|
#endif
|
111 |
|
|
u_short mru; /* Value of MRU */
|
112 |
|
|
#ifdef PPP_MULTILINK
|
113 |
|
|
u_short mrru; /* Value of MRRU, and multilink enable */
|
114 |
|
|
#endif
|
115 |
|
|
u_char chap_mdtype; /* which MD type (hashing algorithm) */
|
116 |
|
|
u32_t asyncmap; /* Value of async map */
|
117 |
|
|
u32_t magicnumber;
|
118 |
|
|
int numloops; /* Number of loops during magic number neg. */
|
119 |
|
|
u32_t lqr_period; /* Reporting period for LQR 1/100ths second */
|
120 |
|
|
#ifdef PPP_MULTILINK
|
121 |
|
|
struct epdisc endpoint; /* endpoint discriminator */
|
122 |
|
|
#endif
|
123 |
|
|
} lcp_options;
|
124 |
|
|
|
125 |
|
|
/*
|
126 |
|
|
* Values for phase from BSD pppd.h based on RFC 1661.
|
127 |
|
|
*/
|
128 |
|
|
typedef enum {
|
129 |
|
|
PHASE_DEAD = 0,
|
130 |
|
|
PHASE_INITIALIZE,
|
131 |
|
|
PHASE_ESTABLISH,
|
132 |
|
|
PHASE_AUTHENTICATE,
|
133 |
|
|
PHASE_CALLBACK,
|
134 |
|
|
PHASE_NETWORK,
|
135 |
|
|
PHASE_TERMINATE
|
136 |
|
|
} LinkPhase;
|
137 |
|
|
|
138 |
|
|
|
139 |
|
|
/*****************************
|
140 |
|
|
*** PUBLIC DATA STRUCTURES ***
|
141 |
|
|
*****************************/
|
142 |
|
|
|
143 |
|
|
extern LinkPhase lcp_phase[NUM_PPP]; /* Phase of link session (RFC 1661) */
|
144 |
|
|
extern lcp_options lcp_wantoptions[];
|
145 |
|
|
extern lcp_options lcp_gotoptions[];
|
146 |
|
|
extern lcp_options lcp_allowoptions[];
|
147 |
|
|
extern lcp_options lcp_hisoptions[];
|
148 |
|
|
extern ext_accm xmit_accm[];
|
149 |
|
|
|
150 |
|
|
|
151 |
|
|
/***********************
|
152 |
|
|
*** PUBLIC FUNCTIONS ***
|
153 |
|
|
***********************/
|
154 |
|
|
|
155 |
|
|
void lcp_init (int);
|
156 |
|
|
void lcp_open (int);
|
157 |
|
|
void lcp_close (int, char *);
|
158 |
|
|
void lcp_lowerup (int);
|
159 |
|
|
void lcp_lowerdown (int);
|
160 |
|
|
void lcp_sprotrej (int, u_char *, int); /* send protocol reject */
|
161 |
|
|
|
162 |
|
|
extern struct protent lcp_protent;
|
163 |
|
|
|
164 |
|
|
/* Default number of times we receive our magic number from the peer
|
165 |
|
|
before deciding the link is looped-back. */
|
166 |
|
|
#define DEFLOOPBACKFAIL 10
|
167 |
|
|
|
168 |
|
|
#endif /* LCP_H */
|
169 |
|
|
|