--- a/CHANGES.html Sat Feb 28 16:25:24 2009 -0800
+++ b/CHANGES.html Tue Mar 10 23:47:55 2009 -0700
@@ -44,6 +44,21 @@
us a note on ns-developers mailing list. </p>
<hr>
+<h1>changes from ns-3.3 to ns-3.4</h1>
+
+<h2>new API:</h2>
+<ul>
+<li>ConstantAccelerationMobilityModel in src/mobility/constant-acceleration-mobility-model.h</li>
+</ul>
+
+<h2>changes to existing API:</h2>
+
+<ul>
+<li>StaticMobilityModel has been renamed ConstantPositionMobilityModel</li>
+<li>StaticSpeedMobilityModel has been renamed ConstantVelocityMobilityModel</li>
+</ul>
+
+<hr>
<h1>changes from ns-3.2 to ns-3.3</h1>
<h2>new API:</h2>
--- a/bindings/python/ns3_module_core.py Sat Feb 28 16:25:24 2009 -0800
+++ b/bindings/python/ns3_module_core.py Tue Mar 10 23:47:55 2009 -0700
@@ -1115,10 +1115,11 @@
cls.add_constructor([])
## random-variable.h: ns3::UniformVariable::UniformVariable(double s, double l) [constructor]
cls.add_constructor([param('double', 's'), param('double', 'l')])
- ## random-variable.h: double ns3::UniformVariable::GetValue() [member function]
+ ## random-variable.h: double ns3::UniformVariable::GetValue() const [member function]
cls.add_method('GetValue',
'double',
- [])
+ [],
+ is_const=True)
## random-variable.h: double ns3::UniformVariable::GetValue(double s, double l) [member function]
cls.add_method('GetValue',
'double',
@@ -2130,7 +2131,7 @@
module.add_function('TypeNameGet',
'std::string',
[],
- template_parameters=['long long'])
+ template_parameters=['long'])
## type-name.h: extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
@@ -2150,7 +2151,7 @@
module.add_function('TypeNameGet',
'std::string',
[],
- template_parameters=['unsigned long long'])
+ template_parameters=['unsigned long'])
## type-name.h: extern std::string ns3::TypeNameGet() [free function]
module.add_function('TypeNameGet',
'std::string',
--- a/bindings/python/ns3_module_internet_stack.py Sat Feb 28 16:25:24 2009 -0800
+++ b/bindings/python/ns3_module_internet_stack.py Tue Mar 10 23:47:55 2009 -0700
@@ -23,12 +23,6 @@
module.add_enum('Flags_t', ['NONE', 'FIN', 'SYN', 'RST', 'PSH', 'ACK', 'URG'], outer_class=root_module['ns3::TcpHeader'])
## udp-header.h: ns3::UdpHeader [class]
module.add_class('UdpHeader', parent=root_module['ns3::Header'])
- ## ipv4-interface.h: ns3::Ipv4Interface [class]
- module.add_class('Ipv4Interface', parent=root_module['ns3::Object'])
- ## ipv4-l3-protocol.h: ns3::Ipv4L3Protocol [class]
- module.add_class('Ipv4L3Protocol', parent=root_module['ns3::Object'])
- ## ipv4-static-routing.h: ns3::Ipv4StaticRouting [class]
- module.add_class('Ipv4StaticRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
## ipv4-global-routing.h: ns3::Ipv4GlobalRouting [class]
module.add_class('Ipv4GlobalRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
@@ -79,9 +73,6 @@
register_Ns3Icmpv4TimeExceeded_methods(root_module, root_module['ns3::Icmpv4TimeExceeded'])
register_Ns3TcpHeader_methods(root_module, root_module['ns3::TcpHeader'])
register_Ns3UdpHeader_methods(root_module, root_module['ns3::UdpHeader'])
- register_Ns3Ipv4Interface_methods(root_module, root_module['ns3::Ipv4Interface'])
- register_Ns3Ipv4L3Protocol_methods(root_module, root_module['ns3::Ipv4L3Protocol'])
- register_Ns3Ipv4StaticRouting_methods(root_module, root_module['ns3::Ipv4StaticRouting'])
register_Ns3Ipv4GlobalRouting_methods(root_module, root_module['ns3::Ipv4GlobalRouting'])
return
@@ -517,392 +508,6 @@
is_const=True)
return
-def register_Ns3Ipv4Interface_methods(root_module, cls):
- ## ipv4-interface.h: ns3::Ipv4Interface::Ipv4Interface(ns3::Ipv4Interface const & arg0) [copy constructor]
- cls.add_constructor([param('ns3::Ipv4Interface const &', 'arg0')])
- ## ipv4-interface.h: static ns3::TypeId ns3::Ipv4Interface::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## ipv4-interface.h: ns3::Ipv4Interface::Ipv4Interface() [constructor]
- cls.add_constructor([])
- ## ipv4-interface.h: ns3::Ptr<ns3::NetDevice> ns3::Ipv4Interface::GetDevice() const [member function]
- cls.add_method('GetDevice',
- 'ns3::Ptr< ns3::NetDevice >',
- [],
- is_pure_virtual=True, is_const=True, is_virtual=True)
- ## ipv4-interface.h: void ns3::Ipv4Interface::SetAddress(ns3::Ipv4Address a) [member function]
- cls.add_method('SetAddress',
- 'void',
- [param('ns3::Ipv4Address', 'a')])
- ## ipv4-interface.h: void ns3::Ipv4Interface::SetNetworkMask(ns3::Ipv4Mask mask) [member function]
- cls.add_method('SetNetworkMask',
- 'void',
- [param('ns3::Ipv4Mask', 'mask')])
- ## ipv4-interface.h: ns3::Ipv4Address ns3::Ipv4Interface::GetBroadcast() const [member function]
- cls.add_method('GetBroadcast',
- 'ns3::Ipv4Address',
- [],
- is_const=True)
- ## ipv4-interface.h: ns3::Ipv4Mask ns3::Ipv4Interface::GetNetworkMask() const [member function]
- cls.add_method('GetNetworkMask',
- 'ns3::Ipv4Mask',
- [],
- is_const=True)
- ## ipv4-interface.h: void ns3::Ipv4Interface::SetMetric(uint16_t metric) [member function]
- cls.add_method('SetMetric',
- 'void',
- [param('uint16_t', 'metric')])
- ## ipv4-interface.h: uint16_t ns3::Ipv4Interface::GetMetric() const [member function]
- cls.add_method('GetMetric',
- 'uint16_t',
- [],
- is_const=True)
- ## ipv4-interface.h: ns3::Ipv4Address ns3::Ipv4Interface::GetAddress() const [member function]
- cls.add_method('GetAddress',
- 'ns3::Ipv4Address',
- [],
- is_const=True)
- ## ipv4-interface.h: uint16_t ns3::Ipv4Interface::GetMtu() const [member function]
- cls.add_method('GetMtu',
- 'uint16_t',
- [],
- is_const=True)
- ## ipv4-interface.h: bool ns3::Ipv4Interface::IsUp() const [member function]
- cls.add_method('IsUp',
- 'bool',
- [],
- is_const=True)
- ## ipv4-interface.h: bool ns3::Ipv4Interface::IsDown() const [member function]
- cls.add_method('IsDown',
- 'bool',
- [],
- is_const=True)
- ## ipv4-interface.h: void ns3::Ipv4Interface::SetUp() [member function]
- cls.add_method('SetUp',
- 'void',
- [])
- ## ipv4-interface.h: void ns3::Ipv4Interface::SetDown() [member function]
- cls.add_method('SetDown',
- 'void',
- [])
- ## ipv4-interface.h: void ns3::Ipv4Interface::Send(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Address dest) [member function]
- cls.add_method('Send',
- 'void',
- [param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Address', 'dest')])
- ## ipv4-interface.h: void ns3::Ipv4Interface::DoDispose() [member function]
- cls.add_method('DoDispose',
- 'void',
- [],
- visibility='protected', is_virtual=True)
- ## ipv4-interface.h: void ns3::Ipv4Interface::SendTo(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Address dest) [member function]
- cls.add_method('SendTo',
- 'void',
- [param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Address', 'dest')],
- is_pure_virtual=True, visibility='private', is_virtual=True)
- return
-
-def register_Ns3Ipv4L3Protocol_methods(root_module, cls):
- ## ipv4-l3-protocol.h: ns3::Ipv4L3Protocol::PROT_NUMBER [variable]
- cls.add_static_attribute('PROT_NUMBER', 'uint16_t const', is_const=True)
- ## ipv4-l3-protocol.h: static ns3::TypeId ns3::Ipv4L3Protocol::GetTypeId() [member function]
- cls.add_method('GetTypeId',
- 'ns3::TypeId',
- [],
- is_static=True)
- ## ipv4-l3-protocol.h: ns3::Ipv4L3Protocol::Ipv4L3Protocol() [constructor]
- cls.add_constructor([])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetNode(ns3::Ptr<ns3::Node> node) [member function]
- cls.add_method('SetNode',
- 'void',
- [param('ns3::Ptr< ns3::Node >', 'node')])
- ## ipv4-l3-protocol.h: ns3::Ptr<ns3::Socket> ns3::Ipv4L3Protocol::CreateRawSocket() [member function]
- cls.add_method('CreateRawSocket',
- 'ns3::Ptr< ns3::Socket >',
- [])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::DeleteRawSocket(ns3::Ptr<ns3::Socket> socket) [member function]
- cls.add_method('DeleteRawSocket',
- 'void',
- [param('ns3::Ptr< ns3::Socket >', 'socket')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::Insert(ns3::Ptr<ns3::Ipv4L4Protocol> protocol) [member function]
- cls.add_method('Insert',
- 'void',
- [param('ns3::Ptr< ns3::Ipv4L4Protocol >', 'protocol')])
- ## ipv4-l3-protocol.h: ns3::Ptr<ns3::Ipv4L4Protocol> ns3::Ipv4L3Protocol::GetProtocol(int protocolNumber) const [member function]
- cls.add_method('GetProtocol',
- 'ns3::Ptr< ns3::Ipv4L4Protocol >',
- [param('int', 'protocolNumber')],
- is_const=True)
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::Remove(ns3::Ptr<ns3::Ipv4L4Protocol> protocol) [member function]
- cls.add_method('Remove',
- 'void',
- [param('ns3::Ptr< ns3::Ipv4L4Protocol >', 'protocol')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetDefaultTtl(uint8_t ttl) [member function]
- cls.add_method('SetDefaultTtl',
- 'void',
- [param('uint8_t', 'ttl')])
- ## ipv4-l3-protocol.h: ns3::Ptr<ns3::Ipv4Interface> ns3::Ipv4L3Protocol::FindInterfaceForDevice(ns3::Ptr<const ns3::NetDevice> device) [member function]
- cls.add_method('FindInterfaceForDevice',
- 'ns3::Ptr< ns3::Ipv4Interface >',
- [param('ns3::Ptr< ns3::NetDevice const >', 'device')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::Receive(ns3::Ptr<ns3::NetDevice> device, ns3::Ptr<const ns3::Packet> p, uint16_t protocol, ns3::Address const & from, ns3::Address const & to, ns3::NetDevice::PacketType packetType) [member function]
- cls.add_method('Receive',
- 'void',
- [param('ns3::Ptr< ns3::NetDevice >', 'device'), param('ns3::Ptr< ns3::Packet const >', 'p'), param('uint16_t', 'protocol'), param('ns3::Address const &', 'from'), param('ns3::Address const &', 'to'), param('ns3::NetDevice::PacketType', 'packetType')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::Send(ns3::Ptr<ns3::Packet> packet, ns3::Ipv4Address source, ns3::Ipv4Address destination, uint8_t protocol) [member function]
- cls.add_method('Send',
- 'void',
- [param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'destination'), param('uint8_t', 'protocol')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
- cls.add_method('AddHostRouteTo',
- 'void',
- [param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
- cls.add_method('AddHostRouteTo',
- 'void',
- [param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
- cls.add_method('AddNetworkRouteTo',
- 'void',
- [param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
- cls.add_method('AddNetworkRouteTo',
- 'void',
- [param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
- cls.add_method('SetDefaultRoute',
- 'void',
- [param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::Lookup(ns3::Ipv4Header const & ipHeader, ns3::Ptr<ns3::Packet> packet, ns3::Callback<void,bool,const ns3::Ipv4Route&,ns3::Ptr<ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> routeReply) [member function]
- cls.add_method('Lookup',
- 'void',
- [param('ns3::Ipv4Header const &', 'ipHeader'), param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Callback< void, bool, ns3::Ipv4Route const &, ns3::Ptr< ns3::Packet >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'routeReply')])
- ## ipv4-l3-protocol.h: uint32_t ns3::Ipv4L3Protocol::GetNRoutes() [member function]
- cls.add_method('GetNRoutes',
- 'uint32_t',
- [])
- ## ipv4-l3-protocol.h: ns3::Ipv4Route * ns3::Ipv4L3Protocol::GetRoute(uint32_t i) [member function]
- cls.add_method('GetRoute',
- 'ns3::Ipv4Route *',
- [param('uint32_t', 'i')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::RemoveRoute(uint32_t i) [member function]
- cls.add_method('RemoveRoute',
- 'void',
- [param('uint32_t', 'i')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::AddMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface, std::vector<unsigned int, std::allocator<unsigned int> > outputInterfaces) [member function]
- cls.add_method('AddMulticastRoute',
- 'void',
- [param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface'), param('std::vector< unsigned int >', 'outputInterfaces')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetDefaultMulticastRoute(uint32_t onputInterface) [member function]
- cls.add_method('SetDefaultMulticastRoute',
- 'void',
- [param('uint32_t', 'onputInterface')])
- ## ipv4-l3-protocol.h: uint32_t ns3::Ipv4L3Protocol::GetNMulticastRoutes() const [member function]
- cls.add_method('GetNMulticastRoutes',
- 'uint32_t',
- [],
- is_const=True)
- ## ipv4-l3-protocol.h: ns3::Ipv4MulticastRoute * ns3::Ipv4L3Protocol::GetMulticastRoute(uint32_t i) const [member function]
- cls.add_method('GetMulticastRoute',
- 'ns3::Ipv4MulticastRoute *',
- [param('uint32_t', 'i')],
- is_const=True)
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::RemoveMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface) [member function]
- cls.add_method('RemoveMulticastRoute',
- 'void',
- [param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::RemoveMulticastRoute(uint32_t i) [member function]
- cls.add_method('RemoveMulticastRoute',
- 'void',
- [param('uint32_t', 'i')])
- ## ipv4-l3-protocol.h: uint32_t ns3::Ipv4L3Protocol::AddInterface(ns3::Ptr<ns3::NetDevice> device) [member function]
- cls.add_method('AddInterface',
- 'uint32_t',
- [param('ns3::Ptr< ns3::NetDevice >', 'device')])
- ## ipv4-l3-protocol.h: ns3::Ptr<ns3::Ipv4Interface> ns3::Ipv4L3Protocol::GetInterface(uint32_t i) const [member function]
- cls.add_method('GetInterface',
- 'ns3::Ptr< ns3::Ipv4Interface >',
- [param('uint32_t', 'i')],
- is_const=True)
- ## ipv4-l3-protocol.h: uint32_t ns3::Ipv4L3Protocol::GetNInterfaces() const [member function]
- cls.add_method('GetNInterfaces',
- 'uint32_t',
- [],
- is_const=True)
- ## ipv4-l3-protocol.h: uint32_t ns3::Ipv4L3Protocol::FindInterfaceForAddr(ns3::Ipv4Address addr) const [member function]
- cls.add_method('FindInterfaceForAddr',
- 'uint32_t',
- [param('ns3::Ipv4Address', 'addr')],
- is_const=True)
- ## ipv4-l3-protocol.h: uint32_t ns3::Ipv4L3Protocol::FindInterfaceForAddr(ns3::Ipv4Address addr, ns3::Ipv4Mask mask) const [member function]
- cls.add_method('FindInterfaceForAddr',
- 'uint32_t',
- [param('ns3::Ipv4Address', 'addr'), param('ns3::Ipv4Mask', 'mask')],
- is_const=True)
- ## ipv4-l3-protocol.h: int32_t ns3::Ipv4L3Protocol::FindInterfaceIndexForDevice(ns3::Ptr<ns3::NetDevice> device) const [member function]
- cls.add_method('FindInterfaceIndexForDevice',
- 'int32_t',
- [param('ns3::Ptr< ns3::NetDevice >', 'device')],
- is_const=True)
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::JoinMulticastGroup(ns3::Ipv4Address origin, ns3::Ipv4Address group) [member function]
- cls.add_method('JoinMulticastGroup',
- 'void',
- [param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::LeaveMulticastGroup(ns3::Ipv4Address origin, ns3::Ipv4Address group) [member function]
- cls.add_method('LeaveMulticastGroup',
- 'void',
- [param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetAddress(uint32_t i, ns3::Ipv4Address address) [member function]
- cls.add_method('SetAddress',
- 'void',
- [param('uint32_t', 'i'), param('ns3::Ipv4Address', 'address')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetNetworkMask(uint32_t i, ns3::Ipv4Mask mask) [member function]
- cls.add_method('SetNetworkMask',
- 'void',
- [param('uint32_t', 'i'), param('ns3::Ipv4Mask', 'mask')])
- ## ipv4-l3-protocol.h: ns3::Ipv4Mask ns3::Ipv4L3Protocol::GetNetworkMask(uint32_t t) const [member function]
- cls.add_method('GetNetworkMask',
- 'ns3::Ipv4Mask',
- [param('uint32_t', 't')],
- is_const=True)
- ## ipv4-l3-protocol.h: ns3::Ipv4Address ns3::Ipv4L3Protocol::GetAddress(uint32_t i) const [member function]
- cls.add_method('GetAddress',
- 'ns3::Ipv4Address',
- [param('uint32_t', 'i')],
- is_const=True)
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetMetric(uint32_t i, uint16_t metric) [member function]
- cls.add_method('SetMetric',
- 'void',
- [param('uint32_t', 'i'), param('uint16_t', 'metric')])
- ## ipv4-l3-protocol.h: uint16_t ns3::Ipv4L3Protocol::GetMetric(uint32_t i) const [member function]
- cls.add_method('GetMetric',
- 'uint16_t',
- [param('uint32_t', 'i')],
- is_const=True)
- ## ipv4-l3-protocol.h: bool ns3::Ipv4L3Protocol::GetIfIndexForDestination(ns3::Ipv4Address destination, uint32_t & ifIndex) const [member function]
- cls.add_method('GetIfIndexForDestination',
- 'bool',
- [param('ns3::Ipv4Address', 'destination'), param('uint32_t &', 'ifIndex')],
- is_const=True)
- ## ipv4-l3-protocol.h: uint16_t ns3::Ipv4L3Protocol::GetMtu(uint32_t i) const [member function]
- cls.add_method('GetMtu',
- 'uint16_t',
- [param('uint32_t', 'i')],
- is_const=True)
- ## ipv4-l3-protocol.h: bool ns3::Ipv4L3Protocol::IsUp(uint32_t i) const [member function]
- cls.add_method('IsUp',
- 'bool',
- [param('uint32_t', 'i')],
- is_const=True)
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetUp(uint32_t i) [member function]
- cls.add_method('SetUp',
- 'void',
- [param('uint32_t', 'i')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetDown(uint32_t i) [member function]
- cls.add_method('SetDown',
- 'void',
- [param('uint32_t', 'i')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::AddRoutingProtocol(ns3::Ptr<ns3::Ipv4RoutingProtocol> routingProtocol, int priority) [member function]
- cls.add_method('AddRoutingProtocol',
- 'void',
- [param('ns3::Ptr< ns3::Ipv4RoutingProtocol >', 'routingProtocol'), param('int', 'priority')])
- ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::DoDispose() [member function]
- cls.add_method('DoDispose',
- 'void',
- [],
- visibility='protected', is_virtual=True)
- return
-
-def register_Ns3Ipv4StaticRouting_methods(root_module, cls):
- ## ipv4-static-routing.h: ns3::Ipv4StaticRouting::Ipv4StaticRouting(ns3::Ipv4StaticRouting const & arg0) [copy constructor]
- cls.add_constructor([param('ns3::Ipv4StaticRouting const &', 'arg0')])
- ## ipv4-static-routing.h: ns3::Ipv4StaticRouting::Ipv4StaticRouting() [constructor]
- cls.add_constructor([])
- ## ipv4-static-routing.h: bool ns3::Ipv4StaticRouting::RequestRoute(uint32_t ifIndex, ns3::Ipv4Header const & ipHeader, ns3::Ptr<ns3::Packet> packet, ns3::Callback<void,bool,const ns3::Ipv4Route&,ns3::Ptr<ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> routeReply) [member function]
- cls.add_method('RequestRoute',
- 'bool',
- [param('uint32_t', 'ifIndex'), param('ns3::Ipv4Header const &', 'ipHeader'), param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Callback< void, bool, ns3::Ipv4Route const &, ns3::Ptr< ns3::Packet >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'routeReply')],
- is_virtual=True)
- ## ipv4-static-routing.h: bool ns3::Ipv4StaticRouting::RequestIfIndex(ns3::Ipv4Address destination, uint32_t & ifIndex) [member function]
- cls.add_method('RequestIfIndex',
- 'bool',
- [param('ns3::Ipv4Address', 'destination'), param('uint32_t &', 'ifIndex')],
- is_virtual=True)
- ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
- cls.add_method('AddHostRouteTo',
- 'void',
- [param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
- ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
- cls.add_method('AddHostRouteTo',
- 'void',
- [param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')])
- ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
- cls.add_method('AddNetworkRouteTo',
- 'void',
- [param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
- ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
- cls.add_method('AddNetworkRouteTo',
- 'void',
- [param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')])
- ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::SetDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
- cls.add_method('SetDefaultRoute',
- 'void',
- [param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
- ## ipv4-static-routing.h: uint32_t ns3::Ipv4StaticRouting::GetNRoutes() [member function]
- cls.add_method('GetNRoutes',
- 'uint32_t',
- [])
- ## ipv4-static-routing.h: ns3::Ipv4Route * ns3::Ipv4StaticRouting::GetDefaultRoute() [member function]
- cls.add_method('GetDefaultRoute',
- 'ns3::Ipv4Route *',
- [])
- ## ipv4-static-routing.h: ns3::Ipv4Route * ns3::Ipv4StaticRouting::GetRoute(uint32_t i) [member function]
- cls.add_method('GetRoute',
- 'ns3::Ipv4Route *',
- [param('uint32_t', 'i')])
- ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::RemoveRoute(uint32_t i) [member function]
- cls.add_method('RemoveRoute',
- 'void',
- [param('uint32_t', 'i')])
- ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface, std::vector<unsigned int, std::allocator<unsigned int> > outputInterfaces) [member function]
- cls.add_method('AddMulticastRoute',
- 'void',
- [param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface'), param('std::vector< unsigned int >', 'outputInterfaces')])
- ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::SetDefaultMulticastRoute(uint32_t outputInterface) [member function]
- cls.add_method('SetDefaultMulticastRoute',
- 'void',
- [param('uint32_t', 'outputInterface')])
- ## ipv4-static-routing.h: uint32_t ns3::Ipv4StaticRouting::GetNMulticastRoutes() const [member function]
- cls.add_method('GetNMulticastRoutes',
- 'uint32_t',
- [],
- is_const=True)
- ## ipv4-static-routing.h: ns3::Ipv4MulticastRoute * ns3::Ipv4StaticRouting::GetMulticastRoute(uint32_t i) const [member function]
- cls.add_method('GetMulticastRoute',
- 'ns3::Ipv4MulticastRoute *',
- [param('uint32_t', 'i')],
- is_const=True)
- ## ipv4-static-routing.h: ns3::Ipv4MulticastRoute * ns3::Ipv4StaticRouting::GetDefaultMulticastRoute() const [member function]
- cls.add_method('GetDefaultMulticastRoute',
- 'ns3::Ipv4MulticastRoute *',
- [],
- is_const=True)
- ## ipv4-static-routing.h: bool ns3::Ipv4StaticRouting::RemoveMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface) [member function]
- cls.add_method('RemoveMulticastRoute',
- 'bool',
- [param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface')])
- ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::RemoveMulticastRoute(uint32_t index) [member function]
- cls.add_method('RemoveMulticastRoute',
- 'void',
- [param('uint32_t', 'index')])
- ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::DoDispose() [member function]
- cls.add_method('DoDispose',
- 'void',
- [],
- visibility='protected', is_virtual=True)
- return
-
def register_Ns3Ipv4GlobalRouting_methods(root_module, cls):
## ipv4-global-routing.h: ns3::Ipv4GlobalRouting::Ipv4GlobalRouting(ns3::Ipv4GlobalRouting const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4GlobalRouting const &', 'arg0')])
--- a/bindings/python/wscript Sat Feb 28 16:25:24 2009 -0800
+++ b/bindings/python/wscript Tue Mar 10 23:47:55 2009 -0700
@@ -15,7 +15,7 @@
import Utils
## https://launchpad.net/pybindgen/
-REQUIRED_PYBINDGEN_VERSION = (0, 10, 0, 626)
+REQUIRED_PYBINDGEN_VERSION = (0, 10, 0, 630)
REQUIRED_PYGCCXML_VERSION = (0, 9, 5)
@@ -70,6 +70,11 @@
conf.report_optional_feature("python", "Python Bindings", False, str(ex))
return
+ # -fvisibility=hidden optimization
+ if conf.env['CXX_NAME'] == 'gcc' and conf.check_compilation_flag('-fvisibility=hidden'):
+ conf.env.append_value('CXXFLAGS_PYEXT', '-fvisibility=hidden')
+ conf.env.append_value('CCFLAGS_PYEXT', '-fvisibility=hidden')
+
# Check for the location of pybindgen
if Options.options.with_pybindgen is not None:
if os.path.isdir(Options.options.with_pybindgen):
--- a/doc/manual/random.texi Sat Feb 28 16:25:24 2009 -0800
+++ b/doc/manual/random.texi Tue Mar 10 23:47:55 2009 -0700
@@ -12,10 +12,19 @@
ns-3 random numbers are provided via instances of @code{class RandomVariable}.
@itemize @bullet
-@item @strong{by default, ns-3 simulations use a random seed}; if there is any
-randomness in the simulation, each run of the program will yield different results. To use a fixed seed, users must call
-@code{RandomVariable::UseGlobalSeed ()} at the beginning of the program;
-see section @xref{Seeding and independent replications}
+@item @strong{by default, ns-3 simulations use a fixed seed}; if there is any
+randomness in the simulation, each run of the program will yield identical
+results uniess the seed and/or run number is changed.
+@itemize @bullet
+@item @strong{in ns-3.3 and earlier, ns-3 simulations used a random seed by
+default; this marks a change in policy starting with ns-3.4}
+@end itemize
+@item to obtain randomness across multiple simulation runs, you must either
+set the seed differently or set the run number differently. To set a seed, call
+@code{SeedManager::SetSeed(uint32_t)} at the beginning of the program;
+to set a run number with the same seed, call
+@code{SeedManager::SetRun (uint32_t)} at the beginning of the program;
+@xref{Seeding and independent replications}
@item each RandomVariable used in ns-3 has a virtual random number
generator associated with it; all random variables use either a fixed
or random seed based on the use of the global seed (previous bullet);
@@ -100,27 +109,24 @@
a fixed, deterministic seed with the same run number, it should give
the same output each time it is run.
-By default, ns-3 simulations use random seeds where the seeding
-is drawn from @code{/dev/random} (if it is available) or else from
-the time of day. A user who wants to fix the initial seeding
-of the PRNG must call the following static method during simulation
-configuration:
-@verbatim
-RandomVariable::UseGlobalSeed (uint32_t s0, s1, s2, s3, s4, s5);
-@end verbatim
-where the six parameters are each of type uint32_t.
+By default, ns-3 simulations use a fixed seed and run number.
+These values are stored in two @code{ns3::GlobalValue} instances:
+@code{g_rngSeed} and @code{g_rngRun}.
A typical use case is to run a simulation as a sequence of independent
trials, so as to compute statistics on a large number of independent
runs. The user can either change the global seed and rerun the
-simulation, or can advance the substream state of the RNG.
+simulation, or can advance the substream state of the RNG, which is
+referred to as incrementing the run number.
+
+A class @code{ns3::SeedManager ()} provides an API to control
+the seeding and run number behavior.
This seeding and substream state setting must be called before any
random variables are created; e.g.
@verbatim
- RandomVariable::UseGlobalSeed(1,2,3,4,5,6);
- int N = atol(argv[1]); //read in run number from command line
- RandomVariable::SetRunNumber(N);
+ SeedManager::SetSeed (3); // Changes seed from default of 1 to 3
+ SeedManager::SetRun (7); // Changes run number from default of 1 to 7
// Now, create random variables
UniformVariable x(0,10);
ExponentialVariable y(2902);
@@ -135,12 +141,29 @@
@strong{Therefore, use the substream capability to produce
multiple independent runs of the same simulation.}
In other words, the more statistically rigorous way to configure
-multiple independent replications is not to simply ignore the
-seeding (and use /dev/random to seed the generator each time) but
-instead to use a fixed seed and to iterate the run number.
-This implementation allows for a maximum of
+multiple independent replications is to use a fixed seed and to
+advance the run number. This implementation allows for a maximum of
2.3x10^15 independent replications using the substreams.
+For ease of use, it is not necessary to control the seed and run number
+from within the program; the user can set the
+@code{NS_GLOBAL_VALUE} environment variable as follows:
+@verbatim
+ NS_GLOBAL_VALUE="RngRun=3" ./waf --run program-name
+@end verbatim
+
+Another way to control this is by passing a command-line argument; since
+this is an ns3 GlobalValue instance, it is equivalently done such as follows:
+@verbatim
+ ./waf --command-template="%s --RngRun=3" --run program-name
+@end verbatim
+or, if you are running programs directly outside of waf:
+@verbatim
+ ./build/optimized/scratch/program-name --RngRun=3
+@end verbatim
+The above command-line variants make it easy to run lots of different
+runs from a shell script by just passing a different RngRun index.
+
@node class RandomVariable
@section class RandomVariable
--- a/examples/csma-bridge-one-hop.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/csma-bridge-one-hop.cc Tue Mar 10 23:47:55 2009 -0700
@@ -225,11 +225,11 @@
//
// Also configure some tcpdump traces; each interface will be traced.
// The output files will be named:
- // csma-bridge.pcap-<nodeId>-<interfaceId>
+ // csma-bridge-<nodeId>-<interfaceId>.pcap
// and can be read by the "tcpdump -r" command (use "-tt" option to
// display timestamps correctly)
//
- CsmaHelper::EnablePcapAll ("csma-bridge-one-hop");
+ CsmaHelper::EnablePcapAll ("csma-bridge-one-hop", false);
//
// Now, do the actual simulation.
--- a/examples/csma-bridge.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/csma-bridge.cc Tue Mar 10 23:47:55 2009 -0700
@@ -150,11 +150,11 @@
//
// Also configure some tcpdump traces; each interface will be traced.
// The output files will be named:
- // csma-bridge.pcap-<nodeId>-<interfaceId>
+ // csma-bridge-<nodeId>-<interfaceId>.pcap
// and can be read by the "tcpdump -r" command (use "-tt" option to
// display timestamps correctly)
//
- CsmaHelper::EnablePcapAll ("csma-bridge");
+ CsmaHelper::EnablePcapAll ("csma-bridge", false);
//
// Now, do the actual simulation.
--- a/examples/csma-broadcast.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/csma-broadcast.cc Tue Mar 10 23:47:55 2009 -0700
@@ -107,9 +107,9 @@
// Also configure some tcpdump traces; each interface will be traced
// The output files will be named
- // csma-broadcast.pcap-<nodeId>-<interfaceId>
+ // csma-broadcast-<nodeId>-<interfaceId>.pcap
// and can be read by the "tcpdump -tt -r" command
- CsmaHelper::EnablePcapAll ("csma-broadcast");
+ CsmaHelper::EnablePcapAll ("csma-broadcast", false);
std::ofstream ascii;
ascii.open ("csma-broadcast.tr");
CsmaHelper::EnableAsciiAll (ascii);
--- a/examples/csma-multicast.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/csma-multicast.cc Tue Mar 10 23:47:55 2009 -0700
@@ -171,10 +171,10 @@
// Also configure some tcpdump traces; each interface will be traced.
// The output files will be named:
- // csma-multicast.pcap-<nodeId>-<interfaceId>
+ // csma-multicast-<nodeId>-<interfaceId>.pcap
// and can be read by the "tcpdump -r" command (use "-tt" option to
// display timestamps correctly)
- CsmaHelper::EnablePcapAll ("csma-multicast");
+ CsmaHelper::EnablePcapAll ("csma-multicast", false);
//
// Now, do the actual simulation.
//
--- a/examples/csma-one-subnet.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/csma-one-subnet.cc Tue Mar 10 23:47:55 2009 -0700
@@ -125,11 +125,11 @@
//
// Also configure some tcpdump traces; each interface will be traced.
// The output files will be named:
-// csma-one-subnet.pcap-<nodeId>-<interfaceId>
+// csma-one-subnet-<nodeId>-<interfaceId>.pcap
// and can be read by the "tcpdump -r" command (use "-tt" option to
// display timestamps correctly)
//
- CsmaHelper::EnablePcapAll ("csma-one-subnet");
+ CsmaHelper::EnablePcapAll ("csma-one-subnet", false);
//
// Now, do the actual simulation.
//
--- a/examples/csma-ping.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/csma-ping.cc Tue Mar 10 23:47:55 2009 -0700
@@ -117,8 +117,9 @@
apps.Stop (Seconds (5.0));
NS_LOG_INFO ("Configure Tracing.");
- // first, pcap tracing.
- csma.EnablePcapAll ("csma-ping");
+ // first, pcap tracing in non-promiscuous mode
+ csma.EnablePcapAll ("csma-ping", false);
+
// then, print what the packet sink receives.
Config::ConnectWithoutContext ("/NodeList/3/ApplicationList/0/$ns3::PacketSink/Rx",
MakeCallback (&SinkRx));
--- a/examples/csma-raw-ip-socket.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/csma-raw-ip-socket.cc Tue Mar 10 23:47:55 2009 -0700
@@ -101,8 +101,8 @@
apps.Stop (Seconds (11.0));
NS_LOG_INFO ("Configure Tracing.");
- // first, pcap tracing.
- csma.EnablePcapAll ("csma-raw-ip-socket");
+ // first, pcap tracing in non-promiscuous mode
+ csma.EnablePcapAll ("csma-raw-ip-socket", false);
// then, print what the packet sink receives.
Config::ConnectWithoutContext ("/NodeList/3/ApplicationList/0/$ns3::PacketSink/Rx",
MakeCallback (&SinkRx));
--- a/examples/csma-star.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/csma-star.cc Tue Mar 10 23:47:55 2009 -0700
@@ -202,7 +202,7 @@
//
// Do pcap tracing on all devices on all nodes.
//
- CsmaHelper::EnablePcapAll ("csma-star");
+ CsmaHelper::EnablePcapAll ("csma-star", false);
NS_LOG_INFO ("Run Simulation.");
Simulator::Run ();
--- a/examples/dynamic-global-routing.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/dynamic-global-routing.cc Tue Mar 10 23:47:55 2009 -0700
@@ -193,7 +193,7 @@
ascii.open ("dynamic-global-routing.tr");
PointToPointHelper::EnablePcapAll ("dynamic-global-routing");
PointToPointHelper::EnableAsciiAll (ascii);
- CsmaHelper::EnablePcapAll ("dynamic-global-routing");
+ CsmaHelper::EnablePcapAll ("dynamic-global-routing", false);
CsmaHelper::EnableAsciiAll (ascii);
InternetStackHelper::EnableAsciiAll (ascii);
--- a/examples/emu-udp-echo.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/emu-udp-echo.cc Tue Mar 10 23:47:55 2009 -0700
@@ -145,7 +145,7 @@
std::ofstream ascii;
ascii.open ("emu-udp-echo.tr");
- EmuHelper::EnablePcapAll ("emu-udp-echo");
+ EmuHelper::EnablePcapAll ("emu-udp-echo", true);
//
// Now, do the actual simulation.
--- a/examples/mixed-global-routing.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/mixed-global-routing.cc Tue Mar 10 23:47:55 2009 -0700
@@ -125,7 +125,7 @@
ascii.open ("mixed-global-routing.tr");
PointToPointHelper::EnablePcapAll ("mixed-global-routing");
PointToPointHelper::EnableAsciiAll (ascii);
- CsmaHelper::EnablePcapAll ("mixed-global-routing");
+ CsmaHelper::EnablePcapAll ("mixed-global-routing", false);
CsmaHelper::EnableAsciiAll (ascii);
--- a/examples/mixed-wireless.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/mixed-wireless.cc Tue Mar 10 23:47:55 2009 -0700
@@ -388,7 +388,8 @@
InternetStackHelper::EnableAsciiAll (ascii);
// Let's do a pcap trace on the application source and sink, ifIndex 0
- CsmaHelper::EnablePcap ("mixed-wireless", appSource->GetId (), 0);
+ // Csma captures in non-promiscuous mode
+ CsmaHelper::EnablePcap ("mixed-wireless", appSource->GetId (), 0, false);
YansWifiPhyHelper::EnablePcap ("mixed-wireless", appSink->GetId (), 0);
YansWifiPhyHelper::EnablePcap ("mixed-wireless", 9, 2);
YansWifiPhyHelper::EnablePcap ("mixed-wireless", 9, 0);
--- a/examples/realtime-udp-echo.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/realtime-udp-echo.cc Tue Mar 10 23:47:55 2009 -0700
@@ -107,7 +107,7 @@
std::ofstream ascii;
ascii.open ("realtime-udp-echo.tr");
- CsmaHelper::EnablePcapAll ("realtime-udp-echo");
+ CsmaHelper::EnablePcapAll ("realtime-udp-echo", false);
CsmaHelper::EnableAsciiAll (ascii);
//
--- a/examples/second.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/second.cc Tue Mar 10 23:47:55 2009 -0700
@@ -102,8 +102,8 @@
GlobalRouteManager::PopulateRoutingTables ();
- PointToPointHelper::EnablePcapAll ("second");
- CsmaHelper::EnablePcapAll ("second");
+ PointToPointHelper::EnablePcap ("second", p2pDevices.Get (1));
+ CsmaHelper::EnablePcap ("second", csmaDevices.Get (0), true);
Simulator::Run ();
Simulator::Destroy ();
--- a/examples/star.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/star.cc Tue Mar 10 23:47:55 2009 -0700
@@ -136,7 +136,7 @@
NS_LOG_INFO ("Enable pcap tracing.");
//
- // Do pcap tracing on all devices on all nodes.
+ // Do pcap tracing on all point-to-point devices on all nodes.
//
PointToPointHelper::EnablePcapAll ("star");
--- a/examples/tap-wifi-dumbbell.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/tap-wifi-dumbbell.cc Tue Mar 10 23:47:55 2009 -0700
@@ -199,7 +199,7 @@
apps = sink.Install (nodesRight.Get (0));
apps.Start (Seconds (1.0));
- CsmaHelper::EnablePcapAll ("tap-dumbbell");
+ CsmaHelper::EnablePcapAll ("tap-dumbbell", false);
GlobalRouteManager::PopulateRoutingTables ();
Simulator::Stop (Seconds (60.));
--- a/examples/tcp-large-transfer.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/tcp-large-transfer.cc Tue Mar 10 23:47:55 2009 -0700
@@ -155,7 +155,6 @@
std::ofstream ascii;
ascii.open ("tcp-large-transfer.tr");
PointToPointHelper::EnableAsciiAll (ascii);
-
PointToPointHelper::EnablePcapAll ("tcp-large-transfer");
// Finally, set up the simulator to run. The 1000 second hard limit is a
--- a/examples/tcp-nsc-zoo.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/tcp-nsc-zoo.cc Tue Mar 10 23:47:55 2009 -0700
@@ -136,7 +136,7 @@
}
}
- CsmaHelper::EnablePcapAll ("tcp-nsc-zoo");
+ CsmaHelper::EnablePcapAll ("tcp-nsc-zoo", false);
Simulator::Stop (Seconds(100));
Simulator::Run ();
--- a/examples/third.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/third.cc Tue Mar 10 23:47:55 2009 -0700
@@ -120,7 +120,7 @@
"Bounds", RectangleValue (Rectangle (-50, 50, -50, 50)));
mobility.Install (wifiStaNodes);
- mobility.SetMobilityModel ("ns3::StaticMobilityModel");
+ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (wifiApNode);
InternetStackHelper stack;
@@ -162,10 +162,9 @@
Simulator::Stop (Seconds (10.0));
- YansWifiPhyHelper::EnablePcap ("third",
- wifiStaNodes.Get (nWifi - 1)->GetId (), 0);
- CsmaHelper::EnablePcap ("third",
- csmaNodes.Get (nCsma)->GetId (), 0);
+ PointToPointHelper::EnablePcap ("third", p2pDevices.Get (0));
+ YansWifiPhyHelper::EnablePcap ("third", apDevices.Get (0));
+ CsmaHelper::EnablePcap ("third", csmaDevices.Get (0), true);
Simulator::Run ();
Simulator::Destroy ();
--- a/examples/udp-echo.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/udp-echo.cc Tue Mar 10 23:47:55 2009 -0700
@@ -127,7 +127,7 @@
std::ofstream ascii;
ascii.open ("udp-echo.tr");
- CsmaHelper::EnablePcapAll ("udp-echo");
+ CsmaHelper::EnablePcapAll ("udp-echo", false);
CsmaHelper::EnableAsciiAll (ascii);
//
--- a/examples/wifi-adhoc.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/wifi-adhoc.cc Tue Mar 10 23:47:55 2009 -0700
@@ -128,7 +128,7 @@
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
positionAlloc->Add (Vector (5.0, 0.0, 0.0));
mobility.SetPositionAllocator (positionAlloc);
- mobility.SetMobilityModel ("ns3::StaticMobilityModel");
+ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (c);
--- a/examples/wifi-wired-bridging.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/examples/wifi-wired-bridging.cc Tue Mar 10 23:47:55 2009 -0700
@@ -119,7 +119,7 @@
// setup the AP.
- mobility.SetMobilityModel ("ns3::StaticMobilityModel");
+ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (backboneNodes.Get (i));
wifi.SetMac ("ns3::NqapWifiMac",
"Ssid", SsidValue (ssid),
@@ -183,11 +183,9 @@
apps.Start (Seconds (0.5));
apps.Stop (Seconds (3.0));
- WifiHelper::EnablePcap ("wifi-wired-bridging", staNodes[1].Get (1));
- WifiHelper::EnablePcap ("wifi-wired-bridging", staNodes[0].Get (0));
+ YansWifiPhyHelper::EnablePcap ("wifi-wired-bridging", apDevices[0]);
+ YansWifiPhyHelper::EnablePcap ("wifi-wired-bridging", apDevices[1]);
- YansWifiPhyHelper::EnablePcap ("wifi-wired-bridging-promisc", staNodes[1].Get (1));
- YansWifiPhyHelper::EnablePcap ("wifi-wired-bridging-promisc", staNodes[0].Get (0));
std::ofstream os;
os.open ("wifi-wired-bridging.mob");
MobilityHelper::EnableAsciiAll (os);
--- a/samples/main-grid-topology.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/samples/main-grid-topology.cc Tue Mar 10 23:47:55 2009 -0700
@@ -32,7 +32,7 @@
// each object will be attached a static position.
// i.e., once set by the "position allocator", the
// position will never change.
- mobility.SetMobilityModel ("ns3::StaticMobilityModel");
+ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
// finalize the setup by attaching to each object
// in the input array a position and initializing
--- a/samples/main-propagation-loss.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/samples/main-propagation-loss.cc Tue Mar 10 23:47:55 2009 -0700
@@ -18,7 +18,7 @@
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "ns3/propagation-loss-model.h"
-#include "ns3/static-mobility-model.h"
+#include "ns3/constant-position-mobility-model.h"
#include "ns3/config.h"
#include "ns3/string.h"
@@ -27,8 +27,8 @@
static void
PrintOne (double minTxpower, double maxTxpower, double stepTxpower, double min, double max, double step)
{
- Ptr<StaticMobilityModel> a = CreateObject<StaticMobilityModel> ();
- Ptr<StaticMobilityModel> b = CreateObject<StaticMobilityModel> ();
+ Ptr<ConstantPositionMobilityModel> a = CreateObject<ConstantPositionMobilityModel> ();
+ Ptr<ConstantPositionMobilityModel> b = CreateObject<ConstantPositionMobilityModel> ();
Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> ();
Ptr<PropagationLossModel> model = log;
--- a/samples/main-random-topology.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/samples/main-random-topology.cc Tue Mar 10 23:47:55 2009 -0700
@@ -29,7 +29,7 @@
"X", StringValue ("100.0"),
"Y", StringValue ("100.0"),
"Rho", StringValue ("Uniform:0:30"));
- mobility.SetMobilityModel ("ns3::StaticMobilityModel");
+ mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (c);
Config::Connect ("/NodeList/*/$ns3::MobilityModelNotifier/CourseChange",
--- a/src/core/attribute-list.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/core/attribute-list.cc Tue Mar 10 23:47:55 2009 -0700
@@ -208,50 +208,51 @@
std::string::size_type cur;
cur = 0;
- do {
- std::string::size_type equal = str.find ("=", cur);
- if (equal == std::string::npos)
- {
- NS_FATAL_ERROR ("Error while parsing serialized attribute: \"" << str << "\"");
- break;
- }
- else
- {
- std::string name = str.substr (cur, equal-cur);
- struct TypeId::AttributeInfo info;
- if (!TypeId::LookupAttributeByFullName (name, &info))
- {
- NS_FATAL_ERROR ("Error while parsing serialized attribute: name does not exist: \"" << name << "\"");
- break;
- }
- else
- {
- std::string::size_type next = str.find ("|", cur);
- std::string value;
- if (next == std::string::npos)
- {
- value = str.substr (equal+1, str.size () - (equal+1));
- cur = str.size ();
- }
- else
- {
- value = str.substr (equal+1, next - (equal+1));
- cur++;
- }
- Ptr<AttributeValue> val = info.checker->Create ();
- bool ok = val->DeserializeFromString (value, info.checker);
- if (!ok)
- {
- NS_FATAL_ERROR ("Error while parsing serialized attribute: value invalid: \"" << value << "\"");
- break;
- }
- else
- {
- DoSetOne (info.checker, *val);
- }
- }
- }
- } while (cur != str.size ());
+ while (cur != str.size ())
+ {
+ std::string::size_type equal = str.find ("=", cur);
+ if (equal == std::string::npos)
+ {
+ NS_FATAL_ERROR ("Error while parsing serialized attribute: \"" << str << "\"");
+ break;
+ }
+ else
+ {
+ std::string name = str.substr (cur, equal-cur);
+ struct TypeId::AttributeInfo info;
+ if (!TypeId::LookupAttributeByFullName (name, &info))
+ {
+ NS_FATAL_ERROR ("Error while parsing serialized attribute: name does not exist: \"" << name << "\"");
+ break;
+ }
+ else
+ {
+ std::string::size_type next = str.find ("|", cur);
+ std::string value;
+ if (next == std::string::npos)
+ {
+ value = str.substr (equal+1, str.size () - (equal+1));
+ cur = str.size ();
+ }
+ else
+ {
+ value = str.substr (equal+1, next - (equal+1));
+ cur++;
+ }
+ Ptr<AttributeValue> val = info.checker->Create ();
+ bool ok = val->DeserializeFromString (value, info.checker);
+ if (!ok)
+ {
+ NS_FATAL_ERROR ("Error while parsing serialized attribute: value invalid: \"" << value << "\"");
+ break;
+ }
+ else
+ {
+ DoSetOne (info.checker, *val);
+ }
+ }
+ }
+ }
return true;
}
--- a/src/core/random-variable.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/core/random-variable.cc Tue Mar 10 23:47:55 2009 -0700
@@ -274,6 +274,11 @@
return ((UniformVariableImpl*)Peek())->GetValue(s,l);
}
+uint32_t UniformVariable::GetInteger (uint32_t s, uint32_t l)
+{
+ NS_ASSERT(s <= l);
+ return static_cast<uint32_t>( GetValue(s, l+1) );
+}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
@@ -763,6 +768,10 @@
virtual double GetValue();
virtual RandomVariableBase* Copy(void) const;
+ double GetMean (void) const;
+ double GetVariance (void) const;
+ double GetBound (void) const;
+
private:
double m_mean; // Mean value of RV
double m_variance; // Mean value of RV
@@ -835,6 +844,24 @@
return new NormalVariableImpl(*this);
}
+double
+NormalVariableImpl::GetMean (void) const
+{
+ return m_mean;
+}
+
+double
+NormalVariableImpl::GetVariance (void) const
+{
+ return m_variance;
+}
+
+double
+NormalVariableImpl::GetBound (void) const
+{
+ return m_bound;
+}
+
NormalVariable::NormalVariable()
: RandomVariable (NormalVariableImpl ())
{}
@@ -1280,6 +1307,17 @@
os << "Uniform:" << uniform->GetMin () << ":" << uniform->GetMax ();
return os;
}
+ NormalVariableImpl *normal = dynamic_cast<NormalVariableImpl *> (base);
+ if (normal != 0)
+ {
+ os << "Normal:" << normal->GetMean () << ":" << normal->GetVariance ();
+ double bound = normal->GetBound ();
+ if (bound != NormalVariableImpl::INFINITE_VALUE)
+ {
+ os << ":" << bound;
+ }
+ return os;
+ }
// XXX: support other distributions
os.setstate (std::ios_base::badbit);
return os;
@@ -1325,6 +1363,44 @@
var = UniformVariable (a, b);
}
}
+ else if (type == "Normal")
+ {
+ if (value.size () == 0)
+ {
+ var = NormalVariable ();
+ }
+ else
+ {
+ tmp = value.find (":");
+ if (tmp == value.npos)
+ {
+ NS_FATAL_ERROR ("bad Normal value: " << value);
+ }
+ std::string::size_type tmp2;
+ std::string sub = value.substr (tmp + 1, value.npos);
+ tmp2 = sub.find (":");
+ if (tmp2 == value.npos)
+ {
+ istringstream issA (value.substr (0, tmp));
+ istringstream issB (sub);
+ double a, b;
+ issA >> a;
+ issB >> b;
+ var = NormalVariable (a, b);
+ }
+ else
+ {
+ istringstream issA (value.substr (0, tmp));
+ istringstream issB (sub.substr (0, tmp2));
+ istringstream issC (sub.substr (tmp2 + 1, value.npos));
+ double a, b, c;
+ issA >> a;
+ issB >> b;
+ issC >> c;
+ var = NormalVariable (a, b, c);
+ }
+ }
+ }
else
{
NS_FATAL_ERROR ("RandomVariable deserialization not implemented for " << type);
@@ -1396,10 +1472,24 @@
// Test attribute serialization
{
- RandomVariableValue val;
- val.DeserializeFromString ("Uniform:0.1:0.2", MakeRandomVariableChecker ());
- RandomVariable rng = val.Get ();
- NS_TEST_ASSERT_EQUAL (val.SerializeToString (MakeRandomVariableChecker ()), "Uniform:0.1:0.2");
+ {
+ RandomVariableValue val;
+ val.DeserializeFromString ("Uniform:0.1:0.2", MakeRandomVariableChecker ());
+ RandomVariable rng = val.Get ();
+ NS_TEST_ASSERT_EQUAL (val.SerializeToString (MakeRandomVariableChecker ()), "Uniform:0.1:0.2");
+ }
+ {
+ RandomVariableValue val;
+ val.DeserializeFromString ("Normal:0.1:0.2", MakeRandomVariableChecker ());
+ RandomVariable rng = val.Get ();
+ NS_TEST_ASSERT_EQUAL (val.SerializeToString (MakeRandomVariableChecker ()), "Normal:0.1:0.2");
+ }
+ {
+ RandomVariableValue val;
+ val.DeserializeFromString ("Normal:0.1:0.2:0.15", MakeRandomVariableChecker ());
+ RandomVariable rng = val.Get ();
+ NS_TEST_ASSERT_EQUAL (val.SerializeToString (MakeRandomVariableChecker ()), "Normal:0.1:0.2:0.15");
+ }
}
return result;
--- a/src/core/random-variable.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/core/random-variable.h Tue Mar 10 23:47:55 2009 -0700
@@ -53,12 +53,18 @@
* ExponentialVariable y(120); //as long as the seed stays the same
* \endcode
* \param seed
+ *
+ * Note, while the underlying RNG takes six integer values as a seed;
+ * it is sufficient to set these all to the same integer, so we provide
+ * a simpler interface here that just takes one integer.
*/
static void SetSeed (uint32_t seed);
/**
* \brief Get the seed value
* \return the seed value
+ *
+ * Note: returns the first of the six seed values used in the underlying RNG
*/
static uint32_t GetSeed ();
@@ -194,6 +200,13 @@
*/
double GetValue(double s, double l);
+ /**
+ * \brief Returns a random unsigned integer from the interval [s,l] including both ends.
+ * \param s Low end of the range
+ * \param l High end of the range
+ * \return A random unsigned integer value.
+ */
+ uint32_t GetInteger (uint32_t s, uint32_t l);
};
/**
--- a/src/core/type-id.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/core/type-id.h Tue Mar 10 23:47:55 2009 -0700
@@ -323,6 +323,15 @@
*/
Ptr<const TraceSourceAccessor> LookupTraceSourceByName (std::string name) const;
+
+ /**
+ * \param fullName the full name of the requested attribute
+ * \param info a pointer to the TypeId::AttributeInfo data structure
+ * where the result value of this method will be stored.
+ * \returns the Accessor associated to the requested attribute
+ */
+ static bool LookupAttributeByFullName (std::string fullName, struct AttributeInfo *info);
+
/**
* \returns the internal integer which uniquely identifies this
* TypeId.
@@ -354,14 +363,6 @@
friend bool operator < (TypeId a, TypeId b);
- /**
- * \param fullName the full name of the requested attribute
- * \param info a pointer to the TypeId::AttributeInfo data structure
- * where the result value of this method will be stored.
- * \returns the Accessor associated to the requested attribute
- */
- static bool LookupAttributeByFullName (std::string fullName, struct AttributeInfo *info);
-
explicit TypeId (uint16_t tid);
void DoAddConstructor (Callback<ObjectBase *> callback);
--- a/src/devices/csma/csma-net-device.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/csma/csma-net-device.cc Tue Mar 10 23:47:55 2009 -0700
@@ -101,32 +101,40 @@
.AddTraceSource ("MacRx",
"Trace source indicating a packet has been received by this device and is being forwarded up the stack",
MakeTraceSourceAccessor (&CsmaNetDevice::m_macRxTrace))
+#if 0
+ // Not currently implemented in this device
+ .AddTraceSource ("MacRxDrop",
+ "Trace source indicating a packet was received, but dropped before being forwarded up the stack",
+ MakeTraceSourceAccessor (&CsmaNetDevice::m_macRxDropTrace))
+#endif
+ .AddTraceSource ("MacTxBackoff",
+ "Trace source indicating a packet has been delayed by the CSMA backoff process",
+ MakeTraceSourceAccessor (&CsmaNetDevice::m_macTxBackoffTrace))
//
// Trace souces at the "bottom" of the net device, where packets transition
// to/from the channel.
//
- .AddTraceSource ("PhyTxStart",
+ .AddTraceSource ("PhyTxBegin",
"Trace source indicating a packet has begun transmitting over the channel",
- MakeTraceSourceAccessor (&CsmaNetDevice::m_phyTxStartTrace))
- .AddTraceSource ("PhyTx",
+ MakeTraceSourceAccessor (&CsmaNetDevice::m_phyTxBeginTrace))
+ .AddTraceSource ("PhyTxEnd",
"Trace source indicating a packet has been completely transmitted over the channel",
- MakeTraceSourceAccessor (&CsmaNetDevice::m_phyTxTrace))
+ MakeTraceSourceAccessor (&CsmaNetDevice::m_phyTxEndTrace))
.AddTraceSource ("PhyTxDrop",
"Trace source indicating a packet has been dropped by the device during transmission",
MakeTraceSourceAccessor (&CsmaNetDevice::m_phyTxDropTrace))
- .AddTraceSource ("PhyRxStart",
+#if 0
+ // Not currently implemented in this device
+ .AddTraceSource ("PhyRxBegin",
"Trace source indicating a packet has begun being received by the device",
- MakeTraceSourceAccessor (&CsmaNetDevice::m_phyRxStartTrace))
- .AddTraceSource ("PhyRx",
+ MakeTraceSourceAccessor (&CsmaNetDevice::m_phyRxBeginTrace))
+#endif
+ .AddTraceSource ("PhyRxEnd",
"Trace source indicating a packet has been completely received by the device",
- MakeTraceSourceAccessor (&CsmaNetDevice::m_phyRxTrace))
+ MakeTraceSourceAccessor (&CsmaNetDevice::m_phyRxEndTrace))
.AddTraceSource ("PhyRxDrop",
"Trace source indicating a packet has been dropped by the device during reception",
MakeTraceSourceAccessor (&CsmaNetDevice::m_phyRxDropTrace))
- .AddTraceSource ("PhyTxBackoff",
- "Trace source indicating a packet has been delayed by the CSMA backoff process",
- MakeTraceSourceAccessor (&CsmaNetDevice::m_phyTxBackoffTrace))
-
//
// Trace sources designed to simulate a packet sniffer facility (tcpdump).
//
@@ -513,7 +521,7 @@
}
else
{
- m_phyTxBackoffTrace (m_currentPkt);
+ m_macTxBackoffTrace (m_currentPkt);
m_backoff.IncrNumRetries ();
Time backoffTime = m_backoff.GetBackoffTime ();
@@ -543,7 +551,7 @@
//
m_backoff.ResetBackoffTime ();
m_txMachineState = BUSY;
- m_phyTxStartTrace (m_currentPkt);
+ m_phyTxBeginTrace (m_currentPkt);
Time tEvent = Seconds (m_bps.CalculateTxTime (m_currentPkt->GetSize ()));
NS_LOG_LOGIC ("Schedule TransmitCompleteEvent in " << tEvent.GetSeconds () << "sec");
@@ -620,7 +628,7 @@
NS_LOG_LOGIC ("Pkt UID is " << m_currentPkt->GetUid () << ")");
m_channel->TransmitEnd ();
- m_phyTxTrace (m_currentPkt);
+ m_phyTxEndTrace (m_currentPkt);
m_currentPkt = 0;
NS_LOG_LOGIC ("Schedule TransmitReadyEvent in " << m_tInterframeGap.GetSeconds () << "sec");
@@ -737,7 +745,7 @@
// Hit the trace hook. This trace will fire on all packets received from the
// channel except those originated by this device.
//
- m_phyRxTrace (packet);
+ m_phyRxEndTrace (packet);
//
// Only receive if the send side of net device is enabled
--- a/src/devices/csma/csma-net-device.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/csma/csma-net-device.h Tue Mar 10 23:47:55 2009 -0700
@@ -669,12 +669,30 @@
TracedCallback<Ptr<const Packet> > m_macRxTrace;
/**
- * The trace source fired when a packet starts the transmission process on
+ * The trace source fired for packets successfully received by the device
+ * but dropped before being forwarded up to higher layers (at the L2/L3
+ * transition).
+ *
+ * \see class CallBackTraceSource
+ */
+ TracedCallback<Ptr<const Packet> > m_macRxDropTrace;
+
+ /**
+ * The trace source fired when the mac layer is forced to begin the backoff
+ * process for a packet. This can happen a number of times as the backoff
+ * sequence is repeated with increasing delays.
+ *
+ * \see class CallBackTraceSource
+ */
+ TracedCallback<Ptr<const Packet> > m_macTxBackoffTrace;
+
+ /**
+ * The trace source fired when a packet begins the transmission process on
* the medium.
*
* \see class CallBackTraceSource
*/
- TracedCallback<Ptr<const Packet> > m_phyTxStartTrace;
+ TracedCallback<Ptr<const Packet> > m_phyTxBeginTrace;
/**
* The trace source fired when a packet ends the transmission process on
@@ -682,7 +700,7 @@
*
* \see class CallBackTraceSource
*/
- TracedCallback<Ptr<const Packet> > m_phyTxTrace;
+ TracedCallback<Ptr<const Packet> > m_phyTxEndTrace;
/**
* The trace source fired when the phy layer drops a packet as it tries
@@ -693,12 +711,12 @@
TracedCallback<Ptr<const Packet> > m_phyTxDropTrace;
/**
- * The trace source fired when a packet ends the reception process from
+ * The trace source fired when a packet begins the reception process from
* the medium.
*
* \see class CallBackTraceSource
*/
- TracedCallback<Ptr<const Packet> > m_phyRxTrace;
+ TracedCallback<Ptr<const Packet> > m_phyRxBeginTrace;
/**
* The trace source fired when a packet ends the reception process from
@@ -706,7 +724,7 @@
*
* \see class CallBackTraceSource
*/
- TracedCallback<Ptr<const Packet> > m_phyRxStartTrace;
+ TracedCallback<Ptr<const Packet> > m_phyRxEndTrace;
/**
* The trace source fired when the phy layer drops a packet it has received.
@@ -716,15 +734,6 @@
TracedCallback<Ptr<const Packet> > m_phyRxDropTrace;
/**
- * The trace source fired when the phy layer is forced to begin the backoff
- * process for a packet. This can happen a number of times as the backoff
- * sequence is repeated with increasing delays.
- *
- * \see class CallBackTraceSource
- */
- TracedCallback<Ptr<const Packet> > m_phyTxBackoffTrace;
-
- /**
* A trace source that emulates a non-promiscuous protocol sniffer connected
* to the device. Unlike your average everyday sniffer, this trace source
* will not fire on PACKET_OTHERHOST events.
--- a/src/devices/emu/emu-net-device.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/emu/emu-net-device.cc Tue Mar 10 23:47:55 2009 -0700
@@ -113,33 +113,40 @@
.AddTraceSource ("MacRx",
"Trace source indicating a packet has been received by this device and is being forwarded up the stack",
MakeTraceSourceAccessor (&EmuNetDevice::m_macRxTrace))
+#if 0
+ // Not currently implemented for this device
+ .AddTraceSource ("MacRxDrop",
+ "Trace source indicating a packet was dropped before being forwarded up the stack",
+ MakeTraceSourceAccessor (&EmuNetDevice::m_macRxDropTrace))
+#endif
//
// In normal ns-3 net devices, these trace souces correspond to the "bottom"
// of the net device, where packets transition to/from the channel. In
- // the case of the emu device, there is no physical layer access and so
- // these are duplicates of the MAC-level hooks. Intepret these points
- // also as the points at which a packet leaves the ns-3 environment
- // destined for the underlying operating system or vice-versa.
+ // the case of the emu device, there is no physical layer access -- all we
+ // do is to send packets to another device that is really at a "real" MAC
+ // level. Since it could be misleading to call anything here PHY, we do not
+ // implement these trace sources.
//
- .AddTraceSource ("PhyTxStart",
+#if 0
+ .AddTraceSource ("PhyTxBegin",
"Trace source indicating a packet has begun transmitting over the channel",
- MakeTraceSourceAccessor (&EmuNetDevice::m_phyTxStartTrace))
- .AddTraceSource ("PhyTx",
+ MakeTraceSourceAccessor (&EmuNetDevice::m_phyTxBeginTrace))
+ .AddTraceSource ("PhyTxEnd",
"Trace source indicating a packet has been completely transmitted over the channel",
- MakeTraceSourceAccessor (&EmuNetDevice::m_phyTxTrace))
+ MakeTraceSourceAccessor (&EmuNetDevice::m_phyTxEndTrace))
.AddTraceSource ("PhyTxDrop",
"Trace source indicating a packet has been dropped by the device during transmission",
MakeTraceSourceAccessor (&EmuNetDevice::m_phyTxDropTrace))
- .AddTraceSource ("PhyRxStart",
+ .AddTraceSource ("PhyRxBegin",
"Trace source indicating a packet has begun being received by the device",
- MakeTraceSourceAccessor (&EmuNetDevice::m_phyRxStartTrace))
- .AddTraceSource ("PhyRx",
+ MakeTraceSourceAccessor (&EmuNetDevice::m_phyRxBeginTrace))
+ .AddTraceSource ("PhyRxEnd",
"Trace source indicating a packet has been completely received by the device",
- MakeTraceSourceAccessor (&EmuNetDevice::m_phyRxTrace))
+ MakeTraceSourceAccessor (&EmuNetDevice::m_phyRxEndTrace))
.AddTraceSource ("PhyRxDrop",
"Trace source indicating a packet has been dropped by the device during reception",
MakeTraceSourceAccessor (&EmuNetDevice::m_phyRxDropTrace))
-
+#endif
//
// Trace sources designed to simulate a packet sniffer facility (tcpdump).
//
@@ -576,13 +583,6 @@
Ptr<Packet> originalPacket = packet->Copy ();
//
- // Hit the trace hook. This trace will fire on all packets received from the
- // OS (promiscuous). Packets are received instantaneously.
- //
- m_phyRxStartTrace (packet);
- m_phyRxTrace (packet);
-
- //
// Checksum the packet
//
EthernetTrailer trailer;
@@ -643,6 +643,7 @@
// make sure that nobody messes with our packet.
//
m_promiscSnifferTrace (originalPacket);
+
if (!m_promiscRxCallback.IsNull ())
{
m_promiscRxCallback (this, packet->Copy (), protocol, header.GetSource (), header.GetDestination (), packetType);
@@ -798,14 +799,10 @@
NS_LOG_LOGIC ("calling sendto");
- m_phyTxStartTrace (packet);
-
int32_t rc;
rc = sendto (m_sock, packet->PeekData (), packet->GetSize (), 0, reinterpret_cast<struct sockaddr *> (&ll), sizeof (ll));
NS_LOG_LOGIC ("sendto returns " << rc);
- m_phyTxTrace (packet);
-
return rc == -1 ? false : true;
}
--- a/src/devices/emu/emu-net-device.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/emu/emu-net-device.h Tue Mar 10 23:47:55 2009 -0700
@@ -289,12 +289,21 @@
TracedCallback<Ptr<const Packet> > m_macRxTrace;
/**
- * The trace source fired when a packet starts the transmission process on
+ * The trace source fired for packets successfully received by the device
+ * but which are dropped before being forwarded up to higher layers (at the
+ * L2/L3 transition).
+ *
+ * \see class CallBackTraceSource
+ */
+ TracedCallback<Ptr<const Packet> > m_macRxDropTrace;
+
+ /**
+ * The trace source fired when a packet begins the transmission process on
* the medium.
*
* \see class CallBackTraceSource
*/
- TracedCallback<Ptr<const Packet> > m_phyTxStartTrace;
+ TracedCallback<Ptr<const Packet> > m_phyTxBeginTrace;
/**
* The trace source fired when a packet ends the transmission process on
@@ -302,7 +311,7 @@
*
* \see class CallBackTraceSource
*/
- TracedCallback<Ptr<const Packet> > m_phyTxTrace;
+ TracedCallback<Ptr<const Packet> > m_phyTxEndTrace;
/**
* The trace source fired when the phy layer drops a packet as it tries
@@ -321,12 +330,20 @@
TracedCallback<Ptr<const Packet> > m_phyRxTrace;
/**
- * The trace source fired when a packet starts the reception process from
+ * The trace source fired when a packet begins the reception process from
* the medium.
*
* \see class CallBackTraceSource
*/
- TracedCallback<Ptr<const Packet> > m_phyRxStartTrace;
+ TracedCallback<Ptr<const Packet> > m_phyRxBeginTrace;
+
+ /**
+ * The trace source fired when a packet begins the reception process from
+ * the medium.
+ *
+ * \see class CallBackTraceSource
+ */
+ TracedCallback<Ptr<const Packet> > m_phyRxEndTrace;
/**
* The trace source fired when the phy layer drops a packet it has received.
--- a/src/devices/point-to-point/point-to-point-net-device.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/point-to-point/point-to-point-net-device.cc Tue Mar 10 23:47:55 2009 -0700
@@ -91,31 +91,42 @@
.AddTraceSource ("MacRx",
"Trace source indicating a packet has been received by this device and is being forwarded up the stack",
MakeTraceSourceAccessor (&PointToPointNetDevice::m_macRxTrace))
+#if 0
+ // Not currently implemented for this device
+ .AddTraceSource ("MacRxDrop",
+ "Trace source indicating a packet was dropped before being forwarded up the stack",
+ MakeTraceSourceAccessor (&PointToPointNetDevice::m_macRxDropTrace))
+#endif
//
// Trace souces at the "bottom" of the net device, where packets transition
// to/from the channel.
//
- .AddTraceSource ("PhyTxStart",
+ .AddTraceSource ("PhyTxBegin",
"Trace source indicating a packet has begun transmitting over the channel",
- MakeTraceSourceAccessor (&PointToPointNetDevice::m_phyTxStartTrace))
- .AddTraceSource ("PhyTx",
+ MakeTraceSourceAccessor (&PointToPointNetDevice::m_phyTxBeginTrace))
+ .AddTraceSource ("PhyTxEnd",
"Trace source indicating a packet has been completely transmitted over the channel",
- MakeTraceSourceAccessor (&PointToPointNetDevice::m_phyTxTrace))
+ MakeTraceSourceAccessor (&PointToPointNetDevice::m_phyTxEndTrace))
.AddTraceSource ("PhyTxDrop",
"Trace source indicating a packet has been dropped by the device during transmission",
MakeTraceSourceAccessor (&PointToPointNetDevice::m_phyTxDropTrace))
- .AddTraceSource ("PhyRxStart",
+#if 0
+ // Not currently implemented for this device
+ .AddTraceSource ("PhyRxBegin",
"Trace source indicating a packet has begun being received by the device",
- MakeTraceSourceAccessor (&PointToPointNetDevice::m_phyRxStartTrace))
- .AddTraceSource ("PhyRx",
+ MakeTraceSourceAccessor (&PointToPointNetDevice::m_phyRxBeginTrace))
+#endif
+ .AddTraceSource ("PhyRxEnd",
"Trace source indicating a packet has been completely received by the device",
- MakeTraceSourceAccessor (&PointToPointNetDevice::m_phyRxTrace))
+ MakeTraceSourceAccessor (&PointToPointNetDevice::m_phyRxEndTrace))
.AddTraceSource ("PhyRxDrop",
"Trace source indicating a packet has been dropped by the device during reception",
MakeTraceSourceAccessor (&PointToPointNetDevice::m_phyRxDropTrace))
//
// Trace sources designed to simulate a packet sniffer facility (tcpdump).
+ // Note that there is really no difference between promiscuous and
+ // non-promiscuous traces in a point-to-point link.
//
.AddTraceSource ("Sniffer",
"Trace source simulating a non-promiscuous packet sniffer attached to the device",
@@ -210,7 +221,7 @@
//
NS_ASSERT_MSG(m_txMachineState == READY, "Must be READY to transmit");
m_txMachineState = BUSY;
- m_phyTxTrace (m_currentPkt);
+ m_phyTxBeginTrace (m_currentPkt);
m_currentPkt = p;
Time txTime = Seconds (m_bps.CalculateTxTime(p->GetSize()));
@@ -243,7 +254,7 @@
NS_ASSERT_MSG (m_currentPkt != 0, "PointToPointNetDevice::TransmitComplete(): m_currentPkt zero");
- m_phyTxTrace (m_currentPkt);
+ m_phyTxEndTrace (m_currentPkt);
m_currentPkt = 0;
Ptr<Packet> p = m_queue->Dequeue ();
@@ -259,6 +270,7 @@
// Got another packet off of the queue, so start the transmit process agin.
//
m_snifferTrace (p);
+ m_promiscSnifferTrace (p);
TransmitStart(p);
}
@@ -315,7 +327,8 @@
// device becuase it is so simple, but this is not usually the case.
//
m_snifferTrace (packet);
- m_phyRxTrace (packet);
+ m_promiscSnifferTrace (packet);
+ m_phyRxEndTrace (packet);
m_macRxTrace (packet);
//
@@ -509,6 +522,7 @@
m_queue->Enqueue (packet);
packet = m_queue->Dequeue ();
m_snifferTrace (packet);
+ m_promiscSnifferTrace (packet);
return TransmitStart (packet);
}
else
--- a/src/devices/point-to-point/point-to-point-net-device.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/point-to-point/point-to-point-net-device.h Tue Mar 10 23:47:55 2009 -0700
@@ -418,23 +418,29 @@
TracedCallback<Ptr<const Packet> > m_macRxTrace;
/**
- * The trace source fired when a packet starts the transmission process on
+ * The trace source fired for packets successfully received by the device
+ * but are dropped before being forwarded up to higher layers (at the L2/L3
+ * transition).
+ *
+ * \see class CallBackTraceSource
+ */
+ TracedCallback<Ptr<const Packet> > m_macRxDropTrace;
+
+ /**
+ * The trace source fired when a packet begins the transmission process on
* the medium.
*
* \see class CallBackTraceSource
*/
- TracedCallback<Ptr<const Packet> > m_phyTxStartTrace;
+ TracedCallback<Ptr<const Packet> > m_phyTxBeginTrace;
/**
* The trace source fired when a packet ends the transmission process on
- * the medium. This happens immediately after the device has completed
- * packet transmission and has stopped "wiggling" the wire. N.B. This
- * is not the same time that the packet will be received on a remote device
- * as that time includes a speed-of-light delay.
+ * the medium.
*
* \see class CallBackTraceSource
*/
- TracedCallback<Ptr<const Packet> > m_phyTxTrace;
+ TracedCallback<Ptr<const Packet> > m_phyTxEndTrace;
/**
* The trace source fired when the phy layer drops a packet before it tries
@@ -445,12 +451,12 @@
TracedCallback<Ptr<const Packet> > m_phyTxDropTrace;
/**
- * The trace source fired when a packet starts the reception process from
+ * The trace source fired when a packet begins the reception process from
* the medium -- when the simulated first bit(s) arrive.
*
* \see class CallBackTraceSource
*/
- TracedCallback<Ptr<const Packet> > m_phyRxStartTrace;
+ TracedCallback<Ptr<const Packet> > m_phyRxBeginTrace;
/**
* The trace source fired when a packet ends the reception process from
@@ -458,7 +464,7 @@
*
* \see class CallBackTraceSource
*/
- TracedCallback<Ptr<const Packet> > m_phyRxTrace;
+ TracedCallback<Ptr<const Packet> > m_phyRxEndTrace;
/**
* The trace source fired when the phy layer drops a packet it has received.
--- a/src/devices/wifi/adhoc-wifi-mac.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/wifi/adhoc-wifi-mac.cc Tue Mar 10 23:47:55 2009 -0700
@@ -235,7 +235,7 @@
destination->RecordDisassociated ();
}
- m_macTxTrace (packet);
+ NotifyTx (packet);
m_dca->Queue (packet, hdr);
}
bool
@@ -248,7 +248,7 @@
AdhocWifiMac::ForwardUp (Ptr<Packet> packet, WifiMacHeader const *hdr)
{
NS_LOG_DEBUG ("received size="<<packet->GetSize ()<<", from="<<hdr->GetAddr2 ());
- m_macRxTrace (packet);
+ NotifyRx (packet);
m_upCallback (packet, hdr->GetAddr2 (), hdr->GetAddr1 ());
}
Ptr<DcaTxop>
--- a/src/devices/wifi/mac-low.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/wifi/mac-low.cc Tue Mar 10 23:47:55 2009 -0700
@@ -840,10 +840,6 @@
*/
Time txDuration = m_phy->CalculateTxDuration (packet->GetSize (), txMode, WIFI_PREAMBLE_LONG);
Simulator::Schedule (txDuration, &MacLow::NotifyNav, this, *hdr, txMode, WIFI_PREAMBLE_LONG);
- /*
- * Tell the phy when we expect the packet has completely been sent -- for tracing
- */
- Simulator::Schedule (txDuration, &WifiPhy::SendDone, m_phy, packet);
}
void
--- a/src/devices/wifi/nqap-wifi-mac.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/wifi/nqap-wifi-mac.cc Tue Mar 10 23:47:55 2009 -0700
@@ -286,7 +286,7 @@
NqapWifiMac::ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to)
{
NS_LOG_FUNCTION (this << packet << from);
- m_macRxTrace (packet);
+ NotifyRx (packet);
m_upCallback (packet, from, to);
}
@@ -302,7 +302,7 @@
hdr.SetDsFrom ();
hdr.SetDsNotTo ();
- m_macTxTrace (packet);
+ NotifyTx (packet);
m_dca->Queue (packet, hdr);
}
void
@@ -477,13 +477,13 @@
{
// this is an AP-to-AP frame
// we ignore for now.
- m_macRxDropTrace (packet);
+ NotifyRxDrop (packet);
}
else
{
// we can ignore these frames since
// they are not targeted at the AP
- m_macRxDropTrace (packet);
+ NotifyRxDrop (packet);
}
}
else if (hdr->IsMgt ())
--- a/src/devices/wifi/nqsta-wifi-mac.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/wifi/nqsta-wifi-mac.cc Tue Mar 10 23:47:55 2009 -0700
@@ -322,7 +322,7 @@
NqstaWifiMac::ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to)
{
NS_LOG_FUNCTION (this << packet << from << to);
- m_macRxTrace (packet);
+ NotifyRx (packet);
m_forwardUp (packet, from, to);
}
void
@@ -468,7 +468,7 @@
NS_LOG_FUNCTION (this << packet << to);
if (!IsAssociated ())
{
- m_macTxDropTrace (packet);
+ NotifyTxDrop (packet);
TryToEnsureAssociated ();
return;
}
@@ -481,7 +481,7 @@
hdr.SetDsNotFrom ();
hdr.SetDsTo ();
- m_macTxTrace (packet);
+ NotifyTx (packet);
m_dca->Queue (packet, hdr);
}
@@ -509,26 +509,26 @@
!hdr->GetAddr1 ().IsGroup ())
{
NS_LOG_LOGIC ("packet is not for us");
- m_macRxDropTrace (packet);
+ NotifyRxDrop (packet);
}
else if (hdr->IsData ())
{
if (!IsAssociated ())
{
NS_LOG_LOGIC ("Received data frame while not associated: ignore");
- m_macRxDropTrace (packet);
+ NotifyRxDrop (packet);
return;
}
if (!(hdr->IsFromDs () && !hdr->IsToDs ()))
{
NS_LOG_LOGIC ("Received data frame not from the DS: ignore");
- m_macRxDropTrace (packet);
+ NotifyRxDrop (packet);
return;
}
if (hdr->GetAddr2 () != GetBssid ())
{
NS_LOG_LOGIC ("Received data frame not from the the BSS we are associated with: ignore");
- m_macRxDropTrace (packet);
+ NotifyRxDrop (packet);
return;
}
@@ -540,7 +540,7 @@
/* this is a frame aimed at an AP.
* so we can safely ignore it.
*/
- m_macRxDropTrace (packet);
+ NotifyRxDrop (packet);
}
else if (hdr->IsBeacon ())
{
--- a/src/devices/wifi/propagation-loss-model.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/wifi/propagation-loss-model.cc Tue Mar 10 23:47:55 2009 -0700
@@ -22,7 +22,6 @@
#include "propagation-loss-model.h"
#include "ns3/log.h"
#include "ns3/mobility-model.h"
-#include "ns3/static-mobility-model.h"
#include "ns3/boolean.h"
#include "ns3/double.h"
#include <math.h>
--- a/src/devices/wifi/random-stream.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/wifi/random-stream.cc Tue Mar 10 23:47:55 2009 -0700
@@ -34,7 +34,7 @@
uint32_t
RealRandomStream::GetNext (uint32_t min, uint32_t max)
{
- return static_cast<uint32_t> (round (m_stream.GetValue (min, max)));
+ return m_stream.GetInteger (min, max);
}
--- a/src/devices/wifi/wifi-mac.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/wifi/wifi-mac.cc Tue Mar 10 23:47:55 2009 -0700
@@ -68,7 +68,6 @@
return ctsTimeout;
}
-
TypeId
WifiMac::GetTypeId (void)
{
@@ -133,9 +132,12 @@
"A packet has been dropped in the MAC layer after it has been passed up from the physical "
"layer.",
MakeTraceSourceAccessor (&WifiMac::m_macRxDropTrace))
+#if 0
+ // Not currently implemented in this device
.AddTraceSource ("Sniffer",
"Trace source simulating a non-promiscuous packet sniffer attached to the device",
MakeTraceSourceAccessor (&WifiMac::m_snifferTrace))
+#endif
;
return tid;
@@ -164,11 +166,28 @@
return m_maxMsduSize;
}
-void
-WifiMac::SnifferTrace (Ptr<const Packet> packet)
+void
+WifiMac::NotifyTx (Ptr<const Packet> packet)
{
- m_snifferTrace (packet);
+ m_macTxTrace (packet);
+}
+
+void
+WifiMac::NotifyTxDrop (Ptr<const Packet> packet)
+{
+ m_macTxDropTrace (packet);
}
+void
+WifiMac::NotifyRx (Ptr<const Packet> packet)
+{
+ m_macRxTrace (packet);
+}
+
+void
+WifiMac::NotifyRxDrop (Ptr<const Packet> packet)
+{
+ m_macRxDropTrace (packet);
+}
} // namespace ns3
--- a/src/devices/wifi/wifi-mac.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/wifi/wifi-mac.h Tue Mar 10 23:47:55 2009 -0700
@@ -177,11 +177,29 @@
*/
virtual void SetLinkDownCallback (Callback<void> linkDown) = 0;
- /*
- * Let the net device hit a trace hook. This is done to group the high-level
- * trace sources all in one place for ease of use.
+ /**
+ * Public method used to fire a MacTx trace. Implemented for encapsulation
+ * purposes.
+ */
+ void NotifyTx (Ptr<const Packet> packet);
+
+ /**
+ * Public method used to fire a MacTxDrop trace. Implemented for encapsulation
+ * purposes.
*/
- void SnifferTrace (Ptr<const Packet> packet);
+ void NotifyTxDrop (Ptr<const Packet> packet);
+
+ /**
+ * Public method used to fire a MacRx trace. Implemented for encapsulation
+ * purposes.
+ */
+ void NotifyRx (Ptr<const Packet> packet);
+
+ /**
+ * Public method used to fire a MacRxDrop trace. Implemented for encapsulation
+ * purposes.
+ */
+ void NotifyRxDrop (Ptr<const Packet> packet);
private:
static Time GetDefaultMaxPropagationDelay (void);
@@ -194,8 +212,6 @@
Time m_maxPropagationDelay;
uint32_t m_maxMsduSize;
-protected:
-
/**
* The trace source fired when packets come into the "top" of the device
* at the L3/L2 transition, before being queued for transmission.
@@ -229,25 +245,6 @@
*/
TracedCallback<Ptr<const Packet> > m_macRxDropTrace;
- /**
- * A trace source that emulates a non-promiscuous protocol sniffer connected
- * to the device. Unlike your average everyday sniffer, this trace source
- * will not fire on PACKET_OTHERHOST events.
- *
- * On the transmit size, this trace hook will fire after a packet is dequeued
- * from the device queue for transmission. In Linux, for example, this would
- * correspond to the point just before a device hard_start_xmit where
- * dev_queue_xmit_nit is called to dispatch the packet to the PF_PACKET
- * ETH_P_ALL handlers.
- *
- * On the receive side, this trace hook will fire when a packet is received,
- * just before the receive callback is executed. In Linux, for example,
- * this would correspond to the point at which the packet is dispatched to
- * packet sniffers in netif_receive_skb.
- *
- * \see class CallBackTraceSource
- */
- TracedCallback<Ptr<const Packet> > m_snifferTrace;
};
} // namespace ns3
--- a/src/devices/wifi/wifi-net-device.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/wifi/wifi-net-device.cc Tue Mar 10 23:47:55 2009 -0700
@@ -248,8 +248,6 @@
Mac48Address realTo = Mac48Address::ConvertFrom (dest);
Mac48Address realFrom = Mac48Address::ConvertFrom (GetAddress ());
- SniffPacket (packet, realTo, realFrom, protocolNumber);
-
LlcSnapHeader llc;
llc.SetType (protocolNumber);
packet->AddHeader (llc);
@@ -307,7 +305,6 @@
if (type != NetDevice::PACKET_OTHERHOST)
{
- SniffPacket (packet, to, from, llc.GetType ());
m_forwardUp (this, packet, llc.GetType (), from);
}
@@ -345,8 +342,6 @@
Mac48Address realTo = Mac48Address::ConvertFrom (dest);
Mac48Address realFrom = Mac48Address::ConvertFrom (source);
- SniffPacket (packet, realTo, realFrom, protocolNumber);
-
LlcSnapHeader llc;
llc.SetType (protocolNumber);
packet->AddHeader (llc);
@@ -370,26 +365,5 @@
return m_mac->SupportsSendFrom ();
}
-void
-WifiNetDevice::SniffPacket (Ptr<const Packet> packet, Mac48Address to, Mac48Address from, uint16_t type)
-{
- Ptr<Packet> copy = packet->Copy ();
- EthernetHeader header (false);
- header.SetSource (from);
- header.SetDestination (to);
-
- LlcSnapHeader llc;
- llc.SetType (type);
- copy->AddHeader (llc);
-
- header.SetLengthType (copy->GetSize ());
- copy->AddHeader (header);
-
- EthernetTrailer trailer;
- trailer.CalcFcs (copy);
- copy->AddTrailer (trailer);
- m_mac->SnifferTrace (copy);
-}
-
} // namespace ns3
--- a/src/devices/wifi/wifi-phy-test.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/wifi/wifi-phy-test.cc Tue Mar 10 23:47:55 2009 -0700
@@ -7,7 +7,7 @@
#include "yans-error-rate-model.h"
#include "ns3/ptr.h"
#include "ns3/mobility-model.h"
-#include "ns3/static-mobility-model.h"
+#include "ns3/constant-position-mobility-model.h"
#include "ns3/vector.h"
#include "ns3/packet.h"
#include "ns3/simulator.h"
@@ -75,9 +75,9 @@
m_output.received = 0;
m_input = input;
- Ptr<MobilityModel> posTx = CreateObject<StaticMobilityModel> ();
+ Ptr<MobilityModel> posTx = CreateObject<ConstantPositionMobilityModel> ();
posTx->SetPosition (Vector (0.0, 0.0, 0.0));
- Ptr<MobilityModel> posRx = CreateObject<StaticMobilityModel> ();
+ Ptr<MobilityModel> posRx = CreateObject<ConstantPositionMobilityModel> ();
posRx->SetPosition (Vector (m_input.distance, 0.0, 0.0));
Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
@@ -207,11 +207,11 @@
Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> ();
channel->SetPropagationLossModel (log);
- Ptr<MobilityModel> posTxA = CreateObject<StaticMobilityModel> ();
+ Ptr<MobilityModel> posTxA = CreateObject<ConstantPositionMobilityModel> ();
posTxA->SetPosition (Vector (input.xA, 0.0, 0.0));
- Ptr<MobilityModel> posTxB = CreateObject<StaticMobilityModel> ();
+ Ptr<MobilityModel> posTxB = CreateObject<ConstantPositionMobilityModel> ();
posTxB->SetPosition (Vector (input.xB, 0.0, 0.0));
- Ptr<MobilityModel> posRx = CreateObject<StaticMobilityModel> ();
+ Ptr<MobilityModel> posRx = CreateObject<ConstantPositionMobilityModel> ();
posRx->SetPosition (Vector (0, 0.0, 0.0));
Ptr<YansWifiPhy> txA = CreateObject<YansWifiPhy> ();
--- a/src/devices/wifi/wifi-phy.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/wifi/wifi-phy.cc Tue Mar 10 23:47:55 2009 -0700
@@ -55,27 +55,27 @@
{
static TypeId tid = TypeId ("ns3::WifiPhy")
.SetParent<Object> ()
- .AddTraceSource ("PhyTxStart",
+ .AddTraceSource ("PhyTxBegin",
"Trace source indicating a packet has begun transmitting over the channel medium",
- MakeTraceSourceAccessor (&WifiPhy::m_phyTxStartTrace))
- .AddTraceSource ("PhyTx",
+ MakeTraceSourceAccessor (&WifiPhy::m_phyTxBeginTrace))
+ .AddTraceSource ("PhyTxEnd",
"Trace source indicating a packet has been completely transmitted over the channel",
- MakeTraceSourceAccessor (&WifiPhy::m_phyTxTrace))
+ MakeTraceSourceAccessor (&WifiPhy::m_phyTxEndTrace))
.AddTraceSource ("PhyTxDrop",
"Trace source indicating a packet has been dropped by the device during transmission",
MakeTraceSourceAccessor (&WifiPhy::m_phyTxDropTrace))
- .AddTraceSource ("PhyRxStart",
+ .AddTraceSource ("PhyRxBegin",
"Trace source indicating a packet has begun being received from the channel medium by the device",
- MakeTraceSourceAccessor (&WifiPhy::m_phyRxStartTrace))
- .AddTraceSource ("PhyRx",
+ MakeTraceSourceAccessor (&WifiPhy::m_phyRxBeginTrace))
+ .AddTraceSource ("PhyRxEnd",
"Trace source indicating a packet has been completely received from the channel medium by the device",
- MakeTraceSourceAccessor (&WifiPhy::m_phyRxTrace))
+ MakeTraceSourceAccessor (&WifiPhy::m_phyRxEndTrace))
.AddTraceSource ("PhyRxDrop",
"Trace source indicating a packet has been dropped by the device during reception",
MakeTraceSourceAccessor (&WifiPhy::m_phyRxDropTrace))
.AddTraceSource ("PromiscSniffer",
"Trace source simulating a promiscuous packet sniffer attached to the device",
- MakeTraceSourceAccessor (&WifiPhy::m_promiscSnifferTrace))
+ MakeTraceSourceAccessor (&WifiPhy::m_phyPromiscSnifferTrace))
;
return tid;
}
@@ -157,6 +157,48 @@
return mode;
}
+void
+WifiPhy::NotifyTxBegin (Ptr<const Packet> packet)
+{
+ m_phyTxBeginTrace (packet);
+}
+
+void
+WifiPhy::NotifyTxEnd (Ptr<const Packet> packet)
+{
+ m_phyTxEndTrace (packet);
+}
+
+void
+WifiPhy::NotifyTxDrop (Ptr<const Packet> packet)
+{
+ m_phyTxDropTrace (packet);
+}
+
+void
+WifiPhy::NotifyRxBegin (Ptr<const Packet> packet)
+{
+ m_phyRxBeginTrace (packet);
+}
+
+void
+WifiPhy::NotifyRxEnd (Ptr<const Packet> packet)
+{
+ m_phyRxEndTrace (packet);
+}
+
+void
+WifiPhy::NotifyRxDrop (Ptr<const Packet> packet)
+{
+ m_phyRxDropTrace (packet);
+}
+
+void
+WifiPhy::NotifyPromiscSniff (Ptr<const Packet> packet)
+{
+ m_phyPromiscSnifferTrace (packet);
+}
+
} // namespace ns3
namespace {
--- a/src/devices/wifi/wifi-phy.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/wifi/wifi-phy.h Tue Mar 10 23:47:55 2009 -0700
@@ -175,13 +175,6 @@
virtual void SendPacket (Ptr<const Packet> packet, WifiMode mode, enum WifiPreamble preamble, uint8_t txPowerLevel) = 0;
/**
- * \param packet the packet that was sent
- *
- * Tell the PHY-level that MAC low believes it should have just completed the send.
- */
- virtual void SendDone (Ptr<const Packet> packet) = 0;
-
- /**
* \param listener the new listener
*
* Add the input listener to the list of objects to be notified of
@@ -260,14 +253,56 @@
static WifiMode Get48mba (void);
static WifiMode Get54mba (void);
-protected:
+ /**
+ * Public method used to fire a PhyTxBegin trace. Implemented for encapsulation
+ * purposes.
+ */
+ void NotifyTxBegin (Ptr<const Packet> packet);
+
+ /**
+ * Public method used to fire a PhyTxEnd trace. Implemented for encapsulation
+ * purposes.
+ */
+ void NotifyTxEnd (Ptr<const Packet> packet);
+
+ /**
+ * Public method used to fire a PhyTxDrop trace. Implemented for encapsulation
+ * purposes.
+ */
+ void NotifyTxDrop (Ptr<const Packet> packet);
+
/**
- * The trace source fired when a packet starts the transmission process on
+ * Public method used to fire a PhyRxBegin trace. Implemented for encapsulation
+ * purposes.
+ */
+ void NotifyRxBegin (Ptr<const Packet> packet);
+
+ /**
+ * Public method used to fire a PhyRxEnd trace. Implemented for encapsulation
+ * purposes.
+ */
+ void NotifyRxEnd (Ptr<const Packet> packet);
+
+ /**
+ * Public method used to fire a PhyRxDrop trace. Implemented for encapsulation
+ * purposes.
+ */
+ void NotifyRxDrop (Ptr<const Packet> packet);
+
+ /**
+ * Public method used to fire a PromiscSniffer trace. Implemented for encapsulation
+ * purposes.
+ */
+ void NotifyPromiscSniff (Ptr<const Packet> packet);
+
+private:
+ /**
+ * The trace source fired when a packet begins the transmission process on
* the medium.
*
* \see class CallBackTraceSource
*/
- TracedCallback<Ptr<const Packet> > m_phyTxStartTrace;
+ TracedCallback<Ptr<const Packet> > m_phyTxBeginTrace;
/**
* The trace source fired when a packet ends the transmission process on
@@ -275,7 +310,7 @@
*
* \see class CallBackTraceSource
*/
- TracedCallback<Ptr<const Packet> > m_phyTxTrace;
+ TracedCallback<Ptr<const Packet> > m_phyTxEndTrace;
/**
* The trace source fired when the phy layer drops a packet as it tries
@@ -286,12 +321,12 @@
TracedCallback<Ptr<const Packet> > m_phyTxDropTrace;
/**
- * The trace source fired when a packet starts the reception process from
+ * The trace source fired when a packet begins the reception process from
* the medium.
*
* \see class CallBackTraceSource
*/
- TracedCallback<Ptr<const Packet> > m_phyRxStartTrace;
+ TracedCallback<Ptr<const Packet> > m_phyRxBeginTrace;
/**
* The trace source fired when a packet ends the reception process from
@@ -299,7 +334,7 @@
*
* \see class CallBackTraceSource
*/
- TracedCallback<Ptr<const Packet> > m_phyRxTrace;
+ TracedCallback<Ptr<const Packet> > m_phyRxEndTrace;
/**
* The trace source fired when the phy layer drops a packet it has received.
@@ -326,7 +361,7 @@
*
* \see class CallBackTraceSource
*/
- TracedCallback<Ptr<const Packet> > m_promiscSnifferTrace;
+ TracedCallback<Ptr<const Packet> > m_phyPromiscSnifferTrace;
};
} // namespace ns3
--- a/src/devices/wifi/wifi-test.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/wifi/wifi-test.cc Tue Mar 10 23:47:55 2009 -0700
@@ -9,7 +9,7 @@
#include "propagation-loss-model.h"
#include "error-rate-model.h"
#include "yans-error-rate-model.h"
-#include "ns3/static-mobility-model.h"
+#include "ns3/constant-position-mobility-model.h"
#include "ns3/node.h"
#include "ns3/simulator.h"
#include "ns3/test.h"
@@ -51,7 +51,7 @@
Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> ();
Ptr<WifiMac> mac = m_mac.Create<WifiMac> ();
- Ptr<StaticMobilityModel> mobility = CreateObject<StaticMobilityModel> ();
+ Ptr<ConstantPositionMobilityModel> mobility = CreateObject<ConstantPositionMobilityModel> ();
Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> ();
Ptr<ErrorRateModel> error = CreateObject<YansErrorRateModel> ();
phy->SetErrorRateModel (error);
--- a/src/devices/wifi/yans-wifi-phy.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/wifi/yans-wifi-phy.cc Tue Mar 10 23:47:55 2009 -0700
@@ -323,7 +323,7 @@
case YansWifiPhy::SYNC:
NS_LOG_DEBUG ("drop packet because already in Sync (power="<<
rxPowerW<<"W)");
- m_phyRxDropTrace (packet);
+ NotifyRxDrop (packet);
if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ())
{
// that packet will be noise _after_ the reception of the
@@ -334,7 +334,7 @@
case YansWifiPhy::TX:
NS_LOG_DEBUG ("drop packet because already in Tx (power="<<
rxPowerW<<"W)");
- m_phyRxDropTrace (packet);
+ NotifyRxDrop (packet);
if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ())
{
// that packet will be noise _after_ the transmission of the
@@ -350,7 +350,7 @@
// sync to signal
m_state->SwitchToSync (rxDuration);
NS_ASSERT (m_endSyncEvent.IsExpired ());
- m_phyRxStartTrace (packet);
+ NotifyRxBegin (packet);
m_endSyncEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndSync, this,
packet,
event);
@@ -359,7 +359,7 @@
{
NS_LOG_DEBUG ("drop packet because signal power too Small ("<<
rxPowerW<<"<"<<m_edThresholdW<<")");
- m_phyRxDropTrace (packet);
+ NotifyRxDrop (packet);
goto maybeCcaBusy;
}
break;
@@ -397,18 +397,12 @@
{
m_endSyncEvent.Cancel ();
}
- m_phyTxStartTrace (packet);
- m_promiscSnifferTrace (packet);
+ NotifyTxBegin (packet);
+ NotifyPromiscSniff (packet);
m_state->SwitchToTx (txDuration, packet, txMode, preamble, txPower);
m_channel->Send (this, packet, GetPowerDbm (txPower) + m_txGainDb, txMode, preamble);
}
-void
-YansWifiPhy::SendDone (Ptr<const Packet> packet)
-{
- m_phyTxTrace (packet);
-}
-
uint32_t
YansWifiPhy::GetNModes (void) const
{
@@ -564,19 +558,16 @@
if (m_random.GetValue () > snrPer.per)
{
- m_phyRxTrace (packet);
- m_promiscSnifferTrace (packet);
+ NotifyRxEnd (packet);
+ NotifyPromiscSniff (packet);
m_state->SwitchFromSyncEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType ());
}
else
{
/* failure. */
- m_phyRxDropTrace (packet);
+ NotifyRxDrop (packet);
m_state->SwitchFromSyncEndError (packet, snrPer.snr);
}
}
-
-
-
} // namespace ns3
--- a/src/devices/wifi/yans-wifi-phy.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/devices/wifi/yans-wifi-phy.h Tue Mar 10 23:47:55 2009 -0700
@@ -102,7 +102,6 @@
virtual void SetReceiveOkCallback (WifiPhy::SyncOkCallback callback);
virtual void SetReceiveErrorCallback (WifiPhy::SyncErrorCallback callback);
virtual void SendPacket (Ptr<const Packet> packet, WifiMode mode, enum WifiPreamble preamble, uint8_t txPowerLevel);
- virtual void SendDone (Ptr<const Packet> packet);
virtual void RegisterListener (WifiPhyListener *listener);
virtual bool IsStateCcaBusy (void);
virtual bool IsStateIdle (void);
@@ -135,54 +134,6 @@
void EndSync (Ptr<Packet> packet, Ptr<InterferenceHelper::Event> event);
private:
- /**
- * The trace source fired when a packet starts the transmission process on
- * the medium.
- *
- * \see class CallBackTraceSource
- */
- TracedCallback<Ptr<const Packet> > m_phyTxStartTrace;
-
- /**
- * The trace source fired when a packet ends the transmission process on
- * the medium.
- *
- * \see class CallBackTraceSource
- */
- TracedCallback<Ptr<const Packet> > m_phyTxTrace;
-
- /**
- * The trace source fired when the phy layer drops a packet as it tries
- * to transmit it.
- *
- * \see class CallBackTraceSource
- */
- TracedCallback<Ptr<const Packet> > m_phyTxDropTrace;
-
- /**
- * The trace source fired when a packet ends the reception process from
- * the medium.
- *
- * \see class CallBackTraceSource
- */
- TracedCallback<Ptr<const Packet> > m_phyRxTrace;
-
- /**
- * The trace source fired when a packet ends the reception process from
- * the medium.
- *
- * \see class CallBackTraceSource
- */
- TracedCallback<Ptr<const Packet> > m_phyRxStartTrace;
-
- /**
- * The trace source fired when the phy layer drops a packet it has received.
- *
- * \see class CallBackTraceSource
- */
- TracedCallback<Ptr<const Packet> > m_phyRxDropTrace;
-
-private:
double m_edThresholdW;
double m_ccaMode1ThresholdW;
double m_txGainDb;
--- a/src/helper/csma-helper.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/helper/csma-helper.cc Tue Mar 10 23:47:55 2009 -0700
@@ -77,7 +77,7 @@
}
void
-CsmaHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid)
+CsmaHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid, bool promiscuous)
{
std::ostringstream oss;
oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::CsmaNetDevice/";
@@ -92,21 +92,43 @@
pcap->Open (oss.str ());
pcap->WriteEthernetHeader ();
oss.str ("");
- oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::CsmaNetDevice/Sniffer";
+ oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid;
+ if (promiscuous)
+ {
+ oss << "/$ns3::CsmaNetDevice/PromiscSniffer";
+ }
+ else
+ {
+ oss << "/$ns3::CsmaNetDevice/Sniffer";
+ }
Config::ConnectWithoutContext (oss.str (), MakeBoundCallback (&CsmaHelper::SniffEvent, pcap));
}
void
-CsmaHelper::EnablePcap (std::string filename, NetDeviceContainer d)
+CsmaHelper::EnablePcap (std::string filename, NetDeviceContainer d, bool promiscuous)
{
for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i)
{
Ptr<NetDevice> dev = *i;
- EnablePcap (filename, dev->GetNode ()->GetId (), dev->GetIfIndex ());
+ EnablePcap (filename, dev->GetNode ()->GetId (), dev->GetIfIndex (), promiscuous);
}
}
+
+void
+CsmaHelper::EnablePcap (std::string filename, Ptr<NetDevice> nd, bool promiscuous)
+{
+ EnablePcap (filename, nd->GetNode ()->GetId (), nd->GetIfIndex (), promiscuous);
+}
+
+void
+CsmaHelper::EnablePcap (std::string filename, std::string ndName, bool promiscuous)
+{
+ Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
+ EnablePcap (filename, nd->GetNode ()->GetId (), nd->GetIfIndex (), promiscuous);
+}
+
void
-CsmaHelper::EnablePcap (std::string filename, NodeContainer n)
+CsmaHelper::EnablePcap (std::string filename, NodeContainer n, bool promiscuous)
{
NetDeviceContainer devs;
for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
@@ -117,13 +139,13 @@
devs.Add (node->GetDevice (j));
}
}
- EnablePcap (filename, devs);
+ EnablePcap (filename, devs, promiscuous);
}
void
-CsmaHelper::EnablePcapAll (std::string filename)
+CsmaHelper::EnablePcapAll (std::string filename, bool promiscuous)
{
- EnablePcap (filename, NodeContainer::GetGlobal ());
+ EnablePcap (filename, NodeContainer::GetGlobal (), promiscuous);
}
void
--- a/src/helper/csma-helper.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/helper/csma-helper.h Tue Mar 10 23:47:55 2009 -0700
@@ -87,6 +87,7 @@
* \param filename filename prefix to use for pcap files.
* \param nodeid the id of the node to generate pcap output for.
* \param deviceid the id of the device to generate pcap output for.
+ * \param promiscuous If true capture all possible packets available at the device.
*
* Generate a pcap file which contains the link-level data observed
* by the specified deviceid within the specified nodeid. The pcap
@@ -95,31 +96,53 @@
* This method should be invoked after the network topology has
* been fully constructed.
*/
- static void EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid);
+ static void EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid, bool promiscuous);
+
+ /**
+ * \param filename filename prefix to use for pcap files.
+ * \param nd Net device in which you want to enable tracing.
+ * \param promiscuous If true capture all possible packets available at the device.
+ *
+ * Enable pcap output the indicated net device.
+ */
+ static void EnablePcap (std::string filename, Ptr<NetDevice> nd, bool promiscuous);
+
+ /**
+ * \param filename filename prefix to use for pcap files.
+ * \param ndName The name of the net device in which you want to enable tracing.
+ * \param promiscuous If true capture all possible packets available at the device.
+ *
+ * Enable pcap output the indicated net device.
+ */
+ static void EnablePcap (std::string filename, std::string ndName, bool promiscuous);
+
/**
* \param filename filename prefix to use for pcap files.
* \param d container of devices of type ns3::CsmaNetDevice
+ * \param promiscuous If true capture all possible packets available at the device.
*
- * Enable pcap output on each input device which is of the
- * ns3::CsmaNetDevice type.
+ * Enable pcap output on each input device which is of the ns3::CsmaNetDevice type.
*/
- static void EnablePcap (std::string filename, NetDeviceContainer d);
+ static void EnablePcap (std::string filename, NetDeviceContainer d, bool promiscuous);
+
/**
* \param filename filename prefix to use for pcap files.
* \param n container of nodes.
+ * \param promiscuous If true capture all possible packets available at the device.
*
* Enable pcap output on each device which is of the
* ns3::CsmaNetDevice type and which is located in one of the
* input nodes.
*/
- static void EnablePcap (std::string filename, NodeContainer n);
+ static void EnablePcap (std::string filename, NodeContainer n, bool promiscuous);
/**
* \param filename filename prefix to use for pcap files.
+ * \param promiscuous If true capture all possible packets available at the device.
*
* Enable pcap output on each device which is of the
* ns3::CsmaNetDevice type
*/
- static void EnablePcapAll (std::string filename);
+ static void EnablePcapAll (std::string filename, bool promiscuous);
/**
* \param os output stream
--- a/src/helper/emu-helper.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/helper/emu-helper.cc Tue Mar 10 23:47:55 2009 -0700
@@ -41,7 +41,7 @@
m_deviceFactory.SetTypeId ("ns3::EmuNetDevice");
}
- void
+void
EmuHelper::SetQueue (
std::string type,
std::string n1, const AttributeValue &v1,
@@ -57,20 +57,17 @@
m_queueFactory.Set (n4, v4);
}
- void
+void
EmuHelper::SetAttribute (std::string n1, const AttributeValue &v1)
{
NS_LOG_FUNCTION_NOARGS ();
m_deviceFactory.Set (n1, v1);
}
- void
-EmuHelper::EnablePcap (
- std::string filename,
- uint32_t nodeid,
- uint32_t deviceid)
+void
+EmuHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid, bool promiscuous)
{
- NS_LOG_FUNCTION (filename << nodeid << deviceid);
+ NS_LOG_FUNCTION (filename << nodeid << deviceid << promiscuous);
std::ostringstream oss;
oss << filename << "-" << nodeid << "-" << deviceid << ".pcap";
Ptr<PcapWriter> pcap = Create<PcapWriter> ();
@@ -78,25 +75,48 @@
pcap->WriteEthernetHeader ();
oss.str ("");
- oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::EmuNetDevice/Sniffer";
+ oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid;
+ if (promiscuous)
+ {
+ oss << "/$ns3::EmuNetDevice/PromiscSniffer";
+ }
+ else
+ {
+ oss << "/$ns3::EmuNetDevice/Sniffer";
+ }
Config::ConnectWithoutContext (oss.str (), MakeBoundCallback (&EmuHelper::SniffEvent, pcap));
}
- void
-EmuHelper::EnablePcap (std::string filename, NetDeviceContainer d)
+void
+EmuHelper::EnablePcap (std::string filename, Ptr<NetDevice> nd, bool promiscuous)
+{
+ NS_LOG_FUNCTION (filename << &nd << promiscuous);
+ EnablePcap (filename, nd->GetNode ()->GetId (), nd->GetIfIndex (), promiscuous);
+}
+
+void
+EmuHelper::EnablePcap (std::string filename, std::string ndName, bool promiscuous)
{
- NS_LOG_FUNCTION (filename << &d);
+ NS_LOG_FUNCTION (filename << ndName << promiscuous);
+ Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
+ EnablePcap (filename, nd->GetNode ()->GetId (), nd->GetIfIndex (), promiscuous);
+}
+
+void
+EmuHelper::EnablePcap (std::string filename, NetDeviceContainer d, bool promiscuous)
+{
+ NS_LOG_FUNCTION (filename << &d << promiscuous);
for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i)
{
Ptr<NetDevice> dev = *i;
- EnablePcap (filename, dev->GetNode ()->GetId (), dev->GetIfIndex ());
+ EnablePcap (filename, dev->GetNode ()->GetId (), dev->GetIfIndex (), promiscuous);
}
}
- void
-EmuHelper::EnablePcap (std::string filename, NodeContainer n)
+void
+EmuHelper::EnablePcap (std::string filename, NodeContainer n, bool promiscuous)
{
- NS_LOG_FUNCTION (filename << &n);
+ NS_LOG_FUNCTION (filename << &n << promiscuous);
NetDeviceContainer devs;
for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
{
@@ -106,17 +126,17 @@
devs.Add (node->GetDevice (j));
}
}
- EnablePcap (filename, devs);
+ EnablePcap (filename, devs, promiscuous);
}
- void
-EmuHelper::EnablePcapAll (std::string filename)
+void
+EmuHelper::EnablePcapAll (std::string filename, bool promiscuous)
{
- NS_LOG_FUNCTION (filename);
- EnablePcap (filename, NodeContainer::GetGlobal ());
+ NS_LOG_FUNCTION (filename << promiscuous);
+ EnablePcap (filename, NodeContainer::GetGlobal (), promiscuous);
}
- void
+void
EmuHelper::EnableAscii (std::ostream &os, uint32_t nodeid, uint32_t deviceid)
{
NS_LOG_FUNCTION (&os << nodeid << deviceid);
@@ -139,7 +159,7 @@
Config::Connect (oss.str (), MakeBoundCallback (&EmuHelper::AsciiDropEvent, &os));
}
- void
+void
EmuHelper::EnableAscii (std::ostream &os, NetDeviceContainer d)
{
NS_LOG_FUNCTION (&os << &d);
@@ -166,7 +186,7 @@
EnableAscii (os, devs);
}
- void
+void
EmuHelper::EnableAsciiAll (std::ostream &os)
{
NS_LOG_FUNCTION (&os);
@@ -199,7 +219,7 @@
return devs;
}
- Ptr<NetDevice>
+Ptr<NetDevice>
EmuHelper::InstallPriv (Ptr<Node> node) const
{
Ptr<EmuNetDevice> device = m_deviceFactory.Create<EmuNetDevice> ();
@@ -211,14 +231,14 @@
return device;
}
- void
+void
EmuHelper::SniffEvent (Ptr<PcapWriter> writer, Ptr<const Packet> packet)
{
NS_LOG_FUNCTION (writer << packet);
writer->WritePacket (packet);
}
- void
+void
EmuHelper::AsciiEnqueueEvent (
std::ostream *os,
std::string path,
@@ -229,7 +249,7 @@
*os << path << " " << *packet << std::endl;
}
- void
+void
EmuHelper::AsciiDequeueEvent (
std::ostream *os,
std::string path,
@@ -240,7 +260,7 @@
*os << path << " " << *packet << std::endl;
}
- void
+void
EmuHelper::AsciiDropEvent (
std::ostream *os,
std::string path,
@@ -251,7 +271,7 @@
*os << path << " " << *packet << std::endl;
}
- void
+void
EmuHelper::AsciiRxEvent (
std::ostream *os,
std::string path,
--- a/src/helper/emu-helper.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/helper/emu-helper.h Tue Mar 10 23:47:55 2009 -0700
@@ -73,6 +73,7 @@
* \param filename filename prefix to use for pcap files.
* \param nodeid the id of the node to generate pcap output for.
* \param deviceid the id of the device to generate pcap output for.
+ * \param promiscuous If true capture all possible packets available at the device.
*
* Generate a pcap file which contains the link-level data observed
* by the specified deviceid within the specified nodeid. The pcap
@@ -81,35 +82,57 @@
* This method should be invoked after the network topology has
* been fully constructed.
*/
- static void EnablePcap (std::string filename, uint32_t nodeid,
- uint32_t deviceid);
+ static void EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid, bool promiscuous);
+
+ /**
+ * \param filename filename prefix to use for pcap files.
+ * \param nd Indicates net device on which you want to enable tracing.
+ * \param promiscuous If true capture all possible packets available at the device.
+ *
+ * Enable pcap output on each input device which is of the
+ * ns3::EmuNetDevice type.
+ */
+ static void EnablePcap (std::string filename, Ptr<NetDevice> nd, bool promiscuous);
+
+ /**
+ * \param filename filename prefix to use for pcap files.
+ * \param ndName Name of net device on which you want to enable tracing.
+ * \param promiscuous If true capture all possible packets available at the device.
+ *
+ * Enable pcap output on each input device which is of the
+ * ns3::EmuNetDevice type.
+ */
+ static void EnablePcap (std::string filename, std::string ndName, bool promiscuous);
/**
* \param filename filename prefix to use for pcap files.
* \param d container of devices of type ns3::EmuNetDevice
+ * \param promiscuous If true capture all possible packets available at the device.
*
* Enable pcap output on each input device which is of the
* ns3::EmuNetDevice type.
*/
- static void EnablePcap (std::string filename, NetDeviceContainer d);
+ static void EnablePcap (std::string filename, NetDeviceContainer d, bool promiscuous);
/**
* \param filename filename prefix to use for pcap files.
* \param n container of nodes.
+ * \param promiscuous If true capture all possible packets available at the device.
*
* Enable pcap output on each device which is of the
* ns3::EmuNetDevice type and which is located in one of the
* input nodes.
*/
- static void EnablePcap (std::string filename, NodeContainer n);
+ static void EnablePcap (std::string filename, NodeContainer n, bool promiscuous);
/**
* \param filename filename prefix to use for pcap files.
+ * \param promiscuous If true capture all possible packets available at the device.
*
* Enable pcap output on each device which is of the
* ns3::EmuNetDevice type
*/
- static void EnablePcapAll (std::string filename);
+ static void EnablePcapAll (std::string filename, bool promiscuous);
/**
* \param os output stream
@@ -120,8 +143,7 @@
* specified nodeid if it is of type ns3::EmuNetDevice and dump
* that to the specified stdc++ output stream.
*/
- static void EnableAscii (std::ostream &os, uint32_t nodeid,
- uint32_t deviceid);
+ static void EnableAscii (std::ostream &os, uint32_t nodeid, uint32_t deviceid);
/**
* \param os output stream
--- a/src/helper/mobility-helper.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/helper/mobility-helper.cc Tue Mar 10 23:47:55 2009 -0700
@@ -37,7 +37,7 @@
m_position = CreateObject<RandomRectanglePositionAllocator>
("X", RandomVariableValue (ConstantVariable (0.0)),
"Y", RandomVariableValue (ConstantVariable (0.0)));
- m_mobility.SetTypeId ("ns3::StaticMobilityModel");
+ m_mobility.SetTypeId ("ns3::ConstantPositionMobilityModel");
}
MobilityHelper::~MobilityHelper ()
{}
--- a/src/helper/ns2-mobility-helper.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/helper/ns2-mobility-helper.cc Tue Mar 10 23:47:55 2009 -0700
@@ -23,7 +23,7 @@
#include "ns3/simulator.h"
#include "ns3/node-list.h"
#include "ns3/node.h"
-#include "ns3/static-speed-mobility-model.h"
+#include "ns3/constant-velocity-mobility-model.h"
#include "ns2-mobility-helper.h"
NS_LOG_COMPONENT_DEFINE ("Ns2MobilityHelper");
@@ -37,7 +37,7 @@
-Ptr<StaticSpeedMobilityModel>
+Ptr<ConstantVelocityMobilityModel>
Ns2MobilityHelper::GetMobilityModel (std::string idString, const ObjectStore &store) const
{
std::istringstream iss;
@@ -49,10 +49,10 @@
{
return 0;
}
- Ptr<StaticSpeedMobilityModel> model = object->GetObject<StaticSpeedMobilityModel> ();
+ Ptr<ConstantVelocityMobilityModel> model = object->GetObject<ConstantVelocityMobilityModel> ();
if (model == 0)
{
- model = CreateObject<StaticSpeedMobilityModel> ();
+ model = CreateObject<ConstantVelocityMobilityModel> ();
object->AggregateObject (model);
}
return model;
@@ -85,7 +85,7 @@
{
continue;
}
- Ptr<StaticSpeedMobilityModel> model = GetMobilityModel (line.substr (startNodeId + 1,
+ Ptr<ConstantVelocityMobilityModel> model = GetMobilityModel (line.substr (startNodeId + 1,
endNodeId - startNodeId),
store);
if (model == 0)
@@ -130,7 +130,7 @@
double ySpeed = ReadDouble (line.substr (xSpeedEnd + 1, ySpeedEnd - xSpeedEnd - 1));
double zSpeed = ReadDouble (line.substr (ySpeedEnd + 1, std::string::npos));
NS_LOG_DEBUG ("at=" << at << "xSpeed=" << xSpeed << ", ySpeed=" << ySpeed << ", zSpeed=" << zSpeed);
- Simulator::Schedule (Seconds (at), &StaticSpeedMobilityModel::SetVelocity, model,
+ Simulator::Schedule (Seconds (at), &ConstantVelocityMobilityModel::SetVelocity, model,
Vector (xSpeed, ySpeed, zSpeed));
}
}
--- a/src/helper/ns2-mobility-helper.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/helper/ns2-mobility-helper.h Tue Mar 10 23:47:55 2009 -0700
@@ -27,7 +27,7 @@
namespace ns3 {
-class StaticSpeedMobilityModel;
+class ConstantVelocityMobilityModel;
/**
* \brief a topology object which can read ns2's movement files
@@ -71,7 +71,7 @@
virtual Ptr<Object> Get (uint32_t i) const = 0;
};
void LayoutObjectStore (const ObjectStore &store) const;
- Ptr<StaticSpeedMobilityModel> GetMobilityModel (std::string idString, const ObjectStore &store) const;
+ Ptr<ConstantVelocityMobilityModel> GetMobilityModel (std::string idString, const ObjectStore &store) const;
double ReadDouble (std::string valueString) const;
std::string m_filename;
};
--- a/src/helper/point-to-point-helper.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/helper/point-to-point-helper.cc Tue Mar 10 23:47:55 2009 -0700
@@ -90,9 +90,24 @@
pcap->Open (oss.str ());
pcap->WritePppHeader ();
oss.str ("");
- oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::PointToPointNetDevice/Sniffer";
+ oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid;
+ oss << "/$ns3::PointToPointNetDevice/PromiscSniffer";
Config::ConnectWithoutContext (oss.str (), MakeBoundCallback (&PointToPointHelper::SniffEvent, pcap));
}
+
+void
+PointToPointHelper::EnablePcap (std::string filename, Ptr<NetDevice> nd)
+{
+ EnablePcap (filename, nd->GetNode ()->GetId (), nd->GetIfIndex ());
+}
+
+void
+PointToPointHelper::EnablePcap (std::string filename, std::string ndName)
+{
+ Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
+ EnablePcap (filename, nd->GetNode ()->GetId (), nd->GetIfIndex ());
+}
+
void
PointToPointHelper::EnablePcap (std::string filename, NetDeviceContainer d)
{
@@ -102,6 +117,7 @@
EnablePcap (filename, dev->GetNode ()->GetId (), dev->GetIfIndex ());
}
}
+
void
PointToPointHelper::EnablePcap (std::string filename, NodeContainer n)
{
@@ -140,6 +156,7 @@
oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::PointToPointNetDevice/TxQueue/Drop";
Config::Connect (oss.str (), MakeBoundCallback (&PointToPointHelper::AsciiDropEvent, &os));
}
+
void
PointToPointHelper::EnableAscii (std::ostream &os, NetDeviceContainer d)
{
@@ -149,6 +166,7 @@
EnableAscii (os, dev->GetNode ()->GetId (), dev->GetIfIndex ());
}
}
+
void
PointToPointHelper::EnableAscii (std::ostream &os, NodeContainer n)
{
@@ -248,24 +266,28 @@
{
writer->WritePacket (packet);
}
+
void
PointToPointHelper::AsciiEnqueueEvent (std::ostream *os, std::string path, Ptr<const Packet> packet)
{
*os << "+ " << Simulator::Now ().GetSeconds () << " ";
*os << path << " " << *packet << std::endl;
}
+
void
PointToPointHelper::AsciiDequeueEvent (std::ostream *os, std::string path, Ptr<const Packet> packet)
{
*os << "- " << Simulator::Now ().GetSeconds () << " ";
*os << path << " " << *packet << std::endl;
}
+
void
PointToPointHelper::AsciiDropEvent (std::ostream *os, std::string path, Ptr<const Packet> packet)
{
*os << "d " << Simulator::Now ().GetSeconds () << " ";
*os << path << " " << *packet << std::endl;
}
+
void
PointToPointHelper::AsciiRxEvent (std::ostream *os, std::string path, Ptr<const Packet> packet)
{
@@ -273,5 +295,4 @@
*os << path << " " << *packet << std::endl;
}
-
} // namespace ns3
--- a/src/helper/point-to-point-helper.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/helper/point-to-point-helper.h Tue Mar 10 23:47:55 2009 -0700
@@ -95,6 +95,25 @@
* been fully constructed.
*/
static void EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid);
+
+ /**
+ * \param filename filename prefix to use for pcap files.
+ * \param nd Net device on which you want to enable tracing.
+ *
+ * Enable pcap output on each input device which is of the
+ * ns3::PointToPointNetDevice type.
+ */
+ static void EnablePcap (std::string filename, Ptr<NetDevice> nd);
+
+ /**
+ * \param filename filename prefix to use for pcap files.
+ * \param ndName Name of net device on which you want to enable tracing.
+ *
+ * Enable pcap output on each input device which is of the
+ * ns3::PointToPointNetDevice type.
+ */
+ static void EnablePcap (std::string filename, std::string ndName);
+
/**
* \param filename filename prefix to use for pcap files.
* \param d container of devices of type ns3::PointToPointNetDevice
@@ -103,6 +122,8 @@
* ns3::PointToPointNetDevice type.
*/
static void EnablePcap (std::string filename, NetDeviceContainer d);
+
+
/**
* \param filename filename prefix to use for pcap files.
* \param n container of nodes.
@@ -112,6 +133,7 @@
* input nodes.
*/
static void EnablePcap (std::string filename, NodeContainer n);
+
/**
* \param filename filename prefix to use for pcap files.
*
@@ -130,6 +152,7 @@
* that to the specified stdc++ output stream.
*/
static void EnableAscii (std::ostream &os, uint32_t nodeid, uint32_t deviceid);
+
/**
* \param os output stream
* \param d device container
@@ -140,6 +163,7 @@
* stdc++ output stream.
*/
static void EnableAscii (std::ostream &os, NetDeviceContainer d);
+
/**
* \param os output stream
* \param n node container
@@ -150,6 +174,7 @@
* stdc++ output stream.
*/
static void EnableAscii (std::ostream &os, NodeContainer n);
+
/**
* \param os output stream
*
--- a/src/helper/wifi-helper.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/helper/wifi-helper.cc Tue Mar 10 23:47:55 2009 -0700
@@ -37,61 +37,6 @@
namespace ns3 {
-static void PcapSnifferEvent (Ptr<PcapWriter> writer, Ptr<const Packet> packet)
-{
- writer->WritePacket (packet);
-}
-
-void
-WifiHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid)
-{
- std::ostringstream oss;
- oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Mac/";
- Config::MatchContainer matches = Config::LookupMatches (oss.str ());
- if (matches.GetN () == 0)
- {
- return;
- }
- oss.str ("");
- oss << filename << "-" << nodeid << "-" << deviceid << ".pcap";
- Ptr<PcapWriter> pcap = Create<PcapWriter> ();
- pcap->Open (oss.str ());
- pcap->WriteEthernetHeader ();
- oss.str ("");
- oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Mac/Sniffer";
- Config::ConnectWithoutContext (oss.str (), MakeBoundCallback (&PcapSnifferEvent, pcap));
-}
-
-void
-WifiHelper::EnablePcap (std::string filename, NetDeviceContainer d)
-{
- for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i)
- {
- Ptr<NetDevice> dev = *i;
- EnablePcap (filename, dev->GetNode ()->GetId (), dev->GetIfIndex ());
- }
-}
-void
-WifiHelper::EnablePcap (std::string filename, NodeContainer n)
-{
- NetDeviceContainer devs;
- for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
- {
- Ptr<Node> node = *i;
- for (uint32_t j = 0; j < node->GetNDevices (); ++j)
- {
- devs.Add (node->GetDevice (j));
- }
- }
- EnablePcap (filename, devs);
-}
-
-void
-WifiHelper::EnablePcapAll (std::string filename)
-{
- EnablePcap (filename, NodeContainer::GetGlobal ());
-}
-
WifiPhyHelper::~WifiPhyHelper ()
{}
--- a/src/helper/wifi-helper.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/helper/wifi-helper.h Tue Mar 10 23:47:55 2009 -0700
@@ -159,43 +159,6 @@
* \returns a device container which contains all the devices created by this method.
*/
NetDeviceContainer Install (const WifiPhyHelper &phy, std::string nodeName) const;
- /**
- * \param filename filename prefix to use for pcap files.
- * \param nodeid the id of the node to generate pcap output for.
- * \param deviceid the id of the device to generate pcap output for.
- *
- * Generate a pcap file which contains the link-level data observed
- * by the specified deviceid within the specified nodeid. The pcap
- * data is stored in the file prefix-nodeid-deviceid.pcap.
- *
- * This method should be invoked after the network topology has
- * been fully constructed.
- */
- static void EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid);
- /**
- * \param filename filename prefix to use for pcap files.
- * \param d container of devices of type ns3::WifiNetDevice
- *
- * Enable pcap output on each input device which is of the
- * ns3::WifiNetDevice type.
- */
- static void EnablePcap (std::string filename, NetDeviceContainer d);
- /**
- * \param filename filename prefix to use for pcap files.
- * \param n container of nodes.
- *
- * Enable pcap output on each device which is of the
- * ns3::WifiNetDevice type and which is located in one of the
- * input nodes.
- */
- static void EnablePcap (std::string filename, NodeContainer n);
- /**
- * \param filename filename prefix to use for pcap files.
- *
- * Enable pcap output on each device which is of the
- * ns3::WifiNetDevice type
- */
- static void EnablePcapAll (std::string filename);
private:
ObjectFactory m_stationManager;
--- a/src/helper/yans-wifi-helper.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/helper/yans-wifi-helper.cc Tue Mar 10 23:47:55 2009 -0700
@@ -220,9 +220,11 @@
pcap->Open (oss.str ());
pcap->WriteWifiHeader ();
oss.str ("");
- oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/PromiscSniffer";
+ oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid;
+ oss << "/$ns3::WifiNetDevice/Phy/PromiscSniffer";
Config::ConnectWithoutContext (oss.str (), MakeBoundCallback (&PcapSnifferEvent, pcap));
}
+
void
YansWifiPhyHelper::EnablePcap (std::string filename, NetDeviceContainer d)
{
@@ -232,6 +234,20 @@
EnablePcap (filename, dev->GetNode ()->GetId (), dev->GetIfIndex ());
}
}
+
+void
+YansWifiPhyHelper::EnablePcap (std::string filename, Ptr<NetDevice> nd)
+{
+ EnablePcap (filename, nd->GetNode ()->GetId (), nd->GetIfIndex ());
+}
+
+void
+YansWifiPhyHelper::EnablePcap (std::string filename, std::string ndName)
+{
+ Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
+ EnablePcap (filename, nd->GetNode ()->GetId (), nd->GetIfIndex ());
+}
+
void
YansWifiPhyHelper::EnablePcap (std::string filename, NodeContainer n)
{
@@ -294,6 +310,4 @@
EnableAscii (os, NodeContainer::GetGlobal ());
}
-
-
} // namespace ns3
--- a/src/helper/yans-wifi-helper.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/helper/yans-wifi-helper.h Tue Mar 10 23:47:55 2009 -0700
@@ -131,8 +131,7 @@
* http://cutebugs.net/files/wns2-yans.pdf
*
* The Pcap and ascii traces generated by the EnableAscii and EnablePcap methods defined
- * in this class correspond to PHY-level traces. That is, they capture traffic
- * at the top of the PHY layer, just below the MAC layer.
+ * in this class correspond to PHY-level traces.
*/
class YansWifiPhyHelper : public WifiPhyHelper
{
@@ -211,6 +210,25 @@
* been fully constructed.
*/
static void EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid);
+
+ /**
+ * \param filename filename prefix to use for pcap files.
+ * \param nd Net device on which you want to enable tracing.
+ *
+ * Enable pcap output on each input device which is of the
+ * ns3::WifiNetDevice type.
+ */
+ static void EnablePcap (std::string filename, Ptr<NetDevice> nd);
+
+ /**
+ * \param filename filename prefix to use for pcap files.
+ * \param ndName Name of net device on which you want to enable tracing.
+ *
+ * Enable pcap output on each input device which is of the
+ * ns3::WifiNetDevice type.
+ */
+ static void EnablePcap (std::string filename, std::string ndName);
+
/**
* \param filename filename prefix to use for pcap files.
* \param d container of devices of type ns3::WifiNetDevice
@@ -219,6 +237,7 @@
* ns3::WifiNetDevice type.
*/
static void EnablePcap (std::string filename, NetDeviceContainer d);
+
/**
* \param filename filename prefix to use for pcap files.
* \param n container of nodes.
@@ -228,6 +247,7 @@
* input nodes.
*/
static void EnablePcap (std::string filename, NodeContainer n);
+
/**
* \param filename filename prefix to use for pcap files.
*
@@ -246,6 +266,7 @@
* that to the specified stdc++ output stream.
*/
static void EnableAscii (std::ostream &os, uint32_t nodeid, uint32_t deviceid);
+
/**
* \param os output stream
* \param d device container
@@ -256,6 +277,7 @@
* stdc++ output stream.
*/
static void EnableAscii (std::ostream &os, NetDeviceContainer d);
+
/**
* \param os output stream
* \param n node container
@@ -266,6 +288,7 @@
* stdc++ output stream.
*/
static void EnableAscii (std::ostream &os, NodeContainer n);
+
/**
* \param os output stream
*
--- a/src/internet-stack/arp-cache.cc Sat Feb 28 16:25:24 2009 -0800
+++ b/src/internet-stack/arp-cache.cc Tue Mar 10 23:47:55 2009 -0700
@@ -185,7 +185,7 @@
for (CacheI i = m_arpCache.begin (); i != m_arpCache.end (); i++)
{
entry = (*i).second;
- if (entry != 0 && entry->IsWaitReply () && entry->IsExpiring () )
+ if (entry != 0 && entry->IsWaitReply ())
{
if (entry->GetRetries () < m_maxRetries)
{
@@ -374,19 +374,6 @@
/* NOTREACHED */
}
}
-bool
-ArpCache::Entry::IsExpiring (void) const
-{
- NS_LOG_FUNCTION_NOARGS ();
- Time timeout = GetTimeout ();
- Time delta = Simulator::Now () - m_lastSeen;
- NS_LOG_DEBUG ("delta=" << delta.GetSeconds () << "s");
- if (delta >= timeout)
- {
- return true;
- }
- return false;
-}
bool
ArpCache::Entry::IsExpired (void) const
{
--- a/src/internet-stack/arp-cache.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/internet-stack/arp-cache.h Tue Mar 10 23:47:55 2009 -0700
@@ -164,23 +164,9 @@
*
* This function returns true if the time elapsed strictly exceeds
* the timeout value (i.e., is not less than or equal to the timeout).
- * Differs from IsExpiring() only in the boundary condition
- * delta == timeout.
- * \see IsExpiring
*/
bool IsExpired (void) const;
/**
- * \return True if this entry is timing out or has already timed out;
- * false otherwise.
- *
- * This function returns true if the time elapsed is equal to or exceeds
- * the timeout value. Differs from IsExpired() only in the boundary
- * condition delta == timeout.
- * \see IsExpired
- */
- bool IsExpiring (void) const;
-
- /**
* \returns 0 is no packet is pending, the next packet to send if
* packets are pending.
*/
--- a/src/internet-stack/wscript Sat Feb 28 16:25:24 2009 -0800
+++ b/src/internet-stack/wscript Tue Mar 10 23:47:55 2009 -0700
@@ -1,6 +1,6 @@
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
import os
-import urllib
+import sys
import Options
import Logs
@@ -45,8 +45,11 @@
conf.report_optional_feature("nsc", "Network Simulation Cradle", False,
"NSC not found (see option --with-nsc)")
return
-
- arch = os.uname()[4]
+
+ if sys.platform in ['linux2']:
+ arch = os.uname()[4]
+ else:
+ arch = None
ok = False
if arch == 'x86_64' or arch == 'i686' or arch == 'i586' or arch == 'i486' or arch == 'i386':
conf.env['NSC_ENABLED'] = 'yes'
@@ -108,14 +111,11 @@
'udp-header.h',
'tcp-header.h',
'sequence-number.h',
- 'ipv4-interface.h',
- 'ipv4-l3-protocol.h',
- 'ipv4-static-routing.h',
'ipv4-global-routing.h',
'icmpv4.h',
]
- if bld.env['WITH_NSC']:
+ if bld.env['NSC_ENABLED']:
obj.source.append ('nsc-tcp-socket-impl.cc')
obj.source.append ('nsc-tcp-l4-protocol.cc')
obj.source.append ('nsc-tcp-socket-factory-impl.cc')
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mobility/constant-acceleration-mobility-model.cc Tue Mar 10 23:47:55 2009 -0700
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Gustavo Carneiro <gjc@inescporto.pt>
+ */
+#include "constant-acceleration-mobility-model.h"
+#include "ns3/simulator.h"
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (ConstantAccelerationMobilityModel);
+
+TypeId ConstantAccelerationMobilityModel::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::ConstantAccelerationMobilityModel")
+ .SetParent<MobilityModel> ()
+ .AddConstructor<ConstantAccelerationMobilityModel> ();
+ return tid;
+}
+
+ConstantAccelerationMobilityModel::ConstantAccelerationMobilityModel ()
+{}
+
+ConstantAccelerationMobilityModel::~ConstantAccelerationMobilityModel ()
+{}
+
+inline Vector
+ConstantAccelerationMobilityModel::DoGetVelocity (void) const
+{
+ double t = (Simulator::Now () - m_baseTime).GetSeconds ();
+ return Vector (m_baseVelocity.x + m_acceleration.x*t,
+ m_baseVelocity.y + m_acceleration.y*t,
+ m_baseVelocity.z + m_acceleration.z*t);
+}
+
+inline Vector
+ConstantAccelerationMobilityModel::DoGetPosition (void) const
+{
+ double t = (Simulator::Now () - m_baseTime).GetSeconds ();
+ double half_t_square = t*t*0.5;
+ return Vector (m_basePosition.x + m_baseVelocity.x*t + m_acceleration.x*half_t_square,
+ m_basePosition.y + m_baseVelocity.y*t + m_acceleration.y*half_t_square,
+ m_basePosition.z + m_baseVelocity.z*t + m_acceleration.z*half_t_square);
+}
+
+void
+ConstantAccelerationMobilityModel::DoSetPosition (const Vector &position)
+{
+ m_baseVelocity = DoGetVelocity ();
+ m_baseTime = Simulator::Now ();
+ m_basePosition = position;
+ NotifyCourseChange ();
+}
+
+void
+ConstantAccelerationMobilityModel::SetVelocityAndAcceleration (const Vector &velocity,
+ const Vector &acceleration)
+{
+ m_basePosition = DoGetPosition ();
+ m_baseTime = Simulator::Now ();
+ m_baseVelocity = velocity;
+ m_acceleration = acceleration;
+ NotifyCourseChange ();
+}
+
+
+}; // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mobility/constant-acceleration-mobility-model.h Tue Mar 10 23:47:55 2009 -0700
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Gustavo Carneiro <gjc@inescporto.pt>
+ */
+#ifndef CONSTANT_ACCELERATION_MOBILITY_MODEL_H
+#define CONSTANT_ACCELERATION_MOBILITY_MODEL_H
+
+#include "mobility-model.h"
+#include "ns3/nstime.h"
+
+namespace ns3 {
+
+/**
+ * \brief a position model for which the current acceleration does not
+ * change once it has been set and until it is set again
+ * explicitely to a new value.
+ */
+class ConstantAccelerationMobilityModel : public MobilityModel
+{
+public:
+ static TypeId GetTypeId (void);
+ /**
+ * Create position located at coordinates (0,0,0) with
+ * speed (0,0,0).
+ */
+ ConstantAccelerationMobilityModel ();
+ virtual ~ConstantAccelerationMobilityModel ();
+ void SetVelocityAndAcceleration (const Vector &velocity, const Vector &acceleration);
+
+private:
+ virtual Vector DoGetPosition (void) const;
+ virtual void DoSetPosition (const Vector &position);
+ virtual Vector DoGetVelocity (void) const;
+
+ Time m_baseTime;
+ Vector m_basePosition;
+ Vector m_baseVelocity;
+ Vector m_acceleration;
+};
+
+}; // namespace ns3
+
+#endif /* CONSTANT_ACCELERATION_MOBILITY_MODEL_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mobility/constant-position-mobility-model.cc Tue Mar 10 23:47:55 2009 -0700
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006,2007 INRIA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#include "constant-position-mobility-model.h"
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (ConstantPositionMobilityModel);
+
+TypeId
+ConstantPositionMobilityModel::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::ConstantPositionMobilityModel")
+ .SetParent<MobilityModel> ()
+ .AddConstructor<ConstantPositionMobilityModel> ()
+ ;
+ return tid;
+}
+
+ConstantPositionMobilityModel::ConstantPositionMobilityModel ()
+{}
+ConstantPositionMobilityModel::~ConstantPositionMobilityModel ()
+{}
+
+Vector
+ConstantPositionMobilityModel::DoGetPosition (void) const
+{
+ return m_position;
+}
+void
+ConstantPositionMobilityModel::DoSetPosition (const Vector &position)
+{
+ m_position = position;
+ NotifyCourseChange ();
+}
+Vector
+ConstantPositionMobilityModel::DoGetVelocity (void) const
+{
+ return Vector (0.0, 0.0, 0.0);
+}
+
+}; // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mobility/constant-position-mobility-model.h Tue Mar 10 23:47:55 2009 -0700
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006,2007 INRIA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#ifndef CONSTANT_POSITION_MOBILITY_MODEL_H
+#define CONSTANT_POSITION_MOBILITY_MODEL_H
+
+#include "mobility-model.h"
+#include "vector.h"
+
+namespace ns3 {
+
+/**
+ * \brief a position model for which the current position does not
+ * change once it has been set and until it is set again
+ * explicitely to a new value.
+ */
+class ConstantPositionMobilityModel : public MobilityModel
+{
+public:
+ static TypeId GetTypeId (void);
+ /**
+ * Create a position located at coordinates (0,0,0)
+ */
+ ConstantPositionMobilityModel ();
+ virtual ~ConstantPositionMobilityModel ();
+
+private:
+ virtual Vector DoGetPosition (void) const;
+ virtual void DoSetPosition (const Vector &position);
+ virtual Vector DoGetVelocity (void) const;
+
+ Vector m_position;
+};
+
+}; // namespace ns3
+
+#endif /* CONSTANT_POSITION_MOBILITY_MODEL_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mobility/constant-velocity-helper.cc Tue Mar 10 23:47:55 2009 -0700
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006,2007 INRIA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#include "ns3/simulator.h"
+#include "ns3/rectangle.h"
+#include "constant-velocity-helper.h"
+
+namespace ns3 {
+
+ConstantVelocityHelper::ConstantVelocityHelper ()
+ : m_paused (true)
+{}
+ConstantVelocityHelper::ConstantVelocityHelper (const Vector &position)
+ : m_position (position),
+ m_paused (true)
+{}
+ConstantVelocityHelper::ConstantVelocityHelper (const Vector &position,
+ const Vector &vel)
+ : m_position (position),
+ m_velocity (vel),
+ m_paused (true)
+{}
+void
+ConstantVelocityHelper::SetPosition (const Vector &position)
+{
+ m_position = position;
+ m_velocity = Vector (0.0, 0.0, 0.0);
+ m_lastUpdate = Simulator::Now ();
+}
+
+Vector
+ConstantVelocityHelper::GetCurrentPosition (void) const
+{
+ return m_position;
+}
+
+Vector
+ConstantVelocityHelper::GetVelocity (void) const
+{
+ return m_paused? Vector (0.0, 0.0, 0.0) : m_velocity;
+}
+void
+ConstantVelocityHelper::SetVelocity (const Vector &vel)
+{
+ m_velocity = vel;
+ m_lastUpdate = Simulator::Now ();
+}
+
+void
+ConstantVelocityHelper::Update (void) const
+{
+ Time now = Simulator::Now ();
+ NS_ASSERT (m_lastUpdate <= now);
+ Time deltaTime = now - m_lastUpdate;
+ m_lastUpdate = now;
+ if (m_paused)
+ {
+ return;
+ }
+ double deltaS = deltaTime.GetSeconds ();
+ m_position.x += m_velocity.x * deltaS;
+ m_position.y += m_velocity.y * deltaS;
+ m_position.z += m_velocity.z * deltaS;
+}
+
+void
+ConstantVelocityHelper::UpdateWithBounds (const Rectangle &bounds) const
+{
+ Update ();
+ m_position.x = std::min (bounds.xMax, m_position.x);
+ m_position.x = std::max (bounds.xMin, m_position.x);
+ m_position.y = std::min (bounds.yMax, m_position.y);
+ m_position.y = std::max (bounds.yMin, m_position.y);
+}
+
+void
+ConstantVelocityHelper::Pause (void)
+{
+ m_paused = true;
+}
+
+void
+ConstantVelocityHelper::Unpause (void)
+{
+ m_paused = false;
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mobility/constant-velocity-helper.h Tue Mar 10 23:47:55 2009 -0700
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006,2007 INRIA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#ifndef CONSTANT_VELOCITY_HELPER_H
+#define CONSTANT_VELOCITY_HELPER_H
+
+#include "ns3/nstime.h"
+#include "vector.h"
+
+namespace ns3 {
+
+class Rectangle;
+
+class ConstantVelocityHelper
+{
+ public:
+ ConstantVelocityHelper ();
+ ConstantVelocityHelper (const Vector &position);
+ ConstantVelocityHelper (const Vector &position,
+ const Vector &vel);
+
+ void SetPosition (const Vector &position);
+ Vector GetCurrentPosition (void) const;
+ Vector GetVelocity (void) const;
+ void SetVelocity (const Vector &vel);
+ void Pause (void);
+ void Unpause (void);
+
+ void UpdateWithBounds (const Rectangle &rectangle) const;
+ void Update (void) const;
+ private:
+ mutable Time m_lastUpdate;
+ mutable Vector m_position;
+ Vector m_velocity;
+ bool m_paused;
+};
+
+} // namespace ns3
+
+#endif /* CONSTANT_VELOCITY_HELPER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mobility/constant-velocity-mobility-model.cc Tue Mar 10 23:47:55 2009 -0700
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006, 2007 INRIA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#include "constant-velocity-mobility-model.h"
+#include "ns3/simulator.h"
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (ConstantVelocityMobilityModel);
+
+TypeId ConstantVelocityMobilityModel::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::ConstantVelocityMobilityModel")
+ .SetParent<MobilityModel> ()
+ .AddConstructor<ConstantVelocityMobilityModel> ();
+ return tid;
+}
+
+ConstantVelocityMobilityModel::ConstantVelocityMobilityModel ()
+{}
+
+ConstantVelocityMobilityModel::~ConstantVelocityMobilityModel ()
+{}
+
+void
+ConstantVelocityMobilityModel::SetVelocity (const Vector &speed)
+{
+ m_helper.Update ();
+ m_helper.SetVelocity (speed);
+ m_helper.Unpause ();
+ NotifyCourseChange ();
+}
+
+
+Vector
+ConstantVelocityMobilityModel::DoGetPosition (void) const
+{
+ m_helper.Update ();
+ return m_helper.GetCurrentPosition ();
+}
+void
+ConstantVelocityMobilityModel::DoSetPosition (const Vector &position)
+{
+ m_helper.SetPosition (position);
+ NotifyCourseChange ();
+}
+Vector
+ConstantVelocityMobilityModel::DoGetVelocity (void) const
+{
+ return m_helper.GetVelocity ();
+}
+
+}; // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mobility/constant-velocity-mobility-model.h Tue Mar 10 23:47:55 2009 -0700
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006, 2007 INRIA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#ifndef CONSTANT_VELOCITY_MOBILITY_MODEL_H
+#define CONSTANT_VELOCITY_MOBILITY_MODEL_H
+
+#include <stdint.h>
+#include "mobility-model.h"
+#include "ns3/nstime.h"
+#include "constant-velocity-helper.h"
+
+namespace ns3 {
+
+/**
+ * \brief a position model for which the current speed does not
+ * change once it has been set and until it is set again
+ * explicitely to a new value.
+ */
+class ConstantVelocityMobilityModel : public MobilityModel
+{
+public:
+ static TypeId GetTypeId (void);
+ /**
+ * Create position located at coordinates (0,0,0) with
+ * speed (0,0,0).
+ */
+ ConstantVelocityMobilityModel ();
+ virtual ~ConstantVelocityMobilityModel ();
+
+ /**
+ * \param speed the new speed to set.
+ *
+ * Set the current speed now to (dx,dy,dz)
+ * Unit is meters/s
+ */
+ void SetVelocity (const Vector &speed);
+private:
+ virtual Vector DoGetPosition (void) const;
+ virtual void DoSetPosition (const Vector &position);
+ virtual Vector DoGetVelocity (void) const;
+ void Update (void) const;
+ ConstantVelocityHelper m_helper;
+};
+
+}; // namespace ns3
+
+#endif /* CONSTANT_VELOCITY_POSITION */
--- a/src/mobility/mobility.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/mobility/mobility.h Tue Mar 10 23:47:55 2009 -0700
@@ -9,10 +9,10 @@
* listeners to the course changes of a mobility model
*
* The mobility models themselves are:
- * - ns3::StaticMobilityModel: a model which maintains a constant position
+ * - ns3::ConstantPositionMobilityModel: a model which maintains a constant position
* until it is changed by the user.
*
- * - ns3::StaticSpeedMobilityModel: a model which maintains a constant speed
+ * - ns3::ConstantVelocityMobilityModel: a model which maintains a constant speed
* until it is changed by the user.
*
* - ns3::HierarchicalMobilityModel: a model which calculates the current
--- a/src/mobility/random-direction-2d-mobility-model.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/mobility/random-direction-2d-mobility-model.h Tue Mar 10 23:47:55 2009 -0700
@@ -27,7 +27,7 @@
#include "ns3/rectangle.h"
#include "ns3/random-variable.h"
#include "mobility-model.h"
-#include "static-speed-helper.h"
+#include "constant-velocity-helper.h"
namespace ns3 {
@@ -63,7 +63,7 @@
RandomVariable m_speed;
RandomVariable m_pause;
EventId m_event;
- StaticSpeedHelper m_helper;
+ ConstantVelocityHelper m_helper;
};
} // namespace ns3
--- a/src/mobility/random-walk-2d-mobility-model.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/mobility/random-walk-2d-mobility-model.h Tue Mar 10 23:47:55 2009 -0700
@@ -26,7 +26,7 @@
#include "ns3/rectangle.h"
#include "ns3/random-variable.h"
#include "mobility-model.h"
-#include "static-speed-helper.h"
+#include "constant-velocity-helper.h"
namespace ns3 {
@@ -63,7 +63,7 @@
virtual void DoSetPosition (const Vector &position);
virtual Vector DoGetVelocity (void) const;
- StaticSpeedHelper m_helper;
+ ConstantVelocityHelper m_helper;
EventId m_event;
enum Mode m_mode;
double m_modeDistance;
--- a/src/mobility/random-waypoint-mobility-model.h Sat Feb 28 16:25:24 2009 -0800
+++ b/src/mobility/random-waypoint-mobility-model.h Tue Mar 10 23:47:55 2009 -0700
@@ -20,7 +20,7 @@
#ifndef RANDOM_WAYPOINT_MOBILITY_MODEL_H
#define RANDOM_WAYPOINT_MOBILITY_MODEL_H
-#include "static-speed-helper.h"
+#include "constant-velocity-helper.h"
#include "mobility-model.h"
#include "position-allocator.h"
#include "ns3/ptr.h"
@@ -53,7 +53,7 @@
virtual void DoSetPosition (const Vector &position);
virtual Vector DoGetVelocity (void) const;
- StaticSpeedHelper m_helper;
+ ConstantVelocityHelper m_helper;
Ptr<PositionAllocator> m_position;
RandomVariable m_speed;
RandomVariable m_pause;
--- a/src/mobility/static-mobility-model.cc Sat Feb 28 16:25:24 2009 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006,2007 INRIA
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#include "static-mobility-model.h"
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (StaticMobilityModel);
-
-TypeId
-StaticMobilityModel::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::StaticMobilityModel")
- .SetParent<MobilityModel> ()
- .AddConstructor<StaticMobilityModel> ()
- ;
- return tid;
-}
-
-StaticMobilityModel::StaticMobilityModel ()
-{}
-StaticMobilityModel::~StaticMobilityModel ()
-{}
-
-Vector
-StaticMobilityModel::DoGetPosition (void) const
-{
- return m_position;
-}
-void
-StaticMobilityModel::DoSetPosition (const Vector &position)
-{
- m_position = position;
- NotifyCourseChange ();
-}
-Vector
-StaticMobilityModel::DoGetVelocity (void) const
-{
- return Vector (0.0, 0.0, 0.0);
-}
-
-}; // namespace ns3
--- a/src/mobility/static-mobility-model.h Sat Feb 28 16:25:24 2009 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006,2007 INRIA
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef STATIC_MOBILITY_MODEL_H
-#define STATIC_MOBILITY_MODEL_H
-
-#include "mobility-model.h"
-#include "vector.h"
-
-namespace ns3 {
-
-/**
- * \brief a position model for which the current position does not
- * change once it has been set and until it is set again
- * explicitely to a new value.
- */
-class StaticMobilityModel : public MobilityModel
-{
-public:
- static TypeId GetTypeId (void);
- /**
- * Create a position located at coordinates (0,0,0)
- */
- StaticMobilityModel ();
- virtual ~StaticMobilityModel ();
-
-private:
- virtual Vector DoGetPosition (void) const;
- virtual void DoSetPosition (const Vector &position);
- virtual Vector DoGetVelocity (void) const;
-
- Vector m_position;
-};
-
-}; // namespace ns3
-
-#endif /* STATIC_MOBILITY_MODEL_H */
--- a/src/mobility/static-speed-helper.cc Sat Feb 28 16:25:24 2009 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006,2007 INRIA
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#include "ns3/simulator.h"
-#include "ns3/rectangle.h"
-#include "static-speed-helper.h"
-
-namespace ns3 {
-
-StaticSpeedHelper::StaticSpeedHelper ()
- : m_paused (true)
-{}
-StaticSpeedHelper::StaticSpeedHelper (const Vector &position)
- : m_position (position),
- m_paused (true)
-{}
-StaticSpeedHelper::StaticSpeedHelper (const Vector &position,
- const Vector &vel)
- : m_position (position),
- m_velocity (vel),
- m_paused (true)
-{}
-void
-StaticSpeedHelper::SetPosition (const Vector &position)
-{
- m_position = position;
- m_velocity = Vector (0.0, 0.0, 0.0);
- m_lastUpdate = Simulator::Now ();
-}
-
-Vector
-StaticSpeedHelper::GetCurrentPosition (void) const
-{
- return m_position;
-}
-
-Vector
-StaticSpeedHelper::GetVelocity (void) const
-{
- return m_paused? Vector (0.0, 0.0, 0.0) : m_velocity;
-}
-void
-StaticSpeedHelper::SetVelocity (const Vector &vel)
-{
- m_velocity = vel;
- m_lastUpdate = Simulator::Now ();
-}
-
-void
-StaticSpeedHelper::Update (void) const
-{
- Time now = Simulator::Now ();
- NS_ASSERT (m_lastUpdate <= now);
- Time deltaTime = now - m_lastUpdate;
- m_lastUpdate = now;
- if (m_paused)
- {
- return;
- }
- double deltaS = deltaTime.GetSeconds ();
- m_position.x += m_velocity.x * deltaS;
- m_position.y += m_velocity.y * deltaS;
- m_position.z += m_velocity.z * deltaS;
-}
-
-void
-StaticSpeedHelper::UpdateWithBounds (const Rectangle &bounds) const
-{
- Update ();
- m_position.x = std::min (bounds.xMax, m_position.x);
- m_position.x = std::max (bounds.xMin, m_position.x);
- m_position.y = std::min (bounds.yMax, m_position.y);
- m_position.y = std::max (bounds.yMin, m_position.y);
-}
-
-void
-StaticSpeedHelper::Pause (void)
-{
- m_paused = true;
-}
-
-void
-StaticSpeedHelper::Unpause (void)
-{
- m_paused = false;
-}
-
-} // namespace ns3
--- a/src/mobility/static-speed-helper.h Sat Feb 28 16:25:24 2009 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006,2007 INRIA
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef STATIC_SPEED_HELPER_H
-#define STATIC_SPEED_HELPER_H
-
-#include "ns3/nstime.h"
-#include "vector.h"
-
-namespace ns3 {
-
-class Rectangle;
-
-class StaticSpeedHelper
-{
- public:
- StaticSpeedHelper ();
- StaticSpeedHelper (const Vector &position);
- StaticSpeedHelper (const Vector &position,
- const Vector &vel);
-
- void SetPosition (const Vector &position);
- Vector GetCurrentPosition (void) const;
- Vector GetVelocity (void) const;
- void SetVelocity (const Vector &vel);
- void Pause (void);
- void Unpause (void);
-
- void UpdateWithBounds (const Rectangle &rectangle) const;
- void Update (void) const;
- private:
- mutable Time m_lastUpdate;
- mutable Vector m_position;
- Vector m_velocity;
- bool m_paused;
-};
-
-} // namespace ns3
-
-#endif /* STATIC_SPEED_HELPER_H */
--- a/src/mobility/static-speed-mobility-model.cc Sat Feb 28 16:25:24 2009 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006, 2007 INRIA
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#include "static-speed-mobility-model.h"
-#include "ns3/simulator.h"
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (StaticSpeedMobilityModel);
-
-TypeId StaticSpeedMobilityModel::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::StaticSpeedMobilityModel")
- .SetParent<MobilityModel> ()
- .AddConstructor<StaticSpeedMobilityModel> ();
- return tid;
-}
-
-StaticSpeedMobilityModel::StaticSpeedMobilityModel ()
-{}
-
-StaticSpeedMobilityModel::~StaticSpeedMobilityModel ()
-{}
-
-void
-StaticSpeedMobilityModel::SetVelocity (const Vector &speed)
-{
- m_helper.Update ();
- m_helper.SetVelocity (speed);
- m_helper.Unpause ();
- NotifyCourseChange ();
-}
-
-
-Vector
-StaticSpeedMobilityModel::DoGetPosition (void) const
-{
- m_helper.Update ();
- return m_helper.GetCurrentPosition ();
-}
-void
-StaticSpeedMobilityModel::DoSetPosition (const Vector &position)
-{
- m_helper.SetPosition (position);
- NotifyCourseChange ();
-}
-Vector
-StaticSpeedMobilityModel::DoGetVelocity (void) const
-{
- return m_helper.GetVelocity ();
-}
-
-}; // namespace ns3
--- a/src/mobility/static-speed-mobility-model.h Sat Feb 28 16:25:24 2009 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006, 2007 INRIA
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef STATIC_SPEED_MOBILITY_MODEL_H
-#define STATIC_SPEED_MOBILITY_MODEL_H
-
-#include <stdint.h>
-#include "mobility-model.h"
-#include "ns3/nstime.h"
-#include "static-speed-helper.h"
-
-namespace ns3 {
-
-/**
- * \brief a position model for which the current speed does not
- * change once it has been set and until it is set again
- * explicitely to a new value.
- */
-class StaticSpeedMobilityModel : public MobilityModel
-{
-public:
- static TypeId GetTypeId (void);
- /**
- * Create position located at coordinates (0,0,0) with
- * speed (0,0,0).
- */
- StaticSpeedMobilityModel ();
- virtual ~StaticSpeedMobilityModel ();
-
- /**
- * \param speed the new speed to set.
- *
- * Set the current speed now to (dx,dy,dz)
- * Unit is meters/s
- */
- void SetVelocity (const Vector &speed);
-private:
- virtual Vector DoGetPosition (void) const;
- virtual void DoSetPosition (const Vector &position);
- virtual Vector DoGetVelocity (void) const;
- void Update (void) const;
- StaticSpeedHelper m_helper;
-};
-
-}; // namespace ns3
-
-#endif /* STATIC_SPEED_POSITION */
--- a/src/mobility/wscript Sat Feb 28 16:25:24 2009 -0800
+++ b/src/mobility/wscript Tue Mar 10 23:47:55 2009 -0700
@@ -8,12 +8,13 @@
'mobility-model.cc',
'position-allocator.cc',
'rectangle.cc',
- 'static-mobility-model.cc',
- 'static-speed-helper.cc',
- 'static-speed-mobility-model.cc',
+ 'constant-position-mobility-model.cc',
+ 'constant-velocity-helper.cc',
+ 'constant-velocity-mobility-model.cc',
'random-waypoint-mobility-model.cc',
'random-walk-2d-mobility-model.cc',
'random-direction-2d-mobility-model.cc',
+ 'constant-acceleration-mobility-model.cc',
]
headers = bld.new_task_gen('ns3header')
@@ -24,10 +25,11 @@
'mobility-model.h',
'position-allocator.h',
'rectangle.h',
- 'static-mobility-model.h',
- 'static-speed-helper.h',
- 'static-speed-mobility-model.h',
+ 'constant-position-mobility-model.h',
+ 'constant-velocity-helper.h',
+ 'constant-velocity-mobility-model.h',
'random-waypoint-mobility-model.h',
'random-walk-2d-mobility-model.h',
'random-direction-2d-mobility-model.h',
+ 'constant-acceleration-mobility-model.h',
]