2 * pppd.h - PPP daemon global declarations.
4 * Copyright (c) 1989 Carnegie Mellon University.
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.
19 * $Id: pppd.h,v 1.1 1993/11/11 03:54:25 paulus Exp $
30 #include <sys/param.h> /* for MAXPATHLEN and BSD4_4, if defined */
32 #define NPPP 1 /* One PPP interface supported (per process) */
37 #define MAXWORDLEN 1024 /* max length of word in file (incl null) */
38 #define MAXARGS 1 /* max # args to a command */
39 #define MAXNAMELEN 256 /* max length of hostname or name for auth */
40 #define MAXSECRETLEN 256 /* max length of password or secret */
42 extern int debug; /* Debug flag */
43 extern int ifunit; /* Interface unit number */
44 extern char ifname[]; /* Interface name */
45 extern int fd; /* Device file descriptor */
46 extern int s; /* socket descriptor */
47 extern char hostname[]; /* hostname */
48 extern u_char outpacket_buf[]; /* buffer for outgoing packets */
50 void quit __ARGS((void)); /* Cleanup and exit */
51 void timeout __ARGS((void (*)(), caddr_t, int));
52 /* Look-alike of kernel's timeout() */
53 void untimeout __ARGS((void (*)(), caddr_t));
54 /* Look-alike of kernel's untimeout() */
55 void output __ARGS((int, u_char *, int));
56 /* Output a PPP packet */
57 void demuxprotrej __ARGS((int, int));
58 /* Demultiplex a Protocol-Reject */
59 int check_passwd __ARGS((int, char *, int, char *, int, char **, int *));
60 /* Check peer-supplied username/password */
61 int get_secret __ARGS((int, char *, char *, char *, int *, int));
62 /* get "secret" for chap */
63 u_long GetMask __ARGS((u_long)); /* get netmask for address */
67 * Inline versions of get/put char/short/long.
68 * Pointer is advanced; we assume that both arguments
69 * are lvalues and will already be in registers.
70 * cp MUST be u_char *.
72 #define GETCHAR(c, cp) { \
75 #define PUTCHAR(c, cp) { \
80 #define GETSHORT(s, cp) { \
84 #define PUTSHORT(s, cp) { \
89 #define GETLONG(l, cp) { \
91 (l) |= *(cp)++; (l) <<= 8; \
92 (l) |= *(cp)++; (l) <<= 8; \
95 #define PUTLONG(l, cp) { \
96 *(cp)++ = (l) >> 24; \
97 *(cp)++ = (l) >> 16; \
102 #define INCPTR(n, cp) ((cp) += (n))
103 #define DECPTR(n, cp) ((cp) -= (n))
106 * System dependent definitions for user-level 4.3BSD UNIX implementation.
109 #define DEMUXPROTREJ(u, p) demuxprotrej(u, p)
111 #define TIMEOUT(r, f, t) timeout((r), (f), (t))
112 #define UNTIMEOUT(r, f) untimeout((r), (f))
114 #define BCOPY(s, d, l) memcpy(d, s, l)
115 #define BZERO(s, n) memset(s, 0, n)
116 #define EXIT(u) quit()
118 #define PRINTMSG(m, l) { m[l] = '\0'; syslog(LOG_INFO, "Remote message: %s", m); }
121 * MAKEHEADER - Add Header fields to a packet.
123 #define MAKEHEADER(p, t) { \
124 PUTCHAR(ALLSTATIONS, p); \
138 #ifndef LOG_PPP /* we use LOG_LOCAL2 for syslog by default */
139 #if defined(DEBUGMAIN) || defined(DEBUGFSM) || defined(DEBUG) \
140 || defined(DEBUGLCP) || defined(DEBUGIPCP) || defined(DEBUGUPAP) \
141 || defined(DEBUGCHAP)
142 #define LOG_PPP LOG_LOCAL2
144 #define LOG_PPP LOG_DAEMON
149 #define MAINDEBUG(x) if (debug) syslog x
155 #define FSMDEBUG(x) if (debug) syslog x
161 #define LCPDEBUG(x) if (debug) syslog x
167 #define IPCPDEBUG(x) if (debug) syslog x
173 #define UPAPDEBUG(x) if (debug) syslog x
179 #define CHAPDEBUG(x) if (debug) syslog x
185 #if defined(sun) || defined(SYSV) || defined(POSIX_SOURCE)
189 #endif /* defined(sun) || defined(SYSV) || defined(POSIX_SOURCE) */
193 #define MIN(a, b) ((a) < (b)? (a): (b))
196 #define MAX(a, b) ((a) > (b)? (a): (b))
199 #endif /* __PPP_H__ */