View | Details | Raw Unified | Return to bug 653
Collapse All | Expand All

(-)a/CHANGES.html (+7 lines)
 Lines 86-91    Link Here 
86
<li><b>WifiMode</b>
86
<li><b>WifiMode</b>
87
<p>WifiMode now has a WifiPhyStandard attribute which identifies the standard the WifiMode belongs to. To properly set this attribute when creating a new WifiMode, it is now required to explicitly pass a WifiPhyStandard parameter to all WifiModeFactory::CreateXXXX() methods. The WifiPhyStandard value of an existing WifiMode can be retrieved using the new method WifiMode::GetStandard().</p>
87
<p>WifiMode now has a WifiPhyStandard attribute which identifies the standard the WifiMode belongs to. To properly set this attribute when creating a new WifiMode, it is now required to explicitly pass a WifiPhyStandard parameter to all WifiModeFactory::CreateXXXX() methods. The WifiPhyStandard value of an existing WifiMode can be retrieved using the new method WifiMode::GetStandard().</p>
88
</li>
88
</li>
89
<li><b>NetDevice</b>
90
<p>In order to have multiple link change callback in NetDevice (i.e. to flush ARP and IPv6 neighbor discovery caches), the following member method has been renamed:</p>
91
<pre>
92
- virtual void SetLinkChangeCallback (Callback&lt;void&gt; callback);
93
+ virtual void AddLinkChangeCallback (Callback&lt;void&gt; callback);</pre>
94
Now each NetDevice subclasses have a TracedCallback&lt;&gt; object (list of callbacks) instead of Callback&lt;void&gt; ones.
95
</li>
89
</ul>
96
</ul>
90
97
91
<hr>
98
<hr>
(-)a/src/devices/bridge/bridge-net-device.cc (-1 / +1 lines)
 Lines 317-323    Link Here 
317
317
318
318
319
void 
319
void 
320
BridgeNetDevice::SetLinkChangeCallback (Callback<void> callback)
320
BridgeNetDevice::AddLinkChangeCallback (Callback<void> callback)
321
{}
321
{}
322
322
323
323
(-)a/src/devices/bridge/bridge-net-device.h (-1 / +1 lines)
 Lines 96-102    Link Here 
96
  virtual bool SetMtu (const uint16_t mtu);
96
  virtual bool SetMtu (const uint16_t mtu);
97
  virtual uint16_t GetMtu (void) const;
97
  virtual uint16_t GetMtu (void) const;
98
  virtual bool IsLinkUp (void) const;
98
  virtual bool IsLinkUp (void) const;
99
  virtual void SetLinkChangeCallback (Callback<void> callback);
99
  virtual void AddLinkChangeCallback (Callback<void> callback);
100
  virtual bool IsBroadcast (void) const;
100
  virtual bool IsBroadcast (void) const;
101
  virtual Address GetBroadcast (void) const;
101
  virtual Address GetBroadcast (void) const;
102
  virtual bool IsMulticast (void) const;
102
  virtual bool IsMulticast (void) const;
(-)a/src/devices/csma/csma-net-device.cc (-7 / +3 lines)
 Lines 839-850    Link Here 
839
CsmaNetDevice::NotifyLinkUp (void)
839
CsmaNetDevice::NotifyLinkUp (void)
840
{
840
{
841
  NS_LOG_FUNCTION_NOARGS ();
841
  NS_LOG_FUNCTION_NOARGS ();
842
843
  m_linkUp = true;
842
  m_linkUp = true;
844
  if (m_linkChangeCallback.IsNull () == false)
843
  m_linkChangeCallbacks ();
845
    {
846
      m_linkChangeCallback ();
847
    }
848
}
844
}
849
845
850
  void 
846
  void 
 Lines 890-899    Link Here 
890
}
886
}
891
887
892
  void 
888
  void 
893
CsmaNetDevice::SetLinkChangeCallback (Callback<void> callback)
889
CsmaNetDevice::AddLinkChangeCallback (Callback<void> callback)
894
{
890
{
895
  NS_LOG_FUNCTION (&callback);
891
  NS_LOG_FUNCTION (&callback);
896
  m_linkChangeCallback = callback;
892
  m_linkChangeCallbacks.ConnectWithoutContext (callback);
897
}
893
}
898
894
899
  bool 
895
  bool 
(-)a/src/devices/csma/csma-net-device.h (-3 / +3 lines)
 Lines 306-312    Link Here 
306
  virtual void SetAddress (Address address);
306
  virtual void SetAddress (Address address);
307
  virtual Address GetAddress (void) const;
307
  virtual Address GetAddress (void) const;
308
  virtual bool IsLinkUp (void) const;
308
  virtual bool IsLinkUp (void) const;
309
  virtual void SetLinkChangeCallback (Callback<void> callback);
309
  virtual void AddLinkChangeCallback (Callback<void> callback);
310
  virtual bool IsBroadcast (void) const;
310
  virtual bool IsBroadcast (void) const;
311
  virtual Address GetBroadcast (void) const;
311
  virtual Address GetBroadcast (void) const;
312
  virtual bool IsMulticast (void) const;
312
  virtual bool IsMulticast (void) const;
 Lines 806-814    Link Here 
806
  bool m_linkUp;
806
  bool m_linkUp;
807
807
808
  /**
808
  /**
809
   * Callback to fire if the link changes state (up or down).
809
   * List of callbacks to fire if the link changes state (up or down).
810
   */
810
   */
811
  Callback<void> m_linkChangeCallback;
811
  TracedCallback<> m_linkChangeCallbacks;
812
812
813
  static const uint16_t DEFAULT_FRAME_SIZE = 1518;
813
  static const uint16_t DEFAULT_FRAME_SIZE = 1518;
814
  static const uint16_t ETHERNET_OVERHEAD = 18;
814
  static const uint16_t ETHERNET_OVERHEAD = 18;
(-)a/src/devices/emu/emu-net-device.cc (-6 / +3 lines)
 Lines 869-878    Link Here 
869
EmuNetDevice::NotifyLinkUp (void)
869
EmuNetDevice::NotifyLinkUp (void)
870
{
870
{
871
  m_linkUp = true;
871
  m_linkUp = true;
872
  if (!m_linkChangeCallback.IsNull ())
872
  m_linkChangeCallbacks ();
873
    {
874
      m_linkChangeCallback ();
875
    }
876
}
873
}
877
874
878
void 
875
void 
 Lines 943-951    Link Here 
943
}
940
}
944
941
945
void 
942
void 
946
EmuNetDevice::SetLinkChangeCallback (Callback<void> callback)
943
EmuNetDevice::AddLinkChangeCallback (Callback<void> callback)
947
{
944
{
948
  m_linkChangeCallback = callback;
945
  m_linkChangeCallbacks.ConnectWithoutContext (callback);
949
}
946
}
950
947
951
bool 
948
bool 
(-)a/src/devices/emu/emu-net-device.h (-3 / +3 lines)
 Lines 110-116    Link Here 
110
110
111
  virtual bool IsLinkUp (void) const;
111
  virtual bool IsLinkUp (void) const;
112
112
113
  virtual void SetLinkChangeCallback (Callback<void> callback);
113
  virtual void AddLinkChangeCallback (Callback<void> callback);
114
114
115
  virtual bool IsBroadcast (void) const;
115
  virtual bool IsBroadcast (void) const;
116
  virtual Address GetBroadcast (void) const;
116
  virtual Address GetBroadcast (void) const;
 Lines 459-467    Link Here 
459
  bool m_isMulticast;
459
  bool m_isMulticast;
460
460
461
  /**
461
  /**
462
   * Callback to fire if the link changes state (up or down).
462
   * Callbacks to fire if the link changes state (up or down).
463
   */
463
   */
464
  Callback<void> m_linkChangeCallback;
464
  TracedCallback<> m_linkChangeCallbacks;
465
465
466
  /**
466
  /**
467
   * The unix/linux name of the underlying device (e.g., eth0)
467
   * The unix/linux name of the underlying device (e.g., eth0)
(-)a/src/devices/point-to-point/point-to-point-net-device.cc (-6 / +3 lines)
 Lines 366-375    Link Here 
366
PointToPointNetDevice::NotifyLinkUp (void)
366
PointToPointNetDevice::NotifyLinkUp (void)
367
{
367
{
368
  m_linkUp = true;
368
  m_linkUp = true;
369
  if (!m_linkChangeCallback.IsNull ())
369
  m_linkChangeCallbacks ();
370
    {
371
      m_linkChangeCallback ();
372
    }
373
}
370
}
374
371
375
  void 
372
  void 
 Lines 415-423    Link Here 
415
}
412
}
416
413
417
  void 
414
  void 
418
PointToPointNetDevice::SetLinkChangeCallback (Callback<void> callback)
415
PointToPointNetDevice::AddLinkChangeCallback (Callback<void> callback)
419
{
416
{
420
  m_linkChangeCallback = callback;
417
  m_linkChangeCallbacks.ConnectWithoutContext (callback);
421
}
418
}
422
419
423
//
420
//
(-)a/src/devices/point-to-point/point-to-point-net-device.h (-2 / +2 lines)
 Lines 231-237    Link Here 
231
231
232
  virtual bool IsLinkUp (void) const;
232
  virtual bool IsLinkUp (void) const;
233
233
234
  virtual void SetLinkChangeCallback (Callback<void> callback);
234
  virtual void AddLinkChangeCallback (Callback<void> callback);
235
235
236
  virtual bool IsBroadcast (void) const;
236
  virtual bool IsBroadcast (void) const;
237
  virtual Address GetBroadcast (void) const;
237
  virtual Address GetBroadcast (void) const;
 Lines 520-526    Link Here 
520
  NetDevice::PromiscReceiveCallback m_promiscCallback;
520
  NetDevice::PromiscReceiveCallback m_promiscCallback;
521
  uint32_t m_ifIndex;
521
  uint32_t m_ifIndex;
522
  bool m_linkUp;
522
  bool m_linkUp;
523
  Callback<void> m_linkChangeCallback;
523
  TracedCallback<> m_linkChangeCallbacks;
524
524
525
  static const uint16_t DEFAULT_MTU = 1500;
525
  static const uint16_t DEFAULT_MTU = 1500;
526
  static const uint16_t PPP_OVERHEAD = 2;
526
  static const uint16_t PPP_OVERHEAD = 2;
(-)a/src/devices/tap-bridge/tap-bridge.cc (-1 / +1 lines)
 Lines 1026-1032    Link Here 
1026
}
1026
}
1027
1027
1028
void 
1028
void 
1029
TapBridge::SetLinkChangeCallback (Callback<void> callback)
1029
TapBridge::AddLinkChangeCallback (Callback<void> callback)
1030
{
1030
{
1031
  NS_LOG_FUNCTION_NOARGS ();
1031
  NS_LOG_FUNCTION_NOARGS ();
1032
}
1032
}
(-)a/src/devices/tap-bridge/tap-bridge.h (-1 / +1 lines)
 Lines 181-187    Link Here 
181
  virtual bool SetMtu (const uint16_t mtu);
181
  virtual bool SetMtu (const uint16_t mtu);
182
  virtual uint16_t GetMtu (void) const;
182
  virtual uint16_t GetMtu (void) const;
183
  virtual bool IsLinkUp (void) const;
183
  virtual bool IsLinkUp (void) const;
184
  virtual void SetLinkChangeCallback (Callback<void> callback);
184
  virtual void AddLinkChangeCallback (Callback<void> callback);
185
  virtual bool IsBroadcast (void) const;
185
  virtual bool IsBroadcast (void) const;
186
  virtual Address GetBroadcast (void) const;
186
  virtual Address GetBroadcast (void) const;
187
  virtual bool IsMulticast (void) const;
187
  virtual bool IsMulticast (void) const;
(-)a/src/devices/virtual-net-device/virtual-net-device.cc (-1 / +1 lines)
 Lines 194-200    Link Here 
194
}
194
}
195
195
196
void
196
void
197
VirtualNetDevice::SetLinkChangeCallback (Callback<void> callback)
197
VirtualNetDevice::AddLinkChangeCallback (Callback<void> callback)
198
{
198
{
199
}
199
}
200
200
(-)a/src/devices/virtual-net-device/virtual-net-device.h (-1 / +1 lines)
 Lines 122-128    Link Here 
122
  virtual Address GetAddress (void) const;
122
  virtual Address GetAddress (void) const;
123
  virtual uint16_t GetMtu (void) const;
123
  virtual uint16_t GetMtu (void) const;
124
  virtual bool IsLinkUp (void) const;
124
  virtual bool IsLinkUp (void) const;
125
  virtual void SetLinkChangeCallback (Callback<void> callback);
125
  virtual void AddLinkChangeCallback (Callback<void> callback);
126
  virtual bool IsBroadcast (void) const;
126
  virtual bool IsBroadcast (void) const;
127
  virtual Address GetBroadcast (void) const;
127
  virtual Address GetBroadcast (void) const;
128
  virtual bool IsMulticast (void) const;
128
  virtual bool IsMulticast (void) const;
(-)a/src/devices/wifi/wifi-net-device.cc (-10 / +4 lines)
 Lines 196-204    Link Here 
196
  return m_phy != 0 && m_linkUp;
196
  return m_phy != 0 && m_linkUp;
197
}
197
}
198
void 
198
void 
199
WifiNetDevice::SetLinkChangeCallback (Callback<void> callback)
199
WifiNetDevice::AddLinkChangeCallback (Callback<void> callback)
200
{
200
{
201
  m_linkChange = callback;
201
  m_linkChanges.ConnectWithoutContext (callback);
202
}
202
}
203
bool 
203
bool 
204
WifiNetDevice::IsBroadcast (void) const
204
WifiNetDevice::IsBroadcast (void) const
 Lines 312-330    Link Here 
312
WifiNetDevice::LinkUp (void)
312
WifiNetDevice::LinkUp (void)
313
{
313
{
314
  m_linkUp = true;
314
  m_linkUp = true;
315
  if (!m_linkChange.IsNull ())
315
  m_linkChanges ();
316
    {
317
      m_linkChange ();
318
    }
319
}
316
}
320
void
317
void
321
WifiNetDevice::LinkDown (void)
318
WifiNetDevice::LinkDown (void)
322
{
319
{
323
  m_linkUp = false;
320
  m_linkUp = false;
324
  if (!m_linkChange.IsNull ())
321
  m_linkChanges ();
325
    {
326
      m_linkChange ();
327
    }
328
}
322
}
329
323
330
bool
324
bool
(-)a/src/devices/wifi/wifi-net-device.h (-2 / +2 lines)
 Lines 83-89    Link Here 
83
  virtual bool SetMtu (const uint16_t mtu);
83
  virtual bool SetMtu (const uint16_t mtu);
84
  virtual uint16_t GetMtu (void) const;
84
  virtual uint16_t GetMtu (void) const;
85
  virtual bool IsLinkUp (void) const;
85
  virtual bool IsLinkUp (void) const;
86
  virtual void SetLinkChangeCallback (Callback<void> callback);
86
  virtual void AddLinkChangeCallback (Callback<void> callback);
87
  virtual bool IsBroadcast (void) const;
87
  virtual bool IsBroadcast (void) const;
88
  virtual Address GetBroadcast (void) const;
88
  virtual Address GetBroadcast (void) const;
89
  virtual bool IsMulticast (void) const;
89
  virtual bool IsMulticast (void) const;
 Lines 123-129    Link Here 
123
123
124
  uint32_t m_ifIndex;
124
  uint32_t m_ifIndex;
125
  bool m_linkUp;
125
  bool m_linkUp;
126
  Callback<void> m_linkChange;
126
  TracedCallback<> m_linkChanges;
127
  mutable uint16_t m_mtu;
127
  mutable uint16_t m_mtu;
128
  bool m_configComplete;
128
  bool m_configComplete;
129
};
129
};
(-)a/src/internet-stack/arp-l3-protocol.cc (-1 / +1 lines)
 Lines 116-122    Link Here 
116
  Ptr<ArpCache> cache = CreateObject<ArpCache> ();
116
  Ptr<ArpCache> cache = CreateObject<ArpCache> ();
117
  cache->SetDevice (device, interface);
117
  cache->SetDevice (device, interface);
118
  NS_ASSERT (device->IsBroadcast ());
118
  NS_ASSERT (device->IsBroadcast ());
119
  device->SetLinkChangeCallback (MakeCallback (&ArpCache::Flush, cache));
119
  device->AddLinkChangeCallback (MakeCallback (&ArpCache::Flush, cache));
120
  cache->SetArpRequestCallback (MakeCallback (&ArpL3Protocol::SendArpRequest, this));
120
  cache->SetArpRequestCallback (MakeCallback (&ArpL3Protocol::SendArpRequest, this));
121
  m_cacheList.push_back (cache);
121
  m_cacheList.push_back (cache);
122
  return cache;
122
  return cache;
(-)a/src/internet-stack/icmpv6-l4-protocol.cc (-5 / +2 lines)
 Lines 1076-1087    Link Here 
1076
{
1076
{
1077
  Ptr<Ipv6L3Protocol> ipv6 = m_node->GetObject<Ipv6L3Protocol> ();
1077
  Ptr<Ipv6L3Protocol> ipv6 = m_node->GetObject<Ipv6L3Protocol> ();
1078
  Ptr<NdiscCache> cache = CreateObject<NdiscCache> ();
1078
  Ptr<NdiscCache> cache = CreateObject<NdiscCache> ();
1079
  
1079
  cache->SetDevice (device, interface);
1080
  cache->SetDevice (device, interface);
1080
1081
  device->AddLinkChangeCallback (MakeCallback (&NdiscCache::Flush, cache));
1081
  /* XXX : make a list of callback in net-device.cc
1082
   * else we override IPv4 flushing ARP table...
1083
   */
1084
/* device->SetLinkChangeCallback (MakeCallback (&NdiscCache::Flush, cache)); */
1085
  m_cacheList.push_back (cache);
1082
  m_cacheList.push_back (cache);
1086
  return cache;
1083
  return cache;
1087
}
1084
}
(-)a/src/internet-stack/loopback-net-device.cc (-1 / +1 lines)
 Lines 125-131    Link Here 
125
}
125
}
126
126
127
void 
127
void 
128
LoopbackNetDevice::SetLinkChangeCallback (Callback<void> callback)
128
LoopbackNetDevice::AddLinkChangeCallback (Callback<void> callback)
129
{}
129
{}
130
130
131
bool 
131
bool 
(-)a/src/internet-stack/loopback-net-device.h (-1 / +1 lines)
 Lines 50-56    Link Here 
50
  virtual bool SetMtu (const uint16_t mtu);
50
  virtual bool SetMtu (const uint16_t mtu);
51
  virtual uint16_t GetMtu (void) const;
51
  virtual uint16_t GetMtu (void) const;
52
  virtual bool IsLinkUp (void) const;
52
  virtual bool IsLinkUp (void) const;
53
  virtual void SetLinkChangeCallback (Callback<void> callback);
53
  virtual void AddLinkChangeCallback (Callback<void> callback);
54
  virtual bool IsBroadcast (void) const;
54
  virtual bool IsBroadcast (void) const;
55
  virtual Address GetBroadcast (void) const;
55
  virtual Address GetBroadcast (void) const;
56
  virtual bool IsMulticast (void) const;
56
  virtual bool IsMulticast (void) const;
(-)a/src/node/net-device.h (-4 / +4 lines)
 Lines 128-139    Link Here 
128
  /**
128
  /**
129
   * \param callback the callback to invoke
129
   * \param callback the callback to invoke
130
   *
130
   *
131
   * Register a callback invoked whenever the link 
131
   * Add a callback invoked whenever the link 
132
   * status changes to UP. This callback is typically used
132
   * status changes to UP. This callback is typically used
133
   * by the IP/ARP layer to flush the ARP cache 
133
   * by the IP/ARP layer to flush the ARP cache and by IPv6 stack
134
   * whenever the link goes up.
134
   * to flush NDISC cache whenever the link goes up.
135
   */
135
   */
136
  virtual void SetLinkChangeCallback (Callback<void> callback) = 0;
136
  virtual void AddLinkChangeCallback (Callback<void> callback) = 0;
137
  /**
137
  /**
138
   * \return true if this interface supports a broadcast address,
138
   * \return true if this interface supports a broadcast address,
139
   *         false otherwise.
139
   *         false otherwise.
(-)a/src/node/simple-net-device.cc (-1 / +1 lines)
 Lines 121-127    Link Here 
121
  return true;
121
  return true;
122
}
122
}
123
void 
123
void 
124
SimpleNetDevice::SetLinkChangeCallback (Callback<void> callback)
124
SimpleNetDevice::AddLinkChangeCallback (Callback<void> callback)
125
{}
125
{}
126
bool 
126
bool 
127
SimpleNetDevice::IsBroadcast (void) const
127
SimpleNetDevice::IsBroadcast (void) const
(-)a/src/node/simple-net-device.h (-1 / +1 lines)
 Lines 53-59    Link Here 
53
  virtual bool SetMtu (const uint16_t mtu);
53
  virtual bool SetMtu (const uint16_t mtu);
54
  virtual uint16_t GetMtu (void) const;
54
  virtual uint16_t GetMtu (void) const;
55
  virtual bool IsLinkUp (void) const;
55
  virtual bool IsLinkUp (void) const;
56
  virtual void SetLinkChangeCallback (Callback<void> callback);
56
  virtual void AddLinkChangeCallback (Callback<void> callback);
57
  virtual bool IsBroadcast (void) const;
57
  virtual bool IsBroadcast (void) const;
58
  virtual Address GetBroadcast (void) const;
58
  virtual Address GetBroadcast (void) const;
59
  virtual bool IsMulticast (void) const;
59
  virtual bool IsMulticast (void) const;

Return to bug 653