A Discrete-Event Network Simulator
API
epc-tft.h
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Nicola Baldo <nbaldo@cttc.es>
19  */
20 
21 
22 #ifndef EPC_TFT_H
23 #define EPC_TFT_H
24 
25 
26 #include <ns3/simple-ref-count.h>
27 #include <ns3/ipv4-address.h>
28 #include <ns3/ipv6-address.h>
29 
30 #include <list>
31 
32 namespace ns3 {
33 
34 
35 
41 class EpcTft : public SimpleRefCount<EpcTft>
42 {
43 
44 public:
45 
46 
52  static Ptr<EpcTft> Default ();
53 
57  enum Direction {DOWNLINK = 1,
58  UPLINK = 2,
60 
74  struct PacketFilter
75  {
76  PacketFilter ();
77 
90  bool Matches (Direction d,
91  Ipv4Address ra,
92  Ipv4Address la,
93  uint16_t rp,
94  uint16_t lp,
95  uint8_t tos);
96 
109  bool Matches (Direction d,
110  Ipv6Address ra,
111  Ipv6Address la,
112  uint16_t rp,
113  uint16_t lp,
114  uint8_t tos);
115 
116 
117 
118  uint8_t precedence;
137  uint16_t remotePortStart;
138  uint16_t remotePortEnd;
139  uint16_t localPortStart;
140  uint16_t localPortEnd;
142  uint8_t typeOfService;
144  };
145 
146  EpcTft ();
147 
148 
156  uint8_t Add (PacketFilter f);
157 
158 
171  bool Matches (Direction direction,
172  Ipv4Address remoteAddress,
173  Ipv4Address localAddress,
174  uint16_t remotePort,
175  uint16_t localPort,
176  uint8_t typeOfService);
177 
190  bool Matches (Direction direction,
191  Ipv6Address remoteAddress,
192  Ipv6Address localAddress,
193  uint16_t remotePort,
194  uint16_t localPort,
195  uint8_t typeOfService);
196 
201  std::list<PacketFilter> GetPacketFilters () const;
202 
203 private:
204 
205  std::list<PacketFilter> m_filters;
206  uint8_t m_numFilters;
207 
208 };
209 
210 
211 std::ostream& operator<< (std::ostream& os, EpcTft::Direction& d);
212 
213 
214 } // namespace ns3
215 
216 #endif /* EPC_TFT_H */
217 
218 
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:42
uint8_t Add(PacketFilter f)
add a PacketFilter to the Traffic Flow Template
Definition: epc-tft.cc:240
bool Matches(Direction direction, Ipv4Address remoteAddress, Ipv4Address localAddress, uint16_t remotePort, uint16_t localPort, uint8_t typeOfService)
Definition: epc-tft.cc:257
static Ptr< EpcTft > Default()
creates a TFT matching any traffic
Definition: epc-tft.cc:224
std::list< PacketFilter > GetPacketFilters() const
Get the packet filters.
Definition: epc-tft.cc:299
Direction
Indicates the direction of the traffic that is to be classified.
Definition: epc-tft.h:57
@ DOWNLINK
Definition: epc-tft.h:57
@ BIDIRECTIONAL
Definition: epc-tft.h:59
std::list< PacketFilter > m_filters
packet filter list
Definition: epc-tft.h:205
uint8_t m_numFilters
number of packet filters applied to this TFT
Definition: epc-tft.h:206
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:256
Describes an IPv6 address.
Definition: ipv6-address.h:50
Describes an IPv6 prefix.
Definition: ipv6-address.h:456
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
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:139
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition: epc-tft.h:75
Ipv4Address localAddress
IPv4 address of the UE.
Definition: epc-tft.h:129
Ipv6Prefix localIpv6Prefix
IPv6 address prefix of the UE.
Definition: epc-tft.h:135
uint16_t localPortEnd
end of the port number range of the UE
Definition: epc-tft.h:140
bool Matches(Direction d, Ipv4Address ra, Ipv4Address la, uint16_t rp, uint16_t lp, uint8_t tos)
Definition: epc-tft.cc:101
Ipv4Mask localMask
IPv4 address mask of the UE.
Definition: epc-tft.h:130
uint16_t remotePortEnd
end of the port number range of the remote host
Definition: epc-tft.h:138
Ipv6Address remoteIpv6Address
IPv6 address of the remote host
Definition: epc-tft.h:132
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:118
Direction direction
whether the filter needs to be applied to uplink / downlink only, or in both cases
Definition: epc-tft.h:124
Ipv4Mask remoteMask
IPv4 address mask of the remote host.
Definition: epc-tft.h:128
uint16_t remotePortStart
start of the port number range of the remote host
Definition: epc-tft.h:137
Ipv6Address localIpv6Address
IPv6 address of the UE.
Definition: epc-tft.h:134
uint8_t typeOfService
type of service field
Definition: epc-tft.h:142
Ipv4Address remoteAddress
IPv4 address of the remote host
Definition: epc-tft.h:127
uint8_t typeOfServiceMask
type of service field mask
Definition: epc-tft.h:143
Ipv6Prefix remoteIpv6Prefix
IPv6 address prefix of the remote host
Definition: epc-tft.h:133
uint16_t localPortStart
start of the port number range of the UE
Definition: epc-tft.h:139