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(
"ForceEtherType",
87 "Force a specific EtherType in L2 frames.",
91 .AddAttribute(
"EtherType",
92 "The specific EtherType to be used in L2 frames.",
95 MakeUintegerChecker<uint16_t>())
96 .AddAttribute(
"UseMeshUnder",
97 "Use a mesh-under routing protocol.",
101 .AddAttribute(
"MeshUnderRadius",
102 "Hops Left to use in mesh-under.",
105 MakeUintegerChecker<uint8_t>())
106 .AddAttribute(
"MeshCacheLength",
107 "Length of the cache for each source.",
110 MakeUintegerChecker<uint16_t>())
111 .AddAttribute(
"MeshUnderJitter",
112 "The jitter in ms a node uses to forward mesh-under packets - used to "
113 "prevent collisions",
114 StringValue(
"ns3::UniformRandomVariable[Min=0.0|Max=10.0]"),
116 MakePointerChecker<RandomVariableStream>())
117 .AddTraceSource(
"Tx",
118 "Send - packet (including 6LoWPAN header), "
119 "SixLoWPanNetDevice Ptr, interface index.",
121 "ns3::SixLowPanNetDevice::RxTxTracedCallback")
122 .AddTraceSource(
"Rx",
123 "Receive - packet (including 6LoWPAN header), "
124 "SixLoWPanNetDevice Ptr, interface index.",
126 "ns3::SixLowPanNetDevice::RxTxTracedCallback")
127 .AddTraceSource(
"Drop",
128 "Drop - DropReason, packet (including 6LoWPAN header), "
129 "SixLoWPanNetDevice Ptr, interface index.",
131 "ns3::SixLowPanNetDevice::DropTracedCallback");
137 m_netDevice(nullptr),
142 m_rng = CreateObject<UniformRandomVariable>();
159 NS_LOG_DEBUG(
"RegisterProtocolHandler for " << device->GetInstanceTypeId().GetName());
161 uint16_t protocolType = 0;
197 iter->second =
nullptr;
212 NS_LOG_FUNCTION(
this << incomingPort << packet << protocol << src << dst);
214 uint8_t dispatchRawVal = 0;
220 copyPkt->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
222 bool isPktDecompressed =
false;
223 bool fragmented =
false;
227 NS_LOG_DEBUG(
"Dispatches: " <<
int(dispatchRawVal) <<
" - " <<
int(dispatchVal));
231 bool hasMesh =
false;
238 copyPkt->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
245 copyPkt->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
253 NS_LOG_LOGIC(
"Dropped packet - we only support mesh if it is paired with a BC0");
262 NS_LOG_LOGIC(
"We have already seen this, no further processing.");
273 "SixLowPan mesh-under flooding can not currently handle extended address "
274 "final destinations: "
277 "SixLowPan mesh-under flooding can not currently handle devices using "
278 "extended addresses: "
291 NS_LOG_LOGIC(
"Not forwarding packet -- hop limit reached");
295 NS_LOG_LOGIC(
"Not forwarding packet -- I am the originator");
338 if (!isPktDecompressed)
344 copyPkt->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
356 isPktDecompressed =
true;
366 isPktDecompressed =
true;
380 isPktDecompressed =
true;
384 NS_LOG_DEBUG(
"Unsupported 6LoWPAN encoding: dropping.");
389 if (!isPktDecompressed)
395 NS_LOG_DEBUG(
"Packet decompressed received: " << *copyPkt);
490 return m_netDevice->AddLinkChangeCallback(callback);
563 ret =
DoSend(packet, src, dest, protocolNumber,
false);
571 uint16_t protocolNumber)
576 ret =
DoSend(packet, src, dest, protocolNumber,
true);
584 uint16_t protocolNumber,
587 NS_LOG_FUNCTION(
this << *packet << src << dest << protocolNumber << doSendFrom);
651 NS_LOG_LOGIC(
"Compressed packet too short, using uncompressed one");
667 std::list<Ptr<Packet>> fragmentList;
668 DoFragmentation(packet, origPacketSize, origHdrSize, extraHdrSize, fragmentList);
669 std::list<Ptr<Packet>>::iterator it;
671 for (it = fragmentList.begin(); it != fragmentList.end(); it++)
673 NS_LOG_DEBUG(
"SixLowPanNetDevice::Send (Fragment) " << **it);
679 (*it)->AddHeader(bc0Hdr);
680 (*it)->AddHeader(meshHdr);
684 success &=
m_netDevice->SendFrom(*it, src, destination, protocolNumber);
688 success &=
m_netDevice->Send(*it, destination, protocolNumber);
707 ret =
m_netDevice->SendFrom(packet, src, destination, protocolNumber);
712 ret =
m_netDevice->Send(packet, destination, protocolNumber);
787 NS_LOG_LOGIC(
"Checking source compression: " << mySrcAddr <<
" - " << srcAddr);
790 bool isSrcSrc = (memcmp(bufOne + 8, bufTwo + 8, 8) == 0);
817 NS_LOG_LOGIC(
"Checking destination compression: " << myDstAddr <<
" - " << dstAddr);
820 bool isDstDst = (memcmp(bufOne + 8, bufTwo + 8, 8) == 0);
880 NS_LOG_DEBUG(
"removed " << ret <<
" bytes - pkt is " << *packet);
886 const uint8_t* interface;
887 const uint8_t* prefix;
892 interface = encoding.GetSrcInterface();
893 for (
int j = 0; j < 8; j++)
902 for (
int j = 0; j < 8; j++)
910 interface = encoding.GetSrcInterface();
913 for (
int j = 0; j < 8; j++)
926 const uint8_t* interface;
927 const uint8_t* prefix;
932 interface = encoding.GetDstInterface();
933 for (
int j = 0; j < 8; j++)
942 for (
int j = 0; j < 8; j++)
950 interface = encoding.GetDstInterface();
953 for (
int j = 0; j < 8; j++)
981 "6LoWPAN: error in decompressing HC1 encoding, unsupported L4 compressed header present.");
997 NS_LOG_DEBUG(
"Original packet: " << *packet <<
" Size " << packet->
GetSize() <<
" src: " << src
1037 iphcHeader.
SetNh(
true);
1042 iphcHeader.
SetNh(
true);
1051 iphcHeader.
SetNh(
true);
1056 iphcHeader.
SetNh(
false);
1063 iphcHeader.
SetNh(
false);
1088 iphcHeader.
SetCid(
false);
1089 iphcHeader.
SetSac(
false);
1090 iphcHeader.
SetDac(
false);
1093 uint8_t unicastAddrCheckerBuf[16];
1094 checker.
GetBytes(unicastAddrCheckerBuf);
1095 uint8_t addressBuf[16];
1101 uint8_t srcContextId;
1114 NS_LOG_LOGIC(
"Checking stateful source compression: " << srcAddr);
1117 if (srcContextId != 0)
1137 uint8_t serializedCleanedAddress[16];
1138 cleanedAddr.
Serialize(serializedCleanedAddress);
1140 if (serializedCleanedAddress[8] == 0x00 &&
1141 serializedCleanedAddress[9] == 0x00 &&
1142 serializedCleanedAddress[10] == 0x00 &&
1143 serializedCleanedAddress[11] == 0xff &&
1144 serializedCleanedAddress[12] == 0xfe &&
1145 serializedCleanedAddress[13] == 0x00)
1160 NS_LOG_LOGIC(
"Checking stateless source compression: " << srcAddr);
1164 uint8_t serializedSrcAddress[16];
1165 srcAddr.
Serialize(serializedSrcAddress);
1171 else if (memcmp(addressBuf, unicastAddrCheckerBuf, 14) == 0)
1192 iphcHeader.
SetM(
true);
1196 iphcHeader.
SetM(
false);
1205 NS_LOG_LOGIC(
"Checking destination compression: " << dstAddr);
1207 uint8_t serializedDstAddress[16];
1208 dstAddr.
Serialize(serializedDstAddress);
1210 if (!iphcHeader.
GetM())
1214 uint8_t dstContextId;
1218 NS_LOG_LOGIC(
"Checking stateful destination compression: " << dstAddr);
1221 if (dstContextId != 0)
1241 uint8_t serializedCleanedAddress[16];
1242 cleanedAddr.
Serialize(serializedCleanedAddress);
1244 if (serializedCleanedAddress[8] == 0x00 &&
1245 serializedCleanedAddress[9] == 0x00 &&
1246 serializedCleanedAddress[10] == 0x00 &&
1247 serializedCleanedAddress[11] == 0xff &&
1248 serializedCleanedAddress[12] == 0xfe &&
1249 serializedCleanedAddress[13] == 0x00)
1263 NS_LOG_LOGIC(
"Checking stateless destination compression: " << dstAddr);
1269 else if (memcmp(addressBuf, unicastAddrCheckerBuf, 14) == 0)
1290 uint8_t dstContextId;
1296 uint8_t dstInlinePart[6] = {};
1297 dstInlinePart[0] = serializedDstAddress[1];
1298 dstInlinePart[1] = serializedDstAddress[2];
1299 dstInlinePart[2] = serializedDstAddress[12];
1300 dstInlinePart[3] = serializedDstAddress[13];
1301 dstInlinePart[4] = serializedDstAddress[14];
1302 dstInlinePart[5] = serializedDstAddress[15];
1305 if (dstContextId != 0)
1318 uint8_t multicastAddrCheckerBuf[16];
1320 multicastCheckAddress.
GetBytes(multicastAddrCheckerBuf);
1323 if (memcmp(addressBuf, multicastAddrCheckerBuf, 15) == 0)
1330 else if ((addressBuf[0] == multicastAddrCheckerBuf[0]) &&
1331 (memcmp(addressBuf + 2, multicastAddrCheckerBuf + 2, 11) == 0))
1333 uint8_t dstInlinePart[4] = {};
1334 memcpy(dstInlinePart, serializedDstAddress + 1, 1);
1335 memcpy(dstInlinePart + 1, serializedDstAddress + 13, 3);
1341 else if ((addressBuf[0] == multicastAddrCheckerBuf[0]) &&
1342 (memcmp(addressBuf + 2, multicastAddrCheckerBuf + 2, 9) == 0))
1344 uint8_t dstInlinePart[6] = {};
1345 memcpy(dstInlinePart, serializedDstAddress + 1, 1);
1346 memcpy(dstInlinePart + 1, serializedDstAddress + 11, 5);
1364 NS_LOG_DEBUG(
"Packet after IPHC compression: " << *packet);
1401 NS_LOG_DEBUG(
"removed " << ret <<
" bytes - pkt is " << *packet);
1419 NS_LOG_LOGIC(
"Unknown Source compression context (" << +contextId
1420 <<
"), dropping packet");
1425 NS_LOG_LOGIC(
"Expired Source compression context (" << +contextId
1426 <<
"), dropping packet");
1430 uint8_t contexPrefix[16];
1432 uint8_t contextLength =
m_contextTable[contextId].contextPrefix.GetPrefixLength();
1434 uint8_t srcAddress[16] = {};
1441 srcAddress[11] = 0xff;
1442 srcAddress[12] = 0xfe;
1450 uint8_t bytesToCopy = contextLength / 8;
1451 uint8_t bitsToCopy = contextLength % 8;
1454 for (uint8_t i = 0; i < bytesToCopy; i++)
1456 srcAddress[i] = contexPrefix[i];
1460 uint8_t addressBitMask = (1 << (8 - bitsToCopy)) - 1;
1461 uint8_t prefixBitMask = ~addressBitMask;
1462 srcAddress[bytesToCopy] = (contexPrefix[bytesToCopy] & prefixBitMask) |
1463 (srcAddress[bytesToCopy] & addressBitMask);
1474 uint8_t srcAddress[16] = {};
1480 uint8_t srcAddress[16] = {};
1482 srcAddress[0] = 0xfe;
1483 srcAddress[1] = 0x80;
1488 uint8_t srcAddress[16] = {};
1490 srcAddress[0] = 0xfe;
1491 srcAddress[1] = 0x80;
1492 srcAddress[11] = 0xff;
1493 srcAddress[12] = 0xfe;
1516 NS_LOG_LOGIC(
"Unknown Destination compression context (" << +contextId
1517 <<
"), dropping packet");
1522 NS_LOG_LOGIC(
"Expired Destination compression context (" << +contextId
1523 <<
"), dropping packet");
1527 uint8_t contexPrefix[16];
1529 uint8_t contextLength =
m_contextTable[contextId].contextPrefix.GetPrefixLength();
1531 if (encoding.
GetM() ==
false)
1534 uint8_t dstAddress[16] = {};
1541 dstAddress[11] = 0xff;
1542 dstAddress[12] = 0xfe;
1550 uint8_t bytesToCopy =
m_contextTable[contextId].contextPrefix.GetPrefixLength() / 8;
1551 uint8_t bitsToCopy = contextLength % 8;
1554 for (uint8_t i = 0; i < bytesToCopy; i++)
1556 dstAddress[i] = contexPrefix[i];
1560 uint8_t addressBitMask = (1 << (8 - bitsToCopy)) - 1;
1561 uint8_t prefixBitMask = ~addressBitMask;
1562 dstAddress[bytesToCopy] = (contexPrefix[bytesToCopy] & prefixBitMask) |
1563 (dstAddress[bytesToCopy] & addressBitMask);
1571 uint8_t dstAddress[16] = {};
1572 dstAddress[0] = 0xff;
1574 dstAddress[3] = contextLength;
1575 memcpy(dstAddress + 4, contexPrefix, 8);
1583 if (encoding.
GetM() ==
false)
1588 uint8_t dstAddress[16] = {};
1594 uint8_t dstAddress[16] = {};
1596 dstAddress[0] = 0xfe;
1597 dstAddress[1] = 0x80;
1602 uint8_t dstAddress[16] = {};
1604 dstAddress[0] = 0xfe;
1605 dstAddress[1] = 0x80;
1606 dstAddress[11] = 0xff;
1607 dstAddress[12] = 0xfe;
1620 uint8_t dstAddress[16] = {};
1626 uint8_t dstAddress[16] = {};
1627 dstAddress[0] = 0xff;
1634 uint8_t dstAddress[16] = {};
1635 dstAddress[0] = 0xff;
1642 uint8_t dstAddress[16] = {};
1643 dstAddress[0] = 0xff;
1644 dstAddress[1] = 0x02;
1652 uint8_t traf = 0x00;
1653 switch (encoding.
GetTf())
1656 traf |= encoding.
GetEcn();
1657 traf = (traf << 6) | encoding.
GetDscp();
1662 traf |= encoding.
GetEcn();
1668 traf |= encoding.
GetEcn();
1669 traf = (traf << 6) | encoding.
GetDscp();
1679 if (encoding.
GetNh())
1682 uint8_t dispatchRawVal = 0;
1685 packet->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
1700 if (retval.second ==
true)
1743 "LOWPAN_NHC MUST NOT be used to encode IPv6 Extension Headers "
1744 "that have more than 255 octets following the Length field after compression. "
1745 "Packet uncompressed.");
1758 nhcHeader.
SetNh(
true);
1763 nhcHeader.
SetNh(
true);
1772 nhcHeader.
SetNh(
true);
1777 nhcHeader.
SetNh(
false);
1784 nhcHeader.
SetNh(
false);
1802 "LOWPAN_NHC MUST NOT be used to encode IPv6 Extension Headers "
1803 "that have more than 255 octets following the Length field after compression. "
1804 "Packet uncompressed.");
1817 nhcHeader.
SetNh(
true);
1822 nhcHeader.
SetNh(
true);
1831 nhcHeader.
SetNh(
true);
1836 nhcHeader.
SetNh(
false);
1843 nhcHeader.
SetNh(
false);
1861 "LOWPAN_NHC MUST NOT be used to encode IPv6 Extension Headers "
1862 "that have more than 255 octets following the Length field after compression. "
1863 "Packet uncompressed.");
1875 nhcHeader.
SetNh(
true);
1880 nhcHeader.
SetNh(
true);
1889 nhcHeader.
SetNh(
true);
1894 nhcHeader.
SetNh(
false);
1901 nhcHeader.
SetNh(
false);
1919 "LOWPAN_NHC MUST NOT be used to encode IPv6 Extension Headers "
1920 "that have more than 255 octets following the Length field after compression. "
1921 "Packet uncompressed.");
1933 nhcHeader.
SetNh(
true);
1938 nhcHeader.
SetNh(
true);
1947 nhcHeader.
SetNh(
true);
1952 nhcHeader.
SetNh(
false);
1959 nhcHeader.
SetNh(
false);
1973 NS_ABORT_MSG(
"IPv6 Mobility Header is not supported in ns-3 yet");
1986 NS_LOG_DEBUG(
"Packet after NHC compression: " << *packet);
1990std::pair<uint8_t, bool>
2002 NS_LOG_DEBUG(
"removed " << ret <<
" bytes - pkt is " << *packet);
2010 uint8_t blobData[260];
2011 blobSize = encoding.
CopyBlob(blobData + 2, 260 - 2);
2012 uint8_t paddingSize = 0;
2014 uint8_t actualEncodedHeaderType = encoding.
GetEid();
2015 uint8_t actualHeaderType;
2018 switch (actualEncodedHeaderType)
2022 if (encoding.
GetNh())
2025 uint8_t dispatchRawVal = 0;
2028 packet->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
2047 if ((blobSize + 2) % 8 > 0)
2049 paddingSize = 8 - (blobSize + 2) % 8;
2051 if (paddingSize == 1)
2053 blobData[blobSize + 2] = 0;
2055 else if (paddingSize > 1)
2057 blobData[blobSize + 2] = 1;
2058 blobData[blobSize + 2 + 1] = paddingSize - 2;
2059 for (uint8_t i = 0; i < paddingSize - 2; i++)
2061 blobData[blobSize + 2 + 2 + i] = 0;
2064 blobData[1] = ((blobSize + 2 + paddingSize) >> 3) - 1;
2066 blob.
Begin().
Write(blobData, blobSize + 2 + paddingSize);
2074 if (encoding.
GetNh())
2077 uint8_t dispatchRawVal = 0;
2080 packet->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
2097 blobData[1] = ((blobSize + 2) >> 3) - 1;
2106 if (encoding.
GetNh())
2109 uint8_t dispatchRawVal = 0;
2112 packet->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
2140 if (encoding.
GetNh())
2143 uint8_t dispatchRawVal = 0;
2146 packet->
CopyData(&dispatchRawVal,
sizeof(dispatchRawVal));
2165 if ((blobSize + 2) % 8 > 0)
2167 paddingSize = 8 - (blobSize + 2) % 8;
2169 if (paddingSize == 1)
2171 blobData[blobSize + 2] = 0;
2173 else if (paddingSize > 1)
2175 blobData[blobSize + 2] = 1;
2176 blobData[blobSize + 2 + 1] = paddingSize - 2;
2177 for (uint8_t i = 0; i < paddingSize - 2; i++)
2179 blobData[blobSize + 2 + 2 + i] = 0;
2182 blobData[1] = ((blobSize + 2 + paddingSize) >> 3) - 1;
2184 blob.
Begin().
Write(blobData, blobSize + 2 + paddingSize);
2191 NS_ABORT_MSG(
"IPv6 Mobility Header is not supported in ns-3 yet");
2198 return std::pair<uint8_t, bool>(0,
true);
2202 NS_ABORT_MSG(
"Trying to decode unknown Extension Header");
2207 return std::pair<uint8_t, bool>(actualHeaderType,
false);
2224 udpNhcHeader.
SetC(
false);
2230 udpNhcHeader.
SetC(
true);
2258 "UDP_NHC Compression - UDP_NHC header size = " << udpNhcHeader.
GetSerializedSize());
2263 NS_LOG_DEBUG(
"Packet after UDP_NHC compression: " << *packet);
2277 NS_LOG_DEBUG(
"removed " << ret <<
" bytes - pkt is " << *packet);
2308 if (encoding.
GetC())
2342 uint16_t offsetData = 0;
2343 uint16_t offset = 0;
2357 "6LoWPAN: can not fragment, 6LoWPAN headers are bigger than MTU");
2360 size = l2Mtu - frag1Hdr.
GetSerializedSize() - compressedHeaderSize - extraHdrSize;
2362 size += compressedHeaderSize;
2367 offset += size + origHdrSize - compressedHeaderSize;
2371 listFragments.push_back(fragment1);
2373 bool moreFrag =
true;
2392 NS_LOG_LOGIC(
"Fragment creation - " << offset <<
", " << offset);
2400 listFragments.push_back(fragment);
2416 key.first = std::pair<Address, Address>(src, dst);
2419 uint16_t offset = 0;
2433 uint8_t dispatchRawValFrag1 = 0;
2438 p->
CopyData(&dispatchRawValFrag1,
sizeof(dispatchRawValFrag1));
2440 NS_LOG_DEBUG(
"Dispatches: " <<
int(dispatchRawValFrag1) <<
" - " <<
int(dispatchValFrag1));
2443 switch (dispatchValFrag1)
2465 key.second = std::pair<uint16_t, uint16_t>(frag1Header.
GetDatagramSize(),
2473 key.second = std::pair<uint16_t, uint16_t>(fragNHeader.
GetDatagramSize(),
2479 MapFragments_t::iterator it =
m_fragments.find(key);
2488 std::list<Ptr<Packet>> storedFragments =
m_fragments[oldestKey]->GetFraments();
2490 fragIter != storedFragments.end();
2500 fragments = Create<Fragments>();
2502 m_fragments.insert(std::make_pair(key, fragments));
2510 fragments = it->second;
2532 fragments =
nullptr;
2556 std::list<std::pair<Ptr<Packet>, uint16_t>>::iterator it;
2557 bool duplicate =
false;
2561 if (it->second > fragmentOffset)
2565 if (it->second == fragmentOffset)
2569 "Duplicate fragment size differs. Aborting.");
2575 m_fragments.insert(it, std::make_pair(fragment, fragmentOffset));
2584 m_firstFragment = fragment;
2593 uint16_t lastEndOffset = 0;
2602 NS_LOG_LOGIC(
"Checking overlaps " << lastEndOffset <<
" - " << it->second);
2604 if (lastEndOffset < it->
second)
2610 uint16_t fragmentEnd = it->first->GetSize() + it->second;
2611 lastEndOffset =
std::max(lastEndOffset, fragmentEnd);
2615 if (ret && (lastEndOffset == m_packetSize))
2627 std::list<std::pair<Ptr<Packet>, uint16_t>>::const_iterator it =
m_fragments.begin();
2630 uint16_t lastEndOffset = 0;
2634 lastEndOffset = it->first->GetSize();
2638 if (lastEndOffset > it->second)
2640 NS_ABORT_MSG(
"Overlapping fragments found, forbidden condition");
2647 lastEndOffset += it->first->GetSize();
2660std::list<Ptr<Packet>>
2663 std::list<Ptr<Packet>> fragments;
2664 std::list<std::pair<Ptr<Packet>, uint16_t>>::const_iterator iter;
2667 fragments.push_back(iter->first);
2675 m_timeoutIter = iter;
2681 return m_timeoutIter;
2689 MapFragments_t::iterator it =
m_fragments.find(key);
2690 std::list<Ptr<Packet>> storedFragments = it->second->GetFraments();
2692 fragIter != storedFragments.end();
2698 it->second =
nullptr;
2757 bool compressionAllowed,
2761 << contextPrefix << compressionAllowed << validLifetime.
As(
Time::S));
2765 NS_LOG_LOGIC(
"Invalid context ID (" << +contextId <<
"), ignoring");
2769 if (validLifetime ==
Time(0))
2771 NS_LOG_LOGIC(
"Context (" << +contextId <<
"), removed (validity time is zero)");
2777 m_contextTable[contextId].compressionAllowed = compressionAllowed;
2784 bool& compressionAllowed,
2785 Time& validLifetime)
2791 NS_LOG_LOGIC(
"Invalid context ID (" << +contextId <<
"), ignoring");
2797 NS_LOG_LOGIC(
"Context not found (" << +contextId <<
"), ignoring");
2802 compressionAllowed =
m_contextTable[contextId].compressionAllowed;
2815 NS_LOG_LOGIC(
"Invalid context ID (" << +contextId <<
"), ignoring");
2821 NS_LOG_LOGIC(
"Context not found (" << +contextId <<
"), ignoring");
2835 NS_LOG_LOGIC(
"Invalid context ID (" << +contextId <<
"), ignoring");
2841 NS_LOG_LOGIC(
"Context not found (" << +contextId <<
"), ignoring");
2854 NS_LOG_LOGIC(
"Invalid context ID (" << +contextId <<
"), ignoring");
2860 NS_LOG_LOGIC(
"Context not found (" << +contextId <<
"), ignoring");
2881 << +contextId <<
" "
2885 contextId = iter.first;
2909 if (contextLength <= 64)
2911 uint8_t contextBytes[16];
2912 uint8_t addressBytes[16];
2915 address.GetBytes(addressBytes);
2917 if (addressBytes[3] == contextLength && addressBytes[4] == contextBytes[0] &&
2918 addressBytes[5] == contextBytes[1] && addressBytes[6] == contextBytes[2] &&
2919 addressBytes[7] == contextBytes[3] && addressBytes[8] == contextBytes[4] &&
2920 addressBytes[9] == contextBytes[5] && addressBytes[10] == contextBytes[6] &&
2921 addressBytes[11] == contextBytes[7])
2924 << +contextId <<
" "
2928 contextId = iter.first;
2940 uint8_t addressBytes[16];
2941 address.GetBytes(addressBytes);
2944 uint8_t bytesToClean = prefixLength / 8;
2945 uint8_t bitsToClean = prefixLength % 8;
2946 for (uint8_t i = 0; i < bytesToClean; i++)
2948 addressBytes[i] = 0;
2952 uint8_t cleanupMask = (1 << bitsToClean) - 1;
2953 addressBytes[bytesToClean] &= cleanupMask;
2958 return cleanedAddress;
a polymophic address class
uint32_t CopyTo(uint8_t buffer[MAX_SIZE]) const
Copy the address bytes into a buffer.
AttributeValue implementation for Boolean.
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.
uint8_t GetHopLimit() const
Get the "Hop limit" field (TTL).
const uint8_t * GetSrcPrefix() const
Get the source prefix.
void SetFlowLabel(uint32_t flowLabel)
Set the Flow Label value.
uint8_t GetTrafficClass() const
Get the Traffic Class 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).
uint32_t GetFlowLabel() const
Get the Flow Label value.
const uint8_t * GetDstPrefix() const
Get the destination prefix.
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.
uint8_t GetNextHeader() const
Get the Next Header value.
void SetSrcInterface(const uint8_t *srcInterface)
Set the source interface.
LowPanHc1Addr_e GetDstCompression() const
Get Destination Compression type.
bool IsHc2HeaderPresent() const
Check if there is a HC2 compressed header.
LowPanHc1Addr_e GetSrcCompression() const
Get Source Compression type.
bool IsTcflCompression() const
Check if the Traffic Class and Flow Labels are compressed.
LOWPAN_IPHC base Encoding - see RFC 6282.
bool GetSac() const
Get the SAC (Source Address Compression) compression.
void SetNextHeader(uint8_t nextHeader)
Set the Next Header field.
uint8_t GetNextHeader() const
Get the Next Header field.
void SetHlim(Hlim_e hlimField)
Set the HLIM (Hop Limit) compression.
void SetDstContextId(uint8_t dstContextId)
Set the DstContextId.
const uint8_t * GetSrcInlinePart() const
brief Get the source address inline part
void SetSam(HeaderCompression_e samField)
Set the SAM (Source Address Mode) compression.
void SetNh(bool nhField)
Set the NH (Next Header) compression.
uint8_t GetDscp() const
Get the DSCP.
HeaderCompression_e GetDam() const
Get the DAM (Destination Address Mode) compression.
uint8_t GetHopLimit() const
Get the Hop Limit field.
bool GetDac() const
Get the DAC (Destination Address Compression) 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).
uint32_t GetFlowLabel() const
Get the Flow Label.
void SetTf(TrafficClassFlowLabel_e tfField)
Set the TF (Traffic Class, Flow Label) compression.
uint8_t GetEcn() const
Get the ECN.
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 GetNh() const
Get the NH (Next Header) compression.
TrafficClassFlowLabel_e GetTf() const
Get the TF (Traffic Class, Flow Label) compression.
bool GetM() const
Get the M (Multicast) compression.
HeaderCompression_e GetSam() const
Get the SAM (Source Address Mode) 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.
const uint8_t * GetDstInlinePart() const
brief Get the destination address inline part
uint8_t GetSrcContextId() const
Get the SrcContextId.
void SetHopLimit(uint8_t hopLimit)
Set the Hop Limit field.
uint8_t GetDstContextId() const
Get the DstContextId.
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.
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.
std::list< Ptr< Packet > > GetFraments() const
Get a list of the current stored fragments.
void AddFirstFragment(Ptr< Packet > fragment)
Add the first packet fragment.
Shim performing 6LoWPAN compression, decompression and fragmentation.
bool IsLinkUp() const override
std::map< FragmentKey_t, Ptr< Fragments > >::iterator MapFragmentsI_t
Container Iterator for fragment key -> fragments.
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
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.
void DoFragmentation(Ptr< Packet > packet, uint32_t origPacketSize, uint32_t origHdrSize, uint32_t extraHdrSize, std::list< Ptr< Packet > > &listFragments)
Performs a packet fragmentation.
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.
std::list< std::tuple< Time, FragmentKey_t, uint32_t > >::iterator FragmentsTimeoutsListI_t
Container Iterator for fragment timeouts.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
bool m_forceEtherType
Force the EtherType number.
Address GetAddress() const override
void SetReceiveCallback(NetDevice::ReceiveCallback cb) override
uint32_t m_compressionThreshold
Minimum L2 payload size.
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.
uint16_t m_etherType
EtherType number (used only if m_forceEtherType is true).
LOWPAN_NHC Extension Header Encoding - see RFC 6282.
bool GetNh() const
Get the Next Header field value.
Eid_e GetEid() const
Get the Extension Header Type.
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
uint32_t CopyBlob(uint8_t *blob, uint32_t size) const
Get the option header data blob.
uint8_t GetNextHeader() const
Get the Next Header field value.
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_e GetPorts() const
Get the compressed Src and Dst Ports.
uint16_t GetChecksum() const
Get the Checksum field value.
uint16_t GetDstPort() const
Get the Destination Port.
@ PORTS_LAST_SRC_LAST_DST
void SetPorts(Ports_e port)
Set the compressed Src and Dst Ports.
bool GetC() const
Get the C (Checksum).
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).
uint16_t GetSrcPort() const
Get the Source Port.
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.
AttributeValue implementation for Time.
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...
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
#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.
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 AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
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.