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