#include <agentx_master.h>
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. | |
AgentXMaster * | get_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. | |
AgentXIndexDB * | get_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 AgentXPdu * | create_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 |
MasterAgentXMib::MasterAgentXMib | ( | ) |
Default Constructor.
MasterAgentXMib::MasterAgentXMib | ( | const NS_SNMP OctetStr & | ) |
Constructor with path where persistent MIB objects should be stored to and loaded from.
path | the directory to store persistent objects. |
virtual MasterAgentXMib::~MasterAgentXMib | ( | ) | [virtual] |
Destructor.
virtual void MasterAgentXMib::set_agentx | ( | AgentXMaster * | ) | [virtual] |
Set the AgentXMaster that will process AgentX messages.
agentXMaster | a pointer to an AgentXMaster instance. |
AgentXMaster* MasterAgentXMib::get_agentx | ( | ) |
Get the AgentXMaster used by the receiver to process AgentX messages.
void MasterAgentXMib::set_session_admin_status_writable | ( | boolean | ) |
Set the access mode for agentxSessionAdminStatus.
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.
item | - A pointer to a MibEntry object (i.e., MibLeaf, MibTable, MibGroup, ...). |
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()
context | an OctetStr instance specifiying the target context. | |
item | a pointer to a MibEntry object (i.e., MibLeaf, MibTable, MibGroup, ...). |
virtual boolean MasterAgentXMib::init | ( | ) | [virtual] |
Start the master agent thread and initialize master MIB.
virtual void MasterAgentXMib::process_agentx | ( | ) | [virtual] |
Wait for an incoming AgentX request and process it.
virtual void MasterAgentXMib::answer | ( | AgentXPdu & | ) | [virtual] |
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).
registration | the registration to test |
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.
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.
sessionID | ||
transactionID | ||
searchRange | ||
vb | ||
timeout | ||
type |
virtual void MasterAgentXMib::close_session | ( | u_int | , | |
u_char | ||||
) | [virtual] |
Close a session.
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).
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.
context | the MibContext name of the context to search. | |
node | a pointer to an AgentXNode that denotes the lower bound of the search. |
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.
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.
context | a context string (<128 character). |
virtual time_t MasterAgentXMib::timeout_requests | ( | time_t | ) | [protected, virtual] |
Timeout old requests and return the time until next request will timeout.
timeout | a time value. All requests with a timeout value less than timeout will be deleted from the queue. |
virtual void MasterAgentXMib::process_set_request | ( | Request * | ) | [protected, virtual] |
Process a set request.
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.
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.
request | a pointer to the Request to delete. |
virtual boolean MasterAgentXMib::send_pending_ax | ( | unsigned | long | ) | [protected, virtual] |
Send pending AgentX requests for a given transaction id.
transactionID | a transaction ID. |
virtual boolean MasterAgentXMib::cancel_pending_ax | ( | unsigned | long | ) | [protected, virtual] |
Cancel pending AgentX requests for a given transaction id.
transactionID | a transaction ID. |
virtual void MasterAgentXMib::process_ax_request | ( | AgentXPdu & | ) | [protected, virtual] |
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.
request | a AgentX request. | |
session | returns the session corresponding to the session id in request. |
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.
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 |
virtual boolean MasterAgentXMib::has_conflict | ( | const AgentXRegEntry & | ) | [protected, virtual] |
Check whether a new registration will result in a conflict with existing registrations.
registration | the registration to test |
virtual void MasterAgentXMib::add_entry | ( | AgentXRegEntry * | ) | [protected, virtual] |
Add a registration entry (a single region or a range) to the MIB.
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)
connectionID | a connection ID (AgentX MIB) | |
victim | a registration entry |
virtual void MasterAgentXMib::remove_entries | ( | u_int | , | |
u_int | ||||
) | [protected, virtual] |
Remove all registration entries of a given session.
(SYNCHRONIZED on registrations)
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.
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. |
virtual void MasterAgentXMib::remove_ax_agent_caps | ( | const NS_SNMP OctetStr & | , | |
const Oidx & | , | |||
AgentXSession & | ||||
) | [protected, virtual] |
Remove Agent Capabilities from a context.
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. |
friend class AgentXResponseTask [friend] |
friend class AgentXCloseTask [friend] |
friend class AgentXTask [friend] |