Library for Bert van Dam's book "ARM MICROCONTROLLERS" For all chapters with internet.

Dependencies:   mbed

Committer:
ICTFBI
Date:
Fri Oct 16 14:28:26 2015 +0000
Revision:
0:4edb816d21e1
Pre-update 16-10-15

Who changed what in which revision?

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