OLD | NEW |
(Empty) | |
| 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 NS_LOG_COMPONENT_DEFINE ("NonCommunicatingNetDevice"); |
| 33 |
| 34 |
| 35 namespace ns3 { |
| 36 |
| 37 |
| 38 |
| 39 NS_OBJECT_ENSURE_REGISTERED (NonCommunicatingNetDevice); |
| 40 |
| 41 TypeId |
| 42 NonCommunicatingNetDevice::GetTypeId (void) |
| 43 { |
| 44 static TypeId tid = TypeId ("ns3::NonCommunicatingNetDevice") |
| 45 .SetParent<NetDevice> () |
| 46 .AddConstructor<NonCommunicatingNetDevice> ()··· |
| 47 .AddAttribute ("Phy", "The PHY layer attached to this device.", |
| 48 PointerValue (), |
| 49 MakePointerAccessor (&NonCommunicatingNetDevice::GetPhy, |
| 50 &NonCommunicatingNetDevice::SetPhy), |
| 51 MakePointerChecker<Object> ()) |
| 52 ; |
| 53 return tid; |
| 54 } |
| 55 |
| 56 NonCommunicatingNetDevice::NonCommunicatingNetDevice () |
| 57 { |
| 58 NS_LOG_FUNCTION (this); |
| 59 } |
| 60 |
| 61 NonCommunicatingNetDevice::~NonCommunicatingNetDevice () |
| 62 { |
| 63 NS_LOG_FUNCTION (this); |
| 64 } |
| 65 |
| 66 void |
| 67 NonCommunicatingNetDevice::DoDispose () |
| 68 { |
| 69 NS_LOG_FUNCTION (this); |
| 70 m_node = 0; |
| 71 m_channel = 0; |
| 72 NetDevice::DoDispose (); |
| 73 } |
| 74 |
| 75 |
| 76 void |
| 77 NonCommunicatingNetDevice::SetIfIndex (const uint32_t index) |
| 78 { |
| 79 NS_LOG_FUNCTION (index); |
| 80 m_ifIndex = index; |
| 81 } |
| 82 |
| 83 uint32_t |
| 84 NonCommunicatingNetDevice::GetIfIndex (void) const |
| 85 { |
| 86 NS_LOG_FUNCTION (this); |
| 87 return m_ifIndex; |
| 88 } |
| 89 |
| 90 bool |
| 91 NonCommunicatingNetDevice::SetMtu (uint16_t mtu) |
| 92 { |
| 93 NS_LOG_FUNCTION (mtu); |
| 94 return (mtu == 0); |
| 95 } |
| 96 |
| 97 uint16_t |
| 98 NonCommunicatingNetDevice::GetMtu (void) const |
| 99 { |
| 100 NS_LOG_FUNCTION (this); |
| 101 return 0; |
| 102 } |
| 103 |
| 104 void |
| 105 NonCommunicatingNetDevice::SetAddress (Address address) |
| 106 { |
| 107 NS_LOG_FUNCTION (this); |
| 108 } |
| 109 |
| 110 Address |
| 111 NonCommunicatingNetDevice::GetAddress (void) const |
| 112 { |
| 113 NS_LOG_FUNCTION (this); |
| 114 return Address (); |
| 115 } |
| 116 |
| 117 bool |
| 118 NonCommunicatingNetDevice::IsBroadcast (void) const |
| 119 { |
| 120 NS_LOG_FUNCTION (this); |
| 121 return false; |
| 122 } |
| 123 |
| 124 Address |
| 125 NonCommunicatingNetDevice::GetBroadcast (void) const |
| 126 { |
| 127 NS_LOG_FUNCTION (this); |
| 128 return Address (); |
| 129 } |
| 130 |
| 131 bool |
| 132 NonCommunicatingNetDevice::IsMulticast (void) const |
| 133 { |
| 134 NS_LOG_FUNCTION (this); |
| 135 return false; |
| 136 } |
| 137 |
| 138 Address |
| 139 NonCommunicatingNetDevice::GetMulticast (Ipv4Address addr) const |
| 140 { |
| 141 NS_LOG_FUNCTION (addr); |
| 142 return Address (); |
| 143 } |
| 144 |
| 145 Address |
| 146 NonCommunicatingNetDevice::GetMulticast (Ipv6Address addr) const |
| 147 { |
| 148 NS_LOG_FUNCTION (addr); |
| 149 return Address (); |
| 150 } |
| 151 |
| 152 bool |
| 153 NonCommunicatingNetDevice::IsPointToPoint (void) const |
| 154 { |
| 155 NS_LOG_FUNCTION (this); |
| 156 return false; |
| 157 } |
| 158 |
| 159 bool |
| 160 NonCommunicatingNetDevice::IsBridge (void) const |
| 161 { |
| 162 NS_LOG_FUNCTION (this); |
| 163 return false; |
| 164 } |
| 165 |
| 166 |
| 167 Ptr<Node> |
| 168 NonCommunicatingNetDevice::GetNode (void) const |
| 169 { |
| 170 NS_LOG_FUNCTION (this); |
| 171 return m_node; |
| 172 } |
| 173 |
| 174 void |
| 175 NonCommunicatingNetDevice::SetNode (Ptr<Node> node) |
| 176 { |
| 177 NS_LOG_FUNCTION (node); |
| 178 |
| 179 m_node = node; |
| 180 } |
| 181 |
| 182 void |
| 183 NonCommunicatingNetDevice::SetPhy (Ptr<Object> phy) |
| 184 { |
| 185 NS_LOG_FUNCTION (this << phy); |
| 186 m_phy = phy; |
| 187 } |
| 188 |
| 189 |
| 190 Ptr<Object> |
| 191 NonCommunicatingNetDevice::GetPhy () const |
| 192 { |
| 193 NS_LOG_FUNCTION (this); |
| 194 return m_phy; |
| 195 } |
| 196 |
| 197 |
| 198 |
| 199 Ptr<Channel> |
| 200 NonCommunicatingNetDevice::GetChannel (void) const |
| 201 { |
| 202 NS_LOG_FUNCTION (this); |
| 203 return m_channel; |
| 204 } |
| 205 |
| 206 |
| 207 bool |
| 208 NonCommunicatingNetDevice::NeedsArp (void) const |
| 209 { |
| 210 NS_LOG_FUNCTION (this); |
| 211 return false; |
| 212 } |
| 213 |
| 214 bool |
| 215 NonCommunicatingNetDevice::IsLinkUp (void) const |
| 216 { |
| 217 NS_LOG_FUNCTION (this); |
| 218 return false; |
| 219 } |
| 220 |
| 221 void |
| 222 NonCommunicatingNetDevice::AddLinkChangeCallback (Callback<void> callback) |
| 223 { |
| 224 NS_LOG_FUNCTION (&callback); |
| 225 } |
| 226 |
| 227 void |
| 228 NonCommunicatingNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb) |
| 229 { |
| 230 NS_LOG_FUNCTION (&cb); |
| 231 } |
| 232 |
| 233 void |
| 234 NonCommunicatingNetDevice::SetPromiscReceiveCallback (NetDevice::PromiscReceiveC
allback cb) |
| 235 { |
| 236 NS_LOG_FUNCTION (&cb); |
| 237 } |
| 238 |
| 239 bool |
| 240 NonCommunicatingNetDevice::SupportsSendFrom () const |
| 241 { |
| 242 NS_LOG_FUNCTION (this); |
| 243 return false; |
| 244 } |
| 245 |
| 246 |
| 247 bool |
| 248 NonCommunicatingNetDevice::Send (Ptr<Packet> packet,const Address& dest, uint16_
t protocolNumber) |
| 249 { |
| 250 NS_LOG_FUNCTION (packet << dest << protocolNumber); |
| 251 return false; |
| 252 } |
| 253 |
| 254 bool |
| 255 NonCommunicatingNetDevice::SendFrom (Ptr<Packet> packet, const Address& src, con
st Address& dest, uint16_t protocolNumber) |
| 256 { |
| 257 NS_LOG_FUNCTION (packet << src << dest << protocolNumber); |
| 258 return false; |
| 259 } |
| 260 |
| 261 |
| 262 } // namespace ns3 |
OLD | NEW |