2 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
4 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
6 * Redistribution and use in source and binary forms are permitted
7 * provided that the above copyright notice and this paragraph are
8 * duplicated in all such forms and that any documentation,
9 * advertising materials, and other materials related to such
10 * distribution and use acknowledge that the software was developed
11 * by the Internet Initiative Japan. The name of the
12 * IIJ may not be used to endorse or promote products derived
13 * from this software without specific prior written permission.
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23 /* Check the following definitions for your machine environment */
25 # define MODEM_LIST "/dev/cuaa1\0/dev/cuaa0" /* name of tty device */
28 # define MODEM_LIST "/dev/cua01\0/dev/cua00" /* name of tty device */
30 # define MODEM_LIST "/dev/tty01\0/dev/tty00" /* name of tty device */
35 #define _PATH_PPP "/etc/ppp"
37 #define TUN_NAME "tun"
38 #define TUN_PREFIX (_PATH_DEV TUN_NAME) /* /dev/tun */
40 #define MODEM_SPEED B38400 /* tty speed */
41 #define SERVER_PORT 3000 /* Base server port no. */
42 #define MODEM_CTSRTS 1 /* Default (true): use CTS/RTS signals */
43 #define RECONNECT_TIMEOUT 3 /* Default timer for carrier loss */
44 #define DIAL_TIMEOUT 30 /* Default and Max random time to redial */
45 #define DIAL_NEXT_TIMEOUT 3 /* Default Hold time to next number redial */
46 #define SCRIPT_LEN 512 /* Size of login/dial/hangup scripts */
47 #define LINE_LEN SCRIPT_LEN /* Size of lines */
48 #define DEVICE_LEN SCRIPT_LEN /* Size of individual devices */
49 #define AUTHLEN 100 /* Size of authname/authkey */
50 #define CHAPDIGESTLEN 100 /* Maximum chap digest */
51 #define CHAPCHALLENGELEN 48 /* Maximum chap challenge */
52 #define MAXARGS 40 /* How many args per config line */
53 #define NCP_IDLE_TIMEOUT 180 /* Drop all links */
54 #define CHOKED_TIMEOUT 120 /* Delete queued packets w/ blocked tun */
56 #define MIN_LQRPERIOD 2 /* Minimum LQR frequency */
57 #define DEF_LQRPERIOD 30 /* Default LQR frequency */
58 #define MIN_FSMRETRY 3 /* Minimum FSM retry frequency */
59 #define DEF_FSMRETRY 3 /* FSM retry frequency */
60 #define DEF_FSMTRIES 5 /* Default max retries */
61 #define DEF_FSMAUTHTRIES 3 /* Default max auth retries */
63 #define CONFFILE "ppp.conf"
64 #define LINKUPFILE "ppp.linkup"
65 #define LINKDOWNFILE "ppp.linkdown"
66 #define SECRETFILE "ppp.secret"
83 /* physical::type values (OR'd in bundle::phys_type) */
85 #define PHYS_INTERACTIVE 1 /* Manual link */
86 #define PHYS_AUTO 2 /* Dial-on-demand link */
87 #define PHYS_DIRECT 4 /* Incoming link, deleted when closed */
88 #define PHYS_DEDICATED 8 /* Dedicated link */
89 #define PHYS_DDIAL 16 /* Dial immediately, stay connected */
90 #define PHYS_BACKGROUND 32 /* Dial immediately, deleted when closed */
91 #define PHYS_FOREGROUND 64 /* Pseudo mode, same as background */
94 /* flags passed to findblank() and MakeArgs() */
95 #define PARSE_NORMAL 0
96 #define PARSE_REDUCE 1
97 #define PARSE_NOHASH 2
99 #define ROUNDUP(x) ((x) ? (1 + (((x) - 1) | (sizeof(long) - 1))) : sizeof(long))
101 extern void randinit(void);
102 extern ssize_t fullread(int, void *, size_t);
103 extern const char *mode2Nam(int);
104 extern int Nam2mode(const char *);
105 extern struct in_addr GetIpAddr(const char *);
106 extern int SpeedToInt(speed_t);
107 extern speed_t IntToSpeed(int);
108 extern char *findblank(char *, int);
109 extern int MakeArgs(char *, char **, int, int);
110 extern const char *NumStr(long, char *, size_t);
111 extern const char *HexStr(long, char *, size_t);