Kea 1.5.0
listener.h
Go to the documentation of this file.
1// Copyright (C) 2017 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>
14#include <boost/shared_ptr.hpp>
15#include <stdint.h>
16
17namespace isc {
18namespace http {
19
22public:
23 HttpListenerError(const char* file, size_t line, const char* what) :
24 isc::Exception(file, line, what) { };
25};
26
28class HttpListenerImpl;
29
52public:
53
59 explicit RequestTimeout(long value)
60 : value_(value) {
61 }
62 long value_;
63 };
64
66 struct IdleTimeout {
70 explicit IdleTimeout(long value)
71 : value_(value) {
72 }
73 long value_;
74 };
75
98 const asiolink::IOAddress& server_address,
99 const unsigned short server_port,
100 const HttpResponseCreatorFactoryPtr& creator_factory,
101 const RequestTimeout& request_timeout,
102 const IdleTimeout& idle_timeout);
103
108
111
113 uint16_t getLocalPort() const;
114
124 void start();
125
127 void stop();
128
129private:
130
132 boost::shared_ptr<HttpListenerImpl> impl_;
133
134};
135
137typedef boost::shared_ptr<HttpListener> HttpListenerPtr;
138
140typedef boost::shared_ptr<const HttpListener> ConstHttpListenerPtr;
141
142} // end of namespace isc::http
143} // end of namespace isc
144
145#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:21
HttpListenerError(const char *file, size_t line, const char *what)
Definition: listener.h:23
HTTP listener.
Definition: listener.h:51
uint16_t getLocalPort() const
Returns local port on which server is listening.
Definition: listener.cc:222
asiolink::IOAddress getLocalAddress() const
Returns local address on which server is listening.
Definition: listener.cc:217
~HttpListener()
Destructor.
Definition: listener.cc:212
void stop()
Stops all active connections and shuts down the service.
Definition: listener.cc:232
void start()
Starts accepting new connections.
Definition: listener.cc:227
boost::shared_ptr< const HttpListener > ConstHttpListenerPtr
Pointer to the const HttpListener.
Definition: listener.h:140
boost::shared_ptr< HttpListener > HttpListenerPtr
Pointer to the HttpListener.
Definition: listener.h:137
boost::shared_ptr< HttpResponseCreatorFactory > HttpResponseCreatorFactoryPtr
Pointer to the HttpResponseCreatorFactory.
Defines the logger used by the top-level component of kea-dhcp-ddns.
Idle connection timeout.
Definition: listener.h:66
long value_
Connection idle timeout value specified.
Definition: listener.h:73
IdleTimeout(long value)
Constructor.
Definition: listener.h:70
HTTP request timeout value.
Definition: listener.h:55
RequestTimeout(long value)
Constructor.
Definition: listener.h:59
long value_
Request timeout value specified.
Definition: listener.h:62