22 #include "ns3/ipv4-address.h"
59 for (std::vector<Tlv*>::const_iterator iter = rules->Begin (); iter != rules->End (); ++iter)
61 switch ((*iter)->GetType ())
70 NS_FATAL_ERROR (
"ToS Not implemented-- please implement and contribute a patch");
76 for (std::vector<uint8_t>::const_iterator iter2 = list->
Begin (); iter2 != list->
End (); ++iter2)
85 for (std::vector<Ipv4AddressTlvValue::ipv4Addr>::const_iterator iter2 = list->
Begin (); iter2 != list->
End (); ++iter2)
94 for (std::vector<Ipv4AddressTlvValue::ipv4Addr>::const_iterator iter2 = list->
Begin (); iter2 != list->
End (); ++iter2)
103 for (std::vector<PortRangeTlvValue::PortRange>::const_iterator iter2 = list->
Begin (); iter2 != list->
End (); ++iter2)
112 for (std::vector<PortRangeTlvValue::PortRange>::const_iterator iter2 = list->
Begin (); iter2 != list->
End (); ++iter2)
132 uint16_t SrcPortHigh,
134 uint16_t DstPortHigh,
224 for (std::vector<struct ipv4Addr>::const_iterator iter =
m_srcAddr.begin (); iter !=
m_srcAddr.end (); ++iter)
226 NS_LOG_INFO (
"src addr check match: pkt=" << srcAddress <<
" cls=" << (*iter).Address <<
"/" << (*iter).Mask);
227 if (srcAddress.
CombineMask ((*iter).Mask) == (*iter).Address)
239 for (std::vector<struct ipv4Addr>::const_iterator iter =
m_dstAddr.begin (); iter !=
m_dstAddr.end (); ++iter)
241 NS_LOG_INFO (
"dst addr check match: pkt=" << dstAddress <<
" cls=" << (*iter).Address <<
"/" << (*iter).Mask);
242 if (dstAddress.
CombineMask ((*iter).Mask) == (*iter).Address)
255 NS_LOG_INFO (
"src port check match: pkt=" << port <<
" cls= [" << (*iter).PortLow <<
" TO " << (*iter).PortHigh
257 if (port >= (*iter).PortLow && port <= (*iter).PortHigh)
270 NS_LOG_INFO (
"dst port check match: pkt=" << port <<
" cls= [" << (*iter).PortLow <<
" TO " << (*iter).PortHigh
272 if (port >= (*iter).PortLow && port <= (*iter).PortHigh)
283 for (std::vector<uint8_t>::const_iterator iter =
m_protocol.begin (); iter !=
m_protocol.end (); ++iter)
285 NS_LOG_INFO (
"proto check match: pkt=" << (uint16_t) proto <<
" cls=" << (uint16_t) proto);
286 if (proto == (*iter))
309 for (std::vector<struct ipv4Addr>::const_iterator iter =
m_srcAddr.begin (); iter !=
m_srcAddr.end (); ++iter)
311 ipv4AddrValSrc.
Add ((*iter).Address, (*iter).Mask);
315 for (std::vector<struct ipv4Addr>::const_iterator iter =
m_dstAddr.begin (); iter !=
m_dstAddr.end (); ++iter)
317 ipv4AddrValDst.
Add ((*iter).Address, (*iter).Mask);
321 for (std::vector<uint8_t>::const_iterator iter =
m_protocol.begin (); iter !=
m_protocol.end (); ++iter)
323 protoVal.
Add ((*iter));
329 portValueSrc.
Add ((*iter).PortLow, (*iter).PortHigh);
335 portValueDst.
Add ((*iter).PortLow, (*iter).PortHigh);
std::vector< struct PortRange > m_srcPortRange
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
virtual uint32_t GetSerializedSize(void) const
bool CheckMatchProtocol(uint8_t proto) const
void Add(uint16_t portLow, uint16_t portHigh)
virtual uint32_t GetSerializedSize(void) const
Ipv4Address CombineMask(Ipv4Mask const &mask) const
Combine this address with a network mask.
virtual uint32_t GetSerializedSize(void) const
void Add(uint8_t protiocol)
bool CheckMatchSrcAddr(Ipv4Address srcAddress) const
This class implements the Type-Len-Value structure channel encodings as described by "IEEE Standard f...
#define NS_FATAL_ERROR(msg)
fatal error handling
std::vector< uint8_t > m_protocol
virtual uint32_t GetSerializedSize(void) const
uint16_t GetCid(void) const
void AddSrcAddr(Ipv4Address srcAddress, Ipv4Mask srcMask)
add a new source ip address to the classifier
std::vector< struct ipv4Addr > m_dstAddr
void AddSrcPortRange(uint16_t srcPortLow, uint16_t srcPortHigh)
add a range of source port to the classifier
std::vector< struct PortRange > m_dstPortRange
void AddDstAddr(Ipv4Address dstAddress, Ipv4Mask dstMask)
add a new destination ip address to the classifier
bool CheckMatchDstPort(uint16_t dstPort) const
void SetCid(uint16_t cid)
Set the cid associated to this classifier.
void SetPriority(uint8_t prio)
Set the priority of this classifier.
uint8_t GetType(void) const
bool CheckMatchSrcPort(uint16_t srcPort) const
bool CheckMatchDstAddr(Ipv4Address dstAddress) const
TlvValue * PeekValue(void)
std::vector< struct ipv4Addr > m_srcAddr
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
#define NS_ASSERT_MSG(condition, message)
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)
Tlv ToTlv(void) const
Creates a TLV from this classifier.
NS_LOG_COMPONENT_DEFINE("IpcsClassifierRecord")