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