⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dhcpd.h

📁 DHCP服务器源码
💻 H
📖 第 1 页 / 共 5 页
字号:
/* dhcpd.h   Definitions for dhcpd... *//* * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * *   Internet Systems Consortium, Inc. *   950 Charter Street *   Redwood City, CA 94063 *   <info@isc.org> *   http://www.isc.org/ * * This software has been written for Internet Systems Consortium * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc. * To learn more about Internet Systems Consortium, see * ``http://www.isc.org/''.  To learn more about Vixie Enterprises, * see ``http://www.vix.com''.   To learn more about Nominum, Inc., see * ``http://www.nominum.com''. */#ifndef __CYGWIN32__#include <sys/types.h>#include <netinet/in.h>#include <sys/socket.h>#include <sys/un.h>#include <arpa/inet.h>#include <netdb.h>#else#define fd_set cygwin_fd_set#include <sys/types.h>#endif#include <fcntl.h>#include <stdio.h>#include <unistd.h>#include <string.h>#include <stdlib.h>#include <sys/stat.h>#include <ctype.h>#include <time.h>#include "cdefs.h"#include "osdep.h"#include "arpa/nameser.h"#if defined (NSUPDATE)# include "minires/minires.h"#endifstruct hash_table;typedef struct hash_table group_hash_t;typedef struct hash_table universe_hash_t;typedef struct hash_table option_hash_t;typedef struct hash_table dns_zone_hash_t;typedef struct hash_table lease_hash_t;typedef struct hash_table host_hash_t;typedef struct hash_table class_hash_t;#include "dhcp.h"#include "statement.h"#include "tree.h"#include "inet.h"#include "dhctoken.h"#include <isc-dhcp/result.h>#include <omapip/omapip_p.h>#if !defined (OPTION_HASH_SIZE)# define OPTION_HASH_SIZE 17# define OPTION_HASH_PTWO 32	/* Next power of two above option hash. */# define OPTION_HASH_EXP 5	/* The exponent for that power of two. */#endif#define compute_option_hash(x) \	(((x) & (OPTION_HASH_PTWO - 1)) + \	 (((x) >> OPTION_HASH_EXP) & \	  (OPTION_HASH_PTWO - 1))) % OPTION_HASH_SIZE;enum dhcp_shutdown_state {	shutdown_listeners,	shutdown_omapi_connections,	shutdown_drop_omapi_connections,	shutdown_dhcp,	shutdown_done};/* Client FQDN option, failover FQDN option, etc. */typedef struct {	u_int8_t codes [2];	unsigned length;	u_int8_t *data;} ddns_fqdn_t;#include "failover.h"/* A parsing context. */struct parse {	int lexline;	int lexchar;	char *token_line;	char *prev_line;	char *cur_line;	const char *tlname;	int eol_token;	char line1 [81];	char line2 [81];	int lpos;	int line;	int tlpos;	int tline;	enum dhcp_token token;	int ugflag;	char *tval;	int tlen;	char tokbuf [1500];#ifdef OLD_LEXER	char comments [4096];	int comment_index;#endif	int warnings_occurred;	int file;	char *inbuf;	unsigned bufix, buflen;	unsigned bufsiz;};/* Variable-length array of data. */struct string_list {	struct string_list *next;	char string [1];};/* A name server, from /etc/resolv.conf. */struct name_server {	struct name_server *next;	struct sockaddr_in addr;	TIME rcdate;};/* A domain search list element. */struct domain_search_list {	struct domain_search_list *next;	char *domain;	TIME rcdate;};/* Option tag structures are used to build chains of option tags, for   when we're sure we're not going to have enough of them to justify   maintaining an array. */struct option_tag {	struct option_tag *next;	u_int8_t data [1];};/* An agent option structure.   We need a special structure for the   Relay Agent Information option because if more than one appears in   a message, we have to keep them seperate. */struct agent_options {	struct agent_options *next;	int length;	struct option_tag *first;};struct option_cache {	int refcnt;	struct option_cache *next;	struct expression *expression;	struct option *option;	struct data_string data;};struct option_state {	int refcnt;	int universe_count;	int site_universe;	int site_code_min;	VOIDPTR universes [1];};/* A dhcp packet and the pointers to its option values. */struct packet {	struct dhcp_packet *raw;	int refcnt;	unsigned packet_length;	int packet_type;	int options_valid;	int client_port;	struct iaddr client_addr;	struct interface_info *interface;	/* Interface on which packet						   was received. */	struct hardware *haddr;		/* Physical link address					   of local sender (maybe gateway). */	/* Information for relay agent options (see	   draft-ietf-dhc-agent-options-xx.txt). */	u_int8_t *circuit_id;		/* Circuit ID of client connection. */	int circuit_id_len;	u_int8_t *remote_id;		/* Remote ID of client. */	int remote_id_len;	int got_requested_address;	/* True if client sent the					   dhcp-requested-address option. */	struct shared_network *shared_network;	struct option_state *options;#if !defined (PACKET_MAX_CLASSES)# define PACKET_MAX_CLASSES 5#endif	int class_count;	struct class *classes [PACKET_MAX_CLASSES];	int known;	int authenticated;};/* A network interface's MAC address. */struct hardware {	u_int8_t hlen;	u_int8_t hbuf [17];};typedef enum {	server_startup = 0,	server_running = 1,	server_shutdown = 2,	server_hibernate = 3,	server_awaken = 4} control_object_state_t;typedef struct {	OMAPI_OBJECT_PREAMBLE;	control_object_state_t state;} dhcp_control_object_t;/* Lease states: */typedef enum {	FTS_FREE = 1,	FTS_ACTIVE = 2,	FTS_EXPIRED = 3,	FTS_RELEASED = 4,	FTS_ABANDONED = 5,	FTS_RESET = 6,	FTS_BACKUP = 7} binding_state_t;/* FTS_LAST is the highest value that is valid for a lease binding state. */#define FTS_LAST FTS_BACKUP/* A dhcp lease declaration structure. */struct lease {	OMAPI_OBJECT_PREAMBLE;	struct lease *next;	struct lease *n_uid, *n_hw;	struct iaddr ip_addr;	TIME starts, ends, timestamp, sort_time;	char *client_hostname;	struct binding_scope *scope;	struct host_decl *host;	struct subnet *subnet;	struct pool *pool;	struct class *billing_class;	struct option_chain_head *agent_options;	struct executable_statement *on_expiry;	struct executable_statement *on_commit;	struct executable_statement *on_release;	unsigned char *uid;	unsigned short uid_len;	unsigned short uid_max;	unsigned char uid_buf [7];	struct hardware hardware_addr;	u_int8_t flags;#       define STATIC_LEASE		1#	define BOOTP_LEASE		2#	define PERSISTENT_FLAGS		(ON_ACK_QUEUE | ON_UPDATE_QUEUE)#	define MS_NULL_TERMINATION	8#	define ON_UPDATE_QUEUE		16#	define ON_ACK_QUEUE		32#	define UNICAST_BROADCAST_HACK	64#	define ON_DEFERRED_QUEUE	128#	define EPHEMERAL_FLAGS		(MS_NULL_TERMINATION | \					 UNICAST_BROADCAST_HACK)	binding_state_t __attribute__ ((mode (__byte__))) binding_state;	binding_state_t __attribute__ ((mode (__byte__))) next_binding_state;	binding_state_t __attribute__ ((mode (__byte__))) desired_binding_state;		struct lease_state *state;	TIME tstp;	/* Time sent to partner. */	TIME tsfp;	/* Time sent from partner. */	TIME cltt;	/* Client last transaction time. */	struct lease *next_pending;};struct lease_state {	struct lease_state *next;	struct interface_info *ip;	struct packet *packet;	/* The incoming packet. */	TIME offered_expiry;	struct option_state *options;	struct data_string parameter_request_list;	int max_message_size;	u_int32_t expiry, renewal, rebind;	struct data_string filename, server_name;	int got_requested_address;	int got_server_identifier;	struct shared_network *shared_network;	/* Shared network of interface						   on which request arrived. */	u_int32_t xid;	u_int16_t secs;	u_int16_t bootp_flags;	struct in_addr ciaddr;	struct in_addr siaddr;	struct in_addr giaddr;	u_int8_t hops;	u_int8_t offer;	struct iaddr from;};#define	ROOT_GROUP	0#define HOST_DECL	1#define SHARED_NET_DECL	2#define SUBNET_DECL	3#define CLASS_DECL	4#define	GROUP_DECL	5#define POOL_DECL	6/* Possible modes in which discover_interfaces can run. */#define DISCOVER_RUNNING	0#define DISCOVER_SERVER		1#define DISCOVER_UNCONFIGURED	2#define DISCOVER_RELAY		3#define DISCOVER_REQUESTED	4/* Server option names. */#define SV_DEFAULT_LEASE_TIME		1#define SV_MAX_LEASE_TIME		2#define SV_MIN_LEASE_TIME		3#define SV_BOOTP_LEASE_CUTOFF		4#define SV_BOOTP_LEASE_LENGTH		5#define SV_BOOT_UNKNOWN_CLIENTS		6#define SV_DYNAMIC_BOOTP		7#define	SV_ALLOW_BOOTP			8#define	SV_ALLOW_BOOTING		9#define	SV_ONE_LEASE_PER_CLIENT		10#define	SV_GET_LEASE_HOSTNAMES		11#define	SV_USE_HOST_DECL_NAMES		12

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -