Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-SMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-SMF
Commits
94d75f4a
Commit
94d75f4a
authored
Apr 20, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unecessary files
parent
8f42b093
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
0 additions
and
1305 deletions
+0
-1305
src/gtpv1u/3gpp_29.281.hpp
src/gtpv1u/3gpp_29.281.hpp
+0
-671
src/gtpv1u/CMakeLists.txt
src/gtpv1u/CMakeLists.txt
+0
-32
src/gtpv1u/gtpu.h
src/gtpv1u/gtpu.h
+0
-72
src/gtpv1u/gtpv1u.cpp
src/gtpv1u/gtpv1u.cpp
+0
-211
src/gtpv1u/gtpv1u.hpp
src/gtpv1u/gtpv1u.hpp
+0
-87
src/gtpv1u/msg_gtpv1u.hpp
src/gtpv1u/msg_gtpv1u.hpp
+0
-232
No files found.
src/gtpv1u/3gpp_29.281.hpp
deleted
100644 → 0
View file @
8f42b093
This diff is collapsed.
Click to expand it.
src/gtpv1u/CMakeLists.txt
deleted
100644 → 0
View file @
8f42b093
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
add_library
(
GTPV1U STATIC
3gpp_29.281.cpp
gtpv1u.cpp
)
include_directories
(
${
SRC_TOP_DIR
}
/common
)
include_directories
(
${
SRC_TOP_DIR
}
/common/msg
)
include_directories
(
${
SRC_TOP_DIR
}
/common/utils
)
include_directories
(
${
SRC_TOP_DIR
}
/itti
)
include_directories
(
${
SRC_TOP_DIR
}
/gtpv1u
)
include_directories
(
${
SRC_TOP_DIR
}
/udp
)
include_directories
(
${
SRC_TOP_DIR
}
/../build/ext/spdlog/include
)
src/gtpv1u/gtpu.h
deleted
100644 → 0
View file @
8f42b093
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file gtpu.h
* \brief
* \author Lionel Gauthier
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_GTPU_SEEN
#define FILE_GTPU_SEEN
#include <endian.h>
#include <stdint.h>
struct
gtpuhdr
{
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned
int
pn
:
1
;
unsigned
int
s
:
1
;
unsigned
int
e
:
1
;
unsigned
int
spare
:
1
;
unsigned
int
pt
:
1
;
unsigned
int
version
:
3
;
#elif __BYTE_ORDER == __BIG_ENDIAN
unsigned
int
version
:
3
;
unsigned
int
pt
:
1
;
unsigned
int
spare
:
1
;
unsigned
int
e
:
1
;
unsigned
int
s
:
1
;
unsigned
int
pn
:
1
;
#else
# error "Please fix <bits/endian.h>"
#endif
// Message Type: This field indicates the type of GTP-U message.
uint8_t
message_type
;
// Length: This field indicates the length in octets of the payload, i.e. the rest of the packet following the mandatory
// part of the GTP header (that is the first 8 octets). The Sequence Number, the N-PDU Number or any Extension
// headers shall be considered to be part of the payload, i.e. included in the length count.
uint16_t
message_length
;
// Tunnel Endpoint Identifier (TEID): This field unambiguously identifies a tunnel endpoint in the receiving
// GTP-U protocol entity. The receiving end side of a GTP tunnel locally assigns the TEID value the transmitting
// side has to use. The TEID value shall be assigned in a non-predictable manner for PGW S5/S8/S2a/S2b
// interfaces (see 3GPP TS 33.250 [32]). The TEID shall be used by the receiving entity to find the PDP context,
// except for the following cases:
// -) The Echo Request/Response and Supported Extension Headers notification messages, where the Tunnel
// Endpoint Identifier shall be set to all zeroes
// -) The Error Indication message where the Tunnel Endpoint Identifier shall be set to all zeros.
uint32_t
teid
;
/*The options start here. */
};
#endif
src/gtpv1u/gtpv1u.cpp
deleted
100644 → 0
View file @
8f42b093
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file gtpv1u.cpp
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#include "common_root_types.h"
#include "conversions.hpp"
#include "gtpu.h"
#include "gtpv1u.hpp"
#include <cstdlib>
#include <sched.h>
using
namespace
gtpv1u
;
using
namespace
std
;
extern
itti_mw
*
itti_inst
;
////------------------------------------------------------------------------------
//void udp_server::handle_receive(const int& error, std::size_t bytes_transferred)
//{
// if (!error) {
// Logger::udp().trace( "udp_server::handle_receive on %s:%d from %s:%d",
// socket_.local_endpoint().address().to_string().c_str(), socket_.local_endpoint().port(),
// remote_endpoint_.address().to_string().c_str(), remote_endpoint_.port());
// if (app_) {
// app_->handle_receive(recv_buffer_.data(), bytes_transferred, remote_endpoint_);
// } else {
// Logger::udp().error( "No upper layer configured for handling UDP packet");
// }
// start_receive(app_);
// } else {
// Logger::udp().error( "udp_server::handle_receive err=%s/%d: %s", error.category().name(), error.value(), error.message());
// }
//}
//------------------------------------------------------------------------------
gtpu_l4_stack
::
gtpu_l4_stack
(
const
struct
in_addr
&
address
,
const
uint16_t
port_num
,
const
util
::
thread_sched_params
&
sched_params
)
:
udp_s
(
udp_server
(
address
,
port_num
))
{
Logger
::
gtpv1_u
().
info
(
"gtpu_l4_stack created listening to %s:%d"
,
conv
::
toString
(
address
).
c_str
(),
port_num
);
id
=
0
;
srand
(
time
(
NULL
));
seq_num
=
rand
()
&
0x7FFFFFFF
;
restart_counter
=
0
;
udp_s
.
start_receive
(
this
,
sched_params
);
}
//------------------------------------------------------------------------------
gtpu_l4_stack
::
gtpu_l4_stack
(
const
struct
in6_addr
&
address
,
const
uint16_t
port_num
,
const
util
::
thread_sched_params
&
sched_params
)
:
udp_s
(
udp_server
(
address
,
port_num
))
{
Logger
::
gtpv1_u
().
info
(
"gtpu_l4_stack created listening to %s:%d"
,
conv
::
toString
(
address
).
c_str
(),
port_num
);
id
=
0
;
srand
(
time
(
NULL
));
seq_num
=
rand
()
&
0x7FFFFFFF
;
restart_counter
=
0
;
udp_s
.
start_receive
(
this
,
sched_params
);
}
//------------------------------------------------------------------------------
gtpu_l4_stack
::
gtpu_l4_stack
(
char
*
address
,
const
uint16_t
port_num
,
const
util
::
thread_sched_params
&
sched_params
)
:
udp_s
(
udp_server
(
address
,
port_num
))
{
Logger
::
gtpv1_u
().
info
(
"gtpu_l4_stack created listening to %s:%d"
,
address
,
port_num
);
id
=
0
;
srand
(
time
(
NULL
));
seq_num
=
rand
()
&
0x7FFFFFFF
;
restart_counter
=
0
;
udp_s
.
start_receive
(
this
,
sched_params
);
}
//------------------------------------------------------------------------------
uint32_t
gtpu_l4_stack
::
get_next_seq_num
()
{
seq_num
++
;
if
(
seq_num
&
0x80000000
)
{
seq_num
=
0
;
}
return
seq_num
;
}
//------------------------------------------------------------------------------
void
gtpu_l4_stack
::
handle_receive
(
char
*
recv_buffer
,
const
std
::
size_t
bytes_transferred
,
const
endpoint
&
r_endpoint
)
{
Logger
::
gtpv1_u
().
error
(
"TODO implement in derived class"
);
}
//------------------------------------------------------------------------------
bool
gtpu_l4_stack
::
check_initial_message_type
(
const
uint8_t
initial
)
{
switch
(
initial
)
{
case
GTPU_ECHO_REQUEST
:
case
GTPU_END_MARKER
:
return
true
;
break
;
default:
return
false
;
}
}
//------------------------------------------------------------------------------
bool
gtpu_l4_stack
::
check_triggered_message_type
(
const
uint8_t
initial
,
const
uint8_t
triggered
)
{
Logger
::
gtpv1_u
().
info
(
"check_triggered_message_type GTPV1-U msg type %d/%d"
,
(
int
)
initial
,
(
int
)
triggered
);
switch
(
initial
)
{
case
GTPU_ECHO_REQUEST
:
if
(
triggered
==
GTPU_ECHO_RESPONSE
)
return
true
;
return
false
;
break
;
case
GTPU_ERROR_INDICATION
:
case
GTPU_SUPPORTED_EXTENSION_HEADERS_NOTIFICATION
:
return
true
;
break
;
default:
return
false
;
}
}
//------------------------------------------------------------------------------
void
gtpu_l4_stack
::
handle_receive_message_cb
(
const
gtpv1u_msg
&
msg
,
const
struct
sockaddr_storage
&
r_endpoint
,
const
socklen_t
&
r_endpoint_addr_len
,
const
task_id_t
&
task_id
,
bool
&
error
,
uint64_t
&
gtpc_tx_id
)
{
}
//------------------------------------------------------------------------------
void
gtpu_l4_stack
::
send_g_pdu
(
const
struct
sockaddr_in
&
peer_addr
,
const
teid_t
teid
,
const
char
*
payload
,
const
ssize_t
payload_len
)
{
struct
gtpuhdr
*
gtpuhdr
=
reinterpret_cast
<
struct
gtpuhdr
*>
(
reinterpret_cast
<
uintptr_t
>
(
payload
)
-
(
uintptr_t
)
sizeof
(
struct
gtpuhdr
));
gtpuhdr
->
spare
=
0
;
gtpuhdr
->
e
=
0
;
gtpuhdr
->
s
=
0
;
gtpuhdr
->
pn
=
0
;
gtpuhdr
->
pt
=
1
;
gtpuhdr
->
version
=
1
;
gtpuhdr
->
message_type
=
GTPU_G_PDU
;
gtpuhdr
->
message_length
=
htobe16
(
payload_len
);
gtpuhdr
->
teid
=
htobe32
(
teid
);
udp_s
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
gtpuhdr
),
payload_len
+
sizeof
(
struct
gtpuhdr
),
peer_addr
);
}
//------------------------------------------------------------------------------
void
gtpu_l4_stack
::
send_g_pdu
(
const
struct
sockaddr_in6
&
peer_addr
,
const
teid_t
teid
,
const
char
*
payload
,
const
ssize_t
payload_len
)
{
struct
gtpuhdr
*
gtpuhdr
=
reinterpret_cast
<
struct
gtpuhdr
*>
(
reinterpret_cast
<
uintptr_t
>
(
payload
)
-
(
uintptr_t
)
sizeof
(
struct
gtpuhdr
));
gtpuhdr
->
spare
=
0
;
gtpuhdr
->
e
=
0
;
gtpuhdr
->
s
=
0
;
gtpuhdr
->
pn
=
0
;
gtpuhdr
->
pt
=
1
;
gtpuhdr
->
version
=
1
;
gtpuhdr
->
message_type
=
GTPU_G_PDU
;
gtpuhdr
->
message_length
=
htobe16
(
payload_len
);
gtpuhdr
->
teid
=
htobe32
(
teid
);
udp_s
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
gtpuhdr
),
payload_len
+
sizeof
(
struct
gtpuhdr
),
peer_addr
);
}
//------------------------------------------------------------------------------
void
gtpu_l4_stack
::
send_response
(
const
gtpv1u_echo_response
&
gtp_ies
)
{
std
::
ostringstream
oss
(
std
::
ostringstream
::
binary
);
gtpv1u_msg
msg
(
gtp_ies
);
uint32_t
teid
=
UNASSIGNED_TEID
;
if
(
gtp_ies
.
get_teid
(
teid
))
{
msg
.
set_teid
(
teid
);
}
uint16_t
sn
=
0
;
if
(
gtp_ies
.
get_sequence_number
(
sn
))
{
msg
.
set_sequence_number
(
sn
);
}
msg
.
dump_to
(
oss
);
std
::
string
bstream
=
oss
.
str
();
udp_s
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
gtp_ies
.
r_endpoint
);
}
//------------------------------------------------------------------------------
void
gtpu_l4_stack
::
send_indication
(
const
gtpv1u_error_indication
&
gtp_ies
)
{
std
::
ostringstream
oss
(
std
::
ostringstream
::
binary
);
gtpv1u_msg
msg
(
gtp_ies
);
uint32_t
teid
=
UNASSIGNED_TEID
;
if
(
gtp_ies
.
get_teid
(
teid
))
{
msg
.
set_teid
(
teid
);
}
uint16_t
sn
=
0
;
if
(
gtp_ies
.
get_sequence_number
(
sn
))
{
msg
.
set_sequence_number
(
sn
);
}
msg
.
dump_to
(
oss
);
std
::
string
bstream
=
oss
.
str
();
udp_s
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
gtp_ies
.
r_endpoint
);
}
src/gtpv1u/gtpv1u.hpp
deleted
100644 → 0
View file @
8f42b093
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file gtpv1u.hpp
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_GTPV1U_HPP_SEEN
#define FILE_GTPV1U_HPP_SEEN
#include "3gpp_29.281.hpp"
#include "itti.hpp"
#include "msg_gtpv1u.hpp"
#include "thread_sched.hpp"
#include "udp.hpp"
#include <iostream>
#include <map>
#include <memory>
#include <stdint.h>
#include <string>
#include <system_error>
#include <thread>
#include <utility>
#include <vector>
namespace
gtpv1u
{
static
const
uint16_t
default_port
=
2152
;
class
gtpu_l4_stack
:
public
udp_application
{
#define GTPV1U_T3_RESPONSE_MS 1000
#define GTPV1U_N3_REQUESTS 5
#define GTPV1U_PROC_TIME_OUT_MS ((GTPV1U_T3_RESPONSE_MS) * (GTPV1U_N3_REQUESTS + 1))
protected:
uint32_t
id
;
udp_server
udp_s
;
// seems no need for std::atomic_uint32_t
uint32_t
seq_num
;
uint32_t
restart_counter
;
static
bool
check_initial_message_type
(
const
uint8_t
initial
);
static
bool
check_triggered_message_type
(
const
uint8_t
initial
,
const
uint8_t
triggered
);
uint32_t
get_next_seq_num
();
public:
static
const
uint8_t
version
=
1
;
gtpu_l4_stack
(
const
struct
in_addr
&
address
,
const
uint16_t
port_num
,
const
util
::
thread_sched_params
&
sched_params
);
gtpu_l4_stack
(
const
struct
in6_addr
&
address
,
const
uint16_t
port_num
,
const
util
::
thread_sched_params
&
sched_params
);
gtpu_l4_stack
(
char
*
ip_address
,
const
uint16_t
port_num
,
const
util
::
thread_sched_params
&
sched_params
);
virtual
void
handle_receive
(
char
*
recv_buffer
,
const
std
::
size_t
bytes_transferred
,
const
endpoint
&
r_endpoint
);
void
handle_receive_message_cb
(
const
gtpv1u_msg
&
msg
,
const
struct
sockaddr_storage
&
r_endpoint
,
const
socklen_t
&
r_endpoint_addr_len
,
const
task_id_t
&
task_id
,
bool
&
error
,
uint64_t
&
gtpc_tx_id
);
void
send_g_pdu
(
const
struct
sockaddr_in
&
peer_addr
,
const
teid_t
teid
,
const
char
*
payload
,
const
ssize_t
payload_len
);
void
send_g_pdu
(
const
struct
sockaddr_in6
&
peer_addr
,
const
teid_t
teid
,
const
char
*
payload
,
const
ssize_t
payload_len
);
void
send_response
(
const
gtpv1u_echo_response
&
gtp_ies
);
void
send_indication
(
const
gtpv1u_error_indication
&
gtp_ies
);
};
}
// namespace gtpv1u
#endif
/* FILE_GTPV1U_HPP_SEEN */
src/gtpv1u/msg_gtpv1u.hpp
deleted
100644 → 0
View file @
8f42b093
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment