author | Peter D. Barnes, Jr. <barnes26@llnl.gov> |
Fri, 26 Sep 2014 15:51:00 -0700 | |
changeset 10968 | 2d29fee2b7b8 |
parent 10652 | dc18deba4502 |
child 11264 | 8eeabddc6c40 |
permissions | -rw-r--r-- |
6349 | 1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2010 CTTC |
|
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 |
#include "ns3/log.h" |
|
22 |
#include "ns3/queue.h" |
|
23 |
#include "ns3/simulator.h" |
|
24 |
#include "ns3/enum.h" |
|
25 |
#include "ns3/boolean.h" |
|
26 |
#include "ns3/uinteger.h" |
|
27 |
#include "ns3/pointer.h" |
|
28 |
#include "ns3/channel.h" |
|
29 |
#include "non-communicating-net-device.h" |
|
30 |
||
31 |
||
32 |
namespace ns3 { |
|
33 |
||
10968
2d29fee2b7b8
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10652
diff
changeset
|
34 |
NS_LOG_COMPONENT_DEFINE ("NonCommunicatingNetDevice"); |
6349 | 35 |
|
10652
dc18deba4502
[doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10410
diff
changeset
|
36 |
NS_OBJECT_ENSURE_REGISTERED (NonCommunicatingNetDevice); |
6349 | 37 |
|
38 |
TypeId |
|
39 |
NonCommunicatingNetDevice::GetTypeId (void) |
|
40 |
{ |
|
41 |
static TypeId tid = TypeId ("ns3::NonCommunicatingNetDevice") |
|
42 |
.SetParent<NetDevice> () |
|
7142
89a701fec3a1
run check-style.py on src/spectrum
Nicola Baldo <nicola@baldo.biz>
parents:
6801
diff
changeset
|
43 |
.AddConstructor<NonCommunicatingNetDevice> () |
6349 | 44 |
.AddAttribute ("Phy", "The PHY layer attached to this device.", |
45 |
PointerValue (), |
|
46 |
MakePointerAccessor (&NonCommunicatingNetDevice::GetPhy, |
|
47 |
&NonCommunicatingNetDevice::SetPhy), |
|
48 |
MakePointerChecker<Object> ()) |
|
49 |
; |
|
50 |
return tid; |
|
51 |
} |
|
52 |
||
53 |
NonCommunicatingNetDevice::NonCommunicatingNetDevice () |
|
54 |
{ |
|
55 |
NS_LOG_FUNCTION (this); |
|
56 |
} |
|
57 |
||
58 |
NonCommunicatingNetDevice::~NonCommunicatingNetDevice () |
|
59 |
{ |
|
60 |
NS_LOG_FUNCTION (this); |
|
61 |
} |
|
62 |
||
63 |
void |
|
64 |
NonCommunicatingNetDevice::DoDispose () |
|
65 |
{ |
|
66 |
NS_LOG_FUNCTION (this); |
|
67 |
m_node = 0; |
|
68 |
m_channel = 0; |
|
69 |
m_phy = 0; |
|
70 |
NetDevice::DoDispose (); |
|
71 |
} |
|
72 |
||
73 |
||
74 |
void |
|
75 |
NonCommunicatingNetDevice::SetIfIndex (const uint32_t index) |
|
76 |
{ |
|
77 |
NS_LOG_FUNCTION (index); |
|
78 |
m_ifIndex = index; |
|
79 |
} |
|
80 |
||
81 |
uint32_t |
|
82 |
NonCommunicatingNetDevice::GetIfIndex (void) const |
|
83 |
{ |
|
84 |
NS_LOG_FUNCTION (this); |
|
85 |
return m_ifIndex; |
|
86 |
} |
|
87 |
||
88 |
bool |
|
89 |
NonCommunicatingNetDevice::SetMtu (uint16_t mtu) |
|
90 |
{ |
|
91 |
NS_LOG_FUNCTION (mtu); |
|
92 |
return (mtu == 0); |
|
93 |
} |
|
94 |
||
95 |
uint16_t |
|
96 |
NonCommunicatingNetDevice::GetMtu (void) const |
|
97 |
{ |
|
98 |
NS_LOG_FUNCTION (this); |
|
99 |
return 0; |
|
100 |
} |
|
101 |
||
102 |
void |
|
103 |
NonCommunicatingNetDevice::SetAddress (Address address) |
|
104 |
{ |
|
105 |
NS_LOG_FUNCTION (this); |
|
106 |
} |
|
107 |
||
108 |
Address |
|
109 |
NonCommunicatingNetDevice::GetAddress (void) const |
|
110 |
{ |
|
111 |
NS_LOG_FUNCTION (this); |
|
112 |
return Address (); |
|
113 |
} |
|
114 |
||
115 |
bool |
|
116 |
NonCommunicatingNetDevice::IsBroadcast (void) const |
|
117 |
{ |
|
118 |
NS_LOG_FUNCTION (this); |
|
119 |
return false; |
|
120 |
} |
|
121 |
||
122 |
Address |
|
123 |
NonCommunicatingNetDevice::GetBroadcast (void) const |
|
124 |
{ |
|
125 |
NS_LOG_FUNCTION (this); |
|
126 |
return Address (); |
|
127 |
} |
|
128 |
||
129 |
bool |
|
130 |
NonCommunicatingNetDevice::IsMulticast (void) const |
|
131 |
{ |
|
132 |
NS_LOG_FUNCTION (this); |
|
133 |
return false; |
|
134 |
} |
|
135 |
||
136 |
Address |
|
137 |
NonCommunicatingNetDevice::GetMulticast (Ipv4Address addr) const |
|
138 |
{ |
|
139 |
NS_LOG_FUNCTION (addr); |
|
140 |
return Address (); |
|
141 |
} |
|
142 |
||
143 |
Address |
|
144 |
NonCommunicatingNetDevice::GetMulticast (Ipv6Address addr) const |
|
145 |
{ |
|
146 |
NS_LOG_FUNCTION (addr); |
|
147 |
return Address (); |
|
148 |
} |
|
149 |
||
150 |
bool |
|
151 |
NonCommunicatingNetDevice::IsPointToPoint (void) const |
|
152 |
{ |
|
153 |
NS_LOG_FUNCTION (this); |
|
154 |
return false; |
|
155 |
} |
|
156 |
||
157 |
bool |
|
158 |
NonCommunicatingNetDevice::IsBridge (void) const |
|
159 |
{ |
|
160 |
NS_LOG_FUNCTION (this); |
|
161 |
return false; |
|
162 |
} |
|
163 |
||
164 |
||
165 |
Ptr<Node> |
|
166 |
NonCommunicatingNetDevice::GetNode (void) const |
|
167 |
{ |
|
168 |
NS_LOG_FUNCTION (this); |
|
169 |
return m_node; |
|
170 |
} |
|
171 |
||
172 |
void |
|
173 |
NonCommunicatingNetDevice::SetNode (Ptr<Node> node) |
|
174 |
{ |
|
175 |
NS_LOG_FUNCTION (node); |
|
176 |
||
177 |
m_node = node; |
|
178 |
} |
|
179 |
||
180 |
void |
|
181 |
NonCommunicatingNetDevice::SetPhy (Ptr<Object> phy) |
|
182 |
{ |
|
183 |
NS_LOG_FUNCTION (this << phy); |
|
184 |
m_phy = phy; |
|
185 |
} |
|
186 |
||
187 |
||
188 |
Ptr<Object> |
|
189 |
NonCommunicatingNetDevice::GetPhy () const |
|
190 |
{ |
|
191 |
NS_LOG_FUNCTION (this); |
|
192 |
return m_phy; |
|
193 |
} |
|
194 |
||
195 |
||
6355
957e0c6ccb29
fixed spectrum code for python bindings as per Gustavo's suggestion
Nicola Baldo <nicola@baldo.biz>
parents:
6349
diff
changeset
|
196 |
void |
957e0c6ccb29
fixed spectrum code for python bindings as per Gustavo's suggestion
Nicola Baldo <nicola@baldo.biz>
parents:
6349
diff
changeset
|
197 |
NonCommunicatingNetDevice::SetChannel (Ptr<Channel> c) |
957e0c6ccb29
fixed spectrum code for python bindings as per Gustavo's suggestion
Nicola Baldo <nicola@baldo.biz>
parents:
6349
diff
changeset
|
198 |
{ |
957e0c6ccb29
fixed spectrum code for python bindings as per Gustavo's suggestion
Nicola Baldo <nicola@baldo.biz>
parents:
6349
diff
changeset
|
199 |
NS_LOG_FUNCTION (this << c); |
957e0c6ccb29
fixed spectrum code for python bindings as per Gustavo's suggestion
Nicola Baldo <nicola@baldo.biz>
parents:
6349
diff
changeset
|
200 |
m_channel = c; |
957e0c6ccb29
fixed spectrum code for python bindings as per Gustavo's suggestion
Nicola Baldo <nicola@baldo.biz>
parents:
6349
diff
changeset
|
201 |
} |
6349 | 202 |
|
203 |
Ptr<Channel> |
|
204 |
NonCommunicatingNetDevice::GetChannel (void) const |
|
205 |
{ |
|
206 |
NS_LOG_FUNCTION (this); |
|
207 |
return m_channel; |
|
208 |
} |
|
209 |
||
210 |
||
211 |
bool |
|
212 |
NonCommunicatingNetDevice::NeedsArp (void) const |
|
213 |
{ |
|
214 |
NS_LOG_FUNCTION (this); |
|
215 |
return false; |
|
216 |
} |
|
217 |
||
218 |
bool |
|
219 |
NonCommunicatingNetDevice::IsLinkUp (void) const |
|
220 |
{ |
|
221 |
NS_LOG_FUNCTION (this); |
|
222 |
return false; |
|
223 |
} |
|
224 |
||
225 |
void |
|
226 |
NonCommunicatingNetDevice::AddLinkChangeCallback (Callback<void> callback) |
|
227 |
{ |
|
228 |
NS_LOG_FUNCTION (&callback); |
|
229 |
} |
|
230 |
||
231 |
void |
|
232 |
NonCommunicatingNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb) |
|
233 |
{ |
|
234 |
NS_LOG_FUNCTION (&cb); |
|
235 |
} |
|
236 |
||
237 |
void |
|
238 |
NonCommunicatingNetDevice::SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb) |
|
239 |
{ |
|
240 |
NS_LOG_FUNCTION (&cb); |
|
241 |
} |
|
242 |
||
243 |
bool |
|
244 |
NonCommunicatingNetDevice::SupportsSendFrom () const |
|
245 |
{ |
|
246 |
NS_LOG_FUNCTION (this); |
|
247 |
return false; |
|
248 |
} |
|
249 |
||
250 |
||
251 |
bool |
|
252 |
NonCommunicatingNetDevice::Send (Ptr<Packet> packet,const Address& dest, uint16_t protocolNumber) |
|
253 |
{ |
|
254 |
NS_LOG_FUNCTION (packet << dest << protocolNumber); |
|
255 |
return false; |
|
256 |
} |
|
257 |
||
258 |
bool |
|
259 |
NonCommunicatingNetDevice::SendFrom (Ptr<Packet> packet, const Address& src, const Address& dest, uint16_t protocolNumber) |
|
260 |
{ |
|
261 |
NS_LOG_FUNCTION (packet << src << dest << protocolNumber); |
|
262 |
return false; |
|
263 |
} |
|
264 |
||
265 |
||
266 |
} // namespace ns3 |