22 #include "ns3/ipv4-address.h"
60 for (std::vector<Tlv*>::const_iterator iter = rules->Begin (); iter != rules->End (); ++iter)
62 switch ((*iter)->GetType ())
71 NS_FATAL_ERROR (
"ToS Not implemented-- please implement and contribute a patch");
77 for (std::vector<uint8_t>::const_iterator iter2 = list->
Begin (); iter2 != list->
End (); ++iter2)
86 for (std::vector<Ipv4AddressTlvValue::ipv4Addr>::const_iterator iter2 = list->
Begin (); iter2 != list->
End (); ++iter2)
95 for (std::vector<Ipv4AddressTlvValue::ipv4Addr>::const_iterator iter2 = list->
Begin (); iter2 != list->
End (); ++iter2)
104 for (std::vector<PortRangeTlvValue::PortRange>::const_iterator iter2 = list->
Begin (); iter2 != list->
End (); ++iter2)
113 for (std::vector<PortRangeTlvValue::PortRange>::const_iterator iter2 = list->
Begin (); iter2 != list->
End (); ++iter2)
133 uint16_t SrcPortHigh,
135 uint16_t DstPortHigh,
225 for (std::vector<struct ipv4Addr>::const_iterator iter =
m_srcAddr.begin (); iter !=
m_srcAddr.end (); ++iter)
227 NS_LOG_INFO (
"src addr check match: pkt=" << srcAddress <<
" cls=" << (*iter).Address <<
"/" << (*iter).Mask);
228 if (srcAddress.
CombineMask ((*iter).Mask) == (*iter).Address)
240 for (std::vector<struct ipv4Addr>::const_iterator iter =
m_dstAddr.begin (); iter !=
m_dstAddr.end (); ++iter)
242 NS_LOG_INFO (
"dst addr check match: pkt=" << dstAddress <<
" cls=" << (*iter).Address <<
"/" << (*iter).Mask);
243 if (dstAddress.
CombineMask ((*iter).Mask) == (*iter).Address)
256 NS_LOG_INFO (
"src port check match: pkt=" << port <<
" cls= [" << (*iter).PortLow <<
" TO " << (*iter).PortHigh
258 if (port >= (*iter).PortLow && port <= (*iter).PortHigh)
271 NS_LOG_INFO (
"dst port check match: pkt=" << port <<
" cls= [" << (*iter).PortLow <<
" TO " << (*iter).PortHigh
273 if (port >= (*iter).PortLow && port <= (*iter).PortHigh)
284 for (std::vector<uint8_t>::const_iterator iter =
m_protocol.begin (); iter !=
m_protocol.end (); ++iter)
286 NS_LOG_INFO (
"proto check match: pkt=" << (uint16_t) proto <<
" cls=" << (uint16_t) proto);
287 if (proto == (*iter))
310 for (std::vector<struct ipv4Addr>::const_iterator iter =
m_srcAddr.begin (); iter !=
m_srcAddr.end (); ++iter)
312 ipv4AddrValSrc.
Add ((*iter).Address, (*iter).Mask);
316 for (std::vector<struct ipv4Addr>::const_iterator iter =
m_dstAddr.begin (); iter !=
m_dstAddr.end (); ++iter)
318 ipv4AddrValDst.
Add ((*iter).Address, (*iter).Mask);
322 for (std::vector<uint8_t>::const_iterator iter =
m_protocol.begin (); iter !=
m_protocol.end (); ++iter)
324 protoVal.
Add ((*iter));
330 portValueSrc.
Add ((*iter).PortLow, (*iter).PortHigh);
336 portValueDst.
Add ((*iter).PortLow, (*iter).PortHigh);
std::vector< struct PortRange > m_srcPortRange
surce port range
uint8_t m_priority
priority
Iterator Begin() const
Begin iterator.
a class to represent an Ipv4 address mask
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
Iterator End() const
End iterator.
virtual uint32_t GetSerializedSize(void) const
Get serialized size in bytes.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ipv4Address Address
IP address.
bool CheckMatchProtocol(uint8_t proto) const
Check match protocol function.
void Add(uint16_t portLow, uint16_t portHigh)
Add a range.
virtual uint32_t GetSerializedSize(void) const
Get serialized size in bytes.
Ipv4Address CombineMask(Ipv4Mask const &mask) const
Combine this address with a network mask.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
virtual uint32_t GetSerializedSize(void) const
Get serialized size in bytes.
Ipv4AddressTlvValue class.
bool CheckMatchSrcAddr(Ipv4Address srcAddress) const
Check match source address function.
This class implements the Type-Len-Value structure channel encodings as described by "IEEE Standard f...
std::vector< uint8_t > m_protocol
protocol
void Add(const Tlv &val)
Add a TLV.
virtual uint32_t GetSerializedSize(void) const
Get serialized size in bytes.
uint16_t GetCid(void) const
NS_ASSERT_MSG(false,"Ipv4AddressGenerator::MaskToIndex(): Impossible")
void AddSrcAddr(Ipv4Address srcAddress, Ipv4Mask srcMask)
add a new source ip address to the classifier
uint8_t m_tosMask
TOS mask.
std::vector< struct ipv4Addr > m_dstAddr
destination address
void AddSrcPortRange(uint16_t srcPortLow, uint16_t srcPortHigh)
add a range of source port to the classifier
std::vector< struct PortRange > m_dstPortRange
destination port range
void AddDstAddr(Ipv4Address dstAddress, Ipv4Mask dstMask)
add a new destination ip address to the classifier
bool CheckMatchDstPort(uint16_t dstPort) const
Check match destination port function.
void SetCid(uint16_t cid)
Set the cid associated to this classifier.
Iterator End() const
End iterator.
void SetPriority(uint8_t prio)
Set the priority of this classifier.
uint8_t GetType(void) const
Get type value.
void Add(uint8_t protocol)
Add protocol number.
bool CheckMatchSrcPort(uint16_t srcPort) const
Check match source port function.
bool CheckMatchDstAddr(Ipv4Address dstAddress) const
Check match destination address function.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t m_tosHigh
TOS high.
TlvValue * PeekValue(void)
Peek value.
uint16_t PortHigh
port high
Iterator Begin() const
Begin iterator.
std::vector< struct ipv4Addr > m_srcAddr
source address
this class implements the classifier descriptor as a tlv vector
void AddDstPortRange(uint16_t dstPortLow, uint16_t dstPortHigh)
add a range of destination port to the classifier
Iterator End() const
End iterator.
Ipv4 addresses are stored in host order in this class.
uint16_t GetIndex(void) const
void AddProtocol(uint8_t proto)
add a protocol to the classifier
void SetIndex(uint16_t index)
Set the index of the classifier.
uint8_t GetPriority(void) const
void Add(Ipv4Address address, Ipv4Mask Mask)
Add IPv4 address and mask.
Tlv ToTlv(void) const
Creates a TLV from this classifier.
Iterator Begin() const
Begin iterator.