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