- }
-
- r -= 2;
-
-end:
- free(at->data);
- at->data = r;
- at->size = size;
-
-
- return true;
-}
-
-
-
-/* WARNING: attributes codes MUST be in ascending order */
-static const struct attr_handler attrtab[] = {
- ATTR_HANDLER_ENTRY(ATTR_MAC, 6, NULL, NULL),
- ATTR_HANDLER_ENTRY(ATTR_IP, 4, NULL, NULL),
- ATTR_HANDLER_ENTRY(ATTR_NETMASK, 4, NULL, NULL),
- ATTR_HANDLER_ENTRY(ATTR_GATEWAY, 4, NULL, NULL),
- ATTR_HANDLER_ENTRY(ATTR_DHCP, 2, NULL, NULL),
- ATTR_HANDLER_ENTRY(ATTR_RESTART, 1, NULL, NULL),
- ATTR_HANDLER_ENTRY(ATTR_ENCPASS, 4, NULL, NULL),
- ATTR_HANDLER_ENTRY(ATTR_DEFAULTS, 1, NULL, NULL),
- ATTR_HANDLER_ENTRY(ATTR_PORT_STATUS, sizeof(struct attr_port_status), NULL, ports_status_decode),
- ATTR_HANDLER_ENTRY(ATTR_PORT_STATISTICS, sizeof(struct attr_port_stat), NULL, port_stat_decode),
- ATTR_HANDLER_ENTRY(ATTR_STATS_RESET, 1, bool_endecode, bool_endecode),
- ATTR_HANDLER_ENTRY(ATTR_CABLETEST_DO, sizeof(struct attr_cabletest_do), cabletest_do_encode, NULL),
- ATTR_HANDLER_ENTRY(ATTR_CABLETEST_RESULT, 0, cabletest_result_endecode, cabletest_result_endecode),
- ATTR_HANDLER_ENTRY(ATTR_VLAN_TYPE, 1, vlan_type_endecode, vlan_type_endecode),
- ATTR_HANDLER_ENTRY(ATTR_VLAN_PORT_CONF, 0, vlan_port_encode, vlan_port_decode),
- ATTR_HANDLER_ENTRY(ATTR_VLAN_DOT_CONF, 0, vlan_dot_encode, vlan_dot_decode),
- ATTR_HANDLER_ENTRY(ATTR_VLAN_DESTROY, 2, vlan_destroy_encode, NULL),
- ATTR_HANDLER_ENTRY(ATTR_VLAN_PVID, sizeof(struct attr_pvid), pvid_encode, pvid_decode),
- ATTR_HANDLER_ENTRY(ATTR_QOS_TYPE, 1, qos_mode_endecode, qos_mode_endecode),
- ATTR_HANDLER_ENTRY(ATTR_QOS_CONFIG, sizeof(struct attr_qos), qos_endecode, qos_endecode),
- ATTR_HANDLER_ENTRY(ATTR_BITRATE_INPUT, sizeof(struct attr_bitrate), bitrate_encode, bitrate_decode),
- ATTR_HANDLER_ENTRY(ATTR_BITRATE_OUTPUT, sizeof(struct attr_bitrate), bitrate_encode, bitrate_decode),
- ATTR_HANDLER_ENTRY(ATTR_STORM_ENABLE, 1, bool_endecode, bool_endecode),
- ATTR_HANDLER_ENTRY(ATTR_STORM_BITRATE, sizeof(struct attr_bitrate), bitrate_encode, bitrate_decode),
- ATTR_HANDLER_ENTRY(ATTR_MIRROR, 0, mirror_encode, mirror_decode),
- ATTR_HANDLER_ENTRY(ATTR_PORTS_COUNT, 1, NULL, NULL),
- ATTR_HANDLER_ENTRY(ATTR_IGMP_ENABLE_VLAN, sizeof(struct attr_igmp_vlan), igmp_vlan_encode, igmp_vlan_decode),
- ATTR_HANDLER_ENTRY(ATTR_IGMP_BLOCK_UNK, 1, bool_endecode, bool_endecode),
- ATTR_HANDLER_ENTRY(ATTR_IGMP_VALID_V3, 1, bool_endecode, bool_endecode)
-};
-
-
-
-const struct attr_handler* getAttrHandler (unsigned short attrcode)
-{
- const struct attr_handler *ah;
- const unsigned int tab_size = sizeof(attrtab) / sizeof(struct attr_handler);
- unsigned int inf, sup, index;
-
-
- inf = 0;
- sup = tab_size;
- index = tab_size >> 1;
- while (index < sup) {
- ah = &attrtab[index];