static int loadave_store_config(int a, int b, void *c, void *d) { char line[SNMP_MAXBUF_SMALL]; if (laConfigSet > 0) { snprintf(line, SNMP_MAXBUF_SMALL, "pload %.02f %.02f %.02f", maxload[0], maxload[1], maxload[2]); snmpd_store_config(line); } return SNMPERR_SUCCESS; }
static int snmp_enableauthentraps_store (int a, int b, void *c, void *d) { char line[SNMP_MAXBUF_SMALL]; if (snmp_enableauthentrapsset > 0) { snprintf (line, SNMP_MAXBUF_SMALL, "pauthtrapenable %ld", snmp_enableauthentraps); snmpd_store_config (line); } return 0; }
int store_traceRouteResultsTable (int majorID, int minorID, void *serverarg, void *clientarg) { char line[SNMP_MAXBUF]; char *cptr = NULL; size_t tmpint; struct traceRouteResultsTable_data *StorageTmp = NULL; struct header_complex_index *hcindex = NULL; DEBUGMSGTL (("traceRouteResultsTable", "storing data... ")); for (hcindex = traceRouteResultsTableStorage; hcindex != NULL; hcindex = hcindex->next) { StorageTmp = (struct traceRouteResultsTable_data *) hcindex->data; if (StorageTmp->storageType != ST_READONLY) { memset (line, 0, sizeof (line)); strcat (line, "traceRouteResultsTable "); cptr = line + strlen (line); cptr = read_config_store_data (ASN_OCTET_STR, cptr, &StorageTmp->traceRouteCtlOwnerIndex, &StorageTmp->traceRouteCtlOwnerIndexLen); cptr = read_config_store_data (ASN_OCTET_STR, cptr, &StorageTmp->traceRouteCtlTestName, &StorageTmp->traceRouteCtlTestNameLen); cptr = read_config_store_data (ASN_INTEGER, cptr, &StorageTmp->traceRouteResultsOperStatus, &tmpint); cptr = read_config_store_data (ASN_GAUGE, cptr, &StorageTmp->traceRouteResultsCurHopCount, &tmpint); cptr = read_config_store_data (ASN_GAUGE, cptr, &StorageTmp->traceRouteResultsCurProbeCount, &tmpint); cptr = read_config_store_data (ASN_INTEGER, cptr, &StorageTmp->traceRouteResultsIpTgtAddrType, &tmpint); cptr = read_config_store_data (ASN_OCTET_STR, cptr, &StorageTmp->traceRouteResultsIpTgtAddr, &StorageTmp->traceRouteResultsIpTgtAddrLen); cptr = read_config_store_data (ASN_UNSIGNED, cptr, &StorageTmp->traceRouteResultsTestAttempts, &tmpint); cptr = read_config_store_data (ASN_UNSIGNED, cptr, &StorageTmp->traceRouteResultsTestSuccesses, &tmpint); cptr = read_config_store_data (ASN_OCTET_STR, cptr, &StorageTmp->traceRouteResultsLastGoodPath, &StorageTmp->traceRouteResultsLastGoodPathLen); snmpd_store_config (line); } } DEBUGMSGTL (("traceRouteResultsTable", "done.\n")); return SNMPERR_SUCCESS; }
static int system_store(int a, int b, void *c, void *d) { char line[SNMP_MAXBUF_SMALL]; if (sysLocationSet > 0) { snprintf(line, SNMP_MAXBUF_SMALL, "psyslocation %s", sysLocation); snmpd_store_config(line); } if (sysContactSet > 0) { snprintf(line, SNMP_MAXBUF_SMALL, "psyscontact %s", sysContact); snmpd_store_config(line); } if (sysNameSet > 0) { snprintf(line, SNMP_MAXBUF_SMALL, "psysname %s", sysName); snmpd_store_config(line); } return 0; }
int store_lookupResultsTable(int majorID, int minorID, void *serverarg, void *clientarg) { char line[SNMP_MAXBUF]; char *cptr = NULL; size_t tmpint; struct lookupResultsTable_data *StorageTmp = NULL; struct header_complex_index *hcindex = NULL; DEBUGMSGTL(("lookupResultsTable", "storing data... ")); for (hcindex = lookupResultsTableStorage; hcindex != NULL; hcindex = hcindex->next) { StorageTmp = (struct lookupResultsTable_data *) hcindex->data; if (StorageTmp->storagetype != ST_READONLY) { memset(line, 0, sizeof(line)); strcat(line, "lookupResultsTable "); cptr = line + strlen(line); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp->lookupCtlOwnerIndex, &StorageTmp-> lookupCtlOwnerIndexLen); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp->lookupCtlOperationName, &StorageTmp-> lookupCtlOperationNameLen); cptr = read_config_store_data(ASN_UNSIGNED, cptr, &StorageTmp->lookupResultsIndex, &tmpint); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp-> lookupResultsAddressType, &tmpint); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp->lookupResultsAddress, &StorageTmp-> lookupResultsAddressLen); snmpd_store_config(line); } } DEBUGMSGTL(("lookupResultsTable", "done.\n")); return SNMPERR_SUCCESS; }
/* * store_snmpNotifyFilterProfileTable(): * stores .conf file entries needed to configure the mib. */ int store_snmpNotifyFilterProfileTable(int majorID, int minorID, void *serverarg, void *clientarg) { char line[SNMP_MAXBUF]; char *cptr; size_t tmpint; struct snmpNotifyFilterProfileTable_data *StorageTmp; struct header_complex_index *hcindex; DEBUGMSGTL(("snmpNotifyFilterProfileTable", "storing data... ")); for (hcindex = snmpNotifyFilterProfileTableStorage; hcindex != NULL; hcindex = hcindex->next) { StorageTmp = (struct snmpNotifyFilterProfileTable_data *) hcindex->data; if ((StorageTmp->snmpNotifyFilterProfileStorType == ST_NONVOLATILE) || (StorageTmp->snmpNotifyFilterProfileStorType == ST_PERMANENT)) { memset(line, 0, sizeof(line)); strcat(line, "snmpNotifyFilterProfileTable "); cptr = line + strlen(line); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp->snmpTargetParamsName, &StorageTmp-> snmpTargetParamsNameLen); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp-> snmpNotifyFilterProfileName, &StorageTmp-> snmpNotifyFilterProfileNameLen); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp-> snmpNotifyFilterProfileStorType, &tmpint); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp-> snmpNotifyFilterProfileRowStatus, &tmpint); snmpd_store_config(line); } } DEBUGMSGTL(("snmpNotifyFilterProfileTable", "done.\n")); return 0; }
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; }
/* * 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; }
/* * store_expExpressionTable(): * stores .conf file entries needed to configure the mib. */ int store_expObjectTable(int majorID, int minorID, void *serverarg, void *clientarg) { char line[SNMP_MAXBUF]; char *cptr; size_t tmpint; struct expObjectTable_data *StorageTmp; struct header_complex_index *hcindex; DEBUGMSGTL(("expObjectTable", "storing data... ")); for (hcindex = expObjectTableStorage; hcindex != NULL; hcindex = hcindex->next) { StorageTmp = (struct expObjectTable_data *) hcindex->data; if (StorageTmp->storageType == ST_NONVOLATILE) { memset(line, 0, sizeof(line)); strcat(line, "expObjectTable "); cptr = line + strlen(line); /* * expObjectTable */ cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp->expExpressionOwner, &StorageTmp->expExpressionOwnerLen); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp->expExpressionName, &StorageTmp->expExpressionNameLen); cptr = read_config_store_data(ASN_UNSIGNED, cptr, &StorageTmp->expObjectIndex, &tmpint); cptr = read_config_store_data(ASN_OBJECT_ID, cptr, &StorageTmp->expObjectID, &StorageTmp->expObjectIDLen); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp->expObjectIDWildcard, &tmpint); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp->expObjectSampleType, &tmpint); cptr = read_config_store_data(ASN_OBJECT_ID, cptr, &StorageTmp-> expObjectDeltaDiscontinuityID, &StorageTmp-> expObjectDeltaDiscontinuityIDLen); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp-> expObjectDiscontinuityIDWildcard, &tmpint); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp-> expObjectDiscontinuityIDType, &tmpint); cptr = read_config_store_data(ASN_OBJECT_ID, cptr, &StorageTmp->expObjectConditional, &StorageTmp-> expObjectConditionalLen); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp-> expObjectConditionalWildcard, &tmpint); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp->expObjectEntryStatus, &tmpint); snmpd_store_config(line); } } DEBUGMSGTL(("expObjectTable", "storage done\n")); return 0; }
int store_pingResultsTable(int majorID, int minorID, void *serverarg, void *clientarg) { char line[SNMP_MAXBUF]; char *cptr; size_t tmpint; struct pingResultsTable_data *StorageTmp; struct header_complex_index *hcindex; DEBUGMSGTL(("pingResultsTable", "storing data... ")); for (hcindex = pingResultsTableStorage; hcindex != NULL; hcindex = hcindex->next) { StorageTmp = (struct pingResultsTable_data *) hcindex->data; if (StorageTmp->storageType != ST_READONLY) { memset(line, 0, sizeof(line)); strcat(line, "pingResultsTable "); cptr = line + strlen(line); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp->pingCtlOwnerIndex, &StorageTmp->pingCtlOwnerIndexLen); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp->pingCtlTestName, &StorageTmp->pingCtlTestNameLen); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp->pingResultsOperStatus, &tmpint); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp-> pingResultsIpTargetAddressType, &tmpint); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp-> pingResultsIpTargetAddress, &StorageTmp-> pingResultsIpTargetAddressLen); cptr = read_config_store_data(ASN_UNSIGNED, cptr, &StorageTmp->pingResultsMinRtt, &tmpint); cptr = read_config_store_data(ASN_UNSIGNED, cptr, &StorageTmp->pingResultsMaxRtt, &tmpint); cptr = read_config_store_data(ASN_UNSIGNED, cptr, &StorageTmp->pingResultsAverageRtt, &tmpint); cptr = read_config_store_data(ASN_UNSIGNED, cptr, &StorageTmp-> pingResultsProbeResponses, &tmpint); cptr = read_config_store_data(ASN_UNSIGNED, cptr, &StorageTmp->pingResultsSendProbes, &tmpint); cptr = read_config_store_data(ASN_UNSIGNED, cptr, &StorageTmp-> pingResultsRttSumOfSquares, &tmpint); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp-> pingResultsLastGoodProbe, &StorageTmp-> pingResultsLastGoodProbeLen); snmpd_store_config(line); } } DEBUGMSGTL(("pingResultsTable", "done.\n")); return SNMPERR_SUCCESS; }
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; }
/* * store_expExpressionTable(): * stores .conf file entries needed to configure the mib. */ int store_expExpressionTable(int majorID, int minorID, void *serverarg, void *clientarg) { char line[SNMP_MAXBUF]; char *cptr; size_t tmpint; struct expExpressionTable_data *StorageTmp; struct header_complex_index *hcindex; DEBUGMSGTL(("expExpressionTable", "storing data... ")); for (hcindex = expExpressionTableStorage; hcindex != NULL; hcindex = hcindex->next) { StorageTmp = (struct expExpressionTable_data *) hcindex->data; if (StorageTmp->storageType == ST_NONVOLATILE) { memset(line, 0, sizeof(line)); strcat(line, "expExpressionTable "); cptr = line + strlen(line); /* * expExpressionTable */ cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp->expExpressionOwner, &StorageTmp->expExpressionOwnerLen); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp->expExpressionName, &StorageTmp->expExpressionNameLen); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp->expExpression, &StorageTmp->expExpressionLen); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp->expExpressionValueType, &tmpint); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp->expExpressionComment, &StorageTmp-> expExpressionCommentLen); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp-> expExpressionDeltaInterval, &tmpint); cptr = read_config_store_data(ASN_OBJECT_ID, cptr, &StorageTmp->expExpressionPrefix, &StorageTmp-> expExpressionPrefixLen); cptr = read_config_store_data(ASN_UNSIGNED, cptr, &StorageTmp->expExpressionErrors, &tmpint); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp-> expExpressionEntryStatus, &tmpint); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp->have_copied_auth_info, &tmpint); if (StorageTmp->have_copied_auth_info) { cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp->pdu_version, &tmpint); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp->pdu_securityModel, &tmpint); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp->pdu_securityLevel, &tmpint); cptr = read_config_store_data(ASN_OBJECT_ID, cptr, (void *) (&StorageTmp-> pdu_tDomain), &StorageTmp->pdu_tDomainLen); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp->pdu_transport, &StorageTmp->pdu_transportLen); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp->pdu_community, &StorageTmp->pdu_community_len); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp->pdu_securityName, &StorageTmp-> pdu_securityNameLen); } snmpd_store_config(line); } } DEBUGMSGTL(("expExpressionTable", "storage done.\n")); return SNMPERR_SUCCESS; }
int store_traceRouteProbeHistoryTable(int majorID, int minorID, void *serverarg, void *clientarg) { char line[SNMP_MAXBUF]; char *cptr = NULL; size_t tmpint; struct traceRouteProbeHistoryTable_data *StorageTmp = NULL; struct header_complex_index *hcindex = NULL; DEBUGMSGTL(("traceRouteProbeHistoryTable", "storing data... ")); for (hcindex = traceRouteProbeHistoryTableStorage; hcindex != NULL; hcindex = hcindex->next) { StorageTmp = (struct traceRouteProbeHistoryTable_data *) hcindex->data; if (StorageTmp->storageType != ST_READONLY) { memset(line, 0, sizeof(line)); strcat(line, "traceRouteProbeHistoryTable "); cptr = line + strlen(line); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp-> traceRouteCtlOwnerIndex, &StorageTmp-> traceRouteCtlOwnerIndexLen); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp->traceRouteCtlTestName, &StorageTmp-> traceRouteCtlTestNameLen); cptr = read_config_store_data(ASN_UNSIGNED, cptr, &StorageTmp-> traceRouteProbeHistoryIndex, &tmpint); cptr = read_config_store_data(ASN_UNSIGNED, cptr, &StorageTmp-> traceRouteProbeHistoryHopIndex, &tmpint); cptr = read_config_store_data(ASN_UNSIGNED, cptr, &StorageTmp-> traceRouteProbeHistoryProbeIndex, &tmpint); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp-> traceRouteProbeHistoryHAddrType, &tmpint); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp-> traceRouteProbeHistoryHAddr, &StorageTmp-> traceRouteProbeHistoryHAddrLen); cptr = read_config_store_data(ASN_UNSIGNED, cptr, &StorageTmp-> traceRouteProbeHistoryResponse, &tmpint); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp-> traceRouteProbeHistoryStatus, &tmpint); cptr = read_config_store_data(ASN_INTEGER, cptr, &StorageTmp-> traceRouteProbeHistoryLastRC, &tmpint); cptr = read_config_store_data(ASN_OCTET_STR, cptr, &StorageTmp-> traceRouteProbeHistoryTime, &StorageTmp-> traceRouteProbeHistoryTimeLen); snmpd_store_config(line); } } DEBUGMSGTL(("traceRouteProbeHistoryTable", "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; }