SocketClient (const Iptuple& iptuple, EventLoop& e)
| SocketClient |
Parameters:
iptuple | specification of the connection endpoints. |
~SocketClient ()
| ~SocketClient |
typedef XorpCallback1<void, bool>::RefPtr ConnectCallback | ConnectCallback |
Callback for connection attempts.
void connect (ConnectCallback cb)
| connect |
Asynchronously connect.
Parameters:
cb | is called when connection suceeds or fails. |
void connect_break ()
| connect_break |
Break asynchronous connect attempt.
Each instance of the this class has a single connection associated with it. If while we are attemping to connect to a peer (using connect()), the peer connects to us. It is necessary to stop the outgoing connect.
void connected (int s)
| connected |
The peer has initiated the connection so form an association.
Parameters:
s | incoming socket file descriptor |
void flush_transmit_queue ()
| flush_transmit_queue |
Throw away all the data that is queued to be sent on this socket.
void stop_reader ()
| stop_reader |
Stop reading data on this socket.
void disconnect ()
| disconnect |
bool disconnecting ()
| disconnecting |
Returns: Are we currrent disconecting.
typedef XorpCallback3<bool,BGPPacket::Status,const uint8_t*,size_t>::RefPtr MessageCallback | MessageCallback |
Callback for incoming data.
Parameters:
const | uint8_t* pointer to data. |
size_t | length of data. |
void set_callback (const MessageCallback& cb)
| set_callback |
Set the callback for incoming data.
enum Event { DATA = AsyncFileWriter::DATA, FLUSHING = AsyncFileWriter::FLUSHING, ERROR = AsyncFileWriter::ERROR_CHECK_ERRNO } | Event |
typedef XorpCallback2<void,Event,const uint8_t*>::RefPtr SendCompleteCallback | SendCompleteCallback |
Callback for data transmission.
Parameters:
Event | status of the send. |
const | uint8_t* pointer to the transmitted data. Allows caller to free the data. |
bool send_message (const uint8_t* buf,
size_t cnt,
SendCompleteCallback cb)
| send_message |
Asynchronously Send a message.
Parameters:
buf | pointer to data buffer. |
cnt | length of data buffer. |
cb | notification of success or failure. |
Returns: true if the message is accepted.
bool output_queue_busy ()
| output_queue_busy |
[const]
Flow control signal.
Data will be queued for transmission until a resource such as memory is exceeded. A correctly written client should stop sending messages if the output queue is not draining.
Returns: true if its time to stop sending messages.
int output_queue_size ()
| output_queue_size |
[const]
Returns: number of messages in the output queue.
bool is_connected ()
| is_connected |
Returns: true if a session exists.
bool still_reading ()
| still_reading |
Returns: true if we are still reading.