dhcp-option.c

来自「this is sample about DHCP-agent」· C语言 代码 · 共 1,499 行 · 第 1/3 页

C
1,499
字号
      dhcp_opt_from_network_ip_addr,      dhcp_opt_from_user_string_ip_addr,      dhcp_opt_from_internal_string_ip_addr,      dhcp_opt_destroy_atom,    },    /* Static Route Option */    { TAG_DHCP_STATIC_ROUTE,      IP_ADDR_LEN,      DHCP_OPT_LIST,      DHCP_OPT_VAL_ADDRESS_PAIR,      dhcp_opt_to_network_list_ip_addr_pair,      dhcp_opt_to_user_string_list_ip_addr_pair,      dhcp_opt_to_internal_string_list_ip_addr_pair,      dhcp_opt_from_network_list_ip_addr_pair,      dhcp_opt_from_user_string_ip_addr_pair,      dhcp_opt_from_internal_string_list_ip_addr_pair,      dhcp_opt_destroy_list,    },    /* Trailer Encapsulation Option */    { TAG_DHCP_TRAILER_ENCAPSULATION,      sizeof(uint8_t),      DHCP_OPT_ATOM,      DHCP_OPT_VAL_UINT8,      dhcp_opt_to_network_uint8,      dhcp_opt_to_user_string_uint8,      dhcp_opt_to_internal_string_uint8,      dhcp_opt_from_network_uint8,      dhcp_opt_from_user_string_uint8,      dhcp_opt_from_internal_string_uint8,      dhcp_opt_destroy_atom,    },    /* Arp Cache Timeout */    { TAG_DHCP_ARP_CACHE_TIMEOUT,      sizeof(uint32_t),      DHCP_OPT_ATOM,      DHCP_OPT_VAL_UINT32,      dhcp_opt_to_network_uint32,      dhcp_opt_to_user_string_uint32,      dhcp_opt_to_internal_string_uint32,      dhcp_opt_from_network_uint32,      dhcp_opt_from_user_string_uint32,      dhcp_opt_from_internal_string_uint32,      dhcp_opt_destroy_atom,    },    /* Ethernet Encapsulation */    { TAG_DHCP_ETHERNET_ENCAPSULATION,      sizeof(uint8_t),      DHCP_OPT_ATOM,      DHCP_OPT_VAL_UINT8,      dhcp_opt_to_network_uint8,      dhcp_opt_to_user_string_uint8,      dhcp_opt_to_internal_string_uint8,      dhcp_opt_from_network_uint8,      dhcp_opt_from_user_string_uint8,      dhcp_opt_from_internal_string_uint8,      dhcp_opt_destroy_atom,    },    /* TCP Default TTL */    { TAG_DHCP_TCP_DEFAULT_TTL,      sizeof(uint8_t),      DHCP_OPT_ATOM,      DHCP_OPT_VAL_UINT8,      dhcp_opt_to_network_uint8,      dhcp_opt_to_user_string_uint8,      dhcp_opt_to_internal_string_uint8,      dhcp_opt_from_network_uint8,      dhcp_opt_from_user_string_uint8,      dhcp_opt_from_internal_string_uint8,      dhcp_opt_destroy_atom,    },    /* TCP Keep Alive Interval */    { TAG_DHCP_TCP_KEEPALIVE_INTERVAL,      sizeof(uint32_t),      DHCP_OPT_ATOM,      DHCP_OPT_VAL_UINT32,      dhcp_opt_to_network_uint32,      dhcp_opt_to_user_string_uint32,      dhcp_opt_to_internal_string_uint32,      dhcp_opt_from_network_uint32,      dhcp_opt_from_user_string_uint32,      dhcp_opt_from_internal_string_uint32,      dhcp_opt_destroy_atom,    },    /* Keep Alive Garbage */    { TAG_DHCP_TCP_KEEPALIVE_GARBAGE,      sizeof(uint8_t),      DHCP_OPT_ATOM,      DHCP_OPT_VAL_UINT8,      dhcp_opt_to_network_uint8,      dhcp_opt_to_user_string_uint8,      dhcp_opt_to_internal_string_uint8,      dhcp_opt_from_network_uint8,      dhcp_opt_from_user_string_uint8,      dhcp_opt_from_internal_string_uint8,      dhcp_opt_destroy_atom,    },    /* NIS Domain */    { TAG_DHCP_NIS_DOMAIN_NAME,      sizeof(int8_t),      DHCP_OPT_STRING,      DHCP_OPT_VAL_INT8,      dhcp_opt_to_network_nvt_string,      dhcp_opt_to_user_string_nvt_string,      dhcp_opt_to_internal_string_nvt_string,      dhcp_opt_from_network_nvt_string,      dhcp_opt_from_user_string_nvt_string,      dhcp_opt_from_internal_string_nvt_string,      dhcp_opt_destroy_string,    },    /* NIS Servers */    { TAG_DHCP_NIS_SERVERS,      IP_ADDR_LEN,      DHCP_OPT_LIST,      DHCP_OPT_VAL_ADDRESS,      dhcp_opt_to_network_list_ip_addr,      dhcp_opt_to_user_string_list_ip_addr,      dhcp_opt_to_internal_string_list_ip_addr,      dhcp_opt_from_network_list_ip_addr,      dhcp_opt_from_user_string_list_ip_addr,      dhcp_opt_from_internal_string_ip_addr,      dhcp_opt_destroy_list,    },    /* NTP Servers */    { TAG_DHCP_NTP_SERVERS,      IP_ADDR_LEN,      DHCP_OPT_LIST,      DHCP_OPT_VAL_ADDRESS,      dhcp_opt_to_network_list_ip_addr,      dhcp_opt_to_user_string_list_ip_addr,      dhcp_opt_to_internal_string_list_ip_addr,      dhcp_opt_from_network_list_ip_addr,      dhcp_opt_from_user_string_list_ip_addr,      dhcp_opt_from_internal_string_list_ip_addr,      dhcp_opt_destroy_list,    },    /* FIXME: this needs to be handled specially.  we actually     * don't because for the time being we don't support any     * vendor specific information. Good place to drop our own     * home rolled options if we want. */    /* Vendor Specific Information */    { TAG_DHCP_VENDOR_SPECIFIC,      sizeof(uint8_t),      DHCP_OPT_ARRAY,      DHCP_OPT_VAL_UINT8,      dhcp_opt_to_network_array_uint8,      dhcp_opt_to_user_string_array_uint8,      dhcp_opt_to_internal_string_array_uint8,      dhcp_opt_from_network_array_uint8,      dhcp_opt_from_user_string_array_uint8,      dhcp_opt_from_internal_string_array_uint8,      dhcp_opt_destroy_array,    },    /* NetBIOS Name Server */    { TAG_DHCP_NETBIOSOTCP_NAME_SERVER,      IP_ADDR_LEN,      DHCP_OPT_LIST,      DHCP_OPT_VAL_ADDRESS,      dhcp_opt_to_network_list_ip_addr,      dhcp_opt_to_user_string_list_ip_addr,      dhcp_opt_to_internal_string_list_ip_addr,      dhcp_opt_from_network_list_ip_addr,      dhcp_opt_from_user_string_list_ip_addr,      dhcp_opt_from_internal_string_list_ip_addr,      dhcp_opt_destroy_list,    },    /* NetBIOS Datagram Distribution Server */    { TAG_DHCP_NETBIOSOTCP_DATAGRAM_SERVER,      IP_ADDR_LEN,      DHCP_OPT_LIST,      DHCP_OPT_VAL_ADDRESS,      dhcp_opt_to_network_list_ip_addr,      dhcp_opt_to_user_string_list_ip_addr,      dhcp_opt_to_internal_string_list_ip_addr,      dhcp_opt_from_network_list_ip_addr,      dhcp_opt_from_user_string_list_ip_addr,      dhcp_opt_from_internal_string_list_ip_addr,      dhcp_opt_destroy_list,    },    /* NetBIOS Datagram Node Type */    { TAG_DHCP_NETBIOSOTCP_NODE_TYPE,      sizeof(uint8_t),      DHCP_OPT_ATOM,      DHCP_OPT_VAL_UINT8,      dhcp_opt_to_network_uint8,      dhcp_opt_to_user_string_uint8,      dhcp_opt_to_internal_string_uint8,      dhcp_opt_from_network_uint8,      dhcp_opt_from_user_string_uint8,      dhcp_opt_from_internal_string_uint8,      dhcp_opt_destroy_atom,    },    /* NetBIOS Scope Option */    { TAG_DHCP_NETBIOSOTCP_SCOPE,      sizeof(int8_t),      DHCP_OPT_STRING,      DHCP_OPT_VAL_INT8,      dhcp_opt_to_network_string,      dhcp_opt_to_user_string_string,      dhcp_opt_to_internal_string_string,      dhcp_opt_from_network_string,      dhcp_opt_from_user_string_string,      dhcp_opt_from_internal_string_string,      dhcp_opt_destroy_atom,    },    /* X-Windows Font Server */    { TAG_DHCP_XWIN_FONT_SERVER,      IP_ADDR_LEN,      DHCP_OPT_LIST,      DHCP_OPT_VAL_ADDRESS,      dhcp_opt_to_network_list_ip_addr,      dhcp_opt_to_user_string_list_ip_addr,      dhcp_opt_to_internal_string_list_ip_addr,      dhcp_opt_from_network_list_ip_addr,      dhcp_opt_from_user_string_list_ip_addr,      dhcp_opt_from_internal_string_list_ip_addr,      dhcp_opt_destroy_list,    },    /* X-Windows Display Manager Server */    { TAG_DHCP_XWIN_DISP_MANAGER_SERVER,      IP_ADDR_LEN,      DHCP_OPT_LIST,      DHCP_OPT_VAL_ADDRESS,      dhcp_opt_to_network_list_ip_addr,      dhcp_opt_to_user_string_list_ip_addr,      dhcp_opt_to_internal_string_list_ip_addr,      dhcp_opt_from_network_list_ip_addr,      dhcp_opt_from_user_string_list_ip_addr,      dhcp_opt_from_internal_string_list_ip_addr,      dhcp_opt_destroy_list,    },    /* Requested IP Address */    { TAG_DHCP_REQUESTED_IP_ADDRESS,      IP_ADDR_LEN,      DHCP_OPT_ATOM,      DHCP_OPT_VAL_ADDRESS,      dhcp_opt_to_network_ip_addr,      dhcp_opt_to_user_string_ip_addr,      dhcp_opt_to_internal_string_ip_addr,      dhcp_opt_from_network_ip_addr,      dhcp_opt_from_user_string_ip_addr,      dhcp_opt_from_internal_string_ip_addr,      dhcp_opt_destroy_atom,    },    /* IP Address Lease Time */    { TAG_DHCP_IP_ADDRESS_LEASE_TIME,      sizeof(uint32_t),      DHCP_OPT_ATOM,      DHCP_OPT_VAL_UINT32,      dhcp_opt_to_network_uint32,      dhcp_opt_to_user_string_uint32,      dhcp_opt_to_internal_string_uint32,      dhcp_opt_from_network_uint32,      dhcp_opt_from_user_string_uint32,      dhcp_opt_from_internal_string_uint32,      dhcp_opt_destroy_atom,    },    /* Option Overload */    { TAG_DHCP_OVERLOAD,      sizeof(uint8_t),      DHCP_OPT_ATOM,      DHCP_OPT_VAL_UINT8,      dhcp_opt_to_network_uint8,      dhcp_opt_to_user_string_uint8,      dhcp_opt_to_internal_string_uint8,      dhcp_opt_from_network_uint8,      dhcp_opt_from_user_string_uint8,      dhcp_opt_from_internal_string_uint8,      dhcp_opt_destroy_atom,    },    /* Message Type */    { TAG_DHCP_MESSAGE_TYPE,      sizeof(uint8_t),      DHCP_OPT_ATOM,      DHCP_OPT_VAL_UINT8,      dhcp_opt_to_network_uint8,      dhcp_opt_to_user_string_uint8,      dhcp_opt_to_internal_string_uint8,      dhcp_opt_from_network_uint8,      dhcp_opt_from_user_string_uint8,      dhcp_opt_from_internal_string_uint8,      dhcp_opt_destroy_atom,    },    /* Server Identifier */    { TAG_DHCP_SERVER_IDENTIFIER,      IP_ADDR_LEN,      DHCP_OPT_ATOM,      DHCP_OPT_VAL_ADDRESS,      dhcp_opt_to_network_ip_addr,      dhcp_opt_to_user_string_ip_addr,      dhcp_opt_to_internal_string_ip_addr,      dhcp_opt_from_network_ip_addr,      dhcp_opt_from_user_string_ip_addr,      dhcp_opt_from_internal_string_ip_addr,      dhcp_opt_destroy_atom,    },    /* FIXME: make a type for this. */    /* Parameter Request List */    { TAG_DHCP_PARAMETERS,      sizeof(uint8_t),      DHCP_OPT_ARRAY,      DHCP_OPT_VAL_UINT8,      dhcp_opt_to_network_array_uint8,      dhcp_opt_to_user_string_array_uint8,      dhcp_opt_to_internal_string_array_uint8,      dhcp_opt_from_network_array_uint8,      dhcp_opt_from_user_string_array_uint8,      dhcp_opt_from_internal_string_array_uint8,      dhcp_opt_destroy_array,    },    /* Message */    { TAG_DHCP_MESSAGE,      sizeof(int8_t),      DHCP_OPT_STRING,      DHCP_OPT_VAL_INT8,      dhcp_opt_to_network_nvt_string,      dhcp_opt_to_user_string_nvt_string,      dhcp_opt_to_internal_string_nvt_string,      dhcp_opt_from_network_nvt_string,      dhcp_opt_from_user_string_nvt_string,      dhcp_opt_from_internal_string_nvt_string,      dhcp_opt_destroy_array,    },    /* Maximum DHCP Message Size */    { TAG_DHCP_MAX_DHCP_SIZE,      sizeof(uint16_t),      DHCP_OPT_ATOM,      DHCP_OPT_VAL_UINT16,      dhcp_opt_to_network_uint16,      dhcp_opt_to_user_string_uint16,      dhcp_opt_to_internal_string_uint16,      dhcp_opt_from_network_uint16,      dhcp_opt_from_user_string_uint16,      dhcp_opt_from_internal_string_uint16,      dhcp_opt_destroy_atom,    },    /* Renewal Time */    { TAG_DHCP_RENEWAL_TIME,      sizeof(uint32_t),      DHCP_OPT_ATOM,      DHCP_OPT_VAL_UINT32,      dhcp_opt_to_network_uint32,      dhcp_opt_to_user_string_uint32,      dhcp_opt_to_internal_string_uint32,      dhcp_opt_from_network_uint32,      dhcp_opt_from_user_string_uint32,      dhcp_opt_from_internal_string_uint32,      dhcp_opt_destroy_atom,    },    /* Rebinding Time */    { TAG_DHCP_REBINDING_TIME,      sizeof(uint32_t),      DHCP_OPT_ATOM,      DHCP_OPT_VAL_UINT32,      dhcp_opt_to_network_uint32,      dhcp_opt_to_user_string_uint32,      dhcp_opt_to_internal_string_uint32,      dhcp_opt_from_network_uint32,      dhcp_opt_from_user_string_uint32,      dhcp_opt_from_internal_string_uint32,      dhcp_opt_destroy_atom,    },    /* Vendor class identifier */    { TAG_DHCP_VENDOR_CLASS_ID,      sizeof(uint8_t),      DHCP_OPT_STRING,      DHCP_OPT_VAL_UINT8,      dhcp_opt_to_network_string,      dhcp_opt_to_user_string_string,      dhcp_opt_to_internal_string_string,      dhcp_opt_from_network_string,      dhcp_opt_from_user_string_string,      dhcp_opt_from_internal_string_string,      dhcp_opt_destroy_atom,    },    /* Client ID */    { TAG_DHCP_CLIENT_ID,      sizeof(uint8_t),      DHCP_OPT_ARRAY,      DHCP_OPT_VAL_UINT8,      dhcp_opt_to_network_array_uint8,      dhcp_opt_to_user_string_array_uint8,      dhcp_opt_to_internal_string_array_uint8,      dhcp_opt_from_network_array_uint8,      dhcp_opt_from_user_string_array_uint8,      dhcp_opt_from_internal_string_array_uint8,      dhcp_opt_destroy_array,    },    /* NIS+ Domain */    { TAG_DHCP_NISPLUS_DOMAIN,      sizeof(int8_t),      DHCP_OPT_STRING,      DHCP_OPT_VAL_INT8,      dhcp_opt_to_network_nvt_string,      dhcp_opt_to_user_string_nvt_string,      dhcp_opt_to_internal_string_nvt_string,      dhcp_opt_from_network_nvt_string,      dhcp_opt_from_user_string_nvt_string,      dhcp_opt_from_internal_string_nvt_string,      dhcp_opt_destroy_atom,    },    /* NIS+ Servers */    { TAG_DHCP_NISPLUS_SERVERS,      IP_ADDR_LEN,      DHCP_OPT_LIST,      DHCP_OPT_VAL_ADDRESS,      dhcp_opt_to_network_list_ip_addr,      dhcp_opt_to_user_string_list_ip_addr,      dhcp_opt_to_internal_string_list_ip_addr,      dhcp_opt_from_network_list_ip_addr,      dhcp_opt_from_user_string_list_ip_addr,      dhcp_opt_from_internal_string_list_ip_addr,      dhcp_opt_destroy_list,    },    /* Mobile IP Home Agent */    { TAG_DHCP_NISPLUS_SERVERS,      IP_ADDR_LEN,      DHCP_OPT_LIST,      DHCP_OPT_VAL_ADDRESS,      dhcp_opt_to_network_list_ip_addr,      dhcp_opt_to_user_string_list_ip_addr,      dhcp_opt_to_internal_string_list_ip_addr,      dhcp_opt_from_network_list_ip_addr,      dhcp_opt_from_user_string_list_ip_addr,      dhcp_opt_from_internal_string_list_ip_addr,      dhcp_opt_destroy_list,    },    /* TFTP Server Name Option */    { TAG_DHCP_TFTP_SERVER,      sizeof(int8_t),      DHCP_OPT_STRING,      DHCP_OPT_VAL_INT8,      dhcp_opt_to_network_string,      dhcp_opt_to_user_string_string,      dhcp_opt_to_internal_string_string,      dhcp_opt_from_network_string,      dhcp_opt_from_user_string_string,      dhcp_opt_from_internal_string_string,      dhcp_opt_destroy_string,    },    /* Boot File Name Option */    { TAG_DHCP_BOOT_FILE_NAME,      sizeof(int8_t),      DHCP_OPT_STRING,      DHCP_OPT_VAL_INT8,      dhcp_opt_to_network_string,      dhcp_opt_to_user_string_string,      dhcp_opt_to_internal_string_string,      dhcp_opt_from_network_string,      dhcp_opt_from_user_string_string,      dhcp_opt_from_internal_string_string,      dhcp_opt_destroy_string,    },    /* FIXME: this option can be legally set to 0     * we need to handle it that way. */    /* IP Home Agent Option */    { TAG_DHCP_IP_HOME_AGENT,      IP_ADDR_LEN,      DHCP_OPT_LIST,      DHCP_OPT_VAL_ADDRESS,      dhcp_opt_to_network_list_ip_addr,      dhcp_opt_to_user_string_list_ip_addr,      dhcp_opt_to_internal_string_list_ip_addr,      dhcp_opt_from_network_list_ip_addr,

⌨️ 快捷键说明

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