Brandon Fictorie / Mbed 2 deprecated BF_Websocket

Dependencies:   mbed

Committer:
bfictorie
Date:
Sun Mar 25 17:26:30 2012 +0000
Revision:
0:8cdad1c73e8e

        

Who changed what in which revision?

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