00001 /* 00002 * Copyright (c) 2000-2002, by the Rector and Board of Visitors of the 00003 * University of Virginia. 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, 00007 * with or without modification, are permitted provided 00008 * that the following conditions are met: 00009 * 00010 * Redistributions of source code must retain the above 00011 * copyright notice, this list of conditions and the following 00012 * disclaimer. 00013 * 00014 * Redistributions in binary form must reproduce the above 00015 * copyright notice, this list of conditions and the following 00016 * disclaimer in the documentation and/or other materials provided 00017 * with the distribution. 00018 * 00019 * Neither the name of the University of Virginia nor the names 00020 * of its contributors may be used to endorse or promote products 00021 * derived from this software without specific prior written 00022 * permission. 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 00025 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 00026 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00027 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00028 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE 00029 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 00030 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00032 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00033 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00034 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00035 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 00036 * THE POSSIBILITY OF SUCH DAMAGE. 00037 */ 00038 /* 00039 * 00040 * Marker module for JoBS (and WTP). 00041 * 00042 * Authors: Constantinos Dovrolis <dovrolis@mail.eecis.udel.edu>, 00043 * Nicolas Christin <nicolas@cs.virginia.edu>, 2000-2002 00044 * 00045 * $Id: marker.h,v 1.1 2003/02/02 22:18:22 xuanc Exp $ 00046 */ 00047 #ifndef MARKER_H 00048 #define MARKER_H 00049 00050 #define NO_CLASSES 4 // This number cannot be changed 00051 // w/o modifying the code. 00052 // This is, again, a prototype 00053 // implementation... 00054 #define DETERM 1 // Deterministic marker: all traffic is marked with 00055 // given class (marker_class_) 00056 #define STATIS 2 // Probabilistic marker: class-marking follow given 00057 // (cumulative) distribution 00058 00059 class Marker: public Queue { 00060 public: 00061 Marker(); 00062 virtual int command(int argc, const char*const* argv); 00063 void enque(Packet*); 00064 Packet* deque(); 00065 double marker_arrvs_[NO_CLASSES+1]; // For monitoring purposes 00066 protected: 00067 int marker_type_; // Marker type 00068 double marker_frc_[NO_CLASSES+1]; // Class-marking fractions 00069 // (STATIS) 00070 // marker_frc_ represent the 00071 // *cumulative* marking distribution 00072 int marker_class_; // Fixed class marking (DETERM) 00073 PacketQueue *q_; // Underlying FIFO queue 00074 int rn_seed_; // Random seed 00075 }; 00076 00077 #endif /* MARKER_H */