author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Wed, 19 Mar 2008 10:30:59 -0700 | |
changeset 2649 | e7c7618c50a2 |
parent 2620 | 0131b5889305 |
child 2927 | 73b47ce1d805 |
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" |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
28 |
#include "ns3/node.h" |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
29 |
#include "ns3/trace-source-accessor.h" |
1956 | 30 |
|
31 |
namespace ns3 { |
|
32 |
||
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
33 |
TypeId |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
34 |
WifiNetDevice::GetTypeId (void) |
2053
012487e16e31
basic tracing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2010
diff
changeset
|
35 |
{ |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2601
diff
changeset
|
36 |
static TypeId tid = TypeId ("ns3::WifiNetDevice") |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
37 |
.SetParent<NetDevice> () |
2551
5df02c95c679
make pac, phy, et al available through Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2530
diff
changeset
|
38 |
.AddAttribute ("Channel", "XXX", |
5df02c95c679
make pac, phy, et al available through Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2530
diff
changeset
|
39 |
Ptr<Channel> (0), |
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
|
40 |
MakePtrAccessor (&WifiNetDevice::DoGetChannel, |
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
|
41 |
&WifiNetDevice::SetChannel), |
2551
5df02c95c679
make pac, phy, et al available through Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2530
diff
changeset
|
42 |
MakePtrChecker<Channel> ()) |
5df02c95c679
make pac, phy, et al available through Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2530
diff
changeset
|
43 |
.AddAttribute ("Phy", "XXX", |
5df02c95c679
make pac, phy, et al available through Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2530
diff
changeset
|
44 |
Ptr<WifiPhy> (0), |
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
|
45 |
MakePtrAccessor (&WifiNetDevice::GetPhy, |
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
|
46 |
&WifiNetDevice::SetPhy), |
2551
5df02c95c679
make pac, phy, et al available through Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2530
diff
changeset
|
47 |
MakePtrChecker<WifiPhy> ()) |
5df02c95c679
make pac, phy, et al available through Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2530
diff
changeset
|
48 |
.AddAttribute ("Mac", "XXX", |
5df02c95c679
make pac, phy, et al available through Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2530
diff
changeset
|
49 |
Ptr<WifiMac> (0), |
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
|
50 |
MakePtrAccessor (&WifiNetDevice::GetMac, |
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
|
51 |
&WifiNetDevice::SetMac), |
2551
5df02c95c679
make pac, phy, et al available through Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2530
diff
changeset
|
52 |
MakePtrChecker<WifiMac> ()) |
5df02c95c679
make pac, phy, et al available through Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2530
diff
changeset
|
53 |
.AddAttribute ("RemoteStationManager", "XXX", |
5df02c95c679
make pac, phy, et al available through Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2530
diff
changeset
|
54 |
Ptr<WifiRemoteStationManager> (0), |
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
|
55 |
MakePtrAccessor (&WifiNetDevice::SetRemoteStationManager, |
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
|
56 |
&WifiNetDevice::GetRemoteStationManager), |
2551
5df02c95c679
make pac, phy, et al available through Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2530
diff
changeset
|
57 |
MakePtrChecker<WifiRemoteStationManager> ()) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
58 |
.AddTraceSource ("Rx", "XXX", |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
59 |
MakeTraceSourceAccessor (&WifiNetDevice::m_rxLogger)) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
60 |
.AddTraceSource ("Tx", "XXX", |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
61 |
MakeTraceSourceAccessor (&WifiNetDevice::m_txLogger)) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
62 |
; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
63 |
return tid; |
1964
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1956
diff
changeset
|
64 |
} |
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1956
diff
changeset
|
65 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
66 |
WifiNetDevice::WifiNetDevice () |
2562
01a2e3e1924d
initialize properly mtu field.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2551
diff
changeset
|
67 |
: m_mtu (0) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
68 |
{} |
1956 | 69 |
WifiNetDevice::~WifiNetDevice () |
2002
32903f9a7315
add dispose methods in subclasses of WifiNetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1999
diff
changeset
|
70 |
{} |
2530
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
71 |
|
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
72 |
void |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
73 |
WifiNetDevice::DoDispose (void) |
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 |
m_node = 0; |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
76 |
m_mac->Dispose (); |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
77 |
m_phy->Dispose (); |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
78 |
m_stationManager->Dispose (); |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
79 |
m_mac = 0; |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
80 |
m_phy = 0; |
2618
b2706c1a6c3b
release the channel.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
81 |
m_channel = 0; |
2530
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
82 |
m_stationManager = 0; |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
83 |
// chain up. |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
84 |
NetDevice::DoDispose (); |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
85 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
86 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
87 |
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
|
88 |
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
|
89 |
{ |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
90 |
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
|
91 |
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
|
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 |
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
|
94 |
{ |
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 |
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
|
96 |
} |
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 |
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
|
98 |
{ |
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 |
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
|
100 |
} |
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 |
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
|
102 |
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
|
103 |
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
|
104 |
} |
1956 | 105 |
} |
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
|
106 |
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
|
107 |
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
|
108 |
{ |
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 |
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
|
110 |
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
|
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 |
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
|
113 |
{ |
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 |
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
|
115 |
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
|
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 |
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
|
118 |
{ |
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 |
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
|
120 |
} |
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 |
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
|
122 |
{ |
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 |
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
|
124 |
} |
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 |
} |
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 |
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
|
128 |
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
|
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 |
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
|
131 |
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
|
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 |
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
|
134 |
{ |
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 |
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
|
136 |
} |
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 |
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
|
138 |
{ |
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 |
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
|
140 |
} |
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 |
} |
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 |
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
|
144 |
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
|
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 |
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
|
147 |
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
|
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->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
|
150 |
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
|
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 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
153 |
Ptr<WifiMac> |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
154 |
WifiNetDevice::GetMac (void) const |
1998
41cd4e5694c2
dispose the channel from WifiNetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1995
diff
changeset
|
155 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
156 |
return m_mac; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
157 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
158 |
Ptr<WifiPhy> |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
159 |
WifiNetDevice::GetPhy (void) const |
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 |
return m_phy; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
162 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
163 |
Ptr<WifiRemoteStationManager> |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
164 |
WifiNetDevice::GetRemoteStationManager (void) const |
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 |
return m_stationManager; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
167 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
168 |
|
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
169 |
void |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
170 |
WifiNetDevice::SetName(const std::string name) |
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 |
m_name = name; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
173 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
174 |
std::string |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
175 |
WifiNetDevice::GetName(void) const |
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 |
return m_name; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
178 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
179 |
void |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
180 |
WifiNetDevice::SetIfIndex(const uint32_t index) |
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 |
m_ifIndex = index; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
183 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
184 |
uint32_t |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
185 |
WifiNetDevice::GetIfIndex(void) const |
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 |
return m_ifIndex; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
188 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
189 |
Ptr<Channel> |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
190 |
WifiNetDevice::GetChannel (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
191 |
{ |
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
|
192 |
return m_channel; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
193 |
} |
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
|
194 |
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
|
195 |
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
|
196 |
{ |
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 |
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
|
198 |
} |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
199 |
Address |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
200 |
WifiNetDevice::GetAddress (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
201 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
202 |
return m_mac->GetAddress (); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
203 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
204 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
205 |
WifiNetDevice::SetMtu (const uint16_t mtu) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
206 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
207 |
Uinteger maxMsduSize = m_mac->GetAttribute ("MaxMsduSize"); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
208 |
if (mtu > maxMsduSize && mtu > 0) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
209 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
210 |
return false; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
211 |
} |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
212 |
m_mtu = mtu; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
213 |
return true; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
214 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
215 |
uint16_t |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
216 |
WifiNetDevice::GetMtu (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
217 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
218 |
if (m_mtu == 0) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
219 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
220 |
Uinteger maxMsduSize = m_mac->GetAttribute ("MaxMsduSize"); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
221 |
m_mtu = maxMsduSize; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
222 |
} |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
223 |
return m_mtu; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
224 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
225 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
226 |
WifiNetDevice::IsLinkUp (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
227 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
228 |
return m_phy != 0 && m_linkUp; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
229 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
230 |
void |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
231 |
WifiNetDevice::SetLinkChangeCallback (Callback<void> callback) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
232 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
233 |
m_linkChange = callback; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
234 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
235 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
236 |
WifiNetDevice::IsBroadcast (void) const |
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 |
return true; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
239 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
240 |
Address |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
241 |
WifiNetDevice::GetBroadcast (void) const |
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 |
return Mac48Address::GetBroadcast (); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
244 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
245 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
246 |
WifiNetDevice::IsMulticast (void) const |
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 |
return false; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
249 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
250 |
Address |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
251 |
WifiNetDevice::GetMulticast (void) const |
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 |
return Mac48Address ("01:00:5e:00:00:00"); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
254 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
255 |
Address |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
256 |
WifiNetDevice::MakeMulticastAddress (Ipv4Address multicastGroup) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
257 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
258 |
return GetMulticast (); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
259 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
260 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
261 |
WifiNetDevice::IsPointToPoint (void) const |
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 |
return false; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
264 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
265 |
bool |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
266 |
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
|
267 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
268 |
NS_ASSERT (Mac48Address::IsMatchingType (dest)); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
269 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
270 |
Mac48Address realTo = Mac48Address::ConvertFrom (dest); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
271 |
|
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
272 |
LlcSnapHeader llc; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
273 |
llc.SetType (protocolNumber); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
274 |
packet->AddHeader (llc); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
275 |
|
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
276 |
m_txLogger (packet, realTo); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
277 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
278 |
m_mac->Enqueue (packet, realTo); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
279 |
return true; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
280 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
281 |
Ptr<Node> |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
282 |
WifiNetDevice::GetNode (void) const |
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 |
return m_node; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
285 |
} |
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
|
286 |
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
|
287 |
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
|
288 |
{ |
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 |
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
|
290 |
} |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
291 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
292 |
WifiNetDevice::NeedsArp (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
293 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
294 |
return true; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
295 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
296 |
void |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
297 |
WifiNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
298 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
299 |
m_forwardUp = cb; |
1964
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1956
diff
changeset
|
300 |
} |
2151
7c63780653f2
add constructors to specify the address of a device
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2146
diff
changeset
|
301 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
302 |
void |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
303 |
WifiNetDevice::ForwardUp (Ptr<Packet> packet, const Mac48Address &from) |
1956 | 304 |
{ |
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
|
305 |
m_rxLogger (packet, from); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
306 |
LlcSnapHeader llc; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
307 |
packet->RemoveHeader (llc); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
308 |
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
|
309 |
} |
2002
32903f9a7315
add dispose methods in subclasses of WifiNetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1999
diff
changeset
|
310 |
|
2151
7c63780653f2
add constructors to specify the address of a device
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2146
diff
changeset
|
311 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
312 |
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
|
313 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
314 |
m_linkUp = true; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
315 |
if (!m_linkChange.IsNull ()) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
316 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
317 |
m_linkChange (); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
318 |
} |
1956 | 319 |
} |
320 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
321 |
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
|
322 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
323 |
m_linkUp = false; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
324 |
if (!m_linkChange.IsNull ()) |
1964
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1956
diff
changeset
|
325 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
326 |
m_linkChange (); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
327 |
} |
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
|
328 |
} |
1956 | 329 |
|
330 |
} // namespace ns3 |
|
331 |