Dependencies:   mbed

Committer:
robertcook
Date:
Wed Jun 13 18:39:46 2012 +0000
Revision:
0:32a0996dff0f

        

Who changed what in which revision?

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