12Oct2012MbedLab

Dependents:   Lab3_VoiceMeter

Fork of EthernetNetIf by Donatien Garnier

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers lcp.h Source File

lcp.h

00001 /*****************************************************************************
00002 * lcp.h - Network Link Control Protocol header file.
00003 *
00004 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
00005 * portions Copyright (c) 1997 Global Election Systems Inc.
00006 *
00007 * The authors hereby grant permission to use, copy, modify, distribute,
00008 * and license this software and its documentation for any purpose, provided
00009 * that existing copyright notices are retained in all copies and that this
00010 * notice and the following disclaimer are included verbatim in any 
00011 * distributions. No written agreement, license, or royalty fee is required
00012 * for any of the authorized uses.
00013 *
00014 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
00015 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00016 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
00017 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00018 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00019 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00020 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00021 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00022 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00023 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00024 *
00025 ******************************************************************************
00026 * REVISION HISTORY
00027 *
00028 * 03-01-01 Marc Boucher <marc@mbsi.ca>
00029 *   Ported to lwIP.
00030 * 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
00031 *   Original derived from BSD codes.
00032 *****************************************************************************/
00033 /*
00034  * lcp.h - Link Control Protocol definitions.
00035  *
00036  * Copyright (c) 1989 Carnegie Mellon University.
00037  * All rights reserved.
00038  *
00039  * Redistribution and use in source and binary forms are permitted
00040  * provided that the above copyright notice and this paragraph are
00041  * duplicated in all such forms and that any documentation,
00042  * advertising materials, and other materials related to such
00043  * distribution and use acknowledge that the software was developed
00044  * by Carnegie Mellon University.  The name of the
00045  * University may not be used to endorse or promote products derived
00046  * from this software without specific prior written permission.
00047  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
00048  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
00049  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00050  *
00051  * $Id: lcp.h,v 1.4 2010/01/18 20:49:43 goldsimon Exp $
00052  */
00053 
00054 #ifndef LCP_H
00055 #define LCP_H
00056 /*
00057  * Options.
00058  */
00059 #define CI_MRU           1  /* Maximum Receive Unit */
00060 #define CI_ASYNCMAP      2  /* Async Control Character Map */
00061 #define CI_AUTHTYPE      3  /* Authentication Type */
00062 #define CI_QUALITY       4  /* Quality Protocol */
00063 #define CI_MAGICNUMBER   5  /* Magic Number */
00064 #define CI_PCOMPRESSION  7  /* Protocol Field Compression */
00065 #define CI_ACCOMPRESSION 8  /* Address/Control Field Compression */
00066 #define CI_CALLBACK      13 /* callback */
00067 #define CI_MRRU          17 /* max reconstructed receive unit; multilink */
00068 #define CI_SSNHF         18 /* short sequence numbers for multilink */
00069 #define CI_EPDISC        19 /* endpoint discriminator */
00070 
00071 /*
00072  * LCP-specific packet types (code numbers).
00073  */
00074 #define PROTREJ          8  /* Protocol Reject */
00075 #define ECHOREQ          9  /* Echo Request */
00076 #define ECHOREP          10 /* Echo Reply */
00077 #define DISCREQ          11 /* Discard Request */
00078 #define CBCP_OPT         6  /* Use callback control protocol */
00079 
00080 /*
00081  * The state of options is described by an lcp_options structure.
00082  */
00083 typedef struct lcp_options {
00084     u_int passive           : 1; /* Don't die if we don't get a response */
00085     u_int silent            : 1; /* Wait for the other end to start first */
00086     u_int restart           : 1; /* Restart vs. exit after close */
00087     u_int neg_mru           : 1; /* Negotiate the MRU? */
00088     u_int neg_asyncmap      : 1; /* Negotiate the async map? */
00089     u_int neg_upap          : 1; /* Ask for UPAP authentication? */
00090     u_int neg_chap          : 1; /* Ask for CHAP authentication? */
00091     u_int neg_magicnumber   : 1; /* Ask for magic number? */
00092     u_int neg_pcompression  : 1; /* HDLC Protocol Field Compression? */
00093     u_int neg_accompression : 1; /* HDLC Address/Control Field Compression? */
00094     u_int neg_lqr           : 1; /* Negotiate use of Link Quality Reports */
00095     u_int neg_cbcp          : 1; /* Negotiate use of CBCP */
00096 #ifdef PPP_MULTILINK
00097     u_int neg_mrru          : 1; /* Negotiate multilink MRRU */
00098     u_int neg_ssnhf         : 1; /* Negotiate short sequence numbers */
00099     u_int neg_endpoint      : 1; /* Negotiate endpoint discriminator */
00100 #endif
00101     u_short mru;                 /* Value of MRU */
00102 #ifdef PPP_MULTILINK
00103     u_short mrru;                /* Value of MRRU, and multilink enable */
00104 #endif
00105     u_char chap_mdtype;          /* which MD type (hashing algorithm) */
00106     u32_t asyncmap;              /* Value of async map */
00107     u32_t magicnumber;
00108     int numloops;                /* Number of loops during magic number neg. */
00109     u32_t lqr_period;            /* Reporting period for LQR 1/100ths second */
00110 #ifdef PPP_MULTILINK
00111     struct epdisc endpoint;      /* endpoint discriminator */
00112 #endif
00113 } lcp_options;
00114 
00115 /*
00116  * Values for phase from BSD pppd.h based on RFC 1661.
00117  */
00118 typedef enum {
00119   PHASE_DEAD = 0,
00120   PHASE_INITIALIZE,
00121   PHASE_ESTABLISH,
00122   PHASE_AUTHENTICATE,
00123   PHASE_CALLBACK,
00124   PHASE_NETWORK,
00125   PHASE_TERMINATE
00126 } LinkPhase;
00127 
00128 
00129 
00130 extern LinkPhase lcp_phase[NUM_PPP]; /* Phase of link session (RFC 1661) */
00131 extern lcp_options lcp_wantoptions[];
00132 extern lcp_options lcp_gotoptions[];
00133 extern lcp_options lcp_allowoptions[];
00134 extern lcp_options lcp_hisoptions[];
00135 extern ext_accm xmit_accm[];
00136 
00137 
00138 void lcp_init     (int);
00139 void lcp_open     (int);
00140 void lcp_close    (int, char *);
00141 void lcp_lowerup  (int);
00142 void lcp_lowerdown(int);
00143 void lcp_sprotrej (int, u_char *, int); /* send protocol reject */
00144 
00145 extern struct protent lcp_protent;
00146 
00147 /* Default number of times we receive our magic number from the peer
00148    before deciding the link is looped-back. */
00149 #define DEFLOOPBACKFAIL 10
00150 
00151 #endif /* LCP_H */