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

SNMP编程

开发平台:

Unix_Linux

  1. /*
  2.  * This file was generated by mib2c and is intended for use as
  3.  * a mib module for the ucd-snmp snmpd agent. 
  4.  */
  5. /*
  6.  * This should always be included first before anything else 
  7.  */
  8. #include <net-snmp/net-snmp-config.h>
  9. #include <sys/types.h>
  10. #if HAVE_WINSOCK_H
  11. #include <winsock.h>
  12. #endif
  13. #if HAVE_STDLIB_H
  14. #include <stdlib.h>
  15. #endif
  16. #if HAVE_STRING_H
  17. #include <string.h>
  18. #else
  19. #include <strings.h>
  20. #endif
  21. /*
  22.  * minimal include directives 
  23.  */
  24. #include <net-snmp/net-snmp-includes.h>
  25. #include <net-snmp/agent/net-snmp-agent-includes.h>
  26. #include "header_complex.h"
  27. #include "snmpNotifyFilterProfileTable.h"
  28. /*
  29.  * snmpNotifyFilterProfileTable_variables_oid:
  30.  *   this is the top level oid that we want to register under.  This
  31.  *   is essentially a prefix, with the suffix appearing in the
  32.  *   variable below.
  33.  */
  34. oid             snmpNotifyFilterProfileTable_variables_oid[] =
  35.     { 1, 3, 6, 1, 6, 3, 13, 1, 2 };
  36. /*
  37.  * variable2 snmpNotifyFilterProfileTable_variables:
  38.  *   this variable defines function callbacks and type return information 
  39.  *   for the snmpNotifyFilterProfileTable mib section 
  40.  */
  41. struct variable2 snmpNotifyFilterProfileTable_variables[] = {
  42.     /*
  43.      * magic number        , variable type , ro/rw , callback fn  , L, oidsuffix 
  44.      */
  45. #define   SNMPNOTIFYFILTERPROFILENAME  3
  46.     {SNMPNOTIFYFILTERPROFILENAME, ASN_OCTET_STR, RWRITE,
  47.      var_snmpNotifyFilterProfileTable, 2, {1, 1}},
  48. #define   SNMPNOTIFYFILTERPROFILESTORTYPE  4
  49.     {SNMPNOTIFYFILTERPROFILESTORTYPE, ASN_INTEGER, RWRITE,
  50.      var_snmpNotifyFilterProfileTable, 2, {1, 2}},
  51. #define   SNMPNOTIFYFILTERPROFILEROWSTATUS  5
  52.     {SNMPNOTIFYFILTERPROFILEROWSTATUS, ASN_INTEGER, RWRITE,
  53.      var_snmpNotifyFilterProfileTable, 2, {1, 3}},
  54. };
  55. /*
  56.  * (L = length of the oidsuffix) 
  57.  */
  58. /*
  59.  * global storage of our data, saved in and configured by header_complex() 
  60.  */
  61. static struct header_complex_index *snmpNotifyFilterProfileTableStorage =
  62.     NULL;
  63. /*
  64.  * init_snmpNotifyFilterProfileTable():
  65.  *   Initialization routine.  This is called when the agent starts up.
  66.  *   At a minimum, registration of your variables should take place here.
  67.  */
  68. void
  69. init_snmpNotifyFilterProfileTable(void)
  70. {
  71.     DEBUGMSGTL(("snmpNotifyFilterProfileTable", "initializing...  "));
  72.     /*
  73.      * register ourselves with the agent to handle our mib tree 
  74.      */
  75.     REGISTER_MIB("snmpNotifyFilterProfileTable",
  76.                  snmpNotifyFilterProfileTable_variables, variable2,
  77.                  snmpNotifyFilterProfileTable_variables_oid);
  78.     /*
  79.      * register our config handler(s) to deal with registrations 
  80.      */
  81.     snmpd_register_config_handler("snmpNotifyFilterProfileTable",
  82.                                   parse_snmpNotifyFilterProfileTable, NULL,
  83.                                   NULL);
  84.     /*
  85.      * we need to be called back later to store our data 
  86.      */
  87.     snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
  88.                            store_snmpNotifyFilterProfileTable, NULL);
  89.     /*
  90.      * place any other initialization junk you need here 
  91.      */
  92.     DEBUGMSGTL(("snmpNotifyFilterProfileTable", "done.n"));
  93. }
  94. /*
  95.  * snmpNotifyFilterProfileTable_add(): adds a structure node to our data set 
  96.  */
  97. int
  98. snmpNotifyFilterProfileTable_add(struct snmpNotifyFilterProfileTable_data
  99.                                  *thedata)
  100. {
  101.     netsnmp_variable_list *vars = NULL;
  102.     DEBUGMSGTL(("snmpNotifyFilterProfileTable", "adding data...  "));
  103.     /*
  104.      * add the index variables to the varbind list, which is 
  105.      * used by header_complex to index the data 
  106.      */
  107.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OCTET_STR,
  108.                               (u_char *) thedata->snmpTargetParamsName,
  109.                               thedata->snmpTargetParamsNameLen);
  110.     header_complex_add_data(&snmpNotifyFilterProfileTableStorage, vars,
  111.                             thedata);
  112.     DEBUGMSGTL(("snmpNotifyFilterProfileTable", "registered an entryn"));
  113.     DEBUGMSGTL(("snmpNotifyFilterProfileTable", "done.n"));
  114.     return SNMPERR_SUCCESS;
  115. }
  116. /*
  117.  * parse_snmpNotifyFilterProfileTable():
  118.  *   parses .conf file entries needed to configure the mib.
  119.  */
  120. void
  121. parse_snmpNotifyFilterProfileTable(const char *token, char *line)
  122. {
  123.     size_t          tmpint;
  124.     struct snmpNotifyFilterProfileTable_data *StorageTmp =
  125.         SNMP_MALLOC_STRUCT(snmpNotifyFilterProfileTable_data);
  126.     DEBUGMSGTL(("snmpNotifyFilterProfileTable", "parsing config...  "));
  127.     if (StorageTmp == NULL) {
  128.         config_perror("malloc failure");
  129.         return;
  130.     }
  131.     line =
  132.         read_config_read_data(ASN_OCTET_STR, line,
  133.                               &StorageTmp->snmpTargetParamsName,
  134.                               &StorageTmp->snmpTargetParamsNameLen);
  135.     if (StorageTmp->snmpTargetParamsName == NULL) {
  136.         config_perror("invalid specification for snmpTargetParamsName");
  137.         return;
  138.     }
  139.     line =
  140.         read_config_read_data(ASN_OCTET_STR, line,
  141.                               &StorageTmp->snmpNotifyFilterProfileName,
  142.                               &StorageTmp->snmpNotifyFilterProfileNameLen);
  143.     line =
  144.         read_config_read_data(ASN_INTEGER, line,
  145.                               &StorageTmp->snmpNotifyFilterProfileStorType,
  146.                               &tmpint);
  147.     line =
  148.         read_config_read_data(ASN_INTEGER, line,
  149.                               &StorageTmp->
  150.                               snmpNotifyFilterProfileRowStatus, &tmpint);
  151.     snmpNotifyFilterProfileTable_add(StorageTmp);
  152.     DEBUGMSGTL(("snmpNotifyFilterProfileTable", "done.n"));
  153. }
  154. /*
  155.  * store_snmpNotifyFilterProfileTable():
  156.  *   stores .conf file entries needed to configure the mib.
  157.  */
  158. int
  159. store_snmpNotifyFilterProfileTable(int majorID, int minorID,
  160.                                    void *serverarg, void *clientarg)
  161. {
  162.     char            line[SNMP_MAXBUF];
  163.     char           *cptr;
  164.     size_t          tmpint;
  165.     struct snmpNotifyFilterProfileTable_data *StorageTmp;
  166.     struct header_complex_index *hcindex;
  167.     DEBUGMSGTL(("snmpNotifyFilterProfileTable", "storing data...  "));
  168.     for (hcindex = snmpNotifyFilterProfileTableStorage; hcindex != NULL;
  169.          hcindex = hcindex->next) {
  170.         StorageTmp =
  171.             (struct snmpNotifyFilterProfileTable_data *) hcindex->data;
  172.         if (StorageTmp->snmpNotifyFilterProfileStorType == ST_NONVOLATILE) {
  173.             memset(line, 0, sizeof(line));
  174.             strcat(line, "snmpNotifyFilterProfileTable ");
  175.             cptr = line + strlen(line);
  176.             cptr =
  177.                 read_config_store_data(ASN_OCTET_STR, cptr,
  178.                                        &StorageTmp->snmpTargetParamsName,
  179.                                        &StorageTmp->
  180.                                        snmpTargetParamsNameLen);
  181.             cptr =
  182.                 read_config_store_data(ASN_OCTET_STR, cptr,
  183.                                        &StorageTmp->
  184.                                        snmpNotifyFilterProfileName,
  185.                                        &StorageTmp->
  186.                                        snmpNotifyFilterProfileNameLen);
  187.             cptr =
  188.                 read_config_store_data(ASN_INTEGER, cptr,
  189.                                        &StorageTmp->
  190.                                        snmpNotifyFilterProfileStorType,
  191.                                        &tmpint);
  192.             cptr =
  193.                 read_config_store_data(ASN_INTEGER, cptr,
  194.                                        &StorageTmp->
  195.                                        snmpNotifyFilterProfileRowStatus,
  196.                                        &tmpint);
  197.             snmpd_store_config(line);
  198.         }
  199.     }
  200.     DEBUGMSGTL(("snmpNotifyFilterProfileTable", "done.n"));
  201.     return 0;
  202. }
  203. /*
  204.  * var_snmpNotifyFilterProfileTable():
  205.  *   Handle this table separately from the scalar value case.
  206.  *   The workings of this are basically the same as for var_snmpNotifyFilterProfileTable above.
  207.  */
  208. unsigned char  *
  209. var_snmpNotifyFilterProfileTable(struct variable *vp,
  210.                                  oid * name,
  211.                                  size_t * length,
  212.                                  int exact,
  213.                                  size_t * var_len,
  214.                                  WriteMethod ** write_method)
  215. {
  216.     struct snmpNotifyFilterProfileTable_data *StorageTmp = NULL;
  217.     DEBUGMSGTL(("snmpNotifyFilterProfileTable",
  218.                 "var_snmpNotifyFilterProfileTable: Entering...  n"));
  219.     /*
  220.      * this assumes you have registered all your data properly
  221.      */
  222.     if ((StorageTmp = (struct snmpNotifyFilterProfileTable_data *)
  223.          header_complex((struct header_complex_index *)
  224.                         snmpNotifyFilterProfileTableStorage, vp, name,
  225.                         length, exact, var_len, write_method)) == NULL) {
  226.         if (vp->magic == SNMPNOTIFYFILTERPROFILEROWSTATUS)
  227.             *write_method = write_snmpNotifyFilterProfileRowStatus;
  228.         return NULL;
  229.     }
  230.     /*
  231.      * this is where we do the value assignments for the mib results.
  232.      */
  233.     switch (vp->magic) {
  234.     case SNMPNOTIFYFILTERPROFILENAME:
  235.         *write_method = write_snmpNotifyFilterProfileName;
  236.         *var_len = StorageTmp->snmpNotifyFilterProfileNameLen;
  237.         return (u_char *) StorageTmp->snmpNotifyFilterProfileName;
  238.     case SNMPNOTIFYFILTERPROFILESTORTYPE:
  239.         *write_method = write_snmpNotifyFilterProfileStorType;
  240.         *var_len = sizeof(StorageTmp->snmpNotifyFilterProfileStorType);
  241.         return (u_char *) & StorageTmp->snmpNotifyFilterProfileStorType;
  242.     case SNMPNOTIFYFILTERPROFILEROWSTATUS:
  243.         *write_method = write_snmpNotifyFilterProfileRowStatus;
  244.         *var_len = sizeof(StorageTmp->snmpNotifyFilterProfileRowStatus);
  245.         return (u_char *) & StorageTmp->snmpNotifyFilterProfileRowStatus;
  246.     default:
  247.         ERROR_MSG("");
  248.     }
  249.     return NULL;
  250. }
  251. int
  252. write_snmpNotifyFilterProfileName(int action,
  253.                                   u_char * var_val,
  254.                                   u_char var_val_type,
  255.                                   size_t var_val_len,
  256.                                   u_char * statP,
  257.                                   oid * name, size_t name_len)
  258. {
  259.     static char    *tmpvar;
  260.     struct snmpNotifyFilterProfileTable_data *StorageTmp = NULL;
  261.     static size_t   tmplen;
  262.     size_t          newlen =
  263.         name_len -
  264.         (sizeof(snmpNotifyFilterProfileTable_variables_oid) / sizeof(oid) +
  265.          3 - 1);
  266.     DEBUGMSGTL(("snmpNotifyFilterProfileTable",
  267.                 "write_snmpNotifyFilterProfileName entering action=%d...  n",
  268.                 action));
  269.     if ((StorageTmp = (struct snmpNotifyFilterProfileTable_data *)
  270.          header_complex((struct header_complex_index *)
  271.                         snmpNotifyFilterProfileTableStorage, NULL,
  272.                         &name[sizeof
  273.                               (snmpNotifyFilterProfileTable_variables_oid)
  274.                               / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  275.                         NULL)) == NULL)
  276.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  277.     switch (action) {
  278.     case RESERVE1:
  279.         if (var_val_type != ASN_OCTET_STR) {
  280.             fprintf(stderr,
  281.                     "write to snmpNotifyFilterProfileName not ASN_OCTET_STRn");
  282.             return SNMP_ERR_WRONGTYPE;
  283.         }
  284.         break;
  285.     case RESERVE2:
  286.         /*
  287.          * memory reseveration, final preparation... 
  288.          */
  289.         break;
  290.     case FREE:
  291.         /*
  292.          * Release any resources that have been allocated 
  293.          */
  294.         break;
  295.     case ACTION:
  296.         /*
  297.          * The variable has been stored in string for
  298.          * you to use, and you have just been asked to do something with
  299.          * it.  Note that anything done here must be reversable in the UNDO case 
  300.          */
  301.         tmpvar = StorageTmp->snmpNotifyFilterProfileName;
  302.         tmplen = StorageTmp->snmpNotifyFilterProfileNameLen;
  303.         memdup((u_char **) & StorageTmp->snmpNotifyFilterProfileName,
  304.                var_val, var_val_len);
  305.         StorageTmp->snmpNotifyFilterProfileNameLen = var_val_len;
  306.         break;
  307.     case UNDO:
  308.         /*
  309.          * Back out any changes made in the ACTION case 
  310.          */
  311.         SNMP_FREE(StorageTmp->snmpNotifyFilterProfileName);
  312.         StorageTmp->snmpNotifyFilterProfileName = tmpvar;
  313.         StorageTmp->snmpNotifyFilterProfileNameLen = tmplen;
  314.         break;
  315.     case COMMIT:
  316.         /*
  317.          * Things are working well, so it's now safe to make the change
  318.          * permanently.  Make sure that anything done here can't fail! 
  319.          */
  320.         SNMP_FREE(tmpvar);
  321.         break;
  322.     }
  323.     return SNMP_ERR_NOERROR;
  324. }
  325. int
  326. write_snmpNotifyFilterProfileStorType(int action,
  327.                                       u_char * var_val,
  328.                                       u_char var_val_type,
  329.                                       size_t var_val_len,
  330.                                       u_char * statP,
  331.                                       oid * name, size_t name_len)
  332. {
  333.     static int      tmpvar;
  334.     struct snmpNotifyFilterProfileTable_data *StorageTmp = NULL;
  335.     size_t          newlen =
  336.         name_len -
  337.         (sizeof(snmpNotifyFilterProfileTable_variables_oid) / sizeof(oid) +
  338.          3 - 1);
  339.     DEBUGMSGTL(("snmpNotifyFilterProfileTable",
  340.                 "write_snmpNotifyFilterProfileStorType entering action=%d...  n",
  341.                 action));
  342.     if ((StorageTmp = (struct snmpNotifyFilterProfileTable_data *)
  343.          header_complex((struct header_complex_index *)
  344.                         snmpNotifyFilterProfileTableStorage, NULL,
  345.                         &name[sizeof
  346.                               (snmpNotifyFilterProfileTable_variables_oid)
  347.                               / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  348.                         NULL)) == NULL)
  349.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  350.     switch (action) {
  351.     case RESERVE1:
  352.         if (var_val_type != ASN_INTEGER) {
  353.             fprintf(stderr,
  354.                     "write to snmpNotifyFilterProfileStorType not ASN_INTEGERn");
  355.             return SNMP_ERR_WRONGTYPE;
  356.         }
  357.         break;
  358.     case RESERVE2:
  359.         /*
  360.          * memory reseveration, final preparation... 
  361.          */
  362.         break;
  363.     case FREE:
  364.         /*
  365.          * Release any resources that have been allocated 
  366.          */
  367.         break;
  368.     case ACTION:
  369.         /*
  370.          * The variable has been stored in long_ret for
  371.          * you to use, and you have just been asked to do something with
  372.          * it.  Note that anything done here must be reversable in the UNDO case 
  373.          */
  374.         tmpvar = StorageTmp->snmpNotifyFilterProfileStorType;
  375.         StorageTmp->snmpNotifyFilterProfileStorType = *((long *) var_val);
  376.         break;
  377.     case UNDO:
  378.         /*
  379.          * Back out any changes made in the ACTION case 
  380.          */
  381.         StorageTmp->snmpNotifyFilterProfileStorType = tmpvar;
  382.         break;
  383.     case COMMIT:
  384.         /*
  385.          * Things are working well, so it's now safe to make the change
  386.          * permanently.  Make sure that anything done here can't fail! 
  387.          */
  388.         break;
  389.     }
  390.     return SNMP_ERR_NOERROR;
  391. }
  392. int
  393. write_snmpNotifyFilterProfileRowStatus(int action,
  394.                                        u_char * var_val,
  395.                                        u_char var_val_type,
  396.                                        size_t var_val_len,
  397.                                        u_char * statP,
  398.                                        oid * name, size_t name_len)
  399. {
  400.     struct snmpNotifyFilterProfileTable_data *StorageTmp = NULL;
  401.     static struct snmpNotifyFilterProfileTable_data *StorageNew,
  402.         *StorageDel;
  403.     size_t          newlen =
  404.         name_len -
  405.         (sizeof(snmpNotifyFilterProfileTable_variables_oid) / sizeof(oid) +
  406.          3 - 1);
  407.     static int      old_value;
  408.     int             set_value;
  409.     netsnmp_variable_list *vars;
  410.     struct header_complex_index *hciptr;
  411.     StorageTmp = (struct snmpNotifyFilterProfileTable_data *)
  412.         header_complex((struct header_complex_index *)
  413.                        snmpNotifyFilterProfileTableStorage, NULL,
  414.                        &name[sizeof
  415.                              (snmpNotifyFilterProfileTable_variables_oid) /
  416.                              sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL);
  417.     if (var_val_type != ASN_INTEGER || var_val == NULL) {
  418.         fprintf(stderr,
  419.                 "write to snmpNotifyFilterProfileRowStatus not ASN_INTEGERn");
  420.         return SNMP_ERR_WRONGTYPE;
  421.     }
  422.     set_value = *((long *) var_val);
  423.     /*
  424.      * check legal range, and notReady is reserved for us, not a user 
  425.      */
  426.     if (set_value < 1 || set_value > 6 || set_value == RS_NOTREADY)
  427.         return SNMP_ERR_INCONSISTENTVALUE;
  428.     switch (action) {
  429.     case RESERVE1:
  430.         /*
  431.          * stage one: test validity 
  432.          */
  433.         if (StorageTmp == NULL) {
  434.             /*
  435.              * create the row now? 
  436.              */
  437.             /*
  438.              * ditch illegal values now 
  439.              */
  440.             if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE)
  441.                 return SNMP_ERR_INCONSISTENTVALUE;
  442.         } else {
  443.             /*
  444.              * row exists.  Check for a valid state change 
  445.              */
  446.             if (set_value == RS_CREATEANDGO
  447.                 || set_value == RS_CREATEANDWAIT) {
  448.                 /*
  449.                  * can't create a row that exists 
  450.                  */
  451.                 return SNMP_ERR_INCONSISTENTVALUE;
  452.             }
  453.             /*
  454.              * XXX: interaction with row storage type needed 
  455.              */
  456.         }
  457.         break;
  458.     case RESERVE2:
  459.         /*
  460.          * memory reseveration, final preparation... 
  461.          */
  462.         if (StorageTmp == NULL &&
  463.             (set_value == RS_CREATEANDGO
  464.              || set_value == RS_CREATEANDWAIT)) {
  465.             /*
  466.              * creation 
  467.              */
  468.             vars = NULL;
  469.             snmp_varlist_add_variable(&vars, NULL, 0,
  470.                                       ASN_PRIV_IMPLIED_OCTET_STR, NULL, 0);
  471.             if (header_complex_parse_oid
  472.                 (&
  473.                  (name
  474.                   [sizeof(snmpNotifyFilterProfileTable_variables_oid) /
  475.                    sizeof(oid) + 2]), newlen, vars) != SNMPERR_SUCCESS) {
  476.                 snmp_free_var(vars);
  477.                 return SNMP_ERR_INCONSISTENTNAME;
  478.             }
  479.             StorageNew =
  480.                 SNMP_MALLOC_STRUCT(snmpNotifyFilterProfileTable_data);
  481.             memdup((u_char **) & (StorageNew->snmpTargetParamsName),
  482.                    vars->val.string, vars->val_len);
  483.             StorageNew->snmpTargetParamsNameLen = vars->val_len;
  484.             StorageNew->snmpNotifyFilterProfileStorType = ST_NONVOLATILE;
  485.             StorageNew->snmpNotifyFilterProfileRowStatus = set_value;
  486.             snmp_free_var(vars);
  487.         }
  488.         break;
  489.     case FREE:
  490.         /*
  491.          * XXX: free, zero vars 
  492.          */
  493.         /*
  494.          * Release any resources that have been allocated 
  495.          */
  496.         break;
  497.     case ACTION:
  498.         /*
  499.          * The variable has been stored in set_value for you to
  500.          * use, and you have just been asked to do something with
  501.          * it.  Note that anything done here must be reversable in
  502.          * the UNDO case 
  503.          */
  504.         if (StorageTmp == NULL &&
  505.             (set_value == RS_CREATEANDGO ||
  506.              set_value == RS_CREATEANDWAIT)) {
  507.             /*
  508.              * row creation, so add it 
  509.              */
  510.             if (StorageNew != NULL)
  511.                 snmpNotifyFilterProfileTable_add(StorageNew);
  512.             /*
  513.              * XXX: ack, and if it is NULL? 
  514.              */
  515.         } else if (set_value != RS_DESTROY) {
  516.             /*
  517.              * set the flag? 
  518.              */
  519.             old_value = StorageTmp->snmpNotifyFilterProfileRowStatus;
  520.             StorageTmp->snmpNotifyFilterProfileRowStatus =
  521.                 *((long *) var_val);
  522.         } else {
  523.             /*
  524.              * destroy...  extract it for now 
  525.              */
  526.             if (StorageTmp) {
  527.                 hciptr =
  528.                     header_complex_find_entry
  529.                     (snmpNotifyFilterProfileTableStorage, StorageTmp);
  530.                 StorageDel = (struct snmpNotifyFilterProfileTable_data *)
  531.                     header_complex_extract_entry((struct
  532.                                                   header_complex_index **)
  533.                                                  &snmpNotifyFilterProfileTableStorage,
  534.                                                  hciptr);
  535.             }
  536.         }
  537.         break;
  538.     case UNDO:
  539.         /*
  540.          * Back out any changes made in the ACTION case 
  541.          */
  542.         if (StorageTmp == NULL &&
  543.             (set_value == RS_CREATEANDGO ||
  544.              set_value == RS_CREATEANDWAIT)) {
  545.             /*
  546.              * row creation, so remove it again 
  547.              */
  548.             hciptr =
  549.                 header_complex_find_entry
  550.                 (snmpNotifyFilterProfileTableStorage, StorageNew);
  551.             StorageDel = (struct snmpNotifyFilterProfileTable_data *)
  552.                 header_complex_extract_entry((struct header_complex_index
  553.                                               **)
  554.                                              &snmpNotifyFilterProfileTableStorage,
  555.                                              hciptr);
  556.             /*
  557.              * XXX: free it 
  558.              */
  559.         } else if (StorageDel != NULL) {
  560.             /*
  561.              * row deletion, so add it again 
  562.              */
  563.             snmpNotifyFilterProfileTable_add(StorageDel);
  564.             StorageDel = NULL;
  565.         } else if (set_value != RS_DESTROY) {
  566.             StorageTmp->snmpNotifyFilterProfileRowStatus = old_value;
  567.         }
  568.         break;
  569.     case COMMIT:
  570.         /*
  571.          * Things are working well, so it's now safe to make the change
  572.          * permanently.  Make sure that anything done here can't fail! 
  573.          */
  574.         if (StorageDel != NULL) {
  575.             StorageDel = NULL;
  576.             /*
  577.              * XXX: free it, its dead 
  578.              */
  579.         }
  580.         if (StorageTmp
  581.             && StorageTmp->snmpNotifyFilterProfileRowStatus ==
  582.             RS_CREATEANDGO) {
  583.             StorageTmp->snmpNotifyFilterProfileRowStatus = RS_ACTIVE;
  584.         } else if (StorageTmp &&
  585.                    StorageTmp->snmpNotifyFilterProfileRowStatus ==
  586.                    RS_CREATEANDWAIT) {
  587.             StorageTmp->snmpNotifyFilterProfileRowStatus = RS_NOTINSERVICE;
  588.         }
  589.         break;
  590.     }
  591.     return SNMP_ERR_NOERROR;
  592. }
  593. char           *
  594. get_FilterName(char *targetName, size_t targetName_len,
  595.                size_t * profileName_len)
  596. {
  597.     netsnmp_variable_list *vars = NULL;
  598.     struct snmpNotifyFilterProfileTable_data *data;
  599.     /*
  600.      * put requested info into var structure 
  601.      */
  602.     snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OCTET_STR,
  603.                               (u_char *) targetName, targetName_len);
  604.     /*
  605.      * get the data from the header_complex storage 
  606.      */
  607.     data = (struct snmpNotifyFilterProfileTable_data *)
  608.         header_complex_get(snmpNotifyFilterProfileTableStorage, vars);
  609.     /*
  610.      * free search index 
  611.      */
  612.     snmp_free_var(vars);
  613.     /*
  614.      * return the requested information (if this row is active) 
  615.      */
  616.     if (data && data->snmpNotifyFilterProfileRowStatus == RS_ACTIVE) {
  617.         *profileName_len = data->snmpNotifyFilterProfileNameLen;
  618.         return data->snmpNotifyFilterProfileName;
  619.     }
  620.     *profileName_len = 0;
  621.     return NULL;
  622. }