A Discrete-Event Network Simulator
API
Classes | Public Member Functions | Private Attributes | List of all members
ns3::Ipv6FlowClassifier Class Reference

Classifies packets by looking at their IP and TCP/UDP headers. More...

#include "ipv6-flow-classifier.h"

+ Inheritance diagram for ns3::Ipv6FlowClassifier:

Classes

struct  FiveTuple
 Structure to classify a packet. More...
 
class  SortByCount
 Comparator used to sort the vector of DSCP values. More...
 

Public Member Functions

 Ipv6FlowClassifier ()
 
bool Classify (const Ipv6Header &ipHeader, Ptr< const Packet > ipPayload, uint32_t *out_flowId, uint32_t *out_packetId)
 try to classify the packet into flow-id and packet-id More...
 
FiveTuple FindFlow (FlowId flowId) const
 Searches for the FiveTuple corresponding to the given flowId. More...
 
std::vector< std::pair< Ipv6Header::DscpType, uint32_t > > GetDscpCounts (FlowId flowId) const
 get the DSCP values of the packets belonging to the flow with the given FlowId, sorted in decreasing order of number of packets seen with that DSCP value More...
 
virtual void SerializeToXmlStream (std::ostream &os, uint16_t indent) const
 Serializes the results to an std::ostream in XML format. More...
 
- Public Member Functions inherited from ns3::FlowClassifier
 FlowClassifier ()
 
virtual ~FlowClassifier ()
 
- Public Member Functions inherited from ns3::SimpleRefCount< FlowClassifier >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 

Private Attributes

std::map< FlowId, std::map< Ipv6Header::DscpType, uint32_t > > m_flowDscpMap
 Map FlowIds to (DSCP value, packet count) pairs. More...
 
std::map< FiveTuple, FlowIdm_flowMap
 Map to Flows Identifiers to FlowIds. More...
 
std::map< FlowId, FlowPacketIdm_flowPktIdMap
 Map to FlowIds to FlowPacketId. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::FlowClassifier
FlowId GetNewFlowId ()
 Returns a new, unique Flow Identifier. More...
 
void Indent (std::ostream &os, uint16_t level) const
 Add a number of spaces for indentation purposes. More...
 

Detailed Description

Classifies packets by looking at their IP and TCP/UDP headers.

From these packet headers, a tuple (source-ip, destination-ip, protocol, source-port, destination-port) is created, and a unique flow identifier is assigned for each different tuple combination

Definition at line 39 of file ipv6-flow-classifier.h.

Constructor & Destructor Documentation

◆ Ipv6FlowClassifier()

ns3::Ipv6FlowClassifier::Ipv6FlowClassifier ( )

Definition at line 100 of file ipv6-flow-classifier.cc.

Member Function Documentation

◆ Classify()

bool ns3::Ipv6FlowClassifier::Classify ( const Ipv6Header ipHeader,
Ptr< const Packet ipPayload,
uint32_t *  out_flowId,
uint32_t *  out_packetId 
)

try to classify the packet into flow-id and packet-id

Warning
: it must be called only once per packet, from SendOutgoingLogger.
Returns
true if the packet was classified, false if not (i.e. it does not appear to be part of a flow).
Parameters
ipHeaderpacket's IP header
ipPayloadpacket's IP payload
out_flowIdpacket's FlowId
out_packetIdpacket's identifier

Definition at line 105 of file ipv6-flow-classifier.cc.

References ns3::Packet::CopyData(), data, ns3::Ipv6FlowClassifier::FiveTuple::destinationAddress, ns3::Ipv6FlowClassifier::FiveTuple::destinationPort, ns3::Ipv6Header::GetDestinationAddress(), ns3::Ipv6Header::GetDscp(), ns3::FlowClassifier::GetNewFlowId(), ns3::Ipv6Header::GetNextHeader(), ns3::Packet::GetSize(), ns3::Ipv6Header::GetSourceAddress(), ns3::Ipv6Address::IsMulticast(), m_flowDscpMap, m_flowMap, m_flowPktIdMap, ns3::Ipv6FlowClassifier::FiveTuple::protocol, ns3::Ipv6FlowClassifier::FiveTuple::sourceAddress, ns3::Ipv6FlowClassifier::FiveTuple::sourcePort, ns3::TCP_PROT_NUMBER, and ns3::UDP_PROT_NUMBER.

◆ FindFlow()

Ipv6FlowClassifier::FiveTuple ns3::Ipv6FlowClassifier::FindFlow ( FlowId  flowId) const

Searches for the FiveTuple corresponding to the given flowId.

Parameters
flowIdthe FlowId to search for
Returns
the FiveTuple corresponding to flowId

Definition at line 187 of file ipv6-flow-classifier.cc.

References ns3::Ipv6Address::GetZero(), m_flowMap, and NS_FATAL_ERROR.

◆ GetDscpCounts()

std::vector< std::pair< Ipv6Header::DscpType, uint32_t > > ns3::Ipv6FlowClassifier::GetDscpCounts ( FlowId  flowId) const

get the DSCP values of the packets belonging to the flow with the given FlowId, sorted in decreasing order of number of packets seen with that DSCP value

Parameters
flowIdthe identifier of the flow of interest
Returns
the vector of DSCP values

Definition at line 210 of file ipv6-flow-classifier.cc.

References m_flowDscpMap, and NS_FATAL_ERROR.

◆ SerializeToXmlStream()

void ns3::Ipv6FlowClassifier::SerializeToXmlStream ( std::ostream &  os,
uint16_t  indent 
) const
virtual

Serializes the results to an std::ostream in XML format.

Parameters
osthe output stream
indentnumber of spaces to use as base indentation level

Implements ns3::FlowClassifier.

Definition at line 226 of file ipv6-flow-classifier.cc.

References ns3::FlowClassifier::Indent(), check-style::indent(), m_flowDscpMap, and m_flowMap.

Member Data Documentation

◆ m_flowDscpMap

std::map<FlowId, std::map<Ipv6Header::DscpType, uint32_t> > ns3::Ipv6FlowClassifier::m_flowDscpMap
private

Map FlowIds to (DSCP value, packet count) pairs.

Definition at line 101 of file ipv6-flow-classifier.h.

Referenced by Classify(), GetDscpCounts(), and SerializeToXmlStream().

◆ m_flowMap

std::map<FiveTuple, FlowId> ns3::Ipv6FlowClassifier::m_flowMap
private

Map to Flows Identifiers to FlowIds.

Definition at line 97 of file ipv6-flow-classifier.h.

Referenced by Classify(), FindFlow(), and SerializeToXmlStream().

◆ m_flowPktIdMap

std::map<FlowId, FlowPacketId> ns3::Ipv6FlowClassifier::m_flowPktIdMap
private

Map to FlowIds to FlowPacketId.

Definition at line 99 of file ipv6-flow-classifier.h.

Referenced by Classify().


The documentation for this class was generated from the following files: