// Project
#include <anna/core/Singleton.hpp>
#include <anna/diameter/defines.hpp>
+#include <anna/core/util/defines.hpp> // U32
+
// Standard
#include <map>
private:
origin_hosts_t a_origin_hosts;
+ std::map<std::string /* remove OH name */, std::string /* own OH name */> a_remote_to_own_origin_hosts{};
+
// private constructor
OriginHostManager() {};
/**
* First element iterator
*/
- origin_hosts_it begin() const throw() { return a_origin_hosts.begin(); }
+ origin_hosts_it begin() const { return a_origin_hosts.begin(); }
/**
* Last element iterator
*/
- origin_hosts_it end() const throw() { return a_origin_hosts.end(); }
+ origin_hosts_it end() const { return a_origin_hosts.end(); }
/**
* Number of registered origin hosts
*/
- int size() const throw() { return a_origin_hosts.size(); }
+ int size() const { return a_origin_hosts.size(); }
/**
* Registers a new origin host node (externally allocated) associated to a name.
* @param name Origin Host Name
* @param originHost Associated Origin Host node
*/
- void registerOriginHost(const std::string &name, OriginHost* originHost) throw();
+ void registerOriginHost(const std::string &name, OriginHost* originHost) ;
+
+ /**
+ * Registers the relation between Origin Host for incoming request and
+ * own origin host.
+ *
+ * @param remoteName origin host name for the received CER
+ * @param ownName Own origin host name
+ */
+ void registerRemoteOriginHost(const std::string &remoteName, const std::string &ownName);
/**
* Get the associated origin host node for a provided name.
*
* @return Found origin host node, NULL if not found
*/
- OriginHost *getOriginHost(const std::string &name) const throw();
+ OriginHost *getOriginHost(const std::string &name) const ;
+
+ /**
+ * Get the associated origin host name for a provided remote origin host name.
+ * This relation was established on CER reception.
+ *
+ * @param name remote origin host name
+ *
+ * @return own origin host, NULL if not found
+ */
+ OriginHost * getOriginHostForRemoteOriginHost(const std::string &name) const;
+
+ /**
+ * Get the associated origin host node for a specific application id
+ * No indexed map by application id, so this search is sequential, but
+ * performance is not required as this is used when receiving CER.
+ *
+ * @applicationId application id to search
+ *
+ * @return Found origin host node, NULL if not found
+ */
+ OriginHost *getOriginHost(const anna::U32 &applicationId) const;
+
/**
Class XML representation.
\param parent XML node over which we will put instance information.
\return XML with class content.
*/
- virtual anna::xml::Node* asXML(anna::xml::Node* parent) const throw();
+ virtual anna::xml::Node* asXML(anna::xml::Node* parent) const ;
friend class anna::Singleton <OriginHostManager>;