Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2456)

Unified Diff: src/lr-wpan/examples/lr-wpan-data.cc

Issue 338800043: ns-3 - LrWpanMac - Extended Addressing (Closed)
Patch Set: lr-wpan-mac: Prevent ADDR_MODE_RESERVED use as destination address mode Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/lr-wpan/model/lr-wpan-mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lr-wpan/examples/lr-wpan-data.cc
===================================================================
--- a/src/lr-wpan/examples/lr-wpan-data.cc
+++ b/src/lr-wpan/examples/lr-wpan-data.cc
@@ -59,10 +59,12 @@
int main (int argc, char *argv[])
{
bool verbose = false;
+ bool extended = false;
CommandLine cmd;
cmd.AddValue ("verbose", "turn on all log components", verbose);
+ cmd.AddValue ("extended", "use extended addressing", extended);
cmd.Parse (argc, argv);
@@ -82,8 +84,18 @@
Ptr<LrWpanNetDevice> dev0 = CreateObject<LrWpanNetDevice> ();
Ptr<LrWpanNetDevice> dev1 = CreateObject<LrWpanNetDevice> ();
- dev0->SetAddress (Mac16Address ("00:01"));
- dev1->SetAddress (Mac16Address ("00:02"));
+ if (!extended)
+ {
+ dev0->SetAddress (Mac16Address ("00:01"));
+ dev1->SetAddress (Mac16Address ("00:02"));
+ }
+ else
+ {
+ Ptr<LrWpanMac> mac0 = dev0->GetMac();
+ Ptr<LrWpanMac> mac1 = dev1->GetMac();
+ mac0->SetExtendedAddress (Mac64Address ("00:00:00:00:00:00:00:01"));
+ mac1->SetExtendedAddress (Mac64Address ("00:00:00:00:00:00:00:02"));
+ }
// Each device must be attached to the same channel
Ptr<SingleModelSpectrumChannel> channel = CreateObject<SingleModelSpectrumChannel> ();
@@ -138,10 +150,19 @@
// 2) DataIndication callback is called with value of 50
Ptr<Packet> p0 = Create<Packet> (50); // 50 bytes of dummy data
McpsDataRequestParams params;
- params.m_srcAddrMode = SHORT_ADDR;
- params.m_dstAddrMode = SHORT_ADDR;
params.m_dstPanId = 0;
- params.m_dstAddr = Mac16Address ("00:02");
+ if (!extended)
+ {
+ params.m_srcAddrMode = SHORT_ADDR;
+ params.m_dstAddrMode = SHORT_ADDR;
+ params.m_dstAddr = Mac16Address ("00:02");
+ }
+ else
+ {
+ params.m_srcAddrMode = EXT_ADDR;
+ params.m_dstAddrMode = EXT_ADDR;
+ params.m_dstExtAddr = Mac64Address ("00:00:00:00:00:00:00:02");
+ }
params.m_msduHandle = 0;
params.m_txOptions = TX_OPTION_ACK;
// dev0->GetMac ()->McpsDataRequest (params, p0);
@@ -151,7 +172,14 @@
// Send a packet back at time 2 seconds
Ptr<Packet> p2 = Create<Packet> (60); // 60 bytes of dummy data
- params.m_dstAddr = Mac16Address ("00:01");
+ if (!extended)
+ {
+ params.m_dstAddr = Mac16Address ("00:01");
+ }
+ else
+ {
+ params.m_dstExtAddr = Mac64Address ("00:00:00:00:00:00:00:01");
+ }
Simulator::ScheduleWithContext (2, Seconds (2.0),
&LrWpanMac::McpsDataRequest,
dev1->GetMac (), params, p2);
« no previous file with comments | « no previous file | src/lr-wpan/model/lr-wpan-mac.h » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b