A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
epc-tft.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_H
10#define EPC_TFT_H
11
12#include <ns3/ipv4-address.h>
13#include <ns3/ipv6-address.h>
14#include <ns3/simple-ref-count.h>
15
16#include <list>
17
18namespace ns3
19{
20
21/**
22 * This class implements the EPS bearer Traffic Flow Template (TFT),
23 * which is the set of all packet filters associated with an EPS bearer.
24 *
25 */
26class EpcTft : public SimpleRefCount<EpcTft>
27{
28 public:
29 /**
30 * creates a TFT matching any traffic
31 *
32 * @return a newly created TFT that will match any traffic
33 */
34 static Ptr<EpcTft> Default();
35
36 /**
37 * Indicates the direction of the traffic that is to be classified.
38 */
40 {
42 UPLINK = 2,
44 };
45
46 /**
47 * Implement the data structure representing a TrafficFlowTemplate
48 * Packet Filter.
49 * See 3GPP TS 24.008 version 8.7.0 Release 8, Table 10.5.162/3GPP TS
50 * 24.008: Traffic flow template information element
51 *
52 * With respect to the Packet Filter specification in the above doc,
53 * the following features are NOT supported:
54 * - IPv6 filtering (including flow labels)
55 * - IPSec filtering
56 * - filter precedence field is not evaluated, hence it is recommended to setup
57 * the TFTs within a PDP context such that TFTs are mutually exclusive
58 */
60 {
62
63 /**
64 *
65 * @param d the direction
66 * @param ra the remote address
67 * @param la the local address
68 * @param rp the remote port
69 * @param lp the local port
70 * @param tos the type of service
71 *
72 * @return true if the parameters match with the PacketFilter,
73 * false otherwise.
74 */
75 bool Matches(Direction d,
76 Ipv4Address ra,
77 Ipv4Address la,
78 uint16_t rp,
79 uint16_t lp,
80 uint8_t tos);
81
82 /**
83 *
84 * @param d the direction
85 * @param ra the remote address
86 * @param la the local address
87 * @param rp the remote port
88 * @param lp the local port
89 * @param tos the type of service
90 *
91 * @return true if the parameters match with the PacketFilter,
92 * false otherwise.
93 */
94 bool Matches(Direction d,
95 Ipv6Address ra,
96 Ipv6Address la,
97 uint16_t rp,
98 uint16_t lp,
99 uint8_t tos);
100
101 /// Used to specify the precedence for the packet filter among all packet filters in the
102 /// TFT; higher values will be evaluated last.
103 uint8_t precedence;
104
105 /// Whether the filter needs to be applied to uplink / downlink only, or in both cases
107
108 Ipv4Address remoteAddress; //!< IPv4 address of the remote host
109 Ipv4Mask remoteMask; //!< IPv4 address mask of the remote host
110 Ipv4Address localAddress; //!< IPv4 address of the UE
111 Ipv4Mask localMask; //!< IPv4 address mask of the UE
112
113 Ipv6Address remoteIpv6Address; //!< IPv6 address of the remote host
114 Ipv6Prefix remoteIpv6Prefix; //!< IPv6 address prefix of the remote host
115 Ipv6Address localIpv6Address; //!< IPv6 address of the UE
116 Ipv6Prefix localIpv6Prefix; //!< IPv6 address prefix of the UE
117
118 uint16_t remotePortStart; //!< start of the port number range of the remote host
119 uint16_t remotePortEnd; //!< end of the port number range of the remote host
120 uint16_t localPortStart; //!< start of the port number range of the UE
121 uint16_t localPortEnd; //!< end of the port number range of the UE
122
123 uint8_t typeOfService; //!< type of service field
124 uint8_t typeOfServiceMask; //!< type of service field mask
125 };
126
127 EpcTft();
128
129 /**
130 * add a PacketFilter to the Traffic Flow Template
131 *
132 * @param f the PacketFilter to be added
133 *
134 * @return the id( 0 <= id < 16) of the newly added filter, if the addition was successful. Will
135 * fail if you try to add more than 15 filters. This is to be compliant with TS 24.008.
136 */
137 uint8_t Add(PacketFilter f);
138
139 /**
140 *
141 * @param direction
142 * @param remoteAddress
143 * @param localAddress
144 * @param remotePort
145 * @param localPort
146 * @param typeOfService
147 *
148 * @return true if any PacketFilter in the TFT matches with the
149 * parameters, false otherwise.
150 */
151 bool Matches(Direction direction,
152 Ipv4Address remoteAddress,
153 Ipv4Address localAddress,
154 uint16_t remotePort,
155 uint16_t localPort,
156 uint8_t typeOfService);
157
158 /**
159 *
160 * @param direction
161 * @param remoteAddress
162 * @param localAddress
163 * @param remotePort
164 * @param localPort
165 * @param typeOfService
166 *
167 * @return true if any PacketFilter in the TFT matches with the
168 * parameters, false otherwise.
169 */
170 bool Matches(Direction direction,
171 Ipv6Address remoteAddress,
172 Ipv6Address localAddress,
173 uint16_t remotePort,
174 uint16_t localPort,
175 uint8_t typeOfService);
176
177 /**
178 * Get the packet filters
179 * @return a container of packet filters
180 */
181 std::list<PacketFilter> GetPacketFilters() const;
182
183 private:
184 std::list<PacketFilter> m_filters; ///< packet filter list
185 uint8_t m_numFilters; ///< number of packet filters applied to this TFT
186};
187
188std::ostream& operator<<(std::ostream& os, const EpcTft::Direction& d);
189
190} // namespace ns3
191
192#endif /* EPC_TFT_H */
This class implements the EPS bearer Traffic Flow Template (TFT), which is the set of all packet filt...
Definition epc-tft.h:27
uint8_t Add(PacketFilter f)
add a PacketFilter to the Traffic Flow Template
Definition epc-tft.cc:233
bool Matches(Direction direction, Ipv4Address remoteAddress, Ipv4Address localAddress, uint16_t remotePort, uint16_t localPort, uint8_t typeOfService)
Definition epc-tft.cc:248
static Ptr< EpcTft > Default()
creates a TFT matching any traffic
Definition epc-tft.cc:218
std::list< PacketFilter > GetPacketFilters() const
Get the packet filters.
Definition epc-tft.cc:298
Direction
Indicates the direction of the traffic that is to be classified.
Definition epc-tft.h:40
@ BIDIRECTIONAL
Definition epc-tft.h:43
std::list< PacketFilter > m_filters
packet filter list
Definition epc-tft.h:184
uint8_t m_numFilters
number of packet filters applied to this TFT
Definition epc-tft.h:185
Ipv4 addresses are stored in host order in this class.
a class to represent an Ipv4 address mask
Describes an IPv6 address.
Describes an IPv6 prefix.
Smart pointer class similar to boost::intrusive_ptr.
A template-based reference counting class.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition epc-tft.h:60
Ipv4Address localAddress
IPv4 address of the UE.
Definition epc-tft.h:110
Ipv6Prefix localIpv6Prefix
IPv6 address prefix of the UE.
Definition epc-tft.h:116
uint16_t localPortEnd
end of the port number range of the UE
Definition epc-tft.h:121
bool Matches(Direction d, Ipv4Address ra, Ipv4Address la, uint16_t rp, uint16_t lp, uint8_t tos)
Definition epc-tft.cc:82
Ipv4Mask localMask
IPv4 address mask of the UE.
Definition epc-tft.h:111
uint16_t remotePortEnd
end of the port number range of the remote host
Definition epc-tft.h:119
Ipv6Address remoteIpv6Address
IPv6 address of the remote host.
Definition epc-tft.h:113
uint8_t precedence
Used to specify the precedence for the packet filter among all packet filters in the TFT; higher valu...
Definition epc-tft.h:103
Direction direction
Whether the filter needs to be applied to uplink / downlink only, or in both cases.
Definition epc-tft.h:106
Ipv4Mask remoteMask
IPv4 address mask of the remote host.
Definition epc-tft.h:109
uint16_t remotePortStart
start of the port number range of the remote host
Definition epc-tft.h:118
Ipv6Address localIpv6Address
IPv6 address of the UE.
Definition epc-tft.h:115
uint8_t typeOfService
type of service field
Definition epc-tft.h:123
Ipv4Address remoteAddress
IPv4 address of the remote host.
Definition epc-tft.h:108
uint8_t typeOfServiceMask
type of service field mask
Definition epc-tft.h:124
Ipv6Prefix remoteIpv6Prefix
IPv6 address prefix of the remote host.
Definition epc-tft.h:114
uint16_t localPortStart
start of the port number range of the UE
Definition epc-tft.h:120