⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wfq.h

📁 c++编写的ns环境下关于wfq算法的仿真源代码
💻 H
字号:
/* * Copyright (c) 1999-2000 Paolo Losi (p.losi@hypersonic.it) * * Copyright (c) 2001-2005 Paolo Losi (p.losi@hypersonic.it) *                         Alexander Sayenko (sayenko@cc.jyu.fi) * * All rights reserved * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. */#include "wfq-list.h"#include "math.h"#include "queue.h"#include "wfqclassifier.h"class WFQ;/* * This class is needed to handle events in the GPS reference system */class GPSHandler : public Handler {	public:		GPSHandler(WFQ *queue) : q(queue){};		void handle(Event *e);	protected:		WFQ* q;};/* * This class represents the WFQ scheduler */class WFQ : public Queue {  public:    WFQ();    virtual int command(int argc, const char*const* argv);    Packet *deque(void);    void enque(Packet* pkt);    void handle(Event *);  protected:    void scheduleGPS();    void updateSum ();    GPSHandler GPS_hand;    Event*     GPS_event;       /* this is the event corresponding to the end                                   of the tx in the GPS reference system */    int idle;                   /* whether GPS reference system is idle */     double virt_time;    double last_vt_update;      /* last virt_time update time */    double sum;                 /* sum of weights of the activ queues */    WFQAggregClassifier *wfq_classifier;		    List<int> GPS_queueID_l;    /* queueID list for GPS refer. system */    List<Packet *> PGPS_pack_l; /* Packet list for PGPS system */	    double bandwidth;           /* bandwidth of the output link */};/* * Interface to NS-2 object hierarchy */static class NS2WFQ : public TclClass {  public:    NS2WFQ() : TclClass("Queue/WFQ") {};    TclObject* create(int, const char*const*)       { return (new WFQ); }} class_wfq;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -