/usr/include/ns3.26/ns3/ipv4-flow-classifier.h is in libns3-dev 3.26+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2009 INESC Porto
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
//
#ifndef IPV4_FLOW_CLASSIFIER_H
#define IPV4_FLOW_CLASSIFIER_H
#include <stdint.h>
#include <map>
#include "ns3/ipv4-header.h"
#include "ns3/flow-classifier.h"
namespace ns3 {
class Packet;
/// 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
class Ipv4FlowClassifier : public FlowClassifier
{
public:
/// Structure to classify a packet
struct FiveTuple
{
Ipv4Address sourceAddress; //!< Source address
Ipv4Address destinationAddress; //!< Destination address
uint8_t protocol; //!< Protocol
uint16_t sourcePort; //!< Source port
uint16_t destinationPort; //!< Destination port
};
Ipv4FlowClassifier ();
/// \brief try to classify the packet into flow-id and packet-id
///
/// \warning: it must be called only once per packet, from SendOutgoingLogger.
///
/// \return true if the packet was classified, false if not (i.e. it
/// does not appear to be part of a flow).
/// \param ipHeader packet's IP header
/// \param ipPayload packet's IP payload
/// \param out_flowId packet's FlowId
/// \param out_packetId packet's identifier
bool Classify (const Ipv4Header &ipHeader, Ptr<const Packet> ipPayload,
uint32_t *out_flowId, uint32_t *out_packetId);
/// Searches for the FiveTuple corresponding to the given flowId
/// \param flowId the FlowId to search for
/// \returns the FiveTuple corresponding to flowId
FiveTuple FindFlow (FlowId flowId) const;
virtual void SerializeToXmlStream (std::ostream &os, int indent) const;
private:
/// Map to Flows Identifiers to FlowIds
std::map<FiveTuple, FlowId> m_flowMap;
/// Map to FlowIds to FlowPacketId
std::map<FlowId, FlowPacketId> m_flowPktIdMap;
};
/**
* \brief Less than operator.
*
* \param t1 the first operand
* \param t2 the first operand
* \returns true if the operands are equal
*/
bool operator < (const Ipv4FlowClassifier::FiveTuple &t1, const Ipv4FlowClassifier::FiveTuple &t2);
/**
* \brief Equal to operator.
*
* \param t1 the first operand
* \param t2 the first operand
* \returns true if the operands are equal
*/
bool operator == (const Ipv4FlowClassifier::FiveTuple &t1, const Ipv4FlowClassifier::FiveTuple &t2);
} // namespace ns3
#endif /* IPV4_FLOW_CLASSIFIER_H */
|