RPATH skipped. Added testing so library. Improve support for default CCR configuratio...
[anna.git] / example / diameter / launcher / MyDiameterEngine.hpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
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 //
7
8
9 #ifndef example_diameter_launcher_MyDiameterEngine_hpp
10 #define example_diameter_launcher_MyDiameterEngine_hpp
11
12 // Project
13 #include <anna/diameter.comm/Engine.hpp>
14
15 // Process
16 #include <MyDiameterEntity.hpp>
17 #include <MyLocalServer.hpp>
18
19 // Standard
20 #include <string>
21
22
23 namespace anna {
24   namespace diameter {
25     namespace stack {
26       class Dictionary;
27     }
28   }
29 }
30
31 class MyDiameterEngine : public anna::diameter::comm::Engine {
32 public:
33
34   MyDiameterEngine(const char *className, const anna::diameter::stack::Dictionary *baseProtocolDictionary) : Engine(className, baseProtocolDictionary) {;}
35
36 // Default implementation is enough
37 //   void readDPA(anna::DataBlock &dpa, const anna::DataBlock & dpr) throw() {;} // DPA is not replied
38 //   void readDWA(anna::DataBlock &dwa, const anna::DataBlock & dwr) throw() {;} // DWA is not replied
39
40 private:
41   anna::Recycler<MyDiameterEntity> a_entitiesRecycler;
42
43   anna::diameter::comm::Entity* allocateEntity() throw() { return a_entitiesRecycler.create(); }
44
45   void releaseEntity(anna::diameter::comm::Entity* entity) throw() {
46     MyDiameterEntity* aux = static_cast <MyDiameterEntity*>(entity);
47     a_entitiesRecycler.release(aux);
48   }
49
50   anna::Recycler<MyLocalServer> a_localServersRecycler;
51
52   anna::diameter::comm::LocalServer* allocateLocalServer() throw() { return a_localServersRecycler.create(); }
53
54   void releaseLocalServer(anna::diameter::comm::LocalServer* localServer) throw() {
55     MyLocalServer* aux = static_cast <MyLocalServer*>(localServer);
56     a_localServersRecycler.release(aux);
57   }
58 };
59
60 #endif