📄 pppd.h
字号:
extern bool holdoff_specified; /* true if user gave a holdoff value */extern bool notty; /* Stdin/out is not a tty */extern char *pty_socket; /* Socket to connect to pty */extern char *record_file; /* File to record chars sent/received */extern bool sync_serial; /* Device is synchronous serial device */extern int maxfail; /* Max # of unsuccessful connection attempts */extern char linkname[MAXPATHLEN]; /* logical name for link */extern bool tune_kernel; /* May alter kernel settings as necessary */extern int connect_delay; /* Time to delay after connect script */extern int max_data_rate; /* max bytes/sec through charshunt */extern int req_unit; /* interface unit number to use */extern bool multilink; /* enable multilink operation */extern bool noendpoint; /* don't send or accept endpt. discrim. */extern char *bundle_name; /* bundle name for multilink */extern bool dump_options; /* print out option values */extern bool dryrun; /* check everything, print options, exit */extern int child_wait; /* # seconds to wait for children at end */#ifdef MAXOCTETSextern unsigned int maxoctets; /* Maximum octetes per session (in bytes) */extern int maxoctets_dir; /* Direction : 0 - in+out (default) 1 - in 2 - out 3 - max(in,out) */extern int maxoctets_timeout; /* Timeout for check of octets limit */#define PPP_OCTETS_DIRECTION_SUM 0#define PPP_OCTETS_DIRECTION_IN 1#define PPP_OCTETS_DIRECTION_OUT 2#define PPP_OCTETS_DIRECTION_MAXOVERAL 3/* same as previos, but little different on RADIUS side */#define PPP_OCTETS_DIRECTION_MAXSESSION 4 #endif#ifdef PPP_FILTERextern struct bpf_program pass_filter; /* Filter for pkts to pass */extern struct bpf_program active_filter; /* Filter for link-active pkts */#endif#ifdef MSLANMANextern bool ms_lanman; /* Use LanMan password instead of NT */ /* Has meaning only with MS-CHAP challenges */#endif/* Values for auth_pending, auth_done */#define PAP_WITHPEER 0x1#define PAP_PEER 0x2#define CHAP_WITHPEER 0x4#define CHAP_PEER 0x8#define EAP_WITHPEER 0x10#define EAP_PEER 0x20/* Values for auth_done only */#define CHAP_MD5_WITHPEER 0x40#define CHAP_MD5_PEER 0x80#define CHAP_MS_SHIFT 8 /* LSB position for MS auths */#define CHAP_MS_WITHPEER 0x100#define CHAP_MS_PEER 0x200#define CHAP_MS2_WITHPEER 0x400#define CHAP_MS2_PEER 0x800extern char *current_option; /* the name of the option being parsed */extern int privileged_option; /* set iff the current option came from root */extern char *option_source; /* string saying where the option came from */extern int option_priority; /* priority of current options *//* * Values for phase. */#define PHASE_DEAD 0#define PHASE_INITIALIZE 1#define PHASE_SERIALCONN 2#define PHASE_DORMANT 3#define PHASE_ESTABLISH 4#define PHASE_AUTHENTICATE 5#define PHASE_CALLBACK 6#define PHASE_NETWORK 7#define PHASE_RUNNING 8#define PHASE_TERMINATE 9#define PHASE_DISCONNECT 10#define PHASE_HOLDOFF 11#define PHASE_MASTER 12/* * The following struct gives the addresses of procedures to call * for a particular protocol. */struct protent { u_short protocol; /* PPP protocol number */ /* Initialization procedure */ void (*init) __P((int unit)); /* Process a received packet */ void (*input) __P((int unit, u_char *pkt, int len)); /* Process a received protocol-reject */ void (*protrej) __P((int unit)); /* Lower layer has come up */ void (*lowerup) __P((int unit)); /* Lower layer has gone down */ void (*lowerdown) __P((int unit)); /* Open the protocol */ void (*open) __P((int unit)); /* Close the protocol */ void (*close) __P((int unit, char *reason)); /* Print a packet in readable form */ int (*printpkt) __P((u_char *pkt, int len, void (*printer) __P((void *, char *, ...)), void *arg)); /* Process a received data packet */ void (*datainput) __P((int unit, u_char *pkt, int len)); bool enabled_flag; /* 0 iff protocol is disabled */ char *name; /* Text name of protocol */ char *data_name; /* Text name of corresponding data protocol */ option_t *options; /* List of command-line options */ /* Check requested options, assign defaults */ void (*check_options) __P((void)); /* Configure interface for demand-dial */ int (*demand_conf) __P((int unit)); /* Say whether to bring up link for this pkt */ int (*active_pkt) __P((u_char *pkt, int len));};/* Table of pointers to supported protocols */extern struct protent *protocols[];/* * This struct contains pointers to a set of procedures for * doing operations on a "channel". A channel provides a way * to send and receive PPP packets - the canonical example is * a serial port device in PPP line discipline (or equivalently * with PPP STREAMS modules pushed onto it). */struct channel { /* set of options for this channel */ option_t *options; /* find and process a per-channel options file */ void (*process_extra_options) __P((void)); /* check all the options that have been given */ void (*check_options) __P((void)); /* get the channel ready to do PPP, return a file descriptor */ int (*connect) __P((void)); /* we're finished with the channel */ void (*disconnect) __P((void)); /* put the channel into PPP `mode' */ int (*establish_ppp) __P((int)); /* take the channel out of PPP `mode', restore loopback if demand */ void (*disestablish_ppp) __P((int)); /* set the transmit-side PPP parameters of the channel */ void (*send_config) __P((int, u_int32_t, int, int)); /* set the receive-side PPP parameters of the channel */ void (*recv_config) __P((int, u_int32_t, int, int)); /* cleanup on error or normal exit */ void (*cleanup) __P((void)); /* close the device, called in children after fork */ void (*close) __P((void));};extern struct channel *the_channel;/* * Prototypes. *//* 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 *));pid_t safe_fork __P((int, int, int)); /* Fork & close stuff in child */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, int wait)); /* Run program prog with args in child */void reopen_log __P((void)); /* (re)open the connection to syslog */void print_link_stats __P((void)); /* Print stats, if available */void reset_link_stats __P((int)); /* Reset (init) stats when link goes up */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));int ppp_send_config __P((int, int, u_int32_t, int, int));int ppp_recv_config __P((int, int, u_int32_t, int, int));const char *protocol_name __P((int));void remove_pidfiles __P((void));void lock_db __P((void));void unlock_db __P((void));/* 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 */void dump_packet __P((const char *, u_char *, int)); /* dump packet to debug log if interesting */ssize_t complete_read __P((int, void *, size_t)); /* read a complete buffer *//* Procedures exported from auth.c */void link_required __P((int)); /* we are starting to use the link */void start_link __P((int)); /* bring the link up now */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 upper_layers_down __P((int));/* take all NCPs down */void link_established __P((int)); /* the link is up; authenticate now */void start_networks __P((int)); /* start all the network control protos */void continue_networks __P((int)); /* start network [ip, etc] 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, 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, 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 get_srp_secret __P((int unit, char *client, char *server, char *secret, int am_server));int auth_ip_addr __P((int, u_int32_t)); /* check if IP address is authorized */int auth_number __P((void)); /* check if remote number 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 */#ifdef HAVE_MULTILINKvoid mp_check_options __P((void)); /* Check multilink-related options */int mp_join_bundle __P((void)); /* join our link to an appropriate bundle */void mp_exit_bundle __P((void)); /* have disconnected our link from bundle */void mp_bundle_terminated __P((void));char *epdisc_to_str __P((struct epdisc *)); /* string from endpoint discrim. */int str_to_epdisc __P((struct epdisc *, char *)); /* endpt disc. from str */#else#define mp_bundle_terminated() /* nothing */#define mp_exit_bundle() /* nothing */#define doing_multilink 0#define multilink_master 0#endif/* 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 generic_disestablish_ppp __P((int dev_fd)); /* Restore device setting */int generic_establish_ppp __P((int dev_fd)); /* Make a ppp interface */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 destroy_bundle __P((void)); /* Tell driver to destroy 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 *));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -