X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2FLauncher.hpp;h=dab341559353c067e7a0866979098b24e14371c9;hb=c881c12ed7e116f1d43760a0d9873f860c10a357;hp=d550ceb8a664307ec00d4ca6a817f4cb5810fcf4;hpb=5f094136b1817b5c4d14dbcc33c9819a8569cd1e;p=anna.git diff --git a/example/diameter/launcher/Launcher.hpp b/example/diameter/launcher/Launcher.hpp index d550ceb..dab3415 100644 --- a/example/diameter/launcher/Launcher.hpp +++ b/example/diameter/launcher/Launcher.hpp @@ -10,113 +10,121 @@ #define example_diameter_launcher_Launcher_hpp // Standard +#include #include #include -#include // Project #include #include -#include #include -#include +#include + +// Process +#include +#include +#include + namespace anna { + namespace timex { + class Engine; + } namespace diameter { + namespace codec { + class Engine; + } namespace comm { - //class Entity; - //class Response; - class LocalServer; + class OriginHost; } } } -// Process -#include "MyCommunicator.hpp" -#include "MyCounterRecorder.hpp" -#include "MyDiameterEngine.hpp" +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 { - MyCommunicator *a_communicator; - MyDiameterEngine *a_myDiameterEngine; - MyDiameterEntity *a_entity; - std::string a_logFile, a_burstLogFile; - std::ofstream a_burstLogStream; - bool a_splitLog, a_detailedLog, a_dumpLog; + // 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; - std::string a_cerPathfile; - std::string a_dwrPathfile; - - // Burst feature - int a_burstCycle; - bool a_burstRepeat; - bool a_burstActive; - std::map < int /* dummy, p.e. used for order number */, anna::diameter::comm::Message* > a_burstMessages; - int a_burstLoadIndx; - std::map::const_iterator a_burstDeliveryIt; - int a_otaRequest; - int a_burstPopCounter; - - // comm Messages factory: - anna::Recycler a_commMessages; - anna::Recycler a_codecMessages; + // 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 - MyLocalServer* a_diameterLocalServer; // DIAMETER - void checkTimeMeasure(const char * commandLineParameter, bool optional = true) throw(anna::RuntimeException); + + 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; } - MyDiameterEngine* getMyDiameterEngine() const throw() { return (a_myDiameterEngine); } - void baseProtocolSetupAsClient(void) throw(anna::RuntimeException); - MyDiameterEntity *getEntity() throw() { return a_entity; } - MyLocalServer* getDiameterLocalServer() throw() { return a_diameterLocalServer; } - void eventOperation(const std::string &, std::string &) throw(anna::RuntimeException); - bool logEnabled() const throw() { return (((a_logFile == "") || (a_logFile == "null")) ? false : true); } - void writeLogFile(const anna::DataBlock & db, const std::string &logExtension, const std::string &detail) const throw(); - void writeLogFile(const anna::diameter::codec::Message & decodedMessage, const std::string &logExtension, const std::string &detail) const throw(); - void writeBurstLogFile(const std::string &buffer) throw(); - bool burstLogEnabled() const throw() { return (((a_burstLogFile == "") || (a_burstLogFile == "null")) ? false : true); } - void startDiameterServer(int) 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() { a_myDiameterEngine->resetStatistics(); } + void resetStatistics() throw(); void resetCounters() throw(); void signalUSR2() throw(anna::RuntimeException); - std::string help() const throw(); - - // Messages factory: - anna::diameter::comm::Message *createCommMessage() throw(anna::RuntimeException); - void releaseCommMessage(anna::diameter::comm::Message*) throw(); - anna::diameter::codec::Message *createCodecMessage() throw(anna::RuntimeException); - void releaseCodecMessage(anna::diameter::codec::Message*) 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(); - - // Burst feature - int clearBurst() throw(); // returns removed - int loadBurstMessage(const anna::DataBlock & db) throw(anna::RuntimeException); - void repeatBurst(bool repeat) throw() { a_burstRepeat = repeat; } - int startBurst(int initialLoad) throw(); // return processed on start, or -1 if burst list is empty, -2 if invalid initial load (0 or negative) - int pushBurst(int loadAmount) throw(); // returns pushed (perhaps is less than provided because of no repeat mode and burst list exhausted), or -1 if burst list is empty, -2 if invalid load (0 or negative) - int sendBurst(int loadAmount) throw(); // returns sent (burst always cycled using send), returns -1 if burst list is empty, -2 if invalid load (0 or negative) - int popBurst(int releaseAmount) throw(); // returns popped (perhaps is less than provided because of OTA request), or -1 if burst stopped - int stopBurst() throw(); // returns remaining on cycle, or -1 if burst already stopped - bool burstActive() const throw() { return a_burstActive; } - bool sendBurstMessage(bool anyway = false) throw(); - std::string lookBurst(int order) const throw(); - std::string gotoBurst(int order) throw(); + bool getDataBlockFromHexFile(const std::string &pathfile, anna::DataBlock &db) const throw(anna::RuntimeException); + + friend class TestManager; }; #endif