net-snmp 5.7
Functions
Registering and unregistering MIB subtrees.
Registry of MIB subtrees, modules, sessions, etc

Adding and removing MIB nodes to the database under their contexts. More...

Functions

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)
 Registers a MIB handler.
void register_mib_reattach (void)
 Call callbacks to reattach all our nodes.
void register_mib_detach (void)
 Mark all our registered OIDs as detached.
int register_mib_context (const char *moduleName, struct variable *var, size_t varsize, size_t numvars, const oid *mibloc, size_t mibloclen, int priority, int range_subid, oid range_ubound, netsnmp_session *ss, const char *context, int timeout, int flags)
 Register a new module into the MIB database, with all possible custom options.
int register_mib_range (const char *moduleName, struct variable *var, size_t varsize, size_t numvars, const oid *mibloc, size_t mibloclen, int priority, int range_subid, oid range_ubound, netsnmp_session *ss)
 Register a new module into the MIB database, as being responsible for a range of OIDs (typically a single row of a table).
int register_mib_priority (const char *moduleName, struct variable *var, size_t varsize, size_t numvars, const oid *mibloc, size_t mibloclen, int priority)
 Register a new module into the MIB database, with a non-default priority.
int register_mib (const char *moduleName, struct variable *var, size_t varsize, size_t numvars, const oid *mibloc, size_t mibloclen)
 Register a new module into the MIB database, using default priority and context.
int unregister_mib_context (oid *name, size_t len, int priority, int range_subid, oid range_ubound, const char *context)
 Unregisters a module registered against a given OID (or range) in a specified context.
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)
 Unregisters a module registered against a given OID (or range) in the default context.
int unregister_mib_priority (oid *name, size_t len, int priority)
 Unregisters a module registered against a given OID at the specified priority.
int unregister_mib (oid *name, size_t len)
 Unregisters a module registered against a given OID at the default priority.
void unregister_mibs_by_session (netsnmp_session *ss)
 Unregisters subtree of OIDs bounded to given session.
int in_a_view (oid *name, size_t *namelen, netsnmp_pdu *pdu, int type)
 Determines if given PDU is allowed to see (or update) a given OID.
int check_access (netsnmp_pdu *pdu)
 Determines if the given PDU request could potentially succeed.
int netsnmp_acm_check_subtree (netsnmp_pdu *pdu, oid *name, size_t namelen)
 Determines if the given PDU request could potentially access the specified MIB subtree.
 netsnmp_feature_child_of (get_session_for_oid, netsnmp_unused)
void setup_tree (void)
int remove_tree_entry (oid *name, size_t len)
void shutdown_tree (void)
void dump_idx_registry (void)
void dump_registry (void)

Detailed Description

Adding and removing MIB nodes to the database under their contexts.


Function Documentation

int check_access ( netsnmp_pdu pdu)

Determines if the given PDU request could potentially succeed.

(Preliminary, OID-independent validation)

Parameters:
pduPDU requesting access
Returns:
gives VACM_SUCCESS if the entire MIB tree is accessible VACM_NOTINVIEW if the entire MIB tree is inaccessible VACM_SUBTREE_UNKNOWN if some portions are accessible other codes may returned on error

Definition at line 2066 of file agent_registry.c.

int in_a_view ( oid *  name,
size_t *  namelen,
netsnmp_pdu pdu,
int  type 
)

Determines if given PDU is allowed to see (or update) a given OID.

Parameters:
nameThe OID to check access for. On return, this parameter holds the OID actually matched
namelenNumber of sub-identifiers in the OID. On return, this parameter holds the length of the matched OID
pduPDU requesting access to the OID.
typeANS.1 type of the value at given OID. (Used for catching SNMPv1 requests for SMIv2-only objects)
Returns:
gives VACM_SUCCESS if the OID is in the PDU, otherwise error code.

Definition at line 2012 of file agent_registry.c.

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

Determines if the given PDU request could potentially access the specified MIB subtree.

Parameters:
pduPDU requesting access
nameThe OID to check access for.
namelenNumber of sub-identifiers in the OID.
Returns:
gives VACM_SUCCESS if the entire MIB tree is accessible VACM_NOTINVIEW if the entire MIB tree is inaccessible VACM_SUBTREE_UNKNOWN if some portions are accessible other codes may returned on error

Definition at line 2110 of file agent_registry.c.

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 
)

Registers a MIB handler.

Parameters:
reginfoRegistration handler structure. In a case of failure, it will be freed.
Returns:
gives MIB_REGISTERED_OK or MIB_* error code.
See also:
netsnmp_register_handler()
register_agentx_list()
netsnmp_handler_registration_free()

Definition at line 1098 of file agent_registry.c.

int register_mib ( const char *  moduleName,
struct variable var,
size_t  varsize,
size_t  numvars,
const oid *  mibloc,
size_t  mibloclen 
)

Register a new module into the MIB database, using default priority and context.

Parameters:
moduleNameText name of the module. The given name will be used to identify the module inside the agent.
varArray of variables to be registered in the module.
varsizeSize of a single variable in var array. The size is normally equal to sizeof(struct variable), but if we wish to use shorter (or longer) OIDs, then we could use different variant of the variable structure.
numvarsNumber of variables in the var array. This is how many variables the function will try to register.
miblocBase OID of the module. All OIDs in var array should be sub-oids of the base OID.
mibloclenLength of the base OID. Number of integers making up the base OID.
Returns:
gives SNMPERR_SUCCESS or SNMPERR_* error code.
See also:
register_mib_priority()
register_mib_range()
register_mib_context()
unregister_mib()

Definition at line 1557 of file agent_registry.c.

int register_mib_context ( const char *  moduleName,
struct variable var,
size_t  varsize,
size_t  numvars,
const oid *  mibloc,
size_t  mibloclen,
int  priority,
int  range_subid,
oid  range_ubound,
netsnmp_session ss,
const char *  context,
int  timeout,
int  flags 
)

Register a new module into the MIB database, with all possible custom options.

Parameters:
moduleNameText name of the module. The given name will be used to identify the module inside the agent.
varArray of variables to be registered in the module.
varsizeSize of a single variable in var array. The size is normally equal to sizeof(struct variable), but if we wish to use shorter (or longer) OIDs, then we could use different variant of the variable structure.
numvarsNumber of variables in the var array. This is how many variables the function will try to register.
miblocBase OID of the module. All OIDs in var array should be sub-oids of the base OID.
mibloclenLength of the base OID. Number of integers making up the base OID.
priorityRegistration priority. Used to achieve a desired configuration when different sessions register identical or overlapping regions. Primarily used with AgentX subagent registrations.
range_subidIf non-zero, the module is registered against a range of OIDs, with this parameter identifying the relevant subidentifier - see RFC 2741 for details. Typically used to register a single row of a table. If zero, then register the module against the full OID subtree.
range_uboundThe end of the range being registered (see RFC 2741) If range_subid is zero, then this parameter is ignored.
ss
timeout
flags
Returns:
gives SNMPERR_SUCCESS or SNMPERR_* error code.
See also:
register_mib()
register_mib_priority()
register_mib_range()
unregister_mib()

Definition at line 1403 of file agent_registry.c.

void register_mib_detach ( void  )

Mark all our registered OIDs as detached.

This is only really useful for subagent protocols, when a connection is lost or the subagent is being shut down.

Definition at line 1341 of file agent_registry.c.

int register_mib_priority ( const char *  moduleName,
struct variable var,
size_t  varsize,
size_t  numvars,
const oid *  mibloc,
size_t  mibloclen,
int  priority 
)

Register a new module into the MIB database, with a non-default priority.

Parameters:
moduleNameText name of the module. The given name will be used to identify the module inside the agent.
varArray of variables to be registered in the module.
varsizeSize of a single variable in var array. The size is normally equal to sizeof(struct variable), but if we wish to use shorter (or longer) OIDs, then we could use different variant of the variable structure.
numvarsNumber of variables in the var array. This is how many variables the function will try to register.
miblocBase OID of the module. All OIDs in var array should be sub-oids of the base OID.
mibloclenLength of the base OID. Number of integers making up the base OID.
priorityRegistration priority. Used to achieve a desired configuration when different sessions register identical or overlapping regions. Primarily used with AgentX subagent registrations.
Returns:
gives SNMPERR_SUCCESS or SNMPERR_* error code.
See also:
register_mib()
register_mib_range()
register_mib_context()
unregister_mib()

Definition at line 1517 of file agent_registry.c.

int register_mib_range ( const char *  moduleName,
struct variable var,
size_t  varsize,
size_t  numvars,
const oid *  mibloc,
size_t  mibloclen,
int  priority,
int  range_subid,
oid  range_ubound,
netsnmp_session ss 
)

Register a new module into the MIB database, as being responsible for a range of OIDs (typically a single row of a table).

Parameters:
moduleNameText name of the module. The given name will be used to identify the module inside the agent.
varArray of variables to be registered in the module.
varsizeSize of a single variable in var array. The size is normally equal to sizeof(struct variable), but if we wish to use shorter (or longer) OIDs, then we could use different variant of the variable structure.
numvarsNumber of variables in the var array. This is how many variables the function will try to register.
miblocBase OID of the module. All OIDs in var array should be sub-oids of the base OID.
mibloclenLength of the base OID. Number of integers making up the base OID.
priorityRegistration priority. Used to achieve a desired configuration when different sessions register identical or overlapping regions. Primarily used with AgentX subagent registrations.
range_subidIf non-zero, the module is registered against a range of OIDs, with this parameter identifying the relevant subidentifier - see RFC 2741 for details. Typically used to register a single row of a table. If zero, then register the module against the full OID subtree.
range_uboundThe end of the range being registered (see RFC 2741) If range_subid is zero, then this parameter is ignored.
ss
Returns:
gives SNMPERR_SUCCESS or SNMPERR_* error code.
See also:
register_mib()
register_mib_priority()
register_mib_context()
unregister_mib()

Definition at line 1468 of file agent_registry.c.

void register_mib_reattach ( void  )

Call callbacks to reattach all our nodes.

Definition at line 1308 of file agent_registry.c.

int unregister_mib ( oid *  name,
size_t  len 
)

Unregisters a module registered against a given OID at the default priority.

Parameters:
namethe specific OID to unregister if it conatins the associated context.
lenthe length of the OID, use OID_LENGTH macro.
Returns:
gives MIB_UNREGISTERED_OK or MIB_* error code.
See also:
unregister_mib_priority()
unregister_mib_context()
unregister_mib_range()
unregister_agentx_list()

Definition at line 1923 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 a module registered against a given OID (or range) in a specified context.

Typically used when a module has multiple contexts defined. The parameters priority, range_subid, range_ubound and context should match those used to register the module originally.

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:
gives MIB_UNREGISTERED_OK or MIB_* error code.
See also:
unregister_mib()
unregister_mib_priority()
unregister_mib_range()

Definition at line 1663 of file agent_registry.c.

int unregister_mib_priority ( oid *  name,
size_t  len,
int  priority 
)

Unregisters a module registered against a given OID at the specified priority.

The priority parameter should match that used to register the module originally.

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.
Returns:
gives MIB_UNREGISTERED_OK or MIB_* error code.
See also:
unregister_mib()
unregister_mib_range()
unregister_mib_context()

Definition at line 1902 of file agent_registry.c.

int unregister_mib_range ( oid *  name,
size_t  len,
int  priority,
int  range_subid,
oid  range_ubound 
)

Unregisters a module registered against a given OID (or range) in the default context.

Typically used when a module has multiple contexts defined. The parameters priority, range_subid, and range_ubound should match those used to register the module originally.

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.
Returns:
gives MIB_UNREGISTERED_OK or MIB_* error code.
See also:
unregister_mib()
unregister_mib_priority()
unregister_mib_context()

Definition at line 1873 of file agent_registry.c.

void unregister_mibs_by_session ( netsnmp_session ss)

Unregisters subtree of OIDs bounded to given session.

Parameters:
ssSession which OIDs will be removed from tree.
See also:
unregister_mib()
unregister_agentx_list()

Definition at line 1936 of file agent_registry.c.