MasterAgentXMib Class Reference

#include <agentx_master.h>

List of all members.

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 (boolean)
 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 boolean 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 boolean 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 (boolean 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 boolean send_pending_ax (unsigned long)
 Send pending AgentX requests for a given transaction id.
virtual boolean 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 &, boolean)
virtual boolean process_ax_search_response (AgentXPdu &, const AgentXPdu &, int *, Request *)
virtual void process_ax_set_response (AgentXPdu &, const AgentXPdu &, int *, Request *)
virtual boolean 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 boolean get_affected_regs (const AgentXRegEntry &, const AgentXRegion &, List< AgentXNode > &)
 Get the affected registrations when trying to add a new one.
virtual boolean 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 boolean 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 boolean 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:
path the directory to store persistent objects.

virtual MasterAgentXMib::~MasterAgentXMib (  )  [virtual]

Destructor.


Member Function Documentation

virtual void MasterAgentXMib::set_agentx ( AgentXMaster  )  [virtual]

Set the AgentXMaster that will process AgentX messages.

Parameters:
agentXMaster a pointer to an AgentXMaster instance.

AgentXMaster* MasterAgentXMib::get_agentx (  ) 

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

Returns:
a pointer to an AgentXMaster instance.

void MasterAgentXMib::set_session_admin_status_writable ( boolean   ) 

Set the access mode for agentxSessionAdminStatus.

Parameters:
writable if 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 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:
context an OctetStr instance specifiying the target context.
item a pointer to a MibEntry object (i.e., MibLeaf, MibTable, MibGroup, ...).
Returns:
the input pointer if the MibEntry could be registered, or 0 otherwise.

virtual boolean MasterAgentXMib::init (  )  [virtual]

Start the master agent thread and initialize master MIB.

Returns:
TRUE if initialization was successful, FALSE otherwise.

virtual void MasterAgentXMib::process_agentx (  )  [virtual]

Wait for an incoming AgentX request and process it.

virtual void MasterAgentXMib::answer ( AgentXPdu  )  [virtual]

Answer an AgentX request.

Parameters:
pdu the PDU to be sent as response

virtual boolean 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:
registration the registration to test
Returns:
TRUE if the test registration would result in a duplicate registration

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_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::close_session ( u_int  ,
u_char   
) [virtual]

Close a session.

Parameters:
sid a session ID.
reason the reason

virtual void MasterAgentXMib::set_auto_context ( boolean  enabled  )  [inline, virtual]

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:
enable If TRUE auto context creation is enabled, otherwise disabled.

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:
context the MibContext name of the context to search.
node a 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 void MasterAgentXMib::add_new_context ( const NS_SNMP OctetStr &   )  [protected, virtual]

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:
newContext an OctetStr representing the new context name.

AgentXIndexDB* MasterAgentXMib::get_index_database ( const NS_SNMP OctetStr &   )  [protected]

Get index database for a given context.

Parameters:
context a context string (<128 character).
Returns:
the index database for the specified context or 0 if such a database does not exist.

virtual time_t MasterAgentXMib::timeout_requests ( time_t   )  [protected, virtual]

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

Parameters:
timeout a 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.

virtual void MasterAgentXMib::process_set_request ( Request *   )  [protected, virtual]

Process a set request.

Parameters:
rep the set request to process.

virtual void MasterAgentXMib::do_process_request ( Request *   )  [protected, virtual]

virtual void MasterAgentXMib::finalize ( Request *   )  [protected, virtual]

Finalize a request.

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

Parameters:
request the request to finalize.

virtual void MasterAgentXMib::delete_request ( Request *  req  )  [inline, protected, virtual]

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

Parameters:
request a pointer to the Request to delete.
Since:
1.4.12

virtual boolean MasterAgentXMib::send_pending_ax ( unsigned  long  )  [protected, virtual]

Send pending AgentX requests for a given transaction id.

Parameters:
transactionID a transaction ID.
Returns:
TRUE if at least one pending request could be found (and sent), FALSE otherwise.

virtual boolean MasterAgentXMib::cancel_pending_ax ( unsigned  long  )  [protected, virtual]

Cancel pending AgentX requests for a given transaction id.

Parameters:
transactionID a transaction ID.
Returns:
TRUE if at least one pending request could be found (and canceled), FALSE otherwise.

virtual void MasterAgentXMib::process_ax_request ( AgentXPdu  )  [protected, virtual]

Process AgentX requests.

Parameters:
pdu the request PDU.

virtual void MasterAgentXMib::process_ax_response ( AgentXPdu ,
boolean   
) [protected, virtual]

virtual boolean MasterAgentXMib::process_ax_search_response ( AgentXPdu ,
const AgentXPdu ,
int *  ,
Request *   
) [protected, virtual]

virtual void MasterAgentXMib::process_ax_set_response ( AgentXPdu ,
const AgentXPdu ,
int *  ,
Request *   
) [protected, virtual]

virtual boolean MasterAgentXMib::process_ax_getbulk_response ( AgentXPdu ,
const AgentXPdu ,
int *  ,
Request *   
) [protected, virtual]

virtual void MasterAgentXMib::process_ax_open ( AgentXPdu  )  [protected, virtual]

virtual void MasterAgentXMib::process_ax_registration ( AgentXPdu  )  [protected, virtual]

virtual void MasterAgentXMib::process_ax_unregistration ( AgentXPdu  )  [protected, virtual]

virtual void MasterAgentXMib::process_ax_notify ( AgentXPdu  )  [protected, virtual]

virtual void MasterAgentXMib::process_ax_master_request ( fd_set *  ,
int *   
) [protected, virtual]

virtual void MasterAgentXMib::process_ax_addagentcaps ( AgentXPdu  )  [protected, virtual]

virtual void MasterAgentXMib::process_ax_removeagentcaps ( AgentXPdu  )  [protected, virtual]

virtual void MasterAgentXMib::process_ax_indexallocate ( AgentXPdu  )  [protected, virtual]

virtual void MasterAgentXMib::process_ax_indexdeallocate ( AgentXPdu  )  [protected, virtual]

virtual AgentXPdu* MasterAgentXMib::create_response ( AgentXPdu ,
AgentXSession  
) [protected, virtual]

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:
request a AgentX request.
session returns 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 boolean MasterAgentXMib::get_affected_regs ( const AgentXRegEntry ,
const AgentXRegion ,
List< AgentXNode > &   
) [protected, virtual]

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

Parameters:
newReg a new AgentX registration
actualRegion the region to be registered. This may be a subregion of newReg.region.
list all affected MibEntry instances will be added to list
Returns:
TRUE if the registration would not affect non AgentX registrations, FALSE otherwise

virtual boolean MasterAgentXMib::has_conflict ( const AgentXRegEntry  )  [protected, virtual]

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

Parameters:
registration the registration to test
Returns:
TRUE if the registration will result in a conflict, FALSE otherwise

virtual void MasterAgentXMib::add_entry ( AgentXRegEntry  )  [protected, virtual]

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

Parameters:
newReg a pointer to a new registration entry (do not delete the pointer - this is done by remove_entry())

virtual boolean MasterAgentXMib::remove_entry ( u_int  ,
const AgentXRegEntry  
) [protected, virtual]

Remove a registration entry.

(NOT SYNCHRONIZED)

Parameters:
connectionID a connection ID (AgentX MIB)
victim a registration entry
Returns:
TRUE if the registration entry has been removed, FALSE otherwise

virtual void MasterAgentXMib::remove_entries ( u_int  ,
u_int   
) [protected, virtual]

Remove all registration entries of a given session.

(SYNCHRONIZED on registrations)

Parameters:
connectionID a connection ID (AgentX MIB)
sessionID a session id.

virtual boolean MasterAgentXMib::add_ax_agent_caps ( const NS_SNMP OctetStr &  ,
const Oidx &  ,
const NS_SNMP OctetStr &  ,
AgentXSession  
) [protected, virtual]

Add Agent Capabilities to a context.

Parameters:
context a context. An empty string denotes the default context.
sysORID an authoritative identification of a capabilities statement with respect to various MIB modules supported by the local SNMPv2 entity acting in an agent role.
sysORDescr a textual description of the capabilities identified by the corresponding instance of sysORID.
session the 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::remove_ax_agent_caps ( const NS_SNMP OctetStr &  ,
const Oidx &  ,
AgentXSession  
) [protected, virtual]

Remove Agent Capabilities from a context.

Parameters:
context a context. An empty string denotes the default context.
sysORID an authoritative identification of a capabilities statement with respect to various MIB modules supported by the local SNMPv2 entity acting in an agent role.
session the session that is associated with this capabilities registration.


Friends And Related Function Documentation

friend class AgentXResponseTask [friend]

friend class AgentXCloseTask [friend]

friend class AgentXTask [friend]


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

Generated on Tue May 26 23:32:16 2009 for AgentX++ by  doxygen 1.5.6