|
|
| 17 |
*/ |
17 |
*/ |
| 18 |
#include "ns3/node.h" |
18 |
#include "ns3/node.h" |
| 19 |
#include "ns3/packet.h" |
19 |
#include "ns3/packet.h" |
| 20 |
#include "ns3/simulator.h" |
20 |
#include "ns3/simulator.h" |
| 21 |
#include "ns3/node-container.h" |
21 |
#include "ns3/node-container.h" |
| 22 |
#include "ns3/net-device-container.h" |
22 |
#include "ns3/net-device-container.h" |
| 23 |
|
23 |
|
|
|
| 115 |
seqTs.SetSeq (seq); |
116 |
seqTs.SetSeq (seq); |
| 116 |
p->AddHeader (seqTs); |
117 |
p->AddHeader (seqTs); |
| 117 |
sender->SendX (p, bssWildcard, WSMP_PROT_NUMBER, txInfo); |
118 |
sender->SendX (p, bssWildcard, WSMP_PROT_NUMBER, txInfo); |
| 118 |
|
|
|
| 119 |
Ptr<Packet> p2 = Create<Packet> (100); |
| 120 |
SeqTsHeader seqTs2; |
| 121 |
seqTs2.SetSeq (seq + 1); |
| 122 |
p2->AddHeader (seqTs2); |
| 123 |
receiver->SendX (p2, bssWildcard, WSMP_PROT_NUMBER, txInfo); |
| 124 |
|
| 125 |
} |
119 |
} |
| 126 |
|
120 |
|
| 127 |
void |
121 |
void |
|
|
| 140 |
|
134 |
|
| 141 |
// send WSMP packets |
135 |
// send WSMP packets |
| 142 |
// the first packet will be queued currently and be transmitted in next SCH interval |
136 |
// the first packet will be queued currently and be transmitted in next SCH interval |
| 143 |
//Simulator::Schedule (Seconds (1.0), &WaveNetDeviceExample::SendOneWsmpPacket, this, SCH1, 1); |
137 |
Simulator::Schedule (Seconds (1.0), &WaveNetDeviceExample::SendOneWsmpPacket, this, SCH1, 1); |
| 144 |
// the second packet will be queued currently and then be transmitted , because of in the CCH interval. |
138 |
// the second packet will be queued currently and then be transmitted , because of in the CCH interval. |
| 145 |
Simulator::Schedule (Seconds (1.0), &WaveNetDeviceExample::SendOneWsmpPacket, this, CCH, 2); |
139 |
Simulator::Schedule (Seconds (1.0), &WaveNetDeviceExample::SendOneWsmpPacket, this, CCH, 2); |
| 146 |
// the third packet will be dropped because of no channel access for SCH2. |
140 |
// the third packet will be dropped because of no channel access for SCH2. |
| 147 |
//Simulator::Schedule (Seconds (1.0), &WaveNetDeviceExample::SendOneWsmpPacket, this, SCH2, 3); |
141 |
Simulator::Schedule (Seconds (1.0), &WaveNetDeviceExample::SendOneWsmpPacket, this, SCH2, 3); |
| 148 |
|
142 |
|
| 149 |
// release SCH access |
143 |
// release SCH access |
| 150 |
//Simulator::Schedule (Seconds (2.0), &WaveNetDevice::StopSch, sender, SCH1); |
144 |
Simulator::Schedule (Seconds (2.0), &WaveNetDevice::StopSch, sender, SCH1); |
| 151 |
//Simulator::Schedule (Seconds (2.0), &WaveNetDevice::StopSch, receiver, SCH1); |
145 |
Simulator::Schedule (Seconds (2.0), &WaveNetDevice::StopSch, receiver, SCH1); |
| 152 |
// the fourth packet will be queued and be transmitted because of default CCH access assigned automatically. |
146 |
// the fourth packet will be queued and be transmitted because of default CCH access assigned automatically. |
| 153 |
//Simulator::Schedule (Seconds (3.0), &WaveNetDeviceExample::SendOneWsmpPacket, this, CCH, 4); |
147 |
Simulator::Schedule (Seconds (3.0), &WaveNetDeviceExample::SendOneWsmpPacket, this, CCH, 4); |
| 154 |
// the fifth packet will be dropped because of no SCH1 access assigned |
148 |
// the fifth packet will be dropped because of no SCH1 access assigned |
| 155 |
//Simulator::Schedule (Seconds (3.0), &WaveNetDeviceExample::SendOneWsmpPacket, this, SCH1, 5); |
149 |
Simulator::Schedule (Seconds (3.0), &WaveNetDeviceExample::SendOneWsmpPacket, this, SCH1, 5); |
| 156 |
|
150 |
|
| 157 |
Simulator::Stop (Seconds (5.0)); |
151 |
Simulator::Stop (Seconds (5.0)); |
| 158 |
Simulator::Run (); |
152 |
Simulator::Run (); |
| 159 |
|
153 |
|
|
|
| 257 |
main (int argc, char *argv[]) |
251 |
main (int argc, char *argv[]) |
| 258 |
{ |
252 |
{ |
| 259 |
example.SendWsmpExample (); |
253 |
example.SendWsmpExample (); |
| 260 |
std::cout << "run WAVE IP routing service case:" << std::endl; |
254 |
NS_LOG_UNCOND ("run WAVE IP routing service case:"); |
| 261 |
//example.SendIpExample (); |
255 |
example.SendIpExample (); |
| 262 |
std::cout << "run WAVE WSA routing service case:" << std::endl; |
256 |
NS_LOG_UNCOND ("run WAVE WSA routing service case:"); |
| 263 |
//example.SendWsaExample (); |
257 |
example.SendWsaExample (); |
| 264 |
return 0; |
258 |
return 0; |
| 265 |
} |
259 |
} |