save loops

Dependencies:   mbed

Committer:
mbedalvaro
Date:
Tue Dec 02 08:29:59 2014 +0000
Revision:
1:3be7b7d050f4
Parent:
0:df6fdd9b99f0
updated

Who changed what in which revision?

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