Testing library separation: now not in launcher but isolated
[anna.git] / include / anna / diameter.comm / Engine.hpp
index 742c0fc..72e3ad9 100644 (file)
@@ -101,37 +101,34 @@ class Engine : public anna::app::Component {
 public:
 
   /**
-     Diameter application node realm name (used to be the site domain name).
+     Diameter application node origin realm
 
-     @param name Diameter application node realm name. Used in order to configure the Origin-Realm for outgoing messages.
+     @param originRealmName Used to configure the Origin-Realm for outgoing messages.
      If not configured or empty string provided, host domainname will be set.
   */
-  void setRealm(const std::string & name) throw();
-
+  void setOriginRealmName(const std::string & originRealmName) throw();
 
   /**
-     Gets the configured diameter application node realm name.
+     Diameter application origin host
 
-     @return Diameter application node realm name.
+     @param originHostName Used to configure the Origin-Host for outgoing messages.
+     If not configured or empty string provided, hostname (system name) will be set.
   */
-  const std::string & getRealm() const throw() { return a_realm; }
-
+  void setOriginHostName(const std::string & originHostName) throw();
 
   /**
-     Diameter application host name as solved by #anna::functions::getHostname()
+     Gets the configured diameter application node origin realm
 
-     @param name Host name. Used in order to configure the Origin-Host for outgoing messages.
-     If not configured or empty string provided, hostname (system name) will be set.
+     @return Diameter application node origin realm
   */
-  void setHost(const std::string & name) throw();
-
+  const std::string & getOriginRealmName() const throw() { return a_originRealm; }
 
   /**
-     Gets the configured diameter application host name.
+     Gets the configured diameter application origin host
 
-     @return Diameter application host name.
+     @return Diameter application node origin host
   */
-  const std::string & getHost() const throw() { return a_host; }
+  const std::string & getOriginHostName() const throw() { return a_originHost; }
 
 
   /**
@@ -576,12 +573,20 @@ public:
   */
   virtual void readDPA(anna::DataBlock &dpa, const anna::DataBlock & dpr) throw();
 
+  /**
+   * Sets optional CEA from file, when default is not enough
+   *
+   * @param &ceaPathfile Path file for the CEA xml message provided
+   */
+  void setCEA(const std::string &ceaPathfile) throw() { a_ceaPathfile = ceaPathfile; }
+
   /**
    * Class user should implement this method in order to define Capabilities-Exchange-Answer for received CER over server socket.
    * Origin-Host and Origin-Realm are configured at comm::Engine with hostname and FQDN (Fully Qualified Domain Name).
    * Default implementation imply CEA with DIAMETER_SUCCESS Result-Code, and own domain node parameters, but application should
    * analyze the CER message in order to accept it or not (with apropiate non-success Result-Code).
-   * Any other implementation is responsible to build a valid CEA diameter message:
+   * If @setCEA was invoked, a message from file is used instead of default implementation.
+   * Any other implementation is responsible to build a valid CEA diameter message, even ignoring a possible cea from file when @setCEA is used:
    *
    * If one peer sends a CER message to another Peer and receiver does not have support for
    *
@@ -707,14 +712,21 @@ protected:
   */
   virtual void releaseLocalServer(LocalServer*) throw() {;}
 
+  //  Gets the base protocol codec engine used internally.
+  //  This engine is initializaed on constructor with the base protocol dictionary.
+  //  The reason to not reuse any other codec engine from the application is to have this one isolated with no interference
+  //  regarding configuration changes (validation depth/mode, fix mode, etc.).
+  //
+  //  @return Pointer to the internal base protocol codec engine
+  codec::Engine *getBaseProtocolCodecEngine() const throw() { return const_cast<codec::Engine *>(&a_baseProtocolCodecEngine); }
 
 private:
 
   // Internal use: tracing and readCEA/DPA/DWA
   codec::Engine a_baseProtocolCodecEngine;
 
-  std::string a_realm;
-  std::string a_host;
+  std::string a_originRealm;
+  std::string a_originHost;
   bool a_autoBind;
   int a_numberOfClientSessionsPerServer;
 
@@ -725,6 +737,7 @@ private:
   anna::Millisecond a_watchdogPeriod;
 
 //   // ServerSessions messages:
+  std::string a_ceaPathfile; // path file to optional CEA (diameter local server configuration)
 //   anna::DataBlock a_cea;
 //   anna::DataBlock a_dwa;
 
@@ -754,14 +767,6 @@ private:
   void assertBaseProtocolHealth() throw(anna::RuntimeException); // checks the dictionary
 
 
-  //  Gets the base protocol codec engine used internally.
-  //  This engine is initializaed on constructor with the base protocol dictionary.
-  //  The reason to not reuse any other codec engine from the application is to have this one isolated with no interference
-  //  regarding configuration changes (validation depth/mode, fix mode, etc.).
-  //
-  //  @return Pointer to the internal base protocol codec engine
-  codec::Engine *getBaseProtocolCodecEngine() const throw() { return const_cast<codec::Engine *>(&a_baseProtocolCodecEngine); }
-
   //////////////////////////
   // CLIENT FUNCTIONALITY //
   //////////////////////////