Kea  1.9.9-git
isc::dhcp_ddns::UDPCallback Class Reference

Implements the callback class passed into UDPSocket calls. More...

#include <ncr_udp.h>

Classes

struct  Data
 Container class which stores service invocation related data. More...
 

Public Member Functions

 UDPCallback (RawBufferPtr &buffer, const size_t buf_size, UDPEndpointPtr &data_source, const UDPCompletionHandler &handler)
 Used as the callback object for UDPSocket services. More...
 
RawBufferPtr getBuffer () const
 Returns the data transfer buffer. More...
 
size_t getBufferSize () const
 Returns the data transfer buffer capacity. More...
 
size_t getBytesTransferred () const
 Returns the number of bytes transferred by the completed IO service. More...
 
const uint8_t * getData () const
 Returns a pointer the data transfer buffer content. More...
 
const UDPEndpointPtrgetDataSource ()
 Returns the UDP endpoint that provided the transferred data. More...
 
boost::system::error_code getErrorCode () const
 Returns the completed IO layer service outcome status. More...
 
size_t getPutLen () const
 Returns the number of bytes manually written into the transfer buffer. More...
 
void operator() (const boost::system::error_code error_code, const size_t bytes_transferred)
 Operator that will be invoked by the asiolink layer. More...
 
void putData (const uint8_t *src, size_t len)
 Copies data into the data transfer buffer. More...
 
void setBytesTransferred (const size_t value)
 Sets the number of bytes transferred. More...
 
void setDataSource (UDPEndpointPtr &endpoint)
 Sets the data source to the given endpoint. More...
 
void setErrorCode (const boost::system::error_code value)
 Sets the completed IO layer service outcome status. More...
 

Detailed Description

Implements the callback class passed into UDPSocket calls.

It serves as the link between the asiolink::UDPSocket asynchronous services and the NameChangeRequest layer. The class provides the asiolink layer callback operator(), which is invoked by the asiolink layer upon service completion. It contains all of the data pertinent to both the invocation and completion of a service, as well as a pointer to NameChangeRequest layer completion handler to invoke.

Definition at line 147 of file ncr_udp.h.

Constructor & Destructor Documentation

isc::dhcp_ddns::UDPCallback::UDPCallback ( RawBufferPtr buffer,
const size_t  buf_size,
UDPEndpointPtr data_source,
const UDPCompletionHandler handler 
)

Used as the callback object for UDPSocket services.

Parameters
bufferis a pointer to the data transfer buffer. This is the buffer data will be written to on a read, or read from on a send.
buf_sizeis the capacity of the buffer
data_sourcestorage for UDP endpoint which supplied the data
handleris a method pointer to the completion handler that is to be called by the operator() implementation.
Exceptions
NcrUDPErrorif either the handler or buffer pointers are invalid.

Definition at line 20 of file ncr_udp.cc.

References isc_throw.

Member Function Documentation

RawBufferPtr isc::dhcp_ddns::UDPCallback::getBuffer ( ) const
inline

Returns the data transfer buffer.

Definition at line 255 of file ncr_udp.h.

size_t isc::dhcp_ddns::UDPCallback::getBufferSize ( ) const
inline

Returns the data transfer buffer capacity.

Definition at line 260 of file ncr_udp.h.

size_t isc::dhcp_ddns::UDPCallback::getBytesTransferred ( ) const
inline

Returns the number of bytes transferred by the completed IO service.

For a read it is the number of bytes written into the buffer. For a write it is the number of bytes read from the buffer.

Definition at line 231 of file ncr_udp.h.

Referenced by isc::dhcp_ddns::NameChangeUDPListener::receiveCompletionHandler().

const uint8_t* isc::dhcp_ddns::UDPCallback::getData ( ) const
inline

Returns a pointer the data transfer buffer content.

Definition at line 265 of file ncr_udp.h.

Referenced by isc::dhcp_ddns::NameChangeUDPListener::receiveCompletionHandler().

const UDPEndpointPtr& isc::dhcp_ddns::UDPCallback::getDataSource ( )
inline

Returns the UDP endpoint that provided the transferred data.

Definition at line 298 of file ncr_udp.h.

boost::system::error_code isc::dhcp_ddns::UDPCallback::getErrorCode ( ) const
inline

Returns the completed IO layer service outcome status.

Definition at line 243 of file ncr_udp.h.

Referenced by isc::dhcp_ddns::NameChangeUDPListener::receiveCompletionHandler(), and isc::dhcp_ddns::NameChangeUDPSender::sendCompletionHandler().

size_t isc::dhcp_ddns::UDPCallback::getPutLen ( ) const
inline

Returns the number of bytes manually written into the transfer buffer.

Definition at line 286 of file ncr_udp.h.

void isc::dhcp_ddns::UDPCallback::operator() ( const boost::system::error_code  error_code,
const size_t  bytes_transferred 
)

Operator that will be invoked by the asiolink layer.

Parameters
error_codeis the IO layer result code of the completed IO service.
bytes_transferredis the number of bytes transferred by completed IO. For a read it is the number of bytes written into the buffer. For a write it is the number of bytes read from the buffer.

Definition at line 34 of file ncr_udp.cc.

References setBytesTransferred(), and setErrorCode().

+ Here is the call graph for this function:

void isc::dhcp_ddns::UDPCallback::putData ( const uint8_t *  src,
size_t  len 
)

Copies data into the data transfer buffer.

Copies the given number of bytes from the given source buffer into the data transfer buffer, and updates the value of put length. This method may be used when performing sends to make a copy of the "raw data" that was shipped (or attempted) accessible to the upstream callback.

Parameters
srcis a pointer to the data source from which to copy
lenis the number of bytes to copy
Exceptions
NcrUDPErrorif the number of bytes to copy exceeds the buffer capacity or if the source pointer is invalid.

Definition at line 50 of file ncr_udp.cc.

References isc_throw.

void isc::dhcp_ddns::UDPCallback::setBytesTransferred ( const size_t  value)
inline

Sets the number of bytes transferred.

Parameters
valueis the new value to assign to bytes transferred.

Definition at line 238 of file ncr_udp.h.

Referenced by operator()().

void isc::dhcp_ddns::UDPCallback::setDataSource ( UDPEndpointPtr endpoint)
inline

Sets the data source to the given endpoint.

Parameters
endpointis the new value to assign to data source.

Definition at line 293 of file ncr_udp.h.

void isc::dhcp_ddns::UDPCallback::setErrorCode ( const boost::system::error_code  value)
inline

Sets the completed IO layer service outcome status.

Parameters
valueis the new value to assign to outcome status.

Definition at line 250 of file ncr_udp.h.

Referenced by operator()().


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