Measure system

Dependencies:   EthernetNetIf mbed RF12B

Committer:
benecsj
Date:
Thu Mar 10 19:56:45 2011 +0000
Revision:
1:b26ab2467b1a

        

Who changed what in which revision?

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