23#include "ns3/ipv4-address.h"
65 for (std::vector<Tlv*>::const_iterator iter = rules->
Begin(); iter != rules->
End(); ++iter)
67 switch ((*iter)->GetType())
74 NS_FATAL_ERROR(
"ToS Not implemented-- please implement and contribute a patch");
79 for (std::vector<uint8_t>::const_iterator iter2 =
list->Begin(); iter2 !=
list->End();
88 for (std::vector<Ipv4AddressTlvValue::Ipv4Addr>::const_iterator iter2 =
list->Begin();
98 for (std::vector<Ipv4AddressTlvValue::Ipv4Addr>::const_iterator iter2 =
list->Begin();
108 for (std::vector<PortRangeTlvValue::PortRange>::const_iterator iter2 =
list->Begin();
109 iter2 !=
list->End();
118 for (std::vector<PortRangeTlvValue::PortRange>::const_iterator iter2 =
list->Begin();
119 iter2 !=
list->End();
139 uint16_t SrcPortHigh,
141 uint16_t DstPortHigh,
239 for (std::vector<Ipv4Addr>::const_iterator iter =
m_srcAddr.begin(); iter !=
m_srcAddr.end();
242 NS_LOG_INFO(
"src addr check match: pkt=" << srcAddress <<
" cls=" << (*iter).Address <<
"/"
244 if (srcAddress.
CombineMask((*iter).Mask) == (*iter).Address)
256 for (std::vector<Ipv4Addr>::const_iterator iter =
m_dstAddr.begin(); iter !=
m_dstAddr.end();
259 NS_LOG_INFO(
"dst addr check match: pkt=" << dstAddress <<
" cls=" << (*iter).Address <<
"/"
261 if (dstAddress.
CombineMask((*iter).Mask) == (*iter).Address)
273 for (std::vector<PortRange>::const_iterator iter =
m_srcPortRange.begin();
277 NS_LOG_INFO(
"src port check match: pkt=" <<
port <<
" cls= [" << (*iter).PortLow <<
" TO "
278 << (*iter).PortHigh <<
"]");
279 if (
port >= (*iter).PortLow &&
port <= (*iter).PortHigh)
291 for (std::vector<PortRange>::const_iterator iter =
m_dstPortRange.begin();
295 NS_LOG_INFO(
"dst port check match: pkt=" <<
port <<
" cls= [" << (*iter).PortLow <<
" TO "
296 << (*iter).PortHigh <<
"]");
297 if (
port >= (*iter).PortLow &&
port <= (*iter).PortHigh)
312 NS_LOG_INFO(
"proto check match: pkt=" << (uint16_t)proto <<
" cls=" << (uint16_t)proto);
313 if (proto == (*iter))
337 for (std::vector<Ipv4Addr>::const_iterator iter =
m_srcAddr.begin(); iter !=
m_srcAddr.end();
340 ipv4AddrValSrc.
Add((*iter).Address, (*iter).Mask);
344 for (std::vector<Ipv4Addr>::const_iterator iter =
m_dstAddr.begin(); iter !=
m_dstAddr.end();
347 ipv4AddrValDst.
Add((*iter).Address, (*iter).Mask);
354 protoVal.
Add((*iter));
358 for (std::vector<PortRange>::const_iterator iter =
m_srcPortRange.begin();
362 portValueSrc.
Add((*iter).PortLow, (*iter).PortHigh);
366 for (std::vector<PortRange>::const_iterator iter =
m_dstPortRange.begin();
370 portValueDst.
Add((*iter).PortLow, (*iter).PortHigh);
this class implements the classifier descriptor as a tlv vector
@ Packet_Classification_Rule
void SetPriority(uint8_t prio)
Set the priority of this classifier.
std::vector< PortRange > m_dstPortRange
destination port range
bool CheckMatchSrcAddr(Ipv4Address srcAddress) const
Check match source address function.
bool CheckMatchProtocol(uint8_t proto) const
Check match protocol function.
uint16_t GetIndex() const
uint8_t GetPriority() const
uint8_t m_tosMask
TOS mask.
void SetIndex(uint16_t index)
Set the index of the classifier.
void AddDstAddr(Ipv4Address dstAddress, Ipv4Mask dstMask)
add a new destination ip address to the classifier
bool CheckMatchSrcPort(uint16_t srcPort) const
Check match source port function.
std::vector< PortRange > m_srcPortRange
source port range
void AddSrcPortRange(uint16_t srcPortLow, uint16_t srcPortHigh)
add a range of source port to the classifier
std::vector< Ipv4Addr > m_dstAddr
destination address
bool CheckMatchDstAddr(Ipv4Address dstAddress) const
Check match destination address function.
Tlv ToTlv() const
Creates a TLV from this classifier.
uint8_t m_priority
priority
bool CheckMatch(Ipv4Address srcAddress, Ipv4Address dstAddress, uint16_t srcPort, uint16_t dstPort, uint8_t proto) const
check if a packets can be used with this classifier
void SetCid(uint16_t cid)
Set the cid associated to this classifier.
void AddDstPortRange(uint16_t dstPortLow, uint16_t dstPortHigh)
add a range of destination port to the classifier
std::vector< uint8_t > m_protocol
protocol
void AddSrcAddr(Ipv4Address srcAddress, Ipv4Mask srcMask)
add a new source ip address to the classifier
std::vector< Ipv4Addr > m_srcAddr
source address
void AddProtocol(uint8_t proto)
add a protocol to the classifier
uint8_t m_tosHigh
TOS high.
bool CheckMatchDstPort(uint16_t dstPort) const
Check match destination port function.
Ipv4 addresses are stored in host order in this class.
Ipv4Address CombineMask(const Ipv4Mask &mask) const
Combine this address with a network mask.
Ipv4AddressTlvValue class.
void Add(Ipv4Address address, Ipv4Mask mask)
Add IPv4 address and mask.
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
a class to represent an Ipv4 address mask
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
void Add(uint16_t portLow, uint16_t portHigh)
Add a range.
void Add(uint8_t protocol)
Add protocol number.
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
This class implements the Type-Len-Value structure channel encodings as described by "IEEE Standard f...
uint8_t GetType() const
Get type value.
TlvValue * PeekValue()
Peek value.
uint32_t GetSerializedSize() const override
Get serialized size in bytes.
Iterator End() const
End iterator.
Iterator Begin() const
Begin iterator.
void Add(const Tlv &val)
Add a TLV.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ipv4Address Address
IP address.
uint16_t PortHigh
port high