Remove operation help.
[anna.git] / example / diameter / launcher / Launcher.hpp
index 204459a..8a68888 100644 (file)
 #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>
 #include <MyCounterRecorder.hpp>
-#include <TestManager.hpp>
+#include <anna/testing/TestManager.hpp>
 
 
 namespace anna {
@@ -33,73 +34,92 @@ namespace anna {
     namespace codec {
       class Engine;
     }
+    namespace comm {
+      class OriginHost;
+    }
   }
 }
 
 class TestManager;
+class MyDiameterEntity;
+class MyLocalServer;
+class MyDiameterEngine;
 
-// RealmNode resources
-class RealmNode;
-typedef std::map<std::string, RealmNode*> realm_nodes_t;
-typedef std::map<std::string, RealmNode*>::const_iterator realm_nodes_it;
-typedef std::map<std::string, RealmNode*>::iterator realm_nodes_nc_it;
+// OriginHost resources
+typedef std::map<std::string, anna::diameter::comm::OriginHost*> origin_hosts_t;
+typedef std::map<std::string, anna::diameter::comm::OriginHost*>::const_iterator origin_hosts_it;
+typedef std::map<std::string, anna::diameter::comm::OriginHost*>::iterator origin_hosts_nc_it;
 
 
 class Launcher : public anna::comm::Application {
 
   // Start time:
   anna::time::Date a_start_time;
+  std::string a_initialWorkingDirectory;
 
   // 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;
   MyCounterRecorderClock *a_counterRecorderClock;
 
   // Nodes deployment:
-  realm_nodes_t a_nodes;
-  RealmNode *a_workingNode;
+  anna::diameter::comm::OriginHost *a_workingNode;
+  anna::diameter::comm::OriginHost *a_operatedHost; // auxiliary for eventOperation
 
   // comm resources:
   anna::comm::ServerSocket* a_httpServerSocket; // HTTP
 
-  const anna::Millisecond &getADMLMinResolution() const throw() { return a_admlMinResolution; }
+  std::string getSignalUSR2InputFile() const throw();
+  std::string getSignalUSR2OutputFile() const throw();
 
   void servicesFromXML(const anna::xml::Node* servicesNode, bool eventOperation) throw(anna::RuntimeException);
   anna::Millisecond checkTimeMeasure(const std::string &parameter, const std::string &value) throw(anna::RuntimeException);
   void initialize() throw(anna::RuntimeException); // HTTP
   void run() throw(anna::RuntimeException);
 
+
+
 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.
+  bool setWorkingNode(const std::string &name) throw();
+  anna::diameter::comm::OriginHost *getOriginHost(const std::string &name) const throw(anna::RuntimeException);
+  anna::diameter::comm::OriginHost *getOriginHost(const anna::diameter::codec::Message &message) const throw(anna::RuntimeException);
+  bool uniqueOriginHost() const throw();
 
-  RealmNode *getRealmNode(const std::string &realmName) const throw();
+  // Operated host for communication resources smart assignment ////////////////////////////////////////////////////////////
+  void updateOperatedOriginHostWithMessage(const anna::diameter::codec::Message &message) throw(anna::RuntimeException);
+  anna::diameter::comm::OriginHost *getWorkingNode() const throw(anna::RuntimeException);
+  anna::diameter::comm::OriginHost *getOperatedHost() 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; }
-  void eventOperation(const std::string &, std::string &) throw(anna::RuntimeException);
+  bool eventOperation(const std::string &, std::string &) throw(anna::RuntimeException); // returns success/failed
   void forceCountersRecord() throw(anna::RuntimeException) { if (a_counterRecorderClock) a_counterRecorderClock->tick(); }
+  void logStatisticsSamples(const std::string &conceptsList) throw();
+
 
   anna::xml::Node* asXML(anna::xml::Node* parent) const throw();
   void resetStatistics() throw();
   void resetCounters() throw();
   void signalUSR2() throw(anna::RuntimeException);
-  std::string help() const throw();
+  void signalTerminate() throw(anna::RuntimeException);
+  anna::xml::Node* oamAsXML(anna::xml::Node* parent) const throw();
+  anna::xml::Node* statsAsXML(anna::xml::Node* parent) const throw();
 
   // helpers
-  bool getDataBlockFromHexFile(const std::string &pathfile, anna::DataBlock &db) const throw();
+  bool getDataBlockFromHexFile(const std::string &pathfile, anna::DataBlock &db) const throw(anna::RuntimeException);
+  bool getContentFromFile(const std::string &pathfile, std::string &content) const throw(anna::RuntimeException);
 
   friend class TestManager;
 };