AgentX++  2.0.5
Public Member Functions | Protected Types | Protected Attributes | List of all members
AgentXSlave Class Reference

#include <agentx.h>

Inheritance diagram for AgentXSlave:
AgentX

Public Member Functions

 AgentXSlave ()
 
virtual ~AgentXSlave ()
 
virtual bool bind_unix ()
 Bind unix domain socket.
 
void set_master_address (const NS_SNMP UdpAddress &addr)
 Set the masters IP address.
 
virtual bool bind_tcp ()
 Bind TCP socket.
 
virtual AgentXPdureceive (const u_int, int &)
 Wait a given time for an incoming request.
 
virtual int send (const AgentXPdu &)
 Send an AgentXPdu.
 
virtual int send_synch (AgentXPdu &, AgentXPdu &)
 Send an AgentXPdu as a synchronous request.
 
virtual int open_session (AgentXSession &)
 Initiates (opens) a AgentX session with the master agent.
 
virtual bool is_response (const AgentXPdu &, const AgentXPdu &)
 Check whether two PDUs are a request/response pair.
 
void lock_rcv_socket ()
 
void unlock_rcv_socket ()
 
int get_socket ()
 Get the socket descriptor used to communicate with the AgentX master agent.
 
- Public Member Functions inherited from AgentX
 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.
 
int get_unix_socket ()
 Get the AgentX 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 ()
 
void close_session (const AgentXSession &, u_int, u_char)
 Close a session.
 
void ping_session (const AgentXSession &, u_int)
 Ping a session.
 

Protected Types

enum  ConnectionType { UNCONNECTED, UNIX, TCP }
 

Protected Attributes

int axSlaveSocket
 
ConnectionType connectionType
 
NS_SNMP UdpAddress masterAddress
 
- Protected Attributes inherited from AgentX
int axTCPSocket
 
int axTCPPort
 
int axSocket
 
NS_SNMP OctetStr axUnixSocketLocation
 
AgentXQueue axQueue
 
List< AgentXPeeraxPeers
 
Synchronized axPeersLock
 
Synchronized axSocketLock
 
int connectMode
 

Additional Inherited Members

- Static Public Member Functions inherited from AgentX
static time_t compute_timeout (u_int, u_int=0)
 Compute the timeout (timestamp when a PDU/request times out)
 
- Public Attributes inherited from AgentX
bool stopit
 

Member Enumeration Documentation

Enumerator:
UNCONNECTED 
UNIX 
TCP 

Constructor & Destructor Documentation

AgentXSlave::AgentXSlave ( )
virtual AgentXSlave::~AgentXSlave ( )
virtual

Member Function Documentation

virtual bool AgentXSlave::bind_tcp ( )
virtual

Bind TCP socket.

Returns
TRUE if the socket could be bound successfully.

Implements AgentX.

virtual bool AgentXSlave::bind_unix ( )
virtual

Bind unix domain socket.

Returns
TRUE if the socket could be bound successfully.

Implements AgentX.

int AgentXSlave::get_socket ( )
inline

Get the socket descriptor used to communicate with the AgentX master agent.

Returns
a socket descriptor of an UNIX socket or a TCP socket.
virtual bool AgentXSlave::is_response ( const AgentXPdu ,
const AgentXPdu  
)
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.

Implements AgentX.

void AgentXSlave::lock_rcv_socket ( )
virtual int AgentXSlave::open_session ( AgentXSession )
virtual

Initiates (opens) a AgentX session with the master agent.

Parameters
sessionan AgentXSession instance.
Returns
AGENTX_OK if session opened successfully, any other AGENTX error code on failure.
virtual AgentXPdu* AgentXSlave::receive ( const u_int  ,
int &   
)
virtual

Wait a given time for an incoming request.

Parameters
timeoutthe maximum time in milli seconds to wait for an incoming request.
statusreturns the current status of the connection with the master.
Returns
a pointer to the received request, or 0, if within the timeout period no request has been received.
virtual int AgentXSlave::send ( const AgentXPdu )
virtual

Send an AgentXPdu.

Parameters
pduthe pdu to send.
Returns
an error status.
virtual int AgentXSlave::send_synch ( AgentXPdu ,
AgentXPdu  
)
virtual

Send an AgentXPdu as a synchronous request.

Parameters
pduthe pdu to send. Packet id and send time are set.
responsethe pdu to hold the received response.
Returns
an error status.
void AgentXSlave::set_master_address ( const NS_SNMP UdpAddress &  addr)
inline

Set the masters IP address.

Default is localhost (127.0.0.1).

Parameters
ipAddressthe IP address of an AgentX master. If the port portion is not 0 it is used instead of the standard AgentX TCP port.
void AgentXSlave::unlock_rcv_socket ( )

Member Data Documentation

int AgentXSlave::axSlaveSocket
protected
ConnectionType AgentXSlave::connectionType
protected
NS_SNMP UdpAddress AgentXSlave::masterAddress
protected

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