blob: 704663448ecddeca1a5fb4046337eca0cb18ced2 [file] [log] [blame]
Alexander Afanasyev7fd74f92011-08-25 19:40:17 -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 Afanasyev4aac5572012-08-09 10:49:55 -070021#include "ndn-fib.h"
Alexander Afanasyev7fd74f92011-08-25 19:40:17 -070022
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070023#include "ndn-fib-impl.h"
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -070024
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070025#include "ns3/ndn.h"
26#include "ns3/ndn-face.h"
27#include "ns3/ndn-interest-header.h"
28#include "ns3/ndn-name-components.h"
Alexander Afanasyeve3d126f2012-07-16 17:07:31 -070029
Alexander Afanasyev78057c32012-07-06 15:18:46 -070030#include "ns3/node.h"
31#include "ns3/names.h"
Alexander Afanasyev7fd74f92011-08-25 19:40:17 -070032
Alexander Afanasyev8e2f1122012-04-17 15:01:11 -070033#include <boost/ref.hpp>
Alexander Afanasyeva46844b2011-11-21 19:13:26 -080034#include <boost/lambda/lambda.hpp>
Alexander Afanasyev19426ef2011-11-23 20:55:28 -080035#include <boost/lambda/bind.hpp>
36namespace ll = boost::lambda;
Alexander Afanasyeva46844b2011-11-21 19:13:26 -080037
Alexander Afanasyev7fd74f92011-08-25 19:40:17 -070038namespace ns3 {
39
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070040using namespace __ndn_private;
Alexander Afanasyev7fd74f92011-08-25 19:40:17 -070041
Alexander Afanasyev44bb6ea2012-07-09 08:44:41 -070042TypeId
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070043NdnFib::GetTypeId (void)
Alexander Afanasyev44bb6ea2012-07-09 08:44:41 -070044{
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070045 static TypeId tid = TypeId ("ns3::private::NdnFib") // cheating ns3 object system
Alexander Afanasyev95a4fa32012-07-09 15:23:59 -070046 .SetParent<Object> ()
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070047 .SetGroupName ("Ndn")
Alexander Afanasyev95a4fa32012-07-09 15:23:59 -070048 ;
49 return tid;
Alexander Afanasyev44bb6ea2012-07-09 08:44:41 -070050}
51
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070052std::ostream& operator<< (std::ostream& os, const NdnFib &fib)
Alexander Afanasyev7fd74f92011-08-25 19:40:17 -070053{
Alexander Afanasyev78057c32012-07-06 15:18:46 -070054 os << "Node " << Names::FindName (fib.GetObject<Node>()) << "\n";
Alexander Afanasyev7fd74f92011-08-25 19:40:17 -070055 os << " Dest prefix Interfaces(Costs) \n";
56 os << "+-------------+--------------------------------------+\n";
Alexander Afanasyev78057c32012-07-06 15:18:46 -070057
58 fib.Print (os);
Alexander Afanasyev7fd74f92011-08-25 19:40:17 -070059 return os;
60}
61
Alexander Afanasyev7fd74f92011-08-25 19:40:17 -070062} // namespace ns3