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
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Nicola Baldo <nbaldo@cttc.es>
18
*/
19
20
#ifndef EPC_TFT_CLASSIFIER_H
21
#define EPC_TFT_CLASSIFIER_H
22
23
#include "
epc-tft.h
"
24
25
#include "ns3/ptr.h"
26
#include "ns3/simple-ref-count.h"
27
28
#include <map>
29
30
namespace
ns3
31
{
32
33
class
EpcTft;
34
class
Packet;
35
36
/**
37
* \brief classifies IP packets according to Traffic Flow Templates (TFTs)
38
*
39
* \note this implementation works with IPv4 and IPv6.
40
* When there is fragmentation of IP packets, UDP/TCP ports maybe missing.
41
*
42
* The following actions are performed to use the port info present in the first segment with
43
* the next fragments:
44
* - Port info is stored if it is available, i.e. it is the first fragment with UDP/TCP protocol
45
* and there is enough data in the payload of the IP packet for the port numbers.
46
* - Port info is used for the next fragments.
47
* - Port info is deleted, when the last fragment is processed.
48
*
49
* When we cannot cache the port info, the TFT of the default bearer is used. This may happen
50
* if there is reordering or losses of IP packets.
51
*/
52
class
EpcTftClassifier
:
public
SimpleRefCount
<EpcTftClassifier>
53
{
54
public
:
55
EpcTftClassifier
();
56
57
/**
58
* add a TFT to the Classifier
59
*
60
* \param tft the TFT to be added
61
* \param id the ID of the bearer which will be classified by specified TFT classifier
62
*
63
*/
64
void
Add
(
Ptr<EpcTft>
tft,
uint32_t
id
);
65
66
/**
67
* delete an existing TFT from the classifier
68
*
69
* \param id the identifier of the TFT to be deleted
70
*/
71
void
Delete
(
uint32_t
id
);
72
73
/**
74
* classify an IP packet
75
*
76
* \param p the IP packet. The outmost header can only be an IPv4 or an IPv6 header.
77
* \param direction the EPC TFT direction (can be downlink, uplink or bi-directional)
78
* \param protocolNumber the protocol of the packet. Only IPv4 and IPv6 are supported.
79
*
80
* \return the identifier (>0) of the first TFT that matches with the IP packet; 0 if no TFT
81
* matched.
82
*/
83
uint32_t
Classify
(
Ptr<Packet>
p,
EpcTft::Direction
direction, uint16_t protocolNumber);
84
85
protected
:
86
std::map<uint32_t, Ptr<EpcTft>>
m_tftMap
;
///< TFT map
87
88
std::map<std::tuple<uint32_t, uint32_t, uint8_t, uint16_t>, std::pair<uint32_t, uint32_t>>
89
m_classifiedIpv4Fragments
;
///< Map with already classified IPv4 Fragments
90
///< An entry is added when the port info is available, i.e.
91
///< first fragment, UDP/TCP protocols and enough payload data
92
///< An entry is used if port info is not available, i.e.
93
///< not first fragment or not enough payload data for TCP/UDP
94
///< An entry is removed when the last fragment is classified
95
///< Note: If last fragment is lost, entry is not removed
96
};
97
98
}
// namespace ns3
99
100
#endif
/* TFT_CLASSIFIER_H */
ns3::EpcTftClassifier
classifies IP packets according to Traffic Flow Templates (TFTs)
Definition:
epc-tft-classifier.h:53
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:89
ns3::EpcTftClassifier::Classify
uint32_t Classify(Ptr< Packet > p, EpcTft::Direction direction, uint16_t protocolNumber)
classify an IP packet
Definition:
epc-tft-classifier.cc:70
ns3::EpcTftClassifier::Add
void Add(Ptr< EpcTft > tft, uint32_t id)
add a TFT to the Classifier
Definition:
epc-tft-classifier.cc:53
ns3::EpcTftClassifier::EpcTftClassifier
EpcTftClassifier()
Definition:
epc-tft-classifier.cc:47
ns3::EpcTftClassifier::m_tftMap
std::map< uint32_t, Ptr< EpcTft > > m_tftMap
TFT map.
Definition:
epc-tft-classifier.h:86
ns3::EpcTftClassifier::Delete
void Delete(uint32_t id)
delete an existing TFT from the classifier
Definition:
epc-tft-classifier.cc:63
ns3::EpcTft::Direction
Direction
Indicates the direction of the traffic that is to be classified.
Definition:
epc-tft.h:51
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::SimpleRefCount
A template-based reference counting class.
Definition:
simple-ref-count.h:81
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 Tue May 28 2024 23:37:09 for ns-3 by
1.9.6