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

TSW3CMPolicy Class Reference

#include <dsPolicy.h>

Inheritance diagram for TSW3CMPolicy:

Inheritance graph
[legend]
Collaboration diagram for TSW3CMPolicy:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TSW3CMPolicy ()
void applyMeter (policyTableEntry *policy, Packet *pkt)
int applyPolicer (policyTableEntry *policy, policerTableEntry *policer, Packet *pkt)

Constructor & Destructor Documentation

TSW3CMPolicy::TSW3CMPolicy  )  [inline]
 

Definition at line 156 of file dsPolicy.h.

00156 : Policy(){};


Member Function Documentation

void TSW3CMPolicy::applyMeter policyTableEntry policy,
Packet pkt
[virtual]
 

Implements Policy.

Definition at line 575 of file dsPolicy.cc.

References hdr_cmn::access(), policyTableEntry::arrivalTime, policyTableEntry::avgRate, Scheduler::clock(), Scheduler::instance(), hdr_cmn::size(), and policyTableEntry::winLen.

00575                                                                    {
00576   double now, bytesInTSW, newBytes;
00577   hdr_cmn* hdr = hdr_cmn::access(pkt);
00578   
00579   bytesInTSW = policy->avgRate * policy->winLen;
00580   newBytes = bytesInTSW + (double) hdr->size();
00581   now = Scheduler::instance().clock();
00582   policy->avgRate = newBytes / (now - policy->arrivalTime + policy->winLen);
00583   policy->arrivalTime = now;
00584 }

Here is the call graph for this function:

int TSW3CMPolicy::applyPolicer policyTableEntry policy,
policerTableEntry policer,
Packet pkt
[virtual]
 

Implements Policy.

Definition at line 606 of file dsPolicy.cc.

References policyTableEntry::avgRate, policyTableEntry::cir, policerTableEntry::downgrade1, policerTableEntry::downgrade2, policerTableEntry::initialCodePt, policyTableEntry::pir, and Random::uniform().

00606                                                                                                 {
00607   double rand = policy->avgRate * (1.0 - Random::uniform(0.0, 1.0));
00608   
00609   if (rand > policy->pir)
00610     return (policer->downgrade2);
00611   else if (rand > policy->cir)
00612     return(policer->downgrade1);
00613   else
00614     return(policer->initialCodePt);
00615 }

Here is the call graph for this function:


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