RINASim  October 2016
Documentation of framework for OMNeT++
DA.h
Go to the documentation of this file.
1 // The MIT License (MIT)
2 //
3 // Copyright (c) 2014-2016 Brno University of Technology, PRISTINE project
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 // THE SOFTWARE.
22 
23 #ifndef __RINA_DA_H_
24 #define __RINA_DA_H_
25 
26 //Standard libraries
27 #include <omnetpp.h>
28 #include "Utils.h"
29 //RINASim libraries
30 #include "Directory.h"
31 #include "NamingInformation.h"
32 #include "NeighborTable.h"
33 #include "SearchTable.h"
34 #include "FABase.h"
35 #include "ExternConsts.h"
36 
37 //Constants
38 extern const char* MOD_DIRECTORY;
39 extern const char* MOD_NAMINFO;
40 extern const char* MOD_SEARCHTAB;
41 extern const char* MOD_NEIGHBORTAB;
42 
43 class DA : public cSimpleModule
44 {
45  public:
46 
47  DirectoryEntry* resolveApn(const APN& apn);
48 
49 
50 
51  const Address* resolveApnToBestAddress(const APN& apn);
52  const Address* resolveApnToBestAddress(const APN& apn, const DAP& difName);
53  const Addresses* resolveApnToAddressList(const APN& apn, const DAP& difName);
54 
55  const APNList* findApnNeigbors(const APN& apn);
56  const APNList* findNeigborApns(const APN& neighbor);
57 
58  //Methods checking local-ness relevant to this DA
59  bool isAppLocal(const APN& apn);
60  bool isDifLocal(const DAP& difName);
61  bool isIpcLocal(cModule* ipc);
62 
63  //Gets local IPC that is member of a given DIF
64  cModule* getDifMember(const DAP& difName);
65 
66  //------------------ DIFAllocator magical oraculum methods ------------------
67 
68  cModule* findIpc(const Address& addr);
69  FABase* findFaInsideIpc(cModule* ipc);
70  cModule* findApp(const APN& apn);
71 
78  bool isDifLocalToIpc(const std::string difName, cModule* ipc);
79 
86  bool isIpcXLocalToIpcY(cModule* ipcX, cModule* ipcY);
87 
88 
89  protected:
94 
95  virtual void initialize();
96  virtual void handleMessage(cMessage *msg);
97  void initPointers();
98 
99 /*
100  DirectoryEntry* resolveApni(const APNamingInfo& apni);
101  FABase* resolveApniToFa(const APNamingInfo& apni);
102  cModule* resolveApniToIpc(const APNamingInfo& apni);
103  std::string resolveApniToIpcPath(const APNamingInfo& apni);
104 */
105 };
106 
107 #endif
std::list< Address > Addresses
Definition: Address.h:146
const APNList * findNeigborApns(const APN &neighbor)
Definition: DA.cc:69
virtual void initialize()
Definition: DA.cc:81
const APNList * findApnNeigbors(const APN &apn)
Definition: DA.cc:27
const char * MOD_SEARCHTAB
Definition: ExternConsts.cc:65
Application Process Name class.
Definition: APN.h:36
bool isDifLocalToIpc(const std::string difName, cModule *ipc)
Definition: DA.cc:93
NamingInformation * NamInfo
Definition: DA.h:91
cModule * findIpc(const Address &addr)
Definition: DA.cc:170
const char * MOD_DIRECTORY
Definition: ExternConsts.cc:35
SearchTable * SearchTab
Definition: DA.h:93
bool isDifLocal(const DAP &difName)
Definition: DA.cc:134
std::list< APN > APNList
APNList represents the list of APNs.
Definition: APN.h:96
cModule * findApp(const APN &apn)
Definition: DA.cc:204
void initPointers()
Definition: DA.cc:73
NeighborTable * NeighborTab
Definition: DA.h:92
FABase * findFaInsideIpc(cModule *ipc)
Definition: DA.cc:183
Directory * Dir
Definition: DA.h:90
const char * MOD_NAMINFO
Definition: ExternConsts.cc:51
bool isAppLocal(const APN &apn)
Definition: DA.cc:119
virtual void handleMessage(cMessage *msg)
Definition: DA.cc:199
Definition: DA.h:43
bool isIpcLocal(cModule *ipc)
Definition: DA.cc:148
const Addresses * resolveApnToAddressList(const APN &apn, const DAP &difName)
Definition: DA.cc:216
Definition: FABase.h:33
cModule * getDifMember(const DAP &difName)
Definition: DA.cc:158
Address class holds IPC Process identification.
Definition: Address.h:42
const char * MOD_NEIGHBORTAB
bool isIpcXLocalToIpcY(cModule *ipcX, cModule *ipcY)
Definition: DA.cc:111
const Address * resolveApnToBestAddress(const APN &apn)
Definition: DA.cc:31
Distributed Application Process name a.k.a. DAP class.
Definition: DAP.h:34
DirectoryEntry * resolveApn(const APN &apn)
Definition: DA.cc:187