Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

Diff_Routing_Entry Class Reference

#include <routing_table.h>

Collaboration diagram for Diff_Routing_Entry:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Diff_Routing_Entry ()
void reset ()
void clear_outlist (Out_List *)
void clear_inlist (In_List *)
void clear_agentlist (Agent_List *)
int MostRecvOrg ()
bool ExistOriginalGradient ()
void IncRecvCnt (ns_addr_t)
void CntPosSend (ns_addr_t)
void CntNeg (ns_addr_t)
void CntNewSub (ns_addr_t)
void ClrNewSub (ns_addr_t)
void CntNewOrg (ns_addr_t)
void CntOldOrg (ns_addr_t)
void ClrAllNewOrg ()
void ClrAllOldOrg ()
In_ListMostRecentIn ()
In_ListAddInList (ns_addr_t)

Public Attributes

int counter
int num_active
int num_iif
Out_Listactive
Out_Listinactive
In_Listiif
In_Listdown_iif
Agent_Listsource
Agent_Listsink
double last_fwd_time
int new_org_counter

Constructor & Destructor Documentation

Diff_Routing_Entry::Diff_Routing_Entry  ) 
 

Definition at line 340 of file routing_table.cc.

References active, counter, down_iif, iif, inactive, INTEREST_PERIODIC, last_fwd_time, new_org_counter, num_active, num_iif, sink, and source.

00341 { 
00342     last_fwd_time = -2.0*INTEREST_PERIODIC;  
00343     counter      = 0;
00344     new_org_counter = 0;
00345     num_active   = 0;
00346     num_iif      = 0;
00347     active       = NULL; 
00348     inactive     = NULL; 
00349     iif          = NULL;
00350     down_iif     = NULL;
00351     source       = NULL;
00352     sink         = NULL;
00353 }


Member Function Documentation

In_List * Diff_Routing_Entry::AddInList ns_addr_t   ) 
 

Definition at line 328 of file routing_table.cc.

References AGT_ADDR, iif, INTF_INSERT, and num_iif.

Referenced by CntNewOrg(), CntNewSub(), CntOldOrg(), CntPosSend(), and IncRecvCnt().

00329 {
00330   In_List *inPtr= new In_List;
00331 
00332   AGT_ADDR(inPtr) = addr;
00333   INTF_INSERT(iif, inPtr); 
00334 
00335   num_iif++;
00336   return inPtr;
00337 }

void Diff_Routing_Entry::clear_agentlist Agent_List  ) 
 

Definition at line 113 of file routing_table.cc.

References AGENT_NEXT.

Referenced by reset().

00114 {
00115   Agent_List *cur=list;
00116   Agent_List *temp = NULL;
00117 
00118   while (cur != NULL) {
00119     temp = AGENT_NEXT(cur);
00120     delete cur;
00121     cur = temp;
00122   }
00123 }

void Diff_Routing_Entry::clear_inlist In_List  ) 
 

Definition at line 99 of file routing_table.cc.

References IN_NEXT.

Referenced by reset().

00100 {
00101   In_List *cur=list;
00102   In_List *temp = NULL;
00103 
00104   while (cur != NULL) {
00105     temp = IN_NEXT(cur);
00106     delete cur;
00107     cur = temp;
00108   }
00109 }

void Diff_Routing_Entry::clear_outlist Out_List  ) 
 

Definition at line 85 of file routing_table.cc.

References OUT_NEXT.

Referenced by reset().

00086 {
00087   Out_List *cur=list;
00088   Out_List *temp = NULL;
00089 
00090   while (cur != NULL) {
00091     temp = OUT_NEXT(cur);
00092     delete cur;
00093     cur = temp;
00094   }
00095   
00096 }

void Diff_Routing_Entry::ClrAllNewOrg  ) 
 

Definition at line 291 of file routing_table.cc.

References iif, IN_NEXT, and NEW_ORG_RECV.

Referenced by DiffusionRate::CheckNegCounter(), DiffusionRate::FwdData(), DiffusionRate::NegReinfTimeOut(), and DiffusionRate::ProcessNegReinf().

00292 {
00293   In_List *cur;
00294 
00295   for (cur = iif; cur!= NULL; cur = IN_NEXT(cur)) {
00296      NEW_ORG_RECV(cur)= 0;
00297   }
00298 }

void Diff_Routing_Entry::ClrAllOldOrg  ) 
 

Definition at line 301 of file routing_table.cc.

References iif, IN_NEXT, and OLD_ORG_RECV.

Referenced by DiffusionRate::CheckNegCounter(), DiffusionRate::FwdData(), DiffusionRate::NegReinfTimeOut(), and DiffusionRate::ProcessNegReinf().

00302 {
00303   In_List *cur;
00304 
00305   for (cur=iif; cur!=NULL; cur = IN_NEXT(cur) ) {
00306      OLD_ORG_RECV(cur)= 0;
00307   }
00308 }

void Diff_Routing_Entry::ClrNewSub ns_addr_t   ) 
 

Definition at line 232 of file routing_table.cc.

References PrvCurPtr::cur, iif, INTF_FIND, LAST_TS_NEW_SUB, and NEW_SUB_RECV.

Referenced by DiffusionRate::ProcessPosReinf(), and DiffusionRate::TriggerPosReinf().

00233 {
00234   PrvCurPtr RetVal;
00235 
00236   RetVal=INTF_FIND(iif, agent_addr);
00237   if (RetVal.cur != NULL) {
00238      NEW_SUB_RECV(RetVal.cur)= 0;
00239      LAST_TS_NEW_SUB(RetVal.cur) = -1.0;
00240      return;
00241   } 
00242 }

void Diff_Routing_Entry::CntNeg ns_addr_t   ) 
 

Definition at line 191 of file routing_table.cc.

References active, PrvCurPtr::cur, INTF_FIND, and NUM_NEG_RECV.

Referenced by DiffusionRate::consider_new().

00192 {
00193   PrvCurPtr RetVal;
00194 
00195   RetVal=INTF_FIND(active, agent_addr);
00196   if (RetVal.cur != NULL) {
00197      NUM_NEG_RECV(RetVal.cur)++;
00198      return;
00199   } 
00200   /*
00201   perror("Hey man. How come you send me the negative reinforment?\n");
00202   exit(-1);
00203   */
00204 }

void Diff_Routing_Entry::CntNewOrg ns_addr_t   ) 
 

Definition at line 245 of file routing_table.cc.

References AddInList(), PrvCurPtr::cur, iif, INTF_FIND, NEW_ORG_RECV, source, and TOTAL_NEW_ORG_RECV.

Referenced by DiffusionRate::consider_new().

00246 {
00247   PrvCurPtr RetVal;
00248 
00249   RetVal=INTF_FIND(iif, agent_addr);
00250   if (RetVal.cur != NULL) {
00251      NEW_ORG_RECV(RetVal.cur)++;
00252      TOTAL_NEW_ORG_RECV(RetVal.cur)++;
00253      return;
00254   } 
00255 
00256   RetVal=INTF_FIND(source, agent_addr);
00257   if (RetVal.cur != NULL)
00258     return;
00259 
00260   // On-demand adding In_List 
00261 
00262   In_List *cur_in = AddInList(agent_addr);
00263   NEW_ORG_RECV(cur_in)++;
00264   TOTAL_NEW_ORG_RECV(cur_in)++;
00265 }

Here is the call graph for this function:

void Diff_Routing_Entry::CntNewSub ns_addr_t   ) 
 

Definition at line 207 of file routing_table.cc.

References AddInList(), PrvCurPtr::cur, iif, INTF_FIND, LAST_TS_NEW_SUB, NEW_SUB_RECV, NOW, source, and TOTAL_NEW_SUB_RECV.

Referenced by DiffusionRate::consider_new().

00208 {
00209   PrvCurPtr RetVal;
00210 
00211   RetVal=INTF_FIND(iif, agent_addr);
00212   if (RetVal.cur != NULL) {
00213      NEW_SUB_RECV(RetVal.cur)++;
00214      TOTAL_NEW_SUB_RECV(RetVal.cur)++;
00215      LAST_TS_NEW_SUB(RetVal.cur) = NOW;
00216      return;
00217   } 
00218 
00219   RetVal=INTF_FIND(source, agent_addr);
00220   if (RetVal.cur != NULL)
00221     return;
00222 
00223   // On-demand adding In_List 
00224 
00225   In_List *cur_in = AddInList(agent_addr);
00226   NEW_SUB_RECV(cur_in)++;
00227   TOTAL_NEW_SUB_RECV(cur_in)++;
00228   LAST_TS_NEW_SUB(cur_in) = NOW;
00229 }

Here is the call graph for this function:

void Diff_Routing_Entry::CntOldOrg ns_addr_t   ) 
 

Definition at line 268 of file routing_table.cc.

References AddInList(), PrvCurPtr::cur, iif, INTF_FIND, OLD_ORG_RECV, source, and TOTAL_OLD_ORG_RECV.

Referenced by DiffusionRate::consider_old().

00269 {
00270   PrvCurPtr RetVal;
00271 
00272   RetVal=INTF_FIND(iif, agent_addr);
00273   if (RetVal.cur != NULL) {
00274      OLD_ORG_RECV(RetVal.cur)++;
00275      TOTAL_OLD_ORG_RECV(RetVal.cur)++;
00276      return;
00277   } 
00278 
00279   RetVal=INTF_FIND(source, agent_addr);
00280   if (RetVal.cur != NULL)
00281     return;
00282 
00283   // On-demand adding In_List 
00284 
00285   In_List *cur_in = AddInList(agent_addr);
00286   OLD_ORG_RECV(cur_in)++;
00287   TOTAL_OLD_ORG_RECV(cur_in)++;
00288 }

Here is the call graph for this function:

void Diff_Routing_Entry::CntPosSend ns_addr_t   ) 
 

Definition at line 174 of file routing_table.cc.

References AddInList(), PrvCurPtr::cur, iif, INTF_FIND, and NUM_POS_SEND.

Referenced by DiffusionRate::ProcessPosReinf(), and DiffusionRate::TriggerPosReinf().

00175 {
00176   PrvCurPtr RetVal;
00177 
00178   RetVal=INTF_FIND(iif, agent_addr);
00179   if (RetVal.cur != NULL) {
00180      NUM_POS_SEND(RetVal.cur)++;
00181      return;
00182   } 
00183 
00184   // On-demand adding In_List 
00185 
00186   In_List *cur_in = AddInList(agent_addr);
00187   NUM_POS_SEND(cur_in)++;
00188 }

Here is the call graph for this function:

bool Diff_Routing_Entry::ExistOriginalGradient  ) 
 

Definition at line 138 of file routing_table.cc.

References active, GRADIENT, ORIGINAL, and OUT_NEXT.

Referenced by DiffusionRate::FwdData(), DiffusionRate::ProcessNegReinf(), and DiffusionRate::TriggerPosReinf().

00139 {
00140   Out_List *cur_out;
00141 
00142   for (cur_out = active; cur_out!=NULL; cur_out=OUT_NEXT(cur_out)) {
00143     if (GRADIENT(cur_out) == ORIGINAL)
00144       return true;
00145   }
00146 
00147   return false;
00148 }

void Diff_Routing_Entry::IncRecvCnt ns_addr_t   ) 
 

Definition at line 151 of file routing_table.cc.

References AddInList(), counter, PrvCurPtr::cur, iif, INTF_FIND, source, and TOTAL_RECV.

Referenced by DiffusionProb::consider_new().

00152 {
00153   PrvCurPtr RetVal;
00154 
00155   counter++;
00156 
00157   RetVal=INTF_FIND(iif, agent_addr);
00158   if (RetVal.cur != NULL) {
00159      TOTAL_RECV(RetVal.cur)++;
00160      return;
00161   } 
00162 
00163   RetVal=INTF_FIND(source, agent_addr);
00164   if (RetVal.cur != NULL)
00165     return;
00166 
00167   // On-demand adding In_List 
00168 
00169   TOTAL_RECV(AddInList(agent_addr))++;
00170 
00171 }

Here is the call graph for this function:

In_List * Diff_Routing_Entry::MostRecentIn  ) 
 

Definition at line 311 of file routing_table.cc.

References iif, IN_NEXT, and LAST_TS_NEW_SUB.

Referenced by DiffusionRate::ProcessPosReinf().

00312 {
00313   In_List *cur, *ret;
00314   double recent_time;
00315 
00316   ret = NULL;
00317   recent_time = -1.0;
00318   for (cur = iif; cur!=NULL; cur=IN_NEXT(cur)) {
00319     if (LAST_TS_NEW_SUB(cur) > recent_time) {
00320       ret = cur;
00321       recent_time = LAST_TS_NEW_SUB(cur);
00322     }
00323   }
00324   return ret;
00325 }

int Diff_Routing_Entry::MostRecvOrg  ) 
 

Definition at line 126 of file routing_table.cc.

References iif, IN_NEXT, max, and NEW_ORG_RECV.

Referenced by DiffusionRate::GenNeg().

00127 {
00128   In_List *cur;
00129   int     most = 0;
00130 
00131   for (cur=iif; cur!=NULL; cur = IN_NEXT(cur)) {
00132       most = max(most,NEW_ORG_RECV(cur));
00133   }
00134   return most;
00135 }

void Diff_Routing_Entry::reset  ) 
 

Definition at line 63 of file routing_table.cc.

References active, clear_agentlist(), clear_inlist(), clear_outlist(), counter, down_iif, iif, inactive, INTEREST_PERIODIC, last_fwd_time, new_org_counter, num_active, num_iif, sink, and source.

Referenced by DiffusionAgent::reset().

00064 {
00065   counter = 0;
00066   num_active = 0;
00067   num_iif = 0;
00068   clear_outlist(active);
00069   clear_outlist(inactive);
00070   clear_inlist(iif);
00071   clear_inlist(down_iif);
00072   clear_agentlist(source);
00073   clear_agentlist(sink);
00074   active = NULL;
00075   inactive = NULL;
00076   iif = NULL;
00077   down_iif = NULL;
00078   source = NULL;
00079   sink = NULL;
00080   last_fwd_time = -2.0*INTEREST_PERIODIC;
00081   new_org_counter = 0;
00082 }

Here is the call graph for this function:


Member Data Documentation

Out_List* Diff_Routing_Entry::active
 

Definition at line 69 of file routing_table.h.

Referenced by DiffusionProb::CalGradient(), CntNeg(), DiffusionRate::consider_new(), DiffusionProb::consider_new(), DiffusionProb::DecGradient(), Diff_Routing_Entry(), ExistOriginalGradient(), DiffusionRate::FwdOriginal(), DiffusionRate::FwdSubsample(), DiffusionRate::GradientTimeOut(), DiffusionRate::Print_IOlist(), DiffusionProb::Print_IOlist(), and reset().

int Diff_Routing_Entry::counter
 

Definition at line 66 of file routing_table.h.

Referenced by DiffusionProb::consider_new(), DiffusionProb::CreateIOList(), Diff_Routing_Entry(), DiffusionProb::FwdPosReinf(), DiffusionProb::GenPosReinf(), IncRecvCnt(), and reset().

In_List* Diff_Routing_Entry::down_iif
 

Definition at line 72 of file routing_table.h.

Referenced by Diff_Routing_Entry(), and reset().

In_List* Diff_Routing_Entry::iif
 

Definition at line 71 of file routing_table.h.

Referenced by AddInList(), ClrAllNewOrg(), ClrAllOldOrg(), ClrNewSub(), CntNewOrg(), CntNewSub(), CntOldOrg(), CntPosSend(), Diff_Routing_Entry(), DiffusionProb::FwdPosReinf(), DiffusionRate::GenNeg(), DiffusionProb::GenPosReinf(), IncRecvCnt(), MostRecentIn(), MostRecvOrg(), and reset().

Out_List* Diff_Routing_Entry::inactive
 

Definition at line 70 of file routing_table.h.

Referenced by Diff_Routing_Entry(), and reset().

double Diff_Routing_Entry::last_fwd_time
 

Definition at line 76 of file routing_table.h.

Referenced by Diff_Routing_Entry(), DiffusionRate::InterestHandle(), and reset().

int Diff_Routing_Entry::new_org_counter
 

Definition at line 78 of file routing_table.h.

Referenced by DiffusionRate::CheckNegCounter(), DiffusionRate::consider_new(), Diff_Routing_Entry(), DiffusionRate::FwdData(), DiffusionRate::NegReinfTimeOut(), DiffusionRate::ProcessNegReinf(), and reset().

int Diff_Routing_Entry::num_active
 

Definition at line 67 of file routing_table.h.

Referenced by DiffusionProb::add_outlist(), DiffusionProb::consider_new(), DiffusionProb::CreateIOList(), Diff_Routing_Entry(), DiffusionRate::FwdSubsample(), DiffusionRate::InterestHandle(), DiffusionProb::InterfaceDown(), DiffusionRate::ProcessPosReinf(), and reset().

int Diff_Routing_Entry::num_iif
 

Definition at line 68 of file routing_table.h.

Referenced by AddInList(), DiffusionRate::CheckNegCounter(), Diff_Routing_Entry(), and reset().

Agent_List* Diff_Routing_Entry::sink
 

Definition at line 74 of file routing_table.h.

Referenced by DiffusionRate::consider_new(), DiffusionProb::consider_new(), Diff_Routing_Entry(), DiffusionProb::ForwardData(), DiffusionRate::FwdData(), DiffusionRate::ProcessNegReinf(), reset(), and DiffusionRate::TriggerPosReinf().

Agent_List* Diff_Routing_Entry::source
 

Definition at line 73 of file routing_table.h.

Referenced by CntNewOrg(), CntNewSub(), CntOldOrg(), DiffusionRate::consider_new(), DiffusionProb::consider_new(), DiffusionProb::data_request_all(), DiffusionRate::DataReqAll(), Diff_Routing_Entry(), DiffusionProb::ForwardData(), IncRecvCnt(), DiffusionProb::InterestPropagate(), DiffusionProb::InterfaceDown(), reset(), and DiffusionAgent::StopSource().


The documentation for this class was generated from the following files:
Generated on Tue Apr 20 12:38:01 2004 for NS2.26SourcesOriginal by doxygen 1.3.3