EthernetNetIf

Dependents:   XBee_WiFi_EA_LPC4088

Committer:
hmike
Date:
Wed Nov 19 12:00:42 2014 +0000
Revision:
0:62580107d20c
EthernetNetIf

Who changed what in which revision?

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