ProjetoBB

Dependencies:   F7_Ethernet WebSocketClient mbed mcp3008

Fork of Nucleo_F746ZG_Ethernet by Dieter Graef

Committer:
DieterGraef
Date:
Sat Jun 18 10:49:12 2016 +0000
Revision:
0:f9b6112278fe
Ethernet for the NUCLEO STM32F746 Board Testprogram uses DHCP and NTP to set the clock

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DieterGraef 0:f9b6112278fe 1 /*****************************************************************************
DieterGraef 0:f9b6112278fe 2 * ppp.h - Network Point to Point Protocol header file.
DieterGraef 0:f9b6112278fe 3 *
DieterGraef 0:f9b6112278fe 4 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
DieterGraef 0:f9b6112278fe 5 * portions Copyright (c) 1997 Global Election Systems Inc.
DieterGraef 0:f9b6112278fe 6 *
DieterGraef 0:f9b6112278fe 7 * The authors hereby grant permission to use, copy, modify, distribute,
DieterGraef 0:f9b6112278fe 8 * and license this software and its documentation for any purpose, provided
DieterGraef 0:f9b6112278fe 9 * that existing copyright notices are retained in all copies and that this
DieterGraef 0:f9b6112278fe 10 * notice and the following disclaimer are included verbatim in any
DieterGraef 0:f9b6112278fe 11 * distributions. No written agreement, license, or royalty fee is required
DieterGraef 0:f9b6112278fe 12 * for any of the authorized uses.
DieterGraef 0:f9b6112278fe 13 *
DieterGraef 0:f9b6112278fe 14 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
DieterGraef 0:f9b6112278fe 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
DieterGraef 0:f9b6112278fe 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
DieterGraef 0:f9b6112278fe 17 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
DieterGraef 0:f9b6112278fe 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
DieterGraef 0:f9b6112278fe 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DieterGraef 0:f9b6112278fe 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
DieterGraef 0:f9b6112278fe 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
DieterGraef 0:f9b6112278fe 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
DieterGraef 0:f9b6112278fe 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
DieterGraef 0:f9b6112278fe 24 *
DieterGraef 0:f9b6112278fe 25 ******************************************************************************
DieterGraef 0:f9b6112278fe 26 * REVISION HISTORY
DieterGraef 0:f9b6112278fe 27 *
DieterGraef 0:f9b6112278fe 28 * 03-01-01 Marc Boucher <marc@mbsi.ca>
DieterGraef 0:f9b6112278fe 29 * Ported to lwIP.
DieterGraef 0:f9b6112278fe 30 * 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
DieterGraef 0:f9b6112278fe 31 * Original derived from BSD codes.
DieterGraef 0:f9b6112278fe 32 *****************************************************************************/
DieterGraef 0:f9b6112278fe 33
DieterGraef 0:f9b6112278fe 34 #ifndef PPP_IMPL_H
DieterGraef 0:f9b6112278fe 35 #define PPP_IMPL_H
DieterGraef 0:f9b6112278fe 36
DieterGraef 0:f9b6112278fe 37 #include "lwip/opt.h"
DieterGraef 0:f9b6112278fe 38
DieterGraef 0:f9b6112278fe 39 #if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
DieterGraef 0:f9b6112278fe 40
DieterGraef 0:f9b6112278fe 41 #include "ppp.h"
DieterGraef 0:f9b6112278fe 42 #include "lwip/def.h"
DieterGraef 0:f9b6112278fe 43 #include "lwip/sio.h"
DieterGraef 0:f9b6112278fe 44 #include "lwip/stats.h"
DieterGraef 0:f9b6112278fe 45 #include "lwip/mem.h"
DieterGraef 0:f9b6112278fe 46 #include "lwip/netif.h"
DieterGraef 0:f9b6112278fe 47 #include "lwip/sys.h"
DieterGraef 0:f9b6112278fe 48 #include "lwip/timers.h"
DieterGraef 0:f9b6112278fe 49
DieterGraef 0:f9b6112278fe 50 /** Some defines for code we skip compared to the original pppd.
DieterGraef 0:f9b6112278fe 51 * These are just here to minimise the use of the ugly "#if 0". */
DieterGraef 0:f9b6112278fe 52 #define PPP_ADDITIONAL_CALLBACKS 0
DieterGraef 0:f9b6112278fe 53
DieterGraef 0:f9b6112278fe 54 /** Some error checks to test for unsupported code */
DieterGraef 0:f9b6112278fe 55 #if CBCP_SUPPORT
DieterGraef 0:f9b6112278fe 56 #error "CBCP is not supported in lwIP PPP"
DieterGraef 0:f9b6112278fe 57 #endif
DieterGraef 0:f9b6112278fe 58 #if CCP_SUPPORT
DieterGraef 0:f9b6112278fe 59 #error "CCP is not supported in lwIP PPP"
DieterGraef 0:f9b6112278fe 60 #endif
DieterGraef 0:f9b6112278fe 61
DieterGraef 0:f9b6112278fe 62 /*
DieterGraef 0:f9b6112278fe 63 * pppd.h - PPP daemon global declarations.
DieterGraef 0:f9b6112278fe 64 *
DieterGraef 0:f9b6112278fe 65 * Copyright (c) 1989 Carnegie Mellon University.
DieterGraef 0:f9b6112278fe 66 * All rights reserved.
DieterGraef 0:f9b6112278fe 67 *
DieterGraef 0:f9b6112278fe 68 * Redistribution and use in source and binary forms are permitted
DieterGraef 0:f9b6112278fe 69 * provided that the above copyright notice and this paragraph are
DieterGraef 0:f9b6112278fe 70 * duplicated in all such forms and that any documentation,
DieterGraef 0:f9b6112278fe 71 * advertising materials, and other materials related to such
DieterGraef 0:f9b6112278fe 72 * distribution and use acknowledge that the software was developed
DieterGraef 0:f9b6112278fe 73 * by Carnegie Mellon University. The name of the
DieterGraef 0:f9b6112278fe 74 * University may not be used to endorse or promote products derived
DieterGraef 0:f9b6112278fe 75 * from this software without specific prior written permission.
DieterGraef 0:f9b6112278fe 76 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
DieterGraef 0:f9b6112278fe 77 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
DieterGraef 0:f9b6112278fe 78 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
DieterGraef 0:f9b6112278fe 79 *
DieterGraef 0:f9b6112278fe 80 */
DieterGraef 0:f9b6112278fe 81 /*
DieterGraef 0:f9b6112278fe 82 * ppp_defs.h - PPP definitions.
DieterGraef 0:f9b6112278fe 83 *
DieterGraef 0:f9b6112278fe 84 * Copyright (c) 1994 The Australian National University.
DieterGraef 0:f9b6112278fe 85 * All rights reserved.
DieterGraef 0:f9b6112278fe 86 *
DieterGraef 0:f9b6112278fe 87 * Permission to use, copy, modify, and distribute this software and its
DieterGraef 0:f9b6112278fe 88 * documentation is hereby granted, provided that the above copyright
DieterGraef 0:f9b6112278fe 89 * notice appears in all copies. This software is provided without any
DieterGraef 0:f9b6112278fe 90 * warranty, express or implied. The Australian National University
DieterGraef 0:f9b6112278fe 91 * makes no representations about the suitability of this software for
DieterGraef 0:f9b6112278fe 92 * any purpose.
DieterGraef 0:f9b6112278fe 93 *
DieterGraef 0:f9b6112278fe 94 * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
DieterGraef 0:f9b6112278fe 95 * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
DieterGraef 0:f9b6112278fe 96 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
DieterGraef 0:f9b6112278fe 97 * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
DieterGraef 0:f9b6112278fe 98 * OF SUCH DAMAGE.
DieterGraef 0:f9b6112278fe 99 *
DieterGraef 0:f9b6112278fe 100 * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
DieterGraef 0:f9b6112278fe 101 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
DieterGraef 0:f9b6112278fe 102 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
DieterGraef 0:f9b6112278fe 103 * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
DieterGraef 0:f9b6112278fe 104 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
DieterGraef 0:f9b6112278fe 105 * OR MODIFICATIONS.
DieterGraef 0:f9b6112278fe 106 */
DieterGraef 0:f9b6112278fe 107
DieterGraef 0:f9b6112278fe 108 #define TIMEOUT(f, a, t) do { sys_untimeout((f), (a)); sys_timeout((t)*1000, (f), (a)); } while(0)
DieterGraef 0:f9b6112278fe 109 #define UNTIMEOUT(f, a) sys_untimeout((f), (a))
DieterGraef 0:f9b6112278fe 110
DieterGraef 0:f9b6112278fe 111
DieterGraef 0:f9b6112278fe 112 /*
DieterGraef 0:f9b6112278fe 113 * Constants and structures defined by the internet system,
DieterGraef 0:f9b6112278fe 114 * Per RFC 790, September 1981, and numerous additions.
DieterGraef 0:f9b6112278fe 115 */
DieterGraef 0:f9b6112278fe 116
DieterGraef 0:f9b6112278fe 117 /*
DieterGraef 0:f9b6112278fe 118 * The basic PPP frame.
DieterGraef 0:f9b6112278fe 119 */
DieterGraef 0:f9b6112278fe 120 #define PPP_HDRLEN 4 /* octets for standard ppp header */
DieterGraef 0:f9b6112278fe 121 #define PPP_FCSLEN 2 /* octets for FCS */
DieterGraef 0:f9b6112278fe 122
DieterGraef 0:f9b6112278fe 123
DieterGraef 0:f9b6112278fe 124 /*
DieterGraef 0:f9b6112278fe 125 * Significant octet values.
DieterGraef 0:f9b6112278fe 126 */
DieterGraef 0:f9b6112278fe 127 #define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */
DieterGraef 0:f9b6112278fe 128 #define PPP_UI 0x03 /* Unnumbered Information */
DieterGraef 0:f9b6112278fe 129 #define PPP_FLAG 0x7e /* Flag Sequence */
DieterGraef 0:f9b6112278fe 130 #define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */
DieterGraef 0:f9b6112278fe 131 #define PPP_TRANS 0x20 /* Asynchronous transparency modifier */
DieterGraef 0:f9b6112278fe 132
DieterGraef 0:f9b6112278fe 133 /*
DieterGraef 0:f9b6112278fe 134 * Protocol field values.
DieterGraef 0:f9b6112278fe 135 */
DieterGraef 0:f9b6112278fe 136 #define PPP_IP 0x21 /* Internet Protocol */
DieterGraef 0:f9b6112278fe 137 #define PPP_AT 0x29 /* AppleTalk Protocol */
DieterGraef 0:f9b6112278fe 138 #define PPP_VJC_COMP 0x2d /* VJ compressed TCP */
DieterGraef 0:f9b6112278fe 139 #define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */
DieterGraef 0:f9b6112278fe 140 #define PPP_COMP 0xfd /* compressed packet */
DieterGraef 0:f9b6112278fe 141 #define PPP_IPCP 0x8021 /* IP Control Protocol */
DieterGraef 0:f9b6112278fe 142 #define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */
DieterGraef 0:f9b6112278fe 143 #define PPP_CCP 0x80fd /* Compression Control Protocol */
DieterGraef 0:f9b6112278fe 144 #define PPP_LCP 0xc021 /* Link Control Protocol */
DieterGraef 0:f9b6112278fe 145 #define PPP_PAP 0xc023 /* Password Authentication Protocol */
DieterGraef 0:f9b6112278fe 146 #define PPP_LQR 0xc025 /* Link Quality Report protocol */
DieterGraef 0:f9b6112278fe 147 #define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */
DieterGraef 0:f9b6112278fe 148 #define PPP_CBCP 0xc029 /* Callback Control Protocol */
DieterGraef 0:f9b6112278fe 149
DieterGraef 0:f9b6112278fe 150 /*
DieterGraef 0:f9b6112278fe 151 * Values for FCS calculations.
DieterGraef 0:f9b6112278fe 152 */
DieterGraef 0:f9b6112278fe 153 #define PPP_INITFCS 0xffff /* Initial FCS value */
DieterGraef 0:f9b6112278fe 154 #define PPP_GOODFCS 0xf0b8 /* Good final FCS value */
DieterGraef 0:f9b6112278fe 155 #define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
DieterGraef 0:f9b6112278fe 156
DieterGraef 0:f9b6112278fe 157 /*
DieterGraef 0:f9b6112278fe 158 * Extended asyncmap - allows any character to be escaped.
DieterGraef 0:f9b6112278fe 159 */
DieterGraef 0:f9b6112278fe 160 typedef u_char ext_accm[32];
DieterGraef 0:f9b6112278fe 161
DieterGraef 0:f9b6112278fe 162 /*
DieterGraef 0:f9b6112278fe 163 * What to do with network protocol (NP) packets.
DieterGraef 0:f9b6112278fe 164 */
DieterGraef 0:f9b6112278fe 165 enum NPmode {
DieterGraef 0:f9b6112278fe 166 NPMODE_PASS, /* pass the packet through */
DieterGraef 0:f9b6112278fe 167 NPMODE_DROP, /* silently drop the packet */
DieterGraef 0:f9b6112278fe 168 NPMODE_ERROR, /* return an error */
DieterGraef 0:f9b6112278fe 169 NPMODE_QUEUE /* save it up for later. */
DieterGraef 0:f9b6112278fe 170 };
DieterGraef 0:f9b6112278fe 171
DieterGraef 0:f9b6112278fe 172 /*
DieterGraef 0:f9b6112278fe 173 * Inline versions of get/put char/short/long.
DieterGraef 0:f9b6112278fe 174 * Pointer is advanced; we assume that both arguments
DieterGraef 0:f9b6112278fe 175 * are lvalues and will already be in registers.
DieterGraef 0:f9b6112278fe 176 * cp MUST be u_char *.
DieterGraef 0:f9b6112278fe 177 */
DieterGraef 0:f9b6112278fe 178 #define GETCHAR(c, cp) { \
DieterGraef 0:f9b6112278fe 179 (c) = *(cp)++; \
DieterGraef 0:f9b6112278fe 180 }
DieterGraef 0:f9b6112278fe 181 #define PUTCHAR(c, cp) { \
DieterGraef 0:f9b6112278fe 182 *(cp)++ = (u_char) (c); \
DieterGraef 0:f9b6112278fe 183 }
DieterGraef 0:f9b6112278fe 184
DieterGraef 0:f9b6112278fe 185
DieterGraef 0:f9b6112278fe 186 #define GETSHORT(s, cp) { \
DieterGraef 0:f9b6112278fe 187 (s) = *(cp); (cp)++; (s) <<= 8; \
DieterGraef 0:f9b6112278fe 188 (s) |= *(cp); (cp)++; \
DieterGraef 0:f9b6112278fe 189 }
DieterGraef 0:f9b6112278fe 190 #define PUTSHORT(s, cp) { \
DieterGraef 0:f9b6112278fe 191 *(cp)++ = (u_char) ((s) >> 8); \
DieterGraef 0:f9b6112278fe 192 *(cp)++ = (u_char) (s & 0xff); \
DieterGraef 0:f9b6112278fe 193 }
DieterGraef 0:f9b6112278fe 194
DieterGraef 0:f9b6112278fe 195 #define GETLONG(l, cp) { \
DieterGraef 0:f9b6112278fe 196 (l) = *(cp); (cp)++; (l) <<= 8; \
DieterGraef 0:f9b6112278fe 197 (l) |= *(cp); (cp)++; (l) <<= 8; \
DieterGraef 0:f9b6112278fe 198 (l) |= *(cp); (cp)++; (l) <<= 8; \
DieterGraef 0:f9b6112278fe 199 (l) |= *(cp); (cp)++; \
DieterGraef 0:f9b6112278fe 200 }
DieterGraef 0:f9b6112278fe 201 #define PUTLONG(l, cp) { \
DieterGraef 0:f9b6112278fe 202 *(cp)++ = (u_char) ((l) >> 24); \
DieterGraef 0:f9b6112278fe 203 *(cp)++ = (u_char) ((l) >> 16); \
DieterGraef 0:f9b6112278fe 204 *(cp)++ = (u_char) ((l) >> 8); \
DieterGraef 0:f9b6112278fe 205 *(cp)++ = (u_char) (l); \
DieterGraef 0:f9b6112278fe 206 }
DieterGraef 0:f9b6112278fe 207
DieterGraef 0:f9b6112278fe 208
DieterGraef 0:f9b6112278fe 209 #define INCPTR(n, cp) ((cp) += (n))
DieterGraef 0:f9b6112278fe 210 #define DECPTR(n, cp) ((cp) -= (n))
DieterGraef 0:f9b6112278fe 211
DieterGraef 0:f9b6112278fe 212 #define BCMP(s0, s1, l) memcmp((u_char *)(s0), (u_char *)(s1), (l))
DieterGraef 0:f9b6112278fe 213 #define BCOPY(s, d, l) MEMCPY((d), (s), (l))
DieterGraef 0:f9b6112278fe 214 #define BZERO(s, n) memset(s, 0, n)
DieterGraef 0:f9b6112278fe 215
DieterGraef 0:f9b6112278fe 216 #if PPP_DEBUG
DieterGraef 0:f9b6112278fe 217 #define PRINTMSG(m, l) { m[l] = '\0'; LWIP_DEBUGF(LOG_INFO, ("Remote message: %s\n", m)); }
DieterGraef 0:f9b6112278fe 218 #else /* PPP_DEBUG */
DieterGraef 0:f9b6112278fe 219 #define PRINTMSG(m, l)
DieterGraef 0:f9b6112278fe 220 #endif /* PPP_DEBUG */
DieterGraef 0:f9b6112278fe 221
DieterGraef 0:f9b6112278fe 222 /*
DieterGraef 0:f9b6112278fe 223 * MAKEHEADER - Add PPP Header fields to a packet.
DieterGraef 0:f9b6112278fe 224 */
DieterGraef 0:f9b6112278fe 225 #define MAKEHEADER(p, t) { \
DieterGraef 0:f9b6112278fe 226 PUTCHAR(PPP_ALLSTATIONS, p); \
DieterGraef 0:f9b6112278fe 227 PUTCHAR(PPP_UI, p); \
DieterGraef 0:f9b6112278fe 228 PUTSHORT(t, p); }
DieterGraef 0:f9b6112278fe 229
DieterGraef 0:f9b6112278fe 230 /************************
DieterGraef 0:f9b6112278fe 231 *** PUBLIC DATA TYPES ***
DieterGraef 0:f9b6112278fe 232 ************************/
DieterGraef 0:f9b6112278fe 233
DieterGraef 0:f9b6112278fe 234 /*
DieterGraef 0:f9b6112278fe 235 * The following struct gives the addresses of procedures to call
DieterGraef 0:f9b6112278fe 236 * for a particular protocol.
DieterGraef 0:f9b6112278fe 237 */
DieterGraef 0:f9b6112278fe 238 struct protent {
DieterGraef 0:f9b6112278fe 239 u_short protocol; /* PPP protocol number */
DieterGraef 0:f9b6112278fe 240 /* Initialization procedure */
DieterGraef 0:f9b6112278fe 241 void (*init) (int unit);
DieterGraef 0:f9b6112278fe 242 /* Process a received packet */
DieterGraef 0:f9b6112278fe 243 void (*input) (int unit, u_char *pkt, int len);
DieterGraef 0:f9b6112278fe 244 /* Process a received protocol-reject */
DieterGraef 0:f9b6112278fe 245 void (*protrej) (int unit);
DieterGraef 0:f9b6112278fe 246 /* Lower layer has come up */
DieterGraef 0:f9b6112278fe 247 void (*lowerup) (int unit);
DieterGraef 0:f9b6112278fe 248 /* Lower layer has gone down */
DieterGraef 0:f9b6112278fe 249 void (*lowerdown) (int unit);
DieterGraef 0:f9b6112278fe 250 /* Open the protocol */
DieterGraef 0:f9b6112278fe 251 void (*open) (int unit);
DieterGraef 0:f9b6112278fe 252 /* Close the protocol */
DieterGraef 0:f9b6112278fe 253 void (*close) (int unit, char *reason);
DieterGraef 0:f9b6112278fe 254 #if PPP_ADDITIONAL_CALLBACKS
DieterGraef 0:f9b6112278fe 255 /* Print a packet in readable form */
DieterGraef 0:f9b6112278fe 256 int (*printpkt) (u_char *pkt, int len,
DieterGraef 0:f9b6112278fe 257 void (*printer) (void *, char *, ...),
DieterGraef 0:f9b6112278fe 258 void *arg);
DieterGraef 0:f9b6112278fe 259 /* Process a received data packet */
DieterGraef 0:f9b6112278fe 260 void (*datainput) (int unit, u_char *pkt, int len);
DieterGraef 0:f9b6112278fe 261 #endif /* PPP_ADDITIONAL_CALLBACKS */
DieterGraef 0:f9b6112278fe 262 int enabled_flag; /* 0 if protocol is disabled */
DieterGraef 0:f9b6112278fe 263 char *name; /* Text name of protocol */
DieterGraef 0:f9b6112278fe 264 #if PPP_ADDITIONAL_CALLBACKS
DieterGraef 0:f9b6112278fe 265 /* Check requested options, assign defaults */
DieterGraef 0:f9b6112278fe 266 void (*check_options) (u_long);
DieterGraef 0:f9b6112278fe 267 /* Configure interface for demand-dial */
DieterGraef 0:f9b6112278fe 268 int (*demand_conf) (int unit);
DieterGraef 0:f9b6112278fe 269 /* Say whether to bring up link for this pkt */
DieterGraef 0:f9b6112278fe 270 int (*active_pkt) (u_char *pkt, int len);
DieterGraef 0:f9b6112278fe 271 #endif /* PPP_ADDITIONAL_CALLBACKS */
DieterGraef 0:f9b6112278fe 272 };
DieterGraef 0:f9b6112278fe 273
DieterGraef 0:f9b6112278fe 274 /*
DieterGraef 0:f9b6112278fe 275 * The following structure records the time in seconds since
DieterGraef 0:f9b6112278fe 276 * the last NP packet was sent or received.
DieterGraef 0:f9b6112278fe 277 */
DieterGraef 0:f9b6112278fe 278 struct ppp_idle {
DieterGraef 0:f9b6112278fe 279 u_short xmit_idle; /* seconds since last NP packet sent */
DieterGraef 0:f9b6112278fe 280 u_short recv_idle; /* seconds since last NP packet received */
DieterGraef 0:f9b6112278fe 281 };
DieterGraef 0:f9b6112278fe 282
DieterGraef 0:f9b6112278fe 283 struct ppp_settings {
DieterGraef 0:f9b6112278fe 284
DieterGraef 0:f9b6112278fe 285 u_int disable_defaultip : 1; /* Don't use hostname for default IP addrs */
DieterGraef 0:f9b6112278fe 286 u_int auth_required : 1; /* Peer is required to authenticate */
DieterGraef 0:f9b6112278fe 287 u_int explicit_remote : 1; /* remote_name specified with remotename opt */
DieterGraef 0:f9b6112278fe 288 u_int refuse_pap : 1; /* Don't wanna auth. ourselves with PAP */
DieterGraef 0:f9b6112278fe 289 u_int refuse_chap : 1; /* Don't wanna auth. ourselves with CHAP */
DieterGraef 0:f9b6112278fe 290 u_int usehostname : 1; /* Use hostname for our_name */
DieterGraef 0:f9b6112278fe 291 u_int usepeerdns : 1; /* Ask peer for DNS adds */
DieterGraef 0:f9b6112278fe 292
DieterGraef 0:f9b6112278fe 293 u_short idle_time_limit; /* Shut down link if idle for this long */
DieterGraef 0:f9b6112278fe 294 int maxconnect; /* Maximum connect time (seconds) */
DieterGraef 0:f9b6112278fe 295
DieterGraef 0:f9b6112278fe 296 char user [MAXNAMELEN + 1]; /* Username for PAP */
DieterGraef 0:f9b6112278fe 297 char passwd [MAXSECRETLEN + 1]; /* Password for PAP, secret for CHAP */
DieterGraef 0:f9b6112278fe 298 char our_name [MAXNAMELEN + 1]; /* Our name for authentication purposes */
DieterGraef 0:f9b6112278fe 299 char remote_name[MAXNAMELEN + 1]; /* Peer's name for authentication */
DieterGraef 0:f9b6112278fe 300 };
DieterGraef 0:f9b6112278fe 301
DieterGraef 0:f9b6112278fe 302 /*****************************
DieterGraef 0:f9b6112278fe 303 *** PUBLIC DATA STRUCTURES ***
DieterGraef 0:f9b6112278fe 304 *****************************/
DieterGraef 0:f9b6112278fe 305
DieterGraef 0:f9b6112278fe 306 /* Buffers for outgoing packets. */
DieterGraef 0:f9b6112278fe 307 extern u_char outpacket_buf[NUM_PPP][PPP_MRU+PPP_HDRLEN];
DieterGraef 0:f9b6112278fe 308
DieterGraef 0:f9b6112278fe 309 extern struct ppp_settings ppp_settings;
DieterGraef 0:f9b6112278fe 310
DieterGraef 0:f9b6112278fe 311 extern struct protent *ppp_protocols[]; /* Table of pointers to supported protocols */
DieterGraef 0:f9b6112278fe 312
DieterGraef 0:f9b6112278fe 313
DieterGraef 0:f9b6112278fe 314 /***********************
DieterGraef 0:f9b6112278fe 315 *** PUBLIC FUNCTIONS ***
DieterGraef 0:f9b6112278fe 316 ***********************/
DieterGraef 0:f9b6112278fe 317
DieterGraef 0:f9b6112278fe 318 /*
DieterGraef 0:f9b6112278fe 319 * Write n characters to a ppp link.
DieterGraef 0:f9b6112278fe 320 * RETURN: >= 0 Number of characters written, -1 Failed to write to device.
DieterGraef 0:f9b6112278fe 321 */
DieterGraef 0:f9b6112278fe 322 int pppWrite(int pd, const u_char *s, int n);
DieterGraef 0:f9b6112278fe 323
DieterGraef 0:f9b6112278fe 324 void pppInProcOverEthernet(int pd, struct pbuf *pb);
DieterGraef 0:f9b6112278fe 325
DieterGraef 0:f9b6112278fe 326 struct pbuf *pppSingleBuf(struct pbuf *p);
DieterGraef 0:f9b6112278fe 327
DieterGraef 0:f9b6112278fe 328 void pppLinkTerminated(int pd);
DieterGraef 0:f9b6112278fe 329
DieterGraef 0:f9b6112278fe 330 void pppLinkDown(int pd);
DieterGraef 0:f9b6112278fe 331
DieterGraef 0:f9b6112278fe 332 /* Configure i/f transmit parameters */
DieterGraef 0:f9b6112278fe 333 void ppp_send_config (int, u16_t, u32_t, int, int);
DieterGraef 0:f9b6112278fe 334 /* Set extended transmit ACCM */
DieterGraef 0:f9b6112278fe 335 void ppp_set_xaccm (int, ext_accm *);
DieterGraef 0:f9b6112278fe 336 /* Configure i/f receive parameters */
DieterGraef 0:f9b6112278fe 337 void ppp_recv_config (int, int, u32_t, int, int);
DieterGraef 0:f9b6112278fe 338 /* Find out how long link has been idle */
DieterGraef 0:f9b6112278fe 339 int get_idle_time (int, struct ppp_idle *);
DieterGraef 0:f9b6112278fe 340
DieterGraef 0:f9b6112278fe 341 /* Configure VJ TCP header compression */
DieterGraef 0:f9b6112278fe 342 int sifvjcomp (int, int, u8_t, u8_t);
DieterGraef 0:f9b6112278fe 343 /* Configure i/f down (for IP) */
DieterGraef 0:f9b6112278fe 344 int sifup (int);
DieterGraef 0:f9b6112278fe 345 /* Set mode for handling packets for proto */
DieterGraef 0:f9b6112278fe 346 int sifnpmode (int u, int proto, enum NPmode mode);
DieterGraef 0:f9b6112278fe 347 /* Configure i/f down (for IP) */
DieterGraef 0:f9b6112278fe 348 int sifdown (int);
DieterGraef 0:f9b6112278fe 349 /* Configure IP addresses for i/f */
DieterGraef 0:f9b6112278fe 350 int sifaddr (int, u32_t, u32_t, u32_t, u32_t, u32_t);
DieterGraef 0:f9b6112278fe 351 /* Reset i/f IP addresses */
DieterGraef 0:f9b6112278fe 352 int cifaddr (int, u32_t, u32_t);
DieterGraef 0:f9b6112278fe 353 /* Create default route through i/f */
DieterGraef 0:f9b6112278fe 354 int sifdefaultroute (int, u32_t, u32_t);
DieterGraef 0:f9b6112278fe 355 /* Delete default route through i/f */
DieterGraef 0:f9b6112278fe 356 int cifdefaultroute (int, u32_t, u32_t);
DieterGraef 0:f9b6112278fe 357
DieterGraef 0:f9b6112278fe 358 /* Get appropriate netmask for address */
DieterGraef 0:f9b6112278fe 359 u32_t GetMask (u32_t);
DieterGraef 0:f9b6112278fe 360
DieterGraef 0:f9b6112278fe 361 #endif /* PPP_SUPPORT */
DieterGraef 0:f9b6112278fe 362
DieterGraef 0:f9b6112278fe 363 #endif /* PPP_IMPL_H */