12Oct2012MbedLab

Dependents:   Lab3_VoiceMeter

Fork of EthernetNetIf by Donatien Garnier

Committer:
psawant9
Date:
Fri Oct 12 16:02:00 2012 +0000
Revision:
6:22ce63eddd2b
Parent:
0:422060928e37
Done

Who changed what in which revision?

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