📄 traceroutectltable.c
字号:
StorageNew->traceRouteCtlByPassRouteTable = 2; StorageNew->traceRouteCtlDataSize = 0; StorageNew->traceRouteCtlTimeOut = 3; StorageNew->traceRouteCtlProbesPerHop = 3; StorageNew->traceRouteCtlPort = 33434; StorageNew->traceRouteCtlMaxTtl = 30; StorageNew->traceRouteCtlDSField = 0; StorageNew->traceRouteCtlSourceAddressType = 0; StorageNew->traceRouteCtlSourceAddress = strdup(""); StorageNew->traceRouteCtlSourceAddressLen = 0; StorageNew->traceRouteCtlIfIndex = 0; StorageNew->traceRouteCtlMiscOptions = strdup(""); StorageNew->traceRouteCtlMiscOptionsLen = 0; StorageNew->traceRouteCtlMaxFailures = 5; StorageNew->traceRouteCtlDontFragment = 2; StorageNew->traceRouteCtlInitialTtl = 1; StorageNew->traceRouteCtlFrequency = 0; StorageNew->traceRouteCtlStorageType = ST_NONVOLATILE; StorageNew->traceRouteCtlAdminStatus = 2; StorageNew->traceRouteCtlDescr = (char *) malloc(strlen("00") + 1); if (StorageNew->traceRouteCtlDescr == NULL) { exit(1); } memcpy(StorageNew->traceRouteCtlDescr, "00", strlen("00") + 1); StorageNew->traceRouteCtlDescr[strlen("00")] = '\0'; StorageNew->traceRouteCtlDescrLen = strlen(StorageNew->traceRouteCtlDescr); StorageNew->traceRouteCtlMaxRows = 50; StorageNew->traceRouteCtlTrapGeneration = strdup(""); StorageNew->traceRouteCtlTrapGenerationLen = 0; StorageNew->traceRouteCtlCreateHopsEntries = 2; StorageNew->traceRouteCtlType = calloc(1, sizeof(oid) * sizeof(2)); /* 0.0 */ StorageNew->traceRouteCtlTypeLen = 2; StorageNew->traceRouteResults = NULL; StorageNew->traceRouteProbeHis = NULL; StorageNew->traceRouteHops = NULL; StorageNew->storageType = ST_NONVOLATILE; /* StorageNew->traceRouteProbeHistoryMaxIndex=0; */ return StorageNew;}/* * traceRouteCtlTable_add(): adds a structure node to our data set */inttraceRouteCtlTable_add(struct traceRouteCtlTable_data *thedata){ netsnmp_variable_list *vars = NULL; DEBUGMSGTL(("traceRouteCtlTable", "adding data... ")); /* * add the index variables to the varbind list, which is * used by header_complex to index the data */ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlOperationName */ if (header_complex_add_data(&traceRouteCtlTableStorage, vars, thedata) == NULL) { vars = NULL; return SNMPERR_GENERR; } else { DEBUGMSGTL(("traceRouteCtlTable", "registered an entry\n")); DEBUGMSGTL(("traceRouteCtlTable", "done.\n")); vars = NULL; return SNMPERR_SUCCESS; }}inttraceRouteResultsTable_add(struct traceRouteCtlTable_data *thedata){ netsnmp_variable_list *vp = NULL; netsnmp_variable_list *vars_list = NULL; struct traceRouteResultsTable_data *p = NULL; p = thedata->traceRouteResults; if (thedata->traceRouteResults != NULL) { snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlOwnerIndex, p->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlTestName, p->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */ DEBUGMSGTL(("traceRouteResultsTable", "adding data... ")); /* * add the index variables to the varbind list, which is * used by header_complex to index the data */ header_complex_add_data(&traceRouteResultsTableStorage, vars_list, p); DEBUGMSGTL(("traceRouteResultsTable", "out finished\n")); vars_list = NULL; DEBUGMSGTL(("traceRouteResultsTable", "done.\n")); return SNMPERR_SUCCESS; } else { vars_list = NULL; DEBUGMSGTL(("traceRouteResultsTable", "error.\n")); return SNMP_ERR_INCONSISTENTNAME; }}inttraceRouteProbeHistoryTable_add(struct traceRouteProbeHistoryTable_data *thedata){ netsnmp_variable_list *vars_list = NULL; if (thedata != NULL) { snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteProbeHistoryIndex, sizeof(thedata->traceRouteProbeHistoryIndex)); /* traceRouteProbeHistoryIndex */ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteProbeHistoryHopIndex, sizeof(thedata->traceRouteProbeHistoryHopIndex)); /* traceRouteProbeHistoryHopIndex */ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteProbeHistoryProbeIndex, sizeof(thedata->traceRouteProbeHistoryProbeIndex)); /* traceRouteProbeHistoryProbeIndex */ DEBUGMSGTL(("traceRouteProbeHistoryTable", "adding data... ")); /* * add the index variables to the varbind list, which is * used by header_complex to index the data */ if (header_complex_add_data (&traceRouteProbeHistoryTableStorage, vars_list, thedata) == NULL) { vars_list = NULL; return SNMP_ERR_INCONSISTENTNAME; } else { DEBUGMSGTL(("traceRouteProbeHistoryTable", "out finished\n")); vars_list = NULL; DEBUGMSGTL(("traceRouteProbeHistoryTable", "done.\n")); return SNMPERR_SUCCESS; } } else { return SNMP_ERR_INCONSISTENTNAME; }}inttraceRouteProbeHistoryTable_addall(struct traceRouteCtlTable_data *thedata){ netsnmp_variable_list *vars_list = NULL; struct traceRouteProbeHistoryTable_data *p = NULL; p = thedata->traceRouteProbeHis; if (thedata->traceRouteProbeHis != NULL) do { snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlOwnerIndex, p->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlTestName, p->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &p->traceRouteProbeHistoryIndex, sizeof(p->traceRouteProbeHistoryIndex)); /* traceRouteProbeHistoryIndex */ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &p->traceRouteProbeHistoryHopIndex, sizeof(p->traceRouteProbeHistoryHopIndex)); /* traceRouteProbeHistoryHopIndex */ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &p->traceRouteProbeHistoryProbeIndex, sizeof(p->traceRouteProbeHistoryProbeIndex)); /* traceRouteProbeHistoryProbeIndex */ DEBUGMSGTL(("traceRouteProbeHistoryTable", "adding data... ")); /* * add the index variables to the varbind list, which is * used by header_complex to index the data */ if (header_complex_add_data (&traceRouteProbeHistoryTableStorage, vars_list, p) == NULL) { vars_list = NULL; return SNMP_ERR_INCONSISTENTNAME; } else { struct header_complex_index *temp = NULL; temp = traceRouteProbeHistoryTableStorage; if (traceRouteProbeHistoryTableStorage != NULL) do { DEBUGMSGTL(("traceRouteProbeHistoryTable", "adding data,vars_oid=%u\n ", temp->name)); DEBUGMSGTL(("traceRouteProbeHistoryTable", "adding data,vars_oid=%d\n ", temp->namelen)); temp = temp->next; } while (temp != NULL); DEBUGMSGTL(("traceRouteProbeHistoryTable", "out finished\n")); DEBUGMSGTL(("traceRouteProbeHistoryTable", "done.\n")); vars_list = NULL; return SNMPERR_SUCCESS; } p = p->next; } while (p != NULL); else { return SNMP_ERR_INCONSISTENTNAME; }}inttraceRouteHopsTable_add(struct traceRouteHopsTable_data *thedata){ netsnmp_variable_list *vars_list = NULL; if (thedata != NULL) { snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteHopsHopIndex, sizeof(thedata->traceRouteHopsHopIndex)); /* traceRouteHopsHopIndex */ DEBUGMSGTL(("traceRouteHopsTable", "adding data... ")); /* * add the index variables to the varbind list, which is * used by header_complex to index the data */ if (header_complex_add_data (&traceRouteHopsTableStorage, vars_list, thedata) == NULL) { vars_list = NULL; return SNMP_ERR_INCONSISTENTNAME; } else { DEBUGMSGTL(("traceRouteHopsTable", "out finished\n")); DEBUGMSGTL(("traceRouteHopsTable", "done.\n")); vars_list = NULL; return SNMPERR_SUCCESS; } }}inttraceRouteHopsTable_addall(struct traceRouteCtlTable_data *thedata){ netsnmp_variable_list *vars_list = NULL; struct traceRouteHopsTable_data *p = NULL; vars_list = NULL; p = thedata->traceRouteHops; if (thedata->traceRouteHops != NULL) { do { snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlOwnerIndex, p->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlTestName, p->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &p->traceRouteHopsHopIndex, sizeof(p->traceRouteHopsHopIndex)); /* traceRouteHopsHopIndex */ DEBUGMSGTL(("traceRouteHopsTable", "adding data... ")); /* * add the index variables to the varbind list, which is * used by header_complex to index the data */ if (header_complex_add_data (&traceRouteHopsTableStorage, vars_list, p) == NULL) { vars_list = NULL; return SNMP_ERR_INCONSISTENTNAME; } else { struct header_complex_index *temp = NULL; temp = traceRouteHopsTableStorage; if (traceRouteHopsTableStorage != NULL) do { DEBUGMSGTL(("traceRouteProbeHistoryTable", "adding data,vars_oid=%u\n ", temp->name)); DEBUGMSGTL(("traceRouteProbeHistoryTable", "adding data,vars_oid=%d\n ", temp->namelen)); temp = temp->next; } while (temp != NULL); DEBUGMSGTL(("traceRouteHopsTable", "out finished\n")); vars_list = NULL; } p = p->next; } while (p != NULL); DEBUGMSGTL(("traceRouteHopsTable", "done.\n")); return SNMPERR_SUCCESS; } else { return SNMP_ERR_INCONSISTENTNAME; }}unsigned longtraceRouteProbeHistoryTable_count(struct traceRouteCtlTable_data *thedata){ struct header_complex_index *hciptr2 = NULL; netsnmp_variable_list *vars = NULL; oid newoid[MAX_OID_LEN]; size_t newoid_len; unsigned long count = 0; snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */ header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars); vars = NULL; for (hciptr2 = traceRouteProbeHistoryTableStorage; hciptr2 != NULL; hciptr2 = hciptr2->next) { if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len) == 0) { count = count + 1; } } return count;}unsigned longtraceRouteHopsTable_count(struct traceRouteCtlTable_data *thedata){ struct header_complex_index *hciptr2 = NULL; netsnmp_variable_list *vars = NULL; oid newoid[MAX_OID_LEN]; size_t newoid_len; unsigned long count = 0; snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlOperationName */ header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars); vars = NULL; for (hciptr2 = traceRouteHopsTableStorage; hciptr2 != NULL; hciptr2 = hciptr2->next) { if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len) == 0) { count = count + 1; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -