NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Groups
Pages
flooding.cc
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
* Ilya Moiseenko <iliamo@cs.ucla.edu>
20
*/
21
22
#include "flooding.h"
23
24
#include "ns3/ndn-interest.h"
25
#include "ns3/ndn-pit.h"
26
#include "ns3/ndn-pit-entry.h"
27
28
#include "ns3/assert.h"
29
#include "ns3/log.h"
30
#include "ns3/simulator.h"
31
#include "ns3/boolean.h"
32
33
#include <boost/ref.hpp>
34
#include <boost/foreach.hpp>
35
#include <boost/lambda/lambda.hpp>
36
#include <boost/lambda/bind.hpp>
37
namespace
ll = boost::lambda;
38
39
namespace
ns3 {
40
namespace
ndn {
41
namespace
fw {
42
43
NS_OBJECT_ENSURE_REGISTERED (Flooding);
44
45
LogComponent Flooding::g_log = LogComponent (
Flooding::GetLogName
().c_str ());
46
47
std::string
48
Flooding::GetLogName
()
49
{
50
return
super::GetLogName
()+
".Flooding"
;
51
}
52
53
TypeId Flooding::GetTypeId ()
54
{
55
static
TypeId tid = TypeId (
"ns3::ndn::fw::Flooding"
)
56
.SetGroupName (
"Ndn"
)
57
.SetParent <
Nacks
> ()
58
.AddConstructor <Flooding> ()
59
;
60
return
tid;
61
}
62
63
Flooding::Flooding
()
64
{
65
}
66
67
bool
68
Flooding::DoPropagateInterest
(Ptr<Face> inFace,
69
Ptr<const Interest> interest,
70
Ptr<pit::Entry> pitEntry)
71
{
72
NS_LOG_FUNCTION (
this
);
73
74
int
propagatedCount = 0;
75
76
BOOST_FOREACH (
const
fib::FaceMetric
&metricFace, pitEntry->GetFibEntry ()->m_faces.get<fib::i_metric> ())
77
{
78
NS_LOG_DEBUG (
"Trying "
<< boost::cref(metricFace));
79
if
(metricFace.
GetStatus
() == fib::FaceMetric::NDN_FIB_RED)
// all non-read faces are in the front of the list
80
break
;
81
82
if
(!
TrySendOutInterest
(inFace, metricFace.
GetFace
(), interest, pitEntry))
83
{
84
continue
;
85
}
86
87
propagatedCount++;
88
}
89
90
NS_LOG_INFO (
"Propagated to "
<< propagatedCount <<
" faces"
);
91
return
propagatedCount > 0;
92
}
93
94
}
// namespace fw
95
}
// namespace ndn
96
}
// namespace ns3
ns3::ndn::fw::Flooding::GetLogName
static std::string GetLogName()
Helper function to retrieve logging name for the forwarding strategy.
Definition:
flooding.cc:48
ns3::ndn::fib::FaceMetric::GetFace
Ptr< Face > GetFace() const
Return Face associated with FaceMetric.
Definition:
ndn-fib-entry.h:99
ns3::ndn::ForwardingStrategy::GetLogName
static std::string GetLogName()
Helper function to retrieve logging name for the forwarding strategy.
Definition:
ndn-forwarding-strategy.cc:57
ns3::ndn::fib::FaceMetric
Structure holding various parameters associated with a (FibEntry, Face) tuple.
Definition:
ndn-fib-entry.h:58
ns3::ndn::fw::Flooding::DoPropagateInterest
virtual bool DoPropagateInterest(Ptr< Face > inFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
Virtual method to perform Interest propagation according to the forwarding strategy logic...
Definition:
flooding.cc:68
ns3::ndn::fw::Flooding::Flooding
Flooding()
Default constructor.
Definition:
flooding.cc:63
ns3::ndn::fib::FaceMetric::GetStatus
Status GetStatus() const
Get current status of FIB entry.
Definition:
ndn-fib-entry.h:112
ns3::ndn::fw::Nacks
Implementation of experimental NACK messages (enables with EnableNACKs option)
Definition:
nacks.h:33
ns3::ndn::ForwardingStrategy::TrySendOutInterest
virtual bool TrySendOutInterest(Ptr< Face > inFace, Ptr< Face > outFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
Method implementing actual interest forwarding, taking into account CanSendOutInterest decision...
Definition:
ndn-forwarding-strategy.cc:523
ndnSIM
model
fw
flooding.cc
Generated on Mon Jan 19 2015 11:27:03 for ndnSIM by
1.8.7