takashi yamanoue
/
XBee_API_ex2
Xbee test 2
LPC1768/lwip/netif/ppp/ppp.h@0:ffac63d6a7f0, 2012-07-21 (annotated)
- Committer:
- takashiyamanoue
- Date:
- Sat Jul 21 04:08:27 2012 +0000
- Revision:
- 0:ffac63d6a7f0
xbee test 2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
takashiyamanoue | 0:ffac63d6a7f0 | 1 | /***************************************************************************** |
takashiyamanoue | 0:ffac63d6a7f0 | 2 | * ppp.h - Network Point to Point 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 | #ifndef PPP_H |
takashiyamanoue | 0:ffac63d6a7f0 | 35 | #define PPP_H |
takashiyamanoue | 0:ffac63d6a7f0 | 36 | |
takashiyamanoue | 0:ffac63d6a7f0 | 37 | #include "lwip/opt.h" |
takashiyamanoue | 0:ffac63d6a7f0 | 38 | |
takashiyamanoue | 0:ffac63d6a7f0 | 39 | #if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ |
takashiyamanoue | 0:ffac63d6a7f0 | 40 | |
takashiyamanoue | 0:ffac63d6a7f0 | 41 | #include "lwip/def.h" |
takashiyamanoue | 0:ffac63d6a7f0 | 42 | #include "lwip/sio.h" |
takashiyamanoue | 0:ffac63d6a7f0 | 43 | #include "lwip/stats.h" |
takashiyamanoue | 0:ffac63d6a7f0 | 44 | #include "lwip/mem.h" |
takashiyamanoue | 0:ffac63d6a7f0 | 45 | #include "lwip/netif.h" |
takashiyamanoue | 0:ffac63d6a7f0 | 46 | #include "lwip/sys.h" |
takashiyamanoue | 0:ffac63d6a7f0 | 47 | #include "lwip/timers.h" |
takashiyamanoue | 0:ffac63d6a7f0 | 48 | |
takashiyamanoue | 0:ffac63d6a7f0 | 49 | /** Some defines for code we skip compared to the original pppd. |
takashiyamanoue | 0:ffac63d6a7f0 | 50 | * These are just here to minimise the use of the ugly "#if 0". */ |
takashiyamanoue | 0:ffac63d6a7f0 | 51 | #define PPP_ADDITIONAL_CALLBACKS 0 |
takashiyamanoue | 0:ffac63d6a7f0 | 52 | |
takashiyamanoue | 0:ffac63d6a7f0 | 53 | /** Some error checks to test for unsupported code */ |
takashiyamanoue | 0:ffac63d6a7f0 | 54 | #if CBCP_SUPPORT |
takashiyamanoue | 0:ffac63d6a7f0 | 55 | #error "CBCP is not supported in lwIP PPP" |
takashiyamanoue | 0:ffac63d6a7f0 | 56 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 57 | #if CCP_SUPPORT |
takashiyamanoue | 0:ffac63d6a7f0 | 58 | #error "CCP is not supported in lwIP PPP" |
takashiyamanoue | 0:ffac63d6a7f0 | 59 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 60 | |
takashiyamanoue | 0:ffac63d6a7f0 | 61 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 62 | * pppd.h - PPP daemon global declarations. |
takashiyamanoue | 0:ffac63d6a7f0 | 63 | * |
takashiyamanoue | 0:ffac63d6a7f0 | 64 | * Copyright (c) 1989 Carnegie Mellon University. |
takashiyamanoue | 0:ffac63d6a7f0 | 65 | * All rights reserved. |
takashiyamanoue | 0:ffac63d6a7f0 | 66 | * |
takashiyamanoue | 0:ffac63d6a7f0 | 67 | * Redistribution and use in source and binary forms are permitted |
takashiyamanoue | 0:ffac63d6a7f0 | 68 | * provided that the above copyright notice and this paragraph are |
takashiyamanoue | 0:ffac63d6a7f0 | 69 | * duplicated in all such forms and that any documentation, |
takashiyamanoue | 0:ffac63d6a7f0 | 70 | * advertising materials, and other materials related to such |
takashiyamanoue | 0:ffac63d6a7f0 | 71 | * distribution and use acknowledge that the software was developed |
takashiyamanoue | 0:ffac63d6a7f0 | 72 | * by Carnegie Mellon University. The name of the |
takashiyamanoue | 0:ffac63d6a7f0 | 73 | * University may not be used to endorse or promote products derived |
takashiyamanoue | 0:ffac63d6a7f0 | 74 | * from this software without specific prior written permission. |
takashiyamanoue | 0:ffac63d6a7f0 | 75 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
takashiyamanoue | 0:ffac63d6a7f0 | 76 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
takashiyamanoue | 0:ffac63d6a7f0 | 77 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
takashiyamanoue | 0:ffac63d6a7f0 | 78 | * |
takashiyamanoue | 0:ffac63d6a7f0 | 79 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 80 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 81 | * ppp_defs.h - PPP definitions. |
takashiyamanoue | 0:ffac63d6a7f0 | 82 | * |
takashiyamanoue | 0:ffac63d6a7f0 | 83 | * Copyright (c) 1994 The Australian National University. |
takashiyamanoue | 0:ffac63d6a7f0 | 84 | * All rights reserved. |
takashiyamanoue | 0:ffac63d6a7f0 | 85 | * |
takashiyamanoue | 0:ffac63d6a7f0 | 86 | * Permission to use, copy, modify, and distribute this software and its |
takashiyamanoue | 0:ffac63d6a7f0 | 87 | * documentation is hereby granted, provided that the above copyright |
takashiyamanoue | 0:ffac63d6a7f0 | 88 | * notice appears in all copies. This software is provided without any |
takashiyamanoue | 0:ffac63d6a7f0 | 89 | * warranty, express or implied. The Australian National University |
takashiyamanoue | 0:ffac63d6a7f0 | 90 | * makes no representations about the suitability of this software for |
takashiyamanoue | 0:ffac63d6a7f0 | 91 | * any purpose. |
takashiyamanoue | 0:ffac63d6a7f0 | 92 | * |
takashiyamanoue | 0:ffac63d6a7f0 | 93 | * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY |
takashiyamanoue | 0:ffac63d6a7f0 | 94 | * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
takashiyamanoue | 0:ffac63d6a7f0 | 95 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF |
takashiyamanoue | 0:ffac63d6a7f0 | 96 | * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY |
takashiyamanoue | 0:ffac63d6a7f0 | 97 | * OF SUCH DAMAGE. |
takashiyamanoue | 0:ffac63d6a7f0 | 98 | * |
takashiyamanoue | 0:ffac63d6a7f0 | 99 | * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, |
takashiyamanoue | 0:ffac63d6a7f0 | 100 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
takashiyamanoue | 0:ffac63d6a7f0 | 101 | * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
takashiyamanoue | 0:ffac63d6a7f0 | 102 | * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO |
takashiyamanoue | 0:ffac63d6a7f0 | 103 | * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, |
takashiyamanoue | 0:ffac63d6a7f0 | 104 | * OR MODIFICATIONS. |
takashiyamanoue | 0:ffac63d6a7f0 | 105 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 106 | |
takashiyamanoue | 0:ffac63d6a7f0 | 107 | #define TIMEOUT(f, a, t) do { sys_untimeout((f), (a)); sys_timeout((t)*1000, (f), (a)); } while(0) |
takashiyamanoue | 0:ffac63d6a7f0 | 108 | #define UNTIMEOUT(f, a) sys_untimeout((f), (a)) |
takashiyamanoue | 0:ffac63d6a7f0 | 109 | |
takashiyamanoue | 0:ffac63d6a7f0 | 110 | |
takashiyamanoue | 0:ffac63d6a7f0 | 111 | #ifndef __u_char_defined |
takashiyamanoue | 0:ffac63d6a7f0 | 112 | |
takashiyamanoue | 0:ffac63d6a7f0 | 113 | /* Type definitions for BSD code. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 114 | typedef unsigned long u_long; |
takashiyamanoue | 0:ffac63d6a7f0 | 115 | typedef unsigned int u_int; |
takashiyamanoue | 0:ffac63d6a7f0 | 116 | typedef unsigned short u_short; |
takashiyamanoue | 0:ffac63d6a7f0 | 117 | typedef unsigned char u_char; |
takashiyamanoue | 0:ffac63d6a7f0 | 118 | |
takashiyamanoue | 0:ffac63d6a7f0 | 119 | #endif |
takashiyamanoue | 0:ffac63d6a7f0 | 120 | |
takashiyamanoue | 0:ffac63d6a7f0 | 121 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 122 | * Constants and structures defined by the internet system, |
takashiyamanoue | 0:ffac63d6a7f0 | 123 | * Per RFC 790, September 1981, and numerous additions. |
takashiyamanoue | 0:ffac63d6a7f0 | 124 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 125 | |
takashiyamanoue | 0:ffac63d6a7f0 | 126 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 127 | * The basic PPP frame. |
takashiyamanoue | 0:ffac63d6a7f0 | 128 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 129 | #define PPP_HDRLEN 4 /* octets for standard ppp header */ |
takashiyamanoue | 0:ffac63d6a7f0 | 130 | #define PPP_FCSLEN 2 /* octets for FCS */ |
takashiyamanoue | 0:ffac63d6a7f0 | 131 | |
takashiyamanoue | 0:ffac63d6a7f0 | 132 | |
takashiyamanoue | 0:ffac63d6a7f0 | 133 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 134 | * Significant octet values. |
takashiyamanoue | 0:ffac63d6a7f0 | 135 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 136 | #define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ |
takashiyamanoue | 0:ffac63d6a7f0 | 137 | #define PPP_UI 0x03 /* Unnumbered Information */ |
takashiyamanoue | 0:ffac63d6a7f0 | 138 | #define PPP_FLAG 0x7e /* Flag Sequence */ |
takashiyamanoue | 0:ffac63d6a7f0 | 139 | #define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */ |
takashiyamanoue | 0:ffac63d6a7f0 | 140 | #define PPP_TRANS 0x20 /* Asynchronous transparency modifier */ |
takashiyamanoue | 0:ffac63d6a7f0 | 141 | |
takashiyamanoue | 0:ffac63d6a7f0 | 142 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 143 | * Protocol field values. |
takashiyamanoue | 0:ffac63d6a7f0 | 144 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 145 | #define PPP_IP 0x21 /* Internet Protocol */ |
takashiyamanoue | 0:ffac63d6a7f0 | 146 | #define PPP_AT 0x29 /* AppleTalk Protocol */ |
takashiyamanoue | 0:ffac63d6a7f0 | 147 | #define PPP_VJC_COMP 0x2d /* VJ compressed TCP */ |
takashiyamanoue | 0:ffac63d6a7f0 | 148 | #define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */ |
takashiyamanoue | 0:ffac63d6a7f0 | 149 | #define PPP_COMP 0xfd /* compressed packet */ |
takashiyamanoue | 0:ffac63d6a7f0 | 150 | #define PPP_IPCP 0x8021 /* IP Control Protocol */ |
takashiyamanoue | 0:ffac63d6a7f0 | 151 | #define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */ |
takashiyamanoue | 0:ffac63d6a7f0 | 152 | #define PPP_CCP 0x80fd /* Compression Control Protocol */ |
takashiyamanoue | 0:ffac63d6a7f0 | 153 | #define PPP_LCP 0xc021 /* Link Control Protocol */ |
takashiyamanoue | 0:ffac63d6a7f0 | 154 | #define PPP_PAP 0xc023 /* Password Authentication Protocol */ |
takashiyamanoue | 0:ffac63d6a7f0 | 155 | #define PPP_LQR 0xc025 /* Link Quality Report protocol */ |
takashiyamanoue | 0:ffac63d6a7f0 | 156 | #define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */ |
takashiyamanoue | 0:ffac63d6a7f0 | 157 | #define PPP_CBCP 0xc029 /* Callback Control Protocol */ |
takashiyamanoue | 0:ffac63d6a7f0 | 158 | |
takashiyamanoue | 0:ffac63d6a7f0 | 159 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 160 | * Values for FCS calculations. |
takashiyamanoue | 0:ffac63d6a7f0 | 161 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 162 | #define PPP_INITFCS 0xffff /* Initial FCS value */ |
takashiyamanoue | 0:ffac63d6a7f0 | 163 | #define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ |
takashiyamanoue | 0:ffac63d6a7f0 | 164 | #define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff]) |
takashiyamanoue | 0:ffac63d6a7f0 | 165 | |
takashiyamanoue | 0:ffac63d6a7f0 | 166 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 167 | * Extended asyncmap - allows any character to be escaped. |
takashiyamanoue | 0:ffac63d6a7f0 | 168 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 169 | typedef u_char ext_accm[32]; |
takashiyamanoue | 0:ffac63d6a7f0 | 170 | |
takashiyamanoue | 0:ffac63d6a7f0 | 171 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 172 | * What to do with network protocol (NP) packets. |
takashiyamanoue | 0:ffac63d6a7f0 | 173 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 174 | enum NPmode { |
takashiyamanoue | 0:ffac63d6a7f0 | 175 | NPMODE_PASS, /* pass the packet through */ |
takashiyamanoue | 0:ffac63d6a7f0 | 176 | NPMODE_DROP, /* silently drop the packet */ |
takashiyamanoue | 0:ffac63d6a7f0 | 177 | NPMODE_ERROR, /* return an error */ |
takashiyamanoue | 0:ffac63d6a7f0 | 178 | NPMODE_QUEUE /* save it up for later. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 179 | }; |
takashiyamanoue | 0:ffac63d6a7f0 | 180 | |
takashiyamanoue | 0:ffac63d6a7f0 | 181 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 182 | * Inline versions of get/put char/short/long. |
takashiyamanoue | 0:ffac63d6a7f0 | 183 | * Pointer is advanced; we assume that both arguments |
takashiyamanoue | 0:ffac63d6a7f0 | 184 | * are lvalues and will already be in registers. |
takashiyamanoue | 0:ffac63d6a7f0 | 185 | * cp MUST be u_char *. |
takashiyamanoue | 0:ffac63d6a7f0 | 186 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 187 | #define GETCHAR(c, cp) { \ |
takashiyamanoue | 0:ffac63d6a7f0 | 188 | (c) = *(cp)++; \ |
takashiyamanoue | 0:ffac63d6a7f0 | 189 | } |
takashiyamanoue | 0:ffac63d6a7f0 | 190 | #define PUTCHAR(c, cp) { \ |
takashiyamanoue | 0:ffac63d6a7f0 | 191 | *(cp)++ = (u_char) (c); \ |
takashiyamanoue | 0:ffac63d6a7f0 | 192 | } |
takashiyamanoue | 0:ffac63d6a7f0 | 193 | |
takashiyamanoue | 0:ffac63d6a7f0 | 194 | |
takashiyamanoue | 0:ffac63d6a7f0 | 195 | #define GETSHORT(s, cp) { \ |
takashiyamanoue | 0:ffac63d6a7f0 | 196 | (s) = *(cp); (cp)++; (s) <<= 8; \ |
takashiyamanoue | 0:ffac63d6a7f0 | 197 | (s) |= *(cp); (cp)++; \ |
takashiyamanoue | 0:ffac63d6a7f0 | 198 | } |
takashiyamanoue | 0:ffac63d6a7f0 | 199 | #define PUTSHORT(s, cp) { \ |
takashiyamanoue | 0:ffac63d6a7f0 | 200 | *(cp)++ = (u_char) ((s) >> 8); \ |
takashiyamanoue | 0:ffac63d6a7f0 | 201 | *(cp)++ = (u_char) (s & 0xff); \ |
takashiyamanoue | 0:ffac63d6a7f0 | 202 | } |
takashiyamanoue | 0:ffac63d6a7f0 | 203 | |
takashiyamanoue | 0:ffac63d6a7f0 | 204 | #define GETLONG(l, cp) { \ |
takashiyamanoue | 0:ffac63d6a7f0 | 205 | (l) = *(cp); (cp)++; (l) <<= 8; \ |
takashiyamanoue | 0:ffac63d6a7f0 | 206 | (l) |= *(cp); (cp)++; (l) <<= 8; \ |
takashiyamanoue | 0:ffac63d6a7f0 | 207 | (l) |= *(cp); (cp)++; (l) <<= 8; \ |
takashiyamanoue | 0:ffac63d6a7f0 | 208 | (l) |= *(cp); (cp)++; \ |
takashiyamanoue | 0:ffac63d6a7f0 | 209 | } |
takashiyamanoue | 0:ffac63d6a7f0 | 210 | #define PUTLONG(l, cp) { \ |
takashiyamanoue | 0:ffac63d6a7f0 | 211 | *(cp)++ = (u_char) ((l) >> 24); \ |
takashiyamanoue | 0:ffac63d6a7f0 | 212 | *(cp)++ = (u_char) ((l) >> 16); \ |
takashiyamanoue | 0:ffac63d6a7f0 | 213 | *(cp)++ = (u_char) ((l) >> 8); \ |
takashiyamanoue | 0:ffac63d6a7f0 | 214 | *(cp)++ = (u_char) (l); \ |
takashiyamanoue | 0:ffac63d6a7f0 | 215 | } |
takashiyamanoue | 0:ffac63d6a7f0 | 216 | |
takashiyamanoue | 0:ffac63d6a7f0 | 217 | |
takashiyamanoue | 0:ffac63d6a7f0 | 218 | #define INCPTR(n, cp) ((cp) += (n)) |
takashiyamanoue | 0:ffac63d6a7f0 | 219 | #define DECPTR(n, cp) ((cp) -= (n)) |
takashiyamanoue | 0:ffac63d6a7f0 | 220 | |
takashiyamanoue | 0:ffac63d6a7f0 | 221 | #define BCMP(s0, s1, l) memcmp((u_char *)(s0), (u_char *)(s1), (l)) |
takashiyamanoue | 0:ffac63d6a7f0 | 222 | #define BCOPY(s, d, l) MEMCPY((d), (s), (l)) |
takashiyamanoue | 0:ffac63d6a7f0 | 223 | #define BZERO(s, n) memset(s, 0, n) |
takashiyamanoue | 0:ffac63d6a7f0 | 224 | |
takashiyamanoue | 0:ffac63d6a7f0 | 225 | #if PPP_DEBUG |
takashiyamanoue | 0:ffac63d6a7f0 | 226 | #define PRINTMSG(m, l) { m[l] = '\0'; LWIP_DEBUGF(LOG_INFO, ("Remote message: %s\n", m)); } |
takashiyamanoue | 0:ffac63d6a7f0 | 227 | #else /* PPP_DEBUG */ |
takashiyamanoue | 0:ffac63d6a7f0 | 228 | #define PRINTMSG(m, l) |
takashiyamanoue | 0:ffac63d6a7f0 | 229 | #endif /* PPP_DEBUG */ |
takashiyamanoue | 0:ffac63d6a7f0 | 230 | |
takashiyamanoue | 0:ffac63d6a7f0 | 231 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 232 | * MAKEHEADER - Add PPP Header fields to a packet. |
takashiyamanoue | 0:ffac63d6a7f0 | 233 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 234 | #define MAKEHEADER(p, t) { \ |
takashiyamanoue | 0:ffac63d6a7f0 | 235 | PUTCHAR(PPP_ALLSTATIONS, p); \ |
takashiyamanoue | 0:ffac63d6a7f0 | 236 | PUTCHAR(PPP_UI, p); \ |
takashiyamanoue | 0:ffac63d6a7f0 | 237 | PUTSHORT(t, p); } |
takashiyamanoue | 0:ffac63d6a7f0 | 238 | |
takashiyamanoue | 0:ffac63d6a7f0 | 239 | /************************* |
takashiyamanoue | 0:ffac63d6a7f0 | 240 | *** PUBLIC DEFINITIONS *** |
takashiyamanoue | 0:ffac63d6a7f0 | 241 | *************************/ |
takashiyamanoue | 0:ffac63d6a7f0 | 242 | |
takashiyamanoue | 0:ffac63d6a7f0 | 243 | /* Error codes. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 244 | #define PPPERR_NONE 0 /* No error. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 245 | #define PPPERR_PARAM -1 /* Invalid parameter. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 246 | #define PPPERR_OPEN -2 /* Unable to open PPP session. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 247 | #define PPPERR_DEVICE -3 /* Invalid I/O device for PPP. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 248 | #define PPPERR_ALLOC -4 /* Unable to allocate resources. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 249 | #define PPPERR_USER -5 /* User interrupt. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 250 | #define PPPERR_CONNECT -6 /* Connection lost. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 251 | #define PPPERR_AUTHFAIL -7 /* Failed authentication challenge. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 252 | #define PPPERR_PROTOCOL -8 /* Failed to meet protocol. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 253 | |
takashiyamanoue | 0:ffac63d6a7f0 | 254 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 255 | * PPP IOCTL commands. |
takashiyamanoue | 0:ffac63d6a7f0 | 256 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 257 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 258 | * Get the up status - 0 for down, non-zero for up. The argument must |
takashiyamanoue | 0:ffac63d6a7f0 | 259 | * point to an int. |
takashiyamanoue | 0:ffac63d6a7f0 | 260 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 261 | #define PPPCTLG_UPSTATUS 100 /* Get the up status - 0 down else up */ |
takashiyamanoue | 0:ffac63d6a7f0 | 262 | #define PPPCTLS_ERRCODE 101 /* Set the error code */ |
takashiyamanoue | 0:ffac63d6a7f0 | 263 | #define PPPCTLG_ERRCODE 102 /* Get the error code */ |
takashiyamanoue | 0:ffac63d6a7f0 | 264 | #define PPPCTLG_FD 103 /* Get the fd associated with the ppp */ |
takashiyamanoue | 0:ffac63d6a7f0 | 265 | |
takashiyamanoue | 0:ffac63d6a7f0 | 266 | /************************ |
takashiyamanoue | 0:ffac63d6a7f0 | 267 | *** PUBLIC DATA TYPES *** |
takashiyamanoue | 0:ffac63d6a7f0 | 268 | ************************/ |
takashiyamanoue | 0:ffac63d6a7f0 | 269 | |
takashiyamanoue | 0:ffac63d6a7f0 | 270 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 271 | * The following struct gives the addresses of procedures to call |
takashiyamanoue | 0:ffac63d6a7f0 | 272 | * for a particular protocol. |
takashiyamanoue | 0:ffac63d6a7f0 | 273 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 274 | struct protent { |
takashiyamanoue | 0:ffac63d6a7f0 | 275 | u_short protocol; /* PPP protocol number */ |
takashiyamanoue | 0:ffac63d6a7f0 | 276 | /* Initialization procedure */ |
takashiyamanoue | 0:ffac63d6a7f0 | 277 | void (*init) (int unit); |
takashiyamanoue | 0:ffac63d6a7f0 | 278 | /* Process a received packet */ |
takashiyamanoue | 0:ffac63d6a7f0 | 279 | void (*input) (int unit, u_char *pkt, int len); |
takashiyamanoue | 0:ffac63d6a7f0 | 280 | /* Process a received protocol-reject */ |
takashiyamanoue | 0:ffac63d6a7f0 | 281 | void (*protrej) (int unit); |
takashiyamanoue | 0:ffac63d6a7f0 | 282 | /* Lower layer has come up */ |
takashiyamanoue | 0:ffac63d6a7f0 | 283 | void (*lowerup) (int unit); |
takashiyamanoue | 0:ffac63d6a7f0 | 284 | /* Lower layer has gone down */ |
takashiyamanoue | 0:ffac63d6a7f0 | 285 | void (*lowerdown) (int unit); |
takashiyamanoue | 0:ffac63d6a7f0 | 286 | /* Open the protocol */ |
takashiyamanoue | 0:ffac63d6a7f0 | 287 | void (*open) (int unit); |
takashiyamanoue | 0:ffac63d6a7f0 | 288 | /* Close the protocol */ |
takashiyamanoue | 0:ffac63d6a7f0 | 289 | void (*close) (int unit, char *reason); |
takashiyamanoue | 0:ffac63d6a7f0 | 290 | #if PPP_ADDITIONAL_CALLBACKS |
takashiyamanoue | 0:ffac63d6a7f0 | 291 | /* Print a packet in readable form */ |
takashiyamanoue | 0:ffac63d6a7f0 | 292 | int (*printpkt) (u_char *pkt, int len, |
takashiyamanoue | 0:ffac63d6a7f0 | 293 | void (*printer) (void *, char *, ...), |
takashiyamanoue | 0:ffac63d6a7f0 | 294 | void *arg); |
takashiyamanoue | 0:ffac63d6a7f0 | 295 | /* Process a received data packet */ |
takashiyamanoue | 0:ffac63d6a7f0 | 296 | void (*datainput) (int unit, u_char *pkt, int len); |
takashiyamanoue | 0:ffac63d6a7f0 | 297 | #endif /* PPP_ADDITIONAL_CALLBACKS */ |
takashiyamanoue | 0:ffac63d6a7f0 | 298 | int enabled_flag; /* 0 if protocol is disabled */ |
takashiyamanoue | 0:ffac63d6a7f0 | 299 | char *name; /* Text name of protocol */ |
takashiyamanoue | 0:ffac63d6a7f0 | 300 | #if PPP_ADDITIONAL_CALLBACKS |
takashiyamanoue | 0:ffac63d6a7f0 | 301 | /* Check requested options, assign defaults */ |
takashiyamanoue | 0:ffac63d6a7f0 | 302 | void (*check_options) (u_long); |
takashiyamanoue | 0:ffac63d6a7f0 | 303 | /* Configure interface for demand-dial */ |
takashiyamanoue | 0:ffac63d6a7f0 | 304 | int (*demand_conf) (int unit); |
takashiyamanoue | 0:ffac63d6a7f0 | 305 | /* Say whether to bring up link for this pkt */ |
takashiyamanoue | 0:ffac63d6a7f0 | 306 | int (*active_pkt) (u_char *pkt, int len); |
takashiyamanoue | 0:ffac63d6a7f0 | 307 | #endif /* PPP_ADDITIONAL_CALLBACKS */ |
takashiyamanoue | 0:ffac63d6a7f0 | 308 | }; |
takashiyamanoue | 0:ffac63d6a7f0 | 309 | |
takashiyamanoue | 0:ffac63d6a7f0 | 310 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 311 | * The following structure records the time in seconds since |
takashiyamanoue | 0:ffac63d6a7f0 | 312 | * the last NP packet was sent or received. |
takashiyamanoue | 0:ffac63d6a7f0 | 313 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 314 | struct ppp_idle { |
takashiyamanoue | 0:ffac63d6a7f0 | 315 | u_short xmit_idle; /* seconds since last NP packet sent */ |
takashiyamanoue | 0:ffac63d6a7f0 | 316 | u_short recv_idle; /* seconds since last NP packet received */ |
takashiyamanoue | 0:ffac63d6a7f0 | 317 | }; |
takashiyamanoue | 0:ffac63d6a7f0 | 318 | |
takashiyamanoue | 0:ffac63d6a7f0 | 319 | struct ppp_settings { |
takashiyamanoue | 0:ffac63d6a7f0 | 320 | |
takashiyamanoue | 0:ffac63d6a7f0 | 321 | u_int disable_defaultip : 1; /* Don't use hostname for default IP addrs */ |
takashiyamanoue | 0:ffac63d6a7f0 | 322 | u_int auth_required : 1; /* Peer is required to authenticate */ |
takashiyamanoue | 0:ffac63d6a7f0 | 323 | u_int explicit_remote : 1; /* remote_name specified with remotename opt */ |
takashiyamanoue | 0:ffac63d6a7f0 | 324 | u_int refuse_pap : 1; /* Don't wanna auth. ourselves with PAP */ |
takashiyamanoue | 0:ffac63d6a7f0 | 325 | u_int refuse_chap : 1; /* Don't wanna auth. ourselves with CHAP */ |
takashiyamanoue | 0:ffac63d6a7f0 | 326 | u_int usehostname : 1; /* Use hostname for our_name */ |
takashiyamanoue | 0:ffac63d6a7f0 | 327 | u_int usepeerdns : 1; /* Ask peer for DNS adds */ |
takashiyamanoue | 0:ffac63d6a7f0 | 328 | |
takashiyamanoue | 0:ffac63d6a7f0 | 329 | u_short idle_time_limit; /* Shut down link if idle for this long */ |
takashiyamanoue | 0:ffac63d6a7f0 | 330 | int maxconnect; /* Maximum connect time (seconds) */ |
takashiyamanoue | 0:ffac63d6a7f0 | 331 | |
takashiyamanoue | 0:ffac63d6a7f0 | 332 | char user [MAXNAMELEN + 1]; /* Username for PAP */ |
takashiyamanoue | 0:ffac63d6a7f0 | 333 | char passwd [MAXSECRETLEN + 1]; /* Password for PAP, secret for CHAP */ |
takashiyamanoue | 0:ffac63d6a7f0 | 334 | char our_name [MAXNAMELEN + 1]; /* Our name for authentication purposes */ |
takashiyamanoue | 0:ffac63d6a7f0 | 335 | char remote_name[MAXNAMELEN + 1]; /* Peer's name for authentication */ |
takashiyamanoue | 0:ffac63d6a7f0 | 336 | }; |
takashiyamanoue | 0:ffac63d6a7f0 | 337 | |
takashiyamanoue | 0:ffac63d6a7f0 | 338 | struct ppp_addrs { |
takashiyamanoue | 0:ffac63d6a7f0 | 339 | ip_addr_t our_ipaddr, his_ipaddr, netmask, dns1, dns2; |
takashiyamanoue | 0:ffac63d6a7f0 | 340 | }; |
takashiyamanoue | 0:ffac63d6a7f0 | 341 | |
takashiyamanoue | 0:ffac63d6a7f0 | 342 | /***************************** |
takashiyamanoue | 0:ffac63d6a7f0 | 343 | *** PUBLIC DATA STRUCTURES *** |
takashiyamanoue | 0:ffac63d6a7f0 | 344 | *****************************/ |
takashiyamanoue | 0:ffac63d6a7f0 | 345 | |
takashiyamanoue | 0:ffac63d6a7f0 | 346 | /* Buffers for outgoing packets. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 347 | extern u_char outpacket_buf[NUM_PPP][PPP_MRU+PPP_HDRLEN]; |
takashiyamanoue | 0:ffac63d6a7f0 | 348 | |
takashiyamanoue | 0:ffac63d6a7f0 | 349 | extern struct ppp_settings ppp_settings; |
takashiyamanoue | 0:ffac63d6a7f0 | 350 | |
takashiyamanoue | 0:ffac63d6a7f0 | 351 | extern struct protent *ppp_protocols[]; /* Table of pointers to supported protocols */ |
takashiyamanoue | 0:ffac63d6a7f0 | 352 | |
takashiyamanoue | 0:ffac63d6a7f0 | 353 | |
takashiyamanoue | 0:ffac63d6a7f0 | 354 | /*********************** |
takashiyamanoue | 0:ffac63d6a7f0 | 355 | *** PUBLIC FUNCTIONS *** |
takashiyamanoue | 0:ffac63d6a7f0 | 356 | ***********************/ |
takashiyamanoue | 0:ffac63d6a7f0 | 357 | |
takashiyamanoue | 0:ffac63d6a7f0 | 358 | /* Initialize the PPP subsystem. */ |
takashiyamanoue | 0:ffac63d6a7f0 | 359 | void pppInit(void); |
takashiyamanoue | 0:ffac63d6a7f0 | 360 | |
takashiyamanoue | 0:ffac63d6a7f0 | 361 | /* Warning: Using PPPAUTHTYPE_ANY might have security consequences. |
takashiyamanoue | 0:ffac63d6a7f0 | 362 | * RFC 1994 says: |
takashiyamanoue | 0:ffac63d6a7f0 | 363 | * |
takashiyamanoue | 0:ffac63d6a7f0 | 364 | * In practice, within or associated with each PPP server, there is a |
takashiyamanoue | 0:ffac63d6a7f0 | 365 | * database which associates "user" names with authentication |
takashiyamanoue | 0:ffac63d6a7f0 | 366 | * information ("secrets"). It is not anticipated that a particular |
takashiyamanoue | 0:ffac63d6a7f0 | 367 | * named user would be authenticated by multiple methods. This would |
takashiyamanoue | 0:ffac63d6a7f0 | 368 | * make the user vulnerable to attacks which negotiate the least secure |
takashiyamanoue | 0:ffac63d6a7f0 | 369 | * method from among a set (such as PAP rather than CHAP). If the same |
takashiyamanoue | 0:ffac63d6a7f0 | 370 | * secret was used, PAP would reveal the secret to be used later with |
takashiyamanoue | 0:ffac63d6a7f0 | 371 | * CHAP. |
takashiyamanoue | 0:ffac63d6a7f0 | 372 | * |
takashiyamanoue | 0:ffac63d6a7f0 | 373 | * Instead, for each user name there should be an indication of exactly |
takashiyamanoue | 0:ffac63d6a7f0 | 374 | * one method used to authenticate that user name. If a user needs to |
takashiyamanoue | 0:ffac63d6a7f0 | 375 | * make use of different authentication methods under different |
takashiyamanoue | 0:ffac63d6a7f0 | 376 | * circumstances, then distinct user names SHOULD be employed, each of |
takashiyamanoue | 0:ffac63d6a7f0 | 377 | * which identifies exactly one authentication method. |
takashiyamanoue | 0:ffac63d6a7f0 | 378 | * |
takashiyamanoue | 0:ffac63d6a7f0 | 379 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 380 | enum pppAuthType { |
takashiyamanoue | 0:ffac63d6a7f0 | 381 | PPPAUTHTYPE_NONE, |
takashiyamanoue | 0:ffac63d6a7f0 | 382 | PPPAUTHTYPE_ANY, |
takashiyamanoue | 0:ffac63d6a7f0 | 383 | PPPAUTHTYPE_PAP, |
takashiyamanoue | 0:ffac63d6a7f0 | 384 | PPPAUTHTYPE_CHAP |
takashiyamanoue | 0:ffac63d6a7f0 | 385 | }; |
takashiyamanoue | 0:ffac63d6a7f0 | 386 | |
takashiyamanoue | 0:ffac63d6a7f0 | 387 | void pppSetAuth(enum pppAuthType authType, const char *user, const char *passwd); |
takashiyamanoue | 0:ffac63d6a7f0 | 388 | |
takashiyamanoue | 0:ffac63d6a7f0 | 389 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 390 | * Open a new PPP connection using the given serial I/O device. |
takashiyamanoue | 0:ffac63d6a7f0 | 391 | * This initializes the PPP control block but does not |
takashiyamanoue | 0:ffac63d6a7f0 | 392 | * attempt to negotiate the LCP session. |
takashiyamanoue | 0:ffac63d6a7f0 | 393 | * Return a new PPP connection descriptor on success or |
takashiyamanoue | 0:ffac63d6a7f0 | 394 | * an error code (negative) on failure. |
takashiyamanoue | 0:ffac63d6a7f0 | 395 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 396 | int pppOverSerialOpen(sio_fd_t fd, void (*linkStatusCB)(void *ctx, int errCode, void *arg), void *linkStatusCtx); |
takashiyamanoue | 0:ffac63d6a7f0 | 397 | |
takashiyamanoue | 0:ffac63d6a7f0 | 398 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 399 | * Open a new PPP Over Ethernet (PPPOE) connection. |
takashiyamanoue | 0:ffac63d6a7f0 | 400 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 401 | int pppOverEthernetOpen(struct netif *ethif, const char *service_name, const char *concentrator_name, void (*linkStatusCB)(void *ctx, int errCode, void *arg), void *linkStatusCtx); |
takashiyamanoue | 0:ffac63d6a7f0 | 402 | |
takashiyamanoue | 0:ffac63d6a7f0 | 403 | /* for source code compatibility */ |
takashiyamanoue | 0:ffac63d6a7f0 | 404 | #define pppOpen(fd,cb,ls) pppOverSerialOpen(fd,cb,ls) |
takashiyamanoue | 0:ffac63d6a7f0 | 405 | |
takashiyamanoue | 0:ffac63d6a7f0 | 406 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 407 | * Close a PPP connection and release the descriptor. |
takashiyamanoue | 0:ffac63d6a7f0 | 408 | * Any outstanding packets in the queues are dropped. |
takashiyamanoue | 0:ffac63d6a7f0 | 409 | * Return 0 on success, an error code on failure. |
takashiyamanoue | 0:ffac63d6a7f0 | 410 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 411 | int pppClose(int pd); |
takashiyamanoue | 0:ffac63d6a7f0 | 412 | |
takashiyamanoue | 0:ffac63d6a7f0 | 413 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 414 | * Indicate to the PPP process that the line has disconnected. |
takashiyamanoue | 0:ffac63d6a7f0 | 415 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 416 | void pppSigHUP(int pd); |
takashiyamanoue | 0:ffac63d6a7f0 | 417 | |
takashiyamanoue | 0:ffac63d6a7f0 | 418 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 419 | * Get and set parameters for the given connection. |
takashiyamanoue | 0:ffac63d6a7f0 | 420 | * Return 0 on success, an error code on failure. |
takashiyamanoue | 0:ffac63d6a7f0 | 421 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 422 | int pppIOCtl(int pd, int cmd, void *arg); |
takashiyamanoue | 0:ffac63d6a7f0 | 423 | |
takashiyamanoue | 0:ffac63d6a7f0 | 424 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 425 | * Return the Maximum Transmission Unit for the given PPP connection. |
takashiyamanoue | 0:ffac63d6a7f0 | 426 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 427 | u_short pppMTU(int pd); |
takashiyamanoue | 0:ffac63d6a7f0 | 428 | |
takashiyamanoue | 0:ffac63d6a7f0 | 429 | /* |
takashiyamanoue | 0:ffac63d6a7f0 | 430 | * Write n characters to a ppp link. |
takashiyamanoue | 0:ffac63d6a7f0 | 431 | * RETURN: >= 0 Number of characters written, -1 Failed to write to device. |
takashiyamanoue | 0:ffac63d6a7f0 | 432 | */ |
takashiyamanoue | 0:ffac63d6a7f0 | 433 | int pppWrite(int pd, const u_char *s, int n); |
takashiyamanoue | 0:ffac63d6a7f0 | 434 | |
takashiyamanoue | 0:ffac63d6a7f0 | 435 | void pppInProcOverEthernet(int pd, struct pbuf *pb); |
takashiyamanoue | 0:ffac63d6a7f0 | 436 | |
takashiyamanoue | 0:ffac63d6a7f0 | 437 | struct pbuf *pppSingleBuf(struct pbuf *p); |
takashiyamanoue | 0:ffac63d6a7f0 | 438 | |
takashiyamanoue | 0:ffac63d6a7f0 | 439 | void pppLinkTerminated(int pd); |
takashiyamanoue | 0:ffac63d6a7f0 | 440 | |
takashiyamanoue | 0:ffac63d6a7f0 | 441 | void pppLinkDown(int pd); |
takashiyamanoue | 0:ffac63d6a7f0 | 442 | |
takashiyamanoue | 0:ffac63d6a7f0 | 443 | void pppos_input(int pd, u_char* data, int len); |
takashiyamanoue | 0:ffac63d6a7f0 | 444 | |
takashiyamanoue | 0:ffac63d6a7f0 | 445 | /* Configure i/f transmit parameters */ |
takashiyamanoue | 0:ffac63d6a7f0 | 446 | void ppp_send_config (int, u16_t, u32_t, int, int); |
takashiyamanoue | 0:ffac63d6a7f0 | 447 | /* Set extended transmit ACCM */ |
takashiyamanoue | 0:ffac63d6a7f0 | 448 | void ppp_set_xaccm (int, ext_accm *); |
takashiyamanoue | 0:ffac63d6a7f0 | 449 | /* Configure i/f receive parameters */ |
takashiyamanoue | 0:ffac63d6a7f0 | 450 | void ppp_recv_config (int, int, u32_t, int, int); |
takashiyamanoue | 0:ffac63d6a7f0 | 451 | /* Find out how long link has been idle */ |
takashiyamanoue | 0:ffac63d6a7f0 | 452 | int get_idle_time (int, struct ppp_idle *); |
takashiyamanoue | 0:ffac63d6a7f0 | 453 | |
takashiyamanoue | 0:ffac63d6a7f0 | 454 | /* Configure VJ TCP header compression */ |
takashiyamanoue | 0:ffac63d6a7f0 | 455 | int sifvjcomp (int, int, u8_t, u8_t); |
takashiyamanoue | 0:ffac63d6a7f0 | 456 | /* Configure i/f down (for IP) */ |
takashiyamanoue | 0:ffac63d6a7f0 | 457 | int sifup (int); |
takashiyamanoue | 0:ffac63d6a7f0 | 458 | /* Set mode for handling packets for proto */ |
takashiyamanoue | 0:ffac63d6a7f0 | 459 | int sifnpmode (int u, int proto, enum NPmode mode); |
takashiyamanoue | 0:ffac63d6a7f0 | 460 | /* Configure i/f down (for IP) */ |
takashiyamanoue | 0:ffac63d6a7f0 | 461 | int sifdown (int); |
takashiyamanoue | 0:ffac63d6a7f0 | 462 | /* Configure IP addresses for i/f */ |
takashiyamanoue | 0:ffac63d6a7f0 | 463 | int sifaddr (int, u32_t, u32_t, u32_t, u32_t, u32_t); |
takashiyamanoue | 0:ffac63d6a7f0 | 464 | /* Reset i/f IP addresses */ |
takashiyamanoue | 0:ffac63d6a7f0 | 465 | int cifaddr (int, u32_t, u32_t); |
takashiyamanoue | 0:ffac63d6a7f0 | 466 | /* Create default route through i/f */ |
takashiyamanoue | 0:ffac63d6a7f0 | 467 | int sifdefaultroute (int, u32_t, u32_t); |
takashiyamanoue | 0:ffac63d6a7f0 | 468 | /* Delete default route through i/f */ |
takashiyamanoue | 0:ffac63d6a7f0 | 469 | int cifdefaultroute (int, u32_t, u32_t); |
takashiyamanoue | 0:ffac63d6a7f0 | 470 | |
takashiyamanoue | 0:ffac63d6a7f0 | 471 | /* Get appropriate netmask for address */ |
takashiyamanoue | 0:ffac63d6a7f0 | 472 | u32_t GetMask (u32_t); |
takashiyamanoue | 0:ffac63d6a7f0 | 473 | |
takashiyamanoue | 0:ffac63d6a7f0 | 474 | #if LWIP_NETIF_STATUS_CALLBACK |
takashiyamanoue | 0:ffac63d6a7f0 | 475 | void ppp_set_netif_statuscallback(int pd, netif_status_callback_fn status_callback); |
takashiyamanoue | 0:ffac63d6a7f0 | 476 | #endif /* LWIP_NETIF_STATUS_CALLBACK */ |
takashiyamanoue | 0:ffac63d6a7f0 | 477 | #if LWIP_NETIF_LINK_CALLBACK |
takashiyamanoue | 0:ffac63d6a7f0 | 478 | void ppp_set_netif_linkcallback(int pd, netif_status_callback_fn link_callback); |
takashiyamanoue | 0:ffac63d6a7f0 | 479 | #endif /* LWIP_NETIF_LINK_CALLBACK */ |
takashiyamanoue | 0:ffac63d6a7f0 | 480 | |
takashiyamanoue | 0:ffac63d6a7f0 | 481 | #endif /* PPP_SUPPORT */ |
takashiyamanoue | 0:ffac63d6a7f0 | 482 | |
takashiyamanoue | 0:ffac63d6a7f0 | 483 | #endif /* PPP_H */ |