void channelList_free(netsnmp_cache *cache, void *magic) { netsnmp_tdata_row *row = netsnmp_tdata_row_first(ch_table); /* Delete table rows one by one */ while (row) { netsnmp_tdata_remove_and_delete_row(ch_table, row); switch_safe_free(row->data); row = netsnmp_tdata_row_first(ch_table); } }
long _expExpression_countEntries(void) { struct expExpression *entry; netsnmp_tdata_row *row; long count = 0; for (row = netsnmp_tdata_row_first(expr_table_data); row; row = netsnmp_tdata_row_next(expr_table_data, row)) { entry = (struct expExpression *)row->data; count += entry->count; } return count; }
long _mteTrigger_countEntries(void) { struct mteTrigger *entry; netsnmp_tdata_row *row; long count = 0; for (row = netsnmp_tdata_row_first(trigger_table_data); row; row = netsnmp_tdata_row_next(trigger_table_data, row)) { entry = (struct mteTrigger *)row->data; count += entry->count; } return count; }
int store_mteOTable(int majorID, int minorID, void *serverarg, void *clientarg) { char line[SNMP_MAXBUF]; char *cptr, *cp; void *vp; size_t tint; netsnmp_tdata_row *row; struct mteObject *entry; DEBUGMSGTL(("disman:event:conf", "Storing mteObjectTable config:\n")); for (row = netsnmp_tdata_row_first( objects_table_data ); row; row = netsnmp_tdata_row_next( objects_table_data, row )) { /* * Skip entries that were set up via static config directives */ entry = (struct mteObject *)netsnmp_tdata_row_entry( row ); if ( entry->flags & MTE_OBJECT_FLAG_FIXED ) continue; DEBUGMSGTL(("disman:event:conf", " Storing (%s %s %ld)\n", entry->mteOwner, entry->mteOName, entry->mteOIndex)); memset(line, 0, sizeof(line)); strcat(line, "_mteOTable "); cptr = line + strlen(line); cp = entry->mteOwner; tint = strlen( cp ); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &cp, &tint ); cp = entry->mteOName; tint = strlen( cp ); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &cp, &tint ); cptr = read_config_store_data(ASN_UNSIGNED, cptr, &entry->mteOIndex, NULL); vp = entry->mteObjectID; cptr = read_config_store_data(ASN_OBJECT_ID, cptr, &vp, &entry->mteObjectID_len); tint = entry->flags & (MTE_OBJECT_FLAG_WILD|MTE_OBJECT_FLAG_ACTIVE); cptr = read_config_store_data(ASN_UNSIGNED, cptr, &tint, NULL); snmpd_store_config(line); } DEBUGMSGTL(("disman:event:conf", " done.\n")); return SNMPERR_SUCCESS; }
void _mteEvent_dump (void) { struct mteEvent *entry; netsnmp_tdata_row *row; int i = 0; for (row = netsnmp_tdata_row_first (event_table_data); row; row = netsnmp_tdata_row_next (event_table_data, row)) { entry = (struct mteEvent *) row->data; DEBUGMSGTL (("disman:event:dump", "EventTable entry %d: ", i)); DEBUGMSGOID (("disman:event:dump", row->oid_index.oids, row->oid_index.len)); DEBUGMSG (("disman:event:dump", "(%s, %s)", row->indexes->val.string, row->indexes->next_variable->val.string)); DEBUGMSG (("disman:event:dump", ": %p, %p\n", row, entry)); i++; } DEBUGMSGTL (("disman:event:dump", "EventTable %d entries\n", i)); }
/* * Save dynamically-configured schedTable entries into persistent storage */ int store_schedTable(int majorID, int minorID, void *serverarg, void *clientarg) { char line[SNMP_MAXBUF]; char time_bits[22]; /* schedWeekDay..schedMinute */ char *cptr, *cp; void *vp; size_t tint; netsnmp_tdata_row *row; struct schedTable_entry *entry; DEBUGMSGTL(( "disman:schedule:conf", "Storing schedTable:\n")); for (row = netsnmp_tdata_row_first( schedule_table ); row; row = netsnmp_tdata_row_next( schedule_table, row )) { if (!row->data) continue; entry = (struct schedTable_entry *)row->data; /* * Only save (dynamically-created) 'nonVolatile' entries * (XXX - what about dynamic 'permanent' entries ??) */ if (entry->schedStorageType != ST_NONVOLATILE ) continue; DEBUGMSGTL(( "disman:schedule:conf", " Storing (%s, %s)\n", entry->schedOwner, entry->schedName)); memset(line, 0, sizeof(line)); strcpy(line, "_schedTable "); cptr = line + strlen(line); cp = entry->schedOwner; tint = strlen( cp ); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &cp, &tint ); cp = entry->schedName; tint = strlen( cp ); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &cp, &tint ); cp = entry->schedDescr; tint = strlen( cp ); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &cp, &tint ); tint = entry->schedInterval; cptr = read_config_store_data(ASN_UNSIGNED, cptr, &tint, NULL ); /* Combine all the timed bits into a single field */ time_bits[0] = entry->schedWeekDay; time_bits[1] = entry->schedMonth[0]; time_bits[2] = entry->schedMonth[1]; time_bits[11] = entry->schedHour[0]; time_bits[12] = entry->schedHour[1]; time_bits[13] = entry->schedHour[2]; memcpy(time_bits+3, entry->schedDay, 8); memcpy(time_bits+14, entry->schedMinute, 8); vp = time_bits; tint = 22; cptr = read_config_store_data(ASN_OCTET_STR, cptr, &vp, &tint ); cp = entry->schedContextName; tint = strlen( cp ); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &cp, &tint ); vp = entry->schedVariable; tint = entry->schedVariable_len; cptr = read_config_store_data(ASN_OBJECT_ID, cptr, &vp, &tint ); tint = entry->schedValue; cptr = read_config_store_data(ASN_INTEGER, cptr, &tint, NULL ); tint = entry->schedType; cptr = read_config_store_data(ASN_UNSIGNED, cptr, &tint, NULL ); tint = entry->flags /* & WHAT ?? */; cptr = read_config_store_data(ASN_UNSIGNED, cptr, &tint, NULL ); /* XXX - Need to store the 'iquery' access information */ snmpd_store_config(line); } DEBUGMSGTL(( "disman:schedule:conf", " done.\n")); return SNMPERR_SUCCESS; }
struct expExpression * expExpression_getFirstEntry( void ) { return (struct expExpression *) netsnmp_tdata_row_entry(netsnmp_tdata_row_first(expr_table_data)); }
int store_expETable(int majorID, int minorID, void *serverarg, void *clientarg) { char line[SNMP_MAXBUF]; char *cptr; void *vp; size_t tint; netsnmp_tdata_row *row; struct expExpression *entry; DEBUGMSGTL(("disman:expr:conf", "Storing expExpressionTable config:\n")); for (row = netsnmp_tdata_row_first( expr_table_data ); row; row = netsnmp_tdata_row_next( expr_table_data, row )) { /* * Skip entries that were set up via static config directives */ entry = (struct expExpression *)netsnmp_tdata_row_entry( row ); if ( entry->flags & EXP_FLAG_FIXED ) continue; DEBUGMSGTL(("disman:expr:conf", " Storing (%s %s)\n", entry->expOwner, entry->expName)); /* * Save the basic expExpression entry */ memset(line, 0, sizeof(line)); strcat(line, "_expETable "); cptr = line + strlen(line); vp = entry->expOwner; tint = strlen( vp ); cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint ); vp = entry->expName; tint = strlen( vp ); cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint ); vp = entry->expExpression; tint = strlen( vp ); cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint ); tint = entry->expValueType; cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL ); vp = entry->expComment; tint = strlen( vp ); cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint ); tint = entry->expDeltaInterval; cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL ); vp = entry->expPrefix; tint = entry->expPrefix_len; cptr = read_config_store_data( ASN_OBJECT_ID, cptr, &vp, &tint ); tint = entry->flags; cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL ); /* XXX - Need to store the 'iquery' access information */ snmpd_store_config(line); } DEBUGMSGTL(("disman:expr:conf", " done.\n")); return SNMPERR_SUCCESS; }
int store_mteETable(int majorID, int minorID, void *serverarg, void *clientarg) { char line[SNMP_MAXBUF]; char *cptr, *cp; void *vp; size_t tint; netsnmp_tdata_row *row; struct mteEvent *entry; DEBUGMSGTL(("disman:event:conf", "Storing mteEventTable config:\n")); for (row = netsnmp_tdata_row_first( event_table_data ); row; row = netsnmp_tdata_row_next( event_table_data, row )) { /* * Skip entries that were set up via static config directives */ entry = (struct mteEvent *)netsnmp_tdata_row_entry( row ); if ( entry->flags & MTE_EVENT_FLAG_FIXED ) continue; DEBUGMSGTL(("disman:event:conf", " Storing (%s %s)\n", entry->mteOwner, entry->mteEName)); /* * Save the basic mteEventTable entry... */ memset(line, 0, sizeof(line)); strcat(line, "_mteETable "); cptr = line + strlen(line); cp = entry->mteOwner; tint = strlen( cp ); cptr = read_config_store_data( ASN_OCTET_STR, cptr, &cp, &tint ); cp = entry->mteEName; tint = strlen( cp ); cptr = read_config_store_data( ASN_OCTET_STR, cptr, &cp, &tint ); cp = entry->mteEventComment; tint = strlen( cp ); cptr = read_config_store_data( ASN_OCTET_STR, cptr, &cp, &tint ); /* ... (but skip the mteEventAction field)... */ tint = entry->flags & (MTE_EVENT_FLAG_ENABLED|MTE_EVENT_FLAG_ACTIVE); cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL ); /* XXX - Need to store the 'iquery' access information */ snmpd_store_config(line); /* * ... then save Notify and/or Set entries separately * (The mteEventAction bits will be set when these are read in). */ if ( entry->mteEventActions & MTE_EVENT_NOTIFICATION ) { memset(line, 0, sizeof(line)); strcat(line, "_mteENotTable "); cptr = line + strlen(line); cp = entry->mteOwner; tint = strlen( cp ); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &cp, &tint ); cp = entry->mteEName; tint = strlen( cp ); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &cp, &tint ); vp = entry->mteNotification; cptr = read_config_store_data(ASN_OBJECT_ID, cptr, &vp, &entry->mteNotification_len); cp = entry->mteNotifyOwner; tint = strlen( cp ); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &cp, &tint ); cp = entry->mteNotifyObjects; tint = strlen( cp ); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &cp, &tint ); snmpd_store_config(line); } if ( entry->mteEventActions & MTE_EVENT_SET ) { memset(line, 0, sizeof(line)); strcat(line, "_mteESetTable "); cptr = line + strlen(line); cp = entry->mteOwner; tint = strlen( cp ); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &cp, &tint ); cp = entry->mteEName; tint = strlen( cp ); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &cp, &tint ); vp = entry->mteSetOID; cptr = read_config_store_data(ASN_OBJECT_ID, cptr, &vp, &entry->mteSetOID_len); tint = entry->mteSetValue; cptr = read_config_store_data(ASN_INTEGER, cptr, &tint, NULL); cp = entry->mteSetTarget; tint = strlen( cp ); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &cp, &tint ); cp = entry->mteSetContext; tint = strlen( cp ); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &cp, &tint ); tint = entry->flags & (MTE_SET_FLAG_OBJWILD|MTE_SET_FLAG_CTXWILD); cptr = read_config_store_data(ASN_UNSIGNED, cptr, &tint, NULL); snmpd_store_config(line); } } DEBUGMSGTL(("disman:event:conf", " done.\n")); return SNMPERR_SUCCESS; }
int store_expOTable(int majorID, int minorID, void *serverarg, void *clientarg) { char line[SNMP_MAXBUF]; char *cptr; void *vp; size_t tint; netsnmp_tdata_row *row; struct expObject *entry; DEBUGMSGTL(("disman:expr:conf", "Storing expObjectTable config:\n")); for (row = netsnmp_tdata_row_first( expObject_table_data ); row; row = netsnmp_tdata_row_next( expObject_table_data, row )) { /* * Skip entries that were set up via static config directives */ entry = (struct expObject *)netsnmp_tdata_row_entry( row ); if ( entry->flags & EXP_OBJ_FLAG_FIXED ) continue; DEBUGMSGTL(("disman:expr:conf", " Storing (%s %s %d)\n", entry->expOwner, entry->expName, entry->expObjectIndex)); /* * Save the basic expObject entry, indexes... */ memset(line, 0, sizeof(line)); strcat(line, "_expOTable "); cptr = line + strlen(line); vp = entry->expOwner; tint = strlen( vp ); cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint ); vp = entry->expName; tint = strlen( vp ); cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint ); tint = entry->expObjectIndex; cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL ); /* * ... and column values. */ vp = entry->expObjectID; tint = entry->expObjectID_len; cptr = read_config_store_data( ASN_OBJECT_ID, cptr, &vp, &tint ); tint = entry->expObjectSampleType; cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL ); vp = entry->expObjDeltaD; tint = entry->expObjDeltaD_len; cptr = read_config_store_data( ASN_OBJECT_ID, cptr, &vp, &tint ); tint = entry->expObjDiscontinuityType; cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL ); vp = entry->expObjCond; tint = entry->expObjCond_len; cptr = read_config_store_data( ASN_OBJECT_ID, cptr, &vp, &tint ); tint = entry->flags; cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL ); snmpd_store_config(line); } DEBUGMSGTL(("disman:expr:conf", " done.\n")); return SNMPERR_SUCCESS; }