diff options
author | Francis Dupont <fdupont@isc.org> | 2024-11-29 10:36:54 +0100 |
---|---|---|
committer | Francis Dupont <fdupont@isc.org> | 2024-12-03 15:13:35 +0100 |
commit | 8b544582b9a1307b26a91dc2381b27f288c66b91 (patch) | |
tree | 22a32dd30d480b087ed4e82469abd6b64bc909b5 /src | |
parent | [#3255] Added a note (diff) | |
download | kea-8b544582b9a1307b26a91dc2381b27f288c66b91.tar.xz kea-8b544582b9a1307b26a91dc2381b27f288c66b91.zip |
[#3255] Added a getTlsContext to HTTP listener
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/http/listener.cc | 5 | ||||
-rw-r--r-- | src/lib/http/listener.h | 3 | ||||
-rw-r--r-- | src/lib/http/listener_impl.cc | 5 | ||||
-rw-r--r-- | src/lib/http/listener_impl.h | 3 | ||||
-rw-r--r-- | src/lib/http/tests/http_server_test.h | 1 |
5 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/http/listener.cc b/src/lib/http/listener.cc index 18f81f529c..9c05e99689 100644 --- a/src/lib/http/listener.cc +++ b/src/lib/http/listener.cc @@ -42,6 +42,11 @@ HttpListener::getLocalPort() const { return (impl_->getEndpoint().getPort()); } +const TlsContextPtr& +HttpListener::getTlsContext() const { + return (impl_->getTlsContext()); +} + int HttpListener::getNative() const { return (impl_->getNative()); diff --git a/src/lib/http/listener.h b/src/lib/http/listener.h index b842d7f18d..9f35e62642 100644 --- a/src/lib/http/listener.h +++ b/src/lib/http/listener.h @@ -115,6 +115,9 @@ public: /// @brief Returns local port on which server is listening. uint16_t getLocalPort() const; + /// @brief Returns reference to the current TLS context. + const asiolink::TlsContextPtr& getTlsContext() const; + /// @brief file descriptor of the underlying acceptor socket. int getNative() const; diff --git a/src/lib/http/listener_impl.cc b/src/lib/http/listener_impl.cc index 70535ef7e5..85fd74ee3d 100644 --- a/src/lib/http/listener_impl.cc +++ b/src/lib/http/listener_impl.cc @@ -70,6 +70,11 @@ HttpListenerImpl::getEndpoint() const { return (*endpoint_); } +const TlsContextPtr& +HttpListenerImpl::getTlsContext() const { + return (tls_context_); +} + int HttpListenerImpl::getNative() const { return (acceptor_ ? acceptor_->getNative() : -1); diff --git a/src/lib/http/listener_impl.h b/src/lib/http/listener_impl.h index 73f70dc507..f36a1330b8 100644 --- a/src/lib/http/listener_impl.h +++ b/src/lib/http/listener_impl.h @@ -60,6 +60,9 @@ public: /// @brief Returns reference to the current listener endpoint. const asiolink::TCPEndpoint& getEndpoint() const; + /// @brief Returns reference to the current TLS context. + const asiolink::TlsContextPtr& getTlsContext() const; + /// @brief file descriptor of the underlying acceptor socket. int getNative() const; diff --git a/src/lib/http/tests/http_server_test.h b/src/lib/http/tests/http_server_test.h index 48c0671400..bd59d61ce3 100644 --- a/src/lib/http/tests/http_server_test.h +++ b/src/lib/http/tests/http_server_test.h @@ -392,6 +392,7 @@ public: ASSERT_NO_THROW(listener.start()); ASSERT_EQ(SERVER_ADDRESS, listener.getLocalAddress().toText()); ASSERT_EQ(SERVER_PORT, listener.getLocalPort()); + ASSERT_EQ(server_context_, listener.getTlsContext()); ASSERT_NO_THROW(startRequest(request)); ASSERT_NO_THROW(runIOService()); ASSERT_EQ(1, clients_.size()); |