Remove dynamic exceptions
[anna.git] / include / anna / diameter.comm / ServerSession.hpp
index 3e7b208..937cbf9 100644 (file)
@@ -1,37 +1,9 @@
-// ANNA - Anna is Not 'N' Anymore
-//
-// (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo
-//
-// https://bitbucket.org/testillano/anna
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: eduardo.ramos.testillano@gmail.com
-//          cisco.tierra@gmail.com
+// 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 anna_diameter_comm_ServerSession_hpp
@@ -82,7 +54,7 @@ public:
   ServerSession();
 
 
-  /* virtual */void initialize() throw();
+  /* virtual */void initialize() ;
 
   /**
    * Default max inactivity period for the diameter server-session health.
@@ -94,48 +66,48 @@ public:
 
      @param allowedInactivityTime Inactivity time allowed
   */
-  void setAllowedInactivityTime(const anna::Millisecond & allowedInactivityTime) throw();
+  void setAllowedInactivityTime(const anna::Millisecond & allowedInactivityTime) ;
 
   /**
      Diameter listening address (ip or hostname).
      \return Diameter listening address.
   */
-  /* virtual */const std::string& getAddress() const throw();
+  /* virtual */const std::string& getAddress() const ;
 
   /**
      Diameter listen port.
      \return Diameter listen port.
   */
-  /* virtual */int getPort() const throw();
+  /* virtual */int getPort() const ;
 
   /**
      Server session key. Same as socket id
   */
-  int getKey() const throw() { return getSocketId(); }
+  int getKey() const { return getSocketId(); }
 
   /**
      Local server parent
      \return Local server parent
   */
-  LocalServer *getParent() throw() { return a_parent; }
+  LocalServer *getParent() { return a_parent; }
 
 
   /**
      Sets the diameter client socket and assign the receiver factory to it
      \param clientSocket Diameter client socket
   */
-  void setClientSocket(anna::comm::ClientSocket *clientSocket) throw();
+  void setClientSocket(anna::comm::ClientSocket *clientSocket) ;
 
   /**
      Diameter client socket
      \return Diameter client socket
   */
-  anna::comm::ClientSocket *getClientSocket() throw() { return a_clientSocket; }
+  anna::comm::ClientSocket *getClientSocket() { return a_clientSocket; }
 
 //   /**
 //      Sets deprecated state to this server session
 //   */
-//   void setDeprecated(bool deprecated = true) throw() { a_deprecated = deprecated; }
+//   void setDeprecated(bool deprecated = true) { a_deprecated = deprecated; }
 
 //   /**
 //    * Sets CEA and DWA diameter messages to be used over created server-sessions
@@ -143,17 +115,17 @@ public:
 //    * @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) throw(anna::RuntimeException);
+//   void setCEAandDWA(const anna::DataBlock & cea, const anna::DataBlock & dwa) noexcept(false);
 
-  /* virtual */const Response* send(const Message* message) throw(anna::RuntimeException);
-  /* virtual */bool unbind(bool forceDisconnect /* se usa en timer, para el actionTimer del tipo SessionUnbind, etc. */ = false) throw(anna::RuntimeException); // returns true if done at call time (no pendings or ignore pendings, except Disconnecting state by mean DPR/DPA)
+  /* 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)
 
 
   /**
      Class string representation
      \return String with relevant information for this instance.
   */
-  /* virtual */std::string asString() const throw();
+  /* virtual */std::string asString() const ;
 
 
   /**
@@ -161,7 +133,7 @@ public:
      \param parent Parent XML node on which hold this instance information.
      \return XML document with relevant information for this instance.
   */
-  /* virtual */anna::xml::Node* asXML(anna::xml::Node* parent) const throw();
+  /* virtual */anna::xml::Node* asXML(anna::xml::Node* parent) const ;
 
 protected:
 
@@ -182,12 +154,12 @@ private:
   // Auxiliary messages:
   Message a_cer, a_dwr;
 
-  /* virtual */void expire(anna::timex::Engine *timeController) throw(anna::RuntimeException);
+  /* virtual */void expire(anna::timex::Engine *timeController) noexcept(false);
 
   // Activity:
-  /* virtual */void updateIncomingActivityTime() throw();
-  /* virtual */void updateOutgoingActivityTime() throw();
-  void countSendings(const diameter::CommandId & cid, bool ok) throw();
+  /* virtual */void updateIncomingActivityTime() ;
+  /* virtual */void updateOutgoingActivityTime() ;
+  void countSendings(const diameter::CommandId & cid, unsigned int aid, bool ok) ;
 
   // Handlers:
   /**
@@ -195,40 +167,55 @@ private:
 
      When notified, ANNA.diameter.comm generates an diameter::comm::ServerSession::eventResponse for every request with pending answers.
   */
-  void eventPeerShutdown() throw();
+  void eventPeerShutdown() ;
+
+  /**
+     Handler about a request retransmission over the session.
+
+     \param request Message retransmitted
+  */
+  void eventRequestRetransmission(Message *request) ;
 
   /**
      Handler for diameter client responses
 
      \param response Answer container object for corresponding diameter request
   */
-  void eventResponse(const Response& response) throw(anna::RuntimeException);
+  void eventResponse(const Response& response) noexcept(false);
 
   /**
      Handler for diameter client requests
 
      \param request Request data block object for corresponding diameter reception
   */
-  void eventRequest(const anna::DataBlock& request) throw(anna::RuntimeException);
-  //void eventRequest(const Message& request) throw(anna::RuntimeException);
+  void eventRequest(const anna::DataBlock& request) 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
   */
-  void eventUnknownResponse(const anna::DataBlock& response) throw(anna::RuntimeException);
+  void eventUnknownResponse(const anna::DataBlock& response) noexcept(false);
+
+  /**
+     Handler for diameter client Disconnect-Peer-Answer messages
+
+     \param response Answer data block object without context match
+  */
+  void eventDPA(const anna::DataBlock& response) noexcept(false);
+
 
 
   /**
   * Handlers for receptions
   */
-  /* virtual */void receive(const anna::comm::Message& message) throw(anna::RuntimeException);
-  /* virtual */void finalize() throw();
+  /* virtual */void receive(const anna::comm::Message& message) noexcept(false);
+  /* virtual */void finalize() ;
 
-  /* virtual */void expireResponse(Response*) throw();
-  void sendCEA() throw(anna::RuntimeException);
-  void sendDWA() throw(anna::RuntimeException);
+  /* virtual */void expireResponse(Response*) ;
+  void sendCEA() noexcept(false);
+  void sendDWA() noexcept(false);
 
 
   friend class anna::diameter::comm::Timer;