Dependents:   RTnoV3 RTnoV3_LED RTnoV3_Template RTnoV3_ADC ... more

Committer:
sherckuith
Date:
Sat Dec 31 11:25:27 2011 +0000
Revision:
0:479ce5546098
Ethernet

Who changed what in which revision?

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