summaryrefslogtreecommitdiff
path: root/agent/mibgroup/udp-mib
diff options
context:
space:
mode:
Diffstat (limited to 'agent/mibgroup/udp-mib')
-rw-r--r--agent/mibgroup/udp-mib/data_access/udp_endpoint.h34
-rw-r--r--agent/mibgroup/udp-mib/data_access/udp_endpoint_common.c158
-rw-r--r--agent/mibgroup/udp-mib/data_access/udp_endpoint_freebsd4.c194
-rw-r--r--agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c313
-rw-r--r--agent/mibgroup/udp-mib/data_access/udp_endpoint_netbsd.c207
-rw-r--r--agent/mibgroup/udp-mib/data_access/udp_endpoint_openbsd.c177
-rw-r--r--agent/mibgroup/udp-mib/data_access/udp_endpoint_private.h7
-rw-r--r--agent/mibgroup/udp-mib/data_access/udp_endpoint_solaris2.c205
-rw-r--r--agent/mibgroup/udp-mib/udpEndpointTable.h5
-rw-r--r--agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.c426
-rw-r--r--agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.h314
-rw-r--r--agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_constants.h85
-rw-r--r--agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.c357
-rw-r--r--agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.h73
-rw-r--r--agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_interface.c1099
-rw-r--r--agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_interface.h97
16 files changed, 3751 insertions, 0 deletions
diff --git a/agent/mibgroup/udp-mib/data_access/udp_endpoint.h b/agent/mibgroup/udp-mib/data_access/udp_endpoint.h
new file mode 100644
index 0000000..ce85be9
--- /dev/null
+++ b/agent/mibgroup/udp-mib/data_access/udp_endpoint.h
@@ -0,0 +1,34 @@
+/*
+ * udp_endpoint data access header
+ *
+ * $Id$
+ */
+/**---------------------------------------------------------------------*/
+/*
+ * configure required files
+ *
+ * Notes:
+ *
+ * 1) prefer functionality over platform, where possible. If a method
+ * is available for multiple platforms, test that first. That way
+ * when a new platform is ported, it won't need a new test here.
+ *
+ * 2) don't do detail requirements here. If, for example,
+ * HPUX11 had different reuirements than other HPUX, that should
+ * be handled in the *_hpux.h header file.
+ */
+config_require(udp-mib/data_access/udp_endpoint_common)
+#if defined( linux )
+config_require(udp-mib/data_access/udp_endpoint_linux)
+config_require(util_funcs/get_pid_from_inode)
+#elif defined( solaris2 )
+config_require(udp-mib/data_access/udp_endpoint_solaris2)
+#elif defined(freebsd4) || defined(dragonfly)
+config_require(udp-mib/data_access/udp_endpoint_freebsd4)
+#elif defined(openbsd4)
+config_require(udp-mib/data_access/udp_endpoint_openbsd)
+#elif defined(netbsd1)
+config_require(udp-mib/data_access/udp_endpoint_netbsd)
+#else
+# define NETSNMP_UDP_ENDPOINT_COMMON_ONLY
+#endif
diff --git a/agent/mibgroup/udp-mib/data_access/udp_endpoint_common.c b/agent/mibgroup/udp-mib/data_access/udp_endpoint_common.c
new file mode 100644
index 0000000..63f8549
--- /dev/null
+++ b/agent/mibgroup/udp-mib/data_access/udp_endpoint_common.c
@@ -0,0 +1,158 @@
+/*
+ * UDP-MIB endpoint architecture support
+ *
+ * $Id$
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-features.h>
+#include <net-snmp/net-snmp-includes.h>
+#include "udp-mib/udpEndpointTable/udpEndpointTable_constants.h"
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/ipaddress.h>
+#include <net-snmp/data_access/udp_endpoint.h>
+
+#include "udp_endpoint_private.h"
+
+netsnmp_feature_child_of(udp_endpoint_common, libnetsnmpmibs)
+
+netsnmp_feature_child_of(udp_endpoint_entry_create, udp_endpoint_common)
+
+/**---------------------------------------------------------------------*/
+/*
+ * local static vars
+ */
+
+
+/**---------------------------------------------------------------------*/
+/*
+ * initialization
+ */
+
+/**---------------------------------------------------------------------*/
+/*
+ * container functions
+ */
+/**
+ * initialize udp_endpoint container
+ */
+netsnmp_container *
+netsnmp_access_udp_endpoint_container_init(u_int flags)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("access:udp_endpoint:container", "init\n"));
+
+ /*
+ * create the containers.
+ */
+ container = netsnmp_container_find("access_udp_endpoint:table_container");
+ if (NULL == container)
+ return NULL;
+
+ return container;
+}
+
+/**
+ * load udp_endpoint information in specified container
+ *
+ * @param container empty container, or NULL to have one created for you
+ * @param load_flags flags to modify behaviour.
+ *
+ * @retval NULL error
+ * @retval !NULL pointer to container
+ */
+netsnmp_container*
+netsnmp_access_udp_endpoint_container_load(netsnmp_container* container,
+ u_int load_flags)
+{
+ int rc;
+
+ DEBUGMSGTL(("access:udp_endpoint:container", "load\n"));
+
+ if (NULL == container)
+ container = netsnmp_access_udp_endpoint_container_init(0);
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "no container specified/found for access_udp_endpoint\n");
+ return NULL;
+ }
+
+ rc =
+ netsnmp_arch_udp_endpoint_container_load(container, load_flags);
+ if (0 != rc) {
+ netsnmp_access_udp_endpoint_container_free(container, 0);
+ container = NULL;
+ }
+
+ return container;
+}
+
+void
+netsnmp_access_udp_endpoint_container_free(netsnmp_container *container,
+ u_int free_flags)
+{
+ DEBUGMSGTL(("access:udp_endpoint:container", "free\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container for netsnmp_access_udp_endpoint_free\n");
+ return;
+ }
+
+ if(! (free_flags & NETSNMP_ACCESS_UDP_ENDPOINT_FREE_DONT_CLEAR)) {
+ /*
+ * free all items.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func*)
+ netsnmp_access_udp_endpoint_entry_free,
+ NULL);
+ }
+
+ if(! (free_flags & NETSNMP_ACCESS_UDP_ENDPOINT_FREE_KEEP_CONTAINER))
+ CONTAINER_FREE(container);
+}
+
+/**---------------------------------------------------------------------*/
+/*
+ * entry functions
+ */
+/**
+ */
+#ifndef NETSNMP_FEATURE_REMOVE_UDP_ENDPOINT_ENTRY_CREATE
+netsnmp_udp_endpoint_entry *
+netsnmp_access_udp_endpoint_entry_create(void)
+{
+ netsnmp_udp_endpoint_entry *entry =
+ SNMP_MALLOC_TYPEDEF(netsnmp_udp_endpoint_entry);
+
+ DEBUGMSGTL(("access:udp_endpoint:entry", "create\n"));
+
+ if(NULL == entry)
+ return NULL;
+
+ entry->oid_index.len = 1;
+ entry->oid_index.oids = (oid *) & entry->index;
+
+ return entry;
+}
+#endif /* NETSNMP_FEATURE_REMOVE_UDP_ENDPOINT_ENTRY_CREATE */
+
+/**
+ */
+void
+netsnmp_access_udp_endpoint_entry_free(netsnmp_udp_endpoint_entry * entry)
+{
+ DEBUGMSGTL(("access:udp_endpoint:entry", "free\n"));
+
+ if (NULL == entry)
+ return;
+
+ /*
+ * SNMP_FREE not needed, for any of these,
+ * since the whole entry is about to be freed
+ */
+
+ free(entry);
+}
diff --git a/agent/mibgroup/udp-mib/data_access/udp_endpoint_freebsd4.c b/agent/mibgroup/udp-mib/data_access/udp_endpoint_freebsd4.c
new file mode 100644
index 0000000..efb8bb6
--- /dev/null
+++ b/agent/mibgroup/udp-mib/data_access/udp_endpoint_freebsd4.c
@@ -0,0 +1,194 @@
+/*
+ * UDP MIB architecture support for FreeBSD/DragonFlyBsd
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/ipaddress.h>
+#include <net-snmp/data_access/udp_endpoint.h>
+
+#include "udp-mib/udpEndpointTable/udpEndpointTable_constants.h"
+#include "udp-mib/data_access/udp_endpoint_private.h"
+
+#include "mibII/mibII_common.h"
+
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+
+static int _load(netsnmp_container *container, u_int flags);
+
+/*
+ * initialize arch specific storage
+ *
+ * @retval 0: success
+ * @retval <0: error
+ */
+int
+netsnmp_arch_udp_endpoint_entry_init(netsnmp_udp_endpoint_entry *entry)
+{
+ /*
+ * init
+ */
+ return 0;
+}
+
+/*
+ * cleanup arch specific storage
+ */
+void
+netsnmp_arch_udp_endpoint_entry_cleanup(netsnmp_udp_endpoint_entry *entry)
+{
+ /*
+ * cleanup
+ */
+}
+
+/*
+ * copy arch specific storage
+ */
+int
+netsnmp_arch_udp_endpoint_entry_copy(netsnmp_udp_endpoint_entry *lhs,
+ netsnmp_udp_endpoint_entry *rhs)
+{
+ return 0;
+}
+
+/*
+ * delete an entry
+ */
+int
+netsnmp_arch_udp_endpoint_entry_delete(netsnmp_udp_endpoint_entry *entry)
+{
+ if (NULL == entry)
+ return -1;
+ /** xxx-rks:9 tcpConn delete not implemented */
+ return -1;
+}
+
+
+/**
+ *
+ * @retval 0 no errors
+ * @retval !0 errors
+ */
+int
+netsnmp_arch_udp_endpoint_container_load(netsnmp_container *container,
+ u_int load_flags )
+{
+ int rc = 0;
+
+ DEBUGMSGTL(("access:udp_endpoint:container",
+ "udp_endpoint_container_arch_load (flags %x)\n", load_flags));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "no container specified/found for access_udp_endpoint\n");
+ return -1;
+ }
+
+ rc = _load(container, load_flags);
+
+ return rc;
+}
+
+#define NS_ELEM struct xinpcb
+
+/**
+ *
+ * @retval 0 no errors
+ * @retval !0 errors
+ */
+static int
+_load(netsnmp_container *container, u_int load_flags)
+{
+ size_t len;
+ int sname[] = { CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_PCBLIST };
+ char *udpcb_buf = NULL;
+#if defined(dragonfly)
+ struct xinpcb *xig = NULL;
+#else
+ struct xinpgen *xig = NULL;
+#endif
+ netsnmp_udp_endpoint_entry *entry;
+ int rc = 0;
+
+ /*
+ * Read in the buffer containing the TCP table data
+ */
+ len = 0;
+ if (sysctl(sname, 4, 0, &len, 0, 0) < 0 ||
+ (udpcb_buf = malloc(len)) == NULL)
+ return -1;
+ if (sysctl(sname, 4, udpcb_buf, &len, 0, 0) < 0) {
+ free(udpcb_buf);
+ return -1;
+ }
+
+ /*
+ * Unpick this into the constituent 'xinpgen' structures, and extract
+ * the 'inpcb' elements into a linked list (built in reverse)
+ */
+#if defined(dragonfly)
+ xig = (struct xinpcb *) udpcb_buf;
+#else
+ xig = (struct xinpgen *) udpcb_buf;
+ xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+#endif
+
+#if defined(dragonfly)
+ while (xig && (xig->xi_len >= sizeof(struct xinpcb)))
+#else
+ while (xig && (xig->xig_len > sizeof(struct xinpgen)))
+#endif
+ {
+ NS_ELEM pcb = *((NS_ELEM *) xig);
+#if defined(dragonfly)
+ xig = (struct xinpcb *) ((char *) xig + xig->xi_len);
+#else
+ xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+#endif
+
+#if !defined(NETSNMP_ENABLE_IPV6)
+ if (pcb.xi_inp.inp_vflag & INP_IPV6)
+ continue;
+#endif
+
+ entry = netsnmp_access_udp_endpoint_entry_create();
+ if(NULL == entry) {
+ rc = -3;
+ break;
+ }
+
+ /** oddly enough, these appear to already be in network order */
+ entry->loc_port = htons(pcb.xi_inp.inp_lport);
+ entry->rmt_port = htons(pcb.xi_inp.inp_fport);
+ entry->pid = 0;
+
+ /** the addr string may need work */
+ if (pcb.xi_inp.inp_vflag & INP_IPV6) {
+ entry->loc_addr_len = entry->rmt_addr_len = 16;
+ memcpy(entry->loc_addr, &pcb.xi_inp.in6p_laddr, 16);
+ memcpy(entry->rmt_addr, &pcb.xi_inp.in6p_faddr, 16);
+ }
+ else {
+ entry->loc_addr_len = entry->rmt_addr_len = 4;
+ memcpy(entry->loc_addr, &pcb.xi_inp.inp_laddr, 4);
+ memcpy(entry->rmt_addr, &pcb.xi_inp.inp_faddr, 4);
+ }
+
+ /*
+ * add entry to container
+ */
+ entry->index = CONTAINER_SIZE(container) + 1;
+ CONTAINER_INSERT(container, entry);
+ }
+
+ if(rc<0)
+ return rc;
+
+ return 0;
+}
diff --git a/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c b/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c
new file mode 100644
index 0000000..6edbdc1
--- /dev/null
+++ b/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c
@@ -0,0 +1,313 @@
+/*
+ * udpEndpointTable MIB architecture support
+ *
+ * $Id$
+ */
+#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 <net-snmp/library/file_utils.h>
+#include <net-snmp/library/text_utils.h>
+
+#include <net-snmp/data_access/ipaddress.h>
+#include <net-snmp/data_access/udp_endpoint.h>
+
+#include "udp-mib/udpEndpointTable/udpEndpointTable_constants.h"
+#include "mibgroup/util_funcs/get_pid_from_inode.h"
+#include "udp_endpoint_private.h"
+
+#include <fcntl.h>
+
+netsnmp_feature_require(text_utils)
+netsnmp_feature_child_of(udp_endpoint_all, libnetsnmpmibs)
+netsnmp_feature_child_of(udp_endpoint_writable, udp_endpoint_all)
+
+static int _load4(netsnmp_container *container, u_int flags);
+#if defined (NETSNMP_ENABLE_IPV6)
+static int _load6(netsnmp_container *container, u_int flags);
+#endif
+
+/*
+ * initialize arch specific storage
+ *
+ * @retval 0: success
+ * @retval <0: error
+ */
+#ifndef NETSNMP_FEATURE_REMOVE_UDP_ENDPOINT_WRITABLE
+int
+netsnmp_arch_udp_endpoint_entry_init(netsnmp_udp_endpoint_entry *entry)
+{
+ /*
+ * init
+ */
+ return 0;
+}
+
+/*
+ * cleanup arch specific storage
+ */
+void
+netsnmp_arch_udp_endpoint_entry_cleanup(netsnmp_udp_endpoint_entry *entry)
+{
+ /*
+ * cleanup
+ */
+}
+
+/*
+ * copy arch specific storage
+ */
+int
+netsnmp_arch_udp_endpoint_entry_copy(netsnmp_udp_endpoint_entry *lhs,
+ netsnmp_udp_endpoint_entry *rhs)
+{
+ return 0;
+}
+
+/*
+ * delete an entry
+ */
+int
+netsnmp_arch_udp_endpoint_delete(netsnmp_udp_endpoint_entry *entry)
+{
+ if (NULL == entry)
+ return -1;
+ /** xxx-rks:9 udp_endpoint delete not implemented */
+ return -1;
+}
+#endif /* NETSNMP_FEATURE_REMOVE_UDP_ENDPOINT_WRITABLE */
+
+
+/**
+ *
+ * @retval 0 no errors
+ * @retval !0 errors
+ */
+int
+netsnmp_arch_udp_endpoint_container_load(netsnmp_container *container,
+ u_int load_flags )
+{
+ int rc = 0;
+
+ /* Setup the pid_from_inode table, and fill it.*/
+ netsnmp_get_pid_from_inode_init();
+
+ rc = _load4(container, load_flags);
+ if(rc < 0) {
+ u_int flags = NETSNMP_ACCESS_UDP_ENDPOINT_FREE_KEEP_CONTAINER;
+ netsnmp_access_udp_endpoint_container_free(container, flags);
+ return rc;
+ }
+
+#if defined (NETSNMP_ENABLE_IPV6)
+ rc = _load6(container, load_flags);
+ if(rc < 0) {
+ u_int flags = NETSNMP_ACCESS_UDP_ENDPOINT_FREE_KEEP_CONTAINER;
+ netsnmp_access_udp_endpoint_container_free(container, flags);
+ return rc;
+ }
+#endif
+
+ return 0;
+}
+
+/**
+ * @internal
+ * process token value index line
+ */
+static int
+_process_line_udp_ep(netsnmp_line_info *line_info, void *mem,
+ struct netsnmp_line_process_info_s* lpi)
+{
+ netsnmp_udp_endpoint_entry *ep = (netsnmp_udp_endpoint_entry *)mem;
+ char *ptr, *sep;
+ u_char *u_ptr;
+ size_t u_ptr_len, offset, len;
+ unsigned long long inode;
+ size_t count = 0;
+
+ /*
+ * skip 'sl'
+ */
+ ptr = skip_not_white(line_info->start);
+ if (NULL == ptr) {
+ DEBUGMSGTL(("access:udp_endpoint", "no sl '%s'\n",
+ line_info->start));
+ return PMLP_RC_MEMORY_UNUSED;
+ }
+ ptr = skip_white(ptr);
+ if (NULL == ptr) {
+ DEBUGMSGTL(("text:util:tvi", "no space after sl '%s'\n",
+ line_info->start));
+ return PMLP_RC_MEMORY_UNUSED;
+ }
+
+ /*
+ * get local address. ignore error on hex conversion, since that
+ * function doesn't like the ':' between address and port. check the
+ * offset to see if it worked. May need to flip string too.
+ */
+ u_ptr = ep->loc_addr;
+ u_ptr_len = sizeof(ep->loc_addr);
+ sep = strchr(ptr, ':');
+ if (NULL == sep) {
+ DEBUGMSGTL(("text:util:tvi", "no ':' '%s'\n",
+ line_info->start));
+ return PMLP_RC_MEMORY_UNUSED;
+ }
+ len = (sep - ptr);
+ if (-1 == netsnmp_addrstr_hton(ptr, len)) {
+ DEBUGMSGTL(("text:util:tvi", "bad length %d for loc addr '%s'\n",
+ (int)u_ptr_len, line_info->start));
+ return PMLP_RC_MEMORY_UNUSED;
+ }
+ offset = 0;
+ netsnmp_hex_to_binary(&u_ptr, &u_ptr_len, &offset, 0, ptr, NULL);
+ if ((4 != offset) && (16 != offset)) {
+ DEBUGMSGTL(("text:util:tvi", "bad offset %d for loc addr '%s'\n",
+ (int)offset, line_info->start));
+ return PMLP_RC_MEMORY_UNUSED;
+ }
+ ep->loc_addr_len = offset;
+ ptr += (offset * 2);
+ ++ptr; /* skip ':' */
+
+ /*
+ * get local port
+ */
+ ep->loc_port = strtol(ptr, &ptr, 16);
+ ptr = skip_white(ptr);
+
+ /*
+ * get remote address. ignore error on hex conversion, since that
+ * function doesn't like the ':' between address and port. check the
+ * offset to see if it worked. May need to flip string too.
+ */
+ u_ptr = ep->rmt_addr;
+ u_ptr_len = sizeof(ep->rmt_addr);
+ sep = strchr(ptr, ':');
+ if (NULL == sep) {
+ DEBUGMSGTL(("text:util:tvi", "no ':' '%s'\n",
+ line_info->start));
+ return PMLP_RC_MEMORY_UNUSED;
+ }
+ len = (sep - ptr);
+ if (-1 == netsnmp_addrstr_hton(ptr, len)) {
+ DEBUGMSGTL(("text:util:tvi", "bad length %d for rmt addr '%s'\n",
+ (int)u_ptr_len, line_info->start));
+ return PMLP_RC_MEMORY_UNUSED;
+ }
+ offset = 0;
+ netsnmp_hex_to_binary(&u_ptr, &u_ptr_len, &offset, 0, ptr, NULL);
+ if ((4 != offset) && (16 != offset)) {
+ DEBUGMSGTL(("text:util:tvi", "bad offset %d for rmt addr '%s'\n",
+ (int)offset, line_info->start));
+ return PMLP_RC_MEMORY_UNUSED;
+ }
+ ep->rmt_addr_len = offset;
+ ptr += (offset * 2);
+ ++ptr; /* skip ':' */
+
+ /*
+ * get remote port
+ */
+ ep->rmt_port = strtol(ptr, &ptr, 16);
+ ptr = skip_white(ptr);
+
+ /*
+ * get state too
+ */
+ ep->state = strtol(ptr, &ptr, 16);
+
+ /*
+ * Use inode as instance value.
+ */
+ while (count != 5) {
+ ptr = skip_white(ptr);
+ ptr = skip_not_white(ptr);
+ count++;
+ }
+ inode = strtoull(ptr, &ptr, 0);
+ ep->instance = (u_int)inode;
+
+ /*
+ * get the pid also
+ */
+ ep->pid = netsnmp_get_pid_from_inode(inode);
+
+ ep->index = (uintptr_t)(lpi->user_context);
+ lpi->user_context = (void*)((char*)(lpi->user_context) + 1);
+
+ ep->oid_index.oids = &ep->index;
+ ep->oid_index.len = 1;
+
+ return PMLP_RC_MEMORY_USED;
+}
+
+/**
+ *
+ * @retval 0 no errors
+ * @retval !0 errors
+ */
+static int
+_load4(netsnmp_container *container, u_int load_flags)
+{
+ netsnmp_file *fp;
+ netsnmp_line_process_info lpi;
+
+ if (NULL == container)
+ return -1;
+
+ /*
+ * allocate file resources
+ */
+ fp = netsnmp_file_fill(NULL, "/proc/net/udp" , O_RDONLY, 0, 0);
+ if (NULL == fp) /** msg already logged */
+ return -2;
+
+ memset(&lpi, 0x0, sizeof(lpi));
+ lpi.mem_size = sizeof(netsnmp_udp_endpoint_entry);
+ lpi.process = _process_line_udp_ep;
+ lpi.user_context = (void*)0;
+
+ container = netsnmp_file_text_parse(fp, container, PM_USER_FUNCTION,
+ 0, &lpi);
+ netsnmp_file_release(fp);
+ return (NULL == container);
+}
+
+#if defined (NETSNMP_ENABLE_IPV6)
+/**
+ *
+ * @retval 0 no errors
+ * @retval !0 errors
+ */
+static int
+_load6(netsnmp_container *container, u_int load_flags)
+{
+ netsnmp_file *fp;
+ netsnmp_line_process_info lpi;
+
+ if (NULL == container)
+ return -1;
+
+ /*
+ * allocate file resources
+ */
+ fp = netsnmp_file_fill(NULL, "/proc/net/udp6" , O_RDONLY, 0, 0);
+ if (NULL == fp) /** msg already logged */
+ return -2;
+
+ memset(&lpi, 0x0, sizeof(lpi));
+ lpi.mem_size = sizeof(netsnmp_udp_endpoint_entry);
+ lpi.process = _process_line_udp_ep;
+ lpi.user_context = (void*)CONTAINER_SIZE(container);
+
+ container = netsnmp_file_text_parse(fp, container, PM_USER_FUNCTION,
+ 0, &lpi);
+ netsnmp_file_release(fp);
+ return (NULL == container);
+}
+#endif /* NETSNMP_ENABLE_IPV6 */
diff --git a/agent/mibgroup/udp-mib/data_access/udp_endpoint_netbsd.c b/agent/mibgroup/udp-mib/data_access/udp_endpoint_netbsd.c
new file mode 100644
index 0000000..f68314b
--- /dev/null
+++ b/agent/mibgroup/udp-mib/data_access/udp_endpoint_netbsd.c
@@ -0,0 +1,207 @@
+/*
+ * udp_endpointTable MIB architecture support for NetBSD
+ *
+ * $Id: udp_endpoint_linux.c 18994 2010-06-16 13:13:25Z dts12 $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/ipaddress.h>
+#include <net-snmp/data_access/udp_endpoint.h>
+
+#include "udp-mib/udpEndpointTable/udpEndpointTable_constants.h"
+#include "udp-mib/data_access/udp_endpoint_private.h"
+
+#include "mibII/mibII_common.h"
+
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+
+static int _load(netsnmp_container *container, u_int flags, int var);
+
+/*
+ * initialize arch specific storage
+ *
+ * @retval 0: success
+ * @retval <0: error
+ */
+int
+netsnmp_arch_udp_endpoint_entry_init(netsnmp_udp_endpoint_entry *entry)
+{
+ /*
+ * init
+ */
+ return 0;
+}
+
+/*
+ * cleanup arch specific storage
+ */
+void
+netsnmp_arch_udp_endpoint_entry_cleanup(netsnmp_udp_endpoint_entry *entry)
+{
+ /*
+ * cleanup
+ */
+}
+
+/*
+ * copy arch specific storage
+ */
+int
+netsnmp_arch_udp_endpoint_entry_copy(netsnmp_udp_endpoint_entry *lhs,
+ netsnmp_udp_endpoint_entry *rhs)
+{
+ return 0;
+}
+
+/*
+ * delete an entry
+ */
+int
+netsnmp_arch_udp_endpoint_entry_delete(netsnmp_udp_endpoint_entry *entry)
+{
+ if (NULL == entry)
+ return -1;
+ /** xxx-rks:9 udp_endpoint delete not implemented */
+ return -1;
+}
+
+
+/**
+ *
+ * @retval 0 no errors
+ * @retval !0 errors
+ */
+int
+netsnmp_arch_udp_endpoint_container_load(netsnmp_container *container,
+ u_int load_flags )
+{
+ int rc = 0;
+
+ DEBUGMSGTL(("access:udp_endpoint:container",
+ "udp_endpoint_container_arch_load (flags %x)\n", load_flags));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "no container specified/found for access_udp_endpoint\n");
+ return -1;
+ }
+
+ rc = _load(container, load_flags, 4);
+#if defined(NETSNMP_ENABLE_IPV6)
+ rc = _load(container, load_flags, 6);
+#endif
+
+ return rc;
+}
+
+
+/**
+ *
+ * @retval 0 no errors
+ * @retval !0 errors
+ */
+static int
+_load(netsnmp_container *container, u_int load_flags, int ver)
+{
+ const char *mibname;
+ int mib[8];
+ size_t mib_len;
+ struct kinfo_pcb *pcblist;
+ size_t pcb_len;
+ netsnmp_udp_endpoint_entry *entry;
+ int i, rc = 0;
+
+ /*
+ * Read in the buffer containing the TCP table data
+ */
+ switch (ver) {
+ case 4:
+ mibname = "net.inet.udp.pcblist";
+ break;
+ case 6:
+ mibname = "net.inet6.udp6.pcblist";
+ break;
+ default:
+ snmp_log(LOG_ERR, "udp-mib:data_access:_load: bad version %d\n", ver);
+ return -1;
+ }
+
+ if (sysctlnametomib(mibname, mib, &mib_len) == -1) {
+ snmp_log(LOG_ERR, "udp-mib:data_access:_load: cant resolve mib %s\n", mibname);
+ return -1;
+ }
+
+ if (sysctl(mib, sizeof(mib) / sizeof(*mib), NULL, &pcb_len, NULL, 0) == -1) {
+ snmp_log(LOG_ERR, "udp-mib:data_access:_load: cant size mib %s\n", mibname);
+ return -1;
+ }
+
+ if ((pcblist = malloc(pcb_len)) == NULL) {
+ snmp_log(LOG_ERR, "udp-mib:data_access:_load: cant allocate mib %s\n", mibname);
+ return -1;
+ }
+ memset(pcblist, 0, pcb_len);
+
+ mib[6] = sizeof(*pcblist);
+ mib[7] = pcb_len / sizeof(*pcblist);
+
+ if (sysctl(mib, sizeof(mib) / sizeof(*mib),
+ pcblist, &pcb_len, NULL, 0) == -1) {
+ snmp_log(LOG_ERR, "udp-mib:data_access:_load: cant size mib %s\n", mibname);
+ return -1;
+ }
+
+ /*
+ * Unpick this into the constituent structures, and extract
+ * the 'inpcb' elements into a linked list (built in reverse)
+ */
+ for (i = 0; i < pcb_len / sizeof(*pcblist); i++) {
+ struct kinfo_pcb *pcb = pcblist+i;
+
+ entry = netsnmp_access_udp_endpoint_entry_create();
+ if(NULL == entry) {
+ rc = -3;
+ break;
+ }
+
+ entry->pid = 0;
+
+ if (ver == 6) {
+ struct sockaddr_in6 src, dst;
+ memcpy(&src, &pcb->ki_s, sizeof(src));
+ memcpy(&dst, &pcb->ki_d, sizeof(dst));
+ entry->loc_addr_len = entry->rmt_addr_len = 16;
+ memcpy(entry->loc_addr, &src.sin6_addr, 16);
+ memcpy(entry->rmt_addr, &dst.sin6_addr, 16);
+ entry->loc_port = ntohs(src.sin6_port);
+ entry->rmt_port = ntohs(dst.sin6_port);
+ }
+ else {
+ struct sockaddr_in src, dst;
+ memcpy(&src, &pcb->ki_s, sizeof(src));
+ memcpy(&dst, &pcb->ki_d, sizeof(dst));
+ entry->loc_addr_len = entry->rmt_addr_len = 4;
+ memcpy(entry->loc_addr, &src.sin_addr, 4);
+ memcpy(entry->rmt_addr, &dst.sin_addr, 4);
+ entry->loc_port = ntohs(src.sin_port);
+ entry->rmt_port = ntohs(dst.sin_port);
+ }
+
+ /*
+ * add entry to container
+ */
+ entry->index = CONTAINER_SIZE(container) + 1;
+ CONTAINER_INSERT(container, entry);
+ }
+
+ if(rc<0)
+ return rc;
+
+ return 0;
+}
diff --git a/agent/mibgroup/udp-mib/data_access/udp_endpoint_openbsd.c b/agent/mibgroup/udp-mib/data_access/udp_endpoint_openbsd.c
new file mode 100644
index 0000000..99b67dc
--- /dev/null
+++ b/agent/mibgroup/udp-mib/data_access/udp_endpoint_openbsd.c
@@ -0,0 +1,177 @@
+/*
+ * udp_endpointTable MIB architecture support for OpenBSD
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/ipaddress.h>
+#include <net-snmp/data_access/udp_endpoint.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "udp-mib/udpEndpointTable/udpEndpointTable_constants.h"
+#include "udp-mib/data_access/udp_endpoint_private.h"
+
+#include "mibII/mibII_common.h"
+
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+
+static int _load(netsnmp_container *container, u_int flags);
+
+/*
+ * initialize arch specific storage
+ *
+ * @retval 0: success
+ * @retval <0: error
+ */
+int
+netsnmp_arch_udp_endpoint_entry_init(netsnmp_udp_endpoint_entry *entry)
+{
+ /*
+ * init
+ */
+ return 0;
+}
+
+/*
+ * cleanup arch specific storage
+ */
+void
+netsnmp_arch_udp_endpoint_entry_cleanup(netsnmp_udp_endpoint_entry *entry)
+{
+ /*
+ * cleanup
+ */
+}
+
+/*
+ * copy arch specific storage
+ */
+int
+netsnmp_arch_udp_endpoint_entry_copy(netsnmp_udp_endpoint_entry *lhs,
+ netsnmp_udp_endpoint_entry *rhs)
+{
+ return 0;
+}
+
+/*
+ * delete an entry
+ */
+int
+netsnmp_arch_udp_endpoint_entry_delete(netsnmp_udp_endpoint_entry *entry)
+{
+ if (NULL == entry)
+ return -1;
+ /** xxx-rks:9 udp_endpoint delete not implemented */
+ return -1;
+}
+
+
+/**
+ *
+ * @retval 0 no errors
+ * @retval !0 errors
+ */
+int
+netsnmp_arch_udp_endpoint_container_load(netsnmp_container *container,
+ u_int load_flags )
+{
+ int rc = 0;
+
+ DEBUGMSGTL(("access:udp_endpoint:container",
+ "udp_endpoint_container_arch_load (flags %x)\n", load_flags));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "no container specified/found for access_udp_endpoint\n");
+ return -1;
+ }
+
+ rc = _load(container, load_flags);
+
+ return rc;
+}
+
+/**
+ *
+ * @retval 0 no errors
+ * @retval !0 errors
+ */
+static int
+_load(netsnmp_container *container, u_int load_flags)
+{
+ struct inpcbtable table;
+ struct inpcb *head, *next, *prev;
+ struct inpcb inpcb;
+ netsnmp_udp_endpoint_entry *entry;
+ int rc = 0;
+
+ /*
+ * Read in the buffer containing the TCP table data
+ */
+ if (!auto_nlist(UDB_SYMBOL, (char *) &table, sizeof(table))) {
+ DEBUGMSGTL(("udp-mib/udp_endpoint_openbsd", "Failed to read udp_symbol\n"));
+ return -1;
+ }
+
+ prev = (struct inpcb *)&CIRCLEQ_FIRST(&table.inpt_queue);
+ prev = NULL;
+ head = next = CIRCLEQ_FIRST(&table.inpt_queue);
+
+ while (next) {
+ NETSNMP_KLOOKUP(next, (char *)&inpcb, sizeof(inpcb));
+ if (prev && CIRCLEQ_PREV(&inpcb, inp_queue) != prev) {
+ snmp_log(LOG_ERR,"udbtable link error\n");
+ break;
+ }
+ prev = next;
+ next = CIRCLEQ_NEXT(&inpcb, inp_queue);
+
+#if !defined(NETSNMP_ENABLE_IPV6)
+ if (inpcb.inp_flags & INP_IPV6)
+ goto skip;
+#endif
+ entry = netsnmp_access_udp_endpoint_entry_create();
+ if (NULL == entry) {
+ rc = -3;
+ break;
+ }
+
+ /** oddly enough, these appear to already be in network order */
+ entry->loc_port = ntohs(inpcb.inp_lport);
+ entry->rmt_port = ntohs(inpcb.inp_fport);
+ entry->pid = 0;
+
+ /** the addr string may need work */
+ if (inpcb.inp_flags & INP_IPV6) {
+ entry->loc_addr_len = entry->rmt_addr_len = 16;
+ memcpy(entry->loc_addr, &inpcb.inp_laddr6, 16);
+ memcpy(entry->rmt_addr, &inpcb.inp_faddr6, 16);
+ }
+ else {
+ entry->loc_addr_len = entry->rmt_addr_len = 4;
+ memcpy(entry->loc_addr, &inpcb.inp_laddr, 4);
+ memcpy(entry->rmt_addr, &inpcb.inp_faddr, 4);
+ }
+
+ /*
+ * add entry to container
+ */
+ entry->index = CONTAINER_SIZE(container) + 1;
+ CONTAINER_INSERT(container, entry);
+#if !defined(NETSNMP_ENABLE_IPV6)
+ skip:
+#endif
+ if (next == head)
+ break;
+ }
+
+ if (rc < 0)
+ return rc;
+
+ return 0;
+}
diff --git a/agent/mibgroup/udp-mib/data_access/udp_endpoint_private.h b/agent/mibgroup/udp-mib/data_access/udp_endpoint_private.h
new file mode 100644
index 0000000..3ca9b2a
--- /dev/null
+++ b/agent/mibgroup/udp-mib/data_access/udp_endpoint_private.h
@@ -0,0 +1,7 @@
+int netsnmp_arch_udp_endpoint_init(void);
+int netsnmp_arch_udp_endpoint_container_load(netsnmp_container *, u_int);
+int netsnmp_arch_udp_endpoint_entry_init(netsnmp_udp_endpoint_entry *);
+void netsnmp_arch_udp_endpoint_entry_cleanup(netsnmp_udp_endpoint_entry *);
+int netsnmp_arch_udp_endpoint_entry_delete(netsnmp_udp_endpoint_entry *);
+int netsnmp_arch_udp_endpoint_entry_copy(netsnmp_udp_endpoint_entry *,
+ netsnmp_udp_endpoint_entry *);
diff --git a/agent/mibgroup/udp-mib/data_access/udp_endpoint_solaris2.c b/agent/mibgroup/udp-mib/data_access/udp_endpoint_solaris2.c
new file mode 100644
index 0000000..f52244a
--- /dev/null
+++ b/agent/mibgroup/udp-mib/data_access/udp_endpoint_solaris2.c
@@ -0,0 +1,205 @@
+#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 <net-snmp/data_access/ipaddress.h>
+#include <net-snmp/data_access/udp_endpoint.h>
+
+#include "udp-mib/udpEndpointTable/udpEndpointTable_constants.h"
+#include "udp-mib/data_access/udp_endpoint_private.h"
+
+#include "kernel_sunos5.h"
+
+netsnmp_feature_require(netsnmp_access_udp_endpoint_entry_create)
+netsnmp_feature_child_of(udp_endpoint_all, libnetsnmpmibs)
+netsnmp_feature_child_of(udp_endpoint_writable, udp_endpoint_all)
+
+static int _load_udp_endpoint_table_v4(netsnmp_container *, int);
+#if defined(NETSNMP_ENABLE_IPV6) && defined(SOLARIS_HAVE_IPV6_MIB_SUPPORT)
+static int _load_udp_endpoint_table_v6(netsnmp_container *, int);
+#endif
+
+#ifndef NETSNMP_FEATURE_REMOVE_UDP_ENDPOINT_WRITABLE
+int
+netsnmp_arch_udp_endpoint_entry_init(netsnmp_udp_endpoint_entry *ep)
+{
+ init_kernel_sunos5();
+ return 0;
+}
+
+void
+netsnmp_arch_udp_endpoint_entry_cleanup(netsnmp_udp_endpoint_entry *ep)
+{
+ /*
+ * Do nothing
+ */
+}
+
+int
+netsnmp_arch_udp_endpoint_entry_copy(netsnmp_udp_endpoint_entry *ep1,
+ netsnmp_udp_endpoint_entry *ep2)
+{
+ /*
+ * Do nothing
+ */
+ return 0;
+}
+
+int
+netsnmp_arch_udp_endpoint_delete(netsnmp_udp_endpoint_entry *ep)
+{
+ /*
+ * Not implemented
+ */
+ return (-1);
+}
+#endif /* NETSNMP_FEATURE_REMOVE_UDP_ENDPOINT_WRITABLE */
+
+int
+netsnmp_arch_udp_endpoint_container_load(netsnmp_container * container,
+ u_int load_flag)
+{
+ int rc;
+
+ if ((rc = _load_udp_endpoint_table_v4(container, load_flag)) != 0) {
+ u_int flag = NETSNMP_ACCESS_UDP_ENDPOINT_FREE_KEEP_CONTAINER;
+ netsnmp_access_udp_endpoint_container_free(container, flag);
+ return (rc);
+ }
+#if defined(NETSNMP_ENABLE_IPV6) && defined(SOLARIS_HAVE_IPV6_MIB_SUPPORT)
+ if ((rc = _load_udp_endpoint_table_v6(container, load_flag)) != 0) {
+ u_int flag = NETSNMP_ACCESS_UDP_ENDPOINT_FREE_KEEP_CONTAINER;
+ netsnmp_access_udp_endpoint_container_free(container, flag);
+ return (rc);
+ }
+#endif
+ return (0);
+}
+
+static int
+_load_udp_endpoint_table_v4(netsnmp_container *container, int flag)
+{
+ netsnmp_udp_endpoint_entry *ep;
+ mib2_udpEntry_t ue;
+ req_e req = GET_FIRST;
+
+ DEBUGMSGT(("access:udp_endpoint:container", "load v4\n"));
+
+ while (getMibstat(MIB_UDP_LISTEN, &ue, sizeof(ue), req,
+ &Get_everything, 0)==0) {
+ req = GET_NEXT;
+ ep = netsnmp_access_udp_endpoint_entry_create();
+ if (ep == NULL)
+ return (-1);
+ DEBUGMSGT(("access:udp_endpoint:container", "add entry\n"));
+
+ /*
+ * local address/port.
+ */
+ ep->loc_addr_len = sizeof(ue.udpLocalAddress);
+ if (sizeof(ep->loc_addr) < ep->loc_addr_len) {
+ netsnmp_access_udp_endpoint_entry_free(ep);
+ return (-1);
+ }
+ memcpy(&ep->loc_addr, &ue.udpLocalAddress, ep->loc_addr_len);
+
+ ep->loc_port = ue.udpLocalPort;
+
+ /*
+ * remote address/port. The address length is the same as the
+ * local address, so no check needed. If the remote address is
+ * unspecfied, then the type should be set to "unknown" (per RFC 4113).
+ */
+ if (ue.udpEntryInfo.ue_RemoteAddress == INADDR_ANY) {
+ ep->rmt_addr_len = 0;
+ } else {
+ ep->rmt_addr_len = sizeof(ue.udpEntryInfo.ue_RemoteAddress);
+ memcpy(&ep->rmt_addr, &ue.udpEntryInfo.ue_RemoteAddress,
+ ep->rmt_addr_len);
+ }
+
+ ep->rmt_port = ue.udpEntryInfo.ue_RemotePort;
+
+ /*
+ * instance - if there is support for RFC 4293, then we also have
+ * support for RFC 4113.
+ */
+#ifdef SOLARIS_HAVE_RFC4293_SUPPORT
+ ep->instance = ue.udpInstance;
+#else
+ ep->instance = 0;
+#endif
+
+ /* state */
+ ep->state = 0;
+
+ /* index */
+ ep->index = CONTAINER_SIZE(container) + 1;
+ ep->oid_index.oids = &ep->index;
+ ep->oid_index.len = 1;
+
+ CONTAINER_INSERT(container, (void *)ep);
+ }
+ return (0);
+}
+
+#if defined(NETSNMP_ENABLE_IPV6) && defined(SOLARIS_HAVE_IPV6_MIB_SUPPORT)
+static int
+_load_udp_endpoint_table_v6(netsnmp_container *container, int flag)
+{
+ netsnmp_udp_endpoint_entry *ep;
+ mib2_udp6Entry_t ue6;
+ req_e req = GET_FIRST;
+
+ DEBUGMSGT(("access:udp_endpoint:container", "load v6\n"));
+
+ while (getMibstat(MIB_UDP6_ENDPOINT, &ue6, sizeof(ue6), req,
+ &Get_everything, 0)==0) {
+ req = GET_NEXT;
+ ep = netsnmp_access_udp_endpoint_entry_create();
+ if (ep == NULL)
+ return (-1);
+ DEBUGMSGT(("access:udp_endpoint:container", "add entry\n"));
+
+ /*
+ * local address/port.
+ */
+ ep->loc_addr_len = sizeof(ue6.udp6LocalAddress);
+ if (sizeof(ep->loc_addr) < ep->loc_addr_len) {
+ netsnmp_access_udp_endpoint_entry_free(ep);
+ return (-1);
+ }
+ (void)memcpy(&ep->loc_addr, &ue6.udp6LocalAddress, ep->loc_addr_len);
+
+ ep->loc_port = ue6.udp6LocalPort;
+
+ /* remote address/port */
+ if (IN6_IS_ADDR_UNSPECIFIED(&ue6.udp6EntryInfo.ue_RemoteAddress)) {
+ ep->rmt_addr_len = 0;
+ } else {
+ ep->rmt_addr_len = sizeof(ue6.udp6EntryInfo.ue_RemoteAddress);
+ (void)memcpy(&ep->rmt_addr, &ue6.udp6EntryInfo.ue_RemoteAddress,
+ ep->rmt_addr_len);
+ }
+ ep->rmt_port = ue6.udp6EntryInfo.ue_RemotePort;
+
+ /* instance */
+#ifdef SOLARIS_HAVE_RFC4293_SUPPORT
+ ep->instance = ue6.udp6Instance;
+#else
+ ep->instance = 0;
+#endif
+ /* state */
+ ep->state = 0;
+
+ /* index */
+ ep->index = CONTAINER_SIZE(container) + 1;
+ ep->oid_index.oids = &ep->index;
+ ep->oid_index.len = 1;
+
+ CONTAINER_INSERT(container, (void *)ep);
+ }
+ return (0);
+}
+#endif /* defined(NETSNMP_ENABLE_IPV6)&&defined(SOLARIS_HAVE_IPV6_MIB_SUPPORT)*/
diff --git a/agent/mibgroup/udp-mib/udpEndpointTable.h b/agent/mibgroup/udp-mib/udpEndpointTable.h
new file mode 100644
index 0000000..95f49fd
--- /dev/null
+++ b/agent/mibgroup/udp-mib/udpEndpointTable.h
@@ -0,0 +1,5 @@
+/*
+ * module to include the modules
+ */
+
+config_require(udp-mib/udpEndpointTable/udpEndpointTable)
diff --git a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.c b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.c
new file mode 100644
index 0000000..145f4ce
--- /dev/null
+++ b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.c
@@ -0,0 +1,426 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id$
+ */
+/** \page MFD helper for udpEndpointTable
+ *
+ * \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 "udpEndpointTable.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "udpEndpointTable_interface.h"
+
+const oid udpEndpointTable_oid[] = { UDPENDPOINTTABLE_OID };
+const int udpEndpointTable_oid_size =
+OID_LENGTH(udpEndpointTable_oid);
+
+udpEndpointTable_registration udpEndpointTable_user_context;
+static udpEndpointTable_registration *udpEndpointTable_user_context_p;
+
+void initialize_table_udpEndpointTable(void);
+void shutdown_table_udpEndpointTable(void);
+
+
+/**
+ * Initializes the udpEndpointTable module
+ */
+void
+init_udpEndpointTable(void)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:init_udpEndpointTable",
+ "called\n"));
+
+ /*
+ * TODO:300:o: Perform udpEndpointTable one-time module initialization.
+ */
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ if (should_init("udpEndpointTable"))
+ initialize_table_udpEndpointTable();
+
+} /* init_udpEndpointTable */
+
+/**
+ * Shut-down the udpEndpointTable module (agent is exiting)
+ */
+void
+shutdown_udpEndpointTable(void)
+{
+ if (should_init("udpEndpointTable"))
+ shutdown_table_udpEndpointTable();
+
+}
+
+/**
+ * Initialize the table udpEndpointTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_udpEndpointTable(void)
+{
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:udpEndpointTable:initialize_table_udpEndpointTable", "called\n"));
+
+ /*
+ * TODO:301:o: Perform udpEndpointTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize udpEndpointTable 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.
+ */
+ udpEndpointTable_user_context_p =
+ netsnmp_create_data_list("udpEndpointTable", NULL, NULL);
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _udpEndpointTable_initialize_interface
+ (udpEndpointTable_user_context_p, flags);
+} /* initialize_table_udpEndpointTable */
+
+/**
+ * Shutdown the table udpEndpointTable
+ */
+void
+shutdown_table_udpEndpointTable(void)
+{
+ /*
+ * call interface shutdown code
+ */
+ _udpEndpointTable_shutdown_interface(udpEndpointTable_user_context_p);
+ netsnmp_free_all_list_data(udpEndpointTable_user_context_p);
+ udpEndpointTable_user_context_p = NULL;
+}
+
+/**
+ * pre-request callback
+ *
+ * @param user_context
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+udpEndpointTable_pre_request(udpEndpointTable_registration * user_context)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_pre_request",
+ "called\n"));
+
+ /*
+ * TODO:510:o: Perform udpEndpointTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* udpEndpointTable_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
+udpEndpointTable_post_request(udpEndpointTable_registration * user_context,
+ int rc)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_post_request",
+ "called\n"));
+
+ /*
+ * TODO:511:o: Perform udpEndpointTable post-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* udpEndpointTable_post_request */
+
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table udpEndpointTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * UDP-MIB::udpEndpointTable is subid 7 of udp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.7.7, length: 8
+ */
+
+/*
+ * ---------------------------------------------------------------------
+ * * TODO:200:r: Implement udpEndpointTable data context functions.
+ */
+
+
+/**
+ * set mib index(es)
+ *
+ * @param tbl_idx mib index structure
+ * @param udpEndpointLocalAddressType_val
+ * @param udpEndpointLocalAddress_val_ptr
+ * @param udpEndpointLocalAddress_val_ptr_len
+ * @param udpEndpointLocalPort_val
+ * @param udpEndpointRemoteAddressType_val
+ * @param udpEndpointRemoteAddress_val_ptr
+ * @param udpEndpointRemoteAddress_val_ptr_len
+ * @param udpEndpointRemotePort_val
+ * @param udpEndpointInstance_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
+udpEndpointTable_indexes_set_tbl_idx(udpEndpointTable_mib_index * tbl_idx,
+ u_long
+ udpEndpointLocalAddressType_val,
+ char *udpEndpointLocalAddress_val_ptr,
+ size_t
+ udpEndpointLocalAddress_val_ptr_len,
+ u_long udpEndpointLocalPort_val,
+ u_long
+ udpEndpointRemoteAddressType_val, char
+ *udpEndpointRemoteAddress_val_ptr,
+ size_t
+ udpEndpointRemoteAddress_val_ptr_len,
+ u_long udpEndpointRemotePort_val,
+ u_long udpEndpointInstance_val,
+ u_long udpEndpointProcess_val)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_indexes_set_tbl_idx", "called\n"));
+
+ /*
+ * udpEndpointLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ tbl_idx->udpEndpointLocalAddressType = udpEndpointLocalAddressType_val;
+
+ /*
+ * udpEndpointLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ tbl_idx->udpEndpointLocalAddress_len = sizeof(tbl_idx->udpEndpointLocalAddress) / sizeof(tbl_idx->udpEndpointLocalAddress[0]); /* max length */
+ /*
+ * make sure there is enough space for udpEndpointLocalAddress data
+ */
+ if ((NULL == tbl_idx->udpEndpointLocalAddress) ||
+ (tbl_idx->udpEndpointLocalAddress_len <
+ (udpEndpointLocalAddress_val_ptr_len))) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ tbl_idx->udpEndpointLocalAddress_len =
+ udpEndpointLocalAddress_val_ptr_len;
+ memcpy(tbl_idx->udpEndpointLocalAddress,
+ udpEndpointLocalAddress_val_ptr,
+ udpEndpointLocalAddress_val_ptr_len *
+ sizeof(udpEndpointLocalAddress_val_ptr[0]));
+
+ /*
+ * udpEndpointLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ tbl_idx->udpEndpointLocalPort = udpEndpointLocalPort_val;
+
+ /*
+ * udpEndpointRemoteAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ tbl_idx->udpEndpointRemoteAddressType =
+ udpEndpointRemoteAddressType_val;
+
+ /*
+ * udpEndpointRemoteAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ tbl_idx->udpEndpointRemoteAddress_len = sizeof(tbl_idx->udpEndpointRemoteAddress) / sizeof(tbl_idx->udpEndpointRemoteAddress[0]); /* max length */
+ /*
+ * make sure there is enough space for udpEndpointRemoteAddress data
+ */
+ if ((NULL == tbl_idx->udpEndpointRemoteAddress) ||
+ (tbl_idx->udpEndpointRemoteAddress_len <
+ (udpEndpointRemoteAddress_val_ptr_len))) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ tbl_idx->udpEndpointRemoteAddress_len =
+ udpEndpointRemoteAddress_val_ptr_len;
+ memcpy(tbl_idx->udpEndpointRemoteAddress,
+ udpEndpointRemoteAddress_val_ptr,
+ udpEndpointRemoteAddress_val_ptr_len *
+ sizeof(udpEndpointRemoteAddress_val_ptr[0]));
+
+ /*
+ * udpEndpointRemotePort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ tbl_idx->udpEndpointRemotePort = udpEndpointRemotePort_val;
+
+ /*
+ * udpEndpointInstance(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h
+ */
+ tbl_idx->udpEndpointInstance = udpEndpointInstance_val;
+ /*
+ * udpEndpointProcess(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h
+ */
+ tbl_idx->udpEndpointProcess = udpEndpointProcess_val;
+
+
+ return MFD_SUCCESS;
+} /* udpEndpointTable_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
+udpEndpointTable_indexes_set(udpEndpointTable_rowreq_ctx * rowreq_ctx,
+ u_long udpEndpointLocalAddressType_val,
+ char *udpEndpointLocalAddress_val_ptr,
+ size_t udpEndpointLocalAddress_val_ptr_len,
+ u_long udpEndpointLocalPort_val,
+ u_long udpEndpointRemoteAddressType_val,
+ char *udpEndpointRemoteAddress_val_ptr,
+ size_t udpEndpointRemoteAddress_val_ptr_len,
+ u_long udpEndpointRemotePort_val,
+ u_long udpEndpointInstance_val,
+ u_long udpEndpointProcess_val)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_indexes_set",
+ "called\n"));
+
+ if (MFD_SUCCESS !=
+ udpEndpointTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,
+ udpEndpointLocalAddressType_val,
+ udpEndpointLocalAddress_val_ptr,
+ udpEndpointLocalAddress_val_ptr_len,
+ udpEndpointLocalPort_val,
+ udpEndpointRemoteAddressType_val,
+ udpEndpointRemoteAddress_val_ptr,
+ udpEndpointRemoteAddress_val_ptr_len,
+ udpEndpointRemotePort_val,
+ udpEndpointInstance_val,
+ udpEndpointProcess_val))
+ return MFD_ERROR;
+
+ /*
+ * convert mib index to oid index
+ */
+ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
+ if (0 != udpEndpointTable_index_to_oid(&rowreq_ctx->oid_idx,
+ &rowreq_ctx->tbl_idx)) {
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS;
+} /* udpEndpointTable_indexes_set */
+
+
+/*---------------------------------------------------------------------
+ * UDP-MIB::udpEndpointEntry.udpEndpointProcess
+ * udpEndpointProcess is subid 8 of udpEndpointEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.7.7.1.8
+ * Description:
+The system's process ID for the process associated with
+ this endpoint, or zero if there is no such process.
+ This value is expected to be the same as
+ HOST-RESOURCES-MIB::hrSWRunIndex or SYSAPPL-MIB::
+ sysApplElmtRunIndex for some row in the appropriate
+ tables.
+ *
+ * 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 udpEndpointProcess data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param udpEndpointProcess_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
+udpEndpointProcess_get(udpEndpointTable_rowreq_ctx * rowreq_ctx,
+ u_long * udpEndpointProcess_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != udpEndpointProcess_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointProcess_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the udpEndpointProcess data.
+ * copy (* udpEndpointProcess_val_ptr ) from rowreq_ctx->tbl_idx.udpEndpointProcess
+ */
+ (*udpEndpointProcess_val_ptr) = rowreq_ctx->tbl_idx.udpEndpointProcess;
+
+ return MFD_SUCCESS;
+} /* udpEndpointProcess_get */
+
+
+
+/** @} */
+/** @} */
+/** @{ */
diff --git a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.h b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.h
new file mode 100644
index 0000000..0deda03
--- /dev/null
+++ b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.h
@@ -0,0 +1,314 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id$
+ */
+#ifndef UDPENDPOINTTABLE_H
+#define UDPENDPOINTTABLE_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(udp-mib/data_access/udp_endpoint)
+config_require(udp-mib/udpEndpointTable/udpEndpointTable_interface)
+config_require(udp-mib/udpEndpointTable/udpEndpointTable_data_access)
+ /* *INDENT-ON* */
+
+ /*
+ * OID, column number and enum definions for udpEndpointTable
+ */
+#include "udpEndpointTable_constants.h"
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+ void init_udpEndpointTable(void);
+ void shutdown_udpEndpointTable(void);
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table udpEndpointTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * UDP-MIB::udpEndpointTable is subid 7 of udp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.7.7, 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 udpEndpointTable registration context.
+ */
+ typedef netsnmp_data_list udpEndpointTable_registration;
+
+/**********************************************************************/
+ /*
+ * TODO:110:r: |-> Review udpEndpointTable data context structure.
+ * This structure is used to represent the data for udpEndpointTable.
+ */
+ /*
+ * This structure contains storage for all the columns defined in the
+ * udpEndpointTable.
+ */
+ typedef struct udpEndpointTable_data_s {
+
+ /*
+ * udpEndpointProcess(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ u_long udpEndpointProcess;
+
+ } udpEndpointTable_data;
+
+
+ /*
+ * TODO:120:r: |-> Review udpEndpointTable mib index.
+ * This structure is used to represent the index for udpEndpointTable.
+ */
+ typedef struct udpEndpointTable_mib_index_s {
+
+ /*
+ * udpEndpointLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ u_long udpEndpointLocalAddressType;
+
+ /*
+ * udpEndpointLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ /** 128 - 6(other indexes) - oid length(10) = 111 */
+ char udpEndpointLocalAddress[111];
+ size_t udpEndpointLocalAddress_len;
+
+ /*
+ * udpEndpointLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ u_long udpEndpointLocalPort;
+
+ /*
+ * udpEndpointRemoteAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ u_long udpEndpointRemoteAddressType;
+
+ /*
+ * udpEndpointRemoteAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ /** 128 - 6(other indexes) - oid length(10) = 111 */
+ char udpEndpointRemoteAddress[111];
+ size_t udpEndpointRemoteAddress_len;
+
+ /*
+ * udpEndpointRemotePort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ u_long udpEndpointRemotePort;
+
+ /*
+ * udpEndpointInstance(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h
+ */
+ u_long udpEndpointInstance;
+
+ /*
+ * udpEndpointProcess(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h
+ */
+ u_long udpEndpointProcess;
+
+
+ } udpEndpointTable_mib_index;
+
+ /*
+ * TODO:121:r: | |-> Review udpEndpointTable 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_udpEndpointTable_IDX_LEN 118
+
+
+ /*
+ *********************************************************************
+ * TODO:130:o: |-> Review udpEndpointTable Row request (rowreq) context.
+ * When your functions are called, you will be passed a
+ * udpEndpointTable_rowreq_ctx pointer.
+ */
+ typedef struct udpEndpointTable_rowreq_ctx_s {
+
+ /** this must be first for container compare to work */
+ netsnmp_index oid_idx;
+ oid oid_tmp[MAX_udpEndpointTable_IDX_LEN];
+
+ udpEndpointTable_mib_index tbl_idx;
+
+ udpEndpointTable_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 udpEndpointTable rowreq context.
+ */
+
+ /*
+ * storage for future expansion
+ */
+ netsnmp_data_list *udpEndpointTable_data_list;
+
+ } udpEndpointTable_rowreq_ctx;
+
+ typedef struct udpEndpointTable_ref_rowreq_ctx_s {
+ udpEndpointTable_rowreq_ctx *rowreq_ctx;
+ } udpEndpointTable_ref_rowreq_ctx;
+
+ /*
+ *********************************************************************
+ * function prototypes
+ */
+ int
+ udpEndpointTable_pre_request(udpEndpointTable_registration *
+ user_context);
+ int
+ udpEndpointTable_post_request(udpEndpointTable_registration *
+ user_context, int rc);
+
+
+ udpEndpointTable_rowreq_ctx
+ * udpEndpointTable_row_find_by_mib_index(udpEndpointTable_mib_index
+ * mib_idx);
+
+ extern const oid udpEndpointTable_oid[];
+ extern const int udpEndpointTable_oid_size;
+
+
+#include "udpEndpointTable_interface.h"
+#include "udpEndpointTable_data_access.h"
+ /*
+ *********************************************************************
+ * GET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * GET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table udpEndpointTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * UDP-MIB::udpEndpointTable is subid 7 of udp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.7.7, length: 8
+ */
+ /*
+ * indexes
+ */
+
+ int udpEndpointProcess_get(udpEndpointTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ udpEndpointProcess_val_ptr);
+
+
+ int
+ udpEndpointTable_indexes_set_tbl_idx(udpEndpointTable_mib_index *
+ tbl_idx,
+ u_long
+ udpEndpointLocalAddressType_val,
+ char
+ *udpEndpointLocalAddress_val_ptr,
+ size_t
+ udpEndpointLocalAddress_val_ptr_len,
+ u_long
+ udpEndpointLocalPort_val,
+ u_long
+ udpEndpointRemoteAddressType_val,
+ char
+ *udpEndpointRemoteAddress_val_ptr,
+ size_t
+ udpEndpointRemoteAddress_val_ptr_len,
+ u_long
+ udpEndpointRemotePort_val,
+ u_long
+ udpEndpointInstance_val,
+ u_long
+ udpEndpointProcess_val);
+ int
+ udpEndpointTable_indexes_set(udpEndpointTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ udpEndpointLocalAddressType_val,
+ char *udpEndpointLocalAddress_val_ptr,
+ size_t
+ udpEndpointLocalAddress_val_ptr_len,
+ u_long udpEndpointLocalPort_val,
+ u_long
+ udpEndpointRemoteAddressType_val, char
+ *udpEndpointRemoteAddress_val_ptr,
+ size_t
+ udpEndpointRemoteAddress_val_ptr_len,
+ u_long udpEndpointRemotePort_val,
+ u_long udpEndpointInstance_val,
+ u_long udpEndpointProcess_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 /* UDPENDPOINTTABLE_H */
+/** @} */
+
diff --git a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_constants.h b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_constants.h
new file mode 100644
index 0000000..35a4c2d
--- /dev/null
+++ b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_constants.h
@@ -0,0 +1,85 @@
+/*
+ * 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 UDPENDPOINTTABLE_CONSTANTS_H
+#define UDPENDPOINTTABLE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ * column number definitions for table udpEndpointTable
+ */
+#define UDPENDPOINTTABLE_OID 1,3,6,1,2,1,7,7
+
+#define COLUMN_UDPENDPOINTLOCALADDRESSTYPE 1
+
+#define COLUMN_UDPENDPOINTLOCALADDRESS 2
+
+#define COLUMN_UDPENDPOINTLOCALPORT 3
+
+#define COLUMN_UDPENDPOINTREMOTEADDRESSTYPE 4
+
+#define COLUMN_UDPENDPOINTREMOTEADDRESS 5
+
+#define COLUMN_UDPENDPOINTREMOTEPORT 6
+
+#define COLUMN_UDPENDPOINTINSTANCE 7
+
+#define COLUMN_UDPENDPOINTPROCESS 8
+
+
+#define UDPENDPOINTTABLE_MIN_COL COLUMN_UDPENDPOINTPROCESS
+#define UDPENDPOINTTABLE_MAX_COL COLUMN_UDPENDPOINTPROCESS
+
+
+ /*
+ * 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 udpEndpointTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * udpEndpointLocalAddressType (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 */
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* UDPENDPOINTTABLE_OIDS_H */
diff --git a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.c b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.c
new file mode 100644
index 0000000..0e25c21
--- /dev/null
+++ b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.c
@@ -0,0 +1,357 @@
+/*
+ * 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-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/ipaddress.h>
+#include <net-snmp/data_access/udp_endpoint.h>
+
+/*
+ * include our parent header
+ */
+#include "udpEndpointTable.h"
+
+
+#include "udpEndpointTable_data_access.h"
+
+/** @ingroup interface
+ * @addtogroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table udpEndpointTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * UDP-MIB::udpEndpointTable is subid 7 of udp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.7.7, length: 8
+ */
+
+/**
+ * initialization for udpEndpointTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param udpEndpointTable_reg
+ * Pointer to udpEndpointTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+udpEndpointTable_init_data(udpEndpointTable_registration *
+ udpEndpointTable_reg)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_init_data",
+ "called\n"));
+
+ /*
+ * TODO:303:o: Initialize udpEndpointTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* udpEndpointTable_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
+udpEndpointTable_container_init(netsnmp_container **container_ptr_ptr,
+ netsnmp_cache * cache)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_container_init",
+ "called\n"));
+
+ if (NULL == container_ptr_ptr) {
+ snmp_log(LOG_ERR,
+ "bad container param to udpEndpointTable_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 udpEndpointTable_container_init\n");
+ return;
+ }
+
+ /*
+ * TODO:345:A: Set up udpEndpointTable 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 = UDPENDPOINTTABLE_CACHE_TIMEOUT; /* seconds */
+} /* udpEndpointTable_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 udpEndpointTable_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
+udpEndpointTable_container_shutdown(netsnmp_container *container_ptr)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_container_shutdown", "called\n"));
+
+ if (NULL == container_ptr) {
+ snmp_log(LOG_ERR,
+ "bad params to udpEndpointTable_container_shutdown\n");
+ return;
+ }
+
+} /* udpEndpointTable_container_shutdown */
+
+/**
+ * load initial data
+ *
+ * TODO:350:M: Implement udpEndpointTable 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
+ * udpEndpointTable_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.
+ *
+ */
+static u_long
+_address_type_from_len(int addrlen) {
+ switch (addrlen) {
+ case 4:
+ return INETADDRESSTYPE_IPV4;
+ case 16:
+ return INETADDRESSTYPE_IPV6;
+ case 0:
+ return INETADDRESSTYPE_UNKNOWN;
+ default:
+ /* To get same behavior as before */
+ return INETADDRESSTYPE_IPV4;
+ }
+}
+
+int
+udpEndpointTable_container_load(netsnmp_container *container)
+{
+ udpEndpointTable_rowreq_ctx *rowreq_ctx;
+ netsnmp_container *ep_c;
+ netsnmp_iterator *ep_it;
+ netsnmp_udp_endpoint_entry *ep;
+
+ /*
+ * temporary storage for index values
+ */
+ u_long udpEndpointLocalAddressType;
+ u_long udpEndpointRemoteAddressType;
+
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_container_load",
+ "called\n"));
+
+ /*
+ * TODO:351:M: |-> Load/update data in the udpEndpointTable container.
+ * loop over your udpEndpointTable data, allocate a rowreq context,
+ * set the index(es) [and data, optionally] and insert into
+ * the container.
+ */
+ ep_c = netsnmp_access_udp_endpoint_container_load(NULL, 0);
+ if (NULL == ep_c)
+ return MFD_RESOURCE_UNAVAILABLE;
+ ep_it = CONTAINER_ITERATOR(ep_c);
+ if (NULL == ep_it) {
+ netsnmp_access_udp_endpoint_container_free(ep_c, 0);
+ return MFD_RESOURCE_UNAVAILABLE;
+ }
+ for (ep = (netsnmp_udp_endpoint_entry*)ITERATOR_FIRST(ep_it); ep;
+ ep = (netsnmp_udp_endpoint_entry*)ITERATOR_NEXT (ep_it)) {
+
+ /*
+ * TODO:352:M: | |-> set indexes in new udpEndpointTable rowreq context.
+ */
+ rowreq_ctx = udpEndpointTable_allocate_rowreq_ctx();
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "memory allocation failed\n");
+ return MFD_RESOURCE_UNAVAILABLE;
+ }
+ udpEndpointLocalAddressType = _address_type_from_len(ep->loc_addr_len);
+ udpEndpointRemoteAddressType = _address_type_from_len(ep->rmt_addr_len);
+ if (MFD_SUCCESS !=
+ udpEndpointTable_indexes_set(rowreq_ctx,
+ udpEndpointLocalAddressType,
+ (char *) ep->loc_addr,
+ ep->loc_addr_len,
+ ep->loc_port,
+ udpEndpointRemoteAddressType,
+ (char *) ep->rmt_addr,
+ ep->rmt_addr_len,
+ ep->rmt_port,
+ ep->instance,
+ ep->pid)) {
+ snmp_log(LOG_ERR,
+ "error setting index while loading "
+ "udpEndpointTable data.\n");
+ udpEndpointTable_release_rowreq_ctx(rowreq_ctx);
+ continue;
+ }
+
+ /*
+ * TODO:352:r: | |-> populate udpEndpointTable data context.
+ * Populate data context here. (optionally, delay until row prep)
+ */
+ /*
+ * non-TRANSIENT data: no need to copy. set pointer to data
+ */
+
+ /*
+ * insert into table container
+ */
+ CONTAINER_INSERT(container, rowreq_ctx);
+ }
+
+ ITERATOR_RELEASE(ep_it);
+
+ netsnmp_access_udp_endpoint_container_free(ep_c, 0);
+
+
+ DEBUGMSGT(("verbose:udpEndpointTable:udpEndpointTable_container_load",
+ "inserted %d records\n", (int)CONTAINER_SIZE(container)));
+
+ return MFD_SUCCESS;
+} /* udpEndpointTable_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
+udpEndpointTable_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_container_free",
+ "called\n"));
+
+ /*
+ * TODO:380:M: Free udpEndpointTable container data.
+ */
+} /* udpEndpointTable_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
+udpEndpointTable_row_prep(udpEndpointTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_row_prep",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:390:o: Prepare row for request.
+ * If populating row data was delayed, this is the place to
+ * fill in the row for this request.
+ */
+
+ return MFD_SUCCESS;
+} /* udpEndpointTable_row_prep */
+
+/** @} */
diff --git a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.h b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.h
new file mode 100644
index 0000000..df7ea87
--- /dev/null
+++ b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.h
@@ -0,0 +1,73 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id$
+ */
+#ifndef UDPENDPOINTTABLE_DATA_ACCESS_H
+#define UDPENDPOINTTABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table udpEndpointTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * UDP-MIB::udpEndpointTable is subid 7 of udp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.7.7, length: 8
+ */
+
+
+ int
+ udpEndpointTable_init_data(udpEndpointTable_registration *
+ udpEndpointTable_reg);
+
+
+ /*
+ * TODO:180:o: Review udpEndpointTable cache timeout.
+ * The number of seconds before the cache times out
+ */
+#define UDPENDPOINTTABLE_CACHE_TIMEOUT 60
+
+ void udpEndpointTable_container_init(netsnmp_container
+ **container_ptr_ptr,
+ netsnmp_cache * cache);
+ void udpEndpointTable_container_shutdown(netsnmp_container
+ *container_ptr);
+
+ int udpEndpointTable_container_load(netsnmp_container
+ *container);
+ void udpEndpointTable_container_free(netsnmp_container
+ *container);
+
+ int udpEndpointTable_cache_load(netsnmp_container
+ *container);
+ void udpEndpointTable_cache_free(netsnmp_container
+ *container);
+
+ int udpEndpointTable_row_prep(udpEndpointTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* UDPENDPOINTTABLE_DATA_ACCESS_H */
diff --git a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_interface.c b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_interface.c
new file mode 100644
index 0000000..60d37e9
--- /dev/null
+++ b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_interface.c
@@ -0,0 +1,1099 @@
+/*
+ * 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 "udpEndpointTable.h"
+
+
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/library/container.h>
+
+#include "udpEndpointTable_interface.h"
+
+#include <ctype.h>
+
+netsnmp_feature_child_of(udpEndpointTable_external_access, libnetsnmpmibs)
+
+netsnmp_feature_require(row_merge)
+netsnmp_feature_require(baby_steps)
+netsnmp_feature_require(check_all_requests_error)
+
+
+netsnmp_feature_child_of(udpEndpointTable_container_size, udpEndpointTable_external_access)
+netsnmp_feature_child_of(udpEndpointTable_registration_set, udpEndpointTable_external_access)
+netsnmp_feature_child_of(udpEndpointTable_registration_get, udpEndpointTable_external_access)
+netsnmp_feature_child_of(udpEndpointTable_container_get, udpEndpointTable_external_access)
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table udpEndpointTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * UDP-MIB::udpEndpointTable is subid 7 of udp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.7.7, length: 8
+ */
+typedef struct udpEndpointTable_interface_ctx_s {
+
+ netsnmp_container *container;
+ netsnmp_cache *cache;
+
+ udpEndpointTable_registration *user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+} udpEndpointTable_interface_ctx;
+
+static udpEndpointTable_interface_ctx udpEndpointTable_if_ctx;
+
+static void
+ _udpEndpointTable_container_init(udpEndpointTable_interface_ctx * if_ctx);
+static void
+ _udpEndpointTable_container_shutdown(udpEndpointTable_interface_ctx *
+ if_ctx);
+
+#ifndef NETSNMP_FEATURE_REMOVE_UDPENDPOINTTABLE_CONTAINER_GET
+netsnmp_container *
+udpEndpointTable_container_get(void)
+{
+ return udpEndpointTable_if_ctx.container;
+}
+#endif /* NETSNMP_FEATURE_REMOVE_UDPENDPOINTTABLE_CONTAINER_GET */
+
+#ifndef NETSNMP_FEATURE_REMOVE_UDPENDPOINTTABLE_REGISTRATION_GET
+udpEndpointTable_registration *
+udpEndpointTable_registration_get(void)
+{
+ return udpEndpointTable_if_ctx.user_ctx;
+}
+#endif /* NETSNMP_FEATURE_REMOVE_UDPENDPOINTTABLE_REGISTRATION_GET */
+
+#ifndef NETSNMP_FEATURE_REMOVE_UDPENDPOINTTABLE_REGISTRATION_SET
+udpEndpointTable_registration *
+udpEndpointTable_registration_set(udpEndpointTable_registration * newreg)
+{
+ udpEndpointTable_registration *old = udpEndpointTable_if_ctx.user_ctx;
+ udpEndpointTable_if_ctx.user_ctx = newreg;
+ return old;
+}
+#endif /* NETSNMP_FEATURE_REMOVE_UDPENDPOINTTABLE_REGISTRATION_SET */
+
+#ifndef NETSNMP_FEATURE_REMOVE_UDPENDPOINTTABLE_CONTAINER_SIZE
+int
+udpEndpointTable_container_size(void)
+{
+ return CONTAINER_SIZE(udpEndpointTable_if_ctx.container);
+}
+#endif /* NETSNMP_FEATURE_REMOVE_UDPENDPOINTTABLE_CONTAINER_SIZE */
+
+/*
+ * mfd multiplexer modes
+ */
+static Netsnmp_Node_Handler _mfd_udpEndpointTable_pre_request;
+static Netsnmp_Node_Handler _mfd_udpEndpointTable_post_request;
+static Netsnmp_Node_Handler _mfd_udpEndpointTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_udpEndpointTable_get_values;
+/**
+ * @internal
+ * Initialize the table udpEndpointTable
+ * (Define its contents and how it's structured)
+ */
+void
+_udpEndpointTable_initialize_interface(udpEndpointTable_registration *
+ reg_ptr, u_long flags)
+{
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &udpEndpointTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info =
+ &udpEndpointTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:udpEndpointTable:_udpEndpointTable_initialize_interface", "called\n"));
+
+
+ /*************************************************
+ *
+ * save interface context for udpEndpointTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,
+ /** index: udpEndpointLocalAddressType */
+ ASN_OCTET_STR,
+ /** index: udpEndpointLocalAddress */
+ ASN_UNSIGNED,
+ /** index: udpEndpointLocalPort */
+ ASN_INTEGER,
+ /** index: udpEndpointRemoteAddressType */
+ ASN_OCTET_STR,
+ /** index: udpEndpointRemoteAddress */
+ ASN_UNSIGNED,
+ /** index: udpEndpointRemotePort */
+ ASN_UNSIGNED,
+ /** index: udpEndpointInstance */
+ 0);
+
+ /*
+ * Define the minimum and maximum accessible columns. This
+ * optimizes retrieval.
+ */
+ tbl_info->min_column = UDPENDPOINTTABLE_MIN_COL;
+ tbl_info->max_column = UDPENDPOINTTABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ udpEndpointTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ udpEndpointTable_init_data(reg_ptr);
+
+ /*
+ * set up the container
+ */
+ _udpEndpointTable_container_init(&udpEndpointTable_if_ctx);
+ if (NULL == udpEndpointTable_if_ctx.container) {
+ snmp_log(LOG_ERR,
+ "could not initialize container for udpEndpointTable\n");
+ return;
+ }
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup =
+ _mfd_udpEndpointTable_object_lookup;
+ access_multiplexer->get_values = _mfd_udpEndpointTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request = _mfd_udpEndpointTable_pre_request;
+ access_multiplexer->post_request = _mfd_udpEndpointTable_post_request;
+
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("udpEndpointTable:init_udpEndpointTable",
+ "Registering udpEndpointTable as a mibs-for-dummies table.\n"));
+ handler =
+ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo =
+ netsnmp_handler_registration_create("udpEndpointTable", handler,
+ udpEndpointTable_oid,
+ udpEndpointTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RONLY);
+ if (NULL == reginfo) {
+ snmp_log(LOG_ERR, "error registering table udpEndpointTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &udpEndpointTable_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,
+ udpEndpointTable_if_ctx.
+ container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject cache helper
+ */
+ if (NULL != udpEndpointTable_if_ctx.cache) {
+ handler = netsnmp_cache_handler_get(udpEndpointTable_if_ctx.cache);
+ netsnmp_inject_handler(reginfo, handler);
+ }
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+
+} /* _udpEndpointTable_initialize_interface */
+
+/**
+ * @internal
+ * Shutdown the table udpEndpointTable
+ */
+void
+_udpEndpointTable_shutdown_interface(udpEndpointTable_registration *
+ reg_ptr)
+{
+ /*
+ * shutdown the container
+ */
+ _udpEndpointTable_container_shutdown(&udpEndpointTable_if_ctx);
+}
+
+void
+udpEndpointTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ udpEndpointTable_if_ctx.tbl_info.valid_columns = vc;
+} /* udpEndpointTable_valid_columns_set */
+
+/**
+ * @internal
+ * convert the index component stored in the context to an oid
+ */
+int
+udpEndpointTable_index_to_oid(netsnmp_index * oid_idx,
+ udpEndpointTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * udpEndpointLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_udpEndpointLocalAddressType;
+ /*
+ * udpEndpointLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_udpEndpointLocalAddress;
+ /*
+ * udpEndpointLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_udpEndpointLocalPort;
+ /*
+ * udpEndpointRemoteAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_udpEndpointRemoteAddressType;
+ /*
+ * udpEndpointRemoteAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_udpEndpointRemoteAddress;
+ /*
+ * udpEndpointRemotePort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_udpEndpointRemotePort;
+ /*
+ * udpEndpointInstance(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_udpEndpointInstance;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_udpEndpointLocalAddressType, 0x00,
+ sizeof(var_udpEndpointLocalAddressType));
+ var_udpEndpointLocalAddressType.type = ASN_INTEGER;
+ memset(&var_udpEndpointLocalAddress, 0x00,
+ sizeof(var_udpEndpointLocalAddress));
+ var_udpEndpointLocalAddress.type = ASN_OCTET_STR;
+ memset(&var_udpEndpointLocalPort, 0x00,
+ sizeof(var_udpEndpointLocalPort));
+ var_udpEndpointLocalPort.type = ASN_UNSIGNED;
+ memset(&var_udpEndpointRemoteAddressType, 0x00,
+ sizeof(var_udpEndpointRemoteAddressType));
+ var_udpEndpointRemoteAddressType.type = ASN_INTEGER;
+ memset(&var_udpEndpointRemoteAddress, 0x00,
+ sizeof(var_udpEndpointRemoteAddress));
+ var_udpEndpointRemoteAddress.type = ASN_OCTET_STR;
+ memset(&var_udpEndpointRemotePort, 0x00,
+ sizeof(var_udpEndpointRemotePort));
+ var_udpEndpointRemotePort.type = ASN_UNSIGNED;
+ memset(&var_udpEndpointInstance, 0x00,
+ sizeof(var_udpEndpointInstance));
+ var_udpEndpointInstance.type = ASN_UNSIGNED;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_udpEndpointLocalAddressType.next_variable =
+ &var_udpEndpointLocalAddress;
+ var_udpEndpointLocalAddress.next_variable = &var_udpEndpointLocalPort;
+ var_udpEndpointLocalPort.next_variable =
+ &var_udpEndpointRemoteAddressType;
+ var_udpEndpointRemoteAddressType.next_variable =
+ &var_udpEndpointRemoteAddress;
+ var_udpEndpointRemoteAddress.next_variable =
+ &var_udpEndpointRemotePort;
+ var_udpEndpointRemotePort.next_variable = &var_udpEndpointInstance;
+ var_udpEndpointInstance.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_index_to_oid",
+ "called\n"));
+
+ /*
+ * udpEndpointLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ snmp_set_var_value(&var_udpEndpointLocalAddressType,
+ (u_char *) & mib_idx->udpEndpointLocalAddressType,
+ sizeof(mib_idx->udpEndpointLocalAddressType));
+
+ /*
+ * udpEndpointLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ snmp_set_var_value(&var_udpEndpointLocalAddress,
+ (u_char *) & mib_idx->udpEndpointLocalAddress,
+ mib_idx->udpEndpointLocalAddress_len *
+ sizeof(mib_idx->udpEndpointLocalAddress[0]));
+
+ /*
+ * udpEndpointLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ snmp_set_var_value(&var_udpEndpointLocalPort,
+ (u_char *) & mib_idx->udpEndpointLocalPort,
+ sizeof(mib_idx->udpEndpointLocalPort));
+
+ /*
+ * udpEndpointRemoteAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ snmp_set_var_value(&var_udpEndpointRemoteAddressType,
+ (u_char *) & mib_idx->udpEndpointRemoteAddressType,
+ sizeof(mib_idx->udpEndpointRemoteAddressType));
+
+ /*
+ * udpEndpointRemoteAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ snmp_set_var_value(&var_udpEndpointRemoteAddress,
+ (u_char *) & mib_idx->udpEndpointRemoteAddress,
+ mib_idx->udpEndpointRemoteAddress_len *
+ sizeof(mib_idx->udpEndpointRemoteAddress[0]));
+
+ /*
+ * udpEndpointRemotePort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ snmp_set_var_value(&var_udpEndpointRemotePort,
+ (u_char *) & mib_idx->udpEndpointRemotePort,
+ sizeof(mib_idx->udpEndpointRemotePort));
+
+ /*
+ * udpEndpointInstance(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h
+ */
+ snmp_set_var_value(&var_udpEndpointInstance,
+ (u_char *) & mib_idx->udpEndpointInstance,
+ sizeof(mib_idx->udpEndpointInstance));
+
+
+ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
+ NULL, 0, &var_udpEndpointLocalAddressType);
+ 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_udpEndpointLocalAddressType);
+
+ return err;
+} /* udpEndpointTable_index_to_oid */
+
+/**
+ * extract udpEndpointTable indexes from a netsnmp_index
+ *
+ * @retval SNMP_ERR_NOERROR : no error
+ * @retval SNMP_ERR_GENERR : error
+ */
+int
+udpEndpointTable_index_from_oid(netsnmp_index * oid_idx,
+ udpEndpointTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * udpEndpointLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_udpEndpointLocalAddressType;
+ /*
+ * udpEndpointLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_udpEndpointLocalAddress;
+ /*
+ * udpEndpointLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_udpEndpointLocalPort;
+ /*
+ * udpEndpointRemoteAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_udpEndpointRemoteAddressType;
+ /*
+ * udpEndpointRemoteAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_udpEndpointRemoteAddress;
+ /*
+ * udpEndpointRemotePort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_udpEndpointRemotePort;
+ /*
+ * udpEndpointInstance(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_udpEndpointInstance;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_udpEndpointLocalAddressType, 0x00,
+ sizeof(var_udpEndpointLocalAddressType));
+ var_udpEndpointLocalAddressType.type = ASN_INTEGER;
+ memset(&var_udpEndpointLocalAddress, 0x00,
+ sizeof(var_udpEndpointLocalAddress));
+ var_udpEndpointLocalAddress.type = ASN_OCTET_STR;
+ memset(&var_udpEndpointLocalPort, 0x00,
+ sizeof(var_udpEndpointLocalPort));
+ var_udpEndpointLocalPort.type = ASN_UNSIGNED;
+ memset(&var_udpEndpointRemoteAddressType, 0x00,
+ sizeof(var_udpEndpointRemoteAddressType));
+ var_udpEndpointRemoteAddressType.type = ASN_INTEGER;
+ memset(&var_udpEndpointRemoteAddress, 0x00,
+ sizeof(var_udpEndpointRemoteAddress));
+ var_udpEndpointRemoteAddress.type = ASN_OCTET_STR;
+ memset(&var_udpEndpointRemotePort, 0x00,
+ sizeof(var_udpEndpointRemotePort));
+ var_udpEndpointRemotePort.type = ASN_UNSIGNED;
+ memset(&var_udpEndpointInstance, 0x00,
+ sizeof(var_udpEndpointInstance));
+ var_udpEndpointInstance.type = ASN_UNSIGNED;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_udpEndpointLocalAddressType.next_variable =
+ &var_udpEndpointLocalAddress;
+ var_udpEndpointLocalAddress.next_variable = &var_udpEndpointLocalPort;
+ var_udpEndpointLocalPort.next_variable =
+ &var_udpEndpointRemoteAddressType;
+ var_udpEndpointRemoteAddressType.next_variable =
+ &var_udpEndpointRemoteAddress;
+ var_udpEndpointRemoteAddress.next_variable =
+ &var_udpEndpointRemotePort;
+ var_udpEndpointRemotePort.next_variable = &var_udpEndpointInstance;
+ var_udpEndpointInstance.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_index_from_oid",
+ "called\n"));
+
+ /*
+ * parse the oid into the individual index components
+ */
+ err = parse_oid_indexes(oid_idx->oids, oid_idx->len,
+ &var_udpEndpointLocalAddressType);
+ if (err == SNMP_ERR_NOERROR) {
+ /*
+ * copy out values
+ */
+ mib_idx->udpEndpointLocalAddressType =
+ *((u_long *) var_udpEndpointLocalAddressType.val.string);
+ /*
+ * NOTE: val_len is in bytes, udpEndpointLocalAddress_len might not be
+ */
+ if (var_udpEndpointLocalAddress.val_len >
+ sizeof(mib_idx->udpEndpointLocalAddress))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->udpEndpointLocalAddress,
+ var_udpEndpointLocalAddress.val.string,
+ var_udpEndpointLocalAddress.val_len);
+ mib_idx->udpEndpointLocalAddress_len =
+ var_udpEndpointLocalAddress.val_len /
+ sizeof(mib_idx->udpEndpointLocalAddress[0]);
+ }
+ mib_idx->udpEndpointLocalPort =
+ *((u_long *) var_udpEndpointLocalPort.val.string);
+ mib_idx->udpEndpointRemoteAddressType =
+ *((u_long *) var_udpEndpointRemoteAddressType.val.string);
+ /*
+ * NOTE: val_len is in bytes, udpEndpointRemoteAddress_len might not be
+ */
+ if (var_udpEndpointRemoteAddress.val_len >
+ sizeof(mib_idx->udpEndpointRemoteAddress))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->udpEndpointRemoteAddress,
+ var_udpEndpointRemoteAddress.val.string,
+ var_udpEndpointRemoteAddress.val_len);
+ mib_idx->udpEndpointRemoteAddress_len =
+ var_udpEndpointRemoteAddress.val_len /
+ sizeof(mib_idx->udpEndpointRemoteAddress[0]);
+ }
+ mib_idx->udpEndpointRemotePort =
+ *((u_long *) var_udpEndpointRemotePort.val.string);
+ mib_idx->udpEndpointInstance =
+ *((u_long *) var_udpEndpointInstance.val.string);
+
+
+ }
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_udpEndpointLocalAddressType);
+
+ return err;
+} /* udpEndpointTable_index_from_oid */
+
+
+/*
+ *********************************************************************
+ * @internal
+ * allocate resources for a udpEndpointTable_rowreq_ctx
+ */
+udpEndpointTable_rowreq_ctx *
+udpEndpointTable_allocate_rowreq_ctx(void)
+{
+ udpEndpointTable_rowreq_ctx *rowreq_ctx =
+ SNMP_MALLOC_TYPEDEF(udpEndpointTable_rowreq_ctx);
+
+ DEBUGMSGTL(("internal:udpEndpointTable:udpEndpointTable_allocate_rowreq_ctx", "called\n"));
+
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "Couldn't allocate memory for a "
+ "udpEndpointTable_rowreq_ctx.\n");
+ return NULL;
+ }
+
+ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
+
+ rowreq_ctx->udpEndpointTable_data_list = NULL;
+
+
+ return rowreq_ctx;
+} /* udpEndpointTable_allocate_rowreq_ctx */
+
+/*
+ * @internal
+ * release resources for a udpEndpointTable_rowreq_ctx
+ */
+void
+udpEndpointTable_release_rowreq_ctx(udpEndpointTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("internal:udpEndpointTable:udpEndpointTable_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);
+} /* udpEndpointTable_release_rowreq_ctx */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_udpEndpointTable_pre_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+
+ DEBUGMSGTL(("internal:udpEndpointTable:_mfd_udpEndpointTable_pre_request", "called\n"));
+
+ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:udpEndpointTable",
+ "skipping additional pre_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ rc = udpEndpointTable_pre_request(udpEndpointTable_if_ctx.user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("udpEndpointTable", "error %d from "
+ "udpEndpointTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_udpEndpointTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_udpEndpointTable_post_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ udpEndpointTable_rowreq_ctx *rowreq_ctx = (udpEndpointTable_rowreq_ctx*)
+ netsnmp_container_table_row_extract(requests);
+ int rc, packet_rc;
+
+ DEBUGMSGTL(("internal:udpEndpointTable:_mfd_udpEndpointTable_post_request", "called\n"));
+
+ /*
+ * release row context, if deleted
+ */
+ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))
+ udpEndpointTable_release_rowreq_ctx(rowreq_ctx);
+
+ /*
+ * wait for last call before calling user
+ */
+ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:udpEndpointTable",
+ "waiting for last post_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
+ rc = udpEndpointTable_post_request(udpEndpointTable_if_ctx.user_ctx,
+ packet_rc);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("udpEndpointTable", "error %d from "
+ "udpEndpointTable_post_request\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_udpEndpointTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_udpEndpointTable_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;
+ udpEndpointTable_rowreq_ctx *rowreq_ctx = (udpEndpointTable_rowreq_ctx*)
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:udpEndpointTable:_mfd_udpEndpointTable_object_lookup", "called\n"));
+
+ /*
+ * get our context from mfd
+ * udpEndpointTable_interface_ctx *if_ctx =
+ * (udpEndpointTable_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
+ udpEndpointTable_row_prep(rowreq_ctx);
+
+ return SNMP_VALIDATE_ERR(rc);
+} /* _mfd_udpEndpointTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_udpEndpointTable_get_column(udpEndpointTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:udpEndpointTable:_mfd_udpEndpointTable_get_column", "called for %d\n", column));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * udpEndpointProcess(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_UDPENDPOINTPROCESS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_UNSIGNED;
+ rc = udpEndpointProcess_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _udpEndpointTable_get_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _udpEndpointTable_get_column */
+
+int
+_mfd_udpEndpointTable_get_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ udpEndpointTable_rowreq_ctx *rowreq_ctx = (udpEndpointTable_rowreq_ctx*)
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ u_char *old_string;
+ void (*dataFreeHook) (void *);
+ int rc;
+
+ DEBUGMSGTL(("internal:udpEndpointTable:_mfd_udpEndpointTable_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 = _udpEndpointTable_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_udpEndpointTable_get_values */
+
+
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*
+ * SET PROCESSING NOT APPLICABLE (per MIB or user setting)
+ */
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+static void _container_free(netsnmp_container *container);
+
+/**
+ * @internal
+ */
+static int
+_cache_load(netsnmp_cache * cache, void *vmagic)
+{
+ DEBUGMSGTL(("internal:udpEndpointTable:_cache_load", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache for udpEndpointTable_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 udpEndpointTable_container_load((netsnmp_container *) cache->
+ magic);
+} /* _cache_load */
+
+/**
+ * @internal
+ */
+static void
+_cache_free(netsnmp_cache * cache, void *magic)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("internal:udpEndpointTable:_cache_free", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache in udpEndpointTable_cache_free\n");
+ return;
+ }
+
+ container = (netsnmp_container *) cache->magic;
+
+ _container_free(container);
+} /* _cache_free */
+
+/**
+ * @internal
+ */
+static void
+_container_item_free(udpEndpointTable_rowreq_ctx * rowreq_ctx,
+ void *context)
+{
+ DEBUGMSGTL(("internal:udpEndpointTable:_container_item_free",
+ "called\n"));
+
+ if (NULL == rowreq_ctx)
+ return;
+
+ udpEndpointTable_release_rowreq_ctx(rowreq_ctx);
+} /* _container_item_free */
+
+/**
+ * @internal
+ */
+static void
+_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("internal:udpEndpointTable:_container_free", "called\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container in udpEndpointTable_container_free\n");
+ return;
+ }
+
+ /*
+ * call user code
+ */
+ udpEndpointTable_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
+_udpEndpointTable_container_init(udpEndpointTable_interface_ctx * if_ctx)
+{
+ DEBUGMSGTL(("internal:udpEndpointTable:_udpEndpointTable_container_init", "called\n"));
+
+ /*
+ * cache init
+ */
+ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */
+ _cache_load, _cache_free,
+ udpEndpointTable_oid,
+ udpEndpointTable_oid_size);
+
+ if (NULL == if_ctx->cache) {
+ snmp_log(LOG_ERR, "error creating cache for udpEndpointTable\n");
+ return;
+ }
+
+ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
+
+ udpEndpointTable_container_init(&if_ctx->container, if_ctx->cache);
+ if (NULL == if_ctx->container)
+ if_ctx->container =
+ netsnmp_container_find("udpEndpointTable:table_container");
+ if (NULL == if_ctx->container) {
+ snmp_log(LOG_ERR, "error creating container in "
+ "udpEndpointTable_container_init\n");
+ return;
+ }
+ if_ctx->container->container_name = strdup("udpEndpointTable");
+
+ if (NULL != if_ctx->cache)
+ if_ctx->cache->magic = (void *) if_ctx->container;
+} /* _udpEndpointTable_container_init */
+
+/**
+ * @internal
+ * shutdown the container with functions or wrappers
+ */
+void
+_udpEndpointTable_container_shutdown(udpEndpointTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:udpEndpointTable:_udpEndpointTable_container_shutdown", "called\n"));
+
+ udpEndpointTable_container_shutdown(if_ctx->container);
+
+ _container_free(if_ctx->container);
+
+} /* _udpEndpointTable_container_shutdown */
+
+
+#ifndef NETSNMP_FEATURE_REMOVE_UDPENDPOINTTABLE_EXTERNAL_ACCESS
+udpEndpointTable_rowreq_ctx *
+udpEndpointTable_row_find_by_mib_index(udpEndpointTable_mib_index *
+ mib_idx)
+{
+ udpEndpointTable_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 = udpEndpointTable_index_to_oid(&oid_idx, mib_idx);
+ if (MFD_SUCCESS != rc)
+ return NULL;
+
+ rowreq_ctx = (udpEndpointTable_rowreq_ctx*)
+ CONTAINER_FIND(udpEndpointTable_if_ctx.container, &oid_idx);
+
+ return rowreq_ctx;
+}
+#endif /* NETSNMP_FEATURE_REMOVE_UDPENDPOINTTABLE_EXTERNAL_ACCESS */
diff --git a/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_interface.h b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_interface.h
new file mode 100644
index 0000000..a7016e0
--- /dev/null
+++ b/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_interface.h
@@ -0,0 +1,97 @@
+/*
+ * 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 UDPENDPOINTTABLE_INTERFACE_H
+#define UDPENDPOINTTABLE_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "udpEndpointTable.h"
+
+
+ /*
+ ********************************************************************
+ * Table declarations
+ */
+
+ /*
+ * PUBLIC interface initialization routine
+ */
+ void
+ _udpEndpointTable_initialize_interface
+ (udpEndpointTable_registration * user_ctx, u_long flags);
+ void
+ _udpEndpointTable_shutdown_interface(udpEndpointTable_registration
+ * user_ctx);
+
+ udpEndpointTable_registration *udpEndpointTable_registration_get(void);
+
+ udpEndpointTable_registration
+ * udpEndpointTable_registration_set(udpEndpointTable_registration *
+ newreg);
+
+ netsnmp_container *udpEndpointTable_container_get(void);
+ int udpEndpointTable_container_size(void);
+
+ udpEndpointTable_rowreq_ctx
+ * udpEndpointTable_allocate_rowreq_ctx(void);
+ void
+ udpEndpointTable_release_rowreq_ctx(udpEndpointTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int udpEndpointTable_index_to_oid(netsnmp_index * oid_idx,
+ udpEndpointTable_mib_index
+ * mib_idx);
+ int udpEndpointTable_index_from_oid(netsnmp_index *
+ oid_idx,
+ udpEndpointTable_mib_index
+ * mib_idx);
+
+ /*
+ * access to certain internals. use with caution!
+ */
+ void udpEndpointTable_valid_columns_set(netsnmp_column_info
+ *vc);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* UDPENDPOINTTABLE_INTERFACE_H */
+/** @} */
+