16#include <boost/shared_ptr.hpp>
100 typedef std::function<void(
const boost::system::error_code&,
114 typedef std::function<bool(
const boost::system::error_code&,
const int)>
ConnectHandler;
149 bool multi_threading_enabled,
150 size_t thread_pool_size = 0,
151 bool defer_thread_start =
false);
335 boost::shared_ptr<HttpClientImpl> impl_;
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.
A generic error raised by the HttpClient class.
HttpClientError(const char *file, size_t line, const char *what)
uint16_t getThreadCount() const
Fetches the number of threads in the pool.
bool isRunning()
Indicates if the thread pool is running.
HttpClient(const asiolink::IOServicePtr &io_service, bool multi_threading_enabled, size_t thread_pool_size=0, bool defer_thread_start=false)
Constructor.
void stop()
Halts client-side IO activity.
bool isPaused()
Indicates if the thread pool is paused.
std::function< bool(const boost::system::error_code &, const int) ConnectHandler)
Optional handler invoked when client connects to the server.
void pause()
Pauses the client's thread pool.
std::function< void(const int)> CloseHandler
Optional handler invoked when client closes the connection to the server.
const asiolink::IOServicePtr getThreadIOService() const
Fetches a pointer to the internal IOService used to drive the thread-pool in multi-threaded mode.
void start()
Starts running the client's thread pool, if multi-threaded.
std::function< bool(const boost::system::error_code &, const int) HandshakeHandler)
Optional handler invoked when client performs the TLS handshake with the server.
std::function< void(const boost::system::error_code &, const HttpResponsePtr &, const std::string &) RequestHandler)
Callback type used in call to HttpClient::asyncSendRequest.
uint16_t getThreadPoolSize() const
Fetches the maximum size of the thread pool.
void closeIfOutOfBand(int socket_fd)
Closes a connection if it has an out-of-band socket event.
void resume()
Resumes running the client's 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.
bool isStopped()
Indicates if the thread pool is stopped.
void checkPermissions()
Check if the current thread can perform thread pool state transition.
boost::shared_ptr< TlsContext > TlsContextPtr
The type of shared pointers to TlsContext objects.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
boost::shared_ptr< HttpClient > HttpClientPtr
Defines a pointer to an HttpClient instance.
boost::shared_ptr< HttpResponse > HttpResponsePtr
Pointer to the HttpResponse object.
boost::shared_ptr< HttpRequest > HttpRequestPtr
Pointer to the HttpRequest object.
Defines the logger used by the top-level component of kea-lfc.
HTTP request/response timeout value.
RequestTimeout(long value)
Constructor.
long value_
Timeout value specified.