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

LoggingDataStruct Class Reference

#include <logging-data-struct.h>

Collaboration diagram for LoggingDataStruct:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 LoggingDataStruct (Node *, RouteLogic *, int sampleAddress, double estimate)
 ~LoggingDataStruct ()
void log (Packet *pkt)
int consolidateStatus ()
void registerStatus (int sender, double arrRate)
LoggingDataStructNodegetNodeByID (int id)
void resetStatus ()

Public Attributes

LoggingDataStructNodefirst_
int count_
int myID_
RateEstimatorrateEstimator_
double reset_time_
int gotStatusAll_
double statusArrivalRateAll_
RouteLogicrtLogic_

Constructor & Destructor Documentation

LoggingDataStruct::LoggingDataStruct Node ,
RouteLogic ,
int  sampleAddress,
double  estimate
 

Definition at line 42 of file logging-data-struct.cc.

References Scheduler::clock(), count_, first_, gotStatusAll_, Scheduler::instance(), RouteLogic::lookup_flat(), myID_, Node::neighbor_list_, neighbor_list_node::next, neighbor_list_node::nodeid, Node::nodeid(), rateEstimator_, reset_time_, rtLogic_, and statusArrivalRateAll_.

00043                                                                          {
00044   first_ = NULL;
00045   count_=0;
00046   myID_ = node->nodeid();
00047   rateEstimator_ = new RateEstimator(estimate);
00048   reset_time_ = Scheduler::instance().clock();
00049   gotStatusAll_ = 0;
00050   statusArrivalRateAll_=-1;
00051   rtLogic_ = rtLogic;
00052   
00053   neighbor_list_node * nextNode = node->neighbor_list_;
00054   while (nextNode != NULL) {
00055     int nid = nextNode->nodeid;
00056     int nextHopID = rtLogic_->lookup_flat(nid, sampleAddress);
00057     if (nextHopID == node->nodeid() /*|| AGGREGATE_CLASSIFICATION_MODE_FID == 1*/) {
00058        LoggingDataStructNode * lgdsNode = new LoggingDataStructNode(nid, first_);
00059        first_ = lgdsNode;
00060        count_++;
00061     }
00062      nextNode = nextNode->next;
00063   }
00064     
00065 }

Here is the call graph for this function:

LoggingDataStruct::~LoggingDataStruct  ) 
 

Definition at line 164 of file logging-data-struct.cc.

References first_, LoggingDataStructNode::next_, and rateEstimator_.

00164                                       {
00165 
00166   LoggingDataStructNode * node = first_;
00167   while (node!=NULL) {
00168     LoggingDataStructNode * next = node->next_;
00169     delete(node);
00170     node = next;
00171   }
00172 
00173   delete(rateEstimator_);
00174 }


Member Function Documentation

int LoggingDataStruct::consolidateStatus  ) 
 

Definition at line 101 of file logging-data-struct.cc.

References first_, LoggingDataStructNode::gotStatus_, gotStatusAll_, LoggingDataStructNode::next_, LoggingDataStructNode::statusArrivalRate_, and statusArrivalRateAll_.

Referenced by RateLimitSession::getArrivalRateForStatus(), and PushbackAgent::processPushbackStatus().

00101                                      {
00102 
00103   double rate = 0;
00104   int all = 1;
00105   LoggingDataStructNode * node = first_;
00106   while (node != NULL) {
00107     if (!node->gotStatus_) {
00108       if (node->statusArrivalRate_<0) {
00109         //condition 1 above.
00110         printf("LGDS: Error: This should never happen now\n");
00111         exit(-1);
00112         //return -1;
00113       }
00114       else {
00115         all = 0;
00116       }
00117     }
00118     rate += node->statusArrivalRate_;
00119     node = node->next_;
00120   }
00121 
00122   gotStatusAll_ = all;
00123   statusArrivalRateAll_=rate;
00124 
00125   return all;
00126 }

LoggingDataStructNode * LoggingDataStruct::getNodeByID int  id  ) 
 

Definition at line 151 of file logging-data-struct.cc.

References first_, LoggingDataStructNode::next_, and LoggingDataStructNode::nid_.

Referenced by log(), and registerStatus().

00151                                      {
00152   
00153   LoggingDataStructNode * node = first_;
00154   while (node != NULL) {
00155     if (node->nid_ == id) {
00156       return node;
00157     }
00158     node = node->next_;
00159   }
00160   
00161   return NULL;
00162 }

void LoggingDataStruct::log Packet pkt  ) 
 

Definition at line 68 of file logging-data-struct.cc.

References hdr_ip::access(), ns_addr_t::addr_, RateEstimator::bytesArr_, RateEstimator::estimateRate(), RateEstimator::estRate_, getNodeByID(), LoggingDataStructNode::log(), RouteLogic::lookup_flat(), myID_, rateEstimator_, rtLogic_, and hdr_ip::src().

Referenced by RateLimitSession::log().

00068                                    {
00069 
00070   rateEstimator_->estimateRate(pkt);
00071 
00072   hdr_ip * iph = hdr_ip::access(pkt);
00073   ns_addr_t src = iph->src();
00074 
00075   // there is a symmetry of routing assumption built into this computation.
00076   // if it does not hold, we need some explicit support to know 
00077   // which neighbor sent us this packet
00078   int neighborID = rtLogic_->lookup_flat(myID_,src.addr_);
00079 #ifdef DEBUG_LGDS
00080   printf("LGDS: %d total = %g rate = %g src = %d neighnorID = %d\n", myID_, 
00081          rateEstimator_->bytesArr_/500.0, rateEstimator_->estRate_, src.addr_, neighborID);
00082 #endif  
00083 
00084   if (neighborID == myID_) return;
00085  
00086   LoggingDataStructNode * node = getNodeByID(neighborID);
00087   if (node == NULL) {
00088 #ifdef DEBUG_LGDS
00089     fprintf(stdout,"LGDS: %d neighbor not found in the struct !!\n", myID_);
00090 #endif
00091     return;
00092     //exit(-1);
00093   }
00094   node->log(pkt);
00095 }

Here is the call graph for this function:

void LoggingDataStruct::registerStatus int  sender,
double  arrRate
 

Definition at line 138 of file logging-data-struct.cc.

References getNodeByID(), and LoggingDataStructNode::registerStatus().

Referenced by PushbackAgent::processPushbackStatus().

00138                                                             {
00139   
00140   LoggingDataStructNode * node = getNodeByID(sender);
00141   
00142   if (node == NULL) {
00143     printf("LGDS: sender not in my list (status processing)\n");
00144     exit(-1);
00145   }
00146   
00147   node->registerStatus(arrRate);
00148 }

Here is the call graph for this function:

void LoggingDataStruct::resetStatus  ) 
 

Definition at line 129 of file logging-data-struct.cc.

References first_, LoggingDataStructNode::gotStatus_, and LoggingDataStructNode::next_.

Referenced by PushbackAgent::processPushbackStatus(), and PushbackAgent::pushbackStatus().

00129                                {
00130   LoggingDataStructNode * node = first_;
00131   while (node != NULL) {
00132     node->gotStatus_=0;
00133     node = node->next_;
00134   }
00135 }


Member Data Documentation

int LoggingDataStruct::count_
 

Definition at line 77 of file logging-data-struct.h.

Referenced by PushbackAgent::initialUpdate(), LoggingDataStruct(), RateLimitSession::merge(), PushbackAgent::processPushbackRequest(), PushbackAgent::pushbackCheck(), and PushbackAgent::refreshUpstreamLimits().

LoggingDataStructNode* LoggingDataStruct::first_
 

Definition at line 76 of file logging-data-struct.h.

Referenced by consolidateStatus(), getNodeByID(), LoggingDataStruct(), RateLimitSession::merge(), PushbackAgent::pushbackCancel(), PushbackAgent::pushbackCheck(), PushbackAgent::refreshUpstreamLimits(), resetStatus(), and ~LoggingDataStruct().

int LoggingDataStruct::gotStatusAll_
 

Definition at line 85 of file logging-data-struct.h.

Referenced by consolidateStatus(), and LoggingDataStruct().

int LoggingDataStruct::myID_
 

Definition at line 78 of file logging-data-struct.h.

Referenced by RateLimitSessionList::filter(), RateLimitSession::log(), log(), LoggingDataStruct(), and RateLimitSession::merge().

RateEstimator* LoggingDataStruct::rateEstimator_
 

Definition at line 80 of file logging-data-struct.h.

Referenced by log(), LoggingDataStruct(), RateLimitSession::merge(), and ~LoggingDataStruct().

double LoggingDataStruct::reset_time_
 

Definition at line 82 of file logging-data-struct.h.

Referenced by LoggingDataStruct().

RouteLogic* LoggingDataStruct::rtLogic_
 

Definition at line 88 of file logging-data-struct.h.

Referenced by log(), and LoggingDataStruct().

double LoggingDataStruct::statusArrivalRateAll_
 

Definition at line 86 of file logging-data-struct.h.

Referenced by consolidateStatus(), RateLimitSession::getArrivalRateForStatus(), LoggingDataStruct(), and PushbackAgent::processPushbackStatus().


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