Version of http://mbed.org/cookbook/NetServicesTribute with setting set the same for LPC2368

Dependents:   UDPSocketExample 24LCxx_I2CApp WeatherPlatform_pachube HvZServerLib ... more

Committer:
simon
Date:
Tue Nov 23 14:15:36 2010 +0000
Revision:
0:350011bf8be7
Experimental version for testing UDP

Who changed what in which revision?

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