27 #include "ns3/command-line.h"    28 #include "ns3/config-store.h"    29 #include "ns3/config.h"    30 #include "ns3/boolean.h"    31 #include "ns3/uinteger.h"    32 #include "ns3/string.h"    34 #include "ns3/yans-wifi-phy.h"    35 #include "ns3/yans-wifi-helper.h"    36 #include "ns3/wifi-net-device.h"    60 int main (
int argc, 
char *argv[])
    62   uint32_t testCase = 0;
    63   bool printAttributes = 
false;
    64   bool exceptionThrown = 
false;
    67   cmd.AddValue (
"testCase", 
"Test case", testCase);
    68   cmd.AddValue (
"printAttributes", 
"If true, print out attributes", printAttributes);
    69   cmd.Parse (argc, argv);
    80   wifi.SetRemoteStationManager (
"ns3::IdealWifiManager");
    84   ssid = 
Ssid (
"wifi-phy-configuration");
    86   macSta.
SetType (
"ns3::StaWifiMac",
    90   macAp.
SetType (
"ns3::ApWifiMac",
   105       phySta = CreateObject<YansWifiPhy> ();
   116       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   127       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   138       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   149       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   160       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   171       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   182       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   193       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   204       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   216       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   228       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   240       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   252       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   256       Config::Set (
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber", 
UintegerValue (40));
   257       Config::Set (
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber", 
UintegerValue (40));
   267       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   271       Config::Set (
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber", 
UintegerValue (46));
   272       Config::Set (
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber", 
UintegerValue (46));
   281       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   285       Config::Set (
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber", 
UintegerValue (46));
   286       Config::Set (
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber", 
UintegerValue (46));
   296       exceptionThrown = 
false;
   299           staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   301       catch (
const std::runtime_error&)
   303           exceptionThrown = 
true;
   306       exceptionThrown = 
false;
   311       catch (
const std::runtime_error&)
   313           exceptionThrown = 
true;
   323       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   335       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   338       exceptionThrown = 
false;
   343       catch (
const std::runtime_error&)
   345           exceptionThrown = 
true;
   353       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   356       exceptionThrown = 
false;
   361       catch (
const std::runtime_error&)
   363           exceptionThrown = 
true;
   372       exceptionThrown = 
false;
   377       catch (
const std::runtime_error&)
   379           exceptionThrown = 
true;
   394       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   402       staDevice = 
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
   423       exceptionThrown = 
false;
   428       catch (
const std::runtime_error&)
   430           exceptionThrown = 
true;
   439       exceptionThrown = 
false;
   444       catch (
const std::runtime_error&)
   446           exceptionThrown = 
true;
   456       std::cerr << 
"Invalid testcase number " << testCase << std::endl;
   Introspection did not find any typical Config paths. 
 
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index. 
 
void SetType(std::string type, Args &&... args)
 
  AttributeValue implementation for Boolean. 
 
Hold variables of type string. 
 
Make it easy to create and manage PHY objects for the YANS model. 
 
static YansWifiChannelHelper Default(void)
Create a channel helper in a default working state. 
 
void Set(std::string path, const AttributeValue &value)
 
void SetOperatingChannel(uint8_t number, uint16_t frequency, uint16_t width)
Set the operating channel according to the specified parameters. 
 
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
 
void PrintAttributesIfEnabled(bool enabled)
 
helps to create WifiNetDevice objects 
 
uint16_t GetChannelWidth(void) const
 
  AttributeValue implementation for Time. 
 
Hold an unsigned integer type. 
 
holds a vector of ns3::NetDevice pointers 
 
Hold together all Wifi-related objects. 
 
Parse command-line arguments. 
 
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy(). 
 
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object. 
 
Ptr< WifiPhy > GetPhy(void) const
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
keep track of a set of node pointers. 
 
uint16_t GetFrequency(void) const
 
802.11 PHY layer modelThis PHY implements a model of 802.11a. 
 
Ptr< YansWifiPhy > GetYansWifiPhyPtr(const NetDeviceContainer &nc)
 
manage and create wifi channel objects for the YANS model. 
 
uint8_t GetChannelNumber(void) const
Return current channel number. 
 
create MAC layers for a ns3::WifiNetDevice. 
 
bool IsSet(void) const
Return true if a valid channel has been set, false otherwise. 
 
The IEEE 802.11 SSID Information Element. 
 
void ConfigureAttributes(void)
Configure the attribute values. 
 
  AttributeValue implementation for Ssid. 
 
void SetDefault(std::string name, const AttributeValue &value)
 
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index. 
 
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit. 
 
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer. 
 
const WifiPhyOperatingChannel & GetOperatingChannel(void) const
Get a const reference to the operating channel. 
 
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.