diff options
author | Mauro Sardara <msardara+fdio@cisco.com> | 2018-02-16 17:53:36 +0100 |
---|---|---|
committer | Mauro Sardara <msardara+fdio@cisco.com> | 2018-02-16 18:18:16 +0100 |
commit | a81921f0fd4296f8def24665174062782b3480be (patch) | |
tree | d645459d7fb1fa1b76159cc548af71cce85dd343 /http-server/http_server.h | |
parent | 0475d783825a6f649853da581df5d812cf5f3bae (diff) |
Added reverse proxy (TCP --> ICN) functionality
Change-Id: I2305aa11aea4a37d3d63c6399c49389f78dfd91c
Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
Diffstat (limited to 'http-server/http_server.h')
-rw-r--r-- | http-server/http_server.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/http-server/http_server.h b/http-server/http_server.h index 704863d5..630f26b6 100644 --- a/http-server/http_server.h +++ b/http-server/http_server.h @@ -22,8 +22,7 @@ * SOFTWARE. */ -#ifndef ICN_WEB_SERVER_WEB_SERVER_H_ -#define ICN_WEB_SERVER_WEB_SERVER_H_ +#pragma once #include "common.h" #include "icn_request.h" @@ -49,6 +48,7 @@ namespace icn_httpserver { class HttpServer { public: + explicit HttpServer(unsigned short port, std::string icn_name, size_t num_threads, @@ -71,10 +71,11 @@ class HttpServer { void send(std::shared_ptr<Response> response, SendCallback callback = nullptr) const; std::unordered_map<std::string, std::unordered_map<std::string, ResourceCallback> > resource; + std::unordered_map<std::string, ResourceCallback> default_resource; + void onIcnRequest(std::shared_ptr<libl4::http::HTTPServerPublisher>& publisher, const uint8_t* buffer, std::size_t size, int request_id); private: - void onIcnRequest(std::shared_ptr<libl4::http::HTTPServerPublisher>& publisher, const uint8_t* buffer, std::size_t size); void spawnThreads(); @@ -100,11 +101,8 @@ class HttpServer { boost::asio::io_service &io_service_; boost::asio::ip::tcp::acceptor acceptor_; std::vector<std::thread> socket_threads_; - - // ICN parameters std::string icn_name_; std::shared_ptr<libl4::http::HTTPServerAcceptor> icn_acceptor_; - std::unordered_map<int, std::shared_ptr<libl4::http::HTTPServerPublisher>> icn_publishers_; std::mutex thread_list_mtx_; long timeout_request_; @@ -113,5 +111,3 @@ class HttpServer { }; } // end namespace icn_httpserver - -#endif //ICN_WEB_SERVER_WEB_SERVER_H_ |