25 #include "ns3/abort.h"
51 os <<
"BIDIRECTIONAL";
67 os <<
" direction: " <<
f.direction
68 <<
" remoteAddress: " <<
f.remoteAddress
69 <<
" remoteMask: " <<
f.remoteMask
70 <<
" remoteIpv6Address: " <<
f.remoteIpv6Address
71 <<
" remoteIpv6Prefix: " <<
f.remoteIpv6Prefix
72 <<
" localAddress: " <<
f.localAddress
73 <<
" localMask: " <<
f.localMask
74 <<
" localIpv6Address: " <<
f.localIpv6Address
75 <<
" localIpv6Prefix: " <<
f.localIpv6Prefix
76 <<
" remotePortStart: " <<
f.remotePortStart
77 <<
" remotePortEnd: " <<
f.remotePortEnd
78 <<
" localPortStart: " <<
f.localPortStart
79 <<
" localPortEnd: " <<
f.localPortEnd
80 <<
" typeOfService: 0x" << std::hex << (uint16_t)
f.typeOfService << std::dec
81 <<
" typeOfServiceMask: 0x" << std::hex << (uint16_t)
f.typeOfServiceMask << std::dec;
87 direction (BIDIRECTIONAL),
88 remoteMask (
"0.0.0.0"),
89 localMask (
"0.0.0.0"),
91 remotePortEnd (65535),
112 if (remoteMask.IsMatch (remoteAddress, ra))
115 if (localMask.IsMatch (localAddress, la))
118 if (remotePortStart <= rp && rp <= remotePortEnd)
121 if (localPortStart <= lp && lp <= localPortEnd)
124 if ((tos & typeOfServiceMask) == (typeOfService & typeOfServiceMask))
131 NS_LOG_LOGIC (
"tos doesn't match: tos=" << tos <<
" f.tos=" << typeOfService <<
" f.tosmask=" << typeOfServiceMask);
136 NS_LOG_LOGIC (
"lp doesn't match: lp=" << lp <<
" f.lps=" << localPortStart <<
" f.lpe=" << localPortEnd);
141 NS_LOG_LOGIC (
"rp doesn't match: rp=" << rp <<
" f.rps=" << remotePortStart <<
" f.lpe=" << remotePortEnd);
146 NS_LOG_LOGIC (
"la doesn't match: la=" << la <<
" f.la=" << localAddress <<
" f.lmask=" << localMask);
151 NS_LOG_LOGIC (
"ra doesn't match: ra=" << ra <<
" f.ra=" << remoteAddress <<
" f.rmask=" << remoteMask);
156 NS_LOG_LOGIC (
"d doesn't match: d=0x" << std::hex << d <<
" f.d=0x" << std::hex << direction << std::dec);
173 if (remoteIpv6Prefix.IsMatch (remoteIpv6Address, ra))
176 if (localIpv6Prefix.IsMatch (localIpv6Address, la))
179 if (remotePortStart <= rp && rp <= remotePortEnd)
182 if (localPortStart <= lp && lp <= localPortEnd)
185 if ((tos & typeOfServiceMask) == (typeOfService & typeOfServiceMask))
192 NS_LOG_LOGIC (
"tos doesn't match: tos=" << tos <<
" f.tos=" << typeOfService <<
" f.tosmask=" << typeOfServiceMask);
197 NS_LOG_LOGIC (
"lp doesn't match: lp=" << lp <<
" f.lps=" << localPortStart <<
" f.lpe=" << localPortEnd);
202 NS_LOG_LOGIC (
"rp doesn't match: rp=" << rp <<
" f.rps=" << remotePortStart <<
" f.lpe=" << remotePortEnd);
207 NS_LOG_LOGIC (
"la doesn't match: la=" << la <<
" f.la=" << localIpv6Address <<
" f.lprefix=" << localIpv6Prefix);
212 NS_LOG_LOGIC (
"ra doesn't match: ra=" << ra <<
" f.ra=" << remoteIpv6Address <<
" f.rprefix=" << remoteIpv6Prefix);
217 NS_LOG_LOGIC (
"d doesn't match: d=0x" << std::hex << d <<
" f.d=0x" << std::hex << direction << std::dec);
228 tft->Add (defaultPacketFilter);
245 std::list<PacketFilter>::iterator it;
247 (it !=
m_filters.end ()) && (it->precedence <=
f.precedence);
262 uint8_t typeOfService)
264 NS_LOG_FUNCTION (
this << direction << remoteAddress << localAddress << std::dec << remotePort << localPort << (uint16_t) typeOfService);
265 for (std::list<PacketFilter>::iterator it =
m_filters.begin ();
269 if (it->Matches (direction, remoteAddress, localAddress, remotePort, localPort, typeOfService))
283 uint8_t typeOfService)
285 NS_LOG_FUNCTION (
this << direction << remoteAddress << localAddress << std::dec << remotePort << localPort << (uint16_t) typeOfService);
286 for (std::list<PacketFilter>::iterator it =
m_filters.begin ();
290 if (it->Matches (direction, remoteAddress, localAddress, remotePort, localPort, typeOfService))
298 std::list<EpcTft::PacketFilter>
double f(double x, void *params)
uint8_t Add(PacketFilter f)
add a PacketFilter to the Traffic Flow Template
bool Matches(Direction direction, Ipv4Address remoteAddress, Ipv4Address localAddress, uint16_t remotePort, uint16_t localPort, uint8_t typeOfService)
static Ptr< EpcTft > Default()
creates a TFT matching any traffic
std::list< PacketFilter > GetPacketFilters() const
Get the packet filters.
Direction
Indicates the direction of the traffic that is to be classified.
std::list< PacketFilter > m_filters
packet filter list
uint8_t m_numFilters
number of packet filters applied to this TFT
Ipv4 addresses are stored in host order in this class.
Describes an IPv6 address.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
bool Matches(Direction d, Ipv4Address ra, Ipv4Address la, uint16_t rp, uint16_t lp, uint8_t tos)