RINASim  October 2016
Documentation of framework for OMNeT++
Flow.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 FLOW_H_
24 #define FLOW_H_
25 
26 //Standard libraries
27 #include <string>
28 #include <sstream>
29 //RINASim libraries
30 #include "APNamingInfo.h"
31 #include "ConnectionId.h"
32 #include "Address.h"
33 #include "QoSReq.h"
34 
35 extern const int VAL_UNDEF_PORTID;
36 extern const int VAL_MGMT_PORTID;
37 extern const int VAL_MAXHOPCOUNT;
38 extern const int VAL_MAXCREATERETRIES;
39 
45 class Flow : public cObject
46 {
47  public:
51  Flow();
52 
58  Flow(APNamingInfo src, APNamingInfo dst);
59 
63  virtual ~Flow();
64 
70  bool operator== (const Flow& other) const;
71 
75  bool compare(const Flow& other) const;
76 
81  virtual Flow* dup() const;
82 
83  Flow* dupToMgmt() const;
84 
85  //Various string output functions
91  std::string info() const;
92 
98  std::string infoSource() const;
99 
105  std::string infoDestination() const;
106 
111  std::string infoOther() const;
112 
119  std::string infoQoS() const;
120 
126  std::string getFlowName() const;
127 
133  Flow& swapFlow();
134 
140 
145  const ConnectionId& getConId() const;
146 
151  void setConId(const ConnectionId& conId);
152 
153 
154  void setQosCube(const QoSCube& qosCube);
155 
156  const QoSCube& getQosCube() const;
157 
162  const QoSReq& getQosRequirements() const;
163 
164  QoSReq& getQosReqs();
165 
170  void setQosRequirements(const QoSReq& qosReqs);
171 
176  const APNamingInfo& getSrcApni() const;
177 
183  void setSrcApni(const APNamingInfo& srcApni);
184 
189  const APNamingInfo& getDstApni() const;
190 
195  void setDstApni(const APNamingInfo& dstApni);
196 
201  int getSrcPortId() const;
202 
207  void setSrcPortId(int srcPortId);
208 
213  int getDstPortId() const;
214 
219  void setDstPortId(int dstPortId);
220 
226  uint32_t getCreateFlowRetries() const;
227 
233 
239  uint32_t getMaxCreateFlowRetries() const;
240 
246 
252  uint32_t getHopCount() const;
253 
258  void setHopCount(uint32_t hopCount);
259 
264  const Address& getSrcAddr() const;
265 
270  void setSrcAddr(const Address& srcAddr);
271 
276  const Address& getDstAddr() const;
277 
282  void setDstAddr(const Address& dstAddr);
283 
284  //TODO: Vesely - Pull addresses to new Flow child class
285 
291  const Address& getSrcNeighbor() const;
292 
297  void setSrcNeighbor(const Address& srcNeighbor);
298 
304  const Address& getDstNeighbor() const;
305 
310  void setDstNeighbor(const Address& dstNeighbor);
311 
317  long getAllocInvokeId() const;
318 
323  void setAllocInvokeId(long allocInvokeId);
324 
330  long getDeallocInvokeId() const;
331 
337 
342  bool isDdtFlag() const;
343 
348  void setDdtFlag(bool ddtFlag);
349 
350  bool isManagementFlow() const;
351 
352  bool isManagementFlowLocalToIPCP() const;
353 
354  protected:
355  //Properties are based on RINA-Demo-2012-001.pdf page 6
356 
361 
366 
371 
376 
381 
386 
391 
396 
401 
406 
411 
415  uint32_t hopCount;
416 
417 
422 
427 
432 
437 
441  bool ddtFlag;
442 
446  void swapPortIds();
447 
451  void swapAddresses();
452 
456  void swapCepIds();
457 
461  void swapApni();
462 
463 
464 };
465 
466 
467 //Free function
474 std::ostream& operator<< (std::ostream& os, const Flow& fl);
475 
476 #endif /* FLOW_H_ */
Class representing flow object with attributes from specs.
Definition: Flow.h:45
void setQosRequirements(const QoSReq &qosReqs)
Sets QoS parameters wanted by flow initiator.
Definition: Flow.cc:323
const APNamingInfo & getSrcApni() const
Gets read-only source APNamingInfo.
Definition: Flow.cc:134
void setDstApni(const APNamingInfo &dstApni)
Sets destination APNamingInfo.
Definition: Flow.cc:106
void setDstAddr(const Address &dstAddr)
Sets (end-point) destination Address.
Definition: Flow.cc:154
ConnectionId & getConnectionId()
Gets Flow's ConnectionId.
Definition: Flow.cc:209
long deallocInvokeId
Attribute holding persistant InvokeId used for deallocation.
Definition: Flow.h:436
void setAllocInvokeId(long allocInvokeId)
Sets allocation InvokeId.
Definition: Flow.cc:281
bool isDdtFlag() const
Gets whether flow is for Degenerate Data Transfer.
Definition: Flow.cc:293
long getAllocInvokeId() const
Gets allocation InvokeId Used inside M_CREATE(_R)(flow) messages.
Definition: Flow.cc:277
const Address & getSrcNeighbor() const
Gets neighbor source Address, which is the address of (interim) hop-by-hop source Used during flow al...
Definition: Flow.cc:348
std::string info() const
Prints Flow information as string Calls variety of other info functions to produce final output...
Definition: Flow.cc:327
bool ddtFlag
Attribute representing whether flow is for Degenerate Data Transfer or not.
Definition: Flow.h:441
Address srcAddr
Attribute holding source address (initiator of communication)
Definition: Flow.h:380
Connection identifier as defined in specifications.
Definition: ConnectionId.h:42
const int VAL_MAXCREATERETRIES
Definition: Flow.cc:28
QoSReq & getQosReqs()
Definition: Flow.cc:301
void setDstPortId(int dstPortId)
Sets destination PortId.
Definition: Flow.cc:114
void swapAddresses()
Auxiliary function swapping source and destination Addresses.
Definition: Flow.cc:219
void setMaxCreateFlowRetries(uint32_t maxCreateFlowRetries)
Sets maximum allowed number of CreateFlow retries.
Definition: Flow.cc:130
uint32_t maxCreateFlowRetries
Attribute holding maximum allowed number of CreateFlow retries.
Definition: Flow.h:410
void setHopCount(uint32_t hopCount)
Sets a new hop-count. Hop-count should be decremented each time message is forwarded within DIF...
Definition: Flow.cc:122
Address dstAddr
Attribute holding destination address (end-host for communication)
Definition: Flow.h:385
void setSrcApni(const APNamingInfo &srcApni)
Sets source APNamingInfo.
Definition: Flow.cc:138
const int VAL_MGMT_PORTID
Definition: Flow.cc:26
void setSrcNeighbor(const Address &srcNeighbor)
Sets neighbor source Address.
Definition: Flow.cc:352
int getDstPortId() const
Gets destination PortId.
Definition: Flow.cc:110
std::string infoDestination() const
Prints Flow destination information as string Outputs destination APNI, address, neigbor-address, PortId, CEP-Id.
Definition: Flow.cc:239
int srcPortId
Attribute holding source PortId.
Definition: Flow.h:370
APNamingInfo holds complete naming info for particular application process.
Definition: APNamingInfo.h:43
Flow * dupToMgmt() const
Definition: Flow.cc:356
const Address & getSrcAddr() const
Gets source Address, which is the address of communication start-point.
Definition: Flow.cc:158
const QoSReq & getQosRequirements() const
Gets QoS parameters wanted by flow initiator.
Definition: Flow.cc:176
const int VAL_MAXHOPCOUNT
Definition: Flow.cc:27
std::string getFlowName() const
Prints flow name consisting of source and destination APNI Primary use is for OMNeT++ cMessage proper...
Definition: Flow.cc:203
QoSCube qosCube
Attribute holding the assigned QoSCube.
Definition: Flow.h:421
uint32_t hopCount
Attribute holding flow's hop-count.
Definition: Flow.h:415
void setDdtFlag(bool ddtFlag)
Sets Degenerate Data Transfer flag.
Definition: Flow.cc:297
const Address & getDstNeighbor() const
Gets neighbor destination Address, which is the address of (interim) hop-by-hop destination Used duri...
Definition: Flow.cc:340
void setSrcAddr(const Address &srcAddr)
Sets (start-point) source Address.
Definition: Flow.cc:162
bool isManagementFlow() const
Definition: Flow.cc:366
QoSReq qosReqs
Attribute holding wanted QoS parameters in form of QoSReq.
Definition: Flow.h:426
uint32_t getMaxCreateFlowRetries() const
Gets maximum allowed number CreateFlow retries By default 3 (const VAL_MAXCREATERETRIES). Value is checked during Flow allocation.
Definition: Flow.cc:126
std::ostream & operator<<(std::ostream &os, const Flow &fl)
Definition: Flow.cc:336
Flow()
Constructor for the flow with undefined values.
Definition: Flow.cc:32
Address dstNeighbor
Attribute holding hop-by-hop destination address.
Definition: Flow.h:395
void setConId(const ConnectionId &conId)
Sets Flow's ConnectionId.
Definition: Flow.cc:90
virtual ~Flow()
Destructor assigning default uninitialized values.
Definition: Flow.cc:56
APNamingInfo srcApni
Attribute holding source APNI.
Definition: Flow.h:360
std::string infoSource() const
Prints Flow source information as string Outputs source APNI, address, neigbor-address, PortId, CEP-Id.
Definition: Flow.cc:229
int getSrcPortId() const
Gets source PortId.
Definition: Flow.cc:142
bool operator==(const Flow &other) const
Equal operator overloading.
Definition: Flow.cc:73
Address srcNeighbor
Attribute holding hop-by-hop source address.
Definition: Flow.h:390
std::string infoOther() const
Prints Flow create flow information and hop-cpunt as string.
Definition: Flow.cc:249
std::string infoQoS() const
Prints RA's QoSCube-id that FA choosed during Flow allocation phase Accompanied QoSParameters could b...
Definition: Flow.cc:258
const int VAL_UNDEF_PORTID
Definition: Flow.cc:25
void swapCepIds()
Auxiliary function swapping source and destination CEP-Ids.
Definition: Flow.cc:225
int dstPortId
Attribute holding destination PortId.
Definition: Flow.h:375
Class representing QoSCube with all its properties that is primarily used by FA, RMT and RA Specifica...
Definition: QoSCube.h:57
const ConnectionId & getConId() const
Gets read-only Flow's ConnectionId.
Definition: Flow.cc:86
void setSrcPortId(int srcPortId)
Sets source PortId.
Definition: Flow.cc:146
void setCreateFlowRetries(uint32_t createFlowRetries)
Sets current number of CreateFlow retries During Flow allocation phase, CreateFlow is incremented eac...
Definition: Flow.cc:98
uint32_t createFlowRetries
Attribute holding current number of allowed CreateFlow retries.
Definition: Flow.h:405
void swapApni()
Auxiliary function swapping source and destinatio APNI.
Definition: Flow.cc:305
uint32_t getCreateFlowRetries() const
Gets current number of CreateFlow retries During Flow allocation phase, CreateFlow is incremented eac...
Definition: Flow.cc:94
APNamingInfo dstApni
Attribute holding destination APNI.
Definition: Flow.h:365
Class representing QoSReq with all its properties that is primarily used by FA, RMT and RA Specificat...
Definition: QoSReq.h:44
void swapPortIds()
Auxiliary function swapping source and destination PortIds.
Definition: Flow.cc:213
void setDstNeighbor(const Address &dstNeighbor)
Sets neighbor destination Address.
Definition: Flow.cc:344
const Address & getDstAddr() const
Gets source Address, which is the address of communication end-point.
Definition: Flow.cc:150
bool compare(const Flow &other) const
Comparator taking into account src/dst addresses, src/dst APNIs, src-dst ConIds/PortIds.
Definition: Flow.cc:269
uint32_t getHopCount() const
Gets hop-count, which is number of allowed message forwards from this device towards destination By d...
Definition: Flow.cc:118
bool isManagementFlowLocalToIPCP() const
Definition: Flow.cc:370
const QoSCube & getQosCube() const
Definition: Flow.cc:171
virtual Flow * dup() const
Flow object duplication method that creates copy with.
Definition: Flow.cc:182
long allocInvokeId
Attribute holding persistant InvokeId used for allocation.
Definition: Flow.h:431
ConnectionId conId
Attribute holding ConnectionId containing source and destination CEP-Ids and chosen RA's QoSCube...
Definition: Flow.h:400
Address class holds IPC Process identification.
Definition: Address.h:42
Flow & swapFlow()
Function that swaps relevant source and destination Flow parameters It is being used mainly for count...
Definition: Flow.cc:311
const APNamingInfo & getDstApni() const
Gets read-only destination APNamingInfo.
Definition: Flow.cc:102
void setQosCube(const QoSCube &qosCube)
Definition: Flow.cc:167
void setDeallocInvokeId(long deallocInvokeId)
Sets deallocation InvokeId.
Definition: Flow.cc:289
long getDeallocInvokeId() const
Gets deallocation InvokeId Used inside M_DELETE(_R)(flow) messages.
Definition: Flow.cc:285