blob: 4a6fa55ddb7950e67d41f1ee59989405eb08aff3 [file] [log] [blame]
Alexander Afanasyevc74a6022011-08-15 20:01:35 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
Alexander Afanasyev98256102011-08-14 01:00:02 -07002/*
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 Afanasyev98256102011-08-14 01:00:02 -070024#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
32NS_LOG_COMPONENT_DEFINE ("CcnxLocalFace");
33
34namespace ns3 {
35
36NS_OBJECT_ENSURE_REGISTERED (CcnxLocalFace);
37
38TypeId
39CcnxLocalFace::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 */
52CcnxLocalFace::CcnxLocalFace ()
53{
54 NS_LOG_FUNCTION (this);
55}
56
57CcnxLocalFace::~CcnxLocalFace ()
58{
59 NS_LOG_FUNCTION_NOARGS ();
60}
61
62void
63CcnxLocalFace::DoDispose (void)
64{
65 NS_LOG_FUNCTION_NOARGS ();
66 CcnxFace::DoDispose ();
67}
68
69void
70CcnxLocalFace::SetDevice (Ptr<NetDevice> device)
71{
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070072 NS_ASSERT_MSG (false, "It is impossible to set device to LocalFace");
Alexander Afanasyev98256102011-08-14 01:00:02 -070073}
74
75Ptr<NetDevice>
76CcnxLocalFace::GetDevice (void) const
77{
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070078 return 0;
Alexander Afanasyev98256102011-08-14 01:00:02 -070079}
80
Alexander Afanasyev98256102011-08-14 01:00:02 -070081void
82CcnxLocalFace::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
94std::ostream& operator<< (std::ostream& os, CcnxLocalFace const& localFace)
95{
96 os << "dev=local";
97 return os;
98}
99
100}; // namespace ns3
101