A Discrete-Event Network Simulator
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
14namespace ns3
15{
16
17NS_LOG_COMPONENT_DEFINE("PacketFilter");
18
19NS_OBJECT_ENSURE_REGISTERED(PacketFilter);
20
21TypeId
23{
24 static TypeId tid =
25 TypeId("ns3::PacketFilter").SetParent<Object>().SetGroupName("TrafficControl");
26 return tid;
27}
28
33
38
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
A base class which provides memory management and object aggregation.
Definition object.h:78
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
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.