#include <dsPolicy.h>
Inheritance diagram for TSW3CMPolicy:


Public Member Functions | |
| TSW3CMPolicy () | |
| void | applyMeter (policyTableEntry *policy, Packet *pkt) |
| int | applyPolicer (policyTableEntry *policy, policerTableEntry *policer, Packet *pkt) |
|
|
Definition at line 156 of file dsPolicy.h.
00156 : Policy(){}; |
|
||||||||||||
|
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:

|
||||||||||||||||
|
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:

1.3.3