network: Add a GetUint8Value method to the QueueItem class
This commit is contained in:
@@ -79,4 +79,20 @@ Ipv4QueueDiscItem::Print (std::ostream& os) const
|
||||
;
|
||||
}
|
||||
|
||||
bool
|
||||
Ipv4QueueDiscItem::GetUint8Value (QueueItem::Uint8Values field, uint8_t& value) const
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case IP_DSFIELD:
|
||||
value = m_header.GetTos ();
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -70,6 +70,15 @@ public:
|
||||
*/
|
||||
virtual void Print (std::ostream &os) const;
|
||||
|
||||
/*
|
||||
* The values for the fields of the Ipv4 header are taken from m_header and
|
||||
* thus might differ from those present in the packet in case the header is
|
||||
* modified after being added to the packet. However, this function is likely
|
||||
* to be called before the header is added to the packet (i.e., before the
|
||||
* packet is dequeued from the queue disc)
|
||||
*/
|
||||
virtual bool GetUint8Value (Uint8Values field, uint8_t &value) const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* \brief Default constructor
|
||||
|
||||
@@ -79,4 +79,20 @@ Ipv6QueueDiscItem::Print (std::ostream& os) const
|
||||
;
|
||||
}
|
||||
|
||||
bool
|
||||
Ipv6QueueDiscItem::GetUint8Value (QueueItem::Uint8Values field, uint8_t& value) const
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case IP_DSFIELD:
|
||||
value = m_header.GetTrafficClass ();
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -70,6 +70,15 @@ public:
|
||||
*/
|
||||
virtual void Print (std::ostream &os) const;
|
||||
|
||||
/*
|
||||
* The values for the fields of the Ipv6 header are taken from m_header and
|
||||
* thus might differ from those present in the packet in case the header is
|
||||
* modified after being added to the packet. However, this function is likely
|
||||
* to be called before the header is added to the packet (i.e., before the
|
||||
* packet is dequeued from the queue disc)
|
||||
*/
|
||||
virtual bool GetUint8Value (Uint8Values field, uint8_t &value) const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* \brief Default constructor
|
||||
|
||||
@@ -53,6 +53,12 @@ QueueItem::GetPacketSize (void) const
|
||||
return m_packet->GetSize ();
|
||||
}
|
||||
|
||||
bool
|
||||
QueueItem::GetUint8Value (QueueItem::Uint8Values field, uint8_t& value) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
QueueItem::Print (std::ostream& os) const
|
||||
{
|
||||
|
||||
@@ -78,6 +78,24 @@ public:
|
||||
*/
|
||||
virtual uint32_t GetPacketSize (void) const;
|
||||
|
||||
/**
|
||||
* \enum Uint8Values
|
||||
* \brief 1-byte fields of the packet whose value can be retrieved, if present
|
||||
*/
|
||||
enum Uint8Values
|
||||
{
|
||||
IP_DSFIELD
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Retrieve the value of a given field from the packet, if present
|
||||
* \param field the field whose value has to be retrieved
|
||||
* \param value the output parameter to store the retrieved value
|
||||
*
|
||||
* \return true if the requested field is present in the packet, false otherwise.
|
||||
*/
|
||||
virtual bool GetUint8Value (Uint8Values field, uint8_t &value) const;
|
||||
|
||||
/**
|
||||
* \brief Print the item contents.
|
||||
* \param os output stream in which the data should be printed.
|
||||
|
||||
Reference in New Issue
Block a user