Alexander Afanasyev | 79a5bd6 | 2013-06-23 22:12:39 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2013 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-api-app.h" |
| 22 | |
| 23 | NS_LOG_COMPONENT_DEFINE ("ndn.ApiApp"); |
| 24 | |
| 25 | namespace ns3 { |
| 26 | namespace ndn { |
| 27 | |
| 28 | // Necessary if you are planning to use ndn::AppHelper |
| 29 | NS_OBJECT_ENSURE_REGISTERED (ApiApp); |
| 30 | |
| 31 | TypeId |
| 32 | ApiApp::GetTypeId () |
| 33 | { |
| 34 | static TypeId tid = TypeId ("ns3::ndn::ApiApp") |
| 35 | .SetParent<Application> () |
| 36 | .AddConstructor<ApiApp> () |
| 37 | ; |
| 38 | |
| 39 | return tid; |
| 40 | } |
| 41 | |
| 42 | ApiApp::ApiApp () |
| 43 | { |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame^] | 44 | // m_handler = CreateObject<Handler> (); |
Alexander Afanasyev | 79a5bd6 | 2013-06-23 22:12:39 -0700 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | void |
| 48 | ApiApp::RequestData () |
| 49 | { |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame^] | 50 | // m_handler->sendInterest ("/test/prefix", boost::bind (&ApiApp::OnData |
Alexander Afanasyev | 79a5bd6 | 2013-06-23 22:12:39 -0700 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | void |
| 54 | ApiApp::StartApplication () |
| 55 | { |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame^] | 56 | // m_handler->SetNode (GetNode ()); |
| 57 | // m_handler->StartApplication (); |
Alexander Afanasyev | 79a5bd6 | 2013-06-23 22:12:39 -0700 | [diff] [blame] | 58 | |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame^] | 59 | // Simulator::Schedule (Seconds (1), &::ns3::ndn::ApiApp::RequestData, this); |
Alexander Afanasyev | 79a5bd6 | 2013-06-23 22:12:39 -0700 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | void |
| 63 | ApiApp::StopApplication () |
| 64 | { |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame^] | 65 | // m_handler->StopApplication (); |
Alexander Afanasyev | 79a5bd6 | 2013-06-23 22:12:39 -0700 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | } // namespace ndn |
| 69 | } // namespace ns3 |
| 70 | |