RINASim  October 2016
Documentation of framework for OMNeT++
RMT.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 
30 #ifndef RMT_H_
31 #define RMT_H_
32 
33 #include <omnetpp.h>
34 #include <fstream>
35 #include <bitset>
36 
37 #include "RINASignals.h"
38 #include "ExternConsts.h"
39 #include "Address.h"
40 #include "PDU.h"
41 #include "Utils.h"
42 
43 #include "IntPDUForwarding.h"
44 #include "QueueAllocBase.h"
45 #include "AddressComparatorBase.h"
46 
47 #include "RMTBase.h"
48 #include "RMTListeners.h"
49 #include "RMTModuleAllocator.h"
50 #include "RMTSchedulingBase.h"
51 #include "RMTQMonitorBase.h"
52 #include "RMTMaxQBase.h"
53 
54 // mapping of cepIDs to output gates
55 typedef std::map<int, cGate*> EfcpiMapping;
56 
57 // shared access to trace logger
58 extern std::ofstream rmtTraceFile;
59 
60 class RMT : public RMTBase
61 {
62  friend class RA;
63  friend class FAI;
64 
65  public:
66 
67  virtual ~RMT();
68 
69  virtual bool getRelayStatus() { return relayOn; };
70  virtual bool isOnWire() { return onWire; };
71 
72  virtual void preQueueArrival(cObject* obj);
73  virtual void postQueueArrival(cObject* obj);
74  virtual void preQueueDeparture(cObject* obj);
75  virtual void postQueueDeparture(cObject* obj);
76  virtual void writeToPort(cObject* obj);
77  virtual void readFromPort(cObject* obj);
78 
79  protected:
80  virtual void initialize();
81  virtual void handleMessage(cMessage *msg);
82  virtual void finish();
83  void recDel(cPacket * p);
84 
85  private:
88 
89  bool relayOn;
90  bool onWire;
91 
94 
98 
102 
104  {
105  MSG_SEND = 's', MSG_RECEIVE = 'r', MSG_ENQUEUE = '+', MSG_DEQUEUE = '-',
106  MSG_DROP = 'd'
107  };
108  bool tracing;
109 
110  void processMessage(cMessage* msg);
111  void relayPDUToPort(PDU* msg);
112  void relayPDUToEFCPI(PDU* msg);
113 
114  std::vector<RMTPort*> fwTableLookup(const PDU * pdu);
115  std::deque<cMessage*> invalidPDUs;
116 
117  void tracePDUEvent(const cPacket* pkt, TraceEventType eventType);
118 
119  simsignal_t sigRMTNoConnID;
120  simsignal_t sigRMTPacketError;
127 
128  // management methods for Resource Allocator
129  void setOnWire(bool status) { onWire = status; };
130  void enableRelay() { relayOn = true; };
131  void disableRelay() { relayOn = false; };
132 
133  // management methods for FAIs
134  void createEfcpiGate(unsigned int efcpiId);
135  void deleteEfcpiGate(unsigned int efcpiId);
136 };
137 
138 #endif /* RMT_H_ */
LisRMTPortReadyForRead * lisRMTPortReadyForRead
Definition: RMT.h:126
Definition: RMTListeners.h:49
RMTSchedulingBase * schedPolicy
Definition: RMT.h:97
void relayPDUToEFCPI(PDU *msg)
Definition: RMT.cc:481
LisRMTQueuePDUPreRcvd * lisRMTQueuePDUPreRcvd
Definition: RMT.h:121
virtual void preQueueArrival(cObject *obj)
Definition: RMT.cc:183
EfcpiMapping efcpiIn
Definition: RMT.h:93
LisRMTPortReadyToServe * lisRMTPortReadyToServe
Definition: RMT.h:125
virtual bool isOnWire()
Definition: RMT.h:70
void recDel(cPacket *p)
Definition: RMT.cc:197
void setOnWire(bool status)
Definition: RMT.h:129
RMTMaxQBase * maxQPolicy
Definition: RMT.h:96
RMTModuleAllocator * rmtAllocator
Definition: RMT.h:87
TraceEventType
Definition: RMT.h:103
virtual void initialize()
Definition: RMT.cc:50
EfcpiMapping efcpiOut
Definition: RMT.h:92
virtual ~RMT()
Definition: RMT.cc:40
IntPDUForwarding * fwd
Definition: RMT.h:86
void deleteEfcpiGate(unsigned int efcpiId)
Definition: RMT.cc:373
virtual void finish()
Definition: RMT.cc:120
QueueAllocBase * qAllocPolicy
Definition: RMT.h:99
Definition: PDU.h:42
bool tracing
Definition: RMT.h:108
void tracePDUEvent(const cPacket *pkt, TraceEventType eventType)
Definition: RMT.cc:148
void disableRelay()
Definition: RMT.h:131
Definition: FAI.h:47
bool onWire
Definition: RMT.h:90
simsignal_t sigRMTPacketError
Definition: RMT.h:120
std::map< int, cGate * > EfcpiMapping
Definition: RMT.h:55
virtual void postQueueArrival(cObject *obj)
Definition: RMT.cc:203
virtual void handleMessage(cMessage *msg)
Definition: RMT.cc:552
simsignal_t sigRMTNoConnID
Definition: RMT.h:119
virtual void postQueueDeparture(cObject *obj)
Definition: RMT.cc:284
Definition: RA.h:61
QueueIDGenBase * queueIdGenerator
Definition: RMT.h:100
LisRMTQueuePDUPreSend * lisRMTQueuePDUPreSend
Definition: RMT.h:123
Definition: RMT.h:60
LisRMTQueuePDUSent * lisRMTQueuePDUSent
Definition: RMT.h:124
virtual void preQueueDeparture(cObject *obj)
Definition: RMT.cc:262
AddressComparatorBase * addrComparator
Definition: RMT.h:101
virtual bool getRelayStatus()
Definition: RMT.h:69
std::vector< RMTPort * > fwTableLookup(const PDU *pdu)
Definition: RMT.cc:404
void createEfcpiGate(unsigned int efcpiId)
Definition: RMT.cc:339
LisRMTQueuePDUPostRcvd * lisRMTQueuePDUPostRcvd
Definition: RMT.h:122
RMTQMonitorBase * qMonPolicy
Definition: RMT.h:95
void processMessage(cMessage *msg)
Definition: RMT.cc:510
void enableRelay()
Definition: RMT.h:130
virtual void writeToPort(cObject *obj)
Definition: RMT.cc:315
bool relayOn
Definition: RMT.h:89
void relayPDUToPort(PDU *msg)
Definition: RMT.cc:425
std::deque< cMessage * > invalidPDUs
Definition: RMT.h:115
virtual void readFromPort(cObject *obj)
Definition: RMT.cc:327
std::ofstream rmtTraceFile
Definition: RMT.cc:35