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

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

?? csfq.cc

?? 里面包含fred,util,csfq這三種演算法的程式碼,適用于NS2開發(fā)環(huán)境
?? 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一区二区三区免费野_久草精品视频
国产精品久久久久9999吃药| 不卡电影一区二区三区| 欧美日本国产视频| 一区二区日韩av| 99国产精品久久久久久久久久| 国产欧美日本一区二区三区| 懂色中文一区二区在线播放| 中文字幕亚洲一区二区va在线| 成人一区二区三区| 亚洲激情图片小说视频| 欧美性xxxxx极品少妇| 午夜精品视频一区| 在线播放91灌醉迷j高跟美女| 亚洲欧美另类小说| 亚洲欧洲av色图| 91麻豆免费看片| 亚洲国产你懂的| 日韩欧美一区二区三区在线| 激情综合五月天| 欧美国产综合色视频| 91蜜桃在线免费视频| 亚洲bt欧美bt精品777| 精品少妇一区二区三区日产乱码| 国产毛片精品国产一区二区三区| 国产精品成人免费| 欧美日韩的一区二区| 国产乱国产乱300精品| 中文字幕一区二区三区在线播放 | 亚洲图片欧美视频| 欧美一级久久久久久久大片| 不卡在线视频中文字幕| 午夜电影一区二区| 欧美人伦禁忌dvd放荡欲情| 欧美电影免费观看高清完整版在 | 天堂成人免费av电影一区| 日韩美女视频一区二区在线观看| 波多野结衣精品在线| 爽好久久久欧美精品| 国产欧美一区二区精品性色超碰 | 国产精品一区二区果冻传媒| 亚洲免费在线视频| 欧美成人艳星乳罩| 日本乱码高清不卡字幕| 国产美女久久久久| 视频一区二区不卡| 国产精品对白交换视频| 日韩午夜在线观看视频| 99久久久精品| 国产一区啦啦啦在线观看| 亚洲成人在线观看视频| av午夜精品一区二区三区| 婷婷久久综合九色综合伊人色| 欧美国产成人精品| 日韩精品资源二区在线| 91久久精品一区二区二区| 国产成人精品免费| 蜜臀精品一区二区三区在线观看 | 成人美女视频在线看| 免费人成精品欧美精品| 亚洲国产精品一区二区www| 国产精品久久午夜| 久久久久久一二三区| 欧美一区二区成人6969| 欧美性xxxxx极品少妇| 一道本成人在线| 99久久er热在这里只有精品66| 国产精品1区2区| 国产在线视频一区二区| 经典三级视频一区| 美女视频网站久久| 蜜臀av性久久久久蜜臀aⅴ| 欧美mv和日韩mv国产网站| 欧美伊人久久久久久午夜久久久久| 国产成人av自拍| 国产一区二区0| 极品少妇一区二区| 美日韩一级片在线观看| 国产精品网站导航| 国产精品对白交换视频 | 欧美日韩黄视频| av在线一区二区三区| 精品无人码麻豆乱码1区2区| 亚洲精选视频免费看| 日本一区二区成人在线| 国产乱码精品一区二区三区忘忧草| 日本欧美大码aⅴ在线播放| 亚洲三级久久久| 91精品欧美福利在线观看| 成人黄色小视频在线观看| 中文字幕亚洲在| 国产欧美日本一区视频| 久久一夜天堂av一区二区三区| 欧美日韩三级一区| 欧美三级中文字幕在线观看| 麻豆专区一区二区三区四区五区| 日韩免费视频一区二区| 欧美日韩视频在线一区二区| 欧美专区亚洲专区| av中文字幕一区| 成人一区在线看| 成人亚洲一区二区一| 国产黄人亚洲片| 丰满放荡岳乱妇91ww| 国产91精品久久久久久久网曝门| 国产一区二区三区高清播放| 狠狠色丁香久久婷婷综| 国产原创一区二区| aaa亚洲精品| 一本色道久久综合亚洲91 | 激情综合色综合久久综合| 麻豆91小视频| 一区二区久久久| 亚洲va欧美va天堂v国产综合| 石原莉奈在线亚洲二区| 五月婷婷另类国产| 久久99精品久久久| 成人激情动漫在线观看| 91小视频免费观看| 青青草视频一区| 精品电影一区二区三区| 精品入口麻豆88视频| 久久久久久久性| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆 | 国产一区二区三区四区五区入口| 麻豆国产精品视频| 国产成人小视频| 91色九色蝌蚪| 欧美一区二视频| 久久综合久久鬼色中文字| 亚洲综合成人网| 美女被吸乳得到大胸91| 成人中文字幕在线| 欧美性高清videossexo| 精品国产91亚洲一区二区三区婷婷| 国产精品无圣光一区二区| 国产精品成人免费在线| 久久精品99国产国产精| 成人精品鲁一区一区二区| 在线日韩一区二区| 欧美一级视频精品观看| 国产精品国产三级国产普通话蜜臀| 极品少妇一区二区| 国产精品免费免费| 亚洲不卡一区二区三区| 另类小说图片综合网| 色综合天天综合网天天看片| 日韩一区国产二区欧美三区| 国产精品青草久久| 毛片av一区二区三区| 一本久久a久久精品亚洲| 精品伦理精品一区| 一区二区免费视频| 国产精品中文欧美| 欧美日韩精品一区视频| 中文久久乱码一区二区| 青青草一区二区三区| 91国在线观看| 中文字幕高清不卡| 亚洲第一久久影院| 色综合色狠狠综合色| 久久你懂得1024| 免费久久精品视频| 欧美私模裸体表演在线观看| 中文成人综合网| 国产精品一二三| 欧美一区二视频| 亚洲国产精品麻豆| 成人自拍视频在线观看| 欧美精品一区二区三区蜜臀| 亚洲成人手机在线| 欧美一卡二卡在线| 日本精品视频一区二区| 欧美日韩国产不卡| 亚洲激情男女视频| 成人动漫精品一区二区| 精品久久人人做人人爽| 日韩精品一区第一页| 色综合久久99| 18成人在线观看| 麻豆精品久久精品色综合| 欧美综合久久久| 亚洲精品成人天堂一二三| 成人精品在线视频观看| 国产偷国产偷精品高清尤物| 国产尤物一区二区| 久久亚洲综合色一区二区三区| 日本不卡123| 日韩欧美在线一区二区三区| 亚洲午夜视频在线| 欧美精品九九99久久| 天天综合色天天综合| 7777精品伊人久久久大香线蕉超级流畅| 一区二区三区在线视频观看58| 色婷婷综合五月| 国产精品福利av| 日本乱人伦aⅴ精品| 亚洲动漫第一页| 日韩欧美国产精品一区| 国产综合一区二区| 另类的小说在线视频另类成人小视频在线 |