diff options
author | Joshua Tolley | 2010-11-26 17:22:01 +0000 |
---|---|---|
committer | Joshua Tolley | 2010-11-26 17:22:01 +0000 |
commit | fe9d8f21bbdfb442b8233b4627a0c67dc458a8bd (patch) | |
tree | a88daa49fc47e64777af3d331cf142e0604c2d48 /PGSQL-MIB_src |
Diffstat (limited to 'PGSQL-MIB_src')
41 files changed, 9672 insertions, 0 deletions
diff --git a/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable.c b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable.c new file mode 100644 index 0000000..5ab5792 --- /dev/null +++ b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable.c @@ -0,0 +1,129 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.32.2.3 $ of : mfd-top.m2c,v $ + * + * $Id: pgsnmpdConnectionsTable.c,v 1.1 2007/10/30 11:44:41 eggyknap Exp $ + */ +/** \mainpage MFD helper for pgsnmpdConnectionsTable + * + * \section intro Introduction + * Introductory text. + * + */ +/* 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 "pgsnmpdConnectionsTable.h" + +#include <net-snmp/agent/mib_modules.h> + +#include "pgsnmpdConnectionsTable_interface.h" + +oid pgsnmpdConnectionsTable_oid[] = { PGSNMPDCONNECTIONSTABLE_OID }; +int pgsnmpdConnectionsTable_oid_size = OID_LENGTH(pgsnmpdConnectionsTable_oid); + +void initialize_table_pgsnmpdConnectionsTable(void); + + +/** + * Initializes the pgsnmpdConnectionsTable module + */ +void +init_pgsnmpdConnectionsTable(void) +{ + DEBUGMSGTL(("verbose:pgsnmpdConnectionsTable:init_pgsnmpdConnectionsTable","called\n")); + + /* + * TODO:300:o: Perform pgsnmpdConnectionsTable one-time module initialization. + */ + + /* + * here we initialize all the tables we're planning on supporting + */ + if (should_init("pgsnmpdConnectionsTable")) + initialize_table_pgsnmpdConnectionsTable(); + +} /* init_pgsnmpdConnectionsTable */ + +/** + * Initialize the table pgsnmpdConnectionsTable + * (Define its contents and how it's structured) + */ +void +initialize_table_pgsnmpdConnectionsTable(void) +{ + pgsnmpdConnectionsTable_registration_ptr user_context; + u_long flags; + + DEBUGMSGTL(("verbose:pgsnmpdConnectionsTable:initialize_table_pgsnmpdConnectionsTable","called\n")); + + /* + * TODO:301:o: Perform pgsnmpdConnectionsTable one-time table initialization. + */ + + /* + * TODO:302:o: |->Initialize pgsnmpdConnectionsTable 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("pgsnmpdConnectionsTable", NULL, NULL); + + /* + * No support for any flags yet, but in the future you would + * set any flags here. + */ + flags = 0; + + /* + * call interface initialization code + */ + _pgsnmpdConnectionsTable_initialize_interface(user_context, flags); +} /* initialize_table_pgsnmpdConnectionsTable */ + +/** + * pre-request callback + * + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error + */ +int +pgsnmpdConnectionsTable_pre_request(pgsnmpdConnectionsTable_registration_ptr user_context) +{ + DEBUGMSGTL(("verbose:pgsnmpdConnectionsTable:pgsnmpdConnectionsTable_pre_request","called\n")); + + /* + * TODO:510:o: Perform pgsnmpdConnectionsTable pre-request actions. + */ + + return MFD_SUCCESS; +} /* pgsnmpdConnectionsTable_pre_request */ + +/** + * post-request callback + * + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error (ignored) + */ +int +pgsnmpdConnectionsTable_post_request(pgsnmpdConnectionsTable_registration_ptr user_context) +{ + DEBUGMSGTL(("verbose:pgsnmpdConnectionsTable:pgsnmpdConnectionsTable_post_request","called\n")); + + /* + * TODO:511:o: Perform pgsnmpdConnectionsTable pos-request actions. + */ + + return MFD_SUCCESS; +} /* pgsnmpdConnectionsTable_post_request */ + + +/** @{ */ diff --git a/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable.h b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable.h new file mode 100644 index 0000000..7191830 --- /dev/null +++ b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable.h @@ -0,0 +1,198 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.32.2.3 $ of : mfd-top.m2c,v $ + * + * $Id: pgsnmpdConnectionsTable.h,v 1.1 2007/10/30 11:44:41 eggyknap Exp $ + */ +#ifndef PGSNMPDCONNECTIONSTABLE_H +#define PGSNMPDCONNECTIONSTABLE_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(PGSQL-MIB/pgsnmpdConnectionsTable/pgsnmpdConnectionsTable_interface); +config_require(PGSQL-MIB/pgsnmpdConnectionsTable/pgsnmpdConnectionsTable_data_access); +config_require(PGSQL-MIB/pgsnmpdConnectionsTable/pgsnmpdConnectionsTable_data_get); +config_require(PGSQL-MIB/pgsnmpdConnectionsTable/pgsnmpdConnectionsTable_data_set); + /* *INDENT-ON* */ + +/* OID and column number definitions for */ +#include "pgsnmpdConnectionsTable_oids.h" + +/* enum definions */ +#include "pgsnmpdConnectionsTable_enums.h" + +/* ********************************************************************* + * function declarations + */ +void init_pgsnmpdConnectionsTable(void); + +/* ********************************************************************* + * Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table pgsnmpdConnectionsTable + *** + ********************************************************************** + **********************************************************************/ +/* + * pgsnmpdConnectionsTable is subid 1 of pgsnmpdTables. + * Its status is Current. + * OID: .1.3.6.1.4.1.27645.1.1.1, length: 10 +*/ +/* ********************************************************************* + * 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 pgsnmpdConnectionsTable registration context. + */ +typedef netsnmp_data_list * pgsnmpdConnectionsTable_registration_ptr; + +/**********************************************************************/ +/* + * TODO:110:r: |-> Review pgsnmpdConnectionsTable data context structure. + * This structure is used to represent the data for pgsnmpdConnectionsTable. + */ +/* + * This structure contains storage for all the columns defined in the + * pgsnmpdConnectionsTable. + */ +typedef struct pgsnmpdConnectionsTable_data_s { + + /* + * pgsnmpdConnHost(2)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H + */ + char pgsnmpdConnHost[255]; +size_t pgsnmpdConnHost_len; /* # of char elements, not bytes */ + + /* + * pgsnmpdConnPort(3)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H + */ + char pgsnmpdConnPort[255]; +size_t pgsnmpdConnPort_len; /* # of char elements, not bytes */ + + /* + * pgsnmpdConnDbName(4)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H + */ + char pgsnmpdConnDbName[255]; +size_t pgsnmpdConnDbName_len; /* # of char elements, not bytes */ + +} pgsnmpdConnectionsTable_data; + + +/* + * TODO:120:r: |-> Review pgsnmpdConnectionsTable mib index. + * This structure is used to represent the index for pgsnmpdConnectionsTable. + */ +typedef struct pgsnmpdConnectionsTable_mib_index_s { + + /* + * pgsnmpdConnID(1)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H + */ + /** 128 - 0(other indexes) - oid length(12) = 115 */ + char pgsnmpdConnID[115]; + size_t pgsnmpdConnID_len; + + +} pgsnmpdConnectionsTable_mib_index; + + /* + * TODO:121:r: | |-> Review pgsnmpdConnectionsTable max index length. + * If you KNOW that your indexes will never exceed a certain + * length, update this macro to that length. + * + * BE VERY CAREFUL TO TAKE INTO ACCOUNT THE MAXIMUM + * POSSIBLE LENGHT FOR EVERY VARIABLE LENGTH INDEX! + * Guessing 128 - col/entry(2) - oid len(10) +*/ +#define MAX_pgsnmpdConnectionsTable_IDX_LEN 116 + + +/* ********************************************************************* + * TODO:130:o: |-> Review pgsnmpdConnectionsTable Row request (rowreq) context. + * When your functions are called, you will be passed a + * pgsnmpdConnectionsTable_rowreq_ctx pointer. + */ +typedef struct pgsnmpdConnectionsTable_rowreq_ctx_s { + + /** this must be first for container compare to work */ + netsnmp_index oid_idx; + oid oid_tmp[MAX_pgsnmpdConnectionsTable_IDX_LEN]; + + pgsnmpdConnectionsTable_mib_index tbl_idx; + + pgsnmpdConnectionsTable_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) + */ + pgsnmpdConnectionsTable_registration_ptr pgsnmpdConnectionsTable_reg; + + /* + * TODO:131:o: | |-> Add useful data to pgsnmpdConnectionsTable rowreq context. + */ + + /* + * storage for future expansion + */ + netsnmp_data_list *pgsnmpdConnectionsTable_data_list; + +} pgsnmpdConnectionsTable_rowreq_ctx; + +typedef struct pgsnmpdConnectionsTable_ref_rowreq_ctx_s { + pgsnmpdConnectionsTable_rowreq_ctx *rowreq_ctx; +} pgsnmpdConnectionsTable_ref_rowreq_ctx; + +/* ********************************************************************* + * function prototypes + */ + int pgsnmpdConnectionsTable_pre_request(pgsnmpdConnectionsTable_registration_ptr user_context); + int pgsnmpdConnectionsTable_post_request(pgsnmpdConnectionsTable_registration_ptr user_context); + + +extern oid pgsnmpdConnectionsTable_oid[]; +extern int pgsnmpdConnectionsTable_oid_size; + + +#include "pgsnmpdConnectionsTable_interface.h" +#include "pgsnmpdConnectionsTable_data_access.h" +#include "pgsnmpdConnectionsTable_data_get.h" +#include "pgsnmpdConnectionsTable_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 /* PGSNMPDCONNECTIONSTABLE_H */ diff --git a/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_data_access.h b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_data_access.h new file mode 100644 index 0000000..d378541 --- /dev/null +++ b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_data_access.h @@ -0,0 +1,56 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.12 $ of : mfd-data-access.m2c,v $ + * + * $Id: pgsnmpdConnectionsTable_data_access.h,v 1.1 2007/10/30 11:44:41 eggyknap Exp $ + */ +#ifndef PGSNMPDCONNECTIONSTABLE_DATA_ACCESS_H +#define PGSNMPDCONNECTIONSTABLE_DATA_ACCESS_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* ********************************************************************* + * function declarations + */ + +/* ********************************************************************* + * Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table pgsnmpdConnectionsTable + *** + ********************************************************************** + **********************************************************************/ +/* + * pgsnmpdConnectionsTable is subid 1 of pgsnmpdTables. + * Its status is Current. + * OID: .1.3.6.1.4.1.27645.1.1.1, length: 10 +*/ + + + int pgsnmpdConnectionsTable_init_data(pgsnmpdConnectionsTable_registration_ptr pgsnmpdConnectionsTable_reg); + + +/* + * TODO:180:o: Review pgsnmpdConnectionsTable cache timeout. + * The number of seconds before the cache times out + */ +#define PGSNMPDCONNECTIONSTABLE_CACHE_TIMEOUT 60 + +void pgsnmpdConnectionsTable_container_init(netsnmp_container **container_ptr_ptr, + netsnmp_cache *cache); +int pgsnmpdConnectionsTable_cache_load(netsnmp_container *container); +void pgsnmpdConnectionsTable_cache_free(netsnmp_container *container); + + /* + *************************************************** + *** START EXAMPLE CODE *** + ***---------------------------------------------***/ +/* ********************************************************************* + * Since we have no idea how you really access your data, we'll go with + * a worst case example: a flat text file. diff --git a/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_data_get.c b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_data_get.c new file mode 100644 index 0000000..c2e7677 --- /dev/null +++ b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_data_get.c @@ -0,0 +1,279 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.18.2.1 $ of : mfd-data-get.m2c,v $ + * + * $Id: pgsnmpdConnectionsTable_data_get.c,v 1.1 2007/10/30 11:44:41 eggyknap 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 "pgsnmpdConnectionsTable.h" + + +/** @defgroup data_get data_get: Routines to get data + * + * TODO:230:M: Implement pgsnmpdConnectionsTable get routines. + * TODO:240:M: Implement pgsnmpdConnectionsTable 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 pgsnmpdConnectionsTable + *** + ********************************************************************** + **********************************************************************/ +/* + * pgsnmpdConnectionsTable is subid 1 of pgsnmpdTables. + * Its status is Current. + * OID: .1.3.6.1.4.1.27645.1.1.1, length: 10 +*/ + +/* --------------------------------------------------------------------- + * TODO:200:r: Implement pgsnmpdConnectionsTable data context functions. + */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsnmpdConnectionEntry.pgsnmpdConnID + * pgsnmpdConnID is subid 1 of pgsnmpdConnectionEntry. + * Its status is Current, and its access level is NoAccess. + * OID: .1.3.6.1.4.1.27645.1.1.1.1.1 + * Description: +Identifying string for this connection. Default is host:port:database. + * + * Attributes: + * accessible 0 isscalar 0 enums 0 hasdefval 0 + * readable 0 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) + * + * + * + * NOTE: NODE pgsnmpdConnID 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-pgsnmpdConnID.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 +pgsnmpdConnID_map(char **mib_pgsnmpdConnID_val_ptr_ptr, size_t *mib_pgsnmpdConnID_val_ptr_len_ptr, char *raw_pgsnmpdConnID_val_ptr, size_t raw_pgsnmpdConnID_val_ptr_len, int allow_realloc) +{ + int converted_len; + + netsnmp_assert(NULL != raw_pgsnmpdConnID_val_ptr); + netsnmp_assert((NULL != mib_pgsnmpdConnID_val_ptr_ptr) && (NULL != mib_pgsnmpdConnID_val_ptr_len_ptr)); + + DEBUGMSGTL(("verbose:pgsnmpdConnectionsTable:pgsnmpdConnID_map","called\n")); + + /* + * TODO:241:r: |-> Implement pgsnmpdConnID 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_pgsnmpdConnID_val_ptr_len; /* assume equal */ + if((NULL == *mib_pgsnmpdConnID_val_ptr_ptr) || (*mib_pgsnmpdConnID_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_pgsnmpdConnID_val_ptr_ptr = realloc( *mib_pgsnmpdConnID_val_ptr_ptr, converted_len * sizeof(**mib_pgsnmpdConnID_val_ptr_ptr)); + if(NULL == *mib_pgsnmpdConnID_val_ptr_ptr) { + snmp_log(LOG_ERR,"could not allocate memory\n"); + return SNMP_ERR_GENERR; + } + } + *mib_pgsnmpdConnID_val_ptr_len_ptr = converted_len; + memcpy( *mib_pgsnmpdConnID_val_ptr_ptr, raw_pgsnmpdConnID_val_ptr, converted_len ); + + return MFD_SUCCESS; +} /* pgsnmpdConnID_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 +pgsnmpdConnectionsTable_indexes_set_tbl_idx(pgsnmpdConnectionsTable_mib_index *tbl_idx, char *pgsnmpdConnID_val_ptr, size_t pgsnmpdConnID_val_ptr_len) +{ + DEBUGMSGTL(("verbose:pgsnmpdConnectionsTable:pgsnmpdConnectionsTable_indexes_set_tbl_idx","called\n")); + + /* pgsnmpdConnID(1)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H */ + tbl_idx->pgsnmpdConnID_len = sizeof(tbl_idx->pgsnmpdConnID); + /* + * make sure there is enough space for pgsnmpdConnID data + */ + if ((NULL == tbl_idx->pgsnmpdConnID) || + (tbl_idx->pgsnmpdConnID_len < (pgsnmpdConnID_val_ptr_len * sizeof(tbl_idx->pgsnmpdConnID[0])))) { + snmp_log(LOG_ERR,"not enough space for value\n"); + return MFD_ERROR; + } + tbl_idx->pgsnmpdConnID_len = pgsnmpdConnID_val_ptr_len * sizeof(tbl_idx->pgsnmpdConnID[0]); + memcpy( tbl_idx->pgsnmpdConnID, pgsnmpdConnID_val_ptr, tbl_idx->pgsnmpdConnID_len ); + + + return MFD_SUCCESS; +} /* pgsnmpdConnectionsTable_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 +pgsnmpdConnectionsTable_indexes_set(pgsnmpdConnectionsTable_rowreq_ctx *rowreq_ctx, char *pgsnmpdConnID_val_ptr, size_t pgsnmpdConnID_val_ptr_len) +{ + DEBUGMSGTL(("verbose:pgsnmpdConnectionsTable:pgsnmpdConnectionsTable_indexes_set","called\n")); + + if(MFD_SUCCESS != pgsnmpdConnectionsTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx + , pgsnmpdConnID_val_ptr, pgsnmpdConnID_val_ptr_len + )) + return MFD_ERROR; + + /* + * convert mib index to oid index + */ + rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid); + if(0 != pgsnmpdConnectionsTable_index_to_oid(&rowreq_ctx->oid_idx, + &rowreq_ctx->tbl_idx)) { + return MFD_ERROR; + } + + return MFD_SUCCESS; +} /* pgsnmpdConnectionsTable_indexes_set */ + + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsnmpdConnectionEntry.pgsnmpdConnHost + * pgsnmpdConnHost is subid 2 of pgsnmpdConnectionEntry. + * Its status is Current, and its access level is NoAccess. + * OID: .1.3.6.1.4.1.27645.1.1.1.1.2 + * Description: +Host name, IP address, or other identifier of the host PostgreSQL server for this connection + * + * Attributes: + * accessible 0 isscalar 0 enums 0 hasdefval 0 + * readable 0 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) + * + * + * + * NOTE: NODE pgsnmpdConnHost IS NOT ACCESSIBLE + * + * + */ +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsnmpdConnectionEntry.pgsnmpdConnPort + * pgsnmpdConnPort is subid 3 of pgsnmpdConnectionEntry. + * Its status is Current, and its access level is NoAccess. + * OID: .1.3.6.1.4.1.27645.1.1.1.1.3 + * Description: +PostgreSQL server port number for this connection + * + * Attributes: + * accessible 0 isscalar 0 enums 0 hasdefval 0 + * readable 0 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) + * + * + * + * NOTE: NODE pgsnmpdConnPort IS NOT ACCESSIBLE + * + * + */ +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsnmpdConnectionEntry.pgsnmpdConnDbName + * pgsnmpdConnDbName is subid 4 of pgsnmpdConnectionEntry. + * Its status is Current, and its access level is NoAccess. + * OID: .1.3.6.1.4.1.27645.1.1.1.1.4 + * Description: +Name of the database this connection is connected to + * + * Attributes: + * accessible 0 isscalar 0 enums 0 hasdefval 0 + * readable 0 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) + * + * + * + * NOTE: NODE pgsnmpdConnDbName IS NOT ACCESSIBLE + * + * + */ + + +/** @} */ diff --git a/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_data_get.h b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_data_get.h new file mode 100644 index 0000000..2e12dae --- /dev/null +++ b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_data_get.h @@ -0,0 +1,65 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.18.2.1 $ of : mfd-data-get.m2c,v $ + * + * $Id: pgsnmpdConnectionsTable_data_get.h,v 1.1 2007/10/30 11:44:41 eggyknap Exp $ + * + * @file pgsnmpdConnectionsTable_data_get.h + * + * @addtogroup get + * + * Prototypes for get functions + * + * @{ + */ +#ifndef PGSNMPDCONNECTIONSTABLE_DATA_GET_H +#define PGSNMPDCONNECTIONSTABLE_DATA_GET_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* ********************************************************************* + * GET function declarations + */ + +/* ********************************************************************* + * GET Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table pgsnmpdConnectionsTable + *** + ********************************************************************** + **********************************************************************/ +/* + * pgsnmpdConnectionsTable is subid 1 of pgsnmpdTables. + * Its status is Current. + * OID: .1.3.6.1.4.1.27645.1.1.1, length: 10 +*/ + /* + * indexes + */ + int pgsnmpdConnID_map(char **mib_pgsnmpdConnID_val_ptr_ptr, size_t *mib_pgsnmpdConnID_val_ptr_len_ptr, char *raw_pgsnmpdConnID_val_ptr, size_t raw_pgsnmpdConnID_val_ptr_len, int allow_realloc); + + int pgsnmpdConnHost_map(char **mib_pgsnmpdConnHost_val_ptr_ptr, size_t *mib_pgsnmpdConnHost_val_ptr_len_ptr, char *raw_pgsnmpdConnHost_val_ptr, size_t raw_pgsnmpdConnHost_val_ptr_len, int allow_realloc); + int pgsnmpdConnHost_get( pgsnmpdConnectionsTable_rowreq_ctx *rowreq_ctx, char **pgsnmpdConnHost_val_ptr_ptr, size_t *pgsnmpdConnHost_val_ptr_len_ptr ); + int pgsnmpdConnPort_map(char **mib_pgsnmpdConnPort_val_ptr_ptr, size_t *mib_pgsnmpdConnPort_val_ptr_len_ptr, char *raw_pgsnmpdConnPort_val_ptr, size_t raw_pgsnmpdConnPort_val_ptr_len, int allow_realloc); + int pgsnmpdConnPort_get( pgsnmpdConnectionsTable_rowreq_ctx *rowreq_ctx, char **pgsnmpdConnPort_val_ptr_ptr, size_t *pgsnmpdConnPort_val_ptr_len_ptr ); + int pgsnmpdConnDbName_map(char **mib_pgsnmpdConnDbName_val_ptr_ptr, size_t *mib_pgsnmpdConnDbName_val_ptr_len_ptr, char *raw_pgsnmpdConnDbName_val_ptr, size_t raw_pgsnmpdConnDbName_val_ptr_len, int allow_realloc); + int pgsnmpdConnDbName_get( pgsnmpdConnectionsTable_rowreq_ctx *rowreq_ctx, char **pgsnmpdConnDbName_val_ptr_ptr, size_t *pgsnmpdConnDbName_val_ptr_len_ptr ); + + +int pgsnmpdConnectionsTable_indexes_set_tbl_idx(pgsnmpdConnectionsTable_mib_index *tbl_idx, char *pgsnmpdConnID_val_ptr, size_t pgsnmpdConnID_val_ptr_len); +int pgsnmpdConnectionsTable_indexes_set(pgsnmpdConnectionsTable_rowreq_ctx *rowreq_ctx, char *pgsnmpdConnID_val_ptr, size_t pgsnmpdConnID_val_ptr_len); + + + + +#ifdef __cplusplus +} +#endif + +#endif /* PGSNMPDCONNECTIONSTABLE_DATA_GET_H */ +/** @} */ diff --git a/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_data_set.c b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_data_set.c new file mode 100644 index 0000000..44af8ae --- /dev/null +++ b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_data_set.c @@ -0,0 +1,24 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.18 $ of : mfd-data-set.m2c,v $ + * + * $Id: pgsnmpdConnectionsTable_data_set.c,v 1.1 2007/10/30 11:44:41 eggyknap 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 "pgsnmpdConnectionsTable.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/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_data_set.h b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_data_set.h new file mode 100644 index 0000000..d077ee0 --- /dev/null +++ b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_data_set.h @@ -0,0 +1,27 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.18 $ of : mfd-data-set.m2c,v $ + * + * $Id: pgsnmpdConnectionsTable_data_set.h,v 1.1 2007/10/30 11:44:41 eggyknap Exp $ + */ +#ifndef PGSNMPDCONNECTIONSTABLE_DATA_SET_H +#define PGSNMPDCONNECTIONSTABLE_DATA_SET_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* ********************************************************************* + * SET function declarations + */ + +/* ********************************************************************* + * SET Table declarations + */ + + +#ifdef __cplusplus +} +#endif + +#endif /* PGSNMPDCONNECTIONSTABLE_DATA_SET_H */ diff --git a/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_enums.h b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_enums.h new file mode 100644 index 0000000..5fcc4cd --- /dev/null +++ b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_enums.h @@ -0,0 +1,40 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : generic-table-enums.m2c,v 1.3 2004/05/18 17:44:32 rstory Exp $ + * + * $Id: pgsnmpdConnectionsTable_enums.h,v 1.1 2007/10/30 11:44:41 eggyknap Exp $ + */ +#ifndef PGSNMPDCONNECTIONSTABLE_ENUMS_H +#define PGSNMPDCONNECTIONSTABLE_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 pgsnmpdConnectionsTable + * + ************************************************************************* + *************************************************************************/ + + + +#ifdef __cplusplus +} +#endif + +#endif /* PGSNMPDCONNECTIONSTABLE_ENUMS_H */ diff --git a/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_interface.c b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_interface.c new file mode 100644 index 0000000..2b42a61 --- /dev/null +++ b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_interface.c @@ -0,0 +1,707 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.43.2.3 $ of : mfd-interface.m2c,v $ + * + * $Id: pgsnmpdConnectionsTable_interface.c,v 1.1 2007/10/30 11:44:41 eggyknap Exp $ + */ +/* + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + * *** *** + * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** + * *** *** + * *** *** + * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** + * *** *** + * *** *** + * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** + * *** *** + * *** *** + * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** + * *** *** + * *** *** + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + */ + +/* 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 "pgsnmpdConnectionsTable.h" + + +#include <net-snmp/library/container.h> + +#include "pgsnmpdConnectionsTable_interface.h" + +/********************************************************************** + ********************************************************************** + *** + *** Table pgsnmpdConnectionsTable + *** + ********************************************************************** + **********************************************************************/ +/* + * pgsnmpdConnectionsTable is subid 1 of pgsnmpdTables. + * Its status is Current. + * OID: .1.3.6.1.4.1.27645.1.1.1, length: 10 +*/ +typedef struct pgsnmpdConnectionsTable_interface_ctx_s { + + netsnmp_container *container; + netsnmp_cache *cache; /* optional cache */ + + pgsnmpdConnectionsTable_registration_ptr user_ctx; + + netsnmp_table_registration_info tbl_info; + + netsnmp_baby_steps_access_methods access_multiplexer; + +} pgsnmpdConnectionsTable_interface_ctx; + +static pgsnmpdConnectionsTable_interface_ctx pgsnmpdConnectionsTable_if_ctx; + +static void _pgsnmpdConnectionsTable_container_init( + pgsnmpdConnectionsTable_interface_ctx *if_ctx); + + +static Netsnmp_Node_Handler _mfd_pgsnmpdConnectionsTable_pre_request; +static Netsnmp_Node_Handler _mfd_pgsnmpdConnectionsTable_post_request; +static Netsnmp_Node_Handler _mfd_pgsnmpdConnectionsTable_object_lookup; +static Netsnmp_Node_Handler _mfd_pgsnmpdConnectionsTable_get_values; +/** + * @internal + * Initialize the table pgsnmpdConnectionsTable + * (Define its contents and how it's structured) + */ +void +_pgsnmpdConnectionsTable_initialize_interface(pgsnmpdConnectionsTable_registration_ptr reg_ptr, u_long flags) +{ + netsnmp_baby_steps_access_methods *access_multiplexer = + &pgsnmpdConnectionsTable_if_ctx.access_multiplexer; + netsnmp_table_registration_info *tbl_info = &pgsnmpdConnectionsTable_if_ctx.tbl_info; + netsnmp_handler_registration *reginfo; + netsnmp_mib_handler *handler; + int mfd_modes = 0; + + DEBUGMSGTL(("internal:pgsnmpdConnectionsTable:_pgsnmpdConnectionsTable_initialize_interface","called\n")); + + + /************************************************* + * + * save interface context for pgsnmpdConnectionsTable + */ + /* + * Setting up the table's definition + */ + netsnmp_table_helper_add_indexes(tbl_info, + ASN_OCTET_STR, /** index: pgsnmpdConnID */ + 0); + + /* Define the minimum and maximum accessible columns. This + optimizes retrival. */ + tbl_info->min_column = PGSNMPDCONNECTIONSTABLE_MIN_COL; + tbl_info->max_column = PGSNMPDCONNECTIONSTABLE_MAX_COL; + + /* + * save users context + */ + pgsnmpdConnectionsTable_if_ctx.user_ctx = reg_ptr; + + /* + * call data access initialization code + */ + pgsnmpdConnectionsTable_init_data(reg_ptr); + + /* + * set up the container + */ + _pgsnmpdConnectionsTable_container_init(&pgsnmpdConnectionsTable_if_ctx); + if (NULL == pgsnmpdConnectionsTable_if_ctx.container) { + snmp_log(LOG_ERR,"could not initialize container for pgsnmpdConnectionsTable\n"); + return; + } + + /* + * access_multiplexer: REQUIRED wrapper for get request handling + */ + access_multiplexer->object_lookup = _mfd_pgsnmpdConnectionsTable_object_lookup; + access_multiplexer->get_values = _mfd_pgsnmpdConnectionsTable_get_values; + + /* + * no wrappers yet + */ + access_multiplexer->pre_request = _mfd_pgsnmpdConnectionsTable_pre_request; + access_multiplexer->post_request = _mfd_pgsnmpdConnectionsTable_post_request; + + + /************************************************* + * + * Create a registration, save our reg data, register table. + */ + DEBUGMSGTL(("pgsnmpdConnectionsTable:init_pgsnmpdConnectionsTable", + "Registering pgsnmpdConnectionsTable as a mibs-for-dummies table.\n")); + handler = netsnmp_baby_steps_access_multiplexer_get(access_multiplexer); + reginfo = netsnmp_handler_registration_create("pgsnmpdConnectionsTable", handler, + pgsnmpdConnectionsTable_oid, + pgsnmpdConnectionsTable_oid_size, + HANDLER_CAN_BABY_STEP | + HANDLER_CAN_RONLY + ); + if(NULL == reginfo) { + snmp_log(LOG_ERR,"error registering table pgsnmpdConnectionsTable\n"); + return; + } + reginfo->my_reg_void = &pgsnmpdConnectionsTable_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, + pgsnmpdConnectionsTable_if_ctx.container, + TABLE_CONTAINER_KEY_NETSNMP_INDEX); + netsnmp_inject_handler( reginfo, handler ); + + /************************************************* + * + * inject cache helper + */ + if(NULL != pgsnmpdConnectionsTable_if_ctx.cache) { + handler = netsnmp_cache_handler_get(pgsnmpdConnectionsTable_if_ctx.cache); + netsnmp_inject_handler( reginfo, handler ); + } + + /* + * register table + */ + netsnmp_register_table(reginfo, tbl_info); +} /* _pgsnmpdConnectionsTable_initialize_interface */ + +void +pgsnmpdConnectionsTable_valid_columns_set(netsnmp_column_info *vc) +{ + pgsnmpdConnectionsTable_if_ctx.tbl_info.valid_columns = vc; +} /* pgsnmpdConnectionsTable_valid_columns_set */ + +/** + * @internal + * convert the index component stored in the context to an oid + */ +int +pgsnmpdConnectionsTable_index_to_oid(netsnmp_index *oid_idx, + pgsnmpdConnectionsTable_mib_index *mib_idx) +{ + int err = SNMP_ERR_NOERROR; + + /* + * temp storage for parsing indexes + */ + /* + * pgsnmpdConnID(1)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H + */ + netsnmp_variable_list var_pgsnmpdConnID; + + /* + * set up varbinds + */ + memset( &var_pgsnmpdConnID, 0x00, sizeof(var_pgsnmpdConnID) ); + var_pgsnmpdConnID.type = ASN_OCTET_STR; + + /* + * chain temp index varbinds together + */ + var_pgsnmpdConnID.next_variable = NULL; + + + DEBUGMSGTL(("verbose:pgsnmpdConnectionsTable:pgsnmpdConnectionsTable_index_to_oid","called\n")); + + /* pgsnmpdConnID(1)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H */ + snmp_set_var_value(&var_pgsnmpdConnID, (u_char*)&mib_idx->pgsnmpdConnID, + mib_idx->pgsnmpdConnID_len * sizeof(mib_idx->pgsnmpdConnID[0])); + + + err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len, + NULL, 0, &var_pgsnmpdConnID); + 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_pgsnmpdConnID ); + + return err; +} /* pgsnmpdConnectionsTable_index_to_oid */ + +/** + * extract pgsnmpdConnectionsTable indexes from a netsnmp_index + * + * @retval SNMP_ERR_NOERROR : no error + * @retval SNMP_ERR_GENERR : error + */ +int +pgsnmpdConnectionsTable_index_from_oid(netsnmp_index *oid_idx, + pgsnmpdConnectionsTable_mib_index *mib_idx) +{ + int err = SNMP_ERR_NOERROR; + + /* + * temp storage for parsing indexes + */ + /* + * pgsnmpdConnID(1)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H + */ + netsnmp_variable_list var_pgsnmpdConnID; + + /* + * set up varbinds + */ + memset( &var_pgsnmpdConnID, 0x00, sizeof(var_pgsnmpdConnID) ); + var_pgsnmpdConnID.type = ASN_OCTET_STR; + + /* + * chain temp index varbinds together + */ + var_pgsnmpdConnID.next_variable = NULL; + + + DEBUGMSGTL(("verbose:pgsnmpdConnectionsTable:pgsnmpdConnectionsTable_index_from_oid","called\n")); + + /* + * parse the oid into the individual index components + */ + err = parse_oid_indexes( oid_idx->oids, oid_idx->len, + &var_pgsnmpdConnID ); + if (err == SNMP_ERR_NOERROR) { + /* + * copy out values + */ + /* + * NOTE: val_len is in bytes, pgsnmpdConnID_len might not be + */ + if(var_pgsnmpdConnID.val_len > sizeof(mib_idx->pgsnmpdConnID)) + err = SNMP_ERR_GENERR; + else { + memcpy(mib_idx->pgsnmpdConnID, var_pgsnmpdConnID.val.string, var_pgsnmpdConnID.val_len); + mib_idx->pgsnmpdConnID_len = var_pgsnmpdConnID.val_len / sizeof(mib_idx->pgsnmpdConnID[0]); + } + + + } + + /* + * parsing may have allocated memory. free it. + */ + snmp_reset_var_buffers( &var_pgsnmpdConnID ); + + return err; +} /* pgsnmpdConnectionsTable_index_from_oid */ + + +/* ********************************************************************* + * @internal + * allocate resources for a pgsnmpdConnectionsTable_rowreq_ctx + */ +pgsnmpdConnectionsTable_rowreq_ctx * +pgsnmpdConnectionsTable_allocate_rowreq_ctx(void) +{ + pgsnmpdConnectionsTable_rowreq_ctx *rowreq_ctx = + SNMP_MALLOC_TYPEDEF(pgsnmpdConnectionsTable_rowreq_ctx); + + DEBUGMSGTL(("internal:pgsnmpdConnectionsTable:pgsnmpdConnectionsTable_allocate_rowreq_ctx","called\n")); + + if(NULL == rowreq_ctx) { + snmp_log(LOG_ERR,"Couldn't allocate memory for a " + "pgsnmpdConnectionsTable_rowreq_ctx.\n"); + } + + rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp; + + rowreq_ctx->pgsnmpdConnectionsTable_data_list = NULL; + rowreq_ctx->pgsnmpdConnectionsTable_reg = pgsnmpdConnectionsTable_if_ctx.user_ctx; + + + return rowreq_ctx; +} /* pgsnmpdConnectionsTable_allocate_rowreq_ctx */ + +/* + * @internal + * release resources for a pgsnmpdConnectionsTable_rowreq_ctx + */ +void +pgsnmpdConnectionsTable_release_rowreq_ctx(pgsnmpdConnectionsTable_rowreq_ctx *rowreq_ctx) +{ + DEBUGMSGTL(("internal:pgsnmpdConnectionsTable:pgsnmpdConnectionsTable_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); +} /* pgsnmpdConnectionsTable_release_rowreq_ctx */ + +/** + * @internal + * wrapper + */ +static int +_mfd_pgsnmpdConnectionsTable_pre_request(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + int rc = pgsnmpdConnectionsTable_pre_request(pgsnmpdConnectionsTable_if_ctx.user_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("internal:pgsnmpdConnectionsTable","error %d from " + "pgsnmpdConnectionsTable_pre_request\n", rc)); + netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); + } + + return SNMP_ERR_NOERROR; +} /* _mfd_pgsnmpdConnectionsTable_pre_request */ + +/** + * @internal + * wrapper + */ +static int +_mfd_pgsnmpdConnectionsTable_post_request(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + pgsnmpdConnectionsTable_rowreq_ctx *rowreq_ctx; + int rc = pgsnmpdConnectionsTable_post_request(pgsnmpdConnectionsTable_if_ctx.user_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("internal:pgsnmpdConnectionsTable","error %d from " + "pgsnmpdConnectionsTable_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(pgsnmpdConnectionsTable_if_ctx.container, rowreq_ctx); + } + else if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) { + CONTAINER_REMOVE(pgsnmpdConnectionsTable_if_ctx.container, rowreq_ctx); + pgsnmpdConnectionsTable_release_rowreq_ctx(rowreq_ctx); + } + } + + return SNMP_ERR_NOERROR; +} /* _mfd_pgsnmpdConnectionsTable_post_request */ + +/** + * @internal + * wrapper + */ +static int +_mfd_pgsnmpdConnectionsTable_object_lookup(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + pgsnmpdConnectionsTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:pgsnmpdConnectionsTable:_mfd_pgsnmpdConnectionsTable_object_lookup","called\n")); + + /* + * get our context from mfd + * pgsnmpdConnectionsTable_interface_ctx *if_ctx = + * (pgsnmpdConnectionsTable_interface_ctx *)reginfo->my_reg_void; + */ + + if(NULL == rowreq_ctx) { + netsnmp_request_set_error_all(requests, SNMP_ERR_NOCREATION); + } + else { + pgsnmpdConnectionsTable_row_prep(rowreq_ctx); + } + + return SNMP_ERR_NOERROR; +} /* _mfd_pgsnmpdConnectionsTable_object_lookup */ + +/*********************************************************************** + * + * GET processing + * + ***********************************************************************/ +/* + * @internal + * Retrieve the value for a particular column + */ +NETSNMP_STATIC_INLINE int +_pgsnmpdConnectionsTable_get_column( pgsnmpdConnectionsTable_rowreq_ctx *rowreq_ctx, + netsnmp_variable_list *var, int column ) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:pgsnmpdConnectionsTable:_mfd_pgsnmpdConnectionsTable_get_column","called\n")); + + + netsnmp_assert(NULL != rowreq_ctx); + + switch(column) { + + default: + snmp_log(LOG_ERR,"unknown column %d in _pgsnmpdConnectionsTable_get_column\n", column); + break; + } + + return rc; +} /* _pgsnmpdConnectionsTable_get_column */ + +int +_mfd_pgsnmpdConnectionsTable_get_values(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + pgsnmpdConnectionsTable_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:pgsnmpdConnectionsTable:_mfd_pgsnmpdConnectionsTable_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 = _pgsnmpdConnectionsTable_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_pgsnmpdConnectionsTable_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:pgsnmpdConnectionsTable:_cache_load","called\n")); + + if((NULL == cache) || (NULL == cache->magic)) { + snmp_log(LOG_ERR, "invalid cache for pgsnmpdConnectionsTable_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 pgsnmpdConnectionsTable_cache_load((netsnmp_container*)cache->magic); +} /* _cache_load */ + +/** + * @internal + */ +static void +_cache_item_free(pgsnmpdConnectionsTable_rowreq_ctx *rowreq_ctx, void *context) +{ + DEBUGMSGTL(("internal:pgsnmpdConnectionsTable:_cache_item_free","called\n")); + + if(NULL == rowreq_ctx) + return; + + pgsnmpdConnectionsTable_release_rowreq_ctx(rowreq_ctx); +} /* _cache_item_free */ + +/** + * @internal + */ +static void +_cache_free(netsnmp_cache *cache, void *magic) +{ + netsnmp_container *container; + + DEBUGMSGTL(("internal:pgsnmpdConnectionsTable:_cache_free","called\n")); + + if((NULL == cache) || (NULL == cache->magic)) { + snmp_log(LOG_ERR, "invalid cache in pgsnmpdConnectionsTable_cache_free\n"); + return; + } + + container = (netsnmp_container*)cache->magic; + + /* + * call user code + */ + pgsnmpdConnectionsTable_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 +_pgsnmpdConnectionsTable_container_init(pgsnmpdConnectionsTable_interface_ctx *if_ctx) +{ + DEBUGMSGTL(("internal:pgsnmpdConnectionsTable:_pgsnmpdConnectionsTable_container_init","called\n")); + + /* + * set up the cache + */ + if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */ + _cache_load, _cache_free, + pgsnmpdConnectionsTable_oid, + pgsnmpdConnectionsTable_oid_size); + + if(NULL == if_ctx->cache) { + snmp_log(LOG_ERR, "error creating cache for pgsnmpdConnectionsTable\n"); + return; + } + + if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET; + + pgsnmpdConnectionsTable_container_init(&if_ctx->container, if_ctx->cache); + if(NULL == if_ctx->container) + if_ctx->container = netsnmp_container_find("pgsnmpdConnectionsTable:table_container"); + if(NULL == if_ctx->container) { + snmp_log(LOG_ERR,"error creating container in " + "pgsnmpdConnectionsTable_container_init\n"); + return; + } + if_ctx->cache->magic = (void*)if_ctx->container; +} /* _pgsnmpdConnectionsTable_container_init */ + diff --git a/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_interface.h b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_interface.h new file mode 100644 index 0000000..872beea --- /dev/null +++ b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_interface.h @@ -0,0 +1,72 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.43.2.3 $ of : mfd-interface.m2c,v $ + * + * $Id: pgsnmpdConnectionsTable_interface.h,v 1.1 2007/10/30 11:44:41 eggyknap Exp $ + */ +/** @defgroup interface: Routines to interface to Net-SNMP + * + * \warning This code should not be modified, called directly, + * or used to interpret functionality. It is subject to + * change at any time. + * + * @{ + */ +/* + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + * *** *** + * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** + * *** *** + * *** *** + * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** + * *** *** + * *** *** + * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** + * *** *** + * *** *** + * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** + * *** *** + * *** *** + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + */ +#ifndef PGSNMPDCONNECTIONSTABLE_INTERFACE_H +#define PGSNMPDCONNECTIONSTABLE_INTERFACE_H + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "pgsnmpdConnectionsTable.h" + +/* ******************************************************************** + * Table declarations + */ + +/* PUBLIC interface initialization routine */ +void _pgsnmpdConnectionsTable_initialize_interface(pgsnmpdConnectionsTable_registration_ptr user_ctx, + u_long flags); + + pgsnmpdConnectionsTable_rowreq_ctx * pgsnmpdConnectionsTable_allocate_rowreq_ctx(void); +void pgsnmpdConnectionsTable_release_rowreq_ctx(pgsnmpdConnectionsTable_rowreq_ctx *rowreq_ctx); + +int pgsnmpdConnectionsTable_index_to_oid(netsnmp_index *oid_idx, + pgsnmpdConnectionsTable_mib_index *mib_idx); +int pgsnmpdConnectionsTable_index_from_oid(netsnmp_index *oid_idx, + pgsnmpdConnectionsTable_mib_index *mib_idx); + +/* + * access to certain internals. use with caution! + */ +void pgsnmpdConnectionsTable_valid_columns_set(netsnmp_column_info *vc); + + +#ifdef __cplusplus +} +#endif + +#endif /* PGSNMPDCONNECTIONSTABLE_INTERFACE_H */ diff --git a/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_oids.h b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_oids.h new file mode 100644 index 0000000..9f8d9c6 --- /dev/null +++ b/PGSQL-MIB_src/pgsnmpdTables/pgsnmpdConnectionsTable_oids.h @@ -0,0 +1,30 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : generic-table-oids.m2c,v 1.10 2004/10/08 23:39:17 rstory Exp $ + * + * $Id: pgsnmpdConnectionsTable_oids.h,v 1.1 2007/10/30 11:44:41 eggyknap Exp $ + */ +#ifndef PGSNMPDCONNECTIONSTABLE_OIDS_H +#define PGSNMPDCONNECTIONSTABLE_OIDS_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* column number definitions for table pgsnmpdConnectionsTable */ +#define PGSNMPDCONNECTIONSTABLE_OID 1,3,6,1,4,1,27645,1,1,1 +#define COLUMN_PGSNMPDCONNID 1 +#define COLUMN_PGSNMPDCONNHOST 2 +#define COLUMN_PGSNMPDCONNPORT 3 +#define COLUMN_PGSNMPDCONNDBNAME 4 + +#define PGSNMPDCONNECTIONSTABLE_MIN_COL +#define PGSNMPDCONNECTIONSTABLE_MAX_COL + + +#ifdef __cplusplus +} +#endif + +#endif /* PGSNMPDCONNECTIONSTABLE_OIDS_H */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable.c b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable.c new file mode 100644 index 0000000..5d427c0 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable.c @@ -0,0 +1,129 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.32.2.3 $ of : mfd-top.m2c,v $ + * + * $Id: pgsqlPgAggregateTable.c,v 1.1 2008/01/17 11:49:24 eggyknap Exp $ + */ +/** \mainpage MFD helper for pgsqlPgAggregateTable + * + * \section intro Introduction + * Introductory text. + * + */ +/* 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 "pgsqlPgAggregateTable.h" + +#include <net-snmp/agent/mib_modules.h> + +#include "pgsqlPgAggregateTable_interface.h" + +oid pgsqlPgAggregateTable_oid[] = { PGSQLPGAGGREGATETABLE_OID }; +int pgsqlPgAggregateTable_oid_size = OID_LENGTH(pgsqlPgAggregateTable_oid); + +void initialize_table_pgsqlPgAggregateTable(void); + + +/** + * Initializes the pgsqlPgAggregateTable module + */ +void +init_pgsqlPgAggregateTable(void) +{ + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:init_pgsqlPgAggregateTable","called\n")); + + /* + * TODO:300:o: Perform pgsqlPgAggregateTable one-time module initialization. + */ + + /* + * here we initialize all the tables we're planning on supporting + */ + if (should_init("pgsqlPgAggregateTable")) + initialize_table_pgsqlPgAggregateTable(); + +} /* init_pgsqlPgAggregateTable */ + +/** + * Initialize the table pgsqlPgAggregateTable + * (Define its contents and how it's structured) + */ +void +initialize_table_pgsqlPgAggregateTable(void) +{ + pgsqlPgAggregateTable_registration_ptr user_context; + u_long flags; + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:initialize_table_pgsqlPgAggregateTable","called\n")); + + /* + * TODO:301:o: Perform pgsqlPgAggregateTable one-time table initialization. + */ + + /* + * TODO:302:o: |->Initialize pgsqlPgAggregateTable 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("pgsqlPgAggregateTable", NULL, NULL); + + /* + * No support for any flags yet, but in the future you would + * set any flags here. + */ + flags = 0; + + /* + * call interface initialization code + */ + _pgsqlPgAggregateTable_initialize_interface(user_context, flags); +} /* initialize_table_pgsqlPgAggregateTable */ + +/** + * pre-request callback + * + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error + */ +int +pgsqlPgAggregateTable_pre_request(pgsqlPgAggregateTable_registration_ptr user_context) +{ + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateTable_pre_request","called\n")); + + /* + * TODO:510:o: Perform pgsqlPgAggregateTable pre-request actions. + */ + + return MFD_SUCCESS; +} /* pgsqlPgAggregateTable_pre_request */ + +/** + * post-request callback + * + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error (ignored) + */ +int +pgsqlPgAggregateTable_post_request(pgsqlPgAggregateTable_registration_ptr user_context) +{ + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateTable_post_request","called\n")); + + /* + * TODO:511:o: Perform pgsqlPgAggregateTable pos-request actions. + */ + + return MFD_SUCCESS; +} /* pgsqlPgAggregateTable_post_request */ + + +/** @{ */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable.h b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable.h new file mode 100644 index 0000000..18c7e4d --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable.h @@ -0,0 +1,221 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.32.2.3 $ of : mfd-top.m2c,v $ + * + * $Id: pgsqlPgAggregateTable.h,v 1.1 2008/01/17 11:49:24 eggyknap Exp $ + */ +#ifndef PGSQLPGAGGREGATETABLE_H +#define PGSQLPGAGGREGATETABLE_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(PGSQL-MIB/pgsqlPgAggregateTable/pgsqlPgAggregateTable_interface); +config_require(PGSQL-MIB/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_access); +config_require(PGSQL-MIB/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_get); +config_require(PGSQL-MIB/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_set); + /* *INDENT-ON* */ + +/* OID and column number definitions for */ +#include "pgsqlPgAggregateTable_oids.h" + +/* enum definions */ +#include "pgsqlPgAggregateTable_enums.h" + +/* ********************************************************************* + * function declarations + */ +void init_pgsqlPgAggregateTable(void); + +/* ********************************************************************* + * Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table pgsqlPgAggregateTable + *** + ********************************************************************** + **********************************************************************/ +/* + * pgsqlPgAggregateTable is subid 1 of pgsqlCatalogTables. + * Its status is Current. + * OID: .1.3.6.1.4.1.27645.1.2.1, length: 10 +*/ +/* ********************************************************************* + * 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 pgsqlPgAggregateTable registration context. + */ +typedef netsnmp_data_list * pgsqlPgAggregateTable_registration_ptr; + +/**********************************************************************/ +/* + * TODO:110:r: |-> Review pgsqlPgAggregateTable data context structure. + * This structure is used to represent the data for pgsqlPgAggregateTable. + */ +/* + * This structure contains storage for all the columns defined in the + * pgsqlPgAggregateTable. + */ +typedef struct pgsqlPgAggregateTable_data_s { + + /* + * pgsqlPgAggregateAggfnoid(2)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAggregateAggfnoid; + + /* + * pgsqlPgAggregateAggtransfn(3)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAggregateAggtransfn; + + /* + * pgsqlPgAggregateAggfinalfn(4)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAggregateAggfinalfn; + + /* + * pgsqlPgAggregateAggsortop(5)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAggregateAggsortop; + + /* + * pgsqlPgAggregateAggtranstype(6)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAggregateAggtranstype; + + /* + * pgsqlPgAggregateAgginitval(7)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H + */ + char pgsqlPgAggregateAgginitval[255]; +size_t pgsqlPgAggregateAgginitval_len; /* # of char elements, not bytes */ + +} pgsqlPgAggregateTable_data; + + +/* + * TODO:120:r: |-> Review pgsqlPgAggregateTable mib index. + * This structure is used to represent the index for pgsqlPgAggregateTable. + */ +typedef struct pgsqlPgAggregateTable_mib_index_s { + + /* + * pgsnmpdConnID(1)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H + */ + /** 128 - 2(other indexes) - oid length(12) = 113 */ + char pgsnmpdConnID[113]; + size_t pgsnmpdConnID_len; + + /* + * rdbmsDbIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h + */ + long rdbmsDbIndex; + + /* + * pgsqlPgAggregateEntryOID(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/r/d/h + */ + long pgsqlPgAggregateEntryOID; + + +} pgsqlPgAggregateTable_mib_index; + + /* + * TODO:121:r: | |-> Review pgsqlPgAggregateTable max index length. + * If you KNOW that your indexes will never exceed a certain + * length, update this macro to that length. + * + * BE VERY CAREFUL TO TAKE INTO ACCOUNT THE MAXIMUM + * POSSIBLE LENGHT FOR EVERY VARIABLE LENGTH INDEX! + * Guessing 128 - col/entry(2) - oid len(10) +*/ +#define MAX_pgsqlPgAggregateTable_IDX_LEN 116 + + +/* ********************************************************************* + * TODO:130:o: |-> Review pgsqlPgAggregateTable Row request (rowreq) context. + * When your functions are called, you will be passed a + * pgsqlPgAggregateTable_rowreq_ctx pointer. + */ +typedef struct pgsqlPgAggregateTable_rowreq_ctx_s { + + /** this must be first for container compare to work */ + netsnmp_index oid_idx; + oid oid_tmp[MAX_pgsqlPgAggregateTable_IDX_LEN]; + + pgsqlPgAggregateTable_mib_index tbl_idx; + + pgsqlPgAggregateTable_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) + */ + pgsqlPgAggregateTable_registration_ptr pgsqlPgAggregateTable_reg; + + /* + * TODO:131:o: | |-> Add useful data to pgsqlPgAggregateTable rowreq context. + */ + + /* + * storage for future expansion + */ + netsnmp_data_list *pgsqlPgAggregateTable_data_list; + +} pgsqlPgAggregateTable_rowreq_ctx; + +typedef struct pgsqlPgAggregateTable_ref_rowreq_ctx_s { + pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx; +} pgsqlPgAggregateTable_ref_rowreq_ctx; + +/* ********************************************************************* + * function prototypes + */ + int pgsqlPgAggregateTable_pre_request(pgsqlPgAggregateTable_registration_ptr user_context); + int pgsqlPgAggregateTable_post_request(pgsqlPgAggregateTable_registration_ptr user_context); + + +extern oid pgsqlPgAggregateTable_oid[]; +extern int pgsqlPgAggregateTable_oid_size; + + +#include "pgsqlPgAggregateTable_interface.h" +#include "pgsqlPgAggregateTable_data_access.h" +#include "pgsqlPgAggregateTable_data_get.h" +#include "pgsqlPgAggregateTable_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 /* PGSQLPGAGGREGATETABLE_H */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_access.c b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_access.c new file mode 100644 index 0000000..2f55780 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_access.c @@ -0,0 +1,297 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.12 $ of : mfd-data-access.m2c,v $ + * + * $Id: pgsqlPgAggregateTable_data_access.c,v 1.2 2008/01/17 12:29:36 eggyknap Exp $ + */ +#include "pgsnmpd.h" + +/* include our parent header */ +#include "pgsqlPgAggregateTable.h" +#include "pgsqlPgAggregateTable_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 pgsqlPgAggregateTable + *** + ********************************************************************** + **********************************************************************/ +/* + * pgsqlPgAggregateTable is subid 1 of pgsqlCatalogTables. + * Its status is Current. + * OID: .1.3.6.1.4.1.27645.1.2.1, length: 10 +*/ + +/** + * initialization for pgsqlPgAggregateTable data access + * + * This function is called during startup to allow you to + * allocate any resources you need for the data table. + * + * @param pgsqlPgAggregateTable_reg + * Pointer to pgsqlPgAggregateTable_registration + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : unrecoverable error. + */ +int +pgsqlPgAggregateTable_init_data(pgsqlPgAggregateTable_registration_ptr pgsqlPgAggregateTable_reg) +{ + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateTable_init_data","called\n")); + + /* + * TODO:303:o: Initialize pgsqlPgAggregateTable data. + */ + + return MFD_SUCCESS; +} /* pgsqlPgAggregateTable_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 +pgsqlPgAggregateTable_container_init(netsnmp_container **container_ptr_ptr, + netsnmp_cache *cache) +{ + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateTable_container_init","called\n")); + + if((NULL == cache) || (NULL == container_ptr_ptr)) { + snmp_log(LOG_ERR,"bad params to pgsqlPgAggregateTable_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 pgsqlPgAggregateTable 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 = PGSQLPGAGGREGATETABLE_CACHE_TIMEOUT; /* seconds */ +} /* pgsqlPgAggregateTable_container_init */ + +/** + * load cache data + * + * TODO:350:M: Implement pgsqlPgAggregateTable 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 + * pgsqlPgAggregateTable_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 +pgsqlPgAggregateTable_cache_load(netsnmp_container *container) +{ + pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx; + size_t count = 0; + + char pgsnmpdConnID[112] = "Default conn ID"; + size_t pgsnmpdConnID_len = strlen(pgsnmpdConnID); + long rdbmsDbIndex = 1; + int i, resultCount, tmpInt; + char *tmpString; + PGresult *pg_db_qry; + +snmp_log(LOG_INFO, "Running pgsqlPgAggregateTable\n"); + if (PQstatus(dbconn) == CONNECTION_OK) + pg_db_qry = PQexec(dbconn, "SELECT aggfnoid::INTEGER, aggfnoid, aggtransfn, aggfinalfn, aggsortop, aggtranstype, agginitval FROM pg_aggregate ORDER BY 1 ASC"); + else { + snmp_log(LOG_ERR, "Can't get connected to database\n"); + return MFD_RESOURCE_UNAVAILABLE; + } + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateTable_cache_load","called\n")); + + if (PQresultStatus(pg_db_qry) != PGRES_TUPLES_OK) { + snmp_log(LOG_ERR, "Didn't get any results from the database\n"); + PQclear(pg_db_qry); + return MFD_RESOURCE_UNAVAILABLE; + } + resultCount = PQntuples(pg_db_qry); + + /* + * TODO:351:M: |-> Load/update data in the pgsqlPgAggregateTable container. + * loop over your pgsqlPgAggregateTable data, allocate a rowreq context, + * set the index(es) [and data, optionally] and insert into + * the container. + */ + for (i = 0; i < resultCount; i++) { + + /* + * TODO:352:M: | |-> set indexes in new pgsqlPgAggregateTable rowreq context. + */ + rowreq_ctx = pgsqlPgAggregateTable_allocate_rowreq_ctx(); + if (NULL == rowreq_ctx) { + snmp_log(LOG_ERR, "memory allocation failed\n"); + return MFD_RESOURCE_UNAVAILABLE; + } + if(MFD_SUCCESS != pgsqlPgAggregateTable_indexes_set(rowreq_ctx + , pgsnmpdConnID, pgsnmpdConnID_len + , rdbmsDbIndex + , atol(PQgetvalue(pg_db_qry, i, 0)) + )) { + snmp_log(LOG_ERR,"error setting index while loading " + "pgsqlPgAggregateTable cache.\n"); + pgsqlPgAggregateTable_release_rowreq_ctx(rowreq_ctx); + continue; + } + rowreq_ctx->data.pgsqlPgAggregateAgginitval_len = 255; + + rowreq_ctx->data.pgsqlPgAggregateAggfnoid = strtoul(PQgetvalue(pg_db_qry, i, 1), NULL, 10); + + rowreq_ctx->data.pgsqlPgAggregateAggtransfn = strtoul(PQgetvalue(pg_db_qry, i, 2), NULL, 10); + + rowreq_ctx->data.pgsqlPgAggregateAggfinalfn = strtoul(PQgetvalue(pg_db_qry, i, 3), NULL, 10); + + rowreq_ctx->data.pgsqlPgAggregateAggsortop = strtoul(PQgetvalue(pg_db_qry, i, 4), NULL, 10); + + rowreq_ctx->data.pgsqlPgAggregateAggtranstype = strtoul(PQgetvalue(pg_db_qry, i, 5), NULL, 10); + + tmpString = PQgetvalue(pg_db_qry, i, 6); + tmpInt = strlen(tmpString); + if ((NULL == rowreq_ctx->data.pgsqlPgAggregateAgginitval) || + (rowreq_ctx->data.pgsqlPgAggregateAgginitval_len < (tmpInt * sizeof(rowreq_ctx->data.pgsqlPgAggregateAgginitval[0])))) { + snmp_log(LOG_ERR,"not enough space for value\n"); + return MFD_ERROR; + } + rowreq_ctx->data.pgsqlPgAggregateAgginitval_len = tmpInt * sizeof(rowreq_ctx->data.pgsqlPgAggregateAgginitval[0]); + memcpy( rowreq_ctx->data.pgsqlPgAggregateAgginitval, tmpString, rowreq_ctx->data.pgsqlPgAggregateAgginitval_len ); + + + /* + * insert into table container + */ + CONTAINER_INSERT(container, rowreq_ctx); + ++count; + } + + + DEBUGMSGT(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateTable_cache_load", + "inserted %d records\n", count)); + PQclear(pg_db_qry); + + return MFD_SUCCESS; +} /* pgsqlPgAggregateTable_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 +pgsqlPgAggregateTable_cache_free(netsnmp_container *container) +{ + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateTable_cache_free","called\n")); + + /* + * TODO:380:M: Free pgsqlPgAggregateTable cache. + */ +} /* pgsqlPgAggregateTable_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 +pgsqlPgAggregateTable_row_prep( pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx) +{ + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateTable_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; +} /* pgsqlPgAggregateTable_row_prep */ + +/** @} */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_access.h b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_access.h new file mode 100644 index 0000000..6831083 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_access.h @@ -0,0 +1,70 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.12 $ of : mfd-data-access.m2c,v $ + * + * $Id: pgsqlPgAggregateTable_data_access.h,v 1.1 2008/01/17 11:49:24 eggyknap Exp $ + */ +#ifndef PGSQLPGAGGREGATETABLE_DATA_ACCESS_H +#define PGSQLPGAGGREGATETABLE_DATA_ACCESS_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* ********************************************************************* + * function declarations + */ + +/* ********************************************************************* + * Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table pgsqlPgAggregateTable + *** + ********************************************************************** + **********************************************************************/ +/* + * pgsqlPgAggregateTable is subid 1 of pgsqlCatalogTables. + * Its status is Current. + * OID: .1.3.6.1.4.1.27645.1.2.1, length: 10 +*/ + + + int pgsqlPgAggregateTable_init_data(pgsqlPgAggregateTable_registration_ptr pgsqlPgAggregateTable_reg); + + +/* + * TODO:180:o: Review pgsqlPgAggregateTable cache timeout. + * The number of seconds before the cache times out + */ +#define PGSQLPGAGGREGATETABLE_CACHE_TIMEOUT 60 + +void pgsqlPgAggregateTable_container_init(netsnmp_container **container_ptr_ptr, + netsnmp_cache *cache); +int pgsqlPgAggregateTable_cache_load(netsnmp_container *container); +void pgsqlPgAggregateTable_cache_free(netsnmp_container *container); + + /* + *************************************************** + *** START EXAMPLE CODE *** + ***---------------------------------------------***/ +/* ********************************************************************* + * Since we have no idea how you really access your data, we'll go with + * a worst case example: a flat text file. + */ +#define MAX_LINE_SIZE 256 + /* + ***---------------------------------------------*** + *** END EXAMPLE CODE *** + ***************************************************/ + int pgsqlPgAggregateTable_row_prep( pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx); + + +#ifdef __cplusplus +} +#endif + +#endif /* PGSQLPGAGGREGATETABLE_DATA_ACCESS_H */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_get.c b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_get.c new file mode 100644 index 0000000..c156328 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_get.c @@ -0,0 +1,839 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.18.2.1 $ of : mfd-data-get.m2c,v $ + * + * $Id: pgsqlPgAggregateTable_data_get.c,v 1.1 2008/01/17 11:49:24 eggyknap 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 "pgsqlPgAggregateTable.h" + + +/** @defgroup data_get data_get: Routines to get data + * + * TODO:230:M: Implement pgsqlPgAggregateTable get routines. + * TODO:240:M: Implement pgsqlPgAggregateTable 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 pgsqlPgAggregateTable + *** + ********************************************************************** + **********************************************************************/ +/* + * pgsqlPgAggregateTable is subid 1 of pgsqlCatalogTables. + * Its status is Current. + * OID: .1.3.6.1.4.1.27645.1.2.1, length: 10 +*/ + +/* --------------------------------------------------------------------- + * TODO:200:r: Implement pgsqlPgAggregateTable data context functions. + */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsnmpdConnectionEntry.pgsnmpdConnID + * pgsnmpdConnID is subid 1 of pgsnmpdConnectionEntry. + * Its status is Current, and its access level is NoAccess. + * OID: .1.3.6.1.4.1.27645.1.1.1.1.1 + * Description: +Identifying string for this connection. Default is host:port:database. + * + * Attributes: + * accessible 0 isscalar 0 enums 0 hasdefval 0 + * readable 0 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) + * + * + * + * NOTE: NODE pgsnmpdConnID 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-pgsnmpdConnID.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 +pgsnmpdConnID_map(char **mib_pgsnmpdConnID_val_ptr_ptr, size_t *mib_pgsnmpdConnID_val_ptr_len_ptr, char *raw_pgsnmpdConnID_val_ptr, size_t raw_pgsnmpdConnID_val_ptr_len, int allow_realloc) +{ + int converted_len; + + netsnmp_assert(NULL != raw_pgsnmpdConnID_val_ptr); + netsnmp_assert((NULL != mib_pgsnmpdConnID_val_ptr_ptr) && (NULL != mib_pgsnmpdConnID_val_ptr_len_ptr)); + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsnmpdConnID_map","called\n")); + + /* + * TODO:241:r: |-> Implement pgsnmpdConnID 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_pgsnmpdConnID_val_ptr_len; /* assume equal */ + if((NULL == *mib_pgsnmpdConnID_val_ptr_ptr) || (*mib_pgsnmpdConnID_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_pgsnmpdConnID_val_ptr_ptr = realloc( *mib_pgsnmpdConnID_val_ptr_ptr, converted_len * sizeof(**mib_pgsnmpdConnID_val_ptr_ptr)); + if(NULL == *mib_pgsnmpdConnID_val_ptr_ptr) { + snmp_log(LOG_ERR,"could not allocate memory\n"); + return SNMP_ERR_GENERR; + } + } + *mib_pgsnmpdConnID_val_ptr_len_ptr = converted_len; + memcpy( *mib_pgsnmpdConnID_val_ptr_ptr, raw_pgsnmpdConnID_val_ptr, converted_len ); + + return MFD_SUCCESS; +} /* pgsnmpdConnID_map */ + + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAggregateEntry.pgsqlPgAggregateEntryOID + * pgsqlPgAggregateEntryOID is subid 1 of pgsqlPgAggregateEntry. + * Its status is Current, and its access level is NoAccess. + * OID: .1.3.6.1.4.1.27645.1.2.1.1.1 + * Description: +OID of this entry + * + * Attributes: + * accessible 0 isscalar 0 enums 0 hasdefval 0 + * readable 0 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + * + * + * + * NOTE: NODE pgsqlPgAggregateEntryOID 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-pgsqlPgAggregateEntryOID.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 +pgsqlPgAggregateEntryOID_map(long *mib_pgsqlPgAggregateEntryOID_val_ptr, long raw_pgsqlPgAggregateEntryOID_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAggregateEntryOID_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateEntryOID_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAggregateEntryOID 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_pgsqlPgAggregateEntryOID_val_ptr) = raw_pgsqlPgAggregateEntryOID_val; + + return MFD_SUCCESS; +} /* pgsqlPgAggregateEntryOID_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 +pgsqlPgAggregateTable_indexes_set_tbl_idx(pgsqlPgAggregateTable_mib_index *tbl_idx, char *pgsnmpdConnID_val_ptr, size_t pgsnmpdConnID_val_ptr_len, long rdbmsDbIndex_val, long pgsqlPgAggregateEntryOID_val) +{ + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateTable_indexes_set_tbl_idx","called\n")); + + /* pgsnmpdConnID(1)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H */ + tbl_idx->pgsnmpdConnID_len = sizeof(tbl_idx->pgsnmpdConnID); + /* + * make sure there is enough space for pgsnmpdConnID data + */ + if ((NULL == tbl_idx->pgsnmpdConnID) || + (tbl_idx->pgsnmpdConnID_len < (pgsnmpdConnID_val_ptr_len * sizeof(tbl_idx->pgsnmpdConnID[0])))) { + snmp_log(LOG_ERR,"not enough space for value\n"); + return MFD_ERROR; + } + tbl_idx->pgsnmpdConnID_len = pgsnmpdConnID_val_ptr_len * sizeof(tbl_idx->pgsnmpdConnID[0]); + memcpy( tbl_idx->pgsnmpdConnID, pgsnmpdConnID_val_ptr, tbl_idx->pgsnmpdConnID_len ); + + /* rdbmsDbIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h */ + tbl_idx->rdbmsDbIndex = rdbmsDbIndex_val; + + /* pgsqlPgAggregateEntryOID(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/r/d/h */ + tbl_idx->pgsqlPgAggregateEntryOID = pgsqlPgAggregateEntryOID_val; + + + return MFD_SUCCESS; +} /* pgsqlPgAggregateTable_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 +pgsqlPgAggregateTable_indexes_set(pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx, char *pgsnmpdConnID_val_ptr, size_t pgsnmpdConnID_val_ptr_len, long rdbmsDbIndex_val, long pgsqlPgAggregateEntryOID_val) +{ + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateTable_indexes_set","called\n")); + + if(MFD_SUCCESS != pgsqlPgAggregateTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx + , pgsnmpdConnID_val_ptr, pgsnmpdConnID_val_ptr_len + , rdbmsDbIndex_val + , pgsqlPgAggregateEntryOID_val + )) + return MFD_ERROR; + + /* + * convert mib index to oid index + */ + rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid); + if(0 != pgsqlPgAggregateTable_index_to_oid(&rowreq_ctx->oid_idx, + &rowreq_ctx->tbl_idx)) { + return MFD_ERROR; + } + + return MFD_SUCCESS; +} /* pgsqlPgAggregateTable_indexes_set */ + + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAggregateEntry.pgsqlPgAggregateAggfnoid + * pgsqlPgAggregateAggfnoid is subid 2 of pgsqlPgAggregateEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.1.1.2 + * Description: +pg_proc OID of the aggregate function + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAggregateAggfnoid.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 +pgsqlPgAggregateAggfnoid_map(long *mib_pgsqlPgAggregateAggfnoid_val_ptr, long raw_pgsqlPgAggregateAggfnoid_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAggregateAggfnoid_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateAggfnoid_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAggregateAggfnoid 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_pgsqlPgAggregateAggfnoid_val_ptr) = raw_pgsqlPgAggregateAggfnoid_val; + + return MFD_SUCCESS; +} /* pgsqlPgAggregateAggfnoid_map */ + +/** + * Extract the current value of the pgsqlPgAggregateAggfnoid data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAggregateAggfnoid_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAggregateAggfnoid_get( pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAggregateAggfnoid_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAggregateAggfnoid_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateAggfnoid_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAggregateAggfnoid data. + * set (* pgsqlPgAggregateAggfnoid_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAggregateAggfnoid_val_ptr ) = rowreq_ctx->data.pgsqlPgAggregateAggfnoid; + + return MFD_SUCCESS; +} /* pgsqlPgAggregateAggfnoid_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAggregateEntry.pgsqlPgAggregateAggtransfn + * pgsqlPgAggregateAggtransfn is subid 3 of pgsqlPgAggregateEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.1.1.3 + * Description: +Transition function + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAggregateAggtransfn.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 +pgsqlPgAggregateAggtransfn_map(long *mib_pgsqlPgAggregateAggtransfn_val_ptr, long raw_pgsqlPgAggregateAggtransfn_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAggregateAggtransfn_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateAggtransfn_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAggregateAggtransfn 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_pgsqlPgAggregateAggtransfn_val_ptr) = raw_pgsqlPgAggregateAggtransfn_val; + + return MFD_SUCCESS; +} /* pgsqlPgAggregateAggtransfn_map */ + +/** + * Extract the current value of the pgsqlPgAggregateAggtransfn data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAggregateAggtransfn_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAggregateAggtransfn_get( pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAggregateAggtransfn_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAggregateAggtransfn_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateAggtransfn_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAggregateAggtransfn data. + * set (* pgsqlPgAggregateAggtransfn_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAggregateAggtransfn_val_ptr ) = rowreq_ctx->data.pgsqlPgAggregateAggtransfn; + + return MFD_SUCCESS; +} /* pgsqlPgAggregateAggtransfn_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAggregateEntry.pgsqlPgAggregateAggfinalfn + * pgsqlPgAggregateAggfinalfn is subid 4 of pgsqlPgAggregateEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.1.1.4 + * Description: +Final function (zero if none) + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAggregateAggfinalfn.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 +pgsqlPgAggregateAggfinalfn_map(long *mib_pgsqlPgAggregateAggfinalfn_val_ptr, long raw_pgsqlPgAggregateAggfinalfn_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAggregateAggfinalfn_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateAggfinalfn_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAggregateAggfinalfn 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_pgsqlPgAggregateAggfinalfn_val_ptr) = raw_pgsqlPgAggregateAggfinalfn_val; + + return MFD_SUCCESS; +} /* pgsqlPgAggregateAggfinalfn_map */ + +/** + * Extract the current value of the pgsqlPgAggregateAggfinalfn data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAggregateAggfinalfn_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAggregateAggfinalfn_get( pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAggregateAggfinalfn_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAggregateAggfinalfn_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateAggfinalfn_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAggregateAggfinalfn data. + * set (* pgsqlPgAggregateAggfinalfn_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAggregateAggfinalfn_val_ptr ) = rowreq_ctx->data.pgsqlPgAggregateAggfinalfn; + + return MFD_SUCCESS; +} /* pgsqlPgAggregateAggfinalfn_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAggregateEntry.pgsqlPgAggregateAggsortop + * pgsqlPgAggregateAggsortop is subid 5 of pgsqlPgAggregateEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.1.1.5 + * Description: +Associated sort operator (zero if none) + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAggregateAggsortop.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 +pgsqlPgAggregateAggsortop_map(long *mib_pgsqlPgAggregateAggsortop_val_ptr, long raw_pgsqlPgAggregateAggsortop_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAggregateAggsortop_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateAggsortop_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAggregateAggsortop 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_pgsqlPgAggregateAggsortop_val_ptr) = raw_pgsqlPgAggregateAggsortop_val; + + return MFD_SUCCESS; +} /* pgsqlPgAggregateAggsortop_map */ + +/** + * Extract the current value of the pgsqlPgAggregateAggsortop data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAggregateAggsortop_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAggregateAggsortop_get( pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAggregateAggsortop_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAggregateAggsortop_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateAggsortop_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAggregateAggsortop data. + * set (* pgsqlPgAggregateAggsortop_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAggregateAggsortop_val_ptr ) = rowreq_ctx->data.pgsqlPgAggregateAggsortop; + + return MFD_SUCCESS; +} /* pgsqlPgAggregateAggsortop_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAggregateEntry.pgsqlPgAggregateAggtranstype + * pgsqlPgAggregateAggtranstype is subid 6 of pgsqlPgAggregateEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.1.1.6 + * Description: +Data type of the aggregate function's internal transition (state) data + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAggregateAggtranstype.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 +pgsqlPgAggregateAggtranstype_map(long *mib_pgsqlPgAggregateAggtranstype_val_ptr, long raw_pgsqlPgAggregateAggtranstype_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAggregateAggtranstype_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateAggtranstype_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAggregateAggtranstype 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_pgsqlPgAggregateAggtranstype_val_ptr) = raw_pgsqlPgAggregateAggtranstype_val; + + return MFD_SUCCESS; +} /* pgsqlPgAggregateAggtranstype_map */ + +/** + * Extract the current value of the pgsqlPgAggregateAggtranstype data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAggregateAggtranstype_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAggregateAggtranstype_get( pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAggregateAggtranstype_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAggregateAggtranstype_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateAggtranstype_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAggregateAggtranstype data. + * set (* pgsqlPgAggregateAggtranstype_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAggregateAggtranstype_val_ptr ) = rowreq_ctx->data.pgsqlPgAggregateAggtranstype; + + return MFD_SUCCESS; +} /* pgsqlPgAggregateAggtranstype_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAggregateEntry.pgsqlPgAggregateAgginitval + * pgsqlPgAggregateAgginitval is subid 7 of pgsqlPgAggregateEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.1.1.7 + * Description: +The initial value of the transition state. This is a text field containing the initial value in its external string representation. If this field is NULL, the transition state value starts out NULL + * + * 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-pgsqlPgAggregateAgginitval.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 +pgsqlPgAggregateAgginitval_map(char **mib_pgsqlPgAggregateAgginitval_val_ptr_ptr, size_t *mib_pgsqlPgAggregateAgginitval_val_ptr_len_ptr, char *raw_pgsqlPgAggregateAgginitval_val_ptr, size_t raw_pgsqlPgAggregateAgginitval_val_ptr_len, int allow_realloc) +{ + int converted_len; + + netsnmp_assert(NULL != raw_pgsqlPgAggregateAgginitval_val_ptr); + netsnmp_assert((NULL != mib_pgsqlPgAggregateAgginitval_val_ptr_ptr) && (NULL != mib_pgsqlPgAggregateAgginitval_val_ptr_len_ptr)); + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateAgginitval_map","called\n")); + + /* + * TODO:241:r: |-> Implement pgsqlPgAggregateAgginitval 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_pgsqlPgAggregateAgginitval_val_ptr_len; /* assume equal */ + if((NULL == *mib_pgsqlPgAggregateAgginitval_val_ptr_ptr) || (*mib_pgsqlPgAggregateAgginitval_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_pgsqlPgAggregateAgginitval_val_ptr_ptr = realloc( *mib_pgsqlPgAggregateAgginitval_val_ptr_ptr, converted_len * sizeof(**mib_pgsqlPgAggregateAgginitval_val_ptr_ptr)); + if(NULL == *mib_pgsqlPgAggregateAgginitval_val_ptr_ptr) { + snmp_log(LOG_ERR,"could not allocate memory\n"); + return SNMP_ERR_GENERR; + } + } + *mib_pgsqlPgAggregateAgginitval_val_ptr_len_ptr = converted_len; + memcpy( *mib_pgsqlPgAggregateAgginitval_val_ptr_ptr, raw_pgsqlPgAggregateAgginitval_val_ptr, converted_len ); + + return MFD_SUCCESS; +} /* pgsqlPgAggregateAgginitval_map */ + +/** + * Extract the current value of the pgsqlPgAggregateAgginitval data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAggregateAgginitval_val_ptr_ptr + * Pointer to storage for a char variable + * @param pgsqlPgAggregateAgginitval_val_ptr_len_ptr + * Pointer to a size_t. On entry, it will contain the size (in bytes) + * pointed to by pgsqlPgAggregateAgginitval. + * 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 (*pgsqlPgAggregateAgginitval_val_ptr_len_ptr) bytes of memory, + * allocate it using malloc() and update pgsqlPgAggregateAgginitval_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 +pgsqlPgAggregateAgginitval_get( pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx, char **pgsqlPgAggregateAgginitval_val_ptr_ptr, size_t *pgsqlPgAggregateAgginitval_val_ptr_len_ptr ) +{ + /** we should have a non-NULL pointer and enough storage */ + netsnmp_assert( (NULL != pgsqlPgAggregateAgginitval_val_ptr_ptr) && (NULL != *pgsqlPgAggregateAgginitval_val_ptr_ptr)); + netsnmp_assert( NULL != pgsqlPgAggregateAgginitval_val_ptr_len_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateAgginitval_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAggregateAgginitval data. + * set (* pgsqlPgAggregateAgginitval_val_ptr_ptr ) and (* pgsqlPgAggregateAgginitval_val_ptr_len_ptr ) from rowreq_ctx->data + */ + /* + * make sure there is enough space for pgsqlPgAggregateAgginitval data + */ + if ((NULL == (* pgsqlPgAggregateAgginitval_val_ptr_ptr )) || + ((* pgsqlPgAggregateAgginitval_val_ptr_len_ptr ) < (rowreq_ctx->data.pgsqlPgAggregateAgginitval_len * sizeof((* pgsqlPgAggregateAgginitval_val_ptr_ptr )[0])))) { + /* + * allocate space for pgsqlPgAggregateAgginitval data + */ + (* pgsqlPgAggregateAgginitval_val_ptr_ptr ) = malloc(rowreq_ctx->data.pgsqlPgAggregateAgginitval_len * sizeof((* pgsqlPgAggregateAgginitval_val_ptr_ptr )[0])); + if(NULL == (* pgsqlPgAggregateAgginitval_val_ptr_ptr )) { + snmp_log(LOG_ERR,"could not allocate memory\n"); + return MFD_ERROR; + } + } + (* pgsqlPgAggregateAgginitval_val_ptr_len_ptr ) = rowreq_ctx->data.pgsqlPgAggregateAgginitval_len * sizeof((* pgsqlPgAggregateAgginitval_val_ptr_ptr )[0]); + memcpy( (* pgsqlPgAggregateAgginitval_val_ptr_ptr ), rowreq_ctx->data.pgsqlPgAggregateAgginitval, (* pgsqlPgAggregateAgginitval_val_ptr_len_ptr ) ); + + return MFD_SUCCESS; +} /* pgsqlPgAggregateAgginitval_get */ + + + +/** @} */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_get.h b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_get.h new file mode 100644 index 0000000..c5c1e73 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_get.h @@ -0,0 +1,72 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.18.2.1 $ of : mfd-data-get.m2c,v $ + * + * $Id: pgsqlPgAggregateTable_data_get.h,v 1.1 2008/01/17 11:49:24 eggyknap Exp $ + * + * @file pgsqlPgAggregateTable_data_get.h + * + * @addtogroup get + * + * Prototypes for get functions + * + * @{ + */ +#ifndef PGSQLPGAGGREGATETABLE_DATA_GET_H +#define PGSQLPGAGGREGATETABLE_DATA_GET_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* ********************************************************************* + * GET function declarations + */ + +/* ********************************************************************* + * GET Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table pgsqlPgAggregateTable + *** + ********************************************************************** + **********************************************************************/ +/* + * pgsqlPgAggregateTable is subid 1 of pgsqlCatalogTables. + * Its status is Current. + * OID: .1.3.6.1.4.1.27645.1.2.1, length: 10 +*/ + /* + * indexes + */ + int pgsnmpdConnID_map(char **mib_pgsnmpdConnID_val_ptr_ptr, size_t *mib_pgsnmpdConnID_val_ptr_len_ptr, char *raw_pgsnmpdConnID_val_ptr, size_t raw_pgsnmpdConnID_val_ptr_len, int allow_realloc); + int pgsqlPgAggregateEntryOID_map(long *mib_pgsqlPgAggregateEntryOID_val_ptr, long raw_pgsqlPgAggregateEntryOID_val); + + int pgsqlPgAggregateAggfnoid_map(long *mib_pgsqlPgAggregateAggfnoid_val_ptr, long raw_pgsqlPgAggregateAggfnoid_val); + int pgsqlPgAggregateAggfnoid_get( pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAggregateAggfnoid_val_ptr ); + int pgsqlPgAggregateAggtransfn_map(long *mib_pgsqlPgAggregateAggtransfn_val_ptr, long raw_pgsqlPgAggregateAggtransfn_val); + int pgsqlPgAggregateAggtransfn_get( pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAggregateAggtransfn_val_ptr ); + int pgsqlPgAggregateAggfinalfn_map(long *mib_pgsqlPgAggregateAggfinalfn_val_ptr, long raw_pgsqlPgAggregateAggfinalfn_val); + int pgsqlPgAggregateAggfinalfn_get( pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAggregateAggfinalfn_val_ptr ); + int pgsqlPgAggregateAggsortop_map(long *mib_pgsqlPgAggregateAggsortop_val_ptr, long raw_pgsqlPgAggregateAggsortop_val); + int pgsqlPgAggregateAggsortop_get( pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAggregateAggsortop_val_ptr ); + int pgsqlPgAggregateAggtranstype_map(long *mib_pgsqlPgAggregateAggtranstype_val_ptr, long raw_pgsqlPgAggregateAggtranstype_val); + int pgsqlPgAggregateAggtranstype_get( pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAggregateAggtranstype_val_ptr ); + int pgsqlPgAggregateAgginitval_map(char **mib_pgsqlPgAggregateAgginitval_val_ptr_ptr, size_t *mib_pgsqlPgAggregateAgginitval_val_ptr_len_ptr, char *raw_pgsqlPgAggregateAgginitval_val_ptr, size_t raw_pgsqlPgAggregateAgginitval_val_ptr_len, int allow_realloc); + int pgsqlPgAggregateAgginitval_get( pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx, char **pgsqlPgAggregateAgginitval_val_ptr_ptr, size_t *pgsqlPgAggregateAgginitval_val_ptr_len_ptr ); + + +int pgsqlPgAggregateTable_indexes_set_tbl_idx(pgsqlPgAggregateTable_mib_index *tbl_idx, char *pgsnmpdConnID_val_ptr, size_t pgsnmpdConnID_val_ptr_len, long rdbmsDbIndex_val, long pgsqlPgAggregateEntryOID_val); +int pgsqlPgAggregateTable_indexes_set(pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx, char *pgsnmpdConnID_val_ptr, size_t pgsnmpdConnID_val_ptr_len, long rdbmsDbIndex_val, long pgsqlPgAggregateEntryOID_val); + + + + +#ifdef __cplusplus +} +#endif + +#endif /* PGSQLPGAGGREGATETABLE_DATA_GET_H */ +/** @} */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_set.c b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_set.c new file mode 100644 index 0000000..b266046 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_set.c @@ -0,0 +1,24 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.18 $ of : mfd-data-set.m2c,v $ + * + * $Id: pgsqlPgAggregateTable_data_set.c,v 1.1 2008/01/17 11:49:24 eggyknap 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 "pgsqlPgAggregateTable.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/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_set.h b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_set.h new file mode 100644 index 0000000..52061bc --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_data_set.h @@ -0,0 +1,27 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.18 $ of : mfd-data-set.m2c,v $ + * + * $Id: pgsqlPgAggregateTable_data_set.h,v 1.1 2008/01/17 11:49:24 eggyknap Exp $ + */ +#ifndef PGSQLPGAGGREGATETABLE_DATA_SET_H +#define PGSQLPGAGGREGATETABLE_DATA_SET_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* ********************************************************************* + * SET function declarations + */ + +/* ********************************************************************* + * SET Table declarations + */ + + +#ifdef __cplusplus +} +#endif + +#endif /* PGSQLPGAGGREGATETABLE_DATA_SET_H */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_enums.h b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_enums.h new file mode 100644 index 0000000..161cc07 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_enums.h @@ -0,0 +1,40 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : generic-table-enums.m2c,v 1.3 2004/05/18 17:44:32 rstory Exp $ + * + * $Id: pgsqlPgAggregateTable_enums.h,v 1.1 2008/01/17 11:49:24 eggyknap Exp $ + */ +#ifndef PGSQLPGAGGREGATETABLE_ENUMS_H +#define PGSQLPGAGGREGATETABLE_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 pgsqlPgAggregateTable + * + ************************************************************************* + *************************************************************************/ + + + +#ifdef __cplusplus +} +#endif + +#endif /* PGSQLPGAGGREGATETABLE_ENUMS_H */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_interface.c b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_interface.c new file mode 100644 index 0000000..8215a2d --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_interface.c @@ -0,0 +1,784 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.43.2.3 $ of : mfd-interface.m2c,v $ + * + * $Id: pgsqlPgAggregateTable_interface.c,v 1.1 2008/01/17 11:49:24 eggyknap Exp $ + */ +/* + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + * *** *** + * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** + * *** *** + * *** *** + * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** + * *** *** + * *** *** + * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** + * *** *** + * *** *** + * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** + * *** *** + * *** *** + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + */ + +/* 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 "pgsqlPgAggregateTable.h" + + +#include <net-snmp/library/container.h> + +#include "pgsqlPgAggregateTable_interface.h" + +/********************************************************************** + ********************************************************************** + *** + *** Table pgsqlPgAggregateTable + *** + ********************************************************************** + **********************************************************************/ +/* + * pgsqlPgAggregateTable is subid 1 of pgsqlCatalogTables. + * Its status is Current. + * OID: .1.3.6.1.4.1.27645.1.2.1, length: 10 +*/ +typedef struct pgsqlPgAggregateTable_interface_ctx_s { + + netsnmp_container *container; + netsnmp_cache *cache; /* optional cache */ + + pgsqlPgAggregateTable_registration_ptr user_ctx; + + netsnmp_table_registration_info tbl_info; + + netsnmp_baby_steps_access_methods access_multiplexer; + +} pgsqlPgAggregateTable_interface_ctx; + +static pgsqlPgAggregateTable_interface_ctx pgsqlPgAggregateTable_if_ctx; + +static void _pgsqlPgAggregateTable_container_init( + pgsqlPgAggregateTable_interface_ctx *if_ctx); + + +static Netsnmp_Node_Handler _mfd_pgsqlPgAggregateTable_pre_request; +static Netsnmp_Node_Handler _mfd_pgsqlPgAggregateTable_post_request; +static Netsnmp_Node_Handler _mfd_pgsqlPgAggregateTable_object_lookup; +static Netsnmp_Node_Handler _mfd_pgsqlPgAggregateTable_get_values; +/** + * @internal + * Initialize the table pgsqlPgAggregateTable + * (Define its contents and how it's structured) + */ +void +_pgsqlPgAggregateTable_initialize_interface(pgsqlPgAggregateTable_registration_ptr reg_ptr, u_long flags) +{ + netsnmp_baby_steps_access_methods *access_multiplexer = + &pgsqlPgAggregateTable_if_ctx.access_multiplexer; + netsnmp_table_registration_info *tbl_info = &pgsqlPgAggregateTable_if_ctx.tbl_info; + netsnmp_handler_registration *reginfo; + netsnmp_mib_handler *handler; + int mfd_modes = 0; + + DEBUGMSGTL(("internal:pgsqlPgAggregateTable:_pgsqlPgAggregateTable_initialize_interface","called\n")); + + + /************************************************* + * + * save interface context for pgsqlPgAggregateTable + */ + /* + * Setting up the table's definition + */ + netsnmp_table_helper_add_indexes(tbl_info, + ASN_OCTET_STR, /** index: pgsnmpdConnID */ + ASN_INTEGER, /** index: rdbmsDbIndex */ + ASN_INTEGER, /** index: pgsqlPgAggregateEntryOID */ + 0); + + /* Define the minimum and maximum accessible columns. This + optimizes retrival. */ + tbl_info->min_column = PGSQLPGAGGREGATETABLE_MIN_COL; + tbl_info->max_column = PGSQLPGAGGREGATETABLE_MAX_COL; + + /* + * save users context + */ + pgsqlPgAggregateTable_if_ctx.user_ctx = reg_ptr; + + /* + * call data access initialization code + */ + pgsqlPgAggregateTable_init_data(reg_ptr); + + /* + * set up the container + */ + _pgsqlPgAggregateTable_container_init(&pgsqlPgAggregateTable_if_ctx); + if (NULL == pgsqlPgAggregateTable_if_ctx.container) { + snmp_log(LOG_ERR,"could not initialize container for pgsqlPgAggregateTable\n"); + return; + } + + /* + * access_multiplexer: REQUIRED wrapper for get request handling + */ + access_multiplexer->object_lookup = _mfd_pgsqlPgAggregateTable_object_lookup; + access_multiplexer->get_values = _mfd_pgsqlPgAggregateTable_get_values; + + /* + * no wrappers yet + */ + access_multiplexer->pre_request = _mfd_pgsqlPgAggregateTable_pre_request; + access_multiplexer->post_request = _mfd_pgsqlPgAggregateTable_post_request; + + + /************************************************* + * + * Create a registration, save our reg data, register table. + */ + DEBUGMSGTL(("pgsqlPgAggregateTable:init_pgsqlPgAggregateTable", + "Registering pgsqlPgAggregateTable as a mibs-for-dummies table.\n")); + handler = netsnmp_baby_steps_access_multiplexer_get(access_multiplexer); + reginfo = netsnmp_handler_registration_create("pgsqlPgAggregateTable", handler, + pgsqlPgAggregateTable_oid, + pgsqlPgAggregateTable_oid_size, + HANDLER_CAN_BABY_STEP | + HANDLER_CAN_RONLY + ); + if(NULL == reginfo) { + snmp_log(LOG_ERR,"error registering table pgsqlPgAggregateTable\n"); + return; + } + reginfo->my_reg_void = &pgsqlPgAggregateTable_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, + pgsqlPgAggregateTable_if_ctx.container, + TABLE_CONTAINER_KEY_NETSNMP_INDEX); + netsnmp_inject_handler( reginfo, handler ); + + /************************************************* + * + * inject cache helper + */ + if(NULL != pgsqlPgAggregateTable_if_ctx.cache) { + handler = netsnmp_cache_handler_get(pgsqlPgAggregateTable_if_ctx.cache); + netsnmp_inject_handler( reginfo, handler ); + } + + /* + * register table + */ + netsnmp_register_table(reginfo, tbl_info); +} /* _pgsqlPgAggregateTable_initialize_interface */ + +void +pgsqlPgAggregateTable_valid_columns_set(netsnmp_column_info *vc) +{ + pgsqlPgAggregateTable_if_ctx.tbl_info.valid_columns = vc; +} /* pgsqlPgAggregateTable_valid_columns_set */ + +/** + * @internal + * convert the index component stored in the context to an oid + */ +int +pgsqlPgAggregateTable_index_to_oid(netsnmp_index *oid_idx, + pgsqlPgAggregateTable_mib_index *mib_idx) +{ + int err = SNMP_ERR_NOERROR; + + /* + * temp storage for parsing indexes + */ + /* + * pgsnmpdConnID(1)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H + */ + netsnmp_variable_list var_pgsnmpdConnID; + /* + * rdbmsDbIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h + */ + netsnmp_variable_list var_rdbmsDbIndex; + /* + * pgsqlPgAggregateEntryOID(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/r/d/h + */ + netsnmp_variable_list var_pgsqlPgAggregateEntryOID; + + /* + * set up varbinds + */ + memset( &var_pgsnmpdConnID, 0x00, sizeof(var_pgsnmpdConnID) ); + var_pgsnmpdConnID.type = ASN_OCTET_STR; + memset( &var_rdbmsDbIndex, 0x00, sizeof(var_rdbmsDbIndex) ); + var_rdbmsDbIndex.type = ASN_INTEGER; + memset( &var_pgsqlPgAggregateEntryOID, 0x00, sizeof(var_pgsqlPgAggregateEntryOID) ); + var_pgsqlPgAggregateEntryOID.type = ASN_INTEGER; + + /* + * chain temp index varbinds together + */ + var_pgsnmpdConnID.next_variable = &var_rdbmsDbIndex; var_rdbmsDbIndex.next_variable = &var_pgsqlPgAggregateEntryOID; var_pgsqlPgAggregateEntryOID.next_variable = NULL; + + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateTable_index_to_oid","called\n")); + + /* pgsnmpdConnID(1)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H */ + snmp_set_var_value(&var_pgsnmpdConnID, (u_char*)&mib_idx->pgsnmpdConnID, + mib_idx->pgsnmpdConnID_len * sizeof(mib_idx->pgsnmpdConnID[0])); + + /* rdbmsDbIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h */ + snmp_set_var_value(&var_rdbmsDbIndex, (u_char*)&mib_idx->rdbmsDbIndex, + sizeof(mib_idx->rdbmsDbIndex)); + + /* pgsqlPgAggregateEntryOID(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/r/d/h */ + snmp_set_var_value(&var_pgsqlPgAggregateEntryOID, (u_char*)&mib_idx->pgsqlPgAggregateEntryOID, + sizeof(mib_idx->pgsqlPgAggregateEntryOID)); + + + err = build_oid_noalloc(oid_idx->oids, oid_idx->len, (size_t *)&oid_idx->len, + NULL, 0, &var_pgsnmpdConnID); + 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_pgsnmpdConnID ); + + return err; +} /* pgsqlPgAggregateTable_index_to_oid */ + +/** + * extract pgsqlPgAggregateTable indexes from a netsnmp_index + * + * @retval SNMP_ERR_NOERROR : no error + * @retval SNMP_ERR_GENERR : error + */ +int +pgsqlPgAggregateTable_index_from_oid(netsnmp_index *oid_idx, + pgsqlPgAggregateTable_mib_index *mib_idx) +{ + int err = SNMP_ERR_NOERROR; + + /* + * temp storage for parsing indexes + */ + /* + * pgsnmpdConnID(1)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H + */ + netsnmp_variable_list var_pgsnmpdConnID; + /* + * rdbmsDbIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h + */ + netsnmp_variable_list var_rdbmsDbIndex; + /* + * pgsqlPgAggregateEntryOID(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/r/d/h + */ + netsnmp_variable_list var_pgsqlPgAggregateEntryOID; + + /* + * set up varbinds + */ + memset( &var_pgsnmpdConnID, 0x00, sizeof(var_pgsnmpdConnID) ); + var_pgsnmpdConnID.type = ASN_OCTET_STR; + memset( &var_rdbmsDbIndex, 0x00, sizeof(var_rdbmsDbIndex) ); + var_rdbmsDbIndex.type = ASN_INTEGER; + memset( &var_pgsqlPgAggregateEntryOID, 0x00, sizeof(var_pgsqlPgAggregateEntryOID) ); + var_pgsqlPgAggregateEntryOID.type = ASN_INTEGER; + + /* + * chain temp index varbinds together + */ + var_pgsnmpdConnID.next_variable = &var_rdbmsDbIndex; var_rdbmsDbIndex.next_variable = &var_pgsqlPgAggregateEntryOID; var_pgsqlPgAggregateEntryOID.next_variable = NULL; + + + DEBUGMSGTL(("verbose:pgsqlPgAggregateTable:pgsqlPgAggregateTable_index_from_oid","called\n")); + + /* + * parse the oid into the individual index components + */ + err = parse_oid_indexes( oid_idx->oids, oid_idx->len, + &var_pgsnmpdConnID ); + if (err == SNMP_ERR_NOERROR) { + /* + * copy out values + */ + /* + * NOTE: val_len is in bytes, pgsnmpdConnID_len might not be + */ + if(var_pgsnmpdConnID.val_len > sizeof(mib_idx->pgsnmpdConnID)) + err = SNMP_ERR_GENERR; + else { + memcpy(mib_idx->pgsnmpdConnID, var_pgsnmpdConnID.val.string, var_pgsnmpdConnID.val_len); + mib_idx->pgsnmpdConnID_len = var_pgsnmpdConnID.val_len / sizeof(mib_idx->pgsnmpdConnID[0]); + } + mib_idx->rdbmsDbIndex = *((long *)var_rdbmsDbIndex.val.string); + mib_idx->pgsqlPgAggregateEntryOID = *((long *)var_pgsqlPgAggregateEntryOID.val.string); + + + } + + /* + * parsing may have allocated memory. free it. + */ + snmp_reset_var_buffers( &var_pgsnmpdConnID ); + + return err; +} /* pgsqlPgAggregateTable_index_from_oid */ + + +/* ********************************************************************* + * @internal + * allocate resources for a pgsqlPgAggregateTable_rowreq_ctx + */ +pgsqlPgAggregateTable_rowreq_ctx * +pgsqlPgAggregateTable_allocate_rowreq_ctx(void) +{ + pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx = + SNMP_MALLOC_TYPEDEF(pgsqlPgAggregateTable_rowreq_ctx); + + DEBUGMSGTL(("internal:pgsqlPgAggregateTable:pgsqlPgAggregateTable_allocate_rowreq_ctx","called\n")); + + if(NULL == rowreq_ctx) { + snmp_log(LOG_ERR,"Couldn't allocate memory for a " + "pgsqlPgAggregateTable_rowreq_ctx.\n"); + } + + rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp; + + rowreq_ctx->pgsqlPgAggregateTable_data_list = NULL; + rowreq_ctx->pgsqlPgAggregateTable_reg = pgsqlPgAggregateTable_if_ctx.user_ctx; + + + return rowreq_ctx; +} /* pgsqlPgAggregateTable_allocate_rowreq_ctx */ + +/* + * @internal + * release resources for a pgsqlPgAggregateTable_rowreq_ctx + */ +void +pgsqlPgAggregateTable_release_rowreq_ctx(pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx) +{ + DEBUGMSGTL(("internal:pgsqlPgAggregateTable:pgsqlPgAggregateTable_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); +} /* pgsqlPgAggregateTable_release_rowreq_ctx */ + +/** + * @internal + * wrapper + */ +static int +_mfd_pgsqlPgAggregateTable_pre_request(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + int rc = pgsqlPgAggregateTable_pre_request(pgsqlPgAggregateTable_if_ctx.user_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("internal:pgsqlPgAggregateTable","error %d from " + "pgsqlPgAggregateTable_pre_request\n", rc)); + netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); + } + + return SNMP_ERR_NOERROR; +} /* _mfd_pgsqlPgAggregateTable_pre_request */ + +/** + * @internal + * wrapper + */ +static int +_mfd_pgsqlPgAggregateTable_post_request(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx; + int rc = pgsqlPgAggregateTable_post_request(pgsqlPgAggregateTable_if_ctx.user_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("internal:pgsqlPgAggregateTable","error %d from " + "pgsqlPgAggregateTable_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(pgsqlPgAggregateTable_if_ctx.container, rowreq_ctx); + } + else if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) { + CONTAINER_REMOVE(pgsqlPgAggregateTable_if_ctx.container, rowreq_ctx); + pgsqlPgAggregateTable_release_rowreq_ctx(rowreq_ctx); + } + } + + return SNMP_ERR_NOERROR; +} /* _mfd_pgsqlPgAggregateTable_post_request */ + +/** + * @internal + * wrapper + */ +static int +_mfd_pgsqlPgAggregateTable_object_lookup(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:pgsqlPgAggregateTable:_mfd_pgsqlPgAggregateTable_object_lookup","called\n")); + + /* + * get our context from mfd + * pgsqlPgAggregateTable_interface_ctx *if_ctx = + * (pgsqlPgAggregateTable_interface_ctx *)reginfo->my_reg_void; + */ + + if(NULL == rowreq_ctx) { + netsnmp_request_set_error_all(requests, SNMP_ERR_NOCREATION); + } + else { + pgsqlPgAggregateTable_row_prep(rowreq_ctx); + } + + return SNMP_ERR_NOERROR; +} /* _mfd_pgsqlPgAggregateTable_object_lookup */ + +/*********************************************************************** + * + * GET processing + * + ***********************************************************************/ +/* + * @internal + * Retrieve the value for a particular column + */ +NETSNMP_STATIC_INLINE int +_pgsqlPgAggregateTable_get_column( pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx, + netsnmp_variable_list *var, int column ) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:pgsqlPgAggregateTable:_mfd_pgsqlPgAggregateTable_get_column","called\n")); + + + netsnmp_assert(NULL != rowreq_ctx); + + switch(column) { + + /* pgsqlPgAggregateAggfnoid(2)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAGGREGATEAGGFNOID: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAggregateAggfnoid_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAggregateAggtransfn(3)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAGGREGATEAGGTRANSFN: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAggregateAggtransfn_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAggregateAggfinalfn(4)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAGGREGATEAGGFINALFN: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAggregateAggfinalfn_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAggregateAggsortop(5)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAGGREGATEAGGSORTOP: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAggregateAggsortop_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAggregateAggtranstype(6)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAGGREGATEAGGTRANSTYPE: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAggregateAggtranstype_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAggregateAgginitval(7)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H */ + case COLUMN_PGSQLPGAGGREGATEAGGINITVAL: + var->type = ASN_OCTET_STR; +rc = pgsqlPgAggregateAgginitval_get(rowreq_ctx, (char **)&var->val.string, &var->val_len ); + break; + + default: + snmp_log(LOG_ERR,"unknown column %d in _pgsqlPgAggregateTable_get_column\n", column); + break; + } + + return rc; +} /* _pgsqlPgAggregateTable_get_column */ + +int +_mfd_pgsqlPgAggregateTable_get_values(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + pgsqlPgAggregateTable_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:pgsqlPgAggregateTable:_mfd_pgsqlPgAggregateTable_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 = _pgsqlPgAggregateTable_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_pgsqlPgAggregateTable_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:pgsqlPgAggregateTable:_cache_load","called\n")); + + if((NULL == cache) || (NULL == cache->magic)) { + snmp_log(LOG_ERR, "invalid cache for pgsqlPgAggregateTable_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 pgsqlPgAggregateTable_cache_load((netsnmp_container*)cache->magic); +} /* _cache_load */ + +/** + * @internal + */ +static void +_cache_item_free(pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx, void *context) +{ + DEBUGMSGTL(("internal:pgsqlPgAggregateTable:_cache_item_free","called\n")); + + if(NULL == rowreq_ctx) + return; + + pgsqlPgAggregateTable_release_rowreq_ctx(rowreq_ctx); +} /* _cache_item_free */ + +/** + * @internal + */ +static void +_cache_free(netsnmp_cache *cache, void *magic) +{ + netsnmp_container *container; + + DEBUGMSGTL(("internal:pgsqlPgAggregateTable:_cache_free","called\n")); + + if((NULL == cache) || (NULL == cache->magic)) { + snmp_log(LOG_ERR, "invalid cache in pgsqlPgAggregateTable_cache_free\n"); + return; + } + + container = (netsnmp_container*)cache->magic; + + /* + * call user code + */ + pgsqlPgAggregateTable_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 +_pgsqlPgAggregateTable_container_init(pgsqlPgAggregateTable_interface_ctx *if_ctx) +{ + DEBUGMSGTL(("internal:pgsqlPgAggregateTable:_pgsqlPgAggregateTable_container_init","called\n")); + + /* + * set up the cache + */ + if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */ + _cache_load, _cache_free, + pgsqlPgAggregateTable_oid, + pgsqlPgAggregateTable_oid_size); + + if(NULL == if_ctx->cache) { + snmp_log(LOG_ERR, "error creating cache for pgsqlPgAggregateTable\n"); + return; + } + + if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET; + + pgsqlPgAggregateTable_container_init(&if_ctx->container, if_ctx->cache); + if(NULL == if_ctx->container) + if_ctx->container = netsnmp_container_find("pgsqlPgAggregateTable:table_container"); + if(NULL == if_ctx->container) { + snmp_log(LOG_ERR,"error creating container in " + "pgsqlPgAggregateTable_container_init\n"); + return; + } + if_ctx->cache->magic = (void*)if_ctx->container; +} /* _pgsqlPgAggregateTable_container_init */ + diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_interface.h b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_interface.h new file mode 100644 index 0000000..94a4e9a --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_interface.h @@ -0,0 +1,72 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.43.2.3 $ of : mfd-interface.m2c,v $ + * + * $Id: pgsqlPgAggregateTable_interface.h,v 1.1 2008/01/17 11:49:24 eggyknap Exp $ + */ +/** @defgroup interface: Routines to interface to Net-SNMP + * + * \warning This code should not be modified, called directly, + * or used to interpret functionality. It is subject to + * change at any time. + * + * @{ + */ +/* + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + * *** *** + * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** + * *** *** + * *** *** + * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** + * *** *** + * *** *** + * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** + * *** *** + * *** *** + * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** + * *** *** + * *** *** + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + */ +#ifndef PGSQLPGAGGREGATETABLE_INTERFACE_H +#define PGSQLPGAGGREGATETABLE_INTERFACE_H + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "pgsqlPgAggregateTable.h" + +/* ******************************************************************** + * Table declarations + */ + +/* PUBLIC interface initialization routine */ +void _pgsqlPgAggregateTable_initialize_interface(pgsqlPgAggregateTable_registration_ptr user_ctx, + u_long flags); + + pgsqlPgAggregateTable_rowreq_ctx * pgsqlPgAggregateTable_allocate_rowreq_ctx(void); +void pgsqlPgAggregateTable_release_rowreq_ctx(pgsqlPgAggregateTable_rowreq_ctx *rowreq_ctx); + +int pgsqlPgAggregateTable_index_to_oid(netsnmp_index *oid_idx, + pgsqlPgAggregateTable_mib_index *mib_idx); +int pgsqlPgAggregateTable_index_from_oid(netsnmp_index *oid_idx, + pgsqlPgAggregateTable_mib_index *mib_idx); + +/* + * access to certain internals. use with caution! + */ +void pgsqlPgAggregateTable_valid_columns_set(netsnmp_column_info *vc); + + +#ifdef __cplusplus +} +#endif + +#endif /* PGSQLPGAGGREGATETABLE_INTERFACE_H */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_oids.h b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_oids.h new file mode 100644 index 0000000..bb5a69d --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAggregateTable/pgsqlPgAggregateTable_oids.h @@ -0,0 +1,33 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : generic-table-oids.m2c,v 1.10 2004/10/08 23:39:17 rstory Exp $ + * + * $Id: pgsqlPgAggregateTable_oids.h,v 1.1 2008/01/17 11:49:24 eggyknap Exp $ + */ +#ifndef PGSQLPGAGGREGATETABLE_OIDS_H +#define PGSQLPGAGGREGATETABLE_OIDS_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* column number definitions for table pgsqlPgAggregateTable */ +#define PGSQLPGAGGREGATETABLE_OID 1,3,6,1,4,1,27645,1,2,1 +#define COLUMN_PGSQLPGAGGREGATEENTRYOID 1 +#define COLUMN_PGSQLPGAGGREGATEAGGFNOID 2 +#define COLUMN_PGSQLPGAGGREGATEAGGTRANSFN 3 +#define COLUMN_PGSQLPGAGGREGATEAGGFINALFN 4 +#define COLUMN_PGSQLPGAGGREGATEAGGSORTOP 5 +#define COLUMN_PGSQLPGAGGREGATEAGGTRANSTYPE 6 +#define COLUMN_PGSQLPGAGGREGATEAGGINITVAL 7 + +#define PGSQLPGAGGREGATETABLE_MIN_COL COLUMN_PGSQLPGAGGREGATEAGGFNOID +#define PGSQLPGAGGREGATETABLE_MAX_COL COLUMN_PGSQLPGAGGREGATEAGGINITVAL + + +#ifdef __cplusplus +} +#endif + +#endif /* PGSQLPGAGGREGATETABLE_OIDS_H */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable.c b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable.c new file mode 100644 index 0000000..d8d6304 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable.c @@ -0,0 +1,129 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.32.2.3 $ of : mfd-top.m2c,v $ + * + * $Id: pgsqlPgAmTable.c,v 1.1 2008/01/17 12:29:36 eggyknap Exp $ + */ +/** \mainpage MFD helper for pgsqlPgAmTable + * + * \section intro Introduction + * Introductory text. + * + */ +/* 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 "pgsqlPgAmTable.h" + +#include <net-snmp/agent/mib_modules.h> + +#include "pgsqlPgAmTable_interface.h" + +oid pgsqlPgAmTable_oid[] = { PGSQLPGAMTABLE_OID }; +int pgsqlPgAmTable_oid_size = OID_LENGTH(pgsqlPgAmTable_oid); + +void initialize_table_pgsqlPgAmTable(void); + + +/** + * Initializes the pgsqlPgAmTable module + */ +void +init_pgsqlPgAmTable(void) +{ + DEBUGMSGTL(("verbose:pgsqlPgAmTable:init_pgsqlPgAmTable","called\n")); + + /* + * TODO:300:o: Perform pgsqlPgAmTable one-time module initialization. + */ + + /* + * here we initialize all the tables we're planning on supporting + */ + if (should_init("pgsqlPgAmTable")) + initialize_table_pgsqlPgAmTable(); + +} /* init_pgsqlPgAmTable */ + +/** + * Initialize the table pgsqlPgAmTable + * (Define its contents and how it's structured) + */ +void +initialize_table_pgsqlPgAmTable(void) +{ + pgsqlPgAmTable_registration_ptr user_context; + u_long flags; + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:initialize_table_pgsqlPgAmTable","called\n")); + + /* + * TODO:301:o: Perform pgsqlPgAmTable one-time table initialization. + */ + + /* + * TODO:302:o: |->Initialize pgsqlPgAmTable 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("pgsqlPgAmTable", NULL, NULL); + + /* + * No support for any flags yet, but in the future you would + * set any flags here. + */ + flags = 0; + + /* + * call interface initialization code + */ + _pgsqlPgAmTable_initialize_interface(user_context, flags); +} /* initialize_table_pgsqlPgAmTable */ + +/** + * pre-request callback + * + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error + */ +int +pgsqlPgAmTable_pre_request(pgsqlPgAmTable_registration_ptr user_context) +{ + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmTable_pre_request","called\n")); + + /* + * TODO:510:o: Perform pgsqlPgAmTable pre-request actions. + */ + + return MFD_SUCCESS; +} /* pgsqlPgAmTable_pre_request */ + +/** + * post-request callback + * + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : other error (ignored) + */ +int +pgsqlPgAmTable_post_request(pgsqlPgAmTable_registration_ptr user_context) +{ + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmTable_post_request","called\n")); + + /* + * TODO:511:o: Perform pgsqlPgAmTable pos-request actions. + */ + + return MFD_SUCCESS; +} /* pgsqlPgAmTable_post_request */ + + +/** @{ */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable.h b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable.h new file mode 100644 index 0000000..a6e5f01 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable.h @@ -0,0 +1,306 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.32.2.3 $ of : mfd-top.m2c,v $ + * + * $Id: pgsqlPgAmTable.h,v 1.1 2008/01/17 12:29:36 eggyknap Exp $ + */ +#ifndef PGSQLPGAMTABLE_H +#define PGSQLPGAMTABLE_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(PGSQL-MIB/pgsqlPgAmTable/pgsqlPgAmTable_interface); +config_require(PGSQL-MIB/pgsqlPgAmTable/pgsqlPgAmTable_data_access); +config_require(PGSQL-MIB/pgsqlPgAmTable/pgsqlPgAmTable_data_get); +config_require(PGSQL-MIB/pgsqlPgAmTable/pgsqlPgAmTable_data_set); + /* *INDENT-ON* */ + +/* OID and column number definitions for */ +#include "pgsqlPgAmTable_oids.h" + +/* enum definions */ +#include "pgsqlPgAmTable_enums.h" + +/* ********************************************************************* + * function declarations + */ +void init_pgsqlPgAmTable(void); + +/* ********************************************************************* + * Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table pgsqlPgAmTable + *** + ********************************************************************** + **********************************************************************/ +/* + * pgsqlPgAmTable is subid 2 of pgsqlCatalogTables. + * Its status is Current. + * OID: .1.3.6.1.4.1.27645.1.2.2, length: 10 +*/ +/* ********************************************************************* + * 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 pgsqlPgAmTable registration context. + */ +typedef netsnmp_data_list * pgsqlPgAmTable_registration_ptr; + +/**********************************************************************/ +/* + * TODO:110:r: |-> Review pgsqlPgAmTable data context structure. + * This structure is used to represent the data for pgsqlPgAmTable. + */ +/* + * This structure contains storage for all the columns defined in the + * pgsqlPgAmTable. + */ +typedef struct pgsqlPgAmTable_data_s { + + /* + * pgsqlPgAmAmname(2)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H + */ + char pgsqlPgAmAmname[255]; +size_t pgsqlPgAmAmname_len; /* # of char elements, not bytes */ + + /* + * pgsqlPgAmAmstrategies(3)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAmAmstrategies; + + /* + * pgsqlPgAmAmsupport(4)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAmAmsupport; + + /* + * pgsqlPgAmAmorderstrategy(5)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAmAmorderstrategy; + + /* + * pgsqlPgAmAmcanunique(6)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h + */ + u_long pgsqlPgAmAmcanunique; + + /* + * pgsqlPgAmAmcanmulticol(7)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h + */ + u_long pgsqlPgAmAmcanmulticol; + + /* + * pgsqlPgAmAmoptionalkey(8)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h + */ + u_long pgsqlPgAmAmoptionalkey; + + /* + * pgsqlPgAmAmindexnulls(9)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h + */ + u_long pgsqlPgAmAmindexnulls; + + /* + * pgsqlPgAmAmstorage(10)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h + */ + u_long pgsqlPgAmAmstorage; + + /* + * pgsqlPgAmAmclusterable(11)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h + */ + u_long pgsqlPgAmAmclusterable; + + /* + * pgsqlPgAmAminsert(12)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAmAminsert; + + /* + * pgsqlPgAmAmbeginscan(13)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAmAmbeginscan; + + /* + * pgsqlPgAmAmgettuple(14)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAmAmgettuple; + + /* + * pgsqlPgAmAmgetmulti(15)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAmAmgetmulti; + + /* + * pgsqlPgAmAmrescan(16)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAmAmrescan; + + /* + * pgsqlPgAmAmendscan(17)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAmAmendscan; + + /* + * pgsqlPgAmAmmarkpos(18)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAmAmmarkpos; + + /* + * pgsqlPgAmAmrestrpos(19)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAmAmrestrpos; + + /* + * pgsqlPgAmAmbuild(20)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAmAmbuild; + + /* + * pgsqlPgAmAmbulkdelete(21)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAmAmbulkdelete; + + /* + * pgsqlPgAmAmvacuumcleanup(22)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAmAmvacuumcleanup; + + /* + * pgsqlPgAmAmcostestimate(23)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAmAmcostestimate; + + /* + * pgsqlPgAmAmoptions(24)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h + */ + long pgsqlPgAmAmoptions; + +} pgsqlPgAmTable_data; + + +/* + * TODO:120:r: |-> Review pgsqlPgAmTable mib index. + * This structure is used to represent the index for pgsqlPgAmTable. + */ +typedef struct pgsqlPgAmTable_mib_index_s { + + /* + * pgsnmpdConnID(1)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H + */ + /** 128 - 2(other indexes) - oid length(12) = 113 */ + char pgsnmpdConnID[113]; + size_t pgsnmpdConnID_len; + + /* + * rdbmsDbIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h + */ + long rdbmsDbIndex; + + /* + * pgsqlPgAmEntryOID(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/r/d/h + */ + long pgsqlPgAmEntryOID; + + +} pgsqlPgAmTable_mib_index; + + /* + * TODO:121:r: | |-> Review pgsqlPgAmTable max index length. + * If you KNOW that your indexes will never exceed a certain + * length, update this macro to that length. + * + * BE VERY CAREFUL TO TAKE INTO ACCOUNT THE MAXIMUM + * POSSIBLE LENGHT FOR EVERY VARIABLE LENGTH INDEX! + * Guessing 128 - col/entry(2) - oid len(10) +*/ +#define MAX_pgsqlPgAmTable_IDX_LEN 116 + + +/* ********************************************************************* + * TODO:130:o: |-> Review pgsqlPgAmTable Row request (rowreq) context. + * When your functions are called, you will be passed a + * pgsqlPgAmTable_rowreq_ctx pointer. + */ +typedef struct pgsqlPgAmTable_rowreq_ctx_s { + + /** this must be first for container compare to work */ + netsnmp_index oid_idx; + oid oid_tmp[MAX_pgsqlPgAmTable_IDX_LEN]; + + pgsqlPgAmTable_mib_index tbl_idx; + + pgsqlPgAmTable_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) + */ + pgsqlPgAmTable_registration_ptr pgsqlPgAmTable_reg; + + /* + * TODO:131:o: | |-> Add useful data to pgsqlPgAmTable rowreq context. + */ + + /* + * storage for future expansion + */ + netsnmp_data_list *pgsqlPgAmTable_data_list; + +} pgsqlPgAmTable_rowreq_ctx; + +typedef struct pgsqlPgAmTable_ref_rowreq_ctx_s { + pgsqlPgAmTable_rowreq_ctx *rowreq_ctx; +} pgsqlPgAmTable_ref_rowreq_ctx; + +/* ********************************************************************* + * function prototypes + */ + int pgsqlPgAmTable_pre_request(pgsqlPgAmTable_registration_ptr user_context); + int pgsqlPgAmTable_post_request(pgsqlPgAmTable_registration_ptr user_context); + + +extern oid pgsqlPgAmTable_oid[]; +extern int pgsqlPgAmTable_oid_size; + + +#include "pgsqlPgAmTable_interface.h" +#include "pgsqlPgAmTable_data_access.h" +#include "pgsqlPgAmTable_data_get.h" +#include "pgsqlPgAmTable_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 /* PGSQLPGAMTABLE_H */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_access.c b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_access.c new file mode 100644 index 0000000..0d910c4 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_access.c @@ -0,0 +1,312 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.12 $ of : mfd-data-access.m2c,v $ + * + * $Id: pgsqlPgAmTable_data_access.c,v 1.1 2008/01/17 12:29:36 eggyknap Exp $ + */ +#include "pgsnmpd.h" + +/* include our parent header */ +#include "pgsqlPgAmTable.h" +#include "pgsqlPgAmTable_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 pgsqlPgAmTable + *** + ********************************************************************** + **********************************************************************/ +/* + * pgsqlPgAmTable is subid 2 of pgsqlCatalogTables. + * Its status is Current. + * OID: .1.3.6.1.4.1.27645.1.2.2, length: 10 +*/ + +/** + * initialization for pgsqlPgAmTable data access + * + * This function is called during startup to allow you to + * allocate any resources you need for the data table. + * + * @param pgsqlPgAmTable_reg + * Pointer to pgsqlPgAmTable_registration + * + * @retval MFD_SUCCESS : success. + * @retval MFD_ERROR : unrecoverable error. + */ +int +pgsqlPgAmTable_init_data(pgsqlPgAmTable_registration_ptr pgsqlPgAmTable_reg) +{ + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmTable_init_data","called\n")); + + /* + * TODO:303:o: Initialize pgsqlPgAmTable data. + */ + + return MFD_SUCCESS; +} /* pgsqlPgAmTable_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 +pgsqlPgAmTable_container_init(netsnmp_container **container_ptr_ptr, + netsnmp_cache *cache) +{ + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmTable_container_init","called\n")); + + if((NULL == cache) || (NULL == container_ptr_ptr)) { + snmp_log(LOG_ERR,"bad params to pgsqlPgAmTable_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 pgsqlPgAmTable 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 = PGSQLPGAMTABLE_CACHE_TIMEOUT; /* seconds */ +} /* pgsqlPgAmTable_container_init */ + +/** + * load cache data + * + * TODO:350:M: Implement pgsqlPgAmTable 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 + * pgsqlPgAmTable_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 +pgsqlPgAmTable_cache_load(netsnmp_container *container) +{ + pgsqlPgAmTable_rowreq_ctx *rowreq_ctx; + size_t count = 0; + + int i, resultCount, tmpInt; + char *tmpString; + PGresult *pg_db_qry; + + char pgsnmpdConnID[112] = "Default conn ID"; + size_t pgsnmpdConnID_len = strlen(pgsnmpdConnID); + long rdbmsDbIndex = 1; + long pgsqlPgAmEntryOID; + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmTable_cache_load","called\n")); + snmp_log(LOG_INFO, "Running pgsqlPgAmTable\n"); + + if (PQstatus(dbconn) == CONNECTION_OK) + pg_db_qry = PQexec(dbconn, "SELECT oid, amname, amstrategies, amsupport, amorderstrategy, CASE WHEN amcanunique THEN 1 ELSE 2 END, CASE WHEN amcanmulticol THEN 1 ELSE 2 END, CASE WHEN amoptionalkey THEN 1 ELSE 2 END, CASE WHEN amindexnulls THEN 1 ELSE 2 END, CASE WHEN amstorage THEN 1 ELSE 2 END, CASE WHEN amclusterable THEN 1 ELSE 2 END, aminsert, ambeginscan, amgettuple, amgetmulti, amrescan, amendscan, ammarkpos, amrestrpos, ambuild, ambulkdelete, amvacuumcleanup, amcostestimate, amoptions FROM pg_am"); + else { + snmp_log(LOG_ERR, "Can't get connected to database\n"); + return MFD_RESOURCE_UNAVAILABLE; + } + if (PQresultStatus(pg_db_qry) != PGRES_TUPLES_OK) { + snmp_log(LOG_ERR, "Didn't get any results from the database\n"); + PQclear(pg_db_qry); + return MFD_RESOURCE_UNAVAILABLE; + } + resultCount = PQntuples(pg_db_qry); + + /* + * TODO:351:M: |-> Load/update data in the pgsqlPgAmTable container. + * loop over your pgsqlPgAmTable data, allocate a rowreq context, + * set the index(es) [and data, optionally] and insert into + * the container. + */ + for (i = 0; i < resultCount; i++) { + /* + * TODO:352:M: | |-> set indexes in new pgsqlPgAmTable rowreq context. + */ + rowreq_ctx = pgsqlPgAmTable_allocate_rowreq_ctx(); + if (NULL == rowreq_ctx) { + snmp_log(LOG_ERR, "memory allocation failed\n"); + return MFD_RESOURCE_UNAVAILABLE; + } + if(MFD_SUCCESS != pgsqlPgAmTable_indexes_set(rowreq_ctx + , pgsnmpdConnID, pgsnmpdConnID_len + , rdbmsDbIndex + , atol(PQgetvalue(pg_db_qry, i, 0)) + )) { + snmp_log(LOG_ERR,"error setting index while loading " + "pgsqlPgAmTable cache.\n"); + pgsqlPgAmTable_release_rowreq_ctx(rowreq_ctx); + continue; + } + rowreq_ctx->data.pgsqlPgAmAmname_len = 255; + + tmpString = PQgetvalue(pg_db_qry, i, 1); + tmpInt = strlen(tmpString); + if ((NULL == rowreq_ctx->data.pgsqlPgAmAmname) || + (rowreq_ctx->data.pgsqlPgAmAmname_len < (tmpInt * sizeof(rowreq_ctx->data.pgsqlPgAmAmname[0])))) { + snmp_log(LOG_ERR,"not enough space for value\n"); + return MFD_ERROR; + } + rowreq_ctx->data.pgsqlPgAmAmname_len = tmpInt * sizeof(rowreq_ctx->data.pgsqlPgAmAmname[0]); + memcpy( rowreq_ctx->data.pgsqlPgAmAmname, tmpString, rowreq_ctx->data.pgsqlPgAmAmname_len ); + + rowreq_ctx->data.pgsqlPgAmAmstrategies = strtoul(PQgetvalue(pg_db_qry, i, 2), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmsupport = strtoul(PQgetvalue(pg_db_qry, i, 3), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmorderstrategy = strtoul(PQgetvalue(pg_db_qry, i, 4), NULL, 10); + + /* These are TruthValue columns. 1 = true, 2 = false */ + rowreq_ctx->data.pgsqlPgAmAmcanunique, strtoul(PQgetvalue(pg_db_qry, i, 5), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmcanmulticol, strtoul(PQgetvalue(pg_db_qry, i, 6), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmoptionalkey, strtoul(PQgetvalue(pg_db_qry, i, 7), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmindexnulls, strtoul(PQgetvalue(pg_db_qry, i, 8), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmstorage, strtoul(PQgetvalue(pg_db_qry, i, 9), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmclusterable, strtoul(PQgetvalue(pg_db_qry, i, 10), NULL, 10); + + rowreq_ctx->data.pgsqlPgAmAminsert = strtoul(PQgetvalue(pg_db_qry, i, 11), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmbeginscan = strtoul(PQgetvalue(pg_db_qry, i, 12), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmgettuple = strtoul(PQgetvalue(pg_db_qry, i, 13), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmgetmulti = strtoul(PQgetvalue(pg_db_qry, i, 14), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmrescan = strtoul(PQgetvalue(pg_db_qry, i, 15), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmendscan = strtoul(PQgetvalue(pg_db_qry, i, 16), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmmarkpos = strtoul(PQgetvalue(pg_db_qry, i, 17), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmrestrpos = strtoul(PQgetvalue(pg_db_qry, i, 18), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmbuild = strtoul(PQgetvalue(pg_db_qry, i, 19), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmbulkdelete = strtoul(PQgetvalue(pg_db_qry, i, 20), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmvacuumcleanup = strtoul(PQgetvalue(pg_db_qry, i, 21), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmcostestimate = strtoul(PQgetvalue(pg_db_qry, i, 22), NULL, 10); + rowreq_ctx->data.pgsqlPgAmAmoptions = strtoul(PQgetvalue(pg_db_qry, i, 23), NULL, 10); + + /* + * insert into table container + */ + CONTAINER_INSERT(container, rowreq_ctx); + ++count; + } + + + DEBUGMSGT(("verbose:pgsqlPgAmTable:pgsqlPgAmTable_cache_load", + "inserted %d records\n", count)); + PQclear(pg_db_qry); + + return MFD_SUCCESS; +} /* pgsqlPgAmTable_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 +pgsqlPgAmTable_cache_free(netsnmp_container *container) +{ + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmTable_cache_free","called\n")); + + /* + * TODO:380:M: Free pgsqlPgAmTable cache. + */ +} /* pgsqlPgAmTable_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 +pgsqlPgAmTable_row_prep( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx) +{ + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmTable_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; +} /* pgsqlPgAmTable_row_prep */ + +/** @} */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_access.h b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_access.h new file mode 100644 index 0000000..29987d0 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_access.h @@ -0,0 +1,70 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.12 $ of : mfd-data-access.m2c,v $ + * + * $Id: pgsqlPgAmTable_data_access.h,v 1.1 2008/01/17 12:29:36 eggyknap Exp $ + */ +#ifndef PGSQLPGAMTABLE_DATA_ACCESS_H +#define PGSQLPGAMTABLE_DATA_ACCESS_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* ********************************************************************* + * function declarations + */ + +/* ********************************************************************* + * Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table pgsqlPgAmTable + *** + ********************************************************************** + **********************************************************************/ +/* + * pgsqlPgAmTable is subid 2 of pgsqlCatalogTables. + * Its status is Current. + * OID: .1.3.6.1.4.1.27645.1.2.2, length: 10 +*/ + + + int pgsqlPgAmTable_init_data(pgsqlPgAmTable_registration_ptr pgsqlPgAmTable_reg); + + +/* + * TODO:180:o: Review pgsqlPgAmTable cache timeout. + * The number of seconds before the cache times out + */ +#define PGSQLPGAMTABLE_CACHE_TIMEOUT 60 + +void pgsqlPgAmTable_container_init(netsnmp_container **container_ptr_ptr, + netsnmp_cache *cache); +int pgsqlPgAmTable_cache_load(netsnmp_container *container); +void pgsqlPgAmTable_cache_free(netsnmp_container *container); + + /* + *************************************************** + *** START EXAMPLE CODE *** + ***---------------------------------------------***/ +/* ********************************************************************* + * Since we have no idea how you really access your data, we'll go with + * a worst case example: a flat text file. + */ +#define MAX_LINE_SIZE 256 + /* + ***---------------------------------------------*** + *** END EXAMPLE CODE *** + ***************************************************/ + int pgsqlPgAmTable_row_prep( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx); + + +#ifdef __cplusplus +} +#endif + +#endif /* PGSQLPGAMTABLE_DATA_ACCESS_H */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_get.c b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_get.c new file mode 100644 index 0000000..84d66fb --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_get.c @@ -0,0 +1,2289 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.18.2.1 $ of : mfd-data-get.m2c,v $ + * + * $Id: pgsqlPgAmTable_data_get.c,v 1.1 2008/01/17 12:29:36 eggyknap 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 "pgsqlPgAmTable.h" + + +/** @defgroup data_get data_get: Routines to get data + * + * TODO:230:M: Implement pgsqlPgAmTable get routines. + * TODO:240:M: Implement pgsqlPgAmTable 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 pgsqlPgAmTable + *** + ********************************************************************** + **********************************************************************/ +/* + * pgsqlPgAmTable is subid 2 of pgsqlCatalogTables. + * Its status is Current. + * OID: .1.3.6.1.4.1.27645.1.2.2, length: 10 +*/ + +/* --------------------------------------------------------------------- + * TODO:200:r: Implement pgsqlPgAmTable data context functions. + */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmEntryOID + * pgsqlPgAmEntryOID is subid 1 of pgsqlPgAmEntry. + * Its status is Current, and its access level is NoAccess. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.1 + * Description: +OID of this entry + * + * Attributes: + * accessible 0 isscalar 0 enums 0 hasdefval 0 + * readable 0 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + * + * + * + * NOTE: NODE pgsqlPgAmEntryOID 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-pgsqlPgAmEntryOID.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 +pgsqlPgAmEntryOID_map(long *mib_pgsqlPgAmEntryOID_val_ptr, long raw_pgsqlPgAmEntryOID_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmEntryOID_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmEntryOID_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmEntryOID 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_pgsqlPgAmEntryOID_val_ptr) = raw_pgsqlPgAmEntryOID_val; + + return MFD_SUCCESS; +} /* pgsqlPgAmEntryOID_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 +pgsqlPgAmTable_indexes_set_tbl_idx(pgsqlPgAmTable_mib_index *tbl_idx, char *pgsnmpdConnID_val_ptr, size_t pgsnmpdConnID_val_ptr_len, long rdbmsDbIndex_val, long pgsqlPgAmEntryOID_val) +{ + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmTable_indexes_set_tbl_idx","called\n")); + + /* pgsnmpdConnID(1)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H */ + tbl_idx->pgsnmpdConnID_len = sizeof(tbl_idx->pgsnmpdConnID); + /* + * make sure there is enough space for pgsnmpdConnID data + */ + if ((NULL == tbl_idx->pgsnmpdConnID) || + (tbl_idx->pgsnmpdConnID_len < (pgsnmpdConnID_val_ptr_len * sizeof(tbl_idx->pgsnmpdConnID[0])))) { + snmp_log(LOG_ERR,"not enough space for value\n"); + return MFD_ERROR; + } + tbl_idx->pgsnmpdConnID_len = pgsnmpdConnID_val_ptr_len * sizeof(tbl_idx->pgsnmpdConnID[0]); + memcpy( tbl_idx->pgsnmpdConnID, pgsnmpdConnID_val_ptr, tbl_idx->pgsnmpdConnID_len ); + + /* rdbmsDbIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h */ + tbl_idx->rdbmsDbIndex = rdbmsDbIndex_val; + + /* pgsqlPgAmEntryOID(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/r/d/h */ + tbl_idx->pgsqlPgAmEntryOID = pgsqlPgAmEntryOID_val; + + + return MFD_SUCCESS; +} /* pgsqlPgAmTable_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 +pgsqlPgAmTable_indexes_set(pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, char *pgsnmpdConnID_val_ptr, size_t pgsnmpdConnID_val_ptr_len, long rdbmsDbIndex_val, long pgsqlPgAmEntryOID_val) +{ + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmTable_indexes_set","called\n")); + + if(MFD_SUCCESS != pgsqlPgAmTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx + , pgsnmpdConnID_val_ptr, pgsnmpdConnID_val_ptr_len + , rdbmsDbIndex_val + , pgsqlPgAmEntryOID_val + )) + return MFD_ERROR; + + /* + * convert mib index to oid index + */ + rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid); + if(0 != pgsqlPgAmTable_index_to_oid(&rowreq_ctx->oid_idx, + &rowreq_ctx->tbl_idx)) { + return MFD_ERROR; + } + + return MFD_SUCCESS; +} /* pgsqlPgAmTable_indexes_set */ + + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmname + * pgsqlPgAmAmname is subid 2 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.2 + * Description: +Name of the access method + * + * 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-pgsqlPgAmAmname.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 +pgsqlPgAmAmname_map(char **mib_pgsqlPgAmAmname_val_ptr_ptr, size_t *mib_pgsqlPgAmAmname_val_ptr_len_ptr, char *raw_pgsqlPgAmAmname_val_ptr, size_t raw_pgsqlPgAmAmname_val_ptr_len, int allow_realloc) +{ + int converted_len; + + netsnmp_assert(NULL != raw_pgsqlPgAmAmname_val_ptr); + netsnmp_assert((NULL != mib_pgsqlPgAmAmname_val_ptr_ptr) && (NULL != mib_pgsqlPgAmAmname_val_ptr_len_ptr)); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmname_map","called\n")); + + /* + * TODO:241:r: |-> Implement pgsqlPgAmAmname 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_pgsqlPgAmAmname_val_ptr_len; /* assume equal */ + if((NULL == *mib_pgsqlPgAmAmname_val_ptr_ptr) || (*mib_pgsqlPgAmAmname_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_pgsqlPgAmAmname_val_ptr_ptr = realloc( *mib_pgsqlPgAmAmname_val_ptr_ptr, converted_len * sizeof(**mib_pgsqlPgAmAmname_val_ptr_ptr)); + if(NULL == *mib_pgsqlPgAmAmname_val_ptr_ptr) { + snmp_log(LOG_ERR,"could not allocate memory\n"); + return SNMP_ERR_GENERR; + } + } + *mib_pgsqlPgAmAmname_val_ptr_len_ptr = converted_len; + memcpy( *mib_pgsqlPgAmAmname_val_ptr_ptr, raw_pgsqlPgAmAmname_val_ptr, converted_len ); + + return MFD_SUCCESS; +} /* pgsqlPgAmAmname_map */ + +/** + * Extract the current value of the pgsqlPgAmAmname data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmname_val_ptr_ptr + * Pointer to storage for a char variable + * @param pgsqlPgAmAmname_val_ptr_len_ptr + * Pointer to a size_t. On entry, it will contain the size (in bytes) + * pointed to by pgsqlPgAmAmname. + * 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 (*pgsqlPgAmAmname_val_ptr_len_ptr) bytes of memory, + * allocate it using malloc() and update pgsqlPgAmAmname_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 +pgsqlPgAmAmname_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, char **pgsqlPgAmAmname_val_ptr_ptr, size_t *pgsqlPgAmAmname_val_ptr_len_ptr ) +{ + /** we should have a non-NULL pointer and enough storage */ + netsnmp_assert( (NULL != pgsqlPgAmAmname_val_ptr_ptr) && (NULL != *pgsqlPgAmAmname_val_ptr_ptr)); + netsnmp_assert( NULL != pgsqlPgAmAmname_val_ptr_len_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmname_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmname data. + * set (* pgsqlPgAmAmname_val_ptr_ptr ) and (* pgsqlPgAmAmname_val_ptr_len_ptr ) from rowreq_ctx->data + */ + /* + * make sure there is enough space for pgsqlPgAmAmname data + */ + if ((NULL == (* pgsqlPgAmAmname_val_ptr_ptr )) || + ((* pgsqlPgAmAmname_val_ptr_len_ptr ) < (rowreq_ctx->data.pgsqlPgAmAmname_len * sizeof((* pgsqlPgAmAmname_val_ptr_ptr )[0])))) { + /* + * allocate space for pgsqlPgAmAmname data + */ + (* pgsqlPgAmAmname_val_ptr_ptr ) = malloc(rowreq_ctx->data.pgsqlPgAmAmname_len * sizeof((* pgsqlPgAmAmname_val_ptr_ptr )[0])); + if(NULL == (* pgsqlPgAmAmname_val_ptr_ptr )) { + snmp_log(LOG_ERR,"could not allocate memory\n"); + return MFD_ERROR; + } + } + (* pgsqlPgAmAmname_val_ptr_len_ptr ) = rowreq_ctx->data.pgsqlPgAmAmname_len * sizeof((* pgsqlPgAmAmname_val_ptr_ptr )[0]); + memcpy( (* pgsqlPgAmAmname_val_ptr_ptr ), rowreq_ctx->data.pgsqlPgAmAmname, (* pgsqlPgAmAmname_val_ptr_len_ptr ) ); + + return MFD_SUCCESS; +} /* pgsqlPgAmAmname_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmstrategies + * pgsqlPgAmAmstrategies is subid 3 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.3 + * Description: +Number of operator strategies for this access method + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAmAmstrategies.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 +pgsqlPgAmAmstrategies_map(long *mib_pgsqlPgAmAmstrategies_val_ptr, long raw_pgsqlPgAmAmstrategies_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmstrategies_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmstrategies_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmstrategies 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_pgsqlPgAmAmstrategies_val_ptr) = raw_pgsqlPgAmAmstrategies_val; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmstrategies_map */ + +/** + * Extract the current value of the pgsqlPgAmAmstrategies data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmstrategies_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmstrategies_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmstrategies_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmstrategies_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmstrategies_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmstrategies data. + * set (* pgsqlPgAmAmstrategies_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmstrategies_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmstrategies; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmstrategies_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmsupport + * pgsqlPgAmAmsupport is subid 4 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.4 + * Description: +Number of support routines for this access method + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAmAmsupport.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 +pgsqlPgAmAmsupport_map(long *mib_pgsqlPgAmAmsupport_val_ptr, long raw_pgsqlPgAmAmsupport_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmsupport_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmsupport_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmsupport 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_pgsqlPgAmAmsupport_val_ptr) = raw_pgsqlPgAmAmsupport_val; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmsupport_map */ + +/** + * Extract the current value of the pgsqlPgAmAmsupport data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmsupport_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmsupport_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmsupport_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmsupport_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmsupport_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmsupport data. + * set (* pgsqlPgAmAmsupport_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmsupport_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmsupport; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmsupport_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmorderstrategy + * pgsqlPgAmAmorderstrategy is subid 5 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.5 + * Description: +Zero if the index offers no sort order, otherwise the strategy number of the strategy operator that describes the sort order + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAmAmorderstrategy.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 +pgsqlPgAmAmorderstrategy_map(long *mib_pgsqlPgAmAmorderstrategy_val_ptr, long raw_pgsqlPgAmAmorderstrategy_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmorderstrategy_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmorderstrategy_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmorderstrategy 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_pgsqlPgAmAmorderstrategy_val_ptr) = raw_pgsqlPgAmAmorderstrategy_val; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmorderstrategy_map */ + +/** + * Extract the current value of the pgsqlPgAmAmorderstrategy data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmorderstrategy_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmorderstrategy_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmorderstrategy_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmorderstrategy_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmorderstrategy_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmorderstrategy data. + * set (* pgsqlPgAmAmorderstrategy_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmorderstrategy_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmorderstrategy; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmorderstrategy_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmcanunique + * pgsqlPgAmAmcanunique is subid 6 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.6 + * Description: +Does the access method support unique indexes? + * + * Attributes: + * accessible 1 isscalar 0 enums 1 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * Enum range: 2/8. Values: true(1), false(2) + * + * Its syntax is TruthValue (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) + */ +/** + * 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-pgsqlPgAmAmcanunique.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 +pgsqlPgAmAmcanunique_map(u_long *mib_pgsqlPgAmAmcanunique_val_ptr, u_long raw_pgsqlPgAmAmcanunique_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmcanunique_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmcanunique_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmcanunique enum mapping. + * uses INTERNAL_* macros defined in the header files + */ + switch(raw_pgsqlPgAmAmcanunique_val) { + case INTERNAL_PGSQLPGAMAMCANUNIQUE_TRUE: + *mib_pgsqlPgAmAmcanunique_val_ptr = TRUTHVALUE_TRUE; + break; + + case INTERNAL_PGSQLPGAMAMCANUNIQUE_FALSE: + *mib_pgsqlPgAmAmcanunique_val_ptr = TRUTHVALUE_FALSE; + break; + + default: + snmp_log(LOG_ERR, "couldn't map value %ld for pgsqlPgAmAmcanunique\n", raw_pgsqlPgAmAmcanunique_val ); + return MFD_ERROR; + } + + return MFD_SUCCESS; +} /* pgsqlPgAmAmcanunique_map */ + +/** + * Extract the current value of the pgsqlPgAmAmcanunique data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmcanunique_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmcanunique_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, u_long * pgsqlPgAmAmcanunique_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmcanunique_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmcanunique_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmcanunique data. + * set (* pgsqlPgAmAmcanunique_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmcanunique_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmcanunique; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmcanunique_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmcanmulticol + * pgsqlPgAmAmcanmulticol is subid 7 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.7 + * Description: +Does the access method support multicolumn indexes? + * + * Attributes: + * accessible 1 isscalar 0 enums 1 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * Enum range: 2/8. Values: true(1), false(2) + * + * Its syntax is TruthValue (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) + */ +/** + * 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-pgsqlPgAmAmcanmulticol.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 +pgsqlPgAmAmcanmulticol_map(u_long *mib_pgsqlPgAmAmcanmulticol_val_ptr, u_long raw_pgsqlPgAmAmcanmulticol_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmcanmulticol_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmcanmulticol_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmcanmulticol enum mapping. + * uses INTERNAL_* macros defined in the header files + */ + switch(raw_pgsqlPgAmAmcanmulticol_val) { + case INTERNAL_PGSQLPGAMAMCANMULTICOL_TRUE: + *mib_pgsqlPgAmAmcanmulticol_val_ptr = TRUTHVALUE_TRUE; + break; + + case INTERNAL_PGSQLPGAMAMCANMULTICOL_FALSE: + *mib_pgsqlPgAmAmcanmulticol_val_ptr = TRUTHVALUE_FALSE; + break; + + default: + snmp_log(LOG_ERR, "couldn't map value %ld for pgsqlPgAmAmcanmulticol\n", raw_pgsqlPgAmAmcanmulticol_val ); + return MFD_ERROR; + } + + return MFD_SUCCESS; +} /* pgsqlPgAmAmcanmulticol_map */ + +/** + * Extract the current value of the pgsqlPgAmAmcanmulticol data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmcanmulticol_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmcanmulticol_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, u_long * pgsqlPgAmAmcanmulticol_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmcanmulticol_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmcanmulticol_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmcanmulticol data. + * set (* pgsqlPgAmAmcanmulticol_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmcanmulticol_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmcanmulticol; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmcanmulticol_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmoptionalkey + * pgsqlPgAmAmoptionalkey is subid 8 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.8 + * Description: +Does the access method support a scan without any constraint for the first index column? + * + * Attributes: + * accessible 1 isscalar 0 enums 1 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * Enum range: 2/8. Values: true(1), false(2) + * + * Its syntax is TruthValue (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) + */ +/** + * 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-pgsqlPgAmAmoptionalkey.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 +pgsqlPgAmAmoptionalkey_map(u_long *mib_pgsqlPgAmAmoptionalkey_val_ptr, u_long raw_pgsqlPgAmAmoptionalkey_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmoptionalkey_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmoptionalkey_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmoptionalkey enum mapping. + * uses INTERNAL_* macros defined in the header files + */ + switch(raw_pgsqlPgAmAmoptionalkey_val) { + case INTERNAL_PGSQLPGAMAMOPTIONALKEY_TRUE: + *mib_pgsqlPgAmAmoptionalkey_val_ptr = TRUTHVALUE_TRUE; + break; + + case INTERNAL_PGSQLPGAMAMOPTIONALKEY_FALSE: + *mib_pgsqlPgAmAmoptionalkey_val_ptr = TRUTHVALUE_FALSE; + break; + + default: + snmp_log(LOG_ERR, "couldn't map value %ld for pgsqlPgAmAmoptionalkey\n", raw_pgsqlPgAmAmoptionalkey_val ); + return MFD_ERROR; + } + + return MFD_SUCCESS; +} /* pgsqlPgAmAmoptionalkey_map */ + +/** + * Extract the current value of the pgsqlPgAmAmoptionalkey data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmoptionalkey_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmoptionalkey_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, u_long * pgsqlPgAmAmoptionalkey_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmoptionalkey_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmoptionalkey_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmoptionalkey data. + * set (* pgsqlPgAmAmoptionalkey_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmoptionalkey_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmoptionalkey; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmoptionalkey_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmindexnulls + * pgsqlPgAmAmindexnulls is subid 9 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.9 + * Description: +Does the access method support null index entries? + * + * Attributes: + * accessible 1 isscalar 0 enums 1 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * Enum range: 2/8. Values: true(1), false(2) + * + * Its syntax is TruthValue (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) + */ +/** + * 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-pgsqlPgAmAmindexnulls.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 +pgsqlPgAmAmindexnulls_map(u_long *mib_pgsqlPgAmAmindexnulls_val_ptr, u_long raw_pgsqlPgAmAmindexnulls_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmindexnulls_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmindexnulls_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmindexnulls enum mapping. + * uses INTERNAL_* macros defined in the header files + */ + switch(raw_pgsqlPgAmAmindexnulls_val) { + case INTERNAL_PGSQLPGAMAMINDEXNULLS_TRUE: + *mib_pgsqlPgAmAmindexnulls_val_ptr = TRUTHVALUE_TRUE; + break; + + case INTERNAL_PGSQLPGAMAMINDEXNULLS_FALSE: + *mib_pgsqlPgAmAmindexnulls_val_ptr = TRUTHVALUE_FALSE; + break; + + default: + snmp_log(LOG_ERR, "couldn't map value %ld for pgsqlPgAmAmindexnulls\n", raw_pgsqlPgAmAmindexnulls_val ); + return MFD_ERROR; + } + + return MFD_SUCCESS; +} /* pgsqlPgAmAmindexnulls_map */ + +/** + * Extract the current value of the pgsqlPgAmAmindexnulls data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmindexnulls_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmindexnulls_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, u_long * pgsqlPgAmAmindexnulls_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmindexnulls_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmindexnulls_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmindexnulls data. + * set (* pgsqlPgAmAmindexnulls_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmindexnulls_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmindexnulls; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmindexnulls_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmstorage + * pgsqlPgAmAmstorage is subid 10 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.10 + * Description: +Can index storage data type differ from column data type? + * + * Attributes: + * accessible 1 isscalar 0 enums 1 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * Enum range: 2/8. Values: true(1), false(2) + * + * Its syntax is TruthValue (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) + */ +/** + * 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-pgsqlPgAmAmstorage.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 +pgsqlPgAmAmstorage_map(u_long *mib_pgsqlPgAmAmstorage_val_ptr, u_long raw_pgsqlPgAmAmstorage_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmstorage_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmstorage_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmstorage enum mapping. + * uses INTERNAL_* macros defined in the header files + */ + switch(raw_pgsqlPgAmAmstorage_val) { + case INTERNAL_PGSQLPGAMAMSTORAGE_TRUE: + *mib_pgsqlPgAmAmstorage_val_ptr = TRUTHVALUE_TRUE; + break; + + case INTERNAL_PGSQLPGAMAMSTORAGE_FALSE: + *mib_pgsqlPgAmAmstorage_val_ptr = TRUTHVALUE_FALSE; + break; + + default: + snmp_log(LOG_ERR, "couldn't map value %ld for pgsqlPgAmAmstorage\n", raw_pgsqlPgAmAmstorage_val ); + return MFD_ERROR; + } + + return MFD_SUCCESS; +} /* pgsqlPgAmAmstorage_map */ + +/** + * Extract the current value of the pgsqlPgAmAmstorage data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmstorage_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmstorage_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, u_long * pgsqlPgAmAmstorage_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmstorage_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmstorage_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmstorage data. + * set (* pgsqlPgAmAmstorage_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmstorage_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmstorage; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmstorage_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmclusterable + * pgsqlPgAmAmclusterable is subid 11 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.11 + * Description: +Can an index of this type be clustered on? + * + * Attributes: + * accessible 1 isscalar 0 enums 1 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * Enum range: 2/8. Values: true(1), false(2) + * + * Its syntax is TruthValue (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) + */ +/** + * 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-pgsqlPgAmAmclusterable.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 +pgsqlPgAmAmclusterable_map(u_long *mib_pgsqlPgAmAmclusterable_val_ptr, u_long raw_pgsqlPgAmAmclusterable_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmclusterable_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmclusterable_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmclusterable enum mapping. + * uses INTERNAL_* macros defined in the header files + */ + switch(raw_pgsqlPgAmAmclusterable_val) { + case INTERNAL_PGSQLPGAMAMCLUSTERABLE_TRUE: + *mib_pgsqlPgAmAmclusterable_val_ptr = TRUTHVALUE_TRUE; + break; + + case INTERNAL_PGSQLPGAMAMCLUSTERABLE_FALSE: + *mib_pgsqlPgAmAmclusterable_val_ptr = TRUTHVALUE_FALSE; + break; + + default: + snmp_log(LOG_ERR, "couldn't map value %ld for pgsqlPgAmAmclusterable\n", raw_pgsqlPgAmAmclusterable_val ); + return MFD_ERROR; + } + + return MFD_SUCCESS; +} /* pgsqlPgAmAmclusterable_map */ + +/** + * Extract the current value of the pgsqlPgAmAmclusterable data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmclusterable_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmclusterable_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, u_long * pgsqlPgAmAmclusterable_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmclusterable_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmclusterable_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmclusterable data. + * set (* pgsqlPgAmAmclusterable_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmclusterable_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmclusterable; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmclusterable_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAminsert + * pgsqlPgAmAminsert is subid 12 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.12 + * Description: +Insert this tuple + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAmAminsert.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 +pgsqlPgAmAminsert_map(long *mib_pgsqlPgAmAminsert_val_ptr, long raw_pgsqlPgAmAminsert_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAminsert_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAminsert_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAminsert 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_pgsqlPgAmAminsert_val_ptr) = raw_pgsqlPgAmAminsert_val; + + return MFD_SUCCESS; +} /* pgsqlPgAmAminsert_map */ + +/** + * Extract the current value of the pgsqlPgAmAminsert data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAminsert_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAminsert_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAminsert_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAminsert_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAminsert_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAminsert data. + * set (* pgsqlPgAmAminsert_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAminsert_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAminsert; + + return MFD_SUCCESS; +} /* pgsqlPgAmAminsert_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmbeginscan + * pgsqlPgAmAmbeginscan is subid 13 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.13 + * Description: +Start new scan + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAmAmbeginscan.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 +pgsqlPgAmAmbeginscan_map(long *mib_pgsqlPgAmAmbeginscan_val_ptr, long raw_pgsqlPgAmAmbeginscan_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmbeginscan_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmbeginscan_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmbeginscan 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_pgsqlPgAmAmbeginscan_val_ptr) = raw_pgsqlPgAmAmbeginscan_val; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmbeginscan_map */ + +/** + * Extract the current value of the pgsqlPgAmAmbeginscan data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmbeginscan_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmbeginscan_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmbeginscan_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmbeginscan_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmbeginscan_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmbeginscan data. + * set (* pgsqlPgAmAmbeginscan_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmbeginscan_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmbeginscan; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmbeginscan_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmgettuple + * pgsqlPgAmAmgettuple is subid 14 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.14 + * Description: +Next valid tuple + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAmAmgettuple.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 +pgsqlPgAmAmgettuple_map(long *mib_pgsqlPgAmAmgettuple_val_ptr, long raw_pgsqlPgAmAmgettuple_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmgettuple_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmgettuple_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmgettuple 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_pgsqlPgAmAmgettuple_val_ptr) = raw_pgsqlPgAmAmgettuple_val; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmgettuple_map */ + +/** + * Extract the current value of the pgsqlPgAmAmgettuple data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmgettuple_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmgettuple_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmgettuple_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmgettuple_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmgettuple_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmgettuple data. + * set (* pgsqlPgAmAmgettuple_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmgettuple_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmgettuple; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmgettuple_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmgetmulti + * pgsqlPgAmAmgetmulti is subid 15 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.15 + * Description: +Fetch multiple tuples + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAmAmgetmulti.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 +pgsqlPgAmAmgetmulti_map(long *mib_pgsqlPgAmAmgetmulti_val_ptr, long raw_pgsqlPgAmAmgetmulti_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmgetmulti_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmgetmulti_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmgetmulti 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_pgsqlPgAmAmgetmulti_val_ptr) = raw_pgsqlPgAmAmgetmulti_val; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmgetmulti_map */ + +/** + * Extract the current value of the pgsqlPgAmAmgetmulti data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmgetmulti_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmgetmulti_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmgetmulti_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmgetmulti_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmgetmulti_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmgetmulti data. + * set (* pgsqlPgAmAmgetmulti_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmgetmulti_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmgetmulti; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmgetmulti_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmrescan + * pgsqlPgAmAmrescan is subid 16 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.16 + * Description: +Restart this scan + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAmAmrescan.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 +pgsqlPgAmAmrescan_map(long *mib_pgsqlPgAmAmrescan_val_ptr, long raw_pgsqlPgAmAmrescan_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmrescan_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmrescan_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmrescan 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_pgsqlPgAmAmrescan_val_ptr) = raw_pgsqlPgAmAmrescan_val; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmrescan_map */ + +/** + * Extract the current value of the pgsqlPgAmAmrescan data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmrescan_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmrescan_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmrescan_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmrescan_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmrescan_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmrescan data. + * set (* pgsqlPgAmAmrescan_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmrescan_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmrescan; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmrescan_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmendscan + * pgsqlPgAmAmendscan is subid 17 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.17 + * Description: +End this scan + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAmAmendscan.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 +pgsqlPgAmAmendscan_map(long *mib_pgsqlPgAmAmendscan_val_ptr, long raw_pgsqlPgAmAmendscan_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmendscan_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmendscan_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmendscan 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_pgsqlPgAmAmendscan_val_ptr) = raw_pgsqlPgAmAmendscan_val; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmendscan_map */ + +/** + * Extract the current value of the pgsqlPgAmAmendscan data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmendscan_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmendscan_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmendscan_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmendscan_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmendscan_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmendscan data. + * set (* pgsqlPgAmAmendscan_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmendscan_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmendscan; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmendscan_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmmarkpos + * pgsqlPgAmAmmarkpos is subid 18 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.18 + * Description: +Mark current scan position + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAmAmmarkpos.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 +pgsqlPgAmAmmarkpos_map(long *mib_pgsqlPgAmAmmarkpos_val_ptr, long raw_pgsqlPgAmAmmarkpos_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmmarkpos_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmmarkpos_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmmarkpos 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_pgsqlPgAmAmmarkpos_val_ptr) = raw_pgsqlPgAmAmmarkpos_val; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmmarkpos_map */ + +/** + * Extract the current value of the pgsqlPgAmAmmarkpos data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmmarkpos_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmmarkpos_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmmarkpos_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmmarkpos_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmmarkpos_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmmarkpos data. + * set (* pgsqlPgAmAmmarkpos_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmmarkpos_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmmarkpos; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmmarkpos_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmrestrpos + * pgsqlPgAmAmrestrpos is subid 19 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.19 + * Description: +Restore marked scan position + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAmAmrestrpos.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 +pgsqlPgAmAmrestrpos_map(long *mib_pgsqlPgAmAmrestrpos_val_ptr, long raw_pgsqlPgAmAmrestrpos_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmrestrpos_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmrestrpos_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmrestrpos 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_pgsqlPgAmAmrestrpos_val_ptr) = raw_pgsqlPgAmAmrestrpos_val; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmrestrpos_map */ + +/** + * Extract the current value of the pgsqlPgAmAmrestrpos data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmrestrpos_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmrestrpos_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmrestrpos_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmrestrpos_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmrestrpos_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmrestrpos data. + * set (* pgsqlPgAmAmrestrpos_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmrestrpos_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmrestrpos; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmrestrpos_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmbuild + * pgsqlPgAmAmbuild is subid 20 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.20 + * Description: +Build new index + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAmAmbuild.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 +pgsqlPgAmAmbuild_map(long *mib_pgsqlPgAmAmbuild_val_ptr, long raw_pgsqlPgAmAmbuild_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmbuild_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmbuild_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmbuild 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_pgsqlPgAmAmbuild_val_ptr) = raw_pgsqlPgAmAmbuild_val; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmbuild_map */ + +/** + * Extract the current value of the pgsqlPgAmAmbuild data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmbuild_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmbuild_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmbuild_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmbuild_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmbuild_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmbuild data. + * set (* pgsqlPgAmAmbuild_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmbuild_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmbuild; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmbuild_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmbulkdelete + * pgsqlPgAmAmbulkdelete is subid 21 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.21 + * Description: +Bulk-delete function + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAmAmbulkdelete.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 +pgsqlPgAmAmbulkdelete_map(long *mib_pgsqlPgAmAmbulkdelete_val_ptr, long raw_pgsqlPgAmAmbulkdelete_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmbulkdelete_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmbulkdelete_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmbulkdelete 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_pgsqlPgAmAmbulkdelete_val_ptr) = raw_pgsqlPgAmAmbulkdelete_val; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmbulkdelete_map */ + +/** + * Extract the current value of the pgsqlPgAmAmbulkdelete data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmbulkdelete_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmbulkdelete_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmbulkdelete_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmbulkdelete_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmbulkdelete_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmbulkdelete data. + * set (* pgsqlPgAmAmbulkdelete_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmbulkdelete_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmbulkdelete; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmbulkdelete_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmvacuumcleanup + * pgsqlPgAmAmvacuumcleanup is subid 22 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.22 + * Description: +Post- VACUUM cleanup function + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAmAmvacuumcleanup.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 +pgsqlPgAmAmvacuumcleanup_map(long *mib_pgsqlPgAmAmvacuumcleanup_val_ptr, long raw_pgsqlPgAmAmvacuumcleanup_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmvacuumcleanup_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmvacuumcleanup_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmvacuumcleanup 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_pgsqlPgAmAmvacuumcleanup_val_ptr) = raw_pgsqlPgAmAmvacuumcleanup_val; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmvacuumcleanup_map */ + +/** + * Extract the current value of the pgsqlPgAmAmvacuumcleanup data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmvacuumcleanup_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmvacuumcleanup_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmvacuumcleanup_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmvacuumcleanup_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmvacuumcleanup_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmvacuumcleanup data. + * set (* pgsqlPgAmAmvacuumcleanup_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmvacuumcleanup_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmvacuumcleanup; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmvacuumcleanup_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmcostestimate + * pgsqlPgAmAmcostestimate is subid 23 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.23 + * Description: +Function to estimate cost of an index scan + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAmAmcostestimate.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 +pgsqlPgAmAmcostestimate_map(long *mib_pgsqlPgAmAmcostestimate_val_ptr, long raw_pgsqlPgAmAmcostestimate_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmcostestimate_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmcostestimate_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmcostestimate 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_pgsqlPgAmAmcostestimate_val_ptr) = raw_pgsqlPgAmAmcostestimate_val; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmcostestimate_map */ + +/** + * Extract the current value of the pgsqlPgAmAmcostestimate data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmcostestimate_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmcostestimate_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmcostestimate_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmcostestimate_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmcostestimate_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmcostestimate data. + * set (* pgsqlPgAmAmcostestimate_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmcostestimate_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmcostestimate; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmcostestimate_get */ + +/*--------------------------------------------------------------------- + * PGSQL-MIB::pgsqlPgAmEntry.pgsqlPgAmAmoptions + * pgsqlPgAmAmoptions is subid 24 of pgsqlPgAmEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.27645.1.2.2.1.24 + * Description: +Function to parse and validate reloptions for an index + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * 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-pgsqlPgAmAmoptions.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 +pgsqlPgAmAmoptions_map(long *mib_pgsqlPgAmAmoptions_val_ptr, long raw_pgsqlPgAmAmoptions_val) +{ + netsnmp_assert(NULL != mib_pgsqlPgAmAmoptions_val_ptr); + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmoptions_map","called\n")); + + /* + * TODO:241:o: |-> Implement pgsqlPgAmAmoptions 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_pgsqlPgAmAmoptions_val_ptr) = raw_pgsqlPgAmAmoptions_val; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmoptions_map */ + +/** + * Extract the current value of the pgsqlPgAmAmoptions data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param pgsqlPgAmAmoptions_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +pgsqlPgAmAmoptions_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmoptions_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != pgsqlPgAmAmoptions_val_ptr ); + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmAmoptions_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + +/* + * TODO:231:o: |-> Extract the current value of the pgsqlPgAmAmoptions data. + * set (* pgsqlPgAmAmoptions_val_ptr ) from rowreq_ctx->data + */ + (* pgsqlPgAmAmoptions_val_ptr ) = rowreq_ctx->data.pgsqlPgAmAmoptions; + + return MFD_SUCCESS; +} /* pgsqlPgAmAmoptions_get */ + + + +/** @} */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_get.h b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_get.h new file mode 100644 index 0000000..19852b7 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_get.h @@ -0,0 +1,107 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.18.2.1 $ of : mfd-data-get.m2c,v $ + * + * $Id: pgsqlPgAmTable_data_get.h,v 1.1 2008/01/17 12:29:36 eggyknap Exp $ + * + * @file pgsqlPgAmTable_data_get.h + * + * @addtogroup get + * + * Prototypes for get functions + * + * @{ + */ +#ifndef PGSQLPGAMTABLE_DATA_GET_H +#define PGSQLPGAMTABLE_DATA_GET_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* ********************************************************************* + * GET function declarations + */ + +/* ********************************************************************* + * GET Table declarations + */ +/********************************************************************** + ********************************************************************** + *** + *** Table pgsqlPgAmTable + *** + ********************************************************************** + **********************************************************************/ +/* + * pgsqlPgAmTable is subid 2 of pgsqlCatalogTables. + * Its status is Current. + * OID: .1.3.6.1.4.1.27645.1.2.2, length: 10 +*/ + /* + * indexes + */ + int pgsnmpdConnID_map(char **mib_pgsnmpdConnID_val_ptr_ptr, size_t *mib_pgsnmpdConnID_val_ptr_len_ptr, char *raw_pgsnmpdConnID_val_ptr, size_t raw_pgsnmpdConnID_val_ptr_len, int allow_realloc); + int rdbmsDbIndex_map(long *mib_rdbmsDbIndex_val_ptr, long raw_rdbmsDbIndex_val); + int pgsqlPgAmEntryOID_map(long *mib_pgsqlPgAmEntryOID_val_ptr, long raw_pgsqlPgAmEntryOID_val); + + int pgsqlPgAmAmname_map(char **mib_pgsqlPgAmAmname_val_ptr_ptr, size_t *mib_pgsqlPgAmAmname_val_ptr_len_ptr, char *raw_pgsqlPgAmAmname_val_ptr, size_t raw_pgsqlPgAmAmname_val_ptr_len, int allow_realloc); + int pgsqlPgAmAmname_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, char **pgsqlPgAmAmname_val_ptr_ptr, size_t *pgsqlPgAmAmname_val_ptr_len_ptr ); + int pgsqlPgAmAmstrategies_map(long *mib_pgsqlPgAmAmstrategies_val_ptr, long raw_pgsqlPgAmAmstrategies_val); + int pgsqlPgAmAmstrategies_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmstrategies_val_ptr ); + int pgsqlPgAmAmsupport_map(long *mib_pgsqlPgAmAmsupport_val_ptr, long raw_pgsqlPgAmAmsupport_val); + int pgsqlPgAmAmsupport_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmsupport_val_ptr ); + int pgsqlPgAmAmorderstrategy_map(long *mib_pgsqlPgAmAmorderstrategy_val_ptr, long raw_pgsqlPgAmAmorderstrategy_val); + int pgsqlPgAmAmorderstrategy_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmorderstrategy_val_ptr ); + int pgsqlPgAmAmcanunique_map(u_long *mib_pgsqlPgAmAmcanunique_val_ptr, u_long raw_pgsqlPgAmAmcanunique_val); + int pgsqlPgAmAmcanunique_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, u_long * pgsqlPgAmAmcanunique_val_ptr ); + int pgsqlPgAmAmcanmulticol_map(u_long *mib_pgsqlPgAmAmcanmulticol_val_ptr, u_long raw_pgsqlPgAmAmcanmulticol_val); + int pgsqlPgAmAmcanmulticol_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, u_long * pgsqlPgAmAmcanmulticol_val_ptr ); + int pgsqlPgAmAmoptionalkey_map(u_long *mib_pgsqlPgAmAmoptionalkey_val_ptr, u_long raw_pgsqlPgAmAmoptionalkey_val); + int pgsqlPgAmAmoptionalkey_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, u_long * pgsqlPgAmAmoptionalkey_val_ptr ); + int pgsqlPgAmAmindexnulls_map(u_long *mib_pgsqlPgAmAmindexnulls_val_ptr, u_long raw_pgsqlPgAmAmindexnulls_val); + int pgsqlPgAmAmindexnulls_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, u_long * pgsqlPgAmAmindexnulls_val_ptr ); + int pgsqlPgAmAmstorage_map(u_long *mib_pgsqlPgAmAmstorage_val_ptr, u_long raw_pgsqlPgAmAmstorage_val); + int pgsqlPgAmAmstorage_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, u_long * pgsqlPgAmAmstorage_val_ptr ); + int pgsqlPgAmAmclusterable_map(u_long *mib_pgsqlPgAmAmclusterable_val_ptr, u_long raw_pgsqlPgAmAmclusterable_val); + int pgsqlPgAmAmclusterable_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, u_long * pgsqlPgAmAmclusterable_val_ptr ); + int pgsqlPgAmAminsert_map(long *mib_pgsqlPgAmAminsert_val_ptr, long raw_pgsqlPgAmAminsert_val); + int pgsqlPgAmAminsert_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAminsert_val_ptr ); + int pgsqlPgAmAmbeginscan_map(long *mib_pgsqlPgAmAmbeginscan_val_ptr, long raw_pgsqlPgAmAmbeginscan_val); + int pgsqlPgAmAmbeginscan_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmbeginscan_val_ptr ); + int pgsqlPgAmAmgettuple_map(long *mib_pgsqlPgAmAmgettuple_val_ptr, long raw_pgsqlPgAmAmgettuple_val); + int pgsqlPgAmAmgettuple_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmgettuple_val_ptr ); + int pgsqlPgAmAmgetmulti_map(long *mib_pgsqlPgAmAmgetmulti_val_ptr, long raw_pgsqlPgAmAmgetmulti_val); + int pgsqlPgAmAmgetmulti_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmgetmulti_val_ptr ); + int pgsqlPgAmAmrescan_map(long *mib_pgsqlPgAmAmrescan_val_ptr, long raw_pgsqlPgAmAmrescan_val); + int pgsqlPgAmAmrescan_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmrescan_val_ptr ); + int pgsqlPgAmAmendscan_map(long *mib_pgsqlPgAmAmendscan_val_ptr, long raw_pgsqlPgAmAmendscan_val); + int pgsqlPgAmAmendscan_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmendscan_val_ptr ); + int pgsqlPgAmAmmarkpos_map(long *mib_pgsqlPgAmAmmarkpos_val_ptr, long raw_pgsqlPgAmAmmarkpos_val); + int pgsqlPgAmAmmarkpos_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmmarkpos_val_ptr ); + int pgsqlPgAmAmrestrpos_map(long *mib_pgsqlPgAmAmrestrpos_val_ptr, long raw_pgsqlPgAmAmrestrpos_val); + int pgsqlPgAmAmrestrpos_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmrestrpos_val_ptr ); + int pgsqlPgAmAmbuild_map(long *mib_pgsqlPgAmAmbuild_val_ptr, long raw_pgsqlPgAmAmbuild_val); + int pgsqlPgAmAmbuild_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmbuild_val_ptr ); + int pgsqlPgAmAmbulkdelete_map(long *mib_pgsqlPgAmAmbulkdelete_val_ptr, long raw_pgsqlPgAmAmbulkdelete_val); + int pgsqlPgAmAmbulkdelete_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmbulkdelete_val_ptr ); + int pgsqlPgAmAmvacuumcleanup_map(long *mib_pgsqlPgAmAmvacuumcleanup_val_ptr, long raw_pgsqlPgAmAmvacuumcleanup_val); + int pgsqlPgAmAmvacuumcleanup_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmvacuumcleanup_val_ptr ); + int pgsqlPgAmAmcostestimate_map(long *mib_pgsqlPgAmAmcostestimate_val_ptr, long raw_pgsqlPgAmAmcostestimate_val); + int pgsqlPgAmAmcostestimate_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmcostestimate_val_ptr ); + int pgsqlPgAmAmoptions_map(long *mib_pgsqlPgAmAmoptions_val_ptr, long raw_pgsqlPgAmAmoptions_val); + int pgsqlPgAmAmoptions_get( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, long * pgsqlPgAmAmoptions_val_ptr ); + + +int pgsqlPgAmTable_indexes_set_tbl_idx(pgsqlPgAmTable_mib_index *tbl_idx, char *pgsnmpdConnID_val_ptr, size_t pgsnmpdConnID_val_ptr_len, long rdbmsDbIndex_val, long pgsqlPgAmEntryOID_val); +int pgsqlPgAmTable_indexes_set(pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, char *pgsnmpdConnID_val_ptr, size_t pgsnmpdConnID_val_ptr_len, long rdbmsDbIndex_val, long pgsqlPgAmEntryOID_val); + + + + +#ifdef __cplusplus +} +#endif + +#endif /* PGSQLPGAMTABLE_DATA_GET_H */ +/** @} */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_set.c b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_set.c new file mode 100644 index 0000000..59971e9 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_set.c @@ -0,0 +1,24 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.18 $ of : mfd-data-set.m2c,v $ + * + * $Id: pgsqlPgAmTable_data_set.c,v 1.1 2008/01/17 12:29:36 eggyknap 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 "pgsqlPgAmTable.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/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_set.h b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_set.h new file mode 100644 index 0000000..b5ff1d8 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_data_set.h @@ -0,0 +1,27 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.18 $ of : mfd-data-set.m2c,v $ + * + * $Id: pgsqlPgAmTable_data_set.h,v 1.1 2008/01/17 12:29:36 eggyknap Exp $ + */ +#ifndef PGSQLPGAMTABLE_DATA_SET_H +#define PGSQLPGAMTABLE_DATA_SET_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* ********************************************************************* + * SET function declarations + */ + +/* ********************************************************************* + * SET Table declarations + */ + + +#ifdef __cplusplus +} +#endif + +#endif /* PGSQLPGAMTABLE_DATA_SET_H */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_enums.h b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_enums.h new file mode 100644 index 0000000..051af4e --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_enums.h @@ -0,0 +1,178 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : generic-table-enums.m2c,v 1.3 2004/05/18 17:44:32 rstory Exp $ + * + * $Id: pgsqlPgAmTable_enums.h,v 1.1 2008/01/17 12:29:36 eggyknap Exp $ + */ +#ifndef PGSQLPGAMTABLE_ENUMS_H +#define PGSQLPGAMTABLE_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 pgsqlPgAmTable + * + ************************************************************************* + *************************************************************************/ + +/************************************************************* + * constants for enums for the MIB node + * pgsqlPgAmAmcanunique (TruthValue / ASN_INTEGER) + * + * since a Textual Convention may be referenced more than once in a + * MIB, protect againt redefinitions of the enum values. + */ +#ifndef TRUTHVALUE_ENUMS +#define TRUTHVALUE_ENUMS + +#define TRUTHVALUE_TRUE 1 +#define TRUTHVALUE_FALSE 2 + + +#endif /* TRUTHVALUE_ENUMS */ + + /* + * TODO:140:o: Define interal representation of pgsqlPgAmAmcanunique enums. + * (used for value mapping; see notes at top of file) + */ +#define INTERNAL_PGSQLPGAMAMCANUNIQUE_TRUE 1 +#define INTERNAL_PGSQLPGAMAMCANUNIQUE_FALSE 2 + +/************************************************************* + * constants for enums for the MIB node + * pgsqlPgAmAmcanmulticol (TruthValue / ASN_INTEGER) + * + * since a Textual Convention may be referenced more than once in a + * MIB, protect againt redefinitions of the enum values. + */ +#ifndef TRUTHVALUE_ENUMS +#define TRUTHVALUE_ENUMS + +#define TRUTHVALUE_TRUE 1 +#define TRUTHVALUE_FALSE 2 + + +#endif /* TRUTHVALUE_ENUMS */ + + /* + * TODO:140:o: Define interal representation of pgsqlPgAmAmcanmulticol enums. + * (used for value mapping; see notes at top of file) + */ +#define INTERNAL_PGSQLPGAMAMCANMULTICOL_TRUE 1 +#define INTERNAL_PGSQLPGAMAMCANMULTICOL_FALSE 2 + +/************************************************************* + * constants for enums for the MIB node + * pgsqlPgAmAmoptionalkey (TruthValue / ASN_INTEGER) + * + * since a Textual Convention may be referenced more than once in a + * MIB, protect againt redefinitions of the enum values. + */ +#ifndef TRUTHVALUE_ENUMS +#define TRUTHVALUE_ENUMS + +#define TRUTHVALUE_TRUE 1 +#define TRUTHVALUE_FALSE 2 + + +#endif /* TRUTHVALUE_ENUMS */ + + /* + * TODO:140:o: Define interal representation of pgsqlPgAmAmoptionalkey enums. + * (used for value mapping; see notes at top of file) + */ +#define INTERNAL_PGSQLPGAMAMOPTIONALKEY_TRUE 1 +#define INTERNAL_PGSQLPGAMAMOPTIONALKEY_FALSE 2 + +/************************************************************* + * constants for enums for the MIB node + * pgsqlPgAmAmindexnulls (TruthValue / ASN_INTEGER) + * + * since a Textual Convention may be referenced more than once in a + * MIB, protect againt redefinitions of the enum values. + */ +#ifndef TRUTHVALUE_ENUMS +#define TRUTHVALUE_ENUMS + +#define TRUTHVALUE_TRUE 1 +#define TRUTHVALUE_FALSE 2 + + +#endif /* TRUTHVALUE_ENUMS */ + + /* + * TODO:140:o: Define interal representation of pgsqlPgAmAmindexnulls enums. + * (used for value mapping; see notes at top of file) + */ +#define INTERNAL_PGSQLPGAMAMINDEXNULLS_TRUE 1 +#define INTERNAL_PGSQLPGAMAMINDEXNULLS_FALSE 2 + +/************************************************************* + * constants for enums for the MIB node + * pgsqlPgAmAmstorage (TruthValue / ASN_INTEGER) + * + * since a Textual Convention may be referenced more than once in a + * MIB, protect againt redefinitions of the enum values. + */ +#ifndef TRUTHVALUE_ENUMS +#define TRUTHVALUE_ENUMS + +#define TRUTHVALUE_TRUE 1 +#define TRUTHVALUE_FALSE 2 + + +#endif /* TRUTHVALUE_ENUMS */ + + /* + * TODO:140:o: Define interal representation of pgsqlPgAmAmstorage enums. + * (used for value mapping; see notes at top of file) + */ +#define INTERNAL_PGSQLPGAMAMSTORAGE_TRUE 1 +#define INTERNAL_PGSQLPGAMAMSTORAGE_FALSE 2 + +/************************************************************* + * constants for enums for the MIB node + * pgsqlPgAmAmclusterable (TruthValue / ASN_INTEGER) + * + * since a Textual Convention may be referenced more than once in a + * MIB, protect againt redefinitions of the enum values. + */ +#ifndef TRUTHVALUE_ENUMS +#define TRUTHVALUE_ENUMS + +#define TRUTHVALUE_TRUE 1 +#define TRUTHVALUE_FALSE 2 + + +#endif /* TRUTHVALUE_ENUMS */ + + /* + * TODO:140:o: Define interal representation of pgsqlPgAmAmclusterable enums. + * (used for value mapping; see notes at top of file) + */ +#define INTERNAL_PGSQLPGAMAMCLUSTERABLE_TRUE 1 +#define INTERNAL_PGSQLPGAMAMCLUSTERABLE_FALSE 2 + + + +#ifdef __cplusplus +} +#endif + +#endif /* PGSQLPGAMTABLE_ENUMS_H */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_interface.c b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_interface.c new file mode 100644 index 0000000..3259307 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_interface.c @@ -0,0 +1,903 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.43.2.3 $ of : mfd-interface.m2c,v $ + * + * $Id: pgsqlPgAmTable_interface.c,v 1.1 2008/01/17 12:29:36 eggyknap Exp $ + */ +/* + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + * *** *** + * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** + * *** *** + * *** *** + * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** + * *** *** + * *** *** + * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** + * *** *** + * *** *** + * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** + * *** *** + * *** *** + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + */ + +/* 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 "pgsqlPgAmTable.h" + + +#include <net-snmp/library/container.h> + +#include "pgsqlPgAmTable_interface.h" + +/********************************************************************** + ********************************************************************** + *** + *** Table pgsqlPgAmTable + *** + ********************************************************************** + **********************************************************************/ +/* + * pgsqlPgAmTable is subid 2 of pgsqlCatalogTables. + * Its status is Current. + * OID: .1.3.6.1.4.1.27645.1.2.2, length: 10 +*/ +typedef struct pgsqlPgAmTable_interface_ctx_s { + + netsnmp_container *container; + netsnmp_cache *cache; /* optional cache */ + + pgsqlPgAmTable_registration_ptr user_ctx; + + netsnmp_table_registration_info tbl_info; + + netsnmp_baby_steps_access_methods access_multiplexer; + +} pgsqlPgAmTable_interface_ctx; + +static pgsqlPgAmTable_interface_ctx pgsqlPgAmTable_if_ctx; + +static void _pgsqlPgAmTable_container_init( + pgsqlPgAmTable_interface_ctx *if_ctx); + + +static Netsnmp_Node_Handler _mfd_pgsqlPgAmTable_pre_request; +static Netsnmp_Node_Handler _mfd_pgsqlPgAmTable_post_request; +static Netsnmp_Node_Handler _mfd_pgsqlPgAmTable_object_lookup; +static Netsnmp_Node_Handler _mfd_pgsqlPgAmTable_get_values; +/** + * @internal + * Initialize the table pgsqlPgAmTable + * (Define its contents and how it's structured) + */ +void +_pgsqlPgAmTable_initialize_interface(pgsqlPgAmTable_registration_ptr reg_ptr, u_long flags) +{ + netsnmp_baby_steps_access_methods *access_multiplexer = + &pgsqlPgAmTable_if_ctx.access_multiplexer; + netsnmp_table_registration_info *tbl_info = &pgsqlPgAmTable_if_ctx.tbl_info; + netsnmp_handler_registration *reginfo; + netsnmp_mib_handler *handler; + int mfd_modes = 0; + + DEBUGMSGTL(("internal:pgsqlPgAmTable:_pgsqlPgAmTable_initialize_interface","called\n")); + + + /************************************************* + * + * save interface context for pgsqlPgAmTable + */ + /* + * Setting up the table's definition + */ + netsnmp_table_helper_add_indexes(tbl_info, + ASN_OCTET_STR, /** index: pgsnmpdConnID */ + ASN_INTEGER, /** index: rdbmsDbIndex */ + ASN_INTEGER, /** index: pgsqlPgAmEntryOID */ + 0); + + /* Define the minimum and maximum accessible columns. This + optimizes retrival. */ + tbl_info->min_column = PGSQLPGAMTABLE_MIN_COL; + tbl_info->max_column = PGSQLPGAMTABLE_MAX_COL; + + /* + * save users context + */ + pgsqlPgAmTable_if_ctx.user_ctx = reg_ptr; + + /* + * call data access initialization code + */ + pgsqlPgAmTable_init_data(reg_ptr); + + /* + * set up the container + */ + _pgsqlPgAmTable_container_init(&pgsqlPgAmTable_if_ctx); + if (NULL == pgsqlPgAmTable_if_ctx.container) { + snmp_log(LOG_ERR,"could not initialize container for pgsqlPgAmTable\n"); + return; + } + + /* + * access_multiplexer: REQUIRED wrapper for get request handling + */ + access_multiplexer->object_lookup = _mfd_pgsqlPgAmTable_object_lookup; + access_multiplexer->get_values = _mfd_pgsqlPgAmTable_get_values; + + /* + * no wrappers yet + */ + access_multiplexer->pre_request = _mfd_pgsqlPgAmTable_pre_request; + access_multiplexer->post_request = _mfd_pgsqlPgAmTable_post_request; + + + /************************************************* + * + * Create a registration, save our reg data, register table. + */ + DEBUGMSGTL(("pgsqlPgAmTable:init_pgsqlPgAmTable", + "Registering pgsqlPgAmTable as a mibs-for-dummies table.\n")); + handler = netsnmp_baby_steps_access_multiplexer_get(access_multiplexer); + reginfo = netsnmp_handler_registration_create("pgsqlPgAmTable", handler, + pgsqlPgAmTable_oid, + pgsqlPgAmTable_oid_size, + HANDLER_CAN_BABY_STEP | + HANDLER_CAN_RONLY + ); + if(NULL == reginfo) { + snmp_log(LOG_ERR,"error registering table pgsqlPgAmTable\n"); + return; + } + reginfo->my_reg_void = &pgsqlPgAmTable_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, + pgsqlPgAmTable_if_ctx.container, + TABLE_CONTAINER_KEY_NETSNMP_INDEX); + netsnmp_inject_handler( reginfo, handler ); + + /************************************************* + * + * inject cache helper + */ + if(NULL != pgsqlPgAmTable_if_ctx.cache) { + handler = netsnmp_cache_handler_get(pgsqlPgAmTable_if_ctx.cache); + netsnmp_inject_handler( reginfo, handler ); + } + + /* + * register table + */ + netsnmp_register_table(reginfo, tbl_info); +} /* _pgsqlPgAmTable_initialize_interface */ + +void +pgsqlPgAmTable_valid_columns_set(netsnmp_column_info *vc) +{ + pgsqlPgAmTable_if_ctx.tbl_info.valid_columns = vc; +} /* pgsqlPgAmTable_valid_columns_set */ + +/** + * @internal + * convert the index component stored in the context to an oid + */ +int +pgsqlPgAmTable_index_to_oid(netsnmp_index *oid_idx, + pgsqlPgAmTable_mib_index *mib_idx) +{ + int err = SNMP_ERR_NOERROR; + + /* + * temp storage for parsing indexes + */ + /* + * pgsnmpdConnID(1)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H + */ + netsnmp_variable_list var_pgsnmpdConnID; + /* + * rdbmsDbIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h + */ + netsnmp_variable_list var_rdbmsDbIndex; + /* + * pgsqlPgAmEntryOID(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/r/d/h + */ + netsnmp_variable_list var_pgsqlPgAmEntryOID; + + /* + * set up varbinds + */ + memset( &var_pgsnmpdConnID, 0x00, sizeof(var_pgsnmpdConnID) ); + var_pgsnmpdConnID.type = ASN_OCTET_STR; + memset( &var_rdbmsDbIndex, 0x00, sizeof(var_rdbmsDbIndex) ); + var_rdbmsDbIndex.type = ASN_INTEGER; + memset( &var_pgsqlPgAmEntryOID, 0x00, sizeof(var_pgsqlPgAmEntryOID) ); + var_pgsqlPgAmEntryOID.type = ASN_INTEGER; + + /* + * chain temp index varbinds together + */ + var_pgsnmpdConnID.next_variable = &var_rdbmsDbIndex; var_rdbmsDbIndex.next_variable = &var_pgsqlPgAmEntryOID; var_pgsqlPgAmEntryOID.next_variable = NULL; + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmTable_index_to_oid","called\n")); + + /* pgsnmpdConnID(1)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H */ + snmp_set_var_value(&var_pgsnmpdConnID, (u_char*)&mib_idx->pgsnmpdConnID, + mib_idx->pgsnmpdConnID_len * sizeof(mib_idx->pgsnmpdConnID[0])); + + /* rdbmsDbIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h */ + snmp_set_var_value(&var_rdbmsDbIndex, (u_char*)&mib_idx->rdbmsDbIndex, + sizeof(mib_idx->rdbmsDbIndex)); + + /* pgsqlPgAmEntryOID(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/r/d/h */ + snmp_set_var_value(&var_pgsqlPgAmEntryOID, (u_char*)&mib_idx->pgsqlPgAmEntryOID, + sizeof(mib_idx->pgsqlPgAmEntryOID)); + + + err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len, + NULL, 0, &var_pgsnmpdConnID); + 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_pgsnmpdConnID ); + + return err; +} /* pgsqlPgAmTable_index_to_oid */ + +/** + * extract pgsqlPgAmTable indexes from a netsnmp_index + * + * @retval SNMP_ERR_NOERROR : no error + * @retval SNMP_ERR_GENERR : error + */ +int +pgsqlPgAmTable_index_from_oid(netsnmp_index *oid_idx, + pgsqlPgAmTable_mib_index *mib_idx) +{ + int err = SNMP_ERR_NOERROR; + + /* + * temp storage for parsing indexes + */ + /* + * pgsnmpdConnID(1)/DisplayString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H + */ + netsnmp_variable_list var_pgsnmpdConnID; + /* + * rdbmsDbIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/R/d/h + */ + netsnmp_variable_list var_rdbmsDbIndex; + /* + * pgsqlPgAmEntryOID(1)/INTEGER/ASN_INTEGER/long(long)//l/a/w/e/r/d/h + */ + netsnmp_variable_list var_pgsqlPgAmEntryOID; + + /* + * set up varbinds + */ + memset( &var_pgsnmpdConnID, 0x00, sizeof(var_pgsnmpdConnID) ); + var_pgsnmpdConnID.type = ASN_OCTET_STR; + memset( &var_rdbmsDbIndex, 0x00, sizeof(var_rdbmsDbIndex) ); + var_rdbmsDbIndex.type = ASN_INTEGER; + memset( &var_pgsqlPgAmEntryOID, 0x00, sizeof(var_pgsqlPgAmEntryOID) ); + var_pgsqlPgAmEntryOID.type = ASN_INTEGER; + + /* + * chain temp index varbinds together + */ + var_pgsnmpdConnID.next_variable = &var_rdbmsDbIndex; var_rdbmsDbIndex.next_variable = &var_pgsqlPgAmEntryOID; var_pgsqlPgAmEntryOID.next_variable = NULL; + + + DEBUGMSGTL(("verbose:pgsqlPgAmTable:pgsqlPgAmTable_index_from_oid","called\n")); + + /* + * parse the oid into the individual index components + */ + err = parse_oid_indexes( oid_idx->oids, oid_idx->len, + &var_pgsnmpdConnID ); + if (err == SNMP_ERR_NOERROR) { + /* + * copy out values + */ + /* + * NOTE: val_len is in bytes, pgsnmpdConnID_len might not be + */ + if(var_pgsnmpdConnID.val_len > sizeof(mib_idx->pgsnmpdConnID)) + err = SNMP_ERR_GENERR; + else { + memcpy(mib_idx->pgsnmpdConnID, var_pgsnmpdConnID.val.string, var_pgsnmpdConnID.val_len); + mib_idx->pgsnmpdConnID_len = var_pgsnmpdConnID.val_len / sizeof(mib_idx->pgsnmpdConnID[0]); + } + mib_idx->rdbmsDbIndex = *((long *)var_rdbmsDbIndex.val.string); + mib_idx->pgsqlPgAmEntryOID = *((long *)var_pgsqlPgAmEntryOID.val.string); + + + } + + /* + * parsing may have allocated memory. free it. + */ + snmp_reset_var_buffers( &var_pgsnmpdConnID ); + + return err; +} /* pgsqlPgAmTable_index_from_oid */ + + +/* ********************************************************************* + * @internal + * allocate resources for a pgsqlPgAmTable_rowreq_ctx + */ +pgsqlPgAmTable_rowreq_ctx * +pgsqlPgAmTable_allocate_rowreq_ctx(void) +{ + pgsqlPgAmTable_rowreq_ctx *rowreq_ctx = + SNMP_MALLOC_TYPEDEF(pgsqlPgAmTable_rowreq_ctx); + + DEBUGMSGTL(("internal:pgsqlPgAmTable:pgsqlPgAmTable_allocate_rowreq_ctx","called\n")); + + if(NULL == rowreq_ctx) { + snmp_log(LOG_ERR,"Couldn't allocate memory for a " + "pgsqlPgAmTable_rowreq_ctx.\n"); + } + + rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp; + + rowreq_ctx->pgsqlPgAmTable_data_list = NULL; + rowreq_ctx->pgsqlPgAmTable_reg = pgsqlPgAmTable_if_ctx.user_ctx; + + + return rowreq_ctx; +} /* pgsqlPgAmTable_allocate_rowreq_ctx */ + +/* + * @internal + * release resources for a pgsqlPgAmTable_rowreq_ctx + */ +void +pgsqlPgAmTable_release_rowreq_ctx(pgsqlPgAmTable_rowreq_ctx *rowreq_ctx) +{ + DEBUGMSGTL(("internal:pgsqlPgAmTable:pgsqlPgAmTable_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); +} /* pgsqlPgAmTable_release_rowreq_ctx */ + +/** + * @internal + * wrapper + */ +static int +_mfd_pgsqlPgAmTable_pre_request(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + int rc = pgsqlPgAmTable_pre_request(pgsqlPgAmTable_if_ctx.user_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("internal:pgsqlPgAmTable","error %d from " + "pgsqlPgAmTable_pre_request\n", rc)); + netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); + } + + return SNMP_ERR_NOERROR; +} /* _mfd_pgsqlPgAmTable_pre_request */ + +/** + * @internal + * wrapper + */ +static int +_mfd_pgsqlPgAmTable_post_request(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + pgsqlPgAmTable_rowreq_ctx *rowreq_ctx; + int rc = pgsqlPgAmTable_post_request(pgsqlPgAmTable_if_ctx.user_ctx); + if (MFD_SUCCESS != rc) { + /* + * nothing we can do about it but log it + */ + DEBUGMSGTL(("internal:pgsqlPgAmTable","error %d from " + "pgsqlPgAmTable_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(pgsqlPgAmTable_if_ctx.container, rowreq_ctx); + } + else if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) { + CONTAINER_REMOVE(pgsqlPgAmTable_if_ctx.container, rowreq_ctx); + pgsqlPgAmTable_release_rowreq_ctx(rowreq_ctx); + } + } + + return SNMP_ERR_NOERROR; +} /* _mfd_pgsqlPgAmTable_post_request */ + +/** + * @internal + * wrapper + */ +static int +_mfd_pgsqlPgAmTable_object_lookup(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + pgsqlPgAmTable_rowreq_ctx *rowreq_ctx = + netsnmp_container_table_row_extract(requests); + + DEBUGMSGTL(("internal:pgsqlPgAmTable:_mfd_pgsqlPgAmTable_object_lookup","called\n")); + + /* + * get our context from mfd + * pgsqlPgAmTable_interface_ctx *if_ctx = + * (pgsqlPgAmTable_interface_ctx *)reginfo->my_reg_void; + */ + + if(NULL == rowreq_ctx) { + netsnmp_request_set_error_all(requests, SNMP_ERR_NOCREATION); + } + else { + pgsqlPgAmTable_row_prep(rowreq_ctx); + } + + return SNMP_ERR_NOERROR; +} /* _mfd_pgsqlPgAmTable_object_lookup */ + +/*********************************************************************** + * + * GET processing + * + ***********************************************************************/ +/* + * @internal + * Retrieve the value for a particular column + */ +NETSNMP_STATIC_INLINE int +_pgsqlPgAmTable_get_column( pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, + netsnmp_variable_list *var, int column ) +{ + int rc = SNMPERR_SUCCESS; + + DEBUGMSGTL(("internal:pgsqlPgAmTable:_mfd_pgsqlPgAmTable_get_column","called\n")); + + + netsnmp_assert(NULL != rowreq_ctx); + + switch(column) { + + /* pgsqlPgAmAmname(2)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H */ + case COLUMN_PGSQLPGAMAMNAME: + var->type = ASN_OCTET_STR; +rc = pgsqlPgAmAmname_get(rowreq_ctx, (char **)&var->val.string, &var->val_len ); + break; + + /* pgsqlPgAmAmstrategies(3)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAMAMSTRATEGIES: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmstrategies_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAmAmsupport(4)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAMAMSUPPORT: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmsupport_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAmAmorderstrategy(5)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAMAMORDERSTRATEGY: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmorderstrategy_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAmAmcanunique(6)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h */ + case COLUMN_PGSQLPGAMAMCANUNIQUE: + var->val_len = sizeof(u_long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmcanunique_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* pgsqlPgAmAmcanmulticol(7)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h */ + case COLUMN_PGSQLPGAMAMCANMULTICOL: + var->val_len = sizeof(u_long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmcanmulticol_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* pgsqlPgAmAmoptionalkey(8)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h */ + case COLUMN_PGSQLPGAMAMOPTIONALKEY: + var->val_len = sizeof(u_long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmoptionalkey_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* pgsqlPgAmAmindexnulls(9)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h */ + case COLUMN_PGSQLPGAMAMINDEXNULLS: + var->val_len = sizeof(u_long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmindexnulls_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* pgsqlPgAmAmstorage(10)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h */ + case COLUMN_PGSQLPGAMAMSTORAGE: + var->val_len = sizeof(u_long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmstorage_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* pgsqlPgAmAmclusterable(11)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h */ + case COLUMN_PGSQLPGAMAMCLUSTERABLE: + var->val_len = sizeof(u_long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmclusterable_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* pgsqlPgAmAminsert(12)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAMAMINSERT: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAminsert_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAmAmbeginscan(13)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAMAMBEGINSCAN: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmbeginscan_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAmAmgettuple(14)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAMAMGETTUPLE: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmgettuple_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAmAmgetmulti(15)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAMAMGETMULTI: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmgetmulti_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAmAmrescan(16)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAMAMRESCAN: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmrescan_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAmAmendscan(17)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAMAMENDSCAN: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmendscan_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAmAmmarkpos(18)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAMAMMARKPOS: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmmarkpos_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAmAmrestrpos(19)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAMAMRESTRPOS: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmrestrpos_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAmAmbuild(20)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAMAMBUILD: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmbuild_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAmAmbulkdelete(21)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAMAMBULKDELETE: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmbulkdelete_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAmAmvacuumcleanup(22)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAMAMVACUUMCLEANUP: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmvacuumcleanup_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAmAmcostestimate(23)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAMAMCOSTESTIMATE: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmcostestimate_get(rowreq_ctx, (long *)var->val.string ); + break; + + /* pgsqlPgAmAmoptions(24)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ + case COLUMN_PGSQLPGAMAMOPTIONS: + var->val_len = sizeof(long); + var->type = ASN_INTEGER; +rc = pgsqlPgAmAmoptions_get(rowreq_ctx, (long *)var->val.string ); + break; + + default: + snmp_log(LOG_ERR,"unknown column %d in _pgsqlPgAmTable_get_column\n", column); + break; + } + + return rc; +} /* _pgsqlPgAmTable_get_column */ + +int +_mfd_pgsqlPgAmTable_get_values(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *agtreq_info, + netsnmp_request_info *requests) +{ + pgsqlPgAmTable_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:pgsqlPgAmTable:_mfd_pgsqlPgAmTable_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 = _pgsqlPgAmTable_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_pgsqlPgAmTable_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:pgsqlPgAmTable:_cache_load","called\n")); + + if((NULL == cache) || (NULL == cache->magic)) { + snmp_log(LOG_ERR, "invalid cache for pgsqlPgAmTable_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 pgsqlPgAmTable_cache_load((netsnmp_container*)cache->magic); +} /* _cache_load */ + +/** + * @internal + */ +static void +_cache_item_free(pgsqlPgAmTable_rowreq_ctx *rowreq_ctx, void *context) +{ + DEBUGMSGTL(("internal:pgsqlPgAmTable:_cache_item_free","called\n")); + + if(NULL == rowreq_ctx) + return; + + pgsqlPgAmTable_release_rowreq_ctx(rowreq_ctx); +} /* _cache_item_free */ + +/** + * @internal + */ +static void +_cache_free(netsnmp_cache *cache, void *magic) +{ + netsnmp_container *container; + + DEBUGMSGTL(("internal:pgsqlPgAmTable:_cache_free","called\n")); + + if((NULL == cache) || (NULL == cache->magic)) { + snmp_log(LOG_ERR, "invalid cache in pgsqlPgAmTable_cache_free\n"); + return; + } + + container = (netsnmp_container*)cache->magic; + + /* + * call user code + */ + pgsqlPgAmTable_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 +_pgsqlPgAmTable_container_init(pgsqlPgAmTable_interface_ctx *if_ctx) +{ + DEBUGMSGTL(("internal:pgsqlPgAmTable:_pgsqlPgAmTable_container_init","called\n")); + + /* + * set up the cache + */ + if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */ + _cache_load, _cache_free, + pgsqlPgAmTable_oid, + pgsqlPgAmTable_oid_size); + + if(NULL == if_ctx->cache) { + snmp_log(LOG_ERR, "error creating cache for pgsqlPgAmTable\n"); + return; + } + + if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET; + + pgsqlPgAmTable_container_init(&if_ctx->container, if_ctx->cache); + if(NULL == if_ctx->container) + if_ctx->container = netsnmp_container_find("pgsqlPgAmTable:table_container"); + if(NULL == if_ctx->container) { + snmp_log(LOG_ERR,"error creating container in " + "pgsqlPgAmTable_container_init\n"); + return; + } + if_ctx->cache->magic = (void*)if_ctx->container; +} /* _pgsqlPgAmTable_container_init */ + diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_interface.h b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_interface.h new file mode 100644 index 0000000..86903e1 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_interface.h @@ -0,0 +1,72 @@ +/* + * Note: this file originally auto-generated by mib2c using + * version : 1.43.2.3 $ of : mfd-interface.m2c,v $ + * + * $Id: pgsqlPgAmTable_interface.h,v 1.1 2008/01/17 12:29:36 eggyknap Exp $ + */ +/** @defgroup interface: Routines to interface to Net-SNMP + * + * \warning This code should not be modified, called directly, + * or used to interpret functionality. It is subject to + * change at any time. + * + * @{ + */ +/* + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + * *** *** + * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** + * *** *** + * *** *** + * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** + * *** *** + * *** *** + * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** + * *** *** + * *** *** + * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** + * *** *** + * *** *** + * ********************************************************************* + * ********************************************************************* + * ********************************************************************* + */ +#ifndef PGSQLPGAMTABLE_INTERFACE_H +#define PGSQLPGAMTABLE_INTERFACE_H + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "pgsqlPgAmTable.h" + +/* ******************************************************************** + * Table declarations + */ + +/* PUBLIC interface initialization routine */ +void _pgsqlPgAmTable_initialize_interface(pgsqlPgAmTable_registration_ptr user_ctx, + u_long flags); + + pgsqlPgAmTable_rowreq_ctx * pgsqlPgAmTable_allocate_rowreq_ctx(void); +void pgsqlPgAmTable_release_rowreq_ctx(pgsqlPgAmTable_rowreq_ctx *rowreq_ctx); + +int pgsqlPgAmTable_index_to_oid(netsnmp_index *oid_idx, + pgsqlPgAmTable_mib_index *mib_idx); +int pgsqlPgAmTable_index_from_oid(netsnmp_index *oid_idx, + pgsqlPgAmTable_mib_index *mib_idx); + +/* + * access to certain internals. use with caution! + */ +void pgsqlPgAmTable_valid_columns_set(netsnmp_column_info *vc); + + +#ifdef __cplusplus +} +#endif + +#endif /* PGSQLPGAMTABLE_INTERFACE_H */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_oids.h b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_oids.h new file mode 100644 index 0000000..85bb01d --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmTable/pgsqlPgAmTable_oids.h @@ -0,0 +1,50 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : generic-table-oids.m2c,v 1.10 2004/10/08 23:39:17 rstory Exp $ + * + * $Id: pgsqlPgAmTable_oids.h,v 1.1 2008/01/17 12:29:36 eggyknap Exp $ + */ +#ifndef PGSQLPGAMTABLE_OIDS_H +#define PGSQLPGAMTABLE_OIDS_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* column number definitions for table pgsqlPgAmTable */ +#define PGSQLPGAMTABLE_OID 1,3,6,1,4,1,27645,1,2,2 +#define COLUMN_PGSQLPGAMENTRYOID 1 +#define COLUMN_PGSQLPGAMAMNAME 2 +#define COLUMN_PGSQLPGAMAMSTRATEGIES 3 +#define COLUMN_PGSQLPGAMAMSUPPORT 4 +#define COLUMN_PGSQLPGAMAMORDERSTRATEGY 5 +#define COLUMN_PGSQLPGAMAMCANUNIQUE 6 +#define COLUMN_PGSQLPGAMAMCANMULTICOL 7 +#define COLUMN_PGSQLPGAMAMOPTIONALKEY 8 +#define COLUMN_PGSQLPGAMAMINDEXNULLS 9 +#define COLUMN_PGSQLPGAMAMSTORAGE 10 +#define COLUMN_PGSQLPGAMAMCLUSTERABLE 11 +#define COLUMN_PGSQLPGAMAMINSERT 12 +#define COLUMN_PGSQLPGAMAMBEGINSCAN 13 +#define COLUMN_PGSQLPGAMAMGETTUPLE 14 +#define COLUMN_PGSQLPGAMAMGETMULTI 15 +#define COLUMN_PGSQLPGAMAMRESCAN 16 +#define COLUMN_PGSQLPGAMAMENDSCAN 17 +#define COLUMN_PGSQLPGAMAMMARKPOS 18 +#define COLUMN_PGSQLPGAMAMRESTRPOS 19 +#define COLUMN_PGSQLPGAMAMBUILD 20 +#define COLUMN_PGSQLPGAMAMBULKDELETE 21 +#define COLUMN_PGSQLPGAMAMVACUUMCLEANUP 22 +#define COLUMN_PGSQLPGAMAMCOSTESTIMATE 23 +#define COLUMN_PGSQLPGAMAMOPTIONS 24 + +#define PGSQLPGAMTABLE_MIN_COL COLUMN_PGSQLPGAMAMNAME +#define PGSQLPGAMTABLE_MAX_COL COLUMN_PGSQLPGAMAMOPTIONS + + +#ifdef __cplusplus +} +#endif + +#endif /* PGSQLPGAMTABLE_OIDS_H */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/old/pgsqlPgAmopTable.c b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/old/pgsqlPgAmopTable.c new file mode 100644 index 0000000..66de62f --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/old/pgsqlPgAmopTable.c @@ -0,0 +1,316 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.iterate.conf 15999 2007-03-25 22:32:02Z dts12 $ + */ + +#include "pgsnmpd.h" +#include "pgsqlPgAmopTable.h" + +void fill_pgsqlPgAmopTable(void); + +/** Initializes the pgsqlPgAmopTable module */ +void +init_pgsqlPgAmopTable(void) +{ + /* here we initialize all the tables we're planning on supporting */ + initialize_table_pgsqlPgAmopTable(); +} + + /* TODO: "Determine the first/last column names" */ + +/** Initialize the pgsqlPgAmopTable table by defining its contents and how it's structured */ +void +initialize_table_pgsqlPgAmopTable(void) +{ + static oid pgsqlPgAmopTable_oid[] = {1,3,6,1,4,1,27645,1,2,3}; + size_t pgsqlPgAmopTable_oid_len = OID_LENGTH(pgsqlPgAmopTable_oid); + netsnmp_handler_registration *reg; + netsnmp_iterator_info *iinfo; + netsnmp_table_registration_info *table_info; + + reg = netsnmp_create_handler_registration( + "pgsqlPgAmopTable", pgsqlPgAmopTable_handler, + pgsqlPgAmopTable_oid, pgsqlPgAmopTable_oid_len, + HANDLER_CAN_RONLY + ); + + table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info ); + netsnmp_table_helper_add_indexes(table_info, + ASN_OCTET_STR, /* index: pgsnmpdConnID */ + ASN_INTEGER, /* index: rdbmsDbIndex */ + ASN_INTEGER, /* index: pgsqlPgAmopEntryOID */ + 0); + table_info->min_column = COLUMN_PGSQLPGAMOPAMOPFAMILY; + table_info->max_column = COLUMN_PGSQLPGAMOPAMOPMETHOD; + + iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info ); + iinfo->get_first_data_point = pgsqlPgAmopTable_get_first_data_point; + iinfo->get_next_data_point = pgsqlPgAmopTable_get_next_data_point; + iinfo->table_reginfo = table_info; + + netsnmp_register_table_iterator( reg, iinfo ); + + /* Initialise the contents of the table here */ + fill_pgsqlPgAmopTable(); +} + +#define CONNID_LEN 255 + + /* Typical data structure for a row entry */ +struct pgsqlPgAmopTable_entry { + /* Index values */ + u_char pgsnmpdConnID[CONNID_LEN]; + size_t pgsnmpdConnID_len; + long rdbmsDbIndex; + long pgsqlPgAmopEntryOID; + + /* Column values */ + long pgsqlPgAmopAmopfamily; + long pgsqlPgAmopAmoplefttype; + long pgsqlPgAmopAmoprighttype; + int pgsqlPgAmopAmopstrategy; + int pgsqlPgAmopAmopreqcheck; + long pgsqlPgAmopAmopopr; + long pgsqlPgAmopAmopmethod; + + /* Illustrate using a simple linked list */ + int valid; + struct pgsqlPgAmopTable_entry *next; +}; + +struct pgsqlPgAmopTable_entry *pgsqlPgAmopTable_head = NULL; + +/* Quiet compiler */ +struct pgsqlPgAmopTable_entry * +pgsqlPgAmopTable_createEntry( + char* pgsnmpdConnID, + size_t pgsnmpdConnID_len, + long rdbmsDbIndex, + long pgsqlPgAmopEntryOID + ); +void +pgsqlPgAmopTable_removeEntry( struct pgsqlPgAmopTable_entry *entry ); + +/* create a new row in the (unsorted) table */ +struct pgsqlPgAmopTable_entry * +pgsqlPgAmopTable_createEntry( + char* pgsnmpdConnID, + size_t pgsnmpdConnID_len, + long rdbmsDbIndex, + long pgsqlPgAmopEntryOID + ) { + struct pgsqlPgAmopTable_entry *entry; + + entry = SNMP_MALLOC_TYPEDEF(struct pgsqlPgAmopTable_entry); + if (!entry) + return NULL; + + /*memset(entry->pgsnmpdConnID, 0, CONNID_LEN); */ + memcpy(entry->pgsnmpdConnID, pgsnmpdConnID, pgsnmpdConnID_len); + entry->pgsnmpdConnID_len = pgsnmpdConnID_len; + entry->rdbmsDbIndex = rdbmsDbIndex; + entry->pgsqlPgAmopEntryOID = pgsqlPgAmopEntryOID; + + entry->next = pgsqlPgAmopTable_head; + pgsqlPgAmopTable_head = entry; + return entry; +} + +/* remove a row from the table */ +void +pgsqlPgAmopTable_removeEntry( struct pgsqlPgAmopTable_entry *entry ) { + struct pgsqlPgAmopTable_entry *ptr, *prev; + + if (!entry) + return; /* Nothing to remove */ + + for ( ptr = pgsqlPgAmopTable_head, prev = NULL; + ptr != NULL; + prev = ptr, ptr = ptr->next ) { + if ( ptr == entry ) + break; + } + if ( !ptr ) + return; /* Can't find it */ + + if ( prev == NULL ) + pgsqlPgAmopTable_head = ptr->next; + else + prev->next = ptr->next; + + SNMP_FREE( entry ); /* XXX - release any other internal resources */ +} + +void fill_pgsqlPgAmopTable(void) { + PGresult *pg_db_query; + int resultCount, i; + struct pgsqlPgAmopTable_entry *entry; + char pgsnmpdConnID[112] = "Default conn ID"; + size_t pgsnmpdConnID_len = strlen(pgsnmpdConnID) + 1; + long rdbmsDbIndex = 1; + + snmp_log(LOG_INFO, "Initializing pgsqlPgAmopTable\n"); + if (PQstatus(dbconn) == CONNECTION_OK) { + pg_db_query = PQexec(dbconn, "SELECT oid::INTEGER, amopfamily::INTEGER, amoplefttype::INTEGER, amoprighttype::INTEGER, amopstrategy, amopreqcheck, amopopr::INTEGER , amopmethod::INTEGER FROM pg_amop ORDER BY 1 ASC"); + } + else { + snmp_log(LOG_ERR, "Can't get connected to database\n"); + return; + /* TODO: I should signal MFD_RESOURCE_UNAVAILABLE somehow, here */ + } + + if (PQresultStatus(pg_db_query) != PGRES_TUPLES_OK) { + snmp_log(LOG_ERR, "Didn't get any results from the database\n"); + PQclear(pg_db_query); + return; + /* TODO: I should signal MFD_RESOURCE_UNAVAILABLE somehow, here */ + } + resultCount = PQntuples(pg_db_query); + for (i = 0; i < resultCount; i++) { + entry = pgsqlPgAmopTable_createEntry(pgsnmpdConnID, pgsnmpdConnID_len, + rdbmsDbIndex, atol(PQgetvalue(pg_db_query, i, 0))); + entry->pgsqlPgAmopAmopfamily = atol(PQgetvalue(pg_db_query, i, 1)); + entry->pgsqlPgAmopAmoplefttype = atol(PQgetvalue(pg_db_query, i, 2)); + entry->pgsqlPgAmopAmoprighttype = atol(PQgetvalue(pg_db_query, i, 3)); + entry->pgsqlPgAmopAmopstrategy = atoi(PQgetvalue(pg_db_query, i, 4)); + entry->pgsqlPgAmopAmopreqcheck = atoi(PQgetvalue(pg_db_query, i, 5)); + entry->pgsqlPgAmopAmopopr = atol(PQgetvalue(pg_db_query, i, 6)); + entry->pgsqlPgAmopAmopmethod = atol(PQgetvalue(pg_db_query, i, 7)); + } + snmp_log(LOG_INFO, "Finished initializing pgsqlPgAmopTable with %d entries\n", resultCount); +} + +/* Example iterator hook routines - using 'get_next' to do most of the work */ +netsnmp_variable_list * +pgsqlPgAmopTable_get_first_data_point(void **my_loop_context, + void **my_data_context, + netsnmp_variable_list *put_index_data, + netsnmp_iterator_info *mydata) +{ + *my_loop_context = pgsqlPgAmopTable_head; + return pgsqlPgAmopTable_get_next_data_point(my_loop_context, my_data_context, + put_index_data, mydata ); +} + +netsnmp_variable_list * +pgsqlPgAmopTable_get_next_data_point(void **my_loop_context, + void **my_data_context, + netsnmp_variable_list *put_index_data, + netsnmp_iterator_info *mydata) +{ + struct pgsqlPgAmopTable_entry *entry = (struct pgsqlPgAmopTable_entry *)*my_loop_context; + netsnmp_variable_list *idx = put_index_data; + + if ( entry ) { + snmp_set_var_value( idx, entry->pgsnmpdConnID, sizeof(entry->pgsnmpdConnID) ); + idx = idx->next_variable; + snmp_set_var_typed_integer( idx, ASN_INTEGER, entry->rdbmsDbIndex ); + idx = idx->next_variable; + snmp_set_var_typed_integer( idx, ASN_INTEGER, entry->pgsqlPgAmopEntryOID ); + idx = idx->next_variable; + *my_data_context = (void *)entry; + *my_loop_context = (void *)entry->next; + return put_index_data; + } else { + return NULL; + } +} + + +/** handles requests for the pgsqlPgAmopTable table */ +int +pgsqlPgAmopTable_handler( + netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) { + + netsnmp_request_info *request; + netsnmp_table_request_info *table_info; + struct pgsqlPgAmopTable_entry *table_entry; + + switch (reqinfo->mode) { + /* + * Read-support (also covers GetNext requests) + */ + case MODE_GET: + for (request=requests; request; request=request->next) { + table_entry = (struct pgsqlPgAmopTable_entry *) + netsnmp_extract_iterator_context(request); + table_info = netsnmp_extract_table_info( request); + + switch (table_info->colnum) { + case COLUMN_PGSQLPGAMOPAMOPFAMILY: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAmopAmopfamily); + break; + case COLUMN_PGSQLPGAMOPAMOPLEFTTYPE: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAmopAmoplefttype); + break; + case COLUMN_PGSQLPGAMOPAMOPRIGHTTYPE: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAmopAmoprighttype); + break; + case COLUMN_PGSQLPGAMOPAMOPSTRATEGY: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAmopAmopstrategy); + break; + case COLUMN_PGSQLPGAMOPAMOPREQCHECK: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAmopAmopreqcheck); + break; + case COLUMN_PGSQLPGAMOPAMOPOPR: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAmopAmopopr); + break; + case COLUMN_PGSQLPGAMOPAMOPMETHOD: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAmopAmopmethod); + break; + default: + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHOBJECT); + break; + } + } + break; + + } + return SNMP_ERR_NOERROR; +} diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/old/pgsqlPgAmopTable.h b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/old/pgsqlPgAmopTable.h new file mode 100644 index 0000000..2d7ee0c --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/old/pgsqlPgAmopTable.h @@ -0,0 +1,24 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.iterate.conf 15999 2007-03-25 22:32:02Z dts12 $ + */ +#ifndef PGSQLPGAMOPTABLE_H +#define PGSQLPGAMOPTABLE_H + +/* function declarations */ +void init_pgsqlPgAmopTable(void); +void initialize_table_pgsqlPgAmopTable(void); +Netsnmp_Node_Handler pgsqlPgAmopTable_handler; +Netsnmp_First_Data_Point pgsqlPgAmopTable_get_first_data_point; +Netsnmp_Next_Data_Point pgsqlPgAmopTable_get_next_data_point; + +/* column number definitions for table pgsqlPgAmopTable */ + #define COLUMN_PGSQLPGAMOPENTRYOID 1 + #define COLUMN_PGSQLPGAMOPAMOPFAMILY 2 + #define COLUMN_PGSQLPGAMOPAMOPLEFTTYPE 3 + #define COLUMN_PGSQLPGAMOPAMOPRIGHTTYPE 4 + #define COLUMN_PGSQLPGAMOPAMOPSTRATEGY 5 + #define COLUMN_PGSQLPGAMOPAMOPREQCHECK 6 + #define COLUMN_PGSQLPGAMOPAMOPOPR 7 + #define COLUMN_PGSQLPGAMOPAMOPMETHOD 8 +#endif /* PGSQLPGAMOPTABLE_H */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/pgsqlPgAmopTable.c b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/pgsqlPgAmopTable.c new file mode 100644 index 0000000..74d70f2 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/pgsqlPgAmopTable.c @@ -0,0 +1,329 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.iterate.conf 15999 2007-03-25 22:32:02Z dts12 $ + */ + +#include "pgsnmpd.h" +#include "pgsqlPgAmopTable.h" + + /* TODO: if this works, move it to pgsnmpd.h */ +#define CONNIDLEN 113 + /* Typical data structure for a row entry */ +struct pgsqlPgAmopTable_entry { + /* Index values */ + u_char pgsnmpdConnID[CONNIDLEN]; + size_t pgsnmpdConnID_len; + long rdbmsDbIndex; + long pgsqlPgAmopEntryOID; + + /* Column values */ + /*long pgsqlPgAmopEntryOID; */ + long pgsqlPgAmopAmopfamily; + long pgsqlPgAmopAmoplefttype; + long pgsqlPgAmopAmoprighttype; + long pgsqlPgAmopAmopstrategy; + long pgsqlPgAmopAmopreqcheck; + long pgsqlPgAmopAmopopr; + long pgsqlPgAmopAmopmethod; + + /* Illustrate using a simple linked list */ + int valid; + struct pgsqlPgAmopTable_entry *next; +}; + +struct pgsqlPgAmopTable_entry *pgsqlPgAmopTable_head; + +struct pgsqlPgAmopTable_entry *pgsqlPgAmopTable_createEntry( + char* pgsnmpdConnID, + size_t pgsnmpdConnID_len, + long rdbmsDbIndex, + long pgsqlPgAmopEntryOID + ); + +void +pgsqlPgAmopTable_removeEntry( struct pgsqlPgAmopTable_entry *entry ); + +/** Initializes the pgsqlPgAmopTable module */ +void +init_pgsqlPgAmopTable(void) +{ + /* here we initialize all the tables we're planning on supporting */ + initialize_table_pgsqlPgAmopTable(); +} + +void fill_pgsqlPgAmopTable(void) { + PGresult *pg_db_query; + int resultCount, i; + struct pgsqlPgAmopTable_entry *entry; + char pgsnmpdConnID[112] = "Default conn ID"; + size_t pgsnmpdConnID_len = strlen(pgsnmpdConnID) + 1; + long rdbmsDbIndex = 1; + + snmp_log(LOG_INFO, "Initializing pgsqlPgAmopTable\n"); + if (PQstatus(dbconn) == CONNECTION_OK) { + pg_db_query = PQexec(dbconn, "SELECT oid::INTEGER, amopfamily::INTEGER, amoplefttype::INTEGER, amoprighttype::INTEGER, amopstrategy, amopreqcheck, amopopr::INTEGER , amopmethod::INTEGER FROM pg_amop ORDER BY 1 ASC LIMIT 3"); + } + else { + snmp_log(LOG_ERR, "Can't get connected to database\n"); + return; + /* TODO: I should signal MFD_RESOURCE_UNAVAILABLE somehow, here */ + } + + if (PQresultStatus(pg_db_query) != PGRES_TUPLES_OK) { + snmp_log(LOG_ERR, "Didn't get any results from the database\n"); + PQclear(pg_db_query); + return; + /* TODO: I should signal MFD_RESOURCE_UNAVAILABLE somehow, here */ + } + resultCount = PQntuples(pg_db_query); + for (i = 0; i < resultCount; i++) { + entry = pgsqlPgAmopTable_createEntry(pgsnmpdConnID, pgsnmpdConnID_len, + rdbmsDbIndex, atol(PQgetvalue(pg_db_query, i, 0))); + entry->pgsqlPgAmopAmopfamily = atol(PQgetvalue(pg_db_query, i, 1)); + entry->pgsqlPgAmopAmoplefttype = atol(PQgetvalue(pg_db_query, i, 2)); + entry->pgsqlPgAmopAmoprighttype = atol(PQgetvalue(pg_db_query, i, 3)); + entry->pgsqlPgAmopAmopstrategy = atoi(PQgetvalue(pg_db_query, i, 4)); + entry->pgsqlPgAmopAmopreqcheck = atoi(PQgetvalue(pg_db_query, i, 5)); + entry->pgsqlPgAmopAmopopr = atol(PQgetvalue(pg_db_query, i, 6)); + entry->pgsqlPgAmopAmopmethod = atol(PQgetvalue(pg_db_query, i, 7)); + } + snmp_log(LOG_INFO, "Finished initializing pgsqlPgAmopTable with %d entries\n", resultCount); +} + +/* TODO # Determine the first/last column names */ + +/** Initialize the pgsqlPgAmopTable table by defining its contents and how it's structured */ +void +initialize_table_pgsqlPgAmopTable(void) +{ + static oid pgsqlPgAmopTable_oid[] = {1,3,6,1,4,1,27645,1,2,3}; + size_t pgsqlPgAmopTable_oid_len = OID_LENGTH(pgsqlPgAmopTable_oid); + netsnmp_handler_registration *reg; + netsnmp_iterator_info *iinfo; + netsnmp_table_registration_info *table_info; + struct pgsqlPgAmopTable_entry *entry; + char *connID = "Default conn ID\0"; + int conn_len = strlen(connID); + + reg = netsnmp_create_handler_registration( + "pgsqlPgAmopTable", pgsqlPgAmopTable_handler, + pgsqlPgAmopTable_oid, pgsqlPgAmopTable_oid_len, + HANDLER_CAN_RONLY + ); + + table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info ); + netsnmp_table_helper_add_indexes(table_info, + ASN_OCTET_STR, /* index: pgsnmpdConnID */ + ASN_INTEGER, /* index: rdbmsDbIndex */ + ASN_INTEGER, /* index: pgsqlPgAmopEntryOID */ + 0); + table_info->min_column = COLUMN_PGSQLPGAMOPENTRYOID; + table_info->max_column = COLUMN_PGSQLPGAMOPAMOPMETHOD; + + iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info ); + iinfo->get_first_data_point = pgsqlPgAmopTable_get_first_data_point; + iinfo->get_next_data_point = pgsqlPgAmopTable_get_next_data_point; + iinfo->table_reginfo = table_info; + + netsnmp_register_table_iterator( reg, iinfo ); + + /* Initialise the contents of the table here */ + fill_pgsqlPgAmopTable(); +} + +/* create a new row in the (unsorted) table */ +struct pgsqlPgAmopTable_entry * +pgsqlPgAmopTable_createEntry( + char* pgsnmpdConnID, + size_t pgsnmpdConnID_len, + long rdbmsDbIndex, + long pgsqlPgAmopEntryOID + ) { + struct pgsqlPgAmopTable_entry *entry; + + entry = SNMP_MALLOC_TYPEDEF(struct pgsqlPgAmopTable_entry); + if (!entry) + return NULL; + + memset(entry->pgsnmpdConnID, 0, CONNIDLEN); + memcpy(entry->pgsnmpdConnID, pgsnmpdConnID, pgsnmpdConnID_len); + entry->pgsnmpdConnID_len = pgsnmpdConnID_len; + entry->rdbmsDbIndex = rdbmsDbIndex; + entry->pgsqlPgAmopEntryOID = pgsqlPgAmopEntryOID; + entry->next = pgsqlPgAmopTable_head; + pgsqlPgAmopTable_head = entry; + return entry; +} + +/* remove a row from the table */ +void +pgsqlPgAmopTable_removeEntry( struct pgsqlPgAmopTable_entry *entry ) { + struct pgsqlPgAmopTable_entry *ptr, *prev; + + if (!entry) + return; /* Nothing to remove */ + + for ( ptr = pgsqlPgAmopTable_head, prev = NULL; + ptr != NULL; + prev = ptr, ptr = ptr->next ) { + if ( ptr == entry ) + break; + } + if ( !ptr ) + return; /* Can't find it */ + + if ( prev == NULL ) + pgsqlPgAmopTable_head = ptr->next; + else + prev->next = ptr->next; + + SNMP_FREE( entry ); /* XXX - release any other internal resources */ +} + + +/* Example iterator hook routines - using 'get_next' to do most of the work */ +netsnmp_variable_list * +pgsqlPgAmopTable_get_first_data_point(void **my_loop_context, + void **my_data_context, + netsnmp_variable_list *put_index_data, + netsnmp_iterator_info *mydata) +{ + *my_loop_context = pgsqlPgAmopTable_head; + snmp_log(LOG_INFO, "*** get_first called\n"); + return pgsqlPgAmopTable_get_next_data_point(my_loop_context, my_data_context, + put_index_data, mydata ); +} + +netsnmp_variable_list * +pgsqlPgAmopTable_get_next_data_point(void **my_loop_context, + void **my_data_context, + netsnmp_variable_list *put_index_data, + netsnmp_iterator_info *mydata) +{ + struct pgsqlPgAmopTable_entry *entry = (struct pgsqlPgAmopTable_entry *)*my_loop_context; + netsnmp_variable_list *idx = put_index_data; + + snmp_log(LOG_INFO, "*** get_next called\n"); + if ( entry ) { + snmp_set_var_value( idx, entry->pgsnmpdConnID, sizeof(entry->pgsnmpdConnID) ); + idx = idx->next_variable; + snmp_set_var_typed_integer( idx, ASN_INTEGER, entry->rdbmsDbIndex ); + idx = idx->next_variable; + snmp_set_var_typed_integer( idx, ASN_INTEGER, entry->pgsqlPgAmopEntryOID ); + idx = idx->next_variable; + *my_data_context = (void *)entry; + *my_loop_context = (void *)entry->next; + return put_index_data; + } else { + return NULL; + } +} + + +/** handles requests for the pgsqlPgAmopTable table */ +int +pgsqlPgAmopTable_handler( + netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) { + + netsnmp_request_info *request; + netsnmp_table_request_info *table_info; + struct pgsqlPgAmopTable_entry *table_entry; + + snmp_log(LOG_INFO, "Handler called\n"); + switch (reqinfo->mode) { + /* + * Read-support (also covers GetNext requests) + */ + case MODE_GET: + for (request=requests; request; request=request->next) { + table_entry = (struct pgsqlPgAmopTable_entry *) + netsnmp_extract_iterator_context(request); + table_info = netsnmp_extract_table_info( request); + + switch (table_info->colnum) { + case COLUMN_PGSQLPGAMOPENTRYOID: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAmopEntryOID); + break; + case COLUMN_PGSQLPGAMOPAMOPFAMILY: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAmopAmopfamily); + break; + case COLUMN_PGSQLPGAMOPAMOPLEFTTYPE: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAmopAmoplefttype); + break; + case COLUMN_PGSQLPGAMOPAMOPRIGHTTYPE: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAmopAmoprighttype); + break; + case COLUMN_PGSQLPGAMOPAMOPSTRATEGY: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAmopAmopstrategy); + break; + case COLUMN_PGSQLPGAMOPAMOPREQCHECK: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAmopAmopreqcheck); + break; + case COLUMN_PGSQLPGAMOPAMOPOPR: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAmopAmopopr); + break; + case COLUMN_PGSQLPGAMOPAMOPMETHOD: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAmopAmopmethod); + break; + default: + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHOBJECT); + break; + } + } + break; + + } + return SNMP_ERR_NOERROR; +} diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/pgsqlPgAmopTable.h b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/pgsqlPgAmopTable.h new file mode 100644 index 0000000..2d7ee0c --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/pgsqlPgAmopTable.h @@ -0,0 +1,24 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.iterate.conf 15999 2007-03-25 22:32:02Z dts12 $ + */ +#ifndef PGSQLPGAMOPTABLE_H +#define PGSQLPGAMOPTABLE_H + +/* function declarations */ +void init_pgsqlPgAmopTable(void); +void initialize_table_pgsqlPgAmopTable(void); +Netsnmp_Node_Handler pgsqlPgAmopTable_handler; +Netsnmp_First_Data_Point pgsqlPgAmopTable_get_first_data_point; +Netsnmp_Next_Data_Point pgsqlPgAmopTable_get_next_data_point; + +/* column number definitions for table pgsqlPgAmopTable */ + #define COLUMN_PGSQLPGAMOPENTRYOID 1 + #define COLUMN_PGSQLPGAMOPAMOPFAMILY 2 + #define COLUMN_PGSQLPGAMOPAMOPLEFTTYPE 3 + #define COLUMN_PGSQLPGAMOPAMOPRIGHTTYPE 4 + #define COLUMN_PGSQLPGAMOPAMOPSTRATEGY 5 + #define COLUMN_PGSQLPGAMOPAMOPREQCHECK 6 + #define COLUMN_PGSQLPGAMOPAMOPOPR 7 + #define COLUMN_PGSQLPGAMOPAMOPMETHOD 8 +#endif /* PGSQLPGAMOPTABLE_H */ diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/tmp/pgsqlPgAggregateTable.c b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/tmp/pgsqlPgAggregateTable.c new file mode 100644 index 0000000..b9e769d --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/tmp/pgsqlPgAggregateTable.c @@ -0,0 +1,254 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.iterate.conf 15999 2007-03-25 22:32:02Z dts12 $ + */ + +#include <net-snmp/net-snmp-config.h> +#include <net-snmp/net-snmp-includes.h> +#include <net-snmp/agent/net-snmp-agent-includes.h> +#include "pgsqlPgAggregateTable.h" + +/** Initializes the pgsqlPgAggregateTable module */ +void +init_pgsqlPgAggregateTable(void) +{ + /* here we initialize all the tables we're planning on supporting */ + initialize_table_pgsqlPgAggregateTable(); +} + + # Determine the first/last column names + +/** Initialize the pgsqlPgAggregateTable table by defining its contents and how it's structured */ +void +initialize_table_pgsqlPgAggregateTable(void) +{ + static oid pgsqlPgAggregateTable_oid[] = {1,3,6,1,4,1,27645,1,2,1}; + size_t pgsqlPgAggregateTable_oid_len = OID_LENGTH(pgsqlPgAggregateTable_oid); + netsnmp_handler_registration *reg; + netsnmp_iterator_info *iinfo; + netsnmp_table_registration_info *table_info; + + reg = netsnmp_create_handler_registration( + "pgsqlPgAggregateTable", pgsqlPgAggregateTable_handler, + pgsqlPgAggregateTable_oid, pgsqlPgAggregateTable_oid_len, + HANDLER_CAN_RONLY + ); + + table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info ); + netsnmp_table_helper_add_indexes(table_info, + ASN_OCTET_STR, /* index: pgsnmpdConnID */ + ASN_INTEGER, /* index: rdbmsDbIndex */ + ASN_INTEGER, /* index: pgsqlPgAggregateEntryOID */ + 0); + table_info->min_column = COLUMN_PGSQLPGAGGREGATEAGGFNOID; + table_info->max_column = COLUMN_PGSQLPGAGGREGATEAGGINITVAL; + + iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info ); + iinfo->get_first_data_point = pgsqlPgAggregateTable_get_first_data_point; + iinfo->get_next_data_point = pgsqlPgAggregateTable_get_next_data_point; + iinfo->table_reginfo = table_info; + + netsnmp_register_table_iterator( reg, iinfo ); + + /* Initialise the contents of the table here */ +} + + /* Typical data structure for a row entry */ +struct pgsqlPgAggregateTable_entry { + /* Index values */ + char pgsnmpdConnID[NNN]; + size_t pgsnmpdConnID_len; + long rdbmsDbIndex; + long pgsqlPgAggregateEntryOID; + + /* Column values */ + long pgsqlPgAggregateAggfnoid; + long pgsqlPgAggregateAggtransfn; + long pgsqlPgAggregateAggfinalfn; + long pgsqlPgAggregateAggsortop; + long pgsqlPgAggregateAggtranstype; + char pgsqlPgAggregateAgginitval[NNN]; + size_t pgsqlPgAggregateAgginitval_len; + + /* Illustrate using a simple linked list */ + int valid; + struct pgsqlPgAggregateTable_entry *next; +}; + +struct pgsqlPgAggregateTable_entry *pgsqlPgAggregateTable_head; + +/* create a new row in the (unsorted) table */ +struct pgsqlPgAggregateTable_entry * +pgsqlPgAggregateTable_createEntry( + char* pgsnmpdConnID, + size_t pgsnmpdConnID_len, + long rdbmsDbIndex, + long pgsqlPgAggregateEntryOID, + ) { + struct pgsqlPgAggregateTable_entry *entry; + + entry = SNMP_MALLOC_TYPEDEF(struct pgsqlPgAggregateTable_entry); + if (!entry) + return NULL; + + memcpy(entry->pgsnmpdConnID, pgsnmpdConnID, pgsnmpdConnID_len); + entry->pgsnmpdConnID_len = pgsnmpdConnID_len; + entry->rdbmsDbIndex = rdbmsDbIndex; + entry->pgsqlPgAggregateEntryOID = pgsqlPgAggregateEntryOID; + entry->next = pgsqlPgAggregateTable_head; + pgsqlPgAggregateTable_head = entry; + return entry; +} + +/* remove a row from the table */ +void +pgsqlPgAggregateTable_removeEntry( struct pgsqlPgAggregateTable_entry *entry ) { + struct pgsqlPgAggregateTable_entry *ptr, *prev; + + if (!entry) + return; /* Nothing to remove */ + + for ( ptr = pgsqlPgAggregateTable_head, prev = NULL; + ptr != NULL; + prev = ptr, ptr = ptr->next ) { + if ( ptr == entry ) + break; + } + if ( !ptr ) + return; /* Can't find it */ + + if ( prev == NULL ) + pgsqlPgAggregateTable_head = ptr->next; + else + prev->next = ptr->next; + + SNMP_FREE( entry ); /* XXX - release any other internal resources */ +} + + +/* Example iterator hook routines - using 'get_next' to do most of the work */ +netsnmp_variable_list * +pgsqlPgAggregateTable_get_first_data_point(void **my_loop_context, + void **my_data_context, + netsnmp_variable_list *put_index_data, + netsnmp_iterator_info *mydata) +{ + *my_loop_context = pgsqlPgAggregateTable_head; + return pgsqlPgAggregateTable_get_next_data_point(my_loop_context, my_data_context, + put_index_data, mydata ); +} + +netsnmp_variable_list * +pgsqlPgAggregateTable_get_next_data_point(void **my_loop_context, + void **my_data_context, + netsnmp_variable_list *put_index_data, + netsnmp_iterator_info *mydata) +{ + struct pgsqlPgAggregateTable_entry *entry = (struct pgsqlPgAggregateTable_entry *)*my_loop_context; + netsnmp_variable_list *idx = put_index_data; + + if ( entry ) { + snmp_set_var_value( idx, entry->pgsnmpdConnID, sizeof(entry->pgsnmpdConnID) ); + idx = idx->next_variable; + snmp_set_var_typed_integer( idx, ASN_INTEGER, entry->rdbmsDbIndex ); + idx = idx->next_variable; + snmp_set_var_typed_integer( idx, ASN_INTEGER, entry->pgsqlPgAggregateEntryOID ); + idx = idx->next_variable; + *my_data_context = (void *)entry; + *my_loop_context = (void *)entry->next; + return put_index_data; + } else { + return NULL; + } +} + + +/** handles requests for the pgsqlPgAggregateTable table */ +int +pgsqlPgAggregateTable_handler( + netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) { + + netsnmp_request_info *request; + netsnmp_table_request_info *table_info; + struct pgsqlPgAggregateTable_entry *table_entry; + + switch (reqinfo->mode) { + /* + * Read-support (also covers GetNext requests) + */ + case MODE_GET: + for (request=requests; request; request=request->next) { + table_entry = (struct pgsqlPgAggregateTable_entry *) + netsnmp_extract_iterator_context(request); + table_info = netsnmp_extract_table_info( request); + + switch (table_info->colnum) { + case COLUMN_PGSQLPGAGGREGATEAGGFNOID: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAggregateAggfnoid); + break; + case COLUMN_PGSQLPGAGGREGATEAGGTRANSFN: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAggregateAggtransfn); + break; + case COLUMN_PGSQLPGAGGREGATEAGGFINALFN: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAggregateAggfinalfn); + break; + case COLUMN_PGSQLPGAGGREGATEAGGSORTOP: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAggregateAggsortop); + break; + case COLUMN_PGSQLPGAGGREGATEAGGTRANSTYPE: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, + table_entry->pgsqlPgAggregateAggtranstype); + break; + case COLUMN_PGSQLPGAGGREGATEAGGINITVAL: + if ( !table_entry ) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + snmp_set_var_typed_value( request->requestvb, ASN_OCTET_STR, + (u_char*)table_entry->pgsqlPgAggregateAgginitval, + table_entry->pgsqlPgAggregateAgginitval_len); + break; + default: + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHOBJECT); + break; + } + } + break; + + } + return SNMP_ERR_NOERROR; +} diff --git a/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/tmp/pgsqlPgAggregateTable.h b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/tmp/pgsqlPgAggregateTable.h new file mode 100644 index 0000000..57e2917 --- /dev/null +++ b/PGSQL-MIB_src/pgsqlCatalogTables/pgsqlPgAmopTable/tmp/pgsqlPgAggregateTable.h @@ -0,0 +1,23 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.iterate.conf 15999 2007-03-25 22:32:02Z dts12 $ + */ +#ifndef PGSQLPGAGGREGATETABLE_H +#define PGSQLPGAGGREGATETABLE_H + +/* function declarations */ +void init_pgsqlPgAggregateTable(void); +void initialize_table_pgsqlPgAggregateTable(void); +Netsnmp_Node_Handler pgsqlPgAggregateTable_handler; +Netsnmp_First_Data_Point pgsqlPgAggregateTable_get_first_data_point; +Netsnmp_Next_Data_Point pgsqlPgAggregateTable_get_next_data_point; + +/* column number definitions for table pgsqlPgAggregateTable */ + #define COLUMN_PGSQLPGAGGREGATEENTRYOID 1 + #define COLUMN_PGSQLPGAGGREGATEAGGFNOID 2 + #define COLUMN_PGSQLPGAGGREGATEAGGTRANSFN 3 + #define COLUMN_PGSQLPGAGGREGATEAGGFINALFN 4 + #define COLUMN_PGSQLPGAGGREGATEAGGSORTOP 5 + #define COLUMN_PGSQLPGAGGREGATEAGGTRANSTYPE 6 + #define COLUMN_PGSQLPGAGGREGATEAGGINITVAL 7 +#endif /* PGSQLPGAGGREGATETABLE_H */ |