Kea: isc::dhcp_ddns::UDPCallback Class Reference

| Kea 3.0.2-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.
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.

## 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 146 of file ncr_udp.h.

## Constructor & Destructor Documentation

## ◆ UDPCallback()

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

  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.

Exceptions

  NcrUDPError | if either the handler or buffer pointers are invalid.

Definition at line 21 of file ncr_udp.cc.

References isc_throw.

## Member Function Documentation

## ◆ getBuffer()

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

Returns the data transfer buffer.

Definition at line 253 of file ncr_udp.h.

## ◆ getBufferSize()

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

Returns the data transfer buffer capacity.

Definition at line 258 of file ncr_udp.h.

## ◆ getBytesTransferred()

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 229 of file ncr_udp.h.

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

## ◆ getData()

const uint8_t * isc::dhcp_ddns::UDPCallback::getData | ( |  | ) | const
| 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().

## ◆ getDataSource()

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

Returns the UDP endpoint that provided the transferred data.

Definition at line 296 of file ncr_udp.h.

## ◆ getErrorCode()

boost::system::error_code isc::dhcp_ddns::UDPCallback::getErrorCode | ( |  | ) | const
| 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().

## ◆ getPutLen()

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

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

Definition at line 284 of file ncr_udp.h.

## ◆ operator()()

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_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().

Here is the call graph for this function:

## ◆ putData()

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

  src | is a pointer to the data source from which to copy
  len | is the number of bytes to copy

Exceptions

  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.

## ◆ setBytesTransferred()

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

Sets the number of bytes transferred.

Parameters

  value | is the new value to assign to bytes transferred.

Definition at line 236 of file ncr_udp.h.

Referenced by operator()().

## ◆ setDataSource()

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

Sets the data source to the given endpoint.

Parameters

  endpoint | is the new value to assign to data source.

Definition at line 291 of file ncr_udp.h.

## ◆ setErrorCode()

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

Sets the completed IO layer service outcome status.

Parameters

  value | is the new value to assign to outcome status.

Definition at line 248 of file ncr_udp.h.

Referenced by operator()().

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

- ncr_udp.h
- ncr_udp.cc