AgentX++  2.0.5
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
AgentX Class Referenceabstract

#include <agentx.h>

Inheritance diagram for AgentX:
AgentXMaster AgentXSlave

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 bool 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 bool bind_unix ()=0
 Bind unix domain socket.
 
int get_unix_socket ()
 Get the AgentX socket.
 
virtual bool bind_tcp ()=0
 Bind TCP socket.
 
int get_tcp_socket ()
 Get the AgentX socket.
 
int set_file_descriptors (fd_set *)
 
bool 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 bool 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

bool 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

virtual bool AgentX::bind_tcp ( )
pure virtual

Bind TCP socket.

Returns
TRUE if the socket could be bound successfully.

Implemented in AgentXSlave, and AgentXMaster.

virtual bool AgentX::bind_unix ( )
pure virtual

Bind unix domain socket.

Returns
TRUE if the socket could be bound successfully.

Implemented in AgentXSlave, and AgentXMaster.

bool AgentX::check_peer_closed ( fd_set *  )
void AgentX::close_session ( const AgentXSession ,
u_int  ,
u_char   
)

Close a session.

Parameters
sessiona AgentXSession instance.
transactionIDthe transcation id to be used.
reasonthe reason.
static time_t AgentX::compute_timeout ( u_int  ,
u_int  = 0 
)
static

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

Parameters
sessionTimeoutthe timeout value of the session. If sessionTimeout is 0 AGENTX_DEFAULT_TIMEOUT is used to compute the timestamp.
regionTimeoutthe 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)
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.
AgentXQueue* AgentX::get_queue ( )
inline
int AgentX::get_tcp_socket ( )

Get the AgentX socket.

Returns
a socket descriptor.
int AgentX::get_unix_socket ( )

Get the AgentX socket.

Returns
a socket descriptor.
virtual bool AgentX::is_response ( const AgentXPdu ,
const AgentXPdu  
)
pure virtual

Check whether two PDUs are a request/response pair.

Parameters
requestthe "request" PDU.
responsethe "response" PDU.
Returns
TRUE if response is a response to request, FALSE otherwise.

Implemented in AgentXSlave, and AgentXMaster.

void AgentX::lock_peers ( )
inline
void AgentX::lock_queue ( )
inline
void AgentX::lock_socket ( )
virtual ListCursor<AgentXPeer> AgentX::peers ( )
virtual

Get a cursor on the peer list.

Returns
a cursor on the receiver's peer list.
void AgentX::ping_session ( const AgentXSession ,
u_int   
)

Ping a session.

Parameters
sessiona AgentXSession instance.
transactionIDthe transcation id to be used.
virtual bool AgentX::quit ( )
inlinevirtual

Return whether the agentX should quit.

Returns
TRUE if the agentX should quit
virtual int AgentX::receive_agentx ( int  ,
AgentXPdu  
)
virtual

Receive an AgentX PDU.

Parameters
sda socket descriptor
pduan empty AgentXPdu instance.
Returns
an error code on failure or AGENTX_CLASS_SUCCESS on success
virtual void AgentX::reinit ( )
inlinevirtual

(Re)initialize the AgentX protocol stack.

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

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

Remove a peer rom the peer list.

Parameters
victiman 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 int AgentX::send_agentx ( int  ,
const AgentXPdu  
)
virtual

Send an AgentX PDU.

Parameters
sda socket descriptor
pduthe AgentXPdu instance to be send
Returns
an error code on failure or AGENTX_CLASS_SUCCESS on success
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
modea possibly ored value of AX_USE_UNIX_SOCKET and AX_USE_TCP_SOCKET.
int AgentX::set_file_descriptors ( fd_set *  )
void AgentX::set_tcp_port ( int  )

Set TCP port.

Parameters
porta TCP port.
void AgentX::set_unix_port_loc ( const NS_SNMP OctetStr &  )

Set the unix port location.

Parameters
locationan AF_UNIX socket port location
void AgentX::unlock_peers ( )
inline
void AgentX::unlock_queue ( )
inline
void AgentX::unlock_socket ( )

Member Data Documentation

List<AgentXPeer> AgentX::axPeers
protected
Synchronized AgentX::axPeersLock
protected
AgentXQueue AgentX::axQueue
protected
int AgentX::axSocket
protected
Synchronized AgentX::axSocketLock
protected
int AgentX::axTCPPort
protected
int AgentX::axTCPSocket
protected
NS_SNMP OctetStr AgentX::axUnixSocketLocation
protected
int AgentX::connectMode
protected
bool AgentX::stopit

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