130 uint16_t srcPort = 0;
131 uint16_t destPort = 0;
133 if (prot == 6 && fragOffset == 0)
139 else if (prot == 17 && fragOffset == 0)
145 if (prot != 6 && prot != 17)
147 NS_LOG_WARN(
"Unknown transport protocol, no port number included in hash computation");
155 buf[9] = (srcPort >> 8) & 0xff;
156 buf[10] = srcPort & 0xff;
157 buf[11] = (destPort >> 8) & 0xff;
158 buf[12] = destPort & 0xff;
159 buf[13] = (perturbation >> 24) & 0xff;
160 buf[14] = (perturbation >> 16) & 0xff;
161 buf[15] = (perturbation >> 8) & 0xff;
162 buf[16] = perturbation & 0xff;
a polymophic address class
Ipv4 addresses are stored in host order in this class.
void Serialize(uint8_t buf[4]) const
Serialize this address to a 4-byte buffer.
bool m_headerAdded
True if the header has already been added to the packet.
const Ipv4Header & GetHeader() const
Ipv4Header m_header
The IPv4 header.
uint32_t Hash(uint32_t perturbation) const override
Computes the hash of the packet's 5-tuple.
~Ipv4QueueDiscItem() override
void AddHeader() override
Add the header to the packet.
bool GetUint8Value(Uint8Values field, uint8_t &value) const override
Retrieve the value of a given field from the packet, if present.
Ipv4QueueDiscItem()=delete
bool Mark() override
Marks the packet by setting ECN_CE bits if the packet has ECN_ECT0 or ECN_ECT1 set.
void Print(std::ostream &os) const override
Print the item contents.
uint32_t GetSize() const override
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 PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
QueueDiscItem is the abstract base class for items that are stored in a queue disc.
Address GetAddress() const
Get the MAC address included in this item.
uint8_t GetTxQueueIndex() const
Get the transmission queue index included in this item.
uint16_t GetProtocol() const
Get the L3 protocol included in this item.
Ptr< Packet > GetPacket() const
Uint8Values
1-byte fields of the packet whose value can be retrieved, if present
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
uint32_t Hash32(const char *buffer, const std::size_t size)
Compute 32-bit hash of a byte buffer, using the default hash function.
#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_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
std::size_t hash(const BasicJsonType &j)
hash a JSON value
Every class exported by the ns3 library is enclosed in the ns3 namespace.