blob: 037b313ad3430b03b6c8c3d0480bf2443c8fe211 [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
Alexander Afanasyev0c395372014-12-20 15:54:02 -080021#include "ndn-limits.hpp"
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070022
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
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080027NS_LOG_COMPONENT_DEFINE("ndn.Limits");
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070028
29namespace ns3 {
30namespace ndn {
31
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070032TypeId
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080033Limits::GetTypeId()
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070034{
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080035 static TypeId tid = TypeId("ns3::ndn::Limits").SetGroupName("Ndn").SetParent<Object>()
36
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070037 ;
38 return tid;
39}
40
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080041Limits::Limits()
42 : m_maxRate(-1)
43 , m_maxDelay(1.0)
44 , m_handler(MakeNullCallback<void>())
45 , m_linkDelay(0)
Alexander Afanasyev08ab5722012-11-06 17:22:25 -080046{
47}
48
Alexander Afanasyev08ab5722012-11-06 17:22:25 -080049void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080050Limits::RegisterAvailableSlotCallback(CallbackHandler handler)
Alexander Afanasyev08ab5722012-11-06 17:22:25 -080051{
52 m_handler = handler;
53}
54
55void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080056Limits::FireAvailableSlotCallback()
Alexander Afanasyev08ab5722012-11-06 17:22:25 -080057{
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080058 if (!m_handler.IsNull())
59 m_handler();
Alexander Afanasyev08ab5722012-11-06 17:22:25 -080060}
61
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070062} // namespace ndn
63} // namespace ns3