Base protocol codec for comm::Engine. Supported retransmissions
[anna.git] / include / anna / diameter.comm / Message.hpp
index b5cb459..9fc265a 100644 (file)
@@ -48,7 +48,7 @@ public:
   /**
    * Define las acciones a realizar en caso de que el temporizador de la petici�n expire.
    */
-  struct OnExpiry { enum _v { Abandon, Ignore }; };
+  struct OnExpiry { enum _v { Abandon, Ignore, Retransmit }; };
 
   /**
      Constructor.
@@ -112,19 +112,26 @@ public:
   // http://diameter-protocol.blogspot.com.es/2011/05/diameter-message-structure-and-message.html
 
   /**
-   * In general, diameter agents CANNOT modify the end-to-end value during sending the message to the peer.
-   * That 'true' value stands for intermediate agents and also for retransmissions (must keep end-to-end
-   * during 4 minutes even upon reboots). False is used for new request created from end points (originators)
-   * as diameter clients.
+   * In general, diameter nodes will sequence the End-To-End value when sending new requests.
+   * A 'false' value stands for intermediate agents (must keep end-to-end during 4 minutes even upon reboots).
    */
-  bool updateEndToEnd() const throw() { return a_updateEndToEnd; }
+  bool endToEndSequenced() const throw() { return a_endToEndSequenced; }
 
   /**
-   * In general, diameter agents CANNOT modify the end-to-end value during sending the message to the peer.
-   * The appropiate behaviour must be configured before sending the message. By default, the diameter::comm
-   * message will sequence the end-to-end increasing the initial value created during session establishment.
+   * By default, the diameter::comm message will sequence the end-to-end increasing the initial value created
+   * during session establishment. Anyway you could change this behaviour with this method.
+   *
+   * @see sequenceEndToEnd
+   */
+  void forwardEndToEnd() throw() { a_endToEndSequenced = false; }
+
+  /**
+   * By default, the diameter::comm message will sequence the end-to-end increasing the initial value created
+   * during session establishment. Anyway you could set again this behaviour with this method.
+   *
+   * @see forwardEndToEnd
    */
-  void updateEndToEnd(bool update) throw() { a_updateEndToEnd = update; }
+  void sequenceEndToEnd() throw() { a_endToEndSequenced = true; }
 
 
   // Statistics
@@ -147,12 +154,12 @@ public:
 
   /** Initializes class information */
   void initialize() throw() {
-    a_retries = 0;
+    a_retries = 1;
     a_requestServerSessionKey = -1; // means unknown/unset
     a_requestClientSessionKey = ""; // means unknown/unset
     a_requestHopByHop = 0;
     a_requestEndToEnd = 0;
-    a_updateEndToEnd = true;
+    a_endToEndSequenced = true;
   }
 
 
@@ -176,7 +183,7 @@ private:
   std::string a_requestClientSessionKey;    // idem for request which was received from servers
   HopByHop a_requestHopByHop; // application backup for hop-by-hop in order to restore on answer receive
   EndToEnd a_requestEndToEnd; // application backup for end-to-end in order to restore on answer receive
-  bool a_updateEndToEnd; // end-to-end will be updated
+  bool a_endToEndSequenced; // end-to-end will be sequenced by default (true)
 
   void send(ClientSession&) const throw(anna::RuntimeException);
   void send(ServerSession&) const throw(anna::RuntimeException);