AgentX Class Reference

#include <agentx.h>

Inheritance diagram for AgentX:

AgentXMaster AgentXSlave

List of all members.

Public Member Functions

 AgentX ()
 Create an AgentX session.
virtual ~AgentX ()
 Destructor.
void set_connect_mode (int m)
 Set connection mode.
int get_connect_mode ()
 Get the connection mode.
void set_unix_port_loc (const NS_SNMP OctetStr &)
 Set the unix port location.
void set_tcp_port (int)
 Set TCP port.
virtual boolean quit ()
 Return whether the agentX should quit.
virtual void reinit ()
 (Re)initialize the AgentX protocol stack.
virtual int send_agentx (int, const AgentXPdu &)
 Send an AgentX PDU.
virtual int receive_agentx (int, AgentXPdu &)
 Receive an AgentX PDU.
virtual ListCursor< AgentXPeerpeers ()
 Get a cursor on the peer list.
virtual AgentXPeerremove_peer (const AgentXPeer &)
 Remove a peer rom the peer list.
virtual boolean bind_unix ()=0
 Bind unix domain socket.
int get_unix_socket ()
 Get the AgentX socket.
virtual boolean bind_tcp ()=0
 Bind TCP socket.
int get_tcp_socket ()
 Get the AgentX socket.
int set_file_descriptors (fd_set *)
boolean check_peer_closed (fd_set *)
void lock_socket ()
void unlock_socket ()
void lock_queue ()
void unlock_queue ()
void lock_peers ()
void unlock_peers ()
AgentXQueueget_queue ()
virtual boolean is_response (const AgentXPdu &, const AgentXPdu &)=0
 Check whether two PDUs are a request/response pair.
void close_session (const AgentXSession &, u_int, u_char)
 Close a session.
void ping_session (const AgentXSession &, u_int)
 Ping a session.

Static Public Member Functions

static time_t compute_timeout (u_int, u_int=0)
 Compute the timeout (timestamp when a PDU/request times out).

Public Attributes

boolean stopit

Protected Attributes

int axTCPSocket
int axTCPPort
int axSocket
NS_SNMP OctetStr axUnixSocketLocation
AgentXQueue axQueue
List< AgentXPeeraxPeers
Synchronized axPeersLock
Synchronized axSocketLock
int connectMode


Constructor & Destructor Documentation

AgentX::AgentX (  ) 

Create an AgentX session.

virtual AgentX::~AgentX (  )  [virtual]

Destructor.


Member Function Documentation

void AgentX::set_connect_mode ( int  m  )  [inline]

Set connection mode.

Currently UNIX domain sockets (AX_USE_UNIX_SOCKET) and TCP sockets (AX_USE_TCP_SOCKET) are supported.

Parameters:
mode a possibly ored value of AX_USE_UNIX_SOCKET and AX_USE_TCP_SOCKET.

int AgentX::get_connect_mode (  )  [inline]

Get the connection mode.

Thus, whether to use the UNIX domain socket, the TCP socket, or both.

Returns:
a possibly ored value of AX_USE_UNIX_SOCKET and AX_USE_TCP_SOCKET.

void AgentX::set_unix_port_loc ( const NS_SNMP OctetStr &   ) 

Set the unix port location.

Parameters:
location an AF_UNIX socket port location

void AgentX::set_tcp_port ( int   ) 

Set TCP port.

Parameters:
port a TCP port.

virtual boolean AgentX::quit (  )  [inline, virtual]

Return whether the agentX should quit.

Returns:
TRUE if the agentX should quit

virtual void AgentX::reinit (  )  [inline, virtual]

(Re)initialize the AgentX protocol stack.

This resets values like stopit in order to be able to reestablish an AgentX connection.

virtual int AgentX::send_agentx ( int  ,
const AgentXPdu  
) [virtual]

Send an AgentX PDU.

Parameters:
sd a socket descriptor
pdu the AgentXPdu instance to be send
Returns:
an error code on failure or AGENTX_CLASS_SUCCESS on success

virtual int AgentX::receive_agentx ( int  ,
AgentXPdu  
) [virtual]

Receive an AgentX PDU.

Parameters:
sd a socket descriptor
pdu an empty AgentXPdu instance.
Returns:
an error code on failure or AGENTX_CLASS_SUCCESS on success

virtual ListCursor<AgentXPeer> AgentX::peers (  )  [virtual]

Get a cursor on the peer list.

Returns:
a cursor on the receiver's peer list.

virtual AgentXPeer* AgentX::remove_peer ( const AgentXPeer  )  [virtual]

Remove a peer rom the peer list.

Parameters:
victim an example for an AgentXPeer instance that should be removed from the peer list.
Returns:
a pointer to the removed peer instance or 0 if no such instance could be found.

virtual boolean AgentX::bind_unix (  )  [pure virtual]

Bind unix domain socket.

Returns:
TRUE if the socket could be bound successfully.

Implemented in AgentXMaster, and AgentXSlave.

int AgentX::get_unix_socket (  ) 

Get the AgentX socket.

Returns:
a socket descriptor.

virtual boolean AgentX::bind_tcp (  )  [pure virtual]

Bind TCP socket.

Returns:
TRUE if the socket could be bound successfully.

Implemented in AgentXMaster, and AgentXSlave.

int AgentX::get_tcp_socket (  ) 

Get the AgentX socket.

Returns:
a socket descriptor.

int AgentX::set_file_descriptors ( fd_set *   ) 

boolean AgentX::check_peer_closed ( fd_set *   ) 

void AgentX::lock_socket (  ) 

void AgentX::unlock_socket (  ) 

void AgentX::lock_queue (  )  [inline]

void AgentX::unlock_queue (  )  [inline]

void AgentX::lock_peers (  )  [inline]

void AgentX::unlock_peers (  )  [inline]

AgentXQueue* AgentX::get_queue (  )  [inline]

virtual boolean AgentX::is_response ( const AgentXPdu ,
const AgentXPdu  
) [pure virtual]

Check whether two PDUs are a request/response pair.

Parameters:
request the "request" PDU.
response the "response" PDU.
Returns:
TRUE if response is a response to request, FALSE otherwise.

Implemented in AgentXMaster, and AgentXSlave.

void AgentX::close_session ( const AgentXSession ,
u_int  ,
u_char   
)

Close a session.

Parameters:
session a AgentXSession instance.
transactionID the transcation id to be used.
reason the reason.

void AgentX::ping_session ( const AgentXSession ,
u_int   
)

Ping a session.

Parameters:
session a AgentXSession instance.
transactionID the transcation id to be used.

static time_t AgentX::compute_timeout ( u_int  ,
u_int  = 0 
) [static]

Compute the timeout (timestamp when a PDU/request times out).

Parameters:
sessionTimeout the timeout value of the session. If sessionTimeout is 0 AGENTX_DEFAULT_TIMEOUT is used to compute the timestamp.
regionTimeout the timeout value of the region. If regionTimeout is 0 or if it is not given, the sessionTimeout or AGENTX_DEFAULT_TIMEOUT value is used to compute the timestamp respectively.
Returns:
a timestamp (current time + timeout)


Member Data Documentation

boolean AgentX::stopit

int AgentX::axTCPSocket [protected]

int AgentX::axTCPPort [protected]

int AgentX::axSocket [protected]

NS_SNMP OctetStr AgentX::axUnixSocketLocation [protected]

List<AgentXPeer> AgentX::axPeers [protected]

Synchronized AgentX::axPeersLock [protected]

Synchronized AgentX::axSocketLock [protected]

int AgentX::connectMode [protected]


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

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