Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 2 | /* |
Ilya Moiseenko | 956d054 | 2012-01-02 15:26:40 -0800 | [diff] [blame] | 3 | * Copyright (c) 2011 University of California, Los Angeles |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 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 | * |
Alexander Afanasyev | 56f79ea | 2011-08-17 23:54:27 -0700 | [diff] [blame] | 18 | * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 19 | * |
| 20 | */ |
| 21 | |
Alexander Afanasyev | 0c39537 | 2014-12-20 15:54:02 -0800 | [diff] [blame] | 22 | #include "ndn-face.hpp" |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 23 | |
Alexander Afanasyev | 19426ef | 2011-11-23 20:55:28 -0800 | [diff] [blame] | 24 | #include "ns3/packet.h" |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 25 | #include "ns3/log.h" |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 26 | #include "ns3/node.h" |
Alexander Afanasyev | 7fd74f9 | 2011-08-25 19:40:17 -0700 | [diff] [blame] | 27 | #include "ns3/assert.h" |
Alexander Afanasyev | cbe92ae | 2011-12-16 13:06:18 -0800 | [diff] [blame] | 28 | #include "ns3/uinteger.h" |
| 29 | #include "ns3/double.h" |
Alexander Afanasyev | 8e0d281 | 2012-01-19 22:38:14 -0800 | [diff] [blame] | 30 | #include "ns3/boolean.h" |
Alexander Afanasyev | 4975f73 | 2011-12-20 17:52:19 -0800 | [diff] [blame] | 31 | #include "ns3/simulator.h" |
Alexander Afanasyev | 98d85e1 | 2012-08-09 10:06:05 -0700 | [diff] [blame] | 32 | #include "ns3/random-variable.h" |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 33 | #include "ns3/pointer.h" |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 34 | |
Alexander Afanasyev | 0c39537 | 2014-12-20 15:54:02 -0800 | [diff] [blame] | 35 | #include "ns3/ndn-header-helper.hpp" |
| 36 | #include "ns3/ndnSIM/utils/ndn-fw-hop-count-tag.hpp" |
Alexander Afanasyev | 7b923f3 | 2013-07-16 13:23:04 -0700 | [diff] [blame] | 37 | |
| 38 | #include "ns3/ndn-wire.h" |
Alexander Afanasyev | 8e0d281 | 2012-01-19 22:38:14 -0800 | [diff] [blame] | 39 | |
Alexander Afanasyev | 23d2b54 | 2011-12-07 18:54:46 -0800 | [diff] [blame] | 40 | #include <boost/ref.hpp> |
| 41 | |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 42 | NS_LOG_COMPONENT_DEFINE("ndn.Face"); |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 43 | |
| 44 | namespace ns3 { |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 45 | namespace ndn { |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 46 | |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 47 | NS_OBJECT_ENSURE_REGISTERED(Face); |
Alexander Afanasyev | 30c33e3 | 2012-06-05 21:28:44 -0700 | [diff] [blame] | 48 | |
Alexander Afanasyev | bdc0d98 | 2011-12-16 01:15:26 -0800 | [diff] [blame] | 49 | TypeId |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 50 | Face::GetTypeId() |
Alexander Afanasyev | bdc0d98 | 2011-12-16 01:15:26 -0800 | [diff] [blame] | 51 | { |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 52 | static TypeId tid = |
| 53 | TypeId("ns3::ndn::Face") |
| 54 | .SetParent<Object>() |
| 55 | .SetGroupName("Ndn") |
| 56 | .AddAttribute("Id", "Face id (unique integer for the Ndn stack on this node)", |
| 57 | TypeId::ATTR_GET, // allow only getting it. |
| 58 | UintegerValue(0), MakeUintegerAccessor(&Face::m_id), |
| 59 | MakeUintegerChecker<uint32_t>()); |
Alexander Afanasyev | bdc0d98 | 2011-12-16 01:15:26 -0800 | [diff] [blame] | 60 | return tid; |
| 61 | } |
| 62 | |
Alexander Afanasyev | 91d7c7c | 2013-01-31 15:01:08 -0800 | [diff] [blame] | 63 | /** |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 64 | * By default, Ndn face are created in the "down" state |
Alexander Afanasyev | 91d7c7c | 2013-01-31 15:01:08 -0800 | [diff] [blame] | 65 | * with no IP addresses. Before becoming useable, the user must |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 66 | * invoke SetUp on them once an Ndn address and mask have been set. |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 67 | */ |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 68 | Face::Face(Ptr<Node> node) |
| 69 | : m_node(node) |
| 70 | , m_upstreamInterestHandler(MakeNullCallback<void, Ptr<Face>, Ptr<Interest>>()) |
| 71 | , m_upstreamDataHandler(MakeNullCallback<void, Ptr<Face>, Ptr<Data>>()) |
| 72 | , m_ifup(false) |
| 73 | , m_id((uint32_t)-1) |
| 74 | , m_metric(0) |
| 75 | , m_flags(0) |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 76 | { |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 77 | NS_LOG_FUNCTION(this << node); |
Alexander Afanasyev | 19426ef | 2011-11-23 20:55:28 -0800 | [diff] [blame] | 78 | |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 79 | NS_ASSERT_MSG(node != 0, "node cannot be NULL. Check the code"); |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 80 | } |
| 81 | |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 82 | Face::~Face() |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 83 | { |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 84 | NS_LOG_FUNCTION_NOARGS(); |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 85 | } |
| 86 | |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 87 | Face::Face(const Face&) |
Alexander Afanasyev | 56f79ea | 2011-08-17 23:54:27 -0700 | [diff] [blame] | 88 | { |
| 89 | } |
| 90 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 91 | Face& Face::operator= (const Face &) |
Alexander Afanasyev | 56f79ea | 2011-08-17 23:54:27 -0700 | [diff] [blame] | 92 | { |
| 93 | return *this; |
| 94 | } |
| 95 | |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 96 | Ptr<Node> |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 97 | Face::GetNode() const |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 98 | { |
| 99 | return m_node; |
| 100 | } |
| 101 | |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 102 | void |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 103 | Face::RegisterProtocolHandlers(const InterestHandler& interestHandler, |
| 104 | const DataHandler& dataHandler) |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 105 | { |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 106 | NS_LOG_FUNCTION_NOARGS(); |
Alexander Afanasyev | 19426ef | 2011-11-23 20:55:28 -0800 | [diff] [blame] | 107 | |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame] | 108 | m_upstreamInterestHandler = interestHandler; |
| 109 | m_upstreamDataHandler = dataHandler; |
| 110 | } |
| 111 | |
| 112 | void |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 113 | Face::UnRegisterProtocolHandlers() |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame] | 114 | { |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 115 | NS_LOG_FUNCTION_NOARGS(); |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame] | 116 | |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 117 | m_upstreamInterestHandler = MakeNullCallback<void, Ptr<Face>, Ptr<Interest>>(); |
| 118 | m_upstreamDataHandler = MakeNullCallback<void, Ptr<Face>, Ptr<Data>>(); |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | bool |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 122 | Face::SendInterest(Ptr<const Interest> interest) |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame] | 123 | { |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 124 | NS_LOG_FUNCTION(this << boost::cref(*this) << interest->GetName()); |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame] | 125 | |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 126 | if (!IsUp()) { |
| 127 | return false; |
| 128 | } |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame] | 129 | |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 130 | return Send(Wire::FromInterest(interest)); |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | bool |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 134 | Face::SendData(Ptr<const Data> data) |
| 135 | { |
| 136 | NS_LOG_FUNCTION(this << data); |
| 137 | |
| 138 | if (!IsUp()) { |
| 139 | return false; |
| 140 | } |
| 141 | |
| 142 | return Send(Wire::FromData(data)); |
| 143 | } |
| 144 | |
| 145 | bool |
| 146 | Face::Send(Ptr<Packet> packet) |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 147 | { |
Alexander Afanasyev | 1a0fff6 | 2013-01-19 14:29:51 -0800 | [diff] [blame] | 148 | FwHopCountTag hopCount; |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 149 | bool tagExists = packet->RemovePacketTag(hopCount); |
| 150 | if (tagExists) { |
| 151 | hopCount.Increment(); |
| 152 | packet->AddPacketTag(hopCount); |
| 153 | } |
Alexander Afanasyev | 30c33e3 | 2012-06-05 21:28:44 -0700 | [diff] [blame] | 154 | |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame] | 155 | return true; |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | bool |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 159 | Face::Receive(Ptr<const Packet> p) |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 160 | { |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 161 | NS_LOG_FUNCTION(this << p << p->GetSize()); |
Alexander Afanasyev | 19426ef | 2011-11-23 20:55:28 -0800 | [diff] [blame] | 162 | |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 163 | if (!IsUp()) { |
| 164 | // no tracing here. If we were off while receiving, we shouldn't even know that something was |
| 165 | // there |
| 166 | return false; |
| 167 | } |
| 168 | |
| 169 | Ptr<Packet> packet = p->Copy(); // give upper layers a rw copy of the packet |
| 170 | try { |
| 171 | HeaderHelper::Type type = HeaderHelper::GetNdnHeaderType(packet); |
| 172 | switch (type) { |
| 173 | case HeaderHelper::INTEREST_NDNSIM: |
| 174 | return ReceiveInterest(Wire::ToInterest(packet, Wire::WIRE_FORMAT_NDNSIM)); |
| 175 | case HeaderHelper::INTEREST_CCNB: |
| 176 | return ReceiveInterest(Wire::ToInterest(packet, Wire::WIRE_FORMAT_CCNB)); |
| 177 | case HeaderHelper::CONTENT_OBJECT_NDNSIM: |
| 178 | return ReceiveData(Wire::ToData(packet, Wire::WIRE_FORMAT_NDNSIM)); |
| 179 | case HeaderHelper::CONTENT_OBJECT_CCNB: |
| 180 | return ReceiveData(Wire::ToData(packet, Wire::WIRE_FORMAT_CCNB)); |
| 181 | default: |
| 182 | NS_FATAL_ERROR("Not supported NDN header"); |
Alexander Afanasyev | 30c33e3 | 2012-06-05 21:28:44 -0700 | [diff] [blame] | 183 | return false; |
| 184 | } |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 185 | |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 186 | // exception will be thrown if packet is not recognized |
| 187 | } |
| 188 | catch (UnknownHeaderException) { |
| 189 | NS_FATAL_ERROR("Unknown NDN header. Should not happen"); |
| 190 | return false; |
| 191 | } |
Alexander Afanasyev | 37a6124 | 2013-07-26 11:19:18 -0700 | [diff] [blame] | 192 | |
| 193 | return false; |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame] | 194 | } |
| 195 | |
| 196 | bool |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 197 | Face::ReceiveInterest(Ptr<Interest> interest) |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame] | 198 | { |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 199 | if (!IsUp()) { |
| 200 | // no tracing here. If we were off while receiving, we shouldn't even know that something was |
| 201 | // there |
| 202 | return false; |
| 203 | } |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame] | 204 | |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 205 | m_upstreamInterestHandler(this, interest); |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame] | 206 | return true; |
| 207 | } |
| 208 | |
| 209 | bool |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 210 | Face::ReceiveData(Ptr<Data> data) |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame] | 211 | { |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 212 | if (!IsUp()) { |
| 213 | // no tracing here. If we were off while receiving, we shouldn't even know that something was |
| 214 | // there |
| 215 | return false; |
| 216 | } |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame] | 217 | |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 218 | m_upstreamDataHandler(this, data); |
Alexander Afanasyev | 19426ef | 2011-11-23 20:55:28 -0800 | [diff] [blame] | 219 | return true; |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 220 | } |
| 221 | |
Alexander Afanasyev | cbe92ae | 2011-12-16 13:06:18 -0800 | [diff] [blame] | 222 | void |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 223 | Face::SetMetric(uint16_t metric) |
Alexander Afanasyev | 8e0d281 | 2012-01-19 22:38:14 -0800 | [diff] [blame] | 224 | { |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 225 | NS_LOG_FUNCTION(metric); |
Alexander Afanasyev | 8e0d281 | 2012-01-19 22:38:14 -0800 | [diff] [blame] | 226 | m_metric = metric; |
| 227 | } |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 228 | |
Alexander Afanasyev | 8e0d281 | 2012-01-19 22:38:14 -0800 | [diff] [blame] | 229 | uint16_t |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 230 | Face::GetMetric(void) const |
Alexander Afanasyev | 8e0d281 | 2012-01-19 22:38:14 -0800 | [diff] [blame] | 231 | { |
Alexander Afanasyev | 8e0d281 | 2012-01-19 22:38:14 -0800 | [diff] [blame] | 232 | return m_metric; |
| 233 | } |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 234 | |
Alexander Afanasyev | dd9fa4f | 2013-05-15 16:35:04 -0700 | [diff] [blame] | 235 | void |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 236 | Face::SetFlags(uint32_t flags) |
Alexander Afanasyev | dd9fa4f | 2013-05-15 16:35:04 -0700 | [diff] [blame] | 237 | { |
| 238 | m_flags = flags; |
| 239 | } |
| 240 | |
Alexander Afanasyev | 56f79ea | 2011-08-17 23:54:27 -0700 | [diff] [blame] | 241 | bool |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 242 | Face::operator== (const Face &face) const |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 243 | { |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 244 | NS_ASSERT_MSG(m_node->GetId() == face.m_node->GetId(), |
| 245 | "Faces of different nodes should not be compared to each other: " << *this << " == " |
| 246 | << face); |
Alexander Afanasyev | 7fd74f9 | 2011-08-25 19:40:17 -0700 | [diff] [blame] | 247 | |
| 248 | return (m_id == face.m_id); |
| 249 | } |
| 250 | |
| 251 | bool |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 252 | Face::operator< (const Face &face) const |
Alexander Afanasyev | 7fd74f9 | 2011-08-25 19:40:17 -0700 | [diff] [blame] | 253 | { |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 254 | NS_ASSERT_MSG(m_node->GetId() == face.m_node->GetId(), |
| 255 | "Faces of different nodes should not be compared to each other: " << *this << " == " |
| 256 | << face); |
Alexander Afanasyev | 7fd74f9 | 2011-08-25 19:40:17 -0700 | [diff] [blame] | 257 | |
| 258 | return (m_id < face.m_id); |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 259 | } |
| 260 | |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 261 | std::ostream& |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 262 | Face::Print(std::ostream& os) const |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 263 | { |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 264 | os << "id=" << GetId(); |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 265 | return os; |
| 266 | } |
| 267 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 268 | std::ostream& |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 269 | operator<<(std::ostream& os, const Face& face) |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 270 | { |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 271 | face.Print(os); |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 272 | return os; |
| 273 | } |
| 274 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 275 | } // namespace ndn |
| 276 | } // namespace ns3 |