marker.h
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:3k
源码类别:

通讯编程

开发平台:

Visual C++

  1. /*
  2.  * Copyright (c) 2000-2002, by the Rector and Board of Visitors of the 
  3.  * University of Virginia.
  4.  * All rights reserved.
  5.  *
  6.  * Redistribution and use in source and binary forms, 
  7.  * with or without modification, are permitted provided 
  8.  * that the following conditions are met:
  9.  *
  10.  * Redistributions of source code must retain the above 
  11.  * copyright notice, this list of conditions and the following 
  12.  * disclaimer. 
  13.  *
  14.  * Redistributions in binary form must reproduce the above 
  15.  * copyright notice, this list of conditions and the following 
  16.  * disclaimer in the documentation and/or other materials provided 
  17.  * with the distribution. 
  18.  *
  19.  * Neither the name of the University of Virginia nor the names 
  20.  * of its contributors may be used to endorse or promote products 
  21.  * derived from this software without specific prior written 
  22.  * permission. 
  23.  *
  24.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
  25.  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
  26.  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
  27.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
  28.  * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE 
  29.  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
  30.  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
  31.  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
  32.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 
  33.  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
  34.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
  35.  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
  36.  * THE POSSIBILITY OF SUCH DAMAGE.
  37.  */
  38. /*
  39.  *                                                                     
  40.  * Marker module for JoBS (and WTP).
  41.  *                                                                     
  42.  * Authors: Constantinos Dovrolis <dovrolis@mail.eecis.udel.edu>, 
  43.  *          Nicolas Christin <nicolas@cs.virginia.edu>, 2000-2002       
  44.  *       
  45.  * $Id: marker.h,v 1.1 2003/02/02 22:18:22 xuanc Exp $
  46.  */
  47. #ifndef MARKER_H
  48. #define MARKER_H
  49. #define NO_CLASSES 4 // This number cannot be changed 
  50. // w/o modifying the code. 
  51. // This is, again, a prototype 
  52. // implementation...
  53. #define DETERM 1 // Deterministic marker: all traffic is marked with 
  54. // given class (marker_class_)
  55. #define STATIS 2 // Probabilistic marker: class-marking follow given
  56. // (cumulative) distribution
  57. class Marker: public Queue {
  58. public:
  59. Marker();
  60. virtual int command(int argc, const char*const* argv); 
  61. void enque(Packet*);
  62. Packet* deque();
  63. double  marker_arrvs_[NO_CLASSES+1]; // For monitoring purposes
  64. protected:
  65. int marker_type_;  // Marker type 
  66. double marker_frc_[NO_CLASSES+1]; // Class-marking fractions 
  67.    // (STATIS)
  68. // marker_frc_ represent the 
  69. // *cumulative* marking distribution
  70. int  marker_class_; // Fixed class marking (DETERM)
  71. PacketQueue *q_; // Underlying FIFO queue 
  72. int rn_seed_; // Random seed
  73. };
  74. #endif /* MARKER_H */