A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
epc-sgw-pgw-application.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: Jaume Nin <jnin@cttc.cat>
19  * Nicola Baldo <nbaldo@cttc.cat>
20  */
21 
22 #ifndef EPC_SGW_PGW_APPLICATION_H
23 #define EPC_SGW_PGW_APPLICATION_H
24 
25 #include <ns3/address.h>
26 #include <ns3/socket.h>
27 #include <ns3/virtual-net-device.h>
28 #include <ns3/traced-callback.h>
29 #include <ns3/callback.h>
30 #include <ns3/ptr.h>
31 #include <ns3/object.h>
32 #include <ns3/eps-bearer.h>
33 #include <ns3/epc-tft.h>
34 #include <ns3/epc-tft-classifier.h>
35 #include <ns3/lte-common.h>
36 #include <ns3/application.h>
37 #include <map>
38 
39 namespace ns3 {
40 
47 {
48 
49 public:
50 
51  // inherited from Object
52  static TypeId GetTypeId (void);
53  virtual void DoDispose ();
54 
63  EpcSgwPgwApplication (const Ptr<VirtualNetDevice> tunDevice, const Ptr<Socket> s1uSocket);
64 
68  virtual ~EpcSgwPgwApplication (void);
69 
70 
83  uint32_t ActivateS1Bearer (Ipv4Address ueAddr, Ipv4Address enbAddr, Ptr<EpcTft> tft);
84 
85 
98  bool RecvFromTunDevice (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
99 
100 
108  void RecvFromS1uSocket (Ptr<Socket> socket);
109 
115  void SendToTunDevice (Ptr<Packet> packet, uint32_t teid);
116 
117 
125  void SendToS1uSocket (Ptr<Packet> packet, Ipv4Address enbS1uAddress, uint32_t teid);
126 
127 
128 
129 private:
130 
131 
135  class UeInfo
136  {
137  public:
138  UeInfo ();
139 
145  void AddBearer (Ptr<EpcTft> tft, uint32_t teid);
146 
156  uint32_t Classify (Ptr<Packet> p);
157 
162 
168  void SetEnbAddr (Ipv4Address addr);
169 
170 
171  private:
174  };
175 
176 
181 
187 
191  std::map<Ipv4Address, UeInfo> m_ueInfoMap;
192 
196  uint16_t m_gtpuUdpPort;
197 
198  uint32_t m_teidCount;
199 
200 };
201 
202 } //namespace ns3
203 
204 #endif /* EPC_SGW_PGW_APPLICATION_H */
205