--- a/bindings/python/ns3_module_helper.py Tue Nov 04 14:06:26 2008 +0100
+++ b/bindings/python/ns3_module_helper.py Tue Nov 04 14:06:34 2008 +0100
@@ -41,6 +41,12 @@
module.add_class('UdpEchoServerHelper', allow_subclassing=False)
## wifi-helper.h: ns3::WifiHelper [class]
module.add_class('WifiHelper', allow_subclassing=False)
+ ## wifi-helper.h: ns3::WifiPhyHelper [class]
+ module.add_class('WifiPhyHelper', allow_subclassing=False)
+ ## yans-wifi-phy-helper.h: ns3::YansWifiChannelHelper [class]
+ module.add_class('YansWifiChannelHelper', allow_subclassing=False)
+ ## yans-wifi-phy-helper.h: ns3::YansWifiPhyHelper [class]
+ module.add_class('YansWifiPhyHelper', allow_subclassing=False, parent=root_module['ns3::WifiPhyHelper'])
## Register a nested module for the namespace internal
@@ -102,6 +108,9 @@
register_Ns3UdpEchoClientHelper_methods(root_module, root_module['ns3::UdpEchoClientHelper'])
register_Ns3UdpEchoServerHelper_methods(root_module, root_module['ns3::UdpEchoServerHelper'])
register_Ns3WifiHelper_methods(root_module, root_module['ns3::WifiHelper'])
+ register_Ns3WifiPhyHelper_methods(root_module, root_module['ns3::WifiPhyHelper'])
+ register_Ns3YansWifiChannelHelper_methods(root_module, root_module['ns3::YansWifiChannelHelper'])
+ register_Ns3YansWifiPhyHelper_methods(root_module, root_module['ns3::YansWifiPhyHelper'])
return
def register_Ns3ApplicationContainer_methods(root_module, cls):
@@ -672,6 +681,11 @@
cls.add_constructor([param('ns3::WifiHelper const &', 'arg0')])
## wifi-helper.h: ns3::WifiHelper::WifiHelper() [constructor]
cls.add_constructor([])
+ ## wifi-helper.h: static ns3::WifiHelper ns3::WifiHelper::Default() [member function]
+ cls.add_method('Default',
+ 'ns3::WifiHelper',
+ [],
+ is_static=True)
## wifi-helper.h: void ns3::WifiHelper::SetRemoteStationManager(std::string type, std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue(), std::string n5="", ns3::AttributeValue const & v5=ns3::EmptyAttributeValue(), std::string n6="", ns3::AttributeValue const & v6=ns3::EmptyAttributeValue(), std::string n7="", ns3::AttributeValue const & v7=ns3::EmptyAttributeValue()) [member function]
cls.add_method('SetRemoteStationManager',
'void',
@@ -680,60 +694,117 @@
cls.add_method('SetMac',
'void',
[param('std::string', 'type'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()')])
- ## wifi-helper.h: void ns3::WifiHelper::SetPhyAttribute(std::string n0, ns3::AttributeValue const & v0) [member function]
- cls.add_method('SetPhyAttribute',
+ ## wifi-helper.h: ns3::NetDeviceContainer ns3::WifiHelper::Install(ns3::WifiPhyHelper const & phy, ns3::NodeContainer c) const [member function]
+ cls.add_method('Install',
+ 'ns3::NetDeviceContainer',
+ [param('ns3::WifiPhyHelper const &', 'phy'), param('ns3::NodeContainer', 'c')],
+ is_const=True)
+ return
+
+def register_Ns3WifiPhyHelper_methods(root_module, cls):
+ ## wifi-helper.h: ns3::WifiPhyHelper::WifiPhyHelper(ns3::WifiPhyHelper const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::WifiPhyHelper const &', 'arg0')])
+ ## wifi-helper.h: ns3::WifiPhyHelper::WifiPhyHelper() [constructor]
+ cls.add_constructor([])
+ ## wifi-helper.h: ns3::Ptr<ns3::WifiPhy> ns3::WifiPhyHelper::Create(ns3::Ptr<ns3::Node> node, ns3::Ptr<ns3::WifiNetDevice> device) const [member function]
+ cls.add_method('Create',
+ 'ns3::Ptr< ns3::WifiPhy >',
+ [param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::Ptr< ns3::WifiNetDevice >', 'device')],
+ is_pure_virtual=True, is_const=True, is_virtual=True)
+ return
+
+def register_Ns3YansWifiChannelHelper_methods(root_module, cls):
+ ## yans-wifi-phy-helper.h: ns3::YansWifiChannelHelper::YansWifiChannelHelper(ns3::YansWifiChannelHelper const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::YansWifiChannelHelper const &', 'arg0')])
+ ## yans-wifi-phy-helper.h: ns3::YansWifiChannelHelper::YansWifiChannelHelper() [constructor]
+ cls.add_constructor([])
+ ## yans-wifi-phy-helper.h: static ns3::YansWifiChannelHelper ns3::YansWifiChannelHelper::Default() [member function]
+ cls.add_method('Default',
+ 'ns3::YansWifiChannelHelper',
+ [],
+ is_static=True)
+ ## yans-wifi-phy-helper.h: void ns3::YansWifiChannelHelper::AddPropagationLoss(std::string name, std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue(), std::string n5="", ns3::AttributeValue const & v5=ns3::EmptyAttributeValue(), std::string n6="", ns3::AttributeValue const & v6=ns3::EmptyAttributeValue(), std::string n7="", ns3::AttributeValue const & v7=ns3::EmptyAttributeValue()) [member function]
+ cls.add_method('AddPropagationLoss',
+ 'void',
+ [param('std::string', 'name'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()')])
+ ## yans-wifi-phy-helper.h: void ns3::YansWifiChannelHelper::SetPropagationDelay(std::string name, std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue(), std::string n5="", ns3::AttributeValue const & v5=ns3::EmptyAttributeValue(), std::string n6="", ns3::AttributeValue const & v6=ns3::EmptyAttributeValue(), std::string n7="", ns3::AttributeValue const & v7=ns3::EmptyAttributeValue()) [member function]
+ cls.add_method('SetPropagationDelay',
'void',
- [param('std::string', 'n0'), param('ns3::AttributeValue const &', 'v0')])
- ## wifi-helper.h: static void ns3::WifiHelper::EnablePcap(std::string filename, uint32_t nodeid, uint32_t deviceid) [member function]
+ [param('std::string', 'name'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()')])
+ ## yans-wifi-phy-helper.h: ns3::Ptr<ns3::YansWifiChannel> ns3::YansWifiChannelHelper::Create() const [member function]
+ cls.add_method('Create',
+ 'ns3::Ptr< ns3::YansWifiChannel >',
+ [],
+ is_const=True)
+ return
+
+def register_Ns3YansWifiPhyHelper_methods(root_module, cls):
+ ## yans-wifi-phy-helper.h: ns3::YansWifiPhyHelper::YansWifiPhyHelper(ns3::YansWifiPhyHelper const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::YansWifiPhyHelper const &', 'arg0')])
+ ## yans-wifi-phy-helper.h: ns3::YansWifiPhyHelper::YansWifiPhyHelper() [constructor]
+ cls.add_constructor([])
+ ## yans-wifi-phy-helper.h: static ns3::YansWifiPhyHelper ns3::YansWifiPhyHelper::Default() [member function]
+ cls.add_method('Default',
+ 'ns3::YansWifiPhyHelper',
+ [],
+ is_static=True)
+ ## yans-wifi-phy-helper.h: void ns3::YansWifiPhyHelper::SetChannel(ns3::Ptr<ns3::YansWifiChannel> channel) [member function]
+ cls.add_method('SetChannel',
+ 'void',
+ [param('ns3::Ptr< ns3::YansWifiChannel >', 'channel')])
+ ## yans-wifi-phy-helper.h: void ns3::YansWifiPhyHelper::Set(std::string name, ns3::AttributeValue const & v) [member function]
+ cls.add_method('Set',
+ 'void',
+ [param('std::string', 'name'), param('ns3::AttributeValue const &', 'v')])
+ ## yans-wifi-phy-helper.h: void ns3::YansWifiPhyHelper::SetErrorRateModel(std::string name, std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue(), std::string n5="", ns3::AttributeValue const & v5=ns3::EmptyAttributeValue(), std::string n6="", ns3::AttributeValue const & v6=ns3::EmptyAttributeValue(), std::string n7="", ns3::AttributeValue const & v7=ns3::EmptyAttributeValue()) [member function]
+ cls.add_method('SetErrorRateModel',
+ 'void',
+ [param('std::string', 'name'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()')])
+ ## yans-wifi-phy-helper.h: ns3::Ptr<ns3::WifiPhy> ns3::YansWifiPhyHelper::Create(ns3::Ptr<ns3::Node> node, ns3::Ptr<ns3::WifiNetDevice> device) const [member function]
+ cls.add_method('Create',
+ 'ns3::Ptr< ns3::WifiPhy >',
+ [param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::Ptr< ns3::WifiNetDevice >', 'device')],
+ is_const=True, is_virtual=True)
+ ## yans-wifi-phy-helper.h: static void ns3::YansWifiPhyHelper::EnablePcap(std::string filename, uint32_t nodeid, uint32_t deviceid) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'filename'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid')],
is_static=True)
- ## wifi-helper.h: static void ns3::WifiHelper::EnablePcap(std::string filename, ns3::NetDeviceContainer d) [member function]
+ ## yans-wifi-phy-helper.h: static void ns3::YansWifiPhyHelper::EnablePcap(std::string filename, ns3::NetDeviceContainer d) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'filename'), param('ns3::NetDeviceContainer', 'd')],
is_static=True)
- ## wifi-helper.h: static void ns3::WifiHelper::EnablePcap(std::string filename, ns3::NodeContainer n) [member function]
+ ## yans-wifi-phy-helper.h: static void ns3::YansWifiPhyHelper::EnablePcap(std::string filename, ns3::NodeContainer n) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'filename'), param('ns3::NodeContainer', 'n')],
is_static=True)
- ## wifi-helper.h: static void ns3::WifiHelper::EnablePcapAll(std::string filename) [member function]
+ ## yans-wifi-phy-helper.h: static void ns3::YansWifiPhyHelper::EnablePcapAll(std::string filename) [member function]
cls.add_method('EnablePcapAll',
'void',
[param('std::string', 'filename')],
is_static=True)
- ## wifi-helper.h: static void ns3::WifiHelper::EnableAscii(std::ostream & os, uint32_t nodeid, uint32_t deviceid) [member function]
+ ## yans-wifi-phy-helper.h: static void ns3::YansWifiPhyHelper::EnableAscii(std::ostream & os, uint32_t nodeid, uint32_t deviceid) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::ostream &', 'os'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid')],
is_static=True)
- ## wifi-helper.h: static void ns3::WifiHelper::EnableAscii(std::ostream & os, ns3::NetDeviceContainer d) [member function]
+ ## yans-wifi-phy-helper.h: static void ns3::YansWifiPhyHelper::EnableAscii(std::ostream & os, ns3::NetDeviceContainer d) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::ostream &', 'os'), param('ns3::NetDeviceContainer', 'd')],
is_static=True)
- ## wifi-helper.h: static void ns3::WifiHelper::EnableAscii(std::ostream & os, ns3::NodeContainer n) [member function]
+ ## yans-wifi-phy-helper.h: static void ns3::YansWifiPhyHelper::EnableAscii(std::ostream & os, ns3::NodeContainer n) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::ostream &', 'os'), param('ns3::NodeContainer', 'n')],
is_static=True)
- ## wifi-helper.h: static void ns3::WifiHelper::EnableAsciiAll(std::ostream & os) [member function]
+ ## yans-wifi-phy-helper.h: static void ns3::YansWifiPhyHelper::EnableAsciiAll(std::ostream & os) [member function]
cls.add_method('EnableAsciiAll',
'void',
[param('std::ostream &', 'os')],
is_static=True)
- ## wifi-helper.h: ns3::NetDeviceContainer ns3::WifiHelper::Install(ns3::NodeContainer c) const [member function]
- cls.add_method('Install',
- 'ns3::NetDeviceContainer',
- [param('ns3::NodeContainer', 'c')],
- is_const=True)
- ## wifi-helper.h: ns3::NetDeviceContainer ns3::WifiHelper::Install(ns3::NodeContainer c, ns3::Ptr<ns3::WifiChannel> channel) const [member function]
- cls.add_method('Install',
- 'ns3::NetDeviceContainer',
- [param('ns3::NodeContainer', 'c'), param('ns3::Ptr< ns3::WifiChannel >', 'channel')],
- is_const=True)
return
def register_functions(root_module):
--- a/bindings/python/ns3_module_wifi.py Tue Nov 04 14:06:26 2008 +0100
+++ b/bindings/python/ns3_module_wifi.py Tue Nov 04 14:06:34 2008 +0100
@@ -77,6 +77,8 @@
module.add_class('ConstantRateWifiManager', parent=root_module['ns3::WifiRemoteStationManager'])
## propagation-delay-model.h: ns3::ConstantSpeedPropagationDelayModel [class]
module.add_class('ConstantSpeedPropagationDelayModel', parent=root_module['ns3::PropagationDelayModel'])
+ ## error-rate-model.h: ns3::ErrorRateModel [class]
+ module.add_class('ErrorRateModel', parent=root_module['ns3::Object'])
## propagation-loss-model.h: ns3::FriisPropagationLossModel [class]
module.add_class('FriisPropagationLossModel', parent=root_module['ns3::PropagationLossModel'])
## ideal-wifi-manager.h: ns3::IdealWifiManager [class]
@@ -176,6 +178,7 @@
register_Ns3ArfWifiManager_methods(root_module, root_module['ns3::ArfWifiManager'])
register_Ns3ConstantRateWifiManager_methods(root_module, root_module['ns3::ConstantRateWifiManager'])
register_Ns3ConstantSpeedPropagationDelayModel_methods(root_module, root_module['ns3::ConstantSpeedPropagationDelayModel'])
+ register_Ns3ErrorRateModel_methods(root_module, root_module['ns3::ErrorRateModel'])
register_Ns3FriisPropagationLossModel_methods(root_module, root_module['ns3::FriisPropagationLossModel'])
register_Ns3IdealWifiManager_methods(root_module, root_module['ns3::IdealWifiManager'])
register_Ns3JakesPropagationLossModel_methods(root_module, root_module['ns3::JakesPropagationLossModel'])
@@ -1647,6 +1650,14 @@
cls.add_method('SetErrorRateModel',
'void',
[param('ns3::Ptr< ns3::ErrorRateModel >', 'rate')])
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetDevice(ns3::Ptr<ns3::Object> device) [member function]
+ cls.add_method('SetDevice',
+ 'void',
+ [param('ns3::Ptr< ns3::Object >', 'device')])
+ ## yans-wifi-phy.h: void ns3::YansWifiPhy::SetMobility(ns3::Ptr<ns3::Object> mobility) [member function]
+ cls.add_method('SetMobility',
+ 'void',
+ [param('ns3::Ptr< ns3::Object >', 'mobility')])
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetRxNoise() const [member function]
cls.add_method('GetRxNoise',
'double',
@@ -1677,6 +1688,15 @@
'ns3::Ptr< ns3::ErrorRateModel >',
[],
is_const=True)
+ ## yans-wifi-phy.h: ns3::Ptr<ns3::Object> ns3::YansWifiPhy::GetDevice() const [member function]
+ cls.add_method('GetDevice',
+ 'ns3::Ptr< ns3::Object >',
+ [],
+ is_const=True)
+ ## yans-wifi-phy.h: ns3::Ptr<ns3::Object> ns3::YansWifiPhy::GetMobility() [member function]
+ cls.add_method('GetMobility',
+ 'ns3::Ptr< ns3::Object >',
+ [])
## yans-wifi-phy.h: double ns3::YansWifiPhy::GetTxPowerStart() const [member function]
cls.add_method('GetTxPowerStart',
'double',
@@ -2028,6 +2048,28 @@
is_const=True)
return
+def register_Ns3ErrorRateModel_methods(root_module, cls):
+ ## error-rate-model.h: ns3::ErrorRateModel::ErrorRateModel(ns3::ErrorRateModel const & arg0) [copy constructor]
+ cls.add_constructor([param('ns3::ErrorRateModel const &', 'arg0')])
+ ## error-rate-model.h: static ns3::TypeId ns3::ErrorRateModel::GetTypeId() [member function]
+ cls.add_method('GetTypeId',
+ 'ns3::TypeId',
+ [],
+ is_static=True)
+ ## error-rate-model.h: ns3::ErrorRateModel::ErrorRateModel() [constructor]
+ cls.add_constructor([])
+ ## error-rate-model.h: double ns3::ErrorRateModel::CalculateSnr(ns3::WifiMode txMode, double ber) const [member function]
+ cls.add_method('CalculateSnr',
+ 'double',
+ [param('ns3::WifiMode', 'txMode'), param('double', 'ber')],
+ is_const=True)
+ ## error-rate-model.h: double ns3::ErrorRateModel::GetChunkSuccessRate(ns3::WifiMode mode, double snr, uint32_t nbits) const [member function]
+ cls.add_method('GetChunkSuccessRate',
+ 'double',
+ [param('ns3::WifiMode', 'mode'), param('double', 'snr'), param('uint32_t', 'nbits')],
+ is_const=True)
+ return
+
def register_Ns3FriisPropagationLossModel_methods(root_module, cls):
## propagation-loss-model.h: static ns3::TypeId ns3::FriisPropagationLossModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
@@ -2145,14 +2187,10 @@
'double',
[],
is_const=True)
- ## propagation-loss-model.h: void ns3::LogDistancePropagationLossModel::SetReferenceModel(ns3::Ptr<ns3::PropagationLossModel> model) [member function]
- cls.add_method('SetReferenceModel',
+ ## propagation-loss-model.h: void ns3::LogDistancePropagationLossModel::SetReference(double referenceDistance, double referenceLoss) [member function]
+ cls.add_method('SetReference',
'void',
- [param('ns3::Ptr< ns3::PropagationLossModel >', 'model')])
- ## propagation-loss-model.h: void ns3::LogDistancePropagationLossModel::SetReferenceDistance(double referenceDistance) [member function]
- cls.add_method('SetReferenceDistance',
- 'void',
- [param('double', 'referenceDistance')])
+ [param('double', 'referenceDistance'), param('double', 'referenceLoss')])
## propagation-loss-model.h: double ns3::LogDistancePropagationLossModel::DoGetLoss(ns3::Ptr<ns3::MobilityModel> a, ns3::Ptr<ns3::MobilityModel> b) const [member function]
cls.add_method('DoGetLoss',
'double',
@@ -2527,11 +2565,6 @@
'ns3::TypeId',
[],
is_static=True)
- ## wifi-channel.h: ns3::Ptr<ns3::WifiPhy> ns3::WifiChannel::CreatePhy(ns3::Ptr<ns3::WifiNetDevice> device, ns3::Ptr<ns3::Object> mobility, ns3::UnsafeAttributeList list) [member function]
- cls.add_method('CreatePhy',
- 'ns3::Ptr< ns3::WifiPhy >',
- [param('ns3::Ptr< ns3::WifiNetDevice >', 'device'), param('ns3::Ptr< ns3::Object >', 'mobility'), param('ns3::UnsafeAttributeList', 'list')],
- is_pure_virtual=True, is_virtual=True)
return
def register_Ns3WifiNetDevice_methods(root_module, cls):
@@ -2556,10 +2589,6 @@
cls.add_method('SetRemoteStationManager',
'void',
[param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'manager')])
- ## wifi-net-device.h: void ns3::WifiNetDevice::SetChannel(ns3::Ptr<ns3::WifiChannel> channel) [member function]
- cls.add_method('SetChannel',
- 'void',
- [param('ns3::Ptr< ns3::WifiChannel >', 'channel')])
## wifi-net-device.h: ns3::Ptr<ns3::WifiMac> ns3::WifiNetDevice::GetMac() const [member function]
cls.add_method('GetMac',
'ns3::Ptr< ns3::WifiMac >',
@@ -2722,11 +2751,10 @@
'ns3::Ptr< ns3::NetDevice >',
[param('uint32_t', 'i')],
is_const=True, is_virtual=True)
- ## yans-wifi-channel.h: ns3::Ptr<ns3::WifiPhy> ns3::YansWifiChannel::CreatePhy(ns3::Ptr<ns3::WifiNetDevice> device, ns3::Ptr<ns3::Object> mobility, ns3::UnsafeAttributeList list) [member function]
- cls.add_method('CreatePhy',
- 'ns3::Ptr< ns3::WifiPhy >',
- [param('ns3::Ptr< ns3::WifiNetDevice >', 'device'), param('ns3::Ptr< ns3::Object >', 'mobility'), param('ns3::UnsafeAttributeList', 'list')],
- is_virtual=True)
+ ## yans-wifi-channel.h: void ns3::YansWifiChannel::Add(ns3::Ptr<ns3::YansWifiPhy> phy) [member function]
+ cls.add_method('Add',
+ 'void',
+ [param('ns3::Ptr< ns3::YansWifiPhy >', 'phy')])
## yans-wifi-channel.h: void ns3::YansWifiChannel::SetPropagationLossModel(ns3::Ptr<ns3::PropagationLossModel> loss) [member function]
cls.add_method('SetPropagationLossModel',
'void',
--- a/examples/mixed-wireless.cc Tue Nov 04 14:06:26 2008 +0100
+++ b/examples/mixed-wireless.cc Tue Nov 04 14:06:34 2008 +0100
@@ -132,9 +132,12 @@
// Create the backbone wifi net devices and install them into the nodes in
// our container
//
+ YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
+ YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
+ wifiPhy.SetChannel (wifiChannel.Create ());
WifiHelper wifi;
wifi.SetMac ("ns3::AdhocWifiMac");
- NetDeviceContainer backboneDevices = wifi.Install (backbone);
+ NetDeviceContainer backboneDevices = wifi.Install (wifiPhy, backbone);
//
// Add the IPv4 protocol stack to the nodes in our container
//
@@ -243,7 +246,8 @@
//
WifiHelper wifiInfra;
wifiInfra.SetMac ("ns3::AdhocWifiMac");
- NetDeviceContainer infraDevices = wifiInfra.Install (infra);
+ wifiPhy.SetChannel (wifiChannel.Create ());
+ NetDeviceContainer infraDevices = wifiInfra.Install (wifiPhy, infra);
// Add the IPv4 protocol stack to the nodes in our container
//
@@ -330,14 +334,14 @@
//
std::ofstream ascii;
ascii.open ("mixed-wireless.tr");
- WifiHelper::EnableAsciiAll (ascii);
+ YansWifiPhyHelper::EnableAsciiAll (ascii);
CsmaHelper::EnableAsciiAll (ascii);
// Look at nodes 11, 13 only
//WifiHelper::EnableAscii (ascii, 11, 0);
//WifiHelper::EnableAscii (ascii, 13, 0);
// Let's do a pcap trace on the backbone devices
- WifiHelper::EnablePcap ("mixed-wireless", backboneDevices);
+ YansWifiPhyHelper::EnablePcap ("mixed-wireless", backboneDevices);
// Let's additionally trace the application Sink, ifIndex 0
CsmaHelper::EnablePcap ("mixed-wireless", appSink->GetId (), 0);
--- a/examples/stats/wifi-example-sim.cc Tue Nov 04 14:06:26 2008 +0100
+++ b/examples/stats/wifi-example-sim.cc Tue Nov 04 14:06:34 2008 +0100
@@ -129,7 +129,10 @@
NS_LOG_INFO("Installing WiFi and Internet stack.");
WifiHelper wifi;
wifi.SetMac("ns3::AdhocWifiMac");
- NetDeviceContainer nodeDevices = wifi.Install(nodes);
+ YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
+ YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
+ wifiPhy.SetChannel (wifiChannel.Create ());
+ NetDeviceContainer nodeDevices = wifi.Install(wifiPhy, nodes);
InternetStackHelper internet;
internet.Install(nodes);
--- a/examples/wifi-adhoc.cc Tue Nov 04 14:06:26 2008 +0100
+++ b/examples/wifi-adhoc.cc Tue Nov 04 14:06:34 2008 +0100
@@ -36,7 +36,7 @@
public:
Experiment ();
Experiment (std::string name);
- GnuplotDataset Run (const WifiHelper &wifi);
+ GnuplotDataset Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const YansWifiChannelHelper &wifiChannel);
private:
void ReceivePacket (Ptr<Socket> socket);
void SetPosition (Ptr<Node> node, Vector position);
@@ -110,7 +110,7 @@
}
GnuplotDataset
-Experiment::Run (const WifiHelper &wifi)
+Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const YansWifiChannelHelper &wifiChannel)
{
m_bytesTotal = 0;
@@ -120,7 +120,9 @@
PacketSocketHelper packetSocket;
packetSocket.Install (c);
- NetDeviceContainer devices = wifi.Install (c);
+ YansWifiPhyHelper phy = wifiPhy;
+ phy.SetChannel (wifiChannel.Create ());
+ NetDeviceContainer devices = wifi.Install (phy, c);
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
@@ -168,7 +170,9 @@
Gnuplot gnuplot = Gnuplot ("reference-rates.png");
Experiment experiment;
- WifiHelper wifi;
+ WifiHelper wifi = WifiHelper::Default ();
+ YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
+ YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
GnuplotDataset dataset;
wifi.SetMac ("ns3::AdhocWifiMac");
@@ -177,56 +181,56 @@
experiment = Experiment ("54mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("wifia-54mbs"));
- dataset = experiment.Run (wifi);
+ dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("48");
experiment = Experiment ("48mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("wifia-48mbs"));
- dataset = experiment.Run (wifi);
+ dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("36");
experiment = Experiment ("36mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("wifia-36mbs"));
- dataset = experiment.Run (wifi);
+ dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("24");
experiment = Experiment ("24mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("wifia-24mbs"));
- dataset = experiment.Run (wifi);
+ dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("18");
experiment = Experiment ("18mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("wifia-18mbs"));
- dataset = experiment.Run (wifi);
+ dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("12");
experiment = Experiment ("12mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("wifia-12mbs"));
- dataset = experiment.Run (wifi);
+ dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("9");
experiment = Experiment ("9mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("wifia-9mbs"));
- dataset = experiment.Run (wifi);
+ dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("6");
experiment = Experiment ("6mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("wifia-6mbs"));
- dataset = experiment.Run (wifi);
+ dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
gnuplot.AddDataset (dataset);
gnuplot.GenerateOutput (std::cout);
@@ -239,19 +243,19 @@
NS_LOG_DEBUG ("arf");
experiment = Experiment ("arf");
wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
- dataset = experiment.Run (wifi);
+ dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("aarf");
experiment = Experiment ("aarf");
wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
- dataset = experiment.Run (wifi);
+ dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("ideal");
experiment = Experiment ("ideal");
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
- dataset = experiment.Run (wifi);
+ dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
gnuplot.AddDataset (dataset);
gnuplot.GenerateOutput (std::cout);
--- a/examples/wifi-ap.cc Tue Nov 04 14:06:26 2008 +0100
+++ b/examples/wifi-ap.cc Tue Nov 04 14:06:34 2008 +0100
@@ -117,7 +117,7 @@
// disable fragmentation
Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200"));
- WifiHelper wifi;
+ WifiHelper wifi = WifiHelper::Default ();
MobilityHelper mobility;
NodeContainer stas;
NodeContainer ap;
@@ -131,23 +131,21 @@
packetSocket.Install (stas);
packetSocket.Install (ap);
- Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
- channel->SetPropagationDelayModel (CreateObject<ConstantSpeedPropagationDelayModel> ());
- Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> ();
- channel->SetPropagationLossModel (log);
-
+ YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
+ YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
+ wifiPhy.SetChannel (wifiChannel.Create ());
Ssid ssid = Ssid ("wifi-default");
wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
// setup stas.
wifi.SetMac ("ns3::NqstaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
- staDevs = wifi.Install (stas, channel);
+ staDevs = wifi.Install (wifiPhy, stas);
// setup ap.
wifi.SetMac ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true),
"BeaconInterval", TimeValue (Seconds (2.5)));
- wifi.Install (ap, channel);
+ wifi.Install (wifiPhy, ap);
// mobility.
mobility.Install (stas);
--- a/examples/wifi-wired-bridging.cc Tue Nov 04 14:06:26 2008 +0100
+++ b/examples/wifi-wired-bridging.cc Tue Nov 04 14:06:34 2008 +0100
@@ -14,16 +14,6 @@
using namespace ns3;
-Ptr<WifiChannel>
-CreateChannel (void)
-{
- Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
- channel->SetPropagationDelayModel (CreateObject<ConstantSpeedPropagationDelayModel> ());
- Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> ();
- channel->SetPropagationLossModel (log);
- return channel;
-}
-
int main (int argc, char *argv[])
{
uint32_t nWifis = 2;
@@ -73,11 +63,12 @@
Ipv4InterfaceContainer apInterface;
MobilityHelper mobility;
BridgeHelper bridge;
- WifiHelper wifi;
- Ptr<WifiChannel> channel;
+ WifiHelper wifi = WifiHelper::Default ();
+ YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
+ YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
+ wifiPhy.SetChannel (wifiChannel.Create ());
sta.Create (nStas);
- channel = CreateChannel ();
ip.NewNetwork ();
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
"MinX", DoubleValue (wifiX),
@@ -95,7 +86,7 @@
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true),
"BeaconInterval", TimeValue (Seconds (2.5)));
- apDev = wifi.Install (backboneNodes.Get (i), channel);
+ apDev = wifi.Install (wifiPhy, backboneNodes.Get (i));
apInterface = ip.Assign (apDev);
bridge.Install (backboneNodes.Get (i), NetDeviceContainer (apDev, backboneDevices.Get (i)));
@@ -110,7 +101,7 @@
wifi.SetMac ("ns3::NqstaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
- staDev = wifi.Install (sta, channel);
+ staDev = wifi.Install (wifiPhy, sta);
staInterface = ip.Assign (staDev);
// save everything in containers.
@@ -149,8 +140,8 @@
apps.Stop (Seconds (3.0));
- WifiHelper::EnablePcap ("wifi-wire-bridging", staNodes[1].Get (1));
- WifiHelper::EnablePcap ("wifi-wire-bridging", staNodes[0].Get (0));
+ YansWifiPhyHelper::EnablePcap ("wifi-wire-bridging", staNodes[1].Get (1));
+ YansWifiPhyHelper::EnablePcap ("wifi-wire-bridging", staNodes[0].Get (0));
std::ofstream os;
os.open ("wifi-wire-bridging.mob");
MobilityHelper::EnableAsciiAll (os);
--- a/src/devices/wifi/interference-helper.cc Tue Nov 04 14:06:26 2008 +0100
+++ b/src/devices/wifi/interference-helper.cc Tue Nov 04 14:06:34 2008 +0100
@@ -104,10 +104,9 @@
****************************************************************/
InterferenceHelper::InterferenceHelper ()
- : m_80211a (false)
-{
- m_errorRateModel = Create<ErrorRateModel> ();
-}
+ : m_80211a (false),
+ m_errorRateModel (0)
+{}
InterferenceHelper::~InterferenceHelper ()
{
m_errorRateModel = 0;
--- a/src/devices/wifi/wifi-channel.h Tue Nov 04 14:06:26 2008 +0100
+++ b/src/devices/wifi/wifi-channel.h Tue Nov 04 14:06:34 2008 +0100
@@ -43,10 +43,6 @@
{
public:
static TypeId GetTypeId (void);
-
- virtual Ptr<WifiPhy> CreatePhy (Ptr<WifiNetDevice> device,
- Ptr<Object> mobility,
- UnsafeAttributeList list) = 0;
};
} // namespace ns3
--- a/src/devices/wifi/wifi-net-device.cc Tue Nov 04 14:06:26 2008 +0100
+++ b/src/devices/wifi/wifi-net-device.cc Tue Nov 04 14:06:34 2008 +0100
@@ -40,8 +40,7 @@
.SetParent<NetDevice> ()
.AddAttribute ("Channel", "The channel attached to this device",
PointerValue (),
- MakePointerAccessor (&WifiNetDevice::DoGetChannel,
- &WifiNetDevice::SetChannel),
+ MakePointerAccessor (&WifiNetDevice::DoGetChannel),
MakePointerChecker<WifiChannel> ())
.AddAttribute ("Phy", "The PHY layer attached to this device.",
PointerValue (),
@@ -67,7 +66,8 @@
}
WifiNetDevice::WifiNetDevice ()
- : m_mtu (0)
+ : m_mtu (0),
+ m_configComplete (false)
{}
WifiNetDevice::~WifiNetDevice ()
{}
@@ -81,67 +81,48 @@
m_stationManager->Dispose ();
m_mac = 0;
m_phy = 0;
- m_channel = 0;
m_stationManager = 0;
// chain up.
NetDevice::DoDispose ();
}
+
+void
+WifiNetDevice::CompleteConfig (void)
+{
+ if (m_mac == 0 ||
+ m_phy == 0 ||
+ m_stationManager == 0 ||
+ m_node == 0 ||
+ m_configComplete)
+ {
+ return;
+ }
+ m_mac->SetWifiRemoteStationManager (m_stationManager);
+ m_mac->SetWifiPhy (m_phy);
+ m_mac->SetForwardUpCallback (MakeCallback (&WifiNetDevice::ForwardUp, this));
+ m_mac->SetLinkUpCallback (MakeCallback (&WifiNetDevice::LinkUp, this));
+ m_mac->SetLinkDownCallback (MakeCallback (&WifiNetDevice::LinkDown, this));
+ m_stationManager->SetupPhy (m_phy);
+ m_configComplete = true;
+}
void
WifiNetDevice::SetMac (Ptr<WifiMac> mac)
{
m_mac = mac;
- if (m_mac != 0)
- {
- if (m_stationManager != 0)
- {
- m_mac->SetWifiRemoteStationManager (m_stationManager);
- }
- if (m_phy != 0)
- {
- m_mac->SetWifiPhy (m_phy);
- }
- m_mac->SetForwardUpCallback (MakeCallback (&WifiNetDevice::ForwardUp, this));
- m_mac->SetLinkUpCallback (MakeCallback (&WifiNetDevice::LinkUp, this));
- m_mac->SetLinkDownCallback (MakeCallback (&WifiNetDevice::LinkDown, this));
- }
+ CompleteConfig ();
}
void
WifiNetDevice::SetPhy (Ptr<WifiPhy> phy)
{
m_phy = phy;
- if (m_phy != 0)
- {
- if (m_stationManager != 0)
- {
- m_stationManager->SetupPhy (m_phy);
- }
- if (m_mac != 0)
- {
- m_mac->SetWifiPhy (m_phy);
- }
- }
+ CompleteConfig ();
}
void
WifiNetDevice::SetRemoteStationManager (Ptr<WifiRemoteStationManager> manager)
{
m_stationManager = manager;
- if (m_stationManager != 0)
- {
- if (m_phy != 0)
- {
- m_stationManager->SetupPhy (m_phy);
- }
- if (m_mac != 0)
- {
- m_mac->SetWifiRemoteStationManager (m_stationManager);
- }
- }
-}
-void
-WifiNetDevice::SetChannel (Ptr<WifiChannel> channel)
-{
- m_channel = channel;
+ CompleteConfig ();
}
Ptr<WifiMac>
WifiNetDevice::GetMac (void) const
@@ -182,12 +163,12 @@
Ptr<Channel>
WifiNetDevice::GetChannel (void) const
{
- return m_channel;
+ return m_phy->GetChannel ();
}
Ptr<WifiChannel>
WifiNetDevice::DoGetChannel (void) const
{
- return m_channel;
+ return m_phy->GetChannel ();
}
Address
WifiNetDevice::GetAddress (void) const
@@ -282,6 +263,7 @@
WifiNetDevice::SetNode (Ptr<Node> node)
{
m_node = node;
+ CompleteConfig ();
}
bool
WifiNetDevice::NeedsArp (void) const
--- a/src/devices/wifi/wifi-net-device.h Tue Nov 04 14:06:26 2008 +0100
+++ b/src/devices/wifi/wifi-net-device.h Tue Nov 04 14:06:34 2008 +0100
@@ -61,10 +61,6 @@
*/
void SetRemoteStationManager (Ptr<WifiRemoteStationManager> manager);
/**
- * \param channel the channel to connect to.
- */
- void SetChannel (Ptr<WifiChannel> channel);
- /**
* \returns the mac we are currently using.
*/
Ptr<WifiMac> GetMac (void) const;
@@ -112,9 +108,10 @@
void LinkDown (void);
void Setup (void);
Ptr<WifiChannel> DoGetChannel (void) const;
+ void CompleteConfig (void);
+
Ptr<Node> m_node;
Ptr<WifiPhy> m_phy;
- Ptr<WifiChannel> m_channel;
Ptr<WifiMac> m_mac;
Ptr<WifiRemoteStationManager> m_stationManager;
NetDevice::ReceiveCallback m_forwardUp;
@@ -126,6 +123,7 @@
bool m_linkUp;
Callback<void> m_linkChange;
mutable uint16_t m_mtu;
+ bool m_configComplete;
};
} // namespace ns3
--- a/src/devices/wifi/wifi-phy-test.cc Tue Nov 04 14:06:26 2008 +0100
+++ b/src/devices/wifi/wifi-phy-test.cc Tue Nov 04 14:06:34 2008 +0100
@@ -3,6 +3,7 @@
#include "yans-wifi-phy.h"
#include "propagation-loss-model.h"
#include "propagation-delay-model.h"
+#include "error-rate-model.h"
#include "ns3/ptr.h"
#include "ns3/mobility-model.h"
#include "ns3/static-mobility-model.h"
@@ -83,8 +84,16 @@
Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> ();
channel->SetPropagationLossModel (log);
- Ptr<WifiPhy> tx = channel->CreatePhy (0, posTx, UnsafeAttributeList ());
- Ptr<WifiPhy> rx = channel->CreatePhy (0, posRx, UnsafeAttributeList ());
+ Ptr<YansWifiPhy> tx = CreateObject<YansWifiPhy> ();
+ Ptr<YansWifiPhy> rx = CreateObject<YansWifiPhy> ();
+ Ptr<ErrorRateModel> error = CreateObject<ErrorRateModel> ();
+ tx->SetErrorRateModel (error);
+ rx->SetErrorRateModel (error);
+ tx->SetChannel (channel);
+ rx->SetChannel (channel);
+ tx->SetMobility (posTx);
+ rx->SetMobility (posRx);
+
rx->SetReceiveOkCallback (MakeCallback (&PsrExperiment::Receive, this));
for (uint32_t i = 0; i < m_input.nPackets; ++i)
@@ -204,9 +213,22 @@
Ptr<MobilityModel> posRx = CreateObject<StaticMobilityModel> ();
posRx->SetPosition (Vector (0, 0.0, 0.0));
- Ptr<WifiPhy> txA = channel->CreatePhy (0, posTxA, UnsafeAttributeList ());
- Ptr<WifiPhy> txB = channel->CreatePhy (0, posTxB, UnsafeAttributeList ());
- Ptr<WifiPhy> rx = channel->CreatePhy (0, posRx, UnsafeAttributeList ());
+ Ptr<YansWifiPhy> txA = CreateObject<YansWifiPhy> ();
+ Ptr<YansWifiPhy> txB = CreateObject<YansWifiPhy> ();
+ Ptr<YansWifiPhy> rx = CreateObject<YansWifiPhy> ();
+
+ Ptr<ErrorRateModel> error = CreateObject<ErrorRateModel> ();
+ txA->SetErrorRateModel (error);
+ txB->SetErrorRateModel (error);
+ rx->SetErrorRateModel (error);
+ txA->SetChannel (channel);
+ txB->SetChannel (channel);
+ rx->SetChannel (channel);
+ txA->SetMobility (posTxA);
+ txB->SetMobility (posTxB);
+ rx->SetMobility (posRx);
+
+
rx->SetReceiveOkCallback (MakeCallback (&CollisionExperiment::Receive, this));
for (uint32_t i = 0; i < m_input.nPackets; ++i)
--- a/src/devices/wifi/wifi-phy.h Tue Nov 04 14:06:26 2008 +0100
+++ b/src/devices/wifi/wifi-phy.h Tue Nov 04 14:06:34 2008 +0100
@@ -35,6 +35,7 @@
namespace ns3 {
class WifiChannel;
+class NetDevice;
/**
* \brief receive notifications about phy events.
@@ -231,12 +232,11 @@
* \returns the mode whose index is specified.
*/
virtual WifiMode GetMode (uint32_t mode) const = 0;
- /* return snr: W/W */
/**
* \param txMode the transmission mode
* \param ber the probability of bit error rate
* \returns the minimum snr which is required to achieve
- * the requested ber for the specified transmission mode.
+ * the requested ber for the specified transmission mode. (W/W)
*/
virtual double CalculateSnr (WifiMode txMode, double ber) const = 0;
--- a/src/devices/wifi/wifi-test.cc Tue Nov 04 14:06:26 2008 +0100
+++ b/src/devices/wifi/wifi-test.cc Tue Nov 04 14:06:34 2008 +0100
@@ -7,6 +7,7 @@
#include "arf-wifi-manager.h"
#include "propagation-delay-model.h"
#include "propagation-loss-model.h"
+#include "error-rate-model.h"
#include "ns3/static-mobility-model.h"
#include "ns3/node.h"
#include "ns3/simulator.h"
@@ -23,7 +24,7 @@
virtual bool RunTests (void);
private:
void RunOne (void);
- void CreateOne (Vector pos, Ptr<WifiChannel> channel);
+ void CreateOne (Vector pos, Ptr<YansWifiChannel> channel);
void SendOnePacket (Ptr<WifiNetDevice> dev);
ObjectFactory m_manager;
@@ -43,14 +44,19 @@
}
void
-WifiTest::CreateOne (Vector pos, Ptr<WifiChannel> channel)
+WifiTest::CreateOne (Vector pos, Ptr<YansWifiChannel> channel)
{
Ptr<Node> node = CreateObject<Node> ();
Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> ();
Ptr<WifiMac> mac = m_mac.Create<WifiMac> ();
Ptr<StaticMobilityModel> mobility = CreateObject<StaticMobilityModel> ();
- Ptr<WifiPhy> phy = channel->CreatePhy (dev, mobility, UnsafeAttributeList ());
+ Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> ();
+ Ptr<ErrorRateModel> error = CreateObject<ErrorRateModel> ();
+ phy->SetErrorRateModel (error);
+ phy->SetChannel (channel);
+ phy->SetDevice (dev);
+ phy->SetMobility (node);
Ptr<WifiRemoteStationManager> manager = m_manager.Create<WifiRemoteStationManager> ();
mobility->SetPosition (pos);
@@ -59,7 +65,6 @@
dev->SetMac (mac);
dev->SetPhy (phy);
dev->SetRemoteStationManager (manager);
- dev->SetChannel (channel);
node->AddDevice (dev);
Simulator::Schedule (Seconds (1.0), &WifiTest::SendOnePacket, this, dev);
--- a/src/devices/wifi/wscript Tue Nov 04 14:06:26 2008 +0100
+++ b/src/devices/wifi/wscript Tue Nov 04 14:06:34 2008 +0100
@@ -74,6 +74,7 @@
'nqap-wifi-mac.h',
'wifi-phy.h',
'supported-rates.h',
+ 'error-rate-model.h',
]
obj = bld.create_ns3_program('wifi-phy-test',
--- a/src/devices/wifi/yans-wifi-channel.cc Tue Nov 04 14:06:26 2008 +0100
+++ b/src/devices/wifi/yans-wifi-channel.cc Tue Nov 04 14:06:34 2008 +0100
@@ -27,7 +27,6 @@
#include "ns3/object-factory.h"
#include "yans-wifi-channel.h"
#include "yans-wifi-phy.h"
-#include "wifi-net-device.h"
#include "propagation-loss-model.h"
#include "propagation-delay-model.h"
@@ -57,7 +56,7 @@
{}
YansWifiChannel::~YansWifiChannel ()
{
- m_deviceList.clear ();
+ m_phyList.clear ();
}
void
@@ -75,22 +74,14 @@
YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
WifiMode wifiMode, WifiPreamble preamble) const
{
- Ptr<MobilityModel> senderMobility = 0;
- for (DeviceList::const_iterator i = m_deviceList.begin (); i != m_deviceList.end (); i++)
- {
- if (sender == i->phy)
- {
- senderMobility = i->mobility->GetObject<MobilityModel> ();
- break;
- }
- }
+ Ptr<MobilityModel> senderMobility = sender->GetMobility ()->GetObject<MobilityModel> ();
NS_ASSERT (senderMobility != 0);
uint32_t j = 0;
- for (DeviceList::const_iterator i = m_deviceList.begin (); i != m_deviceList.end (); i++)
+ for (PhyList::const_iterator i = m_phyList.begin (); i != m_phyList.end (); i++)
{
- if (sender != i->phy)
+ if (sender != (*i))
{
- Ptr<MobilityModel> receiverMobility = i->mobility->GetObject<MobilityModel> ();
+ Ptr<MobilityModel> receiverMobility = (*i)->GetMobility ()->GetObject<MobilityModel> ();
Time delay = m_delay->GetDelay (senderMobility, receiverMobility);
double rxPowerDbm = txPowerDbm + m_loss->GetLoss (senderMobility, receiverMobility);
NS_LOG_DEBUG ("propagation: txPower="<<txPowerDbm<<"dbm, rxPower="<<rxPowerDbm<<"dbm, "<<
@@ -105,38 +96,26 @@
void
YansWifiChannel::Receive (uint32_t i, Ptr<Packet> packet, double rxPowerDbm,
- WifiMode txMode, WifiPreamble preamble) const
+ WifiMode txMode, WifiPreamble preamble) const
{
- m_deviceList[i].phy->StartReceivePacket (packet, rxPowerDbm, txMode, preamble);
+ m_phyList[i]->StartReceivePacket (packet, rxPowerDbm, txMode, preamble);
}
uint32_t
YansWifiChannel::GetNDevices (void) const
{
- return m_deviceList.size ();
+ return m_phyList.size ();
}
Ptr<NetDevice>
YansWifiChannel::GetDevice (uint32_t i) const
{
- return m_deviceList[i].device;
+ return m_phyList[i]->GetDevice ()->GetObject<NetDevice> ();
}
-Ptr<WifiPhy>
-YansWifiChannel::CreatePhy (Ptr<WifiNetDevice> device,
- Ptr<Object> mobility,
- UnsafeAttributeList list)
+void
+YansWifiChannel::Add (Ptr<YansWifiPhy> phy)
{
- ObjectFactory factory;
- factory.SetTypeId ("ns3::YansWifiPhy");
- factory.Set (list.GetSafe ("ns3::YansWifiPhy"));
- Ptr<YansWifiPhy> phy = factory.Create<YansWifiPhy> ();
- phy->SetChannel (this);
- struct Item item;
- item.device = device;
- item.phy = phy;
- item.mobility = mobility;
- m_deviceList.push_back (item);
- return phy;
+ m_phyList.push_back (phy);
}
} // namespace ns3
--- a/src/devices/wifi/yans-wifi-channel.h Tue Nov 04 14:06:26 2008 +0100
+++ b/src/devices/wifi/yans-wifi-channel.h Tue Nov 04 14:06:34 2008 +0100
@@ -30,7 +30,6 @@
namespace ns3 {
class NetDevice;
-class WifiNetDevice;
class PropagationLossModel;
class PropagationDelayModel;
class YansWifiPhy;
@@ -58,10 +57,7 @@
virtual uint32_t GetNDevices (void) const;
virtual Ptr<NetDevice> GetDevice (uint32_t i) const;
- // inherited from WifiChannel
- virtual Ptr<WifiPhy> CreatePhy (Ptr<WifiNetDevice> device,
- Ptr<Object> mobility,
- UnsafeAttributeList list);
+ void Add (Ptr<YansWifiPhy> phy);
/**
* \param loss the new propagation loss model.
@@ -86,17 +82,12 @@
WifiMode wifiMode, WifiPreamble preamble) const;
private:
- struct Item {
- Ptr<WifiNetDevice> device;
- Ptr<YansWifiPhy> phy;
- Ptr<Object> mobility;
- };
- typedef std::vector<struct Item> DeviceList;
+ typedef std::vector<Ptr<YansWifiPhy> > PhyList;
void Receive (uint32_t i, Ptr<Packet> packet, double rxPowerDbm,
WifiMode txMode, WifiPreamble preamble) const;
- DeviceList m_deviceList;
+ PhyList m_phyList;
Ptr<PropagationLossModel> m_loss;
Ptr<PropagationDelayModel> m_delay;
};
--- a/src/devices/wifi/yans-wifi-phy.cc Tue Nov 04 14:06:26 2008 +0100
+++ b/src/devices/wifi/yans-wifi-phy.cc Tue Nov 04 14:06:34 2008 +0100
@@ -33,6 +33,7 @@
#include "ns3/uinteger.h"
#include "ns3/enum.h"
#include "ns3/pointer.h"
+#include "ns3/net-device.h"
#include <math.h>
NS_LOG_COMPONENT_DEFINE ("YansWifiPhy");
@@ -130,6 +131,7 @@
NS_LOG_FUNCTION (this);
m_channel = 0;
m_modes.clear ();
+ m_device = 0;
}
void
@@ -204,6 +206,17 @@
{
m_interference.SetErrorRateModel (rate);
}
+void
+YansWifiPhy::SetDevice (Ptr<Object> device)
+{
+ m_device = device;
+}
+void
+YansWifiPhy::SetMobility (Ptr<Object> mobility)
+{
+ m_mobility = mobility;
+}
+
double
YansWifiPhy::GetRxNoise (void) const
{
@@ -247,6 +260,16 @@
{
return m_interference.GetErrorRateModel ();
}
+Ptr<Object>
+YansWifiPhy::GetDevice (void) const
+{
+ return m_device;
+}
+Ptr<Object>
+YansWifiPhy::GetMobility (void)
+{
+ return m_mobility;
+}
double
YansWifiPhy::CalculateSnr (WifiMode txMode, double ber) const
@@ -259,11 +282,11 @@
{
return m_channel;
}
-
void
YansWifiPhy::SetChannel (Ptr<YansWifiChannel> channel)
{
m_channel = channel;
+ m_channel->Add (this);
}
void
--- a/src/devices/wifi/yans-wifi-phy.h Tue Nov 04 14:06:26 2008 +0100
+++ b/src/devices/wifi/yans-wifi-phy.h Tue Nov 04 14:06:34 2008 +0100
@@ -84,12 +84,16 @@
void SetEdThreshold (double threshold);
void SetCcaMode1Threshold (double threshold);
void SetErrorRateModel (Ptr<ErrorRateModel> rate);
+ void SetDevice (Ptr<Object> device);
+ void SetMobility (Ptr<Object> mobility);
double GetRxNoise (void) const;
double GetTxGain (void) const;
double GetRxGain (void) const;
double GetEdThreshold (void) const;
double GetCcaMode1Threshold (void) const;
Ptr<ErrorRateModel> GetErrorRateModel (void) const;
+ Ptr<Object> GetDevice (void) const;
+ Ptr<Object> GetMobility (void);
virtual double GetTxPowerStart (void) const;
@@ -139,6 +143,8 @@
uint32_t m_nTxPower;
Ptr<YansWifiChannel> m_channel;
+ Ptr<Object> m_device;
+ Ptr<Object> m_mobility;
Modes m_modes;
EventId m_endSyncEvent;
UniformVariable m_random;
--- a/src/helper/wifi-helper.cc Tue Nov 04 14:06:26 2008 +0100
+++ b/src/helper/wifi-helper.cc Tue Nov 04 14:06:34 2008 +0100
@@ -29,8 +29,6 @@
#include "ns3/mobility-model.h"
#include "ns3/log.h"
#include "ns3/pcap-writer.h"
-#include "ns3/wifi-mode.h"
-#include "ns3/wifi-preamble.h"
#include "ns3/config.h"
#include "ns3/simulator.h"
@@ -40,40 +38,20 @@
namespace ns3 {
-static void PcapPhyTxEvent (Ptr<PcapWriter> writer, Ptr<const Packet> packet,
- WifiMode mode, WifiPreamble preamble,
- uint8_t txLevel)
-{
- writer->WritePacket (packet);
-}
-
-static void PcapPhyRxEvent (Ptr<PcapWriter> writer,
- Ptr<const Packet> packet, double snr, WifiMode mode,
- enum WifiPreamble preamble)
-{
- writer->WritePacket (packet);
-}
-
-static void AsciiPhyTxEvent (std::ostream *os, std::string context,
- Ptr<const Packet> packet,
- WifiMode mode, WifiPreamble preamble,
- uint8_t txLevel)
-{
- *os << "+ " << Simulator::Now () << " " << context << " " << *packet << std::endl;
-}
-
-static void AsciiPhyRxOkEvent (std::ostream *os, std::string context,
- Ptr<const Packet> packet, double snr, WifiMode mode,
- enum WifiPreamble preamble)
-{
- *os << "r " << Simulator::Now () << " " << context << " " << *packet << std::endl;
-}
+WifiPhyHelper::~WifiPhyHelper ()
+{}
WifiHelper::WifiHelper ()
+{}
+
+WifiHelper
+WifiHelper::Default (void)
{
- m_stationManager.SetTypeId ("ns3::ArfWifiManager");
- m_mac.SetTypeId ("ns3::AdhocWifiMac");
+ WifiHelper helper;
+ helper.SetRemoteStationManager ("ns3::ArfWifiManager");
+ helper.SetMac ("ns3::AdhocWifiMac");
+ return helper;
}
void
@@ -122,130 +100,21 @@
m_mac.Set (n7, v7);
}
-void
-WifiHelper::SetPhyAttribute (std::string name, const AttributeValue &value)
-{
- m_phyAttributes.Set (name, value);
-}
-
-void
-WifiHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid)
-{
- std::ostringstream oss;
- oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/";
- 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->WriteWifiHeader ();
- oss.str ("");
- oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/Tx";
- Config::ConnectWithoutContext (oss.str (), MakeBoundCallback (&PcapPhyTxEvent, pcap));
- oss.str ("");
- oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/RxOk";
- Config::ConnectWithoutContext (oss.str (), MakeBoundCallback (&PcapPhyRxEvent, 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 ());
-}
-
-void
-WifiHelper::EnableAscii (std::ostream &os, uint32_t nodeid, uint32_t deviceid)
-{
- Packet::EnablePrinting ();
- std::ostringstream oss;
- oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/RxOk";
- Config::Connect (oss.str (), MakeBoundCallback (&AsciiPhyRxOkEvent, &os));
- oss.str ("");
- oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/Tx";
- Config::Connect (oss.str (), MakeBoundCallback (&AsciiPhyTxEvent, &os));
-}
-void
-WifiHelper::EnableAscii (std::ostream &os, NetDeviceContainer d)
-{
- for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i)
- {
- Ptr<NetDevice> dev = *i;
- EnableAscii (os, dev->GetNode ()->GetId (), dev->GetIfIndex ());
- }
-}
-void
-WifiHelper::EnableAscii (std::ostream &os, 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));
- }
- }
- EnableAscii (os, devs);
-}
-
-void
-WifiHelper::EnableAsciiAll (std::ostream &os)
-{
- EnableAscii (os, NodeContainer::GetGlobal ());
-}
-
-NetDeviceContainer
-WifiHelper::Install (NodeContainer c) const
-{
- Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
- channel->SetPropagationDelayModel (CreateObject<ConstantSpeedPropagationDelayModel> ());
- Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> ();
- channel->SetPropagationLossModel (log);
- return Install (c, channel);
-}
-NetDeviceContainer
-WifiHelper::Install (NodeContainer c, Ptr<WifiChannel> channel) const
+NetDeviceContainer
+WifiHelper::Install (const WifiPhyHelper &phyHelper, NodeContainer c) const
{
NetDeviceContainer devices;
- for (NodeContainer::Iterator i = c.Begin (); i != c.End (); i++)
+ for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
{
Ptr<Node> node = *i;
Ptr<WifiNetDevice> device = CreateObject<WifiNetDevice> ();
Ptr<WifiRemoteStationManager> manager = m_stationManager.Create<WifiRemoteStationManager> ();
Ptr<WifiMac> mac = m_mac.Create<WifiMac> ();
- Ptr<WifiPhy> phy = channel->CreatePhy (device, node, m_phyAttributes);
+ Ptr<WifiPhy> phy = phyHelper.Create (node, device);
mac->SetAddress (Mac48Address::Allocate ());
device->SetMac (mac);
device->SetPhy (phy);
device->SetRemoteStationManager (manager);
- device->SetChannel (channel);
node->AddDevice (device);
devices.Add (device);
NS_LOG_DEBUG ("node="<<node<<", mob="<<node->GetObject<MobilityModel> ());
@@ -253,4 +122,5 @@
return devices;
}
+
} // namespace ns3
--- a/src/helper/wifi-helper.h Tue Nov 04 14:06:26 2008 +0100
+++ b/src/helper/wifi-helper.h Tue Nov 04 14:06:34 2008 +0100
@@ -28,7 +28,16 @@
namespace ns3 {
-class WifiChannel;
+class WifiPhy;
+class WifiNetDevice;
+class Node;
+
+class WifiPhyHelper
+{
+public:
+ virtual ~WifiPhyHelper ();
+ virtual Ptr<WifiPhy> Create (Ptr<Node> node, Ptr<WifiNetDevice> device) const = 0;
+};
/**
* \brief helps to create WifiNetDevice objects
@@ -42,6 +51,8 @@
public:
WifiHelper ();
+ static WifiHelper Default (void);
+
/**
* \param type the type of ns3::WifiRemoteStationManager to create.
* \param n0 the name of the attribute to set
@@ -106,125 +117,11 @@
std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
- /**
- * \param name the name of the attribute to set
- * \param value the value of the attribute to set
- *
- */
- void SetPhyAttribute (std::string n0, const AttributeValue &v0);
-
-
-
- /**
- * \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);
-
- /**
- * \param os output stream
- * \param nodeid the id of the node to generate ascii output for.
- * \param deviceid the id of the device to generate ascii output for.
- *
- * Enable ascii output on the specified deviceid within the
- * specified nodeid if it is of type ns3::WifiNetDevice and dump
- * 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
- *
- * Enable ascii output on each device which is of the
- * ns3::WifiNetDevice type and which is located in the input
- * device container and dump that to the specified
- * stdc++ output stream.
- */
- static void EnableAscii (std::ostream &os, NetDeviceContainer d);
- /**
- * \param os output stream
- * \param n node container
- *
- * Enable ascii output on each device which is of the
- * ns3::WifiNetDevice type and which is located in one
- * of the input node and dump that to the specified
- * stdc++ output stream.
- */
- static void EnableAscii (std::ostream &os, NodeContainer n);
- /**
- * \param os output stream
- *
- * Enable ascii output on each device which is of the
- * ns3::WifiNetDevice type and dump that to the specified
- * stdc++ output stream.
- */
- static void EnableAsciiAll (std::ostream &os);
-
- /**
- * \param c a set of nodes
- *
- * This method creates a simple ns3::WifiChannel (with a default
- * ns3::PropagationLossModel and ns3::PropagationDelayModel) and
- * creates, for each of the input nodes, a new ns3::WifiNetDevice
- * attached to this shared channel. Each ns3::WifiNetDevice is also
- * configured with an ns3::WifiRemoteStationManager, ns3::WifiMac, and,
- * ns3::WifiPhy, all of which are created based on the user-specified
- * attributes specified in WifiHelper::SetRemoteStationManager,
- * WifiHelper::SetMac, and, WifiHelper::SetPhy.
- */
- NetDeviceContainer Install (NodeContainer c) const;
- /**
- * \param channel a channel to use
- * \param c a set of nodes
- *
- * For each of the input nodes, a new ns3::WifiNetDevice is attached
- * to the shared input channel. Each ns3::WifiNetDevice is also
- * configured with an ns3::WifiRemoteStationManager, ns3::WifiMac, and,
- * ns3::WifiPhy, all of which are created based on the user-specified
- * attributes specified in WifiHelper::SetRemoteStationManager,
- * WifiHelper::SetMac, and, WifiHelper::SetPhy.
- *
- * The user is expected to attach to the input channel a proper
- * ns3::PropagationLossModel, and ns3::PropagationDelayModel.
- */
- NetDeviceContainer Install (NodeContainer c, Ptr<WifiChannel> channel) const;
+ NetDeviceContainer Install (const WifiPhyHelper &phy, NodeContainer c) const;
private:
ObjectFactory m_stationManager;
ObjectFactory m_mac;
- UnsafeAttributeList m_phyAttributes;
};
} // namespace ns3
--- a/src/helper/wscript Tue Nov 04 14:06:26 2008 +0100
+++ b/src/helper/wscript Tue Nov 04 14:06:34 2008 +0100
@@ -21,6 +21,7 @@
'ipv4-interface-container.cc',
'udp-echo-helper.cc',
'bridge-helper.cc',
+ 'yans-wifi-phy-helper.cc',
]
headers = bld.create_obj('ns3header')
@@ -44,4 +45,5 @@
'ipv4-interface-container.h',
'udp-echo-helper.h',
'bridge-helper.h',
+ 'yans-wifi-phy-helper.h',
]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/helper/yans-wifi-phy-helper.cc Tue Nov 04 14:06:34 2008 +0100
@@ -0,0 +1,305 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 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 "yans-wifi-phy-helper.h"
+#include "ns3/error-rate-model.h"
+#include "ns3/propagation-loss-model.h"
+#include "ns3/propagation-delay-model.h"
+#include "ns3/yans-wifi-channel.h"
+#include "ns3/yans-wifi-phy.h"
+#include "ns3/wifi-net-device.h"
+#include "ns3/pcap-writer.h"
+#include "ns3/simulator.h"
+#include "ns3/config.h"
+
+namespace ns3 {
+
+static void PcapPhyTxEvent (Ptr<PcapWriter> writer, Ptr<const Packet> packet,
+ WifiMode mode, WifiPreamble preamble,
+ uint8_t txLevel)
+{
+ writer->WritePacket (packet);
+}
+
+static void PcapPhyRxEvent (Ptr<PcapWriter> writer,
+ Ptr<const Packet> packet, double snr, WifiMode mode,
+ enum WifiPreamble preamble)
+{
+ writer->WritePacket (packet);
+}
+
+static void AsciiPhyTxEvent (std::ostream *os, std::string context,
+ Ptr<const Packet> packet,
+ WifiMode mode, WifiPreamble preamble,
+ uint8_t txLevel)
+{
+ *os << "+ " << Simulator::Now () << " " << context << " " << *packet << std::endl;
+}
+
+static void AsciiPhyRxOkEvent (std::ostream *os, std::string context,
+ Ptr<const Packet> packet, double snr, WifiMode mode,
+ enum WifiPreamble preamble)
+{
+ *os << "r " << Simulator::Now () << " " << context << " " << *packet << std::endl;
+}
+
+
+YansWifiChannelHelper::YansWifiChannelHelper ()
+{}
+
+YansWifiChannelHelper
+YansWifiChannelHelper::Default (void)
+{
+ YansWifiChannelHelper helper;
+ helper.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
+ helper.AddPropagationLoss ("ns3::LogDistancePropagationLossModel");
+ return helper;
+}
+
+void
+YansWifiChannelHelper::AddPropagationLoss (std::string type,
+ std::string n0, const AttributeValue &v0,
+ std::string n1, const AttributeValue &v1,
+ std::string n2, const AttributeValue &v2,
+ std::string n3, const AttributeValue &v3,
+ std::string n4, const AttributeValue &v4,
+ std::string n5, const AttributeValue &v5,
+ std::string n6, const AttributeValue &v6,
+ std::string n7, const AttributeValue &v7)
+{
+ ObjectFactory factory;
+ factory.SetTypeId (type);
+ factory.Set (n0, v0);
+ factory.Set (n1, v1);
+ factory.Set (n2, v2);
+ factory.Set (n3, v3);
+ factory.Set (n4, v4);
+ factory.Set (n5, v5);
+ factory.Set (n6, v6);
+ factory.Set (n7, v7);
+ m_propagationLoss.push_back (factory);
+}
+
+void
+YansWifiChannelHelper::SetPropagationDelay (std::string type,
+ std::string n0, const AttributeValue &v0,
+ std::string n1, const AttributeValue &v1,
+ std::string n2, const AttributeValue &v2,
+ std::string n3, const AttributeValue &v3,
+ std::string n4, const AttributeValue &v4,
+ std::string n5, const AttributeValue &v5,
+ std::string n6, const AttributeValue &v6,
+ std::string n7, const AttributeValue &v7)
+{
+ ObjectFactory factory;
+ factory.SetTypeId (type);
+ factory.Set (n0, v0);
+ factory.Set (n1, v1);
+ factory.Set (n2, v2);
+ factory.Set (n3, v3);
+ factory.Set (n4, v4);
+ factory.Set (n5, v5);
+ factory.Set (n6, v6);
+ factory.Set (n7, v7);
+ m_propagationDelay = factory;
+}
+
+Ptr<YansWifiChannel>
+YansWifiChannelHelper::Create (void) const
+{
+ Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
+ Ptr<PropagationLossModel> prev = 0;
+ for (std::vector<ObjectFactory>::const_iterator i = m_propagationLoss.begin (); i != m_propagationLoss.end (); ++i)
+ {
+ Ptr<PropagationLossModel> cur = (*i).Create<PropagationLossModel> ();
+ if (prev != 0)
+ {
+ prev->SetNext (cur);
+ prev = cur;
+ }
+ if (m_propagationLoss.begin () == i)
+ {
+ channel->SetPropagationLossModel (cur);
+ }
+ }
+ Ptr<PropagationDelayModel> delay = m_propagationDelay.Create<PropagationDelayModel> ();
+ channel->SetPropagationDelayModel (delay);
+ return channel;
+}
+
+
+YansWifiPhyHelper::YansWifiPhyHelper ()
+ : m_channel (0)
+{
+ m_phy.SetTypeId ("ns3::YansWifiPhy");
+}
+
+YansWifiPhyHelper
+YansWifiPhyHelper::Default (void)
+{
+ YansWifiPhyHelper helper;
+ helper.SetErrorRateModel ("ns3::ErrorRateModel");
+ return helper;
+}
+
+void
+YansWifiPhyHelper::SetChannel (Ptr<YansWifiChannel> channel)
+{
+ m_channel = channel;
+}
+void
+YansWifiPhyHelper::Set (std::string name, const AttributeValue &v)
+{
+ m_phy.Set (name, v);
+}
+
+void
+YansWifiPhyHelper::SetErrorRateModel (std::string name,
+ std::string n0, const AttributeValue &v0,
+ std::string n1, const AttributeValue &v1,
+ std::string n2, const AttributeValue &v2,
+ std::string n3, const AttributeValue &v3,
+ std::string n4, const AttributeValue &v4,
+ std::string n5, const AttributeValue &v5,
+ std::string n6, const AttributeValue &v6,
+ std::string n7, const AttributeValue &v7)
+{
+ m_errorRateModel = ObjectFactory ();
+ m_errorRateModel.SetTypeId (name);
+ m_errorRateModel.Set (n0, v0);
+ m_errorRateModel.Set (n1, v1);
+ m_errorRateModel.Set (n2, v2);
+ m_errorRateModel.Set (n3, v3);
+ m_errorRateModel.Set (n4, v4);
+ m_errorRateModel.Set (n5, v5);
+ m_errorRateModel.Set (n6, v6);
+ m_errorRateModel.Set (n7, v7);
+}
+
+
+Ptr<WifiPhy>
+YansWifiPhyHelper::Create (Ptr<Node> node, Ptr<WifiNetDevice> device) const
+{
+ Ptr<YansWifiPhy> phy = m_phy.Create<YansWifiPhy> ();
+ Ptr<ErrorRateModel> error = m_errorRateModel.Create<ErrorRateModel> ();
+ phy->SetErrorRateModel (error);
+ phy->SetChannel (m_channel);
+ phy->SetMobility (node);
+ phy->SetDevice (device);
+ return phy;
+}
+
+void
+YansWifiPhyHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid)
+{
+ std::ostringstream oss;
+ oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/";
+ Config::MatchContainer matches = Config::LookupMatches (oss.str ());
+ if (matches.GetN () == 0)
+ {
+ return;
+ }
+ oss.str ("");
+ oss << filename << "-" << nodeid << "-" << deviceid << ".pcap";
+ // we must fully-qualify the call to Create below because it conflicts
+ // with the locally-defined WifiPhyHelper::Create method.
+ Ptr<PcapWriter> pcap = ::ns3::Create<PcapWriter> ();
+ pcap->Open (oss.str ());
+ pcap->WriteWifiHeader ();
+ oss.str ("");
+ oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/Tx";
+ Config::ConnectWithoutContext (oss.str (), MakeBoundCallback (&PcapPhyTxEvent, pcap));
+ oss.str ("");
+ oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/RxOk";
+ Config::ConnectWithoutContext (oss.str (), MakeBoundCallback (&PcapPhyRxEvent, pcap));
+}
+void
+YansWifiPhyHelper::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
+YansWifiPhyHelper::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
+YansWifiPhyHelper::EnablePcapAll (std::string filename)
+{
+ EnablePcap (filename, NodeContainer::GetGlobal ());
+}
+
+void
+YansWifiPhyHelper::EnableAscii (std::ostream &os, uint32_t nodeid, uint32_t deviceid)
+{
+ Packet::EnablePrinting ();
+ std::ostringstream oss;
+ oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/RxOk";
+ Config::Connect (oss.str (), MakeBoundCallback (&AsciiPhyRxOkEvent, &os));
+ oss.str ("");
+ oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/Tx";
+ Config::Connect (oss.str (), MakeBoundCallback (&AsciiPhyTxEvent, &os));
+}
+void
+YansWifiPhyHelper::EnableAscii (std::ostream &os, NetDeviceContainer d)
+{
+ for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i)
+ {
+ Ptr<NetDevice> dev = *i;
+ EnableAscii (os, dev->GetNode ()->GetId (), dev->GetIfIndex ());
+ }
+}
+void
+YansWifiPhyHelper::EnableAscii (std::ostream &os, 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));
+ }
+ }
+ EnableAscii (os, devs);
+}
+
+void
+YansWifiPhyHelper::EnableAsciiAll (std::ostream &os)
+{
+ EnableAscii (os, NodeContainer::GetGlobal ());
+}
+
+
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/helper/yans-wifi-phy-helper.h Tue Nov 04 14:06:34 2008 +0100
@@ -0,0 +1,167 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 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 YANS_WIFI_PHY_HELPER_H
+#define YANS_WIFI_PHY_HELPER_H
+
+#include "wifi-helper.h"
+#include "ns3/yans-wifi-channel.h"
+
+namespace ns3 {
+
+class YansWifiChannelHelper
+{
+public:
+ YansWifiChannelHelper ();
+
+ static YansWifiChannelHelper Default (void);
+
+ void AddPropagationLoss (std::string name,
+ std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
+ std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
+ std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
+ std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
+ std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
+ std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
+ std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
+ std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
+ void SetPropagationDelay (std::string name,
+ std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
+ std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
+ std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
+ std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
+ std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
+ std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
+ std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
+ std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
+
+ Ptr<YansWifiChannel> Create (void) const;
+
+private:
+ std::vector<ObjectFactory> m_propagationLoss;
+ ObjectFactory m_propagationDelay;
+};
+
+class YansWifiPhyHelper : public WifiPhyHelper
+{
+public:
+ YansWifiPhyHelper ();
+
+ static YansWifiPhyHelper Default (void);
+
+ void SetChannel (Ptr<YansWifiChannel> channel);
+ void Set (std::string name, const AttributeValue &v);
+ void SetErrorRateModel (std::string name,
+ std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
+ std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
+ std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
+ std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
+ std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
+ std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
+ std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
+ std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
+
+ virtual Ptr<WifiPhy> Create (Ptr<Node> node, Ptr<WifiNetDevice> device) 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);
+
+ /**
+ * \param os output stream
+ * \param nodeid the id of the node to generate ascii output for.
+ * \param deviceid the id of the device to generate ascii output for.
+ *
+ * Enable ascii output on the specified deviceid within the
+ * specified nodeid if it is of type ns3::WifiNetDevice and dump
+ * 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
+ *
+ * Enable ascii output on each device which is of the
+ * ns3::WifiNetDevice type and which is located in the input
+ * device container and dump that to the specified
+ * stdc++ output stream.
+ */
+ static void EnableAscii (std::ostream &os, NetDeviceContainer d);
+ /**
+ * \param os output stream
+ * \param n node container
+ *
+ * Enable ascii output on each device which is of the
+ * ns3::WifiNetDevice type and which is located in one
+ * of the input node and dump that to the specified
+ * stdc++ output stream.
+ */
+ static void EnableAscii (std::ostream &os, NodeContainer n);
+ /**
+ * \param os output stream
+ *
+ * Enable ascii output on each device which is of the
+ * ns3::WifiNetDevice type and dump that to the specified
+ * stdc++ output stream.
+ */
+ static void EnableAsciiAll (std::ostream &os);
+
+private:
+ ObjectFactory m_phy;
+ ObjectFactory m_errorRateModel;
+ Ptr<YansWifiChannel> m_channel;
+};
+
+} // namespace ns3
+
+#endif /* YANS_WIFI_PHY_HELPER_H */