|
a |
|
b/src/DAF/IRM/ConnectionTableEntry.cc |
|
|
1 |
//
|
|
|
2 |
// This program is free software: you can redistribute it and/or modify
|
|
|
3 |
// it under the terms of the GNU Lesser General Public License as published by
|
|
|
4 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
5 |
// (at your option) any later version.
|
|
|
6 |
//
|
|
|
7 |
// This program is distributed in the hope that it will be useful,
|
|
|
8 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
9 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
10 |
// GNU Lesser General Public License for more details.
|
|
|
11 |
//
|
|
|
12 |
// You should have received a copy of the GNU Lesser General Public License
|
|
|
13 |
// along with this program. If not, see http://www.gnu.org/licenses/.
|
|
|
14 |
//
|
|
|
15 |
|
|
|
16 |
#include <ConnectionTableEntry.h>
|
|
|
17 |
|
|
|
18 |
ConnectionTableEntry::ConnectionTableEntry()
|
|
|
19 |
: FlowObject(NULL), conStatus(UNKNOWN),
|
|
|
20 |
northGateIn(NULL), northGateOut(NULL),
|
|
|
21 |
southGateIn(NULL), southGateOut(NULL),
|
|
|
22 |
FlowAlloc(NULL)
|
|
|
23 |
{
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
ConnectionTableEntry::ConnectionTableEntry(Flow* flow)
|
|
|
27 |
: FlowObject(flow), conStatus(FLOWPENDING),
|
|
|
28 |
northGateIn(NULL), northGateOut(NULL),
|
|
|
29 |
southGateIn(NULL), southGateOut(NULL),
|
|
|
30 |
FlowAlloc(NULL)
|
|
|
31 |
{
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
ConnectionTableEntry::ConnectionTableEntry(Flow* flow, cGate* nIn, cGate* nOut)
|
|
|
35 |
: FlowObject(flow), conStatus(FLOWPENDING),
|
|
|
36 |
northGateIn(nIn), northGateOut(nOut),
|
|
|
37 |
southGateIn(NULL), southGateOut(NULL),
|
|
|
38 |
FlowAlloc(NULL)
|
|
|
39 |
{
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
ConnectionTableEntry::~ConnectionTableEntry() {
|
|
|
43 |
this->FlowObject = NULL;
|
|
|
44 |
this->conStatus = UNKNOWN;
|
|
|
45 |
this->northGateIn = NULL;
|
|
|
46 |
this->northGateOut = NULL;
|
|
|
47 |
this->southGateIn = NULL;
|
|
|
48 |
this->southGateOut = NULL;
|
|
|
49 |
this->FlowAlloc = NULL;
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
std::string ConnectionTableEntry::info() const {
|
|
|
53 |
std::stringstream os;
|
|
|
54 |
if (FlowObject)
|
|
|
55 |
os << FlowObject->info() << "\n";
|
|
|
56 |
if (FlowAlloc)
|
|
|
57 |
os << "FA path: " << FlowAlloc->getFullPath() << "\n";
|
|
|
58 |
if (northGateIn && northGateOut)
|
|
|
59 |
os << "northIn: " << this->northGateIn->getName() << "[" << this->northGateIn->getIndex() << "]"
|
|
|
60 |
<< "\tnorthOut: " << this->northGateOut->getName() << "[" << this->northGateIn->getIndex() << "]\n";
|
|
|
61 |
if (southGateIn && southGateOut)
|
|
|
62 |
os << "southIn: " << this->southGateIn->getName()
|
|
|
63 |
<< "\tsouthOut: " << this->southGateOut->getName() << "\n";
|
|
|
64 |
os << "status: " << this->getConnectionStatusString();
|
|
|
65 |
return os.str();
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
std::string ConnectionTableEntry::getConnectionStatusString() const {
|
|
|
69 |
switch(this->conStatus)
|
|
|
70 |
{
|
|
|
71 |
case NIL: return "NULL";
|
|
|
72 |
case FLOWPENDING: return "flowpending";
|
|
|
73 |
case CONNECTPENDING: return "connectpending";
|
|
|
74 |
case AUTHENTICATING: return "authenticating";
|
|
|
75 |
case ESTABLISHED: return "established";
|
|
|
76 |
case RELEASING: return "releasing";
|
|
|
77 |
case UNKNOWN:
|
|
|
78 |
default: return "UNKNOWN";
|
|
|
79 |
}
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
void ConnectionTableEntry::setConStatus(ConnectionStatus conStatus) {
|
|
|
83 |
this->conStatus = conStatus;
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
std::ostream& operator <<(std::ostream& os, const ConnectionTableEntry& cte) {
|
|
|
87 |
return os << cte.info();
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
FABase* ConnectionTableEntry::getFlowAlloc() const {
|
|
|
91 |
return FlowAlloc;
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
void ConnectionTableEntry::setFlowAlloc(FABase* flowAlloc) {
|
|
|
95 |
FlowAlloc = flowAlloc;
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
Flow* ConnectionTableEntry::getFlowObject() const {
|
|
|
99 |
return FlowObject;
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
void ConnectionTableEntry::setFlowObject(Flow* flowObject) {
|
|
|
103 |
FlowObject = flowObject;
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
cGate* ConnectionTableEntry::getNorthGateIn() const {
|
|
|
107 |
return northGateIn;
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
void ConnectionTableEntry::setNorthGateIn(cGate* northGateIn) {
|
|
|
111 |
this->northGateIn = northGateIn;
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
cGate* ConnectionTableEntry::getNorthGateOut() const {
|
|
|
115 |
return northGateOut;
|
|
|
116 |
}
|
|
|
117 |
|
|
|
118 |
void ConnectionTableEntry::setNorthGateOut(cGate* northGateOut) {
|
|
|
119 |
this->northGateOut = northGateOut;
|
|
|
120 |
}
|
|
|
121 |
|
|
|
122 |
cGate* ConnectionTableEntry::getSouthGateIn() const {
|
|
|
123 |
return southGateIn;
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
void ConnectionTableEntry::setSouthGateIn(cGate* southGateIn) {
|
|
|
127 |
this->southGateIn = southGateIn;
|
|
|
128 |
}
|
|
|
129 |
|
|
|
130 |
cGate* ConnectionTableEntry::getSouthGateOut() const {
|
|
|
131 |
return southGateOut;
|
|
|
132 |
}
|
|
|
133 |
|
|
|
134 |
void ConnectionTableEntry::setSouthGateOut(cGate* southGateOut) {
|
|
|
135 |
this->southGateOut = southGateOut;
|
|
|
136 |
}
|
|
|
137 |
|
|
|
138 |
cModule* ConnectionTableEntry::getIpc() const {
|
|
|
139 |
return FlowAlloc->getParentModule()->getParentModule();
|
|
|
140 |
}
|