blob: 397d6c182c158ae4828cf0bd8872d93a427d2e73 [file] [log] [blame]
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -07001/* -*- 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 * Authors: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 */
20
21#ifndef CCNX_NET_DEVICE_FACE_H
22#define CCNX_NET_DEVICE_FACE_H
23
24#include "ccnx-face.h"
25#include "ns3/net-device.h"
26
27namespace ns3 {
28
29class Address;
30
31/**
32 * \ingroup ccnx-face
33 * \brief Implementation of layer-2 (Ethernet) CCNx face
34 *
35 * This class defines basic functionality of CCNx face. Face is core
36 * component responsible for actual delivery of data packet to and
37 * from CCNx stack
38 *
39 * \see CcnxLocalFace, CcnxNetDeviceFace, CcnxIpv4Face, CcnxUdpFace
40 */
41class CcnxNetDeviceFace : public CcnxFace
42{
43public:
44 /**
45 * \brief Interface ID
46 *
47 * \return interface ID
48 */
49 static TypeId GetTypeId (void);
50
51 /**
52 * \brief Default constructor
53 */
54 CcnxNetDeviceFace ();
55 virtual ~CcnxNetDeviceFace();
56
57 ////////////////////////////////////////////////////////////////////
58 // methods overloaded from CcnxFace
59
60 virtual void RegisterProtocolHandler (ProtocolHandler handler);
61
62 virtual void Send (Ptr<Packet> p);
63
64 ////////////////////////////////////////////////////////////////////
65
66 /**
67 * \brief Associate NetDevice object with face
68 *
69 * \param node smart pointer to a NetDevice object
70 */
71 void SetNetDevice (Ptr<NetDevice> node);
72
73 /**
74 * \brief Get NetDevice associated with the face
75 *
76 * \returns smart pointer to NetDevice associated with the face
77 */
78 Ptr<NetDevice> GetNetDevice () const;
79
80protected:
81 virtual void DoDispose ();
82
83private:
84 CcnxNetDeviceFace (const CcnxNetDeviceFace &); ///< \brief Disabled copy constructor
85 CcnxNetDeviceFace& operator= (const CcnxNetDeviceFace &); ///< \brief Disabled copy operator
86
87 // callback
88 void ReceiveFromNetDevice (Ptr<NetDevice> device,
89 Ptr<const Packet> p,
90 uint16_t protocol,
91 const Address &from,
92 const Address &to,
93 NetDevice::PacketType packetType);
94
95private:
96 Ptr<NetDevice> m_netDevice; ///< \brief Smart pointer to NetDevice
97};
98
99std::ostream& operator<< (std::ostream& os, const CcnxNetDeviceFace &face);
100
101} // namespace ns3
102
103#endif //CCNX_NET_DEVICE_FACE_H