SAMV71 Xplained Ultra Software Package 1.4

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.3 2007/12/19 20:47:23 fbernon Exp $
00052  */
00053 
00054 #ifndef LCP_H
00055 #define LCP_H
00056 
00057 /*************************
00058 *** PUBLIC DEFINITIONS ***
00059 *************************/
00060 /*
00061  * Options.
00062  */
00063 #define CI_MRU           1  /* Maximum Receive Unit */
00064 #define CI_ASYNCMAP      2  /* Async Control Character Map */
00065 #define CI_AUTHTYPE      3  /* Authentication Type */
00066 #define CI_QUALITY       4  /* Quality Protocol */
00067 #define CI_MAGICNUMBER   5  /* Magic Number */
00068 #define CI_PCOMPRESSION  7  /* Protocol Field Compression */
00069 #define CI_ACCOMPRESSION 8  /* Address/Control Field Compression */
00070 #define CI_CALLBACK      13 /* callback */
00071 #define CI_MRRU          17 /* max reconstructed receive unit; multilink */
00072 #define CI_SSNHF         18 /* short sequence numbers for multilink */
00073 #define CI_EPDISC        19 /* endpoint discriminator */
00074 
00075 /*
00076  * LCP-specific packet types.
00077  */
00078 #define PROTREJ          8  /* Protocol Reject */
00079 #define ECHOREQ          9  /* Echo Request */
00080 #define ECHOREP          10 /* Echo Reply */
00081 #define DISCREQ          11 /* Discard Request */
00082 #define CBCP_OPT         6  /* Use callback control protocol */
00083 
00084 
00085 /************************
00086 *** PUBLIC DATA TYPES ***
00087 ************************/
00088 
00089 /*
00090  * The state of options is described by an lcp_options structure.
00091  */
00092 typedef struct lcp_options {
00093     u_int passive           : 1; /* Don't die if we don't get a response */
00094     u_int silent            : 1; /* Wait for the other end to start first */
00095     u_int restart           : 1; /* Restart vs. exit after close */
00096     u_int neg_mru           : 1; /* Negotiate the MRU? */
00097     u_int neg_asyncmap      : 1; /* Negotiate the async map? */
00098     u_int neg_upap          : 1; /* Ask for UPAP authentication? */
00099     u_int neg_chap          : 1; /* Ask for CHAP authentication? */
00100     u_int neg_magicnumber   : 1; /* Ask for magic number? */
00101     u_int neg_pcompression  : 1; /* HDLC Protocol Field Compression? */
00102     u_int neg_accompression : 1; /* HDLC Address/Control Field Compression? */
00103     u_int neg_lqr           : 1; /* Negotiate use of Link Quality Reports */
00104     u_int neg_cbcp          : 1; /* Negotiate use of CBCP */
00105 #ifdef PPP_MULTILINK
00106     u_int neg_mrru          : 1; /* Negotiate multilink MRRU */
00107     u_int neg_ssnhf         : 1; /* Negotiate short sequence numbers */
00108     u_int neg_endpoint      : 1; /* Negotiate endpoint discriminator */
00109 #endif
00110     u_short mru;                 /* Value of MRU */
00111 #ifdef PPP_MULTILINK
00112     u_short mrru;                /* Value of MRRU, and multilink enable */
00113 #endif
00114     u_char chap_mdtype;          /* which MD type (hashing algorithm) */
00115     u32_t asyncmap;              /* Value of async map */
00116     u32_t magicnumber;
00117     int numloops;                /* Number of loops during magic number neg. */
00118     u32_t lqr_period;            /* Reporting period for LQR 1/100ths second */
00119 #ifdef PPP_MULTILINK
00120     struct epdisc endpoint;      /* endpoint discriminator */
00121 #endif
00122 } lcp_options;
00123 
00124 /*
00125  * Values for phase from BSD pppd.h based on RFC 1661.
00126  */
00127 typedef enum {
00128   PHASE_DEAD = 0,
00129   PHASE_INITIALIZE,
00130   PHASE_ESTABLISH,
00131   PHASE_AUTHENTICATE,
00132   PHASE_CALLBACK,
00133   PHASE_NETWORK,
00134   PHASE_TERMINATE
00135 } LinkPhase;
00136 
00137 
00138 /*****************************
00139 *** PUBLIC DATA STRUCTURES ***
00140 *****************************/
00141 
00142 extern LinkPhase lcp_phase[NUM_PPP]; /* Phase of link session (RFC 1661) */
00143 extern lcp_options lcp_wantoptions[];
00144 extern lcp_options lcp_gotoptions[];
00145 extern lcp_options lcp_allowoptions[];
00146 extern lcp_options lcp_hisoptions[];
00147 extern ext_accm xmit_accm[];
00148 
00149 
00150 /***********************
00151 *** PUBLIC FUNCTIONS ***
00152 ***********************/
00153 
00154 void lcp_init     (int);
00155 void lcp_open     (int);
00156 void lcp_close    (int, char *);
00157 void lcp_lowerup  (int);
00158 void lcp_lowerdown(int);
00159 void lcp_sprotrej (int, u_char *, int); /* send protocol reject */
00160 
00161 extern struct protent lcp_protent;
00162 
00163 /* Default number of times we receive our magic number from the peer
00164    before deciding the link is looped-back. */
00165 #define DEFLOOPBACKFAIL 10
00166 
00167 #endif /* LCP_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines