17 #include <boost/shared_ptr.hpp>
101 typedef std::function<void(
const boost::system::error_code&,
115 typedef std::function<bool(const boost::system::error_code&, const int)>
ConnectHandler;
149 bool defer_thread_start =
false);
242 const RequestHandler& request_callback,
245 const ConnectHandler& connect_callback =
247 const HandshakeHandler& handshake_callback =
249 const CloseHandler& close_callback =
326 boost::shared_ptr<HttpClientImpl> impl_;
void stop()
Halts client-side IO activity.
HttpClientError(const char *file, size_t line, const char *what)
std::function< bool(const boost::system::error_code &, const int)> ConnectHandler
Optional handler invoked when client connects to the server.
uint16_t getThreadPoolSize() const
Fetches the maximum size of the thread pool.
void asyncSendRequest(const Url &url, const asiolink::TlsContextPtr &tls_context, const HttpRequestPtr &request, const HttpResponsePtr &response, const RequestHandler &request_callback, const RequestTimeout &request_timeout=RequestTimeout(10000), const ConnectHandler &connect_callback=ConnectHandler(), const HandshakeHandler &handshake_callback=HandshakeHandler(), const CloseHandler &close_callback=CloseHandler())
Queues new asynchronous HTTP request for a given URL.
long value_
Timeout value specified.
const asiolink::IOServicePtr getThreadIOService() const
Fetches a pointer to the internal IOService used to drive the thread-pool in multi-threaded mode...
std::function< void(const boost::system::error_code &, const HttpResponsePtr &, const std::string &)> RequestHandler
Callback type used in call to HttpClient::asyncSendRequest.
HttpClient(asiolink::IOService &io_service, size_t thread_pool_size=0, bool defer_thread_start=false)
Constructor.
HTTP request/response timeout value.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
RequestTimeout(long value)
Constructor.
std::function< void(const int)> CloseHandler
Optional handler invoked when client closes the connection to the server.
bool isStopped()
Indicates if the thread pool is stopped.
The IOService class is a wrapper for the ASIO io_service class.
boost::shared_ptr< TlsContext > TlsContextPtr
The type of shared pointers to TlsContext objects.
void resume()
Resumes running the client's thread pool.
boost::shared_ptr< HttpResponse > HttpResponsePtr
Pointer to the HttpResponse object.
void start()
Starts running the client's thread pool, if multi-threaded.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-dhcp-ddns.
std::function< bool(const boost::system::error_code &, const int)> HandshakeHandler
Optional handler invoked when client performs the TLS handshake with the server.
void pause()
Pauses the client's thread pool.
bool isPaused()
Indicates if the thread pool is paused.
bool isRunning()
Indicates if the thread pool is running.
boost::shared_ptr< HttpRequest > HttpRequestPtr
Pointer to the HttpRequest object.
uint16_t getThreadCount() const
Fetches the number of threads in the pool.
void closeIfOutOfBand(int socket_fd)
Closes a connection if it has an out-of-band socket event.
A generic error raised by the HttpClient class.
boost::shared_ptr< HttpClient > HttpClientPtr
Defines a pointer to an HttpClient instance.