Kea 2.5.9
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
127 void start();
128
130 void stop();
131
132protected:
133
135 boost::shared_ptr<HttpListenerImpl> impl_;
136};
137
139typedef boost::shared_ptr<HttpListener> HttpListenerPtr;
140
142typedef boost::shared_ptr<const HttpListener> ConstHttpListenerPtr;
143
144} // end of namespace isc::http
145} // end of namespace isc
146
147#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
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
~HttpListener()
Destructor.
Definition: listener.cc:31
void stop()
Stops all active connections and shuts down the service.
Definition: listener.cc:51
void start()
Starts accepting new connections.
Definition: listener.cc:46
boost::shared_ptr< HttpListenerImpl > impl_
Pointer to the implementation of the HttpListener.
Definition: listener.h:135
TLS API.
boost::shared_ptr< const HttpListener > ConstHttpListenerPtr
Pointer to the const HttpListener.
Definition: listener.h:142
boost::shared_ptr< HttpListener > HttpListenerPtr
Pointer to the HttpListener.
Definition: listener.h:139
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