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.cc
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
#include "
packet-filter.h
"
8
9
#include "
queue-disc.h
"
10
11
#include "ns3/integer.h"
12
#include "ns3/log.h"
13
14
namespace
ns3
15
{
16
17
NS_LOG_COMPONENT_DEFINE
(
"PacketFilter"
);
18
19
NS_OBJECT_ENSURE_REGISTERED
(PacketFilter);
20
21
TypeId
22
PacketFilter::GetTypeId
()
23
{
24
static
TypeId
tid =
25
TypeId
(
"ns3::PacketFilter"
).
SetParent
<
Object
>().SetGroupName(
"TrafficControl"
);
26
return
tid;
27
}
28
29
PacketFilter::PacketFilter
()
30
{
31
NS_LOG_FUNCTION
(
this
);
32
}
33
34
PacketFilter::~PacketFilter
()
35
{
36
NS_LOG_FUNCTION
(
this
);
37
}
38
39
int32_t
40
PacketFilter::Classify
(
Ptr<QueueDiscItem>
item)
const
41
{
42
NS_LOG_FUNCTION
(
this
<< item);
43
44
if
(!
CheckProtocol
(item))
45
{
46
NS_LOG_LOGIC
(
"Unable to classify packets of this protocol"
);
47
return
PF_NO_MATCH
;
48
}
49
50
return
DoClassify
(item);
51
}
52
53
}
// namespace ns3
int32_t
ns3::Object
A base class which provides memory management and object aggregation.
Definition
object.h:78
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::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition
log.h:271
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition
log-macros-enabled.h:229
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
packet-filter.h
queue-disc.h
src
traffic-control
model
packet-filter.cc
Generated on Fri Nov 8 2024 13:59:06 for ns-3 by
1.11.0