Kea
1.9.9-git
|
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 UDPEndpointPtr & | getDataSource () |
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... | |
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.
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.
buffer | is 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_size | is the capacity of the buffer |
data_source | storage for UDP endpoint which supplied the data |
handler | is a method pointer to the completion handler that is to be called by the operator() implementation. |
NcrUDPError | if either the handler or buffer pointers are invalid. |
Definition at line 20 of file ncr_udp.cc.
References isc_throw.
|
inline |
|
inline |
|
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().
|
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().
|
inline |
|
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().
|
inline |
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.
error_code | is the IO layer result code of the completed IO service. |
bytes_transferred | is 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().
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.
src | is a pointer to the data source from which to copy |
len | is the number of bytes to copy |
NcrUDPError | if 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.
|
inline |
Sets the number of bytes transferred.
value | is the new value to assign to bytes transferred. |
Definition at line 238 of file ncr_udp.h.
Referenced by operator()().
|
inline |
|
inline |
Sets the completed IO layer service outcome status.
value | is the new value to assign to outcome status. |
Definition at line 250 of file ncr_udp.h.
Referenced by operator()().