From b6ea100d3fb9f64ca9fd88606c77ba1d715224ea Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 26 Oct 2011 12:44:16 +0200 Subject: [PATCH] Slim down the Origin class --- include/metaproxy/origin.hpp | 26 ++------------------------ src/origin.cpp | 26 +------------------------- src/sru_util.cpp | 4 ++-- 3 files changed, 5 insertions(+), 51 deletions(-) diff --git a/include/metaproxy/origin.hpp b/include/metaproxy/origin.hpp index 44eefcf..603f378 100644 --- a/include/metaproxy/origin.hpp +++ b/include/metaproxy/origin.hpp @@ -34,20 +34,8 @@ namespace metaproxy_1 { class Origin { public: - Origin(std::string listen_host = "", unsigned int listen_port = 0); + Origin(); - /// get function - right val in assignment - std::string listen_host() const; - - /// set function - left val in assignment - std::string & listen_host(); - - /// get function - right val in assignment - unsigned int listen_port() const; - - /// set function - left val in assignment - unsigned int & listen_port(); - /// set client IP info - left val in assignment void set_tcpip_address(std::string addr, unsigned long id); @@ -65,23 +53,13 @@ namespace metaproxy_1 { friend std::ostream& std::operator<<(std::ostream& os, const metaproxy_1::Origin& o); - enum origin_t { - API, - UNIX, - TCPIP - } m_type; - std::string m_address; // UNIX+TCPIP + std::string m_address; unsigned int m_origin_id; - std::string m_listen_host; - unsigned int m_listen_port; int m_max_sockets; std::string m_custom_session; }; - } - - #endif /* * Local variables: diff --git a/src/origin.cpp b/src/origin.cpp index f76a4d6..498629c 100644 --- a/src/origin.cpp +++ b/src/origin.cpp @@ -23,33 +23,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA namespace mp = metaproxy_1; -mp::Origin::Origin(std::string listen_host, - unsigned int listen_port) - : m_type(API), m_address(""), m_origin_id(0), - m_listen_host(listen_host), m_listen_port(listen_port), m_max_sockets(0) +mp::Origin::Origin() : m_address(""), m_origin_id(0), m_max_sockets(0) { } -std::string mp::Origin::listen_host() const -{ - return m_listen_host; -}; - -std::string & mp::Origin::listen_host() -{ - return m_listen_host; -}; - -unsigned int mp::Origin::listen_port() const -{ - return m_listen_port; -}; - -unsigned int & mp::Origin::listen_port() -{ - return m_listen_port; -}; - void mp::Origin::set_max_sockets(int max_sockets) { m_max_sockets = max_sockets; @@ -62,7 +39,6 @@ int mp::Origin::get_max_sockets() void mp::Origin::set_tcpip_address(std::string addr, unsigned long s) { - m_type = TCPIP; m_address = addr; m_origin_id = s; } diff --git a/src/sru_util.cpp b/src/sru_util.cpp index a9b3d66..213b271 100644 --- a/src/sru_util.cpp +++ b/src/sru_util.cpp @@ -49,8 +49,8 @@ mp_util::SRUServerInfo mp_util::get_sru_server_info(mp::Package &package) mp_util::SRUServerInfo sruinfo; // getting host and port info - sruinfo.host = package.origin().listen_host(); - sruinfo.port = mp_util::to_string(package.origin().listen_port()); + sruinfo.host = "localhost"; + sruinfo.port = "80"; // overwriting host and port info if set from HTTP Host header Z_GDU *zgdu_req = package.request().get(); -- 1.7.10.4