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

📄 dhcp-option.h

📁 this is sample about DHCP-agent
💻 H
字号:
/* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-option.h,v 1.7 2003/06/27 20:59:17 actmodern Exp $ *  * Copyright 2002, 2003 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_OPTION_H#define DHCP_OPTION_H/* prototypes. */extern dhcp_opt_t *dhcp_opt_create_from_network(const uint8_t *data, dhcp_opt_len_t len, dhcp_opt_tag_t tag);extern dhcp_opt_t *dhcp_opt_create_from_internal_data(uint8_t tag, void *data, size_t len);extern dhcp_opt_t *dhcp_opt_create_from_user_string(uint8_t tag, void *string_data);extern dhcp_opt_t *dhcp_opt_create_from_host_string(uint8_t tag, char *input);extern void *dhcp_opt_get_network_data(dhcp_opt_t *opt);extern void *dhcp_opt_get_host_data(dhcp_opt_t *opt);extern char *dhcp_opt_get_user_string(dhcp_opt_t *opt);extern char *dhcp_opt_get_internal_string(dhcp_opt_t *opt);extern size_t dhcp_opt_get_mem_len(dhcp_opt_t *opt);extern size_t dhcp_opt_get_num(dhcp_opt_t *opt);extern dhcp_opt_len_t dhcp_opt_get_total_len(dhcp_opt_t *opt);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 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 dhcp_opt_t *dhcp_opt_create_message_type(uint8_t message_type);extern dhcp_opt_t *dhcp_opt_create_parameter_request_list(uint8_t *requested_options);extern void dhcp_option_append(dhcp_opt_t *orig, dhcp_opt_t *data);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. */enum opt_val_type { DHCP_OPT_VAL_UINT32, DHCP_OPT_VAL_INT32, DHCP_OPT_VAL_UINT16, DHCP_OPT_VAL_INT16,                     DHCP_OPT_VAL_UINT8, DHCP_OPT_VAL_INT8, DHCP_OPT_VAL_ADDRESS,                     DHCP_OPT_VAL_ADDRESS_PAIR };/* convenience macros. this makes accessing what's under the attr structure easier. */#define DHCP_OPT_GET_TYPE(x)                           (x->opt_attr->type)#define DHCP_OPT_GET_VAL_TYPE(x)                       (x->opt_attr->val_type)#define DHCP_OPT_GET_TAG(x)                            (x->opt_attr->tag)#define DHCP_OPT_GET_TOTAL_LEN(x)                      (x->opt_attr->len * x->num)#define DHCP_OPT_GET_MEM_LEN(x)                        (x->opt_attr->len)#define DHCP_OPT_FROM_NETWORK_DATA(x, data, len)       (x->opt_attr->from_network(x, data, len))#define DHCP_OPT_FROM_USER_STRING(x, string_data)      (x->opt_attr->from_user_string(x, string_data))#define DHCP_OPT_FROM_INTERNAL_STRING(x, string_data)  (x->opt_attr->from_internal_string(x, string_data))#define DHCP_OPT_TO_INTERNAL_STRING(x)                 (x->opt_attr->to_internal_string(x))#define DHCP_OPT_TO_USER_STRING(x)                     (x->opt_attr->to_user_string(x))#define DHCP_OPT_TO_NETWORK_DATA(x)                    (x->opt_attr->to_network_data(x))#define DHCP_OPT_TO_INTERNAL_DATA(x)                   (dhcp_opt_get_host_data(x))#define DHCP_OPT_DESTROY(x)                            (x->opt_attr->destroy(x))#endif /* DHCP_OPTION_H */

⌨️ 快捷键说明

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