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

(-)a/src/tap-bridge/model/tap-bridge.cc (-1 / +15 lines)
 Lines 236-241   TapBridge::StartTapDevice (void) Link Here 
236
  //
236
  //
237
  CreateTap ();
237
  CreateTap ();
238
238
239
  // Declare the link up
240
  NotifyLinkUp ();
241
239
  //
242
  //
240
  // Now spin up a read thread to read packets from the tap device.
243
  // Now spin up a read thread to read packets from the tap device.
241
  //
244
  //
 Lines 1039-1056   TapBridge::GetMtu (void) const Link Here 
1039
  return m_mtu;
1042
  return m_mtu;
1040
}
1043
}
1041
1044
1045
void
1046
TapBridge::NotifyLinkUp (void)
1047
{
1048
  NS_LOG_FUNCTION_NOARGS ();
1049
  if (!m_linkUp)
1050
    {
1051
      m_linkUp = true;
1052
      m_linkChangeCallbacks ();
1053
    }
1054
}
1042
1055
1043
bool 
1056
bool 
1044
TapBridge::IsLinkUp (void) const
1057
TapBridge::IsLinkUp (void) const
1045
{
1058
{
1046
  NS_LOG_FUNCTION_NOARGS ();
1059
  NS_LOG_FUNCTION_NOARGS ();
1047
  return true;
1060
  return m_linkUp;
1048
}
1061
}
1049
1062
1050
void 
1063
void 
1051
TapBridge::AddLinkChangeCallback (Callback<void> callback)
1064
TapBridge::AddLinkChangeCallback (Callback<void> callback)
1052
{
1065
{
1053
  NS_LOG_FUNCTION_NOARGS ();
1066
  NS_LOG_FUNCTION_NOARGS ();
1067
  m_linkChangeCallbacks.ConnectWithoutContext (callback);
1054
}
1068
}
1055
1069
1056
bool 
1070
bool 
(-)a/src/tap-bridge/model/tap-bridge.h (+18 lines)
 Lines 291-296   private: Link Here 
291
   */
291
   */
292
  Ptr<Packet> Filter (Ptr<Packet> packet, Address *src, Address *dst, uint16_t *type);
292
  Ptr<Packet> Filter (Ptr<Packet> packet, Address *src, Address *dst, uint16_t *type);
293
293
294
  void NotifyLinkUp (void);
295
294
  /**
296
  /**
295
   * \internal
297
   * \internal
296
   *
298
   *
 Lines 463-468   private: Link Here 
463
   * multithreaded apps is not a good thing.
465
   * multithreaded apps is not a good thing.
464
   */
466
   */
465
  uint32_t m_nodeId;
467
  uint32_t m_nodeId;
468
469
  /**
470
   * \internal
471
   *
472
   * Flag indicating whether or not the link is up.  In this case,
473
   * whether or not ns-3 is connected to the underlying TAP device
474
   * with a file descriptor.
475
   */
476
  bool m_linkUp;
477
478
  /**
479
   * \internal
480
   *
481
   * Callbacks to fire if the link changes state (up or down).
482
   */
483
  TracedCallback<> m_linkChangeCallbacks;
466
};
484
};
467
485
468
} // namespace ns3
486
} // namespace ns3

Return to bug 1778