Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 1 | /* -*- 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 Afanasyev | 6a3bb13 | 2012-08-15 09:47:35 -0700 | [diff] [blame] | 25 | #include "ns3/random-variable.h" |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 26 | |
| 27 | NS_LOG_COMPONENT_DEFINE ("ndn.Limits"); |
| 28 | |
| 29 | namespace ns3 { |
| 30 | namespace ndn { |
| 31 | |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 32 | TypeId |
| 33 | Limits::GetTypeId () |
| 34 | { |
| 35 | static TypeId tid = TypeId ("ns3::ndn::Limits") |
| 36 | .SetGroupName ("Ndn") |
| 37 | .SetParent <Object> () |
Alexander Afanasyev | 6a3bb13 | 2012-08-15 09:47:35 -0700 | [diff] [blame] | 38 | |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 39 | ; |
| 40 | return tid; |
| 41 | } |
| 42 | |
Alexander Afanasyev | 08ab572 | 2012-11-06 17:22:25 -0800 | [diff] [blame] | 43 | Limits::Limits () |
| 44 | : m_maxRate (-1) |
| 45 | , m_maxDelay (1.0) |
| 46 | , m_handler (MakeNullCallback<void> ()) |
Alexander Afanasyev | a8f5d88 | 2012-11-09 14:22:48 -0800 | [diff] [blame^] | 47 | , m_linkDelay (0) |
Alexander Afanasyev | 08ab572 | 2012-11-06 17:22:25 -0800 | [diff] [blame] | 48 | { |
| 49 | } |
| 50 | |
| 51 | |
| 52 | void |
| 53 | Limits::RegisterAvailableSlotCallback (CallbackHandler handler) |
| 54 | { |
| 55 | m_handler = handler; |
| 56 | } |
| 57 | |
| 58 | void |
| 59 | Limits::FireAvailableSlotCallback () |
| 60 | { |
| 61 | if (!m_handler.IsNull ()) |
| 62 | m_handler (); |
| 63 | } |
| 64 | |
| 65 | |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 66 | } // namespace ndn |
| 67 | } // namespace ns3 |