void netsnmp_access_udp_endpoint_container_free(netsnmp_container *container, u_int free_flags) { DEBUGMSGTL(("access:udp_endpoint:container", "free\n")); if (NULL == container) { snmp_log(LOG_ERR, "invalid container for netsnmp_access_udp_endpoint_free\n"); return; } if(! (free_flags & NETSNMP_ACCESS_UDP_ENDPOINT_FREE_DONT_CLEAR)) { /* * free all items. */ CONTAINER_CLEAR(container, (netsnmp_container_obj_func*) netsnmp_access_udp_endpoint_entry_free, NULL); } if(! (free_flags & NETSNMP_ACCESS_UDP_ENDPOINT_FREE_KEEP_CONTAINER)) CONTAINER_FREE(container); }
/** * @internal */ static void _cache_free(netsnmp_cache *cache, void *magic) { netsnmp_container *container; DEBUGMSGTL(("internal:dot11ConfTotalTrapGroupTable:_cache_free","called\n")); if((NULL == cache) || (NULL == cache->magic)) { snmp_log(LOG_ERR, "invalid cache in dot11ConfTotalTrapGroupTable_cache_free\n"); return; } container = (netsnmp_container*)cache->magic; /* * call user code */ dot11ConfTotalTrapGroupTable_cache_free(container); /* * free all items. inefficient, but easy. */ CONTAINER_CLEAR(container, (netsnmp_container_obj_func *)_cache_item_free, NULL); } /* _cache_free */
/* * free a buffer * dontcare param is there so this function can be passed directly * to CONTAINER_FOR_EACH. */ static void _sql_buf_free(sql_buf *sqlb, void* dontcare) { if (NULL == sqlb) return; /** do varbinds first */ if (sqlb->varbinds) { CONTAINER_CLEAR(sqlb->varbinds, (netsnmp_container_obj_func*)_sql_vb_buf_free, NULL); CONTAINER_FREE(sqlb->varbinds); } SNMP_FREE(sqlb->host); SNMP_FREE(sqlb->oid); SNMP_FREE(sqlb->user); SNMP_FREE(sqlb->context); SNMP_FREE(sqlb->security_name); SNMP_FREE(sqlb->context_engine); SNMP_FREE(sqlb->security_engine); SNMP_FREE(sqlb->transport); free(sqlb); }
void netsnmp_swrun_container_free_items(netsnmp_container *container) { DEBUGMSGTL(("swrun:container", "free_items\n")); if (NULL == container) { snmp_log(LOG_ERR, "invalid container for netsnmp_swrun_container_free_items\n"); return; } /* * free all items. */ CONTAINER_CLEAR(container, (netsnmp_container_obj_func*)_swrun_entry_release, NULL); }
/** * @internal */ static void _cache_free(netsnmp_cache * cache, void *magic) { netsnmp_container *container; DEBUGMSGTL(("internal:sctpAssocTable:_cache_free", "called\n")); if ((NULL == cache) || (NULL == cache->magic)) { snmp_log(LOG_ERR, "invalid cache in sctpAssocTable_cache_free\n"); return; } container = (netsnmp_container *) cache->magic; /* * empty (but don't free) cache here */ CONTAINER_CLEAR(container, (netsnmp_container_obj_func *) sctpAssocTable_freeEntry_cb, NULL); } /* _cache_free */
void netsnmp_access_systemstats_container_free(netsnmp_container *container, u_int free_flags) { DEBUGMSGTL(("access:systemstats:container", "free\n")); if (NULL == container) { snmp_log(LOG_ERR, "invalid container for netsnmp_access_systemstats_free\n"); return; } if(! (free_flags & NETSNMP_ACCESS_SYSTEMSTATS_FREE_DONT_CLEAR)) { /* * free all items. */ CONTAINER_CLEAR(container, (netsnmp_container_obj_func*)_entry_release, NULL); } CONTAINER_FREE(container); }
/** * @internal */ static void _container_free(netsnmp_container *container) { DEBUGMSGTL(("internal:dot11SsidTeminalTable:_container_free","called\n")); if (NULL == container) { snmp_log(LOG_ERR, "invalid container in dot11SsidTeminalTable_container_free\n"); return; } /* * call user code */ dot11SsidTeminalTable_container_free(container); /* * free all items. inefficient, but easy. */ CONTAINER_CLEAR(container, (netsnmp_container_obj_func *)_container_item_free, NULL); } /* _container_free */
void netsnmp_access_tcpconn_container_free(netsnmp_container *container, u_int free_flags) { DEBUGMSGTL(("access:tcpconn:container", "free\n")); if (NULL == container) { snmp_log(LOG_ERR, "invalid container for netsnmp_access_tcpconn_free\n"); return; } if(! (free_flags & NETSNMP_ACCESS_TCPCONN_FREE_DONT_CLEAR)) { /* * free all items. */ CONTAINER_CLEAR(container, (netsnmp_container_obj_func*)_access_tcpconn_entry_release, NULL); } if(! (free_flags & NETSNMP_ACCESS_TCPCONN_FREE_KEEP_CONTAINER)) CONTAINER_FREE(container); }
/* * process (save) queued items to sql database. * * dontcare & meeither are dummy params so this function can be used * as a netsnmp_alarm callback function. */ static void _sql_process_queue(u_int dontcare, void *meeither) { int rc; /** bail if the queue is empty */ if( 0 == CONTAINER_SIZE(_sql.queue)) return; DEBUGMSGT(("sql:process", "processing %d queued traps\n", (int)CONTAINER_SIZE(_sql.queue))); /* * if we don't have a database connection, try to reconnect. We * don't care if we fail - traps will be logged in that case. */ if (0 == _sql.connected) { DEBUGMSGT(("sql:process", "no sql connection; reconnecting\n")); (void) netsnmp_mysql_connect(); } CONTAINER_FOR_EACH(_sql.queue, (netsnmp_container_obj_func*)_sql_save, NULL); if (_sql.connected) { rc = mysql_commit(_sql.conn); if (rc) { /* nuts... now what? */ netsnmp_sql_error("commit failed"); CONTAINER_FOR_EACH(_sql.queue, (netsnmp_container_obj_func*)_sql_log, NULL); } } CONTAINER_CLEAR(_sql.queue, (netsnmp_container_obj_func*)_sql_buf_free, NULL); }
void shutdown_sysORTable(void) { #ifdef USING_MIBII_SYSTEM_MIB_MODULE if (system_module_count-- == 3) UNREGISTER_SYSOR_TABLE(system_module_oid, system_module_oid_len); #endif snmp_unregister_callback(SNMP_CALLBACK_APPLICATION, SNMPD_CALLBACK_UNREG_SYSOR, unregister_cb, NULL, 1); snmp_unregister_callback(SNMP_CALLBACK_APPLICATION, SNMPD_CALLBACK_REG_SYSOR, register_cb, NULL, 1); if (table) CONTAINER_CLEAR(table, netsnmp_container_simple_free, NULL); netsnmp_container_table_unregister(sysORTable_reg); sysORTable_reg = NULL; table = NULL; netsnmp_table_registration_info_free(sysORTable_table_info); sysORTable_table_info = NULL; netsnmp_unregister_handler(sysORLastChange_reg); sysORLastChange_reg = NULL; }
void sctpLookupRemPortTable_container_clear(netsnmp_container *container) { CONTAINER_CLEAR(container, sctpLookupRemPortTable_entry_clear, NULL); }
void sctpAssocTable_container_clear(netsnmp_container *container) { CONTAINER_CLEAR(container, sctpAssocTable_entry_clear, NULL); }