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