亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? csfq.cc

?? 里面包含fred,util,csfq這三種演算法的程式碼,適用于NS2開發環境
?? CC
?? 第 1 頁 / 共 2 頁
字號:
/* * Copyright (c) 1997 Regents of the University of California. * All rights reserved. *  * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software *    must display the following acknowledgement: * 	This product includes software developed by the MASH Research * 	Group at the University of California Berkeley. * 4. Neither the name of the University nor of the Research Group may be *    used to endorse or promote products derived from this software without *    specific prior written permission. *  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */#ifndef lintstatic char rcsid[] ="@(#) $Header: /afs/cs/project/cmcl-ns2/NetBSD1.2.1/ns-allinone/ns-2/RCS/csfq.cc,v 1.7 1998/09/12 19:39:27 istoica Exp istoica $ (ANS)";#endif#include <stdlib.h>#include <string.h>#include "random.h"#include "queue.h"#define MAXFLOWS 200#ifndef TRUE#define TRUE 1#define FALSE 0#endif#define KALPHA 29 // 0.99^29 = 0.75//#define CSFQ_LOG //#define PENALTY_BOX  /* use penalty box in conjucntion with CSFQ */#ifdef PENALTY_BOX#define MONITOR_TABLE_SIZE 10#define PUNISH_TABLE_SIZE  10#define DROPPED_ARRAY_SIZE 100#define PUNISH_THRESH  1.3  /* 			     * when the flow's rate exceeds 			     * PUNISH_THRESH times the fair rate 			     * the flow is punished			     */#define GOOD_THRESH     0.7  /* 			      * when the punished flow's rate is  			      * GOOD_THRESH times smaller than the 			      * link's fair rate the flow 			      * is no longer punished			      */#define BETA 0.98            /* 			      * (1 - BETA) = precentage by which 			      * link's fair rate is decreased when a			      * forced drop occurs                              */typedef struct identHash {  int    valid_;  double prevTime_;  double estNormRate_;} IdentHashTable;#endif//#define SRCID       /* identify flow bassed of source id rather than flow id *///#define CSFQ_RLMEX  /* used for RLM experiments only *//* the following three functions are in util.cc */void  initRand(unsigned seed);float funifRand(float a, float b);void  panic(char *s);double min(double x, double y){  return (x < y ? x : y);}class CSFQ : public Queue {public:   CSFQ();  virtual int command(int argc, const char*const* argv);  Packet *deque(void);  void   enque(Packet *pkt);protected:  double estRate(int flowid, int pktSize, double arvTime);  void estAlpha(int pktSize, double pktLabel, double arvTime, int enqueue);    void logArvPacket(int flowId, double ctime, int pktSize);  void logDptPacket(int flowId, double ctime, int pktSize);  void logDroppedPacket(int flowId, double ctime);  void logDroppedPacket1(int flowId, double ctime);  void logEstAlpha(double ctime);  void logEstLabel(int flowId, double ctime, double label);#ifdef SRCID        int getId(int src);#endif #ifdef PENALTY_BOX  int isInHash(int idx, IdentHashTable *hashTable, int size);   int insertInHash(int idx, double flowRate, 			 IdentHashTable *hashTable, int size);  void deleteFromHash(int idx, IdentHashTable *hashTable, int size);   double updateNormRate(int idx, double pktLabel,			IdentHashTable *hashTable, int size);   int  recordDroppedPacket(int flowId);  void choseToMonitor();  void punishFlow(int flowId);#endif  struct flowState {    double weight_;   /* the weight of the flow */    double k_;        /* averaging interval for rate estimation */    double estRate_;  /* current flow's estimated rate */    double prevTime_;    /* internal statistics */     int size_;      /* keep track of packets that arrive		       at the same time */    int numArv_;    /* number of arrival packets */    int numDpt_;    /* number of dropped packets */    int numDroped_; /* number of droped packets */      } fs_[MAXFLOWS];  int         id_; /* queue & link identifier */#ifdef SRCID  int         hashid_[MAXFLOWS];#endif  int  CSFQ::monitor(int flowId, double pktLabel);  void CSFQ::dropPkt(int flowId, Packet *pkt);#ifdef PENALTY_BOX  IdentHashTable monitorTable_[MONITOR_TABLE_SIZE];  IdentHashTable punishTable_[PUNISH_TABLE_SIZE];  int droppedArray_[DROPPED_ARRAY_SIZE];  int numDroppedPkts_;  double kDropped_;#endif  PacketQueue q_;           /* packet queue */  int         qsize_;       /* maximum queue size (in bits) */  int         qsizeThresh_; /* threshold (in bits); if queue occupancy does                              * not exceed qsizeThresh_ the queue is                             * assumed to be uncongested                             */  int         qsizeCrt_;    /* current queue size (in bits) */  int         maxflow_;     /* maximum number of flows */    int    edge_;      /* queue type: 1 if belongs to an edge node; 0 otherwise*/  double rate_;      /* link rate (in bps) */  double lastArv_;   /* the arival time of the last packet (in sec) */  double kLink_;     /* avg. interval for computing rateTotal (usec)*/   double alpha_;     /* output link fair rate */  double tmpAlpha_;  /* 		      * used to compute the largest label of a packet, i.e.,		      * the largest flow rate seen during an		      * interval of length kLink_ 		      */  int    kalpha_;    /*  maximum number of times the fair rate		      * (alpha_) can be decreased when the queue		      * overflows, during a time interval of length kLink_ 		      */  double rateAlpha_; /* aggreagte forwarded rate corresponding to crt. alpha_ */  double rateTotal_; /* aggregate arrival rate */  double lArv_;      /* used to store the start of an interval of 		      * length kLink_ 		      */  int    congested_; /* specify whether the link is congested or not*/  int    pktSize_;   /* 		      * the total number of bits enqueued between		      * two consecutive rate estimations.		      * usualy, this represent the size of one packet;		      * however, if more packets are received at the same time		      * this will represent the cumulative size of all		      * pacekets received simulatneously		      */  int    pktSizeE_;  /* 		      * same as above, but for the total number of bytes that		      * are enqueued between consecutive rate estimations		      */};static class CSFQClass : public TclClass {public:	CSFQClass() : TclClass("Queue/CSFQ") {}	TclObject* create(int argc, const char*const* argv) {		return (new CSFQ);	}} class_csfq;CSFQ::CSFQ(){  for (int i = 0; i < MAXFLOWS; ++i) {    fs_[i].weight_   = 1.0;    fs_[i].k_        = 100000.0;    fs_[i].numArv_   = fs_[i].numDpt_ = fs_[i].numDroped_ = 0;    fs_[i].prevTime_ = 0.0;    fs_[i].estRate_  = 0.0;    fs_[i].size_     = 0;#ifdef SRCID    hashid_[i]       = 0;#endif  }  maxflow_     = -1;  qsizeCrt_    = 0;  alpha_       = tmpAlpha_ = 0.;  kalpha_ = KALPHA; #ifdef PENALTY_BOX  for (int i = 0; i < MONITOR_TABLE_SIZE; i++) {    monitorTable_[i].valid_ = 0;    monitorTable_[i].prevTime_ = monitorTable_[i].estNormRate_ = 0.;      }  for (int i = 0; i < PUNISH_TABLE_SIZE; i++) {    punishTable_[i].valid_ = 0;    punishTable_[i].prevTime_ = monitorTable_[i].estNormRate_ = 0.;      }  numDroppedPkts_ = 0;#endif     lastArv_   = rateAlpha_ = rateTotal_ = 0.;  lArv_      = 0.;   pktSize_   = pktSizeE_ = 0;   congested_ = 1; #ifdef PENALTY_BOX  bind("kLink_", &kDropped_);#endif    bind("kLink_", &kLink_);  edge_ = 1;  bind("edge_", &edge_);  bind("qsize_", &qsize_);  bind("qsizeThresh_", &qsizeThresh_);  bind("rate_", &rate_);  bind("id_", &id_);}int CSFQ::command(int argc, const char*const* argv){  if (argc == 5) { /* flowid, weight_, k_ */    if (strcmp(argv[1], "init-flow") == 0) {      int flowId     = atoi(argv[2]);         if (flowId >= MAXFLOWS) {        fprintf(stderr, "CSFQ: Flow id=%d too large; it should be < %d!\n",          flowId, MAXFLOWS);        abort();      }      fs_[flowId].weight_ = (double)atoi(argv[3]);       fs_[flowId].k_      = (double)atoi(argv[4]);       return (TCL_OK);         }   } else if ((argc == 7) && (strcmp(argv[1], "init-link") == 0)) {    /* edge_, kLink_, qsize_, qsizeThresh_  */    edge_  = atoi(argv[2]);    if (edge_ != 0 && edge_ != 1) {      fprintf(stderr, "CSFQ: Invalide link type !\n");      abort();    }    kLink_       = (double)atoi(argv[3]); #ifdef PENALTY_BOX    kDropped_    = kLink_; #endif    qsize_       = atoi(argv[4]);     qsizeThresh_ = atoi(argv[5]);     rate_        = atof(argv[6]);    return (TCL_OK);  }  return (Queue::command(argc, argv));}/* Receive a new packet.  The flow rate is estimated, and the link's * fair rate (alpha_) is computed. If the packet's label is larger * than alpha_ then a dropping probability is computed, and the * newly-arriving packet is dropped with that probability.  The packet * is also dropped if the maximum queue size is exceeded.   */void CSFQ::enque(Packet* pkt){  double   now  = Scheduler::instance().clock();  hdr_cmn* hdr  = hdr_cmn::access(pkt);   hdr_ip*  hip  = hdr_ip::access(pkt); /* (hdr_ip*)pkt->access(off_ip_); */  int pktSize   = hdr->size() << 3; /* length of the packet in bits */  double pktLabel = hdr->label();#ifdef SRCID  int    flowId   = getId(hip->src());#else  int    flowId   = hip->flowid();#endif  /*    * if this queue belongs to an edge node, estimate session rate    * and label the packet   */   if (edge_ == 1) {#ifdef CSFQ_RLMEX    hdr->setlabel(estRate(1, pktSize, now)/fs_[1].weight_);#else    hdr->setlabel(estRate(flowId, pktSize, now)/fs_[flowId].weight_);#endif    pktLabel = hdr->label();  }#ifdef PENALTY_BOX  /*     * if the flow is monitored and its rate (i.e., the packet label)   * exceeds PUNISH_THRESH times link's fair rate, then punish the   * flow if the flow is punished but its rate is no larger than   * GOOD_THRESH times link's fair rate, then remove flow from penalty   * box.     */  if (monitor(flowId, pktLabel)) {    drop(pkt);    return;  }#endif#ifdef CSFQ_LOG    logEstLabel(flowId, now, pktLabel);#endif#ifdef CSFQ_LOG  logEstAlpha(now);  logArvPacket(flowId, now, pktSize);#endif  /*    * check whether alpha_ has been initialized   * alpha_ is set to 0. whenever qusizeCrt_ < qsizeThreshold_    * (see estAlpha method)   */  if (alpha_ != 0) {     if (alpha_/pktLabel < funifRand(0., 1.)) {      /* drop packet prbabilistically */      dropPkt(flowId, pkt);      /*        * estimate fair rate (alpha_); call with last parameter 0 as        * the packet is probabilistically dropped       */      estAlpha(pktSize, pktLabel, now, 0); #ifdef CSFQ_LOG      logDroppedPacket(flowId, now);#endif      return;    }     

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲丝袜另类动漫二区| 韩国中文字幕2020精品| 亚洲高清在线精品| 麻豆视频一区二区| 精品久久五月天| 亚洲天堂福利av| 日本午夜精品一区二区三区电影| 日韩中文字幕麻豆| 国产高清不卡一区二区| 欧美挠脚心视频网站| 欧美韩国一区二区| 日韩国产欧美在线观看| 成人高清视频免费观看| 欧美乱妇15p| 国产精品免费av| 美女尤物国产一区| 日本韩国欧美一区| 国产日韩欧美精品在线| 首页国产丝袜综合| 99精品在线观看视频| 欧美成人福利视频| 亚洲成av人片在线观看无码| 成人在线综合网| 国产亚洲1区2区3区| 免费成人av资源网| 91福利社在线观看| 中文字幕一区在线观看| 国产成人小视频| 久久午夜老司机| 蜜桃av噜噜一区二区三区小说| 在线视频国产一区| 亚洲女性喷水在线观看一区| 成人免费视频国产在线观看| 2欧美一区二区三区在线观看视频| 五月天网站亚洲| 51精品视频一区二区三区| 亚洲综合色丁香婷婷六月图片| 色av一区二区| 亚洲成人av一区二区| 日本精品视频一区二区三区| 一区二区三区在线免费视频| 欧美视频中文字幕| 亚洲图片一区二区| 欧美精品久久久久久久久老牛影院| 亚洲国产综合91精品麻豆| 欧美日韩一区高清| 狠狠色伊人亚洲综合成人| 久久久一区二区三区| 粉嫩高潮美女一区二区三区| 国产精品美女久久久久久久久久久| 国产91在线看| 亚洲资源中文字幕| 欧美一级在线观看| 懂色av中文一区二区三区| 亚洲日韩欧美一区二区在线| 欧美在线免费播放| 国产精品中文字幕欧美| 亚洲精品视频一区| 日韩一区二区精品| 99亚偷拍自图区亚洲| 日韩精品久久久久久| 欧美激情中文字幕| 91精品国产91综合久久蜜臀| 国产九色精品成人porny| 一区二区欧美精品| 亚洲精品一区二区三区香蕉| 99久久精品情趣| 黑人巨大精品欧美一区| 亚洲美女在线国产| 国产片一区二区三区| 日韩亚洲电影在线| 欧美性xxxxxxxx| 99久久伊人精品| 国产一区欧美日韩| 色婷婷激情综合| 久久www免费人成看片高清| 亚洲视频一区二区免费在线观看| 久久蜜桃一区二区| 日韩你懂的电影在线观看| 欧美三级三级三级| 91啪在线观看| 99久久精品国产导航| 国产成人精品午夜视频免费| 男女男精品网站| 日韩电影在线观看一区| 亚洲国产裸拍裸体视频在线观看乱了| 中文无字幕一区二区三区| 久久影视一区二区| 国产色综合一区| 国产日韩视频一区二区三区| 久久综合av免费| 国产夜色精品一区二区av| 久久综合精品国产一区二区三区 | 亚洲免费伊人电影| 亚洲欧美一区二区三区久本道91| 国产日韩欧美综合在线| 国产精品久久久久毛片软件| 欧美国产日韩精品免费观看| 久久久久国产精品麻豆ai换脸 | 成人v精品蜜桃久久一区| 亚洲成人福利片| 日韩av午夜在线观看| 麻豆精品一区二区av白丝在线| 亚洲123区在线观看| 日韩 欧美一区二区三区| 久久aⅴ国产欧美74aaa| 盗摄精品av一区二区三区| 99久久精品99国产精品| 欧美综合在线视频| 337p日本欧洲亚洲大胆精品| 欧美韩日一区二区三区四区| 亚洲综合在线观看视频| 久久成人免费网站| 97se亚洲国产综合在线| 欧美乱妇20p| 国产精品网站导航| 五月综合激情婷婷六月色窝| 国产一区二区福利视频| 色噜噜久久综合| 精品粉嫩超白一线天av| 亚洲男女毛片无遮挡| 精品一区二区三区免费| 一本到高清视频免费精品| 日韩欧美国产小视频| 亚洲精品视频在线观看免费| 国产精品正在播放| 日韩欧美区一区二| 亚洲精品第1页| 成人免费视频一区| 久久久久久久久97黄色工厂| 男人的j进女人的j一区| 欧美日韩亚洲综合在线| 中文字幕中文字幕一区| 国模大尺度一区二区三区| 欧美日韩另类一区| 亚洲综合久久av| 色噜噜久久综合| 亚洲视频一区在线| 不卡一卡二卡三乱码免费网站| 精品久久久久一区二区国产| 日本中文字幕一区二区有限公司| 91久久精品国产91性色tv| 中文字幕日韩精品一区| 99久久婷婷国产精品综合| 中文字幕巨乱亚洲| 懂色av中文一区二区三区 | 亚洲国产aⅴ成人精品无吗| 色婷婷久久久综合中文字幕| 17c精品麻豆一区二区免费| 国产福利电影一区二区三区| 日韩视频中午一区| 国产在线一区观看| 久久免费视频色| 高清不卡一区二区| 成人欧美一区二区三区黑人麻豆 | 九色综合狠狠综合久久| 久久精品夜色噜噜亚洲aⅴ| 高清beeg欧美| 亚洲一区二区三区自拍| 欧美精品乱码久久久久久| 美女在线视频一区| 日本一区二区成人在线| 欧美无乱码久久久免费午夜一区| 五月激情六月综合| 精品1区2区在线观看| 不卡在线观看av| 日韩国产欧美视频| 久久精品一区二区三区不卡| 99re视频这里只有精品| 欧美aaaaaa午夜精品| 国产亚洲精品福利| 欧美日韩在线综合| 大陆成人av片| 日日骚欧美日韩| 国产精品色哟哟网站| 欧美性感一类影片在线播放| 韩日av一区二区| 亚洲精品久久久久久国产精华液| 欧美一区二区三区免费在线看| 成人三级伦理片| 国产精品正在播放| 日韩一区精品视频| 亚洲精品久久7777| 中文字幕免费一区| 久久婷婷综合激情| 日韩免费电影一区| 欧美精品tushy高清| 91九色02白丝porn| a4yy欧美一区二区三区| 国内外精品视频| 久久不见久久见免费视频7| 五月婷婷久久综合| 亚洲综合男人的天堂| 玉米视频成人免费看| 日韩毛片视频在线看| 中文字幕一区二区在线观看| 中日韩免费视频中文字幕| 久久久精品tv| 中文字幕av一区二区三区高 | 亚洲高清免费一级二级三级|