/** * Initializes the ipv4InterfaceTable module */ void init_ipv4InterfaceTable(void) { DEBUGMSGTL(("verbose:ipv4InterfaceTable:init_ipv4InterfaceTable", "called\n")); /* * TODO:300:o: Perform ipv4InterfaceTable one-time module initialization. */ /* * we depend on the ifTable, so we put our init in with it * to guarantee order of execution. */ init_ifTable(); /* * last changed should be 0 at startup */ ipv4InterfaceTable_lastChange_set(0); } /* init_ipv4InterfaceTable */
/** * @internal * determine if we want a ifTable row in our container */ void ipv4InterfaceTable_check_entry_for_updates(const ifTable_rowreq_ctx * ift_rrc, netsnmp_interface_entry *entry) { netsnmp_container *c = ipv4InterfaceTable_container_get(); ifTable_rowreq_ctx *ip4if_rrc; int changed = 0; DEBUGMSGTL(("verbose:ipv4InterfaceTable:check_entry_for_updates", "called\n")); /* * do we have a corresponding row? */ ip4if_rrc = CONTAINER_FIND(c, ift_rrc); if (NULL == ip4if_rrc) { /* * no corresponding row. should we have one? */ if ((NULL != entry) && (entry->ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_IPV4)) { /* * yes. */ DEBUGMSGTL(("ipv4InterfaceTable:check_entry_for_updates", "inserted row for %d\n", entry->index)); CONTAINER_INSERT(c, ift_rrc); changed = 1; } } else { /* * found corresponding row. is it still applicable? */ if ((NULL == entry) || (0 == (entry->ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_IPV4))) { /* * no */ DEBUGMSGTL(("ipv4InterfaceTable:check_entry_for_updates", "removed row for %d\n", ift_rrc->data.ifentry->index)); CONTAINER_REMOVE(c, ift_rrc); changed = 1; } else { /* * still applicable. anything changed? */ if ((entry->retransmit_v4 != ift_rrc->data.ifentry->retransmit_v4) || (entry->reasm_max_v4 != ift_rrc->data.ifentry->reasm_max_v4)) { DEBUGMSGTL(("ipv4InterfaceTable:check_entry_for_updates", "row changed for %d\n", ift_rrc->data.ifentry->index)); changed = 1; } } } /* * if something changed, update table last changed */ if (changed) ipv4InterfaceTable_lastChange_set(netsnmp_get_agent_uptime()); }