X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Forigin.cpp;h=8f150b19c141408661b5bedac1e00be97e625fd8;hb=383c1010e6cdbffebdce97c98c9f4e205717e613;hp=ac2da4447b440764d5c09671651f8e94042bd3ce;hpb=4cd9e521c5e96e3fcc5dcec6192571b54a1351c4;p=metaproxy-moved-to-github.git diff --git a/src/origin.cpp b/src/origin.cpp index ac2da44..8f150b1 100644 --- a/src/origin.cpp +++ b/src/origin.cpp @@ -1,5 +1,5 @@ /* This file is part of Metaproxy. - Copyright (C) 2005-2009 Index Data + Copyright (C) Index Data Metaproxy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -16,40 +16,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -//#include "config.hpp" -#include "origin.hpp" +#include "config.hpp" +#include #include 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,26 +39,32 @@ 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; } +void mp::Origin::set_custom_session(const std::string &s) +{ + m_custom_session = s; +} + std::string mp::Origin::get_address() { return m_address; } -std::ostream& std::operator<<(std::ostream& os, mp::Origin& o) +std::ostream& std::operator<<(std::ostream& os, const mp::Origin& o) { - if (o.m_address != "") + if (o.m_address.length()) os << o.m_address; else os << "0"; os << ":" << o.m_origin_id; + if (o.m_custom_session.length()) + os << ":" << o.m_custom_session; return os; } - + /* * Local variables: * c-basic-offset: 4