From: Eduardo Ramos Testillano Date: Sun, 26 Apr 2015 15:53:04 +0000 (+0200) Subject: Improve name for setProxied. Better updateEndToEnd because have any other application... X-Git-Tag: REFACTORING_TESTING_LIBRARY~146 X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=commitdiff_plain;h=9cf0513932fb41804095983e065e48aee078dfc7 Improve name for setProxied. Better updateEndToEnd because have any other applications, not only proxy agents. I.e. keep value on retransmissions from clients. --- diff --git a/example/diameter/launcher/main.cpp b/example/diameter/launcher/main.cpp index 7907a47..dde2f7c 100644 --- a/example/diameter/launcher/main.cpp +++ b/example/diameter/launcher/main.cpp @@ -2330,7 +2330,7 @@ throw(anna::RuntimeException) { if(localServer && (cid != anna::diameter::helpers::base::COMMANDID__Capabilities_Exchange_Request) /* don't forward CER */) { try { anna::diameter::comm::Message *msg = G_commMessages.create(); - msg->setProxied(); // end-to-end will be kept + msg->updateEndToEnd(false); // end-to-end will be kept msg->setBody(message); msg->setRequestClientSessionKey(clientSession->getKey()); bool success = localServer->send(msg); @@ -2413,7 +2413,7 @@ throw(anna::RuntimeException) { if(localServer && (request_cid != anna::diameter::helpers::base::COMMANDID__Capabilities_Exchange_Request) /* don't forward CEA */) { try { - G_commMsgFwd2c.setProxied(); // end-to-end will be kept + G_commMsgFwd2c.updateEndToEnd(false); // end-to-end will be kept G_commMsgFwd2c.setBody(*message); bool success = localServer->send(&G_commMsgFwd2c, request->getRequestServerSessionKey()); G_commMessages.release(request); @@ -2512,7 +2512,7 @@ throw(anna::RuntimeException) { anna::diameter::comm::Entity *entity = my_app.getEntity(); if(!programmed && entity) { // forward condition (no programmed answer + entity available) anna::diameter::comm::Message *msg = G_commMessages.create(); - msg->setProxied(); // end-to-end will be kept + msg->updateEndToEnd(false); // end-to-end will be kept msg->setBody(message); msg->setRequestServerSessionKey(serverSession->getKey()); bool success = entity->send(msg, cl.exists("balance")); @@ -2640,7 +2640,7 @@ throw(anna::RuntimeException) { if(my_app.logEnabled()) detail = usedClientSession ? usedClientSession->asString() : ""; // esto no deberia ocurrir try { - G_commMsgFwd2e.setProxied(); // end-to-end will be kept + G_commMsgFwd2e.updateEndToEnd(false); // end-to-end will be kept G_commMsgFwd2e.setBody(*message); // Metodo 1: diff --git a/include/anna/diameter.comm/Message.hpp b/include/anna/diameter.comm/Message.hpp index 7e007ca..7532771 100644 --- a/include/anna/diameter.comm/Message.hpp +++ b/include/anna/diameter.comm/Message.hpp @@ -108,11 +108,20 @@ public: bool fixRequestSequence(HopByHop hbh, EndToEnd ete) throw(); - /** Diameter agents CANNOT modify the end-to-end. True value stands for intermediate agents, false for request originators */ - bool isProxied() const throw() { return a_proxied; } + /** + * 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. + */ + bool updateEndToEnd() const throw() { return a_updateEndToEnd; } - /** Diameter agents CANNOT modify the end-to-end. True value stands for intermediate agents, false for request originators */ - void setProxied(bool proxied = true) throw() { a_proxied = proxied; } + /** + * 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. + */ + void updateEndToEnd(bool update) throw() { a_updateEndToEnd = update; } // Statistics @@ -140,7 +149,7 @@ public: a_requestClientSessionKey = ""; // means unknown/unset a_requestHopByHop = 0; a_requestEndToEnd = 0; - a_proxied = false; + a_updateEndToEnd = true; } @@ -164,7 +173,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_proxied; // end-to-end will be kept + bool a_updateEndToEnd; // end-to-end will be updated void send(ClientSession&) const throw(anna::RuntimeException); void send(ServerSession&) const throw(anna::RuntimeException); diff --git a/source/diameter.comm/Message.cpp b/source/diameter.comm/Message.cpp index 2b6331c..0eef96c 100644 --- a/source/diameter.comm/Message.cpp +++ b/source/diameter.comm/Message.cpp @@ -71,7 +71,7 @@ bool Message::fixRequestSequence(HopByHop hbh, EndToEnd ete) throw() { result = true; } - if(!a_proxied) { + if(a_updateEndToEnd) { if(ete != getRequestEndToEnd()) { codec::functions::setEndToEnd((anna::DataBlock&)getBody(), ete); result = true; @@ -85,7 +85,7 @@ bool Message::fixRequestSequence(HopByHop hbh, EndToEnd ete) throw() { msg += " (original) -> "; msg += anna::functions::asString(hbh); msg += " (session)"; - msg += a_proxied ? " | End to end [proxied]: " : " | End to end: "; + msg += a_updateEndToEnd ? " | End to end: " : " | End to end [end-to-end unchanged]: "; msg += anna::functions::asString(getRequestEndToEnd()); msg += " (original) -> "; msg += anna::functions::asString(ete);