1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #ifndef example_diameter_launcher_Launcher_hpp
10 #define example_diameter_launcher_Launcher_hpp
18 #include <anna/core/core.hpp>
19 #include <anna/comm/comm.hpp>
20 #include <anna/time/Date.hpp>
23 #include <MyCommunicator.hpp>
24 #include <MyCounterRecorder.hpp>
25 #include <TestManager.hpp>
41 // RealmNode resources
43 typedef std::map<std::string, RealmNode*> realm_nodes_t;
44 typedef std::map<std::string, RealmNode*>::const_iterator realm_nodes_it;
45 typedef std::map<std::string, RealmNode*>::iterator realm_nodes_nc_it;
48 class Launcher : public anna::comm::Application {
51 anna::time::Date a_start_time;
54 MyCommunicator *a_communicator;
55 anna::diameter::codec::Engine *a_codecEngine;
56 anna::timex::Engine* a_timeEngine;
57 MyCounterRecorder *a_counterRecorder;
58 anna::Millisecond a_admlMinResolution;
59 MyCounterRecorderClock *a_counterRecorderClock;
62 realm_nodes_t a_nodes;
63 RealmNode *a_workingNode;
66 anna::comm::ServerSocket* a_httpServerSocket; // HTTP
68 const anna::Millisecond &getADMLMinResolution() const throw() { return a_admlMinResolution; }
70 void servicesFromXML(const anna::xml::Node* servicesNode, bool eventOperation) throw(anna::RuntimeException);
71 anna::Millisecond checkTimeMeasure(const std::string ¶meter, const std::string &value) throw(anna::RuntimeException);
72 void initialize() throw(anna::RuntimeException); // HTTP
73 void run() throw(anna::RuntimeException);
78 void loadServices(const std::string & xmlPathFile, bool eventOperation = false) throw(anna::RuntimeException);
79 void startServices() throw(anna::RuntimeException);
81 anna::diameter::codec::Engine *getCodecEngine() const throw() { return a_codecEngine; }
82 RealmNode *getWorkingNode() const throw(anna::RuntimeException); // management operations working node
83 bool setWorkingNode(const std::string &name) throw(); // we could update ignoreFlagsOnValidation/integrationAndDebugging over the global codec engine
84 // but finally, that configuration issues will be global to the process.
86 RealmNode *getRealmNode(const std::string &realmName) const throw();
89 MyCommunicator *getCommunicator() throw() { return a_communicator; }
90 void eventOperation(const std::string &, std::string &) throw(anna::RuntimeException);
91 void forceCountersRecord() throw(anna::RuntimeException) { if (a_counterRecorderClock) a_counterRecorderClock->tick(); }
93 anna::xml::Node* asXML(anna::xml::Node* parent) const throw();
94 void resetStatistics() throw();
95 void resetCounters() throw();
96 void signalUSR2() throw(anna::RuntimeException);
97 std::string help() const throw();
100 bool getDataBlockFromHexFile(const std::string &pathfile, anna::DataBlock &db) const throw();
102 friend class TestManager;