Committer:
zoot661
Date:
Tue May 29 09:49:18 2012 +0000
Revision:
0:f993b6d8b1d8

        

Who changed what in which revision?

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