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