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