📄 dhcp-client-conf.h
字号:
/* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-conf.h,v 1.19 2003/06/27 03:16:27 actmodern Exp $ * * Copyright 2002 Thamer Alharbash <tmh@whitefang.com> * * 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. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * */#ifndef DHCP_CLIENT_CONF_H#define DHCP_CLIENT_CONF_H/* typdefs. */typedef uint8_t directive_group_t;/* data structures. *//* note on conf_params_t: all members have an associated _set * member which tells us easily if they've been set. this is * only useful for lower_params where specific groups are * specified and the settings override the global ones. the top * level param is initialized to defaults and no checking is made * there. */typedef struct { /* server specific options. may be set to hardware address or * IP address matching. */ directive_group_t group_type; /* depending on what kind of grouping these two addresses may be used. */ ip_addr_t server_ip; /* server ip address. */ eth_addr_t server_hw_addr; /* server hw address. */ list_t *variables; /* variables of type var_t. */ list_t *lower_params; /* linked list to child parameters. */ list_t *append_options; /* options append values to. */ list_t *prepend_options; /* options prepend values to. */ list_t *override_options; /* options override values. */} client_conf_params_t;typedef struct { char *conf_file; /* name of conf file. */ const char *interface; /* points to dhcp_client_control->interface */ /* the top level conf_params_t -- top level is for any server. * we have lower level ones pointed from the top level. */ client_conf_params_t *params;} client_conf_t;/* typedef of directive handler. */typedef int (*directive_handler_t)(client_conf_params_t *param, void *directive_data, directive_group_t group_type, void *group_data);/* directive types. */enum directive_types { DIRECTIVE_SET_BOOLEAN = 0, DIRECTIVE_SET, DIRECTIVE_REQUEST, DIRECTIVE_REQUIRE, DIRECTIVE_SERVER_GROUP, DIRECTIVE_CONFIGURE, DIRECTIVE_APPEND, DIRECTIVE_PREPEND, DIRECTIVE_OVERRIDE };/* symbols for configuration variables. */enum var_symbols { CLIENT_VAR_HOSTNAME = 0, CLIENT_VAR_DHCP_DISCOVER_TIMEOUT, CLIENT_VAR_DHCP_REQUEST_TIMEOUT, CLIENT_VAR_ICMP_ECHO_TIMEOUT, CLIENT_VAR_ICMP_SUBNET_TIMEOUT, CLIENT_VAR_ARP_TIMEOUT, CLIENT_VAR_DHCP_DISCOVER_RETRIES, CLIENT_VAR_DHCP_REQUEST_RETRIES, CLIENT_VAR_ICMP_RETRIES, CLIENT_VAR_ARP_RETRIES, CLIENT_VAR_INTERFACE_MTU, CLIENT_VAR_DO_MEASURE_ROUTER_LATENCY_ICMP, CLIENT_VAR_REQUEST_OPTIONS, CLIENT_VAR_REQUIRE_OPTIONS, CLIENT_VAR_CONFIGURE_OPTIONS, CLIENT_VAR_APPEND_OPTIONS, CLIENT_VAR_PREPEND_OPTIONS, CLIENT_VAR_OVERRIDE_OPTIONS, CLIENT_VAR_SUBNET_MASK, CLIENT_VAR_RENEW_PERCENT, CLIENT_VAR_REBIND_PERCENT };/* server symbol substitution. */enum server_symbols { CLIENT_SERVER_IP = 0, CLIENT_SERVER_MAC };/* directive groups. */enum directive_group_t { DIRECTIVE_GROUP_NULL = 0, DIRECTIVE_GROUP_IP_ADDRESS, DIRECTIVE_GROUP_MAC_ADDRESS };/* prototypes. */extern client_conf_t *create_client_conf(const char *interface);extern void client_conf_destroy(client_conf_t *cc);extern int client_conf_reread(client_conf_t *cc);extern list_t *client_conf_get_override_options(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr);extern list_t *client_conf_get_append_options(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr);extern list_t *client_conf_get_prepend_options(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr);extern uint8_t *client_conf_get_request_opt_bit_array(client_conf_t *cc);extern int client_conf_get_dhcp_discovery_retries(client_conf_t *cc);extern int client_conf_get_dhcp_request_retries(client_conf_t *cc);extern uint8_t *client_conf_get_opt_required_bit_array(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr);extern uint8_t *client_conf_get_opt_configure_bit_array(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr);extern int client_conf_get_icmp_retries(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr);extern int client_conf_get_arp_retries(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr);extern int client_conf_get_icmp_echo_timeout(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr);extern int client_conf_get_icmp_subnet_timeout(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr);extern int client_conf_get_dhcp_discover_timeout(client_conf_t *cc);extern int client_conf_get_dhcp_request_timeout(client_conf_t *cc);extern int client_conf_get_arp_timeout(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr);extern const char *client_conf_get_hostname(client_conf_t *cc);extern uint8_t client_conf_get_do_measure_router_latency_icmp(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr);extern int client_conf_get_default_mtu(client_conf_t *cc);extern const char *client_conf_get_default_subnet_mask(client_conf_t *cc, ip_addr_t ip_addr, eth_addr_t eth_addr);extern int client_conf_get_renew_percent(client_conf_t *cc);extern int client_conf_get_rebind_percent(client_conf_t *cc);#endif /* DHCP_CLIENT_CONF_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -