First step: AutoIP compiled in and working

Dependencies:   mbed

Committer:
darran
Date:
Fri Jun 18 15:54:21 2010 +0000
Revision:
1:4218cacaf696
Parent:
0:55a05330f8cc

        

Who changed what in which revision?

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