//
// Author: Jae Chung
// File: dpp-queue.h
// Written: 07/19/99 (for ns-2.1b4a)
// Modifed: 10/14/01 (for ns-2.1b8a)
//
#include <string.h>
#include "queue.h"
#include "address.h"
class DppQueue : public Queue {
public:
DppQueue() {
pq_ = fs_[0].q_;
//deq_turn_ = 1;
for( int i=0; i<4; i++)
{
fs_[i].q_ = new PacketQueue;
fs_[i].estRate_ = 0.0;
fs_[i].prevTime_ = 0.0;
//fs_[i].size_ = 0.0;
}
fs_[0].weight_ = 0.25;
fs_[1].weight_ = 0.25;
fs_[2].weight_ = 0.25;
fs_[3].weight_ = 0.25;
fs_[0].bandwidth_ = 2500000;
fs_[1].bandwidth_ = 2500000;
fs_[2].bandwidth_ = 2500000;
fs_[3].bandwidth_ = 2500000;
//Bpre0_ = 3000000;
//Bpre1_ = 3000000;
//Bpre2_ = 3000000;
//slope_ = 0.012; //PQ线性函数的斜率slope
//max_ = 0.75; //定义队列上限的参数
//min_ = 0.12; //定义队列下线的参数
//landa_ = 0.8;
//arfa_ = 0.6;
//pth_ = 0.4;
k_ = 100000.0;
//变量绑定
//bind("slope_",&slope_);
//bind("max_",&max_);
//bind("min_",&min_);
//bind("landa_", &landa_);
//bind("arfa_", &arfa_);
//bind("pth_", &pth_);
bind("k_", &k_);
//bind("pi_", &fs_[0].weight_);
bind_bw("bw_", &bandwidth_);
}
virtual int command(int argc, const char*const* argv);
~DppQueue() {
delete fs_[0].q_;
delete fs_[1].q_;
delete fs_[2].q_;
delete fs_[3].q_;
}
protected:
void enque(Packet*);
Packet* deque();
void estRate( int flowid, int pktSize );
// PacketQueue *q1_; // First FIFO queue, q1 for tcp queue
// PacketQueue *q2_; // Second FIFO queue, q2 for udp queue
//int deq_turn_; // 1 for First queue 2 for Second
struct flowState {
PacketQueue *q_;
double weight_; /* the weight of the flow */
double estRate_; /* current flow's estimated rate */
double prevTime_;
//int size_; /* keep track of packets that arrive
//at the same time */
double bandwidth_;
} fs_[4];
//double slope_;
//double max_;
//double min_;
//double landa_;
//double arfa_;
//double pth_;
double k_;
double bandwidth_;
//double Bpre0_;
//double Bpre1_;
//double Bpre2_;
};