21 #include "ns3/tcp-header.h" 22 #include "ns3/udp-header.h" 124 uint16_t srcPort = 0;
125 uint16_t destPort = 0;
139 if (prot != 6 && prot != 17)
141 NS_LOG_WARN (
"Unknown transport protocol, no port number included in hash computation");
149 buf[33] = (srcPort >> 8) & 0xff;
150 buf[34] = srcPort & 0xff;
151 buf[35] = (destPort >> 8) & 0xff;
152 buf[36] = destPort & 0xff;
153 buf[37] = (perturbation >> 24) & 0xff;
154 buf[38] = (perturbation >> 16) & 0xff;
155 buf[39] = (perturbation >> 8) & 0xff;
156 buf[40] = perturbation & 0xff;
160 uint32_t hash =
Hash32 ((
char*) buf, 41);
162 NS_LOG_DEBUG (
"Found Ipv6 packet; hash of the five tuple " << hash);
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint16_t GetProtocol(void) const
Get the L3 protocol included in this item.
virtual void Print(std::ostream &os) const
Print the item contents.
QueueDiscItem is the abstract base class for items that are stored in a queue disc.
Ptr< Packet > GetPacket(void) const
const Ipv6Header & GetHeader(void) const
virtual void AddHeader(void)
Add the header to the packet.
a polymophic address class
Uint8Values
1-byte fields of the packet whose value can be retrieved, if present
Ipv6Header m_header
The IPv6 header.
virtual ~Ipv6QueueDiscItem()
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t Hash32(const char *buffer, const std::size_t size)
Compute 32-bit hash of a byte buffer, using the default hash function.
virtual bool Mark(void)
Marks the packet by setting ECN_CE bits if the packet has ECN_ECT0 or ECN_ECT1 bits set...
virtual bool GetUint8Value(Uint8Values field, uint8_t &value) const
Retrieve the value of a given field from the packet, if present.
bool m_headerAdded
True if the header has already been added to the packet.
uint8_t GetTxQueueIndex(void) const
Get the transmission queue index included in this item.
Describes an IPv6 address.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Address GetAddress(void) const
Get the MAC address included in this item.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Ipv6QueueDiscItem()
Default constructor.
virtual uint32_t Hash(uint32_t perturbation) const
Computes the hash of the packet's 5-tuple.
virtual uint32_t GetSize(void) const
void AddHeader(const Header &header)
Add header to this packet.
void Serialize(uint8_t buf[16]) const
Serialize this address to a 16-byte buffer.