Example self-announcing webserver which controls a servo through a smallHTML userinterface.

Dependencies:   mbed

Committer:
dirkx
Date:
Sat Aug 14 15:56:01 2010 +0000
Revision:
0:a259777c45a3

        

Who changed what in which revision?

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