|
a |
|
b/src/DIF/RIB/RIBdListeners.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 "RIBdListeners.h"
|
|
|
17 |
|
|
|
18 |
RIBdListeners::RIBdListeners(RIBdBase* nribd) : ribd(nribd)
|
|
|
19 |
{
|
|
|
20 |
}
|
|
|
21 |
|
|
|
22 |
RIBdListeners::~RIBdListeners() {
|
|
|
23 |
ribd = NULL;
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
void LisRIBDCreReq::receiveSignal(cComponent* src, simsignal_t id, cObject* obj) {
|
|
|
27 |
EV << "CreateRequest initiated by " << src->getFullPath()
|
|
|
28 |
<< " and processed by " << ribd->getFullPath() << endl;
|
|
|
29 |
Flow* flow = dynamic_cast<Flow*>(obj);
|
|
|
30 |
if (flow)
|
|
|
31 |
ribd->sendCreateRequestFlow(flow);
|
|
|
32 |
else
|
|
|
33 |
EV << "RIBdListener received unknown object!" << endl;
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
void LisRIBDRcvData::receiveSignal(cComponent* src, simsignal_t id,
|
|
|
37 |
cObject* obj) {
|
|
|
38 |
EV << "ReceiveData initiated by " << src->getFullPath()
|
|
|
39 |
<< " and processed by " << ribd->getFullPath() << endl;
|
|
|
40 |
CDAPMessage* cimsg = dynamic_cast<CDAPMessage*>(obj);
|
|
|
41 |
if (cimsg) {
|
|
|
42 |
ribd->receiveData(cimsg);
|
|
|
43 |
}
|
|
|
44 |
else
|
|
|
45 |
EV << "RIBdListener received unknown object!" << endl;
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
void LisRIBDAllReqFromFai::receiveSignal(cComponent* src, simsignal_t id,
|
|
|
49 |
cObject* obj) {
|
|
|
50 |
EV << "AllocationRequest{fromFAI} initiated by " << src->getFullPath()
|
|
|
51 |
<< " and processed by " << ribd->getFullPath() << endl;
|
|
|
52 |
Flow* flow = dynamic_cast<Flow*>(obj);
|
|
|
53 |
if (flow) {
|
|
|
54 |
//Check whether dstApp is local...
|
|
|
55 |
const APN dstApn = flow->getSrcApni().getApn();
|
|
|
56 |
if (ribd->getMyAddress().getApname() == dstApn)
|
|
|
57 |
ribd->receiveAllocationRequestFromFai(flow);
|
|
|
58 |
}
|
|
|
59 |
else
|
|
|
60 |
EV << "RIBdListener received unknown object!" << endl;
|
|
|
61 |
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
void LisRIBDCreResNega::receiveSignal(cComponent* src, simsignal_t id,
|
|
|
65 |
cObject* obj) {
|
|
|
66 |
EV << "CreateResponseFlowNegative initiated by " << src->getFullPath()
|
|
|
67 |
<< " and processed by " << ribd->getFullPath() << endl;
|
|
|
68 |
Flow* flow = dynamic_cast<Flow*>(obj);
|
|
|
69 |
if (flow)
|
|
|
70 |
ribd->sendCreateResponseNegative(flow);
|
|
|
71 |
else
|
|
|
72 |
EV << "RIBdListener received unknown object!" << endl;
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
void LisRIBDCreResPosi::receiveSignal(cComponent* src, simsignal_t id,
|
|
|
76 |
cObject* obj) {
|
|
|
77 |
EV << "CreateResponseFlowPositive initiated by " << src->getFullPath()
|
|
|
78 |
<< " and processed by " << ribd->getFullPath() << endl;
|
|
|
79 |
Flow* flow = dynamic_cast<Flow*>(obj);
|
|
|
80 |
if (flow)
|
|
|
81 |
ribd->sendCreateResponsePostive(flow);
|
|
|
82 |
else
|
|
|
83 |
EV << "RIBdListener received unknown object!" << endl;
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
void LisRIBDDelReq::receiveSignal(cComponent* src, simsignal_t id,
|
|
|
87 |
cObject* obj) {
|
|
|
88 |
EV << "DeleteRequest initiated by " << src->getFullPath()
|
|
|
89 |
<< " and processed by " << ribd->getFullPath() << endl;
|
|
|
90 |
Flow* flow = dynamic_cast<Flow*>(obj);
|
|
|
91 |
if (flow)
|
|
|
92 |
ribd->sendDeleteRequestFlow(flow);
|
|
|
93 |
else
|
|
|
94 |
EV << "RIBdListener received unknown object!" << endl;
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
void LisRIBDDelRes::receiveSignal(cComponent* src, simsignal_t id,
|
|
|
98 |
cObject* obj) {
|
|
|
99 |
EV << "DeleteResponse initiated by " << src->getFullPath()
|
|
|
100 |
<< " and processed by " << ribd->getFullPath() << endl;
|
|
|
101 |
Flow* flow = dynamic_cast<Flow*>(obj);
|
|
|
102 |
if (flow)
|
|
|
103 |
ribd->sendDeleteResponseFlow(flow);
|
|
|
104 |
else
|
|
|
105 |
EV << "RIBdListener received unknown object!" << endl;
|
|
|
106 |
}
|
|
|
107 |
|
|
|
108 |
void LisRIBDCreFloNega::receiveSignal(cComponent* src, simsignal_t id,
|
|
|
109 |
cObject* obj) {
|
|
|
110 |
EV << "CreateFlowNega initiated by " << src->getFullPath()
|
|
|
111 |
<< " and processed by " << ribd->getFullPath() << endl;
|
|
|
112 |
Flow* flow = dynamic_cast<Flow*>(obj);
|
|
|
113 |
if (flow)
|
|
|
114 |
ribd->receiveCreateFlowNegativeFromRa(flow);
|
|
|
115 |
else
|
|
|
116 |
EV << "RIBdListener received unknown object!" << endl;
|
|
|
117 |
|
|
|
118 |
}
|
|
|
119 |
|
|
|
120 |
void LisRIBDCreFloPosi::receiveSignal(cComponent* src, simsignal_t id,
|
|
|
121 |
cObject* obj) {
|
|
|
122 |
EV << "CreateFlowNegative initiated by " << src->getFullPath()
|
|
|
123 |
<< " and processed by " << ribd->getFullPath() << endl;
|
|
|
124 |
Flow* flow = dynamic_cast<Flow*>(obj);
|
|
|
125 |
if (flow)
|
|
|
126 |
ribd->receiveCreateFlowPositiveFromRa(flow);
|
|
|
127 |
else
|
|
|
128 |
EV << "RIBdListener received unknown object!" << endl;
|
|
|
129 |
|
|
|
130 |
}
|