author | Vedran Miletić <rivanvx@gmail.com> |
Sat, 01 Sep 2012 20:57:21 +0200 | |
changeset 9063 | 32755d0516f4 |
parent 7353 | 09fccf6195ea |
permissions | -rw-r--r-- |
6349 | 1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2010 |
|
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: Nicola Baldo <nbaldo@cttc.es> |
|
19 |
*/ |
|
20 |
||
21 |
#ifndef NON_COMMUNICATING_NET_DEVICE_H |
|
22 |
#define NON_COMMUNICATING_NET_DEVICE_H |
|
23 |
||
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
7353
diff
changeset
|
24 |
#include <cstring> |
6349 | 25 |
#include <ns3/node.h> |
26 |
#include <ns3/address.h> |
|
27 |
#include <ns3/net-device.h> |
|
28 |
#include <ns3/callback.h> |
|
29 |
#include <ns3/packet.h> |
|
30 |
#include <ns3/traced-callback.h> |
|
31 |
#include <ns3/ptr.h> |
|
32 |
||
33 |
namespace ns3 { |
|
34 |
||
35 |
||
36 |
class SpectrumChannel; |
|
37 |
class Channel; |
|
38 |
class SpectrumErrorModel; |
|
39 |
class Queue; |
|
40 |
||
41 |
||
42 |
||
43 |
/** |
|
7241
0a7a16b599e8
Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents:
7142
diff
changeset
|
44 |
* \ingroup spectrum |
0a7a16b599e8
Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents:
7142
diff
changeset
|
45 |
* |
6349 | 46 |
* This class implements a device which does not communicate, in the |
47 |
* sense that it does not interact with the above protocol stack. The |
|
48 |
* purpose of this NetDevice is to be used for devices such as |
|
49 |
* microwave ovens, waveform generators and spectrum |
|
50 |
* analyzers. Since the ns-3 channel API is strongly based on the presence of |
|
51 |
* NetDevice class instances, it is convenient to provide a NetDevice that can |
|
52 |
* be used with such non-communicating devices. |
|
53 |
*/ |
|
54 |
class NonCommunicatingNetDevice : public NetDevice |
|
55 |
{ |
|
56 |
public: |
|
57 |
static TypeId GetTypeId (void); |
|
58 |
||
59 |
NonCommunicatingNetDevice (); |
|
60 |
virtual ~NonCommunicatingNetDevice (); |
|
61 |
||
62 |
||
63 |
/** |
|
64 |
* This class doesn't talk directly with the underlying channel (a |
|
65 |
* dedicated PHY class is expected to do it), however the NetDevice |
|
66 |
* specification features a GetChannel() method. This method here |
|
67 |
* is therefore provide to allow NonCommunicatingNetDevice::GetChannel() to have |
|
68 |
* something meaningful to return. |
|
69 |
* |
|
70 |
* @param c the underlying channel |
|
71 |
*/ |
|
72 |
void SetChannel (Ptr<Channel> c); |
|
73 |
||
74 |
||
75 |
/** |
|
76 |
* Set the Phy object which is attached to this device. |
|
77 |
* This object is needed so that we can set/get attributes and |
|
78 |
* connect to trace sources of the PHY from the net device. |
|
79 |
* |
|
80 |
* @param phy the Phy object embedded within this device. |
|
81 |
*/ |
|
82 |
void SetPhy (Ptr<Object> phy); |
|
83 |
||
84 |
/** |
|
85 |
* @return a reference to the PHY object embedded in this NetDevice. |
|
86 |
*/ |
|
87 |
Ptr<Object> GetPhy () const; |
|
88 |
||
89 |
||
90 |
||
91 |
// inherited from NetDevice |
|
92 |
virtual void SetIfIndex (const uint32_t index); |
|
93 |
virtual uint32_t GetIfIndex (void) const; |
|
94 |
virtual Ptr<Channel> GetChannel (void) const; |
|
95 |
virtual bool SetMtu (const uint16_t mtu); |
|
96 |
virtual uint16_t GetMtu (void) const; |
|
97 |
virtual void SetAddress (Address address); |
|
98 |
virtual Address GetAddress (void) const; |
|
99 |
virtual bool IsLinkUp (void) const; |
|
100 |
virtual void AddLinkChangeCallback (Callback<void> callback); |
|
101 |
virtual bool IsBroadcast (void) const; |
|
102 |
virtual Address GetBroadcast (void) const; |
|
103 |
virtual bool IsMulticast (void) const; |
|
104 |
virtual bool IsPointToPoint (void) const; |
|
105 |
virtual bool IsBridge (void) const; |
|
106 |
virtual bool Send (Ptr<Packet> packet, const Address& dest, |
|
107 |
uint16_t protocolNumber); |
|
108 |
virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, |
|
109 |
uint16_t protocolNumber); |
|
110 |
virtual Ptr<Node> GetNode (void) const; |
|
111 |
virtual void SetNode (Ptr<Node> node); |
|
112 |
virtual bool NeedsArp (void) const; |
|
113 |
virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb); |
|
114 |
virtual Address GetMulticast (Ipv4Address addr) const; |
|
115 |
virtual Address GetMulticast (Ipv6Address addr) const; |
|
116 |
virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb); |
|
117 |
virtual bool SupportsSendFrom (void) const; |
|
118 |
||
119 |
||
120 |
||
121 |
||
122 |
||
123 |
private: |
|
124 |
virtual void DoDispose (void); |
|
125 |
||
126 |
Ptr<Node> m_node; |
|
127 |
Ptr<Channel> m_channel; |
|
128 |
||
129 |
uint32_t m_ifIndex; |
|
130 |
||
131 |
Ptr<Object> m_phy; |
|
132 |
}; |
|
133 |
||
134 |
||
135 |
} // namespace ns3 |
|
136 |
||
7353
09fccf6195ea
bug 1203: Inconsistently named ifndef/define macros in ns-3 headers
Vedran Miletic <rivanvx@gmail.com>
parents:
7241
diff
changeset
|
137 |
#endif /* NON_COMMUNICATING_NET_DEVICE_H */ |