BadVPN – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 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 */
139 struct 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 */
163 enum 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
174 struct 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
184 struct 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  
196 struct 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
204 struct 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  
214 struct 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 */
227 struct 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
245 extern u8_t multilink; /* enable multilink operation */
246 extern u8_t doing_multilink;
247 extern u8_t multilink_master;
248 extern u8_t bundle_eof;
249 extern u8_t bundle_terminating;
250 #endif
251  
252 #ifdef MAXOCTETS
253 extern unsigned int maxoctets; /* Maximum octetes per session (in bytes) */
254 extern int maxoctets_dir; /* Direction :
255  
256 1 - in
257 2 - out
258 3 - max(in,out) */
259 extern 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 */
277 struct 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 */
321 extern 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 */
368 struct 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 */
387 int ppp_init(void);
388  
389 /*
390 * Functions called from PPP link protocols.
391 */
392  
393 /* Create a new PPP control block */
394 ppp_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 */
398 void ppp_start(ppp_pcb *pcb);
399  
400 /* Called when link failed to setup */
401 void ppp_link_failed(ppp_pcb *pcb);
402  
403 /* Called when link is normally down (i.e. it was asked to end) */
404 void ppp_link_end(ppp_pcb *pcb);
405  
406 /* function called to process input packet */
407 void ppp_input(ppp_pcb *pcb, struct pbuf *pb);
408  
409  
410 /*
411 * Functions called by PPP protocols.
412 */
413  
414 /* function called by all PPP subsystems to send packets */
415 err_t ppp_write(ppp_pcb *pcb, struct pbuf *p);
416  
417 /* functions called by auth.c link_terminated() */
418 void ppp_link_terminated(ppp_pcb *pcb);
419  
420 void new_phase(ppp_pcb *pcb, int p);
421  
422 int ppp_send_config(ppp_pcb *pcb, int mtu, u32_t accm, int pcomp, int accomp);
423 int ppp_recv_config(ppp_pcb *pcb, int mru, u32_t accm, int pcomp, int accomp);
424  
425 #if PPP_IPV4_SUPPORT
426 int sifaddr(ppp_pcb *pcb, u32_t our_adr, u32_t his_adr, u32_t netmask);
427 int cifaddr(ppp_pcb *pcb, u32_t our_adr, u32_t his_adr);
428 #if 0 /* UNUSED - PROXY ARP */
429 int sifproxyarp(ppp_pcb *pcb, u32_t his_adr);
430 int cifproxyarp(ppp_pcb *pcb, u32_t his_adr);
431 #endif /* UNUSED - PROXY ARP */
432 #if LWIP_DNS
433 int sdns(ppp_pcb *pcb, u32_t ns1, u32_t ns2);
434 int cdns(ppp_pcb *pcb, u32_t ns1, u32_t ns2);
435 #endif /* LWIP_DNS */
436 #if VJ_SUPPORT
437 int sifvjcomp(ppp_pcb *pcb, int vjcomp, int cidcomp, int maxcid);
438 #endif /* VJ_SUPPORT */
439 int sifup(ppp_pcb *pcb);
440 int sifdown (ppp_pcb *pcb);
441 u32_t get_mask(u32_t addr);
442 #endif /* PPP_IPV4_SUPPORT */
443  
444 #if PPP_IPV6_SUPPORT
445 int sif6addr(ppp_pcb *pcb, eui64_t our_eui64, eui64_t his_eui64);
446 int cif6addr(ppp_pcb *pcb, eui64_t our_eui64, eui64_t his_eui64);
447 int sif6up(ppp_pcb *pcb);
448 int sif6down (ppp_pcb *pcb);
449 #endif /* PPP_IPV6_SUPPORT */
450  
451 #if DEMAND_SUPPORT
452 int sifnpmode(ppp_pcb *pcb, int proto, enum NPmode mode);
453 #endif /* DEMAND_SUPPORt */
454  
455 void netif_set_mtu(ppp_pcb *pcb, int mtu);
456 int netif_get_mtu(ppp_pcb *pcb);
457  
458 #if CCP_SUPPORT
459 #if 0 /* unused */
460 int ccp_test(ppp_pcb *pcb, u_char *opt_ptr, int opt_len, int for_transmit);
461 #endif /* unused */
462 void ccp_set(ppp_pcb *pcb, u8_t isopen, u8_t isup, u8_t receive_method, u8_t transmit_method);
463 void ccp_reset_comp(ppp_pcb *pcb);
464 void ccp_reset_decomp(ppp_pcb *pcb);
465 #if 0 /* unused */
466 int ccp_fatal_error(ppp_pcb *pcb);
467 #endif /* unused */
468 #endif /* CCP_SUPPORT */
469  
470 #if PPP_IDLETIMELIMIT
471 int get_idle_time(ppp_pcb *pcb, struct ppp_idle *ip);
472 #endif /* PPP_IDLETIMELIMIT */
473  
474 #if DEMAND_SUPPORT
475 int get_loop_output(void);
476 #endif /* DEMAND_SUPPORT */
477  
478 /* Optional protocol names list, to make our messages a little more informative. */
479 #if PPP_PROTOCOLNAME
480 const char * protocol_name(int proto);
481 #endif /* PPP_PROTOCOLNAME */
482  
483 /* Optional stats support, to get some statistics on the PPP interface */
484 #if PPP_STATS_SUPPORT
485 void print_link_stats(void); /* Print stats, if available */
486 void reset_link_stats(int u); /* Reset (init) stats when link goes up */
487 void update_link_stats(int u); /* Get stats at link termination */
488 #endif /* PPP_STATS_SUPPORT */
489  
490  
491  
492 /*
493 * Inline versions of get/put char/short/long.
494 * Pointer is advanced; we assume that both arguments
495 * are lvalues and will already be in registers.
496 * cp MUST be u_char *.
497 */
498 #define GETCHAR(c, cp) { \
499 (c) = *(cp)++; \
500 }
501 #define PUTCHAR(c, cp) { \
502 *(cp)++ = (u_char) (c); \
503 }
504 #define GETSHORT(s, cp) { \
505 (s) = *(cp)++ << 8; \
506 (s) |= *(cp)++; \
507 }
508 #define PUTSHORT(s, cp) { \
509 *(cp)++ = (u_char) ((s) >> 8); \
510 *(cp)++ = (u_char) (s); \
511 }
512 #define GETLONG(l, cp) { \
513 (l) = *(cp)++ << 8; \
514 (l) |= *(cp)++; (l) <<= 8; \
515 (l) |= *(cp)++; (l) <<= 8; \
516 (l) |= *(cp)++; \
517 }
518 #define PUTLONG(l, cp) { \
519 *(cp)++ = (u_char) ((l) >> 24); \
520 *(cp)++ = (u_char) ((l) >> 16); \
521 *(cp)++ = (u_char) ((l) >> 8); \
522 *(cp)++ = (u_char) (l); \
523 }
524  
525 #define INCPTR(n, cp) ((cp) += (n))
526 #define DECPTR(n, cp) ((cp) -= (n))
527  
528 /*
529 * System dependent definitions for user-level 4.3BSD UNIX implementation.
530 */
531 #define TIMEOUT(f, a, t) do { sys_untimeout((f), (a)); sys_timeout((t)*1000, (f), (a)); } while(0)
532 #define TIMEOUTMS(f, a, t) do { sys_untimeout((f), (a)); sys_timeout((t), (f), (a)); } while(0)
533 #define UNTIMEOUT(f, a) sys_untimeout((f), (a))
534  
535 #define BZERO(s, n) memset(s, 0, n)
536 #define BCMP(s1, s2, l) memcmp(s1, s2, l)
537  
538 #define PRINTMSG(m, l) { ppp_info("Remote message: %0.*v", l, m); }
539  
540 /*
541 * MAKEHEADER - Add Header fields to a packet.
542 */
543 #define MAKEHEADER(p, t) { \
544 PUTCHAR(PPP_ALLSTATIONS, p); \
545 PUTCHAR(PPP_UI, p); \
546 PUTSHORT(t, p); }
547  
548 /* Procedures exported from auth.c */
549 void link_required(ppp_pcb *pcb); /* we are starting to use the link */
550 void link_terminated(ppp_pcb *pcb); /* we are finished with the link */
551 void link_down(ppp_pcb *pcb); /* the LCP layer has left the Opened state */
552 void upper_layers_down(ppp_pcb *pcb); /* take all NCPs down */
553 void link_established(ppp_pcb *pcb); /* the link is up; authenticate now */
554 void start_networks(ppp_pcb *pcb); /* start all the network control protos */
555 void continue_networks(ppp_pcb *pcb); /* start network [ip, etc] control protos */
556 #if PPP_AUTH_SUPPORT
557 #if PPP_SERVER
558 int auth_check_passwd(ppp_pcb *pcb, char *auser, int userlen, char *apasswd, int passwdlen, const char **msg, int *msglen);
559 /* check the user name and passwd against configuration */
560 void auth_peer_fail(ppp_pcb *pcb, int protocol);
561 /* peer failed to authenticate itself */
562 void auth_peer_success(ppp_pcb *pcb, int protocol, int prot_flavor, const char *name, int namelen);
563 /* peer successfully authenticated itself */
564 #endif /* PPP_SERVER */
565 void auth_withpeer_fail(ppp_pcb *pcb, int protocol);
566 /* we failed to authenticate ourselves */
567 void auth_withpeer_success(ppp_pcb *pcb, int protocol, int prot_flavor);
568 /* we successfully authenticated ourselves */
569 #endif /* PPP_AUTH_SUPPORT */
570 void np_up(ppp_pcb *pcb, int proto); /* a network protocol has come up */
571 void np_down(ppp_pcb *pcb, int proto); /* a network protocol has gone down */
572 void np_finished(ppp_pcb *pcb, int proto); /* a network protocol no longer needs link */
573 #if PPP_AUTH_SUPPORT
574 int get_secret(ppp_pcb *pcb, const char *client, const char *server, char *secret, int *secret_len, int am_server);
575 /* get "secret" for chap */
576 #endif /* PPP_AUTH_SUPPORT */
577  
578 /* Procedures exported from ipcp.c */
579 /* int parse_dotted_ip (char *, u32_t *); */
580  
581 /* Procedures exported from demand.c */
582 #if DEMAND_SUPPORT
583 void demand_conf (void); /* config interface(s) for demand-dial */
584 void demand_block (void); /* set all NPs to queue up packets */
585 void demand_unblock (void); /* set all NPs to pass packets */
586 void demand_discard (void); /* set all NPs to discard packets */
587 void demand_rexmit (int, u32_t); /* retransmit saved frames for an NP*/
588 int loop_chars (unsigned char *, int); /* process chars from loopback */
589 int loop_frame (unsigned char *, int); /* should we bring link up? */
590 #endif /* DEMAND_SUPPORT */
591  
592 /* Procedures exported from multilink.c */
593 #ifdef HAVE_MULTILINK
594 void mp_check_options (void); /* Check multilink-related options */
595 int mp_join_bundle (void); /* join our link to an appropriate bundle */
596 void mp_exit_bundle (void); /* have disconnected our link from bundle */
597 void mp_bundle_terminated (void);
598 char *epdisc_to_str (struct epdisc *); /* string from endpoint discrim. */
599 int str_to_epdisc (struct epdisc *, char *); /* endpt disc. from str */
600 #else
601 #define mp_bundle_terminated() /* nothing */
602 #define mp_exit_bundle() /* nothing */
603 #define doing_multilink 0
604 #define multilink_master 0
605 #endif
606  
607 /* Procedures exported from utils.c. */
608 void ppp_print_string(const u_char *p, int len, void (*printer) (void *, const char *, ...), void *arg); /* Format a string for output */
609 int ppp_slprintf(char *buf, int buflen, const char *fmt, ...); /* sprintf++ */
610 int ppp_vslprintf(char *buf, int buflen, const char *fmt, va_list args); /* vsprintf++ */
611 size_t ppp_strlcpy(char *dest, const char *src, size_t len); /* safe strcpy */
612 size_t ppp_strlcat(char *dest, const char *src, size_t len); /* safe strncpy */
613 void ppp_dbglog(const char *fmt, ...); /* log a debug message */
614 void ppp_info(const char *fmt, ...); /* log an informational message */
615 void ppp_notice(const char *fmt, ...); /* log a notice-level message */
616 void ppp_warn(const char *fmt, ...); /* log a warning message */
617 void ppp_error(const char *fmt, ...); /* log an error message */
618 void ppp_fatal(const char *fmt, ...); /* log an error message and die(1) */
619 #if PRINTPKT_SUPPORT
620 void ppp_dump_packet(ppp_pcb *pcb, const char *tag, unsigned char *p, int len);
621 /* dump packet to debug log if interesting */
622 #endif /* PRINTPKT_SUPPORT */
623  
624  
625 #endif /* PPP_SUPPORT */
626 #endif /* LWIP_HDR_PPP_IMPL_H */