[dhcp-agent-commits] dhcp-agent/src dhcp-server-conf.c,1.10,1.11 dhcp-server-conf.h,1.8,1.9
Status: Alpha
Brought to you by:
actmodern
From: <act...@us...> - 2003-07-27 03:13:53
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv2335/src Modified Files: dhcp-server-conf.c dhcp-server-conf.h Log Message: added option to assume local subnet from interface Index: dhcp-server-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-conf.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dhcp-server-conf.c 26 Jul 2003 23:46:51 -0000 1.10 --- dhcp-server-conf.c 27 Jul 2003 03:13:48 -0000 1.11 *************** *** 50,53 **** --- 50,61 ---- }; + static const char *var_boolean_strings[] = { + "assume-local-subnet-from-interface", + }; + + static const arg_symbol_t var_boolean_symbols[] = { + SERVER_VAR_ASSUME_LOCAL_SUBNET_FROM_INTERFACE, + }; + static const arg_type_t var_arg_types[] = { CONF_IDENTIFIER, CONF_ASSIGNMENT, CONF_STRING }; static const char **var_arg_strings[] = { var_strings, NULL, NULL }; *************** *** 78,81 **** --- 86,93 ---- static const arg_symbol_t *subnet_arg_symbols[] = { NULL, NULL }; + static const arg_type_t enable_arg_types[] = { CONF_IDENTIFIER, CONF_ASSIGNMENT, CONF_BOOLEAN }; + static const char **enable_arg_strings[] = { var_boolean_strings, NULL, NULL }; + static const arg_symbol_t *enable_arg_symbols[] = { var_boolean_symbols, NULL, NULL }; + /* command structures. */ *************** *** 147,150 **** --- 159,171 ---- }; + static const command_t command_enable = { + DIRECTIVE_ENABLE, + "enable", + 3, + enable_arg_strings, + enable_arg_types, + enable_arg_symbols, + }; + static const command_t *commands[] = { &command_set, *************** *** 155,158 **** --- 176,180 ---- &command_local_subnet, &command_subnet, + &command_enable, NULL, }; *************** *** 167,170 **** --- 189,193 ---- static int directive_local_subnet_handler(server_conf_t *server_conf, directive_t *directive, int group_type, void *group_data); static int directive_subnet_handler(server_conf_t *server_conf, directive_t *directive, int group_type, void *group_data); + static int directive_enable_handler(server_conf_t *server_conf, directive_t *directive, int group_type, void *group_data); /* indexed by directive types in dhcp-client-conf.h . */ *************** *** 177,180 **** --- 200,204 ---- directive_local_subnet_handler, directive_subnet_handler, + directive_enable_handler, }; *************** *** 311,314 **** --- 335,365 ---- * directive handlers. * * * * * * * * * * * * */ + + /* enable handler. */ + static int directive_enable_handler(server_conf_t *server_conf, directive_t *directive, int group_type, void *group_data) + { + list_t *args; + arg_symbol_t *var_symbol; + uint8_t *var_value; + + args = directive->arguments; + + var_symbol = list_get_by_index(args, 0); + var_value = list_get_by_index(args, 2); + + switch(*var_symbol) { + + case SERVER_VAR_ASSUME_LOCAL_SUBNET_FROM_INTERFACE: + + server_conf->assume_interface_subnet = *(var_value); + break; + + default: + ERROR_MESSAGE("illegal identifier used in enable directive: %s", var_boolean_strings[*var_symbol]); + return 1; + } + + return 0; + } /* variable set handler. */ Index: dhcp-server-conf.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-conf.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-server-conf.h 26 Jul 2003 23:46:51 -0000 1.8 --- dhcp-server-conf.h 27 Jul 2003 03:13:48 -0000 1.9 *************** *** 38,41 **** --- 38,42 ---- uint16_t default_renew_percent; /* percent of expiry to assign as renew time. */ uint16_t poll_timeout; /* poll timeout -- used in server event processing. */ + uint8_t assume_interface_subnet; /* assume the interface has the correct local subnet configured. */ list_t *local_subnets; /* list of subnets. */ *************** *** 46,52 **** /* constants. */ ! enum var_symbols { SERVER_VAR_RENEW_PERCENT = 0, SERVER_VAR_REBIND_PERCENT, SERVER_VAR_POLL_TIMEOUT }; enum directive_types { DIRECTIVE_SET = 0, DIRECTIVE_RANGE_LEASE, DIRECTIVE_HOSTNAME_LEASE, ! DIRECTIVE_MAC_LEASE, DIRECTIVE_OPTION, DIRECTIVE_LOCAL_SUBNET, DIRECTIVE_SUBNET }; enum group_types { GROUP_NULL = 0, GROUP_LEASE_DEF, GROUP_SUBNET_DEF }; --- 47,54 ---- /* constants. */ ! enum var_symbols { SERVER_VAR_RENEW_PERCENT = 0, SERVER_VAR_REBIND_PERCENT, SERVER_VAR_POLL_TIMEOUT, ! SERVER_VAR_ASSUME_LOCAL_SUBNET_FROM_INTERFACE }; enum directive_types { DIRECTIVE_SET = 0, DIRECTIVE_RANGE_LEASE, DIRECTIVE_HOSTNAME_LEASE, ! DIRECTIVE_MAC_LEASE, DIRECTIVE_OPTION, DIRECTIVE_LOCAL_SUBNET, DIRECTIVE_SUBNET, DIRECTIVE_ENABLE }; enum group_types { GROUP_NULL = 0, GROUP_LEASE_DEF, GROUP_SUBNET_DEF }; |