Leest de waarde van een sensor binnen een maakt deze beschikbaar via internet

Dependencies:   NTPClient_NetServices mbed

Committer:
hendrikvincent
Date:
Mon Dec 02 09:01:23 2013 +0000
Revision:
0:05ccbd4f84f1
eerste programma;

Who changed what in which revision?

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