55#include <boost/scoped_ptr.hpp>
56#include <boost/enable_shared_from_this.hpp>
332 return (io_pending_);
342 void setListening(
bool value) {
621 void skipNextInternal();
627 size_t getQueueSizeInternal()
const;
754 return (send_queue_max_);
812 return (send_queue_);
823 void setSending(
bool value) {
844 size_t send_queue_max_;
853 const boost::scoped_ptr<std::mutex> mutex_;
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Abstract class for defining application layer receive callbacks.
virtual ~RequestReceiveHandler()
virtual void operator()(const Result result, NameChangeRequestPtr &ncr)=0
Function operator implementing a NCR receive callback.
Abstract interface for receiving NameChangeRequests.
virtual void open(const isc::asiolink::IOServicePtr &io_service)=0
Abstract method which opens the IO source for reception.
boost::shared_ptr< RequestReceiveHandler > RequestReceiveHandlerPtr
Defines a smart pointer to an instance of a request receive handler.
void stopListening()
Closes the IO source and stops listen logic.
virtual void close()=0
Abstract method which closes the IO source.
bool isIoPending() const
Returns true if the listener has an IO call in progress.
NameChangeListener(RequestReceiveHandlerPtr recv_handler)
Constructor.
virtual void doReceive()=0
Initiates an IO layer asynchronous read.
void invokeRecvHandler(const Result result, NameChangeRequestPtr &ncr)
Calls the NCR receive handler registered with the listener.
virtual ~NameChangeListener()
Destructor.
bool amListening() const
Returns true if the listener is listening, false otherwise.
Result
Defines the outcome of an asynchronous NCR receive.
void receiveNext()
Initiates an asynchronous receive.
void startListening(const isc::asiolink::IOServicePtr &io_service)
Prepares the IO for reception and initiates the first receive.
Abstract class for defining application layer send callbacks.
virtual ~RequestSendHandler()
virtual void operator()(const Result result, NameChangeRequestPtr &ncr)=0
Function operator implementing a NCR send callback.
Abstract interface for sending NameChangeRequests.
asiolink::IOServicePtr io_service_
Pointer to the IOService currently being used by the sender.
void stopSending()
Closes the IO sink and stops send logic.
virtual int getSelectFd()=0
Returns a file descriptor suitable for use with select.
void startSending(const isc::asiolink::IOServicePtr &io_service)
Prepares the IO for transmission.
NameChangeSender(RequestSendHandlerPtr send_handler, size_t send_queue_max=MAX_QUEUE_DEFAULT)
Constructor.
void assumeQueue(NameChangeSender &source_sender)
Move all queued requests from a given sender into the send queue.
size_t getQueueMaxSize() const
Returns the maximum number of entries allowed in the send queue.
size_t getQueueSize() const
Returns the number of entries currently in the send queue.
const NameChangeRequestPtr & peekAt(const size_t index) const
Returns the entry at a given position in the queue.
virtual bool ioReady()=0
Returns whether or not the sender has IO ready to process.
void skipNext()
Removes the request at the front of the send queue.
std::deque< NameChangeRequestPtr > SendQueue
Defines the type used for the request send queue.
boost::shared_ptr< RequestSendHandler > RequestSendHandlerPtr
Defines a smart pointer to an instance of a request send handler.
void clearSendQueue()
Flushes all entries in the send queue.
bool amSending() const
Returns true if the sender is in send mode, false otherwise.
virtual void doSend(NameChangeRequestPtr &ncr)=0
Initiates an IO layer asynchronous send.
void setQueueMaxSize(const size_t new_max)
Sets the maximum queue size to the given value.
static const size_t MAX_QUEUE_DEFAULT
Defines a default maximum number of entries in the send queue.
virtual ~NameChangeSender()
Destructor.
void invokeSendHandler(const NameChangeSender::Result result)
Calls the NCR send completion handler registered with the sender.
virtual void open(const isc::asiolink::IOServicePtr &io_service)=0
Abstract method which opens the IO sink for transmission.
virtual void close()=0
Abstract method which closes the IO sink.
void sendRequest(NameChangeRequestPtr &ncr)
Queues the given request to be sent.
virtual void runReadyIO()
Processes sender IO events.
SendQueue & getSendQueue()
Returns a reference to the send queue.
bool isSendInProgress() const
Returns true when a send is in progress.
Result
Defines the outcome of an asynchronous NCR send.
void sendNext()
Dequeues and sends the next request on the send queue in a thread safe context.
Exception thrown if an NcrListenerError encounters a general error.
NcrListenerError(const char *file, size_t line, const char *what)
Exception thrown if an error occurs during IO source open.
NcrListenerOpenError(const char *file, size_t line, const char *what)
Exception thrown if an error occurs initiating an IO receive.
NcrListenerReceiveError(const char *file, size_t line, const char *what)
Thrown when a NameChangeSender encounters an error.
NcrSenderError(const char *file, size_t line, const char *what)
Exception thrown if an error occurs during IO source open.
NcrSenderOpenError(const char *file, size_t line, const char *what)
Exception thrown if an error occurs initiating an IO send.
NcrSenderQueueFull(const char *file, size_t line, const char *what)
Exception thrown if an error occurs initiating an IO send.
NcrSenderSendError(const char *file, size_t line, const char *what)
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
NameChangeProtocol stringToNcrProtocol(const std::string &protocol_str)
Function which converts text labels to NameChangeProtocol enums.
boost::shared_ptr< NameChangeListener > NameChangeListenerPtr
Defines a smart pointer to an instance of a listener.
NameChangeProtocol
Defines the list of socket protocols supported.
std::string ncrProtocolToString(NameChangeProtocol protocol)
Function which converts NameChangeProtocol enums to text labels.
boost::shared_ptr< NameChangeSender > NameChangeSenderPtr
Defines a smart pointer to an instance of a sender.
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
Defines the logger used by the top-level component of kea-lfc.
This file provides the classes needed to embody, compose, and decompose DNS update requests that are ...