28 #include <sys/param.h> 29 #include <sys/types.h> 31 #include <net/ppp_defs.h> 32 #include <rtems/rtemsdialer.h> 40 #define __V(x) (va_alist) va_dcl 54 #define MAXWORDLEN 1024 56 #define MAXNAMELEN 256 57 #define MAXSECRETLEN 256 84 #define OPT_VALUE 0xffL 85 #define OPT_HEX 0x100L 86 #define OPT_NOARG 0x200L 88 #define OPT_INC 0x800L 89 #define OPT_PRIV 0x1000L 90 #define OPT_STATIC 0x2000L 91 #define OPT_LLIMIT 0x4000L 92 #define OPT_ULIMIT 0x8000L 93 #define OPT_LIMITS (OPT_LLIMIT|OPT_ULIMIT) 94 #define OPT_ZEROOK 0x10000L 95 #define OPT_NOINCR 0x20000L 96 #define OPT_ZEROINF 0x40000L 97 #define OPT_A2INFO 0x100000L 98 #define OPT_A2COPY 0x200000L 99 #define OPT_ENABLE 0x400000L 100 #define OPT_PRIVFIX 0x800000L 101 #define OPT_PREPASS 0x1000000L 102 #define OPT_INITONLY 0x2000000L 103 #define OPT_DEVEQUIV 0x4000000L 104 #define OPT_DEVNAM (OPT_PREPASS | OPT_INITONLY | OPT_DEVEQUIV) 106 #define OPT_VAL(x) ((x) & OPT_VALUE) 109 #define GIDSET_TYPE gid_t 126 unsigned int bytes_in;
127 unsigned int bytes_out;
140 extern int pppd_kill_link;
142 extern int pppifunit;
143 extern char ifname[];
144 extern int pppd_ttyfd;
145 extern char hostname[];
146 extern u_char outpacket_buf[];
147 extern int pppd_phase;
148 extern int baud_rate;
149 extern int redirect_stderr;
150 extern char peer_authname[];
151 extern int privileged;
152 extern int need_holdoff;
153 extern char **script_env;
155 extern GIDSET_TYPE
groups[NGROUPS_MAX];
158 extern int using_pty;
159 extern int log_to_fd;
160 extern char *no_ppp_msg;
161 extern volatile int pppd_status;
162 extern int devnam_fixed;
163 extern int unsuccess;
164 extern int do_callback;
165 extern int doing_callback;
166 extern dialerfp pppd_dialer;
169 #define CALLBACK_DIALIN 1 170 #define CALLBACK_DIALOUT 2 177 extern int kdebugflag;
178 extern int default_device;
179 extern char devnam[MAXPATHLEN];
183 extern uint32_t netmask;
184 extern bool lockflag;
185 extern bool nodetach;
186 extern bool updetach;
187 extern char *initializer;
188 extern char *connect_script;
189 extern char *disconnect_script;
190 extern char *welcomer;
191 extern char *ptycommand;
192 extern int maxconnect;
193 extern char user[MAXNAMELEN];
194 extern char passwd[MAXSECRETLEN];
195 extern bool auth_required;
197 extern bool uselogin;
198 extern char our_name[MAXNAMELEN];
199 extern char remote_name[MAXNAMELEN];
200 extern bool explicit_remote;
202 extern char *ipparam;
203 extern bool cryptpap;
204 extern int idle_time_limit;
206 extern bool holdoff_specified;
208 extern char *record_file;
209 extern bool sync_serial;
211 extern char linkname[MAXPATHLEN];
212 extern bool tune_kernel;
213 extern int connect_delay;
216 extern struct bpf_program pass_filter;
217 extern struct bpf_program active_filter;
221 extern bool ms_lanman;
225 extern char *current_option;
226 extern int privileged_option;
227 extern char *option_source;
233 #define PHASE_INITIALIZE 1 234 #define PHASE_SERIALCONN 2 235 #define PHASE_DORMANT 3 236 #define PHASE_ESTABLISH 4 237 #define PHASE_AUTHENTICATE 5 238 #define PHASE_CALLBACK 6 239 #define PHASE_NETWORK 7 240 #define PHASE_RUNNING 8 241 #define PHASE_TERMINATE 9 242 #define PHASE_DISCONNECT 10 243 #define PHASE_HOLDOFF 11 252 void (*init)(
int unit);
254 void (*input)(
int unit, u_char *pkt,
int len);
256 void (*protrej)(
int unit);
258 void (*lowerup)(
int unit);
260 void (*lowerdown)(
int unit);
262 void (*open)(
int unit);
264 void (*close)(
int unit,
char *reason);
266 int (*printpkt)(u_char *pkt,
int len,
267 void (*printer)(
void *,
char *, ...),
270 void (*datainput)(
int unit, u_char *pkt,
int len);
276 void (*check_options)(void);
278 int (*demand_conf)(
int unit);
280 int (*active_pkt)(u_char *pkt,
int len);
284 extern struct protent *protocols[];
294 void ppptimeout(
void (*func)(
void *),
void *arg,
int t);
296 void pppuntimeout(
void (*func)(
void *),
void *arg);
298 void update_link_stats(
int);
302 void log_packet(u_char *,
int,
char *,
int);
304 void print_string(
void *,
int,
void (*) (
void *,
char *, ...),
306 int slprintf(
char *,
int,
char *, ...);
307 int vslprintf(
char *,
int,
char *, va_list);
308 size_t strlcpy(
char *,
const char *,
size_t);
309 size_t strlcat(
char *,
const char *,
size_t);
310 void pppd_dbglog(
char *, ...);
311 void pppd_info(
char *, ...);
312 void pppd_notice(
char *, ...);
313 void pppd_warn(
char *, ...);
314 void pppd_error(
char *, ...);
315 void pppd_fatal(
char *, ...);
317 #define dbglog pppd_dbglog 318 #define info pppd_info 319 #define notice pppd_notice 320 #define warn pppd_warn 321 #define error pppd_error 322 #define fatal pppd_fatal 325 void link_required(
int);
326 void link_terminated(
int);
328 void link_established(
int);
329 void start_networks(
void);
330 void np_up(
int,
int);
331 void np_down(
int,
int);
332 void np_finished(
int,
int);
333 void auth_peer_fail(
int,
int);
335 void auth_peer_success(
int,
int,
char *,
int);
337 void auth_withpeer_fail(
int,
int);
339 void auth_withpeer_success(
int,
int);
341 int auth_check_options(
void);
343 void auth_reset(
int);
344 int check_passwd(
int,
char *,
int,
char *,
int,
char **);
346 int get_secret(
int,
char *,
char *,
unsigned char *,
int *,
int);
348 int auth_ip_addr(
int, uint32_t);
350 int bad_ip_adrs(uint32_t);
354 void demand_conf(
void);
355 void demand_block(
void);
356 void demand_unblock(
void);
357 void demand_discard(
void);
358 void demand_rexmit(
int);
359 int loop_chars(
unsigned char *,
int);
360 int loop_frame(
unsigned char *,
int);
364 void sys_cleanup(
void);
365 int sys_check_options(
void);
366 void sys_close(
void);
367 int ppp_available(
void);
368 int open_ppp_loopback(
void);
369 int establish_ppp(
int);
370 void restore_loop(
void);
371 void disestablish_ppp(
int);
372 void clean_check(
void);
373 void set_up_tty(
int,
int);
374 void restore_tty(
int);
375 void setdtr(
int,
int);
376 void output(
int, u_char *,
int);
377 void wait_input(
struct timeval *);
379 void ppp_delay(
void);
380 int read_packet(u_char *);
381 int get_loop_output(
void);
382 void ppp_send_config(
int,
int, uint32_t,
int,
int);
384 void ppp_set_xaccm(
int, ext_accm);
386 void ppp_recv_config(
int,
int, uint32_t,
int,
int);
388 int ccp_test(
int, u_char *,
int,
int);
390 void ccp_flags_set(
int,
int,
int);
392 int ccp_fatal_error(
int);
393 int get_idle_time(
int,
struct ppp_idle *);
397 int sifvjcomp(
int,
int,
int,
int);
400 int sifnpmode(
int u,
int proto,
enum NPmode mode);
403 int sifaddr(
int, uint32_t, uint32_t, uint32_t);
405 int cifaddr(
int, uint32_t, uint32_t);
408 int sif6addr(
int, eui64_t, eui64_t);
410 int cif6addr(
int, eui64_t, eui64_t);
413 int sifdefaultroute(
int, uint32_t, uint32_t);
415 int cifdefaultroute(
int, uint32_t, uint32_t);
417 int sifproxyarp(
int, uint32_t);
419 int cifproxyarp(
int, uint32_t);
421 uint32_t GetMask(uint32_t);
425 void logwtmp(
const char *,
const char *,
const char *);
427 int get_host_seed(
void);
428 int have_route_to(uint32_t);
430 int set_filters(
struct bpf_program *pass,
struct bpf_program *active);
434 int sipxfaddr(
int,
unsigned long,
unsigned char *);
439 int parse_args(
int argc,
char **argv);
441 int options_from_file(
char *filename,
int must_exist,
int check_prot,
444 int options_from_user(
void);
445 int options_for_tty(
void);
446 int options_from_list(
struct wordlist *,
int privileged);
448 int getword(FILE *f,
char *word,
int *newlinep,
char *filename);
450 void option_error(
char *fmt, ...);
452 int int_option(
char *,
int *);
477 extern int (*new_phase_hook)(int);
478 extern int (*idle_time_hook)(
struct ppp_idle *);
479 extern int (*holdoff_hook)(void);
480 extern int (*pap_check_hook)(void);
481 extern int (*pap_auth_hook)(
char *user,
char *passwd
484 extern void (*pap_logout_hook)(void);
485 extern int (*pap_passwd_hook)(
char *user,
char *passwd);
486 extern void (*ip_up_hook)(void);
487 extern void (*ip_down_hook)(void);
488 extern void (*auth_linkup_hook)(void);
489 extern void (*auth_linkdown_hook)(void);
497 #define GETCHAR(c, cp) { \ 500 #define PUTCHAR(c, cp) { \ 501 *(cp)++ = (u_char) (c); \ 505 #define GETSHORT(s, cp) { \ 506 (s) = *(cp)++ << 8; \ 509 #define PUTSHORT(s, cp) { \ 510 *(cp)++ = (u_char) ((s) >> 8); \ 511 *(cp)++ = (u_char) (s); \ 514 #define GETLONG(l, cp) { \ 515 (l) = *(cp)++ << 8; \ 516 (l) |= *(cp)++; (l) <<= 8; \ 517 (l) |= *(cp)++; (l) <<= 8; \ 520 #define PUTLONG(l, cp) { \ 521 *(cp)++ = (u_char) ((l) >> 24); \ 522 *(cp)++ = (u_char) ((l) >> 16); \ 523 *(cp)++ = (u_char) ((l) >> 8); \ 524 *(cp)++ = (u_char) (l); \ 527 #define INCPTR(n, cp) ((cp) += (n)) 528 #define DECPTR(n, cp) ((cp) -= (n)) 534 #define TIMEOUT(r, f, t) ppptimeout((r), (f), (t)) 535 #define UNTIMEOUT(r, f) pppuntimeout((r), (f)) 537 #define BCOPY(s, d, l) memcpy(d, s, l) 538 #define BZERO(s, n) memset(s, 0, n) 540 #define PRINTMSG(m, l) { info("Remote message: %0.*v", l, m); } 545 #define MAKEHEADER(p, t) { \ 546 PUTCHAR(PPP_ALLSTATIONS, p); \ 547 PUTCHAR(PPP_UI, p); \ 554 #define EXIT_FATAL_ERROR 1 555 #define EXIT_OPTION_ERROR 2 556 #define EXIT_NOT_ROOT 3 557 #define EXIT_NO_KERNEL_SUPPORT 4 558 #define EXIT_USER_REQUEST 5 559 #define EXIT_LOCK_FAILED 6 560 #define EXIT_OPEN_FAILED 7 561 #define EXIT_CONNECT_FAILED 8 562 #define EXIT_PTYCMD_FAILED 9 563 #define EXIT_NEGOTIATION_FAILED 10 564 #define EXIT_PEER_AUTH_FAILED 11 565 #define EXIT_IDLE_TIMEOUT 12 566 #define EXIT_CONNECT_TIME 13 567 #define EXIT_CALLBACK 14 568 #define EXIT_PEER_DEAD 15 569 #define EXIT_HANGUP 16 570 #define EXIT_LOOPBACK 17 571 #define EXIT_INIT_FAILED 18 572 #define EXIT_AUTH_TOPEER_FAILED 19 584 #define DEBUGIPV6CP 1 594 #define MAINDEBUG(x) if (debug) dbglog x 600 #define SYSDEBUG(x) if (debug) dbglog x 606 #define FSMDEBUG(x) if (debug) dbglog x 612 #define LCPDEBUG(x) if (debug) dbglog x 618 #define IPCPDEBUG(x) if (debug) dbglog x 624 #define IPV6CPDEBUG(x) if (debug) dbglog x 626 #define IPV6CPDEBUG(x) 630 #define UPAPDEBUG(x) if (debug) dbglog x 636 #define CHAPDEBUG(x) if (debug) dbglog x 642 #define IPXCPDEBUG(x) if (debug) dbglog x 644 #define IPXCPDEBUG(x) 648 #if defined(sun) || defined(SYSV) || defined(POSIX_SOURCE)
Definition: mount_prot.h:53