summaryrefslogtreecommitdiff
path: root/include/net-snmp/agent
diff options
context:
space:
mode:
Diffstat (limited to 'include/net-snmp/agent')
-rw-r--r--include/net-snmp/agent/agent_callbacks.h21
-rw-r--r--include/net-snmp/agent/agent_handler.h283
-rw-r--r--include/net-snmp/agent/agent_index.h46
-rw-r--r--include/net-snmp/agent/agent_read_config.h31
-rw-r--r--include/net-snmp/agent/agent_registry.h184
-rw-r--r--include/net-snmp/agent/agent_sysORTable.h28
-rw-r--r--include/net-snmp/agent/agent_trap.h54
-rw-r--r--include/net-snmp/agent/all_helpers.h43
-rw-r--r--include/net-snmp/agent/auto_nlist.h28
-rw-r--r--include/net-snmp/agent/baby_steps.h117
-rw-r--r--include/net-snmp/agent/bulk_to_next.h28
-rw-r--r--include/net-snmp/agent/cache_handler.h130
-rw-r--r--include/net-snmp/agent/debug_handler.h16
-rw-r--r--include/net-snmp/agent/ds_agent.h74
-rw-r--r--include/net-snmp/agent/hardware/cpu.h68
-rw-r--r--include/net-snmp/agent/hardware/fsys.h109
-rw-r--r--include/net-snmp/agent/hardware/memory.h39
-rw-r--r--include/net-snmp/agent/hardware/sensors.h48
-rw-r--r--include/net-snmp/agent/instance.h145
-rw-r--r--include/net-snmp/agent/mfd.h84
-rw-r--r--include/net-snmp/agent/mib_modules.h23
-rw-r--r--include/net-snmp/agent/mode_end_call.h39
-rw-r--r--include/net-snmp/agent/multiplexer.h39
-rw-r--r--include/net-snmp/agent/net-snmp-agent-includes.h22
-rw-r--r--include/net-snmp/agent/null.h26
-rw-r--r--include/net-snmp/agent/object_monitor.h186
-rw-r--r--include/net-snmp/agent/old_api.h49
-rw-r--r--include/net-snmp/agent/read_only.h29
-rw-r--r--include/net-snmp/agent/row_merge.h38
-rw-r--r--include/net-snmp/agent/scalar.h36
-rw-r--r--include/net-snmp/agent/scalar_group.h36
-rw-r--r--include/net-snmp/agent/serialize.h24
-rw-r--r--include/net-snmp/agent/set_helper.h25
-rw-r--r--include/net-snmp/agent/snmp_agent.h322
-rw-r--r--include/net-snmp/agent/snmp_get_statistic.h20
-rw-r--r--include/net-snmp/agent/snmp_vars.h138
-rw-r--r--include/net-snmp/agent/stash_cache.h35
-rw-r--r--include/net-snmp/agent/stash_to_next.h24
-rw-r--r--include/net-snmp/agent/sysORTable.h62
-rw-r--r--include/net-snmp/agent/table.h200
-rw-r--r--include/net-snmp/agent/table_array.h158
-rw-r--r--include/net-snmp/agent/table_container.h108
-rw-r--r--include/net-snmp/agent/table_data.h124
-rw-r--r--include/net-snmp/agent/table_dataset.h196
-rw-r--r--include/net-snmp/agent/table_iterator.h165
-rw-r--r--include/net-snmp/agent/table_tdata.h147
-rw-r--r--include/net-snmp/agent/var_struct.h116
-rw-r--r--include/net-snmp/agent/watcher.h148
48 files changed, 4111 insertions, 0 deletions
diff --git a/include/net-snmp/agent/agent_callbacks.h b/include/net-snmp/agent/agent_callbacks.h
new file mode 100644
index 0000000..d8e8b47
--- /dev/null
+++ b/include/net-snmp/agent/agent_callbacks.h
@@ -0,0 +1,21 @@
+#ifndef AGENT_CALLBACKS_H
+#define AGENT_CALLBACKS_H
+
+#define SNMPD_CALLBACK_ACM_CHECK 0
+#define SNMPD_CALLBACK_REGISTER_OID 1
+#define SNMPD_CALLBACK_UNREGISTER_OID 2
+#define SNMPD_CALLBACK_REG_SYSOR 3
+#define SNMPD_CALLBACK_UNREG_SYSOR 4
+#define SNMPD_CALLBACK_ACM_CHECK_INITIAL 5
+#define SNMPD_CALLBACK_SEND_TRAP1 6
+#define SNMPD_CALLBACK_SEND_TRAP2 7
+#define SNMPD_CALLBACK_REGISTER_NOTIFICATIONS 8
+#define SNMPD_CALLBACK_PRE_UPDATE_CONFIG 9
+#define SNMPD_CALLBACK_INDEX_START 10
+#define SNMPD_CALLBACK_INDEX_STOP 11
+#define SNMPD_CALLBACK_ACM_CHECK_SUBTREE 12
+#define SNMPD_CALLBACK_REQ_REG_SYSOR 13
+#define SNMPD_CALLBACK_REQ_UNREG_SYSOR 14
+#define SNMPD_CALLBACK_REQ_UNREG_SYSOR_SESS 15
+
+#endif /* AGENT_CALLBACKS_H */
diff --git a/include/net-snmp/agent/agent_handler.h b/include/net-snmp/agent/agent_handler.h
new file mode 100644
index 0000000..ec930fe
--- /dev/null
+++ b/include/net-snmp/agent/agent_handler.h
@@ -0,0 +1,283 @@
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+#ifndef AGENT_HANDLER_H
+#define AGENT_HANDLER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @file agent_handler.h
+ *
+ * @addtogroup handler
+ *
+ * @{
+ */
+
+struct netsnmp_handler_registration_s;
+
+/*
+ * per mib handler flags.
+ * NOTE: Lower bits are reserved for the agent handler's use.
+ * The high 4 bits (31-28) are reserved for use by the handler.
+ */
+#define MIB_HANDLER_AUTO_NEXT 0x00000001
+#define MIB_HANDLER_AUTO_NEXT_OVERRIDE_ONCE 0x00000002
+#define MIB_HANDLER_INSTANCE 0x00000004
+
+#define MIB_HANDLER_CUSTOM4 0x10000000
+#define MIB_HANDLER_CUSTOM3 0x20000000
+#define MIB_HANDLER_CUSTOM2 0x40000000
+#define MIB_HANDLER_CUSTOM1 0x80000000
+
+
+/** @typedef struct netsnmp_mib_handler_s netsnmp_mib_handler
+ * Typedefs the netsnmp_mib_handler_s struct into netsnmp_mib_handler */
+
+/** @struct netsnmp_mib_handler_s
+ * the mib handler structure to be registered
+ */
+typedef struct netsnmp_mib_handler_s {
+ char *handler_name;
+ /** for handler's internal use */
+ void *myvoid;
+ /** for agent_handler's internal use */
+ int flags;
+
+ /** if you add more members, you probably also want to update */
+ /** _clone_handler in agent_handler.c. */
+
+ int (*access_method) (struct netsnmp_mib_handler_s *,
+ struct
+ netsnmp_handler_registration_s *,
+ struct
+ netsnmp_agent_request_info_s *,
+ struct netsnmp_request_info_s *);
+ /** data clone hook for myvoid
+ * deep copy the myvoid member - default is to copy the pointer
+ * This method is only called if myvoid != NULL
+ * myvoid is the current myvoid pointer.
+ * returns NULL on failure
+ */
+ void *(*data_clone)(void *myvoid);
+ /** data free hook for myvoid
+ * delete the myvoid member - default is to do nothing
+ * This method is only called if myvoid != NULL
+ */
+ void (*data_free)(void *myvoid); /**< data free hook for myvoid */
+
+ struct netsnmp_mib_handler_s *next;
+ struct netsnmp_mib_handler_s *prev;
+} netsnmp_mib_handler;
+
+/*
+ * per registration flags
+ */
+#define HANDLER_CAN_GETANDGETNEXT 0x01 /* must be able to do both */
+#define HANDLER_CAN_SET 0x02 /* implies create, too */
+#define HANDLER_CAN_GETBULK 0x04
+#define HANDLER_CAN_NOT_CREATE 0x08 /* auto set if ! CAN_SET */
+#define HANDLER_CAN_BABY_STEP 0x10
+#define HANDLER_CAN_STASH 0x20
+
+
+#define HANDLER_CAN_RONLY (HANDLER_CAN_GETANDGETNEXT)
+#define HANDLER_CAN_RWRITE (HANDLER_CAN_GETANDGETNEXT | HANDLER_CAN_SET)
+#define HANDLER_CAN_SET_ONLY (HANDLER_CAN_SET | HANDLER_CAN_NOT_CREATE)
+#define HANDLER_CAN_DEFAULT (HANDLER_CAN_RONLY | HANDLER_CAN_NOT_CREATE)
+
+/** @typedef struct netsnmp_handler_registration_s netsnmp_handler_registration
+ * Typedefs the netsnmp_handler_registration_s struct into netsnmp_handler_registration */
+
+/** @struct netsnmp_handler_registration_s
+ * Root registration info.
+ * The variables handlerName, contextName, and rootoid need to be allocated
+ * on the heap, when the registration structure is unregistered using
+ * unregister_mib_context() the code attempts to free them.
+ */
+typedef struct netsnmp_handler_registration_s {
+
+ /** for mrTable listings, and other uses */
+ char *handlerName;
+ /** NULL = default context */
+ char *contextName;
+
+ /**
+ * where are we registered at?
+ */
+ oid *rootoid;
+ size_t rootoid_len;
+
+ /**
+ * handler details
+ */
+ netsnmp_mib_handler *handler;
+ int modes;
+
+ /**
+ * more optional stuff
+ */
+ int priority;
+ int range_subid;
+ oid range_ubound;
+ int timeout;
+ int global_cacheid;
+
+ /**
+ * void ptr for registeree
+ */
+ void * my_reg_void;
+
+} netsnmp_handler_registration;
+
+/*
+ * function handler definitions
+ */
+
+typedef int (Netsnmp_Node_Handler) (netsnmp_mib_handler *handler,
+ /** pointer to registration struct */
+ netsnmp_handler_registration *reginfo,
+ /** pointer to current transaction */
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests);
+
+ typedef struct netsnmp_handler_args_s {
+ netsnmp_mib_handler *handler;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_agent_request_info *reqinfo;
+ netsnmp_request_info *requests;
+ } netsnmp_handler_args;
+
+ typedef struct netsnmp_delegated_cache_s {
+ int transaction_id;
+ netsnmp_mib_handler *handler;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_agent_request_info *reqinfo;
+ netsnmp_request_info *requests;
+ void *localinfo;
+ } netsnmp_delegated_cache;
+
+ /*
+ * handler API functions
+ */
+ void netsnmp_init_handler_conf(void);
+ int netsnmp_register_handler(netsnmp_handler_registration
+ *reginfo);
+ int netsnmp_unregister_handler(netsnmp_handler_registration
+ *reginfo);
+ int
+ netsnmp_register_handler_nocallback(netsnmp_handler_registration
+ *reginfo);
+ int netsnmp_inject_handler(netsnmp_handler_registration
+ *reginfo,
+ netsnmp_mib_handler *handler);
+ int
+ netsnmp_inject_handler_before(netsnmp_handler_registration *reginfo,
+ netsnmp_mib_handler *handler,
+ const char *before_what);
+ netsnmp_mib_handler
+ *netsnmp_find_handler_by_name(netsnmp_handler_registration
+ *reginfo, const char *name);
+ void
+ *netsnmp_find_handler_data_by_name(netsnmp_handler_registration
+ *reginfo, const char *name);
+ int netsnmp_call_handlers(netsnmp_handler_registration
+ *reginfo,
+ netsnmp_agent_request_info
+ *reqinfo,
+ netsnmp_request_info *requests);
+ int netsnmp_call_handler(netsnmp_mib_handler *next_handler,
+ netsnmp_handler_registration
+ *reginfo,
+ netsnmp_agent_request_info
+ *reqinfo,
+ netsnmp_request_info *requests);
+ int netsnmp_call_next_handler(netsnmp_mib_handler *current,
+ netsnmp_handler_registration
+ *reginfo,
+ netsnmp_agent_request_info
+ *reqinfo,
+ netsnmp_request_info
+ *requests);
+ int netsnmp_call_next_handler_one_request(netsnmp_mib_handler *current,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests);
+
+ netsnmp_mib_handler *netsnmp_create_handler(const char *name,
+ Netsnmp_Node_Handler *
+ handler_access_method);
+ netsnmp_handler_registration *
+ netsnmp_handler_registration_create(const char *name,
+ netsnmp_mib_handler *handler,
+ const oid * reg_oid, size_t reg_oid_len,
+ int modes);
+ netsnmp_handler_registration *
+ netsnmp_create_handler_registration(const char *name, Netsnmp_Node_Handler*
+ handler_access_method,
+ const oid *reg_oid, size_t reg_oid_len,
+ int modes);
+
+ netsnmp_delegated_cache
+ *netsnmp_create_delegated_cache(netsnmp_mib_handler *,
+ netsnmp_handler_registration *,
+ netsnmp_agent_request_info *,
+ netsnmp_request_info *, void *);
+ void netsnmp_free_delegated_cache(netsnmp_delegated_cache *dcache);
+ netsnmp_delegated_cache
+ *netsnmp_handler_check_cache(netsnmp_delegated_cache *dcache);
+ void netsnmp_register_handler_by_name(const char *,
+ netsnmp_mib_handler
+ *);
+
+ void netsnmp_clear_handler_list(void);
+
+ void
+ netsnmp_request_add_list_data(netsnmp_request_info *request,
+ netsnmp_data_list *node);
+ int netsnmp_request_remove_list_data(netsnmp_request_info *request,
+ const char *name);
+
+ int
+ netsnmp_request_remove_list_data(netsnmp_request_info *request,
+ const char *name);
+
+ void *netsnmp_request_get_list_data(netsnmp_request_info
+ *request,
+ const char *name);
+
+ void
+ netsnmp_free_request_data_set(netsnmp_request_info *request);
+
+ void
+ netsnmp_free_request_data_sets(netsnmp_request_info *request);
+
+ void netsnmp_handler_free(netsnmp_mib_handler *);
+ netsnmp_mib_handler *netsnmp_handler_dup(netsnmp_mib_handler *);
+ netsnmp_handler_registration
+ *netsnmp_handler_registration_dup(netsnmp_handler_registration *);
+ void
+ netsnmp_handler_registration_free(netsnmp_handler_registration *);
+
+#define REQUEST_IS_DELEGATED 1
+#define REQUEST_IS_NOT_DELEGATED 0
+ void
+ netsnmp_handler_mark_requests_as_delegated(netsnmp_request_info *,
+ int);
+ void *netsnmp_handler_get_parent_data(netsnmp_request_info *,
+ const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* AGENT_HANDLER_H */
+/** @} */
diff --git a/include/net-snmp/agent/agent_index.h b/include/net-snmp/agent/agent_index.h
new file mode 100644
index 0000000..49ee7fd
--- /dev/null
+++ b/include/net-snmp/agent/agent_index.h
@@ -0,0 +1,46 @@
+#ifndef AGENT_INDEX_H
+#define AGENT_INDEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ALLOCATE_THIS_INDEX 0x0
+#define ALLOCATE_ANY_INDEX 0x1
+#define ALLOCATE_NEW_INDEX 0x3
+ /*
+ * N.B: it's deliberate that NEW_INDEX & ANY_INDEX == ANY_INDEX
+ */
+
+#define ANY_INTEGER_INDEX -1
+#define ANY_STRING_INDEX NULL
+#define ANY_OID_INDEX NULL
+
+#define INDEX_ERR_GENERR -1
+#define INDEX_ERR_WRONG_TYPE -2
+#define INDEX_ERR_NOT_ALLOCATED -3
+#define INDEX_ERR_WRONG_SESSION -4
+
+char *register_string_index(oid *, size_t, char *);
+int register_int_index(oid *, size_t, int);
+netsnmp_variable_list *register_oid_index(oid *, size_t, oid *, size_t);
+netsnmp_variable_list *register_index(netsnmp_variable_list *, int,
+ netsnmp_session *);
+
+int unregister_string_index(oid *, size_t, char *);
+int unregister_int_index(oid *, size_t, int);
+int unregister_oid_index(oid *, size_t, oid *, size_t);
+
+int release_index(netsnmp_variable_list *);
+int remove_index(netsnmp_variable_list *, netsnmp_session *);
+void unregister_index_by_session(netsnmp_session *);
+int unregister_index(netsnmp_variable_list *, int,
+ netsnmp_session *);
+
+unsigned long count_indexes(oid * name, size_t namelen,
+ int include_unallocated);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* AGENT_INDEX_H */
diff --git a/include/net-snmp/agent/agent_read_config.h b/include/net-snmp/agent/agent_read_config.h
new file mode 100644
index 0000000..e6b3540
--- /dev/null
+++ b/include/net-snmp/agent/agent_read_config.h
@@ -0,0 +1,31 @@
+/*
+ * agent_read_config.h: reads configuration files for extensible sections.
+ *
+ */
+#ifndef _AGENT_READ_CONFIG_H
+#define _AGENT_READ_CONFIG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ void init_agent_read_config(const char *);
+ void update_config(void);
+ void snmpd_register_config_handler(const char *token,
+ void (*parser) (const
+ char *,
+ char *),
+ void (*releaser) (void),
+ const char *help);
+ void snmpd_register_const_config_handler(
+ const char *,
+ void (*parser) (const char *, const char *),
+ void (*releaser) (void),
+ const char *);
+ void snmpd_unregister_config_handler(const char *);
+ void snmpd_store_config(const char *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _AGENT_READ_CONFIG_H */
diff --git a/include/net-snmp/agent/agent_registry.h b/include/net-snmp/agent/agent_registry.h
new file mode 100644
index 0000000..6a907bf
--- /dev/null
+++ b/include/net-snmp/agent/agent_registry.h
@@ -0,0 +1,184 @@
+#ifndef AGENT_REGISTRY_H
+#define AGENT_REGISTRY_H
+
+/***********************************************************************/
+/*
+ * new version2 agent handler API structures
+ */
+/***********************************************************************/
+
+#include <net-snmp/agent/snmp_agent.h>
+#include <net-snmp/library/fd_event_manager.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***********************************************************************/
+ /*
+ * requests api definitions
+ */
+/***********************************************************************/
+
+ /*
+ * the structure of parameters passed to registered ACM modules
+ */
+struct view_parameters {
+ netsnmp_pdu *pdu;
+ oid *name;
+ size_t namelen;
+ int test;
+ int errorcode; /* Do not change unless you're
+ specifying an error, as it starts
+ in a success state. */
+ int check_subtree;
+};
+
+struct register_parameters {
+ oid *name;
+ size_t namelen;
+ int priority;
+ int range_subid;
+ oid range_ubound;
+ int timeout;
+ u_char flags;
+ const char *contextName;
+ netsnmp_session *session;
+ netsnmp_handler_registration *reginfo;
+};
+
+typedef struct subtree_context_cache_s {
+ const char *context_name;
+ struct netsnmp_subtree_s *first_subtree;
+ struct subtree_context_cache_s *next;
+} subtree_context_cache;
+
+
+
+void setup_tree (void);
+void shutdown_tree (void);
+
+
+netsnmp_subtree *netsnmp_subtree_find (const oid *, size_t,
+ netsnmp_subtree *,
+ const char *context_name);
+
+netsnmp_subtree *netsnmp_subtree_find_next(const oid *, size_t,
+ netsnmp_subtree *,
+ const char *context_name);
+
+netsnmp_subtree *netsnmp_subtree_find_prev(const oid *, size_t,
+ netsnmp_subtree *,
+ const char *context_name);
+
+netsnmp_subtree *netsnmp_subtree_find_first(const char *context_name);
+
+netsnmp_session *get_session_for_oid (const oid *, size_t,
+ const char *context_name);
+
+subtree_context_cache *get_top_context_cache(void);
+
+void netsnmp_set_lookup_cache_size(int newsize);
+int netsnmp_get_lookup_cache_size(void);
+
+#define MIB_REGISTERED_OK 0
+#define MIB_DUPLICATE_REGISTRATION -1
+#define MIB_REGISTRATION_FAILED -2
+#define MIB_UNREGISTERED_OK 0
+#define MIB_NO_SUCH_REGISTRATION -1
+#define MIB_UNREGISTRATION_FAILED -2
+#define DEFAULT_MIB_PRIORITY 127
+
+int register_mib (const char *, struct variable *,
+ size_t, size_t, const oid *,
+ size_t);
+
+int register_mib_priority (const char *, struct variable *,
+ size_t, size_t, const oid *, size_t,
+ int);
+
+int register_mib_range (const char *, struct variable *,
+ size_t, size_t, const oid *,
+ size_t, int, int, oid,
+ netsnmp_session *);
+
+int register_mib_context (const char *, struct variable *,
+ size_t, size_t, const oid *, size_t,
+ int, int, oid, netsnmp_session *,
+ const char *, int, int);
+
+int netsnmp_register_mib_table_row (const char *, struct variable *,
+ size_t, size_t, oid *,
+ size_t, int, int, netsnmp_session *,
+ const char *, int, int);
+
+int unregister_mib (oid *, size_t);
+
+int unregister_mib_priority (oid *, size_t, int);
+int unregister_mib_range (oid *, size_t, int, int, oid);
+int unregister_mib_context (oid *, size_t, int, int, oid,
+ const char *);
+void clear_context (void);
+void unregister_mibs_by_session (netsnmp_session *);
+int netsnmp_unregister_mib_table_row (oid *mibloc, size_t mibloclen,
+ int priority, int var_subid,
+ oid range_ubound,
+ const char *context);
+
+int compare_tree (const oid *, size_t,
+ const oid *, size_t);
+int in_a_view (oid *, size_t *,
+ netsnmp_pdu *, int);
+int check_access (netsnmp_pdu *pdu);
+int netsnmp_acm_check_subtree (netsnmp_pdu *, oid *, size_t);
+void register_mib_reattach (void);
+void register_mib_detach (void);
+
+/*
+ * REGISTER_MIB(): This macro simply loads register_mib with less pain:
+ *
+ * descr: A short description of the mib group being loaded.
+ * var: The variable structure to load.
+ * vartype: The variable structure used to define it (variable[2, 4, ...])
+ * theoid: An *initialized* *exact length* oid pointer.
+ * (sizeof(theoid) *must* return the number of elements!)
+ */
+
+#define REGISTER_MIB(descr, var, vartype, theoid) \
+ if (register_mib(descr, (struct variable *) var, sizeof(struct vartype), \
+ sizeof(var)/sizeof(struct vartype), \
+ theoid, sizeof(theoid)/sizeof(oid)) != MIB_REGISTERED_OK ) \
+ DEBUGMSGTL(("register_mib", "%s registration failed\n", descr));
+
+
+#define NUM_EXTERNAL_SIGS 32
+#define SIG_REGISTERED_OK 0
+#define SIG_REGISTRATION_FAILED -2
+#define SIG_UNREGISTERED_OK 0
+
+extern int external_signal_scheduled[NUM_EXTERNAL_SIGS];
+extern void (*external_signal_handler[NUM_EXTERNAL_SIGS])(int);
+
+int register_signal(int, void (*func)(int));
+int unregister_signal(int);
+
+
+
+/*
+ * internal API. Don't use this. Use netsnmp_register_handler instead
+ */
+
+struct netsnmp_handler_registration_s;
+
+int netsnmp_register_mib(const char *, struct variable *,
+ size_t, size_t, oid *, size_t,
+ int, int, oid, netsnmp_session *,
+ const char *, int, int,
+ struct netsnmp_handler_registration_s *,
+ int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* AGENT_REGISTRY_H */
diff --git a/include/net-snmp/agent/agent_sysORTable.h b/include/net-snmp/agent/agent_sysORTable.h
new file mode 100644
index 0000000..5626e4a
--- /dev/null
+++ b/include/net-snmp/agent/agent_sysORTable.h
@@ -0,0 +1,28 @@
+#ifndef AGENT_SYSORTABLE_H
+#define AGENT_SYSORTABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct sysORTable;
+
+extern void init_agent_sysORTable(void);
+extern void shutdown_agent_sysORTable(void);
+
+extern void netsnmp_sysORTable_foreach(void (*)(const struct sysORTable*,
+ void*),
+ void*);
+
+extern int register_sysORTable(oid *, size_t, const char *);
+extern int unregister_sysORTable(oid *, size_t);
+extern int register_sysORTable_sess(oid *, size_t, const char *,
+ netsnmp_session *);
+extern int unregister_sysORTable_sess(oid *, size_t, netsnmp_session *);
+extern void unregister_sysORTable_by_session(netsnmp_session *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* AGENT_SYSORTABLE_H */
diff --git a/include/net-snmp/agent/agent_trap.h b/include/net-snmp/agent/agent_trap.h
new file mode 100644
index 0000000..26e2223
--- /dev/null
+++ b/include/net-snmp/agent/agent_trap.h
@@ -0,0 +1,54 @@
+#ifndef AGENT_TRAP_H
+#define AGENT_TRAP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct agent_add_trap_args {
+ netsnmp_session *ss;
+ int confirm;
+};
+
+void init_traps(void);
+void send_easy_trap(int, int);
+void send_trap_pdu(netsnmp_pdu *);
+void send_v2trap(netsnmp_variable_list *);
+void send_v3trap(netsnmp_variable_list *vars, const char *context);
+void send_trap_vars(int, int, netsnmp_variable_list *);
+void send_trap_vars_with_context(int trap, int specific,
+ netsnmp_variable_list *vars,
+ const char *context);
+void send_enterprise_trap_vars(int trap, int specific,
+ const oid * enterprise,
+ int enterprise_length,
+ netsnmp_variable_list * vars);
+int netsnmp_send_traps(int trap, int specific,
+ const oid * enterprise, int enterprise_length,
+ netsnmp_variable_list * vars,
+ /* flags are currently unused */
+ const char * context, int flags);
+void snmpd_parse_config_authtrap(const char *, char *);
+void snmpd_parse_config_trapsink(const char *, char *);
+void snmpd_parse_config_trap2sink(const char *, char *);
+void snmpd_parse_config_informsink(const char *, char *);
+void snmpd_parse_config_trapsess(const char *, char *);
+void snmpd_free_trapsinks(void);
+void snmpd_parse_config_trapcommunity(const char *, char *);
+void snmpd_free_trapcommunity(void);
+void send_trap_to_sess(netsnmp_session * sess,
+ netsnmp_pdu *template_pdu);
+
+int create_trap_session(char *, u_short, char *, int, int);
+int add_trap_session(netsnmp_session *, int, int, int);
+int remove_trap_session(netsnmp_session *);
+
+void convert_v2_to_v1(netsnmp_variable_list *, netsnmp_pdu *);
+netsnmp_variable_list *convert_v1_to_v2(netsnmp_pdu *);
+netsnmp_pdu *convert_v2pdu_to_v1(netsnmp_pdu *);
+netsnmp_pdu *convert_v1pdu_to_v2(netsnmp_pdu *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* AGENT_TRAP_H */
diff --git a/include/net-snmp/agent/all_helpers.h b/include/net-snmp/agent/all_helpers.h
new file mode 100644
index 0000000..d0d5c22
--- /dev/null
+++ b/include/net-snmp/agent/all_helpers.h
@@ -0,0 +1,43 @@
+#ifndef ALL_HANDLERS_H
+#define ALL_HANDLERS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <net-snmp/agent/instance.h>
+#include <net-snmp/agent/baby_steps.h>
+#include <net-snmp/agent/scalar.h>
+#include <net-snmp/agent/scalar_group.h>
+#include <net-snmp/agent/watcher.h>
+#include <net-snmp/agent/multiplexer.h>
+#include <net-snmp/agent/null.h>
+#include <net-snmp/agent/debug_handler.h>
+#include <net-snmp/agent/cache_handler.h>
+#include <net-snmp/agent/old_api.h>
+#include <net-snmp/agent/read_only.h>
+#include <net-snmp/agent/row_merge.h>
+#include <net-snmp/agent/serialize.h>
+#include <net-snmp/agent/bulk_to_next.h>
+#include <net-snmp/agent/mode_end_call.h>
+/*
+ * #include <net-snmp/agent/set_helper.h>
+ */
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/table_data.h>
+#include <net-snmp/agent/table_dataset.h>
+#include <net-snmp/agent/table_tdata.h>
+#include <net-snmp/agent/table_iterator.h>
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/agent/table_array.h>
+
+#include <net-snmp/agent/mfd.h>
+#include <net-snmp/agent/snmp_get_statistic.h>
+
+
+void netsnmp_init_helpers(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* ALL_HANDLERS_H */
diff --git a/include/net-snmp/agent/auto_nlist.h b/include/net-snmp/agent/auto_nlist.h
new file mode 100644
index 0000000..21b6b8c
--- /dev/null
+++ b/include/net-snmp/agent/auto_nlist.h
@@ -0,0 +1,28 @@
+/*
+ * auto_nlist.h
+ */
+#ifndef AUTO_NLIST_H
+#define AUTO_NLIST_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(irix6) && defined(IRIX64)
+#define nlist nlist64
+#endif
+
+#ifdef NETSNMP_CAN_USE_NLIST
+int auto_nlist(const char *, char *, size_t);
+long auto_nlist_value(const char *);
+int KNLookup(struct nlist *, int, char *, size_t);
+#else
+int auto_nlist_noop(void);
+# define auto_nlist(x,y,z) auto_nlist_noop()
+# define auto_nlist_value(z) auto_nlist_noop()
+# define KNLookup(w,x,y,z) auto_nlist_noop()
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/net-snmp/agent/baby_steps.h b/include/net-snmp/agent/baby_steps.h
new file mode 100644
index 0000000..d256550
--- /dev/null
+++ b/include/net-snmp/agent/baby_steps.h
@@ -0,0 +1,117 @@
+/*
+ * $Id$
+ */
+#ifndef BABY_STEPS_H
+#define BABY_STEPS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <net-snmp/agent/agent_handler.h>
+
+ /*
+ * Flags for baby step modes
+ */
+#define BABY_STEP_NONE 0
+#define BABY_STEP_PRE_REQUEST (0x1 << 1)
+#define BABY_STEP_OBJECT_LOOKUP (0x1 << 2)
+#ifndef NETSNMP_NO_WRITE_SUPPORT
+#define BABY_STEP_CHECK_VALUE (0x1 << 3)
+#define BABY_STEP_ROW_CREATE (0x1 << 4)
+#define BABY_STEP_UNDO_SETUP (0x1 << 5)
+#define BABY_STEP_SET_VALUE (0x1 << 6)
+#define BABY_STEP_CHECK_CONSISTENCY (0x1 << 7)
+#define BABY_STEP_UNDO_SET (0x1 << 8)
+#define BABY_STEP_COMMIT (0x1 << 9)
+#define BABY_STEP_UNDO_COMMIT (0x1 << 10)
+#define BABY_STEP_IRREVERSIBLE_COMMIT (0x1 << 11)
+#define BABY_STEP_UNDO_CLEANUP (0x1 << 12)
+#endif /* NETSNMP_NO_WRITE_SUPPORT */
+#define BABY_STEP_POST_REQUEST (0x1 << 13)
+
+#define BABY_STEP_ALL (0xffffffff)
+
+
+#ifndef NETSNMP_NO_WRITE_SUPPORT
+#define BABY_STEP_CHECK_OBJECT BABY_STEP_CHECK_VALUE
+#define BABY_STEP_SET_VALUES BABY_STEP_SET_VALUE
+#define BABY_STEP_UNDO_SETS BABY_STEP_UNDO_SET
+#endif /* NETSNMP_NO_WRITE_SUPPORT */
+
+/** @name baby_steps
+ *
+ * This helper expands the original net-snmp set modes into the newer, finer
+ * grained modes.
+ *
+ * @{ */
+
+ typedef struct netsnmp_baby_steps_modes_s {
+ /** Number of handlers whose myvoid pointer points at this object. */
+ int refcnt;
+ u_int registered;
+ u_int completed;
+ } netsnmp_baby_steps_modes;
+
+void netsnmp_baby_steps_init(void);
+
+netsnmp_mib_handler *netsnmp_baby_steps_handler_get(u_long modes);
+
+/** @} */
+
+
+/** @name access_multiplexer
+ *
+ * This helper calls individual access methods based on the mode. All
+ * access methods share the same handler, and the same myvoid pointer.
+ * If you need individual myvoid pointers, check out the multiplexer
+ * handler (though it currently only works for traditional modes).
+ *
+ * @{ */
+
+/** @struct netsnmp_mib_handler_access_methods
+ * Defines the access methods to be called by the access_multiplexer helper
+ */
+typedef struct netsnmp_baby_steps_access_methods_s {
+
+ /*
+ * baby step modes
+ */
+ Netsnmp_Node_Handler *pre_request;
+ Netsnmp_Node_Handler *object_lookup;
+ Netsnmp_Node_Handler *get_values;
+#ifndef NETSNMP_NO_WRITE_SUPPORT
+ Netsnmp_Node_Handler *object_syntax_checks;
+ Netsnmp_Node_Handler *row_creation;
+ Netsnmp_Node_Handler *undo_setup;
+ Netsnmp_Node_Handler *set_values;
+ Netsnmp_Node_Handler *consistency_checks;
+ Netsnmp_Node_Handler *commit;
+ Netsnmp_Node_Handler *undo_sets;
+ Netsnmp_Node_Handler *undo_cleanup;
+ Netsnmp_Node_Handler *undo_commit;
+ Netsnmp_Node_Handler *irreversible_commit;
+#endif /* NETSNMP_NO_WRITE_SUPPORT */
+ Netsnmp_Node_Handler *post_request;
+
+ void *my_access_void;
+
+} netsnmp_baby_steps_access_methods;
+
+ netsnmp_mib_handler * netsnmp_baby_steps_access_multiplexer_get(
+ netsnmp_baby_steps_access_methods *);
+
+ int netsnmp_baby_step_mode2flag( u_int mode );
+
+/** @} */
+
+
+/** backwards compatability. don't use in new code */
+#define netsnmp_get_baby_steps_handler netsnmp_baby_steps_handler_get
+#define netsnmp_init_baby_steps_helper netsnmp_baby_steps_handler_init
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* baby_steps */
diff --git a/include/net-snmp/agent/bulk_to_next.h b/include/net-snmp/agent/bulk_to_next.h
new file mode 100644
index 0000000..b578da5
--- /dev/null
+++ b/include/net-snmp/agent/bulk_to_next.h
@@ -0,0 +1,28 @@
+/*
+ * bulk_to_next.h
+ */
+#ifndef BULK_TO_NEXT_H
+#define BULK_TO_NEXT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * The helper merely intercepts GETBULK requests and converts them to
+ * * GETNEXT reequests.
+ */
+
+
+netsnmp_mib_handler *netsnmp_get_bulk_to_next_handler(void);
+void netsnmp_init_bulk_to_next_helper(void);
+void netsnmp_bulk_to_next_fix_requests(netsnmp_request_info
+ *requests);
+
+Netsnmp_Node_Handler netsnmp_bulk_to_next_helper;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/net-snmp/agent/cache_handler.h b/include/net-snmp/agent/cache_handler.h
new file mode 100644
index 0000000..1e4751c
--- /dev/null
+++ b/include/net-snmp/agent/cache_handler.h
@@ -0,0 +1,130 @@
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright (C) 2007 Apple, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+#ifndef NETSNMP_CACHE_HANDLER_H
+#define NETSNMP_CACHE_HANDLER_H
+
+/*
+ * This caching helper provides a generalised (SNMP-manageable) caching
+ * mechanism. Individual SNMP table and scalar/scalar group MIB
+ * implementations can use data caching in a consistent manner, without
+ * needing to handle the generic caching details themselves.
+ */
+
+#include <net-snmp/library/tools.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CACHE_NAME "cache_info"
+
+ typedef struct netsnmp_cache_s netsnmp_cache;
+
+ typedef int (NetsnmpCacheLoad)(netsnmp_cache *, void*);
+ typedef void (NetsnmpCacheFree)(netsnmp_cache *, void*);
+
+ struct netsnmp_cache_s {
+ /** Number of handlers whose myvoid member points at this structure. */
+ int refcnt;
+ /*
+ * For operation of the data caches
+ */
+ int flags;
+ int enabled;
+ int valid;
+ char expired;
+ int timeout; /* Length of time the cache is valid (in s) */
+ marker_t timestampM; /* When the cache was last loaded */
+ u_long timer_id; /* periodic timer id */
+
+ NetsnmpCacheLoad *load_cache;
+ NetsnmpCacheFree *free_cache;
+
+ /*
+ * void pointer for the user that created the cache.
+ * You never know when it might not come in useful ....
+ */
+ void *magic;
+
+ /*
+ * hint from the cache helper. contains the standard
+ * handler arguments.
+ */
+ netsnmp_handler_args *cache_hint;
+
+ /*
+ * For SNMP-management of the data caches
+ */
+ netsnmp_cache *next, *prev;
+ oid *rootoid;
+ int rootoid_len;
+
+ };
+
+
+ void netsnmp_cache_reqinfo_insert(netsnmp_cache* cache,
+ netsnmp_agent_request_info * reqinfo,
+ const char *name);
+ netsnmp_cache *
+ netsnmp_cache_reqinfo_extract(netsnmp_agent_request_info * reqinfo,
+ const char *name);
+ netsnmp_cache* netsnmp_extract_cache_info(netsnmp_agent_request_info *);
+
+ int netsnmp_cache_check_and_reload(netsnmp_cache * cache);
+ int netsnmp_cache_check_expired(netsnmp_cache *cache);
+ int netsnmp_cache_is_valid( netsnmp_agent_request_info *,
+ const char *name);
+ /** for backwards compat */
+ int netsnmp_is_cache_valid( netsnmp_agent_request_info *);
+ netsnmp_mib_handler *netsnmp_get_cache_handler(int, NetsnmpCacheLoad *,
+ NetsnmpCacheFree *,
+ const oid*, int);
+ int netsnmp_register_cache_handler(netsnmp_handler_registration *reginfo,
+ int, NetsnmpCacheLoad *,
+ NetsnmpCacheFree *);
+
+ Netsnmp_Node_Handler netsnmp_cache_helper_handler;
+
+ netsnmp_cache *
+ netsnmp_cache_create(int timeout, NetsnmpCacheLoad * load_hook,
+ NetsnmpCacheFree * free_hook,
+ const oid * rootoid, int rootoid_len);
+ int netsnmp_cache_remove(netsnmp_cache *cache);
+ int netsnmp_cache_free(netsnmp_cache *cache);
+
+ netsnmp_mib_handler *
+ netsnmp_cache_handler_get(netsnmp_cache* cache);
+ void netsnmp_cache_handler_owns_cache(netsnmp_mib_handler *handler);
+
+ netsnmp_cache * netsnmp_cache_find_by_oid(const oid * rootoid,
+ int rootoid_len);
+
+ unsigned int netsnmp_cache_timer_start(netsnmp_cache *cache);
+ void netsnmp_cache_timer_stop(netsnmp_cache *cache);
+
+/*
+ * Flags affecting cache handler operation
+ */
+#define NETSNMP_CACHE_DONT_INVALIDATE_ON_SET 0x0001
+#define NETSNMP_CACHE_DONT_FREE_BEFORE_LOAD 0x0002
+#define NETSNMP_CACHE_DONT_FREE_EXPIRED 0x0004
+#define NETSNMP_CACHE_DONT_AUTO_RELEASE 0x0008
+#define NETSNMP_CACHE_PRELOAD 0x0010
+#define NETSNMP_CACHE_AUTO_RELOAD 0x0020
+#define NETSNMP_CACHE_RESET_TIMER_ON_USE 0x0040
+
+#define NETSNMP_CACHE_HINT_HANDLER_ARGS 0x1000
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* NETSNMP_CACHE_HANDLER_H */
diff --git a/include/net-snmp/agent/debug_handler.h b/include/net-snmp/agent/debug_handler.h
new file mode 100644
index 0000000..0d612db
--- /dev/null
+++ b/include/net-snmp/agent/debug_handler.h
@@ -0,0 +1,16 @@
+#ifndef DEBUG_HANDLER_H
+#define DEBUG_HANDLER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+netsnmp_mib_handler *netsnmp_get_debug_handler(void);
+void netsnmp_init_debug_helper(void);
+
+Netsnmp_Node_Handler netsnmp_debug_helper;
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* DEBUG_HANDLER_H */
diff --git a/include/net-snmp/agent/ds_agent.h b/include/net-snmp/agent/ds_agent.h
new file mode 100644
index 0000000..f6f639d
--- /dev/null
+++ b/include/net-snmp/agent/ds_agent.h
@@ -0,0 +1,74 @@
+#ifndef NETSNMP_DS_AGENT_H
+#define NETSNMP_DS_AGENT_H
+/*
+ * defines agent's default store registrations
+ */
+/*
+ * Note:
+ * If new ds_agent entries are added to this header file,
+ * then remember to run 'perl/agent/default_store/gen' to
+ * update the corresponding perl interface.
+ */
+
+/*
+ * booleans
+ */
+#define NETSNMP_DS_AGENT_VERBOSE 0 /* 1 if verbose output desired */
+#define NETSNMP_DS_AGENT_ROLE 1 /* 0 if master, 1 if client */
+#define NETSNMP_DS_AGENT_NO_ROOT_ACCESS 2 /* 1 if we can't get root access */
+#define NETSNMP_DS_AGENT_AGENTX_MASTER 3 /* 1 if AgentX desired */
+#define NETSNMP_DS_AGENT_QUIT_IMMEDIATELY 4 /* 1 to never start the agent */
+#define NETSNMP_DS_AGENT_DISABLE_PERL 5 /* 1 to never enable perl */
+#define NETSNMP_DS_AGENT_NO_CONNECTION_WARNINGS 6 /* 1 = !see !connect msgs */
+#define NETSNMP_DS_AGENT_LEAVE_PIDFILE 7 /* 1 = leave PID file on exit */
+#define NETSNMP_DS_AGENT_NO_CACHING 8 /* 1 = disable netsnmp_cache */
+#define NETSNMP_DS_AGENT_STRICT_DISMAN 9 /* 1 = "correct" object ordering */
+#define NETSNMP_DS_AGENT_DONT_RETAIN_NOTIFICATIONS 10 /* 1 = disable trap logging */
+#define NETSNMP_DS_AGENT_DONT_LOG_TCPWRAPPERS_CONNECTS 12 /* 1 = disable logging */
+#define NETSNMP_DS_APP_DONT_LOG NETSNMP_DS_AGENT_DONT_RETAIN_NOTIFICATIONS /* compat */
+#define NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES 13 /* 1 = don't store NFS entries in hrStorageTable */
+#define NETSNMP_DS_AGENT_REALSTORAGEUNITS 14 /* 1 = use real allocation units in hrStorageTable, 0 = recalculate it to fit 32bits */
+
+ /* Repeated from "apps/snmptrapd_ds.h" */
+#define NETSNMP_DS_APP_NUMERIC_IP 16
+#define NETSNMP_DS_APP_NO_AUTHORIZATION 17
+
+#define NETSNMP_DS_AGENT_DISKIO_NO_FD 18 /* 1 = don't report /dev/fd* entries in diskIOTable */
+#define NETSNMP_DS_AGENT_DISKIO_NO_LOOP 19 /* 1 = don't report /dev/loop* entries in diskIOTable */
+#define NETSNMP_DS_AGENT_DISKIO_NO_RAM 20 /* 1 = don't report /dev/ram* entries in diskIOTable */
+
+/* WARNING: The trap receiver also uses DS flags and must not conflict with these!
+ * If you define additional boolean entries, check in "apps/snmptrapd_ds.h" first */
+
+/*
+ * strings
+ */
+#define NETSNMP_DS_AGENT_PROGNAME 0 /* argv[0] */
+#define NETSNMP_DS_AGENT_X_SOCKET 1 /* AF_UNIX or ip:port socket addr */
+#define NETSNMP_DS_AGENT_PORTS 2 /* localhost:9161,tcp:localhost:9161... */
+#define NETSNMP_DS_AGENT_INTERNAL_SECNAME 3 /* used by disman/mteTriggerTable. */
+#define NETSNMP_DS_AGENT_PERL_INIT_FILE 4 /* used by embedded perl */
+#define NETSNMP_DS_SMUX_SOCKET 5 /* ip:port socket addr */
+#define NETSNMP_DS_NOTIF_LOG_CTX 6 /* "" | "snmptrapd" */
+#define NETSNMP_DS_AGENT_TRAP_ADDR 7 /* used as v1 trap agent address */
+
+/*
+ * integers
+ */
+#define NETSNMP_DS_AGENT_FLAGS 0 /* session.flags */
+#define NETSNMP_DS_AGENT_USERID 1
+#define NETSNMP_DS_AGENT_GROUPID 2
+#define NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL 3 /* ping master every SECONDS */
+#define NETSNMP_DS_AGENT_AGENTX_TIMEOUT 4
+#define NETSNMP_DS_AGENT_AGENTX_RETRIES 5
+#define NETSNMP_DS_AGENT_X_SOCK_PERM 6 /* permissions for the */
+#define NETSNMP_DS_AGENT_X_DIR_PERM 7 /* AgentX socket */
+#define NETSNMP_DS_AGENT_X_SOCK_USER 8 /* ownership for the */
+#define NETSNMP_DS_AGENT_X_SOCK_GROUP 9 /* AgentX socket */
+#define NETSNMP_DS_AGENT_CACHE_TIMEOUT 10 /* default cache timeout */
+#define NETSNMP_DS_AGENT_INTERNAL_VERSION 11 /* used by internal queries */
+#define NETSNMP_DS_AGENT_INTERNAL_SECLEVEL 12 /* used by internal queries */
+#define NETSNMP_DS_AGENT_MAX_GETBULKREPEATS 13 /* max getbulk repeats */
+#define NETSNMP_DS_AGENT_MAX_GETBULKRESPONSES 14 /* max getbulk respones */
+
+#endif
diff --git a/include/net-snmp/agent/hardware/cpu.h b/include/net-snmp/agent/hardware/cpu.h
new file mode 100644
index 0000000..f6e43e5
--- /dev/null
+++ b/include/net-snmp/agent/hardware/cpu.h
@@ -0,0 +1,68 @@
+typedef struct netsnmp_cpu_info_s netsnmp_cpu_info;
+extern int cpu_num;
+
+ /* For rolling averages */
+struct netsnmp_cpu_history {
+ unsigned long long user_hist;
+ unsigned long long sys_hist;
+ unsigned long long idle_hist;
+ unsigned long long nice_hist;
+ unsigned long long total_hist;
+
+ unsigned long long ctx_hist;
+ unsigned long long intr_hist;
+ unsigned long long swpi_hist;
+ unsigned long long swpo_hist;
+ unsigned long long pagei_hist;
+ unsigned long long pageo_hist;
+};
+
+struct netsnmp_cpu_info_s {
+ int idx;
+ /* For hrDeviceTable */
+ char name[ SNMP_MAXBUF ];
+ char descr[ SNMP_MAXBUF ];
+ int status;
+
+ /* For UCD cpu stats */
+ unsigned long long user_ticks;
+ unsigned long long nice_ticks;
+ unsigned long long sys_ticks;
+ unsigned long long idle_ticks;
+ unsigned long long wait_ticks;
+ unsigned long long kern_ticks;
+ unsigned long long intrpt_ticks;
+ unsigned long long sirq_ticks;
+ unsigned long long steal_ticks;
+ unsigned long long guest_ticks;
+ unsigned long long guestnice_ticks;
+
+ unsigned long long total_ticks;
+ unsigned long long sys2_ticks; /* For non-atomic system counts */
+
+ /* For paging-related UCD stats */
+ /* XXX - Do these belong elsewhere ?? */
+ /* XXX - Do Not Use - Subject to Change */
+ unsigned long long pageIn;
+ unsigned long long pageOut;
+ unsigned long long swapIn;
+ unsigned long long swapOut;
+ unsigned long long nInterrupts;
+ unsigned long long nCtxSwitches;
+
+ struct netsnmp_cpu_history *history;
+
+ netsnmp_cpu_info *next;
+};
+
+
+ /*
+ * Possibly not all needed ??
+ */
+netsnmp_cpu_info *netsnmp_cpu_get_first( void );
+netsnmp_cpu_info *netsnmp_cpu_get_next( netsnmp_cpu_info* );
+netsnmp_cpu_info *netsnmp_cpu_get_byIdx( int, int );
+netsnmp_cpu_info *netsnmp_cpu_get_byName( char*, int );
+
+netsnmp_cache *netsnmp_cpu_get_cache( void );
+int netsnmp_cpu_load( void );
diff --git a/include/net-snmp/agent/hardware/fsys.h b/include/net-snmp/agent/hardware/fsys.h
new file mode 100644
index 0000000..91e8e17
--- /dev/null
+++ b/include/net-snmp/agent/hardware/fsys.h
@@ -0,0 +1,109 @@
+typedef struct netsnmp_fsys_info_s netsnmp_fsys_info;
+
+#define _NETSNMP_FS_TYPE_SKIP_BIT 0x2000
+#define _NETSNMP_FS_TYPE_LOCAL 0x1000
+
+ /*
+ * Enumeration from HOST-RESOURCES-TYPES mib
+ */
+#define NETSNMP_FS_TYPE_OTHER 1
+#define NETSNMP_FS_TYPE_UNKNOWN 2
+#define NETSNMP_FS_TYPE_BERKELEY 3
+#define NETSNMP_FS_TYPE_SYSV 4
+#define NETSNMP_FS_TYPE_FAT 5
+#define NETSNMP_FS_TYPE_HPFS 6
+#define NETSNMP_FS_TYPE_HFS 7
+#define NETSNMP_FS_TYPE_MFS 8
+#define NETSNMP_FS_TYPE_NTFS 9
+#define NETSNMP_FS_TYPE_VNODE 10
+#define NETSNMP_FS_TYPE_JFS 11
+#define NETSNMP_FS_TYPE_ISO9660 12
+#define NETSNMP_FS_TYPE_ROCKRIDGE 13
+#define NETSNMP_FS_TYPE_NFS 14
+#define NETSNMP_FS_TYPE_NETWARE 15
+#define NETSNMP_FS_TYPE_AFS 16
+#define NETSNMP_FS_TYPE_DFS 17
+#define NETSNMP_FS_TYPE_APPLESHARE 18
+#define NETSNMP_FS_TYPE_RFS 19
+#define NETSNMP_FS_TYPE_DGCS 20
+#define NETSNMP_FS_TYPE_BOOTFS 21
+#define NETSNMP_FS_TYPE_FAT32 22
+#define NETSNMP_FS_TYPE_EXT2 23
+
+ /*
+ * Additional enumerationis - not listed in that MIB
+ */
+#define NETSNMP_FS_TYPE_IGNORE 1 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT
+
+#define NETSNMP_FS_TYPE_PROC 2 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT
+
+#define NETSNMP_FS_TYPE_DEVPTS 3 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT
+#define NETSNMP_FS_TYPE_SYSFS 4 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT
+#define NETSNMP_FS_TYPE_TMPFS 5 | _NETSNMP_FS_TYPE_LOCAL
+#define NETSNMP_FS_TYPE_USBFS 6 | _NETSNMP_FS_TYPE_LOCAL
+
+#define NETSNMP_FS_FLAG_ACTIVE 0x01
+#define NETSNMP_FS_FLAG_REMOTE 0x02
+#define NETSNMP_FS_FLAG_RONLY 0x04
+#define NETSNMP_FS_FLAG_BOOTABLE 0x08
+#define NETSNMP_FS_FLAG_REMOVE 0x10
+#define NETSNMP_FS_FLAG_UCD 0x20
+
+#define NETSNMP_FS_FIND_CREATE 1 /* or use one of the type values */
+#define NETSNMP_FS_FIND_EXIST 0
+
+struct netsnmp_fsys_info_s {
+ netsnmp_index idx;
+ /* int idx; */
+
+ char path[ SNMP_MAXPATH+1];
+ char device[SNMP_MAXPATH+1];
+ int type;
+
+ unsigned long long size;
+ unsigned long long used;
+ unsigned long long avail;
+ unsigned long long units;
+
+ /* artificially computed values, both 'size_32' and 'units_32' fit INT32 */
+ unsigned long size_32;
+ unsigned long used_32;
+ unsigned long avail_32;
+ unsigned long units_32;
+
+ unsigned long long inums_total;
+ unsigned long long inums_avail;
+
+ int minspace;
+ int minpercent;
+
+ long flags;
+
+ netsnmp_fsys_info *next;
+};
+
+
+ /*
+ * Possibly not all needed ??
+ */
+netsnmp_fsys_info *netsnmp_fsys_get_first( void );
+netsnmp_fsys_info *netsnmp_fsys_get_next( netsnmp_fsys_info* );
+netsnmp_fsys_info *netsnmp_fsys_get_byIdx( int, int );
+netsnmp_fsys_info *netsnmp_fsys_get_next_byIdx(int,int );
+
+netsnmp_fsys_info *netsnmp_fsys_by_device( char*, int );
+netsnmp_fsys_info *netsnmp_fsys_by_path( char*, int );
+
+netsnmp_cache *netsnmp_fsys_get_cache( void );
+int netsnmp_fsys_load( netsnmp_cache *cache, void *data );
+void netsnmp_fsys_free( netsnmp_cache *cache, void *data );
+
+int netsnmp_fsys_size( netsnmp_fsys_info* );
+int netsnmp_fsys_used( netsnmp_fsys_info* );
+int netsnmp_fsys_avail(netsnmp_fsys_info* );
+
+unsigned long long netsnmp_fsys_size_ull( netsnmp_fsys_info* );
+unsigned long long netsnmp_fsys_used_ull( netsnmp_fsys_info* );
+unsigned long long netsnmp_fsys_avail_ull(netsnmp_fsys_info* );
+
+void netsnmp_fsys_calculate32( netsnmp_fsys_info *f);
diff --git a/include/net-snmp/agent/hardware/memory.h b/include/net-snmp/agent/hardware/memory.h
new file mode 100644
index 0000000..aba0a6c
--- /dev/null
+++ b/include/net-snmp/agent/hardware/memory.h
@@ -0,0 +1,39 @@
+typedef struct netsnmp_memory_info_s netsnmp_memory_info;
+
+#define NETSNMP_MEM_TYPE_PHYSMEM 1
+#define NETSNMP_MEM_TYPE_USERMEM 2
+#define NETSNMP_MEM_TYPE_VIRTMEM 3
+#define NETSNMP_MEM_TYPE_STEXT 4
+#define NETSNMP_MEM_TYPE_RTEXT 5
+#define NETSNMP_MEM_TYPE_MBUF 6
+#define NETSNMP_MEM_TYPE_CACHED 7
+#define NETSNMP_MEM_TYPE_SHARED 8
+#define NETSNMP_MEM_TYPE_SHARED2 9
+#define NETSNMP_MEM_TYPE_SWAP 10
+ /* Leave space for individual swap devices */
+#define NETSNMP_MEM_TYPE_MAX 30
+
+struct netsnmp_memory_info_s {
+ int idx;
+ int type;
+ char *descr;
+
+ long units;
+ long size;
+ long free;
+ long other;
+
+ netsnmp_memory_info *next;
+};
+
+
+ /*
+ * Possibly not all needed ??
+ */
+netsnmp_memory_info *netsnmp_memory_get_first( int );
+netsnmp_memory_info *netsnmp_memory_get_next( netsnmp_memory_info*, int );
+netsnmp_memory_info *netsnmp_memory_get_byIdx( int, int );
+netsnmp_memory_info *netsnmp_memory_get_next_byIdx(int,int );
+
+netsnmp_cache *netsnmp_memory_get_cache( void );
+int netsnmp_memory_load( void );
diff --git a/include/net-snmp/agent/hardware/sensors.h b/include/net-snmp/agent/hardware/sensors.h
new file mode 100644
index 0000000..d59eca7
--- /dev/null
+++ b/include/net-snmp/agent/hardware/sensors.h
@@ -0,0 +1,48 @@
+/*
+ * Hardware Abstraction Layer - Sensors module
+ *
+ * Public interface
+ */
+
+#define NETSNMP_SENSOR_TYPE_OTHER 1
+#define NETSNMP_SENSOR_TYPE_VOLTAGE_AC 3
+#define NETSNMP_SENSOR_TYPE_VOLTAGE_DC 4
+#define NETSNMP_SENSOR_TYPE_CURRENT 5
+#define NETSNMP_SENSOR_TYPE_POWER 6
+#define NETSNMP_SENSOR_TYPE_FREQUENCY 7
+#define NETSNMP_SENSOR_TYPE_TEMPERATURE 8
+#define NETSNMP_SENSOR_TYPE_HUMIDITY 9
+#define NETSNMP_SENSOR_TYPE_RPM 10
+#define NETSNMP_SENSOR_TYPE_VOLUME 11
+#define NETSNMP_SENSOR_TYPE_BOOLEAN 12
+
+
+#define NETSNMP_SENSOR_FLAG_ACTIVE 0x01
+#define NETSNMP_SENSOR_FLAG_NAVAIL 0x02
+#define NETSNMP_SENSOR_FLAG_BROKEN 0x04
+#define NETSNMP_SENSOR_FLAG_DISABLE 0x08
+
+#define NETSNMP_SENSOR_MASK_STATUS 0x06 /* NAVAIL|BROKEN */
+
+
+#define NETSNMP_SENSOR_FIND_CREATE 1 /* or use one of the sensor type values */
+#define NETSNMP_SENSOR_FIND_EXIST 0
+
+typedef struct netsnmp_sensor_info_s netsnmp_sensor_info;
+struct netsnmp_sensor_info_s {
+
+ netsnmp_index idx;
+ /* int idx; */
+ char name[256];
+
+ int type;
+ float value;
+ char descr[256];
+ long flags;
+};
+
+netsnmp_container *get_sensor_container( void );
+netsnmp_cache *get_sensor_cache( void );
+netsnmp_sensor_info *sensor_by_name( const char *, int );
+NetsnmpCacheLoad netsnmp_sensor_load;
+NetsnmpCacheFree netsnmp_sensor_free;
diff --git a/include/net-snmp/agent/instance.h b/include/net-snmp/agent/instance.h
new file mode 100644
index 0000000..82f2edd
--- /dev/null
+++ b/include/net-snmp/agent/instance.h
@@ -0,0 +1,145 @@
+/*
+ * instance.h
+ */
+#ifndef NETSNMP_INSTANCE_H
+#define NETSNMP_INSTANCE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The instance helper is designed to simplify the task of adding simple
+ * * instances to the mib tree.
+ */
+
+/*
+ * GETNEXTs are auto-converted to a GET.
+ * * non-valid GETs are dropped.
+ * * The client can assume that if you're called for a GET, it shouldn't
+ * * have to check the oid at all. Just answer.
+ */
+
+int
+netsnmp_register_instance(netsnmp_handler_registration * reginfo);
+
+int
+netsnmp_register_read_only_instance(netsnmp_handler_registration *reginfo);
+
+#define INSTANCE_HANDLER_NAME "instance"
+
+netsnmp_mib_handler *netsnmp_get_instance_handler(void);
+
+int
+netsnmp_register_read_only_ulong_instance(const char * name,
+ const oid * reg_oid,
+ size_t reg_oid_len,
+ u_long * it,
+ Netsnmp_Node_Handler * subhandler);
+int
+netsnmp_register_ulong_instance(const char * name,
+ const oid * reg_oid,
+ size_t reg_oid_len,
+ u_long * it,
+ Netsnmp_Node_Handler * subhandler);
+int
+netsnmp_register_read_only_counter32_instance(const char *name,
+ const oid * reg_oid,
+ size_t reg_oid_len,
+ u_long * it,
+ Netsnmp_Node_Handler *subhandler);
+int
+netsnmp_register_read_only_long_instance(const char *name,
+ const oid * reg_oid,
+ size_t reg_oid_len,
+ long *it,
+ Netsnmp_Node_Handler * subhandler);
+int
+netsnmp_register_long_instance(const char *name,
+ const oid * reg_oid,
+ size_t reg_oid_len,
+ long *it,
+ Netsnmp_Node_Handler * subhandler);
+
+int
+netsnmp_register_read_only_int_instance(const char *name,
+ const oid * reg_oid,
+ size_t reg_oid_len, int *it,
+ Netsnmp_Node_Handler * subhandler);
+
+int
+netsnmp_register_int_instance(const char *name,
+ const oid * reg_oid,
+ size_t reg_oid_len, int *it,
+ Netsnmp_Node_Handler * subhandler);
+
+/* identical functions that register a in a particular context */
+int
+netsnmp_register_read_only_ulong_instance_context(const char *name,
+ const oid * reg_oid,
+ size_t reg_oid_len,
+ u_long * it,
+ Netsnmp_Node_Handler
+ * subhandler,
+ const char *contextName);
+int
+netsnmp_register_ulong_instance_context(const char *name,
+ const oid * reg_oid,
+ size_t reg_oid_len,
+ u_long * it,
+ Netsnmp_Node_Handler * subhandler,
+ const char *contextName);
+int
+netsnmp_register_read_only_counter32_instance_context(const char *name,
+ const oid * reg_oid,
+ size_t reg_oid_len,
+ u_long * it,
+ Netsnmp_Node_Handler
+ * subhandler,
+ const char *contextName);
+int
+netsnmp_register_read_only_long_instance_context(const char *name,
+ const oid * reg_oid,
+ size_t reg_oid_len,
+ long *it,
+ Netsnmp_Node_Handler
+ * subhandler,
+ const char *contextName);
+int
+netsnmp_register_long_instance_context(const char *name,
+ const oid * reg_oid,
+ size_t reg_oid_len,
+ long *it,
+ Netsnmp_Node_Handler * subhandler,
+ const char *contextName);
+
+int
+netsnmp_register_read_only_int_instance_context(const char *name,
+ const oid * reg_oid,
+ size_t reg_oid_len, int *it,
+ Netsnmp_Node_Handler *
+ subhandler,
+ const char *contextName);
+
+int
+netsnmp_register_int_instance_context(const char *name,
+ const oid * reg_oid,
+ size_t reg_oid_len, int *it,
+ Netsnmp_Node_Handler * subhandler,
+ const char *contextName);
+
+int
+netsnmp_register_num_file_instance(const char *name,
+ const oid * reg_oid, size_t reg_oid_len,
+ const char *file_name, int asn_type, int mode,
+ Netsnmp_Node_Handler * subhandler,
+ const char *contextName);
+
+Netsnmp_Node_Handler netsnmp_instance_helper_handler;
+Netsnmp_Node_Handler netsnmp_instance_num_file_handler;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /** NETSNMP_INSTANCE_H */
diff --git a/include/net-snmp/agent/mfd.h b/include/net-snmp/agent/mfd.h
new file mode 100644
index 0000000..15d0d91
--- /dev/null
+++ b/include/net-snmp/agent/mfd.h
@@ -0,0 +1,84 @@
+/*
+ * MIBs For Dummies header
+ *
+ * $Id$
+ */
+#ifndef NETSNMP_MFD_H
+#define NETSNMP_MFD_H
+
+/***********************************************************************
+ *
+ * return codes
+ *
+ **********************************************************************/
+
+/*----------------------------------------------------------------------
+ * general success/failure
+ */
+#define MFD_SUCCESS SNMP_ERR_NOERROR
+#define MFD_ERROR SNMP_ERR_GENERR
+
+/*
+ * object not currently available
+ */
+#define MFD_SKIP SNMP_NOSUCHINSTANCE
+
+/*
+ * no more data in table (get-next)
+ */
+#define MFD_END_OF_DATA SNMP_ENDOFMIBVIEW
+
+/*----------------------------------------------------------------------
+ * set processing errors
+ */
+/*
+ * row creation errors
+ */
+#define MFD_CANNOT_CREATE_NOW SNMP_ERR_INCONSISTENTNAME
+#define MFD_CANNOT_CREATE_EVER SNMP_ERR_NOCREATION
+
+/*
+ * not writable or resource unavailable
+ */
+#define MFD_NOT_WRITABLE SNMP_ERR_NOTWRITABLE
+#define MFD_RESOURCE_UNAVAILABLE SNMP_ERR_RESOURCEUNAVAILABLE
+
+/*
+ * new value errors
+ */
+#define MFD_NOT_VALID_NOW SNMP_ERR_INCONSISTENTVALUE
+#define MFD_NOT_VALID_EVER SNMP_ERR_WRONGVALUE
+
+
+/***********************************************************************
+ *
+ * rowreq flags
+ *
+ **********************************************************************/
+
+/*----------------------------------------------------------------------
+ * 8 flags resevered for the user
+ */
+#define MFD_ROW_FLAG_USER_1 0x00000001 /* user flag 1 */
+#define MFD_ROW_FLAG_USER_2 0x00000002 /* user flag 2 */
+#define MFD_ROW_FLAG_USER_3 0x00000004 /* user flag 3 */
+#define MFD_ROW_FLAG_USER_4 0x00000008 /* user flag 4 */
+#define MFD_ROW_FLAG_USER_5 0x00000010 /* user flag 5 */
+#define MFD_ROW_FLAG_USER_6 0x00000020 /* user flag 6 */
+#define MFD_ROW_FLAG_USER_7 0x00000040 /* user flag 7 */
+#define MFD_ROW_FLAG_USER_8 0x00000080 /* user flag 8 */
+#define MFD_ROW_FLAG_USER_MASK 0x000000ff /* user flag mask */
+
+/*----------------------------------------------------------------------
+ * MFD flags
+ *
+ * grow left to right, in case we want to add more user flags later
+ */
+#define MFD_ROW_MASK 0xffffff00 /* mask to clear user flags */
+#define MFD_ROW_CREATED 0x80000000 /* newly created row */
+#define MFD_ROW_DATA_FROM_USER 0x40000000 /* we didn't allocate data */
+#define MFD_ROW_DELETED 0x20000000 /* deleted row */
+#define MFD_ROW_DIRTY 0x10000000 /* changed row */
+
+
+#endif /* NETSNMP_MFD_H */
diff --git a/include/net-snmp/agent/mib_modules.h b/include/net-snmp/agent/mib_modules.h
new file mode 100644
index 0000000..7003a11
--- /dev/null
+++ b/include/net-snmp/agent/mib_modules.h
@@ -0,0 +1,23 @@
+#ifndef MIB_MODULES_H
+#define MIB_MODULES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define DO_INITIALIZE 1
+#define DONT_INITIALIZE 0
+
+struct module_init_list {
+ char *module_name;
+ struct module_init_list *next;
+};
+
+void add_to_init_list(char *module_list);
+int should_init(const char *module_name);
+void init_mib_modules(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/net-snmp/agent/mode_end_call.h b/include/net-snmp/agent/mode_end_call.h
new file mode 100644
index 0000000..eb56d0a
--- /dev/null
+++ b/include/net-snmp/agent/mode_end_call.h
@@ -0,0 +1,39 @@
+/*
+ * mode_end_call.h
+ */
+#ifndef MODE_END_CALL_H
+#define MODE_END_CALL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define NETSNMP_MODE_END_ALL_MODES -999
+
+typedef struct netsnmp_mode_handler_list_s {
+ struct netsnmp_mode_handler_list_s *next;
+ int mode;
+ netsnmp_mib_handler *callback_handler;
+} netsnmp_mode_handler_list;
+
+/*
+ * The helper calls another handler after each mode has been
+ * processed.
+ */
+
+/* public functions */
+netsnmp_mib_handler *
+netsnmp_get_mode_end_call_handler(netsnmp_mode_handler_list *endlist);
+
+netsnmp_mode_handler_list *
+netsnmp_mode_end_call_add_mode_callback(netsnmp_mode_handler_list *endlist,
+ int mode,
+ netsnmp_mib_handler *callbackh);
+
+/* internal */
+Netsnmp_Node_Handler netsnmp_mode_end_call_helper;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/net-snmp/agent/multiplexer.h b/include/net-snmp/agent/multiplexer.h
new file mode 100644
index 0000000..2bbb7b1
--- /dev/null
+++ b/include/net-snmp/agent/multiplexer.h
@@ -0,0 +1,39 @@
+#ifndef NETSNMP_MULTIPLEXER_H
+#define NETSNMP_MULTIPLEXER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The multiplexer helper
+ */
+
+/** @name multiplexer
+ * @{ */
+
+/** @struct netsnmp_mib_handler_methods
+ * Defines the subhandlers to be called by the multiplexer helper
+ */
+typedef struct netsnmp_mib_handler_methods_s {
+ /** called when a GET request is received */
+ netsnmp_mib_handler *get_handler;
+ /** called when a GETNEXT request is received */
+ netsnmp_mib_handler *getnext_handler;
+ /** called when a GETBULK request is received */
+ netsnmp_mib_handler *getbulk_handler;
+ /** called when a SET request is received */
+ netsnmp_mib_handler *set_handler;
+} netsnmp_mib_handler_methods;
+
+/** @} */
+
+netsnmp_mib_handler
+ *netsnmp_get_multiplexer_handler(netsnmp_mib_handler_methods *);
+
+Netsnmp_Node_Handler netsnmp_multiplexer_helper_handler;
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* NETSNMP_MULTIPLEXER_H */
diff --git a/include/net-snmp/agent/net-snmp-agent-includes.h b/include/net-snmp/agent/net-snmp-agent-includes.h
new file mode 100644
index 0000000..925349e
--- /dev/null
+++ b/include/net-snmp/agent/net-snmp-agent-includes.h
@@ -0,0 +1,22 @@
+/*
+ * A simple helpful wrapper to include lots of agent specific include
+ * * files for people wanting to embed and snmp agent into an external
+ * * application
+ */
+#ifndef NET_SNMP_AGENT_INCLUDES_H
+#define NET_SNMP_AGENT_INCLUDES_H
+
+#include <net-snmp/agent/mib_module_config.h>
+#include <net-snmp/agent/agent_module_config.h>
+
+#include <net-snmp/agent/snmp_agent.h>
+#include <net-snmp/agent/snmp_vars.h>
+#include <net-snmp/agent/ds_agent.h>
+#include <net-snmp/agent/agent_handler.h>
+#include <net-snmp/agent/agent_read_config.h>
+#include <net-snmp/agent/agent_trap.h>
+#include <net-snmp/agent/agent_handler.h>
+#include <net-snmp/agent/all_helpers.h>
+#include <net-snmp/agent/var_struct.h>
+
+#endif /* NET_SNMP_AGENT_INCLUDES_H */
diff --git a/include/net-snmp/agent/null.h b/include/net-snmp/agent/null.h
new file mode 100644
index 0000000..f24a0b4
--- /dev/null
+++ b/include/net-snmp/agent/null.h
@@ -0,0 +1,26 @@
+#ifndef AGENT_NULL_H
+#define AGENT_NULL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * null.h
+ */
+
+/*
+ * literally does nothing and is used as a final handler for
+ * "do-nothing" nodes that must exist solely for mib tree storage
+ * usage..
+ */
+
+int netsnmp_register_null(oid *, size_t);
+int netsnmp_register_null_context(oid *, size_t, const char *contextName);
+
+Netsnmp_Node_Handler netsnmp_null_handler;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/net-snmp/agent/object_monitor.h b/include/net-snmp/agent/object_monitor.h
new file mode 100644
index 0000000..8ac3eca
--- /dev/null
+++ b/include/net-snmp/agent/object_monitor.h
@@ -0,0 +1,186 @@
+/**************************************************************************
+ * object_monitor.h
+ *
+ * Contributed by: Robert Story <rstory@freesnmp.com>
+ *
+ * $Id$
+ *
+ * functions and data structures for cooperating code to monitor objects.
+ *
+ * WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
+ * WARNING! WARNING!
+ * WARNING! WARNING!
+ * WARNING! This code is under active development WARNING!
+ * WARNING! and is subject to change at any time. WARNING!
+ * WARNING! WARNING!
+ * WARNING! WARNING!
+ * WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
+ */
+#ifndef OBJECT_MONITOR_H
+#define OBJECT_MONITOR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * notification types
+ */
+ enum {
+ /*
+ * cooperative notification from the object being watched
+ */
+ NOTIFICATION_COOPERATIVE = 1,
+ /*
+ * notification that an object has been set vi SNMP-SET
+ */
+ NOTIFICATION_SET_REQUEST,
+ /*
+ * end of current notification types
+ */
+ NOTIFICATION_END
+ };
+
+ /*
+ * COOPERATIVE event types
+ */
+ enum {
+ EVENT_ROW_ADD = 1,
+ EVENT_ROW_MOD,
+ EVENT_ROW_DEL,
+ EVENT_COL_MOD,
+ EVENT_OBJ_MOD,
+ EVENT_END
+ };
+
+ /*
+ * data structures
+ */
+
+
+ /**
+ * callback header
+ */
+ typedef struct netsnmp_monitor_callback_header_s {
+
+ /** callback type */
+ unsigned int event;
+
+ /** registered oid */
+ netsnmp_index monitored_object;
+
+ /** priority */
+ int priority;
+
+ /** pointer given by watcher at registration */
+ void *watcher_data;
+
+ /** pointer passed from the monitored object */
+ void *object_info;
+
+ /** DO NOT USE, INTERNAL USE ONLY */
+ struct netsnmp_monitor_callback_header_s *private;
+ int refs;
+
+
+ } netsnmp_monitor_callback_header;
+
+ /*
+ *
+ */
+ typedef struct netsnmp_monitor_callback_set_request_s {
+
+ /** header */
+ netsnmp_monitor_callback_header hdr;
+
+ /** handler that registered to handle this object */
+ netsnmp_mib_handler *handler;
+
+ /** pdu containing the set request */
+ netsnmp_pdu *pdu;
+
+ /** the set request */
+ netsnmp_request_info *request;
+
+ } netsnmp_monitor_set_request_data;
+
+ /*
+ *
+ */
+ typedef struct netsnmp_monitor_callback_cooperative_s {
+
+ /** header */
+ netsnmp_monitor_callback_header hdr;
+
+ } netsnmp_monitor_callback_cooperative;
+
+
+
+ typedef void
+ (netsnmp_object_monitor_callback) (netsnmp_monitor_callback_header
+ *);
+
+
+
+
+ /**********************************************************************
+ * Registration function prototypes
+ */
+
+ /*
+ * Register a callback for the specified object.
+ */
+ int netsnmp_monitor_register(oid * object, size_t oid_len,
+ int priority,
+ unsigned int events,
+ void *watcher_data,
+ netsnmp_object_monitor_callback
+ * cb);
+
+ /*
+ * Unregister a callback for the specified object.
+ */
+ int netsnmp_monitor_unregister(oid * object,
+ size_t oid_len,
+ int priority,
+ void *watcher_data,
+ netsnmp_object_monitor_callback
+ * cb);
+
+ /*
+ * check to see if a registration exists for an object/event combination
+ */
+ int netsnmp_monitor_check_registered(int event, oid * oid,
+ int oid_len);
+
+
+ /**********************************************************************
+ * function prototypes
+ */
+
+ /*
+ * Notifies the object monitor of an event.
+ */
+ void netsnmp_notify_monitor(netsnmp_monitor_callback_header
+ * cbh);
+
+
+
+
+ /**********************************************************************
+ * function prototypes
+ */
+
+ /*
+ * Notifies the object monitor of a cooperative event.
+ */
+ void netsnmp_notify_cooperative(int event, oid * object,
+ size_t len, char oid_steal,
+ void *object_info);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /** OBJECT_MONITOR_H */
diff --git a/include/net-snmp/agent/old_api.h b/include/net-snmp/agent/old_api.h
new file mode 100644
index 0000000..1ae171c
--- /dev/null
+++ b/include/net-snmp/agent/old_api.h
@@ -0,0 +1,49 @@
+#ifndef OLD_API_H
+#define OLD_API_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define OLD_API_NAME "old_api"
+
+typedef struct netsnmp_old_api_info_s {
+ struct variable *var;
+ size_t varsize;
+ size_t numvars;
+
+ /*
+ * old stuff
+ */
+ netsnmp_session *ss;
+ int flags;
+} netsnmp_old_api_info;
+
+typedef struct old_opi_cache_s {
+ u_char *data;
+ WriteMethod *write_method;
+} netsnmp_old_api_cache;
+
+int netsnmp_register_old_api(const char *moduleName,
+ struct variable *var,
+ size_t varsize,
+ size_t numvars,
+ const oid * mibloc,
+ size_t mibloclen,
+ int priority,
+ int range_subid,
+ oid range_ubound,
+ netsnmp_session * ss,
+ const char *context,
+ int timeout, int flags);
+Netsnmp_Node_Handler netsnmp_old_api_helper;
+
+/*
+ * really shouldn't be used
+ */
+netsnmp_agent_session *netsnmp_get_current_agent_session(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* OLD_API_H */
diff --git a/include/net-snmp/agent/read_only.h b/include/net-snmp/agent/read_only.h
new file mode 100644
index 0000000..41635b0
--- /dev/null
+++ b/include/net-snmp/agent/read_only.h
@@ -0,0 +1,29 @@
+#ifndef READ_ONLY_H
+#define READ_ONLY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * read_only.h
+ */
+
+/*
+ * The helper merely intercepts SET requests and handles them early on
+ * making everything read-only (no SETs are actually permitted).
+ * Useful as a helper to handlers that are implementing MIBs with no
+ * SET support.
+ */
+
+
+netsnmp_mib_handler *netsnmp_get_read_only_handler(void);
+void netsnmp_init_read_only_helper(void);
+
+Netsnmp_Node_Handler netsnmp_read_only_helper;
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/net-snmp/agent/row_merge.h b/include/net-snmp/agent/row_merge.h
new file mode 100644
index 0000000..3e98957
--- /dev/null
+++ b/include/net-snmp/agent/row_merge.h
@@ -0,0 +1,38 @@
+#ifndef ROW_MERGE_H
+#define ROW_MERGE_H
+
+/*
+ * This row_merge helper splits a whole bunch of requests into chunks
+ * based on the row index that they refer to, and passes all requests
+ * for a given row to the lower handlers.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ typedef struct netsnmp_row_merge_status_x {
+ char count; /* number of requests */
+ char rows; /* number of rows (unique indexes) */
+ char current; /* current row number */
+ char reserved; /* reserver for future use */
+
+ netsnmp_request_info **saved_requests; /* internal use */
+ char *saved_status; /* internal use */
+ } netsnmp_row_merge_status;
+
+ netsnmp_mib_handler *netsnmp_get_row_merge_handler(int);
+ int netsnmp_register_row_merge(netsnmp_handler_registration *reginfo);
+ void netsnmp_init_row_merge(void);
+
+ int netsnmp_row_merge_status_first(netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo);
+ int netsnmp_row_merge_status_last(netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo);
+
+ Netsnmp_Node_Handler netsnmp_row_merge_helper_handler;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/net-snmp/agent/scalar.h b/include/net-snmp/agent/scalar.h
new file mode 100644
index 0000000..9af92cb
--- /dev/null
+++ b/include/net-snmp/agent/scalar.h
@@ -0,0 +1,36 @@
+/*
+ * scalar.h
+ */
+#ifndef NETSNMP_SCALAR_H
+#define NETSNMP_SCALAR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The scalar helper is designed to simplify the task of adding simple
+ * scalar objects to the mib tree.
+ */
+
+/*
+ * GETNEXTs are auto-converted to a GET.
+ * * non-valid GETs are dropped.
+ * * The client can assume that if you're called for a GET, it shouldn't
+ * * have to check the oid at all. Just answer.
+ */
+
+int netsnmp_register_scalar(netsnmp_handler_registration *reginfo);
+int netsnmp_register_read_only_scalar(netsnmp_handler_registration *reginfo);
+
+#define SCALAR_HANDLER_NAME "scalar"
+
+netsnmp_mib_handler *netsnmp_get_scalar_handler(void);
+
+Netsnmp_Node_Handler netsnmp_scalar_helper_handler;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /** NETSNMP_SCALAR_H */
diff --git a/include/net-snmp/agent/scalar_group.h b/include/net-snmp/agent/scalar_group.h
new file mode 100644
index 0000000..f421337
--- /dev/null
+++ b/include/net-snmp/agent/scalar_group.h
@@ -0,0 +1,36 @@
+/*
+ * scalar.h
+ */
+#ifndef NETSNMP_SCALAR_GROUP_H
+#define NETSNMP_SCALAR_GROUP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The scalar group helper is designed to implement a group of
+ * scalar objects all in one go, making use of the scalar and
+ * instance helpers.
+ *
+ * GETNEXTs are auto-converted to a GET. Non-valid GETs are dropped.
+ * The client-provided handler just needs to check the OID name to
+ * see which object is being requested, but can otherwise assume that
+ * things are fine.
+ */
+
+typedef struct netsnmp_scalar_group_s {
+ oid lbound; /* XXX - or do we need a more flexible arrangement? */
+ oid ubound;
+} netsnmp_scalar_group;
+
+int netsnmp_register_scalar_group(netsnmp_handler_registration *reginfo,
+ oid first, oid last);
+netsnmp_mib_handler *netsnmp_get_scalar_group_handler(oid first, oid last);
+Netsnmp_Node_Handler netsnmp_scalar_group_helper_handler;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /** NETSNMP_SCALAR_GROUP_H */
diff --git a/include/net-snmp/agent/serialize.h b/include/net-snmp/agent/serialize.h
new file mode 100644
index 0000000..08b38c1
--- /dev/null
+++ b/include/net-snmp/agent/serialize.h
@@ -0,0 +1,24 @@
+#ifndef SERIALIZE_H
+#define SERIALIZE_H
+
+/*
+ * The serialized helper merely calls its clients multiple times for a
+ * * given request set, so they don't have to loop through the requests
+ * * themselves.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ netsnmp_mib_handler *netsnmp_get_serialize_handler(void);
+ int netsnmp_register_serialize(netsnmp_handler_registration
+ *reginfo);
+ void netsnmp_init_serialize(void);
+
+ Netsnmp_Node_Handler netsnmp_serialize_helper_handler;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/net-snmp/agent/set_helper.h b/include/net-snmp/agent/set_helper.h
new file mode 100644
index 0000000..81d887c
--- /dev/null
+++ b/include/net-snmp/agent/set_helper.h
@@ -0,0 +1,25 @@
+#ifndef SET_HELPER_H
+#define SET_HELPER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct netsnmp_set_info_s {
+ int action;
+ void *stateRef;
+
+ /*
+ * don't use yet:
+ */
+ void **oldData;
+ int setCleanupFlags; /* XXX: client sets this to: */
+#define AUTO_FREE_STATEREF 0x01 /* calls free(stateRef) */
+#define AUTO_FREE_OLDDATA 0x02 /* calls free(*oldData) */
+#define AUTO_UNDO 0x04 /* ... */
+} netsnmp_set_info;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/net-snmp/agent/snmp_agent.h b/include/net-snmp/agent/snmp_agent.h
new file mode 100644
index 0000000..aad8837
--- /dev/null
+++ b/include/net-snmp/agent/snmp_agent.h
@@ -0,0 +1,322 @@
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+/*
+ * @file snmp_agent.h
+ *
+ * @addtogroup agent
+ * @addtogroup table
+ * External definitions for functions and variables in snmp_agent.c.
+ *
+ * @{
+ */
+
+#ifndef SNMP_AGENT_H
+#define SNMP_AGENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <net-snmp/library/snmp_impl.h>
+#include <net-snmp/library/tools.h>
+#include <net-snmp/library/data_list.h>
+
+#define SNMP_MAX_PDU_SIZE 64000 /* local constraint on PDU size sent by agent
+ * (see also SNMP_MAX_MSG_SIZE in snmp_api.h) */
+
+ /*
+ * If non-zero, causes the addresses of peers to be logged when receptions
+ * occur.
+ */
+
+ extern int log_addresses;
+
+ /*
+ * How many ticks since we last aged the address cache entries.
+ */
+
+ extern int lastAddrAge;
+
+ /** @typedef struct netsnmp_request_info_s netsnmp_request_info
+ * Typedefs the netsnmp_request_info_s struct into
+ * netsnmp_request_info*/
+ /** @struct netsnmp_request_info_s
+ * The netsnmp request info structure.
+ */
+ typedef struct netsnmp_request_info_s {
+ /**
+ * variable bindings
+ */
+ netsnmp_variable_list *requestvb;
+
+ /**
+ * can be used to pass information on a per-request basis from a
+ * helper to the later handlers
+ */
+ netsnmp_data_list *parent_data;
+
+ /*
+ * pointer to the agent_request_info for this request
+ */
+ struct netsnmp_agent_request_info_s *agent_req_info;
+
+ /** don't free, reference to (struct tree)->end */
+ oid *range_end;
+ size_t range_end_len;
+
+ /*
+ * flags
+ */
+ int delegated;
+ int processed;
+ int inclusive;
+
+ int status;
+ /** index in original pdu */
+ int index;
+
+ /** get-bulk */
+ int repeat;
+ int orig_repeat;
+ netsnmp_variable_list *requestvb_start;
+
+ /* internal use */
+ struct netsnmp_request_info_s *next;
+ struct netsnmp_request_info_s *prev;
+ struct netsnmp_subtree_s *subtree;
+ } netsnmp_request_info;
+
+ typedef struct netsnmp_set_info_s {
+ int action;
+ void *stateRef;
+
+ /*
+ * don't use yet:
+ */
+ void **oldData;
+ int setCleanupFlags;
+#define AUTO_FREE_STATEREF 0x01 /* calls free(stateRef) */
+#define AUTO_FREE_OLDDATA 0x02 /* calls free(*oldData) */
+#define AUTO_UNDO 0x03 /* ... */
+ } netsnmp_set_info;
+
+ typedef struct netsnmp_tree_cache_s {
+ struct netsnmp_subtree_s *subtree;
+ netsnmp_request_info *requests_begin;
+ netsnmp_request_info *requests_end;
+ } netsnmp_tree_cache;
+
+#define MODE_GET SNMP_MSG_GET
+#define MODE_GETNEXT SNMP_MSG_GETNEXT
+#define MODE_GETBULK SNMP_MSG_GETBULK
+#define MODE_GET_STASH SNMP_MSG_INTERNAL_GET_STASH
+#ifndef NETSNMP_NO_WRITE_SUPPORT
+#define MODE_IS_GET(x) ((x >= 128) && (x != -1) && (x != SNMP_MSG_SET))
+#else /* NETSNMP_NO_WRITE_SUPPORT */
+#define MODE_IS_GET(x) ((x >= 128) && (x != -1))
+#endif /* NETSNMP_NO_WRITE_SUPPORT */
+
+ /* #define MODE_IS_GET(x) ((x == SNMP_MSG_GET) || (x == SNMP_MSG_GETNEXT) || (x == SNMP_MSG_GETBULK) || (x == SNMP_MSG_INTERNAL_GET_STASH)) */
+
+#ifndef NETSNMP_NO_WRITE_SUPPORT
+#define MODE_SET_BEGIN SNMP_MSG_INTERNAL_SET_BEGIN
+#define MODE_SET_RESERVE1 SNMP_MSG_INTERNAL_SET_RESERVE1
+#define MODE_SET_RESERVE2 SNMP_MSG_INTERNAL_SET_RESERVE2
+#define MODE_SET_ACTION SNMP_MSG_INTERNAL_SET_ACTION
+#define MODE_SET_COMMIT SNMP_MSG_INTERNAL_SET_COMMIT
+#define MODE_SET_FREE SNMP_MSG_INTERNAL_SET_FREE
+#define MODE_SET_UNDO SNMP_MSG_INTERNAL_SET_UNDO
+#define MODE_IS_SET(x) ((x < 128) || (x == -1) || (x == SNMP_MSG_SET))
+ /* #define MODE_IS_SET(x) (!MODE_IS_GET(x)) */
+#endif /* NETSNMP_NO_WRITE_SUPPORT */
+
+#define MODE_BSTEP_PRE_REQUEST SNMP_MSG_INTERNAL_PRE_REQUEST
+#define MODE_BSTEP_POST_REQUEST SNMP_MSG_INTERNAL_POST_REQUEST
+
+#define MODE_BSTEP_OBJECT_LOOKUP SNMP_MSG_INTERNAL_OBJECT_LOOKUP
+#ifndef NETSNMP_NO_WRITE_SUPPORT
+#define MODE_BSTEP_CHECK_VALUE SNMP_MSG_INTERNAL_CHECK_VALUE
+#define MODE_BSTEP_ROW_CREATE SNMP_MSG_INTERNAL_ROW_CREATE
+#define MODE_BSTEP_UNDO_SETUP SNMP_MSG_INTERNAL_UNDO_SETUP
+#define MODE_BSTEP_SET_VALUE SNMP_MSG_INTERNAL_SET_VALUE
+#define MODE_BSTEP_CHECK_CONSISTENCY SNMP_MSG_INTERNAL_CHECK_CONSISTENCY
+#define MODE_BSTEP_UNDO_SET SNMP_MSG_INTERNAL_UNDO_SET
+#define MODE_BSTEP_COMMIT SNMP_MSG_INTERNAL_COMMIT
+#define MODE_BSTEP_UNDO_COMMIT SNMP_MSG_INTERNAL_UNDO_COMMIT
+#define MODE_BSTEP_IRREVERSIBLE_COMMIT SNMP_MSG_INTERNAL_IRREVERSIBLE_COMMIT
+#define MODE_BSTEP_UNDO_CLEANUP SNMP_MSG_INTERNAL_UNDO_CLEANUP
+#endif /* NETSNMP_NO_WRITE_SUPPORT */
+
+/** @typedef struct netsnmp_agent_request_info_s netsnmp_agent_request_info
+ * Typedefs the netsnmp_agent_request_info_s struct into
+ * netsnmp_agent_request_info
+ */
+
+/** @struct netsnmp_agent_request_info_s
+ * The agent transaction request structure
+ */
+ typedef struct netsnmp_agent_request_info_s {
+ int mode;
+ /** pdu contains authinfo, eg */
+/* netsnmp_pdu *pdu; */
+ struct netsnmp_agent_session_s *asp; /* may not be needed */
+ /*
+ * can be used to pass information on a per-pdu basis from a
+ * helper to the later handlers
+ */
+ netsnmp_data_list *agent_data;
+ } netsnmp_agent_request_info;
+
+ typedef struct netsnmp_cachemap_s {
+ int globalid;
+ int cacheid;
+ struct netsnmp_cachemap_s *next;
+ } netsnmp_cachemap;
+
+ typedef struct netsnmp_agent_session_s {
+ int mode;
+ netsnmp_session *session;
+ netsnmp_pdu *pdu;
+ netsnmp_pdu *orig_pdu;
+ int rw;
+ int exact;
+ int status;
+ int index;
+ int oldmode;
+
+ struct netsnmp_agent_session_s *next;
+
+ /*
+ * new API pointers
+ */
+ netsnmp_agent_request_info *reqinfo;
+ netsnmp_request_info *requests;
+ netsnmp_tree_cache *treecache;
+ netsnmp_variable_list **bulkcache;
+ int treecache_len; /* length of cache array */
+ int treecache_num; /* number of current cache entries */
+ netsnmp_cachemap *cache_store;
+ int vbcount;
+ } netsnmp_agent_session;
+
+ /*
+ * Address cache handling functions.
+ */
+
+ void netsnmp_addrcache_initialise(void);
+ void netsnmp_addrcache_destroy(void);
+ void netsnmp_addrcache_age(void);
+
+
+ /*
+ * config file parsing routines
+ */
+ int handle_snmp_packet(int, netsnmp_session *, int,
+ netsnmp_pdu *, void *);
+ void snmp_agent_parse_config(char *, char *);
+ netsnmp_agent_session *init_agent_snmp_session(netsnmp_session *,
+ netsnmp_pdu *);
+ void free_agent_snmp_session(netsnmp_agent_session *);
+ void
+ netsnmp_remove_and_free_agent_snmp_session(netsnmp_agent_session
+ *asp);
+#ifdef SNMP_NEED_REQUEST_LIST
+ void
+ netsnmp_free_agent_snmp_session_by_session(netsnmp_session * sess,
+ void (*free_request)
+ (netsnmp_request_list
+ *));
+#endif
+ int getNextSessID(void);
+ void dump_sess_list(void);
+ int init_master_agent(void);
+ void shutdown_master_agent(void);
+ int agent_check_and_process(int block);
+ void netsnmp_check_outstanding_agent_requests(void);
+
+ int netsnmp_request_set_error(netsnmp_request_info *request,
+ int error_value);
+ int netsnmp_check_requests_error(netsnmp_request_info *reqs);
+ int netsnmp_check_all_requests_error(netsnmp_agent_session *asp,
+ int look_for_specific);
+ int
+ netsnmp_set_all_requests_error(netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests,
+ int error_value);
+ int netsnmp_request_set_error_idx(netsnmp_request_info *requests,
+ int error_value, int idx);
+ int
+ netsnmp_request_set_error_all(netsnmp_request_info *requests,
+ int error_value);
+
+ /** deprecated, use netsnmp_request_set_error instead */
+ int netsnmp_set_request_error(netsnmp_agent_request_info
+ *reqinfo,
+ netsnmp_request_info
+ *request, int error_value);
+ /** deprecated, use netsnmp_request_set_error instead */
+ int netsnmp_set_mode_request_error(int mode,
+ netsnmp_request_info
+ *request,
+ int error_value);
+
+ u_long netsnmp_marker_uptime(marker_t pm);
+ u_long netsnmp_timeval_uptime(struct timeval *tv);
+ const_marker_t netsnmp_get_agent_starttime(void);
+ uint64_t netsnmp_get_agent_runtime(void);
+ void netsnmp_set_agent_starttime(marker_t s);
+ u_long netsnmp_get_agent_uptime(void);
+ void netsnmp_set_agent_uptime(u_long hsec);
+ int netsnmp_check_transaction_id(int transaction_id);
+ int netsnmp_agent_check_packet(netsnmp_session *,
+ struct netsnmp_transport_s
+ *, void *, int);
+ int netsnmp_agent_check_parse(netsnmp_session *,
+ netsnmp_pdu *, int);
+ int netsnmp_allocate_globalcacheid(void);
+
+ int netsnmp_remove_delegated_requests_for_session(netsnmp_session *sess);
+
+ /*
+ * Register and de-register agent NSAPs.
+ */
+
+ struct netsnmp_transport_s;
+
+ int netsnmp_register_agent_nsap(struct netsnmp_transport_s
+ *t);
+ void netsnmp_deregister_agent_nsap(int handle);
+
+ void
+ netsnmp_agent_add_list_data(netsnmp_agent_request_info *agent,
+ netsnmp_data_list *node);
+
+ int
+ netsnmp_agent_remove_list_data(netsnmp_agent_request_info *ari,
+ const char * name);
+
+ void *
+ netsnmp_agent_get_list_data(netsnmp_agent_request_info
+ *agent, const char *name);
+
+ void
+ netsnmp_free_agent_data_set(netsnmp_agent_request_info *agent);
+
+ void
+ netsnmp_free_agent_data_sets(netsnmp_agent_request_info *agent);
+ void
+ netsnmp_free_agent_request_info(netsnmp_agent_request_info *ari);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+/** @} */
diff --git a/include/net-snmp/agent/snmp_get_statistic.h b/include/net-snmp/agent/snmp_get_statistic.h
new file mode 100644
index 0000000..cc5d486
--- /dev/null
+++ b/include/net-snmp/agent/snmp_get_statistic.h
@@ -0,0 +1,20 @@
+#ifndef SNMP_GET_STATISTIC_H
+#define SNMP_GET_STATISTIC_H
+
+/** Registers a scalar group with statistics from @ref snmp_get_statistic.
+ * as reginfo.[start, start + end - begin].
+ * @param reginfo registration to register the items under
+ * @param start offset to the begin item
+ * @param begin first snmp_get_statistic key to return
+ * @param end last snmp_get_statistic key to return
+ */
+int
+netsnmp_register_statistic_handler(netsnmp_handler_registration *reginfo,
+ oid start, int begin, int end);
+
+#define NETSNMP_REGISTER_STATISTIC_HANDLER(reginfo, start, stat) \
+ netsnmp_register_statistic_handler(reginfo, start, \
+ STAT_ ## stat ## _STATS_START, \
+ STAT_ ## stat ## _STATS_END)
+
+#endif
diff --git a/include/net-snmp/agent/snmp_vars.h b/include/net-snmp/agent/snmp_vars.h
new file mode 100644
index 0000000..5ca2ffc
--- /dev/null
+++ b/include/net-snmp/agent/snmp_vars.h
@@ -0,0 +1,138 @@
+/*
+ * Definitions for SNMP (RFC 1067) agent variable finder.
+ *
+ */
+
+#ifndef _SNMP_VARS_H_
+#define _SNMP_VARS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/***********************************************************
+ Copyright 1988, 1989 by Carnegie Mellon University
+ Copyright 1989 TGV, Incorporated
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU and TGV not be used
+in advertising or publicity pertaining to distribution of the software
+without specific, written prior permission.
+
+CMU AND TGV DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL CMU OR TGV BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+******************************************************************/
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+ struct variable;
+
+ /**
+ * Duplicates a variable.
+ *
+ * @return Pointer to the duplicate variable upon success; NULL upon
+ * failure.
+ *
+ * @see struct variable
+ * @see struct variable1
+ * @see struct variable2
+ * @see struct variable3
+ * @see struct variable4
+ * @see struct variable7
+ * @see struct variable8
+ * @see struct variable13
+ */
+ struct variable *netsnmp_duplicate_variable(struct variable *var);
+
+ /*
+ * Function pointer called by the master agent for writes.
+ */
+ typedef int (WriteMethod) (int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t length);
+
+ /*
+ * Function pointer called by the master agent for mib information retrieval
+ */
+ typedef u_char *(FindVarMethod) (struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len,
+ WriteMethod ** write_method);
+
+ /*
+ * Function pointer called by the master agent for setting up subagent requests
+ */
+ typedef int (AddVarMethod) (netsnmp_agent_session *asp,
+ netsnmp_variable_list * vbp);
+
+ struct nlist;
+
+ extern long long_return;
+ extern u_char return_buf[];
+
+ extern oid nullOid[];
+ extern int nullOidLen;
+
+#define INST 0xFFFFFFFF /* used to fill out the instance field of the variables table */
+
+ struct variable {
+ u_char magic; /* passed to function as a hint */
+ char type; /* type of variable */
+ /*
+ * See important comment in snmp_vars.c relating to acl
+ */
+ u_short acl; /* access control list for variable */
+ FindVarMethod *findVar; /* function that finds variable */
+ u_char namelen; /* length of above */
+ oid name[MAX_OID_LEN]; /* object identifier of variable */
+ };
+
+ int init_agent(const char *);
+ void shutdown_agent(void);
+
+ int should_init(const char *module_name);
+ void add_to_init_list(char *module_list);
+
+#ifdef USING_AGENTX_SUBAGENT_MODULE
+ void netsnmp_enable_subagent(void);
+#endif
+
+#ifndef _AGENT_REGISTRY_H
+#include <net-snmp/agent/agent_handler.h>
+#include <net-snmp/agent/var_struct.h>
+#include <net-snmp/agent/agent_registry.h>
+#endif
+
+ /*
+ * fail overloads non-negative integer value. it must be -1 !
+ */
+#define MATCH_FAILED (-1)
+#define MATCH_SUCCEEDED 0
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _SNMP_VARS_H_ */
diff --git a/include/net-snmp/agent/stash_cache.h b/include/net-snmp/agent/stash_cache.h
new file mode 100644
index 0000000..3709a27
--- /dev/null
+++ b/include/net-snmp/agent/stash_cache.h
@@ -0,0 +1,35 @@
+#ifndef STASH_CACHE_H
+#define STASH_CACHE_H
+
+#include <net-snmp/library/oid_stash.h>
+#include <net-snmp/library/tools.h>
+
+#define STASH_CACHE_NAME "stash_cache"
+
+typedef struct netsnmp_stash_cache_info_s {
+ int cache_valid;
+ marker_t cache_time;
+ netsnmp_oid_stash_node *cache;
+ int cache_length;
+} netsnmp_stash_cache_info;
+
+typedef struct netsnmp_stash_cache_data_s {
+ void *data;
+ size_t data_len;
+ u_char data_type;
+} netsnmp_stash_cache_data;
+
+/* function prototypes */
+void netsnmp_init_stash_cache_helper(void);
+netsnmp_mib_handler *netsnmp_get_bare_stash_cache_handler(void);
+netsnmp_mib_handler *netsnmp_get_stash_cache_handler(void);
+netsnmp_mib_handler *netsnmp_get_timed_bare_stash_cache_handler(int timeout,
+ oid *rootoid, size_t rootoid_len);
+netsnmp_mib_handler *netsnmp_get_timed_stash_cache_handler(int timeout,
+ oid *rootoid, size_t rootoid_len);
+Netsnmp_Node_Handler netsnmp_stash_cache_helper;
+netsnmp_oid_stash_node **netsnmp_extract_stash_cache(netsnmp_agent_request_info *reqinfo);
+int netsnmp_stash_cache_update(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests, netsnmp_stash_cache_info *cinfo);
+
+
+#endif /* STASH_CACHE_H */
diff --git a/include/net-snmp/agent/stash_to_next.h b/include/net-snmp/agent/stash_to_next.h
new file mode 100644
index 0000000..200b5aa
--- /dev/null
+++ b/include/net-snmp/agent/stash_to_next.h
@@ -0,0 +1,24 @@
+/*
+ * stash_to_next.h
+ */
+#ifndef STASH_TO_NEXT_H
+#define STASH_TO_NEXT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * The helper merely intercepts GETSTASH requests and converts them to
+ * GETNEXT reequests.
+ */
+
+
+netsnmp_mib_handler *netsnmp_get_stash_to_next_handler(void);
+Netsnmp_Node_Handler netsnmp_stash_to_next_helper;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/net-snmp/agent/sysORTable.h b/include/net-snmp/agent/sysORTable.h
new file mode 100644
index 0000000..bfebad2
--- /dev/null
+++ b/include/net-snmp/agent/sysORTable.h
@@ -0,0 +1,62 @@
+#ifndef NETSNMP_SYSORTABLE_H
+#define NETSNMP_SYSORTABLE_H
+
+struct sysORTable {
+ char *OR_descr;
+ oid *OR_oid;
+ size_t OR_oidlen;
+ netsnmp_session *OR_sess;
+ u_long OR_uptime;
+};
+
+struct register_sysOR_parameters {
+ char *descr;
+ oid *name;
+ size_t namelen;
+};
+
+#define SYS_ORTABLE_REGISTERED_OK 0
+#define SYS_ORTABLE_REGISTRATION_FAILED -1
+#define SYS_ORTABLE_UNREGISTERED_OK 0
+#define SYS_ORTABLE_NO_SUCH_REGISTRATION -1
+
+#include <net-snmp/agent/agent_callbacks.h>
+
+#define REGISTER_SYSOR_TABLE(theoid, len, descr) \
+ do { \
+ struct sysORTable t; \
+ t.OR_descr = NETSNMP_REMOVE_CONST(char *, descr); \
+ t.OR_oid = theoid; \
+ t.OR_oidlen = len; \
+ t.OR_sess = NULL; \
+ t.OR_uptime = 0; \
+ snmp_call_callbacks(SNMP_CALLBACK_APPLICATION, \
+ SNMPD_CALLBACK_REQ_REG_SYSOR, &t); \
+ } while(0);
+
+#define REGISTER_SYSOR_ENTRY(theoid, descr) \
+ REGISTER_SYSOR_TABLE(theoid, sizeof(theoid) / sizeof(oid), \
+ descr)
+
+#define UNREGISTER_SYSOR_TABLE(theoid, len) \
+ do { \
+ struct sysORTable t; \
+ t.OR_descr = NULL; \
+ t.OR_oid = theoid; \
+ t.OR_oidlen = len; \
+ t.OR_sess = NULL; \
+ t.OR_uptime = 0; \
+ snmp_call_callbacks(SNMP_CALLBACK_APPLICATION, \
+ SNMPD_CALLBACK_REQ_UNREG_SYSOR, &t); \
+ } while(0);
+
+#define UNREGISTER_SYSOR_ENTRY(theoid) \
+ UNREGISTER_SYSOR_TABLE(theoid, sizeof(theoid) / sizeof(oid))
+
+#define UNREGISTER_SYSOR_SESS(sess) \
+ snmp_call_callbacks(SNMP_CALLBACK_APPLICATION, \
+ SNMPD_CALLBACK_REQ_UNREG_SYSOR_SESS, \
+ sess);
+
+
+#endif /* NETSNMP_SYSORTABLE_H */
diff --git a/include/net-snmp/agent/table.h b/include/net-snmp/agent/table.h
new file mode 100644
index 0000000..79e588c
--- /dev/null
+++ b/include/net-snmp/agent/table.h
@@ -0,0 +1,200 @@
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright (C) 2007 Apple, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+/*
+ * @file table.h
+ *
+ * @addtogroup table
+ *
+ * @{
+ */
+#ifndef _TABLE_HANDLER_H_
+#define _TABLE_HANDLER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * The table helper is designed to simplify the task of writing a
+ * table handler for the net-snmp agent. You should create a normal
+ * handler and register it using the netsnmp_register_table() function
+ * instead of the netsnmp_register_handler() function.
+ */
+
+/**
+ * Notes:
+ *
+ * 1) illegal indexes automatically get handled for get/set cases.
+ * Simply check to make sure the value is type ASN_NULL before
+ * you answer a request.
+ */
+
+/**
+ * used as an index to parent_data lookups
+ */
+#define TABLE_HANDLER_NAME "table"
+
+/** @typedef struct netsnmp_column_info_t netsnmp_column_info
+ * Typedefs the netsnmp_column_info_t struct into netsnmp_column_info */
+
+/**
+ * @struct netsnmp_column_info_t
+ * column info struct. OVERLAPPING RANGES ARE NOT SUPPORTED.
+ */
+ typedef struct netsnmp_column_info_t {
+ char isRange;
+ /** only useful if isRange == 0 */
+ char list_count;
+
+ union {
+ unsigned int range[2];
+ unsigned int *list;
+ } details;
+
+ struct netsnmp_column_info_t *next;
+
+ } netsnmp_column_info;
+
+/** @typedef struct netsnmp_table_registration_info_s netsnmp_table_registration_info
+ * Typedefs the netsnmp_table_registration_info_s struct into
+ * netsnmp_table_registration_info */
+
+/**
+ * @struct netsnmp_table_registration_info_s
+ * Table registration structure.
+ */
+ typedef struct netsnmp_table_registration_info_s {
+ /** list of varbinds with only 'type' set */
+ netsnmp_variable_list *indexes;
+ /** calculated automatically */
+ unsigned int number_indexes;
+
+ /**
+ * the minimum columns number. If there are columns
+ * in-between which are not valid, use valid_columns to get
+ * automatic column range checking.
+ */
+ unsigned int min_column;
+ /** the maximum columns number */
+ unsigned int max_column;
+
+ /** more details on columns */
+ netsnmp_column_info *valid_columns;
+
+ } netsnmp_table_registration_info;
+
+/** @typedef struct netsnmp_table_request_info_s netsnmp_table_request_info
+ * Typedefs the netsnmp_table_request_info_s struct into
+ * netsnmp_table_request_info */
+
+/**
+ * @struct netsnmp_table_request_info_s
+ * The table request info structure.
+ */
+ typedef struct netsnmp_table_request_info_s {
+ /** 0 if OID not long enough */
+ unsigned int colnum;
+ /** 0 if failure to parse any */
+ unsigned int number_indexes;
+ /** contents freed by helper upon exit */
+ netsnmp_variable_list *indexes;
+
+ oid index_oid[MAX_OID_LEN];
+ size_t index_oid_len;
+ netsnmp_table_registration_info *reg_info;
+ } netsnmp_table_request_info;
+
+ netsnmp_mib_handler
+ *netsnmp_get_table_handler(netsnmp_table_registration_info
+ *tabreq);
+ void netsnmp_handler_owns_table_info(netsnmp_mib_handler *handler);
+ void netsnmp_registration_owns_table_info(netsnmp_handler_registration *reg);
+ int netsnmp_register_table( netsnmp_handler_registration *reginfo,
+ netsnmp_table_registration_info *tabreq);
+ int netsnmp_unregister_table(netsnmp_handler_registration *reginfo);
+ int netsnmp_table_build_oid( netsnmp_handler_registration *reginfo,
+ netsnmp_request_info *reqinfo,
+ netsnmp_table_request_info *table_info);
+ int
+ netsnmp_table_build_oid_from_index(netsnmp_handler_registration
+ *reginfo,
+ netsnmp_request_info *reqinfo,
+ netsnmp_table_request_info
+ *table_info);
+ int netsnmp_table_build_result(netsnmp_handler_registration
+ *reginfo,
+ netsnmp_request_info
+ *reqinfo,
+ netsnmp_table_request_info
+ *table_info, u_char type,
+ u_char * result,
+ size_t result_len);
+ int
+ netsnmp_update_variable_list_from_index(netsnmp_table_request_info
+ *);
+ int
+ netsnmp_update_indexes_from_variable_list
+ (netsnmp_table_request_info *tri);
+ netsnmp_table_registration_info
+ *netsnmp_find_table_registration_info(netsnmp_handler_registration
+ *reginfo);
+ netsnmp_table_registration_info *
+ netsnmp_table_registration_info_clone(netsnmp_table_registration_info *tri);
+ void netsnmp_table_registration_info_free(netsnmp_table_registration_info *);
+
+ netsnmp_index * netsnmp_table_index_find_next_row(netsnmp_container *c,
+ netsnmp_table_request_info *tblreq);
+
+ unsigned int netsnmp_closest_column(unsigned int current,
+ netsnmp_column_info
+ *valid_columns);
+
+ Netsnmp_Node_Handler table_helper_handler;
+
+#define netsnmp_table_helper_add_index(tinfo, type) snmp_varlist_add_variable(&tinfo->indexes, NULL, 0, (u_char)type, NULL, 0);
+
+ void
+ netsnmp_table_helper_add_indexes(netsnmp_table_registration_info
+ *tinfo, ...);
+
+ int netsnmp_check_getnext_reply(netsnmp_request_info *request,
+ oid * prefix, size_t prefix_len,
+ netsnmp_variable_list * newvar,
+ netsnmp_variable_list ** outvar);
+
+ netsnmp_table_request_info
+ *netsnmp_extract_table_info(netsnmp_request_info *);
+ netsnmp_oid_stash_node
+ **netsnmp_table_get_or_create_row_stash(netsnmp_agent_request_info
+ *reqinfo,
+ const u_char *
+ storage_name);
+ unsigned int
+ netsnmp_table_next_column(netsnmp_table_request_info *table_info);
+
+
+ int netsnmp_sparse_table_register(netsnmp_handler_registration *reginfo,
+ netsnmp_table_registration_info *tabreq);
+
+ netsnmp_mib_handler *netsnmp_sparse_table_handler_get(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TABLE_HANDLER_H_ */
+/** @} */
diff --git a/include/net-snmp/agent/table_array.h b/include/net-snmp/agent/table_array.h
new file mode 100644
index 0000000..afe0717
--- /dev/null
+++ b/include/net-snmp/agent/table_array.h
@@ -0,0 +1,158 @@
+/*
+ * table_array.h
+ * $Id$
+ */
+#ifndef _TABLE_ARRAY_HANDLER_H_
+#define _TABLE_ARRAY_HANDLER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * The table array helper is designed to simplify the task of
+ * writing a table handler for the net-snmp agent when the data being
+ * accessed is in an oid sorted form and must be accessed externally.
+ *
+ * Functionally, it is a specialized version of the more
+ * generic table helper but easies the burden of GETNEXT processing by
+ * retrieving the appropriate row for ead index through
+ * function calls which should be supplied by the module that wishes
+ * help. The module the table_array helps should, afterwards,
+ * never be called for the case of "MODE_GETNEXT" and only for the GET
+ * and SET related modes instead.
+ */
+
+#include <net-snmp/library/container.h>
+#include <net-snmp/agent/table.h>
+
+#define TABLE_ARRAY_NAME "table_array"
+
+ /*
+ * group_item is to allow us to keep a list of requests without
+ * disrupting the actual netsnmp_request_info list.
+ */
+ typedef struct netsnmp_request_group_item_s {
+ netsnmp_request_info *ri;
+ netsnmp_table_request_info *tri;
+ struct netsnmp_request_group_item_s *next;
+ } netsnmp_request_group_item;
+
+ /*
+ * structure to keep a list of requests for each unique index
+ */
+ typedef struct netsnmp_request_group_s {
+ /*
+ * index for this row. points to someone else's memory, so
+ * don't free it!
+ */
+ netsnmp_index index;
+
+ /*
+ * container in which rows belong
+ */
+ netsnmp_container *table;
+
+ /*
+ * actual old and new rows
+ */
+ netsnmp_index *existing_row;
+ netsnmp_index *undo_info;
+
+ /*
+ * flags
+ */
+ char row_created;
+ char row_deleted;
+ char fill1;
+ char fill2;
+
+ /*
+ * requests for this row
+ */
+ netsnmp_request_group_item *list;
+
+ int status;
+
+ void *rg_void;
+
+ } netsnmp_request_group;
+
+ typedef int (Netsnmp_User_Row_Operation_c) (const void *lhs,
+ const void *rhs);
+ typedef int (Netsnmp_User_Row_Operation) (void *lhs, void *rhs);
+ typedef int (Netsnmp_User_Get_Processor) (netsnmp_request_info *,
+ netsnmp_index
+ *,
+ netsnmp_table_request_info
+ *);
+ typedef netsnmp_index
+ *(UserRowMethod) (netsnmp_index *);
+ typedef int (Netsnmp_User_Row_Action) (netsnmp_index *,
+ netsnmp_index *,
+ netsnmp_request_group *);
+ typedef void (Netsnmp_User_Group_Method) (netsnmp_request_group *);
+
+ /*
+ * structure for array callbacks
+ */
+ typedef struct netsnmp_table_array_callbacks_s {
+
+ Netsnmp_User_Row_Operation *row_copy;
+ Netsnmp_User_Row_Operation_c *row_compare;
+
+ Netsnmp_User_Get_Processor *get_value;
+
+
+ Netsnmp_User_Row_Action *can_activate;
+ Netsnmp_User_Row_Action *activated;
+ Netsnmp_User_Row_Action *can_deactivate;
+ Netsnmp_User_Row_Action *deactivated;
+ Netsnmp_User_Row_Action *can_delete;
+
+ UserRowMethod *create_row;
+ UserRowMethod *duplicate_row;
+ UserRowMethod *delete_row; /* always returns NULL */
+
+ Netsnmp_User_Group_Method *set_reserve1;
+ Netsnmp_User_Group_Method *set_reserve2;
+ Netsnmp_User_Group_Method *set_action;
+ Netsnmp_User_Group_Method *set_commit;
+ Netsnmp_User_Group_Method *set_free;
+ Netsnmp_User_Group_Method *set_undo;
+
+ /** not callbacks, but this is a useful place for them... */
+ netsnmp_container* container;
+ char can_set;
+
+ } netsnmp_table_array_callbacks;
+
+
+ int
+ netsnmp_table_container_register(netsnmp_handler_registration *reginfo,
+ netsnmp_table_registration_info
+ *tabreq,
+ netsnmp_table_array_callbacks *cb,
+ netsnmp_container *container,
+ int group_rows);
+
+ int netsnmp_table_array_register(netsnmp_handler_registration *reginfo,
+ netsnmp_table_registration_info *tabreq,
+ netsnmp_table_array_callbacks *cb,
+ netsnmp_container *container,
+ int group_rows);
+
+ netsnmp_container * netsnmp_extract_array_context(netsnmp_request_info *);
+
+ Netsnmp_Node_Handler netsnmp_table_array_helper_handler;
+
+ int
+ netsnmp_table_array_check_row_status(netsnmp_table_array_callbacks *cb,
+ netsnmp_request_group *ag,
+ long *rs_new, long *rs_old);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TABLE_ARRAY_HANDLER_H_ */
diff --git a/include/net-snmp/agent/table_container.h b/include/net-snmp/agent/table_container.h
new file mode 100644
index 0000000..b342110
--- /dev/null
+++ b/include/net-snmp/agent/table_container.h
@@ -0,0 +1,108 @@
+/*
+ * table_container.h
+ * $Id$
+ */
+#ifndef _TABLE_CONTAINER_HANDLER_H_
+#define _TABLE_CONTAINER_HANDLER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * The table container helper is designed to simplify the task of
+ * writing a table handler for the net-snmp agent when the data being
+ * accessed is accessible via a netsnmp_container.
+ *
+ * Functionally, it is a specialized version of the more
+ * generic table helper but easies the burden of GETNEXT processing by
+ * retrieving the appropriate row for each index through
+ * function calls which should be supplied by the module that wishes
+ * help. The module the table_container helps should, afterwards,
+ * never be called for the case of "MODE_GETNEXT" and only for the GET
+ * and SET related modes instead.
+ */
+
+#include <net-snmp/library/container.h>
+#include <net-snmp/agent/table.h>
+
+#define TABLE_CONTAINER_ROW "table_container:row"
+#define TABLE_CONTAINER_CONTAINER "table_container:container"
+
+#define TABLE_CONTAINER_KEY_NETSNMP_INDEX 1 /* default */
+#define TABLE_CONTAINER_KEY_VARBIND_INDEX 2
+#define TABLE_CONTAINER_KEY_VARBIND_RAW 3
+
+/* ====================================
+ * Container Table API: MIB maintenance
+ * ==================================== */
+
+ /*
+ * get an injectable container table handler
+ */
+ netsnmp_mib_handler *
+ netsnmp_container_table_handler_get(netsnmp_table_registration_info *tabreq,
+ netsnmp_container *container,
+ char key_type);
+ /*
+ * register a container table
+ */
+ int
+ netsnmp_container_table_register(netsnmp_handler_registration *reginfo,
+ netsnmp_table_registration_info *tabreq,
+ netsnmp_container *container,
+ char key_type);
+ int
+ netsnmp_container_table_unregister(netsnmp_handler_registration *reginfo);
+
+ /** retrieve the container used by the table_container helper */
+ netsnmp_container*
+ netsnmp_container_table_container_extract(netsnmp_request_info *request);
+
+ /** find the context data used by the table_container helper */
+#ifdef NETSNMP_USE_INLINE
+ NETSNMP_STATIC_INLINE void *
+ netsnmp_container_table_row_extract(netsnmp_request_info *request)
+ {
+ /*
+ * NOTE: this function must match in table_container.c and table_container.h.
+ * if you change one, change them both!
+ */
+ return netsnmp_request_get_list_data(request, TABLE_CONTAINER_ROW);
+ }
+
+ NETSNMP_STATIC_INLINE void *
+ netsnmp_container_table_extract_context(netsnmp_request_info *request)
+ {
+ /*
+ * NOTE: this function must match in table_container.c and table_container.h.
+ * if you change one, change them both!
+ */
+ return netsnmp_request_get_list_data(request, TABLE_CONTAINER_ROW);
+ }
+#else
+ void *
+ netsnmp_container_table_row_extract(netsnmp_request_info *request);
+ void *
+ netsnmp_container_table_extract_context(netsnmp_request_info *request);
+#endif /* inline */
+
+ void netsnmp_container_table_row_insert(netsnmp_request_info *request,
+ netsnmp_index *row);
+ void netsnmp_container_table_row_remove(netsnmp_request_info *request,
+ netsnmp_index *row);
+
+/* ===================================
+ * Container Table API: Row operations
+ * =================================== */
+
+ void *
+ netsnmp_container_table_find_next_row(netsnmp_request_info *request,
+ netsnmp_table_request_info *tblreq,
+ netsnmp_container *container,
+ char key_type );
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TABLE_CONTAINER_HANDLER_H_ */
diff --git a/include/net-snmp/agent/table_data.h b/include/net-snmp/agent/table_data.h
new file mode 100644
index 0000000..f64475e
--- /dev/null
+++ b/include/net-snmp/agent/table_data.h
@@ -0,0 +1,124 @@
+/*
+ * table_iterator.h
+ */
+#ifndef _TABLE_DATA_HANDLER_H_
+#define _TABLE_DATA_HANDLER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * This helper is designed to completely automate the task of storing
+ * tables of data within the agent that are not tied to external data
+ * sources (like the kernel, hardware, or other processes, etc). IE,
+ * all rows within a table are expected to be added manually using
+ * functions found below.
+ */
+
+#define TABLE_DATA_NAME "table_data"
+#define TABLE_DATA_ROW "table_data"
+#define TABLE_DATA_TABLE "table_data_table"
+
+ typedef struct netsnmp_table_row_s {
+ netsnmp_variable_list *indexes; /* stored permanently if store_indexes = 1 */
+ oid *index_oid;
+ size_t index_oid_len;
+ void *data; /* the data to store */
+
+ struct netsnmp_table_row_s *next, *prev; /* if used in a list */
+ } netsnmp_table_row;
+
+ typedef struct netsnmp_table_data_s {
+ netsnmp_variable_list *indexes_template; /* containing only types */
+ char *name; /* if !NULL, it's registered globally */
+ int flags; /* not currently used */
+ int store_indexes;
+ netsnmp_table_row *first_row;
+ netsnmp_table_row *last_row;
+ } netsnmp_table_data;
+
+/* =================================
+ * Table Data API: Table maintenance
+ * ================================= */
+
+ void netsnmp_table_data_generate_index_oid( netsnmp_table_row *row);
+
+ netsnmp_table_data *netsnmp_create_table_data(const char *name);
+ netsnmp_table_row *netsnmp_create_table_data_row(void);
+ netsnmp_table_row *netsnmp_table_data_clone_row( netsnmp_table_row *row);
+ void *netsnmp_table_data_delete_row(netsnmp_table_row *row);
+ int netsnmp_table_data_add_row( netsnmp_table_data *table,
+ netsnmp_table_row *row);
+ void
+ netsnmp_table_data_replace_row(netsnmp_table_data *table,
+ netsnmp_table_row *origrow,
+ netsnmp_table_row *newrow);
+ netsnmp_table_row *netsnmp_table_data_remove_row(netsnmp_table_data *table,
+ netsnmp_table_row *row);
+ void *netsnmp_table_data_remove_and_delete_row(netsnmp_table_data *table,
+ netsnmp_table_row *row);
+ void netsnmp_table_data_delete_table( netsnmp_table_data *table );
+
+/* =================================
+ * Table Data API: MIB maintenance
+ * ================================= */
+
+ netsnmp_mib_handler *
+ netsnmp_get_table_data_handler(netsnmp_table_data *table);
+
+ int netsnmp_register_table_data(netsnmp_handler_registration *reginfo,
+ netsnmp_table_data *table,
+ netsnmp_table_registration_info *table_info);
+ int netsnmp_register_read_only_table_data(
+ netsnmp_handler_registration *reginfo,
+ netsnmp_table_data *table,
+ netsnmp_table_registration_info *table_info);
+ Netsnmp_Node_Handler netsnmp_table_data_helper_handler;
+
+ netsnmp_table_data *netsnmp_extract_table( netsnmp_request_info *);
+ netsnmp_table_row *netsnmp_extract_table_row(netsnmp_request_info *);
+ void *netsnmp_extract_table_row_data(netsnmp_request_info *);
+ void netsnmp_insert_table_row(netsnmp_request_info *, netsnmp_table_row *);
+
+ int netsnmp_table_data_build_result(netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *request,
+ netsnmp_table_row *row, int column,
+ u_char type, u_char * result_data,
+ size_t result_data_len);
+
+/* =================================
+ * Table Data API: Row operations
+ * ================================= */
+
+ netsnmp_table_row *netsnmp_table_data_get_first_row(
+ netsnmp_table_data *table);
+ netsnmp_table_row *netsnmp_table_data_get_next_row(
+ netsnmp_table_data *table,
+ netsnmp_table_row *row);
+
+ netsnmp_table_row *netsnmp_table_data_get(netsnmp_table_data *table,
+ netsnmp_variable_list *indexes);
+
+ netsnmp_table_row *netsnmp_table_data_get_from_oid(
+ netsnmp_table_data *table,
+ oid * searchfor,
+ size_t searchfor_len);
+
+ int netsnmp_table_data_num_rows(netsnmp_table_data *table);
+
+
+/* =================================
+ * Table Data API: Index operations
+ * ================================= */
+
+#define netsnmp_table_data_add_index(thetable, type) snmp_varlist_add_variable(&thetable->indexes_template, NULL, 0, type, NULL, 0)
+#define netsnmp_table_row_add_index(row, type, value, value_len) snmp_varlist_add_variable(&row->indexes, NULL, 0, type, (const u_char *) value, value_len)
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TABLE_DATA_HANDLER_H_ */
diff --git a/include/net-snmp/agent/table_dataset.h b/include/net-snmp/agent/table_dataset.h
new file mode 100644
index 0000000..66e3b3c
--- /dev/null
+++ b/include/net-snmp/agent/table_dataset.h
@@ -0,0 +1,196 @@
+/*
+ * table_iterator.h
+ */
+#ifndef _TABLE_DATA_SET_HANDLER_H_
+#define _TABLE_DATA_SET_HANDLER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * This helper is designed to completely automate the task of storing
+ * tables of data within the agent that are not tied to external data
+ * sources (like the kernel, hardware, or other processes, etc). IE,
+ * all rows within a table are expected to be added manually using
+ * functions found below.
+ */
+
+ void netsnmp_init_table_dataset(void);
+
+#define TABLE_DATA_SET_NAME "netsnmp_table_data_set"
+
+ /*
+ * return SNMP_ERR_NOERROR or some SNMP specific protocol error id
+ */
+ typedef int (Netsnmp_Value_Change_Ok) (char *old_value,
+ size_t old_value_len,
+ char *new_value,
+ size_t new_value_len,
+ void *mydata);
+
+ /*
+ * stored within a given row
+ */
+ typedef struct netsnmp_table_data_set_storage_s {
+ unsigned int column;
+
+ /*
+ * info about it?
+ */
+ char writable;
+ Netsnmp_Value_Change_Ok *change_ok_fn;
+ void *my_change_data;
+
+ /*
+ * data actually stored
+ */
+ u_char type;
+ union { /* value of variable */
+ void *voidp;
+ long *integer;
+ u_char *string;
+ oid *objid;
+ u_char *bitstring;
+ struct counter64 *counter64;
+#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
+ float *floatVal;
+ double *doubleVal;
+#endif /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
+ } data;
+ u_long data_len;
+
+ struct netsnmp_table_data_set_storage_s *next;
+ } netsnmp_table_data_set_storage;
+
+ typedef struct netsnmp_table_data_set_s {
+ netsnmp_table_data *table;
+ netsnmp_table_data_set_storage *default_row;
+ int allow_creation; /* set to 1 to allow creation of new rows */
+ unsigned int rowstatus_column;
+ } netsnmp_table_data_set;
+
+
+/* ============================
+ * DataSet API: Table maintenance
+ * ============================ */
+
+ netsnmp_table_data_set *netsnmp_create_table_data_set(const char *);
+ netsnmp_table_row *netsnmp_table_data_set_clone_row( netsnmp_table_row *row);
+ void netsnmp_table_dataset_delete_all_data(
+ netsnmp_table_data_set_storage *data);
+ void netsnmp_table_dataset_delete_row(netsnmp_table_row *row);
+
+ void netsnmp_table_dataset_add_row(netsnmp_table_data_set
+ *table,
+ netsnmp_table_row *row);
+ void
+ netsnmp_table_dataset_replace_row(netsnmp_table_data_set *table,
+ netsnmp_table_row *origrow,
+ netsnmp_table_row *newrow);
+ void netsnmp_table_dataset_remove_row(netsnmp_table_data_set
+ *table,
+ netsnmp_table_row *row);
+ void
+ netsnmp_table_dataset_remove_and_delete_row(netsnmp_table_data_set
+ *table,
+ netsnmp_table_row *row);
+ void netsnmp_delete_table_data_set(netsnmp_table_data_set *table_set);
+
+/* ============================
+ * DataSet API: Default row operations
+ * ============================ */
+
+ /*
+ * to set, add column, type, (writable) ? 1 : 0
+ */
+ /*
+ * default value, if not NULL, is the default value used in row
+ * creation. It is copied into the storage template (free your
+ * calling argument).
+ */
+ int netsnmp_table_set_add_default_row(netsnmp_table_data_set *,
+ unsigned int, int, int,
+ void *default_value,
+ size_t default_value_len);
+ void netsnmp_table_set_multi_add_default_row(netsnmp_table_data_set *,
+ ...);
+
+
+/* ============================
+ * DataSet API: MIB maintenance
+ * ============================ */
+
+ netsnmp_mib_handler
+ *netsnmp_get_table_data_set_handler(netsnmp_table_data_set *);
+ Netsnmp_Node_Handler netsnmp_table_data_set_helper_handler;
+ int netsnmp_register_table_data_set(netsnmp_handler_registration *,
+ netsnmp_table_data_set *,
+ netsnmp_table_registration_info *);
+ netsnmp_table_data_set
+ *netsnmp_extract_table_data_set(netsnmp_request_info *request);
+ netsnmp_table_data_set_storage
+ *netsnmp_extract_table_data_set_column(netsnmp_request_info *,
+ unsigned int);
+ netsnmp_oid_stash_node **
+ netsnmp_table_dataset_get_or_create_stash(netsnmp_agent_request_info *ari,
+ netsnmp_table_data_set *tds,
+ netsnmp_table_request_info *tri);
+ netsnmp_table_row *
+ netsnmp_table_dataset_get_newrow(netsnmp_request_info *request,
+ netsnmp_agent_request_info *reqinfo,
+ int rootoid_len,
+ netsnmp_table_data_set *datatable,
+ netsnmp_table_request_info *table_info);
+
+
+/* ============================
+ * DataSet API: Config-based operations
+ * ============================ */
+
+ void netsnmp_register_auto_data_table(netsnmp_table_data_set *table_set,
+ char *registration_name);
+ void netsnmp_unregister_auto_data_table(netsnmp_table_data_set *table_set,
+ char *registration_name);
+ void netsnmp_config_parse_table_set(const char *token, char *line);
+ void netsnmp_config_parse_add_row( const char *token, char *line);
+
+
+/* ============================
+ * DataSet API: Row operations
+ * ============================ */
+
+ netsnmp_table_row *netsnmp_table_data_set_get_first_row(netsnmp_table_data_set *table);
+ netsnmp_table_row *netsnmp_table_data_set_get_next_row( netsnmp_table_data_set *table,
+ netsnmp_table_row *row);
+ int netsnmp_table_set_num_rows(netsnmp_table_data_set *table);
+
+
+/* ============================
+ * DataSet API: Column operations
+ * ============================ */
+
+ netsnmp_table_data_set_storage
+ *netsnmp_table_data_set_find_column(netsnmp_table_data_set_storage *,
+ unsigned int);
+ int netsnmp_mark_row_column_writable( netsnmp_table_row *row,
+ int column, int writable);
+ int netsnmp_set_row_column( netsnmp_table_row *,
+ unsigned int, int, const void *,
+ size_t);
+
+/* ============================
+ * DataSet API: Index operations
+ * ============================ */
+
+ void netsnmp_table_dataset_add_index(netsnmp_table_data_set
+ *table, u_char type);
+ void netsnmp_table_set_add_indexes(netsnmp_table_data_set *tset, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#define netsnmp_table_row_add_column(row, type, value, value_len) snmp_varlist_add_variable(&row->indexes, NULL, 0, type, (u_char *) value, value_len)
+
+#endif /* _TABLE_DATA_SET_HANDLER_H_ */
diff --git a/include/net-snmp/agent/table_iterator.h b/include/net-snmp/agent/table_iterator.h
new file mode 100644
index 0000000..c71dd4e
--- /dev/null
+++ b/include/net-snmp/agent/table_iterator.h
@@ -0,0 +1,165 @@
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+/**
+ * @file table_iterator.h
+ * @addtogroup table_iterator
+ * @{
+ */
+#ifndef _TABLE_ITERATOR_HANDLER_H_
+#define _TABLE_ITERATOR_HANDLER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ struct netsnmp_iterator_info_s;
+
+ typedef netsnmp_variable_list *
+ (Netsnmp_First_Data_Point) (void **loop_context,
+ void **data_context,
+ netsnmp_variable_list *,
+ struct netsnmp_iterator_info_s *);
+ typedef netsnmp_variable_list *
+ (Netsnmp_Next_Data_Point) (void **loop_context,
+ void **data_context,
+ netsnmp_variable_list *,
+ struct netsnmp_iterator_info_s *);
+ typedef void *(Netsnmp_Make_Data_Context) (void *loop_context,
+ struct netsnmp_iterator_info_s *);
+ typedef void (Netsnmp_Free_Loop_Context) (void *,
+ struct netsnmp_iterator_info_s *);
+ typedef void (Netsnmp_Free_Data_Context) (void *,
+ struct netsnmp_iterator_info_s *);
+
+ /** @typedef struct netsnmp_iterator_info_s netsnmp_iterator_info
+ * Typedefs the netsnmp_iterator_info_s struct into netsnmp_iterator_info */
+
+ /** @struct netsnmp_iterator_info_s
+
+ * Holds iterator information containing functions which should be
+ called by the iterator_handler to loop over your data set and
+ sort it in a SNMP specific manner.
+
+ The netsnmp_iterator_info typedef can be used instead of directly calling this struct if you would prefer.
+ */
+ typedef struct netsnmp_iterator_info_s {
+ /** Number of handlers that own this data structure. */
+ int refcnt;
+
+ /** Responsible for: returning the first set of "index" data, a
+ loop-context pointer, and optionally a data context
+ pointer */
+ Netsnmp_First_Data_Point *get_first_data_point;
+
+ /** Given the previous loop context, this should return the
+ next loop context, associated index set and optionally a
+ data context */
+ Netsnmp_Next_Data_Point *get_next_data_point;
+
+ /** If a data context wasn't supplied by the
+ get_first_data_point or get_next_data_point functions and
+ the make_data_context pointer is defined, it will be called
+ to convert a loop context into a data context. */
+ Netsnmp_Make_Data_Context *make_data_context;
+
+ /** A function which should free the loop context. This
+ function is called at *each* iteration step, which is
+ not-optimal for speed purposes. The use of
+ free_loop_context_at_end instead is strongly
+ encouraged. This can be set to NULL to avoid its usage. */
+ Netsnmp_Free_Loop_Context *free_loop_context;
+
+ /** Frees a data context. This will be called at any time a
+ data context needs to be freed. This may be at the same
+ time as a correspondng loop context is freed, or much much
+ later. Multiple data contexts may be kept in existence at
+ any time. */
+ Netsnmp_Free_Data_Context *free_data_context;
+
+ /** Frees a loop context at the end of the entire iteration
+ sequence. Generally, this would free the loop context
+ allocated by the get_first_data_point function (which would
+ then be updated by each call to the get_next_data_point
+ function). It is not called until the get_next_data_point
+ function returns a NULL */
+ Netsnmp_Free_Loop_Context *free_loop_context_at_end;
+
+ /** This can be used by client handlers to store any
+ information they need */
+ void *myvoid;
+ int flags;
+#define NETSNMP_ITERATOR_FLAG_SORTED 0x01
+#define NETSNMP_HANDLER_OWNS_IINFO 0x02
+
+ /** A pointer to the netsnmp_table_registration_info object
+ this iterator is registered along with. */
+ netsnmp_table_registration_info *table_reginfo;
+
+ /* Experimental extension - Use At Your Own Risk
+ (these two fields may change/disappear without warning) */
+ Netsnmp_First_Data_Point *get_row_indexes;
+ netsnmp_variable_list *indexes;
+ } netsnmp_iterator_info;
+
+#define TABLE_ITERATOR_NAME "table_iterator"
+
+/* ============================
+ * Iterator API: Table maintenance
+ * ============================ */
+ /* N/A */
+
+/* ============================
+ * Iterator API: MIB maintenance
+ * ============================ */
+
+ void netsnmp_handler_owns_iterator_info(netsnmp_mib_handler *h);
+ netsnmp_mib_handler
+ *netsnmp_get_table_iterator_handler(netsnmp_iterator_info *iinfo);
+ int netsnmp_register_table_iterator(netsnmp_handler_registration *reginfo,
+ netsnmp_iterator_info *iinfo);
+ void netsnmp_iterator_delete_table(netsnmp_iterator_info *iinfo);
+
+ void *netsnmp_extract_iterator_context(netsnmp_request_info *);
+ void netsnmp_insert_iterator_context(netsnmp_request_info *, void *);
+
+ Netsnmp_Node_Handler netsnmp_table_iterator_helper_handler;
+
+#define netsnmp_register_table_iterator2(reginfo, iinfo) \
+ (((iinfo)->flags |= NETSNMP_HANDLER_OWNS_IINFO), \
+ netsnmp_register_table_iterator((reginfo), (iinfo)))
+
+
+/* ============================
+ * Iterator API: Row operations
+ * ============================ */
+
+void *netsnmp_iterator_row_first( netsnmp_iterator_info *);
+void *netsnmp_iterator_row_get( netsnmp_iterator_info *, void *);
+void *netsnmp_iterator_row_next( netsnmp_iterator_info *, void *);
+void *netsnmp_iterator_row_get_byidx( netsnmp_iterator_info *,
+ netsnmp_variable_list *);
+void *netsnmp_iterator_row_next_byidx( netsnmp_iterator_info *,
+ netsnmp_variable_list *);
+void *netsnmp_iterator_row_get_byoid( netsnmp_iterator_info *, oid *, size_t);
+void *netsnmp_iterator_row_next_byoid( netsnmp_iterator_info *, oid *, size_t);
+int netsnmp_iterator_row_count( netsnmp_iterator_info *);
+
+
+/* ============================
+ * Iterator API: Index operations
+ * ============================ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TABLE_ITERATOR_HANDLER_H_ */
+/** @} */
diff --git a/include/net-snmp/agent/table_tdata.h b/include/net-snmp/agent/table_tdata.h
new file mode 100644
index 0000000..b0a1689
--- /dev/null
+++ b/include/net-snmp/agent/table_tdata.h
@@ -0,0 +1,147 @@
+/*
+ * table_tdata.h
+ */
+#ifndef _TABLE_TDATA_HANDLER_H_
+#define _TABLE_TDATA_HANDLER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * This helper is designed to completely automate the task of storing
+ * tables of data within the agent that are not tied to external data
+ * sources (like the kernel, hardware, or other processes, etc). IE,
+ * all rows within a table are expected to be added manually using
+ * functions found below.
+ */
+
+#define TABLE_TDATA_NAME "table_tdata"
+#define TABLE_TDATA_ROW "table_tdata"
+#define TABLE_TDATA_TABLE "table_tdata_table"
+
+#define TDATA_FLAG_NO_STORE_INDEXES 0x01
+#define TDATA_FLAG_NO_CONTAINER 0x02 /* user will provide container */
+
+ /*
+ * The (table-independent) per-row data structure
+ * This is a wrapper round the table-specific per-row data
+ * structure, which is referred to as a "table entry"
+ *
+ * It should be regarded as an opaque, private data structure,
+ * and shouldn't be accessed directly.
+ */
+ typedef struct netsnmp_tdata_row_s {
+ netsnmp_index oid_index; /* table_container index format */
+ netsnmp_variable_list *indexes; /* stored permanently if store_indexes = 1 */
+ void *data; /* the data to store */
+ } netsnmp_tdata_row;
+
+ /*
+ * The data structure to hold a complete table.
+ *
+ * This should be regarded as an opaque, private data structure,
+ * and shouldn't be accessed directly.
+ */
+ typedef struct netsnmp_tdata_s {
+ netsnmp_variable_list *indexes_template; /* containing only types */
+ char *name; /* if !NULL, it's registered globally */
+ int flags; /* This field may legitimately be accessed by external code */
+ netsnmp_container *container;
+ } netsnmp_tdata;
+
+/* Backwards compatability with the previous (poorly named) data structures */
+typedef struct netsnmp_tdata_row_s netsnmp_table_data2row;
+typedef struct netsnmp_tdata_s netsnmp_table_data2;
+
+
+/* ============================
+ * TData API: Table maintenance
+ * ============================ */
+
+ netsnmp_tdata *netsnmp_tdata_create_table(const char *name, long flags);
+ void netsnmp_tdata_delete_table(netsnmp_tdata *table);
+ netsnmp_tdata_row *netsnmp_tdata_create_row(void);
+ netsnmp_tdata_row *netsnmp_tdata_clone_row( netsnmp_tdata_row *row);
+ int netsnmp_tdata_copy_row( netsnmp_tdata_row *dst_row,
+ netsnmp_tdata_row *src_row);
+ void *netsnmp_tdata_delete_row( netsnmp_tdata_row *row);
+
+ int netsnmp_tdata_add_row( netsnmp_tdata *table,
+ netsnmp_tdata_row *row);
+ void netsnmp_tdata_replace_row( netsnmp_tdata *table,
+ netsnmp_tdata_row *origrow,
+ netsnmp_tdata_row *newrow);
+ netsnmp_tdata_row *netsnmp_tdata_remove_row(netsnmp_tdata *table,
+ netsnmp_tdata_row *row);
+ void *netsnmp_tdata_remove_and_delete_row(netsnmp_tdata *table,
+ netsnmp_tdata_row *row);
+
+
+/* ============================
+ * TData API: MIB maintenance
+ * ============================ */
+
+ netsnmp_mib_handler *netsnmp_get_tdata_handler(netsnmp_tdata *table);
+
+ int netsnmp_tdata_register( netsnmp_handler_registration *reginfo,
+ netsnmp_tdata *table,
+ netsnmp_table_registration_info *table_info);
+ int netsnmp_tdata_unregister(netsnmp_handler_registration *reginfo);
+
+ netsnmp_tdata *netsnmp_tdata_extract_table( netsnmp_request_info *);
+ netsnmp_container *netsnmp_tdata_extract_container(netsnmp_request_info *);
+ netsnmp_tdata_row *netsnmp_tdata_extract_row( netsnmp_request_info *);
+ void *netsnmp_tdata_extract_entry( netsnmp_request_info *);
+
+ void netsnmp_insert_tdata_row(netsnmp_request_info *, netsnmp_tdata_row *);
+ void netsnmp_remove_tdata_row(netsnmp_request_info *, netsnmp_tdata_row *);
+
+
+/* ============================
+ * TData API: Row operations
+ * ============================ */
+
+ void * netsnmp_tdata_row_entry( netsnmp_tdata_row *row );
+ netsnmp_tdata_row *netsnmp_tdata_row_first(netsnmp_tdata *table);
+ netsnmp_tdata_row *netsnmp_tdata_row_get( netsnmp_tdata *table,
+ netsnmp_tdata_row *row);
+ netsnmp_tdata_row *netsnmp_tdata_row_next( netsnmp_tdata *table,
+ netsnmp_tdata_row *row);
+
+ netsnmp_tdata_row *netsnmp_tdata_row_get_byidx(netsnmp_tdata *table,
+ netsnmp_variable_list *indexes);
+ netsnmp_tdata_row *netsnmp_tdata_row_get_byoid(netsnmp_tdata *table,
+ oid *searchfor,
+ size_t searchfor_len);
+ netsnmp_tdata_row *netsnmp_tdata_row_next_byidx(netsnmp_tdata *table,
+ netsnmp_variable_list *indexes);
+ netsnmp_tdata_row *netsnmp_tdata_row_next_byoid(netsnmp_tdata *table,
+ oid *searchfor,
+ size_t searchfor_len);
+
+ int netsnmp_tdata_row_count(netsnmp_tdata *table);
+
+
+/* ============================
+ * TData API: Index operations
+ * ============================ */
+
+#define netsnmp_tdata_add_index(thetable, type) snmp_varlist_add_variable(&thetable->indexes_template, NULL, 0, type, NULL, 0)
+#define netsnmp_tdata_row_add_index(row, type, value, value_len) snmp_varlist_add_variable(&row->indexes, NULL, 0, type, (const u_char *) value, value_len)
+
+ int netsnmp_tdata_compare_idx( netsnmp_tdata_row *row,
+ netsnmp_variable_list *indexes);
+ int netsnmp_tdata_compare_oid( netsnmp_tdata_row *row,
+ oid *compareto, size_t compareto_len);
+ int netsnmp_tdata_compare_subtree_idx(netsnmp_tdata_row *row,
+ netsnmp_variable_list *indexes);
+ int netsnmp_tdata_compare_subtree_oid(netsnmp_tdata_row *row,
+ oid *compareto, size_t compareto_len);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TABLE_TDATA_HANDLER_H_ */
diff --git a/include/net-snmp/agent/var_struct.h b/include/net-snmp/agent/var_struct.h
new file mode 100644
index 0000000..15b5770
--- /dev/null
+++ b/include/net-snmp/agent/var_struct.h
@@ -0,0 +1,116 @@
+#ifndef VAR_STRUCT_H
+#define VAR_STRUCT_H
+/*
+ * The subtree structure contains a subtree prefix which applies to
+ * all variables in the associated variable list.
+ *
+ * By converting to a tree of subtree structures, entries can
+ * now be subtrees of another subtree in the structure. i.e:
+ * 1.2
+ * 1.2.0
+ */
+
+#define UCD_REGISTRY_OID_MAX_LEN 128
+
+/*
+ * subtree flags
+ */
+#define FULLY_QUALIFIED_INSTANCE 0x01
+#define SUBTREE_ATTACHED 0x02
+
+typedef struct netsnmp_subtree_s {
+ oid *name_a; /* objid prefix of registered subtree */
+ u_char namelen; /* number of subid's in name above */
+ oid *start_a; /* objid of start of covered range */
+ u_char start_len; /* number of subid's in start name */
+ oid *end_a; /* objid of end of covered range */
+ u_char end_len; /* number of subid's in end name */
+ struct variable *variables; /* pointer to variables array */
+ int variables_len; /* number of entries in above array */
+ int variables_width; /* sizeof each variable entry */
+ char *label_a; /* calling module's label */
+ netsnmp_session *session;
+ u_char flags;
+ u_char priority;
+ int timeout;
+ struct netsnmp_subtree_s *next; /* List of 'sibling' subtrees */
+ struct netsnmp_subtree_s *prev; /* (doubly-linked list) */
+ struct netsnmp_subtree_s *children; /* List of 'child' subtrees */
+ int range_subid;
+ oid range_ubound;
+ netsnmp_handler_registration *reginfo; /* new API */
+ int cacheid;
+ int global_cacheid;
+ size_t oid_off;
+} netsnmp_subtree;
+
+/*
+ * This is a new variable structure that doesn't have as much memory
+ * tied up in the object identifier. It's elements have also been re-arranged
+ * so that the name field can be variable length. Any number of these
+ * structures can be created with lengths tailor made to a particular
+ * application. The first 5 elements of the structure must remain constant.
+ */
+struct variable1 {
+ u_char magic; /* passed to function as a hint */
+ u_char type; /* type of variable */
+ u_short acl; /* access control list for variable */
+ FindVarMethod *findVar; /* function that finds variable */
+ u_char namelen; /* length of name below */
+ oid name[1]; /* object identifier of variable */
+};
+
+struct variable2 {
+ u_char magic; /* passed to function as a hint */
+ u_char type; /* type of variable */
+ u_short acl; /* access control list for variable */
+ FindVarMethod *findVar; /* function that finds variable */
+ u_char namelen; /* length of name below */
+ oid name[2]; /* object identifier of variable */
+};
+
+struct variable3 {
+ u_char magic; /* passed to function as a hint */
+ u_char type; /* type of variable */
+ u_short acl; /* access control list for variable */
+ FindVarMethod *findVar; /* function that finds variable */
+ u_char namelen; /* length of name below */
+ oid name[3]; /* object identifier of variable */
+};
+
+struct variable4 {
+ u_char magic; /* passed to function as a hint */
+ u_char type; /* type of variable */
+ u_short acl; /* access control list for variable */
+ FindVarMethod *findVar; /* function that finds variable */
+ u_char namelen; /* length of name below */
+ oid name[4]; /* object identifier of variable */
+};
+
+struct variable7 {
+ u_char magic; /* passed to function as a hint */
+ u_char type; /* type of variable */
+ u_short acl; /* access control list for variable */
+ FindVarMethod *findVar; /* function that finds variable */
+ u_char namelen; /* length of name below */
+ oid name[7]; /* object identifier of variable */
+};
+
+struct variable8 {
+ u_char magic; /* passed to function as a hint */
+ u_char type; /* type of variable */
+ u_short acl; /* access control list for variable */
+ FindVarMethod *findVar; /* function that finds variable */
+ u_char namelen; /* length of name below */
+ oid name[8]; /* object identifier of variable */
+};
+
+struct variable13 {
+ u_char magic; /* passed to function as a hint */
+ u_char type; /* type of variable */
+ u_short acl; /* access control list for variable */
+ FindVarMethod *findVar; /* function that finds variable */
+ u_char namelen; /* length of name below */
+ oid name[13]; /* object identifier of variable */
+};
+#endif /* VAR_STRUCT_H */
diff --git a/include/net-snmp/agent/watcher.h b/include/net-snmp/agent/watcher.h
new file mode 100644
index 0000000..67104ee
--- /dev/null
+++ b/include/net-snmp/agent/watcher.h
@@ -0,0 +1,148 @@
+/*
+ * watcher.h
+ */
+#ifndef NETSNMP_WATCHER_H
+#define NETSNMP_WATCHER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @ingroup watcher
+ * @{
+ */
+
+/*
+ * if handler flag has this bit set, the timestamp will be
+ * treated as a pointer to the timestamp. If this bit is
+ * not set (the default), the timestamp is a struct timeval
+ * that must be compared to the agent starttime.
+ */
+#define NETSNMP_WATCHER_DIRECT MIB_HANDLER_CUSTOM1
+
+/** The size of the watched object is constant.
+ * @hideinitializer
+ */
+#define WATCHER_FIXED_SIZE 0x01
+/** The maximum size of the watched object is stored in max_size.
+ * If WATCHER_SIZE_STRLEN is set then it is supposed that max_size + 1
+ * bytes could be stored in the buffer.
+ * @hideinitializer
+ */
+#define WATCHER_MAX_SIZE 0x02
+/** If set then the variable data_size_p points to is supposed to hold the
+ * current size of the watched object and will be updated on writes.
+ * @hideinitializer
+ * @since Net-SNMP 5.5
+ */
+#define WATCHER_SIZE_IS_PTR 0x04
+/** If set then data is suppposed to be a zero-terminated character array
+ * and both data_size and data_size_p are ignored. Additionally \\0 is a
+ * forbidden character in the data set.
+ * @hideinitializer
+ * @since Net-SNMP 5.5
+ */
+#define WATCHER_SIZE_STRLEN 0x08
+/** If set then size is in units of object identifiers.
+ * This is useful if you have an OID and tracks the OID_LENGTH of it as
+ * opposed to it's size.
+ * @hideinitializer
+ * @since Net-SNMP 5.5.1
+ */
+#define WATCHER_SIZE_UNIT_OIDS 0x10
+
+typedef struct netsnmp_watcher_info_s {
+ void *data;
+ size_t data_size;
+ size_t max_size;
+ u_char type;
+ int flags;
+ size_t *data_size_p;
+} netsnmp_watcher_info;
+
+/** @} */
+
+int netsnmp_register_watched_instance( netsnmp_handler_registration *reginfo,
+ netsnmp_watcher_info *winfo);
+int netsnmp_register_watched_instance2(netsnmp_handler_registration *reginfo,
+ netsnmp_watcher_info *winfo);
+int netsnmp_register_watched_scalar( netsnmp_handler_registration *reginfo,
+ netsnmp_watcher_info *winfo);
+int netsnmp_register_watched_scalar2( netsnmp_handler_registration *reginfo,
+ netsnmp_watcher_info *winfo);
+int netsnmp_register_watched_timestamp(netsnmp_handler_registration *reginfo,
+ marker_t timestamp);
+int netsnmp_watched_timestamp_register(netsnmp_mib_handler *whandler,
+ netsnmp_handler_registration *reginfo,
+ marker_t timestamp);
+int netsnmp_register_watched_spinlock(netsnmp_handler_registration *reginfo,
+ int *spinlock);
+
+/*
+ * Convenience registration calls
+ */
+
+int netsnmp_register_ulong_scalar(const char *name,
+ const oid * reg_oid, size_t reg_oid_len,
+ u_long * it,
+ Netsnmp_Node_Handler * subhandler);
+int netsnmp_register_read_only_ulong_scalar(const char *name,
+ const oid * reg_oid, size_t reg_oid_len,
+ u_long * it,
+ Netsnmp_Node_Handler * subhandler);
+int netsnmp_register_long_scalar(const char *name,
+ const oid * reg_oid, size_t reg_oid_len,
+ long * it,
+ Netsnmp_Node_Handler * subhandler);
+int netsnmp_register_read_only_long_scalar(const char *name,
+ const oid * reg_oid, size_t reg_oid_len,
+ long * it,
+ Netsnmp_Node_Handler * subhandler);
+int netsnmp_register_int_scalar(const char *name,
+ const oid * reg_oid, size_t reg_oid_len,
+ int * it,
+ Netsnmp_Node_Handler * subhandler);
+int netsnmp_register_read_only_int_scalar(const char *name,
+ const oid * reg_oid, size_t reg_oid_len,
+ int * it,
+ Netsnmp_Node_Handler * subhandler);
+int netsnmp_register_read_only_counter32_scalar(const char *name,
+ const oid * reg_oid, size_t reg_oid_len,
+ u_long * it,
+ Netsnmp_Node_Handler * subhandler);
+
+#define WATCHER_HANDLER_NAME "watcher"
+
+netsnmp_mib_handler *netsnmp_get_watcher_handler(void);
+
+netsnmp_watcher_info *
+netsnmp_init_watcher_info(netsnmp_watcher_info *, void *, size_t, u_char, int);
+
+netsnmp_watcher_info *
+netsnmp_init_watcher_info6(netsnmp_watcher_info *,
+ void *, size_t, u_char, int, size_t, size_t*);
+
+netsnmp_watcher_info *
+netsnmp_create_watcher_info(void *, size_t, u_char, int);
+
+netsnmp_watcher_info *
+netsnmp_create_watcher_info6(void *, size_t, u_char, int, size_t, size_t*);
+
+netsnmp_watcher_info *
+netsnmp_clone_watcher_info(netsnmp_watcher_info *winfo);
+void
+netsnmp_owns_watcher_info(netsnmp_mib_handler *handler);
+
+Netsnmp_Node_Handler netsnmp_watcher_helper_handler;
+
+netsnmp_mib_handler *netsnmp_get_watched_timestamp_handler(void);
+Netsnmp_Node_Handler netsnmp_watched_timestamp_handler;
+
+netsnmp_mib_handler *netsnmp_get_watched_spinlock_handler(void);
+Netsnmp_Node_Handler netsnmp_watched_spinlock_handler;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /** NETSNMP_WATCHER_H */