#include <flowstruct.h>
Collaboration diagram for FlowTable:

Public Member Functions | |
| FlowTable (int size_=FLOW_TABLE_SIZE) | |
| ~FlowTable () | |
| TableEntry & | operator[] (int index) |
| int | find (nsaddr_t source, nsaddr_t destination, u_int16_t flow) |
| int | find (nsaddr_t source, nsaddr_t destination, const Path &route) |
| int | createEntry (nsaddr_t source, nsaddr_t destination, u_int16_t flow) |
| bool | defaultFlow (nsaddr_t source, nsaddr_t destination, u_int16_t &flow) |
| u_int16_t | generateNextFlowId (nsaddr_t destination, bool allowDefault) |
| void | noticeDeadLink (const ID &from, const ID &to) |
| void | cleanup () |
| void | setNetAddr (nsaddr_t net_id) |
Private Member Functions | |
| void | grow () |
Private Attributes | |
| TableEntry * | table |
| int | size |
| int | maxSize |
| u_int16_t | counter |
| nsaddr_t | net_addr |
| DRTable | DRTab |
|
|
Definition at line 30 of file flowstruct.cc. References counter, maxSize, size, and table.
|
|
|
Definition at line 38 of file flowstruct.cc. References table.
00038 {
00039 delete table;
00040 }
|
|
|
Definition at line 130 of file flowstruct.cc. References checkDefaultFlow(), Scheduler::clock(), DRTab, Scheduler::instance(), size, table, and TableEntry::timeout. Referenced by DSRAgent::handleFlowForwarding(), and DSRAgent::sendOutPacketWithRoute().
00130 {
00131 int front, back;
00132 double now = Scheduler::instance().clock();
00133
00134 return; // it's messing up path orders...
00135
00136 // init front to the first expired entry
00137 for (front=0; (front<size) && (table[front].timeout >= now); front++)
00138 ;
00139
00140 // init back to the last unexpired entry
00141 for (back = size-1; (front<back) && (table[back].timeout < now); back--)
00142 checkDefaultFlow(DRTab, table[back]);
00143
00144 while (front < back) {
00145 checkDefaultFlow(DRTab, table[front]);
00146 bcopy(table+back, table+front, sizeof(TableEntry)); // swap
00147 back--;
00148
00149 // next expired entry
00150 while ((front<back) && (table[front].timeout >= now))
00151 front++;
00152 while ((front<back) && (table[back].timeout < now)) {
00153 checkDefaultFlow(DRTab, table[back]);
00154 back--;
00155 }
00156 }
00157
00158 size = back+1;
00159 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 88 of file flowstruct.cc. References DRTab, find(), grow(), DRTable::insert(), maxSize, size, and table. Referenced by DSRAgent::handleFlowForwarding(), and DSRAgent::sendOutPacketWithRoute().
00089 {
00090 if (find(source, destination, flow) != -1)
00091 return -1;
00092 if (size == maxSize)
00093 grow();
00094 if (size == maxSize)
00095 return -1;
00096
00097 table[size].sourceIP = source;
00098 table[size].destinationIP = destination;
00099 table[size].flowId = flow;
00100
00101 if (flow & 1)
00102 DRTab.insert(source, destination, flow);
00103
00104 return size++;
00105 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 165 of file flowstruct.cc. References DRTab, and DRTable::find(). Referenced by DSRAgent::handleDefaultForwarding(), DSRAgent::processFlowARS(), DSRAgent::processUnknownFlowError(), DSRAgent::sendOutPacketWithRoute(), and DSRAgent::xmitFlowFailed().
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 58 of file flowstruct.cc. References TableEntry::destinationIP, size, TableEntry::sourceIP, and table.
00058 {
00059 register int i;
00060 for (i=size-1; i>=0; i--)
00061 if (table[i].sourceIP == source &&
00062 table[i].destinationIP == destination &&
00063 table[i].sourceRoute == route)
00064 break;
00065
00066 return i;
00067 }
|
|
||||||||||||||||
|
Definition at line 47 of file flowstruct.cc. References TableEntry::destinationIP, size, TableEntry::sourceIP, and table. Referenced by createEntry(), DSRAgent::handleDefaultForwarding(), DSRAgent::handleFlowForwarding(), DSRAgent::processFlowARS(), DSRAgent::processUnknownFlowError(), DSRAgent::sendOutPacketWithRoute(), and DSRAgent::xmitFlowFailed().
00047 {
00048 register int i;
00049 for (i=size-1; i>=0; i--)
00050 if (table[i].sourceIP == source &&
00051 table[i].destinationIP == destination &&
00052 table[i].flowId == flow)
00053 break;
00054
00055 return i;
00056 }
|
|
||||||||||||
|
Definition at line 80 of file flowstruct.cc. References counter, and u_int16_t. Referenced by DSRAgent::sendOutPacketWithRoute().
|
|
|
Definition at line 69 of file flowstruct.cc. References maxSize, and table. Referenced by createEntry().
00069 {
00070 assert(0);
00071 TableEntry *temp;
00072 if (!(temp = new TableEntry[maxSize*2]))
00073 return;
00074 bcopy(table, temp, sizeof(TableEntry)*maxSize);
00075 delete table;
00076 maxSize *= 2;
00077 table = temp;
00078 }
|
|
||||||||||||
|
Definition at line 107 of file flowstruct.cc. References Scheduler::clock(), Scheduler::instance(), net_addr, size, TableEntry::sourceIP, table, and TableEntry::timeout. Referenced by DSRAgent::processBrokenRouteError(), and DSRAgent::xmitFailed().
00107 {
00108 double now = Scheduler::instance().clock();
00109
00110 for (int i=0; i<size; i++)
00111 if (table[i].timeout >= now && table[i].sourceIP == net_addr)
00112 for (int n=0; n < (table[i].sourceRoute.length()-1); n++)
00113 if (table[i].sourceRoute[n] == from &&
00114 table[i].sourceRoute[n+1] == to) {
00115 table[i].timeout = now - 1;
00116 // XXX ych rediscover??? 5/2/01
00117 }
00118 }
|
Here is the call graph for this function:

|
|
Definition at line 42 of file flowstruct.cc.
00042 {
00043 assert(index >= 0 && index < size);
00044 return table[index];
00045 }
|
|
|
Definition at line 161 of file flowstruct.cc. References net_addr. Referenced by DSRAgent::command().
00161 {
00162 net_addr = net_id;
00163 }
|
|
|
Definition at line 178 of file flowstruct.h. Referenced by FlowTable(), and generateNextFlowId(). |
|
|
Definition at line 180 of file flowstruct.h. Referenced by cleanup(), createEntry(), and defaultFlow(). |
|
|
Definition at line 176 of file flowstruct.h. Referenced by createEntry(), FlowTable(), and grow(). |
|
|
Definition at line 179 of file flowstruct.h. Referenced by noticeDeadLink(), and setNetAddr(). |
|
|
Definition at line 175 of file flowstruct.h. Referenced by cleanup(), createEntry(), find(), FlowTable(), noticeDeadLink(), and operator[](). |
|
|
Definition at line 174 of file flowstruct.h. Referenced by cleanup(), createEntry(), find(), FlowTable(), grow(), noticeDeadLink(), operator[](), and ~FlowTable(). |
1.3.3