Child: [0fa39f] (diff)

Download this file

Flow.h    139 lines (117 with data), 4.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
#ifndef FLOW_H_
#define FLOW_H_
//Standard libraries
#include <string>
#include <sstream>
//RINASim libraries
#include "APNamingInfo.h"
#include "ConnectionId.h"
#include "Address.h"
extern const int VAL_UNDEFINED;
extern const int VAL_MAXHOPCOUNT;
extern const int VAL_MAXCREATERETRIES;
/**
* @brief Class representing flow object with attributes from specs
* @authors Vladimir Vesely (ivesely@fit.vutbr.cz)
* @date Last refactorized and documented on 2014-10-28
*/
class Flow : public cObject
{
public:
/**
* @brief Constructor for the flow with undefined values
*/
Flow();
/**
* @brief Default constructor for flow between two applications
* @param src Source application naming info
* @param dst Destination application naming info
*/
Flow(APNamingInfo src, APNamingInfo dst);
/**
* @brief Destructor assigning default uninitialized values
*/
virtual ~Flow();
/**
* @brief Equal operator overloading
* @param other Flow for comparison
* @return True if all atributes from this and other flow are equal
*/
bool operator== (const Flow& other) const;
/**
* @brief Flow object duplication method that creates copy with
* @return
*/
virtual Flow* dup() const;
std::string info() const;
std::string infoSource() const;
std::string infoDestination() const;
std::string infoOther() const;
std::string infoQoS() const;
std::string getFlowName() const;
Flow& swapFlow();
ConnectionId& getConnectionId();
const ConnectionId& getConId() const;
void setConId(const ConnectionId& conId);
uint32_t getCreateFlowRetries() const;
void setCreateFlowRetries(uint32_t createFlowRetries);
const APNamingInfo& getDstApni() const;
void setDstApni(const APNamingInfo& dstApni);
int getDstPortId() const;
void setDstPortId(int dstPortId);
uint32_t getHopCount() const;
void setHopCount(uint32_t hopCount);
uint32_t getMaxCreateFlowRetries() const;
void setMaxCreateFlowRetries(uint32_t maxCreateFlowRetries);
const APNamingInfo& getSrcApni() const;
void setSrcApni(const APNamingInfo& srcApni);
int getSrcPortId() const;
void setSrcPortId(int srcPortId);
const Address& getDstAddr() const;
void setDstAddr(const Address& dstAddr);
const Address& getSrcAddr() const;
void setSrcAddr(const Address& srcAddr);
const QosCube& getQosParameters() const;
void setQosParameters(const QosCube& qosParameters);
const Address& getDstNeighbor() const;
void setDstNeighbor(const Address& dstNeighbor);
const Address& getSrcNeighbor() const;
void setSrcNeighbor(const Address& srcNeighbor);
protected:
//Properties are based on RINA-Demo-2012-001.pdf page 6
APNamingInfo srcApni;
APNamingInfo dstApni;
int srcPortId;
int dstPortId;
Address srcAddr;
Address dstAddr;
//TODO: Vesely - Pull neighbor addresses to child class
Address srcNeighbor;
Address dstNeighbor;
ConnectionId conId;
uint32_t createFlowRetries;
uint32_t maxCreateFlowRetries;
uint32_t hopCount;
QosCube qosParameters;
void swapPortIds();
void swapAddresses();
void swapCepIds();
void swapApni();
};
//Free function
std::ostream& operator<< (std::ostream& os, const Flow& fl);
#endif /* FLOW_H_ */