26 #include "ns3/tcp-header.h"
27 #include "ns3/udp-header.h"
42 .SetGroupName (
"Internet")
61 return (DynamicCast<Ipv4QueueDiscItem> (item) != 0);
71 static TypeId tid =
TypeId (
"ns3::FqCoDelIpv4PacketFilter")
73 .SetGroupName (
"Internet")
75 .AddAttribute (
"Perturbation",
76 "The salt used as an additional input to the hash function of this filter",
79 MakeUintegerChecker<uint32_t> ())
110 uint16_t srcPort = 0;
111 uint16_t destPort = 0;
115 if (prot == 6 && fragOffset == 0)
121 else if (prot == 17 && fragOffset == 0)
133 buf[9] = (srcPort >> 8) & 0xff;
134 buf[10] = srcPort & 0xff;
135 buf[11] = (destPort >> 8) & 0xff;
136 buf[12] = destPort & 0xff;
143 uint32_t hash =
Hash32 ((
char*) buf, 17);
145 NS_LOG_DEBUG (
"Found Ipv4 packet; hash value " << hash);
FqCoDelIpv4PacketFilter is the filter to be added to the FQCoDel queue disc to simulate the behavior ...
Smart pointer class similar to boost::intrusive_ptr.
#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.
virtual ~FqCoDelIpv4PacketFilter()
#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.
virtual int32_t DoClassify(Ptr< QueueDiscItem > item) const
Classify a packet.
const Ipv4Header & GetHeader(void) const
Hold an unsigned integer type.
uint32_t m_perturbation
hash perturbation value
void Serialize(uint8_t buf[4]) const
Serialize this address to a 4-byte buffer.
uint32_t Hash32(const char *buffer, const size_t size)
Compute 32-bit hash of a byte buffer, using the default hash function.
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
virtual ~Ipv4PacketFilter()
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual bool CheckProtocol(Ptr< QueueDiscItem > item) const
Checks if the filter is able to classify a kind of items.
Ipv4 addresses are stored in host order in this class.
static TypeId GetTypeId(void)
Get the type ID.
Ipv4PacketFilter is the abstract base class for filters defined for IPv4 packets. ...
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
FqCoDelIpv4PacketFilter()
PacketFilter is the abstract base class for filters used by queue discs to classify packets...
static TypeId GetTypeId(void)
Get the type ID.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< Packet > GetPacket(void) const