25 #include "ns3/abort.h" 51 os <<
"BIDIRECTIONAL";
67 os <<
" direction: " <<
f.direction
68 <<
" remoteAddress: " <<
f.remoteAddress
69 <<
" remoteAddress6: " <<
f.remoteAddress6
70 <<
" remoteMask: " <<
f.remoteMask
71 <<
" localAddress: " <<
f.localAddress
72 <<
" localAddress6: " <<
f.localAddress6
73 <<
" localMask: " <<
f.localMask
74 <<
" remotePortStart: " <<
f.remotePortStart
75 <<
" remotePortEnd: " <<
f.remotePortEnd
76 <<
" localPortStart: " <<
f.localPortStart
77 <<
" localPortEnd: " <<
f.localPortEnd
78 <<
" typeOfService: 0x" << std::hex << (uint16_t)
f.typeOfService << std::dec
79 <<
" typeOfServiceMask: 0x" << std::hex << (uint16_t)
f.typeOfServiceMask << std::dec;
85 direction (BIDIRECTIONAL),
86 remoteMask (
"0.0.0.0"),
87 localMask (
"0.0.0.0"),
89 remotePortEnd (65535),
110 if (remoteMask.IsMatch (remoteAddress, ra))
113 if (localMask.IsMatch (localAddress, la))
116 if (rp >= remotePortStart)
119 if (rp <= remotePortEnd)
122 if (lp >= localPortStart)
125 if (lp <= localPortEnd)
128 if ((tos & typeOfServiceMask) == (typeOfService & typeOfServiceMask))
140 NS_LOG_LOGIC (
"la doesn't match: la=" << la <<
" f.la=" << localAddress <<
" f.lmask=" << localMask);
145 NS_LOG_LOGIC (
"ra doesn't match: ra=" << ra <<
" f.ra=" << remoteAddress <<
" f.rmask=" << remoteMask);
150 NS_LOG_LOGIC (
"d doesn't match: d=0x" << std::hex << d <<
" f.d=0x" << std::hex << direction << std::dec);
167 if (rp >= remotePortStart)
170 if (rp <= remotePortEnd)
173 if (lp >= localPortStart)
176 if (lp <= localPortEnd)
179 if ((tos & typeOfServiceMask) == (typeOfService & typeOfServiceMask))
191 NS_LOG_LOGIC (
"la doesn't match: la=" << la <<
" f.la=" << localAddress <<
" f.lmask=" << localMask);
196 NS_LOG_LOGIC (
"ra doesn't match: ra=" << ra <<
" f.ra=" << remoteAddress <<
" f.rmask=" << remoteMask);
201 NS_LOG_LOGIC (
"d doesn't match: d=0x" << std::hex << d <<
" f.d=0x" << std::hex << direction << std::dec);
212 tft->Add (defaultPacketFilter);
229 std::list<PacketFilter>::iterator it;
231 (it !=
m_filters.end ()) && (it->precedence <=
f.precedence);
246 uint8_t typeOfService)
248 NS_LOG_FUNCTION (
this << direction << remoteAddress << localAddress << std::dec << remotePort << localPort << (uint16_t) typeOfService);
249 for (std::list<PacketFilter>::iterator it =
m_filters.begin ();
253 if (it->Matches (direction, remoteAddress, localAddress, remotePort, localPort, typeOfService))
267 uint8_t typeOfService)
269 NS_LOG_FUNCTION (
this << direction << remoteAddress << localAddress << std::dec << remotePort << localPort << (uint16_t) typeOfService);
270 for (std::list<PacketFilter>::iterator it =
m_filters.begin ();
274 if (it->Matches (direction, remoteAddress, localAddress, remotePort, localPort, typeOfService))
Direction
Indicates the direction of the traffic that is to be classified.
std::list< PacketFilter > m_filters
packet filter list
uint8_t Add(PacketFilter f)
add a PacketFilter to the Traffic Flow Template
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
static Ptr< EpcTft > Default()
creates a TFT matching any traffic
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
bool Matches(Direction d, Ipv4Address ra, Ipv4Address la, uint16_t rp, uint16_t lp, uint8_t tos)
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
double f(double x, void *params)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Describes an IPv6 address.
Ipv4 addresses are stored in host order in this class.
bool Matches(Direction direction, Ipv4Address remoteAddress, Ipv4Address localAddress, uint16_t remotePort, uint16_t localPort, uint8_t typeOfService)
uint8_t m_numFilters
number of packet filters applied to this TFT
Implement the data structure representing a TrafficFlowTemplate Packet Filter.