Maintain a registry of MIB subtrees, together with related information regarding mibmodule, sessions, etc(3)

NAME
Maintain a registry of MIB subtrees, together with related information regarding mibmodule, sessions, etc -

  Data Structures
struct lookup_cache_s
struct lookup_cache_context_s

  Defines
#define IN_SNMP_VARS_C
#define SUBTREE_DEFAULT_CACHE_SIZE 8
#define SUBTREE_MAX_CACHE_SIZE 32

  Typedefs
typedef lookup_cache_s lookup_cache
typedef lookup_cache_context_s lookup_cache_context

  Functions
NETSNMP_STATIC_INLINE void invalidate_lookup_cache (const char *context)
void netsnmp_set_lookup_cache_size (int newsize)
set the lookup cache size for optimized agent registration performance.
int netsnmp_get_lookup_cache_size (void)
retrieves the current value of the lookup cache size
void netsnmp_subtree_free (netsnmp_subtree *a)
netsnmp_subtree * netsnmp_subtree_deepcopy (netsnmp_subtree *a)
subtree_context_cache * get_top_context_cache (void)
netsnmp_subtree * netsnmp_subtree_find_first (const char *context_name)
netsnmp_subtree * add_subtree (netsnmp_subtree *new_tree, const char *context_name)
netsnmp_subtree * netsnmp_subtree_replace_first (netsnmp_subtree *new_tree, const char *context_name)
int netsnmp_subtree_compare (const netsnmp_subtree *ap, const netsnmp_subtree *bp)
void netsnmp_subtree_join (netsnmp_subtree *root)
netsnmp_subtree * netsnmp_subtree_split (netsnmp_subtree *current, oid name[], int name_len)
int netsnmp_subtree_load (netsnmp_subtree *new_sub, const char *context_name)
int netsnmp_register_mib (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_handler_registration *reginfo, int perform_callback)
void register_mib_reattach (void)
void register_mib_detach (void)
int register_mib_context (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)
int register_mib_range (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)
int register_mib_priority (const char *moduleName, struct variable *var, size_t varsize, size_t numvars, oid *mibloc, size_t mibloclen, int priority)
int register_mib (const char *moduleName, struct variable *var, size_t varsize, size_t numvars, oid *mibloc, size_t mibloclen)
void netsnmp_subtree_unload (netsnmp_subtree *sub, netsnmp_subtree *prev, const char *context)
int unregister_mib_context (oid *name, size_t len, int priority, int range_subid, oid range_ubound, const char *context)
Unregisters an OID that has an associated context name value.
int netsnmp_unregister_mib_table_row (oid *name, size_t len, int priority, int var_subid, oid range_ubound, const char *context)
int unregister_mib_range (oid *name, size_t len, int priority, int range_subid, oid range_ubound)
int unregister_mib_priority (oid *name, size_t len, int priority)
int unregister_mib (oid *name, size_t len)
void unregister_mibs_by_session (netsnmp_session *ss)
int in_a_view (oid *name, size_t *namelen, netsnmp_pdu *pdu, int type)
int check_access (netsnmp_pdu *pdu)
int netsnmp_acm_check_subtree (netsnmp_pdu *pdu, oid *name, size_t namelen)
checks to see if everything within a given subtree is either: in view, not in view, or possibly both.
NETSNMP_STATIC_INLINE lookup_cache_context * get_context_lookup_cache (const char *context)
NETSNMP_STATIC_INLINE void lookup_cache_add (const char *context, netsnmp_subtree *next, netsnmp_subtree *previous)
NETSNMP_STATIC_INLINE void lookup_cache_replace (lookup_cache *ptr, netsnmp_subtree *next, netsnmp_subtree *previous)
NETSNMP_STATIC_INLINE lookup_cache * lookup_cache_find (const char *context, oid *name, size_t name_len, int *retcmp)
netsnmp_subtree * netsnmp_subtree_find_prev (oid *name, size_t len, netsnmp_subtree *subtree, const char *context_name)
netsnmp_subtree * netsnmp_subtree_find_next (oid *name, size_t len, netsnmp_subtree *subtree, const char *context_name)
netsnmp_subtree * netsnmp_subtree_find (oid *name, size_t len, netsnmp_subtree *subtree, const char *context_name)
netsnmp_session * get_session_for_oid (oid *name, size_t len, const char *context_name)
void setup_tree (void)
int remove_tree_entry (oid *name, size_t len)
void shutdown_tree (void)
void clear_subtree (netsnmp_subtree *sub)
void clear_lookup_cache (void)
void clear_context (void)
void dump_idx_registry (void)
void dump_registry (void)
int register_readfd (int fd, void(*func)(int, void *), void *data)
int register_writefd (int fd, void(*func)(int, void *), void *data)
int register_exceptfd (int fd, void(*func)(int, void *), void *data)
int unregister_readfd (int fd)
int unregister_writefd (int fd)
int unregister_exceptfd (int fd)
RETSIGTYPE agent_SIGCHLD_handler (int sig)
int register_signal (int sig, void(*func)(int))
int unregister_signal (int sig)

  Variables
subtree_context_cache * context_subtrees = NULL
int lookup_cache_size = 0
int external_readfd [NUM_EXTERNAL_FDS]
int external_readfdlen = 0
int external_writefd [NUM_EXTERNAL_FDS]
int external_writefdlen = 0
int external_exceptfd [NUM_EXTERNAL_FDS]
int external_exceptfdlen = 0
void(* external_readfdfunc [NUM_EXTERNAL_FDS])(int, void *)
void(* external_writefdfunc [NUM_EXTERNAL_FDS])(int, void *)
void(* external_exceptfdfunc [NUM_EXTERNAL_FDS])(int, void *)
void * external_readfd_data [NUM_EXTERNAL_FDS]
void * external_writefd_data [NUM_EXTERNAL_FDS]
void * external_exceptfd_data [NUM_EXTERNAL_FDS]
int external_signal_scheduled [NUM_EXTERNAL_SIGS]
void(* external_signal_handler [NUM_EXTERNAL_SIGS])(int)
int external_readfd [NUM_EXTERNAL_FDS]
int external_readfdlen
int external_writefd [NUM_EXTERNAL_FDS]
int external_writefdlen
int external_exceptfd [NUM_EXTERNAL_FDS]
int external_exceptfdlen
void(* external_readfdfunc [NUM_EXTERNAL_FDS])(int, void *)
void(* external_writefdfunc [NUM_EXTERNAL_FDS])(int, void *)
void(* external_exceptfdfunc [NUM_EXTERNAL_FDS])(int, void *)
void * external_readfd_data [NUM_EXTERNAL_FDS]
void * external_writefd_data [NUM_EXTERNAL_FDS]
void * external_exceptfd_data [NUM_EXTERNAL_FDS]
int external_signal_scheduled [NUM_EXTERNAL_SIGS]
void(* external_signal_handler [NUM_EXTERNAL_SIGS])(int)

Function Documentation

  int netsnmp_acm_check_subtree (netsnmp_pdu * pdu, oid * name, size_t namelen)

checks to see if everything within a given subtree is either: in view, not in view, or possibly both. If the entire subtree is not-in-view we can use this information to skip calling the sub-handlers entirely.

Returns:
    0 if entire subtree is accessible, 5 if not and 7 if portions are both. 1 on error (illegal pdu version).

Definition at line 1194 of file agent_registry.c.

References snmp_pdu::flags, snmp_call_callbacks(), and snmp_pdu::version.

Referenced by netsnmp_add_varbind_to_cache().

  int netsnmp_get_lookup_cache_size (void)

retrieves the current value of the lookup cache size Returns:
    the current lookup cache size

Definition at line 1263 of file agent_registry.c.

Referenced by unregister_mib_context().

  void netsnmp_set_lookup_cache_size (int newsize)

set the lookup cache size for optimized agent registration performance. Parameters:
    newsize set to the maximum size of a cache for a given context. Set to 0 to completely disable caching, or to -1 to set to the default cache size (8), or to a number of your chosing. The rough guide is that it should be equal to the maximum number of simultanious managers you expect to talk to the agent (M) times 80% (or so, he says randomly) the average number (N) of varbinds you expect to receive in a given request for a manager. ie, M times N. Bigger does NOT necessarily mean better. Certainly 16 should be an upper limit. 32 is the hard coded limit.

Definition at line 1250 of file agent_registry.c.

References netsnmp_set_lookup_cache_size().

Referenced by netsnmp_set_lookup_cache_size(), and unregister_mib_context().

  int unregister_mib_context (oid * name, size_t len, int priority, int range_subid, oid range_ubound, const char * context)

Unregisters an OID that has an associated context name value. Typically used when a module has multiple contexts defined. The parameters priority, range_subid, and range_ubound should be used in conjunction with agentx, see RFC 2741, otherwise these values should always be 0.

Parameters:
    name the specific OID to unregister if it conatins the associated context.
    len the length of the OID, use OID_LENGTH macro.
    priority a value between 1 and 255, used to achieve a desired configuration when different sessions register identical or overlapping regions. Subagents with no particular knowledge of priority should register with the default value of 127.
    range_subid permits specifying a range in place of one of a subtree sub-identifiers. When this value is zero, no range is being specified.
    range_ubound the upper bound of a sub-identifier's range. This field is present only if range_subid is not 0.
    context a context name that has been created

Returns:

Definition at line 885 of file agent_registry.c.

References netsnmp_get_lookup_cache_size(), netsnmp_oid_equals(), netsnmp_set_lookup_cache_size(), and snmp_call_callbacks().

Referenced by netsnmp_unregister_handler().