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/pgsnmpdTables |
Diffstat (limited to 'PGSQL-MIB_src/pgsnmpdTables')
11 files changed, 1627 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 */ |