21 #include "ns3/packet.h"
24 #include "ns3/udp-header.h"
25 #include "ns3/tcp-header.h"
104 uint32_t *out_flowId, uint32_t *out_packetId)
142 uint16_t srcPort = 0;
147 uint16_t dstPort = 0;
156 std::pair<std::map<FiveTuple, FlowId>::iterator,
bool> insert
157 =
m_flowMap.insert (std::pair<FiveTuple, FlowId> (tuple, 0));
165 *out_flowId = insert.first->second;
175 for (std::map<FiveTuple, FlowId>::const_iterator
178 if (iter->second == flowId)
191 #define INDENT(level) for (int __xpto = 0; __xpto < level; __xpto++) os << ' ';
193 INDENT (indent); os <<
"<Ipv4FlowClassifier>\n";
196 for (std::map<FiveTuple, FlowId>::const_iterator
200 os <<
"<Flow flowId=\"" << iter->second <<
"\""
201 <<
" sourceAddress=\"" << iter->first.sourceAddress <<
"\""
202 <<
" destinationAddress=\"" << iter->first.destinationAddress <<
"\""
203 <<
" protocol=\"" << int(iter->first.protocol) <<
"\""
204 <<
" sourcePort=\"" << iter->first.sourcePort <<
"\""
205 <<
" destinationPort=\"" << iter->first.destinationPort <<
"\""
210 INDENT (indent); os <<
"</Ipv4FlowClassifier>\n";
FlowId GetNewFlowId()
Returns a new, unique Flow Identifier.
Ipv4Address destinationAddress
Destination address.
uint16_t destinationPort
Destination port.
const uint8_t TCP_PROT_NUMBER
TCP Protocol number.
uint8_t protocol
Protocol.
uint32_t GetSize(void) const
bool operator<(const Room &a, const Room &b)
#define NS_FATAL_ERROR(msg)
fatal error handling
virtual void SerializeToXmlStream(std::ostream &os, int indent) const
Serializes the results to an std::ostream in XML format.
FiveTuple FindFlow(FlowId flowId) const
Searches for the FiveTuple corresponding to the given flowId.
static Ipv4Address GetBroadcast(void)
uint16_t sourcePort
Source port.
static Ipv4Address GetZero(void)
Structure to classify a packet.
const uint8_t UDP_PROT_NUMBER
UDP Protocol number.
bool operator==(const EventId &a, const EventId &b)
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
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
std::map< FiveTuple, FlowId > m_flowMap
Map to Flows Identifiers to FlowIds.
Ipv4Address sourceAddress
Source address.
uint32_t FlowId
Abstract identifier of a packet flow.