Xbee test 2

Dependencies:   XBee mbed

Committer:
takashiyamanoue
Date:
Sat Jul 21 04:08:27 2012 +0000
Revision:
0:ffac63d6a7f0
xbee test 2

Who changed what in which revision?

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