author | Junling Bu <linlinjavaer@gmail.com> |
Sun, 22 Sep 2013 20:59:18 -0700 | |
changeset 10204 | 7a102bb70a36 |
parent 9703 | 681f35b212ff |
child 10410 | 4d4eb8097fa3 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7333
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
1956 | 2 |
/* |
3 |
* Copyright (c) 2005,2006 INRIA |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
1956 | 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" |
5421
612dd4189fa7
add NS_LOG_FUNCTION to several constructors/destructors/DoDisposes
Andrey Mazo <mazo@iitp.ru>
parents:
4764
diff
changeset
|
31 |
#include "ns3/log.h" |
612dd4189fa7
add NS_LOG_FUNCTION to several constructors/destructors/DoDisposes
Andrey Mazo <mazo@iitp.ru>
parents:
4764
diff
changeset
|
32 |
|
612dd4189fa7
add NS_LOG_FUNCTION to several constructors/destructors/DoDisposes
Andrey Mazo <mazo@iitp.ru>
parents:
4764
diff
changeset
|
33 |
NS_LOG_COMPONENT_DEFINE ("WifiNetDevice"); |
1956 | 34 |
|
35 |
namespace ns3 { |
|
36 |
||
2942
e37b7279e41e
add missing registration macro call
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2935
diff
changeset
|
37 |
NS_OBJECT_ENSURE_REGISTERED (WifiNetDevice); |
e37b7279e41e
add missing registration macro call
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2935
diff
changeset
|
38 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
39 |
TypeId |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
40 |
WifiNetDevice::GetTypeId (void) |
2053
012487e16e31
basic tracing support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2010
diff
changeset
|
41 |
{ |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2601
diff
changeset
|
42 |
static TypeId tid = TypeId ("ns3::WifiNetDevice") |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
43 |
.SetParent<NetDevice> () |
4528
49927f942aea
register missing constructors
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4322
diff
changeset
|
44 |
.AddConstructor<WifiNetDevice> () |
6183
8a5e1f9db873
[bug 822] Move Mtu attribute from NetDevice base class to subclasses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5743
diff
changeset
|
45 |
.AddAttribute ("Mtu", "The MAC-level Maximum Transmission Unit", |
6473 | 46 |
UintegerValue (MAX_MSDU_SIZE - LLC_SNAP_HEADER_LENGTH), |
6183
8a5e1f9db873
[bug 822] Move Mtu attribute from NetDevice base class to subclasses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5743
diff
changeset
|
47 |
MakeUintegerAccessor (&WifiNetDevice::SetMtu, |
8a5e1f9db873
[bug 822] Move Mtu attribute from NetDevice base class to subclasses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5743
diff
changeset
|
48 |
&WifiNetDevice::GetMtu), |
6473 | 49 |
MakeUintegerChecker<uint16_t> (1,MAX_MSDU_SIZE - LLC_SNAP_HEADER_LENGTH)) |
2961
2bcb3435483b
improve documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2942
diff
changeset
|
50 |
.AddAttribute ("Channel", "The channel attached to this device", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2961
diff
changeset
|
51 |
PointerValue (), |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
52 |
MakePointerAccessor (&WifiNetDevice::DoGetChannel), |
2935
c24722e09df2
use a specific type if you can
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
53 |
MakePointerChecker<WifiChannel> ()) |
2961
2bcb3435483b
improve documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2942
diff
changeset
|
54 |
.AddAttribute ("Phy", "The PHY layer attached to this device.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2961
diff
changeset
|
55 |
PointerValue (), |
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
|
56 |
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
|
57 |
&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
|
58 |
MakePointerChecker<WifiPhy> ()) |
2961
2bcb3435483b
improve documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2942
diff
changeset
|
59 |
.AddAttribute ("Mac", "The MAC layer attached to this device.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2961
diff
changeset
|
60 |
PointerValue (), |
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
|
61 |
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
|
62 |
&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
|
63 |
MakePointerChecker<WifiMac> ()) |
2961
2bcb3435483b
improve documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2942
diff
changeset
|
64 |
.AddAttribute ("RemoteStationManager", "The station manager attached to this device.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2961
diff
changeset
|
65 |
PointerValue (), |
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
|
66 |
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
|
67 |
&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
|
68 |
MakePointerChecker<WifiRemoteStationManager> ()) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
69 |
; |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
70 |
return tid; |
1964
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1956
diff
changeset
|
71 |
} |
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1956
diff
changeset
|
72 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
73 |
WifiNetDevice::WifiNetDevice () |
6183
8a5e1f9db873
[bug 822] Move Mtu attribute from NetDevice base class to subclasses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5743
diff
changeset
|
74 |
: m_configComplete (false) |
5421
612dd4189fa7
add NS_LOG_FUNCTION to several constructors/destructors/DoDisposes
Andrey Mazo <mazo@iitp.ru>
parents:
4764
diff
changeset
|
75 |
{ |
612dd4189fa7
add NS_LOG_FUNCTION to several constructors/destructors/DoDisposes
Andrey Mazo <mazo@iitp.ru>
parents:
4764
diff
changeset
|
76 |
NS_LOG_FUNCTION_NOARGS (); |
612dd4189fa7
add NS_LOG_FUNCTION to several constructors/destructors/DoDisposes
Andrey Mazo <mazo@iitp.ru>
parents:
4764
diff
changeset
|
77 |
} |
1956 | 78 |
WifiNetDevice::~WifiNetDevice () |
5421
612dd4189fa7
add NS_LOG_FUNCTION to several constructors/destructors/DoDisposes
Andrey Mazo <mazo@iitp.ru>
parents:
4764
diff
changeset
|
79 |
{ |
612dd4189fa7
add NS_LOG_FUNCTION to several constructors/destructors/DoDisposes
Andrey Mazo <mazo@iitp.ru>
parents:
4764
diff
changeset
|
80 |
NS_LOG_FUNCTION_NOARGS (); |
612dd4189fa7
add NS_LOG_FUNCTION to several constructors/destructors/DoDisposes
Andrey Mazo <mazo@iitp.ru>
parents:
4764
diff
changeset
|
81 |
} |
2530
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
82 |
|
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
83 |
void |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
84 |
WifiNetDevice::DoDispose (void) |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
85 |
{ |
5421
612dd4189fa7
add NS_LOG_FUNCTION to several constructors/destructors/DoDisposes
Andrey Mazo <mazo@iitp.ru>
parents:
4764
diff
changeset
|
86 |
NS_LOG_FUNCTION_NOARGS (); |
2530
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
87 |
m_node = 0; |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
88 |
m_mac->Dispose (); |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
89 |
m_phy->Dispose (); |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
90 |
m_stationManager->Dispose (); |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
91 |
m_mac = 0; |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
92 |
m_phy = 0; |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
93 |
m_stationManager = 0; |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
94 |
// chain up. |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
95 |
NetDevice::DoDispose (); |
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
96 |
} |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
97 |
|
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
98 |
void |
9703
681f35b212ff
Rename Start and DoStart methods to Initialize and DoInitialize
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
99 |
WifiNetDevice::DoInitialize (void) |
5743
605867b1d6a8
Followup to changeset efed7493f2c1: Forgot to forward the start event to the MAC layer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5421
diff
changeset
|
100 |
{ |
9703
681f35b212ff
Rename Start and DoStart methods to Initialize and DoInitialize
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
101 |
m_phy->Initialize (); |
681f35b212ff
Rename Start and DoStart methods to Initialize and DoInitialize
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
102 |
m_mac->Initialize (); |
681f35b212ff
Rename Start and DoStart methods to Initialize and DoInitialize
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
103 |
m_stationManager->Initialize (); |
681f35b212ff
Rename Start and DoStart methods to Initialize and DoInitialize
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
104 |
NetDevice::DoInitialize (); |
5743
605867b1d6a8
Followup to changeset efed7493f2c1: Forgot to forward the start event to the MAC layer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5421
diff
changeset
|
105 |
} |
605867b1d6a8
Followup to changeset efed7493f2c1: Forgot to forward the start event to the MAC layer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5421
diff
changeset
|
106 |
|
605867b1d6a8
Followup to changeset efed7493f2c1: Forgot to forward the start event to the MAC layer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5421
diff
changeset
|
107 |
void |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
108 |
WifiNetDevice::CompleteConfig (void) |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
109 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
110 |
if (m_mac == 0 |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
111 |
|| m_phy == 0 |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
112 |
|| m_stationManager == 0 |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
113 |
|| m_node == 0 |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
114 |
|| m_configComplete) |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
115 |
{ |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
116 |
return; |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
117 |
} |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
118 |
m_mac->SetWifiRemoteStationManager (m_stationManager); |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
119 |
m_mac->SetWifiPhy (m_phy); |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
120 |
m_mac->SetForwardUpCallback (MakeCallback (&WifiNetDevice::ForwardUp, this)); |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
121 |
m_mac->SetLinkUpCallback (MakeCallback (&WifiNetDevice::LinkUp, this)); |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
122 |
m_mac->SetLinkDownCallback (MakeCallback (&WifiNetDevice::LinkDown, this)); |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
123 |
m_stationManager->SetupPhy (m_phy); |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
124 |
m_configComplete = true; |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
125 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
126 |
|
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
127 |
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
|
128 |
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
|
129 |
{ |
4297e8c61615
rework the Wifi API to not use a single WifiNetDevice::Setup method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
130 |
m_mac = mac; |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
131 |
CompleteConfig (); |
1956 | 132 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
133 |
void |
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
|
134 |
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
|
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 |
m_phy = phy; |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
137 |
CompleteConfig (); |
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
|
138 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
139 |
void |
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
|
140 |
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
|
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_stationManager = manager; |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
143 |
CompleteConfig (); |
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
|
144 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
145 |
Ptr<WifiMac> |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
146 |
WifiNetDevice::GetMac (void) const |
1998
41cd4e5694c2
dispose the channel from WifiNetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1995
diff
changeset
|
147 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
148 |
return m_mac; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
149 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
150 |
Ptr<WifiPhy> |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
151 |
WifiNetDevice::GetPhy (void) const |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
152 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
153 |
return m_phy; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
154 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
155 |
Ptr<WifiRemoteStationManager> |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
156 |
WifiNetDevice::GetRemoteStationManager (void) const |
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 |
return m_stationManager; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
159 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
160 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
161 |
void |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
162 |
WifiNetDevice::SetIfIndex (const uint32_t index) |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
163 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
164 |
m_ifIndex = index; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
165 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
166 |
uint32_t |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
167 |
WifiNetDevice::GetIfIndex (void) const |
2470
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 |
return m_ifIndex; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
170 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
171 |
Ptr<Channel> |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
172 |
WifiNetDevice::GetChannel (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
173 |
{ |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
174 |
return m_phy->GetChannel (); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
175 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
176 |
Ptr<WifiChannel> |
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
|
177 |
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
|
178 |
{ |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
179 |
return m_phy->GetChannel (); |
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
|
180 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
181 |
void |
4578
88434ff8f0a5
Finally make tap bridge work with VMs (bug 569)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4528
diff
changeset
|
182 |
WifiNetDevice::SetAddress (Address address) |
88434ff8f0a5
Finally make tap bridge work with VMs (bug 569)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4528
diff
changeset
|
183 |
{ |
88434ff8f0a5
Finally make tap bridge work with VMs (bug 569)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4528
diff
changeset
|
184 |
m_mac->SetAddress (Mac48Address::ConvertFrom (address)); |
88434ff8f0a5
Finally make tap bridge work with VMs (bug 569)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4528
diff
changeset
|
185 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
186 |
Address |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
187 |
WifiNetDevice::GetAddress (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
188 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
189 |
return m_mac->GetAddress (); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
190 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
191 |
bool |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
192 |
WifiNetDevice::SetMtu (const uint16_t mtu) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
193 |
{ |
6473 | 194 |
if (mtu > MAX_MSDU_SIZE - LLC_SNAP_HEADER_LENGTH) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
195 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
196 |
return false; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
197 |
} |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
198 |
m_mtu = mtu; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
199 |
return true; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
200 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
201 |
uint16_t |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
202 |
WifiNetDevice::GetMtu (void) const |
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 |
return m_mtu; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
205 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
206 |
bool |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
207 |
WifiNetDevice::IsLinkUp (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
208 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
209 |
return m_phy != 0 && m_linkUp; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
210 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
211 |
void |
4764
e90e1ef585b0
[Bug 653] NetDevice link change callback (SetLinkChangeCallback -> AddLinkChangeCallback).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4578
diff
changeset
|
212 |
WifiNetDevice::AddLinkChangeCallback (Callback<void> callback) |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
213 |
{ |
4764
e90e1ef585b0
[Bug 653] NetDevice link change callback (SetLinkChangeCallback -> AddLinkChangeCallback).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4578
diff
changeset
|
214 |
m_linkChanges.ConnectWithoutContext (callback); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
215 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
216 |
bool |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
217 |
WifiNetDevice::IsBroadcast (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
218 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
219 |
return true; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
220 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
221 |
Address |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
222 |
WifiNetDevice::GetBroadcast (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
223 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
224 |
return Mac48Address::GetBroadcast (); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
225 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
226 |
bool |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
227 |
WifiNetDevice::IsMulticast (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
228 |
{ |
4079
210d64d11998
add wifi multicast support. Based on patch by Mauchle Fabian.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3945
diff
changeset
|
229 |
return true; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
230 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
231 |
Address |
3841
1e7abf5fca79
Apply Patch to address bug 294 -- due to vincent
Craig Dowell <craigdo@ee.washington.edu>
parents:
3604
diff
changeset
|
232 |
WifiNetDevice::GetMulticast (Ipv4Address multicastGroup) const |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
233 |
{ |
3549
4eaf02702f17
shared Mac48 multicast code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
234 |
return Mac48Address::GetMulticast (multicastGroup); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
235 |
} |
3852 | 236 |
Address WifiNetDevice::GetMulticast (Ipv6Address addr) const |
237 |
{ |
|
238 |
return Mac48Address::GetMulticast (addr); |
|
239 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
240 |
bool |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
241 |
WifiNetDevice::IsPointToPoint (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
242 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
243 |
return false; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
244 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
245 |
bool |
3936
e525995ce5dc
implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents:
3852
diff
changeset
|
246 |
WifiNetDevice::IsBridge (void) const |
e525995ce5dc
implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents:
3852
diff
changeset
|
247 |
{ |
e525995ce5dc
implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents:
3852
diff
changeset
|
248 |
return false; |
e525995ce5dc
implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents:
3852
diff
changeset
|
249 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
250 |
bool |
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4079
diff
changeset
|
251 |
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
|
252 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
253 |
NS_ASSERT (Mac48Address::IsMatchingType (dest)); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
254 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
255 |
Mac48Address realTo = Mac48Address::ConvertFrom (dest); |
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4079
diff
changeset
|
256 |
|
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
257 |
LlcSnapHeader llc; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
258 |
llc.SetType (protocolNumber); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
259 |
packet->AddHeader (llc); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
260 |
|
4272
b40ce56e0247
Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents:
4265
diff
changeset
|
261 |
m_mac->NotifyTx (packet); |
3602
e8e41feee205
implement SendFrom correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3584
diff
changeset
|
262 |
m_mac->Enqueue (packet, realTo); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
263 |
return true; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
264 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
265 |
Ptr<Node> |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
266 |
WifiNetDevice::GetNode (void) const |
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 |
return m_node; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
269 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
270 |
void |
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
|
271 |
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
|
272 |
{ |
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
|
273 |
m_node = node; |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
274 |
CompleteConfig (); |
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
|
275 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
276 |
bool |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
277 |
WifiNetDevice::NeedsArp (void) const |
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 |
return true; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
280 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7061
diff
changeset
|
281 |
void |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
282 |
WifiNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2292
diff
changeset
|
283 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
284 |
m_forwardUp = cb; |
1964
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1956
diff
changeset
|
285 |
} |
2151
7c63780653f2
add constructors to specify the address of a device
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2146
diff
changeset
|
286 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
287 |
void |
3604
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
288 |
WifiNetDevice::ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to) |
1956 | 289 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
290 |
LlcSnapHeader llc; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
291 |
packet->RemoveHeader (llc); |
3604
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
292 |
enum NetDevice::PacketType type; |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
293 |
if (to.IsBroadcast ()) |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
294 |
{ |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
295 |
type = NetDevice::PACKET_BROADCAST; |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
296 |
} |
4079
210d64d11998
add wifi multicast support. Based on patch by Mauchle Fabian.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3945
diff
changeset
|
297 |
else if (to.IsGroup ()) |
3604
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
298 |
{ |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
299 |
type = NetDevice::PACKET_MULTICAST; |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
300 |
} |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
301 |
else if (to == m_mac->GetAddress ()) |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
302 |
{ |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
303 |
type = NetDevice::PACKET_HOST; |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
304 |
} |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
305 |
else |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
306 |
{ |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
307 |
type = NetDevice::PACKET_OTHERHOST; |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
308 |
} |
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4079
diff
changeset
|
309 |
|
3604
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
310 |
if (type != NetDevice::PACKET_OTHERHOST) |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
311 |
{ |
4272
b40ce56e0247
Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents:
4265
diff
changeset
|
312 |
m_mac->NotifyRx (packet); |
3604
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
313 |
m_forwardUp (this, packet, llc.GetType (), from); |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
314 |
} |
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4079
diff
changeset
|
315 |
|
3604
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
316 |
if (!m_promiscRx.IsNull ()) |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
317 |
{ |
4272
b40ce56e0247
Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents:
4265
diff
changeset
|
318 |
m_mac->NotifyPromiscRx (packet); |
4265
5f837915710a
remove unneeded packet copies, includes. Rescan
Craig Dowell <craigdo@ee.washington.edu>
parents:
4264
diff
changeset
|
319 |
m_promiscRx (this, packet, llc.GetType (), from, to, type); |
3604
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
320 |
} |
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
|
321 |
} |
2002
32903f9a7315
add dispose methods in subclasses of WifiNetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1999
diff
changeset
|
322 |
|
2151
7c63780653f2
add constructors to specify the address of a device
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2146
diff
changeset
|
323 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
324 |
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
|
325 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
326 |
m_linkUp = true; |
4764
e90e1ef585b0
[Bug 653] NetDevice link change callback (SetLinkChangeCallback -> AddLinkChangeCallback).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4578
diff
changeset
|
327 |
m_linkChanges (); |
1956 | 328 |
} |
329 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
330 |
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
|
331 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2510
diff
changeset
|
332 |
m_linkUp = false; |
4764
e90e1ef585b0
[Bug 653] NetDevice link change callback (SetLinkChangeCallback -> AddLinkChangeCallback).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4578
diff
changeset
|
333 |
m_linkChanges (); |
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
|
334 |
} |
1956 | 335 |
|
3480
a920df6b9f02
Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2965
diff
changeset
|
336 |
bool |
a920df6b9f02
Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2965
diff
changeset
|
337 |
WifiNetDevice::SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber) |
a920df6b9f02
Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2965
diff
changeset
|
338 |
{ |
3517
5ba130a7f519
implement WifiNetDevice::SendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3480
diff
changeset
|
339 |
NS_ASSERT (Mac48Address::IsMatchingType (dest)); |
5ba130a7f519
implement WifiNetDevice::SendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3480
diff
changeset
|
340 |
NS_ASSERT (Mac48Address::IsMatchingType (source)); |
5ba130a7f519
implement WifiNetDevice::SendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3480
diff
changeset
|
341 |
|
5ba130a7f519
implement WifiNetDevice::SendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3480
diff
changeset
|
342 |
Mac48Address realTo = Mac48Address::ConvertFrom (dest); |
5ba130a7f519
implement WifiNetDevice::SendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3480
diff
changeset
|
343 |
Mac48Address realFrom = Mac48Address::ConvertFrom (source); |
5ba130a7f519
implement WifiNetDevice::SendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3480
diff
changeset
|
344 |
|
5ba130a7f519
implement WifiNetDevice::SendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3480
diff
changeset
|
345 |
LlcSnapHeader llc; |
5ba130a7f519
implement WifiNetDevice::SendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3480
diff
changeset
|
346 |
llc.SetType (protocolNumber); |
5ba130a7f519
implement WifiNetDevice::SendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3480
diff
changeset
|
347 |
packet->AddHeader (llc); |
5ba130a7f519
implement WifiNetDevice::SendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3480
diff
changeset
|
348 |
|
4272
b40ce56e0247
Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents:
4265
diff
changeset
|
349 |
m_mac->NotifyTx (packet); |
3517
5ba130a7f519
implement WifiNetDevice::SendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3480
diff
changeset
|
350 |
m_mac->Enqueue (packet, realTo, realFrom); |
5ba130a7f519
implement WifiNetDevice::SendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3480
diff
changeset
|
351 |
|
5ba130a7f519
implement WifiNetDevice::SendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3480
diff
changeset
|
352 |
return true; |
3480
a920df6b9f02
Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2965
diff
changeset
|
353 |
} |
a920df6b9f02
Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2965
diff
changeset
|
354 |
|
a920df6b9f02
Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2965
diff
changeset
|
355 |
void |
a920df6b9f02
Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2965
diff
changeset
|
356 |
WifiNetDevice::SetPromiscReceiveCallback (PromiscReceiveCallback cb) |
a920df6b9f02
Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2965
diff
changeset
|
357 |
{ |
3604
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
358 |
m_promiscRx = cb; |
7333
17b50c5b062c
[Bug 827] promiscuous mode for wifi
Ruben Merz <ruben@net.t-labs.tu-berlin.de>
parents:
7141
diff
changeset
|
359 |
m_mac->SetPromisc(); |
3480
a920df6b9f02
Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2965
diff
changeset
|
360 |
} |
a920df6b9f02
Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2965
diff
changeset
|
361 |
|
a920df6b9f02
Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2965
diff
changeset
|
362 |
bool |
3584
4eb48239b4dc
bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3549
diff
changeset
|
363 |
WifiNetDevice::SupportsSendFrom (void) const |
3480
a920df6b9f02
Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2965
diff
changeset
|
364 |
{ |
3603
da21b3e410b6
implement SupportsSendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3602
diff
changeset
|
365 |
return m_mac->SupportsSendFrom (); |
3480
a920df6b9f02
Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2965
diff
changeset
|
366 |
} |
a920df6b9f02
Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2965
diff
changeset
|
367 |
|
1956 | 368 |
} // namespace ns3 |
369 |