summaryrefslogtreecommitdiff
path: root/agent/mibgroup/ip-mib/ipAddressPrefixTable
diff options
context:
space:
mode:
Diffstat (limited to 'agent/mibgroup/ip-mib/ipAddressPrefixTable')
-rw-r--r--agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.c675
-rw-r--r--agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.h316
-rw-r--r--agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_constants.h153
-rw-r--r--agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.c383
-rw-r--r--agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.h76
-rw-r--r--agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface.c1065
-rw-r--r--agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface.h98
7 files changed, 2766 insertions, 0 deletions
diff --git a/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.c b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.c
new file mode 100644
index 0000000..f4bb085
--- /dev/null
+++ b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.c
@@ -0,0 +1,675 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id$
+ */
+/** \page MFD helper for ipAddressPrefixTable
+ *
+ * \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 "ipAddressPrefixTable.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "ipAddressPrefixTable_interface.h"
+
+const oid ipAddressPrefixTable_oid[] = { IPADDRESSPREFIXTABLE_OID };
+const int ipAddressPrefixTable_oid_size =
+OID_LENGTH(ipAddressPrefixTable_oid);
+
+ipAddressPrefixTable_registration ipAddressPrefixTable_user_context;
+static ipAddressPrefixTable_registration *ipAddressPrefixTable_user_context_p;
+
+void initialize_table_ipAddressPrefixTable(void);
+void shutdown_table_ipAddressPrefixTable(void);
+
+
+/**
+ * Initializes the ipAddressPrefixTable module
+ */
+void
+init_ipAddressPrefixTable(void)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:init_ipAddressPrefixTable",
+ "called\n"));
+
+ /*
+ * TODO:300:o: Perform ipAddressPrefixTable one-time module initialization.
+ */
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ if (should_init("ipAddressPrefixTable"))
+ initialize_table_ipAddressPrefixTable();
+
+} /* init_ipAddressPrefixTable */
+
+/**
+ * Shut-down the ipAddressPrefixTable module (agent is exiting)
+ */
+void
+shutdown_ipAddressPrefixTable(void)
+{
+ if (should_init("ipAddressPrefixTable"))
+ shutdown_table_ipAddressPrefixTable();
+
+}
+
+/**
+ * Initialize the table ipAddressPrefixTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_ipAddressPrefixTable(void)
+{
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:initialize_table_ipAddressPrefixTable", "called\n"));
+
+ /*
+ * TODO:301:o: Perform ipAddressPrefixTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize ipAddressPrefixTable 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.
+ */
+ ipAddressPrefixTable_user_context_p
+ = netsnmp_create_data_list("ipAddressPrefixTable", NULL, NULL);
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _ipAddressPrefixTable_initialize_interface
+ (ipAddressPrefixTable_user_context_p, flags);
+} /* initialize_table_ipAddressPrefixTable */
+
+/**
+ * Shutdown the table ipAddressPrefixTable
+ */
+void
+shutdown_table_ipAddressPrefixTable(void)
+{
+ /*
+ * call interface shutdown code
+ */
+ _ipAddressPrefixTable_shutdown_interface
+ (ipAddressPrefixTable_user_context_p);
+ netsnmp_free_all_list_data(ipAddressPrefixTable_user_context_p);
+ ipAddressPrefixTable_user_context_p = NULL;
+}
+
+/**
+ * extra context initialization (eg default values)
+ *
+ * @param rowreq_ctx : row request context
+ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
+ *
+ * @retval MFD_SUCCESS : no errors
+ * @retval MFD_ERROR : error (context allocate will fail)
+ */
+int
+ipAddressPrefixTable_rowreq_ctx_init(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx, void *user_init_ctx)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_rowreq_ctx_init", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:210:o: |-> Perform extra ipAddressPrefixTable rowreq initialization. (eg DEFVALS)
+ */
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixTable_rowreq_ctx_init */
+
+/**
+ * extra context cleanup
+ *
+ */
+void
+ipAddressPrefixTable_rowreq_ctx_cleanup(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_rowreq_ctx_cleanup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:211:o: |-> Perform extra ipAddressPrefixTable rowreq cleanup.
+ */
+} /* ipAddressPrefixTable_rowreq_ctx_cleanup */
+
+/**
+ * pre-request callback
+ *
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+ipAddressPrefixTable_pre_request(ipAddressPrefixTable_registration *
+ user_context)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_pre_request", "called\n"));
+
+ /*
+ * TODO:510:o: Perform ipAddressPrefixTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixTable_pre_request */
+
+/**
+ * post-request callback
+ *
+ * Note:
+ * New rows have been inserted into the container, and
+ * deleted rows have been removed from the container and
+ * released.
+ *
+ * @param user_context
+ * @param rc : MFD_SUCCESS if all requests succeeded
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error (ignored)
+ */
+int
+ipAddressPrefixTable_post_request(ipAddressPrefixTable_registration *
+ user_context, int rc)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_post_request", "called\n"));
+
+ /*
+ * TODO:511:o: Perform ipAddressPrefixTable post-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixTable_post_request */
+
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressPrefixTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipAddressPrefixTable is subid 32 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.32, length: 8
+ */
+
+/*
+ * ---------------------------------------------------------------------
+ * * TODO:200:r: Implement ipAddressPrefixTable data context functions.
+ */
+
+
+/**
+ * set mib index(es)
+ *
+ * @param tbl_idx mib index structure
+ * @param ipAddressPrefixIfIndex_val
+ * @param ipAddressPrefixType_val
+ * @param ipAddressPrefixPrefix_val_ptr
+ * @param ipAddressPrefixPrefix_val_ptr_len
+ * @param ipAddressPrefixLength_val
+ *
+ * @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
+ipAddressPrefixTable_indexes_set_tbl_idx(ipAddressPrefixTable_mib_index *
+ tbl_idx,
+ long ipAddressPrefixIfIndex_val,
+ u_long ipAddressPrefixType_val,
+ u_char
+ *ipAddressPrefixPrefix_val_ptr,
+ size_t
+ ipAddressPrefixPrefix_val_ptr_len,
+ u_long ipAddressPrefixLength_val)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_indexes_set_tbl_idx", "called\n"));
+
+ /*
+ * ipAddressPrefixIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ tbl_idx->ipAddressPrefixIfIndex = ipAddressPrefixIfIndex_val;
+
+ /*
+ * ipAddressPrefixType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ tbl_idx->ipAddressPrefixType = ipAddressPrefixType_val;
+
+ /*
+ * ipAddressPrefixPrefix(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ tbl_idx->ipAddressPrefixPrefix_len = sizeof(tbl_idx->ipAddressPrefixPrefix) / sizeof(tbl_idx->ipAddressPrefixPrefix[0]); /* max length */
+ /*
+ * make sure there is enough space for ipAddressPrefixPrefix data
+ */
+ if ((NULL == tbl_idx->ipAddressPrefixPrefix) ||
+ (tbl_idx->ipAddressPrefixPrefix_len <
+ (ipAddressPrefixPrefix_val_ptr_len))) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ tbl_idx->ipAddressPrefixPrefix_len = ipAddressPrefixPrefix_val_ptr_len;
+ memcpy(tbl_idx->ipAddressPrefixPrefix, ipAddressPrefixPrefix_val_ptr,
+ ipAddressPrefixPrefix_val_ptr_len *
+ sizeof(ipAddressPrefixPrefix_val_ptr[0]));
+
+ /*
+ * ipAddressPrefixLength(4)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ tbl_idx->ipAddressPrefixLength = ipAddressPrefixLength_val;
+
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixTable_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
+ipAddressPrefixTable_indexes_set(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipAddressPrefixIfIndex_val,
+ u_long ipAddressPrefixType_val,
+ u_char *ipAddressPrefixPrefix_val_ptr,
+ size_t ipAddressPrefixPrefix_val_ptr_len,
+ u_long ipAddressPrefixLength_val)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_indexes_set", "called\n"));
+
+ if (MFD_SUCCESS !=
+ ipAddressPrefixTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,
+ ipAddressPrefixIfIndex_val,
+ ipAddressPrefixType_val,
+ ipAddressPrefixPrefix_val_ptr,
+ ipAddressPrefixPrefix_val_ptr_len,
+ ipAddressPrefixLength_val))
+ return MFD_ERROR;
+
+ /*
+ * convert mib index to oid index
+ */
+ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
+ if (0 != ipAddressPrefixTable_index_to_oid(&rowreq_ctx->oid_idx,
+ &rowreq_ctx->tbl_idx)) {
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixTable_indexes_set */
+
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressPrefixEntry.ipAddressPrefixOrigin
+ * ipAddressPrefixOrigin is subid 5 of ipAddressPrefixEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.32.1.5
+ * Description:
+The origin of this prefix.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ * Enum range: 4/8. Values: other(1), manual(2), wellknown(3), dhcp(4), routeradv(5)
+ *
+ * Its syntax is IpAddressPrefixOriginTC (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ipAddressPrefixOrigin data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressPrefixOrigin_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
+ipAddressPrefixOrigin_get(ipAddressPrefixTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipAddressPrefixOrigin_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressPrefixOrigin_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixOrigin_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressPrefixOrigin data.
+ * copy (* ipAddressPrefixOrigin_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipAddressPrefixOrigin_val_ptr) = rowreq_ctx->data.ipAddressPrefixOrigin;
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixOrigin_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressPrefixEntry.ipAddressPrefixOnLinkFlag
+ * ipAddressPrefixOnLinkFlag is subid 6 of ipAddressPrefixEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.32.1.6
+ * Description:
+This object has the value 'true(1)', if this prefix can be
+ used for on-link determination and the value 'false(2)'
+ otherwise.
+
+
+ The default for IPv4 prefixes is 'true(1)'.
+ *
+ * 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)
+ */
+/**
+ * Extract the current value of the ipAddressPrefixOnLinkFlag data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressPrefixOnLinkFlag_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
+ipAddressPrefixOnLinkFlag_get(ipAddressPrefixTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipAddressPrefixOnLinkFlag_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressPrefixOnLinkFlag_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixOnLinkFlag_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressPrefixOnLinkFlag data.
+ * copy (* ipAddressPrefixOnLinkFlag_val_ptr ) from rowreq_ctx->data
+ */
+ if (INETADDRESSTYPE_IPV4 == rowreq_ctx->tbl_idx.ipAddressPrefixType) {
+ (*ipAddressPrefixOnLinkFlag_val_ptr) = 1; /* per MIB */
+ } else
+ (*ipAddressPrefixOnLinkFlag_val_ptr) =
+ rowreq_ctx->data.ipAddressPrefixOnLinkFlag;
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixOnLinkFlag_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressPrefixEntry.ipAddressPrefixAutonomousFlag
+ * ipAddressPrefixAutonomousFlag is subid 7 of ipAddressPrefixEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.32.1.7
+ * Description:
+Autonomous address configuration flag. When true(1),
+ indicates that this prefix can be used for autonomous
+ address configuration (i.e. can be used to form a local
+ interface address). If false(2), it is not used to auto-
+ configure a local interface address.
+
+
+ The default for IPv4 prefixes is 'false(2)'.
+ *
+ * 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)
+ */
+/**
+ * Extract the current value of the ipAddressPrefixAutonomousFlag data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressPrefixAutonomousFlag_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
+ipAddressPrefixAutonomousFlag_get(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipAddressPrefixAutonomousFlag_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressPrefixAutonomousFlag_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixAutonomousFlag_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressPrefixAutonomousFlag data.
+ * copy (* ipAddressPrefixAutonomousFlag_val_ptr ) from rowreq_ctx->data
+ */
+ if (INETADDRESSTYPE_IPV4 == rowreq_ctx->tbl_idx.ipAddressPrefixType)
+ (*ipAddressPrefixAutonomousFlag_val_ptr) = 2; /* per MIB */
+ else
+ (*ipAddressPrefixAutonomousFlag_val_ptr) =
+ rowreq_ctx->data.ipAddressPrefixAutonomousFlag;
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixAutonomousFlag_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressPrefixEntry.ipAddressPrefixAdvPreferredLifetime
+ * ipAddressPrefixAdvPreferredLifetime is subid 8 of ipAddressPrefixEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.32.1.8
+ * Description:
+The remaining length of time in seconds that this prefix
+ will continue to be preferred, i.e. time until deprecation.
+
+
+
+
+ A value of 4,294,967,295 represents infinity.
+
+
+ The address generated from a deprecated prefix should no
+ longer be used as a source address in new communications,
+ but packets received on such an interface are processed as
+ expected.
+
+
+ The default for IPv4 prefixes is 4,294,967,295 (infinity).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32)
+ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipAddressPrefixAdvPreferredLifetime data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressPrefixAdvPreferredLifetime_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipAddressPrefixAdvPreferredLifetime_get(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipAddressPrefixAdvPreferredLifetime_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressPrefixAdvPreferredLifetime_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixAdvPreferredLifetime_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressPrefixAdvPreferredLifetime data.
+ * copy (* ipAddressPrefixAdvPreferredLifetime_val_ptr ) from rowreq_ctx->data
+ */
+ if (INETADDRESSTYPE_IPV4 == rowreq_ctx->tbl_idx.ipAddressPrefixType)
+ (*ipAddressPrefixAdvPreferredLifetime_val_ptr) = 4294967295U; /* per MIB */
+ else
+ (*ipAddressPrefixAdvPreferredLifetime_val_ptr) =
+ rowreq_ctx->data.ipAddressPrefixAdvPreferredLifetime;
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixAdvPreferredLifetime_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressPrefixEntry.ipAddressPrefixAdvValidLifetime
+ * ipAddressPrefixAdvValidLifetime is subid 9 of ipAddressPrefixEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.32.1.9
+ * Description:
+The remaining length of time, in seconds, that this prefix
+ will continue to be valid, i.e. time until invalidation. A
+ value of 4,294,967,295 represents infinity.
+
+
+ The address generated from an invalidated prefix should not
+ appear as the destination or source address of a packet.
+
+
+ The default for IPv4 prefixes is 4,294,967,295 (infinity).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32)
+ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipAddressPrefixAdvValidLifetime data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressPrefixAdvValidLifetime_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipAddressPrefixAdvValidLifetime_get(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipAddressPrefixAdvValidLifetime_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressPrefixAdvValidLifetime_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixAdvValidLifetime_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressPrefixAdvValidLifetime data.
+ * copy (* ipAddressPrefixAdvValidLifetime_val_ptr ) from rowreq_ctx->data
+ */
+ if (INETADDRESSTYPE_IPV4 == rowreq_ctx->tbl_idx.ipAddressPrefixType)
+ (*ipAddressPrefixAdvValidLifetime_val_ptr) = 4294967295U; /* per MIB */
+ else
+ (*ipAddressPrefixAdvValidLifetime_val_ptr) =
+ rowreq_ctx->data.ipAddressPrefixAdvValidLifetime;
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixAdvValidLifetime_get */
+
+
+
+/** @} */
+/** @} */
+/** @{ */
diff --git a/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.h b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.h
new file mode 100644
index 0000000..24b22a2
--- /dev/null
+++ b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.h
@@ -0,0 +1,316 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id$
+ */
+#ifndef IPADDRESSPREFIXTABLE_H
+#define IPADDRESSPREFIXTABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @addtogroup misc misc: Miscellaneous routines
+ *
+ * @{
+ */
+#include <net-snmp/library/asn1.h>
+
+ /*
+ * other required module components
+ */
+ /* *INDENT-OFF* */
+config_require(ip-mib/ipAddressTable/ipAddressTable)
+config_require(ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface)
+config_require(ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access)
+ /* *INDENT-ON* */
+
+ /*
+ * OID, column number and enum definions for ipAddressPrefixTable
+ */
+#include "ipAddressPrefixTable_constants.h"
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+ void init_ipAddressPrefixTable(void);
+ void shutdown_ipAddressPrefixTable(void);
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressPrefixTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipAddressPrefixTable is subid 32 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.32, length: 8
+ */
+ /*
+ *********************************************************************
+ * 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 ipAddressPrefixTable registration context.
+ */
+ typedef netsnmp_data_list ipAddressPrefixTable_registration;
+
+/**********************************************************************/
+ /*
+ * TODO:110:r: |-> Review ipAddressPrefixTable data context structure.
+ * This structure is used to represent the data for ipAddressPrefixTable.
+ */
+ /*
+ * This structure contains storage for all the columns defined in the
+ * ipAddressPrefixTable.
+ */
+ typedef struct ipAddressPrefixTable_data_s {
+
+ /*
+ * ipAddressPrefixOrigin(5)/IpAddressPrefixOriginTC/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ u_long ipAddressPrefixOrigin;
+
+ /*
+ * ipAddressPrefixOnLinkFlag(6)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ u_long ipAddressPrefixOnLinkFlag;
+
+ /*
+ * ipAddressPrefixAutonomousFlag(7)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ u_long ipAddressPrefixAutonomousFlag;
+
+ /*
+ * ipAddressPrefixAdvPreferredLifetime(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ u_long ipAddressPrefixAdvPreferredLifetime;
+
+ /*
+ * ipAddressPrefixAdvValidLifetime(9)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ u_long ipAddressPrefixAdvValidLifetime;
+
+ } ipAddressPrefixTable_data;
+
+
+ /*
+ * TODO:120:r: |-> Review ipAddressPrefixTable mib index.
+ * This structure is used to represent the index for ipAddressPrefixTable.
+ */
+ typedef struct ipAddressPrefixTable_mib_index_s {
+
+ /*
+ * ipAddressPrefixIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ long ipAddressPrefixIfIndex;
+
+ /*
+ * ipAddressPrefixType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ u_long ipAddressPrefixType;
+
+ /*
+ * ipAddressPrefixPrefix(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ /** 128 - 3(other indexes) - oid length(10) = 114 */
+ char ipAddressPrefixPrefix[114];
+ size_t ipAddressPrefixPrefix_len;
+
+ /*
+ * ipAddressPrefixLength(4)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ u_long ipAddressPrefixLength;
+
+
+ } ipAddressPrefixTable_mib_index;
+
+ /*
+ * TODO:121:r: | |-> Review ipAddressPrefixTable 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(8)
+ */
+#define MAX_ipAddressPrefixTable_IDX_LEN 118
+
+
+ /*
+ *********************************************************************
+ * TODO:130:o: |-> Review ipAddressPrefixTable Row request (rowreq) context.
+ * When your functions are called, you will be passed a
+ * ipAddressPrefixTable_rowreq_ctx pointer.
+ */
+ typedef struct ipAddressPrefixTable_rowreq_ctx_s {
+
+ /** this must be first for container compare to work */
+ netsnmp_index oid_idx;
+ oid oid_tmp[MAX_ipAddressPrefixTable_IDX_LEN];
+
+ ipAddressPrefixTable_mib_index tbl_idx;
+
+ ipAddressPrefixTable_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;
+
+ /*
+ * TODO:131:o: | |-> Add useful data to ipAddressPrefixTable rowreq context.
+ */
+
+ /*
+ * storage for future expansion
+ */
+ netsnmp_data_list *ipAddressPrefixTable_data_list;
+
+ } ipAddressPrefixTable_rowreq_ctx;
+
+ typedef struct ipAddressPrefixTable_ref_rowreq_ctx_s {
+ ipAddressPrefixTable_rowreq_ctx *rowreq_ctx;
+ } ipAddressPrefixTable_ref_rowreq_ctx;
+
+ /*
+ *********************************************************************
+ * function prototypes
+ */
+ int
+ ipAddressPrefixTable_pre_request(ipAddressPrefixTable_registration
+ * user_context);
+ int
+ ipAddressPrefixTable_post_request(ipAddressPrefixTable_registration
+ * user_context, int rc);
+
+ int
+ ipAddressPrefixTable_rowreq_ctx_init
+ (ipAddressPrefixTable_rowreq_ctx * rowreq_ctx,
+ void *user_init_ctx);
+ void
+ ipAddressPrefixTable_rowreq_ctx_cleanup
+ (ipAddressPrefixTable_rowreq_ctx * rowreq_ctx);
+
+
+ ipAddressPrefixTable_rowreq_ctx
+ * ipAddressPrefixTable_row_find_by_mib_index
+ (ipAddressPrefixTable_mib_index * mib_idx);
+
+ extern const oid ipAddressPrefixTable_oid[];
+ extern const int ipAddressPrefixTable_oid_size;
+
+
+#include "ipAddressPrefixTable_interface.h"
+#include "ipAddressPrefixTable_data_access.h"
+ /*
+ *********************************************************************
+ * GET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * GET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressPrefixTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipAddressPrefixTable is subid 32 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.32, length: 8
+ */
+ /*
+ * indexes
+ */
+
+ int
+ ipAddressPrefixOrigin_get(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long * ipAddressPrefixOrigin_val_ptr);
+ int
+ ipAddressPrefixOnLinkFlag_get(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipAddressPrefixOnLinkFlag_val_ptr);
+ int
+ ipAddressPrefixAutonomousFlag_get(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipAddressPrefixAutonomousFlag_val_ptr);
+ int
+ ipAddressPrefixAdvPreferredLifetime_get
+ (ipAddressPrefixTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipAddressPrefixAdvPreferredLifetime_val_ptr);
+ int
+ ipAddressPrefixAdvValidLifetime_get(ipAddressPrefixTable_rowreq_ctx
+ * rowreq_ctx,
+ u_long *
+ ipAddressPrefixAdvValidLifetime_val_ptr);
+
+
+ int
+ ipAddressPrefixTable_indexes_set_tbl_idx
+ (ipAddressPrefixTable_mib_index * tbl_idx,
+ long ipAddressPrefixIfIndex_val, u_long ipAddressPrefixType_val,
+ u_char *ipAddressPrefixPrefix_val_ptr,
+ size_t ipAddressPrefixPrefix_val_ptr_len,
+ u_long ipAddressPrefixLength_val);
+ int
+ ipAddressPrefixTable_indexes_set(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipAddressPrefixIfIndex_val,
+ u_long ipAddressPrefixType_val,
+ u_char
+ *ipAddressPrefixPrefix_val_ptr,
+ size_t
+ ipAddressPrefixPrefix_val_ptr_len,
+ u_long ipAddressPrefixLength_val);
+
+
+
+ /*
+ *********************************************************************
+ * SET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * SET Table declarations
+ */
+
+
+ /*
+ * DUMMY markers, ignore
+ *
+ * TODO:099:x: *************************************************************
+ * TODO:199:x: *************************************************************
+ * TODO:299:x: *************************************************************
+ * TODO:399:x: *************************************************************
+ * TODO:499:x: *************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPADDRESSPREFIXTABLE_H */
+/** @} */
+
diff --git a/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_constants.h b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_constants.h
new file mode 100644
index 0000000..5ecade4
--- /dev/null
+++ b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_constants.h
@@ -0,0 +1,153 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : generic-table-constants.m2c,v 1.5 2005/07/15 22:41:16 rstory Exp $
+ *
+ * $Id$
+ */
+#ifndef IPADDRESSPREFIXTABLE_CONSTANTS_H
+#define IPADDRESSPREFIXTABLE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ * column number definitions for table ipAddressPrefixTable
+ */
+#define IPADDRESSPREFIXTABLE_OID 1,3,6,1,2,1,4,32
+
+#define COLUMN_IPADDRESSPREFIXIFINDEX 1
+
+#define COLUMN_IPADDRESSPREFIXTYPE 2
+
+#define COLUMN_IPADDRESSPREFIXPREFIX 3
+
+#define COLUMN_IPADDRESSPREFIXLENGTH 4
+
+#define COLUMN_IPADDRESSPREFIXORIGIN 5
+
+#define COLUMN_IPADDRESSPREFIXONLINKFLAG 6
+
+#define COLUMN_IPADDRESSPREFIXAUTONOMOUSFLAG 7
+
+#define COLUMN_IPADDRESSPREFIXADVPREFERREDLIFETIME 8
+
+#define COLUMN_IPADDRESSPREFIXADVVALIDLIFETIME 9
+
+
+#define IPADDRESSPREFIXTABLE_MIN_COL COLUMN_IPADDRESSPREFIXORIGIN
+#define IPADDRESSPREFIXTABLE_MAX_COL COLUMN_IPADDRESSPREFIXADVVALIDLIFETIME
+
+
+ /*
+ * 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 ipAddressPrefixTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipAddressPrefixType (InetAddressType / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef INETADDRESSTYPE_ENUMS
+#define INETADDRESSTYPE_ENUMS
+
+#define INETADDRESSTYPE_UNKNOWN 0
+#define INETADDRESSTYPE_IPV4 1
+#define INETADDRESSTYPE_IPV6 2
+#define INETADDRESSTYPE_IPV4Z 3
+#define INETADDRESSTYPE_IPV6Z 4
+#define INETADDRESSTYPE_DNS 16
+
+#endif /* INETADDRESSTYPE_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipAddressPrefixOrigin (IpAddressPrefixOriginTC / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef IPADDRESSPREFIXORIGINTC_ENUMS
+#define IPADDRESSPREFIXORIGINTC_ENUMS
+
+#define IPADDRESSPREFIXORIGINTC_OTHER 1
+#define IPADDRESSPREFIXORIGINTC_MANUAL 2
+#define IPADDRESSPREFIXORIGINTC_WELLKNOWN 3
+#define IPADDRESSPREFIXORIGINTC_DHCP 4
+#define IPADDRESSPREFIXORIGINTC_ROUTERADV 5
+
+#endif /* IPADDRESSPREFIXORIGINTC_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipAddressPrefixOnLinkFlag (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 */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipAddressPrefixAutonomousFlag (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 */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPADDRESSPREFIXTABLE_OIDS_H */
+/****************************************************************
+* Additional constants and definitions for common implementation
+*/
+#define INFINITY_LIFE_TIME 0xFFFFFFFFU
+#define NIP6(addr) \
+ ntohs((addr).s6_addr16[0]), \
+ ntohs((addr).s6_addr16[1]), \
+ ntohs((addr).s6_addr16[2]), \
+ ntohs((addr).s6_addr16[3]), \
+ ntohs((addr).s6_addr16[4]), \
+ ntohs((addr).s6_addr16[5]), \
+ ntohs((addr).s6_addr16[6]), \
+ ntohs((addr).s6_addr16[7])
+
diff --git a/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.c b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.c
new file mode 100644
index 0000000..4437829
--- /dev/null
+++ b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.c
@@ -0,0 +1,383 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id$
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-features.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipAddressPrefixTable.h"
+
+
+#include "ipAddressPrefixTable_data_access.h"
+
+#include "ip-mib/ipAddressTable/ipAddressTable.h"
+
+netsnmp_feature_require(ipAddressTable_container_get)
+netsnmp_feature_require(ipaddress_common_copy_utilities)
+netsnmp_feature_require(ipaddress_prefix_copy)
+
+/** @ingroup interface
+ * @addtogroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressPrefixTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipAddressPrefixTable is subid 32 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.32, length: 8
+ */
+
+/**
+ * initialization for ipAddressPrefixTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param ipAddressPrefixTable_reg
+ * Pointer to ipAddressPrefixTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+ipAddressPrefixTable_init_data(ipAddressPrefixTable_registration *
+ ipAddressPrefixTable_reg)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_init_data", "called\n"));
+
+ /*
+ * TODO:303:o: Initialize ipAddressPrefixTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixTable_init_data */
+
+/**
+ * container overview
+ *
+ */
+
+/**
+ * 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
+ipAddressPrefixTable_container_init(netsnmp_container **container_ptr_ptr,
+ netsnmp_cache * cache)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_container_init", "called\n"));
+
+ if (NULL == container_ptr_ptr) {
+ snmp_log(LOG_ERR,
+ "bad container param to ipAddressPrefixTable_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;
+
+ if (NULL == cache) {
+ snmp_log(LOG_ERR,
+ "bad cache param to ipAddressPrefixTable_container_init\n");
+ return;
+ }
+
+ /*
+ * TODO:345:A: Set up ipAddressPrefixTable 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 = IPADDRESSPREFIXTABLE_CACHE_TIMEOUT; /* seconds */
+} /* ipAddressPrefixTable_container_init */
+
+/**
+ * container shutdown
+ *
+ * @param container_ptr A pointer to the container.
+ *
+ * This function is called at shutdown 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.
+ *
+ * This function is called before ipAddressPrefixTable_container_free().
+ *
+ * @remark
+ * This would also be a good place to do any cleanup needed
+ * for you data source. For example, closing a connection to another
+ * process that supplied the data, closing a database, etc.
+ */
+void
+ipAddressPrefixTable_container_shutdown(netsnmp_container *container_ptr)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_container_shutdown", "called\n"));
+
+ if (NULL == container_ptr) {
+ snmp_log(LOG_ERR,
+ "bad params to ipAddressPrefixTable_container_shutdown\n");
+ return;
+ }
+
+} /* ipAddressPrefixTable_container_shutdown */
+
+/**
+ * load initial data
+ *
+ * TODO:350:M: Implement ipAddressPrefixTable data load
+ * This function will also be called by the cache helper to load
+ * the container again (after the container free function has been
+ * called to free the previous contents).
+ *
+ * @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 load the index(es) (and data, optionally)
+ * for the every row in the data set.
+ *
+ * @remark
+ * While loading the data, 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
+ * ipAddressPrefixTable_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
+ipAddressPrefixTable_container_load(netsnmp_container *container)
+{
+ ipAddressPrefixTable_rowreq_ctx *rowreq_ctx = NULL, *tmp_rowreq_ctx;
+ ipAddressTable_rowreq_ctx *addr_rowreq_ctx;
+ netsnmp_container *addr_container;
+ netsnmp_iterator *addr_it;
+ int count = 0;
+ u_char tmp_pfx[NETSNMP_ACCESS_IPADDRESS_BUF_SIZE];
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_container_load", "called\n"));
+
+ addr_container = ipAddressTable_container_get();
+ if (NULL == addr_container) {
+ DEBUGMSGTL(("ipAddressPrefixTable:container_load",
+ "couldn't get ipAddress container\n"));
+ return MFD_RESOURCE_UNAVAILABLE;
+ }
+
+ addr_it = CONTAINER_ITERATOR(addr_container);
+ if (NULL == addr_container) {
+ DEBUGMSGTL(("ipAddressPrefixTable:container_load",
+ "couldn't get ipAddress iterator\n"));
+ return MFD_RESOURCE_UNAVAILABLE;
+ }
+
+ /*
+ * TODO:351:M: |-> Load/update data in the ipAddressPrefixTable container.
+ * loop over your ipAddressPrefixTable data, allocate a rowreq context,
+ * set the index(es) [and data, optionally] and insert into
+ * the container.
+ */
+ for (addr_rowreq_ctx = ITERATOR_FIRST(addr_it);
+ addr_rowreq_ctx; addr_rowreq_ctx = ITERATOR_NEXT(addr_it)) {
+
+
+
+ /*
+ * TODO:352:M: | |-> set indexes in new ipAddressPrefixTable rowreq context.
+ * data context will be set from the param (unless NULL,
+ * in which case a new data context will be allocated)
+ */
+ if (NULL == rowreq_ctx) {
+ rowreq_ctx = ipAddressPrefixTable_allocate_rowreq_ctx(NULL);
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "memory allocation failed\n");
+ return MFD_RESOURCE_UNAVAILABLE;
+ }
+ }
+ netsnmp_ipaddress_prefix_copy(tmp_pfx,
+ addr_rowreq_ctx->tbl_idx.
+ ipAddressAddr,
+ addr_rowreq_ctx->data->
+ ia_address_len,
+ addr_rowreq_ctx->data->
+ ia_prefix_len);
+ netsnmp_ipaddress_flags_copy(&rowreq_ctx->data.
+ ipAddressPrefixAdvPreferredLifetime,
+ &rowreq_ctx->data.
+ ipAddressPrefixAdvValidLifetime,
+ &rowreq_ctx->data.
+ ipAddressPrefixOnLinkFlag,
+ &rowreq_ctx->data.
+ ipAddressPrefixAutonomousFlag,
+ &addr_rowreq_ctx->data->
+ ia_prefered_lifetime,
+ &addr_rowreq_ctx->data->
+ ia_valid_lifetime,
+ &addr_rowreq_ctx->data->
+ ia_onlink_flag,
+ &addr_rowreq_ctx->data->
+ ia_autonomous_flag);
+
+ if (MFD_SUCCESS !=
+ ipAddressPrefixTable_indexes_set(rowreq_ctx,
+ addr_rowreq_ctx->data->
+ if_index,
+ addr_rowreq_ctx->tbl_idx.
+ ipAddressAddrType, tmp_pfx,
+ addr_rowreq_ctx->data->
+ ia_address_len,
+ addr_rowreq_ctx->data->
+ ia_prefix_len)) {
+ snmp_log(LOG_ERR,
+ "error setting index while loading "
+ "ipAddressPrefixTable data.\n");
+ ipAddressPrefixTable_release_rowreq_ctx(rowreq_ctx);
+ rowreq_ctx = NULL;
+ continue;
+ }
+
+ /** do we already have this prefix? */
+ tmp_rowreq_ctx = CONTAINER_FIND(container, rowreq_ctx);
+ if (NULL != tmp_rowreq_ctx)
+ continue;
+
+ /*
+ * TODO:352:r: | |-> populate ipAddressPrefixTable data context.
+ * Populate data context here. (optionally, delay until row prep)
+ */
+ netsnmp_ipaddress_prefix_origin_copy(&rowreq_ctx->data.
+ ipAddressPrefixOrigin,
+ addr_rowreq_ctx->data->
+ ia_origin,
+ addr_rowreq_ctx->data->
+ flags,
+ addr_rowreq_ctx->tbl_idx.
+ ipAddressAddrType);
+
+ /** defer the rest til row prep */
+
+ /*
+ * insert into table container, clear ptr so we reallocate
+ */
+ CONTAINER_INSERT(container, rowreq_ctx);
+ rowreq_ctx = NULL;
+ ++count;
+ }
+ ITERATOR_RELEASE(addr_it);
+
+ DEBUGMSGT(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_container_load", "inserted %d records\n", count));
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixTable_container_load */
+
+/**
+ * container 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
+ipAddressPrefixTable_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_container_free", "called\n"));
+
+ /*
+ * TODO:380:M: Free ipAddressPrefixTable container data.
+ */
+} /* ipAddressPrefixTable_container_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
+ipAddressPrefixTable_row_prep(ipAddressPrefixTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_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.
+ */
+ if (INETADDRESSTYPE_IPV6 == rowreq_ctx->tbl_idx.ipAddressPrefixType) {
+
+ }
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixTable_row_prep */
+
+/** @} */
diff --git a/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.h b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.h
new file mode 100644
index 0000000..e50d7d0
--- /dev/null
+++ b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.h
@@ -0,0 +1,76 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id$
+ */
+#ifndef IPADDRESSPREFIXTABLE_DATA_ACCESS_H
+#define IPADDRESSPREFIXTABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressPrefixTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipAddressPrefixTable is subid 32 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.32, length: 8
+ */
+
+
+ int
+ ipAddressPrefixTable_init_data(ipAddressPrefixTable_registration *
+ ipAddressPrefixTable_reg);
+
+
+ /*
+ * TODO:180:o: Review ipAddressPrefixTable cache timeout.
+ * The number of seconds before the cache times out
+ */
+#define IPADDRESSPREFIXTABLE_CACHE_TIMEOUT 60
+
+ void ipAddressPrefixTable_container_init(netsnmp_container
+ **container_ptr_ptr,
+ netsnmp_cache *
+ cache);
+ void
+ ipAddressPrefixTable_container_shutdown(netsnmp_container
+ *container_ptr);
+
+ int ipAddressPrefixTable_container_load(netsnmp_container
+ *container);
+ void ipAddressPrefixTable_container_free(netsnmp_container
+ *container);
+
+ int ipAddressPrefixTable_cache_load(netsnmp_container
+ *container);
+ void ipAddressPrefixTable_cache_free(netsnmp_container
+ *container);
+
+ int
+ ipAddressPrefixTable_row_prep(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPADDRESSPREFIXTABLE_DATA_ACCESS_H */
diff --git a/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface.c b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface.c
new file mode 100644
index 0000000..e14a337
--- /dev/null
+++ b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface.c
@@ -0,0 +1,1065 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id$
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** 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-features.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipAddressPrefixTable.h"
+
+
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/library/container.h>
+
+#include "ipAddressPrefixTable_interface.h"
+
+#include <ctype.h>
+
+netsnmp_feature_require(row_merge)
+netsnmp_feature_require(baby_steps)
+netsnmp_feature_require(check_all_requests_error)
+
+netsnmp_feature_child_of(ipaddressprefixtable_row_find_by_mib_index, ipaddressprefixtable_all)
+netsnmp_feature_child_of(ipaddressprefixtable_container_get, ipaddressprefixtable_all)
+netsnmp_feature_child_of(ipAddressPrefixTable_registration_get, ipaddressprefixtable_all)
+netsnmp_feature_child_of(ipAddressPrefixTable_registration_set, ipaddressprefixtable_all)
+netsnmp_feature_child_of(ipAddressPrefixTable_container_size, ipaddressprefixtable_all)
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressPrefixTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipAddressPrefixTable is subid 32 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.32, length: 8
+ */
+typedef struct ipAddressPrefixTable_interface_ctx_s {
+
+ netsnmp_container *container;
+ netsnmp_cache *cache;
+
+ ipAddressPrefixTable_registration *user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+} ipAddressPrefixTable_interface_ctx;
+
+static ipAddressPrefixTable_interface_ctx ipAddressPrefixTable_if_ctx;
+
+static void
+ _ipAddressPrefixTable_container_init(ipAddressPrefixTable_interface_ctx *
+ if_ctx);
+static void
+ _ipAddressPrefixTable_container_shutdown(ipAddressPrefixTable_interface_ctx
+ * if_ctx);
+
+
+#ifndef NETSNMP_FEATURE_REMOVE_IPADDRESSPREFIXTABLE_CONTAINER_GET
+netsnmp_container *
+ipAddressPrefixTable_container_get(void)
+{
+ return ipAddressPrefixTable_if_ctx.container;
+}
+#endif /* NETSNMP_FEATURE_REMOVE_IPADDRESSPREFIXTABLE_CONTAINER_GET */
+
+#ifndef NETSNMP_FEATURE_REMOVE_IPADDRESSPREFIXTABLE_REGISTRATION_GET
+ipAddressPrefixTable_registration *
+ipAddressPrefixTable_registration_get(void)
+{
+ return ipAddressPrefixTable_if_ctx.user_ctx;
+}
+#endif /* NETSNMP_FEATURE_REMOVE_IPADDRESSPREFIXTABLE_REGISTRATION_GET */
+
+#ifndef NETSNMP_FEATURE_REMOVE_IPADDRESSPREFIXTABLE_REGISTRATION_SET
+ipAddressPrefixTable_registration *
+ipAddressPrefixTable_registration_set(ipAddressPrefixTable_registration *
+ newreg)
+{
+ ipAddressPrefixTable_registration *old =
+ ipAddressPrefixTable_if_ctx.user_ctx;
+ ipAddressPrefixTable_if_ctx.user_ctx = newreg;
+ return old;
+}
+#endif /* NETSNMP_FEATURE_REMOVE_IPADDRESSPREFIXTABLE_REGISTRATION_SET */
+
+#ifndef NETSNMP_FEATURE_REMOVE_IPADDRESSPREFIXTABLE_CONTAINER_SIZE
+int
+ipAddressPrefixTable_container_size(void)
+{
+ return CONTAINER_SIZE(ipAddressPrefixTable_if_ctx.container);
+}
+#endif /* NETSNMP_FEATURE_REMOVE_IPADDRESSPREFIXTABLE_CONTAINER_SIZE */
+
+/*
+ * mfd multiplexer modes
+ */
+static Netsnmp_Node_Handler _mfd_ipAddressPrefixTable_pre_request;
+static Netsnmp_Node_Handler _mfd_ipAddressPrefixTable_post_request;
+static Netsnmp_Node_Handler _mfd_ipAddressPrefixTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_ipAddressPrefixTable_get_values;
+/**
+ * @internal
+ * Initialize the table ipAddressPrefixTable
+ * (Define its contents and how it's structured)
+ */
+void
+ _ipAddressPrefixTable_initialize_interface
+ (ipAddressPrefixTable_registration * reg_ptr, u_long flags)
+{
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &ipAddressPrefixTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info =
+ &ipAddressPrefixTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_ipAddressPrefixTable_initialize_interface", "called\n"));
+
+
+ /*************************************************
+ *
+ * save interface context for ipAddressPrefixTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,
+ /** index: ipAddressPrefixIfIndex */
+ ASN_INTEGER,
+ /** index: ipAddressPrefixType */
+ ASN_OCTET_STR,
+ /** index: ipAddressPrefixPrefix */
+ ASN_UNSIGNED,
+ /** index: ipAddressPrefixLength */
+ 0);
+
+ /*
+ * Define the minimum and maximum accessible columns. This
+ * optimizes retrieval.
+ */
+ tbl_info->min_column = IPADDRESSPREFIXTABLE_MIN_COL;
+ tbl_info->max_column = IPADDRESSPREFIXTABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ ipAddressPrefixTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ ipAddressPrefixTable_init_data(reg_ptr);
+
+ /*
+ * set up the container
+ */
+ _ipAddressPrefixTable_container_init(&ipAddressPrefixTable_if_ctx);
+ if (NULL == ipAddressPrefixTable_if_ctx.container) {
+ snmp_log(LOG_ERR,
+ "could not initialize container for ipAddressPrefixTable\n");
+ return;
+ }
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup =
+ _mfd_ipAddressPrefixTable_object_lookup;
+ access_multiplexer->get_values = _mfd_ipAddressPrefixTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request =
+ _mfd_ipAddressPrefixTable_pre_request;
+ access_multiplexer->post_request =
+ _mfd_ipAddressPrefixTable_post_request;
+
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("ipAddressPrefixTable:init_ipAddressPrefixTable",
+ "Registering ipAddressPrefixTable as a mibs-for-dummies table.\n"));
+ handler =
+ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo =
+ netsnmp_handler_registration_create("ipAddressPrefixTable",
+ handler,
+ ipAddressPrefixTable_oid,
+ ipAddressPrefixTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RONLY);
+ if (NULL == reginfo) {
+ snmp_log(LOG_ERR,
+ "error registering table ipAddressPrefixTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &ipAddressPrefixTable_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->pre_request)
+ mfd_modes |= BABY_STEP_PRE_REQUEST;
+ if (access_multiplexer->post_request)
+ mfd_modes |= BABY_STEP_POST_REQUEST;
+
+#if !(defined(NETSNMP_NO_WRITE_SUPPORT) || defined(NETSNMP_DISABLE_SET_SUPPORT))
+ /* XXX - are these actually necessary? */
+ 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->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;
+#endif /* NETSNMP_NO_WRITE_SUPPORT || NETSNMP_DISABLE_SET_SUPPORT */
+
+ 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,
+ ipAddressPrefixTable_if_ctx.
+ container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject cache helper
+ */
+ if (NULL != ipAddressPrefixTable_if_ctx.cache) {
+ handler =
+ netsnmp_cache_handler_get(ipAddressPrefixTable_if_ctx.cache);
+ netsnmp_inject_handler(reginfo, handler);
+ }
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+
+} /* _ipAddressPrefixTable_initialize_interface */
+
+/**
+ * @internal
+ * Shutdown the table ipAddressPrefixTable
+ */
+void
+_ipAddressPrefixTable_shutdown_interface(ipAddressPrefixTable_registration
+ * reg_ptr)
+{
+ /*
+ * shutdown the container
+ */
+ _ipAddressPrefixTable_container_shutdown(&ipAddressPrefixTable_if_ctx);
+}
+
+void
+ipAddressPrefixTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ ipAddressPrefixTable_if_ctx.tbl_info.valid_columns = vc;
+} /* ipAddressPrefixTable_valid_columns_set */
+
+/**
+ * @internal
+ * convert the index component stored in the context to an oid
+ */
+int
+ipAddressPrefixTable_index_to_oid(netsnmp_index * oid_idx,
+ ipAddressPrefixTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * ipAddressPrefixIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_ipAddressPrefixIfIndex;
+ /*
+ * ipAddressPrefixType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_ipAddressPrefixType;
+ /*
+ * ipAddressPrefixPrefix(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_ipAddressPrefixPrefix;
+ /*
+ * ipAddressPrefixLength(4)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_ipAddressPrefixLength;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_ipAddressPrefixIfIndex, 0x00,
+ sizeof(var_ipAddressPrefixIfIndex));
+ var_ipAddressPrefixIfIndex.type = ASN_INTEGER;
+ memset(&var_ipAddressPrefixType, 0x00,
+ sizeof(var_ipAddressPrefixType));
+ var_ipAddressPrefixType.type = ASN_INTEGER;
+ memset(&var_ipAddressPrefixPrefix, 0x00,
+ sizeof(var_ipAddressPrefixPrefix));
+ var_ipAddressPrefixPrefix.type = ASN_OCTET_STR;
+ memset(&var_ipAddressPrefixLength, 0x00,
+ sizeof(var_ipAddressPrefixLength));
+ var_ipAddressPrefixLength.type = ASN_UNSIGNED;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_ipAddressPrefixIfIndex.next_variable = &var_ipAddressPrefixType;
+ var_ipAddressPrefixType.next_variable = &var_ipAddressPrefixPrefix;
+ var_ipAddressPrefixPrefix.next_variable = &var_ipAddressPrefixLength;
+ var_ipAddressPrefixLength.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_index_to_oid", "called\n"));
+
+ /*
+ * ipAddressPrefixIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ snmp_set_var_value(&var_ipAddressPrefixIfIndex,
+ (u_char *) & mib_idx->ipAddressPrefixIfIndex,
+ sizeof(mib_idx->ipAddressPrefixIfIndex));
+
+ /*
+ * ipAddressPrefixType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ snmp_set_var_value(&var_ipAddressPrefixType,
+ (u_char *) & mib_idx->ipAddressPrefixType,
+ sizeof(mib_idx->ipAddressPrefixType));
+
+ /*
+ * ipAddressPrefixPrefix(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ snmp_set_var_value(&var_ipAddressPrefixPrefix,
+ (u_char *) & mib_idx->ipAddressPrefixPrefix,
+ mib_idx->ipAddressPrefixPrefix_len *
+ sizeof(mib_idx->ipAddressPrefixPrefix[0]));
+
+ /*
+ * ipAddressPrefixLength(4)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ snmp_set_var_value(&var_ipAddressPrefixLength,
+ (u_char *) & mib_idx->ipAddressPrefixLength,
+ sizeof(mib_idx->ipAddressPrefixLength));
+
+
+ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
+ NULL, 0, &var_ipAddressPrefixIfIndex);
+ 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_ipAddressPrefixIfIndex);
+
+ return err;
+} /* ipAddressPrefixTable_index_to_oid */
+
+/**
+ * extract ipAddressPrefixTable indexes from a netsnmp_index
+ *
+ * @retval SNMP_ERR_NOERROR : no error
+ * @retval SNMP_ERR_GENERR : error
+ */
+int
+ipAddressPrefixTable_index_from_oid(netsnmp_index * oid_idx,
+ ipAddressPrefixTable_mib_index *
+ mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * ipAddressPrefixIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_ipAddressPrefixIfIndex;
+ /*
+ * ipAddressPrefixType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_ipAddressPrefixType;
+ /*
+ * ipAddressPrefixPrefix(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_ipAddressPrefixPrefix;
+ /*
+ * ipAddressPrefixLength(4)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_ipAddressPrefixLength;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_ipAddressPrefixIfIndex, 0x00,
+ sizeof(var_ipAddressPrefixIfIndex));
+ var_ipAddressPrefixIfIndex.type = ASN_INTEGER;
+ memset(&var_ipAddressPrefixType, 0x00,
+ sizeof(var_ipAddressPrefixType));
+ var_ipAddressPrefixType.type = ASN_INTEGER;
+ memset(&var_ipAddressPrefixPrefix, 0x00,
+ sizeof(var_ipAddressPrefixPrefix));
+ var_ipAddressPrefixPrefix.type = ASN_OCTET_STR;
+ memset(&var_ipAddressPrefixLength, 0x00,
+ sizeof(var_ipAddressPrefixLength));
+ var_ipAddressPrefixLength.type = ASN_UNSIGNED;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_ipAddressPrefixIfIndex.next_variable = &var_ipAddressPrefixType;
+ var_ipAddressPrefixType.next_variable = &var_ipAddressPrefixPrefix;
+ var_ipAddressPrefixPrefix.next_variable = &var_ipAddressPrefixLength;
+ var_ipAddressPrefixLength.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_index_from_oid", "called\n"));
+
+ /*
+ * parse the oid into the individual index components
+ */
+ err = parse_oid_indexes(oid_idx->oids, oid_idx->len,
+ &var_ipAddressPrefixIfIndex);
+ if (err == SNMP_ERR_NOERROR) {
+ /*
+ * copy out values
+ */
+ mib_idx->ipAddressPrefixIfIndex =
+ *((long *) var_ipAddressPrefixIfIndex.val.string);
+ mib_idx->ipAddressPrefixType =
+ *((u_long *) var_ipAddressPrefixType.val.string);
+ /*
+ * NOTE: val_len is in bytes, ipAddressPrefixPrefix_len might not be
+ */
+ if (var_ipAddressPrefixPrefix.val_len >
+ sizeof(mib_idx->ipAddressPrefixPrefix))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->ipAddressPrefixPrefix,
+ var_ipAddressPrefixPrefix.val.string,
+ var_ipAddressPrefixPrefix.val_len);
+ mib_idx->ipAddressPrefixPrefix_len =
+ var_ipAddressPrefixPrefix.val_len /
+ sizeof(mib_idx->ipAddressPrefixPrefix[0]);
+ }
+ mib_idx->ipAddressPrefixLength =
+ *((u_long *) var_ipAddressPrefixLength.val.string);
+
+
+ }
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_ipAddressPrefixIfIndex);
+
+ return err;
+} /* ipAddressPrefixTable_index_from_oid */
+
+
+/*
+ *********************************************************************
+ * @internal
+ * allocate resources for a ipAddressPrefixTable_rowreq_ctx
+ */
+ipAddressPrefixTable_rowreq_ctx *
+ipAddressPrefixTable_allocate_rowreq_ctx(void *user_init_ctx)
+{
+ ipAddressPrefixTable_rowreq_ctx *rowreq_ctx =
+ SNMP_MALLOC_TYPEDEF(ipAddressPrefixTable_rowreq_ctx);
+
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:ipAddressPrefixTable_allocate_rowreq_ctx", "called\n"));
+
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "Couldn't allocate memory for a "
+ "ipAddressPrefixTable_rowreq_ctx.\n");
+ return NULL;
+ }
+
+ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
+
+ rowreq_ctx->ipAddressPrefixTable_data_list = NULL;
+
+ /*
+ * if we allocated data, call init routine
+ */
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) {
+ if (SNMPERR_SUCCESS !=
+ ipAddressPrefixTable_rowreq_ctx_init(rowreq_ctx,
+ user_init_ctx)) {
+ ipAddressPrefixTable_release_rowreq_ctx(rowreq_ctx);
+ rowreq_ctx = NULL;
+ }
+ }
+
+ return rowreq_ctx;
+} /* ipAddressPrefixTable_allocate_rowreq_ctx */
+
+/*
+ * @internal
+ * release resources for a ipAddressPrefixTable_rowreq_ctx
+ */
+void
+ipAddressPrefixTable_release_rowreq_ctx(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:ipAddressPrefixTable_release_rowreq_ctx", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ ipAddressPrefixTable_rowreq_ctx_cleanup(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);
+} /* ipAddressPrefixTable_release_rowreq_ctx */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipAddressPrefixTable_pre_request(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_mfd_ipAddressPrefixTable_pre_request", "called\n"));
+
+ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ipAddressPrefixTable",
+ "skipping additional pre_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ rc = ipAddressPrefixTable_pre_request(ipAddressPrefixTable_if_ctx.
+ user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipAddressPrefixTable", "error %d from "
+ "ipAddressPrefixTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipAddressPrefixTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipAddressPrefixTable_post_request(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipAddressPrefixTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc, packet_rc;
+
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_mfd_ipAddressPrefixTable_post_request", "called\n"));
+
+ /*
+ * release row context, if deleted
+ */
+ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))
+ ipAddressPrefixTable_release_rowreq_ctx(rowreq_ctx);
+
+ /*
+ * wait for last call before calling user
+ */
+ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ipAddressPrefixTable",
+ "waiting for last post_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
+ rc = ipAddressPrefixTable_post_request(ipAddressPrefixTable_if_ctx.
+ user_ctx, packet_rc);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipAddressPrefixTable", "error %d from "
+ "ipAddressPrefixTable_post_request\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipAddressPrefixTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipAddressPrefixTable_object_lookup(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc = SNMP_ERR_NOERROR;
+ ipAddressPrefixTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_mfd_ipAddressPrefixTable_object_lookup", "called\n"));
+
+ /*
+ * get our context from mfd
+ * ipAddressPrefixTable_interface_ctx *if_ctx =
+ * (ipAddressPrefixTable_interface_ctx *)reginfo->my_reg_void;
+ */
+
+ if (NULL == rowreq_ctx) {
+ rc = SNMP_ERR_NOCREATION;
+ }
+
+ if (MFD_SUCCESS != rc)
+ netsnmp_request_set_error_all(requests, rc);
+ else
+ ipAddressPrefixTable_row_prep(rowreq_ctx);
+
+ return SNMP_VALIDATE_ERR(rc);
+} /* _mfd_ipAddressPrefixTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipAddressPrefixTable_get_column(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx, netsnmp_variable_list * var,
+ int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_mfd_ipAddressPrefixTable_get_column", "called for %d\n", column));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipAddressPrefixOrigin(5)/IpAddressPrefixOriginTC/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_IPADDRESSPREFIXORIGIN:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ipAddressPrefixOrigin_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipAddressPrefixOnLinkFlag(6)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_IPADDRESSPREFIXONLINKFLAG:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ipAddressPrefixOnLinkFlag_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipAddressPrefixAutonomousFlag(7)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_IPADDRESSPREFIXAUTONOMOUSFLAG:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ipAddressPrefixAutonomousFlag_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipAddressPrefixAdvPreferredLifetime(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPADDRESSPREFIXADVPREFERREDLIFETIME:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_UNSIGNED;
+ rc = ipAddressPrefixAdvPreferredLifetime_get(rowreq_ctx,
+ (u_long *) var->val.
+ string);
+ break;
+
+ /*
+ * ipAddressPrefixAdvValidLifetime(9)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPADDRESSPREFIXADVVALIDLIFETIME:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_UNSIGNED;
+ rc = ipAddressPrefixAdvValidLifetime_get(rowreq_ctx,
+ (u_long *) var->val.
+ string);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipAddressPrefixTable_get_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ipAddressPrefixTable_get_column */
+
+int
+_mfd_ipAddressPrefixTable_get_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipAddressPrefixTable_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:ipAddressPrefixTable:_mfd_ipAddressPrefixTable_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 = _ipAddressPrefixTable_get_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ if (MFD_SKIP == rc) {
+ requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+ 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_ipAddressPrefixTable_get_values */
+
+
+#if !(defined(NETSNMP_NO_WRITE_SUPPORT) || defined(NETSNMP_DISABLE_SET_SUPPORT))
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*
+ * SET PROCESSING NOT APPLICABLE (per MIB or user setting)
+ */
+#endif
+
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+static void _container_free(netsnmp_container *container);
+
+/**
+ * @internal
+ */
+static int
+_cache_load(netsnmp_cache * cache, void *vmagic)
+{
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_cache_load", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache for ipAddressPrefixTable_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 ipAddressPrefixTable_container_load((netsnmp_container *)
+ cache->magic);
+} /* _cache_load */
+
+/**
+ * @internal
+ */
+static void
+_cache_free(netsnmp_cache * cache, void *magic)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_cache_free", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache in ipAddressPrefixTable_cache_free\n");
+ return;
+ }
+
+ container = (netsnmp_container *) cache->magic;
+
+ _container_free(container);
+} /* _cache_free */
+
+/**
+ * @internal
+ */
+static void
+_container_item_free(ipAddressPrefixTable_rowreq_ctx * rowreq_ctx,
+ void *context)
+{
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_container_item_free",
+ "called\n"));
+
+ if (NULL == rowreq_ctx)
+ return;
+
+ ipAddressPrefixTable_release_rowreq_ctx(rowreq_ctx);
+} /* _container_item_free */
+
+/**
+ * @internal
+ */
+static void
+_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_container_free",
+ "called\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container in ipAddressPrefixTable_container_free\n");
+ return;
+ }
+
+ /*
+ * call user code
+ */
+ ipAddressPrefixTable_container_free(container);
+
+ /*
+ * free all items. inefficient, but easy.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func *) _container_item_free,
+ NULL);
+} /* _container_free */
+
+/**
+ * @internal
+ * initialize the container with functions or wrappers
+ */
+void
+_ipAddressPrefixTable_container_init(ipAddressPrefixTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_ipAddressPrefixTable_container_init", "called\n"));
+
+ /*
+ * cache init
+ */
+ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */
+ _cache_load, _cache_free,
+ ipAddressPrefixTable_oid,
+ ipAddressPrefixTable_oid_size);
+
+ if (NULL == if_ctx->cache) {
+ snmp_log(LOG_ERR,
+ "error creating cache for ipAddressPrefixTable\n");
+ return;
+ }
+
+ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
+
+ ipAddressPrefixTable_container_init(&if_ctx->container, if_ctx->cache);
+ if (NULL == if_ctx->container)
+ if_ctx->container =
+ netsnmp_container_find("ipAddressPrefixTable:table_container");
+ if (NULL == if_ctx->container) {
+ snmp_log(LOG_ERR, "error creating container in "
+ "ipAddressPrefixTable_container_init\n");
+ return;
+ }
+
+ if (NULL != if_ctx->cache)
+ if_ctx->cache->magic = (void *) if_ctx->container;
+} /* _ipAddressPrefixTable_container_init */
+
+/**
+ * @internal
+ * shutdown the container with functions or wrappers
+ */
+void
+_ipAddressPrefixTable_container_shutdown(ipAddressPrefixTable_interface_ctx
+ * if_ctx)
+{
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_ipAddressPrefixTable_container_shutdown", "called\n"));
+
+ ipAddressPrefixTable_container_shutdown(if_ctx->container);
+
+ _container_free(if_ctx->container);
+
+} /* _ipAddressPrefixTable_container_shutdown */
+
+
+#ifndef NETSNMP_FEATURE_REMOVE_IPADDRESSPREFIXTABLE_ROW_FIND_BY_MIB_INDEX
+ipAddressPrefixTable_rowreq_ctx *
+ipAddressPrefixTable_row_find_by_mib_index(ipAddressPrefixTable_mib_index *
+ mib_idx)
+{
+ ipAddressPrefixTable_rowreq_ctx *rowreq_ctx;
+ oid oid_tmp[MAX_OID_LEN];
+ netsnmp_index oid_idx;
+ int rc;
+
+ /*
+ * set up storage for OID
+ */
+ oid_idx.oids = oid_tmp;
+ oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
+
+ /*
+ * convert
+ */
+ rc = ipAddressPrefixTable_index_to_oid(&oid_idx, mib_idx);
+ if (MFD_SUCCESS != rc)
+ return NULL;
+
+ rowreq_ctx =
+ CONTAINER_FIND(ipAddressPrefixTable_if_ctx.container, &oid_idx);
+
+ return rowreq_ctx;
+}
+#endif /* NETSNMP_FEATURE_REMOVE_IPADDRESSPREFIXTABLE_ROW_FIND_BY_MIB_INDEX */
diff --git a/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface.h b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface.h
new file mode 100644
index 0000000..28308b5
--- /dev/null
+++ b/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface.h
@@ -0,0 +1,98 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id$
+ */
+/** @ingroup 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 IPADDRESSPREFIXTABLE_INTERFACE_H
+#define IPADDRESSPREFIXTABLE_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "ipAddressPrefixTable.h"
+
+
+ /*
+ ********************************************************************
+ * Table declarations
+ */
+
+ /*
+ * PUBLIC interface initialization routine
+ */
+ void
+ _ipAddressPrefixTable_initialize_interface
+ (ipAddressPrefixTable_registration * user_ctx, u_long flags);
+ void
+ _ipAddressPrefixTable_shutdown_interface
+ (ipAddressPrefixTable_registration * user_ctx);
+
+ ipAddressPrefixTable_registration
+ * ipAddressPrefixTable_registration_get(void);
+
+ ipAddressPrefixTable_registration
+ * ipAddressPrefixTable_registration_set
+ (ipAddressPrefixTable_registration * newreg);
+
+ netsnmp_container *ipAddressPrefixTable_container_get(void);
+ int ipAddressPrefixTable_container_size(void);
+ ipAddressPrefixTable_rowreq_ctx
+ * ipAddressPrefixTable_allocate_rowreq_ctx(void *);
+ void
+ ipAddressPrefixTable_release_rowreq_ctx
+ (ipAddressPrefixTable_rowreq_ctx * rowreq_ctx);
+
+ int ipAddressPrefixTable_index_to_oid(netsnmp_index *
+ oid_idx,
+ ipAddressPrefixTable_mib_index
+ * mib_idx);
+ int ipAddressPrefixTable_index_from_oid(netsnmp_index *
+ oid_idx,
+ ipAddressPrefixTable_mib_index
+ * mib_idx);
+
+ /*
+ * access to certain internals. use with caution!
+ */
+ void
+ ipAddressPrefixTable_valid_columns_set(netsnmp_column_info *vc);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPADDRESSPREFIXTABLE_INTERFACE_H */
+/** @} */
+