RINASim  October 2016
Documentation of framework for OMNeT++
RMTQueue.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_RMTQUEUE_H_
24 #define __RINA_RMTQUEUE_H_
25 
26 #include <omnetpp.h>
27 #include <queue>
28 
29 #include "RINASignals.h"
30 #include "PDU.h"
31 
32 #include "Flow.h"
33 
34 class RMTQueue : public cSimpleModule
35 {
36  /* tight coupling for management purposes */
37  friend class RMT;
38  friend class RMTPort;
39  friend class RMTModuleAllocator;
40 
41  public:
42 
43  virtual ~RMTQueue();
44 
48  enum queueType { INPUT = 'I', OUTPUT = 'O'};
49 
55  queueType getType() const;
56 
62  int getLength() const;
63 
70  simtime_t getQTime() const;
71 
77  int getMaxLength() const;
78 
84  void setMaxLength(int value);
85 
91  int getThreshLength() const;
92 
98  void setThreshLength(int value);
99 
105  const cPacket* getFirstPDU() const;
106 
112  const cPacket* getLastPDU() const;
113 
117  typedef std::deque<cPacket*>::iterator iterator;
118  typedef std::deque<cPacket*>::const_iterator const_iterator;
119  iterator begin() { return queue.begin(); }
120  iterator end() { return queue.end(); }
121 
125  void releasePDU();
126 
130  void markCongestionOnLast();
131 
135  std::string info() const;
136 
137  void setFlow(Flow *);
138  const Flow* getFlow() const;
139 
140  protected:
141  virtual void initialize();
142  virtual void finish();
143  virtual void handleMessage(cMessage* msg);
144 
145  private:
146  std::deque<cPacket*> queue;
148 
151 
152  simtime_t qTime;
153 
155  cGate* outputGate;
156  cGate* inputGate;
157 
159 
160  void setType(queueType type);
161 
162  void enqueuePDU(cPacket* pdu);
163  cPacket* dropLast();
164 
165  cGate* getOutputGate() const;
166  cGate* getInputGate() const;
167  cGate* getRMTAccessGate() const;
168  void setRMTAccessGate(cGate* gate);
169 
170  void redrawGUI();
171 
172  simsignal_t sigRMTPDUPreRcvd;
173  simsignal_t sigRMTPDUPostRcvd;
174  simsignal_t sigRMTPDUPreSend;
175  simsignal_t sigRMTPDUSent;
177 };
178 
180 typedef std::vector<RMTQueue*> RMTQueues;
181 
182 std::ostream& operator<< (std::ostream& os, const RMTQueue& cte);
183 
184 #endif
int maxQLength
Definition: RMTQueue.h:149
Class representing flow object with attributes from specs.
Definition: Flow.h:45
void setFlow(Flow *)
Definition: RMTQueue.cc:81
queueType getType() const
Definition: RMTQueue.cc:241
std::ostream & operator<<(std::ostream &os, const RMTQueue &cte)
Definition: RMTQueue.cc:100
int thresholdQLength
Definition: RMTQueue.h:150
cGate * inputGate
Definition: RMTQueue.h:156
simsignal_t sigRMTPDUPostRcvd
Definition: RMTQueue.h:173
cGate * getOutputGate() const
Definition: RMTQueue.cc:261
simsignal_t sigStatRMTQueueLength
Definition: RMTQueue.h:176
int getMaxLength() const
Definition: RMTQueue.cc:215
const cPacket * getFirstPDU() const
Definition: RMTQueue.cc:271
simsignal_t sigRMTPDUSent
Definition: RMTQueue.h:175
std::deque< cPacket * >::const_iterator const_iterator
Definition: RMTQueue.h:118
std::deque< cPacket * > queue
Definition: RMTQueue.h:146
Flow * flow
Definition: RMTQueue.h:158
void releasePDU()
Definition: RMTQueue.cc:162
virtual ~RMTQueue()
Definition: RMTQueue.cc:30
simtime_t qTime
Definition: RMTQueue.h:152
void setMaxLength(int value)
Definition: RMTQueue.cc:221
void setThreshLength(int value)
Definition: RMTQueue.cc:231
void setRMTAccessGate(cGate *gate)
Definition: RMTQueue.cc:256
cGate * rmtAccessGate
Definition: RMTQueue.h:154
cPacket * dropLast()
Definition: RMTQueue.cc:185
virtual void handleMessage(cMessage *msg)
Definition: RMTQueue.cc:141
int getLength() const
Definition: RMTQueue.cc:210
const cPacket * getLastPDU() const
Definition: RMTQueue.cc:276
void redrawGUI()
Definition: RMTQueue.cc:106
const Flow * getFlow() const
Definition: RMTQueue.cc:84
int getThreshLength() const
Definition: RMTQueue.cc:226
Definition: RMT.h:60
cGate * outputGate
Definition: RMTQueue.h:155
queueType type
Definition: RMTQueue.h:147
void setType(queueType type)
Definition: RMTQueue.cc:246
RMTQueue::queueType RMTQueueType
Definition: RMTQueue.h:179
simtime_t getQTime() const
Definition: RMTQueue.cc:236
iterator begin()
Definition: RMTQueue.h:119
cGate * getInputGate() const
Definition: RMTQueue.cc:266
virtual void finish()
Definition: RMTQueue.cc:39
void markCongestionOnLast()
Definition: RMTQueue.cc:194
simsignal_t sigRMTPDUPreRcvd
Definition: RMTQueue.h:172
virtual void initialize()
Definition: RMTQueue.cc:56
iterator end()
Definition: RMTQueue.h:120
std::deque< cPacket * >::iterator iterator
Definition: RMTQueue.h:117
simsignal_t sigRMTPDUPreSend
Definition: RMTQueue.h:174
std::vector< RMTQueue * > RMTQueues
Definition: RMTQueue.h:180
cGate * getRMTAccessGate() const
Definition: RMTQueue.cc:251
void enqueuePDU(cPacket *pdu)
Definition: RMTQueue.cc:153
std::string info() const
Definition: RMTQueue.cc:89