summaryrefslogtreecommitdiffstats
path: root/apps/http-proxy/src/http_proxy.h
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2020-05-27 19:16:27 +0200
committerMauro Sardara <msardara@cisco.com>2020-05-29 20:25:19 +0200
commitf54ae4ed4fd2f22525492e2525d0f24a314e65b2 (patch)
treefa0ac2ced671ccffd24a885e930834b8e2ecba48 /apps/http-proxy/src/http_proxy.h
parent4214534b001c27f1923bbb2a8e69fd7372ba5947 (diff)
[HICH-618] HTTP proxy automatic configuration.
Change-Id: I6a76b31b743f155a2d9f7b88e84b838265aab6c8 Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'apps/http-proxy/src/http_proxy.h')
-rw-r--r--apps/http-proxy/src/http_proxy.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/apps/http-proxy/src/http_proxy.h b/apps/http-proxy/src/http_proxy.h
index 6fa394e28..aa47d6a92 100644
--- a/apps/http-proxy/src/http_proxy.h
+++ b/apps/http-proxy/src/http_proxy.h
@@ -18,6 +18,7 @@
#include <hicn/transport/interfaces/socket_consumer.h>
#include <hicn/transport/utils/event_thread.h>
+#include "forwarder_config.h"
#include "http_session.h"
#include "icn_receiver.h"
@@ -37,11 +38,10 @@ class TcpListener {
socket_(io_service),
#endif
callback_(callback) {
- do_accept();
}
- private:
- void do_accept() {
+ public:
+ void doAccept() {
#if ((ASIO_VERSION / 100 % 1000) >= 12)
acceptor_.async_accept(
[this](std::error_code ec, asio::ip::tcp::socket socket) {
@@ -53,7 +53,7 @@ class TcpListener {
callback_(std::move(socket));
}
- do_accept();
+ doAccept();
});
}
@@ -87,11 +87,18 @@ class TcpReceiver : public Receiver {
void onNewConnection(asio::ip::tcp::socket&& socket);
void onClientDisconnect(HTTPClientConnectionCallback* client);
+ template <typename Callback>
+ void parseHicnHeader(std::string& hicn_header, Callback&& callback) {
+ forwarder_config_.parseHicnHeader(hicn_header,
+ std::forward<Callback>(callback));
+ }
+
TcpListener listener_;
std::string prefix_;
std::string ipv6_first_word_;
std::deque<HTTPClientConnectionCallback*> http_clients_;
std::unordered_set<HTTPClientConnectionCallback*> used_http_clients_;
+ ForwarderConfig forwarder_config_;
};
class IcnReceiver : public Receiver {