📄 dhcpd.h
字号:
OMAPI_OBJECT_PREAMBLE; struct interface_info *next; /* Next interface in list... */ struct shared_network *shared_network; /* Networks connected to this interface. */ struct hardware hw_address; /* Its physical address. */ struct in_addr primary_address; /* Primary interface address. */ u_int8_t *circuit_id; /* Circuit ID associated with this interface. */ unsigned circuit_id_len; /* Length of Circuit ID, if there is one. */ u_int8_t *remote_id; /* Remote ID associated with this interface (if any). */ unsigned remote_id_len; /* Length of Remote ID. */ char name [IFNAMSIZ]; /* Its name... */ int index; /* Its index. */ int rfdesc; /* Its read file descriptor. */ int wfdesc; /* Its write file descriptor, if different. */ unsigned char *rbuf; /* Read buffer, if required. */ unsigned int rbuf_max; /* Size of read buffer. */ size_t rbuf_offset; /* Current offset into buffer. */ size_t rbuf_len; /* Length of data in buffer. */ struct ifreq *ifp; /* Pointer to ifreq struct. */ u_int32_t flags; /* Control flags... */#define INTERFACE_REQUESTED 1#define INTERFACE_AUTOMATIC 2#define INTERFACE_RUNNING 4 /* Only used by DHCP client code. */ struct client_state *client;# if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE) int dlpi_sap_length; struct hardware dlpi_broadcast_addr;# endif /* DLPI_SEND || DLPI_RECEIVE */};struct hardware_link { struct hardware_link *next; char name [IFNAMSIZ]; struct hardware address;};typedef void (*tvref_t)(void *, void *, const char *, int);typedef void (*tvunref_t)(void *, const char *, int);struct timeout { struct timeout *next; TIME when; void (*func) PROTO ((void *)); void *what; tvref_t ref; tvunref_t unref;};struct protocol { struct protocol *next; int fd; void (*handler) PROTO ((struct protocol *)); void *local;};struct dns_query; /* forward */struct dns_wakeup { struct dns_wakeup *next; /* Next wakeup in chain. */ void (*func) PROTO ((struct dns_query *));};struct dns_question { u_int16_t type; /* Type of query. */ u_int16_t class; /* Class of query. */ unsigned char data [1]; /* Query data. */};struct dns_answer { u_int16_t type; /* Type of answer. */ u_int16_t class; /* Class of answer. */ int count; /* Number of answers. */ unsigned char *answers[1]; /* Pointers to answers. */};struct dns_query { struct dns_query *next; /* Next query in hash bucket. */ u_int32_t hash; /* Hash bucket index. */ TIME expiry; /* Query expiry time (zero if not yet answered. */ u_int16_t id; /* Query ID (also hash table index) */ caddr_t waiters; /* Pointer to list of things waiting on this query. */ struct dns_question *question; /* Question, internal format. */ struct dns_answer *answer; /* Answer, internal format. */ unsigned char *query; /* Query formatted for DNS server. */ unsigned len; /* Length of entire query. */ int sent; /* The query has been sent. */ struct dns_wakeup *wakeups; /* Wakeups to call if this query is answered. */ struct name_server *next_server; /* Next server to try. */ int backoff; /* Current backoff, in seconds. */};struct dns_zone { int refcnt; TIME timeout; char *name; struct option_cache *primary; struct option_cache *secondary; struct auth_key *key;};struct icmp_state { OMAPI_OBJECT_PREAMBLE; int socket; void (*icmp_handler) PROTO ((struct iaddr, u_int8_t *, int));};#include "ctrace.h"/* Bitmask of dhcp option codes. */typedef unsigned char option_mask [16];/* DHCP Option mask manipulation macros... */#define OPTION_ZERO(mask) (memset (mask, 0, 16))#define OPTION_SET(mask, bit) (mask [bit >> 8] |= (1 << (bit & 7)))#define OPTION_CLR(mask, bit) (mask [bit >> 8] &= ~(1 << (bit & 7)))#define OPTION_ISSET(mask, bit) (mask [bit >> 8] & (1 << (bit & 7)))#define OPTION_ISCLR(mask, bit) (!OPTION_ISSET (mask, bit))/* An option occupies its length plus two header bytes (code and length) for every 255 bytes that must be stored. */#define OPTION_SPACE(x) ((x) + 2 * ((x) / 255 + 1))/* Default path to dhcpd config file. */#ifdef DEBUG#undef _PATH_DHCPD_CONF#define _PATH_DHCPD_CONF "dhcpd.conf"#undef _PATH_DHCPD_DB#define _PATH_DHCPD_DB "dhcpd.leases"#undef _PATH_DHCPD_PID#define _PATH_DHCPD_PID "dhcpd.pid"#else#ifndef _PATH_DHCPD_CONF#define _PATH_DHCPD_CONF "/etc/dhcpd.conf"#endif#ifndef _PATH_DHCPD_DB#define _PATH_DHCPD_DB "/etc/dhcpd.leases"#endif#ifndef _PATH_DHCPD_PID#define _PATH_DHCPD_PID "/var/run/dhcpd.pid"#endif#endif#ifndef _PATH_DHCLIENT_CONF#define _PATH_DHCLIENT_CONF "/etc/dhclient.conf"#endif#ifndef _PATH_DHCLIENT_SCRIPT#define _PATH_DHCLIENT_SCRIPT "/sbin/dhclient-script"#endif#ifndef _PATH_DHCLIENT_PID#define _PATH_DHCLIENT_PID "/var/run/dhclient.pid"#endif#ifndef _PATH_DHCLIENT_DB#define _PATH_DHCLIENT_DB "/etc/dhclient.leases"#endif#ifndef _PATH_RESOLV_CONF#define _PATH_RESOLV_CONF "/etc/resolv.conf"#endif#ifndef _PATH_DHCRELAY_PID#define _PATH_DHCRELAY_PID "/var/run/dhcrelay.pid"#endif#ifndef DHCPD_LOG_FACILITY#define DHCPD_LOG_FACILITY LOG_DAEMON#endif#define MAX_TIME 0x7fffffff#define MIN_TIME 0/* External definitions... */HASH_FUNCTIONS_DECL (group, const char *, struct group_object, group_hash_t)HASH_FUNCTIONS_DECL (universe, const char *, struct universe, universe_hash_t)HASH_FUNCTIONS_DECL (option, const char *, struct option, option_hash_t)HASH_FUNCTIONS_DECL (dns_zone, const char *, struct dns_zone, dns_zone_hash_t)HASH_FUNCTIONS_DECL (lease, const unsigned char *, struct lease, lease_hash_t)HASH_FUNCTIONS_DECL (host, const unsigned char *, struct host_decl, host_hash_t)HASH_FUNCTIONS_DECL (class, const char *, struct class, class_hash_t)/* options.c */extern struct option *vendor_cfg_option;int parse_options PROTO ((struct packet *));int parse_option_buffer PROTO ((struct option_state *, const unsigned char *, unsigned, struct universe *));struct universe *find_option_universe (struct option *, const char *);int parse_encapsulated_suboptions (struct option_state *, struct option *, const unsigned char *, unsigned, struct universe *, const char *);int cons_options PROTO ((struct packet *, struct dhcp_packet *, struct lease *, struct client_state *, int, struct option_state *, struct option_state *, struct binding_scope **, int, int, int, struct data_string *, const char *));int fqdn_universe_decode (struct option_state *, const unsigned char *, unsigned, struct universe *);int store_options PROTO ((unsigned char *, unsigned, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, unsigned *, int, unsigned, unsigned, int, const char *));const char *pretty_print_option PROTO ((struct option *, const unsigned char *, unsigned, int, int));int get_option (struct data_string *, struct universe *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct option_state *, struct binding_scope **, unsigned, const char *, int);void set_option (struct universe *, struct option_state *, struct option_cache *, enum statement_op);struct option_cache *lookup_option PROTO ((struct universe *, struct option_state *, unsigned));struct option_cache *lookup_hashed_option PROTO ((struct universe *, struct option_state *, unsigned));int save_option_buffer (struct universe *, struct option_state *, struct buffer *, unsigned char *, unsigned, struct option *, int);void save_option PROTO ((struct universe *, struct option_state *, struct option_cache *));void save_hashed_option PROTO ((struct universe *, struct option_state *, struct option_cache *));void delete_option PROTO ((struct universe *, struct option_state *, int));void delete_hashed_option PROTO ((struct universe *, struct option_state *, int));int option_cache_dereference PROTO ((struct option_cache **, const char *, int));int hashed_option_state_dereference PROTO ((struct universe *, struct option_state *, const char *, int));int store_option PROTO ((struct data_string *, struct universe *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct option_cache *));int option_space_encapsulate PROTO ((struct data_string *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct data_string *));int hashed_option_space_encapsulate PROTO ((struct data_string *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *));int nwip_option_space_encapsulate PROTO ((struct data_string *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *));int fqdn_option_space_encapsulate (struct data_string *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *);void suboption_foreach (struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *, void (*) (struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *), struct option_cache *, const char *);void option_space_foreach (struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *, void (*) (struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *));void hashed_option_space_foreach (struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *, void (*) (struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *));int linked_option_get PROTO ((struct data_string *, struct universe *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct option_state *, struct binding_scope **, unsigned));int linked_option_state_dereference PROTO ((struct universe *, struct option_state *, const char *, int));void save_linked_option (struct universe *, struct option_state *, struct option_cache *);void linked_option_space_foreach (struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *, void (*) (struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *));int linked_option_space_encapsulate (struct data_string *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *);void delete_linked_option (struct universe *, struct option_state *, int);struct option_cache *lookup_linked_option (struct universe *, struct option_state *, unsigned);void do_packet PROTO ((struct interface_info *, struct dhcp_packet *, unsigned, unsigned int, struct iaddr, struct hardware *));/* dhcpd.c */extern TIME cur_time;int ddns_update_style;extern const char *path_dhcpd_conf;extern const char *path_dhcpd_db;extern const char *path_dhcpd_pid;extern int dhcp_max_agent_option_packet_length;int main PROTO ((int, char **, char **));void postconf_initialization (int);void postdb_startup (void);void cleanup PROTO ((void));void lease_pinged PROTO ((struct iaddr, u_int8_t *, int));void lease_ping_timeout PROTO ((void *));int dhcpd_interface_setup_hook (struct interface_info *ip, struct iaddr *ia);enum dhcp_shutdown_state shutdown_state;isc_result_t dhcp_io_shutdown (omapi_object_t *, void *);isc_result_t dhcp_set_control_state (control_object_state_t oldstate, control_object_state_t newstate);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -