traceRouteCtlTable.c
上传用户:wxp200602
上传日期:2007-10-30
资源大小:4028k
文件大小:215k
源码类别:

SNMP编程

开发平台:

Unix_Linux

  1. /*
  2.  *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
  3.  *
  4.  *All right reserved
  5.  *
  6.  *File Name:traceRouteCtlTable.c
  7.  *File Description:Rows of traceRouteCtlTable MIB add delete ans read.
  8.  *              Rows of traceRouteResultsTable MIB add and delete.
  9.  *              Rows of traceRouteProbeHistoryTable MIB add and delete.
  10.  *              Rows of traceRouteHopsTable MIB add and delete.
  11.  *              The main function is also here.
  12.  *
  13.  *Current Version:1.0
  14.  *Author:ChenJing
  15.  *Date:2004.8.20
  16.  */
  17. #include <net-snmp/net-snmp-config.h>
  18. #include <net-snmp/net-snmp-includes.h>
  19. #include <net-snmp/agent/net-snmp-agent-includes.h>
  20. #include <pthread.h>
  21. #include "traceRouteCtlTable.h"
  22. #include "traceRouteResultsTable.h"
  23. #include "traceRouteProbeHistoryTable.h"
  24. #include "traceRouteHopsTable.h"
  25. #include "header_complex.h"
  26. oid             traceRouteCtlTable_variables_oid[] =
  27.     { 1, 3, 6, 1, 2, 1, 81, 1, 2 };
  28. /* trap */
  29. oid             traceRoutePathChange[] = { 1, 3, 6, 1, 2, 1, 81, 0, 1 };
  30. oid             traceRouteTestFailed[] = { 1, 3, 6, 1, 2, 1, 81, 0, 2 };
  31. oid             traceRouteTestCompleted[] = { 1, 3, 6, 1, 2, 1, 81, 0, 3 };
  32. struct variable2 traceRouteCtlTable_variables[] = {
  33.     /*
  34.      * magic number        , variable type , ro/rw , callback fn  , L, oidsuffix 
  35.      */
  36.     {COLUMN_TRACEROUTECTLTARGETADDRESSTYPE, ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 3}},
  37.     {COLUMN_TRACEROUTECTLTARGETADDRESS,   ASN_OCTET_STR, RWRITE, var_traceRouteCtlTable, 2, {1, 4}},
  38.     {COLUMN_TRACEROUTECTLBYPASSROUTETABLE,  ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 5}},
  39.     {COLUMN_TRACEROUTECTLDATASIZE,     ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 6}},
  40.     {COLUMN_TRACEROUTECTLTIMEOUT,      ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 7}},
  41.     {COLUMN_TRACEROUTECTLPROBESPERHOP, ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 8}},
  42.     {COLUMN_TRACEROUTECTLPORT,         ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 9}},
  43.     {COLUMN_TRACEROUTECTLMAXTTL,       ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 10}},
  44.     {COLUMN_TRACEROUTECTLDSFIELD,      ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 11}},
  45.     {COLUMN_TRACEROUTECTLSOURCEADDRESSTYPE, ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 12}},
  46.     {COLUMN_TRACEROUTECTLSOURCEADDRESS,   ASN_OCTET_STR, RWRITE, var_traceRouteCtlTable, 2, {1, 13}},
  47.     {COLUMN_TRACEROUTECTLIFINDEX,       ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 14}},
  48.     {COLUMN_TRACEROUTECTLMISCOPTIONS, ASN_OCTET_STR, RWRITE, var_traceRouteCtlTable, 2, {1, 15}},
  49.     {COLUMN_TRACEROUTECTLMAXFAILURES,  ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 16}},
  50.     {COLUMN_TRACEROUTECTLDONTFRAGMENT,  ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 17}},
  51.     {COLUMN_TRACEROUTECTLINITIALTTL,   ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 18}},
  52.     {COLUMN_TRACEROUTECTLFREQUENCY,    ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 19}},
  53.     {COLUMN_TRACEROUTECTLSTORAGETYPE,   ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 20}},
  54.     {COLUMN_TRACEROUTECTLADMINSTATUS,   ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 21}},
  55.     {COLUMN_TRACEROUTECTLDESCR,       ASN_OCTET_STR, RWRITE, var_traceRouteCtlTable, 2, {1, 22}},
  56.     {COLUMN_TRACEROUTECTLMAXROWS,      ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 23}},
  57.     {COLUMN_TRACEROUTECTLTRAPGENERATION,  ASN_OCTET_STR, RWRITE, var_traceRouteCtlTable, 2, {1, 24}},
  58.     {COLUMN_TRACEROUTECTLCREATEHOPSENTRIES, ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 25}},
  59.     {COLUMN_TRACEROUTECTLTYPE,        ASN_OBJECT_ID, RWRITE, var_traceRouteCtlTable, 2, {1, 26}},
  60.     {COLUMN_TRACEROUTECTLROWSTATUS,     ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 27}}
  61. };
  62. /*
  63.  * global storage of our data, saved in and configured by header_complex() 
  64.  */
  65. struct header_complex_index *traceRouteCtlTableStorage = NULL;
  66. struct header_complex_index *traceRouteResultsTableStorage = NULL;
  67. struct header_complex_index *traceRouteProbeHistoryTableStorage = NULL;
  68. struct header_complex_index *traceRouteHopsTableStorage = NULL;
  69. void
  70. init_traceRouteCtlTable(void)
  71. {
  72.     DEBUGMSGTL(("traceRouteCtlTable", "initializing...  "));
  73.     /*
  74.      * register ourselves with the agent to handle our mib tree 
  75.      */
  76.     REGISTER_MIB("traceRouteCtlTable", traceRouteCtlTable_variables,
  77.                  variable2, traceRouteCtlTable_variables_oid);
  78.     /*
  79.      * register our config handler(s) to deal with registrations 
  80.      */
  81.     snmpd_register_config_handler("traceRouteCtlTable",
  82.                                   parse_traceRouteCtlTable, NULL, NULL);
  83.     /*
  84.      * we need to be called back later to store our data 
  85.      */
  86.     snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
  87.                            store_traceRouteCtlTable, NULL);
  88.     DEBUGMSGTL(("traceRouteCtlTable", "done.n"));
  89. }
  90. void
  91. init_trResultsTable(struct traceRouteCtlTable_data *item)
  92. {
  93.     struct traceRouteResultsTable_data *StorageTmp = NULL;
  94.     netsnmp_variable_list *vars = NULL;
  95.     char           *host = NULL;
  96.     host =
  97.         (char *) malloc(sizeof(char) *
  98.                         (item->traceRouteCtlTargetAddressLen + 1));
  99.     if (host == NULL) {
  100.         DEBUGMSGTL(("traceRouteCtlTable", "host calloc %sn",
  101.                     strerror(errno)));
  102.         exit(1);
  103.     }
  104.     bzero(host, sizeof(char) * (item->traceRouteCtlTargetAddressLen + 1));
  105.     strcpy(host, item->traceRouteCtlTargetAddress);
  106.     host[item->traceRouteCtlTargetAddressLen] = '';
  107.     StorageTmp = SNMP_MALLOC_STRUCT(traceRouteResultsTable_data);
  108.     if (StorageTmp == NULL) {
  109.         DEBUGMSGTL(("traceRouteCtlTable", "StorageTmp malloc %sn",
  110.                     strerror(errno)));
  111.         exit(1);
  112.     }
  113.     StorageTmp->traceRouteCtlOwnerIndex =
  114.         (char *) malloc(sizeof(char) *
  115.                         (item->traceRouteCtlOwnerIndexLen + 1));
  116.     if (StorageTmp->traceRouteCtlOwnerIndex == NULL) {
  117.         DEBUGMSGTL(("traceRouteCtlTable",
  118.                     "traceRouteCtlOwnerIndex malloc %sn",
  119.                     strerror(errno)));
  120.         exit(1);
  121.     }
  122.     memcpy(StorageTmp->traceRouteCtlOwnerIndex,
  123.            item->traceRouteCtlOwnerIndex,
  124.            item->traceRouteCtlOwnerIndexLen + 1);
  125.     StorageTmp->traceRouteCtlOwnerIndex[item->traceRouteCtlOwnerIndexLen] =
  126.         '';
  127.     StorageTmp->traceRouteCtlOwnerIndexLen =
  128.         item->traceRouteCtlOwnerIndexLen;
  129.     StorageTmp->traceRouteCtlTestName =
  130.         (char *) malloc(sizeof(char) *
  131.                         (item->traceRouteCtlTestNameLen + 1));
  132.     if (StorageTmp->traceRouteCtlTestName == NULL) {
  133.         DEBUGMSGTL(("traceRouteCtlTable",
  134.                     "traceRouteCtlTestName malloc %sn", strerror(errno)));
  135.         exit(1);
  136.     }
  137.     memcpy(StorageTmp->traceRouteCtlTestName, item->traceRouteCtlTestName,
  138.            item->traceRouteCtlTestNameLen + 1);
  139.     StorageTmp->traceRouteCtlTestName[item->traceRouteCtlTestNameLen] =
  140.         '';
  141.     StorageTmp->traceRouteCtlTestNameLen = item->traceRouteCtlTestNameLen;
  142.     StorageTmp->traceRouteResultsOperStatus = 1;
  143.     if (item->traceRouteCtlTargetAddressType == 1
  144.         || item->traceRouteCtlTargetAddressType == 16) {
  145.         struct sockaddr whereto;        /* Who to try to reach */
  146.         register struct sockaddr_in *to = (struct sockaddr_in *) &whereto;
  147.         register struct hostinfo *hi = NULL;
  148.         hi = gethostinfo(host);
  149.         if (hi == NULL) {
  150.             DEBUGMSGTL(("traceRouteCtlTable", "hi calloc %sn",
  151.                         strerror(errno)));
  152.             exit(1);
  153.         }
  154.         setsin(to, hi->addrs[0]);
  155.         if (inet_ntoa(to->sin_addr) == NULL) {
  156.             StorageTmp->traceRouteResultsIpTgtAddrType = 0;
  157.             StorageTmp->traceRouteResultsIpTgtAddr = strdup("");
  158.             StorageTmp->traceRouteResultsIpTgtAddrLen = 0;
  159.         } else {
  160.             StorageTmp->traceRouteResultsIpTgtAddrType = 1;
  161.             StorageTmp->traceRouteResultsIpTgtAddr =
  162.                 (char *) malloc(sizeof(char) *
  163.                                 (strlen(inet_ntoa(to->sin_addr)) + 1));
  164.             if (StorageTmp->traceRouteResultsIpTgtAddr == NULL) {
  165.                 DEBUGMSGTL(("traceRouteCtlTable",
  166.                             "traceRouteResultsIpTgtAddr malloc %sn",
  167.                             strerror(errno)));
  168.                 exit(1);
  169.             }
  170.             memcpy(StorageTmp->traceRouteResultsIpTgtAddr,
  171.                    inet_ntoa(to->sin_addr),
  172.                    strlen(inet_ntoa(to->sin_addr)) + 1);
  173.             StorageTmp->
  174.                 traceRouteResultsIpTgtAddr[strlen(inet_ntoa(to->sin_addr))]
  175.                 = '';
  176.             StorageTmp->traceRouteResultsIpTgtAddrLen =
  177.                 strlen(inet_ntoa(to->sin_addr));
  178.         }
  179.     }
  180.     if (item->traceRouteCtlTargetAddressType == 2) {
  181.         struct sockaddr_in6 whereto;    /* Who to try to reach */
  182.         register struct sockaddr_in6 *to =
  183.             (struct sockaddr_in6 *) &whereto;
  184.         struct hostent *hp = NULL;
  185.         /* struct hostenv hp; */
  186.         char            pa[64];
  187.         bzero(pa, 64);
  188.         to->sin6_family = AF_INET6;
  189.         to->sin6_port = htons(33434);
  190.         if (inet_pton(AF_INET6, host, &to->sin6_addr) > 0) {
  191.             StorageTmp->traceRouteResultsIpTgtAddrType = 2;
  192.             StorageTmp->traceRouteResultsIpTgtAddr =
  193.                 (char *) malloc(sizeof(char) * (strlen(host) + 1));
  194.             if (StorageTmp->traceRouteResultsIpTgtAddr == NULL) {
  195.                 DEBUGMSGTL(("traceRouteCtlTable",
  196.                             "traceRouteResultsIpTgtAddr malloc %sn",
  197.                             strerror(errno)));
  198.                 exit(1);
  199.             }
  200.             bzero(StorageTmp->traceRouteResultsIpTgtAddr,
  201.                   sizeof(char) * (strlen(host) + 1));
  202.             memcpy(StorageTmp->traceRouteResultsIpTgtAddr, host,
  203.                    strlen(host) + 1);
  204.             StorageTmp->traceRouteResultsIpTgtAddr[strlen(host)] = '';
  205.             StorageTmp->traceRouteResultsIpTgtAddrLen = strlen(host);
  206.         } else {
  207.             hp = gethostbyname2(host, AF_INET6);
  208.             if (hp != NULL) {
  209.                 const char     *hostname;
  210.                 memmove((caddr_t) & to->sin6_addr, hp->h_addr, 16);
  211.                 hostname = inet_ntop(AF_INET6, &to->sin6_addr, pa, 64);
  212.                 StorageTmp->traceRouteResultsIpTgtAddrType = 2;
  213.                 StorageTmp->traceRouteResultsIpTgtAddr =
  214.                     (char *) malloc(sizeof(char) * (strlen(hostname) + 1));
  215.                 if (StorageTmp->traceRouteResultsIpTgtAddr == NULL) {
  216.                     DEBUGMSGTL(("traceRouteCtlTable",
  217.                                 "traceRouteResultsIpTgtAddr malloc %sn",
  218.                                 strerror(errno)));
  219.                     exit(1);
  220.                 }
  221.                 bzero(StorageTmp->traceRouteResultsIpTgtAddr,
  222.                       sizeof(char) * (strlen(host) + 1));
  223.                 memcpy(StorageTmp->traceRouteResultsIpTgtAddr, hostname,
  224.                        strlen(hostname) + 1);
  225.                 StorageTmp->traceRouteResultsIpTgtAddr[strlen(hostname)] =
  226.                     '';
  227.                 StorageTmp->traceRouteResultsIpTgtAddrLen =
  228.                     strlen(hostname);
  229.             } else {
  230.                 DEBUGMSGTL(("traceRouteCtlTable",
  231.                             "traceroute: unknown host %sn", host));
  232.                 StorageTmp->traceRouteResultsIpTgtAddrType = 0;
  233.                 StorageTmp->traceRouteResultsIpTgtAddr = strdup("");
  234.                 StorageTmp->traceRouteResultsIpTgtAddrLen = 0;
  235.             }
  236.         }
  237.     }
  238.     StorageTmp->traceRouteResultsCurHopCount = 0;
  239.     StorageTmp->traceRouteResultsCurProbeCount = 0;
  240.     StorageTmp->traceRouteResultsTestAttempts = 0;
  241.     StorageTmp->traceRouteResultsTestSuccesses = 0;
  242.     StorageTmp->traceRouteResultsLastGoodPath = strdup("");
  243.     StorageTmp->traceRouteResultsLastGoodPathLen = 0;
  244.     item->traceRouteResults = StorageTmp;
  245.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlOwnerIndex, item->traceRouteCtlOwnerIndexLen); /*  traceRouteCtlOwnerIndex  */
  246.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlTestName, item->traceRouteCtlTestNameLen);     /*  traceRouteCtlTestName  */
  247.     if ((header_complex_get(traceRouteResultsTableStorage, vars)) != NULL) {
  248.         traceRouteResultsTable_del(item);
  249.     }
  250.     snmp_free_varbind(vars);
  251.     vars = NULL;
  252.     if (item->traceRouteResults != NULL) {
  253.         if (traceRouteResultsTable_add(item) != SNMPERR_SUCCESS) {
  254.             DEBUGMSGTL(("traceRouteResultsTable",
  255.                         "init an entry errorn"));
  256.         }
  257.     }
  258. }
  259. int
  260. modify_trResultsOper(struct traceRouteCtlTable_data *thedata, long val)
  261. {
  262.     netsnmp_variable_list *vars = NULL;
  263.     struct traceRouteResultsTable_data *StorageTmp = NULL;
  264.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen);   /* traceRouteCtlOwnerIndex */
  265.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen);       /* traceRouteCtlTestName */
  266.     if ((StorageTmp =
  267.          header_complex_get(traceRouteResultsTableStorage,
  268.                             vars)) == NULL) {
  269.         snmp_free_varbind(vars);
  270.         vars = NULL;
  271.         return SNMP_ERR_NOSUCHNAME;
  272.     } else {
  273.         StorageTmp->traceRouteResultsOperStatus = val;
  274.         DEBUGMSGTL(("traceRouteResultsOperStatus", "done.n"));
  275.         snmp_free_varbind(vars);
  276.         vars = NULL;
  277.         return SNMPERR_SUCCESS;
  278.     }
  279. }
  280. struct traceRouteCtlTable_data *
  281. create_traceRouteCtlTable_data(void)
  282. {
  283.     struct traceRouteCtlTable_data *StorageNew = NULL;
  284.     StorageNew = SNMP_MALLOC_STRUCT(traceRouteCtlTable_data);
  285.     if (StorageNew == NULL) {
  286.         exit(1);
  287.     }
  288.     StorageNew->traceRouteCtlTargetAddressType = 1;
  289.     StorageNew->traceRouteCtlTargetAddress = strdup("");
  290.     StorageNew->traceRouteCtlTargetAddressLen = 0;
  291.     StorageNew->traceRouteCtlByPassRouteTable = 2;
  292.     StorageNew->traceRouteCtlDataSize = 0;
  293.     StorageNew->traceRouteCtlTimeOut = 3;
  294.     StorageNew->traceRouteCtlProbesPerHop = 3;
  295.     StorageNew->traceRouteCtlPort = 33434;
  296.     StorageNew->traceRouteCtlMaxTtl = 30;
  297.     StorageNew->traceRouteCtlDSField = 0;
  298.     StorageNew->traceRouteCtlSourceAddressType = 0;
  299.     StorageNew->traceRouteCtlSourceAddress = strdup("");
  300.     StorageNew->traceRouteCtlSourceAddressLen = 0;
  301.     StorageNew->traceRouteCtlIfIndex = 0;
  302.     StorageNew->traceRouteCtlMiscOptions = strdup("");
  303.     StorageNew->traceRouteCtlMiscOptionsLen = 0;
  304.     StorageNew->traceRouteCtlMaxFailures = 5;
  305.     StorageNew->traceRouteCtlDontFragment = 2;
  306.     StorageNew->traceRouteCtlInitialTtl = 1;
  307.     StorageNew->traceRouteCtlFrequency = 0;
  308.     StorageNew->traceRouteCtlStorageType = ST_NONVOLATILE;
  309.     StorageNew->traceRouteCtlAdminStatus = 2;
  310.     StorageNew->traceRouteCtlDescr = (char *) malloc(strlen("00") + 1);
  311.     if (StorageNew->traceRouteCtlDescr == NULL) {
  312.         exit(1);
  313.     }
  314.     memcpy(StorageNew->traceRouteCtlDescr, "00", strlen("00") + 1);
  315.     StorageNew->traceRouteCtlDescr[strlen("00")] = '';
  316.     StorageNew->traceRouteCtlDescrLen =
  317.         strlen(StorageNew->traceRouteCtlDescr);
  318.     StorageNew->traceRouteCtlMaxRows = 50;
  319.     StorageNew->traceRouteCtlTrapGeneration = strdup("");
  320.     StorageNew->traceRouteCtlTrapGenerationLen = 0;
  321.     StorageNew->traceRouteCtlCreateHopsEntries = 2;
  322.     StorageNew->traceRouteCtlType = calloc(1, sizeof(oid) * sizeof(2)); /* 0.0 */
  323.     StorageNew->traceRouteCtlTypeLen = 2;
  324.     StorageNew->traceRouteResults = NULL;
  325.     StorageNew->traceRouteProbeHis = NULL;
  326.     StorageNew->traceRouteHops = NULL;
  327.     StorageNew->storageType = ST_NONVOLATILE;
  328.     /* StorageNew->traceRouteProbeHistoryMaxIndex=0; */
  329.     return StorageNew;
  330. }
  331. /*
  332.  * traceRouteCtlTable_add(): adds a structure node to our data set 
  333.  */
  334. int
  335. traceRouteCtlTable_add(struct traceRouteCtlTable_data *thedata)
  336. {
  337.     netsnmp_variable_list *vars = NULL;
  338.     DEBUGMSGTL(("traceRouteCtlTable", "adding data...  "));
  339.     /*
  340.      * add the index variables to the varbind list, which is 
  341.      * used by header_complex to index the data 
  342.      */
  343.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen);   /* traceRouteCtlOwnerIndex */
  344.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen);       /* traceRouteCtlOperationName */
  345.     if (header_complex_add_data(&traceRouteCtlTableStorage, vars, thedata)
  346.         == NULL) {
  347.         vars = NULL;
  348.         return SNMPERR_GENERR;
  349.     } else {
  350.         DEBUGMSGTL(("traceRouteCtlTable", "registered an entryn"));
  351.         DEBUGMSGTL(("traceRouteCtlTable", "done.n"));
  352.         vars = NULL;
  353.         return SNMPERR_SUCCESS;
  354.     }
  355. }
  356. int
  357. traceRouteResultsTable_add(struct traceRouteCtlTable_data *thedata)
  358. {
  359.     netsnmp_variable_list *vp = NULL;
  360.     netsnmp_variable_list *vars_list = NULL;
  361.     struct traceRouteResultsTable_data *p = NULL;
  362.     p = thedata->traceRouteResults;
  363.     if (thedata->traceRouteResults != NULL) {
  364.         snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlOwnerIndex, p->traceRouteCtlOwnerIndexLen);      /* traceRouteCtlOwnerIndex */
  365.         snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlTestName, p->traceRouteCtlTestNameLen);  /* traceRouteCtlTestName */
  366.         DEBUGMSGTL(("traceRouteResultsTable", "adding data...  "));
  367.         /*
  368.          * add the index variables to the varbind list, which is 
  369.          * used by header_complex to index the data 
  370.          */
  371.         header_complex_add_data(&traceRouteResultsTableStorage, vars_list,
  372.                                 p);
  373.         DEBUGMSGTL(("traceRouteResultsTable", "out finishedn"));
  374.         vars_list = NULL;
  375.         DEBUGMSGTL(("traceRouteResultsTable", "done.n"));
  376.         return SNMPERR_SUCCESS;
  377.     } else {
  378.         vars_list = NULL;
  379.         DEBUGMSGTL(("traceRouteResultsTable", "error.n"));
  380.         return SNMP_ERR_INCONSISTENTNAME;
  381.     }
  382. }
  383. int
  384. traceRouteProbeHistoryTable_add(struct traceRouteProbeHistoryTable_data
  385.                                 *thedata)
  386. {
  387.     netsnmp_variable_list *vars_list = NULL;
  388.     if (thedata != NULL) {
  389.         snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen);  /* traceRouteCtlOwnerIndex */
  390.         snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen);      /* traceRouteCtlTestName */
  391.         snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteProbeHistoryIndex, sizeof(thedata->traceRouteProbeHistoryIndex));     /* traceRouteProbeHistoryIndex */
  392.         snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteProbeHistoryHopIndex, sizeof(thedata->traceRouteProbeHistoryHopIndex));       /* traceRouteProbeHistoryHopIndex */
  393.         snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteProbeHistoryProbeIndex, sizeof(thedata->traceRouteProbeHistoryProbeIndex));   /* traceRouteProbeHistoryProbeIndex */
  394.         DEBUGMSGTL(("traceRouteProbeHistoryTable", "adding data...  "));
  395.         /*
  396.          * add the index variables to the varbind list, which is 
  397.          * used by header_complex to index the data 
  398.          */
  399.         if (header_complex_add_data
  400.             (&traceRouteProbeHistoryTableStorage, vars_list,
  401.              thedata) == NULL) {
  402.             vars_list = NULL;
  403.             return SNMP_ERR_INCONSISTENTNAME;
  404.         } else {
  405.             DEBUGMSGTL(("traceRouteProbeHistoryTable", "out finishedn"));
  406.             vars_list = NULL;
  407.             DEBUGMSGTL(("traceRouteProbeHistoryTable", "done.n"));
  408.             return SNMPERR_SUCCESS;
  409.         }
  410.     } else {
  411.         return SNMP_ERR_INCONSISTENTNAME;
  412.     }
  413. }
  414. int
  415. traceRouteProbeHistoryTable_addall(struct traceRouteCtlTable_data *thedata)
  416. {
  417.     netsnmp_variable_list *vars_list = NULL;
  418.     struct traceRouteProbeHistoryTable_data *p = NULL;
  419.     p = thedata->traceRouteProbeHis;
  420.     if (thedata->traceRouteProbeHis != NULL)
  421.         do {
  422.             snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlOwnerIndex, p->traceRouteCtlOwnerIndexLen);  /* traceRouteCtlOwnerIndex */
  423.             snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlTestName, p->traceRouteCtlTestNameLen);      /* traceRouteCtlTestName */
  424.             snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &p->traceRouteProbeHistoryIndex, sizeof(p->traceRouteProbeHistoryIndex));     /* traceRouteProbeHistoryIndex */
  425.             snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &p->traceRouteProbeHistoryHopIndex, sizeof(p->traceRouteProbeHistoryHopIndex));       /* traceRouteProbeHistoryHopIndex */
  426.             snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &p->traceRouteProbeHistoryProbeIndex, sizeof(p->traceRouteProbeHistoryProbeIndex));   /* traceRouteProbeHistoryProbeIndex */
  427.             DEBUGMSGTL(("traceRouteProbeHistoryTable",
  428.                         "adding data...  "));
  429.             /*
  430.              * add the index variables to the varbind list, which is 
  431.              * used by header_complex to index the data 
  432.              */
  433.             if (header_complex_add_data
  434.                 (&traceRouteProbeHistoryTableStorage, vars_list,
  435.                  p) == NULL) {
  436.                 vars_list = NULL;
  437.                 return SNMP_ERR_INCONSISTENTNAME;
  438.             } else {
  439.                 struct header_complex_index *temp = NULL;
  440.                 temp = traceRouteProbeHistoryTableStorage;
  441.                 if (traceRouteProbeHistoryTableStorage != NULL)
  442.                     do {
  443.                         DEBUGMSGTL(("traceRouteProbeHistoryTable",
  444.                                     "adding data,vars_oid=%un ",
  445.                                     temp->name));
  446.                         DEBUGMSGTL(("traceRouteProbeHistoryTable",
  447.                                     "adding data,vars_oid=%dn ",
  448.                                     temp->namelen));
  449.                         temp = temp->next;
  450.                     } while (temp != NULL);
  451.                 DEBUGMSGTL(("traceRouteProbeHistoryTable",
  452.                             "out finishedn"));
  453.                 DEBUGMSGTL(("traceRouteProbeHistoryTable", "done.n"));
  454.                 vars_list = NULL;
  455.                 return SNMPERR_SUCCESS;
  456.             }
  457.             p = p->next;
  458.         } while (p != NULL);
  459.     else {
  460.         return SNMP_ERR_INCONSISTENTNAME;
  461.     }
  462. }
  463. int
  464. traceRouteHopsTable_add(struct traceRouteHopsTable_data *thedata)
  465. {
  466.     netsnmp_variable_list *vars_list = NULL;
  467.     if (thedata != NULL) {
  468.         snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen);  /* traceRouteCtlOwnerIndex */
  469.         snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen);      /* traceRouteCtlTestName */
  470.         snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteHopsHopIndex, sizeof(thedata->traceRouteHopsHopIndex));       /* traceRouteHopsHopIndex */
  471.         DEBUGMSGTL(("traceRouteHopsTable", "adding data...  "));
  472.         /*
  473.          * add the index variables to the varbind list, which is 
  474.          * used by header_complex to index the data 
  475.          */
  476.         if (header_complex_add_data
  477.             (&traceRouteHopsTableStorage, vars_list, thedata) == NULL) {
  478.             vars_list = NULL;
  479.             return SNMP_ERR_INCONSISTENTNAME;
  480.         } else {
  481.             DEBUGMSGTL(("traceRouteHopsTable", "out finishedn"));
  482.             DEBUGMSGTL(("traceRouteHopsTable", "done.n"));
  483.             vars_list = NULL;
  484.             return SNMPERR_SUCCESS;
  485.         }
  486.     }
  487. }
  488. int
  489. traceRouteHopsTable_addall(struct traceRouteCtlTable_data *thedata)
  490. {
  491.     netsnmp_variable_list *vars_list = NULL;
  492.     struct traceRouteHopsTable_data *p = NULL;
  493.     vars_list = NULL;
  494.     p = thedata->traceRouteHops;
  495.     if (thedata->traceRouteHops != NULL) {
  496.         do {
  497.             snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlOwnerIndex, p->traceRouteCtlOwnerIndexLen);  /* traceRouteCtlOwnerIndex */
  498.             snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlTestName, p->traceRouteCtlTestNameLen);      /* traceRouteCtlTestName */
  499.             snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &p->traceRouteHopsHopIndex, sizeof(p->traceRouteHopsHopIndex));       /* traceRouteHopsHopIndex */
  500.             DEBUGMSGTL(("traceRouteHopsTable", "adding data...  "));
  501.             /*
  502.              * add the index variables to the varbind list, which is 
  503.              * used by header_complex to index the data 
  504.              */
  505.             if (header_complex_add_data
  506.                 (&traceRouteHopsTableStorage, vars_list, p) == NULL) {
  507.                 vars_list = NULL;
  508.                 return SNMP_ERR_INCONSISTENTNAME;
  509.             } else {
  510.                 struct header_complex_index *temp = NULL;
  511.                 temp = traceRouteHopsTableStorage;
  512.                 if (traceRouteHopsTableStorage != NULL)
  513.                     do {
  514.                         DEBUGMSGTL(("traceRouteProbeHistoryTable",
  515.                                     "adding data,vars_oid=%un ",
  516.                                     temp->name));
  517.                         DEBUGMSGTL(("traceRouteProbeHistoryTable",
  518.                                     "adding data,vars_oid=%dn ",
  519.                                     temp->namelen));
  520.                         temp = temp->next;
  521.                     } while (temp != NULL);
  522.                 DEBUGMSGTL(("traceRouteHopsTable", "out finishedn"));
  523.                 vars_list = NULL;
  524.             }
  525.             p = p->next;
  526.         } while (p != NULL);
  527.         DEBUGMSGTL(("traceRouteHopsTable", "done.n"));
  528.         return SNMPERR_SUCCESS;
  529.     } else {
  530.         return SNMP_ERR_INCONSISTENTNAME;
  531.     }
  532. }
  533. unsigned long
  534. traceRouteProbeHistoryTable_count(struct traceRouteCtlTable_data *thedata)
  535. {
  536.     struct header_complex_index *hciptr2 = NULL;
  537.     netsnmp_variable_list *vars = NULL;
  538.     oid             newoid[MAX_OID_LEN];
  539.     size_t          newoid_len;
  540.     unsigned long   count = 0;
  541.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen);   /* traceRouteCtlOwnerIndex */
  542.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen);       /* traceRouteCtlTestName */
  543.     header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars);
  544.     vars = NULL;
  545.     for (hciptr2 = traceRouteProbeHistoryTableStorage; hciptr2 != NULL;
  546.          hciptr2 = hciptr2->next) {
  547.         if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
  548.             == 0) {
  549.             count = count + 1;
  550.         }
  551.     }
  552.     return count;
  553. }
  554. unsigned long
  555. traceRouteHopsTable_count(struct traceRouteCtlTable_data *thedata)
  556. {
  557.     struct header_complex_index *hciptr2 = NULL;
  558.     netsnmp_variable_list *vars = NULL;
  559.     oid             newoid[MAX_OID_LEN];
  560.     size_t          newoid_len;
  561.     unsigned long   count = 0;
  562.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen);   /* traceRouteCtlOwnerIndex */
  563.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen);       /* traceRouteCtlOperationName */
  564.     header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars);
  565.     vars = NULL;
  566.     for (hciptr2 = traceRouteHopsTableStorage; hciptr2 != NULL;
  567.          hciptr2 = hciptr2->next) {
  568.         if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
  569.             == 0) {
  570.             count = count + 1;
  571.         }
  572.     }
  573.     return count;
  574. }
  575. int
  576. traceRouteProbeHistoryTable_delLast(struct traceRouteCtlTable_data
  577.                                     *thedata)
  578. {
  579.     struct traceRouteProbeHistoryTable_data *p = NULL;
  580.     struct header_complex_index *hciptr1 = NULL;
  581.     struct header_complex_index *hciptr2 = NULL;
  582.     struct header_complex_index *hcilast = NULL;
  583.     struct traceRouteProbeHistoryTable_data *StorageDel = NULL;
  584.     struct traceRouteProbeHistoryTable_data *StorageTmp = NULL;
  585.     netsnmp_variable_list *vars = NULL;
  586.     netsnmp_variable_list *vars_temp = NULL;
  587.     oid             newoid[MAX_OID_LEN];
  588.     size_t          newoid_len = 0;
  589.     time_t          last_time = 2147483647;
  590.     struct tm      *tp = NULL;
  591.     tp = (struct tm *) malloc(sizeof(struct tm));
  592.     if (tp == NULL) {
  593.         exit(1);
  594.     }
  595.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen);   /* traceRouteCtlOwnerIndex */
  596.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen);       /* traceRouteCtlOperationName */
  597.     bzero(newoid, sizeof(oid) * MAX_OID_LEN);
  598.     header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars);
  599.     for (hcilast = hciptr2 = traceRouteProbeHistoryTableStorage;
  600.          hciptr2 != NULL; hciptr2 = hciptr2->next) {
  601.         if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
  602.             == 0) {
  603.             StorageTmp =
  604.                 header_complex_get_from_oid
  605.                 (traceRouteProbeHistoryTableStorage, hciptr2->name,
  606.                  hciptr2->namelen);
  607.             strptime(StorageTmp->traceRouteProbeHistoryTime, "%c", tp);
  608.             if (last_time > timegm(tp)) {
  609.                 last_time = timegm(tp);
  610.                 hcilast = hciptr2;
  611.             }
  612.         }
  613.     }
  614.     StorageDel =
  615.         header_complex_extract_entry(&traceRouteProbeHistoryTableStorage,
  616.                                      hcilast);
  617.     DEBUGMSGTL(("traceRouteProbeHistoryTable",
  618.                 "delete the last one success!n"));
  619.     vars = NULL;
  620.     free(tp);
  621.     tp = NULL;
  622. }
  623. void
  624. traceRouteCtlTable_cleaner(struct header_complex_index *thestuff)
  625. {
  626.     struct header_complex_index *hciptr = NULL;
  627.     struct traceRouteCtlTable_data *StorageDel = NULL;
  628.     DEBUGMSGTL(("traceRouteCtlTable", "cleanerout  "));
  629.     for (hciptr = thestuff; hciptr != NULL; hciptr = hciptr->next) {
  630.         StorageDel =
  631.             header_complex_extract_entry(&traceRouteCtlTableStorage,
  632.                                          hciptr);
  633.         if (StorageDel != NULL) {
  634.             free(StorageDel->traceRouteCtlOwnerIndex);
  635.             StorageDel->traceRouteCtlOwnerIndex = NULL;
  636.             free(StorageDel->traceRouteCtlTestName);
  637.             StorageDel->traceRouteCtlTestName = NULL;
  638.             free(StorageDel->traceRouteCtlTargetAddress);
  639.             StorageDel->traceRouteCtlTargetAddress = NULL;
  640.             free(StorageDel->traceRouteCtlSourceAddress);
  641.             StorageDel->traceRouteCtlSourceAddress = NULL;
  642.             free(StorageDel->traceRouteCtlMiscOptions);
  643.             StorageDel->traceRouteCtlMiscOptions = NULL;
  644.             free(StorageDel->traceRouteCtlDescr);
  645.             StorageDel->traceRouteCtlDescr = NULL;
  646.             free(StorageDel->traceRouteCtlTrapGeneration);
  647.             StorageDel->traceRouteCtlTrapGeneration = NULL;
  648.             free(StorageDel->traceRouteCtlType);
  649.             StorageDel->traceRouteCtlType = NULL;
  650.             free(StorageDel);
  651.             StorageDel = NULL;
  652.         }
  653.         DEBUGMSGTL(("traceRouteCtlTable", "cleaner  "));
  654.     }
  655. }
  656. /*
  657.  * parse_mteObjectsTable():
  658.  *   parses .conf file entries needed to configure the mib.
  659.  */
  660. void
  661. parse_traceRouteCtlTable(const char *token, char *line)
  662. {
  663.     size_t          tmpint;
  664.     struct traceRouteCtlTable_data *StorageTmp =
  665.         SNMP_MALLOC_STRUCT(traceRouteCtlTable_data);
  666.     DEBUGMSGTL(("traceRouteCtlTable", "parsing config...  "));
  667.     if (StorageTmp == NULL) {
  668.         config_perror("malloc failure");
  669.         return;
  670.     }
  671.     line =
  672.         read_config_read_data(ASN_OCTET_STR, line,
  673.                               &StorageTmp->traceRouteCtlOwnerIndex,
  674.                               &StorageTmp->traceRouteCtlOwnerIndexLen);
  675.     if (StorageTmp->traceRouteCtlOwnerIndex == NULL) {
  676.         config_perror("invalid specification for traceRouteCtlOwnerIndex");
  677.         return;
  678.     }
  679.     line =
  680.         read_config_read_data(ASN_OCTET_STR, line,
  681.                               &StorageTmp->traceRouteCtlTestName,
  682.                               &StorageTmp->traceRouteCtlTestNameLen);
  683.     if (StorageTmp->traceRouteCtlTestName == NULL) {
  684.         config_perror("invalid specification for traceRouteCtlTestName");
  685.         return;
  686.     }
  687.     line =
  688.         read_config_read_data(ASN_INTEGER, line,
  689.                               &StorageTmp->traceRouteCtlTargetAddressType,
  690.                               &tmpint);
  691.     line =
  692.         read_config_read_data(ASN_OCTET_STR, line,
  693.                               &StorageTmp->traceRouteCtlTargetAddress,
  694.                               &StorageTmp->traceRouteCtlTargetAddressLen);
  695.     if (StorageTmp->traceRouteCtlTargetAddress == NULL) {
  696.         config_perror
  697.             ("invalid specification for traceRouteCtlTargetAddress");
  698.         return;
  699.     }
  700.     line =
  701.         read_config_read_data(ASN_INTEGER, line,
  702.                               &StorageTmp->traceRouteCtlByPassRouteTable,
  703.                               &tmpint);
  704.     line =
  705.         read_config_read_data(ASN_UNSIGNED, line,
  706.                               &StorageTmp->traceRouteCtlDataSize, &tmpint);
  707.     line =
  708.         read_config_read_data(ASN_UNSIGNED, line,
  709.                               &StorageTmp->traceRouteCtlTimeOut, &tmpint);
  710.     line =
  711.         read_config_read_data(ASN_UNSIGNED, line,
  712.                               &StorageTmp->traceRouteCtlProbesPerHop,
  713.                               &tmpint);
  714.     line =
  715.         read_config_read_data(ASN_UNSIGNED, line,
  716.                               &StorageTmp->traceRouteCtlPort, &tmpint);
  717.     line =
  718.         read_config_read_data(ASN_UNSIGNED, line,
  719.                               &StorageTmp->traceRouteCtlMaxTtl, &tmpint);
  720.     line =
  721.         read_config_read_data(ASN_UNSIGNED, line,
  722.                               &StorageTmp->traceRouteCtlDSField, &tmpint);
  723.     line =
  724.         read_config_read_data(ASN_INTEGER, line,
  725.                               &StorageTmp->traceRouteCtlSourceAddressType,
  726.                               &tmpint);
  727.     line =
  728.         read_config_read_data(ASN_OCTET_STR, line,
  729.                               &StorageTmp->traceRouteCtlSourceAddress,
  730.                               &StorageTmp->traceRouteCtlSourceAddressLen);
  731.     if (StorageTmp->traceRouteCtlSourceAddress == NULL) {
  732.         config_perror
  733.             ("invalid specification for traceRouteCtlSourceAddress");
  734.         return;
  735.     }
  736.     line =
  737.         read_config_read_data(ASN_INTEGER, line,
  738.                               &StorageTmp->traceRouteCtlIfIndex, &tmpint);
  739.     line =
  740.         read_config_read_data(ASN_OCTET_STR, line,
  741.                               &StorageTmp->traceRouteCtlMiscOptions,
  742.                               &StorageTmp->traceRouteCtlMiscOptionsLen);
  743.     if (StorageTmp->traceRouteCtlMiscOptions == NULL) {
  744.         config_perror
  745.             ("invalid specification for traceRouteCtlMiscOptions");
  746.         return;
  747.     }
  748.     line =
  749.         read_config_read_data(ASN_UNSIGNED, line,
  750.                               &StorageTmp->traceRouteCtlMaxFailures,
  751.                               &tmpint);
  752.     line =
  753.         read_config_read_data(ASN_INTEGER, line,
  754.                               &StorageTmp->traceRouteCtlDontFragment,
  755.                               &tmpint);
  756.     line =
  757.         read_config_read_data(ASN_UNSIGNED, line,
  758.                               &StorageTmp->traceRouteCtlInitialTtl,
  759.                               &tmpint);
  760.     line =
  761.         read_config_read_data(ASN_UNSIGNED, line,
  762.                               &StorageTmp->traceRouteCtlFrequency,
  763.                               &tmpint);
  764.     line =
  765.         read_config_read_data(ASN_INTEGER, line,
  766.                               &StorageTmp->traceRouteCtlStorageType,
  767.                               &tmpint);
  768.     line =
  769.         read_config_read_data(ASN_INTEGER, line,
  770.                               &StorageTmp->traceRouteCtlAdminStatus,
  771.                               &tmpint);
  772.     line =
  773.         read_config_read_data(ASN_OCTET_STR, line,
  774.                               &StorageTmp->traceRouteCtlDescr,
  775.                               &StorageTmp->traceRouteCtlDescrLen);
  776.     if (StorageTmp->traceRouteCtlDescr == NULL) {
  777.         config_perror("invalid specification for traceRouteCtlTrapDescr");
  778.         return;
  779.     }
  780.     line =
  781.         read_config_read_data(ASN_UNSIGNED, line,
  782.                               &StorageTmp->traceRouteCtlMaxRows, &tmpint);
  783.     line =
  784.         read_config_read_data(ASN_OCTET_STR, line,
  785.                               &StorageTmp->traceRouteCtlTrapGeneration,
  786.                               &StorageTmp->traceRouteCtlTrapGenerationLen);
  787.     if (StorageTmp->traceRouteCtlTrapGeneration == NULL) {
  788.         config_perror
  789.             ("invalid specification for traceRouteCtlTrapGeneration");
  790.         return;
  791.     }
  792.     line =
  793.         read_config_read_data(ASN_INTEGER, line,
  794.                               &StorageTmp->traceRouteCtlCreateHopsEntries,
  795.                               &tmpint);
  796.     line =
  797.         read_config_read_data(ASN_OBJECT_ID, line,
  798.                               &StorageTmp->traceRouteCtlType,
  799.                               &StorageTmp->traceRouteCtlTypeLen);
  800.     if (StorageTmp->traceRouteCtlType == NULL) {
  801.         config_perror("invalid specification for traceRouteCtlType");
  802.         return;
  803.     }
  804.     line =
  805.         read_config_read_data(ASN_INTEGER, line,
  806.                               &StorageTmp->traceRouteCtlRowStatus,
  807.                               &tmpint);
  808.     line =
  809.         read_config_read_data(ASN_UNSIGNED, line,
  810.                               &StorageTmp->traceRouteProbeHistoryMaxIndex,
  811.                               &tmpint);
  812.     StorageTmp->storageType = ST_NONVOLATILE;
  813.     traceRouteCtlTable_add(StorageTmp);
  814.     /*     traceRouteCtlTable_cleaner(traceRouteCtlTableStorage); */
  815.     DEBUGMSGTL(("traceRouteCtlTable", "done.n"));
  816. }
  817. /*
  818.  * store_traceRouteCtlTable():
  819.  *   stores .conf file entries needed to configure the mib.
  820.  */
  821. int
  822. store_traceRouteCtlTable(int majorID, int minorID, void *serverarg,
  823.                          void *clientarg)
  824. {
  825.     char            line[SNMP_MAXBUF];
  826.     char           *cptr = NULL;
  827.     size_t          tmpint;
  828.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  829.     struct header_complex_index *hcindex = NULL;
  830.     DEBUGMSGTL(("traceRouteCtlTable", "storing data...  "));
  831.     for (hcindex = traceRouteCtlTableStorage; hcindex != NULL;
  832.          hcindex = hcindex->next) {
  833.         StorageTmp = (struct traceRouteCtlTable_data *) hcindex->data;
  834.         if (StorageTmp->storageType != ST_READONLY) {
  835.             memset(line, 0, sizeof(line));
  836.             strcat(line, "traceRouteCtlTable ");
  837.             cptr = line + strlen(line);
  838.             cptr =
  839.                 read_config_store_data(ASN_OCTET_STR, cptr,
  840.                                        &StorageTmp->
  841.                                        traceRouteCtlOwnerIndex,
  842.                                        &StorageTmp->
  843.                                        traceRouteCtlOwnerIndexLen);
  844.             cptr =
  845.                 read_config_store_data(ASN_OCTET_STR, cptr,
  846.                                        &StorageTmp->traceRouteCtlTestName,
  847.                                        &StorageTmp->
  848.                                        traceRouteCtlTestNameLen);
  849.             cptr =
  850.                 read_config_store_data(ASN_INTEGER, cptr,
  851.                                        &StorageTmp->
  852.                                        traceRouteCtlTargetAddressType,
  853.                                        &tmpint);
  854.             cptr =
  855.                 read_config_store_data(ASN_OCTET_STR, cptr,
  856.                                        &StorageTmp->
  857.                                        traceRouteCtlTargetAddress,
  858.                                        &StorageTmp->
  859.                                        traceRouteCtlTargetAddressLen);
  860.             cptr =
  861.                 read_config_store_data(ASN_INTEGER, cptr,
  862.                                        &StorageTmp->
  863.                                        traceRouteCtlByPassRouteTable,
  864.                                        &tmpint);
  865.             cptr =
  866.                 read_config_store_data(ASN_UNSIGNED, cptr,
  867.                                        &StorageTmp->traceRouteCtlDataSize,
  868.                                        &tmpint);
  869.             cptr =
  870.                 read_config_store_data(ASN_UNSIGNED, cptr,
  871.                                        &StorageTmp->traceRouteCtlTimeOut,
  872.                                        &tmpint);
  873.             cptr =
  874.                 read_config_store_data(ASN_UNSIGNED, cptr,
  875.                                        &StorageTmp->
  876.                                        traceRouteCtlProbesPerHop, &tmpint);
  877.             cptr =
  878.                 read_config_store_data(ASN_UNSIGNED, cptr,
  879.                                        &StorageTmp->traceRouteCtlPort,
  880.                                        &tmpint);
  881.             cptr =
  882.                 read_config_store_data(ASN_UNSIGNED, cptr,
  883.                                        &StorageTmp->traceRouteCtlMaxTtl,
  884.                                        &tmpint);
  885.             cptr =
  886.                 read_config_store_data(ASN_UNSIGNED, cptr,
  887.                                        &StorageTmp->traceRouteCtlDSField,
  888.                                        &tmpint);
  889.             cptr =
  890.                 read_config_store_data(ASN_INTEGER, cptr,
  891.                                        &StorageTmp->
  892.                                        traceRouteCtlSourceAddressType,
  893.                                        &tmpint);
  894.             cptr =
  895.                 read_config_store_data(ASN_OCTET_STR, cptr,
  896.                                        &StorageTmp->
  897.                                        traceRouteCtlSourceAddress,
  898.                                        &StorageTmp->
  899.                                        traceRouteCtlSourceAddressLen);
  900.             cptr =
  901.                 read_config_store_data(ASN_INTEGER, cptr,
  902.                                        &StorageTmp->traceRouteCtlIfIndex,
  903.                                        &tmpint);
  904.             cptr =
  905.                 read_config_store_data(ASN_OCTET_STR, cptr,
  906.                                        &StorageTmp->
  907.                                        traceRouteCtlMiscOptions,
  908.                                        &StorageTmp->
  909.                                        traceRouteCtlMiscOptionsLen);
  910.             cptr =
  911.                 read_config_store_data(ASN_UNSIGNED, cptr,
  912.                                        &StorageTmp->
  913.                                        traceRouteCtlMaxFailures, &tmpint);
  914.             cptr =
  915.                 read_config_store_data(ASN_INTEGER, cptr,
  916.                                        &StorageTmp->
  917.                                        traceRouteCtlDontFragment, &tmpint);
  918.             cptr =
  919.                 read_config_store_data(ASN_UNSIGNED, cptr,
  920.                                        &StorageTmp->
  921.                                        traceRouteCtlInitialTtl, &tmpint);
  922.             cptr =
  923.                 read_config_store_data(ASN_UNSIGNED, cptr,
  924.                                        &StorageTmp->traceRouteCtlFrequency,
  925.                                        &tmpint);
  926.             cptr =
  927.                 read_config_store_data(ASN_INTEGER, cptr,
  928.                                        &StorageTmp->
  929.                                        traceRouteCtlStorageType, &tmpint);
  930.             cptr =
  931.                 read_config_store_data(ASN_INTEGER, cptr,
  932.                                        &StorageTmp->
  933.                                        traceRouteCtlAdminStatus, &tmpint);
  934.             cptr =
  935.                 read_config_store_data(ASN_OCTET_STR, cptr,
  936.                                        &StorageTmp->traceRouteCtlDescr,
  937.                                        &StorageTmp->traceRouteCtlDescrLen);
  938.             cptr =
  939.                 read_config_store_data(ASN_UNSIGNED, cptr,
  940.                                        &StorageTmp->traceRouteCtlMaxRows,
  941.                                        &tmpint);
  942.             cptr =
  943.                 read_config_store_data(ASN_OCTET_STR, cptr,
  944.                                        &StorageTmp->
  945.                                        traceRouteCtlTrapGeneration,
  946.                                        &StorageTmp->
  947.                                        traceRouteCtlTrapGenerationLen);
  948.             cptr =
  949.                 read_config_store_data(ASN_INTEGER, cptr,
  950.                                        &StorageTmp->
  951.                                        traceRouteCtlCreateHopsEntries,
  952.                                        &tmpint);
  953.             cptr =
  954.                 read_config_store_data(ASN_OBJECT_ID, cptr,
  955.                                        &StorageTmp->traceRouteCtlType,
  956.                                        &StorageTmp->traceRouteCtlTypeLen);
  957.             cptr =
  958.                 read_config_store_data(ASN_INTEGER, cptr,
  959.                                        &StorageTmp->traceRouteCtlRowStatus,
  960.                                        &tmpint);
  961.             cptr =
  962.                 read_config_store_data(ASN_UNSIGNED, cptr,
  963.                                        &StorageTmp->
  964.                                        traceRouteProbeHistoryMaxIndex,
  965.                                        &tmpint);
  966.             snmpd_store_config(line);
  967.         }
  968.     }
  969.     DEBUGMSGTL(("traceRouteCtlTable", "done.n"));
  970.     return SNMPERR_SUCCESS;
  971. }
  972. /*
  973.  * var_traceRouteCtlTable():
  974.  *   Handle this table separately from the scalar value case.
  975.  *   The workings of this are basically the same as for var_mteObjectsTable above.
  976.  */
  977. unsigned char  *
  978. var_traceRouteCtlTable(struct variable *vp,
  979.                        oid * name,
  980.                        size_t *length,
  981.                        int exact,
  982.                        size_t *var_len, WriteMethod ** write_method)
  983. {
  984.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  985.     /*
  986.      * this assumes you have registered all your data properly
  987.      */
  988.     if ((StorageTmp =
  989.          header_complex(traceRouteCtlTableStorage, vp, name, length, exact,
  990.                         var_len, write_method)) == NULL) {
  991.         if (vp->magic == COLUMN_TRACEROUTECTLROWSTATUS)
  992.             *write_method = write_traceRouteCtlRowStatus;
  993.         return NULL;
  994.     }
  995.     /*
  996.      * this is where we do the value assignments for the mib results.
  997.      */
  998.     switch (vp->magic) {
  999.     case COLUMN_TRACEROUTECTLTARGETADDRESSTYPE:
  1000.         *write_method = write_traceRouteCtlTargetAddressType;
  1001.         *var_len = sizeof(StorageTmp->traceRouteCtlTargetAddressType);
  1002.         return (u_char *) & StorageTmp->traceRouteCtlTargetAddressType;
  1003.     case COLUMN_TRACEROUTECTLTARGETADDRESS:
  1004.         *write_method = write_traceRouteCtlTargetAddress;
  1005.         *var_len = (StorageTmp->traceRouteCtlTargetAddressLen);
  1006.         return (u_char *) StorageTmp->traceRouteCtlTargetAddress;
  1007.     case COLUMN_TRACEROUTECTLBYPASSROUTETABLE:
  1008.         *write_method = write_traceRouteCtlByPassRouteTable;
  1009.         *var_len = sizeof(StorageTmp->traceRouteCtlByPassRouteTable);
  1010.         return (u_char *) & StorageTmp->traceRouteCtlByPassRouteTable;
  1011.     case COLUMN_TRACEROUTECTLDATASIZE:
  1012.         *write_method = write_traceRouteCtlDataSize;
  1013.         *var_len = sizeof(StorageTmp->traceRouteCtlDataSize);
  1014.         return (u_char *) & StorageTmp->traceRouteCtlDataSize;
  1015.     case COLUMN_TRACEROUTECTLTIMEOUT:
  1016.         *write_method = write_traceRouteCtlTimeOut;
  1017.         *var_len = sizeof(StorageTmp->traceRouteCtlTimeOut);
  1018.         return (u_char *) & StorageTmp->traceRouteCtlTimeOut;
  1019.     case COLUMN_TRACEROUTECTLPROBESPERHOP:
  1020.         *write_method = write_traceRouteCtlProbesPerHop;
  1021.         *var_len = sizeof(StorageTmp->traceRouteCtlProbesPerHop);
  1022.         return (u_char *) & StorageTmp->traceRouteCtlProbesPerHop;
  1023.     case COLUMN_TRACEROUTECTLPORT:
  1024.         *write_method = write_traceRouteCtlPort;
  1025.         *var_len = sizeof(StorageTmp->traceRouteCtlPort);
  1026.         return (u_char *) & StorageTmp->traceRouteCtlPort;
  1027.     case COLUMN_TRACEROUTECTLMAXTTL:
  1028.         *write_method = write_traceRouteCtlMaxTtl;
  1029.         *var_len = sizeof(StorageTmp->traceRouteCtlMaxTtl);
  1030.         return (u_char *) & StorageTmp->traceRouteCtlMaxTtl;
  1031.     case COLUMN_TRACEROUTECTLDSFIELD:
  1032.         *write_method = write_traceRouteCtlDSField;
  1033.         *var_len = sizeof(StorageTmp->traceRouteCtlDSField);
  1034.         return (u_char *) & StorageTmp->traceRouteCtlDSField;
  1035.     case COLUMN_TRACEROUTECTLSOURCEADDRESSTYPE:
  1036.         *write_method = write_traceRouteCtlSourceAddressType;
  1037.         *var_len = sizeof(StorageTmp->traceRouteCtlSourceAddressType);
  1038.         return (u_char *) & StorageTmp->traceRouteCtlSourceAddressType;
  1039.     case COLUMN_TRACEROUTECTLSOURCEADDRESS:
  1040.         *write_method = write_traceRouteCtlSourceAddress;
  1041.         *var_len = (StorageTmp->traceRouteCtlSourceAddressLen);
  1042.         return (u_char *) StorageTmp->traceRouteCtlSourceAddress;
  1043.     case COLUMN_TRACEROUTECTLIFINDEX:
  1044.         *write_method = write_traceRouteCtlIfIndex;
  1045.         *var_len = sizeof(StorageTmp->traceRouteCtlIfIndex);
  1046.         return (u_char *) & StorageTmp->traceRouteCtlIfIndex;
  1047.     case COLUMN_TRACEROUTECTLMISCOPTIONS:
  1048.         *write_method = write_traceRouteCtlMiscOptions;
  1049.         *var_len = (StorageTmp->traceRouteCtlMiscOptionsLen);
  1050.         return (u_char *) StorageTmp->traceRouteCtlMiscOptions;
  1051.     case COLUMN_TRACEROUTECTLMAXFAILURES:
  1052.         *write_method = write_traceRouteCtlMaxFailures;
  1053.         *var_len = sizeof(StorageTmp->traceRouteCtlMaxFailures);
  1054.         return (u_char *) & StorageTmp->traceRouteCtlMaxFailures;
  1055.     case COLUMN_TRACEROUTECTLDONTFRAGMENT:
  1056.         *write_method = write_traceRouteCtlDontFragment;
  1057.         *var_len = sizeof(StorageTmp->traceRouteCtlDontFragment);
  1058.         return (u_char *) & StorageTmp->traceRouteCtlDontFragment;
  1059.     case COLUMN_TRACEROUTECTLINITIALTTL:
  1060.         *write_method = write_traceRouteCtlInitialTtl;
  1061.         *var_len = sizeof(StorageTmp->traceRouteCtlInitialTtl);
  1062.         return (u_char *) & StorageTmp->traceRouteCtlInitialTtl;
  1063.     case COLUMN_TRACEROUTECTLFREQUENCY:
  1064.         *write_method = write_traceRouteCtlFrequency;
  1065.         *var_len = sizeof(StorageTmp->traceRouteCtlFrequency);
  1066.         return (u_char *) & StorageTmp->traceRouteCtlFrequency;
  1067.     case COLUMN_TRACEROUTECTLSTORAGETYPE:
  1068.         *write_method = write_traceRouteCtlStorageType;
  1069.         *var_len = sizeof(StorageTmp->traceRouteCtlStorageType);
  1070.         return (u_char *) & StorageTmp->traceRouteCtlStorageType;
  1071.     case COLUMN_TRACEROUTECTLADMINSTATUS:
  1072.         *write_method = write_traceRouteCtlAdminStatus;
  1073.         *var_len = sizeof(StorageTmp->traceRouteCtlAdminStatus);
  1074.         return (u_char *) & StorageTmp->traceRouteCtlAdminStatus;
  1075.     case COLUMN_TRACEROUTECTLDESCR:
  1076.         *write_method = write_traceRouteCtlDescr;
  1077.         *var_len = (StorageTmp->traceRouteCtlDescrLen);
  1078.         return (u_char *) StorageTmp->traceRouteCtlDescr;
  1079.     case COLUMN_TRACEROUTECTLMAXROWS:
  1080.         *write_method = write_traceRouteCtlMaxRows;
  1081.         *var_len = sizeof(StorageTmp->traceRouteCtlMaxRows);
  1082.         return (u_char *) & StorageTmp->traceRouteCtlMaxRows;
  1083.     case COLUMN_TRACEROUTECTLTRAPGENERATION:
  1084.         *write_method = write_traceRouteCtlTrapGeneration;
  1085.         *var_len = (StorageTmp->traceRouteCtlTrapGenerationLen);
  1086.         return (u_char *) StorageTmp->traceRouteCtlTrapGeneration;
  1087.     case COLUMN_TRACEROUTECTLCREATEHOPSENTRIES:
  1088.         *write_method = write_traceRouteCtlCreateHopsEntries;
  1089.         *var_len = sizeof(StorageTmp->traceRouteCtlCreateHopsEntries);
  1090.         return (u_char *) & StorageTmp->traceRouteCtlCreateHopsEntries;
  1091.     case COLUMN_TRACEROUTECTLTYPE:
  1092.         *write_method = write_traceRouteCtlType;
  1093.         *var_len = (StorageTmp->traceRouteCtlTypeLen) * sizeof(oid);
  1094.         return (u_char *) StorageTmp->traceRouteCtlType;
  1095.     case COLUMN_TRACEROUTECTLROWSTATUS:
  1096.         *write_method = write_traceRouteCtlRowStatus;
  1097.         *var_len = sizeof(StorageTmp->traceRouteCtlRowStatus);
  1098.         return (u_char *) & StorageTmp->traceRouteCtlRowStatus;
  1099.     default:
  1100.         ERROR_MSG("");
  1101.     }
  1102.     return NULL;
  1103. }
  1104. int
  1105. traceRouteResultsTable_del(struct traceRouteCtlTable_data *thedata)
  1106. {
  1107.     struct header_complex_index *hciptr2 = NULL;
  1108.     struct traceRouteResultsTable_data *StorageDel = NULL;
  1109.     netsnmp_variable_list *vars = NULL;
  1110.     oid             newoid[MAX_OID_LEN];
  1111.     size_t          newoid_len = 0;
  1112.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen);   /* traceRouteCtlOwnerIndex */
  1113.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen);       /* traceRouteCtlTestName */
  1114.     bzero(newoid, sizeof(oid) * MAX_OID_LEN);
  1115.     header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars);
  1116.     for (hciptr2 = traceRouteResultsTableStorage; hciptr2 != NULL;
  1117.          hciptr2 = hciptr2->next) {
  1118.         if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
  1119.             == 0) {
  1120.             StorageDel =
  1121.                 header_complex_extract_entry
  1122.                 (&traceRouteResultsTableStorage, hciptr2);
  1123.             DEBUGMSGTL(("traceRouteResultsTable", "delete  success!n"));
  1124.         }
  1125.     }
  1126.     vars = NULL;
  1127.     return SNMPERR_SUCCESS;
  1128. }
  1129. int
  1130. traceRouteProbeHistoryTable_del(struct traceRouteCtlTable_data *thedata)
  1131. {
  1132.     struct header_complex_index *hciptr2 = NULL;
  1133.     struct traceRouteProbeHistoryTable_data *StorageDel = NULL;
  1134.     netsnmp_variable_list *vars = NULL;
  1135.     netsnmp_variable_list *vars_temp = NULL;
  1136.     oid             newoid[MAX_OID_LEN];
  1137.     size_t          newoid_len = 0;
  1138.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen);   /* traceRouteCtlOwnerIndex */
  1139.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen);       /* traceRouteCtlOperationName */
  1140.     bzero(newoid, sizeof(oid) * MAX_OID_LEN);
  1141.     header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars);
  1142.     for (hciptr2 = traceRouteProbeHistoryTableStorage; hciptr2 != NULL;
  1143.          hciptr2 = hciptr2->next) {
  1144.         if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
  1145.             == 0) {
  1146.             StorageDel =
  1147.                 header_complex_extract_entry
  1148.                 (&traceRouteProbeHistoryTableStorage, hciptr2);
  1149.             DEBUGMSGTL(("traceRouteProbeHistoryTable",
  1150.                         "delete  success!n"));
  1151.         }
  1152.     }
  1153.     vars = NULL;
  1154.     return SNMPERR_SUCCESS;
  1155. }
  1156. int
  1157. traceRouteHopsTable_del(struct traceRouteCtlTable_data *thedata)
  1158. {
  1159.     struct header_complex_index *hciptr2 = NULL;
  1160.     struct traceRouteHopsTable_data *StorageDel = NULL;
  1161.     netsnmp_variable_list *vars = NULL;
  1162.     netsnmp_variable_list *vars_temp = NULL;
  1163.     oid             newoid[MAX_OID_LEN];
  1164.     size_t          newoid_len = 0;
  1165.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen);   /* traceRouteCtlOwnerIndex */
  1166.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen);       /* traceRouteCtlTestName */
  1167.     bzero(newoid, sizeof(oid) * MAX_OID_LEN);
  1168.     header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars);
  1169.     for (hciptr2 = traceRouteHopsTableStorage; hciptr2 != NULL;
  1170.          hciptr2 = hciptr2->next) {
  1171.         if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
  1172.             == 0) {
  1173.             StorageDel =
  1174.                 header_complex_extract_entry(&traceRouteHopsTableStorage,
  1175.                                              hciptr2);
  1176.             DEBUGMSGTL(("traceRouteHopsTable", "delete  success!n"));
  1177.         }
  1178.     }
  1179.     vars = NULL;
  1180.     return SNMPERR_SUCCESS;
  1181. }
  1182. /*
  1183.  * send trap 
  1184.  */
  1185. int
  1186. send_traceRoute_trap(struct traceRouteCtlTable_data *item,
  1187.                      oid * trap_oid, size_t trap_oid_len)
  1188. {
  1189.     static oid      objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };     /* snmpTrapIOD.0 */
  1190.     struct traceRouteResultsTable_data *StorageTmp = NULL;
  1191.     struct traceRouteHopsTable_data *StorageHops = NULL;
  1192.     netsnmp_variable_list *var_list = NULL;
  1193.     netsnmp_variable_list *vars = NULL;
  1194.     netsnmp_variable_list *var_hops = NULL;
  1195.     oid             newoid[MAX_OID_LEN];
  1196.     size_t          newoid_len = 0;
  1197.     oid             indexoid[MAX_OID_LEN];
  1198.     size_t          indexoid_len = 0;
  1199.     struct header_complex_index *hciptr;
  1200.     oid             tempoid[MAX_OID_LEN];
  1201.     size_t          tempoid_len = 0;
  1202.     oid             traceRouteCtlTargetAddress[] =
  1203.         { 1, 3, 6, 1, 2, 1, 81, 1, 2, 1, 4 };
  1204.     oid             traceRouteHopsIpTgAddress[] =
  1205.         { 1, 3, 6, 1, 2, 1, 81, 1, 5, 1, 3 };
  1206.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlOwnerIndex, item->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
  1207.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlTestName, item->traceRouteCtlTestNameLen);     /* traceRouteCtlTestName */
  1208.     /*
  1209.      * snmpTrap oid 
  1210.      */
  1211.     snmp_varlist_add_variable(&var_list, objid_snmptrap,
  1212.                               sizeof(objid_snmptrap) / sizeof(oid),
  1213.                               ASN_OBJECT_ID, (u_char *) trap_oid,
  1214.                               trap_oid_len * sizeof(oid));
  1215.     /*
  1216.      * traceRouteCtlTargetAddress 
  1217.      */
  1218.     bzero(newoid, MAX_OID_LEN * sizeof(oid));
  1219.     header_complex_generate_oid(newoid, &newoid_len,
  1220.                                 traceRouteCtlTargetAddress,
  1221.                                 sizeof(traceRouteCtlTargetAddress) /
  1222.                                 sizeof(oid), vars);
  1223.     snmp_varlist_add_variable(&var_list, newoid,
  1224.                               newoid_len,
  1225.                               ASN_OCTET_STR,
  1226.                               (u_char *) item->traceRouteCtlTargetAddress,
  1227.                               item->traceRouteCtlTargetAddressLen);
  1228.     for (hciptr = traceRouteHopsTableStorage; hciptr != NULL;
  1229.          hciptr = hciptr->next) {
  1230.         bzero(indexoid, MAX_OID_LEN * sizeof(oid));
  1231.         header_complex_generate_oid(indexoid, &indexoid_len, NULL, 0,
  1232.                                     vars);
  1233.         if (snmp_oid_compare
  1234.             (indexoid, indexoid_len, hciptr->name, indexoid_len) == 0) {
  1235.             StorageHops =
  1236.                 (struct traceRouteHopsTable_data *)
  1237.                 header_complex_get_from_oid(traceRouteHopsTableStorage,
  1238.                                             hciptr->name, hciptr->namelen);
  1239.             bzero(tempoid, MAX_OID_LEN * sizeof(oid));
  1240.             header_complex_generate_oid(tempoid, &tempoid_len,
  1241.                                         traceRouteHopsIpTgAddress,
  1242.                                         sizeof(traceRouteHopsIpTgAddress) /
  1243.                                         sizeof(oid), vars);
  1244.             snmp_varlist_add_variable(&var_hops, NULL, 0, ASN_UNSIGNED, (char *) &StorageHops->traceRouteHopsHopIndex, sizeof(StorageHops->traceRouteHopsHopIndex));    /* traceRouteCtlTestName */
  1245.             bzero(newoid, MAX_OID_LEN * sizeof(oid));
  1246.             header_complex_generate_oid(newoid, &newoid_len, tempoid,
  1247.                                         tempoid_len, var_hops);
  1248.             snmp_varlist_add_variable(&var_list, newoid, newoid_len,
  1249.                                       ASN_OCTET_STR,
  1250.                                       (u_char *) StorageHops->
  1251.                                       traceRouteHopsIpTgtAddress,
  1252.                                       StorageHops->
  1253.                                       traceRouteHopsIpTgtAddressLen);
  1254.             var_hops = NULL;
  1255.         }
  1256.     }
  1257.     /*
  1258.      * XXX: stuff based on event table 
  1259.      */
  1260.     DEBUGMSG(("pingTest:send_ping_trap", "success!n"));
  1261.     send_v2trap(var_list);
  1262.     snmp_free_varbind(vars);
  1263.     vars = NULL;
  1264.     snmp_free_varbind(var_list);
  1265.     var_list = NULL;
  1266. }
  1267. int
  1268. write_traceRouteCtlTargetAddressType(int action,
  1269.                                      u_char * var_val,
  1270.                                      u_char var_val_type,
  1271.                                      size_t var_val_len,
  1272.                                      u_char * statP, oid * name,
  1273.                                      size_t name_len)
  1274. {
  1275.     static size_t   tmpvar;
  1276.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  1277.     static size_t   tmplen;
  1278.     size_t          newlen =
  1279.         name_len -
  1280.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  1281.     if ((StorageTmp =
  1282.          header_complex(traceRouteCtlTableStorage, NULL,
  1283.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  1284.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  1285.                         NULL)) == NULL)
  1286.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  1287.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  1288.         return SNMP_ERR_NOTWRITABLE;
  1289.     }
  1290.     if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
  1291.         return SNMP_ERR_NOTWRITABLE;
  1292.     }
  1293.     switch (action) {
  1294.     case RESERVE1:
  1295.         if (var_val_type != ASN_INTEGER) {
  1296.             snmp_log(LOG_ERR,
  1297.                      "write to traceRouteCtlTargetAddressType not ASN_INTEGERn");
  1298.             return SNMP_ERR_WRONGTYPE;
  1299.         }
  1300.         break;
  1301.     case RESERVE2:
  1302.         /*
  1303.          * memory reseveration, final preparation... 
  1304.          */
  1305.         break;
  1306.     case FREE:
  1307.         /*
  1308.          * Release any resources that have been allocated 
  1309.          */
  1310.         break;
  1311.     case ACTION:
  1312.         /*
  1313.          * The variable has been stored in objid for
  1314.          * you to use, and you have just been asked to do something with
  1315.          * it.  Note that anything done here must be reversable in the UNDO case 
  1316.          */
  1317.         tmpvar = StorageTmp->traceRouteCtlTargetAddressType;
  1318.         StorageTmp->traceRouteCtlTargetAddressType = *((long *) var_val);
  1319.         break;
  1320.     case UNDO:
  1321.         /*
  1322.          * Back out any changes made in the ACTION case 
  1323.          */
  1324.         StorageTmp->traceRouteCtlTargetAddressType = tmpvar;
  1325.         break;
  1326.     case COMMIT:
  1327.         /*
  1328.          * Things are working well, so it's now safe to make the change
  1329.          * permanently.  Make sure that anything done here can't fail! 
  1330.          */
  1331.         break;
  1332.     }
  1333.     return SNMP_ERR_NOERROR;
  1334. }
  1335. int
  1336. write_traceRouteCtlTargetAddress(int action,
  1337.                                  u_char * var_val,
  1338.                                  u_char var_val_type,
  1339.                                  size_t var_val_len,
  1340.                                  u_char * statP, oid * name,
  1341.                                  size_t name_len)
  1342. {
  1343.     static char    *tmpvar;
  1344.     static size_t   tmplen;
  1345.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  1346.     size_t          newlen =
  1347.         name_len -
  1348.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  1349.     if ((StorageTmp =
  1350.          header_complex(traceRouteCtlTableStorage, NULL,
  1351.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  1352.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  1353.                         NULL)) == NULL)
  1354.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  1355.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  1356.         return SNMP_ERR_NOTWRITABLE;
  1357.     }
  1358.     if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
  1359.         return SNMP_ERR_NOTWRITABLE;
  1360.     }
  1361.     switch (action) {
  1362.     case RESERVE1:
  1363.         if (var_val_type != ASN_OCTET_STR) {
  1364.             snmp_log(LOG_ERR,
  1365.                      "write to traceRouteCtlTargetAddress not ASN_OCTET_STRn");
  1366.             return SNMP_ERR_WRONGTYPE;
  1367.         }
  1368.         break;
  1369.     case RESERVE2:
  1370.         /*
  1371.          * memory reseveration, final preparation... 
  1372.          */
  1373.         break;
  1374.     case FREE:
  1375.         /*
  1376.          * Release any resources that have been allocated 
  1377.          */
  1378.         break;
  1379.     case ACTION:
  1380.         /*
  1381.          * The variable has been stored in long_ret for
  1382.          * you to use, and you have just been asked to do something with
  1383.          * it.  Note that anything done here must be reversable in the UNDO case 
  1384.          */
  1385.         tmpvar = StorageTmp->traceRouteCtlTargetAddress;
  1386.         tmplen = StorageTmp->traceRouteCtlTargetAddressLen;
  1387.         StorageTmp->traceRouteCtlTargetAddress =
  1388.             (char *) malloc(var_val_len + 1);
  1389.         if (StorageTmp->traceRouteCtlTargetAddress == NULL) {
  1390.             exit(1);
  1391.         }
  1392.         memcpy(StorageTmp->traceRouteCtlTargetAddress, var_val,
  1393.                var_val_len);
  1394.         StorageTmp->traceRouteCtlTargetAddress[var_val_len] = '';
  1395.         StorageTmp->traceRouteCtlTargetAddressLen = var_val_len;
  1396.         break;
  1397.     case UNDO:
  1398.         /*
  1399.          * Back out any changes made in the ACTION case 
  1400.          */
  1401.         SNMP_FREE(StorageTmp->traceRouteCtlTargetAddress);
  1402.         StorageTmp->traceRouteCtlTargetAddress = NULL;
  1403.         StorageTmp->traceRouteCtlTargetAddress = tmpvar;
  1404.         StorageTmp->traceRouteCtlTargetAddressLen = tmplen;
  1405.         break;
  1406.     case COMMIT:
  1407.         /*
  1408.          * Things are working well, so it's now safe to make the change
  1409.          * permanently.  Make sure that anything done here can't fail! 
  1410.          */
  1411.         SNMP_FREE(tmpvar);
  1412.         tmpvar = NULL;
  1413.         break;
  1414.     }
  1415.     return SNMP_ERR_NOERROR;
  1416. }
  1417. int
  1418. write_traceRouteCtlByPassRouteTable(int action,
  1419.                                     u_char * var_val,
  1420.                                     u_char var_val_type,
  1421.                                     size_t var_val_len,
  1422.                                     u_char * statP, oid * name,
  1423.                                     size_t name_len)
  1424. {
  1425.     static size_t   tmpvar;
  1426.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  1427.     static size_t   tmplen;
  1428.     size_t          newlen =
  1429.         name_len -
  1430.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  1431.     if ((StorageTmp =
  1432.          header_complex(traceRouteCtlTableStorage, NULL,
  1433.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  1434.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  1435.                         NULL)) == NULL)
  1436.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  1437.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  1438.         return SNMP_ERR_NOTWRITABLE;
  1439.     }
  1440.     if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
  1441.         return SNMP_ERR_NOTWRITABLE;
  1442.     }
  1443.     switch (action) {
  1444.     case RESERVE1:
  1445.         if (var_val_type != ASN_INTEGER) {
  1446.             snmp_log(LOG_ERR,
  1447.                      "write to traceRouteCtlTargetAddressType not ASN_INTEGERn");
  1448.             return SNMP_ERR_WRONGTYPE;
  1449.         }
  1450.         break;
  1451.     case RESERVE2:
  1452.         /*
  1453.          * memory reseveration, final preparation... 
  1454.          */
  1455.         break;
  1456.     case FREE:
  1457.         /*
  1458.          * Release any resources that have been allocated 
  1459.          */
  1460.         break;
  1461.     case ACTION:
  1462.         /*
  1463.          * The variable has been stored in objid for
  1464.          * you to use, and you have just been asked to do something with
  1465.          * it.  Note that anything done here must be reversable in the UNDO case 
  1466.          */
  1467.         tmpvar = StorageTmp->traceRouteCtlByPassRouteTable;
  1468.         StorageTmp->traceRouteCtlByPassRouteTable = *((long *) var_val);
  1469.         break;
  1470.     case UNDO:
  1471.         /*
  1472.          * Back out any changes made in the ACTION case 
  1473.          */
  1474.         StorageTmp->traceRouteCtlByPassRouteTable = tmpvar;
  1475.         break;
  1476.     case COMMIT:
  1477.         /*
  1478.          * Things are working well, so it's now safe to make the change
  1479.          * permanently.  Make sure that anything done here can't fail! 
  1480.          */
  1481.         break;
  1482.     }
  1483.     return SNMP_ERR_NOERROR;
  1484. }
  1485. int
  1486. write_traceRouteCtlDataSize(int action,
  1487.                             u_char * var_val,
  1488.                             u_char var_val_type,
  1489.                             size_t var_val_len,
  1490.                             u_char * statP, oid * name, size_t name_len)
  1491. {
  1492.     static size_t   tmpvar;
  1493.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  1494.     static size_t   tmplen;
  1495.     size_t          newlen =
  1496.         name_len -
  1497.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  1498.     if ((StorageTmp =
  1499.          header_complex(traceRouteCtlTableStorage, NULL,
  1500.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  1501.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  1502.                         NULL)) == NULL)
  1503.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  1504.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  1505.         return SNMP_ERR_NOTWRITABLE;
  1506.     }
  1507.     if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
  1508.         return SNMP_ERR_NOTWRITABLE;
  1509.     }
  1510.     switch (action) {
  1511.     case RESERVE1:
  1512.         if (var_val_type != ASN_UNSIGNED) {
  1513.             snmp_log(LOG_ERR,
  1514.                      "write to traceRouteCtlDataSize not ASN_UNSIGNEDn");
  1515.             return SNMP_ERR_WRONGTYPE;
  1516.         }
  1517.         break;
  1518.     case RESERVE2:
  1519.         /*
  1520.          * memory reseveration, final preparation... 
  1521.          */
  1522.         break;
  1523.     case FREE:
  1524.         /*
  1525.          * Release any resources that have been allocated 
  1526.          */
  1527.         break;
  1528.     case ACTION:
  1529.         /*
  1530.          * The variable has been stored in objid for
  1531.          * you to use, and you have just been asked to do something with
  1532.          * it.  Note that anything done here must be reversable in the UNDO case 
  1533.          */
  1534.         tmpvar = StorageTmp->traceRouteCtlDataSize;
  1535.         if ((*((long *) var_val)) >= 0 && (*((long *) var_val)) <= 65507)
  1536.             StorageTmp->traceRouteCtlDataSize = *((long *) var_val);
  1537.         else
  1538.             StorageTmp->traceRouteCtlDataSize = 56;
  1539.         break;
  1540.     case UNDO:
  1541.         /*
  1542.          * Back out any changes made in the ACTION case 
  1543.          */
  1544.         StorageTmp->traceRouteCtlDataSize = tmpvar;
  1545.         break;
  1546.     case COMMIT:
  1547.         /*
  1548.          * Things are working well, so it's now safe to make the change
  1549.          * permanently.  Make sure that anything done here can't fail! 
  1550.          */
  1551.         break;
  1552.     }
  1553.     return SNMP_ERR_NOERROR;
  1554. }
  1555. int
  1556. write_traceRouteCtlTimeOut(int action,
  1557.                            u_char * var_val,
  1558.                            u_char var_val_type,
  1559.                            size_t var_val_len,
  1560.                            u_char * statP, oid * name, size_t name_len)
  1561. {
  1562.     static size_t   tmpvar;
  1563.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  1564.     static size_t   tmplen;
  1565.     size_t          newlen =
  1566.         name_len -
  1567.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  1568.     if ((StorageTmp =
  1569.          header_complex(traceRouteCtlTableStorage, NULL,
  1570.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  1571.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  1572.                         NULL)) == NULL)
  1573.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  1574.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  1575.         return SNMP_ERR_NOTWRITABLE;
  1576.     }
  1577.     if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
  1578.         return SNMP_ERR_NOTWRITABLE;
  1579.     }
  1580.     switch (action) {
  1581.     case RESERVE1:
  1582.         if (var_val_type != ASN_UNSIGNED) {
  1583.             snmp_log(LOG_ERR,
  1584.                      "write to traceRouteCtlDataSize not ASN_UNSIGNEDn");
  1585.             return SNMP_ERR_WRONGTYPE;
  1586.         }
  1587.         break;
  1588.     case RESERVE2:
  1589.         /*
  1590.          * memory reseveration, final preparation... 
  1591.          */
  1592.         break;
  1593.     case FREE:
  1594.         /*
  1595.          * Release any resources that have been allocated 
  1596.          */
  1597.         break;
  1598.     case ACTION:
  1599.         /*
  1600.          * The variable has been stored in objid for
  1601.          * you to use, and you have just been asked to do something with
  1602.          * it.  Note that anything done here must be reversable in the UNDO case 
  1603.          */
  1604.         tmpvar = StorageTmp->traceRouteCtlTimeOut;
  1605.         if ((*((long *) var_val)) >= 1 && (*((long *) var_val)) <= 60)
  1606.             StorageTmp->traceRouteCtlTimeOut = *((long *) var_val);
  1607.         else
  1608.             StorageTmp->traceRouteCtlTimeOut = 3;
  1609.         break;
  1610.     case UNDO:
  1611.         /*
  1612.          * Back out any changes made in the ACTION case 
  1613.          */
  1614.         StorageTmp->traceRouteCtlTimeOut = tmpvar;
  1615.         break;
  1616.     case COMMIT:
  1617.         /*
  1618.          * Things are working well, so it's now safe to make the change
  1619.          * permanently.  Make sure that anything done here can't fail! 
  1620.          */
  1621.         break;
  1622.     }
  1623.     return SNMP_ERR_NOERROR;
  1624. }
  1625. int
  1626. write_traceRouteCtlProbesPerHop(int action,
  1627.                                 u_char * var_val,
  1628.                                 u_char var_val_type,
  1629.                                 size_t var_val_len,
  1630.                                 u_char * statP, oid * name,
  1631.                                 size_t name_len)
  1632. {
  1633.     static size_t   tmpvar;
  1634.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  1635.     static size_t   tmplen;
  1636.     size_t          newlen =
  1637.         name_len -
  1638.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  1639.     if ((StorageTmp =
  1640.          header_complex(traceRouteCtlTableStorage, NULL,
  1641.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  1642.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  1643.                         NULL)) == NULL)
  1644.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  1645.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  1646.         return SNMP_ERR_NOTWRITABLE;
  1647.     }
  1648.     if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
  1649.         return SNMP_ERR_NOTWRITABLE;
  1650.     }
  1651.     switch (action) {
  1652.     case RESERVE1:
  1653.         if (var_val_type != ASN_UNSIGNED) {
  1654.             snmp_log(LOG_ERR,
  1655.                      "write to traceRouteCtlDataSize not ASN_UNSIGNEDn");
  1656.             return SNMP_ERR_WRONGTYPE;
  1657.         }
  1658.         break;
  1659.     case RESERVE2:
  1660.         /*
  1661.          * memory reseveration, final preparation... 
  1662.          */
  1663.         break;
  1664.     case FREE:
  1665.         /*
  1666.          * Release any resources that have been allocated 
  1667.          */
  1668.         break;
  1669.     case ACTION:
  1670.         /*
  1671.          * The variable has been stored in objid for
  1672.          * you to use, and you have just been asked to do something with
  1673.          * it.  Note that anything done here must be reversable in the UNDO case 
  1674.          */
  1675.         tmpvar = StorageTmp->traceRouteCtlProbesPerHop;
  1676.         if ((*((long *) var_val)) >= 1 && (*((long *) var_val)) <= 10)
  1677.             StorageTmp->traceRouteCtlProbesPerHop = *((long *) var_val);
  1678.         else
  1679.             StorageTmp->traceRouteCtlProbesPerHop = 3;
  1680.         break;
  1681.     case UNDO:
  1682.         /*
  1683.          * Back out any changes made in the ACTION case 
  1684.          */
  1685.         StorageTmp->traceRouteCtlProbesPerHop = tmpvar;
  1686.         break;
  1687.     case COMMIT:
  1688.         /*
  1689.          * Things are working well, so it's now safe to make the change
  1690.          * permanently.  Make sure that anything done here can't fail! 
  1691.          */
  1692.         break;
  1693.     }
  1694.     return SNMP_ERR_NOERROR;
  1695. }
  1696. int
  1697. write_traceRouteCtlPort(int action,
  1698.                         u_char * var_val,
  1699.                         u_char var_val_type,
  1700.                         size_t var_val_len,
  1701.                         u_char * statP, oid * name, size_t name_len)
  1702. {
  1703.     static size_t   tmpvar;
  1704.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  1705.     static size_t   tmplen;
  1706.     size_t          newlen =
  1707.         name_len -
  1708.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  1709.     if ((StorageTmp =
  1710.          header_complex(traceRouteCtlTableStorage, NULL,
  1711.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  1712.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  1713.                         NULL)) == NULL)
  1714.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  1715.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  1716.         return SNMP_ERR_NOTWRITABLE;
  1717.     }
  1718.     switch (action) {
  1719.     case RESERVE1:
  1720.         if (var_val_type != ASN_UNSIGNED) {
  1721.             snmp_log(LOG_ERR,
  1722.                      "write to traceRouteCtlTargetAddressType not ASN_UNSIGNEDn");
  1723.             return SNMP_ERR_WRONGTYPE;
  1724.         }
  1725.         break;
  1726.     case RESERVE2:
  1727.         /*
  1728.          * memory reseveration, final preparation... 
  1729.          */
  1730.         break;
  1731.     case FREE:
  1732.         /*
  1733.          * Release any resources that have been allocated 
  1734.          */
  1735.         break;
  1736.     case ACTION:
  1737.         /*
  1738.          * The variable has been stored in objid for
  1739.          * you to use, and you have just been asked to do something with
  1740.          * it.  Note that anything done here must be reversable in the UNDO case 
  1741.          */
  1742.         tmpvar = StorageTmp->traceRouteCtlPort;
  1743.         StorageTmp->traceRouteCtlPort = *((long *) var_val);
  1744.         break;
  1745.     case UNDO:
  1746.         /*
  1747.          * Back out any changes made in the ACTION case 
  1748.          */
  1749.         StorageTmp->traceRouteCtlPort = tmpvar;
  1750.         break;
  1751.     case COMMIT:
  1752.         /*
  1753.          * Things are working well, so it's now safe to make the change
  1754.          * permanently.  Make sure that anything done here can't fail! 
  1755.          */
  1756.         break;
  1757.     }
  1758.     return SNMP_ERR_NOERROR;
  1759. }
  1760. int
  1761. write_traceRouteCtlMaxTtl(int action,
  1762.                           u_char * var_val,
  1763.                           u_char var_val_type,
  1764.                           size_t var_val_len,
  1765.                           u_char * statP, oid * name, size_t name_len)
  1766. {
  1767.     static size_t   tmpvar;
  1768.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  1769.     static size_t   tmplen;
  1770.     size_t          newlen =
  1771.         name_len -
  1772.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  1773.     if ((StorageTmp =
  1774.          header_complex(traceRouteCtlTableStorage, NULL,
  1775.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  1776.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  1777.                         NULL)) == NULL)
  1778.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  1779.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  1780.         return SNMP_ERR_NOTWRITABLE;
  1781.     }
  1782.     if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
  1783.         return SNMP_ERR_NOTWRITABLE;
  1784.     }
  1785.     switch (action) {
  1786.     case RESERVE1:
  1787.         if (var_val_type != ASN_UNSIGNED) {
  1788.             snmp_log(LOG_ERR,
  1789.                      "write to traceRouteCtlDataSize not ASN_UNSIGNEDn");
  1790.             return SNMP_ERR_WRONGTYPE;
  1791.         }
  1792.         break;
  1793.     case RESERVE2:
  1794.         /*
  1795.          * memory reseveration, final preparation... 
  1796.          */
  1797.         break;
  1798.     case FREE:
  1799.         /*
  1800.          * Release any resources that have been allocated 
  1801.          */
  1802.         break;
  1803.     case ACTION:
  1804.         /*
  1805.          * The variable has been stored in objid for
  1806.          * you to use, and you have just been asked to do something with
  1807.          * it.  Note that anything done here must be reversable in the UNDO case 
  1808.          */
  1809.         tmpvar = StorageTmp->traceRouteCtlMaxTtl;
  1810.         if ((*((long *) var_val)) >= 1 && (*((long *) var_val)) <= 255)
  1811.             StorageTmp->traceRouteCtlMaxTtl = *((long *) var_val);
  1812.         else
  1813.             StorageTmp->traceRouteCtlMaxTtl = 30;
  1814.         break;
  1815.     case UNDO:
  1816.         /*
  1817.          * Back out any changes made in the ACTION case 
  1818.          */
  1819.         StorageTmp->traceRouteCtlMaxTtl = tmpvar;
  1820.         break;
  1821.     case COMMIT:
  1822.         /*
  1823.          * Things are working well, so it's now safe to make the change
  1824.          * permanently.  Make sure that anything done here can't fail! 
  1825.          */
  1826.         break;
  1827.     }
  1828.     return SNMP_ERR_NOERROR;
  1829. }
  1830. int
  1831. write_traceRouteCtlDSField(int action,
  1832.                            u_char * var_val,
  1833.                            u_char var_val_type,
  1834.                            size_t var_val_len,
  1835.                            u_char * statP, oid * name, size_t name_len)
  1836. {
  1837.     static size_t   tmpvar;
  1838.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  1839.     static size_t   tmplen;
  1840.     size_t          newlen =
  1841.         name_len -
  1842.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  1843.     if ((StorageTmp =
  1844.          header_complex(traceRouteCtlTableStorage, NULL,
  1845.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  1846.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  1847.                         NULL)) == NULL)
  1848.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  1849.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  1850.         return SNMP_ERR_NOTWRITABLE;
  1851.     }
  1852.     if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
  1853.         return SNMP_ERR_NOTWRITABLE;
  1854.     }
  1855.     switch (action) {
  1856.     case RESERVE1:
  1857.         if (var_val_type != ASN_UNSIGNED) {
  1858.             snmp_log(LOG_ERR,
  1859.                      "write to traceRouteCtlDataSize not ASN_UNSIGNEDn");
  1860.             return SNMP_ERR_WRONGTYPE;
  1861.         }
  1862.         break;
  1863.     case RESERVE2:
  1864.         /*
  1865.          * memory reseveration, final preparation... 
  1866.          */
  1867.         break;
  1868.     case FREE:
  1869.         /*
  1870.          * Release any resources that have been allocated 
  1871.          */
  1872.         break;
  1873.     case ACTION:
  1874.         /*
  1875.          * The variable has been stored in objid for
  1876.          * you to use, and you have just been asked to do something with
  1877.          * it.  Note that anything done here must be reversable in the UNDO case 
  1878.          */
  1879.         tmpvar = StorageTmp->traceRouteCtlDSField;
  1880.         StorageTmp->traceRouteCtlDSField = *((long *) var_val);
  1881.         break;
  1882.     case UNDO:
  1883.         /*
  1884.          * Back out any changes made in the ACTION case 
  1885.          */
  1886.         StorageTmp->traceRouteCtlDSField = tmpvar;
  1887.         break;
  1888.     case COMMIT:
  1889.         /*
  1890.          * Things are working well, so it's now safe to make the change
  1891.          * permanently.  Make sure that anything done here can't fail! 
  1892.          */
  1893.         break;
  1894.     }
  1895.     return SNMP_ERR_NOERROR;
  1896. }
  1897. int
  1898. write_traceRouteCtlSourceAddressType(int action,
  1899.                                      u_char * var_val,
  1900.                                      u_char var_val_type,
  1901.                                      size_t var_val_len,
  1902.                                      u_char * statP, oid * name,
  1903.                                      size_t name_len)
  1904. {
  1905.     static size_t   tmpvar;
  1906.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  1907.     static size_t   tmplen;
  1908.     size_t          newlen =
  1909.         name_len -
  1910.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  1911.     if ((StorageTmp =
  1912.          header_complex(traceRouteCtlTableStorage, NULL,
  1913.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  1914.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  1915.                         NULL)) == NULL)
  1916.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  1917.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  1918.         return SNMP_ERR_NOTWRITABLE;
  1919.     }
  1920.     if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
  1921.         return SNMP_ERR_NOTWRITABLE;
  1922.     }
  1923.     switch (action) {
  1924.     case RESERVE1:
  1925.         if (var_val_type != ASN_INTEGER) {
  1926.             snmp_log(LOG_ERR,
  1927.                      "write to traceRouteCtlMaxRows not ASN_INTEGERn");
  1928.             return SNMP_ERR_WRONGTYPE;
  1929.         }
  1930.         break;
  1931.     case RESERVE2:
  1932.         /*
  1933.          * memory reseveration, final preparation... 
  1934.          */
  1935.         break;
  1936.     case FREE:
  1937.         /*
  1938.          * Release any resources that have been allocated 
  1939.          */
  1940.         break;
  1941.     case ACTION:
  1942.         /*
  1943.          * The variable has been stored in objid for
  1944.          * you to use, and you have just been asked to do something with
  1945.          * it.  Note that anything done here must be reversable in the UNDO case 
  1946.          */
  1947.         tmpvar = StorageTmp->traceRouteCtlSourceAddressType;
  1948.         StorageTmp->traceRouteCtlSourceAddressType = *((long *) var_val);
  1949.         break;
  1950.     case UNDO:
  1951.         /*
  1952.          * Back out any changes made in the ACTION case 
  1953.          */
  1954.         StorageTmp->traceRouteCtlSourceAddressType = tmpvar;
  1955.         break;
  1956.     case COMMIT:
  1957.         /*
  1958.          * Things are working well, so it's now safe to make the change
  1959.          * permanently.  Make sure that anything done here can't fail! 
  1960.          */
  1961.         break;
  1962.     }
  1963.     return SNMP_ERR_NOERROR;
  1964. }
  1965. int
  1966. write_traceRouteCtlSourceAddress(int action,
  1967.                                  u_char * var_val,
  1968.                                  u_char var_val_type,
  1969.                                  size_t var_val_len,
  1970.                                  u_char * statP, oid * name,
  1971.                                  size_t name_len)
  1972. {
  1973.     static char    *tmpvar;
  1974.     static size_t   tmplen;
  1975.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  1976.     size_t          newlen =
  1977.         name_len -
  1978.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  1979.     if ((StorageTmp =
  1980.          header_complex(traceRouteCtlTableStorage, NULL,
  1981.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  1982.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  1983.                         NULL)) == NULL)
  1984.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  1985.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  1986.         return SNMP_ERR_NOTWRITABLE;
  1987.     }
  1988.     if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
  1989.         return SNMP_ERR_NOTWRITABLE;
  1990.     }
  1991.     switch (action) {
  1992.     case RESERVE1:
  1993.         if (var_val_type != ASN_OCTET_STR) {
  1994.             snmp_log(LOG_ERR,
  1995.                      "write to traceRouteCtlTargetAddress not ASN_OCTET_STRn");
  1996.             return SNMP_ERR_WRONGTYPE;
  1997.         }
  1998.         break;
  1999.     case RESERVE2:
  2000.         /*
  2001.          * memory reseveration, final preparation... 
  2002.          */
  2003.         break;
  2004.     case FREE:
  2005.         /*
  2006.          * Release any resources that have been allocated 
  2007.          */
  2008.         break;
  2009.     case ACTION:
  2010.         /*
  2011.          * The variable has been stored in long_ret for
  2012.          * you to use, and you have just been asked to do something with
  2013.          * it.  Note that anything done here must be reversable in the UNDO case 
  2014.          */
  2015.         tmpvar = StorageTmp->traceRouteCtlSourceAddress;
  2016.         tmplen = StorageTmp->traceRouteCtlSourceAddressLen;
  2017.         StorageTmp->traceRouteCtlSourceAddress =
  2018.             (char *) malloc(var_val_len + 1);
  2019.         if (StorageTmp->traceRouteCtlSourceAddress == NULL) {
  2020.             exit(1);
  2021.         }
  2022.         memcpy(StorageTmp->traceRouteCtlSourceAddress, var_val,
  2023.                var_val_len + 1);
  2024.         StorageTmp->traceRouteCtlSourceAddress[var_val_len] = '';
  2025.         StorageTmp->traceRouteCtlSourceAddressLen = var_val_len;
  2026.         break;
  2027.     case UNDO:
  2028.         /*
  2029.          * Back out any changes made in the ACTION case 
  2030.          */
  2031.         SNMP_FREE(StorageTmp->traceRouteCtlSourceAddress);
  2032.         StorageTmp->traceRouteCtlSourceAddress = NULL;
  2033.         StorageTmp->traceRouteCtlSourceAddress = tmpvar;
  2034.         StorageTmp->traceRouteCtlSourceAddressLen = tmplen;
  2035.         break;
  2036.     case COMMIT:
  2037.         /*
  2038.          * Things are working well, so it's now safe to make the change
  2039.          * permanently.  Make sure that anything done here can't fail! 
  2040.          */
  2041.         SNMP_FREE(tmpvar);
  2042.         tmpvar = NULL;
  2043.         break;
  2044.     }
  2045.     return SNMP_ERR_NOERROR;
  2046. }
  2047. int
  2048. write_traceRouteCtlIfIndex(int action,
  2049.                            u_char * var_val,
  2050.                            u_char var_val_type,
  2051.                            size_t var_val_len,
  2052.                            u_char * statP, oid * name, size_t name_len)
  2053. {
  2054.     static size_t   tmpvar;
  2055.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  2056.     static size_t   tmplen;
  2057.     size_t          newlen =
  2058.         name_len -
  2059.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  2060.     if ((StorageTmp =
  2061.          header_complex(traceRouteCtlTableStorage, NULL,
  2062.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  2063.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  2064.                         NULL)) == NULL)
  2065.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  2066.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  2067.         return SNMP_ERR_NOTWRITABLE;
  2068.     }
  2069.     if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
  2070.         return SNMP_ERR_NOTWRITABLE;
  2071.     }
  2072.     switch (action) {
  2073.     case RESERVE1:
  2074.         if (var_val_type != ASN_INTEGER) {
  2075.             snmp_log(LOG_ERR,
  2076.                      "write to traceRouteCtlMaxRows not ASN_INTEGERn");
  2077.             return SNMP_ERR_WRONGTYPE;
  2078.         }
  2079.         break;
  2080.     case RESERVE2:
  2081.         /*
  2082.          * memory reseveration, final preparation... 
  2083.          */
  2084.         break;
  2085.     case FREE:
  2086.         /*
  2087.          * Release any resources that have been allocated 
  2088.          */
  2089.         break;
  2090.     case ACTION:
  2091.         /*
  2092.          * The variable has been stored in objid for
  2093.          * you to use, and you have just been asked to do something with
  2094.          * it.  Note that anything done here must be reversable in the UNDO case 
  2095.          */
  2096.         tmpvar = StorageTmp->traceRouteCtlIfIndex;
  2097.         StorageTmp->traceRouteCtlIfIndex = *((long *) var_val);
  2098.         break;
  2099.     case UNDO:
  2100.         /*
  2101.          * Back out any changes made in the ACTION case 
  2102.          */
  2103.         StorageTmp->traceRouteCtlIfIndex = tmpvar;
  2104.         break;
  2105.     case COMMIT:
  2106.         /*
  2107.          * Things are working well, so it's now safe to make the change
  2108.          * permanently.  Make sure that anything done here can't fail! 
  2109.          */
  2110.         break;
  2111.     }
  2112.     return SNMP_ERR_NOERROR;
  2113. }
  2114. int
  2115. write_traceRouteCtlMiscOptions(int action,
  2116.                                u_char * var_val,
  2117.                                u_char var_val_type,
  2118.                                size_t var_val_len,
  2119.                                u_char * statP, oid * name, size_t name_len)
  2120. {
  2121.     static char    *tmpvar;
  2122.     static size_t   tmplen;
  2123.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  2124.     size_t          newlen =
  2125.         name_len -
  2126.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  2127.     if ((StorageTmp =
  2128.          header_complex(traceRouteCtlTableStorage, NULL,
  2129.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  2130.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  2131.                         NULL)) == NULL)
  2132.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  2133.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  2134.         return SNMP_ERR_NOTWRITABLE;
  2135.     }
  2136.     if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
  2137.         return SNMP_ERR_NOTWRITABLE;
  2138.     }
  2139.     switch (action) {
  2140.     case RESERVE1:
  2141.         if (var_val_type != ASN_OCTET_STR) {
  2142.             snmp_log(LOG_ERR,
  2143.                      "write to traceRouteCtlTargetAddress not ASN_OCTET_STRn");
  2144.             return SNMP_ERR_WRONGTYPE;
  2145.         }
  2146.         break;
  2147.     case RESERVE2:
  2148.         /*
  2149.          * memory reseveration, final preparation... 
  2150.          */
  2151.         break;
  2152.     case FREE:
  2153.         /*
  2154.          * Release any resources that have been allocated 
  2155.          */
  2156.         break;
  2157.     case ACTION:
  2158.         /*
  2159.          * The variable has been stored in long_ret for
  2160.          * you to use, and you have just been asked to do something with
  2161.          * it.  Note that anything done here must be reversable in the UNDO case 
  2162.          */
  2163.         tmpvar = StorageTmp->traceRouteCtlMiscOptions;
  2164.         tmplen = StorageTmp->traceRouteCtlMiscOptionsLen;
  2165.         StorageTmp->traceRouteCtlMiscOptions =
  2166.             (char *) malloc(var_val_len + 1);
  2167.         if (StorageTmp->traceRouteCtlMiscOptions == NULL) {
  2168.             exit(1);
  2169.         }
  2170.         memcpy(StorageTmp->traceRouteCtlMiscOptions, var_val,
  2171.                var_val_len + 1);
  2172.         StorageTmp->traceRouteCtlMiscOptions[var_val_len] = '';
  2173.         StorageTmp->traceRouteCtlMiscOptionsLen = var_val_len;
  2174.         break;
  2175.     case UNDO:
  2176.         /*
  2177.          * Back out any changes made in the ACTION case 
  2178.          */
  2179.         SNMP_FREE(StorageTmp->traceRouteCtlMiscOptions);
  2180.         StorageTmp->traceRouteCtlMiscOptions = NULL;
  2181.         StorageTmp->traceRouteCtlMiscOptions = tmpvar;
  2182.         StorageTmp->traceRouteCtlMiscOptionsLen = tmplen;
  2183.         break;
  2184.     case COMMIT:
  2185.         /*
  2186.          * Things are working well, so it's now safe to make the change
  2187.          * permanently.  Make sure that anything done here can't fail! 
  2188.          */
  2189.         SNMP_FREE(tmpvar);
  2190.         tmpvar = NULL;
  2191.         break;
  2192.     }
  2193.     return SNMP_ERR_NOERROR;
  2194. }
  2195. int
  2196. write_traceRouteCtlMaxFailures(int action,
  2197.                                u_char * var_val,
  2198.                                u_char var_val_type,
  2199.                                size_t var_val_len,
  2200.                                u_char * statP, oid * name, size_t name_len)
  2201. {
  2202.     static size_t   tmpvar;
  2203.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  2204.     static size_t   tmplen;
  2205.     size_t          newlen =
  2206.         name_len -
  2207.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  2208.     if ((StorageTmp =
  2209.          header_complex(traceRouteCtlTableStorage, NULL,
  2210.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  2211.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  2212.                         NULL)) == NULL)
  2213.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  2214.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  2215.         return SNMP_ERR_NOTWRITABLE;
  2216.     }
  2217.     if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
  2218.         return SNMP_ERR_NOTWRITABLE;
  2219.     }
  2220.     switch (action) {
  2221.     case RESERVE1:
  2222.         if (var_val_type != ASN_UNSIGNED) {
  2223.             snmp_log(LOG_ERR,
  2224.                      "write to traceRouteCtlTrapTestFailureFilter not ASN_UNSIGNEDn");
  2225.             return SNMP_ERR_WRONGTYPE;
  2226.         }
  2227.         break;
  2228.     case RESERVE2:
  2229.         /*
  2230.          * memory reseveration, final preparation... 
  2231.          */
  2232.         break;
  2233.     case FREE:
  2234.         /*
  2235.          * Release any resources that have been allocated 
  2236.          */
  2237.         break;
  2238.     case ACTION:
  2239.         /*
  2240.          * The variable has been stored in objid for
  2241.          * you to use, and you have just been asked to do something with
  2242.          * it.  Note that anything done here must be reversable in the UNDO case 
  2243.          */
  2244.         tmpvar = StorageTmp->traceRouteCtlMaxFailures;
  2245.         if ((*((long *) var_val)) >= 0 && (*((long *) var_val)) <= 15)
  2246.             StorageTmp->traceRouteCtlMaxFailures = *((long *) var_val);
  2247.         else
  2248.             StorageTmp->traceRouteCtlMaxFailures = 1;
  2249.         break;
  2250.     case UNDO:
  2251.         /*
  2252.          * Back out any changes made in the ACTION case 
  2253.          */
  2254.         StorageTmp->traceRouteCtlMaxFailures = tmpvar;
  2255.         break;
  2256.     case COMMIT:
  2257.         /*
  2258.          * Things are working well, so it's now safe to make the change
  2259.          * permanently.  Make sure that anything done here can't fail! 
  2260.          */
  2261.         break;
  2262.     }
  2263.     return SNMP_ERR_NOERROR;
  2264. }
  2265. int
  2266. write_traceRouteCtlDontFragment(int action,
  2267.                                 u_char * var_val,
  2268.                                 u_char var_val_type,
  2269.                                 size_t var_val_len,
  2270.                                 u_char * statP, oid * name,
  2271.                                 size_t name_len)
  2272. {
  2273.     static size_t   tmpvar;
  2274.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  2275.     static size_t   tmplen;
  2276.     size_t          newlen =
  2277.         name_len -
  2278.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  2279.     if ((StorageTmp =
  2280.          header_complex(traceRouteCtlTableStorage, NULL,
  2281.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  2282.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  2283.                         NULL)) == NULL)
  2284.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  2285.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  2286.         return SNMP_ERR_NOTWRITABLE;
  2287.     }
  2288.     if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
  2289.         return SNMP_ERR_NOTWRITABLE;
  2290.     }
  2291.     switch (action) {
  2292.     case RESERVE1:
  2293.         if (var_val_type != ASN_INTEGER) {
  2294.             snmp_log(LOG_ERR,
  2295.                      "write to traceRouteCtlMaxRows not ASN_INTEGERn");
  2296.             return SNMP_ERR_WRONGTYPE;
  2297.         }
  2298.         break;
  2299.     case RESERVE2:
  2300.         /*
  2301.          * memory reseveration, final preparation... 
  2302.          */
  2303.         break;
  2304.     case FREE:
  2305.         /*
  2306.          * Release any resources that have been allocated 
  2307.          */
  2308.         break;
  2309.     case ACTION:
  2310.         /*
  2311.          * The variable has been stored in objid for
  2312.          * you to use, and you have just been asked to do something with
  2313.          * it.  Note that anything done here must be reversable in the UNDO case 
  2314.          */
  2315.         tmpvar = StorageTmp->traceRouteCtlDontFragment;
  2316.         StorageTmp->traceRouteCtlDontFragment = *((long *) var_val);
  2317.         break;
  2318.     case UNDO:
  2319.         /*
  2320.          * Back out any changes made in the ACTION case 
  2321.          */
  2322.         StorageTmp->traceRouteCtlDontFragment = tmpvar;
  2323.         break;
  2324.     case COMMIT:
  2325.         /*
  2326.          * Things are working well, so it's now safe to make the change
  2327.          * permanently.  Make sure that anything done here can't fail! 
  2328.          */
  2329.         break;
  2330.     }
  2331.     return SNMP_ERR_NOERROR;
  2332. }
  2333. int
  2334. write_traceRouteCtlInitialTtl(int action,
  2335.                               u_char * var_val,
  2336.                               u_char var_val_type,
  2337.                               size_t var_val_len,
  2338.                               u_char * statP, oid * name, size_t name_len)
  2339. {
  2340.     static size_t   tmpvar;
  2341.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  2342.     static size_t   tmplen;
  2343.     size_t          newlen =
  2344.         name_len -
  2345.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  2346.     if ((StorageTmp =
  2347.          header_complex(traceRouteCtlTableStorage, NULL,
  2348.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  2349.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  2350.                         NULL)) == NULL)
  2351.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  2352.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  2353.         return SNMP_ERR_NOTWRITABLE;
  2354.     }
  2355.     if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
  2356.         return SNMP_ERR_NOTWRITABLE;
  2357.     }
  2358.     switch (action) {
  2359.     case RESERVE1:
  2360.         if (var_val_type != ASN_UNSIGNED) {
  2361.             snmp_log(LOG_ERR,
  2362.                      "write to traceRouteCtlTrapTestFailureFilter not ASN_UNSIGNEDn");
  2363.             return SNMP_ERR_WRONGTYPE;
  2364.         }
  2365.         break;
  2366.     case RESERVE2:
  2367.         /*
  2368.          * memory reseveration, final preparation... 
  2369.          */
  2370.         break;
  2371.     case FREE:
  2372.         /*
  2373.          * Release any resources that have been allocated 
  2374.          */
  2375.         break;
  2376.     case ACTION:
  2377.         /*
  2378.          * The variable has been stored in objid for
  2379.          * you to use, and you have just been asked to do something with
  2380.          * it.  Note that anything done here must be reversable in the UNDO case 
  2381.          */
  2382.         tmpvar = StorageTmp->traceRouteCtlInitialTtl;
  2383.         if ((*((long *) var_val)) >= 0 && (*((long *) var_val)) <= 255)
  2384.             StorageTmp->traceRouteCtlInitialTtl = *((long *) var_val);
  2385.         else
  2386.             StorageTmp->traceRouteCtlInitialTtl = 1;
  2387.         break;
  2388.     case UNDO:
  2389.         /*
  2390.          * Back out any changes made in the ACTION case 
  2391.          */
  2392.         StorageTmp->traceRouteCtlInitialTtl = tmpvar;
  2393.         break;
  2394.     case COMMIT:
  2395.         /*
  2396.          * Things are working well, so it's now safe to make the change
  2397.          * permanently.  Make sure that anything done here can't fail! 
  2398.          */
  2399.         break;
  2400.     }
  2401.     return SNMP_ERR_NOERROR;
  2402. }
  2403. int
  2404. write_traceRouteCtlFrequency(int action,
  2405.                              u_char * var_val,
  2406.                              u_char var_val_type,
  2407.                              size_t var_val_len,
  2408.                              u_char * statP, oid * name, size_t name_len)
  2409. {
  2410.     static size_t   tmpvar;
  2411.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  2412.     static size_t   tmplen;
  2413.     size_t          newlen =
  2414.         name_len -
  2415.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  2416.     if ((StorageTmp =
  2417.          header_complex(traceRouteCtlTableStorage, NULL,
  2418.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  2419.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  2420.                         NULL)) == NULL)
  2421.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  2422.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  2423.         return SNMP_ERR_NOTWRITABLE;
  2424.     }
  2425.     if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
  2426.         return SNMP_ERR_NOTWRITABLE;
  2427.     }
  2428.     switch (action) {
  2429.     case RESERVE1:
  2430.         if (var_val_type != ASN_UNSIGNED) {
  2431.             snmp_log(LOG_ERR,
  2432.                      "write to traceRouteCtlSourceAddressType not ASN_UNSIGNEDn");
  2433.             return SNMP_ERR_WRONGTYPE;
  2434.         }
  2435.         break;
  2436.     case RESERVE2:
  2437.         /*
  2438.          * memory reseveration, final preparation... 
  2439.          */
  2440.         break;
  2441.     case FREE:
  2442.         /*
  2443.          * Release any resources that have been allocated 
  2444.          */
  2445.         break;
  2446.     case ACTION:
  2447.         /*
  2448.          * The variable has been stored in objid for
  2449.          * you to use, and you have just been asked to do something with
  2450.          * it.  Note that anything done here must be reversable in the UNDO case 
  2451.          */
  2452.         tmpvar = StorageTmp->traceRouteCtlFrequency;
  2453.         StorageTmp->traceRouteCtlFrequency = *((long *) var_val);
  2454.         break;
  2455.     case UNDO:
  2456.         /*
  2457.          * Back out any changes made in the ACTION case 
  2458.          */
  2459.         StorageTmp->traceRouteCtlFrequency = tmpvar;
  2460.         break;
  2461.     case COMMIT:
  2462.         /*
  2463.          * Things are working well, so it's now safe to make the change
  2464.          * permanently.  Make sure that anything done here can't fail! 
  2465.          */
  2466.         break;
  2467.     }
  2468.     return SNMP_ERR_NOERROR;
  2469. }
  2470. int
  2471. write_traceRouteCtlStorageType(int action,
  2472.                                u_char * var_val,
  2473.                                u_char var_val_type,
  2474.                                size_t var_val_len,
  2475.                                u_char * statP, oid * name, size_t name_len)
  2476. {
  2477.     static size_t   tmpvar;
  2478.     int             set_value;
  2479.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  2480.     static size_t   tmplen;
  2481.     size_t          newlen =
  2482.         name_len -
  2483.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  2484.     if ((StorageTmp =
  2485.          header_complex(traceRouteCtlTableStorage, NULL,
  2486.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  2487.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  2488.                         NULL)) == NULL)
  2489.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  2490.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  2491.         return SNMP_ERR_NOTWRITABLE;
  2492.     }
  2493.     if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
  2494.         return SNMP_ERR_NOTWRITABLE;
  2495.     }
  2496.     set_value = *((long *) var_val);
  2497.     switch (action) {
  2498.     case RESERVE1:
  2499.         if (var_val_type != ASN_INTEGER) {
  2500.             snmp_log(LOG_ERR,
  2501.                      "write to traceRouteCtlMaxRows not ASN_INTEGERn");
  2502.             return SNMP_ERR_WRONGTYPE;
  2503.         }
  2504.         if ((StorageTmp->traceRouteCtlStorageType == 2
  2505.              || StorageTmp->traceRouteCtlStorageType == 3)
  2506.             && (set_value == 4 || set_value == 5)) {
  2507.             return SNMP_ERR_WRONGVALUE;
  2508.         }
  2509.         break;
  2510.     case RESERVE2:
  2511.         /*
  2512.          * memory reseveration, final preparation... 
  2513.          */
  2514.         break;
  2515.     case FREE:
  2516.         /*
  2517.          * Release any resources that have been allocated 
  2518.          */
  2519.         break;
  2520.     case ACTION:
  2521.         /*
  2522.          * The variable has been stored in objid for
  2523.          * you to use, and you have just been asked to do something with
  2524.          * it.  Note that anything done here must be reversable in the UNDO case 
  2525.          */
  2526.         tmpvar = StorageTmp->traceRouteCtlStorageType;
  2527.         StorageTmp->traceRouteCtlStorageType = *((long *) var_val);
  2528.         break;
  2529.     case UNDO:
  2530.         /*
  2531.          * Back out any changes made in the ACTION case 
  2532.          */
  2533.         StorageTmp->traceRouteCtlStorageType = tmpvar;
  2534.         break;
  2535.     case COMMIT:
  2536.         /*
  2537.          * Things are working well, so it's now safe to make the change
  2538.          * permanently.  Make sure that anything done here can't fail! 
  2539.          */
  2540.         break;
  2541.     }
  2542.     return SNMP_ERR_NOERROR;
  2543. }
  2544. int
  2545. write_traceRouteCtlAdminStatus(int action,
  2546.                                u_char * var_val,
  2547.                                u_char var_val_type,
  2548.                                size_t var_val_len,
  2549.                                u_char * statP, oid * name, size_t name_len)
  2550. {
  2551.     static size_t   tmpvar;
  2552.     struct traceRouteCtlTable_data *StorageTmp = NULL;
  2553.     netsnmp_variable_list *vars = NULL;
  2554.     struct traceRouteResultsTable_data *StorageNew = NULL;
  2555.     static size_t   tmplen;
  2556.     size_t          newlen =
  2557.         name_len -
  2558.         (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
  2559.     if ((StorageTmp =
  2560.          header_complex(traceRouteCtlTableStorage, NULL,
  2561.                         &name[sizeof(traceRouteCtlTable_variables_oid) /
  2562.                               sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  2563.                         NULL)) == NULL)
  2564.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  2565.     if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
  2566.         return SNMP_ERR_NOTWRITABLE;
  2567.     }
  2568.     switch (action) {
  2569.     case RESERVE1: