View | Details | Raw Unified | Return to bug 2146
Collapse All | Expand All

(-)ns-allinone-3.23/ns-3.23/src/wave/examples/wave-simple-device.cc (-24 / +18 lines)
 Lines 17-22    Link Here 
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/log.h"
20
#include "ns3/simulator.h"
21
#include "ns3/simulator.h"
21
#include "ns3/node-container.h"
22
#include "ns3/node-container.h"
22
#include "ns3/net-device-container.h"
23
#include "ns3/net-device-container.h"
 Lines 93-103    Link Here 
93
{
94
{
94
  SeqTsHeader seqTs;
95
  SeqTsHeader seqTs;
95
  pkt->PeekHeader (seqTs);
96
  pkt->PeekHeader (seqTs);
96
  std::cout << "receive a packet: " << std::endl
97
  NS_LOG_UNCOND ("  receive a packet: ");
97
            << "  sequence = " << seqTs.GetSeq () << "," << std::endl
98
  NS_LOG_UNCOND ("    sequence = " << seqTs.GetSeq () << ",");
98
            << "  sendTime = " << seqTs.GetTs ().GetSeconds () << "s," << std::endl
99
  NS_LOG_UNCOND ("    sendTime = " << seqTs.GetTs ().GetSeconds () << "s,");
99
            << "  recvTime = " << Now ().GetSeconds () << "s," << std::endl
100
  NS_LOG_UNCOND ("    recvTime = " << Now ().GetSeconds () << "s,");
100
            << "  protocol = 0x" << std::hex << mode << std::dec  << std::endl;
101
  NS_LOG_UNCOND ("    protocol = 0x" << std::hex << mode << std::dec);;
101
  return true;
102
  return true;
102
}
103
}
103
104
 Lines 115-127    Link Here 
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
 Lines 140-158    Link Here 
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 ();
 Lines 216-222    Link Here 
216
bool
210
bool
217
WaveNetDeviceExample::ReceiveVsa (Ptr<const Packet> pkt,const Address & address, uint32_t, uint32_t)
211
WaveNetDeviceExample::ReceiveVsa (Ptr<const Packet> pkt,const Address & address, uint32_t, uint32_t)
218
{
212
{
219
  std::cout << "receive a VSA management frame: recvTime = " << Now ().GetSeconds () << "s." << std::endl;
213
  NS_LOG_UNCOND ( "  receive a VSA management frame: recvTime = " << Now ().GetSeconds () << "s.");
220
  return true;
214
  return true;
221
}
215
}
222
216
 Lines 257-267    Link Here 
257
main (int argc, char *argv[])
251
main (int argc, char *argv[])
258
{
252
{
259
  WaveNetDeviceExample example;
253
  WaveNetDeviceExample example;
260
  std::cout << "run WAVE WSMP routing service case:" << std::endl;
254
  NS_LOG_UNCOND ("run WAVE WSMP routing service case:");
261
  example.SendWsmpExample ();
255
  example.SendWsmpExample ();
262
  std::cout << "run WAVE IP routing service case:" << std::endl;
256
  NS_LOG_UNCOND ("run WAVE IP routing service case:");
263
  //example.SendIpExample ();
257
  example.SendIpExample ();
264
  std::cout << "run WAVE WSA routing service case:" << std::endl;
258
  NS_LOG_UNCOND ("run WAVE WSA routing service case:");
265
  //example.SendWsaExample ();
259
  example.SendWsaExample ();
266
  return 0;
260
  return 0;
267
}
261
}
(-)ns-allinone-3.23/ns-3.23/src/wave/model/default-channel-scheduler.cc (-3 / +8 lines)
 Lines 157-165    Link Here 
157
        }
157
        }
158
    }
158
    }
159
159
160
  // if we need immediately switch SCH in CCHI, or we are in SCHI now,
160
  // if we need immediately switch to AlternatingAccess,
161
  // we switch to specific SCH.
161
  // we switch to specific SCH.
162
  if ((immediate || m_coordinator->IsSchInterval ()))
162
  if ((immediate && m_coordinator->IsSchInterval ()))
163
    {
163
    {
164
      NS_ASSERT (m_channelNumber == CCH);
164
      NS_ASSERT (m_channelNumber == CCH);
165
      SwitchToNextChannel (CCH, sch);
165
      SwitchToNextChannel (CCH, sch);
 Lines 329-335    Link Here 
329
    }
329
    }
330
  // CCH MAC is to attach single-PHY device and wake up for transmission.
330
  // CCH MAC is to attach single-PHY device and wake up for transmission.
331
  Ptr<OcbWifiMac> cchMacEntity = m_device->GetMac (CCH);
331
  Ptr<OcbWifiMac> cchMacEntity = m_device->GetMac (CCH);
332
  m_phy->SetChannelNumber (CCH);
332
  if (Now().GetMilliSeconds() != 0)
333
    {
334
	  m_phy->SetChannelNumber (CCH);
335
	  Time switchTime = m_phy->GetChannelSwitchDelay ();
336
	  cchMacEntity->MakeVirtualBusy (switchTime);
337
    }
333
  cchMacEntity->SetWifiPhy (m_phy);
338
  cchMacEntity->SetWifiPhy (m_phy);
334
  cchMacEntity->Resume ();
339
  cchMacEntity->Resume ();
335
340

Return to bug 2146