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 example_diameter_launcher_MyDiameterEntity_hpp
10 #define example_diameter_launcher_MyDiameterEntity_hpp
13 #include <anna/diameter.comm/Entity.hpp>
16 #include "ProgrammedAnswers.hpp"
26 class MyDiameterEntity : public anna::diameter::comm::Entity {
28 anna::diameter::codec::Engine * a_codecEngine; // for automatic answers (failed-avp), write logs, etc.
29 bool a_balance; // Balance over entity servers instead of doing standard behaviour (first primary, secondary if fails, etc.). Default: false.
30 std::string a_sessionBasedModelsType;
32 void eventRequestRetransmission(const anna::diameter::comm::ClientSession *, anna::diameter::comm::Message*) throw();
33 void eventResponse(const anna::diameter::comm::Response&) throw(anna::RuntimeException);
34 void eventRequest(anna::diameter::comm::ClientSession *, const anna::DataBlock&) throw(anna::RuntimeException);
35 void eventUnknownResponse(anna::diameter::comm::ClientSession *, const anna::DataBlock&) throw(anna::RuntimeException);
36 void eventDPA(anna::diameter::comm::ClientSession *, const anna::DataBlock&) throw(anna::RuntimeException);
39 int readSocketId(const anna::diameter::comm::Message* message, int maxClientSessions) const throw();
46 a_sessionBasedModelsType = "SessionIdLowPart";
49 ProgrammedAnswers a_reactingAnswers;
50 void setCodecEngine(anna::diameter::codec::Engine *codecEngine) throw() { a_codecEngine = codecEngine; a_reactingAnswers.setCodecEngine(codecEngine); }
51 ProgrammedAnswers *getReactingAnswers() throw() { return (ProgrammedAnswers *)&a_reactingAnswers; }
53 // Additional configuration parameters:
54 void setSessionBasedModelsType(const std::string &type) throw() { a_sessionBasedModelsType = type; }
55 void setBalance(bool balance) throw() { a_balance = balance; }
56 const std::string & getSessionBasedModelsType() const throw() { return a_sessionBasedModelsType; }
57 bool getBalance() const throw() { return a_balance; }