Dependents:   SNMPAgent HTTPServer think_speak_a cyassl-client ... more

Committer:
mamezu
Date:
Thu Dec 09 01:33:56 2010 +0000
Revision:
0:0f6c82fcde82

        

Who changed what in which revision?

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