A Discrete-Event Network Simulator
API
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 
29 namespace ns3
30 {
31 
37 class EpcTft : public SimpleRefCount<EpcTft>
38 {
39  public:
45  static Ptr<EpcTft> Default();
46 
50  enum Direction
51  {
52  DOWNLINK = 1,
53  UPLINK = 2,
54  BIDIRECTIONAL = 3
55  };
56 
70  struct PacketFilter
71  {
72  PacketFilter();
73 
86  bool Matches(Direction d,
87  Ipv4Address ra,
88  Ipv4Address la,
89  uint16_t rp,
90  uint16_t lp,
91  uint8_t tos);
92 
105  bool Matches(Direction d,
106  Ipv6Address ra,
107  Ipv6Address la,
108  uint16_t rp,
109  uint16_t lp,
110  uint8_t tos);
111 
114  uint8_t precedence;
115 
118 
123 
128 
129  uint16_t remotePortStart;
130  uint16_t remotePortEnd;
131  uint16_t localPortStart;
132  uint16_t localPortEnd;
133 
134  uint8_t typeOfService;
136  };
137 
138  EpcTft();
139 
148  uint8_t Add(PacketFilter f);
149 
162  bool Matches(Direction direction,
164  Ipv4Address localAddress,
165  uint16_t remotePort,
166  uint16_t localPort,
167  uint8_t typeOfService);
168 
181  bool Matches(Direction direction,
183  Ipv6Address localAddress,
184  uint16_t remotePort,
185  uint16_t localPort,
186  uint8_t typeOfService);
187 
192  std::list<PacketFilter> GetPacketFilters() const;
193 
194  private:
195  std::list<PacketFilter> m_filters;
196  uint8_t m_numFilters;
197 };
198 
199 std::ostream& operator<<(std::ostream& os, const EpcTft::Direction& d);
200 
201 } // namespace ns3
202 
203 #endif /* EPC_TFT_H */
double f(double x, void *params)
Definition: 80211b.c:70
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