mteTriggerBooleanTable.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. #if HAVE_STDLIB_H
  10. #include <stdlib.h>
  11. #endif
  12. #if HAVE_STRING_H
  13. #include <string.h>
  14. #else
  15. #include <strings.h>
  16. #endif
  17. /*
  18.  * minimal include directives 
  19.  */
  20. #include <net-snmp/net-snmp-includes.h>
  21. #include <net-snmp/agent/net-snmp-agent-includes.h>
  22. #include "header_complex.h"
  23. #include "mteTriggerBooleanTable.h"
  24. #include "mteTriggerTable.h"
  25. /*
  26.  * mteTriggerBooleanTable_variables_oid:
  27.  *   this is the top level oid that we want to register under.  This
  28.  *   is essentially a prefix, with the suffix appearing in the
  29.  *   variable below.
  30.  */
  31. oid             mteTriggerBooleanTable_variables_oid[] =
  32.     { 1, 3, 6, 1, 2, 1, 88, 1, 2, 5 };
  33. /*
  34.  * variable2 mteTriggerBooleanTable_variables:
  35.  *   this variable defines function callbacks and type return information 
  36.  *   for the mteTriggerBooleanTable mib section 
  37.  */
  38. struct variable2 mteTriggerBooleanTable_variables[] = {
  39.     /*
  40.      * magic number        , variable type , ro/rw , callback fn  , L, oidsuffix 
  41.      */
  42. #define   MTETRIGGERBOOLEANCOMPARISON  3
  43.     {MTETRIGGERBOOLEANCOMPARISON, ASN_INTEGER, RWRITE,
  44.      var_mteTriggerBooleanTable, 2, {1, 1}},
  45. #define   MTETRIGGERBOOLEANVALUE  4
  46.     {MTETRIGGERBOOLEANVALUE, ASN_INTEGER, RWRITE,
  47.      var_mteTriggerBooleanTable, 2, {1, 2}},
  48. #define   MTETRIGGERBOOLEANSTARTUP  5
  49.     {MTETRIGGERBOOLEANSTARTUP, ASN_INTEGER, RWRITE,
  50.      var_mteTriggerBooleanTable, 2, {1, 3}},
  51. #define   MTETRIGGERBOOLEANOBJECTSOWNER  6
  52.     {MTETRIGGERBOOLEANOBJECTSOWNER, ASN_OCTET_STR, RWRITE,
  53.      var_mteTriggerBooleanTable, 2, {1, 4}},
  54. #define   MTETRIGGERBOOLEANOBJECTS  7
  55.     {MTETRIGGERBOOLEANOBJECTS, ASN_OCTET_STR, RWRITE,
  56.      var_mteTriggerBooleanTable, 2, {1, 5}},
  57. #define   MTETRIGGERBOOLEANEVENTOWNER  8
  58.     {MTETRIGGERBOOLEANEVENTOWNER, ASN_OCTET_STR, RWRITE,
  59.      var_mteTriggerBooleanTable, 2, {1, 6}},
  60. #define   MTETRIGGERBOOLEANEVENT  9
  61.     {MTETRIGGERBOOLEANEVENT, ASN_OCTET_STR, RWRITE,
  62.      var_mteTriggerBooleanTable, 2, {1, 7}},
  63. };
  64. /*
  65.  * (L = length of the oidsuffix) 
  66.  */
  67. /*
  68.  * global storage of our data, saved in and configured by header_complex() 
  69.  */
  70. extern struct header_complex_index *mteTriggerTableStorage;
  71. /*
  72.  * init_mteTriggerBooleanTable():
  73.  *   Initialization routine.  This is called when the agent starts up.
  74.  *   At a minimum, registration of your variables should take place here.
  75.  */
  76. void
  77. init_mteTriggerBooleanTable(void)
  78. {
  79.     DEBUGMSGTL(("mteTriggerBooleanTable", "initializing...  "));
  80.     /*
  81.      * register ourselves with the agent to handle our mib tree 
  82.      */
  83.     REGISTER_MIB("mteTriggerBooleanTable",
  84.                  mteTriggerBooleanTable_variables, variable2,
  85.                  mteTriggerBooleanTable_variables_oid);
  86.     DEBUGMSGTL(("mteTriggerBooleanTable", "done.n"));
  87. }
  88. /*
  89.  * var_mteTriggerBooleanTable():
  90.  *   Handle this table separately from the scalar value case.
  91.  *   The workings of this are basically the same as for var_mteTriggerBooleanTable above.
  92.  */
  93. unsigned char  *
  94. var_mteTriggerBooleanTable(struct variable *vp,
  95.                            oid * name,
  96.                            size_t * length,
  97.                            int exact,
  98.                            size_t * var_len, WriteMethod ** write_method)
  99. {
  100.     struct mteTriggerTable_data *StorageTmp = NULL;
  101.     DEBUGMSGTL(("mteTriggerBooleanTable",
  102.                 "var_mteTriggerBooleanTable: Entering...  n"));
  103.     /*
  104.      * this assumes you have registered all your data properly
  105.      */
  106.     if ((StorageTmp =
  107.          header_complex(mteTriggerTableStorage, vp, name, length, exact,
  108.                         var_len, write_method)) == NULL)
  109.         return NULL;
  110.     if (!(StorageTmp->mteTriggerTest[0] & MTETRIGGERTEST_BOOLEAN))
  111.         return NULL;
  112.     /*
  113.      * this is where we do the value assignments for the mib results.
  114.      */
  115.     switch (vp->magic) {
  116.     case MTETRIGGERBOOLEANCOMPARISON:
  117.         *write_method = write_mteTriggerBooleanComparison;
  118.         *var_len = sizeof(StorageTmp->mteTriggerBooleanComparison);
  119.         return (u_char *) & StorageTmp->mteTriggerBooleanComparison;
  120.     case MTETRIGGERBOOLEANVALUE:
  121.         *write_method = write_mteTriggerBooleanValue;
  122.         *var_len = sizeof(StorageTmp->mteTriggerBooleanValue);
  123.         return (u_char *) & StorageTmp->mteTriggerBooleanValue;
  124.     case MTETRIGGERBOOLEANSTARTUP:
  125.         *write_method = write_mteTriggerBooleanStartup;
  126.         *var_len = sizeof(StorageTmp->mteTriggerBooleanStartup);
  127.         return (u_char *) & StorageTmp->mteTriggerBooleanStartup;
  128.     case MTETRIGGERBOOLEANOBJECTSOWNER:
  129.         *write_method = write_mteTriggerBooleanObjectsOwner;
  130.         *var_len = StorageTmp->mteTriggerBooleanObjectsOwnerLen;
  131.         return (u_char *) StorageTmp->mteTriggerBooleanObjectsOwner;
  132.     case MTETRIGGERBOOLEANOBJECTS:
  133.         *write_method = write_mteTriggerBooleanObjects;
  134.         *var_len = StorageTmp->mteTriggerBooleanObjectsLen;
  135.         return (u_char *) StorageTmp->mteTriggerBooleanObjects;
  136.     case MTETRIGGERBOOLEANEVENTOWNER:
  137.         *write_method = write_mteTriggerBooleanEventOwner;
  138.         *var_len = StorageTmp->mteTriggerBooleanEventOwnerLen;
  139.         return (u_char *) StorageTmp->mteTriggerBooleanEventOwner;
  140.     case MTETRIGGERBOOLEANEVENT:
  141.         *write_method = write_mteTriggerBooleanEvent;
  142.         *var_len = StorageTmp->mteTriggerBooleanEventLen;
  143.         return (u_char *) StorageTmp->mteTriggerBooleanEvent;
  144.     default:
  145.         ERROR_MSG("");
  146.     }
  147.     return NULL;
  148. }
  149. int
  150. write_mteTriggerBooleanComparison(int action,
  151.                                   u_char * var_val,
  152.                                   u_char var_val_type,
  153.                                   size_t var_val_len,
  154.                                   u_char * statP,
  155.                                   oid * name, size_t name_len)
  156. {
  157.     static int      tmpvar;
  158.     struct mteTriggerTable_data *StorageTmp = NULL;
  159.     size_t          newlen =
  160.         name_len -
  161.         (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
  162.          1);
  163.     DEBUGMSGTL(("mteTriggerBooleanTable",
  164.                 "write_mteTriggerBooleanComparison entering action=%d...  n",
  165.                 action));
  166.     if ((StorageTmp =
  167.          header_complex(mteTriggerTableStorage, NULL,
  168.                         &name[sizeof(mteTriggerBooleanTable_variables_oid)
  169.                               / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  170.                         NULL)) == NULL)
  171.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  172.     switch (action) {
  173.     case RESERVE1:
  174.         if (var_val_type != ASN_INTEGER) {
  175.             fprintf(stderr,
  176.                     "write to mteTriggerBooleanComparison not ASN_INTEGERn");
  177.             return SNMP_ERR_WRONGTYPE;
  178.         }
  179.         if (StorageTmp->storageType != ST_NONVOLATILE)
  180.             return SNMP_ERR_NOTWRITABLE;
  181.         break;
  182.     case RESERVE2:
  183.         /*
  184.          * memory reseveration, final preparation... 
  185.          */
  186.         break;
  187.     case FREE:
  188.         /*
  189.          * Release any resources that have been allocated 
  190.          */
  191.         break;
  192.     case ACTION:
  193.         /*
  194.          * The variable has been stored in long_ret for
  195.          * you to use, and you have just been asked to do something with
  196.          * it.  Note that anything done here must be reversable in the UNDO case 
  197.          */
  198.         tmpvar = StorageTmp->mteTriggerBooleanComparison;
  199.         StorageTmp->mteTriggerBooleanComparison = *((long *) var_val);
  200.         break;
  201.     case UNDO:
  202.         /*
  203.          * Back out any changes made in the ACTION case 
  204.          */
  205.         StorageTmp->mteTriggerBooleanComparison = tmpvar;
  206.         break;
  207.     case COMMIT:
  208.         /*
  209.          * Things are working well, so it's now safe to make the change
  210.          * permanently.  Make sure that anything done here can't fail! 
  211.          */
  212.         break;
  213.     }
  214.     return SNMP_ERR_NOERROR;
  215. }
  216. int
  217. write_mteTriggerBooleanValue(int action,
  218.                              u_char * var_val,
  219.                              u_char var_val_type,
  220.                              size_t var_val_len,
  221.                              u_char * statP, oid * name, size_t name_len)
  222. {
  223.     static int      tmpvar;
  224.     struct mteTriggerTable_data *StorageTmp = NULL;
  225.     size_t          newlen =
  226.         name_len -
  227.         (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
  228.          1);
  229.     DEBUGMSGTL(("mteTriggerBooleanTable",
  230.                 "write_mteTriggerBooleanValue entering action=%d...  n",
  231.                 action));
  232.     if ((StorageTmp =
  233.          header_complex(mteTriggerTableStorage, NULL,
  234.                         &name[sizeof(mteTriggerBooleanTable_variables_oid)
  235.                               / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  236.                         NULL)) == NULL)
  237.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  238.     switch (action) {
  239.     case RESERVE1:
  240.         if (var_val_type != ASN_INTEGER) {
  241.             fprintf(stderr,
  242.                     "write to mteTriggerBooleanValue not ASN_INTEGERn");
  243.             return SNMP_ERR_WRONGTYPE;
  244.         }
  245.         if (StorageTmp->storageType != ST_NONVOLATILE)
  246.             return SNMP_ERR_NOTWRITABLE;
  247.         break;
  248.     case RESERVE2:
  249.         /*
  250.          * memory reseveration, final preparation... 
  251.          */
  252.         break;
  253.     case FREE:
  254.         /*
  255.          * Release any resources that have been allocated 
  256.          */
  257.         break;
  258.     case ACTION:
  259.         /*
  260.          * The variable has been stored in long_ret for
  261.          * you to use, and you have just been asked to do something with
  262.          * it.  Note that anything done here must be reversable in the UNDO case 
  263.          */
  264.         tmpvar = StorageTmp->mteTriggerBooleanValue;
  265.         StorageTmp->mteTriggerBooleanValue = *((long *) var_val);
  266.         break;
  267.     case UNDO:
  268.         /*
  269.          * Back out any changes made in the ACTION case 
  270.          */
  271.         StorageTmp->mteTriggerBooleanValue = tmpvar;
  272.         break;
  273.     case COMMIT:
  274.         /*
  275.          * Things are working well, so it's now safe to make the change
  276.          * permanently.  Make sure that anything done here can't fail! 
  277.          */
  278.         break;
  279.     }
  280.     return SNMP_ERR_NOERROR;
  281. }
  282. int
  283. write_mteTriggerBooleanStartup(int action,
  284.                                u_char * var_val,
  285.                                u_char var_val_type,
  286.                                size_t var_val_len,
  287.                                u_char * statP, oid * name, size_t name_len)
  288. {
  289.     static int      tmpvar;
  290.     struct mteTriggerTable_data *StorageTmp = NULL;
  291.     size_t          newlen =
  292.         name_len -
  293.         (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
  294.          1);
  295.     DEBUGMSGTL(("mteTriggerBooleanTable",
  296.                 "write_mteTriggerBooleanStartup entering action=%d...  n",
  297.                 action));
  298.     if ((StorageTmp =
  299.          header_complex(mteTriggerTableStorage, NULL,
  300.                         &name[sizeof(mteTriggerBooleanTable_variables_oid)
  301.                               / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  302.                         NULL)) == NULL)
  303.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  304.     switch (action) {
  305.     case RESERVE1:
  306.         if (var_val_type != ASN_INTEGER) {
  307.             fprintf(stderr,
  308.                     "write to mteTriggerBooleanStartup not ASN_INTEGERn");
  309.             return SNMP_ERR_WRONGTYPE;
  310.         }
  311.         if (StorageTmp->storageType != ST_NONVOLATILE)
  312.             return SNMP_ERR_NOTWRITABLE;
  313.         break;
  314.     case RESERVE2:
  315.         /*
  316.          * memory reseveration, final preparation... 
  317.          */
  318.         break;
  319.     case FREE:
  320.         /*
  321.          * Release any resources that have been allocated 
  322.          */
  323.         break;
  324.     case ACTION:
  325.         /*
  326.          * The variable has been stored in long_ret for
  327.          * you to use, and you have just been asked to do something with
  328.          * it.  Note that anything done here must be reversable in the UNDO case 
  329.          */
  330.         tmpvar = StorageTmp->mteTriggerBooleanStartup;
  331.         StorageTmp->mteTriggerBooleanStartup = *((long *) var_val);
  332.         break;
  333.     case UNDO:
  334.         /*
  335.          * Back out any changes made in the ACTION case 
  336.          */
  337.         StorageTmp->mteTriggerBooleanStartup = tmpvar;
  338.         break;
  339.     case COMMIT:
  340.         /*
  341.          * Things are working well, so it's now safe to make the change
  342.          * permanently.  Make sure that anything done here can't fail! 
  343.          */
  344.         break;
  345.     }
  346.     return SNMP_ERR_NOERROR;
  347. }
  348. int
  349. write_mteTriggerBooleanObjectsOwner(int action,
  350.                                     u_char * var_val,
  351.                                     u_char var_val_type,
  352.                                     size_t var_val_len,
  353.                                     u_char * statP,
  354.                                     oid * name, size_t name_len)
  355. {
  356.     static char    *tmpvar;
  357.     struct mteTriggerTable_data *StorageTmp = NULL;
  358.     static size_t   tmplen;
  359.     size_t          newlen =
  360.         name_len -
  361.         (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
  362.          1);
  363.     DEBUGMSGTL(("mteTriggerBooleanTable",
  364.                 "write_mteTriggerBooleanObjectsOwner entering action=%d...  n",
  365.                 action));
  366.     if ((StorageTmp =
  367.          header_complex(mteTriggerTableStorage, NULL,
  368.                         &name[sizeof(mteTriggerBooleanTable_variables_oid)
  369.                               / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  370.                         NULL)) == NULL)
  371.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  372.     switch (action) {
  373.     case RESERVE1:
  374.         if (var_val_type != ASN_OCTET_STR) {
  375.             fprintf(stderr,
  376.                     "write to mteTriggerBooleanObjectsOwner not ASN_OCTET_STRn");
  377.             return SNMP_ERR_WRONGTYPE;
  378.         }
  379.         if (StorageTmp->storageType != ST_NONVOLATILE)
  380.             return SNMP_ERR_NOTWRITABLE;
  381.         break;
  382.     case RESERVE2:
  383.         /*
  384.          * memory reseveration, final preparation... 
  385.          */
  386.         break;
  387.     case FREE:
  388.         /*
  389.          * Release any resources that have been allocated 
  390.          */
  391.         break;
  392.     case ACTION:
  393.         /*
  394.          * The variable has been stored in string for
  395.          * you to use, and you have just been asked to do something with
  396.          * it.  Note that anything done here must be reversable in the UNDO case 
  397.          */
  398.         tmpvar = StorageTmp->mteTriggerBooleanObjectsOwner;
  399.         tmplen = StorageTmp->mteTriggerBooleanObjectsOwnerLen;
  400.         StorageTmp->mteTriggerBooleanObjectsOwner =
  401.             netsnmp_strdup_and_null(var_val, var_val_len);
  402.         StorageTmp->mteTriggerBooleanObjectsOwnerLen = var_val_len;
  403.         break;
  404.     case UNDO:
  405.         /*
  406.          * Back out any changes made in the ACTION case 
  407.          */
  408.         SNMP_FREE(StorageTmp->mteTriggerBooleanObjectsOwner);
  409.         StorageTmp->mteTriggerBooleanObjectsOwner = tmpvar;
  410.         StorageTmp->mteTriggerBooleanObjectsOwnerLen = tmplen;
  411.         break;
  412.     case COMMIT:
  413.         /*
  414.          * Things are working well, so it's now safe to make the change
  415.          * permanently.  Make sure that anything done here can't fail! 
  416.          */
  417.         SNMP_FREE(tmpvar);
  418.         break;
  419.     }
  420.     return SNMP_ERR_NOERROR;
  421. }
  422. int
  423. write_mteTriggerBooleanObjects(int action,
  424.                                u_char * var_val,
  425.                                u_char var_val_type,
  426.                                size_t var_val_len,
  427.                                u_char * statP, oid * name, size_t name_len)
  428. {
  429.     static char    *tmpvar;
  430.     struct mteTriggerTable_data *StorageTmp = NULL;
  431.     static size_t   tmplen;
  432.     size_t          newlen =
  433.         name_len -
  434.         (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
  435.          1);
  436.     DEBUGMSGTL(("mteTriggerBooleanTable",
  437.                 "write_mteTriggerBooleanObjects entering action=%d...  n",
  438.                 action));
  439.     if ((StorageTmp =
  440.          header_complex(mteTriggerTableStorage, NULL,
  441.                         &name[sizeof(mteTriggerBooleanTable_variables_oid)
  442.                               / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  443.                         NULL)) == NULL)
  444.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  445.     switch (action) {
  446.     case RESERVE1:
  447.         if (var_val_type != ASN_OCTET_STR) {
  448.             fprintf(stderr,
  449.                     "write to mteTriggerBooleanObjects not ASN_OCTET_STRn");
  450.             return SNMP_ERR_WRONGTYPE;
  451.         }
  452.         if (StorageTmp->storageType != ST_NONVOLATILE)
  453.             return SNMP_ERR_NOTWRITABLE;
  454.         break;
  455.     case RESERVE2:
  456.         /*
  457.          * memory reseveration, final preparation... 
  458.          */
  459.         break;
  460.     case FREE:
  461.         /*
  462.          * Release any resources that have been allocated 
  463.          */
  464.         break;
  465.     case ACTION:
  466.         /*
  467.          * The variable has been stored in string for
  468.          * you to use, and you have just been asked to do something with
  469.          * it.  Note that anything done here must be reversable in the UNDO case 
  470.          */
  471.         tmpvar = StorageTmp->mteTriggerBooleanObjects;
  472.         tmplen = StorageTmp->mteTriggerBooleanObjectsLen;
  473.         StorageTmp->mteTriggerBooleanObjects =
  474.             netsnmp_strdup_and_null(var_val, var_val_len);
  475.         StorageTmp->mteTriggerBooleanObjectsLen = var_val_len;
  476.         break;
  477.     case UNDO:
  478.         /*
  479.          * Back out any changes made in the ACTION case 
  480.          */
  481.         SNMP_FREE(StorageTmp->mteTriggerBooleanObjects);
  482.         StorageTmp->mteTriggerBooleanObjects = tmpvar;
  483.         StorageTmp->mteTriggerBooleanObjectsLen = tmplen;
  484.         break;
  485.     case COMMIT:
  486.         /*
  487.          * Things are working well, so it's now safe to make the change
  488.          * permanently.  Make sure that anything done here can't fail! 
  489.          */
  490.         SNMP_FREE(tmpvar);
  491.         break;
  492.     }
  493.     return SNMP_ERR_NOERROR;
  494. }
  495. int
  496. write_mteTriggerBooleanEventOwner(int action,
  497.                                   u_char * var_val,
  498.                                   u_char var_val_type,
  499.                                   size_t var_val_len,
  500.                                   u_char * statP,
  501.                                   oid * name, size_t name_len)
  502. {
  503.     static char    *tmpvar;
  504.     struct mteTriggerTable_data *StorageTmp = NULL;
  505.     static size_t   tmplen;
  506.     size_t          newlen =
  507.         name_len -
  508.         (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
  509.          1);
  510.     DEBUGMSGTL(("mteTriggerBooleanTable",
  511.                 "write_mteTriggerBooleanEventOwner entering action=%d...  n",
  512.                 action));
  513.     if ((StorageTmp =
  514.          header_complex(mteTriggerTableStorage, NULL,
  515.                         &name[sizeof(mteTriggerBooleanTable_variables_oid)
  516.                               / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  517.                         NULL)) == NULL)
  518.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  519.     switch (action) {
  520.     case RESERVE1:
  521.         if (var_val_type != ASN_OCTET_STR) {
  522.             fprintf(stderr,
  523.                     "write to mteTriggerBooleanEventOwner not ASN_OCTET_STRn");
  524.             return SNMP_ERR_WRONGTYPE;
  525.         }
  526.         if (StorageTmp->storageType != ST_NONVOLATILE)
  527.             return SNMP_ERR_NOTWRITABLE;
  528.         break;
  529.     case RESERVE2:
  530.         /*
  531.          * memory reseveration, final preparation... 
  532.          */
  533.         break;
  534.     case FREE:
  535.         /*
  536.          * Release any resources that have been allocated 
  537.          */
  538.         break;
  539.     case ACTION:
  540.         /*
  541.          * The variable has been stored in string for
  542.          * you to use, and you have just been asked to do something with
  543.          * it.  Note that anything done here must be reversable in the UNDO case 
  544.          */
  545.         tmpvar = StorageTmp->mteTriggerBooleanEventOwner;
  546.         tmplen = StorageTmp->mteTriggerBooleanEventOwnerLen;
  547.         StorageTmp->mteTriggerBooleanEventOwner =
  548.             netsnmp_strdup_and_null(var_val, var_val_len);
  549.         StorageTmp->mteTriggerBooleanEventOwnerLen = var_val_len;
  550.         break;
  551.     case UNDO:
  552.         /*
  553.          * Back out any changes made in the ACTION case 
  554.          */
  555.         SNMP_FREE(StorageTmp->mteTriggerBooleanEventOwner);
  556.         StorageTmp->mteTriggerBooleanEventOwner = tmpvar;
  557.         StorageTmp->mteTriggerBooleanEventOwnerLen = tmplen;
  558.         break;
  559.     case COMMIT:
  560.         /*
  561.          * Things are working well, so it's now safe to make the change
  562.          * permanently.  Make sure that anything done here can't fail! 
  563.          */
  564.         SNMP_FREE(tmpvar);
  565.         break;
  566.     }
  567.     return SNMP_ERR_NOERROR;
  568. }
  569. int
  570. write_mteTriggerBooleanEvent(int action,
  571.                              u_char * var_val,
  572.                              u_char var_val_type,
  573.                              size_t var_val_len,
  574.                              u_char * statP, oid * name, size_t name_len)
  575. {
  576.     static char    *tmpvar;
  577.     struct mteTriggerTable_data *StorageTmp = NULL;
  578.     static size_t   tmplen;
  579.     size_t          newlen =
  580.         name_len -
  581.         (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
  582.          1);
  583.     DEBUGMSGTL(("mteTriggerBooleanTable",
  584.                 "write_mteTriggerBooleanEvent entering action=%d...  n",
  585.                 action));
  586.     if ((StorageTmp =
  587.          header_complex(mteTriggerTableStorage, NULL,
  588.                         &name[sizeof(mteTriggerBooleanTable_variables_oid)
  589.                               / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
  590.                         NULL)) == NULL)
  591.         return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
  592.     switch (action) {
  593.     case RESERVE1:
  594.         if (var_val_type != ASN_OCTET_STR) {
  595.             fprintf(stderr,
  596.                     "write to mteTriggerBooleanEvent not ASN_OCTET_STRn");
  597.             return SNMP_ERR_WRONGTYPE;
  598.         }
  599.         if (StorageTmp->storageType != ST_NONVOLATILE)
  600.             return SNMP_ERR_NOTWRITABLE;
  601.         break;
  602.     case RESERVE2:
  603.         /*
  604.          * memory reseveration, final preparation... 
  605.          */
  606.         break;
  607.     case FREE:
  608.         /*
  609.          * Release any resources that have been allocated 
  610.          */
  611.         break;
  612.     case ACTION:
  613.         /*
  614.          * The variable has been stored in string for
  615.          * you to use, and you have just been asked to do something with
  616.          * it.  Note that anything done here must be reversable in the UNDO case 
  617.          */
  618.         tmpvar = StorageTmp->mteTriggerBooleanEvent;
  619.         tmplen = StorageTmp->mteTriggerBooleanEventLen;
  620.         StorageTmp->mteTriggerBooleanEvent =
  621.             netsnmp_strdup_and_null(var_val, var_val_len);
  622.         StorageTmp->mteTriggerBooleanEventLen = var_val_len;
  623.         break;
  624.     case UNDO:
  625.         /*
  626.          * Back out any changes made in the ACTION case 
  627.          */
  628.         SNMP_FREE(StorageTmp->mteTriggerBooleanEvent);
  629.         StorageTmp->mteTriggerBooleanEvent = tmpvar;
  630.         StorageTmp->mteTriggerBooleanEventLen = tmplen;
  631.         break;
  632.     case COMMIT:
  633.         /*
  634.          * Things are working well, so it's now safe to make the change
  635.          * permanently.  Make sure that anything done here can't fail! 
  636.          */
  637.         SNMP_FREE(tmpvar);
  638.         break;
  639.     }
  640.     return SNMP_ERR_NOERROR;
  641. }