X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2FLauncher.hpp;h=dab341559353c067e7a0866979098b24e14371c9;hb=c881c12ed7e116f1d43760a0d9873f860c10a357;hp=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391;hpb=68a8fe342d8337ec1a86b57920bc7dcf7faf2413;p=anna.git diff --git a/example/diameter/launcher/Launcher.hpp b/example/diameter/launcher/Launcher.hpp index e69de29..dab3415 100644 --- a/example/diameter/launcher/Launcher.hpp +++ b/example/diameter/launcher/Launcher.hpp @@ -0,0 +1,130 @@ +// ANNA - Anna is Not Nothingness Anymore // +// // +// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo // +// // +// See project site at http://redmine.teslayout.com/projects/anna-suite // +// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE // + + +#ifndef example_diameter_launcher_Launcher_hpp +#define example_diameter_launcher_Launcher_hpp + +// Standard +#include +#include +#include + +// Project +#include +#include +#include +#include + +// Process +#include +#include +#include + + +namespace anna { + namespace timex { + class Engine; + } + namespace diameter { + namespace codec { + class Engine; + } + namespace comm { + class OriginHost; + } + } +} + +class TestManager; +class MyDiameterEntity; +class MyLocalServer; +class MyDiameterEngine; + +// OriginHost resources +typedef std::map origin_hosts_t; +typedef std::map::const_iterator origin_hosts_it; +typedef std::map::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::timex::Engine* a_timeEngine; + MyCounterRecorder *a_counterRecorder; + anna::Millisecond a_admlMinResolution; + MyCounterRecorderClock *a_counterRecorderClock; + + // Nodes deployment: + anna::diameter::comm::OriginHost *a_workingNode; + anna::diameter::comm::OriginHost *a_operatedHost; // auxiliary for eventOperation + + // comm resources: + anna::comm::ServerSocket* a_httpServerSocket; // HTTP + + std::string getSignalUSR2InputFile() const throw(); + std::string getSignalUSR2OutputFile() const throw(); + + void servicesFromXML(const anna::xml::Node* servicesNode, bool bindResources) throw(anna::RuntimeException); + anna::Millisecond checkTimeMeasure(const std::string ¶meter, const std::string &value) throw(anna::RuntimeException); + void initialize() throw(anna::RuntimeException); // HTTP + void run() throw(anna::RuntimeException); + + + +public: + Launcher(); + //~Launcher(); TODO + + void loadServicesFromFile(const std::string & xmlPathFile, bool bindResources) throw(anna::RuntimeException); + void loadServicesFromXMLString(const std::string & xmlString, bool bindResources) throw(anna::RuntimeException); + void startServices() throw(anna::RuntimeException); + + bool setWorkingNode(const std::string &name) throw(); + void setNodeAuto() { a_workingNode = NULL; a_operatedHost = NULL; } + 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(); + + // 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); + void setOperatedHost(anna::diameter::comm::OriginHost *); + MyDiameterEntity *getOperatedEntity() const throw(anna::RuntimeException); + MyLocalServer *getOperatedServer() const throw(anna::RuntimeException); + MyDiameterEngine *getOperatedEngine() const throw(anna::RuntimeException); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + const std::string & getInitialWorkingDirectory() const { return a_initialWorkingDirectory; } + + MyCommunicator *getCommunicator() throw() { return a_communicator; } + 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); + 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(anna::RuntimeException); + + friend class TestManager; +}; + +#endif