25 #include "ns3/boolean.h"
26 #include "ns3/channel.h"
27 #include "ns3/ipv6-extension-header.h"
28 #include "ns3/ipv6-l3-protocol.h"
30 #include "ns3/mac16-address.h"
31 #include "ns3/mac48-address.h"
32 #include "ns3/mac64-address.h"
34 #include "ns3/packet.h"
35 #include "ns3/pointer.h"
36 #include "ns3/simulator.h"
37 #include "ns3/string.h"
38 #include "ns3/udp-header.h"
39 #include "ns3/udp-l4-protocol.h"
40 #include "ns3/uinteger.h"
55 TypeId(
"ns3::SixLowPanNetDevice")
57 .SetGroupName(
"SixLowPan")
59 .AddAttribute(
"Rfc6282",
60 "Use RFC6282 (IPHC) if true, RFC4944 (HC1) otherwise.",
64 .AddAttribute(
"OmitUdpChecksum",
65 "Omit the UDP checksum in IPHC compression.",
70 "FragmentReassemblyListSize",
71 "The maximum size of the reassembly buffer (in packets). Zero meaning infinite.",
74 MakeUintegerChecker<uint16_t>())
76 "FragmentExpirationTimeout",
77 "When this timeout expires, the fragments will be cleared from the buffer.",
81 .AddAttribute(
"CompressionThreshold",
82 "The minimum MAC layer payload size.",
85 MakeUintegerChecker<uint32_t>())
86 .AddAttribute(
"UseMeshUnder",
87 "Use a mesh-under routing protocol.",
91 .AddAttribute(
"MeshUnderRadius",
92 "Hops Left to use in mesh-under.",
95 MakeUintegerChecker<uint8_t>())
96 .AddAttribute(
"MeshCacheLength",
97 "Length of the cache for each source.",
100 MakeUintegerChecker<uint16_t>())
101 .AddAttribute(
"MeshUnderJitter",
102 "The jitter in ms a node uses to forward mesh-under packets - used to "
103 "prevent collisions",
104 StringValue(
"ns3::UniformRandomVariable[Min=0.0|Max=10.0]"),
106 MakePointerChecker<RandomVariableStream>())
107 .AddTraceSource(
"Tx",
108 "Send - packet (including 6LoWPAN header), "
109 "SixLoWPanNetDevice Ptr, interface index.",
111 "ns3::SixLowPanNetDevice::RxTxTracedCallback")
112 .AddTraceSource(
"Rx",
113 "Receive - packet (including 6LoWPAN header), "
114 "SixLoWPanNetDevice Ptr, interface index.",
116 "ns3::SixLowPanNetDevice::RxTxTracedCallback")
117 .AddTraceSource(
"Drop",
118 "Drop - DropReason, packet (including 6LoWPAN header), "
119 "SixLoWPanNetDevice Ptr, interface index.",
121 "ns3::SixLowPanNetDevice::DropTracedCallback");
127 m_netDevice(nullptr),
132 m_rng = CreateObject<UniformRandomVariable>();
149 NS_LOG_DEBUG(
"RegisterProtocolHandler for " << device->GetInstanceTypeId().GetName());
152 if (device->GetInstanceTypeId().GetName() ==
"ns3::LrWpanNetDevice")
190 iter->second =
nullptr;
205 NS_LOG_FUNCTION(
this << incomingPort << packet << protocol << src << dst);
207 uint8_t dispatchRawVal = 0;
213 copyPkt->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
215 bool isPktDecompressed =
false;
216 bool fragmented =
false;
220 NS_LOG_DEBUG(
"Dispatches: " <<
int(dispatchRawVal) <<
" - " <<
int(dispatchVal));
224 bool hasMesh =
false;
231 copyPkt->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
238 copyPkt->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
246 NS_LOG_LOGIC(
"Dropped packet - we only support mesh if it is paired with a BC0");
255 NS_LOG_LOGIC(
"We have already seen this, no further processing.");
266 "SixLowPan mesh-under flooding can not currently handle extended address "
267 "final destinations: "
270 "SixLowPan mesh-under flooding can not currently handle devices using "
271 "extended addresses: "
284 NS_LOG_LOGIC(
"Not forwarding packet -- hop limit reached");
288 NS_LOG_LOGIC(
"Not forwarding packet -- I am the originator");
331 if (!isPktDecompressed)
337 copyPkt->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
349 isPktDecompressed =
true;
359 isPktDecompressed =
true;
373 isPktDecompressed =
true;
377 NS_LOG_DEBUG(
"Unsupported 6LoWPAN encoding: dropping.");
382 if (!isPktDecompressed)
388 NS_LOG_DEBUG(
"Packet decompressed received: " << *copyPkt);
483 return m_netDevice->AddLinkChangeCallback(callback);
556 ret =
DoSend(packet, src, dest, protocolNumber,
false);
564 uint16_t protocolNumber)
569 ret =
DoSend(packet, src, dest, protocolNumber,
true);
577 uint16_t protocolNumber,
580 NS_LOG_FUNCTION(
this << *packet << src << dest << protocolNumber << doSendFrom);
584 uint32_t origHdrSize = 0;
585 uint32_t origPacketSize = packet->
GetSize();
609 uint32_t extraHdrSize = 0;
641 NS_LOG_LOGIC(
"Compressed packet too short, using uncompressed one");
657 std::list<Ptr<Packet>> fragmentList;
658 DoFragmentation(packet, origPacketSize, origHdrSize, extraHdrSize, fragmentList);
660 for (
auto it = fragmentList.begin(); it != fragmentList.end(); it++)
662 NS_LOG_DEBUG(
"SixLowPanNetDevice::Send (Fragment) " << **it);
668 (*it)->AddHeader(bc0Hdr);
669 (*it)->AddHeader(meshHdr);
673 success &=
m_netDevice->SendFrom(*it, src, destination, protocolNumber);
677 success &=
m_netDevice->Send(*it, destination, protocolNumber);
696 ret =
m_netDevice->SendFrom(packet, src, destination, protocolNumber);
701 ret =
m_netDevice->Send(packet, destination, protocolNumber);
776 NS_LOG_LOGIC(
"Checking source compression: " << mySrcAddr <<
" - " << srcAddr);
779 bool isSrcSrc = (memcmp(bufOne + 8, bufTwo + 8, 8) == 0);
806 NS_LOG_LOGIC(
"Checking destination compression: " << myDstAddr <<
" - " << dstAddr);
809 bool isDstDst = (memcmp(bufOne + 8, bufTwo + 8, 8) == 0);
869 NS_LOG_DEBUG(
"removed " << ret <<
" bytes - pkt is " << *packet);
873 switch (
encoding.GetSrcCompression())
875 const uint8_t* interface;
876 const uint8_t* prefix;
881 interface = encoding.GetSrcInterface();
882 for (
int j = 0; j < 8; j++)
891 for (
int j = 0; j < 8; j++)
899 interface = encoding.GetSrcInterface();
902 for (
int j = 0; j < 8; j++)
913 switch (
encoding.GetDstCompression())
915 const uint8_t* interface;
916 const uint8_t* prefix;
921 interface = encoding.GetDstInterface();
922 for (
int j = 0; j < 8; j++)
931 for (
int j = 0; j < 8; j++)
939 interface = encoding.GetDstInterface();
942 for (
int j = 0; j < 8; j++)
969 encoding.IsHc2HeaderPresent() ==
false,
970 "6LoWPAN: error in decompressing HC1 encoding, unsupported L4 compressed header present.");
986 NS_LOG_DEBUG(
"Original packet: " << *packet <<
" Size " << packet->
GetSize() <<
" src: " << src
1026 iphcHeader.
SetNh(
true);
1031 iphcHeader.
SetNh(
true);
1040 iphcHeader.
SetNh(
true);
1045 iphcHeader.
SetNh(
false);
1052 iphcHeader.
SetNh(
false);
1077 iphcHeader.
SetCid(
false);
1078 iphcHeader.
SetSac(
false);
1079 iphcHeader.
SetDac(
false);
1082 uint8_t unicastAddrCheckerBuf[16];
1083 checker.
GetBytes(unicastAddrCheckerBuf);
1084 uint8_t addressBuf[16];
1089 uint8_t srcContextId;
1102 NS_LOG_LOGIC(
"Checking stateful source compression: " << srcAddr);
1105 if (srcContextId != 0)
1125 uint8_t serializedCleanedAddress[16];
1126 cleanedAddr.
Serialize(serializedCleanedAddress);
1128 if (serializedCleanedAddress[8] == 0x00 &&
1129 serializedCleanedAddress[9] == 0x00 &&
1130 serializedCleanedAddress[10] == 0x00 &&
1131 serializedCleanedAddress[11] == 0xff &&
1132 serializedCleanedAddress[12] == 0xfe &&
1133 serializedCleanedAddress[13] == 0x00)
1148 NS_LOG_LOGIC(
"Checking stateless source compression: " << srcAddr);
1152 uint8_t serializedSrcAddress[16];
1153 srcAddr.
Serialize(serializedSrcAddress);
1159 else if (memcmp(addressBuf, unicastAddrCheckerBuf, 14) == 0)
1180 iphcHeader.
SetM(
true);
1184 iphcHeader.
SetM(
false);
1192 NS_LOG_LOGIC(
"Checking destination compression: " << dstAddr);
1194 uint8_t serializedDstAddress[16];
1195 dstAddr.
Serialize(serializedDstAddress);
1197 if (!iphcHeader.
GetM())
1201 uint8_t dstContextId;
1205 NS_LOG_LOGIC(
"Checking stateful destination compression: " << dstAddr);
1208 if (dstContextId != 0)
1228 uint8_t serializedCleanedAddress[16];
1229 cleanedAddr.
Serialize(serializedCleanedAddress);
1231 if (serializedCleanedAddress[8] == 0x00 &&
1232 serializedCleanedAddress[9] == 0x00 &&
1233 serializedCleanedAddress[10] == 0x00 &&
1234 serializedCleanedAddress[11] == 0xff &&
1235 serializedCleanedAddress[12] == 0xfe &&
1236 serializedCleanedAddress[13] == 0x00)
1250 NS_LOG_LOGIC(
"Checking stateless destination compression: " << dstAddr);
1256 else if (memcmp(addressBuf, unicastAddrCheckerBuf, 14) == 0)
1277 uint8_t dstContextId;
1283 uint8_t dstInlinePart[6] = {};
1284 dstInlinePart[0] = serializedDstAddress[1];
1285 dstInlinePart[1] = serializedDstAddress[2];
1286 dstInlinePart[2] = serializedDstAddress[12];
1287 dstInlinePart[3] = serializedDstAddress[13];
1288 dstInlinePart[4] = serializedDstAddress[14];
1289 dstInlinePart[5] = serializedDstAddress[15];
1292 if (dstContextId != 0)
1305 uint8_t multicastAddrCheckerBuf[16];
1307 multicastCheckAddress.
GetBytes(multicastAddrCheckerBuf);
1310 if (memcmp(addressBuf, multicastAddrCheckerBuf, 15) == 0)
1317 else if ((addressBuf[0] == multicastAddrCheckerBuf[0]) &&
1318 (memcmp(addressBuf + 2, multicastAddrCheckerBuf + 2, 11) == 0))
1320 uint8_t dstInlinePart[4] = {};
1321 memcpy(dstInlinePart, serializedDstAddress + 1, 1);
1322 memcpy(dstInlinePart + 1, serializedDstAddress + 13, 3);
1328 else if ((addressBuf[0] == multicastAddrCheckerBuf[0]) &&
1329 (memcmp(addressBuf + 2, multicastAddrCheckerBuf + 2, 9) == 0))
1331 uint8_t dstInlinePart[6] = {};
1332 memcpy(dstInlinePart, serializedDstAddress + 1, 1);
1333 memcpy(dstInlinePart + 1, serializedDstAddress + 11, 5);
1351 NS_LOG_DEBUG(
"Packet after IPHC compression: " << *packet);
1388 NS_LOG_DEBUG(
"removed " << ret <<
" bytes - pkt is " << *packet);
1403 uint8_t contextId =
encoding.GetSrcContextId();
1406 NS_LOG_LOGIC(
"Unknown Source compression context (" << +contextId
1407 <<
"), dropping packet");
1412 NS_LOG_LOGIC(
"Expired Source compression context (" << +contextId
1413 <<
"), dropping packet");
1417 uint8_t contextPrefix[16];
1419 uint8_t contextLength =
m_contextTable[contextId].contextPrefix.GetPrefixLength();
1421 uint8_t srcAddress[16] = {};
1424 memcpy(srcAddress + 8,
encoding.GetSrcInlinePart(), 8);
1428 srcAddress[11] = 0xff;
1429 srcAddress[12] = 0xfe;
1430 memcpy(srcAddress + 14,
encoding.GetSrcInlinePart(), 2);
1437 uint8_t bytesToCopy = contextLength / 8;
1438 uint8_t bitsToCopy = contextLength % 8;
1441 for (uint8_t i = 0; i < bytesToCopy; i++)
1443 srcAddress[i] = contextPrefix[i];
1447 uint8_t addressBitMask = (1 << (8 - bitsToCopy)) - 1;
1448 uint8_t prefixBitMask = ~addressBitMask;
1449 srcAddress[bytesToCopy] = (contextPrefix[bytesToCopy] & prefixBitMask) |
1450 (srcAddress[bytesToCopy] & addressBitMask);
1461 uint8_t srcAddress[16] = {};
1462 memcpy(srcAddress,
encoding.GetSrcInlinePart(), 16);
1467 uint8_t srcAddress[16] = {};
1468 memcpy(srcAddress + 8,
encoding.GetSrcInlinePart(), 8);
1469 srcAddress[0] = 0xfe;
1470 srcAddress[1] = 0x80;
1475 uint8_t srcAddress[16] = {};
1476 memcpy(srcAddress + 14,
encoding.GetSrcInlinePart(), 2);
1477 srcAddress[0] = 0xfe;
1478 srcAddress[1] = 0x80;
1479 srcAddress[11] = 0xff;
1480 srcAddress[12] = 0xfe;
1500 uint8_t contextId =
encoding.GetDstContextId();
1503 NS_LOG_LOGIC(
"Unknown Destination compression context (" << +contextId
1504 <<
"), dropping packet");
1509 NS_LOG_LOGIC(
"Expired Destination compression context (" << +contextId
1510 <<
"), dropping packet");
1514 uint8_t contextPrefix[16];
1516 uint8_t contextLength =
m_contextTable[contextId].contextPrefix.GetPrefixLength();
1521 uint8_t dstAddress[16] = {};
1524 memcpy(dstAddress + 8,
encoding.GetDstInlinePart(), 8);
1528 dstAddress[11] = 0xff;
1529 dstAddress[12] = 0xfe;
1530 memcpy(dstAddress + 14,
encoding.GetDstInlinePart(), 2);
1537 uint8_t bytesToCopy =
m_contextTable[contextId].contextPrefix.GetPrefixLength() / 8;
1538 uint8_t bitsToCopy = contextLength % 8;
1541 for (uint8_t i = 0; i < bytesToCopy; i++)
1543 dstAddress[i] = contextPrefix[i];
1547 uint8_t addressBitMask = (1 << (8 - bitsToCopy)) - 1;
1548 uint8_t prefixBitMask = ~addressBitMask;
1549 dstAddress[bytesToCopy] = (contextPrefix[bytesToCopy] & prefixBitMask) |
1550 (dstAddress[bytesToCopy] & addressBitMask);
1558 uint8_t dstAddress[16] = {};
1559 dstAddress[0] = 0xff;
1560 memcpy(dstAddress + 1,
encoding.GetDstInlinePart(), 2);
1561 dstAddress[3] = contextLength;
1562 memcpy(dstAddress + 4, contextPrefix, 8);
1563 memcpy(dstAddress + 12,
encoding.GetDstInlinePart() + 2, 4);
1575 uint8_t dstAddress[16] = {};
1576 memcpy(dstAddress,
encoding.GetDstInlinePart(), 16);
1581 uint8_t dstAddress[16] = {};
1582 memcpy(dstAddress + 8,
encoding.GetDstInlinePart(), 8);
1583 dstAddress[0] = 0xfe;
1584 dstAddress[1] = 0x80;
1589 uint8_t dstAddress[16] = {};
1590 memcpy(dstAddress + 14,
encoding.GetDstInlinePart(), 2);
1591 dstAddress[0] = 0xfe;
1592 dstAddress[1] = 0x80;
1593 dstAddress[11] = 0xff;
1594 dstAddress[12] = 0xfe;
1607 uint8_t dstAddress[16] = {};
1608 memcpy(dstAddress,
encoding.GetDstInlinePart(), 16);
1613 uint8_t dstAddress[16] = {};
1614 dstAddress[0] = 0xff;
1615 memcpy(dstAddress + 1,
encoding.GetDstInlinePart(), 1);
1616 memcpy(dstAddress + 11,
encoding.GetDstInlinePart() + 1, 5);
1621 uint8_t dstAddress[16] = {};
1622 dstAddress[0] = 0xff;
1623 memcpy(dstAddress + 1,
encoding.GetDstInlinePart(), 1);
1624 memcpy(dstAddress + 13,
encoding.GetDstInlinePart() + 1, 3);
1629 uint8_t dstAddress[16] = {};
1630 dstAddress[0] = 0xff;
1631 dstAddress[1] = 0x02;
1632 memcpy(dstAddress + 15,
encoding.GetDstInlinePart(), 1);
1639 uint8_t traf = 0x00;
1644 traf = (traf << 6) |
encoding.GetDscp();
1656 traf = (traf << 6) |
encoding.GetDscp();
1669 uint8_t dispatchRawVal = 0;
1672 packet->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
1730 "LOWPAN_NHC MUST NOT be used to encode IPv6 Extension Headers "
1731 "that have more than 255 octets following the Length field after compression. "
1732 "Packet uncompressed.");
1745 nhcHeader.
SetNh(
true);
1750 nhcHeader.
SetNh(
true);
1759 nhcHeader.
SetNh(
true);
1764 nhcHeader.
SetNh(
false);
1771 nhcHeader.
SetNh(
false);
1789 "LOWPAN_NHC MUST NOT be used to encode IPv6 Extension Headers "
1790 "that have more than 255 octets following the Length field after compression. "
1791 "Packet uncompressed.");
1804 nhcHeader.
SetNh(
true);
1809 nhcHeader.
SetNh(
true);
1818 nhcHeader.
SetNh(
true);
1823 nhcHeader.
SetNh(
false);
1830 nhcHeader.
SetNh(
false);
1848 "LOWPAN_NHC MUST NOT be used to encode IPv6 Extension Headers "
1849 "that have more than 255 octets following the Length field after compression. "
1850 "Packet uncompressed.");
1862 nhcHeader.
SetNh(
true);
1867 nhcHeader.
SetNh(
true);
1876 nhcHeader.
SetNh(
true);
1881 nhcHeader.
SetNh(
false);
1888 nhcHeader.
SetNh(
false);
1906 "LOWPAN_NHC MUST NOT be used to encode IPv6 Extension Headers "
1907 "that have more than 255 octets following the Length field after compression. "
1908 "Packet uncompressed.");
1920 nhcHeader.
SetNh(
true);
1925 nhcHeader.
SetNh(
true);
1934 nhcHeader.
SetNh(
true);
1939 nhcHeader.
SetNh(
false);
1946 nhcHeader.
SetNh(
false);
1960 NS_ABORT_MSG(
"IPv6 Mobility Header is not supported in ns-3 yet");
1973 NS_LOG_DEBUG(
"Packet after NHC compression: " << *packet);
1977 std::pair<uint8_t, bool>
1989 NS_LOG_DEBUG(
"removed " << ret <<
" bytes - pkt is " << *packet);
1997 uint8_t blobData[260];
1998 blobSize =
encoding.CopyBlob(blobData + 2, 260 - 2);
1999 uint8_t paddingSize = 0;
2001 uint8_t actualEncodedHeaderType =
encoding.GetEid();
2002 uint8_t actualHeaderType;
2005 switch (actualEncodedHeaderType)
2012 uint8_t dispatchRawVal = 0;
2015 packet->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
2030 blobData[0] =
encoding.GetNextHeader();
2034 if ((blobSize + 2) % 8 > 0)
2036 paddingSize = 8 - (blobSize + 2) % 8;
2038 if (paddingSize == 1)
2040 blobData[blobSize + 2] = 0;
2042 else if (paddingSize > 1)
2044 blobData[blobSize + 2] = 1;
2045 blobData[blobSize + 2 + 1] = paddingSize - 2;
2046 for (uint8_t i = 0; i < paddingSize - 2; i++)
2048 blobData[blobSize + 2 + 2 + i] = 0;
2051 blobData[1] = ((blobSize + 2 + paddingSize) >> 3) - 1;
2053 blob.
Begin().
Write(blobData, blobSize + 2 + paddingSize);
2064 uint8_t dispatchRawVal = 0;
2067 packet->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
2082 blobData[0] =
encoding.GetNextHeader();
2084 blobData[1] = ((blobSize + 2) >> 3) - 1;
2096 uint8_t dispatchRawVal = 0;
2099 packet->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
2114 blobData[0] =
encoding.GetNextHeader();
2130 uint8_t dispatchRawVal = 0;
2133 packet->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
2148 blobData[0] =
encoding.GetNextHeader();
2152 if ((blobSize + 2) % 8 > 0)
2154 paddingSize = 8 - (blobSize + 2) % 8;
2156 if (paddingSize == 1)
2158 blobData[blobSize + 2] = 0;
2160 else if (paddingSize > 1)
2162 blobData[blobSize + 2] = 1;
2163 blobData[blobSize + 2 + 1] = paddingSize - 2;
2164 for (uint8_t i = 0; i < paddingSize - 2; i++)
2166 blobData[blobSize + 2 + 2 + i] = 0;
2169 blobData[1] = ((blobSize + 2 + paddingSize) >> 3) - 1;
2171 blob.
Begin().
Write(blobData, blobSize + 2 + paddingSize);
2178 NS_ABORT_MSG(
"IPv6 Mobility Header is not supported in ns-3 yet");
2185 return std::pair<uint8_t, bool>(0,
true);
2189 NS_ABORT_MSG(
"Trying to decode unknown Extension Header");
2194 return std::pair<uint8_t, bool>(actualHeaderType,
false);
2211 udpNhcHeader.
SetC(
false);
2217 udpNhcHeader.
SetC(
true);
2245 "UDP_NHC Compression - UDP_NHC header size = " << udpNhcHeader.
GetSerializedSize());
2250 NS_LOG_DEBUG(
"Packet after UDP_NHC compression: " << *packet);
2264 NS_LOG_DEBUG(
"removed " << ret <<
" bytes - pkt is " << *packet);
2276 temp = (0xf0 << 8) |
encoding.GetDstPort();
2280 temp = (0xf0 << 8) |
encoding.GetSrcPort();
2285 temp = (0xf0b << 4) |
encoding.GetSrcPort();
2287 temp = (0xf0b << 4) |
encoding.GetDstPort();
2320 uint32_t origPacketSize,
2321 uint32_t origHdrSize,
2322 uint32_t extraHdrSize,
2329 uint16_t offsetData = 0;
2330 uint16_t offset = 0;
2333 uint32_t compressedHeaderSize =
packetSize - (origPacketSize - origHdrSize);
2335 auto tag =
static_cast<uint16_t
>(
m_rng->
GetValue(0, 65535));
2344 "6LoWPAN: can not fragment, 6LoWPAN headers are bigger than MTU");
2347 size = l2Mtu - frag1Hdr.
GetSerializedSize() - compressedHeaderSize - extraHdrSize;
2349 size += compressedHeaderSize;
2354 offset += size + origHdrSize - compressedHeaderSize;
2358 listFragments.push_back(fragment1);
2360 bool moreFrag =
true;
2379 NS_LOG_LOGIC(
"Fragment creation - " << offset <<
", " << offset);
2387 listFragments.push_back(fragment);
2403 key.first = std::pair<Address, Address>(src, dst);
2406 uint16_t offset = 0;
2420 uint8_t dispatchRawValFrag1 = 0;
2425 p->
CopyData(&dispatchRawValFrag1,
sizeof(dispatchRawValFrag1));
2427 NS_LOG_DEBUG(
"Dispatches: " <<
int(dispatchRawValFrag1) <<
" - " <<
int(dispatchValFrag1));
2430 switch (dispatchValFrag1)
2452 key.second = std::pair<uint16_t, uint16_t>(frag1Header.
GetDatagramSize(),
2460 key.second = std::pair<uint16_t, uint16_t>(fragNHeader.
GetDatagramSize(),
2475 std::list<Ptr<Packet>> storedFragments =
m_fragments[oldestKey]->GetFragments();
2476 for (
auto fragIter = storedFragments.begin(); fragIter != storedFragments.end();
2486 fragments = Create<Fragments>();
2488 m_fragments.insert(std::make_pair(key, fragments));
2496 fragments = it->second;
2518 fragments =
nullptr;
2542 std::list<std::pair<Ptr<Packet>, uint16_t>>::iterator it;
2543 bool duplicate =
false;
2547 if (it->second > fragmentOffset)
2551 if (it->second == fragmentOffset)
2555 "Duplicate fragment size differs. Aborting.");
2561 m_fragments.insert(it, std::make_pair(fragment, fragmentOffset));
2570 m_firstFragment = fragment;
2579 uint16_t lastEndOffset = 0;
2586 NS_LOG_LOGIC(
"Checking overlaps " << lastEndOffset <<
" - " << it->second);
2588 if (lastEndOffset < it->
second)
2594 uint16_t fragmentEnd = it->first->GetSize() + it->second;
2595 lastEndOffset =
std::max(lastEndOffset, fragmentEnd);
2599 return ret && lastEndOffset == m_packetSize;
2610 uint16_t lastEndOffset = 0;
2614 lastEndOffset = it->first->GetSize();
2618 if (lastEndOffset > it->second)
2620 NS_ABORT_MSG(
"Overlapping fragments found, forbidden condition");
2627 lastEndOffset += it->first->GetSize();
2640 std::list<Ptr<Packet>>
2643 std::list<Ptr<Packet>> fragments;
2646 fragments.push_back(iter->first);
2654 m_timeoutIter = iter;
2660 return m_timeoutIter;
2669 std::list<Ptr<Packet>> storedFragments = it->second->GetFragments();
2670 for (
auto fragIter = storedFragments.begin(); fragIter != storedFragments.end(); fragIter++)
2675 it->second =
nullptr;
2734 bool compressionAllowed,
2738 << contextPrefix << compressionAllowed << validLifetime.
As(
Time::S));
2742 NS_LOG_LOGIC(
"Invalid context ID (" << +contextId <<
"), ignoring");
2746 if (validLifetime ==
Time(0))
2748 NS_LOG_LOGIC(
"Context (" << +contextId <<
"), removed (validity time is zero)");
2754 m_contextTable[contextId].compressionAllowed = compressionAllowed;
2761 bool& compressionAllowed,
2762 Time& validLifetime)
2768 NS_LOG_LOGIC(
"Invalid context ID (" << +contextId <<
"), ignoring");
2774 NS_LOG_LOGIC(
"Context not found (" << +contextId <<
"), ignoring");
2779 compressionAllowed =
m_contextTable[contextId].compressionAllowed;
2792 NS_LOG_LOGIC(
"Invalid context ID (" << +contextId <<
"), ignoring");
2798 NS_LOG_LOGIC(
"Context not found (" << +contextId <<
"), ignoring");
2812 NS_LOG_LOGIC(
"Invalid context ID (" << +contextId <<
"), ignoring");
2818 NS_LOG_LOGIC(
"Context not found (" << +contextId <<
"), ignoring");
2831 NS_LOG_LOGIC(
"Invalid context ID (" << +contextId <<
"), ignoring");
2837 NS_LOG_LOGIC(
"Context not found (" << +contextId <<
"), ignoring");
2858 << +contextId <<
" "
2862 contextId = iter.first;
2886 if (contextLength <= 64)
2888 uint8_t contextBytes[16];
2889 uint8_t addressBytes[16];
2892 address.GetBytes(addressBytes);
2894 if (addressBytes[3] == contextLength && addressBytes[4] == contextBytes[0] &&
2895 addressBytes[5] == contextBytes[1] && addressBytes[6] == contextBytes[2] &&
2896 addressBytes[7] == contextBytes[3] && addressBytes[8] == contextBytes[4] &&
2897 addressBytes[9] == contextBytes[5] && addressBytes[10] == contextBytes[6] &&
2898 addressBytes[11] == contextBytes[7])
2901 << +contextId <<
" "
2905 contextId = iter.first;
2917 uint8_t addressBytes[16];
2918 address.GetBytes(addressBytes);
2921 uint8_t bytesToClean = prefixLength / 8;
2922 uint8_t bitsToClean = prefixLength % 8;
2923 for (uint8_t i = 0; i < bytesToClean; i++)
2925 addressBytes[i] = 0;
2929 uint8_t cleanupMask = (1 << bitsToClean) - 1;
2930 addressBytes[bytesToClean] &= cleanupMask;
2935 return cleanedAddress;
a polymophic address class
uint32_t CopyTo(uint8_t buffer[MAX_SIZE]) const
Copy the address bytes into a buffer.
void Write(const uint8_t *buffer, uint32_t size)
automatically resized byte buffer
void AddAtStart(uint32_t start)
Buffer::Iterator Begin() const
void RemoveAtStart(uint32_t start)
const uint8_t * PeekData() const
bool IsNull() const
Check for null implementation.
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
bool IsRunning() const
This method is syntactic sugar for !IsExpired().
Ipv4 addresses are stored in host order in this class.
Describes an IPv6 address.
bool IsLinkLocal() const
If the IPv6 address is a link-local address (fe80::/64).
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
static Ipv6Address Deserialize(const uint8_t buf[16])
Deserialize this address.
static Ipv6Address MakeAutoconfiguredAddress(Address addr, Ipv6Address prefix)
Make the autoconfigured IPv6 address from a Mac address.
bool IsMulticast() const
If the IPv6 address is multicast (ff00::/8).
void GetBytes(uint8_t buf[16]) const
Get the bytes corresponding to the address.
void Serialize(uint8_t buf[16]) const
Serialize this address to a 16-byte buffer.
static Ipv6Address GetOnes()
Get the "all-1" IPv6 address (ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff).
static Ipv6Address MakeAutoconfiguredLinkLocalAddress(Address mac)
Make the autoconfigured link-local IPv6 address from a Mac address.
static const uint16_t PROT_NUMBER
The protocol number for IPv6 (0x86DD).
Describes an IPv6 prefix.
uint8_t GetPrefixLength() const
Get prefix length.
void GetBytes(uint8_t buf[16]) const
Get the bytes corresponding to the prefix.
This class can contain 16 bit addresses.
static bool IsMatchingType(const Address &address)
static Mac16Address ConvertFrom(const Address &address)
void CopyFrom(const uint8_t buffer[2])
bool IsMulticast() const
Checks if the address is a multicast address according to RFC 4944 Section 9 (i.e....
bool IsBroadcast() const
Checks if the address is a broadcast address according to 802.15.4 scheme (i.e., 0xFFFF).
static bool IsMatchingType(const Address &address)
Network layer to device interface.
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)=0
PacketType
Packet types are used as they are in Linux.
static bool ChecksumEnabled()
void RegisterProtocolHandler(ProtocolHandler handler, uint16_t protocolType, Ptr< NetDevice > device, bool promiscuous=false)
virtual void DoDispose()
Destructor implementation.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
void AddAtEnd(Ptr< const Packet > packet)
Concatenate the input packet at the end of the current packet.
void AddHeader(const Header &header)
Add header to this packet.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
Ptr< Packet > Copy() const
performs a COW copy of the packet.
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const
Create a new packet which contains a fragment of the original packet.
Smart pointer class similar to boost::intrusive_ptr.
virtual double GetValue()=0
Get the next random value drawn from the distribution.
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time Now()
Return the current simulation virtual time.
6LoWPAN BC0 header - see RFC 4944.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
void SetSequenceNumber(uint8_t seqNumber)
Set the "Sequence Number" field.
uint8_t GetSequenceNumber() const
Get the "Sequence Number" field.
static Dispatch_e GetDispatchType(uint8_t dispatch)
Get the Dispatch type.
static NhcDispatch_e GetNhcDispatchType(uint8_t dispatch)
Get the NhcDispatch type.
NhcDispatch_e
Dispatch values for Next Header compression.
6LoWPAN FRAG1 header - see RFC 4944.
void SetDatagramSize(uint16_t datagramSize)
Set the datagram size.
void SetDatagramTag(uint16_t datagramTag)
Set the datagram tag.
uint16_t GetDatagramSize() const
Get the datagram size.
uint16_t GetDatagramTag() const
Get the datagram tag.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
6LoWPAN FRAGN header - see RFC 4944.
void SetDatagramSize(uint16_t datagramSize)
Set the datagram size.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
uint16_t GetDatagramTag() const
Get the datagram tag.
void SetDatagramTag(uint16_t datagramTag)
Set the datagram tag.
void SetDatagramOffset(uint8_t datagramOffset)
Set the datagram offset.
uint8_t GetDatagramOffset() const
Get the datagram offset.
uint16_t GetDatagramSize() const
Get the datagram size.
6LoWPAN HC1 header - see RFC 4944.
void SetTcflCompression(bool tcflCompression)
Set the Traffic Class and Flow Labels as compressed.
void SetFlowLabel(uint32_t flowLabel)
Set the Flow Label value.
void SetDstCompression(LowPanHc1Addr_e dstCompression)
Set Destination Compression type.
void SetTrafficClass(uint8_t trafficClass)
Set the Traffic Class value.
void SetHopLimit(uint8_t limit)
Set the "Hop limit" field (TTL).
void SetHc2HeaderPresent(bool hc2HeaderPresent)
Set the next header a HC2 compressed header.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
void SetNextHeader(uint8_t nextHeader)
Set the Next Header value.
void SetSrcCompression(LowPanHc1Addr_e srcCompression)
Set Source Compression type.
void SetDstInterface(const uint8_t *dstInterface)
Set the destination interface.
void SetDstPrefix(const uint8_t *dstPrefix)
Set the destination prefix.
void SetSrcPrefix(const uint8_t *srcPrefix)
Set the source prefix.
void SetSrcInterface(const uint8_t *srcInterface)
Set the source interface.
LOWPAN_IPHC base Encoding - see RFC 6282.
void SetNextHeader(uint8_t nextHeader)
Set the Next Header field.
void SetHlim(Hlim_e hlimField)
Set the HLIM (Hop Limit) compression.
void SetDstContextId(uint8_t dstContextId)
Set the DstContextId.
void SetSam(HeaderCompression_e samField)
Set the SAM (Source Address Mode) compression.
void SetNh(bool nhField)
Set the NH (Next Header) compression.
void SetEcn(uint8_t ecn)
Set the ECN (2bits).
void SetFlowLabel(uint32_t flowLabel)
Set the Flow Label (20bits).
void SetDscp(uint8_t dscp)
Set the DSCP (6bits).
void SetTf(TrafficClassFlowLabel_e tfField)
Set the TF (Traffic Class, Flow Label) compression.
void SetDam(HeaderCompression_e damField)
Set the DAM (Destination Address Mode) compression.
void SetCid(bool cidField)
Set the CID (Context Identifier Extension) compression.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
void SetSac(bool sacField)
Set the SAC (Source Address Compression) compression.
bool GetM() const
Get the M (Multicast) compression.
void SetDstInlinePart(uint8_t dstInlinePart[16], uint8_t size)
brief Set the destination address inline part
void SetSrcContextId(uint8_t srcContextId)
Set the SrcContextId.
void SetSrcInlinePart(uint8_t srcInlinePart[16], uint8_t size)
brief Set the source address inline part
void SetM(bool mField)
Set the M (Multicast) compression.
void SetHopLimit(uint8_t hopLimit)
Set the Hop Limit field.
void SetDac(bool dacField)
Set the DAC (Destination Address Compression) compression.
6LoWPAN IPv6 uncompressed header - see RFC 4944.
6LoWPAN Mesh header - see RFC 4944.
Address GetOriginator() const
Get the "Originator" address.
void SetHopsLeft(uint8_t hopsLeft)
Set the "Hops Left" field.
void SetFinalDst(Address finalDst)
Set the "Final Destination" address.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
uint8_t GetHopsLeft() const
Get the "Hops Left" field.
Address GetFinalDst() const
Get the "Final Destination" address.
void SetOriginator(Address originator)
Set the "Originator" address.
void SetTimeoutIter(FragmentsTimeoutsListI_t iter)
Set the Timeout iterator.
bool IsEntire() const
If all fragments have been added.
std::list< Ptr< Packet > > GetFragments() const
Get a list of the current stored fragments.
void SetPacketSize(uint32_t packetSize)
Set the packet-to-be-defragmented size.
void AddFragment(Ptr< Packet > fragment, uint16_t fragmentOffset)
Add a fragment to the pool.
uint32_t m_packetSize
The size of the reconstructed packet (bytes).
FragmentsTimeoutsListI_t GetTimeoutIter()
Get the Timeout iterator.
Ptr< Packet > GetPacket() const
Get the entire packet.
void AddFirstFragment(Ptr< Packet > fragment)
Add the first packet fragment.
Shim performing 6LoWPAN compression, decompression and fragmentation.
bool IsLinkUp() const override
bool SetMtu(const uint16_t mtu) override
void DecompressLowPanUdpNhc(Ptr< Packet > packet, Ipv6Address saddr, Ipv6Address daddr)
Decompress the headers according to NHC compression.
bool DoSend(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber, bool doSendFrom)
Ipv6Address CleanPrefix(Ipv6Address address, Ipv6Prefix prefix)
Clean an address from its prefix.
uint8_t m_bc0Serial
Serial number used in BC0 header.
bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber) override
void SetNode(Ptr< Node > node) override
bool NeedsArp() const override
static constexpr uint16_t PROT_NUMBER
The protocol number for 6LoWPAN (0xA0ED) - see RFC 7973.
EventId m_timeoutEvent
Event for the next scheduled timeout.
FragmentsTimeoutsListI_t SetTimeout(FragmentKey_t key, uint32_t iif)
Set a new timeout "event" for a fragmented packet.
Ptr< UniformRandomVariable > m_rng
Rng for the fragments tag.
uint16_t m_meshCacheLength
length of the cache for each source.
bool IsPointToPoint() const override
Return true if the net device is on a point-to-point link.
bool m_useIphc
Use IPHC or HC1.
void RenewContext(uint8_t contextId, Time validLifetime)
Renew a context used in IPHC stateful compression.
bool DecompressLowPanIphc(Ptr< Packet > packet, const Address &src, const Address &dst)
Decompress the headers according to IPHC compression.
uint32_t CompressLowPanHc1(Ptr< Packet > packet, const Address &src, const Address &dst)
Compress the headers according to HC1 compression.
bool IsBridge() const override
Return true if the net device is acting as a bridge.
Ptr< Node > m_node
Smart pointer to the Node.
bool CanCompressLowPanNhc(uint8_t headerType)
Checks if the next header can be compressed using NHC.
Ptr< Channel > GetChannel() const override
uint16_t GetMtu() const override
Returns the link-layer MTU for this interface.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Address GetAddress() const override
std::list< std::tuple< Time, FragmentKey_t, uint32_t > >::iterator FragmentsTimeoutsListI_t
Container Iterator for fragment timeouts.
void SetReceiveCallback(NetDevice::ReceiveCallback cb) override
uint32_t m_compressionThreshold
Minimum L2 payload size.
void DoFragmentation(Ptr< Packet > packet, uint32_t origPacketSize, uint32_t origHdrSize, uint32_t extraHdrSize, std::list< Ptr< Packet >> &listFragments)
Performs a packet fragmentation.
Ptr< NetDevice > GetNetDevice() const
Returns a smart pointer to the underlying NetDevice.
void HandleTimeout()
Handles a fragmented packet timeout.
void ReceiveFromDevice(Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, const Address &source, const Address &destination, PacketType packetType)
Receives all the packets from a NetDevice for further processing.
uint32_t CompressLowPanNhc(Ptr< Packet > packet, uint8_t headerType, const Address &src, const Address &dst)
Compress the headers according to NHC compression.
TracedCallback< Ptr< const Packet >, Ptr< SixLowPanNetDevice >, uint32_t > m_txTrace
Callback to trace TX (transmission) packets.
std::pair< std::pair< Address, Address >, std::pair< uint16_t, uint16_t > > FragmentKey_t
Fragment identifier type: src/dst address src/dst port.
@ DROP_DISALLOWED_COMPRESSION
HC1 while in IPHC mode or vice-versa.
@ DROP_UNKNOWN_EXTENSION
Unsupported compression kind.
@ DROP_FRAGMENT_BUFFER_FULL
Fragment buffer size exceeded.
@ DROP_SATETFUL_DECOMPRESSION_PROBLEM
Decompression failed due to missing or expired context.
@ DROP_FRAGMENT_TIMEOUT
Fragment timeout exceeded.
void AddContext(uint8_t contextId, Ipv6Prefix contextPrefix, bool compressionAllowed, Time validLifetime)
Add, remove, or update a context used in IPHC stateful compression.
Ptr< NetDevice > m_netDevice
Smart pointer to the underlying NetDevice.
void SetNetDevice(Ptr< NetDevice > device)
Setup SixLowPan to be a proxy for the specified NetDevice.
std::map< uint8_t, ContextEntry > m_contextTable
Table of the contexts used in compression/decompression.
TracedCallback< Ptr< const Packet >, Ptr< SixLowPanNetDevice >, uint32_t > m_rxTrace
Callback to trace RX (reception) packets.
bool GetContext(uint8_t contextId, Ipv6Prefix &contextPrefix, bool &compressionAllowed, Time &validLifetime)
Get a context used in IPHC stateful compression.
uint32_t GetIfIndex() const override
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
bool IsBroadcast() const override
Address Get16MacFrom48Mac(Address addr)
Get a Mac16 from its Mac48 pseudo-MAC.
TracedCallback< DropReason, Ptr< const Packet >, Ptr< SixLowPanNetDevice >, uint32_t > m_dropTrace
Callback to trace drop packets.
void SetPromiscReceiveCallback(NetDevice::PromiscReceiveCallback cb) override
bool FindUnicastCompressionContext(Ipv6Address address, uint8_t &contextId)
Finds if the given unicast address matches a context for compression.
Ptr< RandomVariableStream > m_meshUnderJitter
Random variable for the mesh-under packet retransmission.
uint32_t CompressLowPanUdpNhc(Ptr< Packet > packet, bool omitChecksum)
Compress the headers according to NHC compression.
void RemoveContext(uint8_t contextId)
Remove a context used in IPHC stateful compression.
bool m_omitUdpChecksum
Omit UDP checksum in NC1 encoding.
Ptr< Node > GetNode() const override
void AddLinkChangeCallback(Callback< void > callback) override
uint32_t m_ifIndex
Interface index.
Address GetBroadcast() const override
void SetIfIndex(const uint32_t index) override
uint32_t CompressLowPanIphc(Ptr< Packet > packet, const Address &src, const Address &dst)
Compress the headers according to IPHC compression.
void DoDispose() override
Destructor implementation.
bool IsMulticast() const override
Address GetMulticast(Ipv4Address multicastGroup) const override
Make and return a MAC multicast address using the provided multicast group.
Time m_fragmentExpirationTimeout
Time limit for fragment rebuilding.
uint16_t m_fragmentReassemblyListSize
How many packets can be rebuilt at the same time.
uint8_t m_meshUnderHopsLeft
Start value for mesh-under hops left.
void SetAddress(Address address) override
Set the address of this interface.
void DecompressLowPanHc1(Ptr< Packet > packet, const Address &src, const Address &dst)
Decompress the headers according to HC1 compression.
FragmentsTimeoutsList_t m_timeoutEventList
Timeout "events" container.
std::pair< uint8_t, bool > DecompressLowPanNhc(Ptr< Packet > packet, const Address &src, const Address &dst, Ipv6Address srcAddress, Ipv6Address dstAddress)
Decompress the headers according to NHC compression.
NetDevice::PromiscReceiveCallback m_promiscRxCallback
The callback used to notify higher layers that a packet has been received in promiscuous mode.
void HandleFragmentsTimeout(FragmentKey_t key, uint32_t iif)
Process the timeout for packet fragments.
void InvalidateContext(uint8_t contextId)
Invalidate a context used in IPHC stateful compression.
static TypeId GetTypeId()
Get the type ID.
bool SupportsSendFrom() const override
NetDevice::ReceiveCallback m_rxCallback
The callback used to notify higher layers that a packet has been received.
bool ProcessFragment(Ptr< Packet > &packet, const Address &src, const Address &dst, bool isFirst)
Process a packet fragment.
MapFragments_t m_fragments
Fragments hold to be rebuilt.
bool FindMulticastCompressionContext(Ipv6Address address, uint8_t &contextId)
Finds if the given multicast address matches a context for compression.
bool m_meshUnder
Use a mesh-under routing.
std::map< Address, std::list< uint8_t > > m_seenPkts
Seen packets, memorized by OriginatorAddress, SequenceNumber.
SixLowPanNetDevice()
Constructor for the SixLowPanNetDevice.
LOWPAN_NHC Extension Header Encoding - see RFC 6282.
void SetNh(bool nhField)
Set the NH field values.
void SetEid(Eid_e extensionHeaderType)
Set the Extension Header Type.
void SetBlob(const uint8_t *blob, uint32_t size)
Set the option header data blob.
@ EID_DESTINATION_OPTIONS_H
void SetNextHeader(uint8_t nextHeader)
Set the Next Header field values.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
UDP LOWPAN_NHC Extension Header Encoding - see RFC 6282.
@ PORTS_LAST_SRC_LAST_DST
void SetPorts(Ports_e port)
Set the compressed Src and Dst Ports.
void SetChecksum(uint16_t checksum)
Set the Checksum field values.
void SetDstPort(uint16_t port)
Set the Destination Port.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
void SetSrcPort(uint16_t port)
Set the Source Port.
void SetC(bool cField)
Set the C (Checksum).
Hold variables of type string.
Simulation virtual time values and global simulation resolution.
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
static const uint8_t PROT_NUMBER
protocol number (0x11)
Hold an unsigned integer type.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Structure holding the information for a context (used in compression and decompression)
Ipv6Prefix contextPrefix
context prefix to be used in compression/decompression
bool compressionAllowed
compression and decompression allowed (true), decompression only (false)
Time validLifetime
validity period
uint32_t pktSize
packet size used for the simulation (in bytes)
static const uint32_t packetSize
Packet size generated at the AP.