RINASim  October 2016
Documentation of framework for OMNeT++
NM1FlowTableItem.cc
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 #include <NM1FlowTableItem.h>
24 
25 NM1FlowTableItem::NM1FlowTableItem(Flow* flow, FABase* fa, RMTPort* port, std::string gateName)
26 : flow(flow), fa(fa), rmtPort(port), gateName(gateName), conStatus(CON_CONNECTPENDING)
27 {
28 }
29 
31 
32 }
33 
34 std::string NM1FlowTableItem::info() const {
35  std::ostringstream os;
36 
37 
38  os << flow->info() << endl;
39  os << "FA path: " << fa->getFullPath() << endl;
40  os << "status: " << getConnectionStatusString() << endl;
41  os << "RMT port: " << rmtPort->getFullName() << endl;
42 
43  return os.str();
44 }
45 
47  switch(this->conStatus)
48  {
49  case CON_NIL: return "null";
50  case CON_FLOWPENDING: return "flowpending";
51  case CON_CONNECTPENDING: return "connectpending";
52  case CON_AUTHENTICATING: return "authenticating";
53  case CON_ESTABLISHED: return "established";
54  case CON_RELEASING: return "releasing";
55  case CON_ERROR:
56  default: return "UNKNOWN";
57  }
58 }
59 
60 
62 {
63  return this->conStatus;
64 }
65 
67  this->conStatus = conStatus;
68 }
69 
70 std::ostream& operator <<(std::ostream& os, const NM1FlowTableItem& cte) {
71  return os << cte.info();
72 }
73 
75 {
76  return flow;
77 }
78 
79 
81 {
82  return fa;
83 }
84 
86 {
87  return rmtPort;
88 }
89 
90 
92 {
93  return rmtPort->getInputQueues();
94 }
95 
96 
98 {
99  return rmtPort->getOutputQueues();
100 }
101 
102 
103 std::string NM1FlowTableItem::getGateName() const
104 {
105  return gateName;
106 }
107 
108 
109 
Class representing flow object with attributes from specs.
Definition: Flow.h:45
std::string getConnectionStatusString() const
std::ostream & operator<<(std::ostream &os, const NM1FlowTableItem &cte)
const RMTQueues & getRMTInputQueues() const
RMTPort * getRMTPort() const
std::string info() const
Prints Flow information as string Calls variety of other info functions to produce final output...
Definition: Flow.cc:327
RMTQueues & getInputQueues()
Definition: RMTPort.cc:174
std::string gateName
FABase * getFABase() const
std::string info() const
RMTQueues & getOutputQueues()
Definition: RMTPort.cc:179
virtual ~NM1FlowTableItem()
Flow * getFlow() const
const RMTQueues & getRMTOutputQueues() const
std::string getGateName() const
Definition: FABase.h:33
ConnectionStatus conStatus
ConnectionStatus getConnectionStatus()
NM1FlowTableItem(Flow *flow, FABase *fa, RMTPort *port, std::string gateName)
std::vector< RMTQueue * > RMTQueues
Definition: RMTQueue.h:180
void setConnectionStatus(ConnectionStatus status)