--- /dev/null
+// ANNA - Anna is Not Nothingness Anymore //
+// //
+// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
+// //
+// See project site at http://redmine.teslayout.com/projects/anna-suite //
+// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
+
+
+// Project
+#include <anna/diameter.comm/OriginHostManager.hpp>
+#include <anna/diameter.comm/OriginHost.hpp>
+#include <anna/core/tracing/Logger.hpp>
+#include <anna/xml/Node.hpp>
+
+
+using namespace anna::diameter::comm;
+
+OriginHost *OriginHostManager::getOriginHost(const std::string &name) const throw() {
+ origin_hosts_it it = a_origin_hosts.find(name);
+ if (it != a_origin_hosts.end())
+ return it->second;
+
+ LOGWARNING(
+ std::string msg = "Unknown origin host node with name '"; msg += name; msg += "'";
+ anna::Logger::warning(msg, ANNA_FILE_LOCATION);
+ );
+
+ return NULL;
+}
+
+void OriginHostManager::registerOriginHost(const std::string &name, OriginHost* originHost) throw() {
+ if (!originHost) return; // nothing done
+ a_origin_hosts[name] = originHost;
+}
+
+anna::xml::Node* OriginHostManager::asXML(anna::xml::Node* parent) const
+throw() {
+ anna::xml::Node* result = parent->createChild("OriginHostManager");
+ origin_hosts_it it_min(a_origin_hosts.begin());
+ origin_hosts_it it_max(a_origin_hosts.end());
+ for (origin_hosts_it it = it_min; it != it_max; it++)
+ it->second->asXML(result);
+
+ return result;
+}
+