Base protocol codec for comm::Engine. Supported retransmissions
[anna.git] / example / diameter / launcher / Launcher.hpp
index 9a61627..d7e4bba 100644 (file)
@@ -15,6 +15,7 @@
 #include <fstream>
 
 // Project
+#include <anna/core/core.hpp>
 #include <anna/comm/comm.hpp>
 #include <anna/diameter.comm/Entity.hpp>
 #include <anna/time/Date.hpp>
@@ -41,6 +42,7 @@ class Launcher : public anna::comm::Application {
   MyCommunicator *a_communicator;
   MyDiameterEngine *a_myDiameterEngine;
   MyDiameterEntity *a_entity;
+  anna::diameter::codec::Engine *a_codecEngine;
   std::string a_logFile, a_burstLogFile;
   std::ofstream a_burstLogStream;
   bool a_splitLog, a_detailedLog, a_dumpLog;
@@ -61,6 +63,9 @@ class Launcher : public anna::comm::Application {
   int a_otaRequest;
   int a_burstPopCounter;
 
+  // comm Messages factory:
+  anna::Recycler<anna::diameter::comm::Message> a_commMessages;
+
   anna::comm::ServerSocket* a_httpServerSocket; // HTTP
   MyLocalServer* a_diameterLocalServer; // DIAMETER
   void checkTimeMeasure(const char * commandLineParameter, bool optional = true) throw(anna::RuntimeException);
@@ -70,14 +75,15 @@ class Launcher : public anna::comm::Application {
 public:
   Launcher();
 
+  anna::diameter::codec::Engine *getCodecEngine() const throw() { return a_codecEngine; } // XXXXXXXXXXXXXXXXX El del nodo de trabajo
   MyCommunicator *getCommunicator() throw() { return a_communicator; }
   MyDiameterEngine* getMyDiameterEngine() const throw() { return (a_myDiameterEngine); }
-  void baseProtocolSetupAsClient(void) throw(anna::RuntimeException);
+  void baseProtocolSetupAsClient() 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::DataBlock & db, const std::string &logExtension, const std::string &detail, anna::diameter::codec::Engine *codecEngine) 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); }
@@ -90,6 +96,10 @@ public:
   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();
+
   // helpers
   bool getDataBlockFromHexFile(const std::string &pathfile, anna::DataBlock &db) const throw();