Fix local server for multiple applications
[anna.git] / include / anna / diameter.comm / ServerSession.hpp
index 937cbf9..64997c4 100644 (file)
@@ -14,6 +14,7 @@
 #include <string>
 
 #include <anna/core/util/Millisecond.hpp>
+#include <anna/core/util/defines.hpp> // U32
 #include <anna/core/RuntimeException.hpp>
 
 #include <anna/diameter.comm/Session.hpp>
@@ -43,6 +44,7 @@ namespace comm {
 
 
 class LocalServer;
+class OriginHost;
 
 
 /**
@@ -104,19 +106,6 @@ public:
   */
   anna::comm::ClientSocket *getClientSocket() { return a_clientSocket; }
 
-//   /**
-//      Sets deprecated state to this server session
-//   */
-//   void setDeprecated(bool deprecated = true) { a_deprecated = deprecated; }
-
-//   /**
-//    * Sets CEA and DWA diameter messages to be used over created server-sessions
-//    *
-//    * @param cea Capabilities-Exchange-Answer message (encoded) for the server-sessions bind.
-//    * @param dwa Device-Watchdog-Answer message (encoded) for the server-sessions keep-alive.
-//    */
-//   void setCEAandDWA(const anna::DataBlock & cea, const anna::DataBlock & dwa) noexcept(false);
-
   /* virtual */const Response* send(const Message* message) noexcept(false);
   /* virtual */bool unbind(bool forceDisconnect /* se usa en timer, para el actionTimer del tipo SessionUnbind, etc. */ = false) noexcept(false); // returns true if done at call time (no pendings or ignore pendings, except Disconnecting state by mean DPR/DPA)
 
@@ -151,9 +140,6 @@ private:
   // Client Socket
   anna::comm::ClientSocket *a_clientSocket;
 
-  // Auxiliary messages:
-  Message a_cer, a_dwr;
-
   /* virtual */void expire(anna::timex::Engine *timeController) noexcept(false);
 
   // Activity:
@@ -180,30 +166,34 @@ private:
      Handler for diameter client responses
 
      \param response Answer container object for corresponding diameter request
+     \param myNode Own origin host
   */
-  void eventResponse(const Response& response) noexcept(false);
+  void eventResponse(const Response& response, const anna::diameter::comm::OriginHost *myNode) noexcept(false);
 
   /**
      Handler for diameter client requests
 
      \param request Request data block object for corresponding diameter reception
+     \param myNode Own origin host
   */
-  void eventRequest(const anna::DataBlock& request) noexcept(false);
+  void eventRequest(const anna::DataBlock& request, const anna::diameter::comm::OriginHost *myNode) noexcept(false);
   //void eventRequest(const Message& request) noexcept(false);
 
   /**
      Handler for diameter client responses out of context
 
      \param response Answer data block object without context match
+     \param myNode Own origin host
   */
-  void eventUnknownResponse(const anna::DataBlock& response) noexcept(false);
+  void eventUnknownResponse(const anna::DataBlock& response, const anna::diameter::comm::OriginHost *myNode) noexcept(false);
 
   /**
      Handler for diameter client Disconnect-Peer-Answer messages
 
      \param response Answer data block object without context match
+     \param myNode Own origin host
   */
-  void eventDPA(const anna::DataBlock& response) noexcept(false);
+  void eventDPA(const anna::DataBlock& response, const anna::diameter::comm::OriginHost *myNode) noexcept(false);
 
 
 
@@ -214,8 +204,11 @@ private:
   /* virtual */void finalize() ;
 
   /* virtual */void expireResponse(Response*) ;
-  void sendCEA() noexcept(false);
-  void sendDWA() noexcept(false);
+
+  anna::U32 getAuthApplicationIdFromCER(const anna::DataBlock &cer, bool &found) const;
+
+  void sendCEA(const Engine*, const anna::DataBlock &cerDataBlock) noexcept(false);
+  void sendDWA(const Engine*, const anna::DataBlock &dwrDataBlock) noexcept(false);
 
 
   friend class anna::diameter::comm::Timer;