blob: e6fbc12bc39de5ca0a55a7d90163314d4bea8b15 [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 *
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070039 * CcnxNetDevice face is permanently associated with one NetDevice
40 * object and this object cannot be changed for the lifetime of the
41 * face
42 *
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070043 * \see CcnxLocalFace, CcnxNetDeviceFace, CcnxIpv4Face, CcnxUdpFace
44 */
45class CcnxNetDeviceFace : public CcnxFace
46{
47public:
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070048 // /**
49 // * \brief Interface ID
50 // *
51 // * \return interface ID
52 // */
53 // static TypeId GetTypeId (void);
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070054
55 /**
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070056 * \brief Constructor
57 *
58 * \param netDevice a smart pointer to NetDevice object to which
59 * this face will be associate
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070060 */
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070061 CcnxNetDeviceFace (const Ptr<NetDevice> &netDevice);
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070062 virtual ~CcnxNetDeviceFace();
63
64 ////////////////////////////////////////////////////////////////////
65 // methods overloaded from CcnxFace
66
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070067 virtual void
68 RegisterProtocolHandler (ProtocolHandler handler);
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070069
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070070 virtual void
71 Send (Ptr<Packet> p);
Ilya Moiseenko57959f92011-10-28 13:15:58 -070072
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070073 virtual std::ostream&
74 Print (std::ostream &os) const;
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070075 ////////////////////////////////////////////////////////////////////
76
77 /**
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070078 * \brief Get NetDevice associated with the face
79 *
80 * \returns smart pointer to NetDevice associated with the face
81 */
82 Ptr<NetDevice> GetNetDevice () const;
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070083
84private:
85 CcnxNetDeviceFace (const CcnxNetDeviceFace &); ///< \brief Disabled copy constructor
86 CcnxNetDeviceFace& operator= (const CcnxNetDeviceFace &); ///< \brief Disabled copy operator
87
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070088 /// \brief callback from lower layers
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070089 void ReceiveFromNetDevice (Ptr<NetDevice> device,
90 Ptr<const Packet> p,
91 uint16_t protocol,
92 const Address &from,
93 const Address &to,
94 NetDevice::PacketType packetType);
95
96private:
97 Ptr<NetDevice> m_netDevice; ///< \brief Smart pointer to NetDevice
98};
99
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -0700100} // namespace ns3
101
102#endif //CCNX_NET_DEVICE_FACE_H