This library is stripped down version of NetServices library. HTTP server and client function is NOT supported.

Dependents:   imu-daq-eth

Committer:
idinor
Date:
Wed Jul 20 11:45:39 2011 +0000
Revision:
0:dcf3c92487ca

        

Who changed what in which revision?

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