Kea 2.7.6
|
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. | |
RawBufferPtr | getBuffer () const |
Returns the data transfer buffer. | |
size_t | getBufferSize () const |
Returns the data transfer buffer capacity. | |
size_t | getBytesTransferred () const |
Returns the number of bytes transferred by the completed IO service. | |
const uint8_t * | getData () const |
Returns a pointer the data transfer buffer content. | |
const UDPEndpointPtr & | getDataSource () |
Returns the UDP endpoint that provided the transferred data. | |
boost::system::error_code | getErrorCode () const |
Returns the completed IO layer service outcome status. | |
size_t | getPutLen () const |
Returns the number of bytes manually written into the transfer buffer. | |
void | operator() (const boost::system::error_code error_code, const size_t bytes_transferred) |
Operator that will be invoked by the asiolink layer. | |
void | putData (const uint8_t *src, size_t len) |
Copies data into the data transfer buffer. | |
void | setBytesTransferred (const size_t value) |
Sets the number of bytes transferred. | |
void | setDataSource (UDPEndpointPtr &endpoint) |
Sets the data source to the given endpoint. | |
void | setErrorCode (const boost::system::error_code value) |
Sets the completed IO layer service outcome status. | |
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 21 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 229 of file ncr_udp.h.
Referenced by isc::dhcp_ddns::NameChangeUDPListener::receiveCompletionHandler().
|
inline |
Returns a pointer the data transfer buffer content.
Definition at line 263 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 241 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 35 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 51 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 236 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 248 of file ncr_udp.h.
Referenced by operator()().