testing of combination of LCS and LAN

Dependencies:   mbed

Committer:
damir
Date:
Wed Jan 14 13:29:55 2015 +0000
Revision:
0:a7a6a692162f
Test of LAN

Who changed what in which revision?

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