author | Nicola Baldo <nbaldo@cttc.es> |
Wed, 19 Oct 2011 19:01:50 +0200 | |
changeset 8380 | f615b30c26e1 |
parent 8378 | 0d8107d1548b |
child 8386 | 419cbd9e357f |
permissions | -rw-r--r-- |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
2 |
/* |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
3 |
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
4 |
* |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
8 |
* |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
13 |
* |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
17 |
* |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
18 |
* Author: Jaume Nin <jnin@cttc.cat> |
8366
a3af0a5ed1e9
draft eNB and SGW/PGW applications
Nicola Baldo <nbaldo@cttc.es>
parents:
8357
diff
changeset
|
19 |
* Nicola Baldo <nbaldo@cttc.cat> |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
20 |
*/ |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
21 |
|
8366
a3af0a5ed1e9
draft eNB and SGW/PGW applications
Nicola Baldo <nbaldo@cttc.es>
parents:
8357
diff
changeset
|
22 |
#ifndef EPC_ENB_APPLICATION_H |
a3af0a5ed1e9
draft eNB and SGW/PGW applications
Nicola Baldo <nbaldo@cttc.es>
parents:
8357
diff
changeset
|
23 |
#define EPC_ENB_APPLICATION_H |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
24 |
|
8380 | 25 |
#include <ns3/address.h> |
26 |
#include <ns3/socket.h> |
|
27 |
#include <ns3/virtual-net-device.h> |
|
28 |
#include <ns3/epc-gtpu-l5-protocol.h> |
|
29 |
#include <ns3/traced-callback.h> |
|
30 |
#include <ns3/callback.h> |
|
31 |
#include <ns3/ptr.h> |
|
32 |
#include <ns3/object.h> |
|
33 |
#include <ns3/lte-common.h> |
|
34 |
#include <ns3/application.h> |
|
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
35 |
#include <map> |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
36 |
|
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
37 |
namespace ns3 { |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
38 |
|
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
39 |
/** |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
40 |
* \ingroup lte |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
41 |
* |
8380 | 42 |
* This application is installed inside eNBs and provides the bridge functionality for user data plane packets between the radio interface and the S1-U interface. |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
43 |
*/ |
8380 | 44 |
class EpcEnbApplication : public Application |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
45 |
{ |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
46 |
|
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
47 |
public: |
8380 | 48 |
|
49 |
// inherited from Object |
|
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
50 |
static TypeId GetTypeId (void); |
8378 | 51 |
|
52 |
||
53 |
/** |
|
8380 | 54 |
* Constructor |
8378 | 55 |
* |
8380 | 56 |
* \param lteSocket the socket to be used to send/receive packets to/from the LTE radio interface |
8378 | 57 |
* \param s1uSocket the socket to be used to send/receive packets |
58 |
* to/from the S1-U interface connected with the SGW |
|
59 |
* \param sgwAddress the IPv4 address at which this eNB will be able to reach its SGW |
|
60 |
* |
|
61 |
*/ |
|
8380 | 62 |
EpcEnbApplication (Ptr<Socket> lteSocket, Ptr<Socket> s1uSocket, Ipv4Address sgwAddress); |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
63 |
|
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
64 |
/** |
8380 | 65 |
* Destructor |
8378 | 66 |
* |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
67 |
*/ |
8378 | 68 |
virtual ~EpcEnbApplication (void); |
69 |
||
70 |
||
71 |
||
8380 | 72 |
/** |
73 |
* This method is triggered after the eNB received |
|
74 |
* a S1-AP message of type E-RAB Setup Request by the MME and the RadioBearer has already been created |
|
75 |
* |
|
76 |
* \param teid the Tunnel Endpoint IDentifier of the S1-bearer to be setup. |
|
77 |
* \param rnti the unique ID of the UE on this eNB |
|
78 |
* \param lcid the Logical Channel ID identifying the Radio Bearer |
|
79 |
*/ |
|
80 |
void ErabSetupRequest (uint32_t teid, uint16_t rnti, uint8_t lcid); |
|
8378 | 81 |
|
82 |
/** |
|
83 |
* Method to be assigned to the recv callback of the LTE socket. It is called when the eNB receives a data packet from the radio interface that is to be forwarded to the SGW. |
|
84 |
* |
|
85 |
* \param socket pointer to the LTE socket |
|
86 |
*/ |
|
87 |
void RecvFromLteSocket (Ptr<Socket> socket); |
|
88 |
||
89 |
||
90 |
/** |
|
91 |
* Method to be assigned to the recv callback of the S1-U socket. It is called when the eNB receives a data packet from the SGW that is to be forwarded to the UE. |
|
92 |
* |
|
93 |
* \param socket pointer to the S1-U socket |
|
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
94 |
*/ |
8378 | 95 |
void RecvFromS1uSocket (Ptr<Socket> socket); |
96 |
||
97 |
/** |
|
98 |
* Send a packet to the UE via the LTE radio interface of the eNB |
|
99 |
* |
|
100 |
* \param packet t |
|
101 |
* \param rbid the Radio Bearer IDentifier |
|
102 |
*/ |
|
8380 | 103 |
void SendToLteSocket (Ptr<Packet> packet, uint16_t rnti, uint8_t lcid); |
8378 | 104 |
|
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
105 |
|
8378 | 106 |
/** |
107 |
* Send a packet to the SGW via the S1-U interface |
|
108 |
* |
|
109 |
* \param packet packet to be sent |
|
110 |
* \param teid the Tunnel Enpoint IDentifier |
|
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
111 |
*/ |
8378 | 112 |
void SendToS1uSocket (Ptr<Packet> packet, uint32_t teid); |
113 |
||
114 |
||
115 |
private: |
|
116 |
||
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
117 |
|
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
118 |
/** |
8378 | 119 |
* raw packet socket to send and receive the packets to and from the LTE radio interface |
120 |
*/ |
|
121 |
Ptr<Socket> m_lteSocket; |
|
122 |
||
123 |
/** |
|
124 |
* UDP socket to send and receive GTP-U the packets to and from the S1-U interface |
|
125 |
*/ |
|
8380 | 126 |
Ptr<Socket> m_s1uSocket; |
8378 | 127 |
|
128 |
/** |
|
8380 | 129 |
* address of the SGW which terminates all S1-U tunnels |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
130 |
*/ |
8378 | 131 |
Ipv4Address m_sgwAddress; |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
132 |
|
8380 | 133 |
/** |
134 |
* map telling for each RadioBearer (RNTI,LCID) the corresponding S1-U TEID |
|
135 |
* |
|
136 |
*/ |
|
137 |
std::map<LteFlowId_t, uint32_t> m_rbidTeidMap; |
|
138 |
||
139 |
/** |
|
140 |
* map telling for each S1-U TEID the corresponding RadioBearer (RNTI,LCID) |
|
141 |
* |
|
142 |
*/ |
|
143 |
std::map<uint32_t, LteFlowId_t> m_teidRbidMap; |
|
144 |
||
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
145 |
}; |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
146 |
|
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
147 |
} //namespace ns3 |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
148 |
|
8366
a3af0a5ed1e9
draft eNB and SGW/PGW applications
Nicola Baldo <nbaldo@cttc.es>
parents:
8357
diff
changeset
|
149 |
#endif /* EPC_ENB_APPLICATION_H */ |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
150 |