📄 pppd.h
字号:
*//* Procedures exported from main.c. */void set_ifunit __P((int)); /* set stuff that depends on ifunit */void detach __P((void)); /* Detach from controlling tty */void die __P((int)); /* Cleanup and exit */void quit __P((void)); /* like die(1) */void novm __P((char *)); /* Say we ran out of memory, and die */void timeout __P((void (*func)(void *), void *arg, int s, int us)); /* Call func(arg) after s.us seconds */void untimeout __P((void (*func)(void *), void *arg)); /* Cancel call to func(arg) */void record_child __P((int, char *, void (*) (void *), void *));int device_script __P((char *cmd, int in, int out, int dont_wait)); /* Run `cmd' with given stdin and stdout */pid_t run_program __P((char *prog, char **args, int must_exist, void (*done)(void *), void *arg)); /* Run program prog with args in child */void reopen_log __P((void)); /* (re)open the connection to syslog */void update_link_stats __P((int)); /* Get stats at link termination */void script_setenv __P((char *, char *, int)); /* set script env var */void script_unsetenv __P((char *)); /* unset script env var */void new_phase __P((int)); /* signal start of new phase */void add_notifier __P((struct notifier **, notify_func, void *));void remove_notifier __P((struct notifier **, notify_func, void *));void notify __P((struct notifier *, int));/* Procedures exported from tty.c. */void tty_init __P((void));/* Procedures exported from utils.c. */void log_packet __P((u_char *, int, char *, int)); /* Format a packet and log it with syslog */void print_string __P((char *, int, void (*) (void *, char *, ...), void *)); /* Format a string for output */int slprintf __P((char *, int, char *, ...)); /* sprintf++ */int vslprintf __P((char *, int, char *, va_list)); /* vsprintf++ */size_t strlcpy __P((char *, const char *, size_t)); /* safe strcpy */size_t strlcat __P((char *, const char *, size_t)); /* safe strncpy */void dbglog __P((char *, ...)); /* log a debug message */void info __P((char *, ...)); /* log an informational message */void notice __P((char *, ...)); /* log a notice-level message */void warn __P((char *, ...)); /* log a warning message */void error __P((char *, ...)); /* log an error message */void fatal __P((char *, ...)); /* log an error message and die(1) */void init_pr_log __P((char *, int)); /* initialize for using pr_log */void pr_log __P((void *, char *, ...)); /* printer fn, output to syslog */void end_pr_log __P((void)); /* finish up after using pr_log *//* Procedures exported from auth.c */void link_required __P((int)); /* we are starting to use the link */void link_terminated __P((int)); /* we are finished with the link */void link_down __P((int)); /* the LCP layer has left the Opened state */void link_established __P((int)); /* the link is up; authenticate now */void start_networks __P((void)); /* start all the network control protos */void np_up __P((int, int)); /* a network protocol has come up */void np_down __P((int, int)); /* a network protocol has gone down */void np_finished __P((int, int)); /* a network protocol no longer needs link */void auth_peer_fail __P((int, int)); /* peer failed to authenticate itself */void auth_peer_success __P((int, int, char *, int)); /* peer successfully authenticated itself */void auth_withpeer_fail __P((int, int)); /* we failed to authenticate ourselves */void auth_withpeer_success __P((int, int)); /* we successfully authenticated ourselves */void auth_check_options __P((void)); /* check authentication options supplied */void auth_reset __P((int)); /* check what secrets we have */int check_passwd __P((int, char *, int, char *, int, char **)); /* Check peer-supplied username/password */int get_secret __P((int, char *, char *, char *, int *, int)); /* get "secret" for chap */int auth_ip_addr __P((int, u_int32_t)); /* check if IP address is authorized */int bad_ip_adrs __P((u_int32_t)); /* check if IP address is unreasonable *//* Procedures exported from demand.c */void demand_conf __P((void)); /* config interface(s) for demand-dial */void demand_block __P((void)); /* set all NPs to queue up packets */void demand_unblock __P((void)); /* set all NPs to pass packets */void demand_discard __P((void)); /* set all NPs to discard packets */void demand_rexmit __P((int)); /* retransmit saved frames for an NP */int loop_chars __P((unsigned char *, int)); /* process chars from loopback */int loop_frame __P((unsigned char *, int)); /* should we bring link up? *//* Procedures exported from multilink.c */void mp_check_options __P((void)); /* Check multilink-related options */int mp_join_bundle __P((void)); /* join our link to an appropriate bundle */char *epdisc_to_str __P((struct epdisc *)); /* string from endpoint discrim. */int str_to_epdisc __P((struct epdisc *, char *)); /* endpt disc. from str *//* Procedures exported from sys-*.c */void sys_init __P((void)); /* Do system-dependent initialization */void sys_cleanup __P((void)); /* Restore system state before exiting */int sys_check_options __P((void)); /* Check options specified */void sys_close __P((void)); /* Clean up in a child before execing */int ppp_available __P((void)); /* Test whether ppp kernel support exists */int get_pty __P((int *, int *, char *, int)); /* Get pty master/slave */int open_ppp_loopback __P((void)); /* Open loopback for demand-dialling */int tty_establish_ppp __P((int)); /* Turn serial port into a ppp interface */void tty_disestablish_ppp __P((int)); /* Restore port to normal operation */void make_new_bundle __P((int, int, int, int)); /* Create new bundle */int bundle_attach __P((int)); /* Attach link to existing bundle */void cfg_bundle __P((int, int, int, int)); /* Configure existing bundle */void clean_check __P((void)); /* Check if line was 8-bit clean */void set_up_tty __P((int, int)); /* Set up port's speed, parameters, etc. */void restore_tty __P((int)); /* Restore port's original parameters */void setdtr __P((int, int)); /* Raise or lower port's DTR line */void output __P((int, u_char *, int)); /* Output a PPP packet */void wait_input __P((struct timeval *)); /* Wait for input, with timeout */void add_fd __P((int)); /* Add fd to set to wait for */void remove_fd __P((int)); /* Remove fd from set to wait for */int read_packet __P((u_char *)); /* Read PPP packet */int get_loop_output __P((void)); /* Read pkts from loopback */void tty_send_config __P((int, u_int32_t, int, int)); /* Configure i/f transmit parameters */void tty_set_xaccm __P((ext_accm)); /* Set extended transmit ACCM */void tty_recv_config __P((int, u_int32_t, int, int)); /* Configure i/f receive parameters */int ccp_test __P((int, u_char *, int, int)); /* Test support for compression scheme */void ccp_flags_set __P((int, int, int)); /* Set kernel CCP state */int ccp_fatal_error __P((int)); /* Test for fatal decomp error in kernel */int get_idle_time __P((int, struct ppp_idle *)); /* Find out how long link has been idle */int get_ppp_stats __P((int, struct pppd_stats *)); /* Return link statistics */void netif_set_mtu __P((int, int)); /* Set PPP interface MTU */int sifvjcomp __P((int, int, int, int)); /* Configure VJ TCP header compression */int sifup __P((int)); /* Configure i/f up for one protocol */int sifnpmode __P((int u, int proto, enum NPmode mode)); /* Set mode for handling packets for proto */int sifdown __P((int)); /* Configure i/f down for one protocol */int sifaddr __P((int, u_int32_t, u_int32_t, u_int32_t)); /* Configure IPv4 addresses for i/f */int cifaddr __P((int, u_int32_t, u_int32_t)); /* Reset i/f IP addresses */#ifdef INET6int sif6addr __P((int, eui64_t, eui64_t)); /* Configure IPv6 addresses for i/f */int cif6addr __P((int, eui64_t, eui64_t)); /* Remove an IPv6 address from i/f */#endifint sifdefaultroute __P((int, u_int32_t, u_int32_t)); /* Create default route through i/f */int cifdefaultroute __P((int, u_int32_t, u_int32_t)); /* Delete default route through i/f */int sifproxyarp __P((int, u_int32_t)); /* Add proxy ARP entry for peer */int cifproxyarp __P((int, u_int32_t)); /* Delete proxy ARP entry for peer */u_int32_t GetMask __P((u_int32_t)); /* Get appropriate netmask for address */int lock __P((char *)); /* Create lock file for device */int relock __P((int)); /* Rewrite lock file with new pid */void unlock __P((void)); /* Delete previously-created lock file */void logwtmp __P((const char *, const char *, const char *)); /* Write entry to wtmp file */int get_host_seed __P((void)); /* Get host-dependent random number seed */int have_route_to __P((u_int32_t)); /* Check if route to addr exists */#ifdef PPP_FILTERint set_filters __P((struct bpf_program *pass, struct bpf_program *active)); /* Set filter programs in kernel */#endif#ifdef IPX_CHANGEint sipxfaddr __P((int, unsigned long, unsigned char *));int cipxfaddr __P((int));#endifint get_if_hwaddr __P((u_char *addr, char *name));char *get_first_ethernet __P((void));/* Procedures exported from options.c */int parse_args __P((int argc, char **argv)); /* Parse options from arguments given */int options_from_file __P((char *filename, int must_exist, int check_prot, int privileged)); /* Parse options from an options file */int options_from_user __P((void)); /* Parse options from user's .ppprc */int options_for_tty __P((void)); /* Parse options from /etc/ppp/options.tty */int options_from_list __P((struct wordlist *, int privileged)); /* Parse options from a wordlist */int getword __P((FILE *f, char *word, int *newlinep, char *filename)); /* Read a word from a file */void option_error __P((char *fmt, ...)); /* Print an error message about an option */int int_option __P((char *, int *)); /* Simplified number_option for decimal ints */void add_options __P((option_t *)); /* Add extra options */void check_options __P((void)); /* check values after all options parsed */int override_value __P((const char *, int, const char *)); /* override value if permitted by priority */void print_options __P((void (*) __P((void *, char *, ...)), void *)); /* print out values of all options */int parse_dotted_ip __P((char *, u_int32_t *));/* * Hooks to enable plugins to change various things. */extern int (*new_phase_hook) __P((int));extern int (*idle_time_hook) __P((struct ppp_idle *));extern int (*holdoff_hook) __P((void));extern int (*pap_check_hook) __P((void));extern int (*pap_auth_hook) __P((char *user, char *passwd, char **msgp, struct wordlist **paddrs, struct wordlist **popts));extern void (*pap_logout_hook) __P((void));extern int (*pap_passwd_hook) __P((char *user, char *passwd));extern void (*ip_up_hook) __P((void));extern void (*ip_down_hook) __P((void));extern void (*ip_choose_hook) __P((u_int32_t *));/* * Inline versions of get/put char/short/long. * Pointer is advanced; we assume that both arguments * are lvalues and will already be in registers. * cp MUST be u_char *. */#define GETCHAR(c, cp) { \ (c) = *(cp)++; \}#define PUTCHAR(c, cp) { \ *(cp)++ = (u_char) (c); \}#define GETSHORT(s, cp) { \ (s) = *(cp)++ << 8; \ (s) |= *(cp)++; \}#define PUTSHORT(s, cp) { \ *(cp)++ = (u_char) ((s) >> 8); \ *(cp)++ = (u_char) (s); \}#define GETLONG(l, cp) { \ (l) = *(cp)++ << 8; \ (l) |= *(cp)++; (l) <<= 8; \ (l) |= *(cp)++; (l) <<= 8; \ (l) |= *(cp)++; \}#define PUTLONG(l, cp) { \ *(cp)++ = (u_char) ((l) >> 24); \ *(cp)++ = (u_char) ((l) >> 16); \ *(cp)++ = (u_char) ((l) >> 8); \ *(cp)++ = (u_char) (l); \}#define INCPTR(n, cp) ((cp) += (n))#define DECPTR(n, cp) ((cp) -= (n))/* * System dependent definitions for user-level 4.3BSD UNIX implementation. */#define TIMEOUT(r, f, t) timeout((r), (f), (t), 0)#define UNTIMEOUT(r, f) untimeout((r), (f))#define BCOPY(s, d, l) memcpy(d, s, l)#define BZERO(s, n) memset(s, 0, n)#define PRINTMSG(m, l) { info("Remote message: %0.*v", l, m); }/* * MAKEHEADER - Add Header fields to a packet. */#define MAKEHEADER(p, t) { \ PUTCHAR(PPP_ALLSTATIONS, p); \ PUTCHAR(PPP_UI, p); \ PUTSHORT(t, p); }/* * Exit status values. */#define EXIT_OK 0#define EXIT_FATAL_ERROR 1#define EXIT_OPTION_ERROR 2#define EXIT_NOT_ROOT 3#define EXIT_NO_KERNEL_SUPPORT 4#define EXIT_USER_REQUEST 5#define EXIT_LOCK_FAILED 6#define EXIT_OPEN_FAILED 7#define EXIT_CONNECT_FAILED 8#define EXIT_PTYCMD_FAILED 9#define EXIT_NEGOTIATION_FAILED 10#define EXIT_PEER_AUTH_FAILED 11#define EXIT_IDLE_TIMEOUT 12#define EXIT_CONNECT_TIME 13#define EXIT_CALLBACK 14#define EXIT_PEER_DEAD 15#define EXIT_HANGUP 16#define EXIT_LOOPBACK 17#define EXIT_INIT_FAILED 18#define EXIT_AUTH_TOPEER_FAILED 19/* * Debug macros. Slightly useful for finding bugs in pppd, not particularly * useful for finding out why your connection isn't being established. */#ifdef DEBUGALL#define DEBUGMAIN 1#define DEBUGFSM 1#define DEBUGLCP 1#define DEBUGIPCP 1#define DEBUGIPV6CP 1#define DEBUGUPAP 1#define DEBUGCHAP 1#endif#ifndef LOG_PPP /* we use LOG_LOCAL2 for syslog by default */#if defined(DEBUGMAIN) || defined(DEBUGFSM) || defined(DEBUGSYS) \ || defined(DEBUGLCP) || defined(DEBUGIPCP) || defined(DEBUGUPAP) \ || defined(DEBUGCHAP) || defined(DEBUG) || defined(DEBUGIPV6CP)#define LOG_PPP LOG_LOCAL2#else#define LOG_PPP LOG_DAEMON#endif#endif /* LOG_PPP */#ifdef DEBUGMAIN#define MAINDEBUG(x) if (debug) dbglog x#else#define MAINDEBUG(x)#endif#ifdef DEBUGSYS#define SYSDEBUG(x) if (debug) dbglog x#else#define SYSDEBUG(x)#endif#ifdef DEBUGFSM#define FSMDEBUG(x) if (debug) dbglog x#else#define FSMDEBUG(x)#endif#ifdef DEBUGLCP#define LCPDEBUG(x) if (debug) dbglog x#else#define LCPDEBUG(x)#endif#ifdef DEBUGIPCP#define IPCPDEBUG(x) if (debug) dbglog x#else#define IPCPDEBUG(x)#endif#ifdef DEBUGIPV6CP#define IPV6CPDEBUG(x) if (debug) dbglog x#else#define IPV6CPDEBUG(x)#endif#ifdef DEBUGUPAP#define UPAPDEBUG(x) if (debug) dbglog x#else#define UPAPDEBUG(x)#endif#ifdef DEBUGCHAP#define CHAPDEBUG(x) if (debug) dbglog x#else#define CHAPDEBUG(x)#endif#ifdef DEBUGIPXCP#define IPXCPDEBUG(x) if (debug) dbglog x#else#define IPXCPDEBUG(x)#endif#ifndef SIGTYPE#if defined(sun) || defined(SYSV) || defined(POSIX_SOURCE)#define SIGTYPE void#else#define SIGTYPE int#endif /* defined(sun) || defined(SYSV) || defined(POSIX_SOURCE) */#endif /* SIGTYPE */#ifndef MIN#define MIN(a, b) ((a) < (b)? (a): (b))#endif#ifndef MAX#define MAX(a, b) ((a) > (b)? (a): (b))#endif#endif /* __PPP_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -