net-snmp 5.7
Data Structures | Typedefs | Functions | Variables
Lookup cache, storing the registered OIDs.
Registry of MIB subtrees, modules, sessions, etc

Maintain the cache used for locating sub-trees and OIDs. More...

Data Structures

struct  lookup_cache_context_s

Typedefs

typedef struct
lookup_cache_context_s 
lookup_cache_context

Functions

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 Should be called from master agent only - sub-agent doesn't need the cache.
NETSNMP_STATIC_INLINE
lookup_cache_context
get_context_lookup_cache (const char *context)
 Returns lookup cache entry for the context of given name.
NETSNMP_STATIC_INLINE void lookup_cache_add (const char *context, netsnmp_subtree *next, netsnmp_subtree *previous)
 Adds an entry to the Lookup Cache under specified context name.
NETSNMP_STATIC_INLINE
lookup_cache * 
lookup_cache_find (const char *context, const oid *name, size_t name_len, int *retcmp)
 Finds an entry in the Lookup Cache.
void clear_lookup_cache (void)

Variables

 lookup_cache

Detailed Description

Maintain the cache used for locating sub-trees and OIDs.


Function Documentation

NETSNMP_STATIC_INLINE lookup_cache_context* get_context_lookup_cache ( const char *  context)

Returns lookup cache entry for the context of given name.

Parameters:
contextName of the context. Name is case sensitive.
Returns:
the lookup cache context

Definition at line 142 of file agent_registry.c.

NETSNMP_STATIC_INLINE void lookup_cache_add ( const char *  context,
netsnmp_subtree next,
netsnmp_subtree previous 
)

Adds an entry to the Lookup Cache under specified context name.

Parameters:
contextName of the context. Name is case sensitive.
nextNext subtree item.
previousPrevious subtree item.

Definition at line 173 of file agent_registry.c.

NETSNMP_STATIC_INLINE lookup_cache* lookup_cache_find ( const char *  context,
const oid *  name,
size_t  name_len,
int *  retcmp 
)

Finds an entry in the Lookup Cache.

Parameters:
contextCase sensitive name of the context.
nameThe OID we're searching for.
name_lenNumber of sub-ids (single integers) in the OID.
retcmpValue set to snmp_oid_compare() call result. The value, if set, is always nonnegative.
Returns:
gives Lookup Cache entry, or NULL if not found.
See also:
snmp_oid_compare()

Definition at line 223 of file agent_registry.c.

int netsnmp_get_lookup_cache_size ( void  )

Retrieves the current value of the lookup cache size Should be called from master agent only - sub-agent doesn't need the cache.

Returns:
the current lookup cache size

Definition at line 131 of file agent_registry.c.

void netsnmp_set_lookup_cache_size ( int  newsize)

Set the lookup cache size for optimized agent registration performance.

Note that it is only used by master agent - sub-agent doesn't need the cache. The rough guide is that the cache size should be equal to the maximum number of simultaneous 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.

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

Definition at line 116 of file agent_registry.c.