A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::Ipv4FlowClassifier Class Reference

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

#include <ipv4-flow-classifier.h>

+ Inheritance diagram for ns3::Ipv4FlowClassifier:
+ Collaboration diagram for ns3::Ipv4FlowClassifier:

Classes

struct  FiveTuple
 Structure to classify a packet. More...
 

Public Member Functions

 Ipv4FlowClassifier ()
 
bool Classify (const Ipv4Header &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...
 
virtual void SerializeToXmlStream (std::ostream &os, int 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 ()
 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. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 

Private Attributes

std::map< FiveTuple, FlowIdm_flowMap
 Map to Flows Identifiers to FlowIds. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ns3::SimpleRefCount< FlowClassifier >
static void Cleanup (void)
 Noop. More...
 
- Protected Member Functions inherited from ns3::FlowClassifier
FlowId GetNewFlowId ()
 Returns a new, unique Flow Identifier. 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 38 of file ipv4-flow-classifier.h.

Constructor & Destructor Documentation

ns3::Ipv4FlowClassifier::Ipv4FlowClassifier ( )

Definition at line 98 of file ipv4-flow-classifier.cc.

Member Function Documentation

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

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

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 103 of file ipv4-flow-classifier.cc.

References ns3::Packet::CopyData(), data, ns3::Ipv4FlowClassifier::FiveTuple::destinationAddress, ns3::Ipv4FlowClassifier::FiveTuple::destinationPort, ns3::Ipv4Address::GetBroadcast(), ns3::Ipv4Header::GetDestination(), ns3::Ipv4Header::GetFragmentOffset(), ns3::Ipv4Header::GetIdentification(), ns3::FlowClassifier::GetNewFlowId(), ns3::Ipv4Header::GetProtocol(), ns3::Packet::GetSize(), ns3::Ipv4Header::GetSource(), m_flowMap, ns3::Ipv4FlowClassifier::FiveTuple::protocol, ns3::Ipv4FlowClassifier::FiveTuple::sourceAddress, ns3::Ipv4FlowClassifier::FiveTuple::sourcePort, ns3::TCP_PROT_NUMBER, and ns3::UDP_PROT_NUMBER.

+ Here is the call graph for this function:

Ipv4FlowClassifier::FiveTuple ns3::Ipv4FlowClassifier::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 173 of file ipv4-flow-classifier.cc.

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

Referenced by experiment().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::Ipv4FlowClassifier::SerializeToXmlStream ( std::ostream &  os,
int  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 189 of file ipv4-flow-classifier.cc.

References INDENT, and m_flowMap.

Member Data Documentation

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

Map to Flows Identifiers to FlowIds.

Definition at line 74 of file ipv4-flow-classifier.h.

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


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