hattori&ide

Dependencies:   mbed

Committer:
hattori_atsushi
Date:
Sun Dec 18 08:16:01 2022 +0000
Revision:
0:f77369cabd75
hattori

Who changed what in which revision?

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