1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #ifndef anna_diameter_comm_Response_hpp
10 #define anna_diameter_comm_Response_hpp
13 #include <anna/core/util/Recycler.hpp>
14 #include <anna/core/Allocator.hpp>
15 #include <anna/core/RuntimeException.hpp>
18 #include <anna/diameter/defines.hpp>
19 #include <anna/diameter.comm/ClassCode.hpp>
38 Answers that we could receive from diameter servers.
40 La respuesta correspondiente a una peticion se genera automaticamente al invocar a diameter::comm::Session::send.
41 ANNA::diameter::comm notifies el resultado de la operacion solicitada mediante la invocacion
42 al metodo-menejador diameter::comm::Session::eventResponse de nuestra sesion.
51 Timeout, /**< answer timeout from peer, or transport failure with OTA request notification of timeout event deferred by configurtion */
52 DiameterUnavailable /**< Diameter server was unavailable and notification is not deferred to timeout event for OTA requests */
57 Devuelve el tipo de la clase de esta respuesta.
58 \return El tipo de la clase de esta respuesta.
60 const ClassCode::_v & getClassCode() const throw() { return a_classCode; }
63 Devuelve la identificacion del mensaje diameter.
64 Esta identificacion sera generada automaticamente al enviar la peticion.
65 \return Identificacion del mensaje asociado a esta peticion/respuesta.
66 \see diameter::comm::Session::send
68 HopByHop getHopByHop() const throw() { return a_hopByHop; }
71 Devuelve la sesion que genera esta respuesta.
72 \return La instancia de la sesion que genera esta respuesta.
74 const Session* getSession() const throw() { return a_session; }
77 Devuelve la sesion que origino la creacion de esta respuesta.
78 \return La sesion que origino la creacion de esta respuesta.
80 Session* getSession() throw() { return a_session; }
84 Devuelve el resultado de la peticion diameter solicitada.
85 \return El resultado de la peticion diameter solicitada.
87 const ResultCode::_v & getResultCode() const throw() { return a_resultCode; }
91 Returns original request for the response received from the network.
92 \see diameter::comm::Session::send
94 const Message* getRequest() const throw() { return a_request; }
97 Returns message received from the network.
98 \see diameter::comm::Session::send
100 const anna::DataBlock *getMessage() const throw() { return a_message; }
105 // Reponse regarding diameter keepalive
107 // bool isKeepAlive() const throw();
110 Devuelve una cadena con la informacion relevante sobre esta instancia.
111 \return Una cadena con la informacion relevante sobre esta instancia.
113 std::string asString() const throw();
116 ClassCode::_v a_classCode;
119 ResultCode::_v a_resultCode;
121 const Message* a_request; // associated original request
122 const anna::DataBlock *a_message; // received datablock from server
124 typedef anna::Recycler<Response> response_pool;
125 static response_pool st_responses;
129 static Response* instance(const ClassCode::_v &, const HopByHop) throw(anna::RuntimeException);
130 static void release(Response* response) throw();
132 void clear() throw();
134 void setSession(Session* session) throw() { a_session = session; }
135 void setRequest(const Message* request) throw() { a_request = request; }
136 void setMessage(const anna::DataBlock *message) throw() { a_message = message; }
137 void activateTimer() throw(anna::RuntimeException);
138 void cancelTimer() throw();
139 void setResultCode(const ResultCode::_v & resultCode) throw() { a_resultCode = resultCode; }
141 static const char* asText(const ResultCode::_v) throw();
143 friend class Session;
144 friend class ClientSession;
145 friend class ServerSession;
147 friend class anna::Allocator<Response>;