Michael Fischler / Mbed 2 deprecated Contest_Winner

Dependencies:   mbed

Committer:
mafischl
Date:
Thu Oct 13 17:02:29 2011 +0000
Revision:
0:d9266031f832

        

Who changed what in which revision?

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