[dhcp-agent-commits] dhcp-agent/src dhcp-option.c,1.7,1.8 dhcp-option.h,1.8,1.9
Status: Alpha
Brought to you by:
actmodern
From: <act...@us...> - 2003-08-10 01:23:14
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv19315 Modified Files: dhcp-option.c dhcp-option.h Log Message: added routine to get by type by tag Index: dhcp-option.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-option.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-option.c 5 Aug 2003 04:57:38 -0000 1.7 --- dhcp-option.c 10 Aug 2003 01:23:11 -0000 1.8 *************** *** 1365,1368 **** --- 1365,1369 ---- } + /* get type. */ dhcp_opt_type_t dhcp_opt_get_type(dhcp_opt_t *opt) { *************** *** 1370,1378 **** } ! dhcp_opt_type_t dhcp_opt_get_val_type(dhcp_opt_t *opt) { return DHCP_OPT_GET_VAL_TYPE(opt); } dhcp_opt_tag_t dhcp_opt_get_tag(dhcp_opt_t *opt) { --- 1371,1381 ---- } ! /* get val type. */ ! dhcp_opt_val_type_t dhcp_opt_get_val_type(dhcp_opt_t *opt) { return DHCP_OPT_GET_VAL_TYPE(opt); } + /* get tag. */ dhcp_opt_tag_t dhcp_opt_get_tag(dhcp_opt_t *opt) { *************** *** 1514,1516 **** --- 1517,1530 ---- return; + } + + /* return option data type by tag. */ + int dhcp_opt_get_type_by_tag(dhcp_opt_tag_t tag) + { + + if(tag <= MAX_OPTIONS_HANDLED) { + return dhcp_opt_attr[tag].type; + } + + return DHCP_OPT_UNKNOWN; } Index: dhcp-option.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-option.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-option.h 5 Aug 2003 04:57:38 -0000 1.8 --- dhcp-option.h 10 Aug 2003 01:23:11 -0000 1.9 *************** *** 42,49 **** --- 42,51 ---- extern dhcp_opt_tag_t dhcp_opt_get_tag(dhcp_opt_t *opt); extern dhcp_opt_type_t dhcp_opt_get_type(dhcp_opt_t *opt); + extern dhcp_opt_val_type_t dhcp_opt_get_val_type(dhcp_opt_t *opt); extern void dhcp_opt_destroy(dhcp_opt_t *opt); extern void dhcp_opt_destroy_option_list(list_t *list); extern dhcp_opt_t *dhcp_option_copy(dhcp_opt_t *option); extern list_t *dhcp_option_copy_list(list_t *option_list); + extern int dhcp_opt_get_type_by_tag(dhcp_opt_tag_t tag); extern dhcp_opt_t *dhcp_opt_create_message_type(uint8_t message_type); *************** *** 53,64 **** extern void dhcp_option_prepend(dhcp_opt_t *orig, dhcp_opt_t *data); - /* constants. */ /* opt type. */ ! #define DHCP_OPT_LIST 1 ! #define DHCP_OPT_ATOM 2 ! #define DHCP_OPT_STRING 3 ! #define DHCP_OPT_ARRAY 4 /* opt val type. */ --- 55,62 ---- extern void dhcp_option_prepend(dhcp_opt_t *orig, dhcp_opt_t *data); /* constants. */ /* opt type. */ ! enum opt_type { DHCP_OPT_UNKNOWN = 0, DHCP_OPT_LIST, DHCP_OPT_ATOM, DHCP_OPT_STRING, DHCP_OPT_ARRAY }; /* opt val type. */ |