Hard refactoring. CodecEngine is associated to a unique stack.
[anna.git] / example / diameter / launcher / Launcher.hpp
index 9ac09af..3ce4a20 100644 (file)
@@ -18,6 +18,7 @@
 #include <anna/core/core.hpp>
 #include <anna/comm/comm.hpp>
 #include <anna/time/Date.hpp>
+#include <anna/diameter/codec/Message.hpp>
 
 // Process
 #include <MyCommunicator.hpp>
@@ -42,6 +43,10 @@ namespace anna {
 }
 
 class TestManager;
+class RealmNode;
+class MyDiameterEntity;
+class MyLocalServer;
+class MyDiameterEngine;
 
 // RealmNode resources
 class RealmNode;
@@ -57,8 +62,6 @@ class Launcher : public anna::comm::Application {
 
   // Core engines:
   MyCommunicator *a_communicator;
-  anna::diameter::codec::Engine *a_codecEngine;
-  anna::diameter::stack::Dictionary *a_baseProtocolDictionary;
   anna::timex::Engine* a_timeEngine;
   MyCounterRecorder *a_counterRecorder;
   anna::Millisecond a_admlMinResolution;
@@ -67,6 +70,7 @@ class Launcher : public anna::comm::Application {
   // Nodes deployment:
   realm_nodes_t a_nodes;
   RealmNode *a_workingNode;
+  RealmNode *a_operatedRealm; // auxiliary for eventOperation
 
   // comm resources:
   anna::comm::ServerSocket* a_httpServerSocket; // HTTP
@@ -80,17 +84,23 @@ class Launcher : public anna::comm::Application {
 
 public:
   Launcher();
+  //~Launcher(); TODO
 
   void loadServices(const std::string & xmlPathFile, bool eventOperation = false) throw(anna::RuntimeException);
   void startServices() throw(anna::RuntimeException);
 
-  anna::diameter::codec::Engine *getCodecEngine() const throw() { return a_codecEngine; }
-  //anna::diameter::stack::Dictionary *getBaseProtocolDictionary() const throw() { return a_baseProtocolDictionary; }
-  RealmNode *getWorkingNode() const throw(anna::RuntimeException); // management operations working node
-  bool setWorkingNode(const std::string &name) throw(); // we could update ignoreFlagsOnValidation/integrationAndDebugging over the global codec engine
-                                                        //  but finally, that configuration issues will be global to the process.
-
-  RealmNode *getRealmNode(const std::string &realmName) const throw();
+  bool setWorkingNode(const std::string &name) throw();
+  RealmNode *getRealmNode(const std::string &realmName) const throw(anna::RuntimeException);
+  RealmNode *getRealmNode(const anna::diameter::codec::Message &message) const throw(anna::RuntimeException);
+  bool uniqueRealm() const throw() { return (a_nodes.size() == 1); }
+
+  // Operated realm for communication resources smart assignment ////////////////////////////////////////////////////////////
+  void updateOperatedRealmNodeWithMessage(const anna::diameter::codec::Message &message) throw(anna::RuntimeException);
+  RealmNode *getOperatedRealm() const throw(anna::RuntimeException);
+  MyDiameterEntity *getOperatedEntity() const throw(anna::RuntimeException);
+  MyLocalServer *getOperatedServer() const throw(anna::RuntimeException);
+  MyDiameterEngine *getOperatedEngine() const throw(anna::RuntimeException);
+  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 
   MyCommunicator *getCommunicator() throw() { return a_communicator; }