00001 /* -*- Mode:C++; c-basic-offset:2; tab-width:2; indent-tabs-mode:t -*- */ 00002 /* 00003 * Copyright (c) 1994 Regents of the University of California. 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 1. Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * 2. Redistributions in binary form must reproduce the above copyright 00012 * notice, this list of conditions and the following disclaimer in the 00013 * documentation and/or other materials provided with the distribution. 00014 * 3. All advertising materials mentioning features or use of this software 00015 * must display the following acknowledgement: 00016 * This product includes software developed by the Computer Systems 00017 * Engineering Group at Lawrence Berkeley Laboratory. 00018 * 4. Neither the name of the University nor of the Laboratory may be used 00019 * to endorse or promote products derived from this software without 00020 * specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00023 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00024 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00025 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00026 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00027 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00028 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00029 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00030 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00031 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00032 * SUCH DAMAGE. 00033 * 00034 * @(#) $Header: /usr/src/mash/repository/vint/ns-2/drop-tail.h,v 1.8 1998/06/27 01 00035 :23:45 gnguyen Exp $ (LBL) 00036 */ 00037 /* This version of this program contains teh token-bucket formulation. 00038 For a non token-bucket formulation and for one that is tested, please 00039 look at vq_plain.cc and vq_plain.h 00040 - Srisankar 00041 01/07/2001. 00042 */ 00043 00044 #ifndef ns_vq_h 00045 #define ns_vq_h 00046 00047 #include <string.h> 00048 #include "queue.h" 00049 #include "assert.h" 00050 00051 class Vq; 00052 00053 class LinkDelay; 00054 00055 class Vq : public Queue { 00056 public: 00057 Vq(const char *); 00058 protected: 00059 int command(int argc, const char*const* argv); 00060 void enque(Packet*); 00061 Packet* deque(); 00062 int checkPacketForECN(); 00063 void markPacketForECN(Packet* pkt); 00064 void dropPacketForECN(Packet* pkt); 00065 00066 LinkDelay* link_; /* outgoing link */ 00067 PacketQueue *q_; /* underlying FIFO queue */ 00068 int drop_front_; /* drop-from-front (rather than from tail) */ 00069 double ecnlim_; /* Limit when ecn marking comes into effect*/ 00070 double buflim_; 00071 double vq_len; 00072 double c_; 00073 double prev_time; 00074 double vqprev_time; 00075 double curr_time; 00076 double alpha2; 00077 double gamma_; 00078 int qib_; /* bool: queue measured in bytes? */ 00079 double ctilde; // Virtual Capacity 00080 int markpkts_; // Whether to mark or drop packets 00081 int markfront_; // Mark Front? 00082 int firstpkt; 00083 int Pktdrp; 00084 int pkt_cnt; 00085 long int qlength; 00086 int mean_pktsize_; 00087 00088 FILE *fp; 00089 00090 // added to be able to trace EDrop Objects 00091 // the other events - forced drop, enque and deque are traced by a 00092 // different mechanism. 00093 NsObject * EDTrace; //early drop trace 00094 char traceType[20]; /* the preferred type for early drop trace. 00095 better be less than 19 chars long */ 00096 Tcl_Channel tchan_; /* place to write trace records */ 00097 TracedInt curq_; /* current qlen seen by arrivals */ 00098 void trace(TracedVar*); /* routine to write trace records */ 00099 }; 00100 00101 #endif