AgentX++  2.0.5
Public Member Functions | Protected Member Functions | Friends | List of all members
MasterAgentXMib Class Reference

#include <agentx_master.h>

Inheritance diagram for MasterAgentXMib:

Public Member Functions

 MasterAgentXMib ()
 Default Constructor.
 
 MasterAgentXMib (const NS_SNMP OctetStr &)
 Constructor with path where persistent MIB objects should be stored to and loaded from.
 
virtual ~MasterAgentXMib ()
 Destructor.
 
virtual void set_agentx (AgentXMaster *)
 Set the AgentXMaster that will process AgentX messages.
 
AgentXMasterget_agentx ()
 Get the AgentXMaster used by the receiver to process AgentX messages.
 
void set_session_admin_status_writable (bool)
 Set the access mode for agentxSessionAdminStatus.
 
virtual MibEntry * add (MibEntry *)
 Register a MIB object for the agent≥s MIB.
 
virtual MibEntry * add (const NS_SNMP OctetStr &, MibEntry *)
 Register a MIB object within a given context.
 
virtual bool init ()
 Start the master agent thread and initialize master MIB.
 
virtual void process_agentx ()
 Wait for an incoming AgentX request and process it.
 
virtual void answer (AgentXPdu &)
 Answer an AgentX request.
 
virtual bool is_dupl_reg (const AgentXRegEntry &)
 Check whether the given region would be a duplicate registration (a registration that would result in a duplicate region with the same priority and within the same context is termed a duplicate registration)
 
virtual void add_get_subrequest (u_int, unsigned long, const AgentXSearchRange &, u_char, u_char, const NS_SNMP OctetStr &, int=0, int=0)
 Add a get-type sub-request to an AgentX transaction.
 
virtual void add_set_subrequest (u_int, unsigned long, const AgentXSearchRange &, const Vbx &, u_char, u_char, const NS_SNMP OctetStr &)
 Add a set-type sub-request to an AgentX transaction.
 
virtual void close_session (u_int, u_char)
 Close a session.
 
virtual void set_auto_context (bool enabled)
 Enable or disable automatic context creation.
 
virtual Oidx get_upper_session_boundary (const NS_SNMP OctetStr &, AgentXNode *)
 Gets the upper boundary of the AgentX session that the given node's active registration belongs to.
 

Protected Member Functions

virtual void add_new_context (const NS_SNMP OctetStr &)
 Add a new context to the master.
 
AgentXIndexDBget_index_database (const NS_SNMP OctetStr &)
 Get index database for a given context.
 
virtual time_t timeout_requests (time_t)
 Timeout old requests and return the time until next request will timeout.
 
virtual void process_set_request (Request *)
 Process a set request.
 
virtual void do_process_request (Request *)
 
virtual void finalize (Request *)
 Finalize a request.
 
virtual void delete_request (Request *req)
 Unlocks the supplied request before it calls it corresponding super class method to actually delete the request.
 
virtual bool send_pending_ax (unsigned long)
 Send pending AgentX requests for a given transaction id.
 
virtual bool cancel_pending_ax (unsigned long)
 Cancel pending AgentX requests for a given transaction id.
 
virtual void process_ax_request (AgentXPdu &)
 Process AgentX requests.
 
virtual void process_ax_response (AgentXPdu &, bool)
 
virtual bool process_ax_search_response (AgentXPdu &, const AgentXPdu &, int *, Request *)
 
virtual void process_ax_set_response (AgentXPdu &, const AgentXPdu &, int *, Request *)
 
virtual bool process_ax_getbulk_response (AgentXPdu &, const AgentXPdu &, int *, Request *)
 
virtual void process_ax_open (AgentXPdu &)
 
virtual void process_ax_registration (AgentXPdu &)
 
virtual void process_ax_unregistration (AgentXPdu &)
 
virtual void process_ax_notify (AgentXPdu &)
 
virtual void process_ax_master_request (fd_set *, int *)
 
virtual void process_ax_addagentcaps (AgentXPdu &)
 
virtual void process_ax_removeagentcaps (AgentXPdu &)
 
virtual void process_ax_indexallocate (AgentXPdu &)
 
virtual void process_ax_indexdeallocate (AgentXPdu &)
 
virtual AgentXPducreate_response (AgentXPdu &, AgentXSession &)
 Create a response and answer it if either the session id does not correspond to a currently established session or if the NON_DEFAULT_CONTEXT bit is set and the master agent only supports the default context.
 
virtual bool get_affected_regs (const AgentXRegEntry &, const AgentXRegion &, List< AgentXNode > &)
 Get the affected registrations when trying to add a new one.
 
virtual bool has_conflict (const AgentXRegEntry &)
 Check whether a new registration will result in a conflict with existing registrations.
 
virtual void add_entry (AgentXRegEntry *)
 Add a registration entry (a single region or a range) to the MIB.
 
virtual bool remove_entry (u_int, const AgentXRegEntry &)
 Remove a registration entry.
 
virtual void remove_entries (u_int, u_int)
 Remove all registration entries of a given session.
 
virtual bool add_ax_agent_caps (const NS_SNMP OctetStr &, const Oidx &, const NS_SNMP OctetStr &, AgentXSession &)
 Add Agent Capabilities to a context.
 
virtual void remove_ax_agent_caps (const NS_SNMP OctetStr &, const Oidx &, AgentXSession &)
 Remove Agent Capabilities from a context.
 

Friends

class AgentXResponseTask
 
class AgentXCloseTask
 
class AgentXTask
 

Constructor & Destructor Documentation

MasterAgentXMib::MasterAgentXMib ( )

Default Constructor.

MasterAgentXMib::MasterAgentXMib ( const NS_SNMP OctetStr &  )

Constructor with path where persistent MIB objects should be stored to and loaded from.

Parameters
paththe directory to store persistent objects.
virtual MasterAgentXMib::~MasterAgentXMib ( )
virtual

Destructor.

Member Function Documentation

virtual MibEntry* MasterAgentXMib::add ( MibEntry *  )
virtual

Register a MIB object for the agent≥s MIB.

Parameters
item- A pointer to a MibEntry object (i.e., MibLeaf, MibTable, MibGroup, ...).
Returns
The input pointer (if the registered object is of type MibGroup 0).
virtual MibEntry* MasterAgentXMib::add ( const NS_SNMP OctetStr &  ,
MibEntry *   
)
virtual

Register a MIB object within a given context.

If the given context is a new context, it will be added to the list of known contexts.

Note: This method is synchronized using ::lock_mib()

Parameters
contextan OctetStr instance specifiying the target context.
itema pointer to a MibEntry object (i.e., MibLeaf, MibTable, MibGroup, ...).
Returns
the input pointer if the MibEntry could be registered, or 0 otherwise.
virtual bool MasterAgentXMib::add_ax_agent_caps ( const NS_SNMP OctetStr &  ,
const Oidx &  ,
const NS_SNMP OctetStr &  ,
AgentXSession  
)
protectedvirtual

Add Agent Capabilities to a context.

Parameters
contexta context. An empty string denotes the default context.
sysORIDan authoritative identification of a capabilities statement with respect to various MIB modules supported by the local SNMPv2 entity acting in an agent role.
sysORDescra textual description of the capabilities identified by the corresponding instance of sysORID.
sessionthe session that will be associated with this capabilities registration.
Returns
TRUE if the context could be found and it contains the sysOR MIB objects, FALSE otherwise.
virtual void MasterAgentXMib::add_entry ( AgentXRegEntry )
protectedvirtual

Add a registration entry (a single region or a range) to the MIB.

Parameters
newRega pointer to a new registration entry (do not delete the pointer - this is done by remove_entry())
virtual void MasterAgentXMib::add_get_subrequest ( u_int  ,
unsigned  long,
const AgentXSearchRange ,
u_char  ,
u_char  ,
const NS_SNMP OctetStr &  ,
int  = 0,
int  = 0 
)
virtual

Add a get-type sub-request to an AgentX transaction.

Parameters
sessionID
transactionID
searchRange
timeout
type
repeater
repetitions
virtual void MasterAgentXMib::add_new_context ( const NS_SNMP OctetStr &  )
protectedvirtual

Add a new context to the master.

This method is never called when auto context creation is disabled (default). Overwrite this method if you want to dynamically create view and user configuration for the new context.

Parameters
newContextan OctetStr representing the new context name.
virtual void MasterAgentXMib::add_set_subrequest ( u_int  ,
unsigned  long,
const AgentXSearchRange ,
const Vbx &  ,
u_char  ,
u_char  ,
const NS_SNMP OctetStr &   
)
virtual

Add a set-type sub-request to an AgentX transaction.

Parameters
sessionID
transactionID
searchRange
vb
timeout
type
virtual void MasterAgentXMib::answer ( AgentXPdu )
virtual

Answer an AgentX request.

Parameters
pduthe PDU to be sent as response
virtual bool MasterAgentXMib::cancel_pending_ax ( unsigned  long)
protectedvirtual

Cancel pending AgentX requests for a given transaction id.

Parameters
transactionIDa transaction ID.
Returns
TRUE if at least one pending request could be found (and canceled), FALSE otherwise.
virtual void MasterAgentXMib::close_session ( u_int  ,
u_char   
)
virtual

Close a session.

Parameters
sida session ID.
reasonthe reason
virtual AgentXPdu* MasterAgentXMib::create_response ( AgentXPdu ,
AgentXSession  
)
protectedvirtual

Create a response and answer it if either the session id does not correspond to a currently established session or if the NON_DEFAULT_CONTEXT bit is set and the master agent only supports the default context.

Parameters
requesta AgentX request.
sessionreturns the session corresponding to the session id in request.
Returns
NULL if one of the above error conditions occured, or a pointer to a newly created response PDU.
virtual void MasterAgentXMib::delete_request ( Request *  req)
inlineprotectedvirtual

Unlocks the supplied request before it calls it corresponding super class method to actually delete the request.

Parameters
requesta pointer to the Request to delete.
Since
1.4.12
virtual void MasterAgentXMib::do_process_request ( Request *  )
protectedvirtual
virtual void MasterAgentXMib::finalize ( Request *  )
protectedvirtual

Finalize a request.

The finalize method is called if all sub-requests have been successfully processed.

Parameters
requestthe request to finalize.
virtual bool MasterAgentXMib::get_affected_regs ( const AgentXRegEntry ,
const AgentXRegion ,
List< AgentXNode > &   
)
protectedvirtual

Get the affected registrations when trying to add a new one.

Parameters
newRega new AgentX registration
actualRegionthe region to be registered. This may be a subregion of newReg.region.
listall affected MibEntry instances will be added to list
Returns
TRUE if the registration would not affect non AgentX registrations, FALSE otherwise
AgentXMaster* MasterAgentXMib::get_agentx ( )

Get the AgentXMaster used by the receiver to process AgentX messages.

Returns
a pointer to an AgentXMaster instance.
AgentXIndexDB* MasterAgentXMib::get_index_database ( const NS_SNMP OctetStr &  )
protected

Get index database for a given context.

Parameters
contexta context string (<128 character).
Returns
the index database for the specified context or 0 if such a database does not exist.
virtual Oidx MasterAgentXMib::get_upper_session_boundary ( const NS_SNMP OctetStr &  ,
AgentXNode  
)
virtual

Gets the upper boundary of the AgentX session that the given node's active registration belongs to.

"Upper boundary" in this is context is defined as the upper bound (max_key) of the AgentXNode with the greatest key following the given one where all intermediate MibEntry instances are AgentXNodes whose active registration belongs to the same session as the start node.

Parameters
contextthe MibContext name of the context to search.
nodea pointer to an AgentXNode that denotes the lower bound of the search.
Returns
an Oidx that equals max_key() of the found upper bound AgentXNode. If the search for the upper boundary could not be executed, because of concurrent requests that lock the Mib instance, then the value of node->max_key() is returned.
virtual bool MasterAgentXMib::has_conflict ( const AgentXRegEntry )
protectedvirtual

Check whether a new registration will result in a conflict with existing registrations.

Parameters
registrationthe registration to test
Returns
TRUE if the registration will result in a conflict, FALSE otherwise
virtual bool MasterAgentXMib::init ( )
virtual

Start the master agent thread and initialize master MIB.

Returns
TRUE if initialization was successful, FALSE otherwise.
virtual bool MasterAgentXMib::is_dupl_reg ( const AgentXRegEntry )
virtual

Check whether the given region would be a duplicate registration (a registration that would result in a duplicate region with the same priority and within the same context is termed a duplicate registration)

Parameters
registrationthe registration to test
Returns
TRUE if the test registration would result in a duplicate registration
virtual void MasterAgentXMib::process_agentx ( )
virtual

Wait for an incoming AgentX request and process it.

virtual void MasterAgentXMib::process_ax_addagentcaps ( AgentXPdu )
protectedvirtual
virtual bool MasterAgentXMib::process_ax_getbulk_response ( AgentXPdu ,
const AgentXPdu ,
int *  ,
Request *   
)
protectedvirtual
virtual void MasterAgentXMib::process_ax_indexallocate ( AgentXPdu )
protectedvirtual
virtual void MasterAgentXMib::process_ax_indexdeallocate ( AgentXPdu )
protectedvirtual
virtual void MasterAgentXMib::process_ax_master_request ( fd_set *  ,
int *   
)
protectedvirtual
virtual void MasterAgentXMib::process_ax_notify ( AgentXPdu )
protectedvirtual
virtual void MasterAgentXMib::process_ax_open ( AgentXPdu )
protectedvirtual
virtual void MasterAgentXMib::process_ax_registration ( AgentXPdu )
protectedvirtual
virtual void MasterAgentXMib::process_ax_removeagentcaps ( AgentXPdu )
protectedvirtual
virtual void MasterAgentXMib::process_ax_request ( AgentXPdu )
protectedvirtual

Process AgentX requests.

Parameters
pduthe request PDU.
virtual void MasterAgentXMib::process_ax_response ( AgentXPdu ,
bool   
)
protectedvirtual
virtual bool MasterAgentXMib::process_ax_search_response ( AgentXPdu ,
const AgentXPdu ,
int *  ,
Request *   
)
protectedvirtual
virtual void MasterAgentXMib::process_ax_set_response ( AgentXPdu ,
const AgentXPdu ,
int *  ,
Request *   
)
protectedvirtual
virtual void MasterAgentXMib::process_ax_unregistration ( AgentXPdu )
protectedvirtual
virtual void MasterAgentXMib::process_set_request ( Request *  )
protectedvirtual

Process a set request.

Parameters
repthe set request to process.
virtual void MasterAgentXMib::remove_ax_agent_caps ( const NS_SNMP OctetStr &  ,
const Oidx &  ,
AgentXSession  
)
protectedvirtual

Remove Agent Capabilities from a context.

Parameters
contexta context. An empty string denotes the default context.
sysORIDan authoritative identification of a capabilities statement with respect to various MIB modules supported by the local SNMPv2 entity acting in an agent role.
sessionthe session that is associated with this capabilities registration.
virtual void MasterAgentXMib::remove_entries ( u_int  ,
u_int   
)
protectedvirtual

Remove all registration entries of a given session.

(SYNCHRONIZED on registrations)

Parameters
connectionIDa connection ID (AgentX MIB)
sessionIDa session id.
virtual bool MasterAgentXMib::remove_entry ( u_int  ,
const AgentXRegEntry  
)
protectedvirtual

Remove a registration entry.

(NOT SYNCHRONIZED)

Parameters
connectionIDa connection ID (AgentX MIB)
victima registration entry
Returns
TRUE if the registration entry has been removed, FALSE otherwise
virtual bool MasterAgentXMib::send_pending_ax ( unsigned  long)
protectedvirtual

Send pending AgentX requests for a given transaction id.

Parameters
transactionIDa transaction ID.
Returns
TRUE if at least one pending request could be found (and sent), FALSE otherwise.
virtual void MasterAgentXMib::set_agentx ( AgentXMaster )
virtual

Set the AgentXMaster that will process AgentX messages.

Parameters
agentXMastera pointer to an AgentXMaster instance.
virtual void MasterAgentXMib::set_auto_context ( bool  enabled)
inlinevirtual

Enable or disable automatic context creation.

If enabled and the master receives a registration request for an unknown subagent it will add the unknown context to its Mib and to the VACM. The default is FALSE (auto context creation disabled).

Parameters
enableIf TRUE auto context creation is enabled, otherwise disabled.
void MasterAgentXMib::set_session_admin_status_writable ( bool  )

Set the access mode for agentxSessionAdminStatus.

Parameters
writableif TRUE the agentxSessionAdminStatus MIB object of the AgentX MIB may be written and thus an AgentX session may be closed via SNMP. If FALSE agentxSessionAdminStatus is read-only.
virtual time_t MasterAgentXMib::timeout_requests ( time_t  )
protectedvirtual

Timeout old requests and return the time until next request will timeout.

Parameters
timeouta time value. All requests with a timeout value less than timeout will be deleted from the queue.
Returns
the time until the next request will timeout.

Friends And Related Function Documentation

friend class AgentXCloseTask
friend
friend class AgentXResponseTask
friend
friend class AgentXTask
friend

The documentation for this class was generated from the following file: