22 #include "ns3/abort.h"
49 os <<
"BIDIRECTIONAL";
65 os <<
" direction: " <<
f.direction <<
" remoteAddress: " <<
f.remoteAddress
66 <<
" remoteMask: " <<
f.remoteMask <<
" remoteIpv6Address: " <<
f.remoteIpv6Address
67 <<
" remoteIpv6Prefix: " <<
f.remoteIpv6Prefix <<
" localAddress: " <<
f.localAddress
68 <<
" localMask: " <<
f.localMask <<
" localIpv6Address: " <<
f.localIpv6Address
69 <<
" localIpv6Prefix: " <<
f.localIpv6Prefix <<
" remotePortStart: " <<
f.remotePortStart
70 <<
" remotePortEnd: " <<
f.remotePortEnd <<
" localPortStart: " <<
f.localPortStart
71 <<
" localPortEnd: " <<
f.localPortEnd <<
" typeOfService: 0x" << std::hex
72 << (uint16_t)
f.typeOfService << std::dec <<
" typeOfServiceMask: 0x" << std::hex
73 << (uint16_t)
f.typeOfServiceMask << std::dec;
79 direction(BIDIRECTIONAL),
80 remoteMask(
"0.0.0.0"),
107 if (localMask.IsMatch(localAddress, la))
110 if (remotePortStart <= rp && rp <= remotePortEnd)
113 if (localPortStart <= lp && lp <= localPortEnd)
116 if ((tos & typeOfServiceMask) == (typeOfService & typeOfServiceMask))
124 << tos <<
" f.tos=" << typeOfService
125 <<
" f.tosmask=" << typeOfServiceMask);
130 NS_LOG_LOGIC(
"lp doesn't match: lp=" << lp <<
" f.lps=" << localPortStart
131 <<
" f.lpe=" << localPortEnd);
136 NS_LOG_LOGIC(
"rp doesn't match: rp=" << rp <<
" f.rps=" << remotePortStart
137 <<
" f.lpe=" << remotePortEnd);
142 NS_LOG_LOGIC(
"la doesn't match: la=" << la <<
" f.la=" << localAddress
143 <<
" f.lmask=" << localMask);
149 <<
" f.rmask=" << remoteMask);
154 NS_LOG_LOGIC(
"d doesn't match: d=0x" << std::hex << d <<
" f.d=0x" << std::hex << direction
172 if (remoteIpv6Prefix.IsMatch(remoteIpv6Address, ra))
175 if (localIpv6Prefix.IsMatch(localIpv6Address, la))
178 if (remotePortStart <= rp && rp <= remotePortEnd)
181 if (localPortStart <= lp && lp <= localPortEnd)
184 if ((tos & typeOfServiceMask) == (typeOfService & typeOfServiceMask))
192 << tos <<
" f.tos=" << typeOfService
193 <<
" f.tosmask=" << typeOfServiceMask);
198 NS_LOG_LOGIC(
"lp doesn't match: lp=" << lp <<
" f.lps=" << localPortStart
199 <<
" f.lpe=" << localPortEnd);
204 NS_LOG_LOGIC(
"rp doesn't match: rp=" << rp <<
" f.rps=" << remotePortStart
205 <<
" f.lpe=" << remotePortEnd);
210 NS_LOG_LOGIC(
"la doesn't match: la=" << la <<
" f.la=" << localIpv6Address
211 <<
" f.lprefix=" << localIpv6Prefix);
216 NS_LOG_LOGIC(
"ra doesn't match: ra=" << ra <<
" f.ra=" << remoteIpv6Address
217 <<
" f.rprefix=" << remoteIpv6Prefix);
222 NS_LOG_LOGIC(
"d doesn't match: d=0x" << std::hex << d <<
" f.d=0x" << std::hex << direction
233 tft->Add(defaultPacketFilter);
249 std::list<PacketFilter>::iterator it;
250 for (it =
m_filters.begin(); (it !=
m_filters.end()) && (it->precedence <=
f.precedence); ++it)
264 uint8_t typeOfService)
267 << localPort << (uint16_t)typeOfService);
270 if (it->Matches(direction,
289 uint8_t typeOfService)
292 << localPort << (uint16_t)typeOfService);
295 if (it->Matches(direction,
308 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)