A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
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
12
namespace
ns3
13
{
14
15
class
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
*/
23
class
PacketFilter
:
public
Object
24
{
25
public
:
26
/**
27
* @brief Get the type ID.
28
* @return the object TypeId
29
*/
30
static
TypeId
GetTypeId
();
31
32
PacketFilter
();
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
*/
49
int32_t
Classify
(
Ptr<QueueDiscItem>
item)
const
;
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 */
int32_t
ns3::Object
A base class which provides memory management and object aggregation.
Definition
object.h:78
ns3::PacketFilter
PacketFilter is the abstract base class for filters used by queue discs to classify packets.
Definition
packet-filter.h:24
ns3::PacketFilter::Classify
int32_t Classify(Ptr< QueueDiscItem > item) const
Classify a packet.
Definition
packet-filter.cc:40
ns3::PacketFilter::~PacketFilter
~PacketFilter() override
Definition
packet-filter.cc:34
ns3::PacketFilter::PacketFilter
PacketFilter()
Definition
packet-filter.cc:29
ns3::PacketFilter::DoClassify
virtual int32_t DoClassify(Ptr< QueueDiscItem > item) const =0
Classify a packet.
ns3::PacketFilter::PF_NO_MATCH
static const int PF_NO_MATCH
Standard value used by packet filters to indicate that no match was possible.
Definition
packet-filter.h:38
ns3::PacketFilter::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
packet-filter.cc:22
ns3::PacketFilter::CheckProtocol
virtual bool CheckProtocol(Ptr< QueueDiscItem > item) const =0
Checks if the filter is able to classify a kind of items.
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
traffic-control
model
packet-filter.h
Generated on Tue Dec 10 2024 18:20:49 for ns-3 by
1.11.0