AggSpec Class Reference

#include <agg-spec.h>

Collaboration diagram for AggSpec:

Collaboration graph
[legend]

Detailed Description

Definition at line 43 of file agg-spec.h.

Public Member Functions

 AggSpec (AggSpec *orig)
 AggSpec (int dstON, int dstP, int dstBits)
AggSpecclone ()
int contains (AggSpec *)
int equals (AggSpec *)
void expand (int prefix, int bits)
int getPrefix (int addr)
int getSampleAddress ()
int member (Packet *p)
void print ()
int subsetOfDst (int prefix, int bits)

Static Public Member Functions

static int prefixBitsForMerger (AggSpec *, AggSpec *)

Data Fields

int dstBits_
int dstON_
int dstPrefix_
int ptype_
double ptypeShare_


Constructor & Destructor Documentation

AggSpec::AggSpec int  dstON,
int  dstP,
int  dstBits
 

Definition at line 43 of file agg-spec.cc.

References dstBits_, dstON_, dstPrefix_, ptype_, and ptypeShare_.

Referenced by clone().

00043                                                       {
00044 
00045   dstON_ = dstON;
00046   dstPrefix_ = dstPrefix;
00047   dstBits_ = dstBits;
00048   
00049   ptype_=-1;
00050   ptypeShare_=0;
00051 }

AggSpec::AggSpec AggSpec orig  ) 
 

Definition at line 53 of file agg-spec.cc.

References dstBits_, dstON_, dstPrefix_, ptype_, and ptypeShare_.

00053                                {
00054   dstON_ = orig->dstON_;
00055   dstPrefix_ = orig->dstPrefix_;
00056   dstBits_ = orig->dstBits_;
00057 
00058   ptype_ = orig->ptype_;
00059   ptypeShare_=orig->ptypeShare_;
00060 }


Member Function Documentation

AggSpec * AggSpec::clone  ) 
 

Definition at line 131 of file agg-spec.cc.

References AggSpec().

Referenced by PushbackAgent::pushbackCheck(), and PushbackAgent::refreshUpstreamLimits().

00131                {
00132   return new AggSpec(this);
00133 }

Here is the call graph for this function:

int AggSpec::contains AggSpec  ) 
 

Definition at line 103 of file agg-spec.cc.

References dstBits_, dstON_, dstPrefix_, and PrefixTree::getPrefixBits().

Referenced by RateLimitSessionList::containsAggSpec(), and RateLimitSessionList::containsLocalAggSpec().

00103                                    {
00104   
00105   if (another->dstBits_ < dstBits_) return 0; 
00106   if (dstON_ != another->dstON_) return 0;
00107 
00108   int prefix1 = PrefixTree::getPrefixBits(dstPrefix_, dstBits_);
00109   int prefix2 = PrefixTree::getPrefixBits(another->dstPrefix_, dstBits_);
00110   
00111   return (prefix1 == prefix2);
00112 }

Here is the call graph for this function:

int AggSpec::equals AggSpec  ) 
 

Definition at line 96 of file agg-spec.cc.

References dstBits_, dstON_, and dstPrefix_.

Referenced by RateLimitSessionList::insert().

00096                                  {
00097   
00098   return (dstON_ == another->dstON_ && dstPrefix_ == another->dstPrefix_ && 
00099       dstBits_ == another->dstBits_);
00100 }

void AggSpec::expand int  prefix,
int  bits
 

Definition at line 115 of file agg-spec.cc.

References dstBits_, and dstPrefix_.

00115                                     {
00116   
00117   dstPrefix_ = prefix;
00118   dstBits_ = bits;
00119 }

int AggSpec::getPrefix int  addr  ) 
 

Definition at line 89 of file agg-spec.cc.

References dstBits_, and NO_BITS.

Referenced by member().

00089                            {
00090   
00091   int andAgent = ((1 << dstBits_) - 1) << (NO_BITS - dstBits_);
00092   return (addr &  andAgent);
00093 }

int AggSpec::getSampleAddress  ) 
 

Definition at line 136 of file agg-spec.cc.

References AGGREGATE_CLASSIFICATION_MODE_FID, and dstPrefix_.

Referenced by RateLimitSession::RateLimitSession().

00136                           {
00137   
00138   //for now, return the prefix itself
00139   if (AGGREGATE_CLASSIFICATION_MODE_FID) 
00140     return 1;
00141   else 
00142     return dstPrefix_;
00143 }

int AggSpec::member Packet p  ) 
 

Definition at line 63 of file agg-spec.cc.

References hdr_ip::access(), ns_addr_t::addr_, AGGREGATE_CLASSIFICATION_MODE_FID, Scheduler::clock(), hdr_ip::dst(), dstON_, dstPrefix_, hdr_ip::flowid(), getPrefix(), Scheduler::instance(), and print().

Referenced by RateLimitSession::log().

00063                             {
00064   
00065   hdr_ip * iph = hdr_ip::access(pkt);
00066   ns_addr_t dst = iph->dst();
00067   int fid = iph->flowid();
00068 
00069   if (dstON_) {
00070     int prefix;
00071     if (AGGREGATE_CLASSIFICATION_MODE_FID) 
00072       prefix = getPrefix(fid);
00073     else 
00074       prefix = getPrefix(dst.addr_);
00075 
00076     if (prefix == dstPrefix_) {
00077       return 1;
00078     }
00079   }
00080 
00081 #ifdef DEBUG_AS
00082   printf("AS: non-member packet with dst %d at %g. Agg: ", dst.addr_, Scheduler::instance().clock());
00083   print();
00084 #endif
00085   return 0;
00086 }

Here is the call graph for this function:

int AggSpec::prefixBitsForMerger AggSpec ,
AggSpec
[static]
 

Definition at line 146 of file agg-spec.cc.

References dstBits_, dstPrefix_, and PrefixTree::getPrefixBits().

Referenced by RateLimitSessionList::mergeSessions().

00146                                                            {
00147   
00148   int bitsNow = (agg1->dstBits_ < agg2->dstBits_)? agg1->dstBits_: agg2->dstBits_;
00149   for (int i=bitsNow; i>=0; i--) {
00150     int prefix1 = PrefixTree::getPrefixBits(agg1->dstPrefix_, i);
00151     int prefix2 = PrefixTree::getPrefixBits(agg2->dstPrefix_, i);
00152     if (prefix1==prefix2) {
00153       return i;
00154     }
00155   }
00156 
00157   printf("AS: Error: Should never come here\n");
00158   exit(-1);
00159 }

Here is the call graph for this function:

void AggSpec::print  ) 
 

Definition at line 162 of file agg-spec.cc.

Referenced by member(), and PushbackAgent::pushbackCancel().

00162                {
00163   //printf("Prefix = %d Bits = %d\n", dstPrefix_, dstBits_);
00164 }

int AggSpec::subsetOfDst int  prefix,
int  bits
 

Definition at line 122 of file agg-spec.cc.

References dstBits_, dstON_, dstPrefix_, and PrefixTree::getPrefixBits().

Referenced by RateLimitSessionList::getMySubsetCount(), and RateLimitSessionList::merge().

00122                                          {
00123   
00124   if (!dstON_ || dstBits_ < bits) return 0;
00125 
00126   int myPrefix = PrefixTree::getPrefixBits(dstPrefix_, bits);
00127   return (prefix==myPrefix);
00128 }

Here is the call graph for this function:


Field Documentation

int AggSpec::dstBits_
 

Definition at line 48 of file agg-spec.h.

Referenced by AggSpec(), contains(), equals(), expand(), getPrefix(), RateLimitSession::merge(), RateLimitSessionList::mergeSessions(), prefixBitsForMerger(), RateLimitSession::setAggSpec(), and subsetOfDst().

int AggSpec::dstON_
 

Definition at line 46 of file agg-spec.h.

Referenced by AggSpec(), contains(), equals(), member(), RateLimitSessionList::mergeSessions(), RateLimitSession::setAggSpec(), and subsetOfDst().

int AggSpec::dstPrefix_
 

Definition at line 47 of file agg-spec.h.

Referenced by AggSpec(), contains(), equals(), expand(), getSampleAddress(), member(), RateLimitSessionList::mergeSessions(), prefixBitsForMerger(), RateLimitSession::setAggSpec(), and subsetOfDst().

int AggSpec::ptype_
 

Definition at line 51 of file agg-spec.h.

Referenced by AggSpec(), and RateLimitSession::RateLimitSession().

double AggSpec::ptypeShare_
 

Definition at line 52 of file agg-spec.h.

Referenced by AggSpec(), and RateLimitSession::RateLimitSession().


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