Parent: [62f79d] (diff)

Download this file

FAIListeners.cc    139 lines (116 with data), 5.3 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
#include "FAI.h"
#include "FAIListeners.h"
FAIListeners::FAIListeners(FAI* nfai) {
this->fai = nfai;
}
FAIListeners::~FAIListeners() {
// TODO Auto-generated destructor stub
}
void LisFAIAllocResPosi::receiveSignal(cComponent* src, simsignal_t id,
cObject* obj) {
EV << "AllocateResponsePositive initiated by " << src->getFullPath() << " and processed by " << fai->getFullPath() << endl;
Flow* fl = dynamic_cast<Flow*>(obj);
if (fai->getFlow() == fl)
fai->receiveAllocateResponsePositive();
}
void LisFAIAllocResNega::receiveSignal(cComponent* src, simsignal_t id,
cObject* obj) {
EV << "AllocateResponseNegative initiated by " << src->getFullPath() << " and processed by " << fai->getFullPath() << endl;
Flow* fl = dynamic_cast<Flow*>(obj);
if (fai->getFlow() == fl)
fai->receiveAllocateResponseNegative();
}
void LisFAIAllocReq::receiveSignal(cComponent* src, simsignal_t id,
cObject* obj) {
EV << "AllocateRequest initiated by " << src->getFullPath() << " and processed by " << fai->getFullPath() << endl;
Flow* fl = dynamic_cast<Flow*>(obj);
if ( fai->getFlow()->compare(*fl) )
fai->receiveAllocateRequest();
}
void LisFAICreReq::receiveSignal(cComponent* src, simsignal_t id,
cObject* obj) {
EV << "CreateRequest initiated by " << src->getFullPath() << " and processed by " << fai->getFullPath() << endl;
fai->receiveCreateRequest();
}
void LisFAICreResPosi::receiveSignal(cComponent* src, simsignal_t id,
cObject* obj) {
EV << "CreateResponsePositive initiated by " << src->getFullPath()
<< " and processed by " << fai->getFullPath() << endl;
Flow* flow = dynamic_cast<Flow*>(obj);
if (flow) {
//Only FAI with same CepId and PortId process this call
if (fai->getFlow()->getSrcPortId() == flow->getSrcPortId()
&& fai->getFlow()->getConId().getSrcCepId() == flow->getConId().getSrcCepId() ) {
//EV << "A!!!!!!!!!!!!!!IN" << endl;
fai->receiveCreateResponsePositive(flow);
}
}
else
EV << "FAIListener received unknown object!" << endl;
}
void LisFAICreResNega::receiveSignal(cComponent* src, simsignal_t id,
cObject* obj) {
EV << "CreateResponseNegative initiated by " << src->getFullPath()
<< " and processed by " << fai->getFullPath() << endl;
Flow* flow = dynamic_cast<Flow*>(obj);
if (flow) {
//Only FAI with same CepId and PortId process this call
if (fai->getFlow()->getSrcPortId() == flow->getSrcPortId()
&& fai->getFlow()->getConId().getSrcCepId() == flow->getConId().getSrcCepId() )
fai->receiveCreateResponseNegative(flow);
}
else
EV << "FAIListener received unknown object!" << endl;
}
void LisFAIDelRes::receiveSignal(cComponent* src, simsignal_t id,
cObject* obj) {
EV << "DeleteResponse initiated by " << src->getFullPath()
<< " and processed by " << fai->getFullPath() << endl;
Flow* flow = dynamic_cast<Flow*>(obj);
if (flow) {
if ( fai->getFlow()->compare(*flow) )
fai->receiveDeleteResponse();
}
else
EV << "FAIListener received unknown object!" << endl;
}
void LisFAIDelReq::receiveSignal(cComponent* src, simsignal_t id,
cObject* obj) {
EV << "DeleteRequest initiated by " << src->getFullPath() << " and processed by " << fai->getFullPath() << endl;
Flow* fl = dynamic_cast<Flow*>(obj);
// EV << fl->info() << endl << "=================="<< endl << fai->getFlow()->info();
// EV << "srcAPNI = " << (fai->getFlow()->getSrcApni() == fl->getSrcApni()) << endl
// << "dstAPNI = " << (fai->getFlow()->getDstApni() == fl->getDstApni()) << endl
// << "srcPortId = " << (fai->getFlow()->getSrcPortId() == fl->getSrcPortId()) << endl
// << "dstPortId = " << (fai->getFlow()->getDstPortId() == fl->getDstPortId()) << endl
// << "srcAddr = " << (fai->getFlow()->getSrcAddr() == fl->getSrcAddr()) << endl
// << "dstAddr = " << (fai->getFlow()->getDstAddr() == fl->getDstAddr()) << endl;
// EV << "Vysledek> " << (fai->getFlow() == fl) << endl;
if ( fai->getFlow()->compare(*fl) )
fai->receiveDeleteRequest();
}
void LisFAICreResPosiNminusOne::receiveSignal(cComponent* src, simsignal_t id,
cObject* obj) {
EV << "CreateResponsePositiveNminusOne initiated by " << src->getFullPath()
<< " and processed by " << fai->getFullPath() << endl;
Flow* flow = dynamic_cast<Flow*>(obj);
if (flow) {
if (fai->getFa()->getMyAddress().getApname() == flow->getSrcApni().getApn() ) {
//EV << "B!!!!!!!!!!!!!!IN" << endl;
fai->receiveCreateFlowResponsePositiveFromNminusOne();
}
}
else
EV << "FAIListener received unknown object!" << endl;
}
void LisFAICreResNegaNminusOne::receiveSignal(cComponent* src, simsignal_t id,
cObject* obj) {
Flow* flow = dynamic_cast<Flow*>(obj);
if (flow) {
if (fai->getFa()->getMyAddress().getApname() == flow->getSrcApni().getApn() )
fai->receiveCreateFlowResponseNegativeFromNminusOne();
}
else
EV << "FAIListener received unknown object!" << endl;
}