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
epc-tft-classifier.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Nicola Baldo <nbaldo@cttc.es>
7
*/
8
9
#ifndef EPC_TFT_CLASSIFIER_H
10
#define EPC_TFT_CLASSIFIER_H
11
12
#include "
epc-tft.h
"
13
14
#include "ns3/ptr.h"
15
#include "ns3/simple-ref-count.h"
16
17
#include <map>
18
19
namespace
ns3
20
{
21
22
class
EpcTft;
23
class
Packet;
24
25
/**
26
* \brief classifies IP packets according to Traffic Flow Templates (TFTs)
27
*
28
* \note this implementation works with IPv4 and IPv6.
29
* When there is fragmentation of IP packets, UDP/TCP ports maybe missing.
30
*
31
* The following actions are performed to use the port info present in the first segment with
32
* the next fragments:
33
* - Port info is stored if it is available, i.e. it is the first fragment with UDP/TCP protocol
34
* and there is enough data in the payload of the IP packet for the port numbers.
35
* - Port info is used for the next fragments.
36
* - Port info is deleted, when the last fragment is processed.
37
*
38
* When we cannot cache the port info, the TFT of the default bearer is used. This may happen
39
* if there is reordering or losses of IP packets.
40
*/
41
class
EpcTftClassifier
:
public
SimpleRefCount
<EpcTftClassifier>
42
{
43
public
:
44
EpcTftClassifier
();
45
46
/**
47
* add a TFT to the Classifier
48
*
49
* \param tft the TFT to be added
50
* \param id the ID of the bearer which will be classified by specified TFT classifier
51
*
52
*/
53
void
Add
(
Ptr<EpcTft>
tft,
uint32_t
id
);
54
55
/**
56
* delete an existing TFT from the classifier
57
*
58
* \param id the identifier of the TFT to be deleted
59
*/
60
void
Delete
(
uint32_t
id
);
61
62
/**
63
* classify an IP packet
64
*
65
* \param p the IP packet. The outmost header can only be an IPv4 or an IPv6 header.
66
* \param direction the EPC TFT direction (can be downlink, uplink or bi-directional)
67
* \param protocolNumber the protocol of the packet. Only IPv4 and IPv6 are supported.
68
*
69
* \return the identifier (>0) of the first TFT that matches with the IP packet; 0 if no TFT
70
* matched.
71
*/
72
uint32_t
Classify
(
Ptr<Packet>
p,
EpcTft::Direction
direction, uint16_t protocolNumber);
73
74
protected
:
75
std::map<uint32_t, Ptr<EpcTft>>
m_tftMap
;
///< TFT map
76
77
std::map<std::tuple<uint32_t, uint32_t, uint8_t, uint16_t>, std::pair<uint32_t, uint32_t>>
78
m_classifiedIpv4Fragments
;
///< Map with already classified IPv4 Fragments
79
///< An entry is added when the port info is available, i.e.
80
///< first fragment, UDP/TCP protocols and enough payload data
81
///< An entry is used if port info is not available, i.e.
82
///< not first fragment or not enough payload data for TCP/UDP
83
///< An entry is removed when the last fragment is classified
84
///< Note: If last fragment is lost, entry is not removed
85
};
86
87
}
// namespace ns3
88
89
#endif
/* TFT_CLASSIFIER_H */
ns3::EpcTftClassifier
classifies IP packets according to Traffic Flow Templates (TFTs)
Definition
epc-tft-classifier.h:42
ns3::EpcTftClassifier::m_classifiedIpv4Fragments
std::map< std::tuple< uint32_t, uint32_t, uint8_t, uint16_t >, std::pair< uint32_t, uint32_t > > m_classifiedIpv4Fragments
Map with already classified IPv4 Fragments An entry is added when the port info is available,...
Definition
epc-tft-classifier.h:78
ns3::EpcTftClassifier::Classify
uint32_t Classify(Ptr< Packet > p, EpcTft::Direction direction, uint16_t protocolNumber)
classify an IP packet
Definition
epc-tft-classifier.cc:59
ns3::EpcTftClassifier::Add
void Add(Ptr< EpcTft > tft, uint32_t id)
add a TFT to the Classifier
Definition
epc-tft-classifier.cc:42
ns3::EpcTftClassifier::EpcTftClassifier
EpcTftClassifier()
Definition
epc-tft-classifier.cc:36
ns3::EpcTftClassifier::m_tftMap
std::map< uint32_t, Ptr< EpcTft > > m_tftMap
TFT map.
Definition
epc-tft-classifier.h:75
ns3::EpcTftClassifier::Delete
void Delete(uint32_t id)
delete an existing TFT from the classifier
Definition
epc-tft-classifier.cc:52
ns3::EpcTft::Direction
Direction
Indicates the direction of the traffic that is to be classified.
Definition
epc-tft.h:40
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::SimpleRefCount
A template-based reference counting class.
Definition
simple-ref-count.h:70
uint32_t
epc-tft.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
lte
model
epc-tft-classifier.h
Generated on Fri Nov 8 2024 13:59:03 for ns-3 by
1.11.0