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 | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2005,2006,2007 INRIA |
| 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: |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | #include "ccnx-local-face.h" |
| 23 | |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 24 | #include "ns3/ccnx-l3-protocol.h" |
| 25 | #include "ns3/net-device.h" |
| 26 | #include "ns3/log.h" |
| 27 | #include "ns3/packet.h" |
| 28 | #include "ns3/node.h" |
| 29 | #include "ns3/pointer.h" |
| 30 | #include "ns3/assert.h" |
| 31 | |
| 32 | NS_LOG_COMPONENT_DEFINE ("CcnxLocalFace"); |
| 33 | |
| 34 | namespace ns3 { |
| 35 | |
| 36 | NS_OBJECT_ENSURE_REGISTERED (CcnxLocalFace); |
| 37 | |
| 38 | TypeId |
| 39 | CcnxLocalFace::GetTypeId (void) |
| 40 | { |
| 41 | static TypeId tid = TypeId ("ns3::CcnxLocalFace") |
| 42 | .SetParent<Object> () |
| 43 | ; |
| 44 | return tid; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * By default, Ccnx interface are created in the "down" state |
| 49 | * with no IP addresses. Before becoming useable, the user must |
| 50 | * invoke SetUp on them once an Ccnx address and mask have been set. |
| 51 | */ |
| 52 | CcnxLocalFace::CcnxLocalFace () |
| 53 | { |
| 54 | NS_LOG_FUNCTION (this); |
| 55 | } |
| 56 | |
| 57 | CcnxLocalFace::~CcnxLocalFace () |
| 58 | { |
| 59 | NS_LOG_FUNCTION_NOARGS (); |
| 60 | } |
| 61 | |
| 62 | void |
| 63 | CcnxLocalFace::DoDispose (void) |
| 64 | { |
| 65 | NS_LOG_FUNCTION_NOARGS (); |
| 66 | CcnxFace::DoDispose (); |
| 67 | } |
| 68 | |
| 69 | void |
| 70 | CcnxLocalFace::SetDevice (Ptr<NetDevice> device) |
| 71 | { |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 72 | NS_ASSERT_MSG (false, "It is impossible to set device to LocalFace"); |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | Ptr<NetDevice> |
| 76 | CcnxLocalFace::GetDevice (void) const |
| 77 | { |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 78 | return 0; |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 79 | } |
| 80 | |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 81 | void |
| 82 | CcnxLocalFace::Send (Ptr<Packet> p) |
| 83 | { |
| 84 | NS_LOG_FUNCTION (*p); |
| 85 | if (!IsUp ()) |
| 86 | { |
| 87 | return; |
| 88 | } |
| 89 | |
| 90 | // m_device->Send (p, m_device->GetBroadcast (), |
| 91 | // CcnxL3Protocol::PROT_NUMBER); |
| 92 | } |
| 93 | |
| 94 | std::ostream& operator<< (std::ostream& os, CcnxLocalFace const& localFace) |
| 95 | { |
| 96 | os << "dev=local"; |
| 97 | return os; |
| 98 | } |
| 99 | |
| 100 | }; // namespace ns3 |
| 101 | |