author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Mon, 14 Apr 2008 16:06:44 -0700 | |
changeset 2961 | 2bcb3435483b |
parent 2942 | e37b7279e41e |
child 2965 | 4b28e9740e3b |
permissions | -rw-r--r-- |
1956 | 1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2005,2006 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 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
|
19 |
*/ |
|
20 |
#include "wifi-net-device.h" |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
21 |
#include "wifi-mac.h" |
1956 | 22 |
#include "wifi-phy.h" |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
23 |
#include "wifi-remote-station-manager.h" |
1956 | 24 |
#include "wifi-channel.h" |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
25 |
#include "ns3/llc-snap-header.h" |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
26 |
#include "ns3/packet.h" |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
27 |
#include "ns3/uinteger.h" |
2927
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2649
diff
changeset
|
28 |
#include "ns3/pointer.h" |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
29 |
#include "ns3/node.h" |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
30 |
#include "ns3/trace-source-accessor.h" |
1956 | 31 |
|
32 |
namespace ns3 { |
|
33 |
||
2942
e37b7279e41e
add missing registration macro call
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2935
diff
changeset
|
34 |
NS_OBJECT_ENSURE_REGISTERED (WifiNetDevice); |
e37b7279e41e
add missing registration macro call
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2935
diff
changeset
|
35 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
36 |
TypeId |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
37 |
WifiNetDevice::GetTypeId (void) |
2053
012487e16e31
basic tracing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2010
diff
changeset
|
38 |
{ |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2601
diff
changeset
|
39 |
static TypeId tid = TypeId ("ns3::WifiNetDevice") |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
40 |
.SetParent<NetDevice> () |
2961
2bcb3435483b
improve documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2942
diff
changeset
|
41 |
.AddAttribute ("Channel", "The channel attached to this device", |
2927
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2649
diff
changeset
|
42 |
Pointer (), |
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2649
diff
changeset
|
43 |
MakePointerAccessor (&WifiNetDevice::DoGetChannel, |
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2649
diff
changeset
|
44 |
&WifiNetDevice::SetChannel), |
2935
c24722e09df2
use a specific type if you can
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
45 |
MakePointerChecker<WifiChannel> ()) |
2961
2bcb3435483b
improve documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2942
diff
changeset
|
46 |
.AddAttribute ("Phy", "The PHY layer attached to this device.", |
2927
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2649
diff
changeset
|
47 |
Pointer (), |
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2649
diff
changeset
|
48 |
MakePointerAccessor (&WifiNetDevice::GetPhy, |
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2649
diff
changeset
|
49 |
&WifiNetDevice::SetPhy), |
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2649
diff
changeset
|
50 |
MakePointerChecker<WifiPhy> ()) |
2961
2bcb3435483b
improve documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2942
diff
changeset
|
51 |
.AddAttribute ("Mac", "The MAC layer attached to this device.", |
2927
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2649
diff
changeset
|
52 |
Pointer (), |
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2649
diff
changeset
|
53 |
MakePointerAccessor (&WifiNetDevice::GetMac, |
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2649
diff
changeset
|
54 |
&WifiNetDevice::SetMac), |
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2649
diff
changeset
|
55 |
MakePointerChecker<WifiMac> ()) |
2961
2bcb3435483b
improve documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2942
diff
changeset
|
56 |
.AddAttribute ("RemoteStationManager", "The station manager attached to this device.", |
2927
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2649
diff
changeset
|
57 |
Pointer (), |
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2649
diff
changeset
|
58 |
MakePointerAccessor (&WifiNetDevice::SetRemoteStationManager, |
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2649
diff
changeset
|
59 |
&WifiNetDevice::GetRemoteStationManager), |
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2649
diff
changeset
|
60 |
MakePointerChecker<WifiRemoteStationManager> ()) |
2961
2bcb3435483b
improve documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2942
diff
changeset
|
61 |
.AddTraceSource ("Rx", "Received payload from the MAC layer.", |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
62 |
MakeTraceSourceAccessor (&WifiNetDevice::m_rxLogger)) |
2961
2bcb3435483b
improve documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2942
diff
changeset
|
63 |
.AddTraceSource ("Tx", "Send payload to the MAC layer.", |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
64 |
MakeTraceSourceAccessor (&WifiNetDevice::m_txLogger)) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
65 |
; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
66 |
return tid; |
1964
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1956
diff
changeset
|
67 |
} |
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1956
diff
changeset
|
68 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
69 |
WifiNetDevice::WifiNetDevice () |
2562
01a2e3e1924d
initialize properly mtu field.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2551
diff
changeset
|
70 |
: m_mtu (0) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
71 |
{} |
1956 | 72 |
WifiNetDevice::~WifiNetDevice () |
2002
32903f9a7315
add dispose methods in subclasses of WifiNetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1999
diff
changeset
|
73 |
{} |
2530
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
74 |
|
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
75 |
void |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
76 |
WifiNetDevice::DoDispose (void) |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
77 |
{ |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
78 |
m_node = 0; |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
79 |
m_mac->Dispose (); |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
80 |
m_phy->Dispose (); |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
81 |
m_stationManager->Dispose (); |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
82 |
m_mac = 0; |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
83 |
m_phy = 0; |
2618
b2706c1a6c3b
release the channel.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
84 |
m_channel = 0; |
2530
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
85 |
m_stationManager = 0; |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
86 |
// chain up. |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
87 |
NetDevice::DoDispose (); |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
88 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
89 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
90 |
void |
2601
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
91 |
WifiNetDevice::SetMac (Ptr<WifiMac> mac) |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
92 |
{ |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
93 |
m_mac = mac; |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
94 |
if (m_mac != 0) |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
95 |
{ |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
96 |
if (m_stationManager != 0) |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
97 |
{ |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
98 |
m_mac->SetWifiRemoteStationManager (m_stationManager); |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
99 |
} |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
100 |
if (m_phy != 0) |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
101 |
{ |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
102 |
m_mac->SetWifiPhy (m_phy); |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
103 |
} |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
104 |
m_mac->SetForwardUpCallback (MakeCallback (&WifiNetDevice::ForwardUp, this)); |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
105 |
m_mac->SetLinkUpCallback (MakeCallback (&WifiNetDevice::LinkUp, this)); |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
106 |
m_mac->SetLinkDownCallback (MakeCallback (&WifiNetDevice::LinkDown, this)); |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
107 |
} |
1956 | 108 |
} |
2620
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
109 |
void |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
110 |
WifiNetDevice::SetPhy (Ptr<WifiPhy> phy) |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
111 |
{ |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
112 |
m_phy = phy; |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
113 |
if (m_phy != 0) |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
114 |
{ |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
115 |
if (m_channel != 0) |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
116 |
{ |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
117 |
m_channel->Add (this, m_phy); |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
118 |
m_phy->SetChannel (m_channel); |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
119 |
} |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
120 |
if (m_stationManager != 0) |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
121 |
{ |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
122 |
m_stationManager->SetupPhy (m_phy); |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
123 |
} |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
124 |
if (m_mac != 0) |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
125 |
{ |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
126 |
m_mac->SetWifiPhy (m_phy); |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
127 |
} |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
128 |
} |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
129 |
} |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
130 |
void |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
131 |
WifiNetDevice::SetRemoteStationManager (Ptr<WifiRemoteStationManager> manager) |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
132 |
{ |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
133 |
m_stationManager = manager; |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
134 |
if (m_stationManager != 0) |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
135 |
{ |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
136 |
if (m_phy != 0) |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
137 |
{ |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
138 |
m_stationManager->SetupPhy (m_phy); |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
139 |
} |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
140 |
if (m_mac != 0) |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
141 |
{ |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
142 |
m_mac->SetWifiRemoteStationManager (m_stationManager); |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
143 |
} |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
144 |
} |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
145 |
} |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
146 |
void |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
147 |
WifiNetDevice::SetChannel (Ptr<WifiChannel> channel) |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
148 |
{ |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
149 |
m_channel = channel; |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
150 |
if (m_channel != 0 && m_phy != 0) |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
151 |
{ |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
152 |
m_channel->Add (this, m_phy); |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
153 |
m_phy->SetChannel (m_channel); |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
154 |
} |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
155 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
156 |
Ptr<WifiMac> |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
157 |
WifiNetDevice::GetMac (void) const |
1998
41cd4e5694c2
dispose the channel from WifiNetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1995
diff
changeset
|
158 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
159 |
return m_mac; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
160 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
161 |
Ptr<WifiPhy> |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
162 |
WifiNetDevice::GetPhy (void) const |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
163 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
164 |
return m_phy; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
165 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
166 |
Ptr<WifiRemoteStationManager> |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
167 |
WifiNetDevice::GetRemoteStationManager (void) const |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
168 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
169 |
return m_stationManager; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
170 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
171 |
|
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
172 |
void |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
173 |
WifiNetDevice::SetName(const std::string name) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
174 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
175 |
m_name = name; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
176 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
177 |
std::string |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
178 |
WifiNetDevice::GetName(void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
179 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
180 |
return m_name; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
181 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
182 |
void |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
183 |
WifiNetDevice::SetIfIndex(const uint32_t index) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
184 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
185 |
m_ifIndex = index; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
186 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
187 |
uint32_t |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
188 |
WifiNetDevice::GetIfIndex(void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
189 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
190 |
return m_ifIndex; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
191 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
192 |
Ptr<Channel> |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
193 |
WifiNetDevice::GetChannel (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
194 |
{ |
2601
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
195 |
return m_channel; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
196 |
} |
2620
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
197 |
Ptr<WifiChannel> |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
198 |
WifiNetDevice::DoGetChannel (void) const |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
199 |
{ |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
200 |
return m_channel; |
0131b5889305
make sure that all the Setters can be invoked in any order without memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2618
diff
changeset
|
201 |
} |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
202 |
Address |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
203 |
WifiNetDevice::GetAddress (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
204 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
205 |
return m_mac->GetAddress (); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
206 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
207 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
208 |
WifiNetDevice::SetMtu (const uint16_t mtu) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
209 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
210 |
Uinteger maxMsduSize = m_mac->GetAttribute ("MaxMsduSize"); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
211 |
if (mtu > maxMsduSize && mtu > 0) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
212 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
213 |
return false; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
214 |
} |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
215 |
m_mtu = mtu; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
216 |
return true; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
217 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
218 |
uint16_t |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
219 |
WifiNetDevice::GetMtu (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
220 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
221 |
if (m_mtu == 0) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
222 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
223 |
Uinteger maxMsduSize = m_mac->GetAttribute ("MaxMsduSize"); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
224 |
m_mtu = maxMsduSize; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
225 |
} |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
226 |
return m_mtu; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
227 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
228 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
229 |
WifiNetDevice::IsLinkUp (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
230 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
231 |
return m_phy != 0 && m_linkUp; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
232 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
233 |
void |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
234 |
WifiNetDevice::SetLinkChangeCallback (Callback<void> callback) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
235 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
236 |
m_linkChange = callback; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
237 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
238 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
239 |
WifiNetDevice::IsBroadcast (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
240 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
241 |
return true; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
242 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
243 |
Address |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
244 |
WifiNetDevice::GetBroadcast (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
245 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
246 |
return Mac48Address::GetBroadcast (); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
247 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
248 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
249 |
WifiNetDevice::IsMulticast (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
250 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
251 |
return false; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
252 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
253 |
Address |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
254 |
WifiNetDevice::GetMulticast (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
255 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
256 |
return Mac48Address ("01:00:5e:00:00:00"); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
257 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
258 |
Address |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
259 |
WifiNetDevice::MakeMulticastAddress (Ipv4Address multicastGroup) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
260 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
261 |
return GetMulticast (); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
262 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
263 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
264 |
WifiNetDevice::IsPointToPoint (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
265 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
266 |
return false; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
267 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
268 |
bool |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
269 |
WifiNetDevice::Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber) |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
270 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
271 |
NS_ASSERT (Mac48Address::IsMatchingType (dest)); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
272 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
273 |
Mac48Address realTo = Mac48Address::ConvertFrom (dest); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
274 |
|
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
275 |
LlcSnapHeader llc; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
276 |
llc.SetType (protocolNumber); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
277 |
packet->AddHeader (llc); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
278 |
|
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
279 |
m_txLogger (packet, realTo); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
280 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
281 |
m_mac->Enqueue (packet, realTo); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
282 |
return true; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
283 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
284 |
Ptr<Node> |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
285 |
WifiNetDevice::GetNode (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
286 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
287 |
return m_node; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
288 |
} |
2600
6c389d0c717d
add Application::SetNode and NetDevice::SetNode, use them from Node::AddApplication and Node::AddDevice. kill useless "Node" attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2562
diff
changeset
|
289 |
void |
6c389d0c717d
add Application::SetNode and NetDevice::SetNode, use them from Node::AddApplication and Node::AddDevice. kill useless "Node" attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2562
diff
changeset
|
290 |
WifiNetDevice::SetNode (Ptr<Node> node) |
6c389d0c717d
add Application::SetNode and NetDevice::SetNode, use them from Node::AddApplication and Node::AddDevice. kill useless "Node" attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2562
diff
changeset
|
291 |
{ |
6c389d0c717d
add Application::SetNode and NetDevice::SetNode, use them from Node::AddApplication and Node::AddDevice. kill useless "Node" attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2562
diff
changeset
|
292 |
m_node = node; |
6c389d0c717d
add Application::SetNode and NetDevice::SetNode, use them from Node::AddApplication and Node::AddDevice. kill useless "Node" attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2562
diff
changeset
|
293 |
} |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
294 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
295 |
WifiNetDevice::NeedsArp (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
296 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
297 |
return true; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
298 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
299 |
void |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
300 |
WifiNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
301 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
302 |
m_forwardUp = cb; |
1964
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1956
diff
changeset
|
303 |
} |
2151
7c63780653f2
add constructors to specify the address of a device
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2146
diff
changeset
|
304 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
305 |
void |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
306 |
WifiNetDevice::ForwardUp (Ptr<Packet> packet, const Mac48Address &from) |
1956 | 307 |
{ |
2649
e7c7618c50a2
make sure the Rx trace event also gets the llc header to be symetric with the tx event.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2620
diff
changeset
|
308 |
m_rxLogger (packet, from); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
309 |
LlcSnapHeader llc; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
310 |
packet->RemoveHeader (llc); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
311 |
m_forwardUp (this, packet, llc.GetType (), from); |
2350
0b54480c4fd1
Hook trace sources into the trace system. Add WifiTrace to give a 'simple' API to tracing wifi-specific sources.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2349
diff
changeset
|
312 |
} |
2002
32903f9a7315
add dispose methods in subclasses of WifiNetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1999
diff
changeset
|
313 |
|
2151
7c63780653f2
add constructors to specify the address of a device
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2146
diff
changeset
|
314 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
315 |
WifiNetDevice::LinkUp (void) |
2151
7c63780653f2
add constructors to specify the address of a device
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2146
diff
changeset
|
316 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
317 |
m_linkUp = true; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
318 |
if (!m_linkChange.IsNull ()) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
319 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
320 |
m_linkChange (); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
321 |
} |
1956 | 322 |
} |
323 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
324 |
WifiNetDevice::LinkDown (void) |
2350
0b54480c4fd1
Hook trace sources into the trace system. Add WifiTrace to give a 'simple' API to tracing wifi-specific sources.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2349
diff
changeset
|
325 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
326 |
m_linkUp = false; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
327 |
if (!m_linkChange.IsNull ()) |
1964
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1956
diff
changeset
|
328 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
329 |
m_linkChange (); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
330 |
} |
2350
0b54480c4fd1
Hook trace sources into the trace system. Add WifiTrace to give a 'simple' API to tracing wifi-specific sources.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2349
diff
changeset
|
331 |
} |
1956 | 332 |
|
333 |
} // namespace ns3 |
|
334 |