25 #include "ns3/channel.h"
26 #include "ns3/packet.h"
28 #include "ns3/boolean.h"
29 #include "ns3/uinteger.h"
30 #include "ns3/simulator.h"
31 #include "ns3/mac16-address.h"
32 #include "ns3/mac48-address.h"
33 #include "ns3/mac64-address.h"
34 #include "ns3/ipv6-l3-protocol.h"
35 #include "ns3/ipv6-extension-header.h"
36 #include "ns3/udp-header.h"
37 #include "ns3/udp-l4-protocol.h"
38 #include "ns3/string.h"
39 #include "ns3/pointer.h"
53 .SetGroupName (
"SixLowPan")
55 .AddAttribute (
"Rfc6282",
"Use RFC6282 (IPHC) if true, RFC4944 (HC1) otherwise.",
59 .AddAttribute (
"OmitUdpChecksum",
60 "Omit the UDP checksum in IPHC compression.",
64 .AddAttribute (
"FragmentReassemblyListSize",
"The maximum size of the reassembly buffer (in packets). Zero meaning infinite.",
67 MakeUintegerChecker<uint16_t> ())
68 .AddAttribute (
"FragmentExpirationTimeout",
69 "When this timeout expires, the fragments will be cleared from the buffer.",
73 .AddAttribute (
"CompressionThreshold",
74 "The minimum MAC layer payload size.",
77 MakeUintegerChecker<uint32_t> ())
78 .AddAttribute (
"ForceEtherType",
79 "Force a specific EtherType in L2 frames.",
83 .AddAttribute (
"EtherType",
84 "The specific EtherType to be used in L2 frames.",
87 MakeUintegerChecker<uint16_t> ())
88 .AddAttribute (
"UseMeshUnder",
89 "Use a mesh-under routing protocol.",
93 .AddAttribute (
"MeshUnderRadius",
94 "Hops Left to use in mesh-under.",
97 MakeUintegerChecker<uint8_t> ())
98 .AddAttribute (
"MeshCacheLength",
99 "Length of the cache for each source.",
102 MakeUintegerChecker<uint16_t> ())
103 .AddAttribute (
"MeshUnderJitter",
104 "The jitter in ms a node uses to forward mesh-under packets - used to prevent collisions",
105 StringValue (
"ns3::UniformRandomVariable[Min=0.0|Max=10.0]"),
107 MakePointerChecker<RandomVariableStream> ())
108 .AddTraceSource (
"Tx",
109 "Send - packet (including 6LoWPAN header), "
110 "SixLoWPanNetDevice Ptr, interface index.",
112 "ns3::SixLowPanNetDevice::RxTxTracedCallback")
113 .AddTraceSource (
"Rx",
114 "Receive - packet (including 6LoWPAN header), "
115 "SixLoWPanNetDevice Ptr, interface index.",
117 "ns3::SixLowPanNetDevice::RxTxTracedCallback")
118 .AddTraceSource (
"Drop",
119 "Drop - DropReason, packet (including 6LoWPAN header), "
120 "SixLoWPanNetDevice Ptr, interface index.",
122 "ns3::SixLowPanNetDevice::DropTracedCallback")
134 m_rng = CreateObject<UniformRandomVariable> ();
151 uint16_t protocolType = 0;
158 protocolType, device,
false);
198 NS_LOG_FUNCTION (
this << incomingPort << packet << protocol << src << dst);
200 uint8_t dispatchRawVal = 0;
206 copyPkt->
CopyData (&dispatchRawVal,
sizeof(dispatchRawVal));
208 bool isPktDecompressed =
false;
209 bool fragmented =
false;
213 NS_LOG_DEBUG (
"Dispatches: " <<
int(dispatchRawVal) <<
" - " <<
int(dispatchVal) );
217 bool hasMesh =
false;
224 copyPkt->
CopyData (&dispatchRawVal,
sizeof(dispatchRawVal));
231 copyPkt->
CopyData (&dispatchRawVal,
sizeof(dispatchRawVal));
239 NS_LOG_LOGIC (
"Dropped packet - we only support mesh if it is paired with a BC0");
248 NS_LOG_LOGIC (
"We have already seen this, no further processing.");
273 NS_LOG_LOGIC (
"Not forwarding packet -- hop limit reached");
277 NS_LOG_LOGIC (
"Not forwarding packet -- I am the originator");
310 isPktDecompressed =
ProcessFragment (copyPkt, realSrc, realDst,
false);
315 if ( !isPktDecompressed )
321 copyPkt->
CopyData (&dispatchRawVal,
sizeof(dispatchRawVal));
326 switch ( dispatchVal )
333 isPktDecompressed =
true;
343 isPktDecompressed =
true;
357 isPktDecompressed =
true;
361 NS_LOG_DEBUG (
"Unsupported 6LoWPAN encoding: dropping.");
366 if ( !isPktDecompressed )
372 NS_LOG_DEBUG (
"Packet decompressed received: " << *copyPkt );
516 uint16_t protocolNumber)
522 ret =
DoSend (packet, src, dest, protocolNumber,
false);
529 uint16_t protocolNumber)
534 ret =
DoSend (packet, src, dest, protocolNumber,
true);
541 uint16_t protocolNumber,
544 NS_LOG_FUNCTION (
this << *packet << src << dest << protocolNumber << doSendFrom);
548 uint32_t origHdrSize = 0;
549 uint32_t origPacketSize = packet->
GetSize ();
576 uint32_t extraHdrSize = 0;
608 NS_LOG_LOGIC (
"Compressed packet too short, using uncompressed one");
624 std::list<Ptr<Packet> > fragmentList;
625 DoFragmentation (packet, origPacketSize, origHdrSize, extraHdrSize, fragmentList);
626 std::list<Ptr<Packet> >::iterator it;
628 for ( it = fragmentList.begin (); it != fragmentList.end (); it++ )
630 NS_LOG_DEBUG (
"SixLowPanNetDevice::Send (Fragment) " << **it );
636 (*it)->AddHeader (bc0Hdr);
637 (*it)->AddHeader (meshHdr);
738 NS_LOG_LOGIC (
"Checking source compression: " << mySrcAddr <<
" - " << srcAddr );
741 bool isSrcSrc = (memcmp (bufOne + 8, bufTwo + 8, 8) == 0);
768 NS_LOG_LOGIC (
"Checking destination compression: " << myDstAddr <<
" - " << dstAddr );
771 bool isDstDst = (memcmp (bufOne + 8, bufTwo + 8, 8) == 0);
830 [[maybe_unused]] uint32_t ret = packet->
RemoveHeader (encoding);
831 NS_LOG_DEBUG (
"removed " << ret <<
" bytes - pkt is " << *packet);
837 const uint8_t* interface;
838 const uint8_t* prefix;
843 interface = encoding.GetSrcInterface ();
844 for (
int j = 0; j < 8; j++)
853 for (
int j = 0; j < 8; j++)
861 interface = encoding.GetSrcInterface ();
864 for (
int j = 0; j < 8; j++)
877 const uint8_t* interface;
878 const uint8_t* prefix;
883 interface = encoding.GetDstInterface ();
884 for (
int j = 0; j < 8; j++)
893 for (
int j = 0; j < 8; j++)
901 interface = encoding.GetDstInterface ();
904 for (
int j = 0; j < 8; j++)
931 "6LoWPAN: error in decompressing HC1 encoding, unsupported L4 compressed header present.");
947 NS_LOG_DEBUG (
"Original packet: " << *packet <<
" Size " << packet->
GetSize () <<
" src: " << src <<
" dst: " << dst);
986 iphcHeader.
SetNh (
true);
991 iphcHeader.
SetNh (
true);
1000 iphcHeader.
SetNh (
true);
1005 iphcHeader.
SetNh (
false);
1012 iphcHeader.
SetNh (
false);
1037 iphcHeader.
SetCid (
false);
1038 iphcHeader.
SetSac (
false);
1039 iphcHeader.
SetDac (
false);
1043 uint8_t unicastAddrCheckerBuf[16];
1044 checker.
GetBytes (unicastAddrCheckerBuf);
1045 uint8_t addressBuf[16];
1051 uint8_t srcContextId;
1058 iphcHeader.
SetSac (
true);
1064 NS_LOG_LOGIC (
"Checking stateful source compression: " << srcAddr );
1066 iphcHeader.
SetSac (
true);
1067 if (srcContextId != 0)
1071 iphcHeader.
SetCid (
true);
1083 uint8_t serializedCleanedAddress[16];
1084 cleanedAddr.
Serialize (serializedCleanedAddress);
1086 if ( serializedCleanedAddress[8] == 0x00 && serializedCleanedAddress[9] == 0x00 &&
1087 serializedCleanedAddress[10] == 0x00 && serializedCleanedAddress[11] == 0xff &&
1088 serializedCleanedAddress[12] == 0xfe && serializedCleanedAddress[13] == 0x00 )
1104 NS_LOG_LOGIC (
"Checking stateless source compression: " << srcAddr );
1108 uint8_t serializedSrcAddress[16];
1109 srcAddr.
Serialize (serializedSrcAddress);
1115 else if (memcmp (addressBuf, unicastAddrCheckerBuf, 14) == 0)
1136 iphcHeader.
SetM (
true);
1140 iphcHeader.
SetM (
false);
1149 NS_LOG_LOGIC (
"Checking destination compression: " << dstAddr );
1151 uint8_t serializedDstAddress[16];
1152 dstAddr.
Serialize (serializedDstAddress);
1154 if ( !iphcHeader.
GetM () )
1158 uint8_t dstContextId;
1162 NS_LOG_LOGIC (
"Checking stateful destination compression: " << dstAddr );
1164 iphcHeader.
SetDac (
true);
1165 if (dstContextId != 0)
1169 iphcHeader.
SetCid (
true);
1181 uint8_t serializedCleanedAddress[16];
1182 cleanedAddr.
Serialize (serializedCleanedAddress);
1184 if ( serializedCleanedAddress[8] == 0x00 && serializedCleanedAddress[9] == 0x00 &&
1185 serializedCleanedAddress[10] == 0x00 && serializedCleanedAddress[11] == 0xff &&
1186 serializedCleanedAddress[12] == 0xfe && serializedCleanedAddress[13] == 0x00 )
1200 NS_LOG_LOGIC (
"Checking stateless destination compression: " << dstAddr );
1206 else if (memcmp (addressBuf, unicastAddrCheckerBuf, 14) == 0)
1227 uint8_t dstContextId;
1233 uint8_t dstInlinePart[6] = {};
1234 dstInlinePart[0] = serializedDstAddress[1];
1235 dstInlinePart[1] = serializedDstAddress[2];
1236 dstInlinePart[2] = serializedDstAddress[12];
1237 dstInlinePart[3] = serializedDstAddress[13];
1238 dstInlinePart[4] = serializedDstAddress[14];
1239 dstInlinePart[5] = serializedDstAddress[15];
1241 iphcHeader.
SetDac (
true);
1242 if (dstContextId != 0)
1246 iphcHeader.
SetCid (
true);
1255 uint8_t multicastAddrCheckerBuf[16];
1257 multicastCheckAddress.
GetBytes (multicastAddrCheckerBuf);
1260 if ( memcmp (addressBuf, multicastAddrCheckerBuf, 15) == 0 )
1267 else if ( (addressBuf[0] == multicastAddrCheckerBuf[0])
1268 && (memcmp (addressBuf + 2, multicastAddrCheckerBuf + 2, 11) == 0) )
1270 uint8_t dstInlinePart[4] = {};
1271 memcpy (dstInlinePart, serializedDstAddress+1, 1);
1272 memcpy (dstInlinePart+1, serializedDstAddress+13, 3);
1278 else if ( (addressBuf[0] == multicastAddrCheckerBuf[0])
1279 && (memcmp (addressBuf + 2, multicastAddrCheckerBuf + 2, 9) == 0) )
1281 uint8_t dstInlinePart[6] = {};
1282 memcpy (dstInlinePart, serializedDstAddress+1, 1);
1283 memcpy (dstInlinePart+1, serializedDstAddress+11, 5);
1301 NS_LOG_DEBUG (
"Packet after IPHC compression: " << *packet);
1337 [[maybe_unused]] uint32_t ret = packet->
RemoveHeader (encoding);
1338 NS_LOG_DEBUG (
"removed " << ret <<
" bytes - pkt is " << *packet);
1344 if ( encoding.
GetSac () )
1356 NS_LOG_LOGIC (
"Unknown Source compression context (" << +contextId <<
"), dropping packet");
1361 NS_LOG_LOGIC (
"Expired Source compression context (" << +contextId <<
"), dropping packet");
1365 uint8_t contexPrefix[16];
1367 uint8_t contextLength =
m_contextTable[contextId].contextPrefix.GetPrefixLength ();
1369 uint8_t srcAddress[16] = { };
1376 srcAddress[11] = 0xff;
1377 srcAddress[12] = 0xfe;
1385 uint8_t bytesToCopy = contextLength / 8;
1386 uint8_t bitsToCopy = contextLength % 8;
1389 for (uint8_t i=0; i<bytesToCopy; i++)
1391 srcAddress[i] = contexPrefix[i];
1395 uint8_t addressBitMask = (1<<(8-bitsToCopy))-1;
1396 uint8_t prefixBitMask = ~addressBitMask;
1397 srcAddress[bytesToCopy] = (contexPrefix[bytesToCopy] & prefixBitMask) | (srcAddress[bytesToCopy] & addressBitMask);
1408 uint8_t srcAddress[16] = { };
1414 uint8_t srcAddress[16] = { };
1416 srcAddress[0] = 0xfe;
1417 srcAddress[1] = 0x80;
1422 uint8_t srcAddress[16] = { };
1424 srcAddress[0] = 0xfe;
1425 srcAddress[1] = 0x80;
1426 srcAddress[11] = 0xff;
1427 srcAddress[12] = 0xfe;
1436 if ( encoding.
GetDac () )
1450 NS_LOG_LOGIC (
"Unknown Destination compression context (" << +contextId <<
"), dropping packet");
1455 NS_LOG_LOGIC (
"Expired Destination compression context (" << +contextId <<
"), dropping packet");
1459 uint8_t contexPrefix[16];
1461 uint8_t contextLength =
m_contextTable[contextId].contextPrefix.GetPrefixLength ();
1463 if (encoding.
GetM () ==
false)
1466 uint8_t dstAddress[16] = { };
1473 dstAddress[11] = 0xff;
1474 dstAddress[12] = 0xfe;
1482 uint8_t bytesToCopy =
m_contextTable[contextId].contextPrefix.GetPrefixLength () / 8;
1483 uint8_t bitsToCopy = contextLength % 8;
1486 for (uint8_t i=0; i<bytesToCopy; i++)
1488 dstAddress[i] = contexPrefix[i];
1492 uint8_t addressBitMask = (1<<(8-bitsToCopy))-1;
1493 uint8_t prefixBitMask = ~addressBitMask;
1494 dstAddress[bytesToCopy] = (contexPrefix[bytesToCopy] & prefixBitMask) | (dstAddress[bytesToCopy] & addressBitMask);
1502 uint8_t dstAddress[16] = { };
1503 dstAddress[0] = 0xff;
1505 dstAddress[3] = contextLength;
1506 memcpy (dstAddress +4, contexPrefix, 8);
1514 if (encoding.
GetM () ==
false)
1519 uint8_t dstAddress[16] = { };
1525 uint8_t dstAddress[16] = { };
1527 dstAddress[0] = 0xfe;
1528 dstAddress[1] = 0x80;
1533 uint8_t dstAddress[16] = { };
1535 dstAddress[0] = 0xfe;
1536 dstAddress[1] = 0x80;
1537 dstAddress[11] = 0xff;
1538 dstAddress[12] = 0xfe;
1551 uint8_t dstAddress[16] = { };
1557 uint8_t dstAddress[16] = { };
1558 dstAddress[0] = 0xff;
1565 uint8_t dstAddress[16] = { };
1566 dstAddress[0] = 0xff;
1573 uint8_t dstAddress[16] = { };
1574 dstAddress[0] = 0xff;
1575 dstAddress[1] = 0x02;
1583 uint8_t traf = 0x00;
1584 switch (encoding.
GetTf ())
1587 traf |= encoding.
GetEcn ();
1588 traf = ( traf << 6 ) | encoding.
GetDscp ();
1593 traf |= encoding.
GetEcn ();
1599 traf |= encoding.
GetEcn ();
1600 traf = ( traf << 6 ) | encoding.
GetDscp ();
1610 if ( encoding.
GetNh () )
1613 uint8_t dispatchRawVal = 0;
1616 packet->
CopyData (&dispatchRawVal,
sizeof(dispatchRawVal));
1627 if ( retval.second ==
true )
1666 NS_LOG_DEBUG (
"LOWPAN_NHC MUST NOT be used to encode IPv6 Extension Headers "
1667 "that have more than 255 octets following the Length field after compression. "
1668 "Packet uncompressed.");
1681 nhcHeader.
SetNh (
true);
1686 nhcHeader.
SetNh (
true);
1695 nhcHeader.
SetNh (
true);
1700 nhcHeader.
SetNh (
false);
1707 nhcHeader.
SetNh (
false);
1724 NS_LOG_DEBUG (
"LOWPAN_NHC MUST NOT be used to encode IPv6 Extension Headers "
1725 "that have more than 255 octets following the Length field after compression. "
1726 "Packet uncompressed.");
1739 nhcHeader.
SetNh (
true);
1744 nhcHeader.
SetNh (
true);
1753 nhcHeader.
SetNh (
true);
1758 nhcHeader.
SetNh (
false);
1765 nhcHeader.
SetNh (
false);
1782 NS_LOG_DEBUG (
"LOWPAN_NHC MUST NOT be used to encode IPv6 Extension Headers "
1783 "that have more than 255 octets following the Length field after compression. "
1784 "Packet uncompressed.");
1796 nhcHeader.
SetNh (
true);
1801 nhcHeader.
SetNh (
true);
1810 nhcHeader.
SetNh (
true);
1815 nhcHeader.
SetNh (
false);
1822 nhcHeader.
SetNh (
false);
1839 NS_LOG_DEBUG (
"LOWPAN_NHC MUST NOT be used to encode IPv6 Extension Headers "
1840 "that have more than 255 octets following the Length field after compression. "
1841 "Packet uncompressed.");
1853 nhcHeader.
SetNh (
true);
1858 nhcHeader.
SetNh (
true);
1867 nhcHeader.
SetNh (
true);
1872 nhcHeader.
SetNh (
false);
1879 nhcHeader.
SetNh (
false);
1893 NS_ABORT_MSG (
"IPv6 Mobility Header is not supported in ns-3 yet");
1906 NS_LOG_DEBUG (
"Packet after NHC compression: " << *packet);
1910 std::pair <uint8_t, bool>
1917 [[maybe_unused]] uint32_t ret = packet->
RemoveHeader (encoding);
1918 NS_LOG_DEBUG (
"removed " << ret <<
" bytes - pkt is " << *packet);
1926 uint8_t blobData[260];
1927 blobSize = encoding.
CopyBlob (blobData + 2, 260 - 2);
1928 uint8_t paddingSize = 0;
1930 uint8_t actualEncodedHeaderType = encoding.
GetEid ();
1931 uint8_t actualHeaderType;
1934 switch (actualEncodedHeaderType)
1938 if ( encoding.
GetNh () )
1941 uint8_t dispatchRawVal = 0;
1944 packet->
CopyData (&dispatchRawVal,
sizeof(dispatchRawVal));
1963 if ((blobSize + 2) % 8 > 0)
1965 paddingSize = 8 - (blobSize + 2) % 8;
1967 if (paddingSize == 1)
1969 blobData[blobSize + 2] = 0;
1971 else if (paddingSize > 1)
1973 blobData[blobSize + 2] = 1;
1974 blobData[blobSize + 2 + 1] = paddingSize - 2;
1975 for (uint8_t i = 0; i < paddingSize - 2; i++)
1977 blobData[blobSize + 2 + 2 + i] = 0;
1980 blobData [1] = ((blobSize + 2 + paddingSize) >> 3) - 1;
1981 blob.
AddAtStart (blobSize + 2 + paddingSize);
1982 blob.
Begin ().
Write (blobData, blobSize + 2 + paddingSize);
1990 if ( encoding.
GetNh () )
1993 uint8_t dispatchRawVal = 0;
1996 packet->
CopyData (&dispatchRawVal,
sizeof(dispatchRawVal));
2013 blobData [1] = ((blobSize + 2) >> 3) - 1;
2015 blob.
Begin ().
Write (blobData, blobSize + 2);
2022 if ( encoding.
GetNh () )
2025 uint8_t dispatchRawVal = 0;
2028 packet->
CopyData (&dispatchRawVal,
sizeof(dispatchRawVal));
2048 blob.
Begin ().
Write (blobData, blobSize + 2);
2056 if ( encoding.
GetNh () )
2059 uint8_t dispatchRawVal = 0;
2062 packet->
CopyData (&dispatchRawVal,
sizeof(dispatchRawVal));
2081 if ((blobSize + 2) % 8 > 0)
2083 paddingSize = 8 - (blobSize + 2) % 8;
2085 if (paddingSize == 1)
2087 blobData[blobSize + 2] = 0;
2089 else if (paddingSize > 1)
2091 blobData[blobSize + 2] = 1;
2092 blobData[blobSize + 2 + 1] = paddingSize - 2;
2093 for (uint8_t i = 0; i < paddingSize - 2; i++)
2095 blobData[blobSize + 2 + 2 + i] = 0;
2098 blobData [1] = ((blobSize + 2 + paddingSize) >> 3) - 1;
2099 blob.
AddAtStart (blobSize + 2 + paddingSize);
2100 blob.
Begin ().
Write (blobData, blobSize + 2 + paddingSize);
2107 NS_ABORT_MSG (
"IPv6 Mobility Header is not supported in ns-3 yet");
2114 return std::pair<uint8_t, bool> (0,
true);
2118 NS_ABORT_MSG (
"Trying to decode unknown Extension Header");
2123 return std::pair<uint8_t, bool> (actualHeaderType,
false);
2140 udpNhcHeader.
SetC (
false);
2146 udpNhcHeader.
SetC (
true);
2176 NS_LOG_DEBUG (
"Packet after UDP_NHC compression: " << *packet);
2189 [[maybe_unused]] uint32_t ret = packet->
RemoveHeader (encoding);
2190 NS_LOG_DEBUG (
"removed " << ret <<
" bytes - pkt is " << *packet);
2211 temp = (0xf0b << 4) | encoding.
GetSrcPort ();
2213 temp = (0xf0b << 4) | encoding.
GetDstPort ();
2221 if ( encoding.
GetC () )
2247 uint32_t origPacketSize,
2248 uint32_t origHdrSize,
2249 uint32_t extraHdrSize,
2256 uint16_t offsetData = 0;
2257 uint16_t offset = 0;
2260 uint32_t compressedHeaderSize =
packetSize - (origPacketSize - origHdrSize);
2271 "6LoWPAN: can not fragment, 6LoWPAN headers are bigger than MTU");
2274 size = l2Mtu - frag1Hdr.
GetSerializedSize () - compressedHeaderSize - extraHdrSize;
2276 size += compressedHeaderSize;
2281 offset += size + origHdrSize - compressedHeaderSize;
2285 listFragments.push_back (fragment1);
2287 bool moreFrag =
true;
2306 NS_LOG_LOGIC (
"Fragment creation - " << offset <<
", " << offset );
2314 listFragments.push_back (fragment);
2329 key.first = std::pair<Address, Address> (src, dst);
2332 uint16_t offset = 0;
2346 uint8_t dispatchRawValFrag1 = 0;
2351 p->
CopyData (&dispatchRawValFrag1,
sizeof(dispatchRawValFrag1));
2353 NS_LOG_DEBUG (
"Dispatches: " <<
int(dispatchRawValFrag1) <<
" - " <<
int(dispatchValFrag1) );
2356 switch ( dispatchValFrag1 )
2391 MapFragments_t::iterator it =
m_fragments.find (key);
2400 std::list< Ptr<Packet> > storedFragments =
m_fragments[oldestKey]->GetFraments ();
2402 fragIter != storedFragments.end (); fragIter++)
2412 fragments = Create<Fragments> ();
2414 m_fragments.insert (std::make_pair (key, fragments));
2422 fragments = it->second;
2467 std::list<std::pair<Ptr<Packet>, uint16_t> >::iterator it;
2468 bool duplicate =
false;
2472 if (it->second > fragmentOffset)
2476 if (it->second == fragmentOffset)
2479 NS_ASSERT_MSG (fragment->
GetSize () == it->first->GetSize (),
"Duplicate fragment size differs. Aborting.");
2485 m_fragments.insert (it, std::make_pair (fragment, fragmentOffset));
2493 m_firstFragment = fragment;
2501 uint16_t lastEndOffset = 0;
2508 NS_LOG_LOGIC (
"Checking overlaps " << lastEndOffset <<
" - " << it->second );
2510 if (lastEndOffset < it->
second)
2516 uint16_t fragmentEnd = it->first->GetSize () + it->second;
2517 lastEndOffset =
std::max ( lastEndOffset, fragmentEnd );
2521 if ( ret && (lastEndOffset == m_packetSize))
2532 std::list<std::pair<Ptr<Packet>, uint16_t> >::const_iterator it =
m_fragments.begin ();
2535 uint16_t lastEndOffset = 0;
2539 lastEndOffset = it->first->GetSize ();
2543 if ( lastEndOffset > it->second )
2545 NS_ABORT_MSG (
"Overlapping fragments found, forbidden condition");
2552 lastEndOffset += it->first->GetSize ();
2566 std::list< Ptr<Packet> > fragments;
2567 std::list<std::pair<Ptr<Packet>, uint16_t> >::const_iterator iter;
2570 fragments.push_back (iter->first);
2578 m_timeoutIter = iter;
2585 return m_timeoutIter;
2592 MapFragments_t::iterator it =
m_fragments.find (key);
2593 std::list< Ptr<Packet> > storedFragments = it->second->GetFraments ();
2595 fragIter != storedFragments.end (); fragIter++)
2659 NS_LOG_LOGIC (
"Invalid context ID (" << +contextId <<
"), ignoring");
2663 if (validLifetime ==
Time(0))
2665 NS_LOG_LOGIC (
"Context (" << +contextId <<
"), removed (validity time is zero)");
2671 m_contextTable[contextId].compressionAllowed = compressionAllowed;
2683 NS_LOG_LOGIC (
"Invalid context ID (" << +contextId <<
"), ignoring");
2689 NS_LOG_LOGIC (
"Context not found (" << +contextId <<
"), ignoring");
2694 compressionAllowed =
m_contextTable[contextId].compressionAllowed;
2706 NS_LOG_LOGIC (
"Invalid context ID (" << +contextId <<
"), ignoring");
2712 NS_LOG_LOGIC (
"Context not found (" << +contextId <<
"), ignoring");
2727 NS_LOG_LOGIC (
"Invalid context ID (" << +contextId <<
"), ignoring");
2733 NS_LOG_LOGIC (
"Context not found (" << +contextId <<
"), ignoring");
2746 NS_LOG_LOGIC (
"Invalid context ID (" << +contextId <<
"), ignoring");
2752 NS_LOG_LOGIC (
"Context not found (" << +contextId <<
"), ignoring");
2776 contextId = iter.first;
2799 if (contextLength <= 64)
2801 uint8_t contextBytes[16];
2802 uint8_t addressBytes[16];
2805 address.GetBytes (addressBytes);
2807 if (addressBytes[3] == contextLength &&
2808 addressBytes[4] == contextBytes[0] &&
2809 addressBytes[5] == contextBytes[1] &&
2810 addressBytes[6] == contextBytes[2] &&
2811 addressBytes[7] == contextBytes[3] &&
2812 addressBytes[8] == contextBytes[4] &&
2813 addressBytes[9] == contextBytes[5] &&
2814 addressBytes[10] == contextBytes[6] &&
2815 addressBytes[11] == contextBytes[7])
2820 contextId = iter.first;
2831 uint8_t addressBytes[16];
2832 address.GetBytes (addressBytes);
2835 uint8_t bytesToClean = prefixLength / 8;
2836 uint8_t bitsToClean = prefixLength % 8;
2837 for (uint8_t i=0; i<bytesToClean; i++)
2839 addressBytes[i] = 0;
2843 uint8_t cleanupMask = (1<<bitsToClean)-1;
2844 addressBytes[bytesToClean] &= cleanupMask;
2849 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(uint8_t const *buffer, uint32_t size)
automatically resized byte buffer
uint32_t GetSize(void) const
void AddAtStart(uint32_t start)
uint8_t const * PeekData(void) const
Buffer::Iterator Begin(void) const
void RemoveAtStart(uint32_t start)
bool IsNull(void) const
Check for null implementation.
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
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.
bool IsBroadcast(void) const
Checks if the address is a broadcast address according to 802.15.4 scheme (i.e., 0xFFFF).
static bool IsMatchingType(const Address &address)
static Mac16Address ConvertFrom(const Address &address)
bool IsMulticast(void) const
Checks if the address is a multicast address according to RFC 4944 Section 9 (i.e....
void CopyFrom(const uint8_t buffer[2])
static bool IsMatchingType(const Address &address)
Network layer to device interface.
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)=0
virtual bool IsMulticast(void) const =0
virtual bool SetMtu(const uint16_t mtu)=0
virtual Ptr< Channel > GetChannel(void) const =0
virtual Address GetBroadcast(void) const =0
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)=0
virtual Address GetAddress(void) const =0
virtual bool IsBroadcast(void) const =0
virtual bool IsPointToPoint(void) const =0
Return true if the net device is on a point-to-point link.
virtual uint16_t GetMtu(void) const =0
virtual Address GetMulticast(Ipv4Address multicastGroup) const =0
Make and return a MAC multicast address using the provided multicast group.
virtual bool IsBridge(void) const =0
Return true if the net device is acting as a bridge.
virtual void AddLinkChangeCallback(Callback< void > callback)=0
virtual bool NeedsArp(void) const =0
virtual void SetAddress(Address address)=0
Set the address of this interface.
PacketType
Packet types are used as they are in Linux.
virtual bool IsLinkUp(void) const =0
static bool ChecksumEnabled(void)
uint32_t GetId(void) const
void RegisterProtocolHandler(ProtocolHandler handler, uint16_t protocolType, Ptr< NetDevice > device, bool promiscuous=false)
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
virtual void DoDispose(void)
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 CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
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.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
virtual double GetValue(void)=0
Get the next random value as a double drawn from the distribution.
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time Now(void)
Return the current simulation virtual time.
6LoWPAN BC0 header - see RFC 4944.
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
uint8_t GetSequenceNumber(void) const
Get the "Sequence Number" field.
void SetSequenceNumber(uint8_t seqNumber)
Set 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.
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
uint16_t GetDatagramSize(void) const
Get the datagram size.
uint16_t GetDatagramTag(void) const
Get the datagram tag.
6LoWPAN FRAGN header - see RFC 4944.
uint16_t GetDatagramTag(void) const
Get the datagram tag.
uint8_t GetDatagramOffset(void) const
Get the datagram offset.
void SetDatagramSize(uint16_t datagramSize)
Set the datagram size.
uint16_t GetDatagramSize(void) const
Get the datagram size.
void SetDatagramTag(uint16_t datagramTag)
Set the datagram tag.
void SetDatagramOffset(uint8_t datagramOffset)
Set the datagram offset.
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
6LoWPAN HC1 header - see RFC 4944.
void SetTcflCompression(bool tcflCompression)
Set the Traffic Class and Flow Labels as compressed.
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.
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
void SetHopLimit(uint8_t limit)
Set the "Hop limit" field (TTL).
uint32_t GetFlowLabel() const
Get the Flow Label value.
uint8_t GetHopLimit(void) const
Get the "Hop limit" field (TTL).
const uint8_t * GetDstPrefix() const
Get the destination prefix.
void SetHc2HeaderPresent(bool hc2HeaderPresent)
Set the next header a HC2 compressed header.
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.
void SetNextHeader(uint8_t nextHeader)
Set the Next Header field.
bool GetM(void) const
Get the M (Multicast) compression.
void SetHlim(Hlim_e hlimField)
Set the HLIM (Hop Limit) compression.
bool GetSac(void) const
Get the SAC (Source Address Compression) 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.
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
void SetEcn(uint8_t ecn)
Set the ECN (2bits).
void SetFlowLabel(uint32_t flowLabel)
Set the Flow Label (20bits).
TrafficClassFlowLabel_e GetTf(void) const
Get the TF (Traffic Class, Flow Label) compression.
bool GetDac(void) const
Get the DAC (Destination Address Compression) compression.
void SetDscp(uint8_t dscp)
Set the DSCP (6bits).
uint8_t GetDstContextId(void) const
Get the DstContextId.
void SetTf(TrafficClassFlowLabel_e tfField)
Set the TF (Traffic Class, Flow Label) compression.
const uint8_t * GetDstInlinePart(void) const
brief Get the destination address inline part
void SetDam(HeaderCompression_e damField)
Set the DAM (Destination Address Mode) compression.
void SetCid(bool cidField)
Set the CID (Context Identifier Extension) compression.
uint8_t GetEcn(void) const
Get the ECN.
HeaderCompression_e GetSam(void) const
Get the SAM (Source Address Mode) compression.
uint8_t GetHopLimit(void) const
Get the Hop Limit field.
bool GetNh(void) const
Get the NH (Next Header) compression.
void SetSac(bool sacField)
Set the SAC (Source Address Compression) compression.
HeaderCompression_e GetDam(void) const
Get the DAM (Destination Address Mode) compression.
const uint8_t * GetSrcInlinePart(void) const
brief Get the source address inline part
void SetDstInlinePart(uint8_t dstInlinePart[16], uint8_t size)
brief Set the destination address inline part
uint8_t GetSrcContextId(void) const
Get the SrcContextId.
void SetSrcContextId(uint8_t srcContextId)
Set the SrcContextId.
void SetSrcInlinePart(uint8_t srcInlinePart[16], uint8_t size)
brief Set the source address inline part
uint8_t GetDscp(void) const
Get the DSCP.
void SetM(bool mField)
Set the M (Multicast) compression.
uint32_t GetFlowLabel(void) const
Get the Flow Label.
uint8_t GetNextHeader(void) const
Get the Next Header field.
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.
void SetHopsLeft(uint8_t hopsLeft)
Set the "Hops Left" field.
Address GetFinalDst(void) const
Get the "Final Destination" address.
void SetFinalDst(Address finalDst)
Set the "Final Destination" address.
Address GetOriginator(void) const
Get the "Originator" address.
uint8_t GetHopsLeft(void) const
Get the "Hops Left" field.
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
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 DecompressLowPanIphc(Ptr< Packet > packet, Address const &src, Address const &dst)
Decompress the headers according to IPHC compression.
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.
uint32_t CompressLowPanHc1(Ptr< Packet > packet, Address const &src, Address const &dst)
Compress the headers according to HC1 compression.
uint8_t m_bc0Serial
Serial number used in BC0 header.
EventId m_timeoutEvent
Event for the next scheduled timeout.
virtual Ptr< Channel > GetChannel(void) const
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.
std::map< FragmentKey_t, Ptr< Fragments > >::iterator MapFragmentsI_t
Container Iterator for fragment key -> fragments.
uint16_t m_meshCacheLength
length of the cache for each source.
bool m_useIphc
Use IPHC or HC1.
void RenewContext(uint8_t contextId, Time validLifetime)
Renew a context used in IPHC stateful compression.
virtual Address GetAddress(void) const
virtual Address GetBroadcast(void) const
void ReceiveFromDevice(Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, Address const &source, Address const &destination, PacketType packetType)
Receives all the packets from a NetDevice for further processing.
void DoFragmentation(Ptr< Packet > packet, uint32_t origPacketSize, uint32_t origHdrSize, uint32_t extraHdrSize, std::list< Ptr< Packet > > &listFragments)
Performs a packet fragmentation.
virtual bool SupportsSendFrom() const
Ptr< Node > m_node
Smart pointer to the Node.
uint32_t CompressLowPanNhc(Ptr< Packet > packet, uint8_t headerType, Address const &src, Address const &dst)
Compress the headers according to NHC compression.
virtual void SetPromiscReceiveCallback(NetDevice::PromiscReceiveCallback cb)
bool CanCompressLowPanNhc(uint8_t headerType)
Checks if the next header can be compressed using NHC.
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
virtual Ptr< Node > GetNode(void) const
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.
virtual uint32_t GetIfIndex(void) const
virtual bool NeedsArp(void) const
uint32_t m_compressionThreshold
Minimum L2 payload size.
virtual void AddLinkChangeCallback(Callback< void > callback)
void DecompressLowPanHc1(Ptr< Packet > packet, Address const &src, Address const &dst)
Decompress the headers according to HC1 compression.
Ptr< NetDevice > GetNetDevice() const
Returns a smart pointer to the underlying NetDevice.
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
uint32_t CompressLowPanIphc(Ptr< Packet > packet, Address const &src, Address const &dst)
Compress the headers according to IPHC compression.
TracedCallback< Ptr< const Packet >, Ptr< SixLowPanNetDevice >, uint32_t > m_txTrace
Callback to trace TX (transmission) packets.
@ DROP_DISALLOWED_COMPRESSION
HC1 while in IPHC mode or viceversa.
@ 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.
static TypeId GetTypeId(void)
Get the type ID.
Ptr< NetDevice > m_netDevice
Smart pointer to the underlying NetDevice.
std::pair< uint8_t, bool > DecompressLowPanNhc(Ptr< Packet > packet, Address const &src, Address const &dst, Ipv6Address srcAddress, Ipv6Address dstAddress)
Decompress the headers according to NHC compression.
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 ProcessFragment(Ptr< Packet > &packet, Address const &src, Address const &dst, bool isFirst)
Process a packet fragment.
bool GetContext(uint8_t contextId, Ipv6Prefix &contextPrefix, bool &compressionAllowed, Time &validLifetime)
Get a context used in IPHC stateful compression.
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge.
virtual bool IsMulticast(void) const
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.
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.
virtual Address GetMulticast(Ipv4Address multicastGroup) const
Make and return a MAC multicast address using the provided multicast group.
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
virtual void DoDispose(void)
Destructor implementation.
uint32_t CompressLowPanUdpNhc(Ptr< Packet > packet, bool omitChecksum)
Compress the headers according to NHC compression.
virtual bool IsLinkUp(void) const
void RemoveContext(uint8_t contextId)
Remove a context used in IPHC stateful compression.
bool m_omitUdpChecksum
Omit UDP checksum in NC1 encoding.
std::pair< std::pair< Address, Address >, std::pair< uint16_t, uint16_t > > FragmentKey_t
Fragment identifier type: src/dst address src/dst port.
virtual bool SetMtu(const uint16_t mtu)
uint32_t m_ifIndex
Interface index.
virtual bool IsBroadcast(void) const
virtual void SetAddress(Address address)
Set the address of this interface.
virtual uint16_t GetMtu(void) const
Returns the link-layer MTU for this interface.
void HandleTimeout(void)
Handles a fragmented packet timeout.
virtual void SetIfIndex(const uint32_t index)
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.
FragmentsTimeoutsList_t m_timeoutEventList
Timeout "events" container.
virtual void SetNode(Ptr< Node > node)
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.
NetDevice::ReceiveCallback m_rxCallback
The callback used to notify higher layers that a packet has been received.
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
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 OriginatorAdddress, SequenceNumber.
std::list< std::tuple< Time, FragmentKey_t, uint32_t > >::iterator FragmentsTimeoutsListI_t
Container Iterator for fragment timeouts.
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.
uint8_t GetNextHeader(void) const
Get the Next Header field value.
void SetNh(bool nhField)
Set the NH field values.
Eid_e GetEid(void) const
Get the Extension Header Type.
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
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
uint32_t CopyBlob(uint8_t *blob, uint32_t size) const
Get the option header data blob.
bool GetNh(void) const
Get the Next Header field value.
void SetNextHeader(uint8_t nextHeader)
Set the Next Header field values.
UDP LOWPAN_NHC Extension Header Encoding - see RFC 6282.
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.
uint16_t GetChecksum(void) const
Get the Checksum field value.
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
bool GetC(void) const
Get the C (Checksum).
void SetChecksum(uint16_t checksum)
Set the Checksum field values.
void SetDstPort(uint16_t port)
Set the Destination Port.
void SetSrcPort(uint16_t port)
Set the Source Port.
void SetC(bool cField)
Set the C (Checksum).
Ports_e GetPorts(void) const
Get the compressed Src and Dst Ports.
uint16_t GetSrcPort() const
Get the Source Port.
Hold variables of type string.
Simulation virtual time values and global simulation resolution.
TimeWithUnit As(const enum 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.
std::string GetName(void) const
Get the name.
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 AttributeChecker > MakeBooleanChecker(void)
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#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 > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Structure holding the informations 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