drop-tail.h
上传用户:sdhqmy
上传日期:2015-12-07
资源大小:63k
文件大小:3k
源码类别:

3G开发

开发平台:

C/C++

  1. /* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
  2. /*
  3.  * Copyright (c) 1994 Regents of the University of California.
  4.  * All rights reserved.
  5.  *
  6.  * Redistribution and use in source and binary forms, with or without
  7.  * modification, are permitted provided that the following conditions
  8.  * are met:
  9.  * 1. Redistributions of source code must retain the above copyright
  10.  *    notice, this list of conditions and the following disclaimer.
  11.  * 2. Redistributions in binary form must reproduce the above copyright
  12.  *    notice, this list of conditions and the following disclaimer in the
  13.  *    documentation and/or other materials provided with the distribution.
  14.  * 3. All advertising materials mentioning features or use of this software
  15.  *    must display the following acknowledgement:
  16.  * This product includes software developed by the Computer Systems
  17.  * Engineering Group at Lawrence Berkeley Laboratory.
  18.  * 4. Neither the name of the University nor of the Laboratory may be used
  19.  *    to endorse or promote products derived from this software without
  20.  *    specific prior written permission.
  21.  *
  22.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  23.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  26.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  28.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  29.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  31.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32.  * SUCH DAMAGE.
  33.  *
  34.  * @(#) $Header: /nfs/jade/vint/CVSROOT/ns-2/queue/drop-tail.h,v 1.17 2002/01/01 04:26:10 sfloyd Exp $ (LBL)
  35.  */
  36. #ifndef ns_drop_tail_h
  37. #define ns_drop_tail_h
  38. #include <string.h>
  39. #include "queue.h"
  40. #include "config.h"
  41. /*
  42.  * A bounded, drop-tail queue
  43.  */
  44. class DropTail : public Queue {
  45.   public:
  46. DropTail() { 
  47. q_ = new PacketQueue; 
  48. pq_ = q_;
  49. bind_bool("drop_front_", &drop_front_);
  50. bind_bool("summarystats_", &summarystats);
  51. bind_bool("queue_in_bytes_", &qib_);  // boolean: q in bytes?
  52. bind("mean_pktsize_", &mean_pktsize_);
  53. // _RENAMED("drop-front_", "drop_front_");
  54. }
  55. ~DropTail() {
  56. delete q_;
  57. }
  58.   protected:
  59. void reset();
  60. int command(int argc, const char*const* argv); 
  61. void enque(Packet*);
  62. Packet* deque();
  63. //JUNGMIN
  64. int BuildQState(int*, int);
  65. void ReturnPacket(Packet* p);
  66. //end of JUNGMIN
  67. PacketQueue *q_; /* underlying FIFO queue */
  68. int drop_front_; /* drop-from-front (rather than from tail) */
  69. int summarystats;
  70. void print_summarystats();
  71. int qib_;        /* bool: queue measured in bytes? */
  72. int mean_pktsize_; /* configured mean packet size in bytes */
  73. };
  74. #endif