|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
18 #include "ns3/command-line.h"
20 #include "ns3/packet.h"
21 #include "ns3/simulator.h"
22 #include "ns3/node-container.h"
23 #include "ns3/net-device-container.h"
24 #include "ns3/yans-wifi-helper.h"
25 #include "ns3/mobility-helper.h"
26 #include "ns3/seq-ts-header.h"
27 #include "ns3/wave-net-device.h"
28 #include "ns3/wave-mac-helper.h"
29 #include "ns3/wave-helper.h"
44 void SendWsmpExample (
void);
47 void SendIpExample (
void);
50 void SendWsaExample (
void);
58 void SendOneWsmpPacket (uint32_t
channel, uint32_t seq);
64 void SendIpPacket (uint32_t seq,
bool ipv6);
82 void CreateWaveNodes (
void);
95 positionAlloc->
Add (Vector (0.0, 0.0, 0.0));
96 positionAlloc->
Add (Vector (5.0, 0.0, 0.0));
97 mobility.SetPositionAllocator (positionAlloc);
98 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
109 for (uint32_t i = 0; i !=
devices.GetN (); ++i)
125 std::cout <<
"receive a packet: " << std::endl
126 <<
" sequence = " << seqTs.
GetSeq () <<
"," << std::endl
127 <<
" sendTime = " << seqTs.
GetTs ().
As (
Time::S) <<
"," << std::endl
128 <<
" recvTime = " <<
Now ().
As (
Time::S) <<
"," << std::endl
129 <<
" protocol = 0x" << std::hex << mode << std::dec << std::endl;
138 const static uint16_t WSMP_PROT_NUMBER = 0x88DC;
146 sender->
SendX (p, bssWildcard, WSMP_PROT_NUMBER, txInfo);
191 const static uint16_t IPv4_PROT_NUMBER = 0x0800;
192 const static uint16_t IPv6_PROT_NUMBER = 0x86DD;
193 uint16_t protocol = ipv6 ? IPv6_PROT_NUMBER : IPv4_PROT_NUMBER;
198 sender->
Send (p, dest, protocol);
241 std::cout <<
"receive a VSA management frame: recvTime = " <<
Now ().
As (
Time::S) <<
"." << std::endl;
279 main (
int argc,
char *argv[])
282 cmd.Parse (argc, argv);
285 std::cout <<
"run WAVE WSMP routing service case:" << std::endl;
287 std::cout <<
"run WAVE IP routing service case:" << std::endl;
289 std::cout <<
"run WAVE WSA routing service case:" << std::endl;
holds a vector of ns3::NetDevice pointers
static YansWifiChannelHelper Default(void)
Create a channel helper in a default working state.
Parse command-line arguments.
void Add(Vector v)
Add a position to the list of positions.
bool DeleteTxProfile(uint32_t channelNumber)
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
void EnablePcap(std::string prefix, Ptr< NetDevice > nd, bool promiscuous=false, bool explicitFilename=false)
Enable pcap output the indicated net device.
#define EXTENDED_ALTERNATING
void SendOneWsmpPacket(uint32_t channel, uint32_t seq)
Send one WSMP packet function.
void AddHeader(const Header &header)
Add header to this packet.
NetDeviceContainer devices
the devices
void SendWsmpExample(void)
Send WSMP example function.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static WaveHelper Default(void)
void SetWaveVsaCallback(WaveVsaCallback vsaCallback)
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
bool RegisterTxProfile(const TxProfile &txprofile)
helps to create WaveNetDevice objects
void SetChannel(Ptr< YansWifiChannel > channel)
bool Receive(Ptr< NetDevice > dev, Ptr< const Packet > pkt, uint16_t mode, const Address &sender)
Receive function.
bool ReceiveVsa(Ptr< const Packet > pkt, const Address &address, uint32_t, uint32_t)
Receive VSA function.
void CreateWaveNodes(void)
Create WAVE nodes function.
static Mac48Address GetBroadcast(void)
Ptr< YansWifiChannel > Create(void) const
Qos Wave Mac Helper class.
static QosWaveMacHelper Default(void)
Create a mac helper in a default working state.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
a polymophic address class
void SendIpExample(void)
Send IP example function.
@ DLT_IEEE802_11
IEEE 802.11 Wireless LAN headers on packets.
bool StartVsa(const VsaInfo &vsaInfo)
To trace WaveNetDevice, we have to overwrite the trace functions of class YansWifiPhyHelper.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
static void Run(void)
Run the simulation.
void SetPcapDataLinkType(SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used.
Time Seconds(double value)
Construct a Time in the indicated unit.
bool StartSch(const SchInfo &schInfo)
static YansWavePhyHelper Default(void)
Create a phy helper in a default working state.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
keep track of a set of node pointers.
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
manage and create wifi channel objects for the YANS model.
This simulation is to show the routing service of WaveNetDevice described in IEEE 09....
bool StopVsa(uint32_t channelNumber)
virtual Address GetAddress(void) const
NodeContainer nodes
the nodes
bool SendX(Ptr< Packet > packet, const Address &dest, uint32_t protocol, const TxInfo &txInfo)
Helper class used to assign positions and mobility models to nodes.
void SendWsaExample(void)
Send WSA example.
void SendIpPacket(uint32_t seq, bool ipv6)
Send IP packet function.
bool StopSch(uint32_t channelNumber)
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
the organization identifier is a public organizationally unique identifier assigned by the IEEE.