blob: b1f220815a313b6e0615630bad15a476775165bb [file] [log] [blame]
Alexander Afanasyevf5c07742012-10-31 13:13:05 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2011 University of California, Los Angeles
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 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 */
20
21#ifndef _NDN_LIMITS_WINDOW_H_
22#define _NDN_LIMITS_WINDOW_H_
23
24#include "ndn-limits.h"
25
26namespace ns3 {
27namespace ndn {
28
29/**
30 * \ingroup ndn
31 * \brief Structure to manage limits for outstanding interests
32 */
33class LimitsWindow :
34 public Limits
35{
36public:
37 typedef Limits super;
38
39 static TypeId
40 GetTypeId ();
41
42 /**
43 * \brief Constructor
44 * \param prefix smart pointer to the prefix for the FIB entry
45 */
46 LimitsWindow ()
47 : m_outstanding (0)
48 { }
49
50 virtual
51 ~LimitsWindow () { }
52
53
54 // from limits
55 virtual bool
56 IsBelowLimit ();
57
58 ////////////////////////////////////////////////////////////////////////////
59 ////////////////////////////////////////////////////////////////////////////
60 ////////////////////////////////////////////////////////////////////////////
61
62 // specific to window-based limits
63
64 /**
65 * @brief Remove outstanding interests
66 */
67 void
68 RemoveOutstanding ();
69
70 double
71 GetOutstanding () const
72 {
73 return m_outstanding;
74 }
75
76protected:
77 TracedValue< double > m_outstanding;
78};
79
80
81} // namespace ndn
82} // namespace ns3
83
84#endif // _NDN_LIMITS_WINDOW_H_