ARSTable Class Reference

#include <flowstruct.h>

Collaboration diagram for ARSTable:

Collaboration graph
[legend]

Detailed Description

Definition at line 78 of file flowstruct.h.

Public Member Functions

 ARSTable (int size_=ARS_TABLE_SIZE)
int findAndClear (int uid, u_int16_t fid)
void insert (int uid, u_int16_t fid, int hopsEarly)
 ~ARSTable ()

Private Attributes

int size
ARSTabEnttable
int victim


Constructor & Destructor Documentation

ARSTable::ARSTable int  size_ = ARS_TABLE_SIZE  ) 
 

Definition at line 261 of file flowstruct.cc.

References size, table, and victim.

00261                             {
00262     size = size_;
00263     victim = 0;
00264     table = new ARSTabEnt[size_];
00265     bzero(table, sizeof(ARSTabEnt)*size_);
00266 }

ARSTable::~ARSTable  ) 
 

Definition at line 268 of file flowstruct.cc.

References table.

00268                     {
00269     delete table;
00270 }


Member Function Documentation

int ARSTable::findAndClear int  uid,
u_int16_t  fid
 

Definition at line 290 of file flowstruct.cc.

References ARSTabEnt::hopsEarly, size, and table.

00290                                                  {
00291     int i, retval;
00292 
00293     for (i=0; i<size; i++) {
00294             if (table[i].hopsEarly && table[i].uid == uid) {
00295                 if (table[i].fid == fid) {
00296                     retval = table[i].hopsEarly;
00297                 table[i].hopsEarly = 0;
00298                 return retval;
00299             } else {
00300                 table[i].hopsEarly = 0;
00301                 return 0;
00302             }
00303         }
00304     }
00305 
00306     return 0;
00307 }

void ARSTable::insert int  uid,
u_int16_t  fid,
int  hopsEarly
 

Definition at line 272 of file flowstruct.cc.

References ARSTabEnt::fid, ARSTabEnt::hopsEarly, size, table, ARSTabEnt::uid, and victim.

00272                                                            {
00273     int i = victim;
00274     assert(hopsEarly);
00275     
00276     do {
00277         if (!table[i].hopsEarly)
00278             break; // we found a victim
00279         i = (i+1)%size;
00280     } while (i != victim);
00281 
00282     if (table[i].hopsEarly) // full. need extreme measures.
00283         victim = (victim+1)%size;
00284 
00285     table[i].hopsEarly = hopsEarly;
00286     table[i].uid       = uid;
00287     table[i].fid       = fid;
00288 }


Field Documentation

int ARSTable::size [private]
 

Definition at line 88 of file flowstruct.h.

Referenced by ARSTable(), findAndClear(), and insert().

ARSTabEnt* ARSTable::table [private]
 

Definition at line 86 of file flowstruct.h.

Referenced by ARSTable(), findAndClear(), insert(), and ~ARSTable().

int ARSTable::victim [private]
 

Definition at line 87 of file flowstruct.h.

Referenced by ARSTable(), and insert().


The documentation for this class was generated from the following files:
Generated on Tue Mar 6 17:03:14 2007 for ns2 Network Simulator 2.29 by  doxygen 1.4.6