blob: ee4160e022fc1857a09905d4cf11780ccf1b89c8 [file] [log] [blame]
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -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#include "ndn-limits.h"
22
23#include "ns3/log.h"
24#include "ns3/simulator.h"
Alexander Afanasyev6a3bb132012-08-15 09:47:35 -070025#include "ns3/random-variable.h"
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070026
27NS_LOG_COMPONENT_DEFINE ("ndn.Limits");
28
29namespace ns3 {
30namespace ndn {
31
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070032TypeId
33Limits::GetTypeId ()
34{
35 static TypeId tid = TypeId ("ns3::ndn::Limits")
36 .SetGroupName ("Ndn")
37 .SetParent <Object> ()
Alexander Afanasyev6a3bb132012-08-15 09:47:35 -070038
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070039 ;
40 return tid;
41}
42
Alexander Afanasyev08ab5722012-11-06 17:22:25 -080043Limits::Limits ()
44 : m_maxRate (-1)
45 , m_maxDelay (1.0)
46 , m_handler (MakeNullCallback<void> ())
47{
48}
49
50
51void
52Limits::RegisterAvailableSlotCallback (CallbackHandler handler)
53{
54 m_handler = handler;
55}
56
57void
58Limits::FireAvailableSlotCallback ()
59{
60 if (!m_handler.IsNull ())
61 m_handler ();
62}
63
64
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070065} // namespace ndn
66} // namespace ns3