You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
[MCOL-69] autotools - finish integrating newer net-snmp
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,159 +0,0 @@
|
||||
netsnmp_HEADERS = \
|
||||
config_api.h \
|
||||
definitions.h \
|
||||
mib_api.h \
|
||||
net-snmp-config.h \
|
||||
net-snmp-includes.h \
|
||||
output_api.h \
|
||||
pdu_api.h \
|
||||
session_api.h \
|
||||
snmpv3_api.h \
|
||||
types.h \
|
||||
utilities.h \
|
||||
varbind_api.h \
|
||||
version.h
|
||||
|
||||
netsnmpsys_HEADERS = \
|
||||
system/aix.h \
|
||||
system/bsd.h \
|
||||
system/bsdi.h \
|
||||
system/bsdi3.h \
|
||||
system/bsdi4.h \
|
||||
system/cygwin.h \
|
||||
system/darwin.h \
|
||||
system/darwin7.h \
|
||||
system/dynix.h \
|
||||
system/freebsd.h \
|
||||
system/freebsd2.h \
|
||||
system/freebsd3.h \
|
||||
system/freebsd4.h \
|
||||
system/freebsd5.h \
|
||||
system/freebsd6.h \
|
||||
system/generic.h \
|
||||
system/hpux.h \
|
||||
system/irix.h \
|
||||
system/linux.h \
|
||||
system/mingw32.h \
|
||||
system/mips.h \
|
||||
system/netbsd.h \
|
||||
system/openbsd.h \
|
||||
system/osf5.h \
|
||||
system/solaris.h \
|
||||
system/solaris2.6.h \
|
||||
system/solaris2.7.h \
|
||||
system/solaris2.8.h \
|
||||
system/solaris2.9.h \
|
||||
system/sunos.h \
|
||||
system/svr5.h \
|
||||
system/sysv.h \
|
||||
system/ultrix4.h
|
||||
|
||||
netsnmpmach_HEADERS = \
|
||||
machine/generic.h
|
||||
|
||||
netsnmplibr_HEADERS = \
|
||||
library/README \
|
||||
library/asn1.h \
|
||||
library/callback.h \
|
||||
library/check_varbind.h \
|
||||
library/cmu_compat.h \
|
||||
library/container.h \
|
||||
library/container_binary_array.h \
|
||||
library/container_iterator.h \
|
||||
library/container_list_ssll.h \
|
||||
library/container_null.h \
|
||||
library/data_list.h \
|
||||
library/default_store.h \
|
||||
library/factory.h \
|
||||
library/getopt.h \
|
||||
library/int64.h \
|
||||
library/keytools.h \
|
||||
library/lcd_time.h \
|
||||
library/md5.h \
|
||||
library/mib.h \
|
||||
library/mt_support.h \
|
||||
library/oid_stash.h \
|
||||
library/parse.h \
|
||||
library/read_config.h \
|
||||
library/scapi.h \
|
||||
library/snmp-tc.h \
|
||||
library/snmp.h \
|
||||
library/snmpCallbackDomain.h \
|
||||
library/snmpTCPDomain.h \
|
||||
library/snmpUDPDomain.h \
|
||||
library/snmpUnixDomain.h \
|
||||
library/snmp_alarm.h \
|
||||
library/snmp_api.h \
|
||||
library/snmp_assert.h \
|
||||
library/snmp_client.h \
|
||||
library/snmp_debug.h \
|
||||
library/snmp_enum.h \
|
||||
library/snmp_impl.h \
|
||||
library/snmp_locking.h \
|
||||
library/snmp_logging.h \
|
||||
library/snmp_parse_args.h \
|
||||
library/snmp_secmod.h \
|
||||
library/snmp_transport.h \
|
||||
library/snmpusm.h \
|
||||
library/snmpv3-security-includes.h \
|
||||
library/snmpv3.h \
|
||||
library/system.h \
|
||||
library/tools.h \
|
||||
library/transform_oids.h \
|
||||
library/ucd_compat.h \
|
||||
library/vacm.h \
|
||||
library/winpipe.h \
|
||||
library/winservice.h
|
||||
|
||||
netsnmpagnt_HEADERS = \
|
||||
agent/agent_callbacks.h \
|
||||
agent/agent_handler.h \
|
||||
agent/agent_index.h \
|
||||
agent/agent_module_config.h \
|
||||
agent/agent_read_config.h \
|
||||
agent/agent_registry.h \
|
||||
agent/agent_trap.h \
|
||||
agent/all_helpers.h \
|
||||
agent/auto_nlist.h \
|
||||
agent/baby_steps.h \
|
||||
agent/bulk_to_next.h \
|
||||
agent/cache_handler.h \
|
||||
agent/debug_handler.h \
|
||||
agent/ds_agent.h \
|
||||
agent/instance.h \
|
||||
agent/mfd.h \
|
||||
agent/mib_module_config.h \
|
||||
agent/mib_module_includes.h \
|
||||
agent/mib_modules.h \
|
||||
agent/mode_end_call.h \
|
||||
agent/multiplexer.h \
|
||||
agent/net-snmp-agent-includes.h \
|
||||
agent/null.h \
|
||||
agent/old_api.h \
|
||||
agent/read_only.h \
|
||||
agent/row_merge.h \
|
||||
agent/scalar.h \
|
||||
agent/scalar_group.h \
|
||||
agent/serialize.h \
|
||||
agent/set_helper.h \
|
||||
agent/snmp_agent.h \
|
||||
agent/snmp_vars.h \
|
||||
agent/table.h \
|
||||
agent/table_array.h \
|
||||
agent/table_container.h \
|
||||
agent/table_data.h \
|
||||
agent/table_dataset.h \
|
||||
agent/table_iterator.h \
|
||||
agent/var_struct.h \
|
||||
agent/watcher.h
|
||||
|
||||
test:
|
||||
|
||||
coverage:
|
||||
|
||||
leakcheck:
|
||||
|
||||
docs:
|
||||
|
||||
bootstrap: install-data-am
|
||||
|
@ -1,18 +0,0 @@
|
||||
#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
|
||||
|
||||
#endif /* AGENT_CALLBACKS_H */
|
@ -1,266 +0,0 @@
|
||||
/* 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 <20> 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: The last 4 bits are reserved for the handler's own use.
|
||||
*/
|
||||
#define MIB_HANDLER_AUTO_NEXT 0x00000001
|
||||
#define MIB_HANDLER_AUTO_NEXT_OVERRIDE_ONCE 0x00000002
|
||||
|
||||
#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 snmp_agent.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 *);
|
||||
|
||||
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_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,
|
||||
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, oid *reg_oid,
|
||||
size_t reg_oid_len, int modes);
|
||||
|
||||
NETSNMP_INLINE netsnmp_delegated_cache
|
||||
*netsnmp_create_delegated_cache(netsnmp_mib_handler *,
|
||||
netsnmp_handler_registration *,
|
||||
netsnmp_agent_request_info *,
|
||||
netsnmp_request_info *, void *);
|
||||
NETSNMP_INLINE void netsnmp_free_delegated_cache(netsnmp_delegated_cache
|
||||
*dcache);
|
||||
NETSNMP_INLINE 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);
|
||||
|
||||
NETSNMP_INLINE void
|
||||
netsnmp_request_add_list_data(netsnmp_request_info *request,
|
||||
netsnmp_data_list *node);
|
||||
|
||||
NETSNMP_INLINE int
|
||||
netsnmp_request_remove_list_data(netsnmp_request_info *request,
|
||||
const char *name);
|
||||
|
||||
NETSNMP_INLINE void *netsnmp_request_get_list_data(netsnmp_request_info
|
||||
*request,
|
||||
const char *name);
|
||||
|
||||
NETSNMP_INLINE void
|
||||
netsnmp_free_request_data_set(netsnmp_request_info *request);
|
||||
|
||||
NETSNMP_INLINE 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 */
|
||||
/** @} */
|
@ -1,46 +0,0 @@
|
||||
#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 */
|
@ -1,28 +0,0 @@
|
||||
/* This file is automatically generated by configure. Do not modify by hand. */
|
||||
/* Define if compiling with the snmpv3/usmConf module files. */
|
||||
#define USING_SNMPV3_USMCONF_MODULE 1
|
||||
|
||||
/* Define if compiling with the agentx/master module files. */
|
||||
#define USING_AGENTX_MASTER_MODULE 1
|
||||
|
||||
/* Define if compiling with the agentx/subagent module files. */
|
||||
#define USING_AGENTX_SUBAGENT_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/vacm_conf module files. */
|
||||
#define USING_MIBII_VACM_CONF_MODULE 1
|
||||
|
||||
/* Define if compiling with the utilities/execute module files. */
|
||||
#define USING_UTILITIES_EXECUTE_MODULE 1
|
||||
|
||||
/* Define if compiling with the agentx/protocol module files. */
|
||||
#define USING_AGENTX_PROTOCOL_MODULE 1
|
||||
|
||||
/* Define if compiling with the agentx/client module files. */
|
||||
#define USING_AGENTX_CLIENT_MODULE 1
|
||||
|
||||
/* Define if compiling with the agentx/master_admin module files. */
|
||||
#define USING_AGENTX_MASTER_ADMIN_MODULE 1
|
||||
|
||||
/* Define if compiling with the agentx/agentx_config module files. */
|
||||
#define USING_AGENTX_AGENTX_CONFIG_MODULE 1
|
||||
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* 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 *,
|
||||
void (*parser) (const
|
||||
char *,
|
||||
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 */
|
@ -1,204 +0,0 @@
|
||||
#ifndef AGENT_REGISTRY_H
|
||||
#define AGENT_REGISTRY_H
|
||||
|
||||
/***********************************************************************/
|
||||
/*
|
||||
* new version2 agent handler API structures
|
||||
*/
|
||||
/***********************************************************************/
|
||||
|
||||
#include <net-snmp/agent/snmp_agent.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;
|
||||
};
|
||||
|
||||
typedef struct subtree_context_cache_s {
|
||||
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 (oid *, size_t, netsnmp_subtree *,
|
||||
const char *context_name);
|
||||
|
||||
netsnmp_subtree *netsnmp_subtree_find_next(oid *, size_t, netsnmp_subtree *,
|
||||
const char *context_name);
|
||||
|
||||
netsnmp_subtree *netsnmp_subtree_find_prev(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 (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, oid *, size_t);
|
||||
|
||||
int register_mib_priority (const char *, struct variable *,
|
||||
size_t, size_t, oid *, size_t,
|
||||
int);
|
||||
|
||||
int register_mib_range (const char *, struct variable *,
|
||||
size_t, size_t, oid *, size_t,
|
||||
int, int, oid, netsnmp_session *);
|
||||
|
||||
int register_mib_context (const char *, struct variable *,
|
||||
size_t, size_t, 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_FDS 32
|
||||
#define FD_REGISTERED_OK 0
|
||||
#define FD_REGISTRATION_FAILED -2
|
||||
#define FD_UNREGISTERED_OK 0
|
||||
#define FD_NO_SUCH_REGISTRATION -1
|
||||
|
||||
extern int external_readfd[NUM_EXTERNAL_FDS], external_readfdlen;
|
||||
extern int external_writefd[NUM_EXTERNAL_FDS], external_writefdlen;
|
||||
extern int external_exceptfd[NUM_EXTERNAL_FDS], external_exceptfdlen;
|
||||
|
||||
extern void (*external_readfdfunc[NUM_EXTERNAL_FDS]) (int, void *);
|
||||
extern void (*external_writefdfunc[NUM_EXTERNAL_FDS]) (int, void *);
|
||||
extern void (*external_exceptfdfunc[NUM_EXTERNAL_FDS]) (int, void *);
|
||||
|
||||
extern void *external_readfd_data[NUM_EXTERNAL_FDS];
|
||||
extern void *external_writefd_data[NUM_EXTERNAL_FDS];
|
||||
extern void *external_exceptfd_data[NUM_EXTERNAL_FDS];
|
||||
|
||||
int register_readfd(int, void (*func)(int, void *), void *);
|
||||
int register_writefd(int, void (*func)(int, void *), void *);
|
||||
int register_exceptfd(int, void (*func)(int, void *), void *);
|
||||
int unregister_readfd(int);
|
||||
int unregister_writefd(int);
|
||||
int unregister_exceptfd(int);
|
||||
|
||||
|
||||
|
||||
#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 */
|
@ -1,50 +0,0 @@
|
||||
#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_trap_vars(int, int, netsnmp_variable_list *);
|
||||
void send_enterprise_trap_vars(int trap, int specific,
|
||||
oid * enterprise,
|
||||
int enterprise_length,
|
||||
netsnmp_variable_list * vars);
|
||||
int netsnmp_send_traps(int trap, int specific,
|
||||
oid * enterprise, int enterprise_length,
|
||||
netsnmp_variable_list * vars,
|
||||
/* These next two are currently unused */
|
||||
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(const char *, u_short, const 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 */
|
@ -1,43 +0,0 @@
|
||||
#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_iterator.h>
|
||||
#include <net-snmp/agent/table_container.h>
|
||||
/*
|
||||
* #include <net-snmp/agent/table_array.h>
|
||||
*/
|
||||
|
||||
#include <net-snmp/agent/mfd.h>
|
||||
|
||||
|
||||
void netsnmp_init_helpers(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* ALL_HANDLERS_H */
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* 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 CAN_USE_NLIST
|
||||
int auto_nlist(const char *, char *, int);
|
||||
long auto_nlist_value(const char *);
|
||||
int KNLookup(struct nlist *, int, char *, int);
|
||||
#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
|
@ -1,109 +0,0 @@
|
||||
/*
|
||||
* $Id: baby_steps.h,v 1.7 2004/09/14 02:29:15 rstory Exp $
|
||||
*/
|
||||
#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)
|
||||
#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)
|
||||
#define BABY_STEP_POST_REQUEST (0x1 << 13)
|
||||
|
||||
#define BABY_STEP_ALL (0xffffffff)
|
||||
|
||||
|
||||
#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
|
||||
|
||||
/** @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 {
|
||||
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;
|
||||
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;
|
||||
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 */
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* 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
|
@ -1,111 +0,0 @@
|
||||
#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 {
|
||||
/*
|
||||
* 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 timestamp; /* 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
|
||||
*/
|
||||
void *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 *,
|
||||
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,
|
||||
oid * rootoid, int rootoid_len);
|
||||
netsnmp_mib_handler *
|
||||
netsnmp_cache_handler_get(netsnmp_cache* cache);
|
||||
|
||||
netsnmp_cache * netsnmp_cache_find_by_oid(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_HINT_HANDLER_ARGS 0x1000
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* NETSNMP_CACHE_HANDLER_H */
|
@ -1,16 +0,0 @@
|
||||
#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 */
|
@ -1,45 +0,0 @@
|
||||
#ifndef NETSNMP_DS_AGENT_H
|
||||
#define NETSNMP_DS_AGENT_H
|
||||
/*
|
||||
* defines agent's default store registrations
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
|
||||
#endif
|
@ -1,148 +0,0 @@
|
||||
/*
|
||||
* testhandler.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,
|
||||
oid * reg_oid,
|
||||
size_t
|
||||
reg_oid_len,
|
||||
u_long * it,
|
||||
Netsnmp_Node_Handler
|
||||
* subhandler);
|
||||
int netsnmp_register_ulong_instance(const char *name,
|
||||
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,
|
||||
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,
|
||||
oid * reg_oid,
|
||||
size_t
|
||||
reg_oid_len,
|
||||
long *it,
|
||||
Netsnmp_Node_Handler
|
||||
* subhandler);
|
||||
int netsnmp_register_long_instance(const char *name,
|
||||
oid * reg_oid,
|
||||
size_t reg_oid_len,
|
||||
long *it,
|
||||
Netsnmp_Node_Handler *
|
||||
subhandler);
|
||||
|
||||
int netsnmp_register_read_only_int_instance(const char *name,
|
||||
oid * reg_oid,
|
||||
size_t reg_oid_len, int *it,
|
||||
Netsnmp_Node_Handler *
|
||||
subhandler);
|
||||
|
||||
int netsnmp_register_int_instance(const char *name,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
oid * reg_oid,
|
||||
size_t reg_oid_len, int *it,
|
||||
Netsnmp_Node_Handler *
|
||||
subhandler,
|
||||
const char *contextName);
|
||||
|
||||
Netsnmp_Node_Handler netsnmp_instance_helper_handler;
|
||||
Netsnmp_Node_Handler netsnmp_instance_ulong_handler;
|
||||
Netsnmp_Node_Handler netsnmp_instance_long_handler;
|
||||
Netsnmp_Node_Handler netsnmp_instance_int_handler;
|
||||
Netsnmp_Node_Handler netsnmp_instance_counter32_handler;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /** NETSNMP_INSTANCE_H */
|
@ -1,81 +0,0 @@
|
||||
/*
|
||||
* MIBs For Dummies header
|
||||
*
|
||||
* $Id: mfd.h,v 1.3.2.1 2004/12/10 14:50:38 rstory Exp $
|
||||
*/
|
||||
#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 1 */
|
||||
#define MFD_ROW_FLAG_USER_3 0x00000004 /* user flag 1 */
|
||||
#define MFD_ROW_FLAG_USER_4 0x00000008 /* user flag 1 */
|
||||
#define MFD_ROW_FLAG_USER_5 0x00000010 /* user flag 1 */
|
||||
#define MFD_ROW_FLAG_USER_6 0x00000020 /* user flag 1 */
|
||||
#define MFD_ROW_FLAG_USER_7 0x00000040 /* user flag 1 */
|
||||
#define MFD_ROW_FLAG_USER_8 0x00000080 /* user flag 1 */
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
* MFD flags
|
||||
*
|
||||
* grow left to right, in case we want to add more user flags later
|
||||
*/
|
||||
#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 */
|
||||
|
||||
|
||||
#endif /* NETSNMP_MFD_H */
|
@ -1,220 +0,0 @@
|
||||
/* This file is automatically generated by configure. Do not modify by hand. */
|
||||
/* Define if compiling with the mibII module files. */
|
||||
#define USING_MIBII_MODULE 1
|
||||
|
||||
/* Define if compiling with the ucd_snmp module files. */
|
||||
#define USING_UCD_SNMP_MODULE 1
|
||||
|
||||
/* Define if compiling with the snmpv3mibs module files. */
|
||||
#define USING_SNMPV3MIBS_MODULE 1
|
||||
|
||||
/* Define if compiling with the notification module files. */
|
||||
#define USING_NOTIFICATION_MODULE 1
|
||||
|
||||
/* Define if compiling with the target module files. */
|
||||
#define USING_TARGET_MODULE 1
|
||||
|
||||
/* Define if compiling with the agent_mibs module files. */
|
||||
#define USING_AGENT_MIBS_MODULE 1
|
||||
|
||||
/* Define if compiling with the agentx module files. */
|
||||
#define USING_AGENTX_MODULE 1
|
||||
|
||||
/* Define if compiling with the utilities module files. */
|
||||
#define USING_UTILITIES_MODULE 1
|
||||
|
||||
/* Define if compiling with the disman/event-mib module files. */
|
||||
#define USING_DISMAN_EVENT_MIB_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/system_mib module files. */
|
||||
#define USING_MIBII_SYSTEM_MIB_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/sysORTable module files. */
|
||||
#define USING_MIBII_SYSORTABLE_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/at module files. */
|
||||
#define USING_MIBII_AT_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/interfaces module files. */
|
||||
#define USING_MIBII_INTERFACES_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/ip module files. */
|
||||
#define USING_MIBII_IP_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/snmp_mib module files. */
|
||||
#define USING_MIBII_SNMP_MIB_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/tcp module files. */
|
||||
#define USING_MIBII_TCP_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/icmp module files. */
|
||||
#define USING_MIBII_ICMP_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/udp module files. */
|
||||
#define USING_MIBII_UDP_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/vacm_vars module files. */
|
||||
#define USING_MIBII_VACM_VARS_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/setSerialNo module files. */
|
||||
#define USING_MIBII_SETSERIALNO_MODULE 1
|
||||
|
||||
/* Define if compiling with the ucd-snmp/memory module files. */
|
||||
#define USING_UCD_SNMP_MEMORY_MODULE 1
|
||||
|
||||
/* Define if compiling with the ucd-snmp/vmstat module files. */
|
||||
#define USING_UCD_SNMP_VMSTAT_MODULE 1
|
||||
|
||||
/* Define if compiling with the ucd-snmp/proc module files. */
|
||||
#define USING_UCD_SNMP_PROC_MODULE 1
|
||||
|
||||
/* Define if compiling with the ucd-snmp/versioninfo module files. */
|
||||
#define USING_UCD_SNMP_VERSIONINFO_MODULE 1
|
||||
|
||||
/* Define if compiling with the ucd-snmp/pass module files. */
|
||||
#define USING_UCD_SNMP_PASS_MODULE 1
|
||||
|
||||
/* Define if compiling with the ucd-snmp/pass_persist module files. */
|
||||
#define USING_UCD_SNMP_PASS_PERSIST_MODULE 1
|
||||
|
||||
/* Define if compiling with the ucd-snmp/disk module files. */
|
||||
#define USING_UCD_SNMP_DISK_MODULE 1
|
||||
|
||||
/* Define if compiling with the ucd-snmp/loadave module files. */
|
||||
#define USING_UCD_SNMP_LOADAVE_MODULE 1
|
||||
|
||||
/* Define if compiling with the ucd-snmp/extensible module files. */
|
||||
#define USING_UCD_SNMP_EXTENSIBLE_MODULE 1
|
||||
|
||||
/* Define if compiling with the agent/extend module files. */
|
||||
#define USING_AGENT_EXTEND_MODULE 1
|
||||
|
||||
/* Define if compiling with the ucd-snmp/errormib module files. */
|
||||
#define USING_UCD_SNMP_ERRORMIB_MODULE 1
|
||||
|
||||
/* Define if compiling with the ucd-snmp/file module files. */
|
||||
#define USING_UCD_SNMP_FILE_MODULE 1
|
||||
|
||||
/* Define if compiling with the ucd-snmp/dlmod module files. */
|
||||
#define USING_UCD_SNMP_DLMOD_MODULE 1
|
||||
|
||||
/* Define if compiling with the ucd-snmp/proxy module files. */
|
||||
#define USING_UCD_SNMP_PROXY_MODULE 1
|
||||
|
||||
/* Define if compiling with the ucd-snmp/logmatch module files. */
|
||||
#define USING_UCD_SNMP_LOGMATCH_MODULE 1
|
||||
|
||||
/* Define if compiling with the snmpv3/snmpEngine module files. */
|
||||
#define USING_SNMPV3_SNMPENGINE_MODULE 1
|
||||
|
||||
/* Define if compiling with the snmpv3/snmpMPDStats module files. */
|
||||
#define USING_SNMPV3_SNMPMPDSTATS_MODULE 1
|
||||
|
||||
/* Define if compiling with the snmpv3/usmStats module files. */
|
||||
#define USING_SNMPV3_USMSTATS_MODULE 1
|
||||
|
||||
/* Define if compiling with the snmpv3/usmUser module files. */
|
||||
#define USING_SNMPV3_USMUSER_MODULE 1
|
||||
|
||||
/* Define if compiling with the notification/snmpNotifyTable module files. */
|
||||
#define USING_NOTIFICATION_SNMPNOTIFYTABLE_MODULE 1
|
||||
|
||||
/* Define if compiling with the notification/snmpNotifyFilterTable module files. */
|
||||
#define USING_NOTIFICATION_SNMPNOTIFYFILTERTABLE_MODULE 1
|
||||
|
||||
/* Define if compiling with the notification/snmpNotifyFilterProfileTable module files. */
|
||||
#define USING_NOTIFICATION_SNMPNOTIFYFILTERPROFILETABLE_MODULE 1
|
||||
|
||||
/* Define if compiling with the target/snmpTargetAddrEntry module files. */
|
||||
#define USING_TARGET_SNMPTARGETADDRENTRY_MODULE 1
|
||||
|
||||
/* Define if compiling with the target/snmpTargetParamsEntry module files. */
|
||||
#define USING_TARGET_SNMPTARGETPARAMSENTRY_MODULE 1
|
||||
|
||||
/* Define if compiling with the target/target module files. */
|
||||
#define USING_TARGET_TARGET_MODULE 1
|
||||
|
||||
/* Define if compiling with the target/target_counters module files. */
|
||||
#define USING_TARGET_TARGET_COUNTERS_MODULE 1
|
||||
|
||||
/* Define if compiling with the agent/nsTransactionTable module files. */
|
||||
#define USING_AGENT_NSTRANSACTIONTABLE_MODULE 1
|
||||
|
||||
/* Define if compiling with the agent/nsModuleTable module files. */
|
||||
#define USING_AGENT_NSMODULETABLE_MODULE 1
|
||||
|
||||
/* Define if compiling with the agent/nsDebug module files. */
|
||||
#define USING_AGENT_NSDEBUG_MODULE 1
|
||||
|
||||
/* Define if compiling with the agent/nsCache module files. */
|
||||
#define USING_AGENT_NSCACHE_MODULE 1
|
||||
|
||||
/* Define if compiling with the agent/nsLogging module files. */
|
||||
#define USING_AGENT_NSLOGGING_MODULE 1
|
||||
|
||||
/* Define if compiling with the utilities/override module files. */
|
||||
#define USING_UTILITIES_OVERRIDE_MODULE 1
|
||||
|
||||
/* Define if compiling with the disman/mteTriggerTable module files. */
|
||||
#define USING_DISMAN_MTETRIGGERTABLE_MODULE 1
|
||||
|
||||
/* Define if compiling with the disman/mteTriggerDeltaTable module files. */
|
||||
#define USING_DISMAN_MTETRIGGERDELTATABLE_MODULE 1
|
||||
|
||||
/* Define if compiling with the disman/mteTriggerExistenceTable module files. */
|
||||
#define USING_DISMAN_MTETRIGGEREXISTENCETABLE_MODULE 1
|
||||
|
||||
/* Define if compiling with the disman/mteTriggerBooleanTable module files. */
|
||||
#define USING_DISMAN_MTETRIGGERBOOLEANTABLE_MODULE 1
|
||||
|
||||
/* Define if compiling with the disman/mteTriggerThresholdTable module files. */
|
||||
#define USING_DISMAN_MTETRIGGERTHRESHOLDTABLE_MODULE 1
|
||||
|
||||
/* Define if compiling with the disman/mteObjectsTable module files. */
|
||||
#define USING_DISMAN_MTEOBJECTSTABLE_MODULE 1
|
||||
|
||||
/* Define if compiling with the disman/mteEventTable module files. */
|
||||
#define USING_DISMAN_MTEEVENTTABLE_MODULE 1
|
||||
|
||||
/* Define if compiling with the disman/mteEventNotificationTable module files. */
|
||||
#define USING_DISMAN_MTEEVENTNOTIFICATIONTABLE_MODULE 1
|
||||
|
||||
/* Define if compiling with the util_funcs module files. */
|
||||
#define USING_UTIL_FUNCS_MODULE 1
|
||||
|
||||
/* Define if compiling with the if-mib/data_access/interface module files. */
|
||||
#define USING_IF_MIB_DATA_ACCESS_INTERFACE_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/var_route module files. */
|
||||
#define USING_MIBII_VAR_ROUTE_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/kernel_linux module files. */
|
||||
#define USING_MIBII_KERNEL_LINUX_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/ipAddr module files. */
|
||||
#define USING_MIBII_IPADDR_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/route_write module files. */
|
||||
#define USING_MIBII_ROUTE_WRITE_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/tcpTable module files. */
|
||||
#define USING_MIBII_TCPTABLE_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/udpTable module files. */
|
||||
#define USING_MIBII_UDPTABLE_MODULE 1
|
||||
|
||||
/* Define if compiling with the mibII/vacm_context module files. */
|
||||
#define USING_MIBII_VACM_CONTEXT_MODULE 1
|
||||
|
||||
/* Define if compiling with the header_complex module files. */
|
||||
#define USING_HEADER_COMPLEX_MODULE 1
|
||||
|
||||
/* Define if compiling with the if-mib/data_access/interface_common module files. */
|
||||
#define USING_IF_MIB_DATA_ACCESS_INTERFACE_COMMON_MODULE 1
|
||||
|
||||
/* Define if compiling with the if-mib/data_access/interface_linux module files. */
|
||||
#define USING_IF_MIB_DATA_ACCESS_INTERFACE_LINUX_MODULE 1
|
||||
|
||||
/* Define if compiling with the if-mib/data_access/interface_ioctl module files. */
|
||||
#define USING_IF_MIB_DATA_ACCESS_INTERFACE_IOCTL_MODULE 1
|
||||
|
@ -1,72 +0,0 @@
|
||||
/* This file is automatically generated by configure. Do not modify by hand. */
|
||||
#include "mibgroup/mibII.h"
|
||||
#include "mibgroup/ucd_snmp.h"
|
||||
#include "mibgroup/snmpv3mibs.h"
|
||||
#include "mibgroup/notification.h"
|
||||
#include "mibgroup/target.h"
|
||||
#include "mibgroup/agent_mibs.h"
|
||||
#include "mibgroup/agentx.h"
|
||||
#include "mibgroup/utilities.h"
|
||||
#include "mibgroup/disman/event-mib.h"
|
||||
#include "mibgroup/mibII/system_mib.h"
|
||||
#include "mibgroup/mibII/sysORTable.h"
|
||||
#include "mibgroup/mibII/at.h"
|
||||
#include "mibgroup/mibII/interfaces.h"
|
||||
#include "mibgroup/mibII/ip.h"
|
||||
#include "mibgroup/mibII/snmp_mib.h"
|
||||
#include "mibgroup/mibII/tcp.h"
|
||||
#include "mibgroup/mibII/icmp.h"
|
||||
#include "mibgroup/mibII/udp.h"
|
||||
#include "mibgroup/mibII/vacm_vars.h"
|
||||
#include "mibgroup/mibII/setSerialNo.h"
|
||||
#include "mibgroup/ucd-snmp/memory.h"
|
||||
#include "mibgroup/ucd-snmp/vmstat.h"
|
||||
#include "mibgroup/ucd-snmp/proc.h"
|
||||
#include "mibgroup/ucd-snmp/versioninfo.h"
|
||||
#include "mibgroup/ucd-snmp/pass.h"
|
||||
#include "mibgroup/ucd-snmp/pass_persist.h"
|
||||
#include "mibgroup/ucd-snmp/disk.h"
|
||||
#include "mibgroup/ucd-snmp/loadave.h"
|
||||
#include "mibgroup/ucd-snmp/extensible.h"
|
||||
#include "mibgroup/agent/extend.h"
|
||||
#include "mibgroup/ucd-snmp/errormib.h"
|
||||
#include "mibgroup/ucd-snmp/file.h"
|
||||
#include "mibgroup/ucd-snmp/dlmod.h"
|
||||
#include "mibgroup/ucd-snmp/proxy.h"
|
||||
#include "mibgroup/ucd-snmp/logmatch.h"
|
||||
#include "mibgroup/snmpv3/snmpEngine.h"
|
||||
#include "mibgroup/snmpv3/snmpMPDStats.h"
|
||||
#include "mibgroup/snmpv3/usmStats.h"
|
||||
#include "mibgroup/snmpv3/usmUser.h"
|
||||
#include "mibgroup/notification/snmpNotifyTable.h"
|
||||
#include "mibgroup/notification/snmpNotifyFilterTable.h"
|
||||
#include "mibgroup/notification/snmpNotifyFilterProfileTable.h"
|
||||
#include "mibgroup/target/snmpTargetAddrEntry.h"
|
||||
#include "mibgroup/target/snmpTargetParamsEntry.h"
|
||||
#include "mibgroup/target/target.h"
|
||||
#include "mibgroup/target/target_counters.h"
|
||||
#include "mibgroup/agent/nsTransactionTable.h"
|
||||
#include "mibgroup/agent/nsModuleTable.h"
|
||||
#include "mibgroup/agent/nsDebug.h"
|
||||
#include "mibgroup/agent/nsCache.h"
|
||||
#include "mibgroup/agent/nsLogging.h"
|
||||
#include "mibgroup/utilities/override.h"
|
||||
#include "mibgroup/disman/mteTriggerTable.h"
|
||||
#include "mibgroup/disman/mteTriggerDeltaTable.h"
|
||||
#include "mibgroup/disman/mteTriggerExistenceTable.h"
|
||||
#include "mibgroup/disman/mteTriggerBooleanTable.h"
|
||||
#include "mibgroup/disman/mteTriggerThresholdTable.h"
|
||||
#include "mibgroup/disman/mteObjectsTable.h"
|
||||
#include "mibgroup/disman/mteEventTable.h"
|
||||
#include "mibgroup/disman/mteEventNotificationTable.h"
|
||||
#include "mibgroup/util_funcs.h"
|
||||
#include "mibgroup/if-mib/data_access/interface.h"
|
||||
#include "mibgroup/mibII/var_route.h"
|
||||
#include "mibgroup/mibII/kernel_linux.h"
|
||||
#include "mibgroup/mibII/ipAddr.h"
|
||||
#include "mibgroup/mibII/route_write.h"
|
||||
#include "mibgroup/mibII/tcpTable.h"
|
||||
#include "mibgroup/mibII/udpTable.h"
|
||||
#include "mibgroup/mibII/vacm_context.h"
|
||||
#include "mibgroup/header_complex.h"
|
||||
#include "mibgroup/if-mib/data_access/interface_ioctl.h"
|
@ -1,23 +0,0 @@
|
||||
#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
|
@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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
|
@ -1,39 +0,0 @@
|
||||
#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 */
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* 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/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>
|
||||
|
||||
#include <net-snmp/agent/mib_module_config.h>
|
||||
#include <net-snmp/agent/agent_module_config.h>
|
||||
|
||||
#endif /* NET_SNMP_AGENT_INCLUDES_H */
|
@ -1,26 +0,0 @@
|
||||
#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
|
@ -1,49 +0,0 @@
|
||||
#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,
|
||||
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 */
|
@ -1,29 +0,0 @@
|
||||
#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
|
@ -1,23 +0,0 @@
|
||||
#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
|
||||
|
||||
netsnmp_mib_handler *netsnmp_get_row_merge_handler(int);
|
||||
int netsnmp_register_row_merge(netsnmp_handler_registration *reginfo);
|
||||
void netsnmp_init_row_merge(void);
|
||||
|
||||
Netsnmp_Node_Handler netsnmp_row_merge_helper_handler;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* 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 */
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* 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 */
|
@ -1,24 +0,0 @@
|
||||
#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
|
@ -1,25 +0,0 @@
|
||||
#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
|
@ -1,305 +0,0 @@
|
||||
/* 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 <20> 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
|
||||
#define MODE_IS_GET(x) ((x >= 128) && (x != -1) && (x != SNMP_MSG_SET))
|
||||
/* #define MODE_IS_GET(x) ((x == SNMP_MSG_GET) || (x == SNMP_MSG_GETNEXT) || (x == SNMP_MSG_GETBULK) || (x == SNMP_MSG_INTERNAL_GET_STASH)) */
|
||||
|
||||
#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)) */
|
||||
|
||||
#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
|
||||
#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
|
||||
|
||||
|
||||
/** @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_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_set_all_requests_error(netsnmp_agent_request_info *reqinfo,
|
||||
netsnmp_request_info *requests,
|
||||
int error_value);
|
||||
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);
|
||||
u_long netsnmp_get_agent_uptime(void);
|
||||
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);
|
||||
|
||||
NETSNMP_INLINE void
|
||||
netsnmp_agent_add_list_data(netsnmp_agent_request_info *agent,
|
||||
netsnmp_data_list *node);
|
||||
|
||||
NETSNMP_INLINE int
|
||||
netsnmp_agent_remove_list_data(netsnmp_agent_request_info *ari,
|
||||
const char * name);
|
||||
|
||||
NETSNMP_INLINE void *
|
||||
netsnmp_agent_get_list_data(netsnmp_agent_request_info
|
||||
*agent, const char *name);
|
||||
|
||||
NETSNMP_INLINE void
|
||||
netsnmp_free_agent_data_set(netsnmp_agent_request_info *agent);
|
||||
|
||||
NETSNMP_INLINE void
|
||||
netsnmp_free_agent_data_sets(netsnmp_agent_request_info *agent);
|
||||
NETSNMP_INLINE void
|
||||
netsnmp_free_agent_request_info(netsnmp_agent_request_info *ari);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
/** @} */
|
@ -1,118 +0,0 @@
|
||||
/*
|
||||
* 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 <20> 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;
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
#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_ */
|
@ -1,195 +0,0 @@
|
||||
/* 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 <20> 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.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);
|
||||
int netsnmp_register_table(netsnmp_handler_registration
|
||||
*reginfo,
|
||||
netsnmp_table_registration_info
|
||||
*tabreq);
|
||||
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_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);
|
||||
|
||||
#if HAVE_STDARG_H
|
||||
void
|
||||
netsnmp_table_helper_add_indexes(netsnmp_table_registration_info
|
||||
*tinfo, ...);
|
||||
#else
|
||||
void netsnmp_table_helper_add_indexes(va_alist);
|
||||
#endif
|
||||
|
||||
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_ */
|
||||
/** @} */
|
@ -1,152 +0,0 @@
|
||||
/*
|
||||
* table_array.h
|
||||
* $Id: table_array.h,v 5.11 2004/09/14 02:29:15 rstory Exp $
|
||||
*/
|
||||
#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;
|
||||
|
||||
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);
|
||||
|
||||
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_ */
|
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* table_container.h
|
||||
* $Id: table_container.h,v 1.7 2004/10/09 02:12:55 rstory Exp $
|
||||
*/
|
||||
#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
|
||||
|
||||
/*
|
||||
* register a container table
|
||||
*/
|
||||
int
|
||||
netsnmp_container_table_register(netsnmp_handler_registration *reginfo,
|
||||
netsnmp_table_registration_info
|
||||
*tabreq,
|
||||
netsnmp_container *container,
|
||||
char key_type);
|
||||
/*
|
||||
* get an injectable containe table handler
|
||||
*/
|
||||
netsnmp_mib_handler *
|
||||
netsnmp_container_table_handler_get(netsnmp_table_registration_info *tabreq,
|
||||
netsnmp_container *container,
|
||||
char key_type);
|
||||
|
||||
/** 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);
|
||||
}
|
||||
#else
|
||||
void *
|
||||
netsnmp_container_table_extract_context(netsnmp_request_info *request);
|
||||
#endif /* inline */
|
||||
|
||||
void netsnmp_container_table_insert_row(netsnmp_request_info *request,
|
||||
netsnmp_index *row);
|
||||
|
||||
/** retrieve the container used by the table_container helper */
|
||||
netsnmp_container*
|
||||
netsnmp_container_table_container_extract(netsnmp_request_info *request);
|
||||
|
||||
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_ */
|
@ -1,114 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
netsnmp_mib_handler *netsnmp_get_table_data_handler(netsnmp_table_data
|
||||
*table);
|
||||
void netsnmp_table_data_generate_index_oid(netsnmp_table_row
|
||||
*row);
|
||||
int netsnmp_table_data_add_row(netsnmp_table_data *table,
|
||||
netsnmp_table_row *row);
|
||||
netsnmp_table_row *netsnmp_table_data_remove_row(netsnmp_table_data
|
||||
*table,
|
||||
netsnmp_table_row
|
||||
*row);
|
||||
void *netsnmp_table_data_delete_row(netsnmp_table_row *row);
|
||||
void
|
||||
*netsnmp_table_data_remove_and_delete_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_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_table_row *netsnmp_extract_table_row(netsnmp_request_info *);
|
||||
netsnmp_table_data *netsnmp_extract_table( netsnmp_request_info *);
|
||||
void *netsnmp_extract_table_row_data(netsnmp_request_info *);
|
||||
void netsnmp_insert_table_row(netsnmp_request_info *, netsnmp_table_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);
|
||||
NETSNMP_INLINE void
|
||||
netsnmp_table_data_replace_row(netsnmp_table_data *table,
|
||||
netsnmp_table_row *origrow,
|
||||
netsnmp_table_row *newrow);
|
||||
|
||||
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);
|
||||
int netsnmp_table_data_num_rows(netsnmp_table_data *table);
|
||||
|
||||
|
||||
#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)
|
||||
|
||||
|
||||
Netsnmp_Node_Handler netsnmp_table_data_helper_handler;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TABLE_DATA_HANDLER_H_ */
|
@ -1,168 +0,0 @@
|
||||
/*
|
||||
* 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 OPAQUE_SPECIAL_TYPES
|
||||
float *floatVal;
|
||||
double *doubleVal;
|
||||
#endif /* 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;
|
||||
|
||||
Netsnmp_Node_Handler netsnmp_table_data_set_helper_handler;
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
/*
|
||||
* to set, add column, type, (writable) ? 1 : 0, ...
|
||||
*/
|
||||
#if HAVE_STDARG_H
|
||||
void
|
||||
netsnmp_table_set_multi_add_default_row(netsnmp_table_data_set *,
|
||||
...);
|
||||
#else
|
||||
void netsnmp_table_set_multi_add_default_row(va_alist);
|
||||
#endif
|
||||
int netsnmp_set_row_column(netsnmp_table_row *,
|
||||
unsigned int, int, const char *,
|
||||
size_t);
|
||||
netsnmp_table_data_set_storage
|
||||
*netsnmp_table_data_set_find_column(netsnmp_table_data_set_storage
|
||||
*, unsigned int);
|
||||
netsnmp_table_data_set_storage
|
||||
*netsnmp_extract_table_data_set_column(netsnmp_request_info *,
|
||||
unsigned int);
|
||||
int
|
||||
netsnmp_register_table_data_set(netsnmp_handler_registration *,
|
||||
netsnmp_table_data_set *,
|
||||
netsnmp_table_registration_info *);
|
||||
netsnmp_mib_handler
|
||||
*netsnmp_get_table_data_set_handler(netsnmp_table_data_set *);
|
||||
netsnmp_table_data_set *netsnmp_create_table_data_set(const char *);
|
||||
int netsnmp_mark_row_column_writable(netsnmp_table_row
|
||||
*row, int column,
|
||||
int writable);
|
||||
NETSNMP_INLINE netsnmp_table_data_set
|
||||
*netsnmp_extract_table_data_set(netsnmp_request_info *request);
|
||||
void netsnmp_config_parse_table_set(const char *token,
|
||||
char *line);
|
||||
void netsnmp_config_parse_add_row(const char *token,
|
||||
char *line);
|
||||
NETSNMP_INLINE void netsnmp_table_dataset_add_index(netsnmp_table_data_set
|
||||
*table, u_char type);
|
||||
NETSNMP_INLINE void netsnmp_table_dataset_add_row(netsnmp_table_data_set
|
||||
*table,
|
||||
netsnmp_table_row *row);
|
||||
NETSNMP_INLINE void netsnmp_table_dataset_remove_row(netsnmp_table_data_set
|
||||
*table,
|
||||
netsnmp_table_row
|
||||
*row);
|
||||
NETSNMP_INLINE void netsnmp_table_dataset_delete_row(netsnmp_table_row
|
||||
*row);
|
||||
NETSNMP_INLINE void
|
||||
netsnmp_table_dataset_remove_and_delete_row(netsnmp_table_data_set
|
||||
*table,
|
||||
netsnmp_table_row
|
||||
*row);
|
||||
NETSNMP_INLINE void
|
||||
netsnmp_table_dataset_delete_all_data
|
||||
(netsnmp_table_data_set_storage *data);
|
||||
NETSNMP_INLINE void
|
||||
netsnmp_table_dataset_replace_row(netsnmp_table_data_set *table,
|
||||
netsnmp_table_row *origrow,
|
||||
netsnmp_table_row *newrow);
|
||||
netsnmp_table_row *netsnmp_table_data_set_clone_row(netsnmp_table_row
|
||||
*row);
|
||||
void netsnmp_register_auto_data_table(netsnmp_table_data_set
|
||||
*table_set,
|
||||
char
|
||||
*registration_name);
|
||||
int netsnmp_table_data_num_rows(netsnmp_table_data *table);
|
||||
|
||||
#if HAVE_STDARG_H
|
||||
void
|
||||
netsnmp_table_set_add_indexes(netsnmp_table_data_set *tset, ...);
|
||||
#else
|
||||
void netsnmp_table_helper_add_indexes(va_alist);
|
||||
#endif
|
||||
|
||||
#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_ */
|
@ -1,138 +0,0 @@
|
||||
/* 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 <20> 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 {
|
||||
/** 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, assiocated 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
|
||||
|
||||
/** A pointer to the netsnmp_table_registration_info object
|
||||
this iterator is registered along with. */
|
||||
netsnmp_table_registration_info *table_reginfo;
|
||||
} netsnmp_iterator_info;
|
||||
|
||||
#define TABLE_ITERATOR_NAME "table_iterator"
|
||||
|
||||
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_extract_iterator_context(netsnmp_request_info
|
||||
*);
|
||||
void netsnmp_insert_iterator_context(netsnmp_request_info
|
||||
*, void *);
|
||||
|
||||
Netsnmp_Node_Handler netsnmp_table_iterator_helper_handler;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TABLE_ITERATOR_HANDLER_H_ */
|
||||
/** @} */
|
@ -1,115 +0,0 @@
|
||||
#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;
|
||||
} 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 */
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* watcher.h
|
||||
*/
|
||||
#ifndef NETSNMP_WATCHER_H
|
||||
#define NETSNMP_WATCHER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define WATCHER_FIXED_SIZE 0x01
|
||||
#define WATCHER_MAX_SIZE 0x02
|
||||
|
||||
typedef struct netsnmp_watcher_info_s {
|
||||
void *data;
|
||||
size_t data_size;
|
||||
size_t max_size;
|
||||
u_char type;
|
||||
int flags;
|
||||
} netsnmp_watcher_info;
|
||||
|
||||
int netsnmp_register_watched_instance( 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_timestamp(netsnmp_handler_registration *reginfo,
|
||||
marker_t timestamp);
|
||||
int netsnmp_register_watched_spinlock(netsnmp_handler_registration *reginfo,
|
||||
int *spinlock);
|
||||
|
||||
#define WATCHER_HANDLER_NAME "watcher"
|
||||
|
||||
netsnmp_mib_handler *netsnmp_get_watcher_handler(void);
|
||||
netsnmp_watcher_info *netsnmp_create_watcher_info(void *, size_t, u_char, int);
|
||||
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 */
|
@ -1,30 +0,0 @@
|
||||
#ifndef NET_SNMP_CONFIG_API_H
|
||||
#define NET_SNMP_CONFIG_API_H
|
||||
|
||||
/**
|
||||
* Library API routines concerned with configuration and control
|
||||
* of the behaviour of the library, agent and other applications.
|
||||
*/
|
||||
|
||||
#include <net-snmp/types.h>
|
||||
|
||||
/*
|
||||
* For the initial release, this will just refer to the
|
||||
* relevant UCD header files.
|
||||
* In due course, the routines relevant to this area of the
|
||||
* API will be identified, and listed here directly.
|
||||
*
|
||||
* But for the time being, this header file is a placeholder,
|
||||
* to allow application writers to adopt the new header file names.
|
||||
*/
|
||||
#include <net-snmp/library/snmp_api.h>
|
||||
|
||||
#include <net-snmp/library/read_config.h>
|
||||
#include <net-snmp/library/default_store.h>
|
||||
|
||||
#include <stdio.h> /* for FILE definition */
|
||||
#include <net-snmp/library/snmp_parse_args.h>
|
||||
#include <net-snmp/library/snmp_enum.h>
|
||||
#include <net-snmp/library/vacm.h>
|
||||
|
||||
#endif /* NET_SNMP_CONFIG_API_H */
|
@ -1,32 +0,0 @@
|
||||
#ifndef NET_SNMP_DEFINITIONS_H
|
||||
#define NET_SNMP_DEFINITIONS_H
|
||||
|
||||
/**
|
||||
* Defined constants, and other similar enumerations.
|
||||
*/
|
||||
|
||||
#define MAX_OID_LEN 128 /* max subid's in an oid */
|
||||
|
||||
#define ONE_SEC 1000000L
|
||||
|
||||
/*
|
||||
* For the initial release, this will just refer to the
|
||||
* relevant UCD header files.
|
||||
* In due course, the relevant definitions will be
|
||||
* identified, and listed here directly.
|
||||
*
|
||||
* But for the time being, this header file is primarily a placeholder,
|
||||
* to allow application writers to adopt the new header file names.
|
||||
*/
|
||||
|
||||
#include <net-snmp/types.h> /* for oid */
|
||||
#include <net-snmp/library/snmp_api.h>
|
||||
#include <net-snmp/library/asn1.h>
|
||||
#include <net-snmp/library/snmp_impl.h>
|
||||
#include <net-snmp/library/snmp.h>
|
||||
#include <net-snmp/library/snmp-tc.h>
|
||||
/*
|
||||
* #include <net-snmp/library/libsnmp.h>
|
||||
*/
|
||||
|
||||
#endif /* NET_SNMP_DEFINITIONS_H */
|
@ -1,67 +0,0 @@
|
||||
One of the goals of the Net-SNMP v5 development line, is to try and
|
||||
clarify the distinction between the "public" library API, and routines
|
||||
that are regarded as being more "internal" to the library.
|
||||
|
||||
This doesn't mean that application writers are discouraged from
|
||||
making use of such internal routines. There is a strong feeling
|
||||
within the development team that as much as possible of the library
|
||||
should be made externally visible, to support writing as wide a
|
||||
range of applications as possible. To that end, most routines
|
||||
will be declared within an installed header file, rather than
|
||||
privately within the library code files themselves.
|
||||
|
||||
The public/internal categorisation is rather concerned with issues
|
||||
of documentation, stability, and ease of programming. The public
|
||||
API routines have been selected as those covering the more common
|
||||
requirements (e.g. creating SNMP requests, sending them to other SNMP
|
||||
agents, and interpreting the results), together with certain supporting
|
||||
activities (e.g. run-time configuration).
|
||||
|
||||
The intention is that these routines should be properly documented,
|
||||
and remain relatively stable. We will attempt to avoid changing the
|
||||
profile of these interfaces, and would normally provide some mechanism
|
||||
to retain backward compatability if need be.
|
||||
|
||||
On the other hand, the internal API routines are regarded as just
|
||||
that - "internal" - so may legitimately be changed without providing
|
||||
any compatability mechanism. You are perfectly free to make use of
|
||||
these routines, but be aware that you do so "at your own risk".
|
||||
|
||||
[This statement is in no way intended to challenge or amend the status
|
||||
of the disclaimers in the top-level 'COPYING' file, which remain
|
||||
unchanged as the legal basis for using this code]
|
||||
|
||||
|
||||
There are (currently) eight main "public API" header files, relating
|
||||
to various areas of SNMP programming, plus a combined "all-in-one"
|
||||
header file (net-snmp-includes.h).
|
||||
Currently these simply include the relevant library header files
|
||||
following the UCD-SNMP organisation. However, the intention is for
|
||||
future releases to declare the public API calls directly within these
|
||||
top-level header files, and use the 'library/*.h' files for the more
|
||||
internal calls. (i.e. those that are more likely to change over time).
|
||||
|
||||
Until this process can be started, the best approximation to the
|
||||
"public API" list is probably those routines that are documented
|
||||
in manual pages. Apologies for any confusion, but hopefully this
|
||||
process will result in a clearer end result than at present.
|
||||
|
||||
Applications writers are encouraged to start #including the new header
|
||||
files as soon as possible - either individually, or using the combined
|
||||
wrapper file. Hopefully, with only a handful of top-level files, it
|
||||
will be reasonably clear which file(s) might be appropriate for any
|
||||
particular programming requirement.
|
||||
|
||||
|
||||
|
||||
One final disclaimer: The above description represents my own
|
||||
personal aims and understanding of the likely development of the
|
||||
library API. While I have every confidence in having the support of
|
||||
the other developers (or being able to persuade them of the benefits
|
||||
of this approach!), it may turn out that things actually take a different
|
||||
route. Anyone wishing to influence the organisation of the eventual
|
||||
library API is encouraged to subscribe to the net-snmp-coders mailing
|
||||
list, and contribute to the discussions there.
|
||||
|
||||
Dave Shield
|
||||
February 2002
|
@ -1,444 +0,0 @@
|
||||
#ifndef ASN1_H
|
||||
#define ASN1_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PARSE_PACKET 0
|
||||
#define DUMP_PACKET 1
|
||||
|
||||
/*
|
||||
* Definitions for Abstract Syntax Notation One, ASN.1
|
||||
* As defined in ISO/IS 8824 and ISO/IS 8825
|
||||
*
|
||||
*
|
||||
*/
|
||||
/***********************************************************
|
||||
Copyright 1988, 1989 by Carnegie Mellon University
|
||||
|
||||
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 not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
CMU 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.
|
||||
******************************************************************/
|
||||
|
||||
|
||||
#ifndef MAX_SUBID /* temporary - duplicate definition protection */
|
||||
#ifndef EIGHTBIT_SUBIDS
|
||||
typedef u_long oid;
|
||||
#define MAX_SUBID 0xFFFFFFFF
|
||||
#else
|
||||
typedef u_char oid;
|
||||
#define MAX_SUBID 0xFF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define MIN_OID_LEN 2
|
||||
#define MAX_OID_LEN 128 /* max subid's in an oid */
|
||||
#ifndef MAX_NAME_LEN /* conflicts with some libraries */
|
||||
#define MAX_NAME_LEN MAX_OID_LEN /* obsolete. use MAX_OID_LEN */
|
||||
#endif
|
||||
|
||||
#define OID_LENGTH(x) (sizeof(x)/sizeof(oid))
|
||||
|
||||
|
||||
#define ASN_BOOLEAN ((u_char)0x01)
|
||||
#define ASN_INTEGER ((u_char)0x02)
|
||||
#define ASN_BIT_STR ((u_char)0x03)
|
||||
#define ASN_OCTET_STR ((u_char)0x04)
|
||||
#define ASN_NULL ((u_char)0x05)
|
||||
#define ASN_OBJECT_ID ((u_char)0x06)
|
||||
#define ASN_SEQUENCE ((u_char)0x10)
|
||||
#define ASN_SET ((u_char)0x11)
|
||||
|
||||
#define ASN_UNIVERSAL ((u_char)0x00)
|
||||
#define ASN_APPLICATION ((u_char)0x40)
|
||||
#define ASN_CONTEXT ((u_char)0x80)
|
||||
#define ASN_PRIVATE ((u_char)0xC0)
|
||||
|
||||
#define ASN_PRIMITIVE ((u_char)0x00)
|
||||
#define ASN_CONSTRUCTOR ((u_char)0x20)
|
||||
|
||||
#define ASN_LONG_LEN (0x80)
|
||||
#define ASN_EXTENSION_ID (0x1F)
|
||||
#define ASN_BIT8 (0x80)
|
||||
|
||||
#define IS_CONSTRUCTOR(byte) ((byte) & ASN_CONSTRUCTOR)
|
||||
#define IS_EXTENSION_ID(byte) (((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
|
||||
|
||||
struct counter64 {
|
||||
u_long high;
|
||||
u_long low;
|
||||
};
|
||||
|
||||
#ifdef OPAQUE_SPECIAL_TYPES
|
||||
typedef struct counter64 integer64;
|
||||
typedef struct counter64 unsigned64;
|
||||
|
||||
/*
|
||||
* The BER inside an OPAQUE is an context specific with a value of 48 (0x30)
|
||||
* plus the "normal" tag. For a Counter64, the tag is 0x46 (i.e., an
|
||||
* applications specific tag with value 6). So the value for a 64 bit
|
||||
* counter is 0x46 + 0x30, or 0x76 (118 base 10). However, values
|
||||
* greater than 30 can not be encoded in one octet. So the first octet
|
||||
* has the class, in this case context specific (ASN_CONTEXT), and
|
||||
* the special value (i.e., 31) to indicate that the real value follows
|
||||
* in one or more octets. The high order bit of each following octet
|
||||
* indicates if the value is encoded in additional octets. A high order
|
||||
* bit of zero, indicates the last. For this "hack", only one octet
|
||||
* will be used for the value.
|
||||
*/
|
||||
|
||||
/*
|
||||
* first octet of the tag
|
||||
*/
|
||||
#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
|
||||
/*
|
||||
* base value for the second octet of the tag - the
|
||||
* second octet was the value for the tag
|
||||
*/
|
||||
#define ASN_OPAQUE_TAG2 ((u_char)0x30)
|
||||
|
||||
#define ASN_OPAQUE_TAG2U ((u_char)0x2f) /* second octet of tag for union */
|
||||
|
||||
/*
|
||||
* All the ASN.1 types for SNMP "should have been" defined in this file,
|
||||
* but they were not. (They are defined in snmp_impl.h) Thus, the tag for
|
||||
* Opaque and Counter64 is defined, again, here with a different names.
|
||||
*/
|
||||
#define ASN_APP_OPAQUE (ASN_APPLICATION | 4)
|
||||
#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
|
||||
#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
|
||||
#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
|
||||
#define ASN_APP_I64 (ASN_APPLICATION | 10)
|
||||
#define ASN_APP_U64 (ASN_APPLICATION | 11)
|
||||
#define ASN_APP_UNION (ASN_PRIVATE | 1) /* or ASN_PRIV_UNION ? */
|
||||
|
||||
/*
|
||||
* value for Counter64
|
||||
*/
|
||||
#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
|
||||
/*
|
||||
* max size of BER encoding of Counter64
|
||||
*/
|
||||
#define ASN_OPAQUE_COUNTER64_MX_BER_LEN 12
|
||||
|
||||
/*
|
||||
* value for Float
|
||||
*/
|
||||
#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
|
||||
/*
|
||||
* size of BER encoding of Float
|
||||
*/
|
||||
#define ASN_OPAQUE_FLOAT_BER_LEN 7
|
||||
|
||||
/*
|
||||
* value for Double
|
||||
*/
|
||||
#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
|
||||
/*
|
||||
* size of BER encoding of Double
|
||||
*/
|
||||
#define ASN_OPAQUE_DOUBLE_BER_LEN 11
|
||||
|
||||
/*
|
||||
* value for Integer64
|
||||
*/
|
||||
#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
|
||||
/*
|
||||
* max size of BER encoding of Integer64
|
||||
*/
|
||||
#define ASN_OPAQUE_I64_MX_BER_LEN 11
|
||||
|
||||
/*
|
||||
* value for Unsigned64
|
||||
*/
|
||||
#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
|
||||
/*
|
||||
* max size of BER encoding of Unsigned64
|
||||
*/
|
||||
#define ASN_OPAQUE_U64_MX_BER_LEN 12
|
||||
|
||||
#endif /* OPAQUE_SPECIAL_TYPES */
|
||||
|
||||
|
||||
#define ASN_PRIV_INCL_RANGE (ASN_PRIVATE | 2)
|
||||
#define ASN_PRIV_EXCL_RANGE (ASN_PRIVATE | 3)
|
||||
#define ASN_PRIV_DELEGATED (ASN_PRIVATE | 5)
|
||||
#define ASN_PRIV_IMPLIED_OCTET_STR (ASN_PRIVATE | ASN_OCTET_STR) /* 4 */
|
||||
#define ASN_PRIV_IMPLIED_OBJECT_ID (ASN_PRIVATE | ASN_OBJECT_ID) /* 6 */
|
||||
#define ASN_PRIV_RETRY (ASN_PRIVATE | 7)
|
||||
#define IS_DELEGATED(x) ((x) == ASN_PRIV_DELEGATED)
|
||||
|
||||
|
||||
int asn_check_packet(u_char *, size_t);
|
||||
u_char *asn_parse_int(u_char *, size_t *, u_char *, long *,
|
||||
size_t);
|
||||
u_char *asn_build_int(u_char *, size_t *, u_char, const long *,
|
||||
size_t);
|
||||
u_char *asn_parse_unsigned_int(u_char *, size_t *, u_char *,
|
||||
u_long *, size_t);
|
||||
u_char *asn_build_unsigned_int(u_char *, size_t *, u_char,
|
||||
const u_long *, size_t);
|
||||
u_char *asn_parse_string(u_char *, size_t *, u_char *,
|
||||
u_char *, size_t *);
|
||||
u_char *asn_build_string(u_char *, size_t *, u_char,
|
||||
const u_char *, size_t);
|
||||
u_char *asn_parse_header(u_char *, size_t *, u_char *);
|
||||
u_char *asn_parse_sequence(u_char *, size_t *, u_char *, u_char expected_type, /* must be this type */
|
||||
const char *estr); /* error message prefix */
|
||||
u_char *asn_build_header(u_char *, size_t *, u_char, size_t);
|
||||
u_char *asn_build_sequence(u_char *, size_t *, u_char, size_t);
|
||||
u_char *asn_parse_length(u_char *, u_long *);
|
||||
u_char *asn_build_length(u_char *, size_t *, size_t);
|
||||
u_char *asn_parse_objid(u_char *, size_t *, u_char *, oid *,
|
||||
size_t *);
|
||||
u_char *asn_build_objid(u_char *, size_t *, u_char, oid *,
|
||||
size_t);
|
||||
u_char *asn_parse_null(u_char *, size_t *, u_char *);
|
||||
u_char *asn_build_null(u_char *, size_t *, u_char);
|
||||
u_char *asn_parse_bitstring(u_char *, size_t *, u_char *,
|
||||
u_char *, size_t *);
|
||||
u_char *asn_build_bitstring(u_char *, size_t *, u_char,
|
||||
const u_char *, size_t);
|
||||
u_char *asn_parse_unsigned_int64(u_char *, size_t *, u_char *,
|
||||
struct counter64 *, size_t);
|
||||
u_char *asn_build_unsigned_int64(u_char *, size_t *, u_char,
|
||||
const struct counter64 *, size_t);
|
||||
u_char *asn_parse_signed_int64(u_char *, size_t *, u_char *,
|
||||
struct counter64 *, size_t);
|
||||
u_char *asn_build_signed_int64(u_char *, size_t *, u_char,
|
||||
const struct counter64 *, size_t);
|
||||
u_char *asn_build_float(u_char *, size_t *, u_char, const float *,
|
||||
size_t);
|
||||
u_char *asn_parse_float(u_char *, size_t *, u_char *, float *,
|
||||
size_t);
|
||||
u_char *asn_build_double(u_char *, size_t *, u_char, const double *,
|
||||
size_t);
|
||||
u_char *asn_parse_double(u_char *, size_t *, u_char *,
|
||||
double *, size_t);
|
||||
|
||||
#ifdef USE_REVERSE_ASNENCODING
|
||||
|
||||
/*
|
||||
* Re-allocator function for below.
|
||||
*/
|
||||
|
||||
int asn_realloc(u_char **, size_t *);
|
||||
|
||||
/*
|
||||
* Re-allocating reverse ASN.1 encoder functions. Synopsis:
|
||||
*
|
||||
* u_char *buf = (u_char*)malloc(100);
|
||||
* u_char type = (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER);
|
||||
* size_t buf_len = 100, offset = 0;
|
||||
* long data = 12345;
|
||||
* int allow_realloc = 1;
|
||||
*
|
||||
* if (asn_realloc_rbuild_int(&buf, &buf_len, &offset, allow_realloc,
|
||||
* type, &data, sizeof(long)) == 0) {
|
||||
* error;
|
||||
* }
|
||||
*
|
||||
* NOTE WELL: after calling one of these functions with allow_realloc
|
||||
* non-zero, buf might have moved, buf_len might have grown and
|
||||
* offset will have increased by the size of the encoded data.
|
||||
* You should **NEVER** do something like this:
|
||||
*
|
||||
* u_char *buf = (u_char *)malloc(100), *ptr;
|
||||
* u_char type = (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER);
|
||||
* size_t buf_len = 100, offset = 0;
|
||||
* long data1 = 1234, data2 = 5678;
|
||||
* int rc = 0, allow_realloc = 1;
|
||||
*
|
||||
* rc = asn_realloc_rbuild_int(&buf, &buf_len, &offset, allow_realloc,
|
||||
* type, &data1, sizeof(long));
|
||||
* ptr = buf[buf_len - offset]; / * points at encoding of data1 * /
|
||||
* if (rc == 0) {
|
||||
* error;
|
||||
* }
|
||||
* rc = asn_realloc_rbuild_int(&buf, &buf_len, &offset, allow_realloc,
|
||||
* type, &data2, sizeof(long));
|
||||
* make use of ptr here;
|
||||
*
|
||||
*
|
||||
* ptr is **INVALID** at this point. In general, you should store the
|
||||
* offset value and compute pointers when you need them:
|
||||
*
|
||||
*
|
||||
*
|
||||
* u_char *buf = (u_char *)malloc(100), *ptr;
|
||||
* u_char type = (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER);
|
||||
* size_t buf_len = 100, offset = 0, ptr_offset;
|
||||
* long data1 = 1234, data2 = 5678;
|
||||
* int rc = 0, allow_realloc = 1;
|
||||
*
|
||||
* rc = asn_realloc_rbuild_int(&buf, &buf_len, &offset, allow_realloc,
|
||||
* type, &data1, sizeof(long));
|
||||
* ptr_offset = offset;
|
||||
* if (rc == 0) {
|
||||
* error;
|
||||
* }
|
||||
* rc = asn_realloc_rbuild_int(&buf, &buf_len, &offset, allow_realloc,
|
||||
* type, &data2, sizeof(long));
|
||||
* ptr = buf + buf_len - ptr_offset
|
||||
* make use of ptr here;
|
||||
*
|
||||
*
|
||||
*
|
||||
* Here, you can see that ptr will be a valid pointer even if the block of
|
||||
* memory has been moved, as it may well have been. Plenty of examples of
|
||||
* usage all over asn1.c, snmp_api.c, snmpusm.c.
|
||||
*
|
||||
* The other thing you should **NEVER** do is to pass a pointer to a buffer
|
||||
* on the stack as the first argument when allow_realloc is non-zero, unless
|
||||
* you really know what you are doing and your machine/compiler allows you to
|
||||
* free non-heap memory. There are rumours that such things exist, but many
|
||||
* consider them no more than the wild tales of a fool.
|
||||
*
|
||||
* Of course, you can pass allow_realloc as zero, to indicate that you do not
|
||||
* wish the packet buffer to be reallocated for some reason; perhaps because
|
||||
* it is on the stack. This may be useful to emulate the functionality of
|
||||
* the old API:
|
||||
*
|
||||
* u_char my_static_buffer[100], *cp = NULL;
|
||||
* size_t my_static_buffer_len = 100;
|
||||
* float my_pi = (float)22/(float)7;
|
||||
*
|
||||
* cp = asn_rbuild_float(my_static_buffer, &my_static_buffer_len,
|
||||
* ASN_OPAQUE_FLOAT, &my_pi, sizeof(float));
|
||||
* if (cp == NULL) {
|
||||
* error;
|
||||
* }
|
||||
*
|
||||
*
|
||||
* IS EQUIVALENT TO:
|
||||
*
|
||||
*
|
||||
* u_char my_static_buffer[100];
|
||||
* size_t my_static_buffer_len = 100, my_offset = 0;
|
||||
* float my_pi = (float)22/(float)7;
|
||||
* int rc = 0;
|
||||
*
|
||||
* rc = asn_realloc_rbuild_float(&my_static_buffer, &my_static_buffer_len,
|
||||
* &my_offset, 0,
|
||||
* ASN_OPAQUE_FLOAT, &my_pi, sizeof(float));
|
||||
* if (rc == 0) {
|
||||
* error;
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
int asn_realloc_rbuild_int(u_char ** pkt, size_t * pkt_len,
|
||||
size_t * offset,
|
||||
int allow_realloc, u_char type,
|
||||
const long *data, size_t data_size);
|
||||
|
||||
int asn_realloc_rbuild_string(u_char ** pkt,
|
||||
size_t * pkt_len,
|
||||
size_t * offset,
|
||||
int allow_realloc,
|
||||
u_char type,
|
||||
const u_char * data,
|
||||
size_t data_size);
|
||||
|
||||
int asn_realloc_rbuild_unsigned_int(u_char ** pkt,
|
||||
size_t * pkt_len,
|
||||
size_t * offset,
|
||||
int allow_realloc,
|
||||
u_char type,
|
||||
const u_long * data,
|
||||
size_t data_size);
|
||||
|
||||
int asn_realloc_rbuild_header(u_char ** pkt,
|
||||
size_t * pkt_len,
|
||||
size_t * offset,
|
||||
int allow_realloc,
|
||||
u_char type,
|
||||
size_t data_size);
|
||||
|
||||
int asn_realloc_rbuild_sequence(u_char ** pkt,
|
||||
size_t * pkt_len,
|
||||
size_t * offset,
|
||||
int allow_realloc,
|
||||
u_char type,
|
||||
size_t data_size);
|
||||
|
||||
int asn_realloc_rbuild_length(u_char ** pkt,
|
||||
size_t * pkt_len,
|
||||
size_t * offset,
|
||||
int allow_realloc,
|
||||
size_t data_size);
|
||||
|
||||
int asn_realloc_rbuild_objid(u_char ** pkt,
|
||||
size_t * pkt_len,
|
||||
size_t * offset,
|
||||
int allow_realloc,
|
||||
u_char type, const oid *,
|
||||
size_t);
|
||||
|
||||
int asn_realloc_rbuild_null(u_char ** pkt,
|
||||
size_t * pkt_len,
|
||||
size_t * offset,
|
||||
int allow_realloc,
|
||||
u_char type);
|
||||
|
||||
int asn_realloc_rbuild_bitstring(u_char ** pkt,
|
||||
size_t * pkt_len,
|
||||
size_t * offset,
|
||||
int allow_realloc,
|
||||
u_char type,
|
||||
const u_char * data,
|
||||
size_t data_size);
|
||||
|
||||
int asn_realloc_rbuild_unsigned_int64(u_char ** pkt,
|
||||
size_t * pkt_len,
|
||||
size_t * offset,
|
||||
int allow_realloc,
|
||||
u_char type,
|
||||
struct counter64
|
||||
const *data, size_t);
|
||||
|
||||
int asn_realloc_rbuild_signed_int64(u_char ** pkt,
|
||||
size_t * pkt_len,
|
||||
size_t * offset,
|
||||
int allow_realloc,
|
||||
u_char type,
|
||||
const struct counter64 *data,
|
||||
size_t);
|
||||
|
||||
int asn_realloc_rbuild_float(u_char ** pkt,
|
||||
size_t * pkt_len,
|
||||
size_t * offset,
|
||||
int allow_realloc,
|
||||
u_char type, const float *data,
|
||||
size_t data_size);
|
||||
|
||||
int asn_realloc_rbuild_double(u_char ** pkt,
|
||||
size_t * pkt_len,
|
||||
size_t * offset,
|
||||
int allow_realloc,
|
||||
u_char type, const double *data,
|
||||
size_t data_size);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* ASN1_H */
|
@ -1,65 +0,0 @@
|
||||
/*
|
||||
* callback.c: A generic callback mechanism
|
||||
*/
|
||||
|
||||
#ifndef CALLBACK_H
|
||||
#define CALLBACK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAX_CALLBACK_IDS 2
|
||||
#define MAX_CALLBACK_SUBIDS 16
|
||||
|
||||
/*
|
||||
* Callback Major Types
|
||||
*/
|
||||
#define SNMP_CALLBACK_LIBRARY 0
|
||||
#define SNMP_CALLBACK_APPLICATION 1
|
||||
|
||||
/*
|
||||
* SNMP_CALLBACK_LIBRARY minor types
|
||||
*/
|
||||
#define SNMP_CALLBACK_POST_READ_CONFIG 0
|
||||
#define SNMP_CALLBACK_STORE_DATA 1
|
||||
#define SNMP_CALLBACK_SHUTDOWN 2
|
||||
#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG 3
|
||||
#define SNMP_CALLBACK_LOGGING 4
|
||||
#define SNMP_CALLBACK_SESSION_INIT 5
|
||||
|
||||
typedef int (SNMPCallback) (int majorID, int minorID,
|
||||
void *serverarg, void *clientarg);
|
||||
|
||||
struct snmp_gen_callback {
|
||||
SNMPCallback *sc_callback;
|
||||
void *sc_client_arg;
|
||||
int priority;
|
||||
struct snmp_gen_callback *next;
|
||||
};
|
||||
|
||||
/*
|
||||
* function prototypes
|
||||
*/
|
||||
void init_callbacks(void);
|
||||
|
||||
int netsnmp_register_callback(int major, int minor,
|
||||
SNMPCallback * new_callback,
|
||||
void *arg, int priority);
|
||||
int snmp_register_callback(int major, int minor,
|
||||
SNMPCallback * new_callback,
|
||||
void *arg);
|
||||
int snmp_call_callbacks(int major, int minor,
|
||||
void *caller_arg);
|
||||
int snmp_callback_available(int major, int minor); /* is >1 available */
|
||||
int snmp_count_callbacks(int major, int minor); /* ret the number registered */
|
||||
int snmp_unregister_callback(int major, int minor,
|
||||
SNMPCallback * new_callback,
|
||||
void *arg, int matchargs);
|
||||
void clear_callback (void);
|
||||
struct snmp_gen_callback *snmp_callback_list(int major, int minor);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* CALLBACK_H */
|
@ -1,35 +0,0 @@
|
||||
#ifndef SNMP_CHECK_VARBIND_H
|
||||
#define SNMP_CHECK_VARBIND_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Assorted convience routines to check the contents of a
|
||||
* netsnmp_variable_list instance.
|
||||
*/
|
||||
|
||||
int netsnmp_check_vb_type(const netsnmp_variable_list *var, int type);
|
||||
int netsnmp_check_vb_size(const netsnmp_variable_list *var, size_t size );
|
||||
int netsnmp_check_vb_size_range(const netsnmp_variable_list *var,
|
||||
size_t low, size_t high );
|
||||
|
||||
int netsnmp_check_vb_type_and_size(const netsnmp_variable_list *var,
|
||||
int type, size_t size);
|
||||
|
||||
int netsnmp_check_vb_int_range(const netsnmp_variable_list *var, int low,
|
||||
int high);
|
||||
|
||||
int netsnmp_check_vb_truthvalue(const netsnmp_variable_list *var);
|
||||
|
||||
int netsnmp_check_vb_rowstatus_value(const netsnmp_variable_list *var);
|
||||
int netsnmp_check_vb_rowstatus(const netsnmp_variable_list *var, int old_val);
|
||||
|
||||
int netsnmp_check_vb_storagetype(const netsnmp_variable_list *var, int old_val);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* SNMP_CHECK_VARBIND_H */
|
@ -1,293 +0,0 @@
|
||||
/* 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 <20> 2003 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms specified in the COPYING file
|
||||
* distributed with the Net-SNMP package.
|
||||
*/
|
||||
|
||||
/*
|
||||
* CMU compatability definitions and structures.
|
||||
*
|
||||
* (since the UCD package split from the CMU one
|
||||
* about 8 years ago, that's probably enough time
|
||||
* for people to convert any outstanding code!)
|
||||
*/
|
||||
|
||||
#ifndef NET_SNMP_CMU_COMPAT_H
|
||||
#define NET_SNMP_CMU_COMPAT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ============================
|
||||
* *
|
||||
* * Enumerations and definitions
|
||||
* *
|
||||
* * ============================
|
||||
*/
|
||||
#include <net-snmp/definitions.h>
|
||||
/*
|
||||
* From parse.h
|
||||
*/
|
||||
#define ACCESS_READONLY MIB_ACCESS_READONLY
|
||||
#define ACCESS_READWRITE MIB_ACCESS_READWRITE
|
||||
#define ACCESS_WRITEONLY MIB_ACCESS_WRITEONLY
|
||||
#define ACCESS_NOACCESS MIB_ACCESS_NOACCESS
|
||||
#define ACCESS_NOTIFY MIB_ACCESS_NOTIFY
|
||||
#define ACCESS_CREATE MIB_ACCESS_CREATE
|
||||
#define STATUS_MANDATORY MIB_STATUS_MANDATORY
|
||||
#define STATUS_OPTIONAL MIB_STATUS_OPTIONAL
|
||||
#define STATUS_OBSOLETE MIB_STATUS_OBSOLETE
|
||||
#define STATUS_DEPRECATED MIB_STATUS_DEPRECATED
|
||||
#define STATUS_CURRENT MIB_STATUS_CURRENT
|
||||
/*
|
||||
* From smnp_impl.h
|
||||
*/
|
||||
#define INTEGER ASN_INTEGER
|
||||
#define STRING ASN_OCTET_STR
|
||||
#define OBJID ASN_OBJECT_ID
|
||||
#define NULLOBJ ASN_NULL
|
||||
#define BITSTRING ASN_BIT_STR /* HISTORIC - don't use */
|
||||
#define IPADDRESS ASN_IPADDRESS
|
||||
#define COUNTER ASN_COUNTER
|
||||
#define GAUGE ASN_GAUGE
|
||||
#define UNSIGNED ASN_UNSIGNED
|
||||
#define TIMETICKS ASN_TIMETICKS
|
||||
#define ASNT_OPAQUE ASN_OPAQUE
|
||||
#define NSAP ASN_NSAP
|
||||
#define COUNTER64 ASN_COUNTER64
|
||||
#define UINTEGER ASN_UINTEGER
|
||||
/*
|
||||
* From snmp.h
|
||||
*/
|
||||
#define GET_REQ_MSG SNMP_MSG_GET
|
||||
#define GETNEXT_REQ_MSG SNMP_MSG_GETNEXT
|
||||
#define GET_RSP_MSG SNMP_MSG_RESPONSE
|
||||
#define SET_REQ_MSG SNMP_MSG_SET
|
||||
#define TRP_REQ_MSG SNMP_MSG_TRAP
|
||||
#define BULK_REQ_MSG SNMP_MSG_GETBULK
|
||||
#define INFORM_REQ_MSG SNMP_MSG_INFORM
|
||||
#define TRP2_REQ_MSG SNMP_MSG_TRAP2
|
||||
#define REPORT_RSP_MSG SNMP_MSG_REPORT
|
||||
/*
|
||||
* since CMU V1.5
|
||||
*/
|
||||
#define SNMP_PDU_GET SNMP_MSG_GET
|
||||
#define SNMP_PDU_GETNEXT SNMP_MSG_GETNEXT
|
||||
#define SNMP_PDU_RESPONSE SNMP_MSG_RESPONSE
|
||||
#define SNMP_PDU_SET SNMP_MSG_SET
|
||||
#define SNMP_PDU_GETBULK SNMP_MSG_GETBULK
|
||||
#define SNMP_PDU_INFORM SNMP_MSG_INFORM
|
||||
#define SNMP_PDU_V2TRAP SNMP_MSG_TRAP2
|
||||
#define SNMP_PDU_REPORT SNMP_MSG_REPORT
|
||||
#define SNMP_TRAP_AUTHENTICATIONFAILURE SNMP_TRAP_AUTHFAIL
|
||||
#define SMI_INTEGER ASN_INTEGER
|
||||
#define SMI_STRING ASN_OCTET_STR
|
||||
#define SMI_OBJID ASN_OBJECT_ID
|
||||
#define SMI_NULLOBJ ASN_NULL
|
||||
#define SMI_IPADDRESS ASN_IPADDRESS
|
||||
#define SMI_COUNTER32 ASN_COUNTER
|
||||
#define SMI_GAUGE32 ASN_GAUGE
|
||||
#define SMI_UNSIGNED32 SMI_GAUGE32
|
||||
#define SMI_TIMETICKS ASN_TIMETICKS
|
||||
#define SMI_OPAQUE ASN_OPAQUE
|
||||
#define SMI_COUNTER64 ASN_COUNTER64
|
||||
/*
|
||||
* ============================
|
||||
* *
|
||||
* * Function declarations
|
||||
* * and global variables
|
||||
* *
|
||||
* * ============================
|
||||
*/
|
||||
extern int snmp_dump_packet; /* from snmp_api.h */
|
||||
extern int quick_print; /* from snmp_api.h */
|
||||
|
||||
#include <net-snmp/types.h> /* for snmp_pdu & snmp_session */
|
||||
|
||||
int mib_TxtToOid(char *, oid **, size_t *); /* from snmp.h */
|
||||
int mib_OidToTxt(oid *, size_t, char *, size_t); /* from snmp.h */
|
||||
char *snmp_pdu_type(netsnmp_pdu *); /* from snmp.h */
|
||||
u_char *cmu_snmp_parse(netsnmp_session * session, netsnmp_pdu *pdu, u_char * data, size_t length); /* from snmp.h */
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ============================
|
||||
* *
|
||||
* * MIB-II data structures
|
||||
* * (from mib.h)
|
||||
* *
|
||||
* * ============================
|
||||
*/
|
||||
|
||||
|
||||
struct mib_system {
|
||||
char sysDescr[32]; /* textual description */
|
||||
u_char sysObjectID[16]; /* OBJECT IDENTIFIER of system */
|
||||
u_char ObjIDLen; /* length of sysObjectID */
|
||||
u_int sysUpTime; /* Uptime in 100/s of a second */
|
||||
};
|
||||
|
||||
struct mib_interface {
|
||||
int ifNumber; /* number of interfaces */
|
||||
};
|
||||
|
||||
struct mib_ifEntry {
|
||||
int ifIndex; /* index of this interface */
|
||||
char ifDescr[32]; /* english description of interface */
|
||||
int ifType; /* network type of device */
|
||||
int ifMtu; /* size of largest packet in bytes */
|
||||
u_int ifSpeed; /* bandwidth in bits/sec */
|
||||
u_char ifPhysAddress[11]; /* interface's address */
|
||||
u_char PhysAddrLen; /* length of physAddr */
|
||||
int ifAdminStatus; /* desired state of interface */
|
||||
int ifOperStatus; /* current operational status */
|
||||
u_int ifLastChange; /* value of sysUpTime when current state entered */
|
||||
u_int ifInOctets; /* number of octets received on interface */
|
||||
u_int ifInUcastPkts; /* number of unicast packets delivered */
|
||||
u_int ifInNUcastPkts; /* number of broadcasts or multicasts */
|
||||
u_int ifInDiscards; /* number of packets discarded with no error */
|
||||
u_int ifInErrors; /* number of packets containing errors */
|
||||
u_int ifInUnknownProtos; /* number of packets with unknown protocol */
|
||||
u_int ifOutOctets; /* number of octets transmitted */
|
||||
u_int ifOutUcastPkts; /* number of unicast packets sent */
|
||||
u_int ifOutNUcastPkts; /* number of broadcast or multicast pkts */
|
||||
u_int ifOutDiscards; /* number of packets discarded with no error */
|
||||
u_int ifOutErrors; /* number of pkts discarded with an error */
|
||||
u_int ifOutQLen; /* number of packets in output queue */
|
||||
};
|
||||
|
||||
struct mib_atEntry {
|
||||
int atIfIndex; /* interface on which this entry maps */
|
||||
u_char atPhysAddress[11]; /* physical address of destination */
|
||||
u_char PhysAddressLen; /* length of atPhysAddress */
|
||||
u_int atNetAddress; /* IP address of physical address */
|
||||
};
|
||||
|
||||
struct mib_ip {
|
||||
int ipForwarding; /* 1 if gateway, 2 if host */
|
||||
int ipDefaultTTL; /* default TTL for pkts originating here */
|
||||
u_int ipInReceives; /* no. of IP packets received from interfaces */
|
||||
u_int ipInHdrErrors; /* number of pkts discarded due to header errors */
|
||||
u_int ipInAddrErrors; /* no. of pkts discarded due to bad address */
|
||||
u_int ipForwDatagrams; /* number pf pkts forwarded through this entity */
|
||||
u_int ipInUnknownProtos; /* no. of local-addressed pkts w/unknown proto */
|
||||
u_int ipInDiscards; /* number of error-free packets discarded */
|
||||
u_int ipInDelivers; /* number of datagrams delivered to upper level */
|
||||
u_int ipOutRequests; /* number of IP datagrams originating locally */
|
||||
u_int ipOutDiscards; /* number of error-free output IP pkts discarded */
|
||||
u_int ipOutNoRoutes; /* number of IP pkts discarded due to no route */
|
||||
int ipReasmTimeout; /* seconds fragment is held awaiting reassembly */
|
||||
u_int ipReasmReqds; /* no. of fragments needing reassembly (here) */
|
||||
u_int ipReasmOKs; /* number of fragments reassembled */
|
||||
u_int ipReasmFails; /* number of failures in IP reassembly */
|
||||
u_int ipFragOKs; /* number of datagrams fragmented here */
|
||||
u_int ipFragFails; /* no. pkts unable to be fragmented here */
|
||||
u_int ipFragCreates; /* number of IP fragments created here */
|
||||
};
|
||||
|
||||
struct mib_ipAddrEntry {
|
||||
u_int ipAdEntAddr; /* IP address of this entry */
|
||||
int ipAdEntIfIndex; /* IF for this entry */
|
||||
u_int ipAdEntNetMask; /* subnet mask of this entry */
|
||||
int ipAdEntBcastAddr; /* read the MIB for this one */
|
||||
int ipAdEntReasmMaxSize;
|
||||
/* max size for dg reassembly {ipAddrEntry 5} */
|
||||
};
|
||||
|
||||
struct mib_ipRouteEntry {
|
||||
u_int ipRouteDest; /* destination IP addr for this route */
|
||||
int ipRouteIfIndex; /* index of local IF for this route */
|
||||
int ipRouteMetric1; /* Primary routing metric */
|
||||
int ipRouteMetric2; /* Alternate routing metric */
|
||||
int ipRouteMetric3; /* Alternate routing metric */
|
||||
int ipRouteMetric4; /* Alternate routing metric */
|
||||
u_int ipRouteNextHop; /* IP addr of next hop */
|
||||
int ipRouteType; /* Type of this route */
|
||||
int ipRouteProto; /* How this route was learned */
|
||||
int ipRouteAge; /* No. of seconds since updating this route */
|
||||
};
|
||||
|
||||
struct mib_icmp {
|
||||
u_int icmpInMsgs; /* Total of ICMP msgs received */
|
||||
u_int icmpInErrors; /* Total of ICMP msgs received with errors */
|
||||
u_int icmpInDestUnreachs;
|
||||
u_int icmpInTimeExcds;
|
||||
u_int icmpInParmProbs;
|
||||
u_int icmpInSrcQuenchs;
|
||||
u_int icmpInRedirects;
|
||||
u_int icmpInEchos;
|
||||
u_int icmpInEchoReps;
|
||||
u_int icmpInTimestamps;
|
||||
u_int icmpInTimestampReps;
|
||||
u_int icmpInAddrMasks;
|
||||
u_int icmpInAddrMaskReps;
|
||||
u_int icmpOutMsgs;
|
||||
u_int icmpOutErrors;
|
||||
u_int icmpOutDestUnreachs;
|
||||
u_int icmpOutTimeExcds;
|
||||
u_int icmpOutParmProbs;
|
||||
u_int icmpOutSrcQuenchs;
|
||||
u_int icmpOutRedirects;
|
||||
u_int icmpOutEchos;
|
||||
u_int icmpOutEchoReps;
|
||||
u_int icmpOutTimestamps;
|
||||
u_int icmpOutTimestampReps;
|
||||
u_int icmpOutAddrMasks;
|
||||
u_int icmpOutAddrMaskReps;
|
||||
};
|
||||
|
||||
struct mib_tcp {
|
||||
int tcpRtoAlgorithm; /* retransmission timeout algorithm */
|
||||
int tcpRtoMin; /* minimum retransmission timeout (mS) */
|
||||
int tcpRtoMax; /* maximum retransmission timeout (mS) */
|
||||
int tcpMaxConn; /* maximum tcp connections possible */
|
||||
u_int tcpActiveOpens; /* number of SYN-SENT -> CLOSED transitions */
|
||||
u_int tcpPassiveOpens; /* number of SYN-RCVD -> LISTEN transitions */
|
||||
u_int tcpAttemptFails; /*(SYN-SENT,SYN-RCVD)->CLOSED or SYN-RCVD->LISTEN */
|
||||
u_int tcpEstabResets; /* (ESTABLISHED,CLOSE-WAIT) -> CLOSED */
|
||||
u_int tcpCurrEstab; /* number in ESTABLISHED or CLOSE-WAIT state */
|
||||
u_int tcpInSegs; /* number of segments received */
|
||||
u_int tcpOutSegs; /* number of segments sent */
|
||||
u_int tcpRetransSegs; /* number of retransmitted segments */
|
||||
};
|
||||
|
||||
struct mib_tcpConnEntry {
|
||||
int tcpConnState; /* State of this connection */
|
||||
u_int tcpConnLocalAddress; /* local IP address for this connection */
|
||||
int tcpConnLocalPort; /* local port for this connection */
|
||||
u_int tcpConnRemAddress; /* remote IP address for this connection */
|
||||
int tcpConnRemPort; /* remote port for this connection */
|
||||
};
|
||||
|
||||
struct mib_udp {
|
||||
u_int udpInDatagrams; /* No. of UDP datagrams delivered to users */
|
||||
u_int udpNoPorts; /* No. of UDP datagrams to port with no listener */
|
||||
u_int udpInErrors; /* No. of UDP datagrams unable to be delivered */
|
||||
u_int udpOutDatagrams; /* No. of UDP datagrams sent from this entity */
|
||||
};
|
||||
|
||||
struct mib_egp {
|
||||
u_int egpInMsgs; /* No. of EGP msgs received without error */
|
||||
u_int egpInErrors; /* No. of EGP msgs received with error */
|
||||
u_int egpOutMsgs; /* No. of EGP msgs sent */
|
||||
u_int egpOutErrors; /* No. of (outgoing) EGP msgs dropped due to error */
|
||||
};
|
||||
|
||||
struct mib_egpNeighEntry {
|
||||
int egpNeighState; /* local EGP state with this entry's neighbor */
|
||||
u_int egpNeighAddr; /* IP address of this entry's neighbor */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* NET_SNMP_CMU_COMPAT_H */
|
@ -1,497 +0,0 @@
|
||||
#ifndef NETSNMP_CONTAINER_H
|
||||
#define NETSNMP_CONTAINER_H
|
||||
|
||||
/*
|
||||
* $Id: container.h,v 1.25 2004/09/14 02:29:16 rstory Exp $
|
||||
*
|
||||
* WARNING: This is a recently created file, and all of it's contents are
|
||||
* subject to change at any time.
|
||||
*
|
||||
* A basic container template. A generic way for code to store and
|
||||
* retrieve data. Allows for interchangable storage algorithms.
|
||||
*/
|
||||
#ifndef NET_SNMP_CONFIG_H
|
||||
#error "Please include <net-snmp/net-snmp-config.h> before this file"
|
||||
#endif
|
||||
|
||||
#include <net-snmp/types.h>
|
||||
#include <net-snmp/library/factory.h>
|
||||
#include <net-snmp/library/snmp_logging.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* function pointer definitions
|
||||
*
|
||||
*************************************************************************/
|
||||
struct netsnmp_iterator_s; /** forward declare */
|
||||
struct netsnmp_container_s; /** forward declare */
|
||||
|
||||
/*
|
||||
* function returning an int for an operation on a container
|
||||
*/
|
||||
typedef int (netsnmp_container_rc)(struct netsnmp_container_s *);
|
||||
|
||||
/*
|
||||
* function returning an int for an operation on a container
|
||||
*/
|
||||
typedef struct netsnmp_iterator_s * (netsnmp_container_it)
|
||||
(struct netsnmp_container_s *);
|
||||
|
||||
/*
|
||||
* function returning a size_t for an operation on a container
|
||||
*/
|
||||
typedef size_t (netsnmp_container_size)(struct netsnmp_container_s *);
|
||||
|
||||
/*
|
||||
* function returning an int for an operation on an object and
|
||||
* a container
|
||||
*/
|
||||
typedef int (netsnmp_container_op)(struct netsnmp_container_s *,
|
||||
const void *data);
|
||||
|
||||
/*
|
||||
* function returning an oject for an operation on an object and a
|
||||
* container
|
||||
*/
|
||||
typedef void * (netsnmp_container_rtn)(struct netsnmp_container_s *,
|
||||
const void *data);
|
||||
|
||||
/*
|
||||
* function with no return which acts on an object
|
||||
*/
|
||||
typedef void (netsnmp_container_obj_func)(void *data, void *context);
|
||||
|
||||
/*
|
||||
* function with no return which acts on an object
|
||||
*/
|
||||
typedef void (netsnmp_container_func)(struct netsnmp_container_s *,
|
||||
netsnmp_container_obj_func *,
|
||||
void *context);
|
||||
|
||||
/*
|
||||
* function returning an array of objects for an operation on an
|
||||
* ojbect and a container
|
||||
*/
|
||||
typedef netsnmp_void_array * (netsnmp_container_set)
|
||||
(struct netsnmp_container_s *, void *data);
|
||||
|
||||
/*
|
||||
* function returning an int for a comparison between two objects
|
||||
*/
|
||||
typedef int (netsnmp_container_compare)(const void *lhs,
|
||||
const void *rhs);
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* Basic container
|
||||
*
|
||||
*************************************************************************/
|
||||
typedef struct netsnmp_container_s {
|
||||
|
||||
/*
|
||||
* pointer for container implementation
|
||||
*/
|
||||
void * container_data;
|
||||
|
||||
/*
|
||||
* returns the number of items in a container
|
||||
*/
|
||||
netsnmp_container_size *get_size;
|
||||
|
||||
/*
|
||||
* initialize a container
|
||||
*/
|
||||
netsnmp_container_rc *init;
|
||||
|
||||
/*
|
||||
* release memory used by a container.
|
||||
*
|
||||
* Note: if your data structures contained allocated
|
||||
* memory, you are responsible for releasing that
|
||||
* memory before calling this function!
|
||||
*/
|
||||
netsnmp_container_rc *cfree;
|
||||
|
||||
/*
|
||||
* add an entry to the container
|
||||
*/
|
||||
netsnmp_container_op *insert;
|
||||
|
||||
/*
|
||||
* remove an entry from the container
|
||||
*/
|
||||
netsnmp_container_op *remove;
|
||||
|
||||
/*
|
||||
* release memory for an entry from the container
|
||||
*/
|
||||
netsnmp_container_op *release;
|
||||
|
||||
/*
|
||||
* Note: do not change the key! If you need to
|
||||
* change a key, remove the entry, change the key,
|
||||
* and the re-add the entry.
|
||||
*/
|
||||
|
||||
/*
|
||||
* find the entry in the container with the same key
|
||||
*
|
||||
*/
|
||||
netsnmp_container_rtn *find;
|
||||
|
||||
/*
|
||||
* find the entry in the container with the next highest key
|
||||
*
|
||||
* If the key is NULL, return the first item in the container.
|
||||
*/
|
||||
netsnmp_container_rtn *find_next;
|
||||
|
||||
/*
|
||||
* find all entries in the container which match the partial key
|
||||
* returns allocated memory (netsnmp_void_array). User is responsible
|
||||
* for releasing this memory (free(array->array), free(array)).
|
||||
* DO NOT FREE ELEMENTS OF THE ARRAY, because they are the same pointers
|
||||
* stored in the container.
|
||||
*/
|
||||
netsnmp_container_set *get_subset;
|
||||
|
||||
/*
|
||||
* function to return an iterator for the container
|
||||
*/
|
||||
netsnmp_container_it *get_iterator;
|
||||
|
||||
/*
|
||||
* function to call another function for each object in the container
|
||||
*/
|
||||
netsnmp_container_func *for_each;
|
||||
|
||||
/*
|
||||
* specialized version of for_each used to optimize cleanup.
|
||||
* clear the container, optionally calling a function for each item.
|
||||
*/
|
||||
netsnmp_container_func *clear;
|
||||
|
||||
/*
|
||||
* function to compare two object stored in the container.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
* -1 LHS < RHS
|
||||
* 0 LHS = RHS
|
||||
* 1 LHS > RHS
|
||||
*/
|
||||
netsnmp_container_compare *compare;
|
||||
|
||||
/*
|
||||
* same as compare, but RHS will be a partial key
|
||||
*/
|
||||
netsnmp_container_compare *ncompare;
|
||||
|
||||
/*
|
||||
* unique name for finding a particular container in a list
|
||||
*/
|
||||
char *container_name;
|
||||
|
||||
/*
|
||||
* containers can contain other containers (additional indexes)
|
||||
*/
|
||||
struct netsnmp_container_s *next, *prev;
|
||||
|
||||
} netsnmp_container;
|
||||
|
||||
/*
|
||||
* initialize/free a container of container factories. used by
|
||||
* netsnmp_container_find* functions.
|
||||
*/
|
||||
void netsnmp_container_init_list(void);
|
||||
void netsnmp_container_free_list(void);
|
||||
|
||||
/*
|
||||
* register a new container factory
|
||||
*/
|
||||
int netsnmp_container_register(const char* name, netsnmp_factory *f);
|
||||
|
||||
/*
|
||||
* search for and create a container from a list of types or a
|
||||
* specific type.
|
||||
*/
|
||||
netsnmp_container * netsnmp_container_find(const char *type_list);
|
||||
netsnmp_container * netsnmp_container_get(const char *type);
|
||||
|
||||
/*
|
||||
* utility routines
|
||||
*/
|
||||
void netsnmp_container_add_index(netsnmp_container *primary,
|
||||
netsnmp_container *new_index);
|
||||
|
||||
|
||||
netsnmp_factory *netsnmp_container_get_factory(const char *type);
|
||||
|
||||
/*
|
||||
* common comparison routines
|
||||
*/
|
||||
/** first data element is a 'netsnmp_index' */
|
||||
int netsnmp_compare_netsnmp_index(const void *lhs, const void *rhs);
|
||||
int netsnmp_ncompare_netsnmp_index(const void *lhs, const void *rhs);
|
||||
|
||||
/** first data element is a 'char *' */
|
||||
int netsnmp_compare_cstring(const void * lhs, const void * rhs);
|
||||
int netsnmp_ncompare_cstring(const void * lhs, const void * rhs);
|
||||
|
||||
/** useful for octet strings */
|
||||
int netsnmp_compare_mem(const char * lhs, size_t lhs_len,
|
||||
const char * rhs, size_t rhs_len);
|
||||
|
||||
/** for_each callback to call free on data item */
|
||||
void netsnmp_container_simple_free(void *data, void *context);
|
||||
|
||||
/*
|
||||
* useful macros (x = container; k = key; c = user context)
|
||||
*/
|
||||
#define CONTAINER_FIRST(x) (x)->find_next(x,NULL)
|
||||
#define CONTAINER_FIND(x,k) (x)->find(x,k)
|
||||
#define CONTAINER_NEXT(x,k) (x)->find_next(x,k)
|
||||
/*
|
||||
* GET_SUBSET returns allocated memory (netsnmp_void_array). User is responsible
|
||||
* for releasing this memory (free(array->array), free(array)).
|
||||
* DO NOT FREE ELEMENTS OF THE ARRAY, because they are the same pointers
|
||||
* stored in the container.
|
||||
*/
|
||||
#define CONTAINER_GET_SUBSET(x,k) (x)->get_subset(x,k)
|
||||
#define CONTAINER_SIZE(x) (x)->get_size(x)
|
||||
#define CONTAINER_ITERATOR(x) (x)->get_iterator(x)
|
||||
#define CONTAINER_COMPARE(x,l,r) (x)->compare(l,r)
|
||||
#define CONTAINER_FOR_EACH(x,f,c) (x)->for_each(x,f,c)
|
||||
|
||||
/*
|
||||
* if you are getting multiple definitions of these three
|
||||
* inline functions, you most likely have optimizations turned off.
|
||||
* Either turn them back on, or define NETSNMP_NO_INLINE
|
||||
*/
|
||||
#ifndef NETSNMP_USE_INLINE /* default is to inline */
|
||||
/*
|
||||
* insert k into all containers
|
||||
*/
|
||||
int CONTAINER_INSERT(netsnmp_container *x, const void *k);
|
||||
|
||||
/*
|
||||
* remove k from all containers
|
||||
*/
|
||||
int CONTAINER_REMOVE(netsnmp_container *x, const void *k);
|
||||
|
||||
/*
|
||||
* clear all containers. When clearing the *first* container, and
|
||||
* *only* the first container, call the function f for each item.
|
||||
* After calling this function, all containers should be empty.
|
||||
*/
|
||||
void CONTAINER_CLEAR(netsnmp_container *x, netsnmp_container_obj_func *f,
|
||||
void *c);
|
||||
/*
|
||||
* free all containers
|
||||
*/
|
||||
int CONTAINER_FREE(netsnmp_container *x);
|
||||
#else
|
||||
/*------------------------------------------------------------------
|
||||
* These functions should EXACTLY match the function version in
|
||||
* container.c. If you change one, change them both.
|
||||
*/
|
||||
NETSNMP_STATIC_INLINE /* gcc docs recommend static w/inline */
|
||||
int CONTAINER_INSERT(netsnmp_container *x, const void *k)
|
||||
{
|
||||
int rc2, rc = 0;
|
||||
|
||||
/** start at first container */
|
||||
while(x->prev)
|
||||
x = x->prev;
|
||||
while(x) {
|
||||
rc2 = x->insert(x,k);
|
||||
if (rc2) {
|
||||
snmp_log(LOG_ERR,"error on subcontainer insert (%d)\n", rc2);
|
||||
rc = rc2;
|
||||
}
|
||||
x = x->next;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------
|
||||
* These functions should EXACTLY match the function version in
|
||||
* container.c. If you change one, change them both.
|
||||
*/
|
||||
NETSNMP_STATIC_INLINE /* gcc docs recommend static w/inline */
|
||||
int CONTAINER_REMOVE(netsnmp_container *x, const void *k)
|
||||
{
|
||||
int rc2, rc = 0;
|
||||
|
||||
/** start at last container */
|
||||
while(x->next)
|
||||
x = x->next;
|
||||
while(x) {
|
||||
rc2 = x->remove(x,k);
|
||||
if (rc2) {
|
||||
snmp_log(LOG_ERR,"error on subcontainer remove (%d)\n", rc2);
|
||||
rc = rc2;
|
||||
}
|
||||
x = x->prev;
|
||||
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------
|
||||
* These functions should EXACTLY match the function version in
|
||||
* container.c. If you change one, change them both.
|
||||
*/
|
||||
NETSNMP_STATIC_INLINE /* gcc docs recommend static w/inline */
|
||||
int CONTAINER_FREE(netsnmp_container *x)
|
||||
{
|
||||
int rc2, rc = 0;
|
||||
|
||||
/** start at last container */
|
||||
while(x->next)
|
||||
x = x->next;
|
||||
while(x) {
|
||||
netsnmp_container *tmp;
|
||||
tmp = x->prev;
|
||||
if (NULL != x->container_name)
|
||||
SNMP_FREE(x->container_name);
|
||||
rc2 = x->cfree(x);
|
||||
if (rc2) {
|
||||
snmp_log(LOG_ERR,"error on subcontainer cfree (%d)\n", rc2);
|
||||
rc = rc2;
|
||||
}
|
||||
x = tmp;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------
|
||||
* These functions should EXACTLY match the function version in
|
||||
* container.c. If you change one, change them both.
|
||||
*/
|
||||
/*
|
||||
* clear all containers. When clearing the *first* container, and
|
||||
* *only* the first container, call the function f for each item.
|
||||
* After calling this function, all containers should be empty.
|
||||
*/
|
||||
NETSNMP_STATIC_INLINE /* gcc docs recommend static w/inline */
|
||||
void CONTAINER_CLEAR(netsnmp_container *x, netsnmp_container_obj_func *f,
|
||||
void *c)
|
||||
{
|
||||
/** start at last container */
|
||||
while(x->next)
|
||||
x = x->next;
|
||||
while(x->prev) {
|
||||
x->clear(x, NULL, c);
|
||||
x = x->prev;
|
||||
}
|
||||
x->clear(x, f, c);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------
|
||||
* These functions should EXACTLY match the function version in
|
||||
* container.c. If you change one, change them both.
|
||||
*/
|
||||
/*
|
||||
* Find a sub-container with the given name
|
||||
*/
|
||||
NETSNMP_STATIC_INLINE /* gcc docs recommend static w/inline */
|
||||
netsnmp_container *SUBCONTAINER_FIND(netsnmp_container *x,
|
||||
const char* name)
|
||||
{
|
||||
if ((NULL == x) || (NULL == name))
|
||||
return NULL;
|
||||
|
||||
/** start at first container */
|
||||
while(x->prev)
|
||||
x = x->prev;
|
||||
while(x) {
|
||||
if ((NULL != x->container_name) &&
|
||||
(0 == strcmp(name,x->container_name)))
|
||||
break;
|
||||
x = x->next;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* container iterator
|
||||
*
|
||||
*************************************************************************/
|
||||
/*
|
||||
* function returning an int for an operation on an iterator
|
||||
*/
|
||||
typedef int (netsnmp_iterator_rc)(struct netsnmp_iterator_s *);
|
||||
|
||||
/*
|
||||
* function returning an int for an operation on an iterator and
|
||||
* an object in the container.
|
||||
*/
|
||||
typedef int (netsnmp_iterator_rc_op)(struct netsnmp_iterator_s *,
|
||||
void *data);
|
||||
|
||||
/*
|
||||
* function returning an oject for an operation on an iterator
|
||||
*/
|
||||
typedef void * (netsnmp_iterator_rtn)(struct netsnmp_iterator_s *);
|
||||
|
||||
typedef struct netsnmp_iterator_s {
|
||||
|
||||
netsnmp_container *container;
|
||||
|
||||
void *context;
|
||||
|
||||
netsnmp_iterator_rc *init;
|
||||
netsnmp_iterator_rc_op *position;
|
||||
netsnmp_iterator_rtn *first;
|
||||
netsnmp_iterator_rtn *next;
|
||||
netsnmp_iterator_rtn *last;
|
||||
|
||||
} netsnmp_iterator;
|
||||
|
||||
|
||||
#define ITERATOR_FIRST(x) x->first(x)
|
||||
#define ITERATOR_NEXT(x) x->next(x)
|
||||
#define ITERATOR_LAST(x) x->last(x)
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* Sorted container
|
||||
*
|
||||
*************************************************************************/
|
||||
typedef struct netsnmp_sorted_container_s {
|
||||
|
||||
netsnmp_container bc;
|
||||
|
||||
/*
|
||||
* methods to manipulate container
|
||||
*/
|
||||
|
||||
netsnmp_container_rtn *first;
|
||||
netsnmp_container_rtn *next;
|
||||
netsnmp_container_set *subset;
|
||||
|
||||
} netsnmp_sorted_container;
|
||||
|
||||
|
||||
void
|
||||
netsnmp_init_sorted_container(netsnmp_sorted_container *sc,
|
||||
netsnmp_container_rtn *first,
|
||||
netsnmp_container_rtn *next,
|
||||
netsnmp_container_set *subset);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /** NETSNMP_CONTAINER_H */
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* binary_array.h
|
||||
* $Id: container_binary_array.h,v 1.6 2004/03/02 05:03:36 rstory Exp $
|
||||
*/
|
||||
|
||||
#ifndef BINARY_ARRAY_H
|
||||
#define BINARY_ARRAY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <net-snmp/library/asn1.h>
|
||||
#include <net-snmp/library/container.h>
|
||||
#include <net-snmp/library/factory.h>
|
||||
|
||||
/*
|
||||
* initialize binary array container. call at startup.
|
||||
*/
|
||||
void netsnmp_container_binary_array_init(void);
|
||||
|
||||
/*
|
||||
* get an container which uses an binary_array for storage
|
||||
*/
|
||||
netsnmp_container * netsnmp_container_get_binary_array(void);
|
||||
|
||||
/*
|
||||
* get a factory for producing binary_array objects
|
||||
*/
|
||||
netsnmp_factory * netsnmp_container_get_binary_array_factory(void);
|
||||
|
||||
|
||||
int netsnmp_binary_array_remove(netsnmp_container *c, const void *key,
|
||||
void **save);
|
||||
|
||||
void netsnmp_binary_array_release(netsnmp_container *c);
|
||||
|
||||
void netsnmp_container_binary_array_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -1,62 +0,0 @@
|
||||
/**
|
||||
* @file container_iterator.h
|
||||
* @addtogroup container_iterator
|
||||
* @{
|
||||
*/
|
||||
#ifndef _CONTAINER_ITERATOR_HANDLER_H_
|
||||
#define _CONTAINER_ITERATOR_HANDLER_H_
|
||||
|
||||
#include "container.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int (Netsnmp_Iterator_Loop_Key) (void *iterator_ctx,
|
||||
netsnmp_ref_void* loop_ctx,
|
||||
netsnmp_ref_void* key);
|
||||
typedef int (Netsnmp_Iterator_Loop_Data)(void *iterator_ctx,
|
||||
netsnmp_ref_void* loop_ctx,
|
||||
netsnmp_ref_void* data);
|
||||
typedef int (Netsnmp_Iterator_Ctx) (void *iterator_ctx,
|
||||
netsnmp_ref_void* loop_ctx);
|
||||
typedef int (Netsnmp_Iterator_Ctx_Dup) (void *iterator_ctx,
|
||||
netsnmp_ref_void* loop_ctx,
|
||||
netsnmp_ref_void* dup_ctx,
|
||||
int reuse);
|
||||
typedef int (Netsnmp_Iterator_Op) (void *iterator_ctx);
|
||||
typedef int (Netsnmp_Iterator_Data) (void *iterator_ctx,
|
||||
const void *data);
|
||||
|
||||
void netsnmp_container_iterator_init(void);
|
||||
|
||||
netsnmp_container* netsnmp_container_iterator_get(
|
||||
void *iterator_user_ctx,
|
||||
netsnmp_container_compare * compare,
|
||||
Netsnmp_Iterator_Loop_Key * get_first,
|
||||
Netsnmp_Iterator_Loop_Key * get_next,
|
||||
Netsnmp_Iterator_Loop_Data * get_data,
|
||||
Netsnmp_Iterator_Ctx_Dup * save_pos, /* iff returning static data */
|
||||
Netsnmp_Iterator_Ctx * init_loop_ctx,
|
||||
Netsnmp_Iterator_Ctx * cleanup_loop_ctx,
|
||||
Netsnmp_Iterator_Data * free_user_ctx,
|
||||
int sorted);
|
||||
|
||||
/*
|
||||
* set up optional callbacks/
|
||||
* NOTE: even though the first parameter is a generic netsnmp_container,
|
||||
* this function should only be called for a container created
|
||||
* by netsnmp_container_iterator_get.
|
||||
*/
|
||||
void
|
||||
netsnmp_container_iterator_set_data_cb(netsnmp_container *c,
|
||||
Netsnmp_Iterator_Data * insert_data,
|
||||
Netsnmp_Iterator_Data * remove_data,
|
||||
Netsnmp_Iterator_Op * get_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _CONTAINER_ITERATOR_HANDLER_H_ */
|
||||
/** @} */
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* container_list_sl.h
|
||||
* $Id: container_list_ssll.h,v 1.3 2004/09/14 02:29:16 rstory Exp $
|
||||
*
|
||||
*/
|
||||
#ifndef NETSNMP_CONTAINER_SSLL_H
|
||||
#define NETSNMP_CONTAINER_SSLL_H
|
||||
|
||||
|
||||
#include <net-snmp/library/container.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
netsnmp_container *netsnmp_container_get_sorted_singly_linked_list(void);
|
||||
netsnmp_container *netsnmp_container_get_singly_linked_list(int fifo);
|
||||
|
||||
void netsnmp_container_ssll_init(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /** NETSNMP_CONTAINER_SSLL_H */
|
@ -1,20 +0,0 @@
|
||||
#ifndef NETSNMP_CONTAINER_NULL_H
|
||||
#define NETSNMP_CONTAINER_NULL_H
|
||||
|
||||
|
||||
#include <net-snmp/library/container.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
netsnmp_container *netsnmp_container_get_null(void);
|
||||
|
||||
void netsnmp_container_null_init(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /** NETSNMP_CONTAINER_NULL_H */
|
@ -1,98 +0,0 @@
|
||||
/* 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 <20> 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 netsnmp_data_list.h
|
||||
*
|
||||
* @addtogroup agent
|
||||
* @addtogroup library *
|
||||
*
|
||||
* $Id: data_list.h,v 5.3 2004/02/16 20:46:24 hardaker Exp $
|
||||
*
|
||||
* External definitions for functions and variables in netsnmp_data_list.c.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef DATA_LIST_H
|
||||
#define DATA_LIST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <net-snmp/library/snmp_impl.h>
|
||||
#include <net-snmp/library/tools.h>
|
||||
|
||||
typedef void (Netsnmp_Free_List_Data) (void *);
|
||||
typedef int (Netsnmp_Save_List_Data) (char *buf, size_t buf_len, void *);
|
||||
typedef void * (Netsnmp_Read_List_Data) (char *buf, size_t buf_len);
|
||||
|
||||
/** @struct netsnmp_data_list_s
|
||||
* used to iterate through lists of data
|
||||
*/
|
||||
typedef struct netsnmp_data_list_s {
|
||||
struct netsnmp_data_list_s *next;
|
||||
char *name;
|
||||
/** The pointer to the data passed on. */
|
||||
void *data;
|
||||
/** must know how to free netsnmp_data_list->data */
|
||||
Netsnmp_Free_List_Data *free_func;
|
||||
} netsnmp_data_list;
|
||||
|
||||
typedef struct netsnmp_data_list_saveinfo_s {
|
||||
netsnmp_data_list **datalist;
|
||||
const char *type;
|
||||
const char *token;
|
||||
Netsnmp_Save_List_Data *data_list_save_ptr;
|
||||
Netsnmp_Read_List_Data *data_list_read_ptr;
|
||||
Netsnmp_Free_List_Data *data_list_free_ptr;
|
||||
} netsnmp_data_list_saveinfo;
|
||||
|
||||
NETSNMP_INLINE netsnmp_data_list *
|
||||
netsnmp_create_data_list(const char *, void *, Netsnmp_Free_List_Data* );
|
||||
void netsnmp_data_list_add_node(netsnmp_data_list **head,
|
||||
netsnmp_data_list *node);
|
||||
netsnmp_data_list *
|
||||
netsnmp_data_list_add_data(netsnmp_data_list **head,
|
||||
const char *name, void *data,
|
||||
Netsnmp_Free_List_Data * beer);
|
||||
void *netsnmp_get_list_data(netsnmp_data_list *head,
|
||||
const char *node);
|
||||
void netsnmp_free_list_data(netsnmp_data_list *head); /* single */
|
||||
void netsnmp_free_all_list_data(netsnmp_data_list *head); /* multiple */
|
||||
int netsnmp_remove_list_node(netsnmp_data_list **realhead,
|
||||
const char *name);
|
||||
NETSNMP_INLINE netsnmp_data_list *
|
||||
netsnmp_get_list_node(netsnmp_data_list *head,
|
||||
const char *name);
|
||||
|
||||
/** depreciated: use netsnmp_data_list_add_node() */
|
||||
void netsnmp_add_list_data(netsnmp_data_list **head,
|
||||
netsnmp_data_list *node);
|
||||
|
||||
|
||||
void
|
||||
netsnmp_register_save_list(netsnmp_data_list **datalist,
|
||||
const char *type, const char *token,
|
||||
Netsnmp_Save_List_Data *data_list_save_ptr,
|
||||
Netsnmp_Read_List_Data *data_list_read_ptr,
|
||||
Netsnmp_Free_List_Data *data_list_free_ptr);
|
||||
int
|
||||
netsnmp_save_all_data(netsnmp_data_list *head,
|
||||
const char *type, const char *token,
|
||||
Netsnmp_Save_List_Data * data_list_save_ptr);
|
||||
SNMPCallback netsnmp_save_all_data_callback;
|
||||
void netsnmp_read_data_callback(const char *token, char *line);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
/** @} */
|
@ -1,162 +0,0 @@
|
||||
/* 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 <20> 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 default_store.h: storage space for defaults
|
||||
*
|
||||
* @addtogroup default_store
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#ifndef DEFAULT_STORE_H
|
||||
#define DEFAULT_STORE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NETSNMP_DS_MAX_IDS 3
|
||||
#define NETSNMP_DS_MAX_SUBIDS 40 /* needs to be a multiple of 8 */
|
||||
|
||||
/*
|
||||
* begin storage definitions
|
||||
*/
|
||||
/**
|
||||
* @def NETSNMP_DS_LIBRARY_ID These definitions correspond with the "storid" argument to the API
|
||||
*/
|
||||
#define NETSNMP_DS_LIBRARY_ID 0
|
||||
#define NETSNMP_DS_APPLICATION_ID 1
|
||||
#define NETSNMP_DS_TOKEN_ID 2
|
||||
|
||||
/*
|
||||
* These definitions correspond with the "which" argument to the API,
|
||||
* when the storeid argument is NETSNMP_DS_LIBRARY_ID
|
||||
*/
|
||||
/*
|
||||
* library booleans
|
||||
*/
|
||||
#define NETSNMP_DS_LIB_MIB_ERRORS 0
|
||||
#define NETSNMP_DS_LIB_SAVE_MIB_DESCRS 1
|
||||
#define NETSNMP_DS_LIB_MIB_COMMENT_TERM 2
|
||||
#define NETSNMP_DS_LIB_MIB_PARSE_LABEL 3
|
||||
#define NETSNMP_DS_LIB_DUMP_PACKET 4
|
||||
#define NETSNMP_DS_LIB_LOG_TIMESTAMP 5
|
||||
#define NETSNMP_DS_LIB_DONT_READ_CONFIGS 6
|
||||
#define NETSNMP_DS_LIB_MIB_REPLACE 7 /* replace objects from latest module */
|
||||
#define NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM 8 /* print only numeric enum values */
|
||||
#define NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS 9 /* print only numeric enum values */
|
||||
#define NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS 10 /* dont print oid indexes specially */
|
||||
#define NETSNMP_DS_LIB_ALARM_DONT_USE_SIG 11 /* don't use the alarm() signal */
|
||||
#define NETSNMP_DS_LIB_PRINT_FULL_OID 12 /* print fully qualified oids */
|
||||
#define NETSNMP_DS_LIB_QUICK_PRINT 13 /* print very brief output for parsing */
|
||||
#define NETSNMP_DS_LIB_RANDOM_ACCESS 14 /* random access to oid labels */
|
||||
#define NETSNMP_DS_LIB_REGEX_ACCESS 15 /* regex matching to oid labels */
|
||||
#define NETSNMP_DS_LIB_DONT_CHECK_RANGE 16 /* don't check values for ranges on send */
|
||||
#define NETSNMP_DS_LIB_NO_TOKEN_WARNINGS 17 /* no warn about unknown config tokens */
|
||||
#define NETSNMP_DS_LIB_NUMERIC_TIMETICKS 18 /* print timeticks as a number */
|
||||
#define NETSNMP_DS_LIB_ESCAPE_QUOTES 19 /* shell escape quote marks in oids */
|
||||
#define NETSNMP_DS_LIB_REVERSE_ENCODE 20 /* encode packets from back to front */
|
||||
#define NETSNMP_DS_LIB_PRINT_BARE_VALUE 21 /* just print value (not OID = value) */
|
||||
#define NETSNMP_DS_LIB_EXTENDED_INDEX 22 /* print extended index format [x1][x2] */
|
||||
#define NETSNMP_DS_LIB_PRINT_HEX_TEXT 23 /* print ASCII text along with hex strings */
|
||||
#define NETSNMP_DS_LIB_PRINT_UCD_STYLE_OID 24 /* print OID's using the UCD-style prefix suppression */
|
||||
#define NETSNMP_DS_LIB_READ_UCD_STYLE_OID 25 /* require top-level OIDs to be prefixed with a dot */
|
||||
#define NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG 26 /* have the pre-mib parsing config tokens been processed */
|
||||
#define NETSNMP_DS_LIB_HAVE_READ_CONFIG 27 /* have the config tokens been processed */
|
||||
#define NETSNMP_DS_LIB_QUICKE_PRINT 28
|
||||
#define NETSNMP_DS_LIB_DONT_PRINT_UNITS 29 /* don't print UNITS suffix */
|
||||
#define NETSNMP_DS_LIB_NO_DISPLAY_HINT 30 /* don't apply DISPLAY-HINTs */
|
||||
#define NETSNMP_DS_LIB_16BIT_IDS 31 /* restrict requestIDs, etc to 16-bit values */
|
||||
#define NETSNMP_DS_LIB_DONT_PERSIST_STATE 32 /* don't save/load any persistant state */
|
||||
#define NETSNMP_DS_LIB_2DIGIT_HEX_OUTPUT 33 /* print a leading 0 on hex values <= 'f' */
|
||||
#define NETSNMP_DS_LIB_IGNORE_NO_COMMUNITY 34 /* don't complain if not community is specified in the command arguments */
|
||||
|
||||
/*
|
||||
* library integers
|
||||
*/
|
||||
#define NETSNMP_DS_LIB_MIB_WARNINGS 0
|
||||
#define NETSNMP_DS_LIB_SECLEVEL 1
|
||||
#define NETSNMP_DS_LIB_SNMPVERSION 2
|
||||
#define NETSNMP_DS_LIB_DEFAULT_PORT 3
|
||||
#define NETSNMP_DS_LIB_OID_OUTPUT_FORMAT 4
|
||||
#define NETSNMP_DS_LIB_PRINT_SUFFIX_ONLY NETSNMP_DS_LIB_OID_OUTPUT_FORMAT
|
||||
#define NETSNMP_DS_LIB_STRING_OUTPUT_FORMAT 5
|
||||
#define NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH 6
|
||||
#define NETSNMP_DS_LIB_SERVERSENDBUF 7 /* send buffer (server) */
|
||||
#define NETSNMP_DS_LIB_SERVERRECVBUF 8 /* receive buffer (server) */
|
||||
#define NETSNMP_DS_LIB_CLIENTSENDBUF 9 /* send buffer (client) */
|
||||
#define NETSNMP_DS_LIB_CLIENTRECVBUF 10 /* receive buffer (client) */
|
||||
|
||||
/*
|
||||
* special meanings for the default SNMP version slot (NETSNMP_DS_LIB_SNMPVERSION)
|
||||
*/
|
||||
#ifndef DISABLE_SNMPV1
|
||||
#define NETSNMP_DS_SNMP_VERSION_1 128 /* bogus */
|
||||
#endif
|
||||
#ifndef DISABLE_SNMPV2C
|
||||
#define NETSNMP_DS_SNMP_VERSION_2c 1 /* real */
|
||||
#endif
|
||||
#define NETSNMP_DS_SNMP_VERSION_3 3 /* real */
|
||||
|
||||
|
||||
/*
|
||||
* library strings
|
||||
*/
|
||||
#define NETSNMP_DS_LIB_SECNAME 0
|
||||
#define NETSNMP_DS_LIB_CONTEXT 1
|
||||
#define NETSNMP_DS_LIB_PASSPHRASE 2
|
||||
#define NETSNMP_DS_LIB_AUTHPASSPHRASE 3
|
||||
#define NETSNMP_DS_LIB_PRIVPASSPHRASE 4
|
||||
#define NETSNMP_DS_LIB_OPTIONALCONFIG 5
|
||||
#define NETSNMP_DS_LIB_APPTYPE 6
|
||||
#define NETSNMP_DS_LIB_COMMUNITY 7
|
||||
#define NETSNMP_DS_LIB_PERSISTENT_DIR 8
|
||||
#define NETSNMP_DS_LIB_CONFIGURATION_DIR 9
|
||||
#define NETSNMP_DS_LIB_SECMODEL 10
|
||||
#define NETSNMP_DS_LIB_MIBDIRS 11
|
||||
#define NETSNMP_DS_LIB_OIDSUFFIX 12
|
||||
#define NETSNMP_DS_LIB_OIDPREFIX 13
|
||||
#define NETSNMP_DS_LIB_CLIENT_ADDR 14
|
||||
#define NETSNMP_DS_LIB_TEMP_FILE_PATTERN 15
|
||||
#define NETSNMP_DS_LIB_AUTHMASTERKEY 16
|
||||
#define NETSNMP_DS_LIB_PRIVMASTERKEY 17
|
||||
#define NETSNMP_DS_LIB_AUTHLOCALIZEDKEY 18
|
||||
#define NETSNMP_DS_LIB_PRIVLOCALIZEDKEY 19
|
||||
#define NETSNMP_DS_LIB_APPTYPES 20
|
||||
#define NETSNMP_DS_LIB_KSM_KEYTAB 21
|
||||
#define NETSNMP_DS_LIB_KSM_SERVICE_NAME 22
|
||||
|
||||
/*
|
||||
* end storage definitions
|
||||
*/
|
||||
|
||||
int netsnmp_ds_set_boolean(int storeid, int which, int value);
|
||||
int netsnmp_ds_get_boolean(int storeid, int which);
|
||||
int netsnmp_ds_toggle_boolean(int storeid, int which);
|
||||
int netsnmp_ds_set_int(int storeid, int which, int value);
|
||||
int netsnmp_ds_get_int(int storeid, int which);
|
||||
int netsnmp_ds_set_string(int storeid, int which,
|
||||
const char *value);
|
||||
char *netsnmp_ds_get_string(int storeid, int which);
|
||||
int netsnmp_ds_set_void(int storeid, int which, void *value);
|
||||
void *netsnmp_ds_get_void(int storeid, int which);
|
||||
int netsnmp_ds_register_config(u_char type, const char *ftype,
|
||||
const char *token, int storeid,
|
||||
int which);
|
||||
int netsnmp_ds_register_premib(u_char type, const char *ftype,
|
||||
const char *token, int storeid,
|
||||
int which);
|
||||
void netsnmp_ds_shutdown(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* DEFAULT_STORE_H */
|
||||
/** @} */
|
@ -1,72 +0,0 @@
|
||||
#ifndef NETSNMP_FACTORY_H
|
||||
#define NETSNMP_FACTORY_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void * (netsnmp_factory_produce_f)(void);
|
||||
typedef int (netsnmp_factory_produce_noalloc_f)(void *);
|
||||
|
||||
typedef struct netsnmp_factory_s {
|
||||
/*
|
||||
* a string describing the product the factory creates
|
||||
*/
|
||||
const char *product;
|
||||
|
||||
/*
|
||||
* a function to create an object in newly allcoated memory
|
||||
*/
|
||||
netsnmp_factory_produce_f *produce;
|
||||
|
||||
/*
|
||||
* a function to create an object in previously allcoated memory
|
||||
*/
|
||||
netsnmp_factory_produce_noalloc_f *produce_noalloc;
|
||||
|
||||
} netsnmp_factory;
|
||||
|
||||
/*
|
||||
* init factory registry
|
||||
*/
|
||||
void netsnmp_factory_init(void);
|
||||
|
||||
/*
|
||||
* register a factory type
|
||||
*/
|
||||
int netsnmp_factory_register(netsnmp_factory *f);
|
||||
|
||||
/*
|
||||
* get a factory
|
||||
*/
|
||||
netsnmp_factory* netsnmp_factory_get(const char* product);
|
||||
|
||||
/*
|
||||
* ask a factory to produce an object
|
||||
*/
|
||||
void * netsnmp_factory_produce(const char* product);
|
||||
|
||||
/*
|
||||
* ask a factory to produce an object in the provided memory
|
||||
*/
|
||||
int netsnmp_factory_produce_noalloc(const char *product, void *memory);
|
||||
|
||||
/*
|
||||
* factory return codes
|
||||
*/
|
||||
enum {
|
||||
FACTORY_NOERROR = 0,
|
||||
FACTORY_EXISTS,
|
||||
FACTORY_NOTFOUND,
|
||||
FACTORY_NOMEMORY,
|
||||
FACTORY_GENERR,
|
||||
FACTORY_MAXIMUM_ERROR
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* NETSNMP_FACTORY_H */
|
@ -1,15 +0,0 @@
|
||||
#ifndef _GETOPT_H_
|
||||
#define _GETOPT_H_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
NETSNMP_IMPORT int getopt(int, char *const *, const char *);
|
||||
NETSNMP_IMPORT char *optarg;
|
||||
NETSNMP_IMPORT int optind, opterr, optopt, optreset;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -1,38 +0,0 @@
|
||||
#ifndef INT64_INCLUDED
|
||||
#define INT64_INCLUDED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct counter64 U64;
|
||||
|
||||
#define I64CHARSZ 21
|
||||
|
||||
void divBy10(U64, U64 *, unsigned int *);
|
||||
void multBy10(U64, U64 *);
|
||||
void incrByU16(U64 *, unsigned int);
|
||||
void incrByU32(U64 *, unsigned int);
|
||||
void zeroU64(U64 *);
|
||||
int isZeroU64(const U64 *);
|
||||
void printU64(char *, const U64 *);
|
||||
void printI64(char *, const U64 *);
|
||||
int read64(U64 *, const char *);
|
||||
void u64Subtract(const U64 * pu64one, const U64 * pu64two,
|
||||
U64 * pu64out);
|
||||
void u64Incr(U64 * pu64out, const U64 * pu64one);
|
||||
void u64UpdateCounter(U64 * pu64out, const U64 * pu64one,
|
||||
const U64 * pu64two);
|
||||
void u64Copy(U64 * pu64one, const U64 * pu64two);
|
||||
|
||||
int netsnmp_c64_check_for_32bit_wrap(U64 *old_val, U64 *new_val,
|
||||
int adjust);
|
||||
int netsnmp_c64_check32_and_update(struct counter64 *prev_val,
|
||||
struct counter64 *new_val,
|
||||
struct counter64 *old_prev_val,
|
||||
int *need_wrap_check);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* keytools.h
|
||||
*/
|
||||
|
||||
#ifndef _KEYTOOLS_H
|
||||
#define _KEYTOOLS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define USM_LENGTH_EXPANDED_PASSPHRASE (1024 * 1024) /* 1Meg. */
|
||||
|
||||
#define USM_LENGTH_KU_HASHBLOCK 64 /* In bytes. */
|
||||
|
||||
#define USM_LENGTH_P_MIN 8 /* In characters. */
|
||||
/*
|
||||
* Recommended practice given in <draft-ietf-snmpv3-usm-v2-02.txt>,
|
||||
* * Section 11.2 "Defining Users". Move into cmdline app argument
|
||||
* * parsing, and out of the internal routine? XXX
|
||||
*/
|
||||
|
||||
/*
|
||||
* Prototypes.h
|
||||
*/
|
||||
int generate_Ku(const oid * hashtype, u_int hashtype_len,
|
||||
u_char * P, size_t pplen,
|
||||
u_char * Ku, size_t * kulen);
|
||||
|
||||
int generate_kul(const oid * hashtype, u_int hashtype_len,
|
||||
u_char * engineID, size_t engineID_len,
|
||||
u_char * Ku, size_t ku_len,
|
||||
u_char * Kul, size_t * kul_len);
|
||||
|
||||
int encode_keychange(const oid * hashtype,
|
||||
u_int hashtype_len, u_char * oldkey,
|
||||
size_t oldkey_len, u_char * newkey,
|
||||
size_t newkey_len, u_char * kcstring,
|
||||
size_t * kcstring_len);
|
||||
|
||||
int decode_keychange(const oid * hashtype,
|
||||
u_int hashtype_len, u_char * oldkey,
|
||||
size_t oldkey_len, u_char * kcstring,
|
||||
size_t kcstring_len, u_char * newkey,
|
||||
size_t * newkey_len);
|
||||
|
||||
|
||||
/*
|
||||
* All functions devolve to the following block if we can't do cryptography
|
||||
*/
|
||||
#define _KEYTOOLS_NOT_AVAILABLE \
|
||||
{ \
|
||||
return SNMPERR_KT_NOT_AVAILABLE; \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _KEYTOOLS_H */
|
@ -1,136 +0,0 @@
|
||||
/*
|
||||
* lcd_time.h
|
||||
*/
|
||||
|
||||
#ifndef _LCD_TIME_H
|
||||
#define _LCD_TIME_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* undefine to enable time synchronization only on authenticated packets
|
||||
*/
|
||||
#define LCD_TIME_SYNC_OPT 1
|
||||
|
||||
/*
|
||||
* Macros and definitions.
|
||||
*/
|
||||
#define ETIMELIST_SIZE 23
|
||||
|
||||
|
||||
|
||||
typedef struct enginetime_struct {
|
||||
u_char *engineID;
|
||||
u_int engineID_len;
|
||||
|
||||
u_int engineTime;
|
||||
u_int engineBoot;
|
||||
/*
|
||||
* Time & boots values received from last authenticated
|
||||
* * message within the previous time window.
|
||||
*/
|
||||
|
||||
time_t lastReceivedEngineTime;
|
||||
/*
|
||||
* Timestamp made when engineTime/engineBoots was last
|
||||
* * updated. Measured in seconds.
|
||||
*/
|
||||
|
||||
#ifdef LCD_TIME_SYNC_OPT
|
||||
u_int authenticatedFlag;
|
||||
#endif
|
||||
struct enginetime_struct *next;
|
||||
} enginetime , *Enginetime;
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Macros for streamlined engineID existence checks --
|
||||
*
|
||||
* e is char *engineID,
|
||||
* e_l is u_int engineID_len.
|
||||
*
|
||||
*
|
||||
* ISENGINEKNOWN(e, e_l)
|
||||
* Returns:
|
||||
* TRUE If engineID is recoreded in the EngineID List;
|
||||
* FALSE Otherwise.
|
||||
*
|
||||
* ENSURE_ENGINE_RECORD(e, e_l)
|
||||
* Adds the given engineID to the EngineID List if it does not exist
|
||||
* already. engineID is added with a <enginetime, engineboots>
|
||||
* tuple of <0,0>. ALWAYS succeeds -- except in case of a
|
||||
* fatal internal error.
|
||||
* Returns:
|
||||
* SNMPERR_SUCCESS On success;
|
||||
* SNMPERR_GENERR Otherwise.
|
||||
*
|
||||
* MAKENEW_ENGINE_RECORD(e, e_l)
|
||||
* Returns:
|
||||
* SNMPERR_SUCCESS If engineID already exists in the EngineID List;
|
||||
* SNMPERR_GENERR Otherwise -and- invokes ENSURE_ENGINE_RECORD()
|
||||
* to add an entry to the EngineID List.
|
||||
*
|
||||
* XXX Requres the following declaration in modules calling ISENGINEKNOWN():
|
||||
* static u_int dummy_etime, dummy_eboot;
|
||||
*/
|
||||
#define ISENGINEKNOWN(e, e_l) \
|
||||
( (get_enginetime(e, e_l, \
|
||||
&dummy_eboot, &dummy_etime, TRUE) == SNMPERR_SUCCESS) \
|
||||
? TRUE \
|
||||
: FALSE )
|
||||
|
||||
#define ENSURE_ENGINE_RECORD(e, e_l) \
|
||||
( (set_enginetime(e, e_l, 0, 0, FALSE) == SNMPERR_SUCCESS) \
|
||||
? SNMPERR_SUCCESS \
|
||||
: SNMPERR_GENERR )
|
||||
|
||||
#define MAKENEW_ENGINE_RECORD(e, e_l) \
|
||||
( (ISENGINEKNOWN(e, e_l) == TRUE) \
|
||||
? SNMPERR_SUCCESS \
|
||||
: (ENSURE_ENGINE_RECORD(e, e_l), SNMPERR_GENERR) )
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes.
|
||||
*/
|
||||
int get_enginetime(u_char * engineID, u_int engineID_len,
|
||||
u_int * engine_boot,
|
||||
u_int * engine_time,
|
||||
u_int authenticated);
|
||||
|
||||
int get_enginetime_ex(u_char * engineID,
|
||||
u_int engineID_len,
|
||||
u_int * engine_boot,
|
||||
u_int * engine_time,
|
||||
u_int * last_engine_time,
|
||||
u_int authenticated);
|
||||
|
||||
int set_enginetime(u_char * engineID, u_int engineID_len,
|
||||
u_int engine_boot, u_int engine_time,
|
||||
u_int authenticated);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Enginetime
|
||||
search_enginetime_list(u_char * engineID, u_int engineID_len);
|
||||
|
||||
int hash_engineID(u_char * engineID, u_int engineID_len);
|
||||
|
||||
void dump_etimelist_entry(Enginetime e, int count);
|
||||
void dump_etimelist(void);
|
||||
void free_enginetime(unsigned char *engineID, size_t engineID_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _LCD_TIME_H */
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* ** **************************************************************************
|
||||
* ** md5.h -- Header file for implementation of MD5 Message Digest Algorithm **
|
||||
* ** Updated: 2/13/90 by Ronald L. Rivest **
|
||||
* ** (C) 1990 RSA Data Security, Inc. **
|
||||
* ** **************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef MD5_H
|
||||
#define MD5_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* MDstruct is the data structure for a message digest computation.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int buffer[4]; /* Holds 4-word result of MD computation */
|
||||
unsigned char count[8]; /* Number of bits processed so far */
|
||||
unsigned int done; /* Nonzero means MD computation finished */
|
||||
} MDstruct , *MDptr;
|
||||
|
||||
/*
|
||||
* MDbegin(MD)
|
||||
* ** Input: MD -- an MDptr
|
||||
* ** Initialize the MDstruct prepatory to doing a message digest computation.
|
||||
*/
|
||||
extern void MDbegin(MDptr);
|
||||
|
||||
/*
|
||||
* MDupdate(MD,X,count)
|
||||
* ** Input: MD -- an MDptr
|
||||
* ** X -- a pointer to an array of unsigned characters.
|
||||
* ** count -- the number of bits of X to use (an unsigned int).
|
||||
* ** Updates MD using the first ``count'' bits of X.
|
||||
* ** The array pointed to by X is not modified.
|
||||
* ** If count is not a multiple of 8, MDupdate uses high bits of last byte.
|
||||
* ** This is the basic input routine for a user.
|
||||
* ** The routine terminates the MD computation when count < 512, so
|
||||
* ** every MD computation should end with one call to MDupdate with a
|
||||
* ** count less than 512. Zero is OK for a count.
|
||||
*/
|
||||
extern int MDupdate(MDptr, unsigned char *, unsigned int);
|
||||
|
||||
/*
|
||||
* MDprint(MD)
|
||||
* ** Input: MD -- an MDptr
|
||||
* ** Prints message digest buffer MD as 32 hexadecimal digits.
|
||||
* ** Order is from low-order byte of buffer[0] to high-order byte of buffer[3].
|
||||
* ** Each byte is printed with high-order hexadecimal digit first.
|
||||
*/
|
||||
extern void MDprint(MDptr);
|
||||
|
||||
int MDchecksum(u_char * data, size_t len, u_char * mac,
|
||||
size_t maclen);
|
||||
int MDsign(u_char * data, size_t len, u_char * mac,
|
||||
size_t maclen, u_char * secret,
|
||||
size_t secretlen);
|
||||
void MDget(MDstruct * MD, u_char * buf, size_t buflen);
|
||||
|
||||
/*
|
||||
* ** End of md5.h
|
||||
* ****************************(cut)****************************************
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* MD5_H */
|
@ -1,528 +0,0 @@
|
||||
#ifndef MIB_H
|
||||
#define MIB_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* mib.h - Definitions for the variables as defined in the MIB
|
||||
*
|
||||
* Update: 1998-07-17 <jhy@gsu.edu>
|
||||
* Added prototypes for print_oid_report* functions.
|
||||
*/
|
||||
/***********************************************************
|
||||
Copyright 1988, 1989 by Carnegie Mellon University
|
||||
|
||||
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 not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
CMU 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.
|
||||
******************************************************************/
|
||||
|
||||
#include <stdio.h> /* for FILE */
|
||||
|
||||
#define MIB 1, 3, 6, 1, 2, 1
|
||||
|
||||
#define MIB_IFTYPE_OTHER 1
|
||||
#define MIB_IFTYPE_REGULAR1822 2
|
||||
#define MIB_IFTYPE_HDH1822 3
|
||||
#define MIB_IFTYPE_DDNX25 4
|
||||
#define MIB_IFTYPE_RFC877X25 5
|
||||
#define MIB_IFTYPE_ETHERNETCSMACD 6
|
||||
#define MIB_IFTYPE_ISO88023CSMACD 7
|
||||
#define MIB_IFTYPE_ISO88024TOKENBUS 8
|
||||
#define MIB_IFTYPE_ISO88025TOKENRING 9
|
||||
#define MIB_IFTYPE_ISO88026MAN 10
|
||||
#define MIB_IFTYPE_STARLAN 11
|
||||
#define MIB_IFTYPE_PROTEON10MBIT 12
|
||||
#define MIB_IFTYPE_PROTEON80MBIT 13
|
||||
#define MIB_IFTYPE_HYPERCHANNEL 14
|
||||
#define MIB_IFTYPE_FDDI 15
|
||||
#define MIB_IFTYPE_LAPB 16
|
||||
#define MIB_IFTYPE_SDLC 17
|
||||
#define MIB_IFTYPE_T1CARRIER 18
|
||||
#define MIB_IFTYPE_CEPT 19
|
||||
#define MIB_IFTYPE_BASICISDN 20
|
||||
#define MIB_IFTYPE_PRIMARYISDN 21
|
||||
#define MIB_IFTYPE_PROPPOINTTOPOINTSERIAL 22
|
||||
|
||||
#define MIB_IFSTATUS_UP 1
|
||||
#define MIB_IFSTATUS_DOWN 2
|
||||
#define MIB_IFSTATUS_TESTING 3
|
||||
|
||||
#define MIB_FORWARD_GATEWAY 1
|
||||
#define MIB_FORWARD_HOST 2
|
||||
|
||||
#define MIB_IPROUTETYPE_OTHER 1
|
||||
#define MIB_IPROUTETYPE_INVALID 2
|
||||
#define MIB_IPROUTETYPE_DIRECT 3
|
||||
#define MIB_IPROUTETYPE_REMOTE 4
|
||||
|
||||
#define MIB_IPROUTEPROTO_OTHER 1
|
||||
#define MIB_IPROUTEPROTO_LOCAL 2
|
||||
#define MIB_IPROUTEPROTO_NETMGMT 3
|
||||
#define MIB_IPROUTEPROTO_ICMP 4
|
||||
#define MIB_IPROUTEPROTO_EGP 5
|
||||
#define MIB_IPROUTEPROTO_GGP 6
|
||||
#define MIB_IPROUTEPROTO_HELLO 7
|
||||
#define MIB_IPROUTEPROTO_RIP 8
|
||||
#define MIB_IPROUTEPROTO_ISIS 9
|
||||
#define MIB_IPROUTEPROTO_ESIS 10
|
||||
#define MIB_IPROUTEPROTO_CISCOIGRP 11
|
||||
#define MIB_IPROUTEPROTO_BBNSPFIGP 12
|
||||
#define MIB_IPROUTEPROTO_OIGP 13
|
||||
|
||||
#define MIB_TCPRTOALG_OTHER 1
|
||||
#define MIB_TCPRTOALG_CONSTANT 2
|
||||
#define MIB_TCPRTOALG_RSRE 3
|
||||
#define MIB_TCPRTOALG_VANJ 4
|
||||
|
||||
#define MIB_TCPCONNSTATE_CLOSED 1
|
||||
#define MIB_TCPCONNSTATE_LISTEN 2
|
||||
#define MIB_TCPCONNSTATE_SYNSENT 3
|
||||
#define MIB_TCPCONNSTATE_SYNRECEIVED 4
|
||||
#define MIB_TCPCONNSTATE_ESTABLISHED 5
|
||||
#define MIB_TCPCONNSTATE_FINWAIT1 6
|
||||
#define MIB_TCPCONNSTATE_FINWAIT2 7
|
||||
#define MIB_TCPCONNSTATE_CLOSEWAIT 8
|
||||
#define MIB_TCPCONNSTATE_LASTACK 9
|
||||
#define MIB_TCPCONNSTATE_CLOSING 10
|
||||
#define MIB_TCPCONNSTATE_TIMEWAIT 11
|
||||
|
||||
#define MIB_EGPNEIGHSTATE_IDLE 1
|
||||
#define MIB_EGPNEIGHSTATE_AQUISITION 2
|
||||
#define MIB_EGPNEIGHSTATE_DOWN 3
|
||||
#define MIB_EGPNEIGHSTATE_UP 4
|
||||
#define MIB_EGPNEIGHSTATE_CEASE 5
|
||||
|
||||
struct variable_list;
|
||||
struct enum_list;
|
||||
|
||||
void print_mib(FILE * fp);
|
||||
void print_ascii_dump(FILE *);
|
||||
int read_objid(const char *, oid *, size_t *);
|
||||
void register_mib_handlers(void);
|
||||
void netsnmp_set_mib_directory(const char *dir);
|
||||
char *netsnmp_get_mib_directory(void);
|
||||
void netsnmp_fixup_mib_directory(void);
|
||||
void init_mib(void);
|
||||
void shutdown_mib(void);
|
||||
void print_description(oid *, size_t, int);
|
||||
void fprint_description(FILE *, oid *, size_t, int);
|
||||
int snprint_description(char *, size_t, oid *, size_t, int);
|
||||
int sprint_realloc_description(u_char **, size_t *, size_t *,
|
||||
int, oid *, size_t, int);
|
||||
int get_module_node(const char *, const char *, oid *,
|
||||
size_t *);
|
||||
int get_wild_node(const char *, oid *, size_t *);
|
||||
int get_node(const char *, oid *, size_t *);
|
||||
oid *snmp_parse_oid(const char *, oid *, size_t *);
|
||||
struct tree *get_symbol(oid *, size_t, struct tree *, char *);
|
||||
struct tree *get_tree(const oid *, size_t, struct tree *);
|
||||
struct tree *get_tree_head(void);
|
||||
void set_function(struct tree *);
|
||||
|
||||
int parse_one_oid_index(oid ** oidStart, size_t * oidLen,
|
||||
netsnmp_variable_list * data,
|
||||
int complete);
|
||||
int parse_oid_indexes(oid * oidIndex, size_t oidLen,
|
||||
netsnmp_variable_list * data);
|
||||
int build_oid_noalloc(oid * in, size_t in_len,
|
||||
size_t * out_len, oid * prefix,
|
||||
size_t prefix_len,
|
||||
netsnmp_variable_list * indexes);
|
||||
int build_oid(oid ** out, size_t * out_len, oid * prefix,
|
||||
size_t prefix_len,
|
||||
netsnmp_variable_list * indexes);
|
||||
int build_oid_segment(netsnmp_variable_list * var);
|
||||
|
||||
|
||||
void print_variable(const oid * objid, size_t objidlen,
|
||||
const netsnmp_variable_list * variable);
|
||||
|
||||
void fprint_variable(FILE * fp,
|
||||
const oid * objid, size_t objidlen,
|
||||
const netsnmp_variable_list * variable);
|
||||
|
||||
int snprint_variable(char *buf, size_t buf_len,
|
||||
const oid * objid, size_t objidlen,
|
||||
const netsnmp_variable_list * variable);
|
||||
|
||||
int sprint_realloc_variable(u_char ** buf,
|
||||
size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const oid * objid,
|
||||
size_t objidlen,
|
||||
const netsnmp_variable_list *
|
||||
variable);
|
||||
|
||||
#ifndef DISABLE_MIB_LOADING
|
||||
struct tree *
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
netsnmp_sprint_realloc_objid_tree(u_char ** buf,
|
||||
size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
int *buf_overflow,
|
||||
const oid * objid,
|
||||
size_t objidlen);
|
||||
|
||||
void
|
||||
netsnmp_sprint_realloc_objid(u_char ** buf,
|
||||
size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
int *buf_overflow,
|
||||
const oid * objid,
|
||||
size_t objidlen);
|
||||
|
||||
void print_value(const oid * objid, size_t objidlen,
|
||||
const netsnmp_variable_list * variable);
|
||||
|
||||
void fprint_value(FILE * fp,
|
||||
const oid * objid, size_t objidlen,
|
||||
const netsnmp_variable_list * variable);
|
||||
|
||||
int snprint_value(char *buf, size_t buf_len,
|
||||
const oid * objid, size_t objidlen,
|
||||
const netsnmp_variable_list * variable);
|
||||
|
||||
int sprint_realloc_value(u_char ** buf, size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const oid * objid,
|
||||
size_t objidlen,
|
||||
const netsnmp_variable_list * variable);
|
||||
|
||||
|
||||
void print_objid(const oid * objid, size_t objidlen);
|
||||
|
||||
void fprint_objid(FILE * fp,
|
||||
const oid * objid, size_t objidlen);
|
||||
|
||||
int snprint_objid(char *buf, size_t buf_len,
|
||||
const oid * objid, size_t objidlen);
|
||||
|
||||
int sprint_realloc_objid(u_char ** buf, size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const oid * objid,
|
||||
size_t objidlen);
|
||||
|
||||
|
||||
int sprint_realloc_by_type(u_char ** buf, size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list * var,
|
||||
const struct enum_list *enums,
|
||||
const char *hint,
|
||||
const char *units);
|
||||
|
||||
int sprint_realloc_hexstring(u_char ** buf,
|
||||
size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const u_char *, size_t);
|
||||
|
||||
int sprint_realloc_asciistring(u_char ** buf,
|
||||
size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const u_char * cp,
|
||||
size_t len);
|
||||
|
||||
int sprint_realloc_octet_string(u_char ** buf,
|
||||
size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *,
|
||||
const char *,
|
||||
const char *);
|
||||
|
||||
int sprint_realloc_opaque(u_char ** buf, size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
int sprint_realloc_object_identifier(u_char ** buf,
|
||||
size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list
|
||||
*, const struct enum_list *,
|
||||
const char *,
|
||||
const char *);
|
||||
|
||||
int sprint_realloc_timeticks(u_char ** buf,
|
||||
size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *,
|
||||
const char *, const char *);
|
||||
|
||||
int sprint_realloc_hinted_integer(u_char ** buf,
|
||||
size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc, long,
|
||||
const char, const char *,
|
||||
const char *);
|
||||
|
||||
int sprint_realloc_integer(u_char ** buf, size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *,
|
||||
const char *, const char *);
|
||||
|
||||
int sprint_realloc_uinteger(u_char ** buf,
|
||||
size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *,
|
||||
const char *, const char *);
|
||||
|
||||
int sprint_realloc_gauge(u_char ** buf, size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
int sprint_realloc_counter(u_char ** buf, size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *,
|
||||
const char *, const char *);
|
||||
|
||||
int sprint_realloc_networkaddress(u_char ** buf,
|
||||
size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *,
|
||||
const char *,
|
||||
const char *);
|
||||
|
||||
int sprint_realloc_ipaddress(u_char ** buf,
|
||||
size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *,
|
||||
const char *, const char *);
|
||||
|
||||
int sprint_realloc_null(u_char ** buf, size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
int sprint_realloc_bitstring(u_char ** buf,
|
||||
size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *,
|
||||
const char *, const char *);
|
||||
|
||||
int sprint_realloc_nsapaddress(u_char ** buf,
|
||||
size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *,
|
||||
const char *, const char *);
|
||||
|
||||
int sprint_realloc_counter64(u_char ** buf,
|
||||
size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *,
|
||||
const char *, const char *);
|
||||
|
||||
int sprint_realloc_badtype(u_char ** buf, size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *,
|
||||
const char *, const char *);
|
||||
|
||||
#ifdef OPAQUE_SPECIAL_TYPES
|
||||
int sprint_realloc_float(u_char ** buf, size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
int sprint_realloc_double(u_char ** buf, size_t * buf_len,
|
||||
size_t * out_len,
|
||||
int allow_realloc,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
#endif
|
||||
|
||||
|
||||
int snprint_by_type(char *buf, size_t buf_len,
|
||||
netsnmp_variable_list * var,
|
||||
const struct enum_list *enums,
|
||||
const char *hint, const char *units);
|
||||
|
||||
int snprint_hexstring(char *buf, size_t buf_len,
|
||||
const u_char *, size_t);
|
||||
|
||||
int snprint_asciistring(char *buf, size_t buf_len,
|
||||
const u_char * cp, size_t len);
|
||||
|
||||
int snprint_octet_string(char *buf, size_t buf_len,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
int snprint_opaque(char *buf, size_t buf_len,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
int snprint_object_identifier(char *buf, size_t buf_len,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *,
|
||||
const char *, const char *);
|
||||
|
||||
int snprint_timeticks(char *buf, size_t buf_len,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
int snprint_hinted_integer(char *buf, size_t buf_len,
|
||||
long, const char *,
|
||||
const char *);
|
||||
|
||||
int snprint_integer(char *buf, size_t buf_len,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
int snprint_uinteger(char *buf, size_t buf_len,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
int snprint_gauge(char *buf, size_t buf_len,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
int snprint_counter(char *buf, size_t buf_len,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
int snprint_networkaddress(char *buf, size_t buf_len,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *,
|
||||
const char *, const char *);
|
||||
|
||||
int snprint_ipaddress(char *buf, size_t buf_len,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
int snprint_null(char *buf, size_t buf_len,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
int snprint_bitstring(char *buf, size_t buf_len,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
int snprint_nsapaddress(char *buf, size_t buf_len,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
int snprint_counter64(char *buf, size_t buf_len,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
int snprint_badtype(char *buf, size_t buf_len,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
#ifdef OPAQUE_SPECIAL_TYPES
|
||||
int snprint_float(char *buf, size_t buf_len,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
|
||||
int snprint_double(char *buf, size_t buf_len,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
#endif
|
||||
|
||||
void print_oid_report(FILE *);
|
||||
void print_oid_report_enable_labeledoid(void);
|
||||
void print_oid_report_enable_oid(void);
|
||||
void print_oid_report_enable_suffix(void);
|
||||
void print_oid_report_enable_symbolic(void);
|
||||
|
||||
const char *parse_octet_hint(const char *hint, const char *value,
|
||||
unsigned char **new_val, int *new_val_len);
|
||||
|
||||
void clear_tree_flags(register struct tree *tp);
|
||||
|
||||
char *snmp_out_toggle_options(char *);
|
||||
void snmp_out_toggle_options_usage(const char *, FILE *);
|
||||
char *snmp_in_toggle_options(char *);
|
||||
char *snmp_in_options(char *, int, char * const *);
|
||||
void snmp_in_toggle_options_usage(const char *, FILE *);
|
||||
u_char mib_to_asn_type(int mib_type);
|
||||
|
||||
|
||||
int netsnmp_str2oid(const char *S, oid * O, int L);
|
||||
|
||||
|
||||
#define NETSNMP_STRING_OUTPUT_GUESS 1
|
||||
#define NETSNMP_STRING_OUTPUT_ASCII 2
|
||||
#define NETSNMP_STRING_OUTPUT_HEX 3
|
||||
|
||||
#define NETSNMP_OID_OUTPUT_SUFFIX 1
|
||||
#define NETSNMP_OID_OUTPUT_MODULE 2
|
||||
#define NETSNMP_OID_OUTPUT_FULL 3
|
||||
#define NETSNMP_OID_OUTPUT_NUMERIC 4
|
||||
#define NETSNMP_OID_OUTPUT_UCD 5
|
||||
#define NETSNMP_OID_OUTPUT_NONE 6
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* MIB_H */
|
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* mt_support.h - multi-thread resource locking support declarations
|
||||
*/
|
||||
/*
|
||||
* Author: Markku Laukkanen
|
||||
* Created: 6-Sep-1999
|
||||
* History:
|
||||
* 8-Sep-1999 M. Slifcak method names changed;
|
||||
* use array of resource locking structures.
|
||||
*/
|
||||
|
||||
#ifndef MT_SUPPORT_H
|
||||
#define MT_SUPPORT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Lock group identifiers
|
||||
*/
|
||||
|
||||
#define MT_LIBRARY_ID 0
|
||||
#define MT_APPLICATION_ID 1
|
||||
#define MT_TOKEN_ID 2
|
||||
|
||||
#define MT_MAX_IDS 3 /* one greater than last from above */
|
||||
#define MT_MAX_SUBIDS 10
|
||||
|
||||
|
||||
/*
|
||||
* Lock resource identifiers for library resources
|
||||
*/
|
||||
|
||||
#define MT_LIB_NONE 0
|
||||
#define MT_LIB_SESSION 1
|
||||
#define MT_LIB_REQUESTID 2
|
||||
#define MT_LIB_MESSAGEID 3
|
||||
#define MT_LIB_SESSIONID 4
|
||||
#define MT_LIB_TRANSID 5
|
||||
|
||||
#define MT_LIB_MAXIMUM 6 /* must be one greater than the last one */
|
||||
|
||||
|
||||
#if defined(NS_REENTRANT) || defined(WIN32)
|
||||
|
||||
#if HAVE_PTHREAD_H
|
||||
#include <pthread.h>
|
||||
typedef pthread_mutex_t mutex_type;
|
||||
#ifdef pthread_mutexattr_default
|
||||
#define MT_MUTEX_INIT_DEFAULT pthread_mutexattr_default
|
||||
#else
|
||||
#define MT_MUTEX_INIT_DEFAULT 0
|
||||
#endif
|
||||
|
||||
#elif defined(WIN32) || defined(cygwin)
|
||||
|
||||
#include <windows.h>
|
||||
typedef CRITICAL_SECTION mutex_type;
|
||||
|
||||
#else /* HAVE_PTHREAD_H */
|
||||
error "There is no re-entrant support as defined."
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
|
||||
int snmp_res_init(void);
|
||||
int snmp_res_lock(int groupID, int resourceID);
|
||||
int snmp_res_unlock(int groupID, int resourceID);
|
||||
int snmp_res_destroy_mutex(int groupID, int resourceID);
|
||||
|
||||
#else /* NS_REENTRANT */
|
||||
|
||||
#ifndef WIN32
|
||||
#define snmp_res_init() do {} while (0)
|
||||
#define snmp_res_lock(x,y) do {} while (0)
|
||||
#define snmp_res_unlock(x,y) do {} while (0)
|
||||
#define snmp_res_destroy_mutex(x,y) do {} while (0)
|
||||
#endif /* WIN32 */
|
||||
|
||||
#endif /* NS_REENTRANT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* MT_SUPPORT_H */
|
@ -1,78 +0,0 @@
|
||||
#ifndef OID_STASH_H
|
||||
#define OID_STASH_H
|
||||
|
||||
/*
|
||||
* designed to store/retrieve information associated with a given oid.
|
||||
* Storage is done in an efficient tree manner for fast lookups.
|
||||
*/
|
||||
|
||||
#define OID_STASH_CHILDREN_SIZE 31
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct netsnmp_oid_stash_node_s;
|
||||
|
||||
/* args: buffer, sizeof(buffer), yourdata, stashnode */
|
||||
typedef int (NetSNMPStashDump) (char *, size_t,
|
||||
void *,
|
||||
struct netsnmp_oid_stash_node_s *);
|
||||
|
||||
typedef void (NetSNMPStashFreeNode) (void *);
|
||||
|
||||
typedef struct netsnmp_oid_stash_node_s {
|
||||
oid value;
|
||||
struct netsnmp_oid_stash_node_s **children; /* array of children */
|
||||
size_t children_size;
|
||||
struct netsnmp_oid_stash_node_s *next_sibling; /* cache too small links */
|
||||
struct netsnmp_oid_stash_node_s *prev_sibling;
|
||||
struct netsnmp_oid_stash_node_s *parent;
|
||||
|
||||
void *thedata;
|
||||
} netsnmp_oid_stash_node;
|
||||
|
||||
typedef struct netsnmp_oid_stash_save_info_s {
|
||||
const char *token;
|
||||
netsnmp_oid_stash_node **root;
|
||||
NetSNMPStashDump *dumpfn;
|
||||
} netsnmp_oid_stash_save_info;
|
||||
|
||||
int netsnmp_oid_stash_add_data(netsnmp_oid_stash_node
|
||||
**root, oid * lookup,
|
||||
size_t lookup_len,
|
||||
void *mydata);
|
||||
SNMPCallback netsnmp_oid_stash_store_all;
|
||||
|
||||
|
||||
netsnmp_oid_stash_node
|
||||
*netsnmp_oid_stash_get_node(netsnmp_oid_stash_node *root,
|
||||
oid * lookup, size_t lookup_len);
|
||||
void *netsnmp_oid_stash_get_data(netsnmp_oid_stash_node
|
||||
*root, oid * lookup,
|
||||
size_t lookup_len);
|
||||
netsnmp_oid_stash_node *
|
||||
netsnmp_oid_stash_getnext_node(netsnmp_oid_stash_node *root,
|
||||
oid * lookup, size_t lookup_len);
|
||||
|
||||
netsnmp_oid_stash_node *netsnmp_oid_stash_create_sized_node(size_t
|
||||
mysize);
|
||||
netsnmp_oid_stash_node *netsnmp_oid_stash_create_node(void); /* returns a malloced node */
|
||||
|
||||
void netsnmp_oid_stash_store(netsnmp_oid_stash_node *root,
|
||||
const char *tokenname,
|
||||
NetSNMPStashDump *dumpfn,
|
||||
oid *curoid, size_t curoid_len);
|
||||
|
||||
/* frees all data in the stash and cleans it out. Sets root = NULL */
|
||||
void netsnmp_oid_stash_free(netsnmp_oid_stash_node **root,
|
||||
NetSNMPStashFreeNode *freefn);
|
||||
|
||||
|
||||
/* a noop function that can be passed to netsnmp_oid_stash_node to
|
||||
NOT free the data */
|
||||
NetSNMPStashFreeNode netsnmp_oid_stash_no_free;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* OID_STASH_H */
|
@ -1,251 +0,0 @@
|
||||
#ifndef PARSE_H
|
||||
#define PARSE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* parse.h
|
||||
*/
|
||||
/***********************************************************
|
||||
Copyright 1989 by Carnegie Mellon University
|
||||
|
||||
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 not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
CMU 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.
|
||||
******************************************************************/
|
||||
|
||||
#define MAXLABEL 64 /* maximum characters in a label */
|
||||
#define MAXTOKEN 128 /* maximum characters in a token */
|
||||
#define MAXQUOTESTR 4096 /* maximum characters in a quoted string */
|
||||
|
||||
struct variable_list;
|
||||
|
||||
/*
|
||||
* A linked list of tag-value pairs for enumerated integers.
|
||||
*/
|
||||
struct enum_list {
|
||||
struct enum_list *next;
|
||||
int value;
|
||||
char *label;
|
||||
};
|
||||
|
||||
/*
|
||||
* A linked list of ranges
|
||||
*/
|
||||
struct range_list {
|
||||
struct range_list *next;
|
||||
int low, high;
|
||||
};
|
||||
|
||||
/*
|
||||
* A linked list of indexes
|
||||
*/
|
||||
struct index_list {
|
||||
struct index_list *next;
|
||||
char *ilabel;
|
||||
char isimplied;
|
||||
};
|
||||
|
||||
/*
|
||||
* A linked list of varbinds
|
||||
*/
|
||||
struct varbind_list {
|
||||
struct varbind_list *next;
|
||||
char *vblabel;
|
||||
};
|
||||
|
||||
/*
|
||||
* A linked list of nodes.
|
||||
*/
|
||||
struct node {
|
||||
struct node *next;
|
||||
char *label; /* This node's (unique) textual name */
|
||||
u_long subid; /* This node's integer subidentifier */
|
||||
int modid; /* The module containing this node */
|
||||
char *parent; /* The parent's textual name */
|
||||
int tc_index; /* index into tclist (-1 if NA) */
|
||||
int type; /* The type of object this represents */
|
||||
int access;
|
||||
int status;
|
||||
struct enum_list *enums; /* (optional) list of enumerated integers */
|
||||
struct range_list *ranges;
|
||||
struct index_list *indexes;
|
||||
char *augments;
|
||||
struct varbind_list *varbinds;
|
||||
char *hint;
|
||||
char *units;
|
||||
char *description; /* description (a quoted string) */
|
||||
char *reference; /* references (a quoted string) */
|
||||
char *defaultValue;
|
||||
char *filename;
|
||||
int lineno;
|
||||
};
|
||||
|
||||
/*
|
||||
* A tree in the format of the tree structure of the MIB.
|
||||
*/
|
||||
struct tree {
|
||||
struct tree *child_list; /* list of children of this node */
|
||||
struct tree *next_peer; /* Next node in list of peers */
|
||||
struct tree *next; /* Next node in hashed list of names */
|
||||
struct tree *parent;
|
||||
char *label; /* This node's textual name */
|
||||
u_long subid; /* This node's integer subidentifier */
|
||||
int modid; /* The module containing this node */
|
||||
int number_modules;
|
||||
int *module_list; /* To handle multiple modules */
|
||||
int tc_index; /* index into tclist (-1 if NA) */
|
||||
int type; /* This node's object type */
|
||||
int access; /* This nodes access */
|
||||
int status; /* This nodes status */
|
||||
struct enum_list *enums; /* (optional) list of enumerated integers */
|
||||
struct range_list *ranges;
|
||||
struct index_list *indexes;
|
||||
char *augments;
|
||||
struct varbind_list *varbinds;
|
||||
char *hint;
|
||||
char *units;
|
||||
int (*printomat) (u_char **, size_t *, size_t *, int,
|
||||
const netsnmp_variable_list *,
|
||||
const struct enum_list *, const char *,
|
||||
const char *);
|
||||
void (*printer) (char *, const netsnmp_variable_list *, const struct enum_list *, const char *, const char *); /* Value printing function */
|
||||
char *description; /* description (a quoted string) */
|
||||
char *reference; /* references (a quoted string) */
|
||||
int reported; /* 1=report started in print_subtree... */
|
||||
char *defaultValue;
|
||||
};
|
||||
|
||||
/*
|
||||
* Information held about each MIB module
|
||||
*/
|
||||
struct module_import {
|
||||
char *label; /* The descriptor being imported */
|
||||
int modid; /* The module imported from */
|
||||
};
|
||||
|
||||
struct module {
|
||||
char *name; /* This module's name */
|
||||
char *file; /* The file containing the module */
|
||||
struct module_import *imports; /* List of descriptors being imported */
|
||||
int no_imports; /* The number of such import descriptors */
|
||||
/*
|
||||
* -1 implies the module hasn't been read in yet
|
||||
*/
|
||||
int modid; /* The index number of this module */
|
||||
struct module *next; /* Linked list pointer */
|
||||
};
|
||||
|
||||
struct module_compatability {
|
||||
const char *old_module;
|
||||
const char *new_module;
|
||||
const char *tag; /* NULL implies unconditional replacement,
|
||||
* otherwise node identifier or prefix */
|
||||
size_t tag_len; /* 0 implies exact match (or unconditional) */
|
||||
struct module_compatability *next; /* linked list */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* non-aggregate types for tree end nodes
|
||||
*/
|
||||
#define TYPE_OTHER 0
|
||||
#define TYPE_OBJID 1
|
||||
#define TYPE_OCTETSTR 2
|
||||
#define TYPE_INTEGER 3
|
||||
#define TYPE_NETADDR 4
|
||||
#define TYPE_IPADDR 5
|
||||
#define TYPE_COUNTER 6
|
||||
#define TYPE_GAUGE 7
|
||||
#define TYPE_TIMETICKS 8
|
||||
#define TYPE_OPAQUE 9
|
||||
#define TYPE_NULL 10
|
||||
#define TYPE_COUNTER64 11
|
||||
#define TYPE_BITSTRING 12
|
||||
#define TYPE_NSAPADDRESS 13
|
||||
#define TYPE_UINTEGER 14
|
||||
#define TYPE_UNSIGNED32 15
|
||||
#define TYPE_INTEGER32 16
|
||||
|
||||
#define TYPE_SIMPLE_LAST 16
|
||||
|
||||
#define TYPE_TRAPTYPE 20
|
||||
#define TYPE_NOTIFTYPE 21
|
||||
#define TYPE_OBJGROUP 22
|
||||
#define TYPE_NOTIFGROUP 23
|
||||
#define TYPE_MODID 24
|
||||
#define TYPE_AGENTCAP 25
|
||||
#define TYPE_MODCOMP 26
|
||||
|
||||
#define MIB_ACCESS_READONLY 18
|
||||
#define MIB_ACCESS_READWRITE 19
|
||||
#define MIB_ACCESS_WRITEONLY 20
|
||||
#define MIB_ACCESS_NOACCESS 21
|
||||
#define MIB_ACCESS_NOTIFY 67
|
||||
#define MIB_ACCESS_CREATE 48
|
||||
|
||||
#define MIB_STATUS_MANDATORY 23
|
||||
#define MIB_STATUS_OPTIONAL 24
|
||||
#define MIB_STATUS_OBSOLETE 25
|
||||
#define MIB_STATUS_DEPRECATED 39
|
||||
#define MIB_STATUS_CURRENT 57
|
||||
|
||||
#define ANON "anonymous#"
|
||||
#define ANON_LEN strlen(ANON)
|
||||
|
||||
struct tree *read_module(const char *);
|
||||
struct tree *read_mib(const char *);
|
||||
struct tree *read_all_mibs(void);
|
||||
int unload_module(const char *name);
|
||||
void unload_all_mibs(void);
|
||||
void init_mib_internals(void);
|
||||
int add_mibfile(const char*, const char*, FILE *);
|
||||
int add_mibdir(const char *);
|
||||
void add_module_replacement(const char *, const char *,
|
||||
const char *, int);
|
||||
int which_module(const char *);
|
||||
char *module_name(int, char *);
|
||||
void print_subtree(FILE *, struct tree *, int);
|
||||
void print_ascii_dump_tree(FILE *, struct tree *, int);
|
||||
struct tree *find_tree_node(const char *, int);
|
||||
const char *get_tc_descriptor(int);
|
||||
const char *get_tc_description(int);
|
||||
struct tree *find_best_tree_node(const char *, struct tree *,
|
||||
u_int *);
|
||||
/*
|
||||
* backwards compatability
|
||||
*/
|
||||
struct tree *find_node(const char *, struct tree *);
|
||||
struct tree *find_node2(const char *, const char *);
|
||||
struct module *find_module(int);
|
||||
void adopt_orphans(void);
|
||||
char *snmp_mib_toggle_options(char *options);
|
||||
void snmp_mib_toggle_options_usage(const char *lead,
|
||||
FILE * outf);
|
||||
void print_mib(FILE *);
|
||||
void print_mib_tree(FILE *, struct tree *, int);
|
||||
int get_mib_parse_error_count(void);
|
||||
int snmp_get_token(FILE * fp, char *token, int maxtlen);
|
||||
struct tree *find_best_tree_node(const char *name,
|
||||
struct tree *tree_top,
|
||||
u_int * match);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* PARSE_H */
|
@ -1,143 +0,0 @@
|
||||
/*
|
||||
* read_config.h: reads configuration files for extensible sections.
|
||||
*
|
||||
*/
|
||||
#ifndef READ_CONFIG_H
|
||||
#define READ_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define STRINGMAX 1024
|
||||
|
||||
#define NORMAL_CONFIG 0
|
||||
#define PREMIB_CONFIG 1
|
||||
#define EITHER_CONFIG 2
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Defines a set of file types and the parse and free functions
|
||||
* which process the syntax following a given token in a given file.
|
||||
*/
|
||||
struct config_files {
|
||||
char *fileHeader; /* Label for entire file. */
|
||||
struct config_line *start;
|
||||
struct config_files *next;
|
||||
};
|
||||
|
||||
struct config_line {
|
||||
char *config_token; /* Label for each line parser
|
||||
* in the given file. */
|
||||
void (*parse_line) (const char *, char *);
|
||||
void (*free_func) (void);
|
||||
struct config_line *next;
|
||||
char config_time; /* {NORMAL,PREMIB,EITHER}_CONFIG */
|
||||
char *help;
|
||||
};
|
||||
|
||||
struct read_config_memory {
|
||||
char *line;
|
||||
struct read_config_memory *next;
|
||||
};
|
||||
|
||||
|
||||
int netsnmp_config(char *); /* parse a simple line: token=values */
|
||||
void netsnmp_config_remember(char *); /* process later, during snmp_init() */
|
||||
void netsnmp_config_process_memories(void); /* run all memories through parser */
|
||||
void read_config(const char *, struct config_line *, int);
|
||||
void read_configs(void);
|
||||
void read_premib_configs(void);
|
||||
void read_config_files(int);
|
||||
void free_config(void);
|
||||
void config_perror(const char *);
|
||||
void config_pwarn(const char *);
|
||||
char *skip_white(char *);
|
||||
char *skip_not_white(char *);
|
||||
char *skip_token(char *);
|
||||
char *copy_nword(char *, char *, int);
|
||||
char *copy_word(char *, char *); /* do not use */
|
||||
void read_config_with_type(const char *, const char *);
|
||||
struct config_line *register_config_handler(const char *, const char *,
|
||||
void (*parser) (const char
|
||||
*, char *),
|
||||
void (*releaser) (void),
|
||||
const char *);
|
||||
struct config_line *register_app_config_handler(const char *,
|
||||
void (*parser) (const
|
||||
char *,
|
||||
char
|
||||
*),
|
||||
void (*releaser)
|
||||
(void), const char *);
|
||||
struct config_line *register_prenetsnmp_mib_handler(const char *,
|
||||
const char *,
|
||||
void (*parser)
|
||||
(const char *,
|
||||
char *),
|
||||
void (*releaser)
|
||||
(void),
|
||||
const char *);
|
||||
struct config_line *register_app_prenetsnmp_mib_handler(const char *,
|
||||
void (*parser)
|
||||
(const char *,
|
||||
char *),
|
||||
void
|
||||
(*releaser)
|
||||
(void),
|
||||
const char *);
|
||||
void unregister_config_handler(const char *, const char *);
|
||||
void unregister_app_config_handler(const char *);
|
||||
void unregister_all_config_handlers(void);
|
||||
void read_config_print_usage(const char *lead);
|
||||
char *read_config_save_octet_string(char *saveto,
|
||||
u_char * str,
|
||||
size_t len);
|
||||
char *read_config_read_octet_string(char *readfrom,
|
||||
u_char ** str,
|
||||
size_t * len);
|
||||
char *read_config_read_objid(char *readfrom, oid ** objid,
|
||||
size_t * len);
|
||||
char *read_config_save_objid(char *saveto, oid * objid,
|
||||
size_t len);
|
||||
char *read_config_read_data(int type, char *readfrom,
|
||||
void *dataptr, size_t * len);
|
||||
char *read_config_read_memory(int type, char *readfrom,
|
||||
char *dataptr, size_t * len);
|
||||
char *read_config_store_data(int type, char *storeto,
|
||||
void *dataptr, size_t * len);
|
||||
char *read_config_store_data_prefix(char prefix, int type,
|
||||
char *storeto,
|
||||
void *dataptr, size_t len);
|
||||
void read_config_store(const char *type, const char *line);
|
||||
void read_app_config_store(const char *line);
|
||||
void snmp_save_persistent(const char *type);
|
||||
void snmp_clean_persistent(const char *type);
|
||||
struct config_line *read_config_get_handlers(const char *type);
|
||||
|
||||
/*
|
||||
* external memory list handlers
|
||||
*/
|
||||
void snmp_config_remember_in_list(char *line,
|
||||
struct read_config_memory
|
||||
**mem);
|
||||
void snmp_config_process_memory_list(struct
|
||||
read_config_memory
|
||||
**mem, int, int);
|
||||
void snmp_config_remember_free_list(struct
|
||||
read_config_memory
|
||||
**mem);
|
||||
|
||||
void set_configuration_directory(const char *dir);
|
||||
const char *get_configuration_directory(void);
|
||||
void set_persistent_directory(const char *dir);
|
||||
const char *get_persistent_directory(void);
|
||||
void set_temp_file_pattern(const char *pattern);
|
||||
const char *get_temp_file_pattern(void);
|
||||
void handle_long_opt(const char *myoptarg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* READ_CONFIG_H */
|
@ -1,106 +0,0 @@
|
||||
/*
|
||||
* scapi.h
|
||||
*/
|
||||
|
||||
#ifndef _SCAPI_H
|
||||
#define _SCAPI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Authentication/privacy transform bitlengths.
|
||||
*/
|
||||
#define SNMP_TRANS_AUTHLEN_HMACMD5 128
|
||||
#define SNMP_TRANS_AUTHLEN_HMACSHA1 160
|
||||
|
||||
#define SNMP_TRANS_AUTHLEN_HMAC96 96
|
||||
|
||||
#define SNMP_TRANS_PRIVLEN_1DES 64
|
||||
#define SNMP_TRANS_PRIVLEN_1DES_IV 64
|
||||
|
||||
#define SNMP_TRANS_PRIVLEN_AES 128
|
||||
#define SNMP_TRANS_PRIVLEN_AES_IV 128
|
||||
#define SNMP_TRANS_AES_PADSIZE 128 /* backwards compat */
|
||||
#define SNMP_TRANS_PRIVLEN_AES128 128 /* backwards compat */
|
||||
#define SNMP_TRANS_PRIVLEN_AES128_IV 128 /* backwards compat */
|
||||
#define SNMP_TRANS_AES_AES128_PADSIZE 128 /* backwards compat */
|
||||
|
||||
/*
|
||||
* Prototypes.
|
||||
*/
|
||||
int sc_get_properlength(const oid * hashtype,
|
||||
u_int hashtype_len);
|
||||
int sc_get_proper_priv_length(const oid * privtype,
|
||||
u_int privtype_len);
|
||||
|
||||
int sc_init(void);
|
||||
int sc_shutdown(int majorID, int minorID, void *serverarg,
|
||||
void *clientarg);
|
||||
|
||||
int sc_random(u_char * buf, size_t * buflen);
|
||||
|
||||
int sc_generate_keyed_hash(const oid * authtype,
|
||||
size_t authtypelen,
|
||||
u_char * key, u_int keylen,
|
||||
u_char * message, u_int msglen,
|
||||
u_char * MAC, size_t * maclen);
|
||||
|
||||
int sc_check_keyed_hash(const oid * authtype,
|
||||
size_t authtypelen, u_char * key,
|
||||
u_int keylen, u_char * message,
|
||||
u_int msglen, u_char * MAC,
|
||||
u_int maclen);
|
||||
|
||||
int sc_encrypt(const oid * privtype, size_t privtypelen,
|
||||
u_char * key, u_int keylen,
|
||||
u_char * iv, u_int ivlen,
|
||||
u_char * plaintext, u_int ptlen,
|
||||
u_char * ciphertext, size_t * ctlen);
|
||||
|
||||
int sc_decrypt(const oid * privtype, size_t privtypelen,
|
||||
u_char * key, u_int keylen,
|
||||
u_char * iv, u_int ivlen,
|
||||
u_char * ciphertext, u_int ctlen,
|
||||
u_char * plaintext, size_t * ptlen);
|
||||
|
||||
int sc_hash(const oid * hashtype, size_t hashtypelen,
|
||||
u_char * buf, size_t buf_len,
|
||||
u_char * MAC, size_t * MAC_len);
|
||||
|
||||
int sc_get_transform_type(oid * hashtype,
|
||||
u_int hashtype_len,
|
||||
int (**hash_fn) (const int mode,
|
||||
void **context,
|
||||
const u_char *
|
||||
data,
|
||||
const int
|
||||
data_len,
|
||||
u_char **
|
||||
digest,
|
||||
size_t *
|
||||
digest_len));
|
||||
|
||||
|
||||
/*
|
||||
* All functions devolve to the following block if we can't do cryptography
|
||||
*/
|
||||
#define _SCAPI_NOT_CONFIGURED \
|
||||
{ \
|
||||
snmp_log(LOG_ERR, "Encryption support not enabled.\n"); \
|
||||
DEBUGMSGTL(("scapi", "SCAPI not configured")); \
|
||||
return SNMPERR_SC_NOT_CONFIGURED; \
|
||||
}
|
||||
|
||||
/*
|
||||
* define a transform type if we're using the internal md5 support
|
||||
*/
|
||||
#ifdef USE_INTERNAL_MD5
|
||||
#define INTERNAL_MD5 1
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _SCAPI_H */
|
@ -1,61 +0,0 @@
|
||||
#ifndef SNMP_TC_H
|
||||
#define SNMP_TC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* snmp-tc.h: Provide some standard #defines for Textual Convention
|
||||
* related value information
|
||||
*/
|
||||
|
||||
int
|
||||
netsnmp_dateandtime_set_buf_from_vars(u_char *buf, size_t *bufsize,
|
||||
u_short y, u_char mon, u_char d,
|
||||
u_char h, u_char min, u_char s,
|
||||
u_char deci_seconds,
|
||||
int utc_offset_direction,
|
||||
u_char utc_offset_hours,
|
||||
u_char utc_offset_minutes);
|
||||
|
||||
u_char *date_n_time(time_t *, size_t *);
|
||||
time_t ctime_to_timet(char *);
|
||||
|
||||
/*
|
||||
* TrueValue
|
||||
*/
|
||||
#define TV_TRUE 1
|
||||
#define TV_FALSE 2
|
||||
|
||||
/*
|
||||
* RowStatus
|
||||
*/
|
||||
#define RS_NONEXISTENT 0
|
||||
#define RS_ACTIVE 1
|
||||
#define RS_NOTINSERVICE 2
|
||||
#define RS_NOTREADY 3
|
||||
#define RS_CREATEANDGO 4
|
||||
#define RS_CREATEANDWAIT 5
|
||||
#define RS_DESTROY 6
|
||||
|
||||
#define RS_IS_GOING_ACTIVE( x ) ( x == RS_CREATEANDGO || x == RS_ACTIVE )
|
||||
#define RS_IS_ACTIVE( x ) ( x == RS_ACTIVE )
|
||||
#define RS_IS_NOT_ACTIVE( x ) ( ! RS_IS_GOING_ACTIVE(x) )
|
||||
|
||||
/*
|
||||
* StorageType
|
||||
*/
|
||||
#define ST_NONE 0
|
||||
#define ST_OTHER 1
|
||||
#define ST_VOLATILE 2
|
||||
#define ST_NONVOLATILE 3
|
||||
#define ST_PERMANENT 4
|
||||
#define ST_READONLY 5
|
||||
|
||||
char check_rowstatus_transition(int old_val, int new_val);
|
||||
char check_storage_transition(int old_val, int new_val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* SNMP_TC_H */
|
@ -1,344 +0,0 @@
|
||||
#ifndef SNMP_H
|
||||
#define SNMP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Definitions for the Simple Network Management Protocol (RFC 1067).
|
||||
*
|
||||
*
|
||||
*/
|
||||
/***********************************************************
|
||||
Copyright 1988, 1989 by Carnegie Mellon University
|
||||
|
||||
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 not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
CMU 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.
|
||||
******************************************************************/
|
||||
|
||||
|
||||
#define SNMP_PORT 161 /* standard UDP port for SNMP agents
|
||||
* to receive requests messages */
|
||||
#define SNMP_TRAP_PORT 162 /* standard UDP port for SNMP
|
||||
* managers to receive notificaion
|
||||
* (trap and inform) messages */
|
||||
|
||||
#define SNMP_MAX_LEN 1500 /* typical maximum message size */
|
||||
#define SNMP_MIN_MAX_LEN 484 /* minimum maximum message size */
|
||||
|
||||
/*
|
||||
* SNMP versions
|
||||
*/
|
||||
/*
|
||||
* There currently exists the following SNMP versions.
|
||||
* * (Note that only SNMPv1 is in widespread usage, and this code supports
|
||||
* * only SNMPv1, SNMPv2c, and SNMPv3.
|
||||
* *
|
||||
* * SNMPv1 - (full) the original version, defined by RFC 1157
|
||||
* * SNMPsec - (historic) the first attempt to add strong security
|
||||
* * to SNMPv1, defined by RFCs 1351, 1352, and 1353.
|
||||
* * SNMPv2p - (historic) party-based SNMP, which was another
|
||||
* * attempt to add strong security to SNMP, defined
|
||||
* * by RFCs 1441, 1445, 1446, 1448, and 1449.
|
||||
* * SNMPv2c - (experimental) community string-based SNMPv2,
|
||||
* * which was an attempt to combine the protocol
|
||||
* * operations of SNMPv2 with the security of
|
||||
* * SNMPv1, defined by RFCs 1901, 1905, and 1906.
|
||||
* * SNMPv2u - (experimental) user-based SNMPv2, which provided
|
||||
* * security based on user names and protocol
|
||||
* * operations of SNMPv2, defined by RFCs 1905,
|
||||
* * 1909, and 1910.
|
||||
* * SNMPv2* (or SNMPv2star) - (experimental) an attempt to add the
|
||||
* * best features of SNMPv2p and SNMPv2u, defined
|
||||
* * by unpublished documents found at WEB site
|
||||
* * owned by SNMP Research (a leading SNMP vendor)
|
||||
* * SNMPv3 - the current attempt by the IETF working group to merge
|
||||
* * the SNMPv2u and SNMPv2* proposals into a more widly
|
||||
* * accepted SNMPv3. It is defined by not yet published
|
||||
* * documents of the IETF SNMPv3 WG.
|
||||
* *
|
||||
* * SNMPv1, SNMPv2c, SNMPv2u, and SNMPv3 messages have a common
|
||||
* * form, which is an ASN.1 sequence containing a message version
|
||||
* * field, followed by version dependent fields.
|
||||
* * SNMPsec, SNMPv2p, and SNMPv2* messages have a common form,
|
||||
* * which is a tagged ASN.1 context specific sequence containing
|
||||
* * message dependent fields.
|
||||
* *
|
||||
* * In the #defines for the message versions below, the value
|
||||
* * for SNMPv1, SNMPv2c, SNMPv2u, and SNMPv3 messages is the
|
||||
* * value of the message version field. Since SNMPsec, SNMPv2p,
|
||||
* * and SNMPv2* messages do not have a message version field,
|
||||
* * the value in the defines for them is choosen to be a large
|
||||
* * arbitrary number.
|
||||
* *
|
||||
* * Note that many of the version ID's are defined below purely for
|
||||
* * documentational purposes. At this point the only protocol planned
|
||||
* * for future implementations is SNMP3, as the other v2 protocols will
|
||||
* * not be supported by the IETF (ie, v2u, v2sec, v2star) or used by
|
||||
* * the snmp community at large (at the time of this writing).
|
||||
*/
|
||||
|
||||
/*
|
||||
* versions based on version field
|
||||
*/
|
||||
#ifndef DISABLE_SNMPV1
|
||||
#define SNMP_VERSION_1 0
|
||||
#endif
|
||||
#ifndef DISABLE_SNMPV2C
|
||||
#define SNMP_VERSION_2c 1
|
||||
#endif
|
||||
#define SNMP_VERSION_2u 2 /* not (will never be) supported by this code */
|
||||
#define SNMP_VERSION_3 3
|
||||
|
||||
/*
|
||||
* versions not based on a version field
|
||||
*/
|
||||
#define SNMP_VERSION_sec 128 /* not (will never be) supported by this code */
|
||||
#define SNMP_VERSION_2p 129 /* no longer supported by this code (> 4.0) */
|
||||
#define SNMP_VERSION_2star 130 /* not (will never be) supported by this code */
|
||||
|
||||
/*
|
||||
* PDU types in SNMPv1, SNMPsec, SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3
|
||||
*/
|
||||
#define SNMP_MSG_GET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
|
||||
#define SNMP_MSG_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
|
||||
#define SNMP_MSG_RESPONSE (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
|
||||
#define SNMP_MSG_SET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
|
||||
|
||||
/*
|
||||
* PDU types in SNMPv1 and SNMPsec
|
||||
*/
|
||||
#define SNMP_MSG_TRAP (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
|
||||
|
||||
/*
|
||||
* PDU types in SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3
|
||||
*/
|
||||
#define SNMP_MSG_GETBULK (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
|
||||
#define SNMP_MSG_INFORM (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
|
||||
#define SNMP_MSG_TRAP2 (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
|
||||
|
||||
/*
|
||||
* PDU types in SNMPv2u, SNMPv2*, and SNMPv3
|
||||
*/
|
||||
#define SNMP_MSG_REPORT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
|
||||
|
||||
/*
|
||||
* internal modes that should never be used by the protocol for the
|
||||
* pdu type.
|
||||
*
|
||||
* All modes < 128 are reserved for SET requests.
|
||||
*/
|
||||
#define SNMP_MSG_INTERNAL_SET_BEGIN -1
|
||||
#define SNMP_MSG_INTERNAL_SET_RESERVE1 0 /* these should match snmp.h */
|
||||
#define SNMP_MSG_INTERNAL_SET_RESERVE2 1
|
||||
#define SNMP_MSG_INTERNAL_SET_ACTION 2
|
||||
#define SNMP_MSG_INTERNAL_SET_COMMIT 3
|
||||
#define SNMP_MSG_INTERNAL_SET_FREE 4
|
||||
#define SNMP_MSG_INTERNAL_SET_UNDO 5
|
||||
#define SNMP_MSG_INTERNAL_SET_MAX 6
|
||||
|
||||
#define SNMP_MSG_INTERNAL_CHECK_VALUE 17
|
||||
#define SNMP_MSG_INTERNAL_ROW_CREATE 18
|
||||
#define SNMP_MSG_INTERNAL_UNDO_SETUP 19
|
||||
#define SNMP_MSG_INTERNAL_SET_VALUE 20
|
||||
#define SNMP_MSG_INTERNAL_CHECK_CONSISTENCY 21
|
||||
#define SNMP_MSG_INTERNAL_UNDO_SET 22
|
||||
#define SNMP_MSG_INTERNAL_COMMIT 23
|
||||
#define SNMP_MSG_INTERNAL_UNDO_COMMIT 24
|
||||
#define SNMP_MSG_INTERNAL_IRREVERSIBLE_COMMIT 25
|
||||
#define SNMP_MSG_INTERNAL_UNDO_CLEANUP 26
|
||||
|
||||
/*
|
||||
* modes > 128 for non sets.
|
||||
* Note that 160-168 overlap with SNMP ASN1 pdu types
|
||||
*/
|
||||
#define SNMP_MSG_INTERNAL_PRE_REQUEST 128
|
||||
#define SNMP_MSG_INTERNAL_OBJECT_LOOKUP 129
|
||||
#define SNMP_MSG_INTERNAL_POST_REQUEST 130
|
||||
#define SNMP_MSG_INTERNAL_GET_STASH 131
|
||||
|
||||
/*
|
||||
* test for member of Confirmed Class i.e., reportable
|
||||
*/
|
||||
#define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
|
||||
c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
|
||||
c == SNMP_MSG_SET)
|
||||
|
||||
/*
|
||||
* Exception values for SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3
|
||||
*/
|
||||
#define SNMP_NOSUCHOBJECT (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
|
||||
#define SNMP_NOSUCHINSTANCE (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
|
||||
#define SNMP_ENDOFMIBVIEW (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
|
||||
|
||||
/*
|
||||
* Error codes (the value of the field error-status in PDUs)
|
||||
*/
|
||||
|
||||
/*
|
||||
* in SNMPv1, SNMPsec, SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 PDUs
|
||||
*/
|
||||
#define SNMP_ERR_NOERROR (0) /* XXX Used only for PDUs? */
|
||||
#define SNMP_ERR_TOOBIG (1)
|
||||
#define SNMP_ERR_NOSUCHNAME (2)
|
||||
#define SNMP_ERR_BADVALUE (3)
|
||||
#define SNMP_ERR_READONLY (4)
|
||||
#define SNMP_ERR_GENERR (5)
|
||||
|
||||
/*
|
||||
* in SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 PDUs
|
||||
*/
|
||||
#define SNMP_ERR_NOACCESS (6)
|
||||
#define SNMP_ERR_WRONGTYPE (7)
|
||||
#define SNMP_ERR_WRONGLENGTH (8)
|
||||
#define SNMP_ERR_WRONGENCODING (9)
|
||||
#define SNMP_ERR_WRONGVALUE (10)
|
||||
#define SNMP_ERR_NOCREATION (11)
|
||||
#define SNMP_ERR_INCONSISTENTVALUE (12)
|
||||
#define SNMP_ERR_RESOURCEUNAVAILABLE (13)
|
||||
#define SNMP_ERR_COMMITFAILED (14)
|
||||
#define SNMP_ERR_UNDOFAILED (15)
|
||||
#define SNMP_ERR_AUTHORIZATIONERROR (16)
|
||||
#define SNMP_ERR_NOTWRITABLE (17)
|
||||
|
||||
/*
|
||||
* in SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 PDUs
|
||||
*/
|
||||
#define SNMP_ERR_INCONSISTENTNAME (18)
|
||||
|
||||
#define MAX_SNMP_ERR 18
|
||||
|
||||
#define SNMP_VALIDATE_ERR(x) ( (x > MAX_SNMP_ERR) ? \
|
||||
SNMP_ERR_GENERR : \
|
||||
(x < SNMP_ERR_NOERROR) ? \
|
||||
SNMP_ERR_GENERR : \
|
||||
x )
|
||||
|
||||
/*
|
||||
* values of the generic-trap field in trap PDUs
|
||||
*/
|
||||
#define SNMP_TRAP_COLDSTART (0)
|
||||
#define SNMP_TRAP_WARMSTART (1)
|
||||
#define SNMP_TRAP_LINKDOWN (2)
|
||||
#define SNMP_TRAP_LINKUP (3)
|
||||
#define SNMP_TRAP_AUTHFAIL (4)
|
||||
#define SNMP_TRAP_EGPNEIGHBORLOSS (5)
|
||||
#define SNMP_TRAP_ENTERPRISESPECIFIC (6)
|
||||
|
||||
/*
|
||||
* row status values
|
||||
*/
|
||||
#define SNMP_ROW_NONEXISTENT 0
|
||||
#define SNMP_ROW_ACTIVE 1
|
||||
#define SNMP_ROW_NOTINSERVICE 2
|
||||
#define SNMP_ROW_NOTREADY 3
|
||||
#define SNMP_ROW_CREATEANDGO 4
|
||||
#define SNMP_ROW_CREATEANDWAIT 5
|
||||
#define SNMP_ROW_DESTROY 6
|
||||
|
||||
/*
|
||||
* row storage values
|
||||
*/
|
||||
#define SNMP_STORAGE_NONE 0
|
||||
#define SNMP_STORAGE_OTHER 1
|
||||
#define SNMP_STORAGE_VOLATILE 2
|
||||
#define SNMP_STORAGE_NONVOLATILE 3
|
||||
#define SNMP_STORAGE_PERMANENT 4
|
||||
#define SNMP_STORAGE_READONLY 5
|
||||
|
||||
/*
|
||||
* message processing models
|
||||
*/
|
||||
#define SNMP_MP_MODEL_SNMPv1 0
|
||||
#define SNMP_MP_MODEL_SNMPv2c 1
|
||||
#define SNMP_MP_MODEL_SNMPv2u 2
|
||||
#define SNMP_MP_MODEL_SNMPv3 3
|
||||
#define SNMP_MP_MODEL_SNMPv2p 256
|
||||
|
||||
/*
|
||||
* security values
|
||||
*/
|
||||
#define SNMP_SEC_MODEL_ANY 0
|
||||
#define SNMP_SEC_MODEL_SNMPv1 1
|
||||
#define SNMP_SEC_MODEL_SNMPv2c 2
|
||||
#define SNMP_SEC_MODEL_USM 3
|
||||
#define SNMP_SEC_MODEL_SNMPv2p 256
|
||||
|
||||
#define SNMP_SEC_LEVEL_NOAUTH 1
|
||||
#define SNMP_SEC_LEVEL_AUTHNOPRIV 2
|
||||
#define SNMP_SEC_LEVEL_AUTHPRIV 3
|
||||
|
||||
#define SNMP_MSG_FLAG_AUTH_BIT 0x01
|
||||
#define SNMP_MSG_FLAG_PRIV_BIT 0x02
|
||||
#define SNMP_MSG_FLAG_RPRT_BIT 0x04
|
||||
|
||||
/*
|
||||
* control PDU handling characteristics
|
||||
*/
|
||||
#define UCD_MSG_FLAG_RESPONSE_PDU 0x100
|
||||
#define UCD_MSG_FLAG_EXPECT_RESPONSE 0x200
|
||||
#define UCD_MSG_FLAG_FORCE_PDU_COPY 0x400
|
||||
#define UCD_MSG_FLAG_ALWAYS_IN_VIEW 0x800
|
||||
#define UCD_MSG_FLAG_PDU_TIMEOUT 0x1000
|
||||
#define UCD_MSG_FLAG_ONE_PASS_ONLY 0x2000
|
||||
|
||||
/*
|
||||
* view status
|
||||
*/
|
||||
#define SNMP_VIEW_INCLUDED 1
|
||||
#define SNMP_VIEW_EXCLUDED 2
|
||||
|
||||
/*
|
||||
* basic oid values
|
||||
*/
|
||||
#define SNMP_OID_INTERNET 1, 3, 6, 1
|
||||
#define SNMP_OID_ENTERPRISES SNMP_OID_INTERNET, 4, 1
|
||||
#define SNMP_OID_MIB2 SNMP_OID_INTERNET, 2, 1
|
||||
#define SNMP_OID_SNMPV2 SNMP_OID_INTERNET, 6
|
||||
#define SNMP_OID_SNMPMODULES SNMP_OID_SNMPV2, 3
|
||||
|
||||
/*
|
||||
* lengths as defined by TCs
|
||||
*/
|
||||
#define SNMPADMINLENGTH 255
|
||||
|
||||
|
||||
char *uptime_string(u_long, char *);
|
||||
void xdump(const u_char *, size_t, const char *);
|
||||
u_char *snmp_parse_var_op(u_char *, oid *, size_t *, u_char *,
|
||||
size_t *, u_char **, size_t *);
|
||||
u_char *snmp_build_var_op(u_char *, oid *, size_t *, u_char,
|
||||
size_t, u_char *, size_t *);
|
||||
|
||||
|
||||
#ifdef USE_REVERSE_ASNENCODING
|
||||
int snmp_realloc_rbuild_var_op(u_char ** pkt,
|
||||
size_t * pkt_len,
|
||||
size_t * offset,
|
||||
int allow_realloc,
|
||||
const oid * name,
|
||||
size_t * name_len,
|
||||
u_char value_type,
|
||||
u_char * value,
|
||||
size_t value_length);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* SNMP_H */
|
@ -1,70 +0,0 @@
|
||||
#ifndef _SNMPCALLBACKDOMAIN_H
|
||||
#define _SNMPCALLBACKDOMAIN_H
|
||||
|
||||
#ifndef NET_SNMP_CONFIG_H
|
||||
#error "Please include <netsnmp/net-snmp-config.h> before this file"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef SNMP_TRANSPORT_CALLBACK_DOMAIN
|
||||
|
||||
#include <net-snmp/library/snmp_transport.h>
|
||||
|
||||
typedef struct netsnmp_callback_pass_s {
|
||||
int return_transport_num;
|
||||
netsnmp_pdu *pdu;
|
||||
struct netsnmp_callback_pass_s *next;
|
||||
} netsnmp_callback_pass;
|
||||
|
||||
typedef struct netsnmp_callback_info_s {
|
||||
int linkedto;
|
||||
void *parent_data;
|
||||
netsnmp_callback_pass *data;
|
||||
int callback_num;
|
||||
int pipefds[2];
|
||||
} netsnmp_callback_info;
|
||||
|
||||
netsnmp_transport *netsnmp_callback_transport(int);
|
||||
int netsnmp_callback_hook_parse(netsnmp_session * sp,
|
||||
netsnmp_pdu *pdu,
|
||||
u_char * packetptr,
|
||||
size_t len);
|
||||
int netsnmp_callback_hook_build(netsnmp_session * sp,
|
||||
netsnmp_pdu *pdu,
|
||||
u_char * ptk, size_t * len);
|
||||
int netsnmp_callback_check_packet(u_char * pkt, size_t len);
|
||||
netsnmp_pdu *netsnmp_callback_create_pdu(netsnmp_transport *transport,
|
||||
void *opaque, size_t olength);
|
||||
netsnmp_session *netsnmp_callback_open(int attach_to,
|
||||
int (*return_func) (int op,
|
||||
netsnmp_session
|
||||
* session,
|
||||
int reqid,
|
||||
netsnmp_pdu
|
||||
*pdu,
|
||||
void *magic),
|
||||
int (*fpre_parse) (netsnmp_session
|
||||
*,
|
||||
struct
|
||||
netsnmp_transport_s
|
||||
*, void *, int),
|
||||
int (*fpost_parse) (netsnmp_session
|
||||
*,
|
||||
netsnmp_pdu *,
|
||||
int));
|
||||
void netsnmp_clear_callback_list(void);
|
||||
|
||||
#else
|
||||
|
||||
#define netsnmp_clear_callback_list()
|
||||
|
||||
|
||||
#endif /*SNMP_TRANSPORT_CALLBACK_DOMAIN*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif/*_SNMPCALLBACKDOMAIN_H*/
|
@ -1,41 +0,0 @@
|
||||
#ifndef _SNMPTCPDOMAIN_H
|
||||
#define _SNMPTCPDOMAIN_H
|
||||
|
||||
#ifdef SNMP_TRANSPORT_TCP_DOMAIN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <net-snmp/library/snmp_transport.h>
|
||||
#include <net-snmp/library/asn1.h>
|
||||
|
||||
#if HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#if HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The SNMP over TCP over IPv4 transport domain is identified by
|
||||
* transportDomainTcpIpv4 as defined in RFC 3419.
|
||||
*/
|
||||
|
||||
#define TRANSPORT_DOMAIN_TCP_IP 1,3,6,1,2,1,100,1,5
|
||||
extern oid netsnmp_snmpTCPDomain[];
|
||||
|
||||
netsnmp_transport *netsnmp_tcp_transport(struct sockaddr_in *addr, int local);
|
||||
|
||||
/*
|
||||
* "Constructor" for transport domain object.
|
||||
*/
|
||||
|
||||
void netsnmp_tcp_ctor(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /*SNMP_TRANSPORT_TCP_DOMAIN */
|
||||
|
||||
#endif/*_SNMPTCPDOMAIN_H*/
|
@ -1,54 +0,0 @@
|
||||
#ifndef _SNMPUDPDOMAIN_H
|
||||
#define _SNMPUDPDOMAIN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <net-snmp/library/snmp_transport.h>
|
||||
#include <net-snmp/library/asn1.h>
|
||||
|
||||
#if HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#if HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
netsnmp_transport *netsnmp_udp_transport(struct sockaddr_in *addr, int local);
|
||||
|
||||
|
||||
/*
|
||||
* Convert a "traditional" peername into a sockaddr_in structure which is
|
||||
* written to *addr. Returns 1 if the conversion was successful, or 0 if it
|
||||
* failed.
|
||||
*/
|
||||
|
||||
int netsnmp_sockaddr_in(struct sockaddr_in *addr,
|
||||
const char *peername, int remote_port);
|
||||
|
||||
|
||||
/*
|
||||
* Register any configuration tokens specific to the agent.
|
||||
*/
|
||||
|
||||
void netsnmp_udp_agent_config_tokens_register(void);
|
||||
|
||||
void netsnmp_udp_parse_security(const char *token, char *param);
|
||||
|
||||
int netsnmp_udp_getSecName(void *opaque, int olength,
|
||||
const char *community,
|
||||
size_t community_len,
|
||||
char **secname,
|
||||
char **contextName);
|
||||
|
||||
/*
|
||||
* "Constructor" for transport domain object.
|
||||
*/
|
||||
|
||||
void netsnmp_udp_ctor(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif/*_SNMPUDPDOMAIN_H*/
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user