29 #include "ns3/packet.h" 30 #include "ns3/ipv4-header.h" 31 #include "ns3/ipv6-header.h" 32 #include "ns3/udp-header.h" 33 #include "ns3/tcp-header.h" 34 #include "ns3/ipv4-l3-protocol.h" 35 #include "ns3/icmpv4-l4-protocol.h" 36 #include "ns3/udp-l4-protocol.h" 37 #include "ns3/tcp-l4-protocol.h" 38 #include "ns3/ipv6-l3-protocol.h" 39 #include "ns3/icmpv6-l4-protocol.h" 83 uint16_t localPort = 0;
84 uint16_t remotePort = 0;
89 pCopy->RemoveHeader (ipv4Header);
93 localAddressIpv4 = ipv4Header.
GetSource ();
99 remoteAddressIpv4 = ipv4Header.
GetSource ();
102 NS_LOG_INFO (
"local address: " << localAddressIpv4 <<
" remote address: " << remoteAddressIpv4);
112 tos = ipv4Header.
GetTos ();
118 if (fragmentOffset == 0)
123 pCopy->RemoveHeader (udpHeader);
136 std::tuple<uint32_t, uint32_t, uint8_t, uint16_t> fragmentKey =
148 pCopy->RemoveHeader (tcpHeader);
162 std::tuple<uint32_t, uint32_t, uint8_t, uint16_t> fragmentKey =
180 std::tuple<uint32_t, uint32_t, uint8_t, uint16_t> fragmentKey =
186 std::map< std::tuple<uint32_t, uint32_t, uint8_t, uint16_t>,
187 std::pair<uint32_t, uint32_t> >::iterator it =
192 localPort = it->second.first;
193 remotePort = it->second.second;
205 pCopy->RemoveHeader (ipv6Header);
218 NS_LOG_INFO (
"local address: " << localAddressIpv6 <<
" remote address: " << remoteAddressIpv6);
226 pCopy->RemoveHeader (udpHeader);
242 pCopy->RemoveHeader (tcpHeader);
257 NS_ABORT_MSG (
"EpcTftClassifier::Classify - Unknown IP type...");
264 <<
" localAddr=" << localAddressIpv4
265 <<
" remoteAddr=" << remoteAddressIpv4
266 <<
" localPort=" << localPort
267 <<
" remotePort=" << remotePort
268 <<
" tos=0x" << (uint16_t) tos );
273 std::map <uint32_t, Ptr<EpcTft> >::const_reverse_iterator it;
281 if (tft->Matches (direction, remoteAddressIpv4, localAddressIpv4, remotePort, localPort, tos))
291 <<
" localAddr=" << localAddressIpv6
292 <<
" remoteAddr=" << remoteAddressIpv6
293 <<
" localPort=" << localPort
294 <<
" remotePort=" << remotePort
295 <<
" tos=0x" << (uint16_t) tos );
300 std::map <uint32_t, Ptr<EpcTft> >::const_reverse_iterator it;
308 if (tft->Matches (direction, remoteAddressIpv6, localAddressIpv6, remotePort, localPort, tos))
Direction
Indicates the direction of the traffic that is to be classified.
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 "...
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void Add(Ptr< EpcTft > tft, uint32_t id)
add a TFT to the Classifier
uint32_t Classify(Ptr< Packet > p, EpcTft::Direction direction, uint16_t protocolNumber)
classify an IP packet
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
static const uint8_t PROT_NUMBER
protocol number (0x6)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
std::map< uint32_t, Ptr< EpcTft > > m_tftMap
TFT map.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
Describes an IPv6 address.
Ipv4 addresses are stored in host order in this class.
std::map< std::tuple< uint32_t, uint32_t, uint8_t, uint16_t >, std::pair< uint32_t, uint32_t > > m_classifiedIpv4Fragments
Map with already classified IPv4 Fragments An entry is added when the port info is available...
void Delete(uint32_t id)
delete an existing TFT from the classifier
uint32_t Get(void) const
Get the host-order 32-bit IP address.
static const uint8_t PROT_NUMBER
protocol number (0x11)
static const uint16_t PROT_NUMBER
The protocol number for IPv6 (0x86DD).
static const uint16_t PROT_NUMBER
Protocol number (0x0800)