X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=include%2Fanna%2Fdiameter.comm%2FMessage.hpp;h=6e9acf3ddd666aca94f6746fb00bbfb3db937cb4;hb=5a6cba5fde2b2f538a7515f8293cc0a8d9589dfa;hp=fe9da01fcc4f922292e62563d5508f42efd28a3d;hpb=0a5f4f3cacf71411409feda7a38b790b292c1121;p=anna.git diff --git a/include/anna/diameter.comm/Message.hpp b/include/anna/diameter.comm/Message.hpp index fe9da01..6e9acf3 100644 --- a/include/anna/diameter.comm/Message.hpp +++ b/include/anna/diameter.comm/Message.hpp @@ -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. @@ -62,13 +62,13 @@ public: Devuelve el tipo de la clase de esta peticion indicada en el contructor. \return El tipo de la clase de esta peticion indicada en el contructor. */ - const ClassCode::_v & getClassCode() const throw() { return a_classCode; } + const ClassCode::_v & getClassCode() const { return a_classCode; } /** * Devuelve la acci�n a realizar en caso de que el temporizador asociado a esta petici�n expire. * \return la acci�n a realizar en caso de que el temporizador asociado a esta petici�n expire. */ - OnExpiry::_v getOnExpiry() const throw() { return a_onExpiry; } + OnExpiry::_v getOnExpiry() const { return a_onExpiry; } /** * Establece la acci�n a realizar en caso de que el temporizador asociado a esta petici�n expire. @@ -76,82 +76,90 @@ public: * * \warning Establecer el valor OnExpiry::Ignore podr�a causar p�rdida de memoria y uso innecesario de recursos. */ - void setOnExpiry(const OnExpiry::_v onExpiry) throw() { a_onExpiry = onExpiry; } + void setOnExpiry(const OnExpiry::_v onExpiry) { a_onExpiry = onExpiry; } // Internal use (CER message) - void setClassCode(const ClassCode::_v & classCode) throw() { a_classCode = classCode; } + void setClassCode(const ClassCode::_v & classCode) { a_classCode = classCode; } /** Class string representation \return String with relevant information for this instance. */ - virtual std::string asString() const throw(); + virtual std::string asString() const ; /** Class xml representation \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 ; // Helpers - HopByHop getHopByHop() const throw(); - EndToEnd getEndToEnd() const throw(); - HopByHop getRequestHopByHop() const throw() { return a_requestHopByHop; } - EndToEnd getRequestEndToEnd() const throw() { return a_requestEndToEnd; } - void setRequestHopByHop(HopByHop hbh) throw() { a_requestHopByHop = hbh; } - void setRequestEndToEnd(EndToEnd ete) throw() { a_requestEndToEnd = ete; } - CommandId getCommandId(bool &isRequest) const throw(); - CommandId getCommandId() const throw() { bool dummy; return getCommandId(dummy); } - - bool fixRequestSequence(HopByHop hbh, EndToEnd ete) throw(); + HopByHop getHopByHop() const ; + EndToEnd getEndToEnd() const ; + HopByHop getRequestHopByHop() const { return a_requestHopByHop; } + EndToEnd getRequestEndToEnd() const { return a_requestEndToEnd; } + void setRequestHopByHop(HopByHop hbh) { a_requestHopByHop = hbh; } + void setRequestEndToEnd(EndToEnd ete) { a_requestEndToEnd = ete; } + CommandId getCommandId(bool &isRequest) const ; + CommandId getCommandId() const { bool dummy; return getCommandId(dummy); } + ApplicationId getApplicationId() const ; + + bool fixRequestSequence(HopByHop hbh, EndToEnd ete) ; // 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 endToEndSequenced() const { return a_endToEndSequenced; } + + /** + * 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 */ - bool updateEndToEnd() const throw() { return a_updateEndToEnd; } + void forwardEndToEnd() { a_endToEndSequenced = false; } /** - * 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 set again this behaviour with this method. + * + * @see forwardEndToEnd */ - void updateEndToEnd(bool update) throw() { a_updateEndToEnd = update; } + void sequenceEndToEnd() { a_endToEndSequenced = true; } // Statistics - void updateRequestTimestampMs(void) throw() { a_request_timestamp_ms = anna::functions::millisecond(); } - const anna::Millisecond & getRequestTimestampMs() const throw() { return (a_request_timestamp_ms); } + void updateRequestTimestampMs(void) { a_request_timestamp_ms = anna::functions::millisecond(); } + const anna::Millisecond & getRequestTimestampMs() const { return (a_request_timestamp_ms); } - int getRetries() const throw() { return a_retries; } - void setRetries(int value) throw() { a_retries = value; } + int getRetries() const { return a_retries; } + void setRetries(int value) { a_retries = value; } - int getRequestServerSessionKey() const throw() { return a_requestServerSessionKey; } + int getRequestServerSessionKey() const { return a_requestServerSessionKey; } /** Application specific socket id to keep origin track for request which came from a specific client, at asyncronous contexts (process with both diameter interfaces: client & entities) */ - void setRequestServerSessionKey(int value) throw() { a_requestServerSessionKey = value; } + void setRequestServerSessionKey(int value) { a_requestServerSessionKey = value; } - const std::string & getRequestClientSessionKey() const throw() { return a_requestClientSessionKey; } + const std::string & getRequestClientSessionKey() const { return a_requestClientSessionKey; } /** Application specific socket id to keep origin track for request which came from a specific server (entity), at asyncronous contexts (process with both diameter interfaces: client & entities) */ - void setRequestClientSessionKey(const std::string & value) throw() { a_requestClientSessionKey = value; } + void setRequestClientSessionKey(const std::string & value) { a_requestClientSessionKey = value; } /** Initializes class information */ - void initialize() throw() { - a_retries = 0; + void initialize() { + 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; } @@ -175,13 +183,13 @@ 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); - void restoreSequencesAfterFix() throw(); + void send(ClientSession&) const noexcept(false); + void send(ServerSession&) const noexcept(false); + void restoreSequencesAfterFix() ; - static const char* asText(const OnExpiry::_v) throw(); + static const char* asText(const OnExpiry::_v) ; friend class Session; friend class ClientSession;