22 #include "ns3/packet.h"
25 #include "ns3/udp-header.h"
26 #include "ns3/tcp-header.h"
105 uint32_t *out_flowId, uint32_t *out_packetId)
118 if ((tuple.
protocol != UDP_PROT_NUMBER) && (tuple.
protocol != TCP_PROT_NUMBER))
137 uint16_t srcPort = 0;
142 uint16_t dstPort = 0;
151 std::pair<std::map<FiveTuple, FlowId>::iterator,
bool> insert
152 =
m_flowMap.insert (std::pair<FiveTuple, FlowId> (tuple, 0));
158 insert.first->second = newFlowId;
166 *out_flowId = insert.first->second;
176 for (std::map<FiveTuple, FlowId>::const_iterator
179 if (iter->second == flowId)
192 #define INDENT(level) for (int __xpto = 0; __xpto < level; __xpto++) os << ' ';
194 INDENT (indent); os <<
"<Ipv6FlowClassifier>\n";
197 for (std::map<FiveTuple, FlowId>::const_iterator
201 os <<
"<Flow flowId=\"" << iter->second <<
"\""
202 <<
" sourceAddress=\"" << iter->first.sourceAddress <<
"\""
203 <<
" destinationAddress=\"" << iter->first.destinationAddress <<
"\""
204 <<
" protocol=\"" << int(iter->first.protocol) <<
"\""
205 <<
" sourcePort=\"" << iter->first.sourcePort <<
"\""
206 <<
" destinationPort=\"" << iter->first.destinationPort <<
"\""
211 INDENT (indent); os <<
"</Ipv6FlowClassifier>\n";
FiveTuple FindFlow(FlowId flowId) const
Searches for the FiveTuple corresponding to the given flowId.
FlowId GetNewFlowId()
Returns a new, unique Flow Identifier.
Ipv6Address destinationAddress
Destination address.
const uint8_t TCP_PROT_NUMBER
TCP Protocol number.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
#define NS_FATAL_ERROR(msg)
Fatal error handling.
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
def indent(source, debug, level)
virtual void SerializeToXmlStream(std::ostream &os, int indent) const
Serializes the results to an std::ostream in XML format.
static Ipv6Address GetZero()
Get the 0 (::) Ipv6Address.
std::map< FiveTuple, FlowId > m_flowMap
Map to Flows Identifiers to FlowIds.
Ipv6Address sourceAddress
Source address.
bool operator<(const int64x64_t &lhs, const int64x64_t &rhs)
Less than operator.
std::map< FlowId, FlowPacketId > m_flowPktIdMap
Map to FlowIds to FlowPacketId.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t protocol
Protocol.
bool IsMulticast() const
If the IPv6 address is multicast (ff00::/8).
const uint8_t UDP_PROT_NUMBER
UDP Protocol number.
bool operator==(const EventId &a, const EventId &b)
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
uint16_t destinationPort
Destination port.
uint16_t sourcePort
Source port.
Structure to classify a packet.
uint32_t FlowId
Abstract identifier of a packet flow.