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