summaryrefslogtreecommitdiff
path: root/RDBMS-MIB_src/rdbmsSrvTable
diff options
context:
space:
mode:
Diffstat (limited to 'RDBMS-MIB_src/rdbmsSrvTable')
-rw-r--r--RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable.c130
-rw-r--r--RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable.h205
-rw-r--r--RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_access.c306
-rw-r--r--RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_access.h64
-rw-r--r--RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_get.c758
-rw-r--r--RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_get.h66
-rw-r--r--RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_set.c30
-rw-r--r--RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_set.h34
-rw-r--r--RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_enums.h47
-rw-r--r--RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_interface.c701
-rw-r--r--RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_interface.h50
-rw-r--r--RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_oids.h37
12 files changed, 2428 insertions, 0 deletions
diff --git a/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable.c b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable.c
new file mode 100644
index 0000000..f713244
--- /dev/null
+++ b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable.c
@@ -0,0 +1,130 @@
+/*-------------------------------------------------------------------------
+ * rdbmsSrvTable.c
+ *
+ * RDBMSMIB mib module.
+ *
+ * Copyright (c) 2004-2007, PostgreSQL Global Development Group
+ * Author: Joshua Tolley
+ *
+ * $Id: rdbmsSrvTable.c,v 1.4 2007/09/13 14:20:44 h-saito Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/* standard Net-SNMP includes */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/* include our parent header */
+#include "rdbmsSrvTable.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "rdbmsSrvTable_interface.h"
+
+oid rdbmsSrvTable_oid[] = { RDBMSSRVTABLE_OID };
+int rdbmsSrvTable_oid_size = OID_LENGTH(rdbmsSrvTable_oid);
+
+void initialize_table_rdbmsSrvTable(void);
+
+
+/**
+ * Initializes the rdbmsSrvTable module
+ */
+void
+init_rdbmsSrvTable(void)
+{
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:init_rdbmsSrvTable","called\n"));
+
+ /*
+ * TODO:300:o: Perform rdbmsSrvTable one-time module initialization.
+ */
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ if (should_init("rdbmsSrvTable"))
+ initialize_table_rdbmsSrvTable();
+
+} /* init_rdbmsSrvTable */
+
+/**
+ * Initialize the table rdbmsSrvTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_rdbmsSrvTable(void)
+{
+ rdbmsSrvTable_registration_ptr user_context;
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:initialize_table_rdbmsSrvTable","called\n"));
+
+ /*
+ * TODO:301:o: Perform rdbmsSrvTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize rdbmsSrvTable user context
+ * if you'd like to pass in a pointer to some data for this
+ * table, allocate or set it up here.
+ */
+ /*
+ * a netsnmp_data_list is a simple way to store void pointers. A simple
+ * string token is used to add, find or remove pointers.
+ */
+ user_context = netsnmp_create_data_list("rdbmsSrvTable", NULL, NULL);
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _rdbmsSrvTable_initialize_interface(user_context, flags);
+} /* initialize_table_rdbmsSrvTable */
+
+/**
+ * pre-request callback
+ *
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+rdbmsSrvTable_pre_request(rdbmsSrvTable_registration_ptr user_context)
+{
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvTable_pre_request","called\n"));
+
+ /*
+ * TODO:510:o: Perform rdbmsSrvTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* rdbmsSrvTable_pre_request */
+
+/**
+ * post-request callback
+ *
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error (ignored)
+ */
+int
+rdbmsSrvTable_post_request(rdbmsSrvTable_registration_ptr user_context)
+{
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvTable_post_request","called\n"));
+
+ /*
+ * TODO:511:o: Perform rdbmsSrvTable pos-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* rdbmsSrvTable_post_request */
+
+
+/** @{ */
diff --git a/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable.h b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable.h
new file mode 100644
index 0000000..c2c6553
--- /dev/null
+++ b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable.h
@@ -0,0 +1,205 @@
+/*-------------------------------------------------------------------------
+ * rdbmsSrvTable.h
+ *
+ * RDBMSMIB mib module.
+ *
+ * Copyright (c) 2004-2007, PostgreSQL Global Development Group
+ * Author: Joshua Tolley
+ *
+ * $Id: rdbmsSrvTable.h,v 1.4 2007/09/13 14:20:44 h-saito Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef RDBMSSRVTABLE_H
+#define RDBMSSRVTABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @defgroup misc misc: Miscelaneous routines
+ *
+ * @{
+ */
+#include <net-snmp/library/asn1.h>
+
+/* other required module components */
+ /* *INDENT-OFF* */
+config_require(RDBMS-MIB/rdbmsSrvTable/rdbmsSrvTable_interface);
+config_require(RDBMS-MIB/rdbmsSrvTable/rdbmsSrvTable_data_access);
+config_require(RDBMS-MIB/rdbmsSrvTable/rdbmsSrvTable_data_get);
+config_require(RDBMS-MIB/rdbmsSrvTable/rdbmsSrvTable_data_set);
+ /* *INDENT-ON* */
+
+/* OID and column number definitions for */
+#include "rdbmsSrvTable_oids.h"
+
+/* enum definions */
+#include "rdbmsSrvTable_enums.h"
+
+/* *********************************************************************
+ * function declarations
+ */
+void init_rdbmsSrvTable(void);
+
+/* *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table rdbmsSrvTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * rdbmsSrvTable is subid 5 of rdbmsObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.39.1.5, length: 9
+*/
+/* *********************************************************************
+ * When you register your mib, you get to provide a generic
+ * pointer that will be passed back to you for most of the
+ * functions calls.
+ *
+ * TODO:100:r: Review all context structures
+ */
+ /*
+ * TODO:101:o: |-> Review rdbmsSrvTable registration context.
+ */
+typedef netsnmp_data_list * rdbmsSrvTable_registration_ptr;
+
+/**********************************************************************/
+/*
+ * TODO:110:r: |-> Review rdbmsSrvTable data context structure.
+ * This structure is used to represent the data for rdbmsSrvTable.
+ */
+/*
+ * This structure contains storage for all the columns defined in the
+ * rdbmsSrvTable.
+ */
+typedef struct rdbmsSrvTable_data_s {
+
+ /*
+ * rdbmsSrvPrivateMibOID(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/w/e/r/d/h
+ */
+ oid rdbmsSrvPrivateMibOID[128];
+size_t rdbmsSrvPrivateMibOID_len; /* # of oid elements, not bytes */
+
+ /*
+ * rdbmsSrvVendorName(2)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H
+ */
+ char rdbmsSrvVendorName[255];
+size_t rdbmsSrvVendorName_len; /* # of char elements, not bytes */
+
+ /*
+ * rdbmsSrvProductName(3)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H
+ */
+ char rdbmsSrvProductName[255];
+size_t rdbmsSrvProductName_len; /* # of char elements, not bytes */
+
+ /*
+ * rdbmsSrvContact(4)/DisplayString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ char rdbmsSrvContact[255];
+size_t rdbmsSrvContact_len; /* # of char elements, not bytes */
+
+} rdbmsSrvTable_data;
+
+
+/*
+ * TODO:120:r: |-> Review rdbmsSrvTable mib index.
+ * This structure is used to represent the index for rdbmsSrvTable.
+ */
+typedef struct rdbmsSrvTable_mib_index_s {
+
+ /*
+ * applIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h
+ */
+ long applIndex;
+
+
+} rdbmsSrvTable_mib_index;
+
+ /*
+ * TODO:121:r: | |-> Review rdbmsSrvTable max index length.
+ * If you KNOW that your indexes will never exceed a certain
+ * length, update this macro to that length.
+*/
+#define MAX_rdbmsSrvTable_IDX_LEN 1
+
+
+/* *********************************************************************
+ * TODO:130:o: |-> Review rdbmsSrvTable Row request (rowreq) context.
+ * When your functions are called, you will be passed a
+ * rdbmsSrvTable_rowreq_ctx pointer.
+ */
+typedef struct rdbmsSrvTable_rowreq_ctx_s {
+
+ /** this must be first for container compare to work */
+ netsnmp_index oid_idx;
+ oid oid_tmp[MAX_rdbmsSrvTable_IDX_LEN];
+
+ rdbmsSrvTable_mib_index tbl_idx;
+
+ rdbmsSrvTable_data data;
+
+ /*
+ * flags per row. Currently, the first (lower) 8 bits are reserved
+ * for the user. See mfd.h for other flags.
+ */
+ u_int rowreq_flags;
+
+ /*
+ * implementor's context pointer (provided during registration)
+ */
+ rdbmsSrvTable_registration_ptr rdbmsSrvTable_reg;
+
+ /*
+ * TODO:131:o: | |-> Add useful data to rdbmsSrvTable rowreq context.
+ */
+
+ /*
+ * storage for future expansion
+ */
+ netsnmp_data_list *rdbmsSrvTable_data_list;
+
+} rdbmsSrvTable_rowreq_ctx;
+
+typedef struct rdbmsSrvTable_ref_rowreq_ctx_s {
+ rdbmsSrvTable_rowreq_ctx *rowreq_ctx;
+} rdbmsSrvTable_ref_rowreq_ctx;
+
+/* *********************************************************************
+ * function prototypes
+ */
+ int rdbmsSrvTable_pre_request(rdbmsSrvTable_registration_ptr user_context);
+ int rdbmsSrvTable_post_request(rdbmsSrvTable_registration_ptr user_context);
+
+
+extern oid rdbmsSrvTable_oid[];
+extern int rdbmsSrvTable_oid_size;
+
+
+#include "rdbmsSrvTable_interface.h"
+#include "rdbmsSrvTable_data_access.h"
+#include "rdbmsSrvTable_data_get.h"
+#include "rdbmsSrvTable_data_set.h"
+
+/*
+ * DUMMY markers, ignore
+ *
+ * TODO:099:x: *************************************************************
+ * TODO:199:x: *************************************************************
+ * TODO:299:x: *************************************************************
+ * TODO:399:x: *************************************************************
+ * TODO:499:x: *************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RDBMSSRVTABLE_H */
diff --git a/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_access.c b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_access.c
new file mode 100644
index 0000000..6345766
--- /dev/null
+++ b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_access.c
@@ -0,0 +1,306 @@
+/*-------------------------------------------------------------------------
+ * rdbmsSrvTable_data_access.c
+ *
+ * RDBMSMIB mib module.
+ *
+ * Copyright (c) 2004-2007, PostgreSQL Global Development Group
+ * Author: Joshua Tolley
+ *
+ * $Id: rdbmsSrvTable_data_access.c,v 1.9 2007/09/13 14:20:44 h-saito Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "pgsnmpd.h"
+
+/* include our parent header */
+#include "rdbmsSrvTable.h"
+#include "rdbmsSrvTable_data_access.h"
+
+/** @defgroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table rdbmsSrvTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * rdbmsSrvTable is subid 5 of rdbmsObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.39.1.5, length: 9
+*/
+
+/**
+ * initialization for rdbmsSrvTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param rdbmsSrvTable_reg
+ * Pointer to rdbmsSrvTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+rdbmsSrvTable_init_data(rdbmsSrvTable_registration_ptr rdbmsSrvTable_reg)
+{
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvTable_init_data","called\n"));
+
+ /*
+ * TODO:303:o: Initialize rdbmsSrvTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* rdbmsSrvTable_init_data */
+
+/**
+ * container-cached overview
+ *
+ */
+
+/***********************************************************************
+ *
+ * cache
+ *
+ ***********************************************************************/
+/**
+ * container initialization
+ *
+ * @param container_ptr_ptr A pointer to a container pointer. If you
+ * create a custom container, use this parameter to return it
+ * to the MFD helper. If set to NULL, the MFD helper will
+ * allocate a container for you.
+ * @param cache A pointer to a cache structure. You can set the timeout
+ * and other cache flags using this pointer.
+ *
+ * This function is called at startup to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases. If no custom
+ * container is allocated, the MFD code will create one for your.
+ *
+ * This is also the place to set up cache behavior. The default, to
+ * simply set the cache timeout, will work well with the default
+ * container. If you are using a custom container, you may want to
+ * look at the cache helper documentation to see if there are any
+ * flags you want to set.
+ *
+ * @remark
+ * This would also be a good place to do any initialization needed
+ * for you data source. For example, opening a connection to another
+ * process that will supply the data, opening a database, etc.
+ */
+void
+rdbmsSrvTable_container_init(netsnmp_container **container_ptr_ptr,
+ netsnmp_cache *cache)
+{
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvTable_container_init","called\n"));
+
+ if((NULL == cache) || (NULL == container_ptr_ptr)) {
+ snmp_log(LOG_ERR,"bad params to rdbmsSrvTable_container_init\n");
+ return;
+ }
+
+ /*
+ * For advanced users, you can use a custom container. If you
+ * do not create one, one will be created for you.
+ */
+ *container_ptr_ptr = NULL;
+
+ /*
+ * TODO:345:A: Set up rdbmsSrvTable cache properties.
+ *
+ * Also for advanced users, you can set parameters for the
+ * cache. Do not change the magic pointer, as it is used
+ * by the MFD helper. To completely disable caching, set
+ * cache->enabled to 0.
+ */
+ cache->timeout = RDBMSSRVTABLE_CACHE_TIMEOUT; /* seconds */
+} /* rdbmsSrvTable_container_init */
+
+/**
+ * load cache data
+ *
+ * TODO:350:M: Implement rdbmsSrvTable cache load
+ *
+ * @param container container to which items should be inserted
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
+ * @retval MFD_ERROR : other error.
+ *
+ * This function is called to cache the index(es) (and data, optionally)
+ * for the every row in the data set.
+ *
+ * @remark
+ * While loading the cache, the only important thing is the indexes.
+ * If access to your data is cheap/fast (e.g. you have a pointer to a
+ * structure in memory), it would make sense to update the data here.
+ * If, however, the accessing the data invovles more work (e.g. parsing
+ * some other existing data, or peforming calculations to derive the data),
+ * then you can limit yourself to setting the indexes and saving any
+ * information you will need later. Then use the saved information in
+ * rdbmsSrvTable_row_prep() for populating data.
+ *
+ * @note
+ * If you need consistency between rows (like you want statistics
+ * for each row to be from the same time frame), you should set all
+ * data here.
+ *
+ */
+int
+rdbmsSrvTable_cache_load(netsnmp_container *container)
+{
+ rdbmsSrvTable_rowreq_ctx *rowreq_ctx;
+ oid rdbmsSrvPrivateMibOID[128] = { 1,3,6,1,4,1,27645 };
+ size_t count = 0;
+
+ /*
+ * applIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h
+ */
+
+ /* Eventually we'll probably want to make this actually pay attention to
+ * APPLICATION-MIB. For now, I'm ignoring it. When we make that change, we'll need to
+ * modify the other files that use applIndex (the one I'm thinking of now is rdbmsRelTable */
+ long applIndex = 1;
+ PGresult *pgsnmpd_tbl_qry;
+ int vendor_len, contact_len, product_len;
+ char *vendor_name, *contact_name, *product_name;
+
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvTable_cache_load","called\n"));
+
+ /*
+ * TODO:351:M: |-> Load/update data in the rdbmsSrvTable container.
+ * loop over your rdbmsSrvTable data, allocate a rowreq context,
+ * set the index(es) [and data, optionally] and insert into
+ * the container.
+ */
+
+ /* There's only one server, so we only need to create one row */
+ /*
+ * TODO:352:M: | |-> set indexes in new rdbmsSrvTable rowreq context.
+ */
+ rowreq_ctx = rdbmsSrvTable_allocate_rowreq_ctx();
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "memory allocation failed\n");
+ return MFD_RESOURCE_UNAVAILABLE;
+ }
+ if(MFD_SUCCESS != rdbmsSrvTable_indexes_set(rowreq_ctx
+ , applIndex
+ )) {
+ snmp_log(LOG_ERR,"error setting index while loading "
+ "rdbmsSrvTable cache.\n");
+ rdbmsSrvTable_release_rowreq_ctx(rowreq_ctx);
+ return MFD_ERROR;
+ }
+
+ pgsnmpd_tbl_qry = PQexec(dbconn, "SELECT vendor_name, product_name, contact_name FROM pgsnmpd_rdbmsSrvTable");
+ if (PQresultStatus(pgsnmpd_tbl_qry) == PGRES_TUPLES_OK && PQntuples(pgsnmpd_tbl_qry) > 0) {
+ vendor_name = PQgetvalue(pgsnmpd_tbl_qry, 0, 0);
+ product_name = PQgetvalue(pgsnmpd_tbl_qry, 0, 1);
+ contact_name = PQgetvalue(pgsnmpd_tbl_qry, 0, 2);
+ vendor_len = strlen(vendor_name);
+ product_len = strlen(product_name);
+ contact_len = strlen(contact_name);
+ }
+ else {
+ product_name = NULL;
+ vendor_name = NULL;
+ contact_name = NULL;
+ product_len = 0;
+ vendor_len = 0;
+ contact_len = 0;
+ }
+
+ rowreq_ctx->data.rdbmsSrvVendorName_len = 255;
+ rowreq_ctx->data.rdbmsSrvContact_len = 255;
+ rowreq_ctx->data.rdbmsSrvProductName_len = 255;
+
+ rowreq_ctx->data.rdbmsSrvPrivateMibOID_len = 8 * sizeof(rowreq_ctx->data.rdbmsSrvPrivateMibOID[0]);
+ memcpy( rowreq_ctx->data.rdbmsSrvPrivateMibOID, rdbmsSrvPrivateMibOID, rowreq_ctx->data.rdbmsSrvPrivateMibOID_len );
+
+ rowreq_ctx->data.rdbmsSrvVendorName_len = vendor_len * sizeof(rowreq_ctx->data.rdbmsSrvVendorName[0]);
+ memcpy( rowreq_ctx->data.rdbmsSrvVendorName, vendor_name, rowreq_ctx->data.rdbmsSrvVendorName_len );
+
+ rowreq_ctx->data.rdbmsSrvProductName_len = product_len * sizeof(rowreq_ctx->data.rdbmsSrvProductName[0]);
+ memcpy( rowreq_ctx->data.rdbmsSrvProductName, product_name, rowreq_ctx->data.rdbmsSrvProductName_len );
+
+ rowreq_ctx->data.rdbmsSrvContact_len = contact_len * sizeof(rowreq_ctx->data.rdbmsSrvContact[0]);
+ memcpy( rowreq_ctx->data.rdbmsSrvContact, contact_name, rowreq_ctx->data.rdbmsSrvContact_len );
+
+ PQclear(pgsnmpd_tbl_qry);
+
+
+ /*
+ * insert into table container
+ */
+ CONTAINER_INSERT(container, rowreq_ctx);
+ ++count;
+
+
+ DEBUGMSGT(("verbose:rdbmsSrvTable:rdbmsSrvTable_cache_load",
+ "inserted %d records\n", count));
+
+ return MFD_SUCCESS;
+} /* rdbmsSrvTable_cache_load */
+
+/**
+ * cache clean up
+ *
+ * @param container container with all current items
+ *
+ * This optional callback is called prior to all
+ * item's being removed from the container. If you
+ * need to do any processing before that, do it here.
+ *
+ * @note
+ * The MFD helper will take care of releasing all the row contexts.
+ *
+ */
+void
+rdbmsSrvTable_cache_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvTable_cache_free","called\n"));
+
+ /*
+ * TODO:380:M: Free rdbmsSrvTable cache.
+ */
+} /* rdbmsSrvTable_cache_free */
+
+/**
+ * prepare row for processing.
+ *
+ * When the agent has located the row for a request, this function is
+ * called to prepare the row for processing. If you fully populated
+ * the data context during the index setup phase, you may not need to
+ * do anything.
+ *
+ * @param rowreq_ctx pointer to a context.
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ */
+int
+rdbmsSrvTable_row_prep( rdbmsSrvTable_rowreq_ctx *rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvTable_row_prep","called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:390:o: Prepare row for request.
+ * If populating row data was delayed, this is the place to
+ * fill in the row for this request.
+ */
+
+ return MFD_SUCCESS;
+} /* rdbmsSrvTable_row_prep */
+
+/** @} */
diff --git a/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_access.h b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_access.h
new file mode 100644
index 0000000..a074ba0
--- /dev/null
+++ b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_access.h
@@ -0,0 +1,64 @@
+/*-------------------------------------------------------------------------
+ * rdbmsSrvTable_data_access.h
+ *
+ * RDBMSMIB mib module.
+ *
+ * Copyright (c) 2004-2007, PostgreSQL Global Development Group
+ * Author: Joshua Tolley
+ *
+ * $Id: rdbmsSrvTable_data_access.h,v 1.4 2007/09/13 14:20:44 h-saito Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef RDBMSSRVTABLE_DATA_ACCESS_H
+#define RDBMSSRVTABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* *********************************************************************
+ * function declarations
+ */
+
+/* *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table rdbmsSrvTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * rdbmsSrvTable is subid 5 of rdbmsObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.39.1.5, length: 9
+*/
+
+
+ int rdbmsSrvTable_init_data(rdbmsSrvTable_registration_ptr rdbmsSrvTable_reg);
+
+
+/*
+ * TODO:180:o: Review rdbmsSrvTable cache timeout.
+ * The number of seconds before the cache times out
+ */
+#define RDBMSSRVTABLE_CACHE_TIMEOUT 60
+
+void rdbmsSrvTable_container_init(netsnmp_container **container_ptr_ptr,
+ netsnmp_cache *cache);
+int rdbmsSrvTable_cache_load(netsnmp_container *container);
+void rdbmsSrvTable_cache_free(netsnmp_container *container);
+
+ int rdbmsSrvTable_row_prep( rdbmsSrvTable_rowreq_ctx *rowreq_ctx);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RDBMSSRVTABLE_DATA_ACCESS_H */
diff --git a/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_get.c b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_get.c
new file mode 100644
index 0000000..ce0fa3d
--- /dev/null
+++ b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_get.c
@@ -0,0 +1,758 @@
+/*-------------------------------------------------------------------------
+ * rdbmsSrvTable_data_get.c
+ *
+ * RDBMSMIB mib module.
+ *
+ * Copyright (c) 2004-2007, PostgreSQL Global Development Group
+ * Author: Joshua Tolley
+ *
+ * $Id: rdbmsSrvTable_data_get.c,v 1.4 2007/09/13 14:20:44 h-saito Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/* standard Net-SNMP includes */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/* include our parent header */
+#include "rdbmsSrvTable.h"
+
+
+/** @defgroup data_get data_get: Routines to get data
+ *
+ * TODO:230:M: Implement rdbmsSrvTable get routines.
+ * TODO:240:M: Implement rdbmsSrvTable mapping routines (if any).
+ *
+ * These routine are used to get the value for individual objects. The
+ * row context is passed, along with a pointer to the memory where the
+ * value should be copied.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table rdbmsSrvTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * rdbmsSrvTable is subid 5 of rdbmsObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.39.1.5, length: 9
+*/
+
+/* ---------------------------------------------------------------------
+ * TODO:200:r: Implement rdbmsSrvTable data context functions.
+ */
+
+/*---------------------------------------------------------------------
+ * APPLICATION-MIB::applEntry.applIndex
+ * applIndex is subid 1 of applEntry.
+ * Its status is Current, and its access level is NoAccess.
+ * OID: .1.3.6.1.2.1.27.1.1.1
+ * Description:
+An index to uniquely identify the network service
+ application.
+ *
+ * Attributes:
+ * accessible 0 isscalar 0 enums 0 hasdefval 0
+ * readable 0 iscolumn 1 ranges 1 hashint 0
+ * settable 0
+ *
+ * Ranges: 1 - 2147483647;
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ *
+ *
+ *
+ * NOTE: NODE applIndex IS NOT ACCESSIBLE
+ *
+ *
+ */
+/**
+ * map a value from its original native format to the MIB format.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : Any other error
+ *
+ * @note parameters follow the memset convention (dest, src).
+ *
+ * @note generation and use of this function can be turned off by re-running
+ * mib2c after adding the following line to the file
+ * default-node-applIndex.m2d :
+ * @eval $m2c_node_skip_mapping = 1@
+ *
+ * @remark
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them here.
+ * Otherwise, just do a direct copy.
+ */
+int
+applIndex_map(long *mib_applIndex_val_ptr, long raw_applIndex_val)
+{
+ netsnmp_assert(NULL != mib_applIndex_val_ptr);
+
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:applIndex_map","called\n"));
+
+ /*
+ * TODO:241:o: |-> Implement applIndex mapping.
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them here.
+ */
+ (*mib_applIndex_val_ptr) = raw_applIndex_val;
+
+ return MFD_SUCCESS;
+} /* applIndex_map */
+
+
+/**
+ * set mib index(es)
+ *
+ * @param tbl_idx mib index structure
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This convenience function is useful for setting all the MIB index
+ * components with a single function call. It is assume that the C values
+ * have already been mapped from their native/rawformat to the MIB format.
+ */
+int
+rdbmsSrvTable_indexes_set_tbl_idx(rdbmsSrvTable_mib_index *tbl_idx, long applIndex_val)
+{
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvTable_indexes_set_tbl_idx","called\n"));
+
+ /* applIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h */
+ tbl_idx->applIndex = applIndex_val;
+
+
+ return MFD_SUCCESS;
+} /* rdbmsSrvTable_indexes_set_tbl_idx */
+
+/**
+ * @internal
+ * set row context indexes
+ *
+ * @param reqreq_ctx the row context that needs updated indexes
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This function sets the mib indexs, then updates the oid indexs
+ * from the mib index.
+ */
+int
+rdbmsSrvTable_indexes_set(rdbmsSrvTable_rowreq_ctx *rowreq_ctx, long applIndex_val)
+{
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvTable_indexes_set","called\n"));
+
+ if(MFD_SUCCESS != rdbmsSrvTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx
+ , applIndex_val
+ ))
+ return MFD_ERROR;
+
+ /*
+ * convert mib index to oid index
+ */
+ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
+ if(0 != rdbmsSrvTable_index_to_oid(&rowreq_ctx->oid_idx,
+ &rowreq_ctx->tbl_idx)) {
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS;
+} /* rdbmsSrvTable_indexes_set */
+
+
+/*---------------------------------------------------------------------
+ * RDBMS-MIB::rdbmsSrvEntry.rdbmsSrvPrivateMibOID
+ * rdbmsSrvPrivateMibOID is subid 1 of rdbmsSrvEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.39.1.5.1.1
+ * Description:
+The authoritative identification for the private MIB for this
+ server, presumably based on the vendor, e.g., { enterprises
+ 111 <optional subidentifiers>} for Oracle servers, {
+ enterprises 757 <optional subidentifiers>} for Ingres
+ servers, { enterprises 897 <optional subidentifiers>} for
+ Sybase servers, etc.
+
+ If no OBJECT IDENTIFIER exists for the private MIB, attempts
+ to access this object will return noSuchName (SNMPv1)
+ or noSuchInstance (SNMPv2).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is OBJECTID (based on perltype OBJECTID)
+ * The net-snmp type is ASN_OBJECT_ID. The C type decl is oid (oid)
+ * This data type requires a length. (Max 2147483647)
+ */
+/**
+ * map a value from its original native format to the MIB format.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : Any other error
+ *
+ * @note parameters follow the memset convention (dest, src).
+ *
+ * @note generation and use of this function can be turned off by re-running
+ * mib2c after adding the following line to the file
+ * default-node-rdbmsSrvPrivateMibOID.m2d :
+ * @eval $m2c_node_skip_mapping = 1@
+ *
+ * @remark
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them here.
+ * Otherwise, just do a direct copy.
+ */
+int
+rdbmsSrvPrivateMibOID_map(oid **mib_rdbmsSrvPrivateMibOID_val_ptr_ptr, size_t *mib_rdbmsSrvPrivateMibOID_val_ptr_len_ptr, oid *raw_rdbmsSrvPrivateMibOID_val_ptr, size_t raw_rdbmsSrvPrivateMibOID_val_ptr_len, int allow_realloc)
+{
+ int converted_len;
+
+ netsnmp_assert(NULL != raw_rdbmsSrvPrivateMibOID_val_ptr);
+ netsnmp_assert((NULL != mib_rdbmsSrvPrivateMibOID_val_ptr_ptr) && (NULL != mib_rdbmsSrvPrivateMibOID_val_ptr_len_ptr));
+
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvPrivateMibOID_map","called\n"));
+
+ /*
+ * TODO:241:r: |-> Implement rdbmsSrvPrivateMibOID non-integer mapping
+ * it is hard to autogenerate code for mapping types that are not simple
+ * integers, so here is an idea of what you might need to do. It will
+ * probably need some tweaking to get right.
+ */
+ /*
+ * if the length of the raw data doesn't directly correspond with
+ * the length of the mib data, set converted_len to the
+ * space required.
+ */
+ converted_len = raw_rdbmsSrvPrivateMibOID_val_ptr_len; /* assume equal */
+ if((NULL == *mib_rdbmsSrvPrivateMibOID_val_ptr_ptr) || (*mib_rdbmsSrvPrivateMibOID_val_ptr_len_ptr < converted_len)) {
+ if(! allow_realloc) {
+ snmp_log(LOG_ERR,"not enough space for value mapping\n");
+ return SNMP_ERR_GENERR;
+ }
+ *mib_rdbmsSrvPrivateMibOID_val_ptr_ptr = realloc( *mib_rdbmsSrvPrivateMibOID_val_ptr_ptr, converted_len * sizeof(**mib_rdbmsSrvPrivateMibOID_val_ptr_ptr));
+ if(NULL == *mib_rdbmsSrvPrivateMibOID_val_ptr_ptr) {
+ snmp_log(LOG_ERR,"could not allocate memory\n");
+ return SNMP_ERR_GENERR;
+ }
+ }
+ *mib_rdbmsSrvPrivateMibOID_val_ptr_len_ptr = converted_len;
+ memcpy( *mib_rdbmsSrvPrivateMibOID_val_ptr_ptr, raw_rdbmsSrvPrivateMibOID_val_ptr, converted_len );
+
+ return MFD_SUCCESS;
+} /* rdbmsSrvPrivateMibOID_map */
+
+/**
+ * Extract the current value of the rdbmsSrvPrivateMibOID data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param rdbmsSrvPrivateMibOID_val_ptr_ptr
+ * Pointer to storage for a oid variable
+ * @param rdbmsSrvPrivateMibOID_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by rdbmsSrvPrivateMibOID.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*rdbmsSrvPrivateMibOID_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update rdbmsSrvPrivateMibOID_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+rdbmsSrvPrivateMibOID_get( rdbmsSrvTable_rowreq_ctx *rowreq_ctx, oid **rdbmsSrvPrivateMibOID_val_ptr_ptr, size_t *rdbmsSrvPrivateMibOID_val_ptr_len_ptr )
+{
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert( (NULL != rdbmsSrvPrivateMibOID_val_ptr_ptr) && (NULL != *rdbmsSrvPrivateMibOID_val_ptr_ptr));
+ netsnmp_assert( NULL != rdbmsSrvPrivateMibOID_val_ptr_len_ptr );
+
+
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvPrivateMibOID_get","called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+/*
+ * TODO:231:o: |-> Extract the current value of the rdbmsSrvPrivateMibOID data.
+ * set (* rdbmsSrvPrivateMibOID_val_ptr_ptr ) and (* rdbmsSrvPrivateMibOID_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * make sure there is enough space for rdbmsSrvPrivateMibOID data
+ */
+ if ((NULL == (* rdbmsSrvPrivateMibOID_val_ptr_ptr )) ||
+ ((* rdbmsSrvPrivateMibOID_val_ptr_len_ptr ) < (rowreq_ctx->data.rdbmsSrvPrivateMibOID_len * sizeof((* rdbmsSrvPrivateMibOID_val_ptr_ptr )[0])))) {
+ /*
+ * allocate space for rdbmsSrvPrivateMibOID data
+ */
+ (* rdbmsSrvPrivateMibOID_val_ptr_ptr ) = malloc(rowreq_ctx->data.rdbmsSrvPrivateMibOID_len * sizeof((* rdbmsSrvPrivateMibOID_val_ptr_ptr )[0]));
+ if(NULL == (* rdbmsSrvPrivateMibOID_val_ptr_ptr )) {
+ snmp_log(LOG_ERR,"could not allocate memory\n");
+ return MFD_ERROR;
+ }
+ }
+ (* rdbmsSrvPrivateMibOID_val_ptr_len_ptr ) = rowreq_ctx->data.rdbmsSrvPrivateMibOID_len * sizeof((* rdbmsSrvPrivateMibOID_val_ptr_ptr )[0]);
+ memcpy( (* rdbmsSrvPrivateMibOID_val_ptr_ptr ), rowreq_ctx->data.rdbmsSrvPrivateMibOID, (* rdbmsSrvPrivateMibOID_val_ptr_len_ptr ) );
+
+ return MFD_SUCCESS;
+} /* rdbmsSrvPrivateMibOID_get */
+
+/*---------------------------------------------------------------------
+ * RDBMS-MIB::rdbmsSrvEntry.rdbmsSrvVendorName
+ * rdbmsSrvVendorName is subid 2 of rdbmsSrvEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.39.1.5.1.2
+ * Description:
+The name of the vendor whose RDBMS manages this database,
+ for informational purposes.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 1
+ * settable 0
+ * hint: 255a
+ *
+ * Ranges: 0 - 255;
+ *
+ * Its syntax is DisplayString (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 255)
+ */
+/**
+ * map a value from its original native format to the MIB format.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : Any other error
+ *
+ * @note parameters follow the memset convention (dest, src).
+ *
+ * @note generation and use of this function can be turned off by re-running
+ * mib2c after adding the following line to the file
+ * default-node-rdbmsSrvVendorName.m2d :
+ * @eval $m2c_node_skip_mapping = 1@
+ *
+ * @remark
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them here.
+ * Otherwise, just do a direct copy.
+ */
+int
+rdbmsSrvVendorName_map(char **mib_rdbmsSrvVendorName_val_ptr_ptr, size_t *mib_rdbmsSrvVendorName_val_ptr_len_ptr, char *raw_rdbmsSrvVendorName_val_ptr, size_t raw_rdbmsSrvVendorName_val_ptr_len, int allow_realloc)
+{
+ int converted_len;
+
+ netsnmp_assert(NULL != raw_rdbmsSrvVendorName_val_ptr);
+ netsnmp_assert((NULL != mib_rdbmsSrvVendorName_val_ptr_ptr) && (NULL != mib_rdbmsSrvVendorName_val_ptr_len_ptr));
+
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvVendorName_map","called\n"));
+
+ /*
+ * TODO:241:r: |-> Implement rdbmsSrvVendorName non-integer mapping
+ * it is hard to autogenerate code for mapping types that are not simple
+ * integers, so here is an idea of what you might need to do. It will
+ * probably need some tweaking to get right.
+ */
+ /*
+ * if the length of the raw data doesn't directly correspond with
+ * the length of the mib data, set converted_len to the
+ * space required.
+ */
+ converted_len = raw_rdbmsSrvVendorName_val_ptr_len; /* assume equal */
+ if((NULL == *mib_rdbmsSrvVendorName_val_ptr_ptr) || (*mib_rdbmsSrvVendorName_val_ptr_len_ptr < converted_len)) {
+ if(! allow_realloc) {
+ snmp_log(LOG_ERR,"not enough space for value mapping\n");
+ return SNMP_ERR_GENERR;
+ }
+ *mib_rdbmsSrvVendorName_val_ptr_ptr = realloc( *mib_rdbmsSrvVendorName_val_ptr_ptr, converted_len * sizeof(**mib_rdbmsSrvVendorName_val_ptr_ptr));
+ if(NULL == *mib_rdbmsSrvVendorName_val_ptr_ptr) {
+ snmp_log(LOG_ERR,"could not allocate memory\n");
+ return SNMP_ERR_GENERR;
+ }
+ }
+ *mib_rdbmsSrvVendorName_val_ptr_len_ptr = converted_len;
+ memcpy( *mib_rdbmsSrvVendorName_val_ptr_ptr, raw_rdbmsSrvVendorName_val_ptr, converted_len );
+
+ return MFD_SUCCESS;
+} /* rdbmsSrvVendorName_map */
+
+/**
+ * Extract the current value of the rdbmsSrvVendorName data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param rdbmsSrvVendorName_val_ptr_ptr
+ * Pointer to storage for a char variable
+ * @param rdbmsSrvVendorName_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by rdbmsSrvVendorName.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*rdbmsSrvVendorName_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update rdbmsSrvVendorName_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+rdbmsSrvVendorName_get( rdbmsSrvTable_rowreq_ctx *rowreq_ctx, char **rdbmsSrvVendorName_val_ptr_ptr, size_t *rdbmsSrvVendorName_val_ptr_len_ptr )
+{
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert( (NULL != rdbmsSrvVendorName_val_ptr_ptr) && (NULL != *rdbmsSrvVendorName_val_ptr_ptr));
+ netsnmp_assert( NULL != rdbmsSrvVendorName_val_ptr_len_ptr );
+
+
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvVendorName_get","called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+/*
+ * TODO:231:o: |-> Extract the current value of the rdbmsSrvVendorName data.
+ * set (* rdbmsSrvVendorName_val_ptr_ptr ) and (* rdbmsSrvVendorName_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * make sure there is enough space for rdbmsSrvVendorName data
+ */
+ if ((NULL == (* rdbmsSrvVendorName_val_ptr_ptr )) ||
+ ((* rdbmsSrvVendorName_val_ptr_len_ptr ) < (rowreq_ctx->data.rdbmsSrvVendorName_len * sizeof((* rdbmsSrvVendorName_val_ptr_ptr )[0])))) {
+ /*
+ * allocate space for rdbmsSrvVendorName data
+ */
+ (* rdbmsSrvVendorName_val_ptr_ptr ) = malloc(rowreq_ctx->data.rdbmsSrvVendorName_len * sizeof((* rdbmsSrvVendorName_val_ptr_ptr )[0]));
+ if(NULL == (* rdbmsSrvVendorName_val_ptr_ptr )) {
+ snmp_log(LOG_ERR,"could not allocate memory\n");
+ return MFD_ERROR;
+ }
+ }
+ (* rdbmsSrvVendorName_val_ptr_len_ptr ) = rowreq_ctx->data.rdbmsSrvVendorName_len * sizeof((* rdbmsSrvVendorName_val_ptr_ptr )[0]);
+ memcpy( (* rdbmsSrvVendorName_val_ptr_ptr ), rowreq_ctx->data.rdbmsSrvVendorName, (* rdbmsSrvVendorName_val_ptr_len_ptr ) );
+
+ return MFD_SUCCESS;
+} /* rdbmsSrvVendorName_get */
+
+/*---------------------------------------------------------------------
+ * RDBMS-MIB::rdbmsSrvEntry.rdbmsSrvProductName
+ * rdbmsSrvProductName is subid 3 of rdbmsSrvEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.39.1.5.1.3
+ * Description:
+The product name of this server. This is normally the
+ vendor's formal name for the product, in product specific
+ format.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 1
+ * settable 0
+ * hint: 255a
+ *
+ * Ranges: 0 - 255;
+ *
+ * Its syntax is DisplayString (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 255)
+ */
+/**
+ * map a value from its original native format to the MIB format.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : Any other error
+ *
+ * @note parameters follow the memset convention (dest, src).
+ *
+ * @note generation and use of this function can be turned off by re-running
+ * mib2c after adding the following line to the file
+ * default-node-rdbmsSrvProductName.m2d :
+ * @eval $m2c_node_skip_mapping = 1@
+ *
+ * @remark
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them here.
+ * Otherwise, just do a direct copy.
+ */
+int
+rdbmsSrvProductName_map(char **mib_rdbmsSrvProductName_val_ptr_ptr, size_t *mib_rdbmsSrvProductName_val_ptr_len_ptr, char *raw_rdbmsSrvProductName_val_ptr, size_t raw_rdbmsSrvProductName_val_ptr_len, int allow_realloc)
+{
+ int converted_len;
+
+ netsnmp_assert(NULL != raw_rdbmsSrvProductName_val_ptr);
+ netsnmp_assert((NULL != mib_rdbmsSrvProductName_val_ptr_ptr) && (NULL != mib_rdbmsSrvProductName_val_ptr_len_ptr));
+
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvProductName_map","called\n"));
+
+ /*
+ * TODO:241:r: |-> Implement rdbmsSrvProductName non-integer mapping
+ * it is hard to autogenerate code for mapping types that are not simple
+ * integers, so here is an idea of what you might need to do. It will
+ * probably need some tweaking to get right.
+ */
+ /*
+ * if the length of the raw data doesn't directly correspond with
+ * the length of the mib data, set converted_len to the
+ * space required.
+ */
+ converted_len = raw_rdbmsSrvProductName_val_ptr_len; /* assume equal */
+ if((NULL == *mib_rdbmsSrvProductName_val_ptr_ptr) || (*mib_rdbmsSrvProductName_val_ptr_len_ptr < converted_len)) {
+ if(! allow_realloc) {
+ snmp_log(LOG_ERR,"not enough space for value mapping\n");
+ return SNMP_ERR_GENERR;
+ }
+ *mib_rdbmsSrvProductName_val_ptr_ptr = realloc( *mib_rdbmsSrvProductName_val_ptr_ptr, converted_len * sizeof(**mib_rdbmsSrvProductName_val_ptr_ptr));
+ if(NULL == *mib_rdbmsSrvProductName_val_ptr_ptr) {
+ snmp_log(LOG_ERR,"could not allocate memory\n");
+ return SNMP_ERR_GENERR;
+ }
+ }
+ *mib_rdbmsSrvProductName_val_ptr_len_ptr = converted_len;
+ memcpy( *mib_rdbmsSrvProductName_val_ptr_ptr, raw_rdbmsSrvProductName_val_ptr, converted_len );
+
+ return MFD_SUCCESS;
+} /* rdbmsSrvProductName_map */
+
+/**
+ * Extract the current value of the rdbmsSrvProductName data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param rdbmsSrvProductName_val_ptr_ptr
+ * Pointer to storage for a char variable
+ * @param rdbmsSrvProductName_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by rdbmsSrvProductName.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*rdbmsSrvProductName_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update rdbmsSrvProductName_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+rdbmsSrvProductName_get( rdbmsSrvTable_rowreq_ctx *rowreq_ctx, char **rdbmsSrvProductName_val_ptr_ptr, size_t *rdbmsSrvProductName_val_ptr_len_ptr )
+{
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert( (NULL != rdbmsSrvProductName_val_ptr_ptr) && (NULL != *rdbmsSrvProductName_val_ptr_ptr));
+ netsnmp_assert( NULL != rdbmsSrvProductName_val_ptr_len_ptr );
+
+
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvProductName_get","called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+/*
+ * TODO:231:o: |-> Extract the current value of the rdbmsSrvProductName data.
+ * set (* rdbmsSrvProductName_val_ptr_ptr ) and (* rdbmsSrvProductName_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * make sure there is enough space for rdbmsSrvProductName data
+ */
+ if ((NULL == (* rdbmsSrvProductName_val_ptr_ptr )) ||
+ ((* rdbmsSrvProductName_val_ptr_len_ptr ) < (rowreq_ctx->data.rdbmsSrvProductName_len * sizeof((* rdbmsSrvProductName_val_ptr_ptr )[0])))) {
+ /*
+ * allocate space for rdbmsSrvProductName data
+ */
+ (* rdbmsSrvProductName_val_ptr_ptr ) = malloc(rowreq_ctx->data.rdbmsSrvProductName_len * sizeof((* rdbmsSrvProductName_val_ptr_ptr )[0]));
+ if(NULL == (* rdbmsSrvProductName_val_ptr_ptr )) {
+ snmp_log(LOG_ERR,"could not allocate memory\n");
+ return MFD_ERROR;
+ }
+ }
+ (* rdbmsSrvProductName_val_ptr_len_ptr ) = rowreq_ctx->data.rdbmsSrvProductName_len * sizeof((* rdbmsSrvProductName_val_ptr_ptr )[0]);
+ memcpy( (* rdbmsSrvProductName_val_ptr_ptr ), rowreq_ctx->data.rdbmsSrvProductName, (* rdbmsSrvProductName_val_ptr_len_ptr ) );
+
+ return MFD_SUCCESS;
+} /* rdbmsSrvProductName_get */
+
+/*---------------------------------------------------------------------
+ * RDBMS-MIB::rdbmsSrvEntry.rdbmsSrvContact
+ * rdbmsSrvContact is subid 4 of rdbmsSrvEntry.
+ * Its status is Current, and its access level is ReadWrite.
+ * OID: .1.3.6.1.2.1.39.1.5.1.4
+ * Description:
+The textual identification of the contact person for this
+ managed server, together with information on how to contact
+ this person.
+
+ Note: if there is no active server associated with this
+ object, an agent may need to keep this in other persistent
+ storage, e.g., a configuration file.
+
+ Note that a compliant agent does not need to
+ allow write access to this object.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 1
+ * settable 1
+ * hint: 255a
+ *
+ * Ranges: 0 - 255;
+ *
+ * Its syntax is DisplayString (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 255)
+ */
+/**
+ * map a value from its original native format to the MIB format.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : Any other error
+ *
+ * @note parameters follow the memset convention (dest, src).
+ *
+ * @note generation and use of this function can be turned off by re-running
+ * mib2c after adding the following line to the file
+ * default-node-rdbmsSrvContact.m2d :
+ * @eval $m2c_node_skip_mapping = 1@
+ *
+ * @remark
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them here.
+ * Otherwise, just do a direct copy.
+ */
+int
+rdbmsSrvContact_map(char **mib_rdbmsSrvContact_val_ptr_ptr, size_t *mib_rdbmsSrvContact_val_ptr_len_ptr, char *raw_rdbmsSrvContact_val_ptr, size_t raw_rdbmsSrvContact_val_ptr_len, int allow_realloc)
+{
+ int converted_len;
+
+ netsnmp_assert(NULL != raw_rdbmsSrvContact_val_ptr);
+ netsnmp_assert((NULL != mib_rdbmsSrvContact_val_ptr_ptr) && (NULL != mib_rdbmsSrvContact_val_ptr_len_ptr));
+
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvContact_map","called\n"));
+
+ /*
+ * TODO:241:r: |-> Implement rdbmsSrvContact non-integer mapping
+ * it is hard to autogenerate code for mapping types that are not simple
+ * integers, so here is an idea of what you might need to do. It will
+ * probably need some tweaking to get right.
+ */
+ /*
+ * if the length of the raw data doesn't directly correspond with
+ * the length of the mib data, set converted_len to the
+ * space required.
+ */
+ converted_len = raw_rdbmsSrvContact_val_ptr_len; /* assume equal */
+ if((NULL == *mib_rdbmsSrvContact_val_ptr_ptr) || (*mib_rdbmsSrvContact_val_ptr_len_ptr < converted_len)) {
+ if(! allow_realloc) {
+ snmp_log(LOG_ERR,"not enough space for value mapping\n");
+ return SNMP_ERR_GENERR;
+ }
+ *mib_rdbmsSrvContact_val_ptr_ptr = realloc( *mib_rdbmsSrvContact_val_ptr_ptr, converted_len * sizeof(**mib_rdbmsSrvContact_val_ptr_ptr));
+ if(NULL == *mib_rdbmsSrvContact_val_ptr_ptr) {
+ snmp_log(LOG_ERR,"could not allocate memory\n");
+ return SNMP_ERR_GENERR;
+ }
+ }
+ *mib_rdbmsSrvContact_val_ptr_len_ptr = converted_len;
+ memcpy( *mib_rdbmsSrvContact_val_ptr_ptr, raw_rdbmsSrvContact_val_ptr, converted_len );
+
+ return MFD_SUCCESS;
+} /* rdbmsSrvContact_map */
+
+/**
+ * Extract the current value of the rdbmsSrvContact data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param rdbmsSrvContact_val_ptr_ptr
+ * Pointer to storage for a char variable
+ * @param rdbmsSrvContact_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by rdbmsSrvContact.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*rdbmsSrvContact_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update rdbmsSrvContact_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+rdbmsSrvContact_get( rdbmsSrvTable_rowreq_ctx *rowreq_ctx, char **rdbmsSrvContact_val_ptr_ptr, size_t *rdbmsSrvContact_val_ptr_len_ptr )
+{
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert( (NULL != rdbmsSrvContact_val_ptr_ptr) && (NULL != *rdbmsSrvContact_val_ptr_ptr));
+ netsnmp_assert( NULL != rdbmsSrvContact_val_ptr_len_ptr );
+
+
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvContact_get","called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+/*
+ * TODO:231:o: |-> Extract the current value of the rdbmsSrvContact data.
+ * set (* rdbmsSrvContact_val_ptr_ptr ) and (* rdbmsSrvContact_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * make sure there is enough space for rdbmsSrvContact data
+ */
+ if ((NULL == (* rdbmsSrvContact_val_ptr_ptr )) ||
+ ((* rdbmsSrvContact_val_ptr_len_ptr ) < (rowreq_ctx->data.rdbmsSrvContact_len * sizeof((* rdbmsSrvContact_val_ptr_ptr )[0])))) {
+ /*
+ * allocate space for rdbmsSrvContact data
+ */
+ (* rdbmsSrvContact_val_ptr_ptr ) = malloc(rowreq_ctx->data.rdbmsSrvContact_len * sizeof((* rdbmsSrvContact_val_ptr_ptr )[0]));
+ if(NULL == (* rdbmsSrvContact_val_ptr_ptr )) {
+ snmp_log(LOG_ERR,"could not allocate memory\n");
+ return MFD_ERROR;
+ }
+ }
+ (* rdbmsSrvContact_val_ptr_len_ptr ) = rowreq_ctx->data.rdbmsSrvContact_len * sizeof((* rdbmsSrvContact_val_ptr_ptr )[0]);
+ memcpy( (* rdbmsSrvContact_val_ptr_ptr ), rowreq_ctx->data.rdbmsSrvContact, (* rdbmsSrvContact_val_ptr_len_ptr ) );
+
+ return MFD_SUCCESS;
+} /* rdbmsSrvContact_get */
+
+
+
+/** @} */
diff --git a/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_get.h b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_get.h
new file mode 100644
index 0000000..f2d17f9
--- /dev/null
+++ b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_get.h
@@ -0,0 +1,66 @@
+/*-------------------------------------------------------------------------
+ * rdbmsSrvTable_data_get.h
+ *
+ * RDBMSMIB mib module.
+ *
+ * Copyright (c) 2004-2007, PostgreSQL Global Development Group
+ * Author: Joshua Tolley
+ *
+ * $Id: rdbmsSrvTable_data_get.h,v 1.4 2007/09/13 14:20:44 h-saito Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef RDBMSSRVTABLE_DATA_GET_H
+#define RDBMSSRVTABLE_DATA_GET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* *********************************************************************
+ * GET function declarations
+ */
+
+/* *********************************************************************
+ * GET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table rdbmsSrvTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * rdbmsSrvTable is subid 5 of rdbmsObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.39.1.5, length: 9
+*/
+ /*
+ * indexes
+ */
+ int applIndex_map(long *mib_applIndex_val_ptr, long raw_applIndex_val);
+
+ int rdbmsSrvPrivateMibOID_map(oid **mib_rdbmsSrvPrivateMibOID_val_ptr_ptr, size_t *mib_rdbmsSrvPrivateMibOID_val_ptr_len_ptr, oid *raw_rdbmsSrvPrivateMibOID_val_ptr, size_t raw_rdbmsSrvPrivateMibOID_val_ptr_len, int allow_realloc);
+ int rdbmsSrvPrivateMibOID_get( rdbmsSrvTable_rowreq_ctx *rowreq_ctx, oid **rdbmsSrvPrivateMibOID_val_ptr_ptr, size_t *rdbmsSrvPrivateMibOID_val_ptr_len_ptr );
+ int rdbmsSrvVendorName_map(char **mib_rdbmsSrvVendorName_val_ptr_ptr, size_t *mib_rdbmsSrvVendorName_val_ptr_len_ptr, char *raw_rdbmsSrvVendorName_val_ptr, size_t raw_rdbmsSrvVendorName_val_ptr_len, int allow_realloc);
+ int rdbmsSrvVendorName_get( rdbmsSrvTable_rowreq_ctx *rowreq_ctx, char **rdbmsSrvVendorName_val_ptr_ptr, size_t *rdbmsSrvVendorName_val_ptr_len_ptr );
+ int rdbmsSrvProductName_map(char **mib_rdbmsSrvProductName_val_ptr_ptr, size_t *mib_rdbmsSrvProductName_val_ptr_len_ptr, char *raw_rdbmsSrvProductName_val_ptr, size_t raw_rdbmsSrvProductName_val_ptr_len, int allow_realloc);
+ int rdbmsSrvProductName_get( rdbmsSrvTable_rowreq_ctx *rowreq_ctx, char **rdbmsSrvProductName_val_ptr_ptr, size_t *rdbmsSrvProductName_val_ptr_len_ptr );
+ int rdbmsSrvContact_map(char **mib_rdbmsSrvContact_val_ptr_ptr, size_t *mib_rdbmsSrvContact_val_ptr_len_ptr, char *raw_rdbmsSrvContact_val_ptr, size_t raw_rdbmsSrvContact_val_ptr_len, int allow_realloc);
+ int rdbmsSrvContact_get( rdbmsSrvTable_rowreq_ctx *rowreq_ctx, char **rdbmsSrvContact_val_ptr_ptr, size_t *rdbmsSrvContact_val_ptr_len_ptr );
+
+
+int rdbmsSrvTable_indexes_set_tbl_idx(rdbmsSrvTable_mib_index *tbl_idx, long applIndex_val);
+int rdbmsSrvTable_indexes_set(rdbmsSrvTable_rowreq_ctx *rowreq_ctx, long applIndex_val);
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RDBMSSRVTABLE_DATA_GET_H */
+/** @} */
diff --git a/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_set.c b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_set.c
new file mode 100644
index 0000000..3fb2e10
--- /dev/null
+++ b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_set.c
@@ -0,0 +1,30 @@
+/*-------------------------------------------------------------------------
+ * rdbmsSrvTable_data_set.c
+ *
+ * RDBMSMIB mib module.
+ *
+ * Copyright (c) 2004-2007, PostgreSQL Global Development Group
+ * Author: Joshua Tolley
+ *
+ * $Id: rdbmsSrvTable_data_set.c,v 1.4 2007/09/13 14:20:44 h-saito Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/* standard Net-SNMP includes */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/* include our parent header */
+#include "rdbmsSrvTable.h"
+
+
+/** @defgroup data_set data_set: Routines to set data
+ *
+ * These routines are used to set the value for individual objects. The
+ * row context is passed, along with the new value.
+ *
+ * @{
+ */
+/** @} */
diff --git a/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_set.h b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_set.h
new file mode 100644
index 0000000..e2b982f
--- /dev/null
+++ b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_data_set.h
@@ -0,0 +1,34 @@
+/*-------------------------------------------------------------------------
+ * rdbmsSrvTable_data_set.h
+ *
+ * RDBMSMIB mib module.
+ *
+ * Copyright (c) 2004-2007, PostgreSQL Global Development Group
+ * Author: Joshua Tolley
+ *
+ * $Id: rdbmsSrvTable_data_set.h,v 1.4 2007/09/13 14:20:44 h-saito Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef RDBMSSRVTABLE_DATA_SET_H
+#define RDBMSSRVTABLE_DATA_SET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* *********************************************************************
+ * SET function declarations
+ */
+
+/* *********************************************************************
+ * SET Table declarations
+ */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RDBMSSRVTABLE_DATA_SET_H */
diff --git a/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_enums.h b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_enums.h
new file mode 100644
index 0000000..c2686ce
--- /dev/null
+++ b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_enums.h
@@ -0,0 +1,47 @@
+/*-------------------------------------------------------------------------
+ * rdbmsSrvTable_enums.h
+ *
+ * RDBMSMIB mib module.
+ *
+ * Copyright (c) 2004-2007, PostgreSQL Global Development Group
+ * Author: Joshua Tolley
+ *
+ * $Id: rdbmsSrvTable_enums.h,v 1.4 2007/09/13 14:20:44 h-saito Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef RDBMSSRVTABLE_ENUMS_H
+#define RDBMSSRVTABLE_ENUMS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * NOTES on enums
+ * ==============
+ *
+ * Value Mapping
+ * -------------
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them
+ * below. For example, a boolean flag (1/0) is usually represented
+ * as a TruthValue in a MIB, which maps to the values (1/2).
+ *
+ */
+/*************************************************************************
+ *************************************************************************
+ *
+ * enum definitions for table rdbmsSrvTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RDBMSSRVTABLE_ENUMS_H */
diff --git a/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_interface.c b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_interface.c
new file mode 100644
index 0000000..50567f7
--- /dev/null
+++ b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_interface.c
@@ -0,0 +1,701 @@
+/*-------------------------------------------------------------------------
+ * rdbmsSrvTable_interface.c
+ *
+ * RDBMSMIB mib module.
+ *
+ * Copyright (c) 2004-2007, PostgreSQL Global Development Group
+ * Author: Joshua Tolley
+ *
+ * $Id: rdbmsSrvTable_interface.c,v 1.5 2007/09/13 14:20:44 h-saito Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "pgsnmpd.h"
+
+/* include our parent header */
+#include "rdbmsSrvTable.h"
+#include "rdbmsSrvTable_interface.h"
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table rdbmsSrvTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * rdbmsSrvTable is subid 5 of rdbmsObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.39.1.5, length: 9
+*/
+typedef struct rdbmsSrvTable_interface_ctx_s {
+
+ netsnmp_container *container;
+ netsnmp_cache *cache; /* optional cache */
+
+ rdbmsSrvTable_registration_ptr user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+} rdbmsSrvTable_interface_ctx;
+
+static rdbmsSrvTable_interface_ctx rdbmsSrvTable_if_ctx;
+
+static void _rdbmsSrvTable_container_init(
+ rdbmsSrvTable_interface_ctx *if_ctx);
+
+
+static Netsnmp_Node_Handler _mfd_rdbmsSrvTable_pre_request;
+static Netsnmp_Node_Handler _mfd_rdbmsSrvTable_post_request;
+static Netsnmp_Node_Handler _mfd_rdbmsSrvTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_rdbmsSrvTable_get_values;
+/**
+ * @internal
+ * Initialize the table rdbmsSrvTable
+ * (Define its contents and how it's structured)
+ */
+void
+_rdbmsSrvTable_initialize_interface(rdbmsSrvTable_registration_ptr reg_ptr, u_long flags)
+{
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &rdbmsSrvTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info = &rdbmsSrvTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:rdbmsSrvTable:_rdbmsSrvTable_initialize_interface","called\n"));
+
+
+ /*************************************************
+ *
+ * save interface context for rdbmsSrvTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info,
+ ASN_INTEGER, /** index: applIndex */
+ 0);
+
+ /* Define the minimum and maximum accessible columns. This
+ optimizes retrival. */
+ tbl_info->min_column = RDBMSSRVTABLE_MIN_COL;
+ tbl_info->max_column = RDBMSSRVTABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ rdbmsSrvTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ rdbmsSrvTable_init_data(reg_ptr);
+
+ /*
+ * set up the container
+ */
+ _rdbmsSrvTable_container_init(&rdbmsSrvTable_if_ctx);
+ if (NULL == rdbmsSrvTable_if_ctx.container) {
+ snmp_log(LOG_ERR,"could not initialize container for rdbmsSrvTable\n");
+ return;
+ }
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup = _mfd_rdbmsSrvTable_object_lookup;
+ access_multiplexer->get_values = _mfd_rdbmsSrvTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request = _mfd_rdbmsSrvTable_pre_request;
+ access_multiplexer->post_request = _mfd_rdbmsSrvTable_post_request;
+
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("rdbmsSrvTable:init_rdbmsSrvTable",
+ "Registering rdbmsSrvTable as a mibs-for-dummies table.\n"));
+ handler = netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo = netsnmp_handler_registration_create("rdbmsSrvTable", handler,
+ rdbmsSrvTable_oid,
+ rdbmsSrvTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RONLY
+ );
+ if(NULL == reginfo) {
+ snmp_log(LOG_ERR,"error registering table rdbmsSrvTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &rdbmsSrvTable_if_ctx;
+
+ /*************************************************
+ *
+ * set up baby steps handler, create it and inject it
+ */
+ if( access_multiplexer->object_lookup )
+ mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
+ if( access_multiplexer->set_values )
+ mfd_modes |= BABY_STEP_SET_VALUES;
+ if( access_multiplexer->irreversible_commit )
+ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
+ if( access_multiplexer->object_syntax_checks )
+ mfd_modes |= BABY_STEP_CHECK_OBJECT;
+
+ if( access_multiplexer->pre_request )
+ mfd_modes |= BABY_STEP_PRE_REQUEST;
+ if( access_multiplexer->post_request )
+ mfd_modes |= BABY_STEP_POST_REQUEST;
+
+ if( access_multiplexer->undo_setup )
+ mfd_modes |= BABY_STEP_UNDO_SETUP;
+ if( access_multiplexer->undo_cleanup )
+ mfd_modes |= BABY_STEP_UNDO_CLEANUP;
+ if( access_multiplexer->undo_sets )
+ mfd_modes |= BABY_STEP_UNDO_SETS;
+
+ if( access_multiplexer->row_creation )
+ mfd_modes |= BABY_STEP_ROW_CREATE;
+ if( access_multiplexer->consistency_checks )
+ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
+ if( access_multiplexer->commit )
+ mfd_modes |= BABY_STEP_COMMIT;
+ if( access_multiplexer->undo_commit )
+ mfd_modes |= BABY_STEP_UNDO_COMMIT;
+
+ handler = netsnmp_baby_steps_handler_get(mfd_modes);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
+ */
+ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler =
+ netsnmp_container_table_handler_get(tbl_info,
+ rdbmsSrvTable_if_ctx.container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler( reginfo, handler );
+
+ /*************************************************
+ *
+ * inject cache helper
+ */
+ if(NULL != rdbmsSrvTable_if_ctx.cache) {
+ handler = netsnmp_cache_handler_get(rdbmsSrvTable_if_ctx.cache);
+ netsnmp_inject_handler( reginfo, handler );
+ }
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+} /* _rdbmsSrvTable_initialize_interface */
+
+void
+rdbmsSrvTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ rdbmsSrvTable_if_ctx.tbl_info.valid_columns = vc;
+} /* rdbmsSrvTable_valid_columns_set */
+
+/**
+ * @internal
+ * convert the index component stored in the context to an oid
+ */
+int
+rdbmsSrvTable_index_to_oid(netsnmp_index *oid_idx,
+ rdbmsSrvTable_mib_index *mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * applIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_applIndex;
+
+ /*
+ * set up varbinds
+ */
+ memset( &var_applIndex, 0x00, sizeof(var_applIndex) );
+ var_applIndex.type = ASN_INTEGER;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_applIndex.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvTable_index_to_oid","called\n"));
+
+ /* applIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h */
+ snmp_set_var_value(&var_applIndex, (u_char*)&mib_idx->applIndex,
+ sizeof(mib_idx->applIndex));
+
+
+ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, (size_t *)&oid_idx->len,
+ NULL, 0, &var_applIndex);
+ if(err)
+ snmp_log(LOG_ERR,"error %d converting index to oid\n", err);
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers( &var_applIndex );
+
+ return err;
+} /* rdbmsSrvTable_index_to_oid */
+
+/**
+ * extract rdbmsSrvTable indexes from a netsnmp_index
+ *
+ * @retval SNMP_ERR_NOERROR : no error
+ * @retval SNMP_ERR_GENERR : error
+ */
+int
+rdbmsSrvTable_index_from_oid(netsnmp_index *oid_idx,
+ rdbmsSrvTable_mib_index *mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * applIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_applIndex;
+
+ /*
+ * set up varbinds
+ */
+ memset( &var_applIndex, 0x00, sizeof(var_applIndex) );
+ var_applIndex.type = ASN_INTEGER;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_applIndex.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:rdbmsSrvTable:rdbmsSrvTable_index_from_oid","called\n"));
+
+ /*
+ * parse the oid into the individual index components
+ */
+ err = parse_oid_indexes( oid_idx->oids, oid_idx->len,
+ &var_applIndex );
+ if (err == SNMP_ERR_NOERROR) {
+ /*
+ * copy out values
+ */
+ mib_idx->applIndex = *((long *)var_applIndex.val.string);
+
+
+ }
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers( &var_applIndex );
+
+ return err;
+} /* rdbmsSrvTable_index_from_oid */
+
+
+/* *********************************************************************
+ * @internal
+ * allocate resources for a rdbmsSrvTable_rowreq_ctx
+ */
+rdbmsSrvTable_rowreq_ctx *
+rdbmsSrvTable_allocate_rowreq_ctx(void)
+{
+ rdbmsSrvTable_rowreq_ctx *rowreq_ctx =
+ SNMP_MALLOC_TYPEDEF(rdbmsSrvTable_rowreq_ctx);
+
+ DEBUGMSGTL(("internal:rdbmsSrvTable:rdbmsSrvTable_allocate_rowreq_ctx","called\n"));
+
+ if(NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR,"Couldn't allocate memory for a "
+ "rdbmsSrvTable_rowreq_ctx.\n");
+ }
+
+ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
+
+ rowreq_ctx->rdbmsSrvTable_data_list = NULL;
+ rowreq_ctx->rdbmsSrvTable_reg = rdbmsSrvTable_if_ctx.user_ctx;
+
+
+ return rowreq_ctx;
+} /* rdbmsSrvTable_allocate_rowreq_ctx */
+
+/*
+ * @internal
+ * release resources for a rdbmsSrvTable_rowreq_ctx
+ */
+void
+rdbmsSrvTable_release_rowreq_ctx(rdbmsSrvTable_rowreq_ctx *rowreq_ctx)
+{
+ DEBUGMSGTL(("internal:rdbmsSrvTable:rdbmsSrvTable_release_rowreq_ctx","called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+
+ /*
+ * free index oid pointer
+ */
+ if(rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp)
+ free(rowreq_ctx->oid_idx.oids);
+
+ SNMP_FREE(rowreq_ctx);
+} /* rdbmsSrvTable_release_rowreq_ctx */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_rdbmsSrvTable_pre_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc = rdbmsSrvTable_pre_request(rdbmsSrvTable_if_ctx.user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("internal:rdbmsSrvTable","error %d from "
+ "rdbmsSrvTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_rdbmsSrvTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_rdbmsSrvTable_post_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ rdbmsSrvTable_rowreq_ctx *rowreq_ctx;
+ int rc = rdbmsSrvTable_post_request(rdbmsSrvTable_if_ctx.user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("internal:rdbmsSrvTable","error %d from "
+ "rdbmsSrvTable_post_request\n", rc));
+ }
+
+ /*
+ * if there are no errors, check for and handle row creation/deletion
+ */
+ rc = netsnmp_check_requests_error(requests);
+ if ((SNMP_ERR_NOERROR == rc) &&
+ (NULL !=
+ (rowreq_ctx = netsnmp_container_table_row_extract(requests)))) {
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_CREATED;
+ CONTAINER_INSERT(rdbmsSrvTable_if_ctx.container, rowreq_ctx);
+ }
+ else if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) {
+ CONTAINER_REMOVE(rdbmsSrvTable_if_ctx.container, rowreq_ctx);
+ rdbmsSrvTable_release_rowreq_ctx(rowreq_ctx);
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_rdbmsSrvTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_rdbmsSrvTable_object_lookup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ rdbmsSrvTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:rdbmsSrvTable:_mfd_rdbmsSrvTable_object_lookup","called\n"));
+
+ /*
+ * get our context from mfd
+ * rdbmsSrvTable_interface_ctx *if_ctx =
+ * (rdbmsSrvTable_interface_ctx *)reginfo->my_reg_void;
+ */
+
+ if(NULL == rowreq_ctx) {
+ netsnmp_request_set_error_all(requests, SNMP_ERR_NOCREATION);
+ }
+ else {
+ rdbmsSrvTable_row_prep(rowreq_ctx);
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_rdbmsSrvTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_rdbmsSrvTable_get_column( rdbmsSrvTable_rowreq_ctx *rowreq_ctx,
+ netsnmp_variable_list *var, int column )
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:rdbmsSrvTable:_mfd_rdbmsSrvTable_get_column","called\n"));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch(column) {
+
+ /* rdbmsSrvPrivateMibOID(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/w/e/r/d/h */
+ case COLUMN_RDBMSSRVPRIVATEMIBOID:
+ var->type = ASN_OBJECT_ID;
+rc = rdbmsSrvPrivateMibOID_get(rowreq_ctx, (oid **)&var->val.string, &var->val_len );
+ break;
+
+ /* rdbmsSrvVendorName(2)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H */
+ case COLUMN_RDBMSSRVVENDORNAME:
+ var->type = ASN_OCTET_STR;
+rc = rdbmsSrvVendorName_get(rowreq_ctx, (char **)&var->val.string, &var->val_len );
+ break;
+
+ /* rdbmsSrvProductName(3)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H */
+ case COLUMN_RDBMSSRVPRODUCTNAME:
+ var->type = ASN_OCTET_STR;
+rc = rdbmsSrvProductName_get(rowreq_ctx, (char **)&var->val.string, &var->val_len );
+ break;
+
+ /* rdbmsSrvContact(4)/DisplayString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H */
+ case COLUMN_RDBMSSRVCONTACT:
+ var->type = ASN_OCTET_STR;
+rc = rdbmsSrvContact_get(rowreq_ctx, (char **)&var->val.string, &var->val_len );
+ break;
+
+ default:
+ snmp_log(LOG_ERR,"unknown column %d in _rdbmsSrvTable_get_column\n", column);
+ break;
+ }
+
+ return rc;
+} /* _rdbmsSrvTable_get_column */
+
+int
+_mfd_rdbmsSrvTable_get_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ rdbmsSrvTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info * tri;
+ u_char * old_string;
+ void (*dataFreeHook)(void *);
+ int rc;
+
+ DEBUGMSGTL(("internal:rdbmsSrvTable:_mfd_rdbmsSrvTable_get_values","called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for(;requests; requests = requests->next) {
+ /*
+ * save old pointer, so we can free it if replaced
+ */
+ old_string = requests->requestvb->val.string;
+ dataFreeHook = requests->requestvb->dataFreeHook;
+ if(NULL == requests->requestvb->val.string) {
+ requests->requestvb->val.string = requests->requestvb->buf;
+ requests->requestvb->val_len = sizeof(requests->requestvb->buf);
+ }
+ else if(requests->requestvb->buf == requests->requestvb->val.string) {
+ if(requests->requestvb->val_len != sizeof(requests->requestvb->buf))
+ requests->requestvb->val_len = sizeof(requests->requestvb->buf);
+ }
+
+ /*
+ * get column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if(NULL == tri)
+ continue;
+
+ rc = _rdbmsSrvTable_get_column(rowreq_ctx, requests->requestvb, tri->colnum);
+ if(rc) {
+ if(MFD_SKIP == rc) {
+ requests->requestvb->type = ASN_PRIV_RETRY;
+ rc = SNMP_ERR_NOERROR;
+ }
+ }
+ else if (NULL == requests->requestvb->val.string) {
+ snmp_log(LOG_ERR,"NULL varbind data pointer!\n");
+ rc = SNMP_ERR_GENERR;
+ }
+ if(rc)
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+
+ /*
+ * if the buffer wasn't used previously for the old data (i.e. it
+ * was allcoated memory) and the get routine replaced the pointer,
+ * we need to free the previous pointer.
+ */
+ if(old_string && (old_string != requests->requestvb->buf) &&
+ (requests->requestvb->val.string != old_string)) {
+ if(dataFreeHook)
+ (*dataFreeHook)(old_string);
+ else
+ free(old_string);
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_rdbmsSrvTable_get_values */
+
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*
+ * NOT APPLICABLE (per MIB or user setting)
+ */
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+/**
+ * @internal
+ */
+static int
+_cache_load(netsnmp_cache *cache, void *vmagic)
+{
+ DEBUGMSGTL(("internal:rdbmsSrvTable:_cache_load","called\n"));
+
+ if((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR, "invalid cache for rdbmsSrvTable_cache_load\n");
+ return -1;
+ }
+
+ /** should only be called for an invalid or expired cache */
+ netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
+
+ /*
+ * call user code
+ */
+ return rdbmsSrvTable_cache_load((netsnmp_container*)cache->magic);
+} /* _cache_load */
+
+/**
+ * @internal
+ */
+static void
+_cache_item_free(rdbmsSrvTable_rowreq_ctx *rowreq_ctx, void *context)
+{
+ DEBUGMSGTL(("internal:rdbmsSrvTable:_cache_item_free","called\n"));
+
+ if(NULL == rowreq_ctx)
+ return;
+
+ rdbmsSrvTable_release_rowreq_ctx(rowreq_ctx);
+} /* _cache_item_free */
+
+/**
+ * @internal
+ */
+static void
+_cache_free(netsnmp_cache *cache, void *magic)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("internal:rdbmsSrvTable:_cache_free","called\n"));
+
+ if((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR, "invalid cache in rdbmsSrvTable_cache_free\n");
+ return;
+ }
+
+ container = (netsnmp_container*)cache->magic;
+
+ /*
+ * call user code
+ */
+ rdbmsSrvTable_cache_free(container);
+
+ /*
+ * free all items. inefficient, but easy.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func *)_cache_item_free,
+ NULL);
+} /* _cache_free */
+
+/**
+ * @internal
+ * initialize the iterator container with functions or wrappers
+ */
+void
+_rdbmsSrvTable_container_init(rdbmsSrvTable_interface_ctx *if_ctx)
+{
+ DEBUGMSGTL(("internal:rdbmsSrvTable:_rdbmsSrvTable_container_init","called\n"));
+
+ /*
+ * set up the cache
+ */
+ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */
+ _cache_load, _cache_free,
+ rdbmsSrvTable_oid,
+ rdbmsSrvTable_oid_size);
+
+ if(NULL == if_ctx->cache) {
+ snmp_log(LOG_ERR, "error creating cache for rdbmsSrvTable\n");
+ return;
+ }
+
+ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
+
+ rdbmsSrvTable_container_init(&if_ctx->container, if_ctx->cache);
+ if(NULL == if_ctx->container)
+ if_ctx->container = netsnmp_container_find("rdbmsSrvTable:table_container");
+ if(NULL == if_ctx->container) {
+ snmp_log(LOG_ERR,"error creating container in "
+ "rdbmsSrvTable_container_init\n");
+ return;
+ }
+ if_ctx->cache->magic = (void*)if_ctx->container;
+} /* _rdbmsSrvTable_container_init */
+
diff --git a/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_interface.h b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_interface.h
new file mode 100644
index 0000000..640efb4
--- /dev/null
+++ b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_interface.h
@@ -0,0 +1,50 @@
+/*-------------------------------------------------------------------------
+ * rdbmsSrvTable_interface.h
+ *
+ * RDBMSMIB mib module.
+ *
+ * Copyright (c) 2004-2007, PostgreSQL Global Development Group
+ * Author: Joshua Tolley
+ *
+ * $Id: rdbmsSrvTable_interface.h,v 1.4 2007/09/13 14:20:44 h-saito Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef RDBMSSRVTABLE_INTERFACE_H
+#define RDBMSSRVTABLE_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "rdbmsSrvTable.h"
+
+/* ********************************************************************
+ * Table declarations
+ */
+
+/* PUBLIC interface initialization routine */
+void _rdbmsSrvTable_initialize_interface(rdbmsSrvTable_registration_ptr user_ctx,
+ u_long flags);
+
+ rdbmsSrvTable_rowreq_ctx * rdbmsSrvTable_allocate_rowreq_ctx(void);
+void rdbmsSrvTable_release_rowreq_ctx(rdbmsSrvTable_rowreq_ctx *rowreq_ctx);
+
+int rdbmsSrvTable_index_to_oid(netsnmp_index *oid_idx,
+ rdbmsSrvTable_mib_index *mib_idx);
+int rdbmsSrvTable_index_from_oid(netsnmp_index *oid_idx,
+ rdbmsSrvTable_mib_index *mib_idx);
+
+/*
+ * access to certain internals. use with caution!
+ */
+void rdbmsSrvTable_valid_columns_set(netsnmp_column_info *vc);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RDBMSSRVTABLE_INTERFACE_H */
diff --git a/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_oids.h b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_oids.h
new file mode 100644
index 0000000..4cf34de
--- /dev/null
+++ b/RDBMS-MIB_src/rdbmsSrvTable/rdbmsSrvTable_oids.h
@@ -0,0 +1,37 @@
+/*-------------------------------------------------------------------------
+ * rdbmsSrvTable_oids.h
+ *
+ * RDBMSMIB mib module.
+ *
+ * Copyright (c) 2004-2007, PostgreSQL Global Development Group
+ * Author: Joshua Tolley
+ *
+ * $Id: rdbmsSrvTable_oids.h,v 1.4 2007/09/13 14:20:44 h-saito Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef RDBMSSRVTABLE_OIDS_H
+#define RDBMSSRVTABLE_OIDS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* column number definitions for table rdbmsSrvTable */
+#define RDBMSSRVTABLE_OID 1,3,6,1,2,1,39,1,5
+#define COLUMN_RDBMSSRVPRIVATEMIBOID 1
+#define COLUMN_RDBMSSRVVENDORNAME 2
+#define COLUMN_RDBMSSRVPRODUCTNAME 3
+#define COLUMN_RDBMSSRVCONTACT 4
+
+#define RDBMSSRVTABLE_MIN_COL COLUMN_RDBMSSRVPRIVATEMIBOID
+#define RDBMSSRVTABLE_MAX_COL COLUMN_RDBMSSRVCONTACT
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RDBMSSRVTABLE_OIDS_H */