20 : maxRtx(maxRtx1),
myAdr(myAdr1), ctt(ctt1) {
21 tbl =
new RouteEntry[
maxRtx+1];
36 int RouteTable::addEntry(
comt_t comt,
fAdr_t adr,
int cLnk) {
38 int rtx =
rteMap->addPair(key(comt,adr));
39 if (rtx == 0)
return 0;
43 tbl[rtx].links =
new set<int>();
45 tbl[rtx].links->insert(cLnk);
60 void RouteTable::removeEntry(
int rtx) {
61 if (!validRteIndex(rtx))
return;
63 set<int>& links = *(tbl[rtx].links);
64 set<int>::iterator lp;
65 for (lp = links.begin(); lp != links.end(); lp++)
67 delete tbl[rtx].links;
69 rteMap->dropPair(key(tbl[rtx].ct,tbl[rtx].adr));
75 void RouteTable::purgeRoutes(
comt_t comt) {
78 set<int>::iterator lp;
79 for (lp = links.begin(); lp != links.end(); lp++) {
82 set<int>::iterator rp;
83 int *rvec =
new int[routes.size()];
int i = 0;
84 for (rp = routes.begin(); rp != routes.end(); rp++)
86 while (--i >= 0) removeEntry(rvec[i]);
101 bool RouteTable::readEntry(istream& in) {
102 int comt, lnk;
fAdr_t adr;
106 int rtx = addEntry(comt,adr,0);
107 if (rtx == 0)
return false;
111 removeEntry(rtx);
return false;
114 if (cLnk == 0)
return false;
119 removeEntry(rtx);
return false;
123 if (cLnk == 0)
return false;
140 for (
int i = 1; i <= num; i++) {
141 if (!readEntry(in)) {
142 cerr <<
"Error in route table entry # " << i << endl;
160 if (
noLinks(rtx)) { ss <<
"-\n"; s = ss.str();
return s; }
162 set<int>& subLinks = getSubLinks(rtx);
163 set<int>::iterator p;
164 for (p = subLinks.begin(); p != subLinks.end(); p++) {
165 if (first) first =
false;
183 ss <<
rteMap->size() << endl;
184 for (
int rtx = firstRteIndex(); rtx != 0; rtx = nextRteIndex(rtx))