net-snmp  5.4.1
Data Structures | Defines | Typedefs | Functions | Variables
Maintain a registry of MIB subtrees, together with related information regarding mibmodule, sessions, etc
The Net-SNMP agent

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 struct lookup_cache_s lookup_cache
typedef struct
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_subtreenetsnmp_subtree_deepcopy (netsnmp_subtree *a)
subtree_context_cacheget_top_context_cache (void)
netsnmp_subtreenetsnmp_subtree_find_first (const char *context_name)
netsnmp_subtreeadd_subtree (netsnmp_subtree *new_tree, const char *context_name)
netsnmp_subtreenetsnmp_subtree_replace_first (netsnmp_subtree *new_tree, const char *context_name)
NETSNMP_INLINE void netsnmp_subtree_change_next (netsnmp_subtree *ptr, netsnmp_subtree *thenext)
NETSNMP_INLINE void netsnmp_subtree_change_prev (netsnmp_subtree *ptr, netsnmp_subtree *theprev)
int netsnmp_subtree_compare (const netsnmp_subtree *ap, const netsnmp_subtree *bp)
void netsnmp_subtree_join (netsnmp_subtree *root)
netsnmp_subtreenetsnmp_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_subtreenetsnmp_subtree_find_prev (oid *name, size_t len, netsnmp_subtree *subtree, const char *context_name)
netsnmp_subtreenetsnmp_subtree_find_next (oid *name, size_t len, netsnmp_subtree *subtree, const char *context_name)
netsnmp_subtreenetsnmp_subtree_find (oid *name, size_t len, netsnmp_subtree *subtree, const char *context_name)
netsnmp_sessionget_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)
RETSIGTYPE agent_SIGCHLD_handler (int sig)
int register_signal (int sig, void(*func)(int))
int unregister_signal (int sig)

Variables

subtree_context_cachecontext_subtrees = NULL
int lookup_cache_size = 0
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 1297 of file agent_registry.c.

retrieves the current value of the lookup cache size

Returns:
the current lookup cache size

Definition at line 1370 of file agent_registry.c.

void netsnmp_set_lookup_cache_size ( int  newsize)

set the lookup cache size for optimized agent registration performance.

Parameters:
newsizeset 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 1357 of file agent_registry.c.

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:
namethe specific OID to unregister if it conatins the associated context.
lenthe length of the OID, use OID_LENGTH macro.
prioritya 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_subidpermits specifying a range in place of one of a subtree sub-identifiers. When this value is zero, no range is being specified.
range_uboundthe upper bound of a sub-identifier's range. This field is present only if range_subid is not 0.
contexta context name that has been created
Returns:

Definition at line 963 of file agent_registry.c.