Onenet

Dependents:   K64F_eCompass_OneNET_JW

Committer:
robert_jw
Date:
Mon Jun 20 01:40:20 2016 +0000
Revision:
0:b2805b6888dc
ADS

Who changed what in which revision?

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