2 * Copyright (c) 1996 - 2001 Brian Somers <brian@Awfulhak.org>
3 * based on work by Toshiharu OHNO <tony-o@iij.ad.jp>
4 * Internet Initiative Japan, Inc (IIJ)
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * $FreeBSD: src/usr.sbin/ppp/defs.h,v 1.52.2.11 2002/09/01 02:12:26 brian Exp $
29 * $DragonFly: src/usr.sbin/ppp/defs.h,v 1.3 2004/02/03 07:11:47 dillon Exp $
32 /* Check the following definitions for your machine environment */
34 # define MODEM_LIST "/dev/cuaa1\0/dev/cuaa0" /* name of tty device */
37 # define MODEM_LIST "/dev/cua01\0/dev/cua00" /* name of tty device */
39 # define MODEM_LIST "/dev/tty01\0/dev/tty00" /* name of tty device */
45 #define PPP_CONFDIR "/etc/ppp"
48 #define TUN_NAME "tun"
49 #define TUN_PREFIX (_PATH_DEV TUN_NAME) /* /dev/tun */
51 #define MODEM_SPEED B38400 /* tty speed */
52 #define SERVER_PORT 3000 /* Base server port no. */
53 #define MODEM_CTSRTS 1 /* Default (true): use CTS/RTS signals */
54 #define RECONNECT_TIMEOUT 3 /* Default timer for carrier loss */
55 #define DIAL_TIMEOUT 30 /* Default and Max random time to redial */
56 #define DIAL_NEXT_TIMEOUT 3 /* Default Hold time to next number redial */
57 #define SCRIPT_LEN 512 /* Size of login/dial/hangup scripts */
58 #define LINE_LEN SCRIPT_LEN /* Size of lines */
59 #define DEVICE_LEN SCRIPT_LEN /* Size of individual devices */
60 #define AUTHLEN 100 /* Size of authname/authkey */
61 #define CHAPDIGESTLEN 100 /* Maximum chap digest */
62 #define CHAPCHALLENGELEN 48 /* Maximum chap challenge */
63 #define CHAPAUTHRESPONSELEN 48 /* Maximum chap authresponse (chap81) */
64 #define MAXARGS 40 /* How many args per config line */
65 #define NCP_IDLE_TIMEOUT 180 /* Drop all links */
66 #define CHOKED_TIMEOUT 120 /* Delete queued packets w/ blocked tun */
68 #define MIN_LQRPERIOD 1 /* Minimum LQR frequency */
69 #define DEF_LQRPERIOD 30 /* Default LQR frequency */
70 #define MIN_FSMRETRY 1 /* Minimum FSM retry frequency */
71 #define DEF_FSMRETRY 3 /* FSM retry frequency */
72 #define DEF_FSMTRIES 5 /* Default max retries */
73 #define DEF_FSMAUTHTRIES 3 /* Default max auth retries */
74 #define DEF_IFQUEUE 30 /* Default interface queue size */
76 #define CONFFILE "ppp.conf"
77 #define LINKUPFILE "ppp.linkup"
78 #define LINKDOWNFILE "ppp.linkdown"
79 #define SECRETFILE "ppp.secret"
95 /* return values for -background mode, not really exits */
97 #define EX_RECONNECT 14
99 /* physical::type values (OR'd in bundle::phys_type) */
101 #define PHYS_INTERACTIVE 1 /* Manual link */
102 #define PHYS_AUTO 2 /* Dial-on-demand link */
103 #define PHYS_DIRECT 4 /* Incoming link, deleted when closed */
104 #define PHYS_DEDICATED 8 /* Dedicated link */
105 #define PHYS_DDIAL 16 /* Dial immediately, stay connected */
106 #define PHYS_BACKGROUND 32 /* Dial immediately, deleted when closed */
107 #define PHYS_FOREGROUND 64 /* Pseudo mode, same as background */
110 /* flags passed to findblank() and MakeArgs() */
111 #define PARSE_NORMAL 0
112 #define PARSE_REDUCE 1
113 #define PARSE_NOHASH 2
115 /* flags passed to loadmodules */
116 #define LOAD_QUIETLY 1
117 #define LOAD_VERBOSLY 2
119 #define ROUNDUP(x) ((x) ? (1 + (((x) - 1) | (sizeof(long) - 1))) : sizeof(long))
121 #if defined(__NetBSD__)
122 extern void randinit(void);
124 #define random arc4random
128 extern ssize_t fullread(int, void *, size_t);
129 extern const char *mode2Nam(int);
130 extern int Nam2mode(const char *);
131 extern struct in_addr GetIpAddr(const char *);
132 extern int SpeedToInt(speed_t);
133 extern speed_t IntToSpeed(int);
134 extern char *findblank(char *, int);
135 extern int MakeArgs(char *, char **, int, int);
136 extern const char *NumStr(long, char *, size_t);
137 extern const char *HexStr(long, char *, size_t);
138 extern const char *ex_desc(int);
139 extern void SetTitle(const char *);
140 extern fd_set *mkfdset(void);
141 extern void zerofdset(fd_set *);
142 extern void Concatinate(char *, size_t, int, const char *const *);
143 extern int loadmodules(int, const char *, ...);