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