blob: c0479341e8903bed1fa0281cd3bb004eb43cae99 [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 *
Ilya Moiseenko1cf6b0a2011-08-29 13:02:34 -070018 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 Ilya Moiseenko <iliamo@cs.ucla.edu>
Alexander Afanasyev98256102011-08-14 01:00:02 -070020 *
21 */
22
23#include "ccnx-local-face.h"
24
Alexander Afanasyev98256102011-08-14 01:00:02 -070025#include "ns3/log.h"
26#include "ns3/packet.h"
27#include "ns3/node.h"
28#include "ns3/pointer.h"
29#include "ns3/assert.h"
30
31NS_LOG_COMPONENT_DEFINE ("CcnxLocalFace");
32
Ilya Moiseenko1cf6b0a2011-08-29 13:02:34 -070033namespace ns3
34{
Alexander Afanasyev98256102011-08-14 01:00:02 -070035
36NS_OBJECT_ENSURE_REGISTERED (CcnxLocalFace);
37
38TypeId
39CcnxLocalFace::GetTypeId (void)
40{
41 static TypeId tid = TypeId ("ns3::CcnxLocalFace")
Alexander Afanasyev070aa482011-08-20 00:38:25 -070042 .SetGroupName ("Ccnx")
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070043 .SetParent<CcnxFace> ()
Alexander Afanasyev98256102011-08-14 01:00:02 -070044 ;
45 return tid;
46}
47
Alexander Afanasyev98256102011-08-14 01:00:02 -070048CcnxLocalFace::CcnxLocalFace ()
49{
50 NS_LOG_FUNCTION (this);
51}
52
53CcnxLocalFace::~CcnxLocalFace ()
54{
55 NS_LOG_FUNCTION_NOARGS ();
56}
57
58void
59CcnxLocalFace::DoDispose (void)
60{
61 NS_LOG_FUNCTION_NOARGS ();
62 CcnxFace::DoDispose ();
63}
64
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070065void
66CcnxLocalFace::RegisterProtocolHandler (ProtocolHandler handler)
Alexander Afanasyev98256102011-08-14 01:00:02 -070067{
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070068 m_protocolHandler = handler;
Alexander Afanasyev98256102011-08-14 01:00:02 -070069}
70
Alexander Afanasyev98256102011-08-14 01:00:02 -070071void
72CcnxLocalFace::Send (Ptr<Packet> p)
73{
74 NS_LOG_FUNCTION (*p);
75 if (!IsUp ())
76 {
77 return;
78 }
79
Alexander Afanasyev7fd74f92011-08-25 19:40:17 -070080
Alexander Afanasyev98256102011-08-14 01:00:02 -070081}
Ilya Moiseenko1cf6b0a2011-08-29 13:02:34 -070082
83void
84CcnxLocalFace::Receive (Ptr<Packet> p)
85{
86 //ypedef Callback<void,const Ptr<CcnxFace>&,const Ptr<const Packet>& > ProtocolHandler;
87 m_protocolHandler ((const Ptr<CcnxFace>)this,(const Ptr<Packet>)p);
88}
Alexander Afanasyev98256102011-08-14 01:00:02 -070089
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070090std::ostream& operator<< (std::ostream& os, const CcnxLocalFace &localFace)
Alexander Afanasyev98256102011-08-14 01:00:02 -070091{
92 os << "dev=local";
93 return os;
94}
95
96}; // namespace ns3
97