1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 /* 3 * Copyright (c) 2016 Universita' degli Studi di Napoli Federico II 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License version 2 as 7 * published by the Free Software Foundation; 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * 18 * Authors: Pasquale Imputato <p.imputato@gmail.com> 19 * Stefano Avallone <stefano.avallone@unina.it> 20 */ 21 22 #ifndef QUEUE_LIMITS_H 23 #define QUEUE_LIMITS_H 24 25 #include "ns3/object.h" 26 27 namespace ns3 { 28 29 /** 30 * \ingroup network 31 * 32 * \brief Abstract base class for NetDevice queue length controller 33 * 34 * QueueLimits is an abstract base class providing the interface to 35 * the NetDevice queue length controller. 36 * 37 * Child classes need to implement the methods used for a byte-based 38 * measure of the queue length. 39 * 40 * The design and implementation of this class is inspired by Linux. 41 * For more details, see the queue limits Sphinx documentation. 42 */ 43 class QueueLimits : public Object { 44 public: 45 /** 46 * \brief Get the type ID. 47 * \return the object TypeId 48 */ 49 static TypeId GetTypeId (void); 50 51 virtual ~QueueLimits (); 52 53 /** 54 * \brief Reset queue limits state 55 */ 56 virtual void Reset () = 0; 57 58 /** 59 * \brief Record number of completed bytes and recalculate the limit 60 * \param count the number of completed bytes 61 */ 62 virtual void Completed (uint32_t count) = 0; 63 64 /** 65 * Available is called from NotifyTransmittedBytes to calculate the 66 * number of bytes that can be passed again to the NetDevice. 67 * A negative value means that no packets can be passed to the NetDevice. 68 * In this case, NotifyTransmittedBytes stops the transmission queue. 69 * \brief Returns how many bytes can be queued 70 * \return the number of bytes that can be queued 71 */ 72 virtual int32_t Available () const = 0; 73 74 /** 75 * \brief Record the number of bytes queued 76 * \param count the number of bytes queued 77 */ 78 virtual void Queued (uint32_t count) = 0; 79 }; 80 81 } // namespace ns3 82 83 #endif /* QUEUE_LIMITS_H */ 84