A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
packet-filter.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Universita' degli Studi di Napoli Federico II
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
7#ifndef PACKET_FILTER_H
8#define PACKET_FILTER_H
9
10#include "ns3/object.h"
11
12namespace ns3
13{
14
15class QueueDiscItem;
16
17/**
18 * \ingroup traffic-control
19 *
20 * PacketFilter is the abstract base class for filters used by queue discs
21 * to classify packets.
22 */
23class PacketFilter : public Object
24{
25 public:
26 /**
27 * \brief Get the type ID.
28 * \return the object TypeId
29 */
30 static TypeId GetTypeId();
31
33 ~PacketFilter() override;
34
35 /**
36 * Standard value used by packet filters to indicate that no match was possible.
37 */
38 static const int PF_NO_MATCH = -1;
39
40 /**
41 * \brief Classify a packet.
42 *
43 * \param item the packet to classify.
44 *
45 * \return -1 if this filter is not able to classify packets of the same protocol
46 * as item or the item does not match the filter conditions, the configured return
47 * value otherwise.
48 */
50
51 private:
52 /**
53 * \brief Checks if the filter is able to classify a kind of items.
54 *
55 * \param item an example item to check.
56 * \return true if this filter is able to classify packets.
57 */
58 virtual bool CheckProtocol(Ptr<QueueDiscItem> item) const = 0;
59
60 /**
61 * \brief Classify a packet.
62 *
63 * \param item the packet to classify.
64 *
65 * \return -1 if the item does not match the filter conditions, or the configured
66 * return value otherwise.
67 */
68 virtual int32_t DoClassify(Ptr<QueueDiscItem> item) const = 0;
69};
70
71} // namespace ns3
72
73#endif /* PACKET_FILTER */
A base class which provides memory management and object aggregation.
Definition object.h:78
PacketFilter is the abstract base class for filters used by queue discs to classify packets.
int32_t Classify(Ptr< QueueDiscItem > item) const
Classify a packet.
~PacketFilter() override
virtual int32_t DoClassify(Ptr< QueueDiscItem > item) const =0
Classify a packet.
static const int PF_NO_MATCH
Standard value used by packet filters to indicate that no match was possible.
static TypeId GetTypeId()
Get the type ID.
virtual bool CheckProtocol(Ptr< QueueDiscItem > item) const =0
Checks if the filter is able to classify a kind of items.
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.