The Pedigree Project 0.1
ppp_impl.h
1/*****************************************************************************
2* ppp.h - Network Point to Point Protocol header file.
3*
4* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
5* portions Copyright (c) 1997 Global Election Systems Inc.
6*
7* The authors hereby grant permission to use, copy, modify, distribute,
8* and license this software and its documentation for any purpose, provided
9* that existing copyright notices are retained in all copies and that this
10* notice and the following disclaimer are included verbatim in any
11* distributions. No written agreement, license, or royalty fee is required
12* for any of the authorized uses.
13*
14* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
15* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
18* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24*
25******************************************************************************
26* REVISION HISTORY
27*
28* 03-01-01 Marc Boucher <marc@mbsi.ca>
29* Ported to lwIP.
30* 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
31* Original derived from BSD codes.
32*****************************************************************************/
33#ifndef LWIP_HDR_PPP_IMPL_H
34#define LWIP_HDR_PPP_IMPL_H
35
36#include "netif/ppp/ppp_opts.h"
37
38#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
39
40#ifdef PPP_INCLUDE_SETTINGS_HEADER
41#include "ppp_settings.h"
42#endif
43
44#include <stdio.h> /* formats */
45#include <stdarg.h>
46#include <string.h>
47#include <stdlib.h> /* strtol() */
48
49#include "lwip/netif.h"
50#include "lwip/def.h"
51#include "lwip/timeouts.h"
52
53#include "ppp.h"
54#include "pppdebug.h"
55
56/*
57 * Memory used for control packets.
58 *
59 * PPP_CTRL_PBUF_MAX_SIZE is the amount of memory we allocate when we
60 * cannot figure out how much we are going to use before filling the buffer.
61 */
62#if PPP_USE_PBUF_RAM
63#define PPP_CTRL_PBUF_TYPE PBUF_RAM
64#define PPP_CTRL_PBUF_MAX_SIZE 512
65#else /* PPP_USE_PBUF_RAM */
66#define PPP_CTRL_PBUF_TYPE PBUF_POOL
67#define PPP_CTRL_PBUF_MAX_SIZE PBUF_POOL_BUFSIZE
68#endif /* PPP_USE_PBUF_RAM */
69
70/*
71 * The basic PPP frame.
72 */
73#define PPP_ADDRESS(p) (((u_char *)(p))[0])
74#define PPP_CONTROL(p) (((u_char *)(p))[1])
75#define PPP_PROTOCOL(p) ((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3])
76
77/*
78 * Significant octet values.
79 */
80#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */
81#define PPP_UI 0x03 /* Unnumbered Information */
82#define PPP_FLAG 0x7e /* Flag Sequence */
83#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */
84#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */
85
86/*
87 * Protocol field values.
88 */
89#define PPP_IP 0x21 /* Internet Protocol */
90#if 0 /* UNUSED */
91#define PPP_AT 0x29 /* AppleTalk Protocol */
92#define PPP_IPX 0x2b /* IPX protocol */
93#endif /* UNUSED */
94#if VJ_SUPPORT
95#define PPP_VJC_COMP 0x2d /* VJ compressed TCP */
96#define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */
97#endif /* VJ_SUPPORT */
98#if PPP_IPV6_SUPPORT
99#define PPP_IPV6 0x57 /* Internet Protocol Version 6 */
100#endif /* PPP_IPV6_SUPPORT */
101#if CCP_SUPPORT
102#define PPP_COMP 0xfd /* compressed packet */
103#endif /* CCP_SUPPORT */
104#define PPP_IPCP 0x8021 /* IP Control Protocol */
105#if 0 /* UNUSED */
106#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */
107#define PPP_IPXCP 0x802b /* IPX Control Protocol */
108#endif /* UNUSED */
109#if PPP_IPV6_SUPPORT
110#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */
111#endif /* PPP_IPV6_SUPPORT */
112#if CCP_SUPPORT
113#define PPP_CCP 0x80fd /* Compression Control Protocol */
114#endif /* CCP_SUPPORT */
115#if ECP_SUPPORT
116#define PPP_ECP 0x8053 /* Encryption Control Protocol */
117#endif /* ECP_SUPPORT */
118#define PPP_LCP 0xc021 /* Link Control Protocol */
119#if PAP_SUPPORT
120#define PPP_PAP 0xc023 /* Password Authentication Protocol */
121#endif /* PAP_SUPPORT */
122#if LQR_SUPPORT
123#define PPP_LQR 0xc025 /* Link Quality Report protocol */
124#endif /* LQR_SUPPORT */
125#if CHAP_SUPPORT
126#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */
127#endif /* CHAP_SUPPORT */
128#if CBCP_SUPPORT
129#define PPP_CBCP 0xc029 /* Callback Control Protocol */
130#endif /* CBCP_SUPPORT */
131#if EAP_SUPPORT
132#define PPP_EAP 0xc227 /* Extensible Authentication Protocol */
133#endif /* EAP_SUPPORT */
134
135/*
136 * The following struct gives the addresses of procedures to call
137 * for a particular lower link level protocol.
138 */
139struct link_callbacks {
140 /* Start a connection (e.g. Initiate discovery phase) */
141 void (*connect) (ppp_pcb *pcb, void *ctx);
142#if PPP_SERVER
143 /* Listen for an incoming connection (Passive mode) */
144 void (*listen) (ppp_pcb *pcb, void *ctx);
145#endif /* PPP_SERVER */
146 /* End a connection (i.e. initiate disconnect phase) */
147 void (*disconnect) (ppp_pcb *pcb, void *ctx);
148 /* Free lower protocol control block */
149 err_t (*free) (ppp_pcb *pcb, void *ctx);
150 /* Write a pbuf to a ppp link, only used from PPP functions to send PPP packets. */
151 err_t (*write)(ppp_pcb *pcb, void *ctx, struct pbuf *p);
152 /* Send a packet from lwIP core (IPv4 or IPv6) */
153 err_t (*netif_output)(ppp_pcb *pcb, void *ctx, struct pbuf *p, u_short protocol);
154 /* configure the transmit-side characteristics of the PPP interface */
155 void (*send_config)(ppp_pcb *pcb, void *ctx, u32_t accm, int pcomp, int accomp);
156 /* confire the receive-side characteristics of the PPP interface */
157 void (*recv_config)(ppp_pcb *pcb, void *ctx, u32_t accm, int pcomp, int accomp);
158};
159
160/*
161 * What to do with network protocol (NP) packets.
162 */
163enum NPmode {
164 NPMODE_PASS, /* pass the packet through */
165 NPMODE_DROP, /* silently drop the packet */
166 NPMODE_ERROR, /* return an error */
167 NPMODE_QUEUE /* save it up for later. */
168};
169
170/*
171 * Statistics.
172 */
173#if PPP_STATS_SUPPORT
174struct pppstat {
175 unsigned int ppp_ibytes; /* bytes received */
176 unsigned int ppp_ipackets; /* packets received */
177 unsigned int ppp_ierrors; /* receive errors */
178 unsigned int ppp_obytes; /* bytes sent */
179 unsigned int ppp_opackets; /* packets sent */
180 unsigned int ppp_oerrors; /* transmit errors */
181};
182
183#if VJ_SUPPORT
184struct vjstat {
185 unsigned int vjs_packets; /* outbound packets */
186 unsigned int vjs_compressed; /* outbound compressed packets */
187 unsigned int vjs_searches; /* searches for connection state */
188 unsigned int vjs_misses; /* times couldn't find conn. state */
189 unsigned int vjs_uncompressedin; /* inbound uncompressed packets */
190 unsigned int vjs_compressedin; /* inbound compressed packets */
191 unsigned int vjs_errorin; /* inbound unknown type packets */
192 unsigned int vjs_tossed; /* inbound packets tossed because of error */
193};
194#endif /* VJ_SUPPORT */
195
196struct ppp_stats {
197 struct pppstat p; /* basic PPP statistics */
198#if VJ_SUPPORT
199 struct vjstat vj; /* VJ header compression statistics */
200#endif /* VJ_SUPPORT */
201};
202
203#if CCP_SUPPORT
204struct compstat {
205 unsigned int unc_bytes; /* total uncompressed bytes */
206 unsigned int unc_packets; /* total uncompressed packets */
207 unsigned int comp_bytes; /* compressed bytes */
208 unsigned int comp_packets; /* compressed packets */
209 unsigned int inc_bytes; /* incompressible bytes */
210 unsigned int inc_packets; /* incompressible packets */
211 unsigned int ratio; /* recent compression ratio << 8 */
212};
213
214struct ppp_comp_stats {
215 struct compstat c; /* packet compression statistics */
216 struct compstat d; /* packet decompression statistics */
217};
218#endif /* CCP_SUPPORT */
219
220#endif /* PPP_STATS_SUPPORT */
221
222#if PPP_IDLETIMELIMIT
223/*
224 * The following structure records the time in seconds since
225 * the last NP packet was sent or received.
226 */
227struct ppp_idle {
228 time_t xmit_idle; /* time since last NP packet sent */
229 time_t recv_idle; /* time since last NP packet received */
230};
231#endif /* PPP_IDLETIMELIMIT */
232
233/* values for epdisc.class */
234#define EPD_NULL 0 /* null discriminator, no data */
235#define EPD_LOCAL 1
236#define EPD_IP 2
237#define EPD_MAC 3
238#define EPD_MAGIC 4
239#define EPD_PHONENUM 5
240
241/*
242 * Global variables.
243 */
244#ifdef HAVE_MULTILINK
245extern u8_t multilink; /* enable multilink operation */
246extern u8_t doing_multilink;
247extern u8_t multilink_master;
248extern u8_t bundle_eof;
249extern u8_t bundle_terminating;
250#endif
251
252#ifdef MAXOCTETS
253extern unsigned int maxoctets; /* Maximum octetes per session (in bytes) */
254extern int maxoctets_dir; /* Direction :
255 0 - in+out (default)
256 1 - in
257 2 - out
258 3 - max(in,out) */
259extern int maxoctets_timeout; /* Timeout for check of octets limit */
260#define PPP_OCTETS_DIRECTION_SUM 0
261#define PPP_OCTETS_DIRECTION_IN 1
262#define PPP_OCTETS_DIRECTION_OUT 2
263#define PPP_OCTETS_DIRECTION_MAXOVERAL 3
264/* same as previos, but little different on RADIUS side */
265#define PPP_OCTETS_DIRECTION_MAXSESSION 4
266#endif
267
268/* Data input may be used by CCP and ECP, remove this entry
269 * from struct protent to save some flash
270 */
271#define PPP_DATAINPUT 0
272
273/*
274 * The following struct gives the addresses of procedures to call
275 * for a particular protocol.
276 */
277struct protent {
278 u_short protocol; /* PPP protocol number */
279 /* Initialization procedure */
280 void (*init) (ppp_pcb *pcb);
281 /* Process a received packet */
282 void (*input) (ppp_pcb *pcb, u_char *pkt, int len);
283 /* Process a received protocol-reject */
284 void (*protrej) (ppp_pcb *pcb);
285 /* Lower layer has come up */
286 void (*lowerup) (ppp_pcb *pcb);
287 /* Lower layer has gone down */
288 void (*lowerdown) (ppp_pcb *pcb);
289 /* Open the protocol */
290 void (*open) (ppp_pcb *pcb);
291 /* Close the protocol */
292 void (*close) (ppp_pcb *pcb, const char *reason);
293#if PRINTPKT_SUPPORT
294 /* Print a packet in readable form */
295 int (*printpkt) (const u_char *pkt, int len,
296 void (*printer) (void *, const char *, ...),
297 void *arg);
298#endif /* PRINTPKT_SUPPORT */
299#if PPP_DATAINPUT
300 /* Process a received data packet */
301 void (*datainput) (ppp_pcb *pcb, u_char *pkt, int len);
302#endif /* PPP_DATAINPUT */
303#if PRINTPKT_SUPPORT
304 const char *name; /* Text name of protocol */
305 const char *data_name; /* Text name of corresponding data protocol */
306#endif /* PRINTPKT_SUPPORT */
307#if PPP_OPTIONS
308 option_t *options; /* List of command-line options */
309 /* Check requested options, assign defaults */
310 void (*check_options) (void);
311#endif /* PPP_OPTIONS */
312#if DEMAND_SUPPORT
313 /* Configure interface for demand-dial */
314 int (*demand_conf) (int unit);
315 /* Say whether to bring up link for this pkt */
316 int (*active_pkt) (u_char *pkt, int len);
317#endif /* DEMAND_SUPPORT */
318};
319
320/* Table of pointers to supported protocols */
321extern const struct protent* const protocols[];
322
323
324/* Values for auth_pending, auth_done */
325#if PAP_SUPPORT
326#define PAP_WITHPEER 0x1
327#define PAP_PEER 0x2
328#endif /* PAP_SUPPORT */
329#if CHAP_SUPPORT
330#define CHAP_WITHPEER 0x4
331#define CHAP_PEER 0x8
332#endif /* CHAP_SUPPORT */
333#if EAP_SUPPORT
334#define EAP_WITHPEER 0x10
335#define EAP_PEER 0x20
336#endif /* EAP_SUPPORT */
337
338/* Values for auth_done only */
339#if CHAP_SUPPORT
340#define CHAP_MD5_WITHPEER 0x40
341#define CHAP_MD5_PEER 0x80
342#if MSCHAP_SUPPORT
343#define CHAP_MS_SHIFT 8 /* LSB position for MS auths */
344#define CHAP_MS_WITHPEER 0x100
345#define CHAP_MS_PEER 0x200
346#define CHAP_MS2_WITHPEER 0x400
347#define CHAP_MS2_PEER 0x800
348#endif /* MSCHAP_SUPPORT */
349#endif /* CHAP_SUPPORT */
350
351/* Supported CHAP protocols */
352#if CHAP_SUPPORT
353
354#if MSCHAP_SUPPORT
355#define CHAP_MDTYPE_SUPPORTED (MDTYPE_MICROSOFT_V2 | MDTYPE_MICROSOFT | MDTYPE_MD5)
356#else /* MSCHAP_SUPPORT */
357#define CHAP_MDTYPE_SUPPORTED (MDTYPE_MD5)
358#endif /* MSCHAP_SUPPORT */
359
360#else /* CHAP_SUPPORT */
361#define CHAP_MDTYPE_SUPPORTED (MDTYPE_NONE)
362#endif /* CHAP_SUPPORT */
363
364#if PPP_STATS_SUPPORT
365/*
366 * PPP statistics structure
367 */
368struct pppd_stats {
369 unsigned int bytes_in;
370 unsigned int bytes_out;
371 unsigned int pkts_in;
372 unsigned int pkts_out;
373};
374#endif /* PPP_STATS_SUPPORT */
375
376
377/*
378 * PPP private functions
379 */
380
381
382/*
383 * Functions called from lwIP core.
384 */
385
386/* initialize the PPP subsystem */
387int ppp_init(void);
388
389/*
390 * Functions called from PPP link protocols.
391 */
392
393/* Create a new PPP control block */
394ppp_pcb *ppp_new(struct netif *pppif, const struct link_callbacks *callbacks, void *link_ctx_cb,
395 ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
396
397/* Initiate LCP open request */
398void ppp_start(ppp_pcb *pcb);
399
400/* Called when link failed to setup */
401void ppp_link_failed(ppp_pcb *pcb);
402
403/* Called when link is normally down (i.e. it was asked to end) */
404void ppp_link_end(ppp_pcb *pcb);
405
406/* function called to process input packet */
407void ppp_input(ppp_pcb *pcb, struct pbuf *pb);
408
409/* helper function, merge a pbuf chain into one pbuf */
410struct pbuf *ppp_singlebuf(struct pbuf *p);
411
412
413/*
414 * Functions called by PPP protocols.
415 */
416
417/* function called by all PPP subsystems to send packets */
418err_t ppp_write(ppp_pcb *pcb, struct pbuf *p);
419
420/* functions called by auth.c link_terminated() */
421void ppp_link_terminated(ppp_pcb *pcb);
422
423void new_phase(ppp_pcb *pcb, int p);
424
425int ppp_send_config(ppp_pcb *pcb, int mtu, u32_t accm, int pcomp, int accomp);
426int ppp_recv_config(ppp_pcb *pcb, int mru, u32_t accm, int pcomp, int accomp);
427
428#if PPP_IPV4_SUPPORT
429int sifaddr(ppp_pcb *pcb, u32_t our_adr, u32_t his_adr, u32_t netmask);
430int cifaddr(ppp_pcb *pcb, u32_t our_adr, u32_t his_adr);
431#if 0 /* UNUSED - PROXY ARP */
432int sifproxyarp(ppp_pcb *pcb, u32_t his_adr);
433int cifproxyarp(ppp_pcb *pcb, u32_t his_adr);
434#endif /* UNUSED - PROXY ARP */
435#if LWIP_DNS
436int sdns(ppp_pcb *pcb, u32_t ns1, u32_t ns2);
437int cdns(ppp_pcb *pcb, u32_t ns1, u32_t ns2);
438#endif /* LWIP_DNS */
439#if VJ_SUPPORT
440int sifvjcomp(ppp_pcb *pcb, int vjcomp, int cidcomp, int maxcid);
441#endif /* VJ_SUPPORT */
442int sifup(ppp_pcb *pcb);
443int sifdown (ppp_pcb *pcb);
444u32_t get_mask(u32_t addr);
445#endif /* PPP_IPV4_SUPPORT */
446
447#if PPP_IPV6_SUPPORT
448int sif6addr(ppp_pcb *pcb, eui64_t our_eui64, eui64_t his_eui64);
449int cif6addr(ppp_pcb *pcb, eui64_t our_eui64, eui64_t his_eui64);
450int sif6up(ppp_pcb *pcb);
451int sif6down (ppp_pcb *pcb);
452#endif /* PPP_IPV6_SUPPORT */
453
454#if DEMAND_SUPPORT
455int sifnpmode(ppp_pcb *pcb, int proto, enum NPmode mode);
456#endif /* DEMAND_SUPPORt */
457
458void netif_set_mtu(ppp_pcb *pcb, int mtu);
459int netif_get_mtu(ppp_pcb *pcb);
460
461#if CCP_SUPPORT
462#if 0 /* unused */
463int ccp_test(ppp_pcb *pcb, u_char *opt_ptr, int opt_len, int for_transmit);
464#endif /* unused */
465void ccp_set(ppp_pcb *pcb, u8_t isopen, u8_t isup, u8_t receive_method, u8_t transmit_method);
466void ccp_reset_comp(ppp_pcb *pcb);
467void ccp_reset_decomp(ppp_pcb *pcb);
468#if 0 /* unused */
469int ccp_fatal_error(ppp_pcb *pcb);
470#endif /* unused */
471#endif /* CCP_SUPPORT */
472
473#if PPP_IDLETIMELIMIT
474int get_idle_time(ppp_pcb *pcb, struct ppp_idle *ip);
475#endif /* PPP_IDLETIMELIMIT */
476
477#if DEMAND_SUPPORT
478int get_loop_output(void);
479#endif /* DEMAND_SUPPORT */
480
481/* Optional protocol names list, to make our messages a little more informative. */
482#if PPP_PROTOCOLNAME
483const char * protocol_name(int proto);
484#endif /* PPP_PROTOCOLNAME */
485
486/* Optional stats support, to get some statistics on the PPP interface */
487#if PPP_STATS_SUPPORT
488void print_link_stats(void); /* Print stats, if available */
489void reset_link_stats(int u); /* Reset (init) stats when link goes up */
490void update_link_stats(int u); /* Get stats at link termination */
491#endif /* PPP_STATS_SUPPORT */
492
493
494
495/*
496 * Inline versions of get/put char/short/long.
497 * Pointer is advanced; we assume that both arguments
498 * are lvalues and will already be in registers.
499 * cp MUST be u_char *.
500 */
501#define GETCHAR(c, cp) { \
502 (c) = *(cp)++; \
503}
504#define PUTCHAR(c, cp) { \
505 *(cp)++ = (u_char) (c); \
506}
507#define GETSHORT(s, cp) { \
508 (s) = *(cp)++ << 8; \
509 (s) |= *(cp)++; \
510}
511#define PUTSHORT(s, cp) { \
512 *(cp)++ = (u_char) ((s) >> 8); \
513 *(cp)++ = (u_char) (s); \
514}
515#define GETLONG(l, cp) { \
516 (l) = *(cp)++ << 8; \
517 (l) |= *(cp)++; (l) <<= 8; \
518 (l) |= *(cp)++; (l) <<= 8; \
519 (l) |= *(cp)++; \
520}
521#define PUTLONG(l, cp) { \
522 *(cp)++ = (u_char) ((l) >> 24); \
523 *(cp)++ = (u_char) ((l) >> 16); \
524 *(cp)++ = (u_char) ((l) >> 8); \
525 *(cp)++ = (u_char) (l); \
526}
527
528#define INCPTR(n, cp) ((cp) += (n))
529#define DECPTR(n, cp) ((cp) -= (n))
530
531/*
532 * System dependent definitions for user-level 4.3BSD UNIX implementation.
533 */
534#define TIMEOUT(f, a, t) do { sys_untimeout((f), (a)); sys_timeout((t)*1000, (f), (a)); } while(0)
535#define TIMEOUTMS(f, a, t) do { sys_untimeout((f), (a)); sys_timeout((t), (f), (a)); } while(0)
536#define UNTIMEOUT(f, a) sys_untimeout((f), (a))
537
538#define BZERO(s, n) memset(s, 0, n)
539#define BCMP(s1, s2, l) memcmp(s1, s2, l)
540
541#define PRINTMSG(m, l) { ppp_info("Remote message: %0.*v", l, m); }
542
543/*
544 * MAKEHEADER - Add Header fields to a packet.
545 */
546#define MAKEHEADER(p, t) { \
547 PUTCHAR(PPP_ALLSTATIONS, p); \
548 PUTCHAR(PPP_UI, p); \
549 PUTSHORT(t, p); }
550
551/* Procedures exported from auth.c */
552void link_required(ppp_pcb *pcb); /* we are starting to use the link */
553void link_terminated(ppp_pcb *pcb); /* we are finished with the link */
554void link_down(ppp_pcb *pcb); /* the LCP layer has left the Opened state */
555void upper_layers_down(ppp_pcb *pcb); /* take all NCPs down */
556void link_established(ppp_pcb *pcb); /* the link is up; authenticate now */
557void start_networks(ppp_pcb *pcb); /* start all the network control protos */
558void continue_networks(ppp_pcb *pcb); /* start network [ip, etc] control protos */
559#if PPP_AUTH_SUPPORT
560#if PPP_SERVER
561int auth_check_passwd(ppp_pcb *pcb, char *auser, int userlen, char *apasswd, int passwdlen, const char **msg, int *msglen);
562 /* check the user name and passwd against configuration */
563void auth_peer_fail(ppp_pcb *pcb, int protocol);
564 /* peer failed to authenticate itself */
565void auth_peer_success(ppp_pcb *pcb, int protocol, int prot_flavor, const char *name, int namelen);
566 /* peer successfully authenticated itself */
567#endif /* PPP_SERVER */
568void auth_withpeer_fail(ppp_pcb *pcb, int protocol);
569 /* we failed to authenticate ourselves */
570void auth_withpeer_success(ppp_pcb *pcb, int protocol, int prot_flavor);
571 /* we successfully authenticated ourselves */
572#endif /* PPP_AUTH_SUPPORT */
573void np_up(ppp_pcb *pcb, int proto); /* a network protocol has come up */
574void np_down(ppp_pcb *pcb, int proto); /* a network protocol has gone down */
575void np_finished(ppp_pcb *pcb, int proto); /* a network protocol no longer needs link */
576#if PPP_AUTH_SUPPORT
577int get_secret(ppp_pcb *pcb, const char *client, const char *server, char *secret, int *secret_len, int am_server);
578 /* get "secret" for chap */
579#endif /* PPP_AUTH_SUPPORT */
580
581/* Procedures exported from ipcp.c */
582/* int parse_dotted_ip (char *, u32_t *); */
583
584/* Procedures exported from demand.c */
585#if DEMAND_SUPPORT
586void demand_conf (void); /* config interface(s) for demand-dial */
587void demand_block (void); /* set all NPs to queue up packets */
588void demand_unblock (void); /* set all NPs to pass packets */
589void demand_discard (void); /* set all NPs to discard packets */
590void demand_rexmit (int, u32_t); /* retransmit saved frames for an NP*/
591int loop_chars (unsigned char *, int); /* process chars from loopback */
592int loop_frame (unsigned char *, int); /* should we bring link up? */
593#endif /* DEMAND_SUPPORT */
594
595/* Procedures exported from multilink.c */
596#ifdef HAVE_MULTILINK
597void mp_check_options (void); /* Check multilink-related options */
598int mp_join_bundle (void); /* join our link to an appropriate bundle */
599void mp_exit_bundle (void); /* have disconnected our link from bundle */
600void mp_bundle_terminated (void);
601char *epdisc_to_str (struct epdisc *); /* string from endpoint discrim. */
602int str_to_epdisc (struct epdisc *, char *); /* endpt disc. from str */
603#else
604#define mp_bundle_terminated() /* nothing */
605#define mp_exit_bundle() /* nothing */
606#define doing_multilink 0
607#define multilink_master 0
608#endif
609
610/* Procedures exported from utils.c. */
611void ppp_print_string(const u_char *p, int len, void (*printer) (void *, const char *, ...), void *arg); /* Format a string for output */
612int ppp_slprintf(char *buf, int buflen, const char *fmt, ...); /* sprintf++ */
613int ppp_vslprintf(char *buf, int buflen, const char *fmt, va_list args); /* vsprintf++ */
614size_t ppp_strlcpy(char *dest, const char *src, size_t len); /* safe strcpy */
615size_t ppp_strlcat(char *dest, const char *src, size_t len); /* safe strncpy */
616void ppp_dbglog(const char *fmt, ...); /* log a debug message */
617void ppp_info(const char *fmt, ...); /* log an informational message */
618void ppp_notice(const char *fmt, ...); /* log a notice-level message */
619void ppp_warn(const char *fmt, ...); /* log a warning message */
620void ppp_error(const char *fmt, ...); /* log an error message */
621void ppp_fatal(const char *fmt, ...); /* log an error message and die(1) */
622#if PRINTPKT_SUPPORT
623void ppp_dump_packet(ppp_pcb *pcb, const char *tag, unsigned char *p, int len);
624 /* dump packet to debug log if interesting */
625#endif /* PRINTPKT_SUPPORT */
626
627
628#endif /* PPP_SUPPORT */
629#endif /* LWIP_HDR_PPP_IMPL_H */
s8_t err_t
Definition err.h:76
Definition netif.h:244
Definition pbuf.h:161
u16_t len
Definition pbuf.h:178