dhcpd.h
来自「open source dhcp server client etc...」· C头文件 代码 · 共 1,889 行 · 第 1/5 页
H
1,889 行
/* dhcpd.h Definitions for dhcpd... *//* * Copyright (c) 1996-2001 Internet Software Consortium. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of The Internet Software Consortium nor the names * of its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This software has been written for the Internet Software Consortium * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc. * To learn more about the Internet Software 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"#endif#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, FTS_RESERVED = 8, FTS_BOOTP = 9} binding_state_t;/* 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 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 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; 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#define SV_USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 13#define SV_MIN_SECS 14
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?