7#ifndef NCR_UDP_LISTENER_H 
    8#define NCR_UDP_LISTENER_H 
  111#include <boost/shared_array.hpp> 
  112#include <boost/enable_shared_from_this.hpp> 
  220    void operator ()(
const boost::system::error_code error_code,
 
  221                     const size_t bytes_transferred);
 
  230        return (data_->bytes_transferred_);
 
 
  237        data_->bytes_transferred_ = value;
 
 
  242        return (data_->error_code_);
 
 
  249        data_->error_code_  = value;
 
 
  254        return (data_->buffer_);
 
 
  259        return (data_->buf_size_);
 
 
  264        return (data_->buffer_.get());
 
 
  280    void putData(
const uint8_t* src, 
size_t len);
 
  285        return (data_->put_len_);
 
 
  292        data_->data_source_ = endpoint;
 
 
  297        return (data_->data_source_);
 
 
  305    boost::shared_ptr<Data> data_;
 
 
  338                          const bool reuse_address = 
false);
 
  360    virtual void close();
 
  413    boost::shared_ptr<boost::asio::ip::udp::socket> asio_socket_;
 
  416    boost::shared_ptr<NameChangeUDPSocket> socket_;
 
  419    boost::shared_ptr<UDPCallback> recv_callback_;
 
 
  468        const bool reuse_address = 
false);
 
  490    virtual void close();
 
  548    void closeWatchSocket();
 
  560    uint32_t server_port_;
 
  566    boost::shared_ptr<boost::asio::ip::udp::socket> asio_socket_;
 
  569    boost::shared_ptr<NameChangeUDPSocket> socket_;
 
  572    boost::shared_ptr<isc::asiolink::UDPEndpoint> server_endpoint_;
 
  575    boost::shared_ptr<UDPCallback> send_callback_;
 
 
This is a base class for exceptions thrown from the DNS library module.
Exception(const char *file, size_t line, const char *what)
Constructor for a given type for exceptions with file name and file line number.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
The IOAddress class represents an IP addresses (version agnostic)
The UDPSocket class is a concrete derived class of IOAsioSocket that represents a UDP socket.
boost::shared_ptr< RequestReceiveHandler > RequestReceiveHandlerPtr
Defines a smart pointer to an instance of a request receive handler.
NameChangeListener(RequestReceiveHandlerPtr recv_handler)
Constructor.
NameChangeSender(RequestSendHandlerPtr send_handler, size_t send_queue_max=MAX_QUEUE_DEFAULT)
Constructor.
boost::shared_ptr< RequestSendHandler > RequestSendHandlerPtr
Defines a smart pointer to an instance of a request send handler.
static const size_t MAX_QUEUE_DEFAULT
Defines a default maximum number of entries in the send queue.
NameChangeUDPListener(const isc::asiolink::IOAddress &ip_address, const uint32_t port, const NameChangeFormat format, RequestReceiveHandlerPtr ncr_recv_handler, const bool reuse_address=false)
Constructor.
virtual void close()
Closes the UDPSocket.
virtual void open(const isc::asiolink::IOServicePtr &io_service)
Opens a UDP socket using the given IOService.
virtual ~NameChangeUDPListener()
Destructor.
static const size_t RECV_BUF_MAX
Defines the maximum size packet that can be received.
void receiveCompletionHandler(const bool successful, const UDPCallback *recv_callback)
Implements the NameChangeRequest level receive completion handler.
void doReceive()
Initiates an asynchronous read on the socket.
void sendCompletionHandler(const bool successful, const UDPCallback *send_callback)
Implements the NameChangeRequest level send completion handler.
virtual bool ioReady()
Returns whether or not the sender has IO ready to process.
static const size_t SEND_BUF_MAX
Defines the maximum size packet that can be sent.
virtual void open(const isc::asiolink::IOServicePtr &io_service)
Opens a UDP socket using the given IOService.
virtual int getSelectFd()
Returns a file descriptor suitable for use with select.
virtual void close()
Closes the UDPSocket.
virtual void doSend(NameChangeRequestPtr &ncr)
Sends a given request asynchronously over the socket.
NameChangeUDPSender(const isc::asiolink::IOAddress &ip_address, const uint32_t port, const isc::asiolink::IOAddress &server_address, const uint32_t server_port, const NameChangeFormat format, RequestSendHandlerPtr ncr_send_handler, const size_t send_que_max=NameChangeSender::MAX_QUEUE_DEFAULT, const bool reuse_address=false)
Constructor.
virtual ~NameChangeUDPSender()
Destructor.
NcrUDPError(const char *file, size_t line, const char *what)
Implements the callback class passed into UDPSocket calls.
size_t getBytesTransferred() const
Returns the number of bytes transferred by the completed IO service.
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.
size_t getBufferSize() const
Returns the data transfer buffer capacity.
RawBufferPtr getBuffer() const
Returns the data transfer buffer.
const uint8_t * getData() const
Returns a pointer the data transfer buffer content.
void putData(const uint8_t *src, size_t len)
Copies data into the data transfer buffer.
UDPCallback(RawBufferPtr &buffer, const size_t buf_size, UDPEndpointPtr &data_source, const UDPCompletionHandler &handler)
Used as the callback object for UDPSocket services.
void setBytesTransferred(const size_t value)
Sets the number of bytes transferred.
const UDPEndpointPtr & getDataSource()
Returns the UDP endpoint that provided the transferred data.
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.
boost::system::error_code getErrorCode() const
Returns the completed IO layer service outcome status.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
NameChangeFormat
Defines the list of data wire formats supported.
std::function< void(const bool, const UDPCallback *)> UDPCompletionHandler
Defines a function pointer for NameChangeRequest completion handlers.
isc::asiolink::UDPSocket< UDPCallback > NameChangeUDPSocket
Convenience type for UDP socket based listener.
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
boost::shared_array< uint8_t > RawBufferPtr
Defines a dynamically allocated shared array.
boost::shared_ptr< asiolink::UDPEndpoint > UDPEndpointPtr
boost::shared_ptr< WatchSocket > WatchSocketPtr
Defines a smart pointer to an instance of a WatchSocket.
Defines the logger used by the top-level component of kea-lfc.
This file defines abstract classes for exchanging NameChangeRequests.
boost::system::error_code error_code_
Stores the IO layer result code of the completed IO service.
size_t put_len_
Stores this size of the data within the buffer when written there manually.
RawBufferPtr buffer_
A pointer to the data transfer buffer.
size_t buf_size_
Storage capacity of the buffer.
Data(RawBufferPtr &buffer, const size_t buf_size, UDPEndpointPtr &data_source)
Constructor.
UDPEndpointPtr data_source_
The UDP endpoint that is the origin of the data transferred.
size_t bytes_transferred_
Stores the number of bytes transferred by completed IO service.
Defines the class, WatchSocket.