/** * initialize interface container */ netsnmp_container * netsnmp_access_interface_container_init(u_int flags) { netsnmp_container *container1; DEBUGMSGTL(("access:interface:container", "init\n")); /* * create the containers. one indexed by ifIndex, the other * indexed by ifName. */ container1 = netsnmp_container_find("access_interface:table_container"); if (NULL == container1) return NULL; container1->container_name = strdup("interface container"); if (flags & NETSNMP_ACCESS_INTERFACE_INIT_ADDL_IDX_BY_NAME) { netsnmp_container *container2 = netsnmp_container_find("access_interface_by_name:access_interface:table_container"); if (NULL == container2) return NULL; container2->container_name = strdup("interface name container"); container2->compare = _access_interface_entry_compare_name; netsnmp_container_add_index(container1, container2); } return container1; }
netsnmp_container * netsnmp_access_ipaddress_container_init(u_int flags) { netsnmp_container *container1; DEBUGMSGTL(("access:ipaddress:container", "init\n")); /* * create the containers. one indexed by ifIndex, the other * indexed by ifName. */ container1 = netsnmp_container_find("access_ipaddress:table_container"); if (NULL == container1) { snmp_log(LOG_ERR, "ipaddress primary container not found\n"); return NULL; } container1->container_name = strdup("ia_index"); if (flags & NETSNMP_ACCESS_IPADDRESS_INIT_ADDL_IDX_BY_ADDR) { netsnmp_container *container2 = netsnmp_container_find("ipaddress_addr:access_ipaddress:table_container"); if (NULL == container2) { snmp_log(LOG_ERR, "ipaddress secondary container not found\n"); CONTAINER_FREE(container1); return NULL; } container2->compare = _access_ipaddress_entry_compare_addr; container2->container_name = strdup("ia_addr"); netsnmp_container_add_index(container1, container2); } return container1; }
/************************************************************ * * Initialize the saHpiDomainEventTable table by defining its contents and how it's structured */ void initialize_table_saHpiDomainEventTable(void) { netsnmp_table_registration_info *table_info; if(my_handler) { snmp_log(LOG_ERR, "initialize_table_saHpiDomainEventTable_handler called again\n"); return; } memset(&cb, 0x00, sizeof(cb)); /** create the table structure itself */ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info); /* if your table is read only, it's easiest to change the HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */ my_handler = netsnmp_create_handler_registration("saHpiDomainEventTable", netsnmp_table_array_helper_handler, saHpiDomainEventTable_oid, saHpiDomainEventTable_oid_len, HANDLER_CAN_RWRITE); if (!my_handler || !table_info) { snmp_log(LOG_ERR, "malloc failed in " "initialize_table_saHpiDomainEventTable_handler\n"); return; /** mallocs failed */ } /*************************************************** * Setting up the table's definition */ /* * TODO: add any external indexes here. */ /** TODO: add code for external index(s)! */ /* * internal indexes */ /** index: saHpiDomainId */ netsnmp_table_helper_add_index(table_info, ASN_UNSIGNED); /** index: saHpiDomainEventEntryId */ netsnmp_table_helper_add_index(table_info, ASN_UNSIGNED); /** index: saHpiEventSeverity */ netsnmp_table_helper_add_index(table_info, ASN_INTEGER); table_info->min_column = saHpiDomainEventTable_COL_MIN; table_info->max_column = saHpiDomainEventTable_COL_MAX; /*************************************************** * registering the table with the master agent */ cb.get_value = saHpiDomainEventTable_get_value; cb.container = netsnmp_container_find("saHpiDomainEventTable_primary:" "saHpiDomainEventTable:" "table_container"); netsnmp_container_add_index(cb.container, netsnmp_container_find("saHpiDomainEventTable_secondary:" "saHpiDomainEventTable:" "table_container")); cb.container->next->compare = saHpiDomainEventTable_cmp; cb.can_set = 1; cb.create_row = (UserRowMethod*)saHpiDomainEventTable_create_row; cb.duplicate_row = (UserRowMethod*)saHpiDomainEventTable_duplicate_row; cb.delete_row = (UserRowMethod*)saHpiDomainEventTable_delete_row; cb.row_copy = (Netsnmp_User_Row_Operation *)saHpiDomainEventTable_row_copy; cb.can_activate = (Netsnmp_User_Row_Action *)saHpiDomainEventTable_can_activate; cb.can_deactivate = (Netsnmp_User_Row_Action *)saHpiDomainEventTable_can_deactivate; cb.can_delete = (Netsnmp_User_Row_Action *)saHpiDomainEventTable_can_delete; cb.set_reserve1 = saHpiDomainEventTable_set_reserve1; cb.set_reserve2 = saHpiDomainEventTable_set_reserve2; cb.set_action = saHpiDomainEventTable_set_action; cb.set_commit = saHpiDomainEventTable_set_commit; cb.set_free = saHpiDomainEventTable_set_free; cb.set_undo = saHpiDomainEventTable_set_undo; DEBUGMSGTL(("initialize_table_saHpiDomainEventTable", "Registering table saHpiDomainEventTable " "as a table array\n")); netsnmp_table_container_register(my_handler, table_info, &cb, cb.container, 1); }
/* * Initialize the openserSIPStatusCodesTable table by defining how it is * structured. * * This function is mostly auto-generated. */ void initialize_table_openserSIPStatusCodesTable(void) { netsnmp_table_registration_info *table_info; if(my_handler) { snmp_log(LOG_ERR, "initialize_table_openserSIPStatusCodes" "Table_handler called again\n"); return; } memset(&cb, 0x00, sizeof(cb)); /** create the table structure itself */ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info); my_handler = netsnmp_create_handler_registration( "openserSIPStatusCodesTable", netsnmp_table_array_helper_handler, openserSIPStatusCodesTable_oid, openserSIPStatusCodesTable_oid_len, HANDLER_CAN_RWRITE); if (!my_handler || !table_info) { snmp_log(LOG_ERR, "malloc failed in initialize_table_openserSIP" "StatusCodesTable_handler\n"); return; /** mallocs failed */ } /** index: openserSIPStatusCodeMethod */ netsnmp_table_helper_add_index(table_info, ASN_UNSIGNED); /** index: openserSIPStatusCodeValue */ netsnmp_table_helper_add_index(table_info, ASN_UNSIGNED); table_info->min_column = openserSIPStatusCodesTable_COL_MIN; table_info->max_column = openserSIPStatusCodesTable_COL_MAX; /*************************************************** * registering the table with the master agent */ cb.get_value = openserSIPStatusCodesTable_get_value; cb.container = netsnmp_container_find("openserSIPStatusCodesTable_primary:" "openserSIPStatusCodesTable:" "table_container"); #ifdef openserSIPStatusCodesTable_CUSTOM_SORT netsnmp_container_add_index(cb.container, netsnmp_container_find( "openserSIPStatusCodesTable_custom:" "openserSIPStatusCodesTable:" "table_container")); cb.container->next->compare = openserSIPStatusCodesTable_cmp; #endif cb.can_set = 1; cb.create_row = (UserRowMethod*)openserSIPStatusCodesTable_create_row; cb.duplicate_row = (UserRowMethod*)openserSIPStatusCodesTable_duplicate_row; cb.delete_row = (UserRowMethod*)openserSIPStatusCodesTable_delete_row; cb.row_copy = (Netsnmp_User_Row_Operation *) openserSIPStatusCodesTable_row_copy; cb.can_activate = (Netsnmp_User_Row_Action *) openserSIPStatusCodesTable_can_activate; cb.can_deactivate = (Netsnmp_User_Row_Action *) openserSIPStatusCodesTable_can_deactivate; cb.can_delete = (Netsnmp_User_Row_Action *)openserSIPStatusCodesTable_can_delete; cb.set_reserve1 = openserSIPStatusCodesTable_set_reserve1; cb.set_reserve2 = openserSIPStatusCodesTable_set_reserve2; cb.set_action = openserSIPStatusCodesTable_set_action; cb.set_commit = openserSIPStatusCodesTable_set_commit; cb.set_free = openserSIPStatusCodesTable_set_free; cb.set_undo = openserSIPStatusCodesTable_set_undo; DEBUGMSGTL(("initialize_table_openserSIPStatusCodesTable", "Registering table openserSIPStatusCodesTable " "as a table array\n")); netsnmp_table_container_register(my_handler, table_info, &cb, cb.container, 1); }
/************************************************************ * * Initialize the memTable table by defining its contents and how it's structured */ void initialize_table_memTable(void) { netsnmp_table_registration_info *table_info; if (my_handler) { log_print(LOGN_CRI, "initialize_table_memTable_handler called again\n"); return; } memset(&cb, 0x00, sizeof(cb)); /** create the table structure itself */ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info); /* * if your table is read only, it's easiest to change the * HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */ my_handler = netsnmp_create_handler_registration("memTable", netsnmp_table_array_helper_handler, memTable_oid, memTable_oid_len, HANDLER_CAN_RWRITE); if (!my_handler || !table_info) { log_print(LOGN_CRI, "malloc failed in " "initialize_table_memTable_handler\n"); return; /** mallocs failed */ } /*************************************************** * Setting up the table's definition */ /* * TODO: add any external indexes here. */ /* * internal indexes */ /** index: memIndex */ netsnmp_table_helper_add_index(table_info, ASN_INTEGER); table_info->min_column = memTable_COL_MIN; table_info->max_column = memTable_COL_MAX; /*************************************************** * registering the table with the master agent */ cb.get_value = memTable_get_value; cb.container = netsnmp_container_find("memTable_primary:" "memTable:" "table_container"); #ifdef memTable_IDX2 netsnmp_container_add_index(cb.container, netsnmp_container_find ("memTable_secondary:" "memTable:" "table_container")); cb.container->next->compare = memTable_cmp; #endif #ifdef memTable_SET_HANDLING cb.can_set = 1; #ifdef memTable_ROW_CREATION cb.create_row = (UserRowMethod *) memTable_create_row; #endif cb.duplicate_row = (UserRowMethod *) memTable_duplicate_row; cb.delete_row = (UserRowMethod *) memTable_delete_row; cb.row_copy = (Netsnmp_User_Row_Operation *) memTable_row_copy; cb.can_delete = (Netsnmp_User_Row_Action *) memTable_can_delete; cb.set_reserve1 = memTable_set_reserve1; cb.set_reserve2 = memTable_set_reserve2; cb.set_action = memTable_set_action; cb.set_commit = memTable_set_commit; cb.set_free = memTable_set_free; cb.set_undo = memTable_set_undo; #endif DEBUGMSGTL(("initialize_table_memTable", "Registering table memTable " "as a table array\n")); netsnmp_table_container_register(my_handler, table_info, &cb, cb.container, 1); }