source: rtems-libbsd/rtemsbsd/pppd/pppd.h

6-freebsd-12
Last change on this file was 573b4cd6, checked in by Sebastian Huber <sebastian.huber@…>, on 10/08/14 at 06:04:59

ppp: Port to new stack

  • Property mode set to 100644
File size: 22.5 KB
Line 
1/*
2 * pppd.h - PPP daemon global declarations.
3 *
4 * Copyright (c) 1989 Carnegie Mellon University.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms are permitted
8 * provided that the above copyright notice and this paragraph are
9 * duplicated in all such forms and that any documentation,
10 * advertising materials, and other materials related to such
11 * distribution and use acknowledge that the software was developed
12 * by Carnegie Mellon University.  The name of the
13 * University may not be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 *
19 * $Id$
20 */
21
22#ifndef __PPPD_H__
23#define __PPPD_H__
24
25#include <stdbool.h>            /* bool */
26#include <stdio.h>              /* for FILE */
27#include <limits.h>             /* for NGROUPS_MAX */
28#include <sys/param.h>          /* for MAXPATHLEN and BSD4_4, if defined */
29#include <sys/types.h>          /* for uint32_t, if defined */
30#include <sys/time.h>           /* for struct timeval */
31#include <net/ppp_defs.h>
32#include <rtems/rtemsdialer.h>
33#include <stdint.h>
34#include <arpa/nameser.h>
35#include <arpa/nameser_compat.h>
36
37#if defined(__STDC__)
38#include <stdarg.h>
39#define __V(x)  x
40#else
41#include <varargs.h>
42#define __V(x)  (va_alist) va_dcl
43#define const
44#define volatile
45#endif
46
47#ifdef INET6
48#include "eui64.h"
49#endif
50
51#include "namespace.h"
52
53/*
54 * Limits.
55 */
56
57#define NUM_PPP         1       /* One PPP interface supported (per process) */
58#define MAXWORDLEN      1024    /* max length of word in file (incl null) */
59#define MAXARGS         1       /* max # args to a command */
60#define MAXNAMELEN      256     /* max length of hostname or name for auth */
61#define MAXSECRETLEN    256     /* max length of password or secret */
62
63/*
64 * Option descriptor structure.
65 */
66
67enum opt_type {
68        o_special_noarg = 0,
69        o_special = 1,
70        o_bool,
71        o_int,
72        o_uint32,
73        o_string,
74};
75
76typedef struct {
77        char    *name;          /* name of the option */
78        enum opt_type type;
79        void    *addr;
80        char    *description;
81        uint32_t flags;
82        void    *addr2;
83        int     upper_limit;
84        int     lower_limit;
85} option_t;
86
87/* Values for flags */
88#define OPT_VALUE       0xffL   /* mask for presupplied value */
89#define OPT_HEX         0x100L  /* int option is in hex */
90#define OPT_NOARG       0x200L  /* option doesn't take argument */
91#define OPT_OR          0x400L  /* OR in argument to value */
92#define OPT_INC         0x800L  /* increment value */
93#define OPT_PRIV        0x1000L /* privileged option */
94#define OPT_STATIC      0x2000L /* string option goes into static array */
95#define OPT_LLIMIT      0x4000L /* check value against lower limit */
96#define OPT_ULIMIT      0x8000L /* check value against upper limit */
97#define OPT_LIMITS      (OPT_LLIMIT|OPT_ULIMIT)
98#define OPT_ZEROOK      0x10000L        /* 0 value is OK even if not within limits */
99#define OPT_NOINCR      0x20000L        /* value mustn't be increased */
100#define OPT_ZEROINF     0x40000L        /* with OPT_NOINCR, 0 == infinity */
101#define OPT_A2INFO      0x100000L /* addr2 -> option_info to update */
102#define OPT_A2COPY      0x200000L /* addr2 -> second location to rcv value */
103#define OPT_ENABLE      0x400000L /* use *addr2 as enable for option */
104#define OPT_PRIVFIX     0x800000L /* can't be overridden if noauth */
105#define OPT_PREPASS     0x1000000L /* do this opt in pre-pass to find device */
106#define OPT_INITONLY    0x2000000L /* option can only be set in init phase */
107#define OPT_DEVEQUIV    0x4000000L /* equiv to device name */
108#define OPT_DEVNAM      (OPT_PREPASS | OPT_INITONLY | OPT_DEVEQUIV)
109
110#define OPT_VAL(x)      ((x) & OPT_VALUE)
111
112#ifndef GIDSET_TYPE
113#define GIDSET_TYPE     gid_t
114#endif
115
116/* Structure representing a list of permitted IP addresses. */
117struct permitted_ip {
118    int         permit;         /* 1 = permit, 0 = forbid */
119    uint32_t    base;           /* match if (addr & mask) == base */
120    uint32_t    mask;           /* base and mask are in network byte order */
121};
122
123/*
124 * Unfortunately, the linux kernel driver uses a different structure
125 * for statistics from the rest of the ports.
126 * This structure serves as a common representation for the bits
127 * pppd needs.
128 */
129struct pppd_stats {
130    unsigned int        bytes_in;
131    unsigned int        bytes_out;
132};
133
134/* Used for storing a sequence of words.  Usually malloced. */
135struct wordlist {
136    struct wordlist     *next;
137    char                *word;
138};
139
140/*
141 * Global variables.
142 */
143
144extern int      pppd_kill_link; /* Signal to terminate processing loop */
145extern int      hungup;         /* Physical layer has disconnected */
146extern int      pppifunit;      /* Interface unit number */
147extern char     ifname[];       /* Interface name */
148extern int      pppd_ttyfd;     /* Serial device file descriptor */
149extern char     hostname[];     /* Our hostname */
150extern u_char   outpacket_buf[]; /* Buffer for outgoing packets */
151extern int      pppd_phase;             /* Current state of link - see values below */
152extern int      baud_rate;      /* Current link speed in bits/sec */
153extern int      redirect_stderr;/* Connector's stderr should go to file */
154extern char     peer_authname[];/* Authenticated name of peer */
155extern int      privileged;     /* We were run by real-uid root */
156extern int      need_holdoff;   /* Need holdoff period after link terminates */
157extern char     **script_env;   /* Environment variables for scripts */
158extern int      detached;       /* Have detached from controlling tty */
159extern GIDSET_TYPE groups[NGROUPS_MAX]; /* groups the user is in */
160extern int      ngroups;        /* How many groups valid in groups */
161extern struct pppd_stats link_stats; /* byte/packet counts etc. for link */
162extern int      using_pty;      /* using pty as device (notty or pty opt.) */
163extern int      log_to_fd;      /* logging to this fd as well as syslog */
164extern char     *no_ppp_msg;    /* message to print if ppp not in kernel */
165extern volatile int pppd_status;        /* exit status for pppd */
166extern int      devnam_fixed;   /* can no longer change devnam */
167extern int      unsuccess;      /* # unsuccessful connection attempts */
168extern int      do_callback;    /* set if we want to do callback next */
169extern int      doing_callback; /* set if this is a callback */
170extern dialerfp pppd_dialer;    /* script dialer function callback */
171
172/* Values for do_callback and doing_callback */
173#define CALLBACK_DIALIN         1       /* we are expecting the call back */
174#define CALLBACK_DIALOUT        2       /* we are dialling out to call back */
175
176/*
177 * Variables set by command-line options.
178 */
179
180extern int      debug;          /* Debug flag */
181extern int      kdebugflag;     /* Tell kernel to print debug messages */
182extern int      default_device; /* Using /dev/tty or equivalent */
183extern char     devnam[MAXPATHLEN];     /* Device name */
184extern int      crtscts;        /* Use hardware flow control */
185extern bool     modem;          /* Use modem control lines */
186extern int      inspeed;        /* Input/Output speed requested */
187extern uint32_t netmask;        /* IP netmask to set on interface */
188extern bool     lockflag;       /* Create lock file to lock the serial dev */
189extern bool     nodetach;       /* Don't detach from controlling tty */
190extern bool     updetach;       /* Detach from controlling tty when link up */
191extern char     *initializer;   /* Script to initialize physical link */
192extern char     *connect_script; /* Script to establish physical link */
193extern char     *disconnect_script; /* Script to disestablish physical link */
194extern char     *welcomer;      /* Script to welcome client after connection */
195extern char     *ptycommand;    /* Command to run on other side of pty */
196extern int      maxconnect;     /* Maximum connect time (seconds) */
197extern char     user[MAXNAMELEN];/* Our name for authenticating ourselves */
198extern char     passwd[MAXSECRETLEN];   /* Password for PAP or CHAP */
199extern bool     auth_required;  /* Peer is required to authenticate */
200extern bool     persist;        /* Reopen link after it goes down */
201extern bool     uselogin;       /* Use /etc/passwd for checking PAP */
202extern char     our_name[MAXNAMELEN];/* Our name for authentication purposes */
203extern char     remote_name[MAXNAMELEN]; /* Peer's name for authentication */
204extern bool     explicit_remote;/* remote_name specified with remotename opt */
205extern bool     demand;         /* Do dial-on-demand */
206extern char     *ipparam;       /* Extra parameter for ip up/down scripts */
207extern bool     cryptpap;       /* Others' PAP passwords are encrypted */
208extern int      idle_time_limit;/* Shut down link if idle for this long */
209extern int      holdoff;        /* Dead time before restarting */
210extern bool     holdoff_specified; /* true if user gave a holdoff value */
211extern bool     notty;          /* Stdin/out is not a tty */
212extern char     *record_file;   /* File to record chars sent/received */
213extern bool     sync_serial;    /* Device is synchronous serial device */
214extern int      maxfail;        /* Max # of unsuccessful connection attempts */
215extern char     linkname[MAXPATHLEN]; /* logical name for link */
216extern bool     tune_kernel;    /* May alter kernel settings as necessary */
217extern int      connect_delay;  /* Time to delay after connect script */
218
219#ifdef PPP_FILTER
220extern struct   bpf_program pass_filter;   /* Filter for pkts to pass */
221extern struct   bpf_program active_filter; /* Filter for link-active pkts */
222#endif
223
224#ifdef MSLANMAN
225extern bool     ms_lanman;      /* Use LanMan password instead of NT */
226                                /* Has meaning only with MS-CHAP challenges */
227#endif
228
229extern char *current_option;    /* the name of the option being parsed */
230extern int  privileged_option;  /* set iff the current option came from root */
231extern char *option_source;     /* string saying where the option came from */
232
233/*
234 * Values for phase.
235 */
236#define PHASE_DEAD              0
237#define PHASE_INITIALIZE        1
238#define PHASE_SERIALCONN        2
239#define PHASE_DORMANT           3
240#define PHASE_ESTABLISH         4
241#define PHASE_AUTHENTICATE      5
242#define PHASE_CALLBACK          6
243#define PHASE_NETWORK           7
244#define PHASE_RUNNING           8
245#define PHASE_TERMINATE         9
246#define PHASE_DISCONNECT        10
247#define PHASE_HOLDOFF           11
248
249/*
250 * The following struct gives the addresses of procedures to call
251 * for a particular protocol.
252 */
253struct protent {
254    u_short protocol;           /* PPP protocol number */
255    /* Initialization procedure */
256    void (*init)(int unit);
257    /* Process a received packet */
258    void (*input)(int unit, u_char *pkt, int len);
259    /* Process a received protocol-reject */
260    void (*protrej)(int unit);
261    /* Lower layer has come up */
262    void (*lowerup)(int unit);
263    /* Lower layer has gone down */
264    void (*lowerdown)(int unit);
265    /* Open the protocol */
266    void (*open)(int unit);
267    /* Close the protocol */
268    void (*close)(int unit, char *reason);
269    /* Print a packet in readable form */
270    int  (*printpkt)(u_char *pkt, int len,
271                          void (*printer)(void *, char *, ...),
272                          void *arg);
273    /* Process a received data packet */
274    void (*datainput)(int unit, u_char *pkt, int len);
275    bool enabled_flag;          /* 0 iff protocol is disabled */
276    char *name;                 /* Text name of protocol */
277    char *data_name;            /* Text name of corresponding data protocol */
278    option_t *options;          /* List of command-line options */
279    /* Check requested options, assign defaults */
280    void (*check_options)(void);
281    /* Configure interface for demand-dial */
282    int  (*demand_conf)(int unit);
283    /* Say whether to bring up link for this pkt */
284    int  (*active_pkt)(u_char *pkt, int len);
285};
286
287/* Table of pointers to supported protocols */
288extern struct protent *protocols[];
289
290/*
291 * Prototypes.
292 */
293
294/* Procedures exported from main.c. */
295void die(int);          /* Cleanup and exit */
296void quit(void);                /* like die(1) */
297void novm(char *);      /* Say we ran out of memory, and die */
298void ppptimeout(void (*func)(void *), void *arg, int t);
299                                /* Call func(arg) after t seconds */
300void pppuntimeout(void (*func)(void *), void *arg);
301                                /* Cancel call to func(arg) */
302void update_link_stats(int); /* Get stats at link termination */
303void new_phase(int);    /* signal start of new phase */
304
305/* Procedures exported from utils.c. */
306void log_packet(u_char *, int, char *, int);
307                                /* Format a packet and log it with syslog */
308void print_string(void *, int,  void (*) (void *, char *, ...),
309                void *);        /* Format a string for output */
310int slprintf(char *, int, char *, ...);         /* sprintf++ */
311int vslprintf(char *, int, char *, va_list);    /* vsprintf++ */
312size_t strlcpy(char *, const char *, size_t);   /* safe strcpy */
313size_t strlcat(char *, const char *, size_t);   /* safe strncpy */
314void pppd_dbglog(char *, ...);  /* log a debug message */
315void pppd_info(char *, ...);    /* log an informational message */
316void pppd_notice(char *, ...);  /* log a notice-level message */
317void pppd_warn(char *, ...);    /* log a warning message */
318void pppd_error(char *, ...);   /* log an error message */
319void pppd_fatal(char *, ...);   /* log an error message and die(1) */
320
321#define dbglog pppd_dbglog
322#define info   pppd_info
323#define notice pppd_notice
324#define warn   pppd_warn
325#define error  pppd_error
326#define fatal  pppd_fatal
327
328/* Procedures exported from auth.c */
329void link_required(int);          /* we are starting to use the link */
330void link_terminated(int);  /* we are finished with the link */
331void link_down(int);      /* the LCP layer has left the Opened state */
332void link_established(int); /* the link is up; authenticate now */
333void start_networks(void);  /* start all the network control protos */
334void np_up(int, int);     /* a network protocol has come up */
335void np_down(int, int);   /* a network protocol has gone down */
336void np_finished(int, int); /* a network protocol no longer needs link */
337void auth_peer_fail(int, int);
338                                /* peer failed to authenticate itself */
339void auth_peer_success(int, int, char *, int);
340                                /* peer successfully authenticated itself */
341void auth_withpeer_fail(int, int);
342                                /* we failed to authenticate ourselves */
343void auth_withpeer_success(int, int);
344                                /* we successfully authenticated ourselves */
345int  auth_check_options(void);
346                                /* check authentication options supplied */
347void auth_reset(int);   /* check what secrets we have */
348int  check_passwd(int, char *, int, char *, int, char **);
349                                /* Check peer-supplied username/password */
350int  get_secret(int, char *, char *, unsigned char *, int *, int);
351                                /* get "secret" for chap */
352int  auth_ip_addr(int, uint32_t);
353                                /* check if IP address is authorized */
354int  bad_ip_adrs(uint32_t);
355                                /* check if IP address is unreasonable */
356
357/* Procedures exported from demand.c */
358void demand_conf(void); /* config interface(s) for demand-dial */
359void demand_block(void);        /* set all NPs to queue up packets */
360void demand_unblock(void); /* set all NPs to pass packets */
361void demand_discard(void); /* set all NPs to discard packets */
362void demand_rexmit(int);        /* retransmit saved frames for an NP */
363int  loop_chars(unsigned char *, int); /* process chars from loopback */
364int  loop_frame(unsigned char *, int); /* should we bring link up? */
365
366/* Procedures exported from sys-*.c */
367void sys_init(void);    /* Do system-dependent initialization */
368void sys_cleanup(void); /* Restore system state before exiting */
369int  sys_check_options(void); /* Check options specified */
370void sys_close(void);   /* Clean up in a child before execing */
371int  ppp_available(void);       /* Test whether ppp kernel support exists */
372int  get_pty(int *, int *, char *, int);        /* Get pty master/slave */
373int  open_ppp_loopback(void); /* Open loopback for demand-dialling */
374int  establish_ppp(int);        /* Turn serial port into a ppp interface */
375void restore_loop(void);        /* Transfer ppp unit back to loopback */
376void disestablish_ppp(int); /* Restore port to normal operation */
377void clean_check(void); /* Check if line was 8-bit clean */
378void set_up_tty(int, int); /* Set up port's speed, parameters, etc. */
379void restore_tty(int);  /* Restore port's original parameters */
380void setdtr(int, int);  /* Raise or lower port's DTR line */
381void output(int, u_char *, int); /* Output a PPP packet */
382void wait_input(struct timeval *); /* Wait for input, with timeout */
383
384void ppp_delay(void);       /* delay task for a little while */
385int  read_packet(u_char *); /* Read PPP packet */
386int  get_loop_output(void); /* Read pkts from loopback */
387void ppp_send_config(int, int, uint32_t, int, int);
388                                /* Configure i/f transmit parameters */
389void ppp_set_xaccm(int, ext_accm);
390                                /* Set extended transmit ACCM */
391void ppp_recv_config(int, int, uint32_t, int, int);
392                                /* Configure i/f receive parameters */
393int  ccp_test(int, u_char *, int, int);
394                                /* Test support for compression scheme */
395void ccp_flags_set(int, int, int);
396                                /* Set kernel CCP state */
397int  ccp_fatal_error(int); /* Test for fatal decomp error in kernel */
398int  get_idle_time(int, struct ppp_idle *);
399                                /* Find out how long link has been idle */
400int  get_ppp_stats(int, struct pppd_stats *);
401                                /* Return link statistics */
402int  sifvjcomp(int, int, int, int);
403                                /* Configure VJ TCP header compression */
404int  sifup(int);                /* Configure i/f up for one protocol */
405int  sifnpmode(int u, int proto, enum NPmode mode);
406                                /* Set mode for handling packets for proto */
407int  sifdown(int);      /* Configure i/f down for one protocol */
408int  sifaddr(int, uint32_t, uint32_t, uint32_t);
409                                /* Configure IPv4 addresses for i/f */
410int  cifaddr(int, uint32_t, uint32_t);
411                                /* Reset i/f IP addresses */
412#ifdef INET6
413int  sif6addr(int, eui64_t, eui64_t);
414                                /* Configure IPv6 addresses for i/f */
415int  cif6addr(int, eui64_t, eui64_t);
416                                /* Remove an IPv6 address from i/f */
417#endif
418int  sifdefaultroute(int, uint32_t, uint32_t);
419                                /* Create default route through i/f */
420int  cifdefaultroute(int, uint32_t, uint32_t);
421                                /* Delete default route through i/f */
422int  sifproxyarp(int, uint32_t);
423                                /* Add proxy ARP entry for peer */
424int  cifproxyarp(int, uint32_t);
425                                /* Delete proxy ARP entry for peer */
426uint32_t GetMask(uint32_t); /* Get appropriate netmask for address */
427int  lock(char *);      /* Create lock file for device */
428int  relock(int);               /* Rewrite lock file with new pid */
429void unlock(void);      /* Delete previously-created lock file */
430void logwtmp(const char *, const char *, const char *);
431                                /* Write entry to wtmp file */
432int  get_host_seed(void);       /* Get host-dependent random number seed */
433int  have_route_to(uint32_t); /* Check if route to addr exists */
434#ifdef PPP_FILTER
435int  set_filters(struct bpf_program *pass, struct bpf_program *active);
436                                /* Set filter programs in kernel */
437#endif
438#ifdef IPX_CHANGE
439int  sipxfaddr(int, unsigned long, unsigned char *);
440int  cipxfaddr(int);
441#endif
442
443/* Procedures exported from options.c */
444int  parse_args(int argc, char **argv);
445                                /* Parse options from arguments given */
446int  options_from_file(char *filename, int must_exist, int check_prot,
447                            int privileged);
448                                /* Parse options from an options file */
449int  options_from_user(void); /* Parse options from user's .ppprc */
450int  options_for_tty(void); /* Parse options from /etc/ppp/options.tty */
451int  options_from_list(struct wordlist *, int privileged);
452                                /* Parse options from a wordlist */
453int  getword(FILE *f, char *word, int *newlinep, char *filename);
454                                /* Read a word from a file */
455void option_error(char *fmt, ...);
456                                /* Print an error message about an option */
457int int_option(char *, int *);
458                                /* Simplified number_option for decimal ints */
459void add_options(option_t *); /* Add extra options */
460
461/*
462 * This structure is used to store information about certain
463 * options, such as where the option value came from (/etc/ppp/options,
464 * command line, etc.) and whether it came from a privileged source.
465 */
466
467struct option_info {
468    int     priv;               /* was value set by sysadmin? */
469    char    *source;            /* where option came from */
470};
471
472extern struct option_info devnam_info;
473extern struct option_info initializer_info;
474extern struct option_info connect_script_info;
475extern struct option_info disconnect_script_info;
476extern struct option_info welcomer_info;
477extern struct option_info ptycommand_info;
478
479/*
480 * Hooks to enable plugins to change various things.
481 */
482extern int (*new_phase_hook)(int);
483extern int (*idle_time_hook)(struct ppp_idle *);
484extern int (*holdoff_hook)(void);
485extern int (*pap_check_hook)(void);
486extern int (*pap_auth_hook)(char *user, char *passwd/*, char **msgp,
487                                 struct wordlist **paddrs,
488                                 struct wordlist **popts*/);
489extern void (*pap_logout_hook)(void);
490extern int (*pap_passwd_hook)(char *user, char *passwd);
491extern void (*ip_up_hook)(void);
492extern void (*ip_down_hook)(void);
493extern void (*auth_linkup_hook)(void);
494extern void (*auth_linkdown_hook)(void);
495
496/*
497 * Inline versions of get/put char/short/long.
498 * Pointer is advanced; we assume that both arguments
499 * are lvalues and will already be in registers.
500 * cp MUST be u_char *.
501 */
502#define GETCHAR(c, cp) { \
503        (c) = *(cp)++; \
504}
505#define PUTCHAR(c, cp) { \
506        *(cp)++ = (u_char) (c); \
507}
508
509#define INCPTR(n, cp)   ((cp) += (n))
510#define DECPTR(n, cp)   ((cp) -= (n))
511
512/*
513 * System dependent definitions for user-level 4.3BSD UNIX implementation.
514 */
515
516#define TIMEOUT(r, f, t)        ppptimeout((r), (f), (t))
517#define UNTIMEOUT(r, f) pppuntimeout((r), (f))
518
519#define BCOPY(s, d, l)          memcpy(d, s, l)
520#define BZERO(s, n)             memset(s, 0, n)
521
522#define PRINTMSG(m, l)          { info("Remote message: %0.*v", l, m); }
523
524/*
525 * MAKEHEADER - Add Header fields to a packet.
526 */
527#define MAKEHEADER(p, t) { \
528    PUTCHAR(PPP_ALLSTATIONS, p); \
529    PUTCHAR(PPP_UI, p); \
530    PUTSHORT(t, p); }
531
532/*
533 * Exit status values.
534 */
535#define EXIT_OK                 0
536#define EXIT_FATAL_ERROR        1
537#define EXIT_OPTION_ERROR       2
538#define EXIT_NOT_ROOT           3
539#define EXIT_NO_KERNEL_SUPPORT  4
540#define EXIT_USER_REQUEST       5
541#define EXIT_LOCK_FAILED        6
542#define EXIT_OPEN_FAILED        7
543#define EXIT_CONNECT_FAILED     8
544#define EXIT_PTYCMD_FAILED      9
545#define EXIT_NEGOTIATION_FAILED 10
546#define EXIT_PEER_AUTH_FAILED   11
547#define EXIT_IDLE_TIMEOUT       12
548#define EXIT_CONNECT_TIME       13
549#define EXIT_CALLBACK           14
550#define EXIT_PEER_DEAD          15
551#define EXIT_HANGUP             16
552#define EXIT_LOOPBACK           17
553#define EXIT_INIT_FAILED        18
554#define EXIT_AUTH_TOPEER_FAILED 19
555
556/*
557 * Debug macros.  Slightly useful for finding bugs in pppd, not particularly
558 * useful for finding out why your connection isn't being established.
559 */
560
561#ifdef DEBUGALL
562#define DEBUGMAIN       1
563#define DEBUGFSM        1
564#define DEBUGLCP        1
565#define DEBUGIPCP       1
566#define DEBUGIPV6CP     1
567#define DEBUGUPAP       1
568#define DEBUGCHAP       1
569#endif
570#define DEBUGMAIN       1
571#define DEBUGUPAP       1
572#define DEBUGCHAP       1
573
574
575#ifdef DEBUGMAIN
576#define MAINDEBUG(x)    if (debug) dbglog x
577#else
578#define MAINDEBUG(x)
579#endif
580
581#ifdef DEBUGSYS
582#define SYSDEBUG(x)     if (debug) dbglog x
583#else
584#define SYSDEBUG(x)
585#endif
586
587#ifdef DEBUGFSM
588#define FSMDEBUG(x)     if (debug) dbglog x
589#else
590#define FSMDEBUG(x)
591#endif
592
593#ifdef DEBUGLCP
594#define LCPDEBUG(x)     if (debug) dbglog x
595#else
596#define LCPDEBUG(x)
597#endif
598
599#ifdef DEBUGIPCP
600#define IPCPDEBUG(x)    if (debug) dbglog x
601#else
602#define IPCPDEBUG(x)
603#endif
604
605#ifdef DEBUGIPV6CP
606#define IPV6CPDEBUG(x)  if (debug) dbglog x
607#else
608#define IPV6CPDEBUG(x)
609#endif
610
611#ifdef DEBUGUPAP
612#define UPAPDEBUG(x)    if (debug) dbglog x
613#else
614#define UPAPDEBUG(x)
615#endif
616
617#ifdef DEBUGCHAP
618#define CHAPDEBUG(x)    if (debug) dbglog x
619#else
620#define CHAPDEBUG(x)
621#endif
622
623#ifdef DEBUGIPXCP
624#define IPXCPDEBUG(x)   if (debug) dbglog x
625#else
626#define IPXCPDEBUG(x)
627#endif
628
629#ifndef SIGTYPE
630#if defined(sun) || defined(SYSV) || defined(POSIX_SOURCE)
631#define SIGTYPE void
632#else
633#define SIGTYPE int
634#endif /* defined(sun) || defined(SYSV) || defined(POSIX_SOURCE) */
635#endif /* SIGTYPE */
636
637#ifndef MIN
638#define MIN(a, b)       ((a) < (b)? (a): (b))
639#endif
640#ifndef MAX
641#define MAX(a, b)       ((a) > (b)? (a): (b))
642#endif
643
644#endif /* __PPP_H__ */
Note: See TracBrowser for help on using the repository browser.