44 if(
Im == n_addr) {
return vector<Port>(); }
45 if(n_addr.
type < 0 || n_addr.
type > 3) {
46 cerr <<
"Invalid dst addr ("<<n_addr<<
")" << endl;
47 return vector<Port>();
50 auto r =
table.find(n_addr);
51 if(r !=
table.end()) {
53 if(!e.entryType) {
return vector<Port>(); }
58 if(e.inverseStorage == (e.ports.find(p) == e.ports.end()) ) {
65 if(n_addr.
type == 2 && n_addr.
a ==
Im.
b) {
70 }
else { cout <<
"!!! Invalid port to " << (n_addr.
b) <<
" at " <<
Im << endl; }
78 cerr <<
"Invalid neighbour ("<<n_addr<<
") found for Edge " <<
Im<<endl;
95 for(
auto & e :
table) {
96 if(e.second.ports.find(t) != e.second.ports.end()) {
97 e.second.ports.erase(t);
99 e.second.ports.insert(port);
108 if(n_addr ==
Im) {
return; }
110 if(n_addr.
type < 0 || n_addr.
type > 3) {
111 cerr <<
"Invalid dst addr ("<<n_addr<<
")" << endl;
123 for(
const auto & n : next) {
128 if(n_addr.
type == 2 && n_addr.
a ==
Im.
b) {
129 if(S == 1 && pIds.find(n_addr.
b) != pIds.end()){
157 if(par(
"printAtEnd").boolValue()) {
158 cout <<
"-----------------------" << endl;
159 cout <<
"SimpleEdgeForwarding at "<< endl;
160 cout <<
" " << getFullPath() << endl;
162 cout <<
"I'm Edge "<<
Im << endl;
164 cout <<
"\tDown neighbours:" << endl;
166 cout <<
"\t\t1."<<
Im.
a<<
"."<<i<<
" -> Status "<< (
portsArray[i]!=
nullptr?
"ON":
"OFF") << endl;
170 cout <<
"\tNo entries stored" << endl;
172 cout <<
"Stored entries " <<
table.size() << endl;
173 for(
auto & e :
table) {
174 cout <<
"\t\t"<< e.first <<
" -- ";
175 if(e.second.entryType ==
false) {
176 cout <<
"Unreachable";
178 if(e.second.inverseStorage) {
179 cout <<
"(inverse) ";
181 cout << e.second.ports.size() <<
" stored ports:";
184 for(
auto &k : e.second.ports) {
185 cout <<
"\t\t\t" << k->getFullPath() << endl;
Register_Class(SimpleDCGenerator)
eFWDEntry getFWDEntry(const set< int > &pIds)
virtual void refreshCache(Port oldP, Port newP)
void setDst(const DCAddr &n_addr, const set< DCAddr > &next)
bool setNeigh(const DCAddr &n_addr, Port port)
vector< Port > search(const DCAddr &n_addr)
map< DCAddr, eFWDEntry > table