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