Kea 2.7.5
listener.h
Go to the documentation of this file.
1// Copyright (C) 2017-2024 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef HTTP_LISTENER_H
8#define HTTP_LISTENER_H
9
10#include <asiolink/io_address.h>
11#include <asiolink/io_service.h>
12#include <asiolink/crypto_tls.h>
15#include <boost/shared_ptr.hpp>
16#include <cstdint>
17
18namespace isc {
19namespace http {
20
23public:
24 HttpListenerError(const char* file, size_t line, const char* what) :
25 isc::Exception(file, line, what) { }
26};
27
29class HttpListenerImpl;
30
53public:
54
60 explicit RequestTimeout(long value)
61 : value_(value) {
62 }
63 long value_;
64 };
65
67 struct IdleTimeout {
71 explicit IdleTimeout(long value)
72 : value_(value) {
73 }
74 long value_;
75 };
76
99 HttpListener(const asiolink::IOServicePtr& io_service,
100 const asiolink::IOAddress& server_address,
101 const unsigned short server_port,
102 const asiolink::TlsContextPtr& tls_context,
103 const HttpResponseCreatorFactoryPtr& creator_factory,
104 const RequestTimeout& request_timeout,
105 const IdleTimeout& idle_timeout);
106
111
114
116 uint16_t getLocalPort() const;
117
119 int getNative() const;
120
127 void addExternalSockets(bool use_external = false);
128
138 void start();
139
141 void stop();
142
143protected:
144
146 boost::shared_ptr<HttpListenerImpl> impl_;
147};
148
150typedef boost::shared_ptr<HttpListener> HttpListenerPtr;
151
153typedef boost::shared_ptr<const HttpListener> ConstHttpListenerPtr;
154
155} // end of namespace isc::http
156} // end of namespace isc
157
158#endif
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 HttpListener class.
Definition listener.h:22
HttpListenerError(const char *file, size_t line, const char *what)
Definition listener.h:24
HTTP listener.
Definition listener.h:52
HttpListener(const asiolink::IOServicePtr &io_service, const asiolink::IOAddress &server_address, const unsigned short server_port, const asiolink::TlsContextPtr &tls_context, const HttpResponseCreatorFactoryPtr &creator_factory, const RequestTimeout &request_timeout, const IdleTimeout &idle_timeout)
Constructor.
Definition listener.cc:18
uint16_t getLocalPort() const
Returns local port on which server is listening.
Definition listener.cc:41
asiolink::IOAddress getLocalAddress() const
Returns local address on which server is listening.
Definition listener.cc:36
void addExternalSockets(bool use_external=false)
Use external sockets flag.
Definition listener.cc:51
~HttpListener()
Destructor.
Definition listener.cc:31
void stop()
Stops all active connections and shuts down the service.
Definition listener.cc:61
void start()
Starts accepting new connections.
Definition listener.cc:56
int getNative() const
file descriptor of the underlying acceptor socket.
Definition listener.cc:46
boost::shared_ptr< HttpListenerImpl > impl_
Pointer to the implementation of the HttpListener.
Definition listener.h:146
TLS API.
boost::shared_ptr< const HttpListener > ConstHttpListenerPtr
Pointer to the const HttpListener.
Definition listener.h:153
boost::shared_ptr< HttpListener > HttpListenerPtr
Pointer to the HttpListener.
Definition listener.h:150
boost::shared_ptr< HttpResponseCreatorFactory > HttpResponseCreatorFactoryPtr
Pointer to the HttpResponseCreatorFactory.
Defines the logger used by the top-level component of kea-lfc.
Idle connection timeout.
Definition listener.h:67
long value_
Connection idle timeout value specified.
Definition listener.h:74
IdleTimeout(long value)
Constructor.
Definition listener.h:71
HTTP request timeout value.
Definition listener.h:56
RequestTimeout(long value)
Constructor.
Definition listener.h:60
long value_
Request timeout value specified.
Definition listener.h:63