gtp-u old code delete

This commit is contained in:
Laurent THOMAS
2022-01-26 11:27:02 +01:00
parent 4d1bda01c6
commit 3e7c22e7c6
86 changed files with 214 additions and 10339 deletions
+13 -42
View File
@@ -1019,7 +1019,6 @@ add_boolean_option(TRACE_RLC_UM_TX_STATUS False "TRACE for RLC UM, TO BE CHANGE
##########################
#add_boolean_option(LINK_ENB_PDCP_TO_IP_DRIVER False "For eNB, PDCP communicate with a IP driver")
#add_boolean_option(LINK_ENB_PDCP_TO_GTPV1U True "For eNB, PDCP communicate with GTP-U protocol (eNB<->S-GW)")
add_definitions(-DNEW_GTPU=1)
##########################
# RRC LAYER OPTIONS
@@ -1097,8 +1096,7 @@ include_directories("${OPENAIR3_DIR}/S1AP")
include_directories("${OPENAIR2_DIR}/X2AP")
include_directories("${OPENAIR2_DIR}/M2AP")
include_directories("${OPENAIR2_DIR}/F1AP")
include_directories("${OPENAIR3_DIR}/UDP")
include_directories("${OPENAIR3_DIR}/GTPV1-U")
include_directories("${OPENAIR3_DIR}/ocp-gtpu")
include_directories("${OPENAIR3_DIR}/M3AP")
include_directories("${OPENAIR3_DIR}/MME_APP")
include_directories("${OPENAIR_DIR}/targets/COMMON")
@@ -1124,8 +1122,6 @@ include_directories("${OPENAIR2_DIR}/UTIL/CLI")
include_directories("${OPENAIR2_DIR}/UTIL/OPT")
include_directories("${OPENAIR2_DIR}/UTIL/OMV")
include_directories("${OPENAIR2_DIR}/RRC/LTE/MESSAGES")
include_directories("${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/shared")
include_directories("${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/include")
include_directories("${OPENAIR_DIR}")
# Utilities Library
@@ -2158,7 +2154,6 @@ add_library(L2_NR
${MAC_NR_SRC}
${GNB_APP_SRC}
)
target_compile_definitions(L2_NR PUBLIC NEW_GTPU)
add_library(L2_LTE_NR
${L2_RRC_SRC}
@@ -2166,7 +2161,6 @@ add_library(L2_LTE_NR
${ENB_APP_SRC}
${MCE_APP_SRC}
)
target_compile_definitions(L2_LTE_NR PUBLIC NEW_GTPU)
add_dependencies(L2_NR rrc_flag nr_rrc_flag s1ap_flag x2_flag)
@@ -2207,32 +2201,14 @@ add_library(CN_UTILS
${OPENAIR3_DIR}/UTILS/mcc_mnc_itu.c
)
set(GTPV1U_DIR ${OPENAIR3_DIR}/GTPV1-U)
add_library (GTPV1U_OCP
add_library (GTPV1U
${NR_RRC_DIR}/rrc_gNB_GTPV1U.c
${RRC_DIR}/rrc_eNB_GTPV1U.c
${OPENAIR3_DIR}/ocp-gtpu/gtp_itf.cpp
)
target_compile_definitions(GTPV1U_OCP PUBLIC NEW_GTPU)
add_dependencies(GTPV1U_OCP rrc_flag)
add_dependencies(GTPV1U rrc_flag)
include_directories(${OPENAIR3_DIR}/ocp-gtp)
#NR case
set (NR_GTPV1U_SRC
${NR_RRC_DIR}/rrc_gNB_GTPV1U.c
${RRC_DIR}/rrc_eNB_GTPV1U.c
${GTPV1U_DIR}/gtpv1u_eNB.c
${GTPV1U_DIR}/gtpv1u_gNB.c
${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c
${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTrxn.c
${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uMsg.c
${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1u.c
${GTPV1U_DIR}/gtpv1u_teid_pool.c
)
add_library(NR_GTPV1U ${NR_GTPV1U_SRC})
add_dependencies(NR_GTPV1U rrc_flag)
set (MME_APP_SRC
${OPENAIR3_DIR}/MME_APP/mme_app.c
${OPENAIR3_DIR}/MME_APP/mme_config.c
@@ -2248,9 +2224,6 @@ set(SCTP_SRC
add_library(SCTP_CLIENT ${SCTP_SRC})
add_dependencies(SCTP_CLIENT rrc_flag)
add_library(UDP ${OPENAIR3_DIR}/UDP/udp_eNB_task.c)
add_dependencies(UDP rrc_flag)
set(NAS_SRC ${OPENAIR3_DIR}/NAS/)
set(libnas_api_OBJS
${NAS_SRC}COMMON/API/NETWORK/as_message.c
@@ -2805,7 +2778,7 @@ add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag oai_iqplayer)
target_link_libraries (lte-softmodem
-Wl,--start-group
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U_OCP F1AP_LIB F1AP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U F1AP_LIB F1AP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_LIB SCHED_RU_LIB
PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB LFDS7
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB}
-Wl,--end-group z dl)
@@ -2849,7 +2822,7 @@ add_dependencies(ocp-enb rrc_flag s1ap_flag x2_flag oai_iqplayer coding params_l
target_link_libraries (ocp-enb
-Wl,--start-group
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U_OCP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_LIB SCHED_RU_LIB
PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB MISC_NFAPI_LTE_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 SIMU_COMMON
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB}
-Wl,--end-group z dl)
@@ -2943,7 +2916,7 @@ endif()
target_link_libraries (lte-uesoftmodem
-Wl,--start-group
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB
SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON
SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON
PHY_UE PHY_RU LFDS L2_UE L2_LTE LFDS7 SIMU_COMMON SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES}
-Wl,--end-group z dl)
@@ -2985,10 +2958,9 @@ add_executable(nr-softmodem
${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api_to_fix.c
)
target_compile_definitions(nr-softmodem PUBLIC NEW_GTPU)
target_link_libraries (nr-softmodem
-Wl,--start-group
UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS GTPV1U_OCP SECU_CN SECU_OSA
UTIL HASHTABLE SCTP_CLIENT SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS GTPV1U SECU_CN SECU_OSA
ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB
NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB}
@@ -3028,7 +3000,7 @@ add_executable(ocp-gnb
target_link_libraries (ocp-gnb
-Wl,--start-group
UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS GTPV1U_OCP SECU_CN SECU_OSA
UTIL HASHTABLE SCTP_CLIENT SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS GTPV1U SECU_CN SECU_OSA
ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB
NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB SIMU_COMMON
@@ -3072,7 +3044,7 @@ add_executable(nr-uesoftmodem
target_link_libraries (nr-uesoftmodem
-Wl,--start-group
RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB
RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB
PHY_COMMON PHY_NR_COMMON PHY_UE PHY_NR_UE PHY_RU LFDS NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB
NFAPI_USER_LIB MISC_NFAPI_NR_LIB S1AP_LIB S1AP_ENB
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES}
@@ -3326,7 +3298,7 @@ add_executable(test_epc_generate_scenario
${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h
)
target_link_libraries (test_epc_generate_scenario
-Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U_OCP LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ITTI ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
-Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_LIB PHY LFDS ITTI ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
)
add_executable(test_epc_play_scenario
@@ -3345,7 +3317,7 @@ add_executable(test_epc_play_scenario
)
target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c)
target_link_libraries (test_epc_play_scenario
-Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U_OCP LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ITTI ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
-Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ITTI ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
)
@@ -3391,7 +3363,7 @@ if (${T_TRACER})
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB
PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX
L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON MAC_NR MAC_UE_NR NGAP_GNB
CN_UTILS GTPV1U_OCP GTPV1U_OCP SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB
CN_UTILS GTPV1U SCTP_CLIENT MME_APP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB
ldpc_orig ldpc_optim ldpc_optim8seg ldpc PROTO_AGENT dfts)
if (TARGET ${i})
add_dependencies(${i} generate_T)
@@ -3496,11 +3468,10 @@ add_executable(nr-ittisim
${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
)
target_compile_definitions(nr-ittisim PUBLIC NEW_GTPU)
target_link_libraries (nr-ittisim
-Wl,--start-group
UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS GTPV1U_OCP SECU_CN SECU_OSA
UTIL HASHTABLE SCTP_CLIENT SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS GTPV1U SECU_CN SECU_OSA
ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_SIM_LIB} RRC_LIB NR_RRC_LIB
NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB}
+1 -9
View File
@@ -42,17 +42,11 @@
//#include "ENB_APP/enb_config.h"
#include "flexran_agent_defs.h"
#include "gtpv1u.h"
#include "NwGtpv1u.h"
#include "NwGtpv1uMsg.h"
#include "NwGtpv1uPrivate.h"
#include "gtpv1u_eNB_defs.h"
#include "gtpv1u_gNB_defs.h"
#include "PHY/defs_L1_NB_IoT.h"
#include "RRC/LTE/defs_NB_IoT.h"
#include "RRC/LTE/rrc_defs.h"
#include "RRC/NR/nr_rrc_defs.h"
#include <openair3/ocp-gtpu/gtpv1u_eNB_task.h>
typedef struct {
@@ -110,8 +104,6 @@ typedef struct {
struct gNB_MAC_INST_s **nrmac;
/// GTPu descriptor
gtpv1u_data_t *gtpv1u_data_g;
/// NR GTPu descriptor
nr_gtpv1u_data_t *nr_gtpv1u_data_g;
/// RU descriptors. These describe what each radio unit is supposed to do and contain the necessary functions for fronthaul interfaces
struct RU_t_s **ru;
/// Mask to indicate fronthaul setup status of RU (hard-limit to 64 RUs)
+13 -5
View File
@@ -25,14 +25,22 @@
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <sys/types.h>
#include <unistd.h>
#include <platform_types.h>
#include "backtrace.h"
#define _Assert_Exit_ \
fprintf(stderr, "\nExiting execution\n"); \
fflush(stdout); \
fflush(stderr); \
abort();
#define _Assert_Exit_ \
if (getenv("gdbStacks")) { \
char tmp [1000]; \
sprintf(tmp,"gdb -ex='set confirm off' -ex 'thread apply all bt' -ex q -p %d > /tmp/full_stacks.%d < /dev/null", \
getpid(), getpid()); \
system(tmp); \
} \
fprintf(stderr, "\nExiting execution\n"); \
fflush(stdout); \
fflush(stderr); \
abort();
#define _Assert_(cOND, aCTION, fORMAT, aRGS...) \
do { \
-34
View File
@@ -1,34 +0,0 @@
/*
* 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 ue_power.h
* \brief support routines used in MAC and PHY
* \author R. Knopp, F. Kaltenberger
* \date 2020
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
* \note
* \warning
*/
int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs);
+2 -4
View File
@@ -256,8 +256,8 @@ typedef struct IttiMsgText_s {
#include <openair3/MME_APP/mme_app.h>
//#include <proto.h>
#include <openair3/GTPV1-U/gtpv1u_eNB_task.h>
#include <openair3/GTPV1-U/gtpv1u_gNB_task.h>
#include <openair3/ocp-gtpu/gtpv1u_eNB_task.h>
#include <openair3/ocp-gtpu/gtpv1u_gNB_task.h>
void *rrc_enb_process_itti_msg(void *);
#include <openair3/SCTP/sctp_eNB_task.h>
#include <openair3/NGAP/ngap_gNB.h>
@@ -340,8 +340,6 @@ void *rrc_enb_process_msg(void *);
TASK_DEF(TASK_RAL_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MSC, TASK_PRIORITY_MED, 200, NULL, NULL)\
TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\
TASK_DEF(OCP_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\
TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000, NULL, NULL)\
TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_UE_SIM, TASK_PRIORITY_MED, 200, NULL, NULL) \
+1 -1
View File
@@ -369,7 +369,7 @@ gtpv1u_create_s1u_tunnel(), delete tunnel, ... functions are called inside the o
# New GTP
## initialization
ocp_gtpv1uTask(): this creates only the thread, doesn't configure anything
gtpv1uTask(): this creates only the thread, doesn't configure anything
gtpv1Init(): creates a listening socket to Linux for a given reception and select a local IP address
## newGtpuCreateTunnel()
+1 -1
View File
@@ -365,7 +365,7 @@ int create_gNB_tasks(uint32_t gnb_nb) {
//Use check on x2ap to consider the NSA scenario and check on AMF_MODE_ENABLED for the SA scenario
if(is_x2ap_enabled() || AMF_MODE_ENABLED) {
if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task, NULL) < 0) {
if (itti_create_task (TASK_GTPV1_U, &gtpv1uTask, NULL) < 0) {
LOG_E(GTPU, "Create task for GTPV1U failed\n");
return -1;
}
+2 -1
View File
@@ -18,7 +18,8 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#define _GNU_SOURCE
#include <pthread.h>
#include <openair1/PHY/impl_defs_top.h>
#include "executables/nr-uesoftmodem.h"
#include "PHY/phy_extern_nr_ue.h"
-6
View File
@@ -49,12 +49,6 @@ void reset_stats(FL_OBJECT *button, long arg) {
int i,j,k;
PHY_VARS_eNB *phy_vars_eNB = RC.eNB[0][0];
printf("XXX %d %d %d\n",
sizeofArray(phy_vars_eNB->UE_stats),
sizeofArray( phy_vars_eNB->UE_stats[i].dlsch_NAK),
sizeofArray( *phy_vars_eNB->UE_stats[i].dlsch_NAK)
);
for (i=0; i<sizeofArray(phy_vars_eNB->UE_stats); i++) {
for (k=0; k<sizeofArray(phy_vars_eNB->UE_stats[i].dlsch_NAK); k++) { //harq_processes
for (j=0; j<sizeofArray(*phy_vars_eNB->UE_stats[i].dlsch_NAK); j++) {
View File
+6 -1
View File
@@ -175,7 +175,12 @@ gtpv1u_update_ngu_tunnel(
return 0;
}
int ocp_gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) {
int gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) {
return 0;
}
int gtpv1u_delete_ngu_tunnel( const instance_t instance,
gtpv1u_gnb_delete_tunnel_req_t *req) {
return 0;
}
+6 -1
View File
@@ -143,7 +143,12 @@ gtpv1u_update_ngu_tunnel(
return 0;
}
int ocp_gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) {
int gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) {
return 0;
}
int gtpv1u_delete_ngu_tunnel( const instance_t instance,
gtpv1u_gnb_delete_tunnel_req_t *req) {
return 0;
}
+6 -1
View File
@@ -139,7 +139,12 @@ gtpv1u_create_s1u_tunnel(
return 0;
}
int ocp_gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) {
int gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) {
return 0;
}
int gtpv1u_delete_ngu_tunnel( const instance_t instance,
gtpv1u_gnb_delete_tunnel_req_t *req) {
return 0;
}
+2 -8
View File
@@ -19,18 +19,12 @@
* contact@openairinterface.org
*/
MESSAGE_DEF(GTPV1U_ENB_UPDATE_TUNNEL_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_update_tunnel_req_t, Gtpv1uUpdateTunnelReq)
MESSAGE_DEF(GTPV1U_ENB_UPDATE_TUNNEL_RESP, MESSAGE_PRIORITY_MED, gtpv1u_enb_update_tunnel_resp_t, Gtpv1uUpdateTunnelResp)
MESSAGE_DEF(GTPV1U_ENB_DELETE_TUNNEL_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_delete_tunnel_req_t, Gtpv1uDeleteTunnelReq)
MESSAGE_DEF(GTPV1U_ENB_DELETE_TUNNEL_RESP, MESSAGE_PRIORITY_MED, gtpv1u_enb_delete_tunnel_resp_t, Gtpv1uDeleteTunnelResp)
MESSAGE_DEF(GTPV1U_ENB_TUNNEL_DATA_IND, MESSAGE_PRIORITY_MED, gtpv1u_enb_tunnel_data_ind_t, Gtpv1uTunnelDataInd)
MESSAGE_DEF(GTPV1U_ENB_TUNNEL_DATA_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_tunnel_data_req_t, Gtpv1uTunnelDataReq)
MESSAGE_DEF(GTPV1U_ENB_DATA_FORWARDING_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_data_forwarding_req_t,Gtpv1uDataForwardingReq)
MESSAGE_DEF(GTPV1U_ENB_DATA_FORWARDING_IND, MESSAGE_PRIORITY_MED, gtpv1u_enb_data_forwarding_ind_t,Gtpv1uDataForwardingInd)
MESSAGE_DEF(GTPV1U_ENB_END_MARKER_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_end_marker_req_t, Gtpv1uEndMarkerReq)
MESSAGE_DEF(GTPV1U_ENB_END_MARKER_IND, MESSAGE_PRIORITY_MED, gtpv1u_enb_end_marker_ind_t, Gtpv1uEndMarkerInd)
MESSAGE_DEF(GTPV1U_REQ, MESSAGE_PRIORITY_MED, Gtpv1uReq, gtpv1uReq)
MESSAGE_DEF(GTPV1U_REQ, MESSAGE_PRIORITY_MED, Gtpv1uReq, gtpv1uReq)
MESSAGE_DEF(GTPV1U_GNB_DELETE_TUNNEL_REQ, MESSAGE_PRIORITY_MED, gtpv1u_gnb_delete_tunnel_req_t, NRGtpv1uDeleteTunnelReq)
MESSAGE_DEF(GTPV1U_GNB_DELETE_TUNNEL_RESP, MESSAGE_PRIORITY_MED, gtpv1u_gnb_delete_tunnel_resp_t, NRGtpv1uDeleteTunnelResp)
MESSAGE_DEF(GTPV1U_GNB_TUNNEL_DATA_REQ, MESSAGE_PRIORITY_MED, gtpv1u_gnb_tunnel_data_req_t, NRGtpv1uTunnelDataReq)
-8
View File
@@ -28,10 +28,6 @@
#define GTPV1U_MAX_BEARERS_PER_UE max_val_LTE_DRB_Identity
#define NR_GTPV1U_MAX_BEARERS_PER_UE max_val_NR_DRB_Identity
#define GTPV1U_ENB_UPDATE_TUNNEL_REQ(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uUpdateTunnelReq
#define GTPV1U_ENB_UPDATE_TUNNEL_RESP(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uUpdateTunnelResp
#define GTPV1U_ENB_DELETE_TUNNEL_REQ(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uDeleteTunnelReq
#define GTPV1U_ENB_DELETE_TUNNEL_RESP(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uDeleteTunnelResp
#define GTPV1U_ENB_TUNNEL_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uTunnelDataInd
#define GTPV1U_ENB_TUNNEL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uTunnelDataReq
#define GTPV1U_ENB_DATA_FORWARDING_REQ(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uDataForwardingReq
@@ -41,8 +37,6 @@
#define GTPV1U_REQ(mSGpTR) (mSGpTR)->ittiMsg.gtpv1uReq
#define GTPV1U_GNB_DELETE_TUNNEL_REQ(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uDeleteTunnelReq
#define GTPV1U_GNB_DELETE_TUNNEL_RESP(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uDeleteTunnelResp
#define GTPV1U_GNB_TUNNEL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uTunnelDataReq
#define GTPV1U_ALL_TUNNELS_TEID (teid_t)0xFFFFFFFF
@@ -200,7 +194,6 @@ typedef struct gtpv1u_gnb_create_tunnel_resp_s {
pdusessionid_t pdusession_id[NR_GTPV1U_MAX_BEARERS_PER_UE];
transport_layer_addr_t gnb_addr;
} gtpv1u_gnb_create_tunnel_resp_t;
typedef struct gtpv1u_gnb_delete_tunnel_req_s {
rnti_t rnti;
uint8_t num_pdusession;
@@ -212,7 +205,6 @@ typedef struct gtpv1u_gnb_delete_tunnel_resp_s {
uint8_t status; ///< Status of NGU endpoint deleteion (Failed = 0xFF or Success = 0x0)
teid_t gnb_NGu_teid; ///< local NGU Tunnel Endpoint Identifier to be deleted
} gtpv1u_gnb_delete_tunnel_resp_t;
typedef struct gtpv1u_gnb_tunnel_data_req_s {
uint8_t *buffer;
uint32_t length;
+1 -1
View File
@@ -2080,7 +2080,7 @@ int RCconfig_gtpu(void ) {
GTPV1U_REQ(message).localPort = enb_port_for_S1U;
strcpy(GTPV1U_REQ(message).localAddrStr,address);
sprintf(GTPV1U_REQ(message).localPortStr,"%d", enb_port_for_S1U);
itti_send_msg_to_task (TASK_VARIABLE, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id)
itti_send_msg_to_task (TASK_GTPV1_U, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id)
} else
LOG_E(GTPU,"invalid address for S1U\n");
+1 -1
View File
@@ -47,7 +47,7 @@ static instance_t cu_task_create_gtpu_instance_to_du(eth_params_t *IPaddrs) {
strncpy(tmp.destinationHost, IPaddrs->remote_addr, sizeof(tmp.destinationHost)-1);
sprintf(tmp.originService, "%d", IPaddrs->my_portd);
sprintf(tmp.destinationService, "%d", IPaddrs->remote_portd);
return ocp_gtpv1Init(tmp);
return gtpv1Init(tmp);
}
static void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind,
+1 -1
View File
@@ -103,7 +103,7 @@ static instance_t du_create_gtpu_instance_to_cu(char *CUaddr, uint16_t CUport, c
strncpy(tmp.destinationHost, CUaddr, sizeof(tmp.destinationHost)-1);
sprintf(tmp.originService, "%d", DUport);
sprintf(tmp.destinationService, "%d", CUport);
return ocp_gtpv1Init(tmp);
return gtpv1Init(tmp);
}
void *F1AP_DU_task(void *arg) {
+1 -1
View File
@@ -1220,7 +1220,7 @@ int RCconfig_nr_gtpu(void ) {
GTPV1U_REQ(message).localPort = port;
strcpy(GTPV1U_REQ(message).localAddrStr,address);
sprintf(GTPV1U_REQ(message).localPortStr,"%d", port);
itti_send_msg_to_task (TASK_VARIABLE, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id)
itti_send_msg_to_task (TASK_GTPV1_U, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id)
} else
LOG_E(GTPU,"invalid address for NGU or S1U\n");
+2 -3
View File
@@ -60,7 +60,6 @@
#include <pthread.h>
# include "gtpv1u_eNB_task.h"
# include "gtpv1u.h"
#include <openair3/ocp-gtpu/gtp_itf.h>
#include "ENB_APP/enb_config.h"
@@ -229,7 +228,7 @@ rlc_op_status_t cu_send_to_du(const protocol_ctxt_t *const ctxt,
LOG_D(PDCP, "%s() (drb %ld) sending message to gtp size %d\n",
__func__, rb_id, size);
extern instance_t CUuniqInstance;
itti_send_msg_to_task(TASK_VARIABLE, CUuniqInstance, message_p);
itti_send_msg_to_task(TASK_GTPV1_U, CUuniqInstance, message_p);
return TRUE;
}
@@ -1078,7 +1077,7 @@ pdcp_data_ind(
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX;
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ctxt_pP->rnti;
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4;
itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p);
itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
packet_forwarded = TRUE;
}
} else {
-2
View File
@@ -85,8 +85,6 @@ extern struct msghdr nas_msg_rx;
# include "gtpv1u_eNB_task.h"
# include "gtpv1u_eNB_defs.h"
extern int gtpv1u_new_data_req( uint8_t enb_module_idP, rnti_t ue_rntiP, uint8_t rab_idP, uint8_t *buffer_pP, uint32_t buf_lenP, uint32_t buf_offsetP);
uint16_t ue_id_g; // Global variable to identify the ID for each UE. It is updated in main() of lte-uesoftmodem.c
+2 -2
View File
@@ -674,7 +674,7 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
sdap_gnb_ul_header_handler(buf[0]); // Handler for the UL gNB SDAP Header
}
LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size-offset);
itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p);
itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
}
}
}
@@ -728,7 +728,7 @@ rb_found:
LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n",
__func__, rb_id, size);
extern instance_t CUuniqInstance;
itti_send_msg_to_task(TASK_VARIABLE, CUuniqInstance, message_p);
itti_send_msg_to_task(TASK_GTPV1_U, CUuniqInstance, message_p);
} else {
memblock = get_free_mem_block(size, __FUNCTION__);
+1 -1
View File
@@ -518,7 +518,7 @@ rb_found:
req->pdusession_id=rb_id;
LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size);
extern instance_t DUuniqInstance;
itti_send_msg_to_task(OCP_GTPV1_U, DUuniqInstance, msg);
itti_send_msg_to_task(TASK_GTPV1_U, DUuniqInstance, msg);
return;
}
}
+1 -1
View File
@@ -440,7 +440,7 @@ rb_found:
req->rnti=ue->rnti;
req->rab_id=rb_id+4;
LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size);
itti_send_msg_to_task(OCP_GTPV1_U, DUuniqInstance, msg);
itti_send_msg_to_task(TASK_GTPV1_U, DUuniqInstance, msg);
return;
}
}
@@ -30,6 +30,10 @@
* \warning
*/
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "PHY/defs_nr_UE.h"
#include "NR_IF_Module.h"
#include "NR_MAC_UE/mac_proto.h"
-14
View File
@@ -9572,20 +9572,6 @@ void *rrc_enb_process_itti_msg(void *notUsed) {
rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND(msg_p, msg_name_p, instance);
break;
case GTPV1U_ENB_DELETE_TUNNEL_RESP: {
rrc_eNB_ue_context_t *ue = rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti);
if (ue != NULL
&& ue->ue_context.ue_release_timer_rrc > 0
&& (ue->ue_context.handover_info == NULL ||
(ue->ue_context.handover_info->state != HO_RELEASE &&
ue->ue_context.handover_info->state != HO_CANCEL))) {
ue->ue_context.ue_release_timer_rrc = ue->ue_context.ue_release_timer_thres_rrc;
}
break;
}
case S1AP_PATH_SWITCH_REQ_ACK:
LOG_I(RRC, "[eNB %ld] received path switch ack %s\n", instance, msg_name_p);
rrc_eNB_process_S1AP_PATH_SWITCH_REQ_ACK(msg_p, msg_name_p, instance);
+2 -2
View File
@@ -210,7 +210,7 @@ boolean_t gtpv_data_req_new (
GTPV1U_ENB_END_MARKER_REQ(msg).offset = GTPU_HEADER_OVERHEAD_MAX;
LOG_I(GTPU, "Send End Marker to GTPV1-U at frame %d and subframe %d \n", ctxt->frame,ctxt->subframe);
itti_send_msg_to_task(TASK_GTPV1_U, ENB_MODULE_ID_TO_INSTANCE(ctxt->module_id), msg);
return NW_GTPV1U_OK;
return 0;
}
/* target enb */
@@ -225,7 +225,7 @@ boolean_t gtpv_data_req_new (
gtpv1u_enb_delete_tunnel_req_t delete_tunnel_req;
memset(&delete_tunnel_req, 0, sizeof(delete_tunnel_req));
delete_tunnel_req.rnti = ctxt->rnti;
gtpv1u_delete_x2u_tunnel(ctxt->module_id, &delete_tunnel_req, GTPV1U_TARGET_ENB);
gtpv1u_delete_x2u_tunnel(ctxt->module_id, &delete_tunnel_req);
return true;
} else {
/* data packet */
-1
View File
@@ -36,7 +36,6 @@
#include "rrc_eNB_S1AP.h"
#include "enb_config.h"
#include "common/ran_context.h"
#include "gtpv1u.h"
#include "s1ap_eNB.h"
#include "s1ap_eNB_defs.h"
+7 -16
View File
@@ -30,6 +30,10 @@
#define RRC_GNB_C
#define RRC_GNB_C
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "nr_rrc_config.h"
#include "nr_rrc_defs.h"
#include "nr_rrc_extern.h"
@@ -2190,7 +2194,6 @@ rrc_gNB_decode_dcch(
asn_dec_rval_t dec_rval;
NR_UL_DCCH_Message_t *ul_dcch_msg = NULL;
struct rrc_gNB_ue_context_s *ue_context_p = NULL;
MessageDef *msg_delete_tunnels_p = NULL;
uint8_t xid;
int i;
@@ -2289,21 +2292,17 @@ rrc_gNB_decode_dcch(
xid = ul_dcch_msg->message.choice.c1->choice.rrcReconfigurationComplete->rrc_TransactionIdentifier;
ue_context_p->ue_context.pdu_session_release_command_flag = 0;
//gtp tunnel delete
msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_GNB, 0, GTPV1U_GNB_DELETE_TUNNEL_REQ);
memset(&GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p)));
GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti;
gtpv1u_gnb_delete_tunnel_req_t req={0};
for(i = 0; i < NB_RB_MAX; i++) {
if(xid == ue_context_p->ue_context.pduSession[i].xid) {
GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).pdusession_id[GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_pdusession++] =
req.pdusession_id[req.num_pdusession++] =
ue_context_p->ue_context.gnb_gtp_psi[i];
ue_context_p->ue_context.gnb_gtp_teid[i] = 0;
memset(&ue_context_p->ue_context.gnb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.gnb_gtp_addrs[i]));
ue_context_p->ue_context.gnb_gtp_psi[i] = 0;
}
}
itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->instance, msg_delete_tunnels_p);
gtpv1u_delete_ngu_tunnel(ctxt_pP->instance, &req);
//NGAP_PDUSESSION_RELEASE_RESPONSE
rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(ctxt_pP, ue_context_p, xid);
} else if (ue_context_p->ue_context.established_pdu_sessions_flag != 1) {
@@ -3636,9 +3635,6 @@ void *rrc_gnb_task(void *args_p) {
rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(msg_p, msg_name_p, instance);
break;
case GTPV1U_GNB_DELETE_TUNNEL_RESP:
break;
/* Messages from gNB app */
case NRRRC_CONFIGURATION_REQ:
LOG_I(NR_RRC, "[gNB %ld] Received %s : %p\n", instance, msg_name_p,&NRRRC_CONFIGURATION_REQ(msg_p));
@@ -3688,11 +3684,6 @@ void *rrc_gnb_task(void *args_p) {
rrc_gNB_process_dc_overall_timeout(GNB_INSTANCE_TO_MODULE_ID(instance), &X2AP_ENDC_DC_OVERALL_TIMEOUT(msg_p));
break;
/* Messages from GTP */
case GTPV1U_ENB_DELETE_TUNNEL_RESP:
/* nothing to do? */
break;
case NGAP_UE_CONTEXT_RELEASE_REQ:
rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_REQ(msg_p, msg_name_p, instance);
break;
+5 -8
View File
@@ -33,7 +33,6 @@
#include "rrc_eNB_S1AP.h"
#include "gnb_config.h"
#include "common/ran_context.h"
#include "gtpv1u.h"
#include "asn1_conversions.h"
#include "intertask_interface.h"
@@ -44,6 +43,7 @@
#include "gtpv1u_eNB_task.h"
#include "gtpv1u_gNB_task.h"
#include <openair3/ocp-gtpu/gtp_itf.h>
#include "RRC/LTE/rrc_eNB_GTPV1U.h"
#include "RRC/NR/rrc_gNB_GTPV1U.h"
@@ -1395,7 +1395,6 @@ rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(
protocol_ctxt_t ctxt;
pdusession_release_t pdusession_release_params[NGAP_MAX_PDUSESSION];
uint8_t nb_pdusessions_torelease;
MessageDef *msg_delete_tunnels_p = NULL;
uint8_t xid;
int i, pdusession;
uint8_t b_existed,is_existed;
@@ -1473,20 +1472,18 @@ rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(
} else {
//gtp tunnel delete
LOG_I(NR_RRC, "gtp tunnel delete \n");
msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_GNB, 0, GTPV1U_GNB_DELETE_TUNNEL_REQ);
memset(&GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p)));
GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti;
gtpv1u_gnb_delete_tunnel_req_t req={0};
req.rnti = ue_context_p->ue_context.rnti;
for(i = 0; i < NB_RB_MAX; i++) {
if(xid == ue_context_p->ue_context.pduSession[i].xid) {
GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).pdusession_id[GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_pdusession++] = ue_context_p->ue_context.gnb_gtp_psi[i];
req.pdusession_id[req.num_pdusession++] = ue_context_p->ue_context.gnb_gtp_psi[i];
ue_context_p->ue_context.gnb_gtp_teid[i] = 0;
memset(&ue_context_p->ue_context.gnb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.gnb_gtp_addrs[i]));
ue_context_p->ue_context.gnb_gtp_psi[i] = 0;
}
}
itti_send_msg_to_task(TASK_GTPV1_U, instance, msg_delete_tunnels_p);
gtpv1u_delete_ngu_tunnel(instance, &req);
//NGAP_PDUSESSION_RELEASE_RESPONSE
rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(&ctxt, ue_context_p, xid);
LOG_I(NR_RRC, "Send PDU Session Release Response \n");
-185
View File
@@ -1,185 +0,0 @@
/*
* 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
*/
/*
May 10, 2001
Modified in June, 2001, to include the length non multiple of 8
crc_byte.c
Byte oriented implementation of CRC's
*/
#include "rtos_header.h"
#include "platform_types.h"
/*ref 25.222 v4.0.0 , p12 */
/* the highest degree is set by default */
unsigned int poly24 = 0x80006100; // 1000 0000 0000 0000 0110 0001 D^24 + D^23 + D^6 + D^5 + D + 1
unsigned int poly16 = 0x10210000; // 0001 0000 0010 0001 D^16 + D^12 + D^5 + 1
unsigned int poly12 = 0x80F00000; // 1000 0000 1111 D^12 + D^11 + D^3 + D^2 + D + 1
unsigned int poly8 = 0x9B000000; // 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1
/*********************************************************
For initialization && verification purposes,
bit by bit implementation with any polynomial
The first bit is in the MSB of each byte
*********************************************************/
static unsigned int
crcbit (unsigned char * inputptr, int octetlen, unsigned int poly)
{
unsigned int i, crc = 0, c;
while (octetlen-- > 0) {
c = (*inputptr++) << 24;
for (i = 8; i != 0; i--) {
if ((1 << 31) & (c ^ crc))
crc = (crc << 1) ^ poly;
else
crc <<= 1;
c <<= 1;
}
}
return crc;
}
/*********************************************************
crc table initialization
*********************************************************/
static unsigned int crc24Table[256];
static unsigned short crc16Table[256];
static unsigned short crc12Table[256];
static unsigned char crc8Table[256];
void
crcTableInit ()
{
unsigned char c = 0;
do {
crc24Table[c] = crcbit (&c, 1, poly24);
crc16Table[c] = (unsigned short) (crcbit (&c, 1, poly16) >> 16);
crc12Table[c] = (unsigned short) (crcbit (&c, 1, poly12) >> 16);
crc8Table[c] = (unsigned char) (crcbit (&c, 1, poly8) >> 24);
} while (++c);
}
/*********************************************************
Byte by byte implementations,
assuming initial byte is 0 padded (in MSB) if necessary
*********************************************************/
unsigned int
crc24 (unsigned char * inptr, int bitlen)
{
int octetlen, resbit;
unsigned int crc = 0;
octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8);
while (octetlen-- > 0) {
crc = (crc << 8) ^ crc24Table[(*inptr++) ^ (crc >> 24)];
}
if (resbit > 0)
crc = (crc << resbit) ^ crc24Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
return crc;
}
unsigned int
crc16 (unsigned char * inptr, int bitlen)
{
int octetlen, resbit;
unsigned int crc = 0;
octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8);
while (octetlen-- > 0) {
crc = (crc << 8) ^ (crc16Table[(*inptr++) ^ (crc >> 24)] << 16);
}
if (resbit > 0)
crc = (crc << resbit) ^ (crc16Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 16);
return crc;
}
unsigned int
crc12 (unsigned char * inptr, int bitlen)
{
int octetlen, resbit;
unsigned int crc = 0;
octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8);
while (octetlen-- > 0) {
crc = (crc << 8) ^ (crc12Table[(*inptr++) ^ (crc >> 24)] << 16);
}
if (resbit > 0)
crc = (crc << resbit) ^ (crc12Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 16);
return crc;
}
unsigned int
crc8 (unsigned char * inptr, int bitlen)
{
int octetlen, resbit;
unsigned int crc = 0;
octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8);
while (octetlen-- > 0) {
crc = crc8Table[(*inptr++) ^ (crc >> 24)] << 24;
}
if (resbit > 0)
crc = (crc << resbit) ^ (crc8Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 24);
return crc;
}
/*******************************************************************/
/**
Test code
********************************************************************/
/* #ifdef MAIN
#include <stdio.h>
main()
{
unsigned char test[] = "Thebigredfox";
crcTableInit();
printf("%x\n", crcbit(test, sizeof(test) - 1, poly24));
printf("%x\n", crc24(test, (sizeof(test) - 1)*8));
printf("%x\n", crcbit(test, sizeof(test) - 1, poly8));
printf("%x\n", crc8(test, (sizeof(test) - 1)*8));
}
#endif */
-30
View File
@@ -1,30 +0,0 @@
/*
* 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
*/
/*
random_proto_extern.h
-------------------
AUTHOR : Lionel GAUTHIER
COMPANY : EURECOM
EMAIL : Lionel.Gauthier@eurecom.fr
***************************************************************************/
extern int uniform (void);
-116
View File
@@ -1,116 +0,0 @@
/*
* 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 taus.c
* \brief random number generator per OAI component
* \author Navid Nikaein
* \date 2011 - 2014
* \version 0.1
* \email navid.nikaein@eurecom.fr
* \warning
* @ingroup util
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include "oml.h"
unsigned int s0[MAX_NUM_COMPS], s1[MAX_NUM_COMPS], s2[MAX_NUM_COMPS], b[MAX_NUM_COMPS], r[MAX_NUM_COMPS];
inline unsigned int taus(unsigned int comp) {
b[comp] = (((s0[comp] << 13) ^ s0[comp]) >> 19);
s0[comp] = (((s0[comp] & 0xFFFFFFFE) << 12)^ b[comp]);
b[comp] = (((s1[comp] << 2) ^ s1[comp]) >> 25);
s1[comp] = (((s1[comp] & 0xFFFFFFF8) << 4)^ b[comp]);
b[comp] = (((s2[comp] << 3) ^ s2[comp]) >> 11);
s2[comp] = (((s2[comp] & 0xFFFFFFF0) << 17)^ b[comp]);
r[comp] = s0[comp] ^ s1[comp] ^ s2[comp];
return r[comp];
}
/*void set_taus_seed(unsigned int seed_type) {
unsigned int i; // i index of component
for (i=MIN_NUM_COMPS; i < MAX_NUM_COMPS ; i ++) {
switch (seed_type) {
case 0: // use rand func
if (i == 0) srand(time(NULL));
s0[i] = ((unsigned int)rand());
s1[i] = ((unsigned int)rand());
s2[i] = ((unsigned int)rand());
printf("Initial seeds use rand: s0[%u] = 0x%x, s1[%u] = 0x%x, s2[%u] = 0x%x\n", i, s0[i], i, s1[i], i, s2[i]);
break;
case 1: // use rand with seed
if (i == 0) srand(0x1e23d851);
s0[i] = ((unsigned int)rand());
s1[i] = ((unsigned int)rand());
s2[i] = ((unsigned int)rand());
printf("Initial seeds use rand with seed : s0[%u] = 0x%x, s1[%u] = 0x%x, s2[%u] = 0x%x\n", i, s0[i], i, s1[i], i, s2[i]);
break;
default:
break;
}
}
}*/
int get_rand (unsigned int comp) {
if ((comp > MIN_NUM_COMPS) && (comp < MAX_NUM_COMPS))
return r[comp];
else {
//LOG_E(RNG,"unknown component %d\n",comp);
return -1;
}
}
unsigned int dtaus(unsigned int comp, unsigned int a, unsigned b) {
return (int) (((double)taus(comp)/(double)0xffffffff)* (double)(b-a) + (double)a);
}
/*
#ifdef STANDALONE
main() {
unsigned int i,randomg, randphy;
set_taus_seed(0);
printf("dtaus %d \n",dtaus(PHY, 1000, 1000000));
do {//for (i=0;i<10;i++){
randphy = taus(PHY);
randomg = taus(OTG);
i++;
// printf("rand for OMG (%d,0x%x) PHY (%d,0x%x)\n",OMG, randomg, PHY, randphy);
} while (randphy != randomg);
printf("after %d run: get rand for (OMG 0x%x, PHY 0x%x)\n",i, get_rand(OTG), get_rand(PHY));
}
#endif
*/
-58
View File
@@ -1,58 +0,0 @@
#/*
# * 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
# */
AM_CFLAGS = @ADD_CFLAGS@ \
-I$(top_srcdir)/COMMON \
-I$(top_srcdir)/NAS/EURECOM-NAS/src/api/network \
-I$(top_srcdir)/NAS/EURECOM-NAS/src/include \
-I$(top_srcdir)/NAS/EURECOM-NAS/src/ies \
-I$(top_srcdir)/NAS/EURECOM-NAS/src/emm/msg \
-I$(top_srcdir)/NAS/EURECOM-NAS/src/esm/msg \
-I$(top_srcdir)/NAS/EURECOM-NAS/src/util \
-I$(top_srcdir)/INTERTASK_INTERFACE \
-I$(top_srcdir)/GTPV1-U/nw-gtpv1u/include \
-I$(top_srcdir)/GTPV1-U/nw-gtpv1u/shared \
-I$(top_srcdir)/UTILS \
-I$(top_srcdir)/UTILS/HASHTABLE \
-I$(top_srcdir)/UTILS/TIMER
noinst_LTLIBRARIES = libgtpv1u.la
libgtpv1u_la_LDFLAGS = -all-static
libgtpv1u_la_SOURCES = \
gtpv1u_task.c gtpv1u.h \
gtpv1u_teid_pool.c \
nw-gtpv1u/shared/NwTypes.h \
nw-gtpv1u/shared/NwUtils.h \
nw-gtpv1u/shared/NwGtpv1uError.h \
nw-gtpv1u/shared/NwLog.h \
nw-gtpv1u/shared/NwGtpv1uIe.h \
nw-gtpv1u/shared/NwGtpv1uMsg.h \
nw-gtpv1u/shared/NwGtpv1u.h \
nw-gtpv1u/include/NwGtpv1uPrivate.h \
nw-gtpv1u/include/NwGtpv1uLog.h \
nw-gtpv1u/include/NwGtpv1uTrxn.h \
nw-gtpv1u/include/NwGtpv1uTunnelEndPoint.h \
nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c \
nw-gtpv1u/src/NwGtpv1uTrxn.c \
nw-gtpv1u/src/NwGtpv1uMsg.c \
nw-gtpv1u/src/NwGtpv1u.c
-67
View File
@@ -1,67 +0,0 @@
#/*
# * 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
# */
OUTDIR = .
libgtpv1u_OBJECTS = \
nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.o \
nw-gtpv1u/src/NwGtpv1uTrxn.o \
nw-gtpv1u/src/NwGtpv1uMsg.o \
nw-gtpv1u/src/NwGtpv1u.o \
gtpv1u_eNB.o \
gtpv1u_teid_pool.o
# pull in dependency info for *existing* .o files
-include $(OUTDIR)/*.d
CFLAGS = \
-Wall \
$(GTPV1U_CFLAGS) \
-DENB_MODE \
-Werror=uninitialized \
-Werror=implicit-function-declaration
$(OUTDIR)/%.o : %.c
@echo "Compiling $<"
@if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi;
@$(CC) -c $(CFLAGS) -o $@ $<
@$(CC) -MM $(CFLAGS) $< > $(basename $@).d
@mv -f $(basename $@).d $(basename $@).d.tmp
@sed -e 's|.*:|$@:|' < $(basename $@).d.tmp > $(basename $@).d
@sed -e 's/.*://' -e 's/\\$$//' < $(basename $@).d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $(basename $@).d
@rm -f $(basename $@).d.tmp
objsdir:
@if [ ! -d $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi;
$(OUTDIR)/libgtpv1u.a: $(addprefix $(OUTDIR)/,$(libgtpv1u_OBJECTS))
@echo Creating GTPV1U archive
@$(AR) rcs $@ $(addprefix $(OUTDIR)/,$(libgtpv1u_OBJECTS))
clean:
@$(RM_F_V) $(OUTDIR)/nw-gtpv1u/src/*.o
@$(RM_F_V) $(OUTDIR)/nw-gtpv1u/src/*.d
@$(RM_F_V) $(OUTDIR)/*.o
@$(RM_F_V) $(OUTDIR)/*.d
@$(RM_F_V) $(OUTDIR)/libgtpv1u.a
cleanall: clean
-55
View File
@@ -1,55 +0,0 @@
/*
* 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.h
* \brief
* \author Sebastien ROUX, Lionel Gauthier
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
#ifndef GTPV1_U_H_
#define GTPV1_U_H_
#define GTPU_STACK_ENB 0
#define GTPU_STACK_SGW 1
/* When gtpv1u is compiled for eNB use MACRO from UTILS/log.h,
* otherwise use standard fprintf as logger.
*/
#if defined(ENB_MODE)
# define GTPU_DEBUG(x, args...) LOG_D(GTPU, x, ##args)
# define GTPU_INFO(x, args...) LOG_I(GTPU, x, ##args)
# define GTPU_WARNING(x, args...) LOG_W(GTPU, x, ##args)
# define GTPU_ERROR(x, args...) LOG_E(GTPU, x, ##args)
#else
# define GTPU_DEBUG(x, args...) fprintf(stdout, "[GTPU][D]"x, ##args)
# define GTPU_INFO(x, args...) fprintf(stdout, "[GTPU][I]"x, ##args)
# define GTPU_WARNING(x, args...) fprintf(stdout, "[GTPU][W]"x, ##args)
# define GTPU_ERROR(x, args...) fprintf(stderr, "[GTPU][E]"x, ##args)
#endif
//#warning "TO BE REFINED"
# define GTPU_HEADER_OVERHEAD_MAX 64
uint32_t gtpv1u_new_teid(void);
#endif /* GTPV1_U_H_ */
File diff suppressed because it is too large Load Diff
-69
View File
@@ -1,69 +0,0 @@
/*
* 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_eNB_task.h
* \brief
* \author Lionel Gauthier
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
#ifndef GTPV1U_ENB_TASK_H_
#define GTPV1U_ENB_TASK_H_
/*
int
gtpv1u_new_data_req(
uint8_t enb_id,
uint8_t ue_id,
uint8_t rab_id,
uint8_t *buffer,
uint32_t buf_len,
uint32_t buf_offset);*/
int gtpv1u_eNB_init(void);
void *gtpv1u_eNB_process_itti_msg(void*);
void *gtpv1u_eNB_task(void *args);
int
gtpv1u_create_x2u_tunnel(
const instance_t instanceP,
const gtpv1u_enb_create_x2u_tunnel_req_t * const create_tunnel_req_pP,
gtpv1u_enb_create_x2u_tunnel_resp_t * const create_tunnel_resp_pP);
int
gtpv1u_create_s1u_tunnel(
const instance_t instanceP,
const gtpv1u_enb_create_tunnel_req_t * const create_tunnel_req_pP,
gtpv1u_enb_create_tunnel_resp_t * const create_tunnel_resp_pP);
int
gtpv1u_update_s1u_tunnel(
const instance_t instanceP,
const gtpv1u_enb_create_tunnel_req_t * const create_tunnel_req_pP,
const rnti_t prior_rnti);
int gtpv1u_delete_x2u_tunnel(
const instance_t instanceP,
const gtpv1u_enb_delete_tunnel_req_t * const req_pP,
int enbflag);
#endif /* GTPV1U_ENB_TASK_H_ */
File diff suppressed because it is too large Load Diff
-108
View File
@@ -1,108 +0,0 @@
/*
* 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_gNB_defs.h
* \brief
* \author Yoshio INOUE, Masayuki HARADA
* \date 2020
* \version 0.1
* \email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
* (yoshio.inoue%40fujitsu.com%2cmasayuki.harada%40fujitsu.com)
*/
#include "hashtable.h"
#include "NR_asn_constant.h"
#ifndef GTPV1U_GNB_DEFS_H_
#define GTPV1U_GNB_DEFS_H_
#include "NwGtpv1u.h"
#define GTPV1U_UDP_PORT (2152)
#define NR_GTPV1U_MAX_BEARERS_ID (max_val_NR_DRB_Identity - 3)
#define GTPV1U_SOURCE_GNB (0)
#define GTPV1U_TARGET_GNB (1)
#define GTPV1U_MSG_FROM_SOURCE_GNB (0)
#define GTPV1U_MSG_FROM_UPF (1)
typedef struct nr_gtpv1u_teid_data_s {
/* UE identifier for oaisim stack */
module_id_t gnb_id;
rnti_t ue_id;
pdusessionid_t pdu_session_id;
} nr_gtpv1u_teid_data_t;
typedef struct nr_gtpv1u_bearer_s {
/* TEID used in dl and ul */
teid_t teid_gNB; ///< gNB TEID
uintptr_t teid_gNB_stack_session; ///< gNB TEID
teid_t teid_upf; ///< Remote TEID
in_addr_t upf_ip_addr;
struct in6_addr upf_ip6_addr;
teid_t teid_tgNB;
in_addr_t tgnb_ip_addr; ///< target gNB ipv4
struct in6_addr tgnb_ip6_addr; ///< target gNB ipv6
tcp_udp_port_t port;
//NwGtpv1uStackSessionHandleT stack_session;
bearer_state_t state;
} nr_gtpv1u_bearer_t;
typedef struct nr_gtpv1u_ue_data_s {
/* UE identifier for oaisim stack */
rnti_t ue_id;
/* Unique identifier used between PDCP and GTP-U to distinguish UEs */
uint32_t instance_id;
int num_bearers;
/* Bearer related data.
* Note that the first LCID available for data is 3 and we fixed the maximum
* number of e-rab per UE to be (32 [id range]), max RB is 11. The real rb id will 3 + rab_id (3..32).
*/
nr_gtpv1u_bearer_t bearers[NR_GTPV1U_MAX_BEARERS_ID];
//RB_ENTRY(gtpv1u_ue_data_s) gtpv1u_ue_node;
} nr_gtpv1u_ue_data_t;
typedef struct nr_gtpv1u_data_s {
/* nwgtpv1u stack internal data */
NwGtpv1uStackHandleT gtpv1u_stack;
/* RB tree of UEs */
hash_table_t *ue_mapping; // PDCP->GTPV1U
hash_table_t *teid_mapping; // GTPV1U -> PDCP
//RB_HEAD(gtpv1u_ue_map, gtpv1u_ue_data_s) gtpv1u_ue_map_head;
/* Local IP address to use */
in_addr_t gnb_ip_address_for_NGu_up;
/* UDP internal data */
//udp_data_t udp_data;
uint16_t seq_num;
uint8_t restart_counter;
} nr_gtpv1u_data_t;
#endif /* GTPV1U_GNB_DEFS_H_ */
-97
View File
@@ -1,97 +0,0 @@
/*
* 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
*/
#ifndef GTPV1U_SGW_DEFS_H_
#define GTPV1U_SGW_DEFS_H_
#include "mme_config.h"
#include "NwGtpv1u.h"
#include "gtpv1u.h"
#include "hashtable.h"
#include "common_types.h"
#define GTPV1U_UDP_PORT (2152)
#define MAX_BEARERS_PER_UE (11)
typedef enum {
BEARER_DOWN = 0,
BEARER_IN_CONFIG,
BEARER_UP,
BEARER_DL_HANDOVER,
BEARER_UL_HANDOVER,
BEARER_MAX,
} bearer_state_t;
#define BUFFER_TO_uint32_t(buf, x) \
do { \
x = ((uint32_t)((buf)[0]) ) | \
((uint32_t)((buf)[1]) << 8) | \
((uint32_t)((buf)[2]) << 16) | \
((uint32_t)((buf)[3]) << 24); \
} while(0)
typedef struct gtpv1u_teid2enb_info_s {
/* TEID used in dl and ul */
uint32_t teid_enb; ///< Remote eNB TEID
ip_address_t enb_ip_addr;
bearer_state_t state;
uint16_t port; /// LG ???
} gtpv1u_teid2enb_info_t;
/*struct gtpv1u_ue_data_s {
// UE identifier for oaisim stack
uint8_t ue_id;
// Unique identifier used between PDCP and GTP-U to distinguish UEs
uint32_t instance_id;
// Bearer related data.
// Note that the first LCID available for data is 3 and we fixed the maximum
// number of e-rab per UE to be 11. The real rb id will 3 + rab_id (0..10).
//
struct gtpv1u_bearer_s bearers[MAX_BEARERS_PER_UE];
RB_ENTRY(gtpv1u_ue_data_s) gtpv1u_ue_node;
};*/
typedef struct {
/* nwgtpv1u stack internal data */
NwGtpv1uStackHandleT gtpv1u_stack;
/* RB tree of UEs */
//RB_HEAD(gtpv1u_ue_map, gtpv1u_ue_data_s) gtpv1u_ue_map_head;
/* Local IP address to use */
uint32_t sgw_ip_address_for_S1u_S12_S4_up;
char *ip_addr;
uint16_t seq_num;
uint8_t restart_counter;
//gtpv1u_teid2enb_info_t* teid2enb_mapping[];
hash_table_t *S1U_mapping;
} gtpv1u_data_t;
int gtpv1u_init(const mme_config_t *mme_config);
#endif /* GTPV1U_SGW_DEFS_H_ */
-47
View File
@@ -1,47 +0,0 @@
/*
* 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_task.c
* \brief
* \author Lionel Gauthier
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
#include <stdlib.h>
#include <stdint.h>
#include "gtpv1u.h"
//#define GTPV1U_LINEAR_TEID_ALLOCATION 1
#ifdef GTPV1U_LINEAR_TEID_ALLOCATION
static uint32_t g_gtpv1u_teid = 0;
#endif
uint32_t gtpv1u_new_teid(void)
{
#ifdef GTPV1U_LINEAR_TEID_ALLOCATION
g_gtpv1u_teid = g_gtpv1u_teid + 1;
return g_gtpv1u_teid;
#else
return random() + random() % (RAND_MAX - 1) + 1;
#endif
}
-1
View File
@@ -1 +0,0 @@
Amit Chawre
-26
View File
@@ -1,26 +0,0 @@
Copyright (c) 2010-2011 Amit Chawre <http://www.amitchawre.net/contact.html>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View File
View File
@@ -1,83 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* n w - g t p v 2 u *
* G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k *
* *
* *
* Copyright (c) 2010-2011 Amit Chawre *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* 3. The name of the author may not be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*----------------------------------------------------------------------------*/
#ifndef __NW_GTPV1U_LOG_H__
#define __NW_GTPV1U_LOG_H__
#include <stdio.h>
#include "NwLog.h"
/**
* @file NwGtpv1uLog.h
* @brief This header contains logging related definitions.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*---------------------------------------------------------------------------
* Log Macro Definition
*--------------------------------------------------------------------------*/
#define NW_LOG(_gtpv1uHandle, _logLevel, ...) \
do { \
if(((NwGtpv1uStackT*)(_gtpv1uHandle))->logLevel >= _logLevel) \
{ \
char _logBuf[1024]; \
snprintf(_logBuf, 1024, __VA_ARGS__); \
((NwGtpv1uStackT*)(_gtpv1uHandle))->logMgr.logReqCallback(((NwGtpv1uStackT*)_gtpv1uHandle)->logMgr.logMgrHandle, _logLevel, __FILE__, __LINE__, _logBuf);\
} \
} while(0)
#define NW_ENTER(_gtpv1uHandle) \
do { \
NW_LOG(_gtpv1uHandle, NW_LOG_LEVEL_DEBG, "Entering '%s'", __func__);\
} while(0)
#define NW_LEAVE(_gtpv1uHandle) \
do { \
NW_LOG(_gtpv1uHandle, NW_LOG_LEVEL_DEBG, "Leaving '%s'", __func__);\
} while(0)
#ifdef __cplusplus
}
#endif
#endif /* __NW_TYPES_H__ */
/*--------------------------------------------------------------------------*
* E N D O F F I L E *
*--------------------------------------------------------------------------*/
@@ -1,227 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* n w - g t p v 2 u *
* n w - g t p v 2 u *
* G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k *
* *
* *
* Copyright (c) 2010-2011 Amit Chawre *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* 3. The name of the author may not be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*----------------------------------------------------------------------------*/
#ifndef __NW_GTPV1U_PRIVATE_H__
#define __NW_GTPV1U_PRIVATE_H__
#include "tree.h"
#include "queue.h"
#include "NwTypes.h"
#include "NwGtpv1uError.h"
#include "NwGtpv1u.h"
#include "NwGtpv1uMsg.h"
/**
* @file NwGtpv1uPrivate.h
* @brief This header file contains nw-gtpv1u private definitions not to be
* exposed to user application.
*/
#ifdef __cplusplus
extern "C" {
#endif
#define NW_GTPV1U_MALLOC(_stack, _size, _mem, _type) \
do { \
if(((NwGtpv1uStackT*)(_stack))->memMgr.memAlloc && ((NwGtpv1uStackT*)(_stack))->memMgr.memFree )\
{ \
_mem = (_type) ((NwGtpv1uStackT*) (_stack))->memMgr.memAlloc(((NwGtpv1uStackT*) (_stack))->memMgr.hMemMgr, _size, __FILE__, __LINE__);\
} \
else \
{ \
_mem = (_type) malloc (_size); \
} \
} while (0)
/*--------------------------------------------------------------------------*
* G T P U S T A C K O B J E C T T Y P E D E F I N I T I O N *
*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*
* GRPS Tunneling Protocol Stack Class Definition
*--------------------------------------------------------------------------*/
/**
* gtpv1u stack class definition
*/
typedef struct NwGtpv1uStack {
uint32_t stackType;/**< GTPU_STACK_ENB or GTPU_STACK_SGW */
NwPtrT id;
uint32_t seq;
NwGtpv1uUlpEntityT ulp;
NwGtpv1uUdpEntityT udp;
NwGtpv1uMemMgrEntityT memMgr;
NwGtpv1uTimerMgrEntityT tmrMgr;
NwGtpv1uLogMgrEntityT logMgr;
uint32_t logLevel;
RB_HEAD( NwGtpv1uOutstandingTxSeqNumTrxnMap, NwGtpv1uTrxn) outstandingTxSeqNumMap;
RB_HEAD( NwGtpv1uOutstandingRxSeqNumTrxnMap, NwGtpv1uTrxn) outstandingRxSeqNumMap;
RB_HEAD(NwGtpv1uTunnelEndPointTMap, NwGtpv1uTunnelEndPoint) sessionMap;
RB_HEAD(NwGtpv1uTunnelEndPointIdentifierMap, NwGtpv1uTunnelEndPoint) teidMap;
} NwGtpv1uStackT;
/**
* GTP Tunnel End Point class definition
*/
typedef struct NwGtpv1uTunnelEndPoint {
uint32_t teid; /**< Gtpu Tunnel End Point Identifier */
uint32_t peerAddr; /**< Peer IP address for the session */
NwGtpv1uStackT* pStack; /**< Pointer to the parent stack */
NwGtpv1uUlpSessionHandleT hUlpSession; /**< ULP session handle for the session */
RB_ENTRY (NwGtpv1uTunnelEndPoint) sessionMapRbtNode; /**< RB Tree Data Structure Node */
struct NwGtpv1uTunnelEndPoint *next;
} NwGtpv1uTunnelEndPointT;
/*--------------------------------------------------------------------------*
* Timeout Info Type Definition
*--------------------------------------------------------------------------*/
/**
* gtpv1u timeout info
*/
typedef struct NwGtpv1uTimeoutInfo {
NwGtpv1uStackHandleT hStack;
void* timeoutArg;
NwGtpv1uRcT (*timeoutCallbackFunc)(void*);
} NwGtpv1uTimeoutInfoT;
/**
* Start a transaction response timer
*
* @param[in] thiz Pointer to stack instance
* @param[in] timeoutArg Arg to timeout function.
* @param[out] phTmr Pointer to timer handle.
* @return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpStartTrxnPeerRspTimer(NwGtpv1uStackT* thiz, NwGtpv1uTimeoutInfoT* timeoutInfo, NwGtpv1uTimerHandleT* phTmr);
/**
* Stop a transaction response timer
*
* @param[in] thiz Pointer to stack instance
* @param[out] phTmr Pointer to timer handle.
* @return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpStopTrxnPeerRspTimer(NwGtpv1uStackT* thiz, NwGtpv1uTimerHandleT* phTmr);
#define NW_GTPV1U_MAX_MSG_LEN (4096) /**< Maximum supported gtpv1u packet length including header */
/**
* NwGtpv1uMsgT holds gtpv1u messages to/from the peer.
*/
typedef struct NwGtpv1uMsg {
uint8_t version;
uint8_t protocolType;
uint8_t extHdrFlag;
uint8_t seqNumFlag;
uint16_t npduNumFlag;
uint32_t msgType;
uint16_t msgLen;
uint32_t teid;
uint16_t seqNum;
uint8_t npduNum;
uint8_t nextExtHdrType;
uint8_t* msgBuf;
uint32_t msgBufLen;
uint32_t msgBufOffset;
struct NwGtpv1uMsg* next;
} NwGtpv1uMsgT;
/*--------------------------------------------------------------------------*
* R6/R4 Transaction Context Type Definition
*--------------------------------------------------------------------------*/
/**
* Transaction structure
*/
typedef struct NwGtpv1uTrxn {
uint32_t seqNum;
uint32_t peerIp;
uint32_t peerPort;
uint8_t maxRetries;
uint8_t t3Timer;
NwGtpv1uTimerHandleT hRspTmr;
NwGtpv1uTimeoutInfoT peerRspTimeoutInfo;
NwGtpv1uStackT* pStack;
NwGtpv1uTunnelEndPointT* pSession;
uint32_t hUlpTrxn;
NwGtpv1uMsgT* pMsg;
RB_ENTRY (NwGtpv1uTrxn) outstandingTxSeqNumMapRbtNode; /**< RB Tree Data Structure Node */
RB_ENTRY (NwGtpv1uTrxn) outstandingRxSeqNumMapRbtNode; /**< RB Tree Data Structure Node */
struct NwGtpv1uTrxn* next;
} NwGtpv1uTrxnT;
/**
* GTPv2 message header structure
*/
#pragma pack(1)
typedef struct NwGtpv1uMsgHeader {
uint8_t PN:1;
uint8_t S:1;
uint8_t E:1;
uint8_t spare:1;
uint8_t PT:1;
uint8_t version:3;
uint8_t msgType;
uint16_t msgLength;
uint32_t teid;
} NwGtpv1uMsgHeaderT;
#pragma pack()
#ifdef __cplusplus
}
#endif
#endif /* __NW_GTPV1U_PRIVATE_H__ */
/*--------------------------------------------------------------------------*
* E N D O F F I L E *
*--------------------------------------------------------------------------*/
@@ -1,88 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* n w - g t p v 2 u *
* G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k *
* *
* *
* Copyright (c) 2010-2011 Amit Chawre *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* 3. The name of the author may not be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*----------------------------------------------------------------------------*/
/**
* @file NwGtpv1uTrxn.h
* @author Amit Chawre
* @brief
*
* This header file contains required definitions and functions
* prototypes used by gtpv1u transactions.
*
**/
#ifndef __NW_GTPV1U_TRXN_H__
#define __NW_GTPV1U_TRXN_H__
#ifdef __cplusplus
extern "C" {
#endif
NwGtpv1uRcT
nwGtpv1uTrxnNew( NW_IN NwGtpv1uStackT* thiz,
NW_OUT NwGtpv1uTrxnT **ppTrxn);
NwGtpv1uRcT
nwGtpv1uTrxnWithSeqNew( NW_IN NwGtpv1uStackT* thiz,
NW_IN uint32_t seqNum,
NW_OUT NwGtpv1uTrxnT **ppTrxn);
NwGtpv1uRcT
nwGtpv1uTrxnDelete( NW_INOUT NwGtpv1uTrxnT **ppTrxn);
NwGtpv1uRcT
nwGtpv1uTrxnNew( NW_IN NwGtpv1uStackT* thiz,
NW_OUT NwGtpv1uTrxnT **ppTrxn);
NwGtpv1uRcT
nwGtpv1uTrxnDelete( NW_INOUT NwGtpv1uTrxnT **pthiz);
NwGtpv1uRcT
nwGtpv1uTrxnCreateAndSendMsg( NW_IN NwGtpv1uStackT* thiz,
NW_IN NwGtpv1uTrxnT *pTrxn,
NW_IN uint32_t peerIp,
NW_IN uint32_t peerPort,
NW_IN NwGtpv1uMsgT *pMsg);
#ifdef __cplusplus
}
#endif
#endif /* __NW_GTPV1U_TRXN_H__ */
/*--------------------------------------------------------------------------*
* E N D O F F I L E *
*--------------------------------------------------------------------------*/
@@ -1,85 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* n w - g t p v 2 u *
* G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k *
* *
* *
* Copyright (c) 2010-2011 Amit Chawre *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* 3. The name of the author may not be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*----------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "NwTypes.h"
#include "NwUtils.h"
#include "NwGtpv1uError.h"
#include "NwGtpv1uPrivate.h"
#include "NwGtpv1uMsg.h"
#include "NwGtpv1u.h"
#include "NwGtpv1uLog.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __NW_GTPV1U_CONNECTION_H__
#define __NW_GTPV1U_CONNECTION_H__
/**
Constructor
@return Pointer to session on success, NULL n failure.
*/
NwGtpv1uTunnelEndPointT*
nwGtpTunnelEndPointNew(struct NwGtpv1uStack* pStack);
/**
Destructor
@param[in] thiz: Pointer to session
@return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpTunnelEndPointDestroy(struct NwGtpv1uStack* pStack, NwGtpv1uTunnelEndPointT* thiz);
NwGtpv1uRcT
nwGtpSessionSendMsgApiToUlpEntity(NwGtpv1uTunnelEndPointT* thiz,
NwGtpv1uMsgT *pMsg);
#ifdef __cplusplus
}
#endif
#endif
/*--------------------------------------------------------------------------*
* E N D O F F I L E *
*--------------------------------------------------------------------------*/
@@ -1,562 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* n w - g t p v 2 u *
* G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k *
* *
* *
* Copyright (c) 2010-2011 Amit Chawre *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* 3. The name of the author may not be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*----------------------------------------------------------------------------*/
#ifndef __NW_GTPV1U_H__
#define __NW_GTPV1U_H__
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include "NwTypes.h"
#include "NwGtpv1uError.h"
/**
* @file NwGtpv1u.h
* @author Amit Chawre
* @brief
*
* This header file contains all required definitions and functions
* prototypes for using nw-gtpv1u library.
*
**/
#define NW_GTPU_VERSION (0x01)
#define NW_GTP_PROTOCOL_TYPE_GTP (0x01)
#define NW_GTP_PROTOCOL_TYPE_GTP_PRIME (0x00)
/*--------------------------------------------------------------------------*
* S H A R E D A P I M A C R O S *
*--------------------------------------------------------------------------*/
#define NW_GTP_ECHO_REQ (1)
#define NW_GTP_ECHO_RSP (2)
#define NW_GTP_ERROR_INDICATION (26)
#define NW_GTP_SUPPORTED_EXTENSION_HEADER_INDICATION (31)
#define NW_GTP_END_MARKER (254)
#define NW_GTP_GPDU (255)
/*---------------------------------------------------------------------------
* Opaque Gtpv2 Stack Handles
*--------------------------------------------------------------------------*/
typedef NwPtrT NwGtpv1uStackHandleT; /**< Gtpv2 Stack Handle */
typedef NwPtrT NwGtpv1uUlpHandleT; /**< Gtpv2 Stack Ulp Entity Handle */
typedef NwPtrT NwGtpv1uUdpHandleT; /**< Gtpv2 Stack Udp Entity Handle */
typedef NwPtrT NwGtpv1uMemMgrHandleT; /**< Gtpv2 Stack Mem Manager Handle */
typedef NwPtrT NwGtpv1uTimerMgrHandleT; /**< Gtpv2 Stack Timer Manager Handle */
typedef NwPtrT NwGtpv1uLogMgrHandleT; /**< Gtpv2 Stack Log Mnagaer Handle */
typedef NwPtrT NwGtpv1uTimerHandleT; /**< Gtpv2 Stack Timer Handle */
typedef NwPtrT NwGtpv1uMsgHandleT; /**< Gtpv2 Msg Handle */
typedef struct NwGtpv1uStackConfig {
uint16_t udpSrcPort;
} NwGtpv1uStackConfigT;
/*--------------------------------------------------------------------------*
* S T A C K A P I D E F I N I T I O N S *
*--------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------
* Gtpv2 Stack ULP API type definitions
*--------------------------------------------------------------------------*/
/**
* APIs types between ULP and Stack
*/
typedef enum {
/* APIs from ULP to stack */
NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT = 0x00000000, /**< Create a local teid context on stack */
NW_GTPV1U_ULP_API_DESTROY_TUNNEL_ENDPOINT, /**< Delete a local teid context on stack */
NW_GTPV1U_ULP_API_INITIAL_REQ, /**< Send a Initial Request over a session */
NW_GTPV1U_ULP_API_TRIGGERED_REQ, /**< Send a Initial Request over a session */
NW_GTPV1U_ULP_API_TRIGGERED_RSP, /**< Send a Trigger Response over a session */
NW_GTPV1U_ULP_API_SEND_TPDU, /**< Send a T-PDU message over teid context */
/* APIs from stack to ULP */
NW_GTPV1U_ULP_API_RECV_TPDU, /**< Receive a gtpv1u T-PDU from stack */
NW_GTPV1U_ULP_API_RECV_MSG, /**< Receive a gtpv1u message from stack */
NW_GTPV1U_ULP_API_RSP_FAILURE, /**< Rsp failure for gtpv2 message from stack */
/* Do not add below this */
NW_GTPV1U_ULP_API_END = 0xFFFFFFFF,
} NwGtpv1uUlpApiTypeT;
/*---------------------------------------------------------------------------
* Gtpv2 Stack API information elements definitions
*--------------------------------------------------------------------------*/
typedef NwPtrT NwGtpv1uStackSessionHandleT;/**< Gtpv2 Stack session Handle */
typedef uint8_t NwGtpv1uMsgTypeT; /**< Gtpv2 Msg Type */
typedef NwPtrT NwGtpv1uTrxnHandleT; /**< Gtpv2 Transaction Handle */
typedef NwPtrT NwGtpv1uUlpTrxnHandleT; /**< Gtpv2 Ulp Transaction Handle */
typedef NwPtrT NwGtpv1uUlpSessionHandleT; /**< Gtpv2 Ulp session Handle */
/**
* API information elements between ULP and Stack for
* creating a session.
*/
typedef struct {
NW_IN uint32_t teid;
NW_IN NwGtpv1uUlpSessionHandleT hUlpSession;
NW_OUT NwGtpv1uStackSessionHandleT hStackSession;
} NwGtpv1uCreateTunnelEndPointT;
/**
* API information elements between ULP and Stack for
* destroying a session.
*/
typedef struct {
NW_IN NwGtpv1uStackSessionHandleT hStackSessionHandle;
} NwGtpv1uDestroyTunnelEndPointT;
/**
* API information elements between ULP and Stack for
* sending a Gtpv1u initial message.
*/
typedef struct {
NW_IN NwGtpv1uUlpTrxnHandleT hUlpTrxn;
NW_IN uint32_t peerIp;
NW_IN uint32_t peerPort;
NW_IN uint8_t flags;
NW_IN uint32_t teid;
} NwGtpv1uInitialReqInfoT;
/**
* API information elements between ULP and Stack for
* sending a Gtpv1u triggered response message.
*/
typedef struct {
NW_IN NwGtpv1uUlpTrxnHandleT hUlpTrxn;
NW_IN uint32_t peerIp;
NW_IN uint32_t peerPort;
NW_IN uint8_t flags;
NW_IN uint32_t teid;
NW_IN uint32_t seqNum;
NW_IN NwGtpv1uMsgHandleT hMsg;
} NwGtpv1uTriggeredRspInfoT;
/**
* API information elements between ULP and Stack for
* sending a Gtpv1u triggered request message.
*/
typedef struct {
NW_IN NwGtpv1uUlpTrxnHandleT hUlpTrxn;
NW_IN uint32_t peerIp;
NW_IN uint32_t peerPort;
NW_IN uint8_t flags;
NW_IN uint32_t teid;
NW_IN uint32_t seqNum;
NW_IN NwGtpv1uMsgHandleT hMsg;
} NwGtpv1uTriggeredReqInfoT;
/**
* API information elements between ULP and Stack for
* sending a Gtpv2 message over a session.
*/
typedef struct {
NW_IN uint32_t teid;
NW_IN uint32_t ipAddr;
NW_IN uint8_t flags;
NW_IN NwGtpv1uMsgHandleT hMsg;
} NwGtpv1uSendtoInfoT;
/**
* API information elements between ULP and Stack for
* sending a Gtpv2 message over a session.
*/
typedef struct {
NW_OUT NwGtpv1uStackSessionHandleT hStackSessionHandle;
NW_INOUT NwGtpv1uTrxnHandleT hTrxn;
NW_IN NwGtpv1uUlpTrxnHandleT hUlpTrxn;
NW_IN NwGtpv1uMsgTypeT msgType;
NW_IN uint8_t flags;
NW_IN NwGtpv1uMsgHandleT hMsg;
} NwGtpv1uSendMsgInfoT;
/**
* API information elements between ULP and Stack for
* receiving a Gtpv2 message over a session from stack.
*/
typedef struct {
NW_IN NwGtpv1uUlpSessionHandleT hUlpSession;
NW_IN NwGtpv1uUlpTrxnHandleT hUlpTrxn;
NW_IN uint32_t teid;
NW_IN uint32_t peerIp;
NW_IN uint32_t peerPort;
NW_IN uint32_t msgType; /**< Message type */
NW_IN NwGtpv1uMsgHandleT hMsg; /**< Gtp Message handle */
} NwGtpv1uRecvMsgInfoT;
/**
* API information elements between ULP and Stack for
* receiving a Gtpv2 message over a session from stack.
*/
typedef struct {
NW_IN NwGtpv1uUlpSessionHandleT hUlpSession;
NW_IN NwGtpv1uTrxnHandleT hTrxn;
} NwGtpv1uNackInfoT;
/*---------------------------------------------------------------------------
* Gtpv2 Stack API structure definition
*--------------------------------------------------------------------------*/
/**
* API structure between ULP and Stack
*/
typedef struct {
NwGtpv1uUlpApiTypeT apiType;
NwGtpv1uMsgHandleT hMsg;
union {
NwGtpv1uCreateTunnelEndPointT createTunnelEndPointInfo;
NwGtpv1uDestroyTunnelEndPointT destroyTunnelEndPointInfo;
NwGtpv1uInitialReqInfoT initialReqInfo;
NwGtpv1uTriggeredRspInfoT triggeredRspInfo;
NwGtpv1uTriggeredReqInfoT triggeredReqInfo;
NwGtpv1uSendtoInfoT sendtoInfo;
NwGtpv1uSendMsgInfoT sendMsgInfo;
NwGtpv1uRecvMsgInfoT recvMsgInfo;
NwGtpv1uNackInfoT nackMsgInfo;
} apiInfo;
} NwGtpv1uUlpApiT;
/*--------------------------------------------------------------------------*
* S T A C K E N T I T I E S D E F I N I T I O N S *
*--------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------
* ULP Entity Definitions
*--------------------------------------------------------------------------*/
/**
* Gtpv2 ULP entity definition
*/
typedef struct {
NwGtpv1uUlpHandleT hUlp;
NwGtpv1uRcT (*ulpReqCallback) ( NW_IN NwGtpv1uUlpHandleT hUlp,
NW_IN NwGtpv1uUlpApiT *pUlpApi);
} NwGtpv1uUlpEntityT;
/*---------------------------------------------------------------------------
* UDP Entity Definitions
*--------------------------------------------------------------------------*/
/**
* Gtpv2 UDP entity definition
*/
typedef struct {
NwGtpv1uUdpHandleT hUdp;
NwGtpv1uRcT (*udpDataReqCallback) ( NW_IN NwGtpv1uUdpHandleT udpHandle,
NW_IN uint8_t* dataBuf,
NW_IN uint32_t dataSize,
NW_IN uint32_t dataOffset,
NW_IN uint32_t peerIP,
NW_IN uint16_t peerPort);
} NwGtpv1uUdpEntityT;
/**
* Gtpv1u Memory Manager entity definition
*/
typedef struct {
NwGtpv1uMemMgrHandleT hMemMgr;
void* (*memAlloc)( NW_IN NwGtpv1uMemMgrHandleT hMemMgr,
NW_IN uint32_t memSize,
NW_IN NwCharT* fileName,
NW_IN uint32_t lineNumber);
void (*memFree) ( NW_IN NwGtpv1uMemMgrHandleT hMemMgr,
NW_IN void* hMem,
NW_IN NwCharT* fileName,
NW_IN uint32_t lineNumber);
} NwGtpv1uMemMgrEntityT;
/*---------------------------------------------------------------------------
* Timer Entity Definitions
*--------------------------------------------------------------------------*/
#define NW_GTPV1U_TMR_TYPE_ONE_SHOT (0)
#define NW_GTPV1U_TMR_TYPE_REPETITIVE (1)
/**
* Gtpv2 Timer Manager entity definition
*/
typedef struct {
NwGtpv1uTimerMgrHandleT tmrMgrHandle;
NwGtpv1uRcT (*tmrStartCallback)( NW_IN NwGtpv1uTimerMgrHandleT tmrMgrHandle,
NW_IN uint32_t timeoutSecs,
NW_IN uint32_t timeoutUsec,
NW_IN uint32_t tmrType,
NW_IN void* tmrArg,
NW_OUT NwGtpv1uTimerHandleT* tmrHandle);
NwGtpv1uRcT (*tmrStopCallback) ( NW_IN NwGtpv1uTimerMgrHandleT tmrMgrHandle,
NW_IN NwGtpv1uTimerHandleT tmrHandle);
} NwGtpv1uTimerMgrEntityT;
/*---------------------------------------------------------------------------
* Log Entity Definitions
*--------------------------------------------------------------------------*/
/**
* Gtpv2 Log manager entity definition
*/
typedef struct {
NwGtpv1uLogMgrHandleT logMgrHandle;
NwGtpv1uRcT (*logReqCallback) (NW_IN NwGtpv1uLogMgrHandleT logMgrHandle,
NW_IN uint32_t logLevel,
NW_IN NwCharT* file,
NW_IN uint32_t line,
NW_IN NwCharT* logStr);
} NwGtpv1uLogMgrEntityT;
/*--------------------------------------------------------------------------*
* P U B L I C F U N C T I O N S *
*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif
/*---------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------*/
/**
Initialize the nw-gtpv1u stack.
@param[in,out] phGtpv1uStackHandle : Pointer to stack handle
@param[in] stackType : GTPU_STACK_ENB or GTPU_STACK_SGW
*/
NwGtpv1uRcT
nwGtpv1uInitialize( NW_INOUT NwGtpv1uStackHandleT* phGtpv1uStackHandle, uint32_t stackType);
/*---------------------------------------------------------------------------
* Destructor
*--------------------------------------------------------------------------*/
/**
Destroy the nw-gtpv1u stack.
@param[in] hGtpv1uStackHandle : Stack handle
*/
NwGtpv1uRcT
nwGtpv1uFinalize( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle);
/*---------------------------------------------------------------------------
* Configuration Get/Set Operations
*--------------------------------------------------------------------------*/
/**
Set Configuration for the nw-gtpv1u stack.
@param[in,out] phGtpv1uStackHandle : Pointer to stack handle
*/
NwGtpv1uRcT
NwGtpv1uConfigSet( NW_IN NwGtpv1uStackHandleT* phGtpv1uStackHandle, NW_IN NwGtpv1uStackConfigT* pConfig);
/**
Get Configuration for the nw-gtpv1u stack.
@param[in,out] phGtpv1uStackHandle : Pointer to stack handle
*/
NwGtpv1uRcT
NwGtpv1uConfigGet( NW_IN NwGtpv1uStackHandleT* phGtpv1uStackHandle, NW_OUT NwGtpv1uStackConfigT* pConfig);
/**
Set ULP entity for the stack.
@param[in] hGtpv1uStackHandle : Stack handle
@param[in] pUlpEntity : Pointer to ULP entity.
@return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpv1uSetUlpEntity( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle,
NW_IN NwGtpv1uUlpEntityT* pUlpEntity);
/**
Set UDP entity for the stack.
@param[in] hGtpv1uStackHandle : Stack handle
@param[in] pUdpEntity : Pointer to UDP entity.
@return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpv1uSetUdpEntity( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle,
NW_IN NwGtpv1uUdpEntityT* pUdpEntity);
/**
Set MemMgr entity for the stack.
@param[in] hGtpv1uStackHandle : Stack handle
@param[in] pMemMgr : Pointer to Memory Manager.
@return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpv1uSetMemMgrEntity( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle,
NW_IN NwGtpv1uMemMgrEntityT* pMemMgr);
/**
Set TmrMgr entity for the stack.
@param[in] hGtpv1uStackHandle : Stack handle
@param[in] pTmrMgr : Pointer to Timer Manager.
@return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpv1uSetTimerMgrEntity( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle,
NW_IN NwGtpv1uTimerMgrEntityT* pTmrMgr);
/**
Set LogMgr entity for the stack.
@param[in] hGtpv1uStackHandle : Stack handle
@param[in] pLogMgr : Pointer to Log Manager.
@return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpv1uSetLogMgrEntity( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle,
NW_IN NwGtpv1uLogMgrEntityT* pLogMgr);
/**
Set log level for the stack.
@param[in] hGtpv1uStackHandle : Stack handle
@param[in] logLevel : Log level.
@return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpv1uSetLogLevel( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NW_IN uint32_t logLevel);
/*---------------------------------------------------------------------------
* Process Request from Udp Layer
*--------------------------------------------------------------------------*/
/**
Process Data Request from UDP entity.
@param[in] hGtpv1uStackHandle : Stack handle
@param[in] udpData : Pointer to received UDP data.
@param[in] udpDataLen : Received data length.
@param[in] dstPort : Received on port.
@param[in] from : Received from peer information.
@return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpv1uProcessUdpReq( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle,
NW_IN uint8_t* udpData,
NW_IN uint32_t udpDataLen,
NW_IN uint16_t peerPort,
NW_IN uint32_t peerIP);
/*---------------------------------------------------------------------------
* Process Request from Upper Layer
*--------------------------------------------------------------------------*/
/**
Process Request from ULP entity.
@param[in] hGtpv1uStackHandle : Stack handle
@param[in] pLogMgr : Pointer to Ulp Req.
@return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpv1uProcessUlpReq( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle,
NW_IN NwGtpv1uUlpApiT *ulpReq);
/*---------------------------------------------------------------------------
* Process Timer timeout Request from Timer Manager
*--------------------------------------------------------------------------*/
/**
Process Timer timeout Request from Timer Manager
@param[in] pLogMgr : Pointer timeout arguments.
@return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpv1uProcessTimeout( NW_IN void* timeoutArg);
NwGtpv1uRcT
nwGtpv1uPeerRspTimeout(void* arg);
#ifdef __cplusplus
}
#endif
#endif /* __NW_GTPV1U_H__ */
/*--------------------------------------------------------------------------*
* E N D O F F I L E *
*--------------------------------------------------------------------------*/
@@ -1,63 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* n w - g t p v 2 c *
* G P R S T u n n e l i n g P r o t o c o l v 2 c S t a c k *
* *
* *
* Copyright (c) 2010-2011 Amit Chawre *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* 3. The name of the author may not be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*----------------------------------------------------------------------------*/
#ifndef __NW_GTPV1U_ERROR_H__
#define __NW_GTPV1U_ERROR_H__
/**
* @file NwGtpv1uError.h
* @brief This header file contains return error code type definitions.
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
NW_GTPV1U_OK = 0x00000000,
NW_GTPV1U_MANDATORY_IE_DUPLICATE,
NW_GTPV1U_MANDATORY_IE_MISSING,
NW_GTPV1U_MSG_MALFORMED,
NW_GTPV1U_FAILURE = 0xFFFFFFFE
}
NwGtpv1uRcT;
#ifdef __cplusplus
}
#endif
#endif /* __NW_GTPV1U_ERROR_H__*/
@@ -1,66 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* n w - g t p v 2 u *
* G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k *
* *
* *
* Copyright (c) 2010-2011 Amit Chawre *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* 3. The name of the author may not be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*----------------------------------------------------------------------------*/
/**
* @file NwGtpv1uIe.h
* @brief This header file contains Information Element definitions for GTPv1u
* as per 3GPP TS 29281-930.
*/
#ifndef __NW_GTPV1U_IE_H__
#define __NW_GTPV1U_IE_H__
/*--------------------------------------------------------------------------*
* G T P V 2 U I E T Y P E M A C R O D E F I N I T I O N S *
*--------------------------------------------------------------------------*/
#define NW_GTPV1U_IE_RECOVERY (14)
#define NW_GTPV1U_IE_TEID_DATA_I (15)
#define NW_GTPV1U_IE_GSN_ADDRESS (133)
#define NW_GTPV1U_IE_EXT_HDR_TYPE_LIST (141)
#define NW_GTPV1U_IE_PRIVATE_EXTENSION (255)
/*--------------------------------------------------------------------------*
* G T P V 2 U C A U S E V A L U E D E F I N I T I O N S *
*--------------------------------------------------------------------------*/
#define NW_GTPV1U_CAUSE_REQUEST_ACCEPTED (16)
#define NW_GTPV1U_CAUSE_MANDATORY_IE_MISSING (70)
#endif /* __NW_GTPV1U_IE_H__ */
/*--------------------------------------------------------------------------*
* E N D O F F I L E *
*--------------------------------------------------------------------------*/
@@ -1,317 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* n w - g t p v 2 u *
* G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k *
* *
* *
* Copyright (c) 2010-2011 Amit Chawre *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* 3. The name of the author may not be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*----------------------------------------------------------------------------*/
#ifndef __NW_GTPV1U_MSG_H__
#define __NW_GTPV1U_MSG_H__
#include "NwTypes.h"
#include "NwGtpv1u.h"
/**
* @file NwGtpv1uMsg.h
* @brief This file defines APIs for to build new outgoing gtpv1u messages and to parse incoming messages.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------*
* G T P V 2 C I E D A T A - T Y P E D E F I N I T I O N S *
*--------------------------------------------------------------------------*/
#pragma pack(1)
typedef struct NwGtpv1uIeTv1 {
uint8_t t;
uint8_t v;
} NwGtpv1uIeTv1T;
typedef struct NwGtpv1uIeTv2 {
uint8_t t;
uint8_t v;
} NwGtpv1uIeTv2T;
typedef struct NwGtpv1uIeTv4 {
uint8_t t;
uint32_t v;
} NwGtpv1uIeTv4T;
typedef struct NwGtpv1uIeTlv {
uint8_t t;
uint16_t l;
} NwGtpv1uIeTlvT;
#pragma pack()
/**
* Allocate a GPDU gtpv1u message.
*
* @param[in] hGtpuStackHandle : gtpv1u stack handle.
* @param[in] teidPresent : TEID is present flag.
* @param[in] teid : TEID for this message.
* @param[in] seqNum : Sequence number for this message.
* @param[out] phMsg : Pointer to message handle.
*/
NwGtpv1uRcT
nwGtpv1uMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NW_IN uint8_t seqNumFlag,
NW_IN uint8_t npduNumFlag,
NW_IN uint8_t extHdrFlag,
NW_IN uint8_t msgType,
NW_IN uint8_t teid,
NW_IN uint16_t seqNum,
NW_IN uint8_t npduNum,
NW_IN uint8_t nextExtHeader,
NW_OUT NwGtpv1uMsgHandleT *phMsg);
/**
* Allocate a gtpv1u message.
*
* @param[in] hGtpuStackHandle : gtpv1u stack handle.
* @param[in] teid : TEID for this message.
* @param[in] seqNumFlag : Sequence number flag for this message.
* @param[in] seqNum : Sequence number for this message.
* @param[in] pTpdu: T-PDU for this message.
* @param[in] tpduLength: T-PDU length for this message.
* @param[out] phMsg : Pointer to message handle.
*/
NwGtpv1uRcT
nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NW_IN uint32_t teid,
NW_IN uint8_t seqNumFlag,
NW_IN uint16_t seqNum,
NW_IN uint8_t* tpdu,
NW_IN uint16_t tpduLength,
NW_IN uint32_t tpduOffset,
NW_OUT NwGtpv1uMsgHandleT *phMsg);
/**
* Allocate a gtpv1u message from another gtpv1u message.
*
* @param[in] hGtpuStackHandle : gtpv1u stack handle.
* @param[out] hMsg : Handle to input message.
* @param[out] phMsg : Pointer to message handle.
*/
NwGtpv1uRcT
nwGtpv1uMsgFromMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NW_IN NwGtpv1uMsgHandleT hMsg,
NW_OUT NwGtpv1uMsgHandleT *phMsg);
/**
* Allocate a gtpv1u message from data buffer.
*
* @param[in] hGtpuStackHandle : gtpv1u stack handle.
* @param[in] pBuf: Buffer to be copied in this message.
* @param[in] bufLen: Buffer length to be copied in this message.
* @param[out] phMsg : Pointer to message handle.
*/
NwGtpv1uRcT
nwGtpv1uMsgFromBufferNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NW_IN uint8_t* pBuf,
NW_IN uint32_t bufLen,
NW_OUT NwGtpv1uMsgHandleT *phMsg);
/**
* Free a gtpv1u message.
*
* @param[in] hGtpuStackHandle : gtpv1u stack handle.
* @param[in] hMsg : Message handle.
*/
NwGtpv1uRcT
nwGtpv1uMsgDelete( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NW_IN NwGtpv1uMsgHandleT hMsg);
/**
* Set TEID for gtpv1u message.
*
* @param[in] hMsg : Message handle.
* @param[in] teid: TEID value.
*/
NwGtpv1uRcT
nwGtpv1uMsgSetTeid(NW_IN NwGtpv1uMsgHandleT hMsg, uint32_t teid);
/**
* Set TEID present flag for gtpv1u message.
*
* @param[in] hMsg : Message handle.
* @param[in] teidPesent: Flag boolean value.
*/
NwGtpv1uRcT
nwGtpv1uMsgSetTeidPresent(NW_IN NwGtpv1uMsgHandleT hMsg, NwBoolT teidPresent);
/**
* Set sequence for gtpv1u message.
*
* @param[in] hMsg : Message handle.
* @param[in] seqNum: Flag boolean value.
*/
NwGtpv1uRcT
nwGtpv1uMsgSetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg, uint32_t seqNum);
/**
* Get TEID present for gtpv1u message.
*
* @param[in] hMsg : Message handle.
*/
uint32_t
nwGtpv1uMsgGetTeid(NW_IN NwGtpv1uMsgHandleT hMsg);
/**
* Get TEID present for gtpv1u message.
*
* @param[in] hMsg : Message handle.
*/
NwBoolT
nwGtpv1uMsgGetTeidPresent(NW_IN NwGtpv1uMsgHandleT hMsg);
/**
* Get sequence number for gtpv1u message.
*
* @param[in] hMsg : Message handle.
*/
uint32_t
nwGtpv1uMsgGetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg);
/**
* Get tpdu for gtpv1u message.
*
* @param[in] hMsg : Message handle.
* @param[inout] pTpduBuf : Buffer to copy the T-PDU.
* @param[out] hMsg : T-PDU length.
*/
uint32_t
nwGtpv1uMsgGetTpdu(NW_IN NwGtpv1uMsgHandleT hMsg, uint8_t* pTpduBuf, uint32_t* pTpduLength);
uint8_t*
nwGtpv1uMsgGetTpduHandle(NW_IN NwGtpv1uMsgHandleT hMsg);
uint32_t
nwGtpv1uMsgGetTpduLength(NW_IN NwGtpv1uMsgHandleT hMsg);
/**
* Add a gtpv1u information element of length 1 to gtpv1u mesasge.
*
* @param[in] hMsg : Handle to gtpv1u message.
* @param[in] type : IE type.
* @param[in] value : IE value.
*/
NwGtpv1uRcT
nwGtpv1uMsgAddIeTV1(NW_IN NwGtpv1uMsgHandleT hMsg,
NW_IN uint8_t type,
NW_IN uint8_t value);
/**
* Add a gtpv1u information element of length 2 to gtpv1u mesasge.
*
* @param[in] hMsg : Handle to gtpv1u message.
* @param[in] type : IE type.
* @param[in] value : IE value.
*/
NwGtpv1uRcT
nwGtpv1uMsgAddIeTV2(NW_IN NwGtpv1uMsgHandleT hMsg,
NW_IN uint8_t type,
NW_IN uint16_t length,
NW_IN uint16_t value);
/**
* Add a gtpv1u information element of length 4 to gtpv1u mesasge.
*
* @param[in] hMsg : Handle to gtpv1u message.
* @param[in] type : IE type.
* @param[in] value : IE value.
*/
NwGtpv1uRcT
nwGtpv1uMsgAddIeTV4(NW_IN NwGtpv1uMsgHandleT hMsg,
NW_IN uint8_t type,
NW_IN uint16_t length,
NW_IN uint32_t value);
/**
* Add a gtpv1u information element of variable length to gtpv1u mesasge.
*
* @param[in] hMsg : Handle to gtpv1u message.
* @param[in] type : IE type.
* @param[in] length : IE length.
* @param[in] value : IE value.
*/
NwGtpv1uRcT
nwGtpv1uMsgAddIe(NW_IN NwGtpv1uMsgHandleT hMsg,
NW_IN uint8_t type,
NW_IN uint16_t length,
NW_IN uint8_t* pVal);
/**
* Dump the contents of gtpv1u mesasge.
*
* @param[in] hMsg : Handle to gtpv1u message.
* @param[in] fp: Pointer to output file.
*/
NwGtpv1uRcT
nwGtpv1uMsgHexDump(NwGtpv1uMsgHandleT hMsg, FILE* fp);
uint32_t
nwGtpv1uMsgGetMsgType(NW_IN NwGtpv1uMsgHandleT hMsg);
#ifdef __cplusplus
}
#endif
#endif /* __NW_TYPES_H__ */
/*--------------------------------------------------------------------------*
* E N D O F F I L E *
*--------------------------------------------------------------------------*/
-88
View File
@@ -1,88 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* n w - g t p v 2 c *
* G P R S T u n n e l i n g P r o t o c o l v 2 c S t a c k *
* *
* *
* Copyright (c) 2010-2011 Amit Chawre *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* 3. The name of the author may not be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*----------------------------------------------------------------------------*/
#ifndef __NW_LOG_H__
#define __NW_LOG_H__
#include <libgen.h>
#include "NwTypes.h"
/**
* @file NwLog.h
* @brief This header file contains global shared logging definitions.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*---------------------------------------------------------------------------
* Log Level Definitions
*--------------------------------------------------------------------------*/
#define NW_LOG_LEVEL_EMER (0) /**< system is unusable */
#define NW_LOG_LEVEL_ALER (1) /**< action must be taken immediately*/
#define NW_LOG_LEVEL_CRIT (2) /**< critical conditions */
#define NW_LOG_LEVEL_ERRO (3) /**< error conditions */
#define NW_LOG_LEVEL_WARN (4) /**< warning conditions */
#define NW_LOG_LEVEL_NOTI (5) /**< normal but signification condition */
#define NW_LOG_LEVEL_INFO (6) /**< informational */
#define NW_LOG_LEVEL_DEBG (7) /**< debug-level messages */
// static
// NwCharT* gLogLevelStr[] = {"EMER", "ALER", "CRIT", "ERRO", "WARN", "NOTI", "INFO", "DEBG"};
/*---------------------------------------------------------------------------
* IPv4 logging macros
*--------------------------------------------------------------------------*/
#define NW_IPV4_ADDR "%u.%u.%u.%u"
#define NW_IPV4_ADDR_FORMAT(__addr) (uint8_t)((__addr) & 0x000000ff), \
(uint8_t)(((__addr) & 0x0000ff00) >> 8 ), \
(uint8_t)(((__addr) & 0x00ff0000) >> 16), \
(uint8_t)(((__addr) & 0xff000000) >> 24)
#define NW_IPV4_ADDR_FORMATP(__paddr) (uint8_t)(*((uint8_t*)(__paddr)) & 0x000000ff), \
(uint8_t)(*((uint8_t*)(__paddr + 1)) & 0x000000ff), \
(uint8_t)(*((uint8_t*)(__paddr + 2)) & 0x000000ff), \
(uint8_t)(*((uint8_t*)(__paddr + 3)) & 0x000000ff)
#ifdef __cplusplus
}
#endif
#endif /* __NW_LOG_H__ */
@@ -1,78 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* n w - g t p v 2 c *
* G P R S T u n n e l i n g P r o t o c o l v 2 c S t a c k *
* *
* *
* Copyright (c) 2010-2011 Amit Chawre *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* 3. The name of the author may not be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*----------------------------------------------------------------------------*/
#include <stdlib.h>
#include <stdint.h>
#ifndef __NW_TYPES_H__
#define __NW_TYPES_H__
/**
* @file NwTypes.h
* @brief This header file contains basic type definitions.
*/
#ifdef __cplusplus
extern "C" {
#endif
#define NW_IN /**< An input argument */
#define NW_OUT /**< An output argumnet */
#define NW_INOUT /**< An input and output argument */
#define NW_TRUE (1) /**< Truth value */
#define NW_FALSE (0) /**< False value */
typedef signed char NwS8T; /**< Signed 1 byte */
typedef signed short NwS16T; /**< Signed 2 byte */
typedef signed int NwS32T; /**< Signed 4 byte */
typedef signed long long NwS64T; /**< Signed 8 byte */
typedef uintptr_t NwPtrT; /**< Use this for generic pointers */
typedef unsigned int NwHandleT; /**< Use this for generic handles */
typedef char NwBoolT; /**< Use this for booleans */
typedef char NwCharT; /**< Use this for strings */
typedef signed int NwFdT; /**< Use this for file descriptor */
#ifdef __cplusplus
}
#endif
#endif /* __NW_TYPES_H__ */
@@ -1,68 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* n w - g t p v 2 c *
* G P R S T u n n e l i n g P r o t o c o l v 2 c S t a c k *
* *
* *
* Copyright (c) 2010-2011 Amit Chawre *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* 3. The name of the author may not be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*----------------------------------------------------------------------------*/
#include <assert.h>
#ifndef __NW_UTILS_H__
#define __NW_UTILS_H__
/**
* @file NwUtils.h
* @brief This header file contains utility macro and function definitions.
*/
#define NW_ASSERT assert /**< Assertion */
#define NW_CHK_NULL_PTR(_ptr) NW_ASSERT(_ptr != NULL) /**< Null pointer check */
#define NW_HTONS(x) ( ( ((x) & 0xff00) >> 8 ) | ( ((x) & 0x00ff) << 8 ) )
#define NW_HTONL(x) ( ( ((x) & 0xff000000) >> 24 ) | ( ( (x) & 0x00ff0000 ) >> 8 ) | \
( ( (x) & 0x0000ff00 ) << 8 ) | ( ( (x) & 0x000000ff) << 24 ) )
#define NW_HTONLL(x) ( \
( ( ((uint64_t)x) & 0xff00000000000000ULL ) >> 56 ) | ( ( ((uint64_t)x) & 0x00ff000000000000ULL ) >> 40 ) | \
( ( ((uint64_t)x) & 0x0000ff0000000000ULL ) >> 24 ) | ( ( ((uint64_t)x) & 0x000000ff00000000ULL ) >> 8 ) | \
( ( ((uint64_t)x) & 0x000000000000ff00ULL ) << 40 ) | ( ( ((uint64_t)x) & 0x00000000000000ffULL ) << 56 ) | \
( ( ((uint64_t)x) & 0x0000000000ff0000ULL ) << 24 ) | ( ( ((uint64_t)x) & 0x00000000ff000000ULL ) << 8 ) \
)
#define NW_NTOHS NW_HTONS
#define NW_NTOHL NW_HTONL
#define NW_NTOHLL NW_HTONLL
#endif /* __NW_UTILS_H__ */
File diff suppressed because it is too large Load Diff
@@ -1,558 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* n w - g t p v 2 u *
* G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k *
* *
* *
* Copyright (c) 2010-2011 Amit Chawre *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* 3. The name of the author may not be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*----------------------------------------------------------------------------*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "NwTypes.h"
#include "NwLog.h"
#include "NwUtils.h"
#include "NwGtpv1uLog.h"
#include "NwGtpv1u.h"
#include "NwGtpv1uPrivate.h"
#include "NwGtpv1uMsg.h"
#include "assertions.h"
#include "gtpv1u.h"
#if defined(ENB_MODE)
#include "common/utils/LOG/log.h"
#endif
#define NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE (12) /**< Size of GTPv1u EPC specific header */
#define NW_GTPV1U_EPC_MIN_HEADER_SIZE (8)
#ifdef __cplusplus
extern "C" {
#endif
static NwGtpv1uMsgT *gpGtpv1uMsgPool = NULL;
NwGtpv1uRcT
nwGtpv1uMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NW_IN uint8_t seqNumFlag,
NW_IN uint8_t npduNumFlag,
NW_IN uint8_t extHdrFlag,
NW_IN uint8_t msgType,
NW_IN uint8_t teid,
NW_IN uint16_t seqNum,
NW_IN uint8_t npduNum,
NW_IN uint8_t nextExtHeader,
NW_OUT NwGtpv1uMsgHandleT *phMsg)
{
NwGtpv1uStackT *pStack = (NwGtpv1uStackT *) hGtpuStackHandle;
NwGtpv1uMsgT *pMsg;
if(gpGtpv1uMsgPool) {
pMsg = gpGtpv1uMsgPool;
gpGtpv1uMsgPool = gpGtpv1uMsgPool->next;
} else {
NW_GTPV1U_MALLOC(pStack, sizeof(NwGtpv1uMsgT), pMsg, NwGtpv1uMsgT *);
}
if(pMsg) {
pMsg->version = NW_GTPU_VERSION;
pMsg->protocolType = NW_GTP_PROTOCOL_TYPE_GTP;
pMsg->seqNumFlag = seqNumFlag;
pMsg->npduNumFlag = npduNumFlag;
pMsg->extHdrFlag = extHdrFlag;
pMsg->msgType = msgType;
if(seqNumFlag) {
pMsg->seqNum = seqNum;
}
if(npduNumFlag) {
pMsg->npduNum = npduNum;
}
if(extHdrFlag) {
pMsg->nextExtHdrType = nextExtHeader;
}
pMsg->msgLen = ((pMsg->seqNumFlag || pMsg->npduNumFlag
|| pMsg->extHdrFlag) ?
4 : 0);
//NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE : (NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE - 4));
pMsg->msgBuf = NULL;
pMsg->msgBufLen = 0;
pMsg->msgBufOffset = 0;
*phMsg = (NwGtpv1uMsgHandleT) pMsg;
return NW_GTPV1U_OK;
}
return NW_GTPV1U_FAILURE;
}
NwGtpv1uRcT
nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NW_IN uint32_t teid,
NW_IN uint8_t seqNumFlag,
NW_IN uint16_t seqNum,
NW_IN uint8_t *tpdu,
NW_IN uint16_t tpduLength,
NW_IN uint32_t tpduOffset,
NW_OUT NwGtpv1uMsgHandleT *phMsg)
{
NwGtpv1uStackT *pStack = (NwGtpv1uStackT *) hGtpuStackHandle;
NwGtpv1uMsgT *pMsg;
//uint32_t header_len = 0;
uint32_t msgExtraLen = 0;
if(gpGtpv1uMsgPool) {
pMsg = gpGtpv1uMsgPool;
gpGtpv1uMsgPool = gpGtpv1uMsgPool->next;
} else {
NW_GTPV1U_MALLOC(pStack, sizeof(NwGtpv1uMsgT), pMsg, NwGtpv1uMsgT *);
}
if(pMsg) {
msgExtraLen = (((seqNumFlag) || (NW_FALSE) || (NW_FALSE) ) ?
(NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE - NW_GTPV1U_EPC_MIN_HEADER_SIZE) : 0);
AssertFatal((msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE) <= tpduOffset,
"Mismatch GTPU len, msgExtraLen %u tpduOffset %u",
msgExtraLen,
(uint32_t) tpduOffset);
pMsg->msgBuf = tpdu;
pMsg->msgBufLen = tpduLength + msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE;
pMsg->msgBufOffset = tpduOffset - (msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE);
#if defined(LOG_GTPU) && LOG_GTPU > 0
GTPU_DEBUG("MSG length %u, offset %u -> length %u offset %u\n",
tpduLength, tpduOffset,
pMsg->msgBufLen, pMsg->msgBufOffset);
#endif
// Version field: This field is used to determine the version of the GTP-U protocol.
// The version number shall be set to '1'.
pMsg->version = NW_GTPU_VERSION;
// Protocol Type (PT): This bit is used as a protocol discriminator between GTP (when PT is '1')
// and GTP' (when PT is '0'). GTP is described in this document and the GTP' protocol in 3GPP TS 32.295 [8].
// Note that the interpretation of the header fields may be different in GTP' than in GTP.
pMsg->protocolType = NW_GTP_PROTOCOL_TYPE_GTP;
// Extension Header flag (E): This flag indicates the presence of a meaningful value of the Next Extension
// Header field. When it is set to '0', the Next Extension Header field either is not present or, if present,
// shall not be interpreted.
pMsg->extHdrFlag = NW_FALSE;
// Sequence number flag (S): This flag indicates the presence of a meaningful value of the Sequence Number field.
// When it is set to '0', the Sequence Number field either is not present or, if present, shall not be interpreted.
// When it is set to '1', the Sequence Number field is present, and shall be interpreted, as described below in
// this section.
// For the Echo Request, Echo Response, Error Indication and Supported Extension Headers Notification
// messages, the S flag shall be set to '1'. Since the use of Sequence Numbers is optional for G-PDUs, the PGW,
// SGW, ePDG and eNodeB should set the flag to '0'. However, when a G-PDU (T-PDU+header) is being relayed
// by the Indirect Data Forwarding for Inter RAT HO procedure, then if the received G-PDU has the S flag set to
// '1', then the relaying entity shall set S flag to '1' and forward the G-PDU (T-PDU+header). In an End marker
// message the S flag shall be set to '0'.
pMsg->seqNumFlag = (seqNumFlag? NW_TRUE : NW_FALSE);
pMsg->seqNum = seqNum;
// N-PDU Number flag (PN): This flag indicates the presence of a meaningful value of the N-PDU Number field.
// When it is set to '0', the N-PDU Number field either is not present, or, if present, shall not be interpreted.
// When it is set to '1', the N-PDU Number field is present, and shall be interpreted.
pMsg->npduNumFlag = NW_FALSE;
pMsg->npduNum = 0x00;
// Message Type: This field indicates the type of GTP-U message.
pMsg->msgType = NW_GTP_GPDU;
// 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.
//header_len = ((pMsg->seqNumFlag || pMsg->npduNumFlag || pMsg->extHdrFlag ) ?
// NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE : NW_GTPV1U_EPC_MIN_HEADER_SIZE);
pMsg->msgLen = msgExtraLen + tpduLength;
// 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 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.
pMsg->teid = teid;
pMsg->nextExtHdrType= 0x00;
//memcpy(pMsg->msgBuf + header_len, tpdu, tpduLength);
*phMsg = (NwGtpv1uMsgHandleT) pMsg;
return NW_GTPV1U_OK;
}
return NW_GTPV1U_FAILURE;
}
NwGtpv1uRcT
nwGtpv1uMsgFromMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NW_IN NwGtpv1uMsgHandleT hMsg,
NW_OUT NwGtpv1uMsgHandleT *phMsg)
{
NwGtpv1uStackT *pStack = (NwGtpv1uStackT *) hGtpuStackHandle;
NwGtpv1uMsgT *pMsg;
if(gpGtpv1uMsgPool) {
pMsg = gpGtpv1uMsgPool;
gpGtpv1uMsgPool = gpGtpv1uMsgPool->next;
} else {
NW_GTPV1U_MALLOC(pStack, sizeof(NwGtpv1uMsgT), pMsg, NwGtpv1uMsgT *);
}
if(pMsg) {
memcpy(pMsg, (NwGtpv1uMsgT *)hMsg, sizeof(NwGtpv1uMsgT));
*phMsg = (NwGtpv1uMsgHandleT) pMsg;
return NW_GTPV1U_OK;
}
return NW_GTPV1U_FAILURE;
}
NwGtpv1uRcT
nwGtpv1uMsgFromBufferNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NW_IN uint8_t *pBuf,
NW_IN uint32_t bufLen,
NW_OUT NwGtpv1uMsgHandleT *phMsg)
{
NwGtpv1uStackT *pStack = (NwGtpv1uStackT *) hGtpuStackHandle;
NwGtpv1uMsgT *pMsg;
if(gpGtpv1uMsgPool) {
pMsg = gpGtpv1uMsgPool;
gpGtpv1uMsgPool = gpGtpv1uMsgPool->next;
} else {
NW_GTPV1U_MALLOC(pStack, sizeof(NwGtpv1uMsgT), pMsg, NwGtpv1uMsgT *);
}
if(pMsg) {
pMsg->msgBuf = pBuf;
pMsg->version = ((*pBuf) & 0xE0) >> 5;
pMsg->protocolType = ((*pBuf) & 0x10) >> 4;
pMsg->extHdrFlag = ((*pBuf) & 0x04) >> 2;
pMsg->seqNumFlag = ((*pBuf) & 0x02) >> 1;
pMsg->npduNumFlag = ((*pBuf) & 0x01);
pBuf++;
pMsg->msgType = *(pBuf);
pBuf++;
pBuf += 2;
pMsg->teid = ntohl(*((uint32_t *)pBuf));
pBuf += 4;
if(pMsg->extHdrFlag || pMsg->seqNumFlag || pMsg->npduNumFlag) {
pMsg->seqNum = ntohs(*(((uint16_t *)pBuf)));
pBuf += 2;
pMsg->npduNum = *(pBuf++);
pMsg->nextExtHdrType = *(pBuf++);
}
pMsg->msgBufOffset = (uint32_t)(pBuf - pMsg->msgBuf);
pMsg->msgBufLen = bufLen - pMsg->msgBufOffset;
pMsg->msgLen = bufLen;
#if defined(LOG_GTPU) && LOG_GTPU > 0
GTPU_DEBUG("nwGtpv1uMsgFromBufferNew() msgLen %u msgBufLen %u msgBufOffset %u ",
pMsg->msgLen, pMsg->msgBufLen, pMsg->msgBufOffset);
#endif
*phMsg = (NwGtpv1uMsgHandleT) pMsg;
return NW_GTPV1U_OK;
}
return NW_GTPV1U_FAILURE;
}
NwGtpv1uRcT
nwGtpv1uMsgDelete( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NW_IN NwGtpv1uMsgHandleT hMsg)
{
((NwGtpv1uMsgT *)hMsg)->next = gpGtpv1uMsgPool;
gpGtpv1uMsgPool = (NwGtpv1uMsgT *) hMsg;
return NW_GTPV1U_OK;
}
/**
* Set TEID for gtpv1u message.
*
* @param[in] hMsg : Message handle.
* @param[in] teid: TEID value.
*/
NwGtpv1uRcT
nwGtpv1uMsgSetTeid(NW_IN NwGtpv1uMsgHandleT hMsg, uint32_t teid)
{
NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg;
thiz->teid = teid;
#if defined(LOG_GTPU) && LOG_GTPU > 0
GTPU_DEBUG("nwGtpv1uMsgSetTeid() teid %u", teid);
#endif
return NW_GTPV1U_OK;
}
/**
* Set sequence for gtpv1u message.
*
* @param[in] hMsg : Message handle.
* @param[in] seqNum: Flag boolean value.
*/
NwGtpv1uRcT
nwGtpv1uMsgSetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg, uint32_t seqNum)
{
NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg;
thiz->seqNum = seqNum;
return NW_GTPV1U_OK;
}
/**
* Get TEID present for gtpv1u message.
*
* @param[in] hMsg : Message handle.
*/
uint32_t
nwGtpv1uMsgGetTeid(NW_IN NwGtpv1uMsgHandleT hMsg)
{
NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg;
return (thiz->teid);
}
/**
* Get sequence number for gtpv1u message.
*
* @param[in] hMsg : Message handle.
*/
uint32_t
nwGtpv1uMsgGetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg)
{
NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg;
return (thiz->seqNum);
}
/**
* Get msg type for gtpv1u message.
*
* @param[in] hMsg : Message handle.
*/
uint32_t
nwGtpv1uMsgGetMsgType(NW_IN NwGtpv1uMsgHandleT hMsg)
{
NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg;
return (thiz->msgType);
}
/**
* Get tpdu for gtpv1u message.
*
* @param[in] hMsg : Message handle.
*/
NwGtpv1uRcT
nwGtpv1uMsgGetTpdu(NW_IN NwGtpv1uMsgHandleT hMsg, uint8_t *pTpduBuf,
uint32_t *pTpduLength)
{
NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg;
uint8_t headerLength = ((thiz->seqNumFlag || thiz->extHdrFlag
|| thiz->npduNumFlag) ? 12 : 8);
*pTpduLength = thiz->msgLen - headerLength;
memcpy(pTpduBuf, thiz->msgBuf + headerLength, *pTpduLength);
return NW_GTPV1U_OK;
}
uint8_t *
nwGtpv1uMsgGetTpduHandle(NW_IN NwGtpv1uMsgHandleT hMsg)
{
NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg;
return (thiz->msgBuf + ((thiz->seqNumFlag || thiz->extHdrFlag
|| thiz->npduNumFlag) ? 12 : 8));
}
uint32_t
nwGtpv1uMsgGetTpduLength(NW_IN NwGtpv1uMsgHandleT hMsg)
{
NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg;
return (thiz->msgLen - ((thiz->seqNumFlag || thiz->extHdrFlag
|| thiz->npduNumFlag) ? 12 : 8));
}
NwGtpv1uRcT
nwGtpv1uMsgAddIeTV1(NW_IN NwGtpv1uMsgHandleT hMsg,
NW_IN uint8_t type,
NW_IN uint8_t value)
{
NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg;
NwGtpv1uIeTv1T *pIe;
pIe = (NwGtpv1uIeTv1T *) (pMsg->msgBuf + pMsg->msgLen);
pIe->t = type;
pIe->v = value;
pMsg->msgLen += sizeof(NwGtpv1uIeTv1T);
return NW_GTPV1U_OK;
}
NwGtpv1uRcT
nwGtpv1uMsgAddIeTV2(NW_IN NwGtpv1uMsgHandleT hMsg,
NW_IN uint8_t type,
NW_IN uint16_t length,
NW_IN uint16_t value)
{
NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg;
NwGtpv1uIeTv2T *pIe;
pIe = (NwGtpv1uIeTv2T *) (pMsg->msgBuf + pMsg->msgLen);
pIe->t = type;
pIe->v = htons(value);
pMsg->msgLen += sizeof(NwGtpv1uIeTv2T);
return NW_GTPV1U_OK;
}
NwGtpv1uRcT
nwGtpv1uMsgAddIeTV4(NW_IN NwGtpv1uMsgHandleT hMsg,
NW_IN uint8_t type,
NW_IN uint16_t length,
NW_IN uint32_t value)
{
NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg;
NwGtpv1uIeTv4T *pIe;
pIe = (NwGtpv1uIeTv4T *) (pMsg->msgBuf + pMsg->msgLen);
pIe->t = type;
pIe->v = htonl(value);
pMsg->msgLen += sizeof(NwGtpv1uIeTv4T);
return NW_GTPV1U_OK;
}
NwGtpv1uRcT
nwGtpv1uMsgAddIe(NW_IN NwGtpv1uMsgHandleT hMsg,
NW_IN uint8_t type,
NW_IN uint16_t length,
NW_IN uint8_t *pVal)
{
NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg;
NwGtpv1uIeTlvT *pIe;
pIe = (NwGtpv1uIeTlvT *) (pMsg->msgBuf + pMsg->msgLen);
pIe->t = type;
pIe->l = htons(length);
memcpy(pIe + 4, pVal, length);
pMsg->msgLen += (4 + length);
return NW_GTPV1U_OK;
}
NwGtpv1uRcT
nwGtpv1uMsgHexDump(NwGtpv1uMsgHandleT hMsg, FILE *fp)
{
NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg;
uint8_t *data = pMsg->msgBuf;
uint32_t size = pMsg->msgLen;
unsigned char *p = (unsigned char *)data;
unsigned char c;
int n;
char bytestr[4] = {0};
char addrstr[10] = {0};
char hexstr[ 16*3 + 5] = {0};
char charstr[16*1 + 5] = {0};
fprintf((FILE *)fp, "\n");
for(n=1; n<=size; n++) {
if (n%16 == 1) {
/* store address for this line */
snprintf(addrstr, sizeof(addrstr), "%.4lx",
(p-data) );
}
c = *p;
if (isalnum(c) == 0) {
c = '.';
}
/* store hex str (for left side) */
snprintf(bytestr, sizeof(bytestr), "%02X ", *p);
strncat(hexstr, bytestr, sizeof(hexstr)-strlen(hexstr)-1);
/* store char str (for right side) */
snprintf(bytestr, sizeof(bytestr), "%c", c);
strncat(charstr, bytestr, sizeof(charstr)-strlen(charstr)-1);
if(n%16 == 0) {
/* line completed */
fprintf((FILE *)fp, "[%4.4s] %-50.50s %s\n", addrstr, hexstr, charstr);
hexstr[0] = 0;
charstr[0] = 0;
} else if(n%8 == 0) {
/* half line: add whitespaces */
strncat(hexstr, " ", sizeof(hexstr)-strlen(hexstr)-1);
strncat(charstr, " ", sizeof(charstr)-strlen(charstr)-1);
}
p++; /* next byte */
}
if (strlen(hexstr) > 0) {
/* print rest of buffer if not empty */
fprintf((FILE *)fp, "[%4.4s] %-50.50s %s\n", addrstr, hexstr, charstr);
}
fprintf((FILE *)fp, "\n");
return NW_GTPV1U_OK;
}
#ifdef __cplusplus
}
#endif
/*--------------------------------------------------------------------------*
* E N D O F F I L E *
*--------------------------------------------------------------------------*/
@@ -1,399 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* n w - g t p v 2 u *
* G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k *
* *
* *
* Copyright (c) 2010-2011 Amit Chawre *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* 3. The name of the author may not be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*----------------------------------------------------------------------------*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "NwTypes.h"
#include "NwLog.h"
#include "NwUtils.h"
#include "NwGtpv1uLog.h"
#include "NwGtpv1u.h"
#include "NwGtpv1uPrivate.h"
#include "NwGtpv1uTrxn.h"
/*--------------------------------------------------------------------------*
* P R I V A T E D E C L A R A T I O N S *
*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif
static NwGtpv1uTrxnT *gpGtpv1uTrxnPool = NULL;
/*--------------------------------------------------------------------------*
* P R I V A T E F U N C T I O N S *
*--------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------
* Send msg retransmission to peer via data request to UDP Entity
*--------------------------------------------------------------------------*/
static NwGtpv1uRcT
nwGtpv1uTrxnSendMsgRetransmission(NwGtpv1uTrxnT *thiz)
{
NwGtpv1uRcT rc;
NW_ASSERT(thiz);
NW_ASSERT(thiz->pMsg);
rc = thiz->pStack->udp.udpDataReqCallback(thiz->pStack->udp.hUdp,
thiz->pMsg->msgBuf,
thiz->pMsg->msgLen,
thiz->pMsg->msgBufOffset,
thiz->peerIp,
thiz->peerPort);
return rc;
}
static NwGtpv1uRcT
nwGtpv1uTrxnPeerRspTimeout(void *arg)
{
NwGtpv1uRcT rc = NW_GTPV1U_OK;
NwGtpv1uTrxnT *thiz;
NwGtpv1uStackT *pStack;
NwGtpv1uTimeoutInfoT *timeoutInfo = arg;
thiz = ((NwGtpv1uTrxnT *)timeoutInfo->timeoutArg);
pStack = thiz->pStack;
NW_ASSERT(pStack);
NW_LOG(pStack, NW_LOG_LEVEL_WARN, "T3 timer expired for transaction 0x%p",
thiz);
rc = nwGtpv1uTrxnSendMsgRetransmission(thiz);
if(thiz->maxRetries) {
rc = pStack->tmrMgr.tmrStartCallback(pStack->tmrMgr.tmrMgrHandle,
thiz->t3Timer, 0, NW_GTPV1U_TMR_TYPE_ONE_SHOT, (void *)timeoutInfo,
&thiz->hRspTmr);
thiz->maxRetries--;
} else {
NwGtpv1uUlpApiT ulpApi;
ulpApi.apiType = NW_GTPV1U_ULP_API_RSP_FAILURE;
ulpApi.apiInfo.recvMsgInfo.msgType = nwGtpv1uMsgGetMsgType((
NwGtpv1uMsgHandleT)thiz->pMsg);
ulpApi.apiInfo.recvMsgInfo.hUlpTrxn = thiz->hUlpTrxn;
ulpApi.apiInfo.recvMsgInfo.peerIp = thiz->peerIp;
ulpApi.apiInfo.recvMsgInfo.peerPort = thiz->peerPort;
thiz->hRspTmr = 0;
rc = nwGtpv1uTrxnDelete(&thiz);
NW_ASSERT(rc == NW_GTPV1U_OK);
rc = pStack->ulp.ulpReqCallback(pStack->ulp.hUlp, &ulpApi);
NW_ASSERT(rc == NW_GTPV1U_OK);
}
return rc;
}
/**
Send timer start request to TmrMgr Entity.
@param[in] thiz : Pointer to transaction
@param[in] timeoutCallbackFunc : Timeout handler callback function.
@return NW_GTPV1U_OK on success.
*/
static NwGtpv1uRcT
nwGtpv1uTrxnStartPeerRspTimer(NwGtpv1uTrxnT *thiz,
NwGtpv1uRcT (*timeoutCallbackFunc)(void *))
{
NwGtpv1uRcT rc;
NwGtpv1uTimeoutInfoT *timeoutInfo;
NW_ASSERT(thiz->pStack->tmrMgr.tmrStartCallback != NULL);
timeoutInfo = &thiz->peerRspTimeoutInfo;
timeoutInfo->timeoutArg = thiz;
timeoutInfo->timeoutCallbackFunc = timeoutCallbackFunc;
timeoutInfo->hStack = (NwGtpv1uStackHandleT)thiz->pStack;
rc = thiz->pStack->tmrMgr.tmrStartCallback(thiz->pStack->tmrMgr.tmrMgrHandle,
thiz->t3Timer, 0, NW_GTPV1U_TMR_TYPE_ONE_SHOT, (void *)timeoutInfo,
&thiz->hRspTmr);
return rc;
}
/**
Send timer stop request to TmrMgr Entity.
@param[in] thiz : Pointer to transaction
@return NW_GTPV1U_OK on success.
*/
static NwGtpv1uRcT
nwGtpv1uTrxnStopPeerRspTimer(NwGtpv1uTrxnT *thiz)
{
NwGtpv1uRcT rc;
NW_ASSERT(thiz->pStack->tmrMgr.tmrStopCallback != NULL);
rc = thiz->pStack->tmrMgr.tmrStopCallback(thiz->pStack->tmrMgr.tmrMgrHandle,
thiz->hRspTmr);
thiz->hRspTmr = 0;
return rc;
}
/*--------------------------------------------------------------------------*
* P U B L I C F U N C T I O N S *
*--------------------------------------------------------------------------*/
/**
* Constructor
*
* @param[in] thiz : Pointer to stack
* @param[out] ppTrxn : Pointer to pointer to Trxn object.
* @return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpv1uTrxnNew( NW_IN NwGtpv1uStackT *thiz,
NW_OUT NwGtpv1uTrxnT **ppTrxn)
{
NwGtpv1uRcT rc = NW_GTPV1U_OK;
NwGtpv1uTrxnT *pTrxn;
if(gpGtpv1uTrxnPool) {
pTrxn = gpGtpv1uTrxnPool;
gpGtpv1uTrxnPool = gpGtpv1uTrxnPool->next;
} else {
NW_GTPV1U_MALLOC(thiz, sizeof(NwGtpv1uTrxnT), pTrxn, NwGtpv1uTrxnT *);
}
if (pTrxn) {
pTrxn->maxRetries = 2;
pTrxn->pStack = thiz;
pTrxn->t3Timer = 2;
pTrxn->seqNum = thiz->seq;
/* Increment sequence number */
thiz->seq++;
if(thiz->seq == 0x800000) {
thiz->seq = 0;
}
} else {
rc = NW_GTPV1U_FAILURE;
}
NW_LOG(thiz, NW_LOG_LEVEL_DEBG, "Created transaction 0x%p", pTrxn);
*ppTrxn = pTrxn;
return rc;
}
/**
* Overloaded Constructor
*
* @param[in] thiz : Pointer to stack.
* @param[in] seqNum : Sequence number for this transaction.
* @param[out] ppTrxn : Pointer to pointer to Trxn object.
* @return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpv1uTrxnWithSeqNew( NW_IN NwGtpv1uStackT *thiz,
NW_IN uint32_t seqNum,
NW_OUT NwGtpv1uTrxnT **ppTrxn)
{
NwGtpv1uRcT rc = NW_GTPV1U_OK;
NwGtpv1uTrxnT *pTrxn;
if(gpGtpv1uTrxnPool) {
pTrxn = gpGtpv1uTrxnPool;
gpGtpv1uTrxnPool = gpGtpv1uTrxnPool->next;
} else {
NW_GTPV1U_MALLOC(thiz, sizeof(NwGtpv1uTrxnT), pTrxn, NwGtpv1uTrxnT *);
}
if (pTrxn) {
pTrxn->maxRetries = 2;
pTrxn->pStack = thiz;
pTrxn->t3Timer = 2;
pTrxn->seqNum = seqNum;
pTrxn->pMsg = NULL;
} else {
rc = NW_GTPV1U_FAILURE;
}
NW_LOG(thiz, NW_LOG_LEVEL_DEBG, "Created transaction 0x%p", pTrxn);
*ppTrxn = pTrxn;
return rc;
}
/**
* Destructor
*
* @param[out] pthiz : Pointer to pointer to Trxn object.
* @return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpv1uTrxnDelete( NW_INOUT NwGtpv1uTrxnT **pthiz)
{
NwGtpv1uRcT rc = NW_GTPV1U_OK;
NwGtpv1uStackT *pStack;
NwGtpv1uTrxnT *thiz = *pthiz;
pStack = thiz->pStack;
if(thiz->hRspTmr) {
rc = nwGtpv1uTrxnStopPeerRspTimer(thiz);
NW_ASSERT(rc == NW_GTPV1U_OK);
}
if(thiz->pMsg) {
rc = nwGtpv1uMsgDelete((NwGtpv1uStackHandleT)pStack,
(NwGtpv1uMsgHandleT)thiz->pMsg);
NW_ASSERT(rc == NW_GTPV1U_OK);
}
thiz->next = gpGtpv1uTrxnPool;
gpGtpv1uTrxnPool = thiz;
NW_LOG(pStack, NW_LOG_LEVEL_DEBG, "Purged transaction 0x%p", thiz);
*pthiz = NULL;
return rc;
}
#if 1
/**
* Send msg to peer via data request to UDP Entity
*
* @param[in] thiz : Pointer to stack.
* @param[in] pTrxn : Pointer to Trxn object.
* @param[in] peerIp : Peer Ip address.
* @param[in] peerPort : Peer Ip port.
* @param[in] pMsg : Message to be sent.
* @return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpv1uTrxnCreateAndSendMsg( NW_IN NwGtpv1uStackT *thiz,
NW_IN NwGtpv1uTrxnT *pTrxn,
NW_IN uint32_t peerIp,
NW_IN uint32_t peerPort,
NW_IN NwGtpv1uMsgT *pMsg)
{
NwGtpv1uRcT rc;
uint8_t *msgHdr;
NW_ASSERT(thiz);
NW_ASSERT(pMsg);
msgHdr = &pMsg->msgBuf[pMsg->msgBufOffset];
NW_ASSERT(msgHdr != NULL);
*(msgHdr++) = (pMsg->version << 5) |
(pMsg->protocolType << 4) |
(pMsg->extHdrFlag << 2) |
(pMsg->seqNumFlag << 1) |
(pMsg->npduNumFlag);
*(msgHdr++) = (pMsg->msgType);
*((uint16_t *) msgHdr) = htons(pMsg->msgLen);
msgHdr += 2;
*((uint32_t *) msgHdr) = htonl(pMsg->teid);
msgHdr += 4;
if(pMsg->seqNumFlag | pMsg->extHdrFlag | pMsg->npduNumFlag) {
if(pMsg->seqNumFlag) {
*((uint16_t *) msgHdr) = htons((pTrxn ? pTrxn->seqNum : pMsg->seqNum));
} else {
*((uint16_t *) msgHdr) = 0x0000;
}
msgHdr += 2;
if(pMsg->npduNumFlag) {
*((uint8_t *) msgHdr) = pMsg->npduNumFlag;
} else {
*((uint8_t *) msgHdr) = 0x00;
}
msgHdr++;
if(pMsg->extHdrFlag) {
*((uint8_t *) msgHdr) = pMsg->extHdrFlag;
} else {
*((uint8_t *) msgHdr) = 0x00;
}
msgHdr++;
}
NW_ASSERT(thiz->udp.udpDataReqCallback != NULL);
rc = thiz->udp.udpDataReqCallback(thiz->udp.hUdp,
pMsg->msgBuf,
pMsg->msgLen,
pMsg->msgBufOffset,
peerIp,
peerPort);
/* Save the message for retransmission */
if(rc == NW_GTPV1U_OK && pTrxn) {
pTrxn->pMsg = pMsg;
pTrxn->peerIp = peerIp;
pTrxn->peerPort = peerPort;
rc = nwGtpv1uTrxnStartPeerRspTimer(pTrxn, nwGtpv1uTrxnPeerRspTimeout);
NW_ASSERT(rc == NW_GTPV1U_OK);
}
return rc;
}
#endif
#ifdef __cplusplus
}
#endif
/*--------------------------------------------------------------------------*
* E N D O F F I L E *
*--------------------------------------------------------------------------*/
@@ -1,135 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* n w - g t p v 2 u *
* G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k *
* *
* *
* Copyright (c) 2010-2011 Amit Chawre *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* 3. The name of the author may not be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*----------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "NwTypes.h"
#include "NwUtils.h"
#include "NwGtpv1uError.h"
#include "NwGtpv1uPrivate.h"
#include "NwGtpv1uMsg.h"
#include "NwGtpv1uTunnelEndPoint.h"
#include "NwGtpv1u.h"
#include "NwGtpv1uLog.h"
#ifdef __cplusplus
extern "C" {
#endif
/*--------------------------------------------------------------------------*
* P R I V A T E D E C L A R A T I O N S *
*--------------------------------------------------------------------------*/
static NwGtpv1uTunnelEndPointT *gpTunnelEndPointPool = NULL;
/*--------------------------------------------------------------------------*
* P U B L I C F U N C T I O N S *
*--------------------------------------------------------------------------*/
/**
Constructor
@param[in] msid: MSID
@param[in] peerAddr: Address of the peer.
@return Pointer to Session on success, NULL on failure.
*/
NwGtpv1uTunnelEndPointT *
nwGtpTunnelEndPointNew(struct NwGtpv1uStack *pStack)
{
NwGtpv1uTunnelEndPointT *thiz;
if(gpTunnelEndPointPool) {
thiz = gpTunnelEndPointPool;
gpTunnelEndPointPool = gpTunnelEndPointPool->next;
} else {
NW_GTPV1U_MALLOC(pStack, sizeof(NwGtpv1uTunnelEndPointT), thiz,
NwGtpv1uTunnelEndPointT *);
}
return thiz;
}
/**
Destructor
@param[in] thiz: Pointer to session
@return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpTunnelEndPointDestroy(struct NwGtpv1uStack *pStack,
NwGtpv1uTunnelEndPointT *thiz)
{
thiz->next = gpTunnelEndPointPool;
gpTunnelEndPointPool = thiz;
return NW_GTPV1U_OK;
}
/**
Purge a Transaction for a Session.
@param[in] thiz: Pointer to session
@param[in,out] pTrxn: Pointer to the trxn.
@return NW_GTPV1U_OK on success.
*/
NwGtpv1uRcT
nwGtpSessionSendMsgApiToUlpEntity(NwGtpv1uTunnelEndPointT *thiz,
NwGtpv1uMsgT *pMsg)
{
NwGtpv1uRcT rc = NW_GTPV1U_OK;
NwGtpv1uUlpApiT api;
api.apiType = NW_GTPV1U_ULP_API_RECV_TPDU;
api.apiInfo.recvMsgInfo.hUlpSession = thiz->hUlpSession;
api.apiInfo.recvMsgInfo.teid = thiz->teid;
api.apiInfo.recvMsgInfo.hMsg = (NwGtpv1uMsgHandleT)pMsg;
NW_ASSERT(thiz->pStack->ulp.ulpReqCallback != NULL);
thiz->pStack->ulp.ulpReqCallback(thiz->pStack->ulp.hUlp, &api);
return rc;
}
#ifdef __cplusplus
}
#endif
/*--------------------------------------------------------------------------*
* E N D O F F I L E *
*--------------------------------------------------------------------------*/
@@ -1,5 +0,0 @@
# this is example-file: Makefile.am
# the subdirectories of the project to go into
SUBDIRS = \
nw-helloworld
@@ -1,461 +0,0 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# this is example-file: Makefile.am
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = nw-gtpv1u/test-app
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_CFLAGS = @AM_CFLAGS@
AM_LDFLAGS = @AM_LDFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
# the subdirectories of the project to go into
SUBDIRS = \
nw-helloworld
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu nw-gtpv1u/test-app/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu nw-gtpv1u/test-app/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
am__remove_distdir=: \
am__skip_length_check=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-exec-am:
install-html: install-html-recursive
install-info: install-info-recursive
install-man:
install-pdf: install-pdf-recursive
install-ps: install-ps-recursive
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
install-strip
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-generic ctags \
ctags-recursive distclean distclean-generic distclean-tags \
distdir dvi dvi-am html html-am info info-am install \
install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
tags-recursive uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
@@ -1,17 +0,0 @@
bin_PROGRAMS = helloworld
AM_CFLAGS = -D__WITH_LIBEVENT__ -I../../shared -I../../include -I../../test-app/nw-udp -I../../test-app/nw-log @AM_CFLAGS@
helloworld_SOURCES = \
NwEvt.h\
NwMiniLogMgrEntity.h\
NwMiniTmrMgrEntity.h\
NwMiniUlpEntity.h\
NwMiniUdpEntity.h\
NwMiniLogMgrEntity.c\
NwMiniTmrMgrEntity.c\
NwMiniUlpEntity.c\
NwMiniUdpEntity.c\
helloworld.c
helloworld_LDADD = ../../src/libNwGtpv1u.a -levent $(AM_LDFLAGS)
@@ -1,433 +0,0 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
bin_PROGRAMS = helloworld$(EXEEXT)
subdir = nw-gtpv1u/test-app/nw-helloworld
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_helloworld_OBJECTS = NwMiniLogMgrEntity.$(OBJEXT) \
NwMiniTmrMgrEntity.$(OBJEXT) NwMiniUlpEntity.$(OBJEXT) \
NwMiniUdpEntity.$(OBJEXT) helloworld.$(OBJEXT)
helloworld_OBJECTS = $(am_helloworld_OBJECTS)
am__DEPENDENCIES_1 =
helloworld_DEPENDENCIES = ../../src/libNwGtpv1u.a \
$(am__DEPENDENCIES_1)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(helloworld_SOURCES)
DIST_SOURCES = $(helloworld_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_CFLAGS = -D__WITH_LIBEVENT__ -I../../shared -I../../include -I../../test-app/nw-udp -I../../test-app/nw-log @AM_CFLAGS@
AM_LDFLAGS = @AM_LDFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
helloworld_SOURCES = \
NwEvt.h\
NwMiniLogMgrEntity.h\
NwMiniTmrMgrEntity.h\
NwMiniUlpEntity.h\
NwMiniUdpEntity.h\
NwMiniLogMgrEntity.c\
NwMiniTmrMgrEntity.c\
NwMiniUlpEntity.c\
NwMiniUdpEntity.c\
helloworld.c
helloworld_LDADD = ../../src/libNwGtpv1u.a -levent $(AM_LDFLAGS)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu nw-gtpv1u/test-app/nw-helloworld/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu nw-gtpv1u/test-app/nw-helloworld/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
helloworld$(EXEEXT): $(helloworld_OBJECTS) $(helloworld_DEPENDENCIES)
@rm -f helloworld$(EXEEXT)
$(LINK) $(helloworld_OBJECTS) $(helloworld_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NwMiniLogMgrEntity.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NwMiniTmrMgrEntity.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NwMiniUdpEntity.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NwMiniUlpEntity.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helloworld.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-exec-am: install-binPROGRAMS
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-binPROGRAMS \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-binPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
@@ -1,80 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* Copyright (c) 2010-2011 Amit Chawre *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* 3. The name of the author may not be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*----------------------------------------------------------------------------*/
#ifndef __NW_EVT_H__
#define __NW_EVT_H__
/**
* @file NwEvt.h
* @brief
*/
#ifdef __WITH_LIBEVENT__
#include <event.h>
typedef struct event NwEventT;
#define NW_EVT_READ (EV_READ)
#define NW_EVT_PERSIST (EV_PERSIST)
#define NW_EVT_CALLBACK(__cbFunc) __cbFunc(int fd, short event, void *arg)
#define NW_TMR_CALLBACK(__cbFunc) __cbFunc(int fd, short event, void *arg)
#define NW_EVT_INIT event_init
#define NW_EVT_LOOP event_dispatch
#define NW_EVENT_ADD(__ev, __evSelObj, __evCallback, __evCallbackArg, __evFlags) \
do { \
event_set(&(__ev), __evSelObj, __evFlags, __evCallback, __evCallbackArg); \
event_add(&(__ev), NULL); \
} while(0)
#else
#warning "Event library not defined!"
/* HACK : Defining dummy values for compilation!*/
typedef struct {
int __tbd;
} NwEventT;
#define NW_EVT_READ (0)
#define NW_EVT_PERSIST (1)
#define NW_EVT_CALLBACK(__cbFunc) __cbFunc(void *arg)
#define NW_TMR_CALLBACK(__cbFunc) __cbFunc(void *arg)
#define NW_EVT_INIT() do { printf("error: Event library not defined!\n"); exit (0); } while(0)
#define NW_EVT_LOOP() do { printf("error: Event library not defined!\n"); exit (0); } while(0)
#define NW_EVENT_ADD(...) do { printf("error: Event library not defined!\n"); exit (0); } while(0)
#endif
#endif /* __NW_EVT_H__ */
@@ -1,62 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* M I N I M A L I S T I C L O G M G R E N T I T Y *
* *
* Copyright (C) 2010 Amit Chawre. *
* *
*----------------------------------------------------------------------------*/
/**
* @file hello-world.c
* @brief This file contains example of a minimalistic log manager entity.
*/
#include <stdio.h>
#include <assert.h>
#include "NwLog.h"
#include "NwEvt.h"
#include "NwGtpv1u.h"
#include "NwMiniLogMgrEntity.h"
#ifdef __cplusplus
extern "C" {
#endif
uint32_t g_log_level = NW_LOG_LEVEL_INFO;
/*---------------------------------------------------------------------------
* Public functions
*--------------------------------------------------------------------------*/
NwGtpv1uRcT nwMiniLogMgrInit(NwMiniLogMgrT *thiz, uint32_t logLevel )
{
thiz->logLevel = logLevel;
return NW_GTPV1U_OK;
}
NwGtpv1uRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT *thiz, uint32_t logLevel)
{
thiz->logLevel = logLevel;
}
NwGtpv1uRcT nwMiniLogMgrLogRequest (NwGtpv1uLogMgrHandleT hLogMgr,
uint32_t logLevel,
NwCharT *file,
uint32_t line,
NwCharT *logStr)
{
NwMiniLogMgrT *thiz = (NwMiniLogMgrT *) hLogMgr;
if(thiz->logLevel >= logLevel) {
printf("NWGTPv2U-STK %s - %s <%s,%u>\n", gLogLevelStr[logLevel], logStr,
basename(file), line);
}
return NW_GTPV1U_OK;
}
#ifdef __cplusplus
}
#endif
@@ -1,57 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* M I N I M A L I S T I C L O G M G R E N T I T Y *
* *
* Copyright (C) 2010 Amit Chawre. *
* *
*----------------------------------------------------------------------------*/
/**
* @file hello-world.c
* @brief This file contains example of a minimalistic log manager entity.
*/
#include <stdio.h>
#include <assert.h>
#include "NwEvt.h"
#include "NwLog.h"
#ifndef __NW_MINI_LOG_MGR_H__
#define __NW_MINI_LOG_MGR_H__
#ifndef NW_ASSERT
#define NW_ASSERT assert
#endif
extern uint32_t g_log_level;
#define NW_LOG( _logLevel, ...) \
do { \
if(g_log_level >= _logLevel) \
{ \
char _logStr[1024]; \
snprintf(_logStr, 1024, __VA_ARGS__); \
printf("NWGTPv2U-APP %s - %s <%s,%d>\n", gLogLevelStr[_logLevel], _logStr, basename(__FILE__), __LINE__);\
} \
} while(0)
typedef struct {
uint8_t logLevel;
} NwMiniLogMgrT;
#ifdef __cplusplus
extern "C" {
#endif
NwGtpv1uRcT nwMiniLogMgrLogRequest (NwGtpv1uLogMgrHandleT logMgrHandle,
uint32_t logLevel,
NwCharT* file,
uint32_t line,
NwCharT* logStr);
#ifdef __cplusplus
}
#endif
#endif
@@ -1,101 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* M I N I M A L I S T I C T M R M G R E N T I T Y *
* *
* Copyright (C) 2010 Amit Chawre. *
* *
*----------------------------------------------------------------------------*/
/**
* @file NwMiniTmrMgrEntity.c
* @brief This file ontains example of a minimalistic timer manager entity.
*/
#include <stdio.h>
#include <assert.h>
#include "NwEvt.h"
#include "NwGtpv1u.h"
#include "NwMiniLogMgrEntity.h"
#include "NwMiniTmrMgrEntity.h"
#ifndef NW_ASSERT
#define NW_ASSERT assert
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*---------------------------------------------------------------------------
* Private functions
*--------------------------------------------------------------------------*/
static void
NW_TMR_CALLBACK(nwMiniTmrMgrHandleTimeout)
{
NwGtpv1uRcT rc;
NwMiniTmrMgrEntityT *pTmr = (NwMiniTmrMgrEntityT *) arg;
/*---------------------------------------------------------------------------
* Send Timeout Request to GTPv1u Stack Instance
*--------------------------------------------------------------------------*/
rc = nwGtpv1uProcessTimeout(pTmr->timeoutArg);
NW_ASSERT( rc == NW_GTPV1U_OK );
free(pTmr);
return;
}
/*---------------------------------------------------------------------------
* Public functions
*--------------------------------------------------------------------------*/
NwGtpv1uRcT nwTimerStart( NwGtpv1uTimerMgrHandleT tmrMgrHandle,
uint32_t timeoutSec,
uint32_t timeoutUsec,
uint32_t tmrType,
void *timeoutArg,
NwGtpv1uTimerHandleT *hTmr)
{
NwGtpv1uRcT rc = NW_GTPV1U_OK;
NwMiniTmrMgrEntityT *pTmr;
struct timeval tv;
NW_LOG(NW_LOG_LEVEL_INFO,
"Received start timer request from stack with timer type %d , arg %x, for %d sec and %d usec",
tmrType, (unsigned int)timeoutArg, timeoutSec, timeoutUsec);
pTmr = (NwMiniTmrMgrEntityT *) malloc (sizeof(NwMiniTmrMgrEntityT));
/* set the timevalues*/
timerclear(&tv);
tv.tv_sec = timeoutSec;
tv.tv_usec = timeoutUsec;
pTmr->timeoutArg = timeoutArg;
evtimer_set(&pTmr->ev, nwMiniTmrMgrHandleTimeout, pTmr);
/*add event*/
event_add(&(pTmr->ev), &tv);
*hTmr = (NwGtpv1uTimerHandleT)pTmr;
return rc;
}
NwGtpv1uRcT nwTimerStop( NwGtpv1uTimerMgrHandleT tmrMgrHandle,
NwGtpv1uTimerHandleT hTmr)
{
NW_LOG(NW_LOG_LEVEL_INFO,
"Received stop timer request from stack for timer handle %d", hTmr);
evtimer_del(&(((NwMiniTmrMgrEntityT *)hTmr)->ev));
free((void *)hTmr);
return NW_GTPV1U_OK;
}
#ifdef __cplusplus
}
#endif
@@ -1,53 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* M I N I M A L I S T I C T M R M G R E N T I T Y *
* *
* Copyright (C) 2010 Amit Chawre. *
* *
*----------------------------------------------------------------------------*/
/**
* @file NwMiniTmrMgrEntity.c
* @brief This file ontains example of a minimalistic timer manager entity.
*/
#include <stdio.h>
#include <assert.h>
#include "NwEvt.h"
#include "NwLog.h"
#ifndef __NW_MINI_TMR_MGR_H__
#define __NW_MINI_TMR_MGR_H__
#ifndef NW_ASSERT
#define NW_ASSERT assert
#endif
typedef struct {
NwEventT ev;
void* timeoutArg;
} NwMiniTmrMgrEntityT;
#ifdef __cplusplus
extern "C" {
#endif
NwGtpv1uRcT nwTimerStart( NwGtpv1uTimerMgrHandleT tmrMgrHandle,
uint32_t timeoutSec,
uint32_t timeoutUsec,
uint32_t tmrType,
void* timeoutArg,
NwGtpv1uTimerHandleT* hTmr);
NwGtpv1uRcT nwTimerStop( NwGtpv1uTimerMgrHandleT tmrMgrHandle,
NwGtpv1uTimerHandleT hTmr);
#ifdef __cplusplus
}
#endif
#endif
@@ -1,157 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* M I N I M A L I S T I C U D P E N T I T Y *
* *
* Copyright (C) 2010 Amit Chawre. *
* *
*----------------------------------------------------------------------------*/
/**
* @file NwMiniUdpEntity.c
* @brief This file contains example of a minimalistic ULP entity.
*/
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include "NwEvt.h"
#include "NwGtpv1u.h"
#include "NwMiniLogMgrEntity.h"
#include "NwMiniUdpEntity.h"
#ifndef NW_ASSERT
#define NW_ASSERT assert
#endif
#define MAX_UDP_PAYLOAD_LEN (4096)
#ifdef __cplusplus
extern "C" {
#endif
/*---------------------------------------------------------------------------
* Private functions
*--------------------------------------------------------------------------*/
static
void NW_TMR_CALLBACK(nwUdpDataIndicationCallbackData)
{
NwGtpv1uRcT rc;
uint8_t udpBuf[MAX_UDP_PAYLOAD_LEN];
NwS32T bytesRead;
uint32_t peerLen;
struct sockaddr_in peer;
NwMiniUdpEntityT *thiz = (NwMiniUdpEntityT *) arg;
peerLen = sizeof(peer);
bytesRead = recvfrom(thiz->hSocket, udpBuf, MAX_UDP_PAYLOAD_LEN , 0,
(struct sockaddr *) &peer,(socklen_t *) &peerLen);
if(bytesRead) {
NW_LOG(NW_LOG_LEVEL_DEBG, "Received UDP message of length %u from %X:%u",
bytesRead, ntohl(peer.sin_addr.s_addr), ntohs(peer.sin_port));
rc = nwGtpv1uProcessUdpReq(thiz->hGtpv1uStack, udpBuf, bytesRead,
peer.sin_port, peer.sin_addr.s_addr);
} else {
NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno));
}
}
/*---------------------------------------------------------------------------
* Public functions
*--------------------------------------------------------------------------*/
NwGtpv1uRcT nwMiniUdpInit(NwMiniUdpEntityT *thiz,
NwGtpv1uStackHandleT hGtpv1uStack, uint8_t *ipAddr)
{
int sd;
struct sockaddr_in addr;
sd = socket(AF_INET, SOCK_DGRAM, 0);
if (sd < 0) {
NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno));
NW_ASSERT(0);
}
addr.sin_family = AF_INET;
addr.sin_port = htons(2152);
addr.sin_addr.s_addr = inet_addr(ipAddr);
memset(addr.sin_zero, '\0', sizeof (addr.sin_zero));
if(bind(sd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno));
NW_ASSERT(0);
}
event_set(&(thiz->ev), sd, EV_READ|EV_PERSIST, nwUdpDataIndicationCallbackData,
thiz);
event_add(&(thiz->ev), NULL);
thiz->hSocket = sd;
thiz->hGtpv1uStack = hGtpv1uStack;
return NW_GTPV1U_OK;
}
NwGtpv1uRcT nwMiniUdpDestroy(NwMiniUdpEntityT *thiz)
{
close(thiz->hSocket);
}
NwGtpv1uRcT nwMiniUdpDataReq(NwGtpv1uUdpHandleT udpHandle,
uint8_t *dataBuf,
uint32_t dataSize,
uint32_t peerIpAddr,
uint32_t peerPort)
{
struct sockaddr_in peerAddr;
NwS32T bytesSent;
NwMiniUdpEntityT *thiz = (NwMiniUdpEntityT *) udpHandle;
peerAddr.sin_family = AF_INET;
peerAddr.sin_port = htons(peerPort);
peerAddr.sin_addr.s_addr = (peerIpAddr);
memset(peerAddr.sin_zero, '\0', sizeof (peerAddr.sin_zero));
NW_LOG(NW_LOG_LEVEL_DEBG,
"Sending %u bytes on handle 0x%x to peer %u.%u.%u.%u:%u", dataSize, udpHandle,
(peerIpAddr & 0x000000ff),
(peerIpAddr & 0x0000ff00) >> 8,
(peerIpAddr & 0x00ff0000) >> 16,
(peerIpAddr & 0xff000000) >> 24,
peerPort);
bytesSent = sendto (thiz->hSocket, dataBuf, dataSize, 0,
(struct sockaddr *) &peerAddr, sizeof(peerAddr));
if(bytesSent < 0) {
NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno));
} else {
NW_LOG(NW_LOG_LEVEL_DEBG, "Sent %u bytes on handle 0x%x to peer %u.%u.%u.%u",
dataSize, udpHandle,
(peerIpAddr & 0x000000ff),
(peerIpAddr & 0x0000ff00) >> 8,
(peerIpAddr & 0x00ff0000) >> 16,
(peerIpAddr & 0xff000000) >> 24);
}
return NW_GTPV1U_OK;
}
#ifdef __cplusplus
}
#endif
@@ -1,51 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* M I N I M A L I S T I C U D P E N T I T Y *
* *
* Copyright (C) 2010 Amit Chawre. *
* *
*----------------------------------------------------------------------------*/
/**
* @file NwMiniUdpEntity.h
* @brief This file contains example of a minimalistic ULP entity.
*/
#include <stdio.h>
#include <assert.h>
#include "NwEvt.h"
#include "NwLog.h"
#ifndef __NW_MINI_UDP_ENTITY_H__
#define __NW_MINI_UDP_ENTITY_H__
#ifndef NW_ASSERT
#define NW_ASSERT assert
#endif
typedef struct {
uint32_t hSocket;
NwEventT ev;
NwGtpv1uStackHandleT hGtpv1uStack;
} NwMiniUdpEntityT;
#ifdef __cplusplus
extern "C" {
#endif
NwGtpv1uRcT nwMiniUdpInit(NwMiniUdpEntityT* thiz, NwGtpv1uStackHandleT hGtpv1uStack, uint8_t* ipAddr);
NwGtpv1uRcT nwMiniUdpDestroy(NwMiniUdpEntityT* thiz);
NwGtpv1uRcT nwMiniUdpDataReq(NwGtpv1uUdpHandleT udpHandle,
uint8_t* dataBuf,
uint32_t dataSize,
uint32_t peerAddr,
uint32_t peerPort);
#ifdef __cplusplus
}
#endif
#endif
@@ -1,309 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* M I N I M A L I S T I C U L P E N T I T Y *
* *
* Copyright (C) 2010 Amit Chawre. *
* *
*----------------------------------------------------------------------------*/
/**
* @file NwMiniUlpEntity.c
* @brief This file contains example of a minimalistic ULP entity.
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include "NwEvt.h"
#include "NwGtpv1u.h"
#include "NwGtpv1uIe.h"
#include "NwMiniLogMgrEntity.h"
#include "NwMiniUlpEntity.h"
#ifndef NW_ASSERT
#define NW_ASSERT assert
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*---------------------------------------------------------------------------
* Private Functions
*--------------------------------------------------------------------------*/
#define MAX_UDP_PAYLOAD_LEN (4096)
NwGtpv1uRcT
nwMiniUlpSendEchoRequestToPeer(NwMiniUlpEntityT *thiz, uint32_t peerIp)
{
NwGtpv1uRcT rc;
NwGtpv1uUlpApiT ulpReq;
/*
* Send Message Request to Gtpv1u Stack Instance
*/
ulpReq.apiType = NW_GTPV1U_ULP_API_INITIAL_REQ;
ulpReq.apiInfo.initialReqInfo.hUlpTrxn = (NwGtpv1uUlpTrxnHandleT)thiz;
ulpReq.apiInfo.initialReqInfo.teid = 0x00;
ulpReq.apiInfo.initialReqInfo.peerIp = (peerIp);
ulpReq.apiInfo.initialReqInfo.peerPort = 2152;
/* Send Echo Request*/
rc = nwGtpv1uMsgNew( thiz->hGtpv1uStack,
NW_TRUE, /* SeqNum flag */
NW_FALSE,
NW_FALSE,
NW_GTP_ECHO_REQ, /* Msg Type */
0x00000000UL, /* TEID */
0x5678, /* Seq Number */
0,
0,
(&ulpReq.hMsg));
NW_ASSERT( rc == NW_GTPV1U_OK );
rc = nwGtpv1uMsgAddIeTV1((ulpReq.hMsg), NW_GTPV1U_IE_RECOVERY,
thiz->restartCounter);
NW_ASSERT( rc == NW_GTPV1U_OK );
rc = nwGtpv1uProcessUlpReq(thiz->hGtpv1uStack, &ulpReq);
NW_ASSERT( rc == NW_GTPV1U_OK );
return NW_GTPV1U_OK;
}
static
void NW_EVT_CALLBACK(nwMiniUlpDataIndicationCallbackData)
{
NwMiniUlpEntityT *thiz = (NwMiniUlpEntityT *) arg;
NwGtpv1uRcT rc;
uint8_t udpBuf[MAX_UDP_PAYLOAD_LEN];
NwS32T bytesRead;
uint32_t peerLen;
struct sockaddr_in peer;
peerLen = sizeof(peer);
bytesRead = recvfrom(thiz->hSocket, udpBuf, MAX_UDP_PAYLOAD_LEN , 0,
(struct sockaddr *) &peer,(socklen_t *) &peerLen);
if(bytesRead) {
NW_LOG(NW_LOG_LEVEL_DEBG, "Received UDP message of length %u from %X:%u",
bytesRead, ntohl(peer.sin_addr.s_addr), ntohs(peer.sin_port));
rc = nwMiniUlpTpduSend(thiz, udpBuf, bytesRead, thiz->localPort[fd]);
} else {
NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno));
}
}
/*---------------------------------------------------------------------------
* Public Functions
*--------------------------------------------------------------------------*/
NwGtpv1uRcT
nwMiniUlpInit(NwMiniUlpEntityT *thiz, NwGtpv1uStackHandleT hGtpv1uStack)
{
NwGtpv1uRcT rc;
thiz->hGtpv1uStack = hGtpv1uStack;
return NW_GTPV1U_OK;
}
NwGtpv1uRcT
nwMiniUlpDestroy(NwMiniUlpEntityT *thiz)
{
NW_ASSERT(thiz);
memset(thiz, 0, sizeof(NwMiniUlpEntityT));
return NW_GTPV1U_OK;
}
NwGtpv1uRcT
nwMiniUlpCreateConn(NwMiniUlpEntityT *thiz, char *localIpStr, uint16_t localport,
char *peerIpStr)
{
NwGtpv1uRcT rc;
int sd;
struct sockaddr_in addr;
NwGtpv1uUlpApiT ulpReq;
strcpy(thiz->peerIpStr, peerIpStr);
/*
* Create local tunnel endpoint
*/
NW_LOG(NW_LOG_LEVEL_NOTI, "Creating tunnel endpoint with teid %d", localport);
ulpReq.apiType =
NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT;
ulpReq.apiInfo.createTunnelEndPointInfo.teid = localport;
ulpReq.apiInfo.createTunnelEndPointInfo.hUlpSession =
(NwGtpv1uUlpSessionHandleT)thiz;
rc = nwGtpv1uProcessUlpReq(thiz->hGtpv1uStack, &ulpReq);
NW_ASSERT( rc == NW_GTPV1U_OK );
thiz->hGtpv1uConn = ulpReq.apiInfo.createTunnelEndPointInfo.hStackSession;
/*
* Create local udp listening endpoint
*/
sd = socket(AF_INET, SOCK_DGRAM, 0);
if (sd < 0) {
NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno));
NW_ASSERT(0);
}
addr.sin_family = AF_INET;
addr.sin_port = htons(localport);
addr.sin_addr.s_addr = inet_addr(localIpStr);
memset(addr.sin_zero, '\0', sizeof (addr.sin_zero));
if(bind(sd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno));
NW_ASSERT(0);
}
event_set(&(thiz->ev[sd]), sd, EV_READ|EV_PERSIST,
nwMiniUlpDataIndicationCallbackData, thiz);
event_add(&(thiz->ev[sd]), NULL);
thiz->localPort[sd] = localport;
/*
* Create local udp for sendign data
*/
sd = socket(AF_INET, SOCK_DGRAM, 0);
if (sd < 0) {
NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno));
NW_ASSERT(0);
}
thiz->hSocket = sd;
return NW_GTPV1U_OK;
}
NwGtpv1uRcT
nwMiniUlpDestroyConn(NwMiniUlpEntityT *thiz)
{
NwGtpv1uRcT rc;
NwGtpv1uUlpApiT ulpReq;
/*---------------------------------------------------------------------------
* Send Destroy Session Request to GTPv1u Stack Instance
*--------------------------------------------------------------------------*/
ulpReq.apiType = NW_GTPV1U_ULP_API_DESTROY_TUNNEL_ENDPOINT;
ulpReq.apiInfo.destroyTunnelEndPointInfo.hStackSessionHandle = thiz->hGtpv1uConn;
rc = nwGtpv1uProcessUlpReq(thiz->hGtpv1uStack, &ulpReq);
NW_ASSERT( rc == NW_GTPV1U_OK );
thiz->hGtpv1uConn = 0;
return NW_GTPV1U_OK;
}
NwGtpv1uRcT
nwMiniUlpTpduSend(NwMiniUlpEntityT *thiz, uint8_t *tpduBuf, uint32_t tpduLen ,
uint16_t fromPort)
{
NwGtpv1uRcT rc;
NwGtpv1uUlpApiT ulpReq;
/*
* Send Message Request to GTPv1u Stack Instance
*/
ulpReq.apiType = NW_GTPV1U_ULP_API_SEND_TPDU;
ulpReq.apiInfo.sendtoInfo.teid = fromPort;
ulpReq.apiInfo.sendtoInfo.ipAddr = inet_addr(thiz->peerIpStr);
rc = nwGtpv1uGpduMsgNew( thiz->hGtpv1uStack,
fromPort,
NW_FALSE,
thiz->seqNum++,
tpduBuf,
tpduLen,
&(ulpReq.apiInfo.sendtoInfo.hMsg));
NW_ASSERT( rc == NW_GTPV1U_OK );
rc = nwGtpv1uProcessUlpReq(thiz->hGtpv1uStack, &ulpReq);
NW_ASSERT( rc == NW_GTPV1U_OK );
rc = nwGtpv1uMsgDelete(thiz->hGtpv1uStack, (ulpReq.apiInfo.sendtoInfo.hMsg));
NW_ASSERT( rc == NW_GTPV1U_OK );
return NW_GTPV1U_OK;
}
NwGtpv1uRcT
nwMiniUlpProcessStackReqCallback (NwGtpv1uUlpHandleT hUlp,
NwGtpv1uUlpApiT *pUlpApi)
{
NwMiniUlpEntityT *thiz;
NW_ASSERT(pUlpApi != NULL);
thiz = (NwMiniUlpEntityT *) hUlp;
switch(pUlpApi->apiType) {
case NW_GTPV1U_ULP_API_RECV_TPDU: {
struct sockaddr_in peerAddr;
NwS32T bytesSent;
uint8_t dataBuf[4096];
uint32_t dataSize;
uint32_t peerIpAddr = (inet_addr(thiz->peerIpStr));
NW_ASSERT( NW_GTPV1U_OK == nwGtpv1uMsgGetTpdu(pUlpApi->apiInfo.recvMsgInfo.hMsg,
dataBuf, &dataSize) );
NW_LOG(NW_LOG_LEVEL_DEBG, "Received TPDU from gtpv1u stack %u!",
pUlpApi->apiInfo.recvMsgInfo.teid);
peerAddr.sin_family = AF_INET;
peerAddr.sin_port = htons(pUlpApi->apiInfo.recvMsgInfo.teid);
peerAddr.sin_addr.s_addr = (peerIpAddr);
memset(peerAddr.sin_zero, '\0', sizeof (peerAddr.sin_zero));
bytesSent = sendto (thiz->hSocket, dataBuf, dataSize, 0,
(struct sockaddr *) &peerAddr, sizeof(peerAddr));
if(bytesSent < 0) {
NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno));
NW_ASSERT(0);
} else {
NW_LOG(NW_LOG_LEVEL_DEBG, "Sent %u bytes to peer %u.%u.%u.%u", dataSize,
(peerIpAddr & 0x000000ff),
(peerIpAddr & 0x0000ff00) >> 8,
(peerIpAddr & 0x00ff0000) >> 16,
(peerIpAddr & 0xff000000) >> 24);
}
NW_ASSERT(nwGtpv1uMsgDelete(thiz->hGtpv1uStack,
(pUlpApi->apiInfo.recvMsgInfo.hMsg)) == NW_GTPV1U_OK);
}
break;
default:
NW_LOG(NW_LOG_LEVEL_WARN, "Received undefined UlpApi (%d) from gtpv1u stack!",
pUlpApi->apiType);
}
return NW_GTPV1U_OK;
}
#ifdef __cplusplus
}
#endif
@@ -1,64 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* M I N I M A L I S T I C U L P E N T I T Y *
* *
* Copyright (C) 2010 Amit Chawre. *
* *
*----------------------------------------------------------------------------*/
/**
* @file NwMiniUlpEntity.h
* @brief This file contains example of a minimalistic ULP entity.
*/
#include <stdio.h>
#include <assert.h>
#include "NwEvt.h"
#include "NwLog.h"
#ifndef __NW_MINI_ULP_H__
#define __NW_MINI_ULP_H__
typedef struct {
int hSocket;
uint16_t seqNum;
uint8_t restartCounter;
uint8_t localIpStr[16];
uint8_t peerIpStr[16];
uint32_t localPort[1025];
NwEventT ev[1025];
NwGtpv1uStackHandleT hGtpv1uStack;
NwGtpv1uStackSessionHandleT hGtpv1uConn;
} NwMiniUlpEntityT;
#ifdef __cplusplus
extern "C" {
#endif
NwGtpv1uRcT
nwMiniUlpInit(NwMiniUlpEntityT* thiz, NwGtpv1uStackHandleT hGtpv1uStack);
NwGtpv1uRcT
nwMiniUlpDestroy(NwMiniUlpEntityT* thiz);
NwGtpv1uRcT
nwMiniUlpCreateConn(NwMiniUlpEntityT* thiz, char* localIpStr, uint16_t localPort, char* peerIpStr);
NwGtpv1uRcT
nwMiniUlpDestroyConn(NwMiniUlpEntityT* thiz);
NwGtpv1uRcT
nwMiniUlpSendMsg(NwMiniUlpEntityT* thiz);
NwGtpv1uRcT
nwMiniUlpTpduSend(NwMiniUlpEntityT* thiz, uint8_t* tpduBuf, uint32_t tpduLen , uint16_t fromPort);
NwGtpv1uRcT
nwMiniUlpProcessStackReqCallback (NwGtpv1uUlpHandleT hUlp,
NwGtpv1uUlpApiT *pUlpApi);
#ifdef __cplusplus
}
#endif
#endif
@@ -1,207 +0,0 @@
/*----------------------------------------------------------------------------*
* *
* n w - g t p v 2 u *
* G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k *
* *
* M I N I M A L I S T I C D E M O N S T R A T I O N *
* *
* Copyright (C) 2010 Amit Chawre. *
* *
*----------------------------------------------------------------------------*/
/**
* @file hello-world.c
* @brief This is a test program demostrating usage of nw-gtpv2 library.
*/
#include <stdio.h>
#include <assert.h>
#include "NwEvt.h"
#include "NwGtpv1u.h"
#include "NwMiniLogMgrEntity.h"
#include "NwMiniTmrMgrEntity.h"
#include "NwMiniUdpEntity.h"
#include "NwMiniUlpEntity.h"
#ifndef NW_ASSERT
#define NW_ASSERT assert
#endif
/*---------------------------------------------------------------------------
* T H E M A I N F U N C T I O N
*--------------------------------------------------------------------------*/
int main(int argc, char *argv[])
{
NwGtpv1uRcT rc;
char *logLevelStr;
uint32_t logLevel;
uint32_t num_of_connections;
NwGtpv1uStackHandleT hGtpv1uStack = 0;
NwMiniUlpEntityT ulpObj;
NwMiniUdpEntityT udpObj;
NwMiniLogMgrT logObj;
NwGtpv1uUlpEntityT ulp;
NwGtpv1uUdpEntityT udp;
NwGtpv1uTimerMgrEntityT tmrMgr;
NwGtpv1uLogMgrEntityT logMgr;
if(argc != 4) {
printf("Usage: %s <num-of-connections> <local-ip> <peer-ip>\n", argv[0]);
exit(0);
}
logLevelStr = getenv ("NW_LOG_LEVEL");
if(logLevelStr == NULL) {
logLevel = NW_LOG_LEVEL_INFO;
} else {
if(strncmp(logLevelStr, "EMER",4) == 0) {
logLevel = NW_LOG_LEVEL_EMER;
} else if(strncmp(logLevelStr, "ALER",4) == 0) {
logLevel = NW_LOG_LEVEL_ALER;
} else if(strncmp(logLevelStr, "CRIT",4) == 0) {
logLevel = NW_LOG_LEVEL_CRIT;
} else if(strncmp(logLevelStr, "ERRO",4) == 0) {
logLevel = NW_LOG_LEVEL_ERRO ;
} else if(strncmp(logLevelStr, "WARN",4) == 0) {
logLevel = NW_LOG_LEVEL_WARN;
} else if(strncmp(logLevelStr, "NOTI",4) == 0) {
logLevel = NW_LOG_LEVEL_NOTI;
} else if(strncmp(logLevelStr, "INFO",4) == 0) {
logLevel = NW_LOG_LEVEL_INFO;
} else if(strncmp(logLevelStr, "DEBG",4) == 0) {
logLevel = NW_LOG_LEVEL_DEBG;
}
}
/*---------------------------------------------------------------------------
* Initialize event library
*--------------------------------------------------------------------------*/
NW_EVT_INIT();
/*---------------------------------------------------------------------------
* Initialize Log Manager
*--------------------------------------------------------------------------*/
nwMiniLogMgrInit(&logObj, logLevel);
/*---------------------------------------------------------------------------
* Create GTPv1u Stack Instance
*--------------------------------------------------------------------------*/
rc = nwGtpv1uInitialize(&hGtpv1uStack, GTPU_STACK_ENB);
if(rc != NW_GTPV1U_OK) {
NW_LOG(NW_LOG_LEVEL_ERRO,
"Failed to create gtpv1u stack instance. Error '%u' occured", rc);
exit(1);
}
NW_LOG(NW_LOG_LEVEL_INFO, "Gtpv1u Stack Handle '%X' Creation Successful!",
hGtpv1uStack);
/*---------------------------------------------------------------------------
* Set up Ulp Entity
*--------------------------------------------------------------------------*/
rc = nwMiniUlpInit(&ulpObj, hGtpv1uStack);
NW_ASSERT( rc == NW_GTPV1U_OK );
ulp.hUlp = (NwGtpv1uUlpHandleT) &ulpObj;
ulp.ulpReqCallback = nwMiniUlpProcessStackReqCallback;
rc = nwGtpv1uSetUlpEntity(hGtpv1uStack, &ulp);
NW_ASSERT( rc == NW_GTPV1U_OK );
/*---------------------------------------------------------------------------
* Set up Udp Entity
*--------------------------------------------------------------------------*/
rc = nwMiniUdpInit(&udpObj, hGtpv1uStack, (argv[2]));
NW_ASSERT( rc == NW_GTPV1U_OK );
udp.hUdp = (NwGtpv1uUdpHandleT) &udpObj;
udp.udpDataReqCallback = nwMiniUdpDataReq;
rc = nwGtpv1uSetUdpEntity(hGtpv1uStack, &udp);
NW_ASSERT( rc == NW_GTPV1U_OK );
/*---------------------------------------------------------------------------
* Set up Log Entity
*--------------------------------------------------------------------------*/
tmrMgr.tmrMgrHandle = 0;
tmrMgr.tmrStartCallback = nwTimerStart;
tmrMgr.tmrStopCallback = nwTimerStop;
rc = nwGtpv1uSetTimerMgrEntity(hGtpv1uStack, &tmrMgr);
NW_ASSERT( rc == NW_GTPV1U_OK );
/*---------------------------------------------------------------------------
* Set up Log Entity
*--------------------------------------------------------------------------*/
logMgr.logMgrHandle = (NwGtpv1uLogMgrHandleT) &logObj;
logMgr.logReqCallback = nwMiniLogMgrLogRequest;
rc = nwGtpv1uSetLogMgrEntity(hGtpv1uStack, &logMgr);
NW_ASSERT( rc == NW_GTPV1U_OK );
/*---------------------------------------------------------------------------
* Set GTPv1u log level
*--------------------------------------------------------------------------*/
rc = nwGtpv1uSetLogLevel(hGtpv1uStack, logLevel);
/*---------------------------------------------------------------------------
* Send Create Session Request to GTPv1u Stack Instance
*--------------------------------------------------------------------------*/
num_of_connections = atoi(argv[1]);
while ( num_of_connections-- ) {
//rc = nwMiniUlpCreateConn(&ulpObj, argv[2], 1234 + num_of_connections, argv[3]);
rc = nwMiniUlpSendEchoRequestToPeer(&ulpObj, inet_addr(argv[3]));
NW_ASSERT( rc == NW_GTPV1U_OK );
}
/*---------------------------------------------------------------------------
* Event loop
*--------------------------------------------------------------------------*/
NW_EVT_LOOP();
NW_LOG(NW_LOG_LEVEL_ERRO, "Exit from eventloop, no events to process!");
/*---------------------------------------------------------------------------
* Send Destroy Session Request to GTPv1u Stack Instance
*--------------------------------------------------------------------------*/
rc = nwMiniUlpDestroyConn(&ulpObj);
NW_ASSERT( rc == NW_GTPV1U_OK );
/*---------------------------------------------------------------------------
* Destroy GTPv1u Stack Instance
*--------------------------------------------------------------------------*/
rc = nwGtpv1uFinalize(hGtpv1uStack);
if(rc != NW_GTPV1U_OK) {
NW_LOG(NW_LOG_LEVEL_ERRO,
"Failed to finalize gtpv1u stack instance. Error '%u' occured", rc);
} else {
NW_LOG(NW_LOG_LEVEL_INFO, "Gtpv1u Stack Handle '%X' Finalize Successful!",
hGtpv1uStack);
}
return rc;
}
-447
View File
@@ -1,447 +0,0 @@
/*
* 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 udp_eNB_task.c
* \brief
* \author Sebastien ROUX, Lionel Gauthier
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <pthread.h>
#include "queue.h"
#include "intertask_interface.h"
#include "assertions.h"
#include "udp_eNB_task.h"
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "msc.h"
#define IPV4_ADDR "%u.%u.%u.%u"
#define IPV4_ADDR_FORMAT(aDDRESS) \
(uint8_t)((aDDRESS) & 0x000000ff), \
(uint8_t)(((aDDRESS) & 0x0000ff00) >> 8 ), \
(uint8_t)(((aDDRESS) & 0x00ff0000) >> 16), \
(uint8_t)(((aDDRESS) & 0xff000000) >> 24)
struct udp_socket_desc_s {
int sd; /* Socket descriptor to use */
pthread_t listener_thread; /* Thread affected to recv */
char *local_address; /* Local ipv4 address to use */
uint16_t local_port; /* Local port to use */
task_id_t task_id; /* Task who has requested the new endpoint */
STAILQ_ENTRY(udp_socket_desc_s) entries;
};
static STAILQ_HEAD(udp_socket_list_s, udp_socket_desc_s) udp_socket_list;
static pthread_mutex_t udp_socket_list_mutex = PTHREAD_MUTEX_INITIALIZER;
static
struct udp_socket_desc_s *
udp_eNB_get_socket_desc(task_id_t task_id);
void udp_eNB_process_file_descriptors(
struct epoll_event *events,
int nb_events);
static
int
udp_eNB_create_socket(
int port,
char *ip_addr,
task_id_t task_id);
int
udp_eNB_send_to(
int sd,
uint16_t port,
uint32_t address,
const uint8_t *buffer,
uint32_t length);
void udp_eNB_receiver(struct udp_socket_desc_s *udp_sock_pP);
void *udp_eNB_task(void *args_p);
int udp_enb_init(void);
/* @brief Retrieve the descriptor associated with the task_id
*/
static
struct udp_socket_desc_s *udp_eNB_get_socket_desc(task_id_t task_id)
{
struct udp_socket_desc_s *udp_sock_p = NULL;
#if defined(LOG_UDP) && LOG_UDP > 0
LOG_T(UDP_, "Looking for task %d\n", task_id);
#endif
STAILQ_FOREACH(udp_sock_p, &udp_socket_list, entries) {
if (udp_sock_p->task_id == task_id) {
#if defined(LOG_UDP) && LOG_UDP > 0
LOG_T(UDP_, "Found matching task desc\n");
#endif
break;
}
}
return udp_sock_p;
}
void udp_eNB_process_file_descriptors(struct epoll_event *events, int nb_events)
{
int i;
struct udp_socket_desc_s *udp_sock_p = NULL;
if (events == NULL) {
return;
}
for (i = 0; i < nb_events; i++) {
STAILQ_FOREACH(udp_sock_p, &udp_socket_list, entries) {
if (udp_sock_p->sd == events[i].data.fd) {
#if defined(LOG_UDP) && LOG_UDP > 0
LOG_D(UDP_, "Found matching task desc\n");
#endif
udp_eNB_receiver(udp_sock_p);
break;
}
}
}
}
static
int udp_eNB_create_socket(int port, char *ip_addr, task_id_t task_id)
{
struct udp_socket_desc_s *udp_socket_desc_p = NULL;
int sd, rc;
struct sockaddr_in sin;
LOG_I(UDP_, "Initializing UDP for local address %s with port %d\n", ip_addr, port);
sd = socket(AF_INET, SOCK_DGRAM, 0);
AssertFatal(sd > 0, "UDP: Failed to create new socket: (%s:%d)\n", strerror(errno), errno);
memset(&sin, 0, sizeof(struct sockaddr_in));
sin.sin_family = AF_INET;
sin.sin_port = htons(port);
if (ip_addr == NULL) {
sin.sin_addr.s_addr = inet_addr(INADDR_ANY);
} else {
sin.sin_addr.s_addr = inet_addr(ip_addr);
}
if ((rc = bind(sd, (struct sockaddr *)&sin, sizeof(struct sockaddr_in))) < 0) {
close(sd);
LOG_E(UDP_, "Failed to bind socket: (%s:%d) address %s port %d\n", strerror(errno), errno, ip_addr, port);
return -1;
}
/* Create a new descriptor for this connection */
udp_socket_desc_p = calloc(1, sizeof(struct udp_socket_desc_s));
DevAssert(udp_socket_desc_p != NULL);
udp_socket_desc_p->sd = sd;
udp_socket_desc_p->local_address = ip_addr;
udp_socket_desc_p->local_port = port;
udp_socket_desc_p->task_id = task_id;
LOG_I(UDP_, "Inserting new descriptor for task %d, sd %d\n", udp_socket_desc_p->task_id, udp_socket_desc_p->sd);
pthread_mutex_lock(&udp_socket_list_mutex);
STAILQ_INSERT_TAIL(&udp_socket_list, udp_socket_desc_p, entries);
pthread_mutex_unlock(&udp_socket_list_mutex);
itti_subscribe_event_fd(TASK_UDP, sd);
LOG_I(UDP_, "Initializing UDP for local address %s with port %d: DONE\n", ip_addr, port);
return sd;
}
int
udp_eNB_send_to(
int sd,
uint16_t port,
uint32_t address,
const uint8_t *buffer,
uint32_t length)
{
struct sockaddr_in to;
socklen_t to_length;
if (sd <= 0 || ((buffer == NULL) && (length > 0))) {
LOG_E(UDP_, "udp_send_to: bad param\n");
return -1;
}
memset(&to, 0, sizeof(struct sockaddr_in));
to_length = sizeof(to);
to.sin_family = AF_INET;
to.sin_port = htons(port);
to.sin_addr.s_addr = address;
if (sendto(sd, (void *)buffer, (size_t)length, 0, (struct sockaddr *)&to,
to_length) < 0) {
LOG_E(UDP_,
"[SD %d] Failed to send data to "IPV4_ADDR" on port %d, buffer size %u\n",
sd, IPV4_ADDR_FORMAT(address), port, length);
return -1;
}
#if defined(LOG_UDP) && LOG_UDP > 0
LOG_I(UDP_, "[SD %d] Successfully sent to "IPV4_ADDR
" on port %d, buffer size %u, buffer address %x\n",
sd, IPV4_ADDR_FORMAT(address), port, length, buffer);
#endif
return 0;
}
void udp_eNB_receiver(struct udp_socket_desc_s *udp_sock_pP)
{
uint8_t l_buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE];
int n;
socklen_t from_len;
struct sockaddr_in addr;
MessageDef *message_p = NULL;
udp_data_ind_t *udp_data_ind_p = NULL;
uint8_t *forwarded_buffer = NULL;
if (1) {
from_len = (socklen_t)sizeof(struct sockaddr_in);
if ((n = recvfrom(udp_sock_pP->sd, l_buffer, sizeof(l_buffer), MSG_TRUNC,
(struct sockaddr *)&addr, &from_len)) < 0) {
LOG_E(UDP_, "Recvfrom failed %s\n", strerror(errno));
return;
} else if (n > sizeof(l_buffer)) {
LOG_E(UDP_, "%s(%d). Message truncated. %d\n", __FUNCTION__, __LINE__, n);
return;
} else if (n == 0) {
LOG_W(UDP_, "Recvfrom returned 0\n");
return;
} else {
forwarded_buffer = itti_malloc(TASK_UDP, udp_sock_pP->task_id, n*sizeof(uint8_t));
DevAssert(forwarded_buffer != NULL);
memcpy(forwarded_buffer, l_buffer, n);
message_p = itti_alloc_new_message(TASK_UDP, 0, UDP_DATA_IND);
DevAssert(message_p != NULL);
udp_data_ind_p = &message_p->ittiMsg.udp_data_ind;
udp_data_ind_p->buffer = forwarded_buffer;
udp_data_ind_p->buffer_length = n;
udp_data_ind_p->peer_port = htons(addr.sin_port);
udp_data_ind_p->peer_address = addr.sin_addr.s_addr;
#if defined(LOG_UDP) && LOG_UDP > 0
LOG_I(UDP_, "Msg of length %d received from %s:%u\n",
n, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
#endif
/* TODO: this is a hack. Let's accept failures and do nothing when
* it happens. Since itti_send_msg_to_task crashes when the message
* queue is full we wrote itti_try_send_msg_to_task that returns -1
* if the queue is full.
*/
/* look for HACK_RLC_UM_LIMIT for others places related to the hack. Please do not remove this comment. */
if (itti_send_msg_to_task(udp_sock_pP->task_id, INSTANCE_DEFAULT, message_p) < 0) {
LOG_E(UDP_, "Failed to send message %d to task %d\n",
UDP_DATA_IND,
udp_sock_pP->task_id);
itti_free(TASK_UDP, message_p);
itti_free(TASK_UDP, forwarded_buffer);
return;
}
}
}
//close(udp_sock_p->sd);
//udp_sock_p->sd = -1;
//pthread_mutex_lock(&udp_socket_list_mutex);
//STAILQ_REMOVE(&udp_socket_list, udp_sock_p, udp_socket_desc_s, entries);
//pthread_mutex_unlock(&udp_socket_list_mutex);
}
void *udp_eNB_task(void *args_p)
{
int nb_events;
struct epoll_event *events;
MessageDef *received_message_p = NULL;
//const char *msg_name = NULL;
//instance_t instance = 0;
udp_enb_init();
itti_mark_task_ready(TASK_UDP);
MSC_START_USE();
while(1) {
itti_receive_msg(TASK_UDP, &received_message_p);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UDP_ENB_TASK, VCD_FUNCTION_IN);
#if defined(LOG_UDP) && LOG_UDP > 0
LOG_D(UDP_, "Got message %p\n", &received_message_p);
#endif
if (received_message_p != NULL) {
//msg_name = ITTI_MSG_NAME (received_message_p);
//instance = ITTI_MSG_DESTINATION_INSTANCE (received_message_p);
switch (ITTI_MSG_ID(received_message_p)) {
case UDP_INIT: {
LOG_D(UDP_, "Received UDP_INIT\n");
udp_init_t *udp_init_p;
udp_init_p = &received_message_p->ittiMsg.udp_init;
udp_eNB_create_socket(
udp_init_p->port,
udp_init_p->address,
ITTI_MSG_ORIGIN_ID(received_message_p));
}
break;
case UDP_DATA_REQ: {
#if defined(LOG_UDP) && LOG_UDP > 0
LOG_D(UDP_, "Received UDP_DATA_REQ\n");
#endif
int udp_sd = -1;
ssize_t bytes_written;
struct udp_socket_desc_s *udp_sock_p = NULL;
udp_data_req_t *udp_data_req_p;
struct sockaddr_in peer_addr;
udp_data_req_p = &received_message_p->ittiMsg.udp_data_req;
memset(&peer_addr, 0, sizeof(struct sockaddr_in));
peer_addr.sin_family = AF_INET;
peer_addr.sin_port = htons(udp_data_req_p->peer_port);
peer_addr.sin_addr.s_addr = udp_data_req_p->peer_address;
pthread_mutex_lock(&udp_socket_list_mutex);
udp_sock_p = udp_eNB_get_socket_desc(ITTI_MSG_ORIGIN_ID(received_message_p));
if (udp_sock_p == NULL) {
LOG_E(UDP_,
"Failed to retrieve the udp socket descriptor "
"associated with task %d\n",
ITTI_MSG_ORIGIN_ID(received_message_p));
pthread_mutex_unlock(&udp_socket_list_mutex);
if (udp_data_req_p->buffer) {
itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), udp_data_req_p->buffer);
}
goto on_error;
}
udp_sd = udp_sock_p->sd;
pthread_mutex_unlock(&udp_socket_list_mutex);
//#if defined(LOG_UDP) && LOG_UDP > 0
LOG_D(UDP_, "[%d] Sending message of size %u to "IPV4_ADDR" and port %u\n",
udp_sd,
udp_data_req_p->buffer_length,
IPV4_ADDR_FORMAT(udp_data_req_p->peer_address),
udp_data_req_p->peer_port);
//#endif
bytes_written = sendto(
udp_sd,
&udp_data_req_p->buffer[udp_data_req_p->buffer_offset],
udp_data_req_p->buffer_length,
0,
(struct sockaddr *)&peer_addr,
sizeof(struct sockaddr_in));
if (bytes_written != udp_data_req_p->buffer_length) {
LOG_E(UDP_, "There was an error while writing to socket %d rc %zd"
"(%d:%s) May be normal if GTPU kernel module loaded on same host (may NF_DROP IP packet)\n",
udp_sd, bytes_written, errno, strerror(errno));
}
itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), udp_data_req_p->buffer);
}
break;
case TERMINATE_MESSAGE: {
LOG_W(UDP_, " *** Exiting UDP thread\n");
itti_exit_task();
}
break;
case MESSAGE_TEST: {
} break;
default: {
LOG_W(UDP_, "Unkwnon message ID %d:%s\n",
ITTI_MSG_ID(received_message_p),
ITTI_MSG_NAME(received_message_p));
}
break;
}
on_error:
itti_free (ITTI_MSG_ORIGIN_ID(received_message_p), received_message_p);
received_message_p = NULL;
}
nb_events = itti_get_events(TASK_UDP, &events);
/* Now handle notifications for other sockets */
if (nb_events > 0) {
#if defined(LOG_UDP) && LOG_UDP > 0
LOG_D(UDP_, "UDP task Process %d events\n",nb_events);
#endif
udp_eNB_process_file_descriptors(events, nb_events);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UDP_ENB_TASK, VCD_FUNCTION_OUT);
}
LOG_I(UDP_, "Task UDP eNB exiting\n");
return NULL;
}
int udp_enb_init(void)
{
LOG_I(UDP_, "Initializing UDP task interface\n");
STAILQ_INIT(&udp_socket_list);
LOG_I(UDP_, "Initializing UDP task interface: DONE\n");
return 0;
}
-97
View File
@@ -1,97 +0,0 @@
/*
* 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 udp_eNB_task.h
* \brief
* \author Sebastien ROUX, Lionel Gauthier
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
#include <pthread.h>
#include <stdint.h>
#ifndef UDP_ENB_TASK_H_
#define UDP_ENB_TASK_H_
#include "enb_config.h"
/** \brief UDP recv callback prototype. Will be called every time a payload is
* received on socket.
* \param port Port on which data had been received
* \param address Sender Ipv4 address
* \param buffer Pointer to data (should be freed by user)
* \param length Length of message received
* \param arg_p User provided argument (transparent for wrappers)
* @returns Execution result
*/
typedef int (*udp_recv_callback)(uint16_t port,
uint32_t address,
uint8_t *buffer,
uint32_t length,
void *arg_p);
typedef struct {
int sd; /* Socket descriptor to use */
pthread_t listener_thread; /* Thread affected to recv */
char *local_address; /* Local ipv4 address to use */
uint16_t local_port; /* Local port to use */
task_id_t task_id; /* Task who has requested the new endpoint */
} udp_data_t;
/** \brief Create new datagram connection-less socket and create new thread
* for data in downstream.
* \param ip_addr Local IPv4 address to use
* \param port Local port to use
* \param udp_data_p
* \param recv_callback Pointer to data (should be freed by user)
* \param arg_p Optionnal argument to pass to recv_callback
* @returns < 0 on failure or socket descriptor on success
*/
int udp_create_connection(char *ip_addr, uint16_t port,
udp_data_t *udp_data_p,
udp_recv_callback recv_callback,
void *arg_p);
/** \brief Send buffer to remote peer.
* \param sd socket descriptor to use
* \param port remote port
* \param address remote address
* \param buffer Data buffer to send
* \param length Buffer length
* @returns < 0 on failure or socket descriptor on success
*/
int udp_send_to(int sd, uint16_t port, uint32_t address,
const uint8_t *buffer, uint32_t length);
/** \brief UDP ITTI task on eNB.
* \param args_p
* @returns always NULL
*/
void *udp_eNB_task(void *args_p);
/** \brief init UDP layer.
* \param enb_config_p configuration of eNB
* @returns always 0
*/
int udp_enb_init(void);
#endif /* UDP_ENB_TASK_H_ */
+71 -33
View File
@@ -46,7 +46,7 @@ typedef struct Gtpv1uMsgHeader {
#define GTP_GPDU (255)
typedef struct ocp_gtpv1u_bearer_s {
typedef struct gtpv1u_bearer_s {
/* TEID used in dl and ul */
teid_t teid_incoming; ///< eNB TEID
teid_t teid_outgoing; ///< Remote TEID
@@ -55,10 +55,10 @@ typedef struct ocp_gtpv1u_bearer_s {
tcp_udp_port_t outgoing_port;
uint16_t seqNum;
uint8_t npduNum;
} ocp_gtpv1u_bearer_t;
} gtpv1u_bearer_t;
typedef struct {
map<int, ocp_gtpv1u_bearer_t> bearers;
map<int, gtpv1u_bearer_t> bearers;
} teidData_t;
typedef struct {
@@ -173,7 +173,7 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b
return;
}
map<int, ocp_gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id);
map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id);
if ( ptr2 == ptrRnti->second.bearers.end() ) {
LOG_E(GTPU,"[%ld] GTP-U instance: sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id);
@@ -191,7 +191,7 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b
ptr2->second.npduNum++;
// copy to release the mutex
ocp_gtpv1u_bearer_t tmp=ptr2->second;
gtpv1u_bearer_t tmp=ptr2->second;
pthread_mutex_unlock(&globGtp.gtp_lock);
gtpv1uCreateAndSendMsg(compatInst(instance),
tmp.outgoing_ip_addr,
@@ -216,7 +216,7 @@ static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req,
return;
}
map<int, ocp_gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id);
map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id);
if ( ptr2 == ptrRnti->second.bearers.end() ) {
LOG_D(GTPU,"GTP-U instance: %ld sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id);
@@ -234,7 +234,7 @@ static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req,
ptr2->second.npduNum++;
// copy to release the mutex
ocp_gtpv1u_bearer_t tmp=ptr2->second;
gtpv1u_bearer_t tmp=ptr2->second;
pthread_mutex_unlock(&globGtp.gtp_lock);
gtpv1uCreateAndSendMsg(compatInst(instance),
tmp.outgoing_ip_addr,
@@ -257,7 +257,7 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r
return;
}
map<int, ocp_gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id);
map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(rab_id);
if ( ptr2 == ptrRnti->second.bearers.end() ) {
LOG_E(GTPU,"[%ld] GTP-U sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id);
@@ -267,7 +267,7 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r
LOG_D(GTPU,"[%ld] sending a end packet packet to RNTI:RAB:teid %x/%x/%x\n",
instance, rnti, rab_id,ptr2->second.teid_outgoing);
ocp_gtpv1u_bearer_t tmp=ptr2->second;
gtpv1u_bearer_t tmp=ptr2->second;
pthread_mutex_unlock(&globGtp.gtp_lock);
Gtpv1uMsgHeaderT msgHdr;
// N should be 0 for us (it was used only in 2G and 3G)
@@ -383,12 +383,12 @@ static int udpServerSocket(openAddr_s addr) {
return sockfd;
}
instance_t ocp_gtpv1Init(openAddr_t context) {
instance_t gtpv1Init(openAddr_t context) {
pthread_mutex_lock(&globGtp.gtp_lock);
int id=udpServerSocket(context);
if (id>=0) {
itti_subscribe_event_fd(OCP_GTPV1_U, id);
itti_subscribe_event_fd(TASK_GTPV1_U, id);
} else
LOG_E(GTPU,"can't create GTP-U instance\n");
@@ -408,7 +408,7 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer
return;
}
map<int, ocp_gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(bearer_id);
map<int, gtpv1u_bearer_t>::iterator ptr2=ptrRnti->second.bearers.find(bearer_id);
if ( ptr2 == ptrRnti->second.bearers.end() ) {
LOG_E(GTPU,"[%ld] Update tunnel for a existing rnti %x, but wrong bearer_id %u\n", instance, rnti, bearer_id);
@@ -447,7 +447,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer
inst->te2ue_mapping[incoming_teid].callBack=callBack;
ocp_gtpv1u_bearer_t *tmp=&inst->ue2te_mapping[rnti].bearers[outgoing_bearer_id];
gtpv1u_bearer_t *tmp=&inst->ue2te_mapping[rnti].bearers[outgoing_bearer_id];
int addrs_length_in_bytes = remoteAddr.length / 8;
@@ -487,7 +487,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer
return incoming_teid;
}
int ocp_gtpv1u_create_s1u_tunnel(instance_t instance,
int gtpv1u_create_s1u_tunnel(instance_t instance,
const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req,
gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) {
LOG_D(GTPU, "[%ld] Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n",
@@ -521,7 +521,7 @@ int ocp_gtpv1u_create_s1u_tunnel(instance_t instance,
return !GTPNOK;
}
int ocp_gtpv1u_update_s1u_tunnel(
int gtpv1u_update_s1u_tunnel(
const instance_t instance,
const gtpv1u_enb_create_tunnel_req_t *const create_tunnel_req,
const rnti_t prior_rnti
@@ -546,7 +546,7 @@ int ocp_gtpv1u_update_s1u_tunnel(
LOG_W(GTPU,"[%ld] Update a not existing tunnel, start create the new one (new rnti %x, old rnti %x)\n", instance, create_tunnel_req->rnti, prior_rnti);
pthread_mutex_unlock(&globGtp.gtp_lock);
gtpv1u_enb_create_tunnel_resp_t tmp;
(void)ocp_gtpv1u_create_s1u_tunnel(instance, create_tunnel_req, &tmp);
(void)gtpv1u_create_s1u_tunnel(instance, create_tunnel_req, &tmp);
return 0;
}
@@ -593,14 +593,14 @@ int gtpv1u_update_ngu_tunnel(
return GTPNOK;
}
int ocp_gtpv1u_create_x2u_tunnel(
int gtpv1u_create_x2u_tunnel(
const instance_t instanceP,
const gtpv1u_enb_create_x2u_tunnel_req_t *const create_tunnel_req_pP,
gtpv1u_enb_create_x2u_tunnel_resp_t *const create_tunnel_resp_pP) {
AssertFatal( false, "to be developped\n");
}
int newGtpuDeleteTunnel(instance_t instance, rnti_t rnti) {
int newGtpuDeleteAllTunnels(instance_t instance, rnti_t rnti) {
LOG_D(GTPU, "[%ld] Start delete tunnels for RNTI %x\n",
instance, rnti);
pthread_mutex_lock(&globGtp.gtp_lock);
@@ -627,20 +627,58 @@ int newGtpuDeleteTunnel(instance_t instance, rnti_t rnti) {
LOG_I(GTPU, "[%ld] Deleted all tunnels for RNTI %x (%d tunnels deleted)\n", instance, rnti, nb);
return !GTPNOK;
}
// Legacy delete tunnel finish by deleting all the rnti
// so the list of bearer provided is only a design bug
int ocp_gtpv1u_delete_s1u_tunnel( const instance_t instance,
// Legacy delete tunnel finish by deleting all the rnti
// so the list of bearer provided is only a design bug
int gtpv1u_delete_s1u_tunnel( const instance_t instance,
const gtpv1u_enb_delete_tunnel_req_t *const req_pP) {
return newGtpuDeleteTunnel(instance, req_pP->rnti);
return newGtpuDeleteAllTunnels(instance, req_pP->rnti);
}
int newGtpuDeleteTunnels(instance_t instance, rnti_t rnti, int nbTunnels, pdusessionid_t *pdusession_id) {
LOG_D(GTPU, "[%ld] Start delete tunnels for RNTI %x\n",
instance, rnti);
pthread_mutex_lock(&globGtp.gtp_lock);
auto inst=&globGtp.instances[compatInst(instance)];
auto ptrRNTI=inst->ue2te_mapping.find(rnti);
if ( ptrRNTI == inst->ue2te_mapping.end() ) {
LOG_W(GTPU,"[%ld] Delete GTP tunnels for rnti: %x, but no tunnel exits\n", instance, rnti);
pthread_mutex_unlock(&globGtp.gtp_lock);
return -1;
}
int nb=0;
for (int i=0; i<nbTunnels; i++) {
auto ptr2=ptrRNTI->second.bearers.find(pdusession_id[i]);
if ( ptr2 == ptrRNTI->second.bearers.end() ) {
LOG_E(GTPU,"[%ld] GTP-U instance: delete of not existing tunnel RNTI:RAB: %x/%x\n", instance, rnti,pdusession_id[i]);
} else {
inst->te2ue_mapping.erase(ptr2->second.teid_incoming);
nb++;
}
}
if (ptrRNTI->second.bearers.size() == 0 )
// no tunnels on this rnti, erase the ue entry
inst->ue2te_mapping.erase(ptrRNTI);
pthread_mutex_unlock(&globGtp.gtp_lock);
LOG_I(GTPU, "[%ld] Deleted all tunnels for RNTI %x (%d tunnels deleted)\n", instance, rnti, nb);
return !GTPNOK;
}
int gtpv1u_delete_x2u_tunnel( const instance_t instanceP,
const gtpv1u_enb_delete_tunnel_req_t *const req_pP,
int enbflag) {
const gtpv1u_enb_delete_tunnel_req_t *const req_pP) {
LOG_E(GTPU,"x2 tunnel not implemented\n");
return 0;
}
int gtpv1u_delete_ngu_tunnel( const instance_t instance,
gtpv1u_gnb_delete_tunnel_req_t * req) {
return newGtpuDeleteTunnels(instance, req->rnti, req->num_pdusession, req->pdusession_id);
}
static int Gtpv1uHandleEchoReq(int h,
uint8_t *msgBuf,
uint32_t msgBufLen,
@@ -871,14 +909,14 @@ void gtpv1uReceiver(int h) {
#include <openair2/ENB_APP/enb_paramdef.h>
void *ocp_gtpv1uTask(void *args) {
void *gtpv1uTask(void *args) {
while(1) {
/* Trying to fetch a message from the message queue.
If the queue is empty, this function will block till a
message is sent to the task.
*/
MessageDef *message_p = NULL;
itti_receive_msg(OCP_GTPV1_U, &message_p);
itti_receive_msg(TASK_GTPV1_U, &message_p);
if (message_p != NULL ) {
openAddr_t addr= {0};
@@ -888,7 +926,7 @@ void *ocp_gtpv1uTask(void *args) {
case GTPV1U_ENB_TUNNEL_DATA_REQ: {
gtpv1uSend(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)),
&GTPV1U_ENB_TUNNEL_DATA_REQ(message_p), false, false);
itti_free(OCP_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer);
itti_free(TASK_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer);
}
break;
@@ -908,7 +946,7 @@ void *ocp_gtpv1uTask(void *args) {
case GTPV1U_ENB_END_MARKER_REQ:
gtpv1uEndTunnel(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)),
&GTPV1U_ENB_TUNNEL_DATA_REQ(message_p));
itti_free(OCP_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer);
itti_free(TASK_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer);
break;
case GTPV1U_ENB_DATA_FORWARDING_REQ:
@@ -923,7 +961,7 @@ void *ocp_gtpv1uTask(void *args) {
strcpy(addr.originHost, GTPV1U_REQ(message_p).localAddrStr);
strcpy(addr.originService, GTPV1U_REQ(message_p).localPortStr);
strcpy(addr.destinationService,addr.originService);
AssertFatal((legacyInstanceMapping=ocp_gtpv1Init(addr))!=0,"Instance 0 reserved for legacy\n");
AssertFatal((legacyInstanceMapping=gtpv1Init(addr))!=0,"Instance 0 reserved for legacy\n");
break;
default:
@@ -932,12 +970,12 @@ void *ocp_gtpv1uTask(void *args) {
break;
}
AssertFatal(EXIT_SUCCESS==itti_free(OCP_GTPV1_U, message_p), "Failed to free memory!\n");
AssertFatal(EXIT_SUCCESS==itti_free(TASK_GTPV1_U, message_p), "Failed to free memory!\n");
}
struct epoll_event *events;
int nb_events = itti_get_events(OCP_GTPV1_U, &events);
int nb_events = itti_get_events(TASK_GTPV1_U, &events);
for (int i = 0; i < nb_events; i++)
if ((events[i].events&EPOLLIN))
+10 -21
View File
@@ -8,19 +8,6 @@
extern "C" {
#endif
#include <openair3/GTPV1-U/gtpv1u_eNB_defs.h>
#if defined(NEW_GTPU)
#define gtpv1u_create_s1u_tunnel ocp_gtpv1u_create_s1u_tunnel
#define gtpv1u_update_s1u_tunnel ocp_gtpv1u_update_s1u_tunnel
#define gtpv1u_delete_s1u_tunnel ocp_gtpv1u_delete_s1u_tunnel
#define gtpv1u_create_x2u_tunnel ocp_gtpv1u_create_x2u_tunnel
#define gtpv1u_eNB_task ocp_gtpv1uTask
#define nr_gtpv1u_gNB_task ocp_gtpv1uTask
#define TASK_VARIABLE OCP_GTPV1_U
#else
#define TASK_VARIABLE TASK_GTPV1_U
#endif
typedef boolean_t (*gtpCallback)(
protocol_ctxt_t *ctxt_pP,
const srb_flag_t srb_flagP,
@@ -43,18 +30,18 @@ typedef struct openAddr_s {
// the init function create a gtp instance and return the gtp instance id
// the parameter originInstance will be sent back in each message from gtp to the creator
void ocp_gtpv1uReceiver(int h);
void ocp_gtpv1uProcessTimeout(int handle,void *arg);
int ocp_gtpv1u_create_s1u_tunnel(const instance_t instance, const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req,
void gtpv1uReceiver(int h);
void gtpv1uProcessTimeout(int handle,void *arg);
int gtpv1u_create_s1u_tunnel(const instance_t instance, const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req,
gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp);
int ocp_gtpv1u_update_s1u_tunnel(const instance_t instanceP,
int gtpv1u_update_s1u_tunnel(const instance_t instanceP,
const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req_pP,
const rnti_t prior_rnti
);
int ocp_gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP);
int gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP);
int gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP);
int ocp_gtpv1u_create_x2u_tunnel(
int gtpv1u_create_x2u_tunnel(
const instance_t instanceP,
const gtpv1u_enb_create_x2u_tunnel_req_t *const create_tunnel_req_pP,
gtpv1u_enb_create_x2u_tunnel_resp_t *const create_tunnel_resp_pP);
@@ -64,8 +51,10 @@ int ocp_gtpv1u_create_x2u_tunnel(
teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer_id, int outgoing_rb_id, teid_t teid,
transport_layer_addr_t remoteAddr, int port, gtpCallback callBack);
void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer_id, teid_t newOutgoingTeid);
instance_t ocp_gtpv1Init(openAddr_t context);
void *ocp_gtpv1uTask(void *args);
int newGtpuDeleteAllTunnels(instance_t instance, rnti_t rnti);
int newGtpuDeleteTunnels(instance_t instance, rnti_t rnti, int nbTunnels, pdusessionid_t *pdusession_id);
instance_t gtpv1Init(openAddr_t context);
void *gtpv1uTask(void *args);
#ifdef __cplusplus
}
@@ -19,32 +19,23 @@
* contact@openairinterface.org
*/
/*! \file gtpv1u_eNB_defs.h
* \brief
* \author Sebastien ROUX, Lionel GAUTHIER
* \version 1.0
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
/*! \file gtpv1u_eNB_task.h
* \brief
* \author Lionel Gauthier
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
#include "hashtable.h"
#include "LTE_asn_constant.h"
#ifndef GTPV1U_ENB_TASK_H_
#define GTPV1U_ENB_TASK_H_
#ifndef GTPV1U_ENB_DEFS_H_
#define GTPV1U_ENB_DEFS_H_
typedef struct gtpv1u_data_s {
/* RB tree of UEs */
hash_table_t *ue_mapping;
} gtpv1u_data_t;
#include "NwGtpv1u.h"
#define GTPV1U_UDP_PORT (2152)
#define GTPV1U_BEARER_OFFSET 3
#define GTPV1U_MAX_BEARERS_ID (max_val_LTE_DRB_Identity - GTPV1U_BEARER_OFFSET)
#define GTPV1U_SOURCE_ENB (0)
#define GTPV1U_TARGET_ENB (1)
#define GTPV1U_MSG_FROM_SOURCE_ENB (0)
#define GTPV1U_MSG_FROM_SPGW (1)
typedef enum {
BEARER_DOWN = 0,
BEARER_IN_CONFIG,
@@ -54,16 +45,7 @@ typedef enum {
BEARER_MAX,
} bearer_state_t;
typedef struct gtpv1u_teid_data_s {
/* UE identifier for oaisim stack */
module_id_t enb_id;
rnti_t ue_id;
ebi_t eps_bearer_id;
} gtpv1u_teid_data_t;
typedef struct gtpv1u_bearer_s {
typedef struct fixMe_gtpv1u_bearer_s {
/* TEID used in dl and ul */
teid_t teid_eNB; ///< eNB TEID
uintptr_t teid_eNB_stack_session; ///< eNB TEID
@@ -76,7 +58,7 @@ typedef struct gtpv1u_bearer_s {
tcp_udp_port_t port;
//NwGtpv1uStackSessionHandleT stack_session;
bearer_state_t state;
} gtpv1u_bearer_t;
} fixMe_gtpv1u_bearer_t;
typedef struct gtpv1u_ue_data_s {
/* UE identifier for oaisim stack */
@@ -89,45 +71,43 @@ typedef struct gtpv1u_ue_data_s {
* Note that the first LCID available for data is 3 and we fixed the maximum
* number of e-rab per UE to be (32 [id range]), max RB is 11. The real rb id will 3 + rab_id (3..32).
*/
gtpv1u_bearer_t bearers[GTPV1U_MAX_BEARERS_ID];
fixMe_gtpv1u_bearer_t bearers[GTPV1U_MAX_BEARERS_ID];
//RB_ENTRY(gtpv1u_ue_data_s) gtpv1u_ue_node;
} gtpv1u_ue_data_t;
typedef struct gtpv1u_data_s {
/* nwgtpv1u stack internal data */
NwGtpv1uStackHandleT gtpv1u_stack;
/* RB tree of UEs */
hash_table_t *ue_mapping; // PDCP->GTPV1U
hash_table_t *teid_mapping; // GTPV1U -> PDCP
//RB_HEAD(gtpv1u_ue_map, gtpv1u_ue_data_s) gtpv1u_ue_map_head;
/* Local IP address to use */
in_addr_t enb_ip_address_for_S1u_S12_S4_up;
/* UDP internal data */
//udp_data_t udp_data;
uint16_t seq_num;
uint8_t restart_counter;
} gtpv1u_data_t;
/*
int
gtpv1u_new_data_req(
uint8_t enb_module_idP,
rnti_t ue_rntiP,
uint8_t rab_idP,
uint8_t *buffer_pP,
uint32_t buf_lenP,
uint32_t buf_offsetP
);
uint8_t enb_id,
uint8_t ue_id,
uint8_t rab_id,
uint8_t *buffer,
uint32_t buf_len,
uint32_t buf_offset);*/
int gtpv1u_eNB_init(void);
void *gtpv1u_eNB_process_itti_msg(void*);
void *gtpv1u_eNB_task(void *args);
int
gtpv1u_initial_req(
gtpv1u_data_t *gtpv1u_data_p,
uint32_t teid,
uint16_t port,
uint32_t address);
gtpv1u_create_x2u_tunnel(
const instance_t instanceP,
const gtpv1u_enb_create_x2u_tunnel_req_t * const create_tunnel_req_pP,
gtpv1u_enb_create_x2u_tunnel_resp_t * const create_tunnel_resp_pP);
#endif /* GTPV1U_ENB_DEFS_H_ */
int
gtpv1u_create_s1u_tunnel(
const instance_t instanceP,
const gtpv1u_enb_create_tunnel_req_t * const create_tunnel_req_pP,
gtpv1u_enb_create_tunnel_resp_t * const create_tunnel_resp_pP);
int
gtpv1u_update_s1u_tunnel(
const instance_t instanceP,
const gtpv1u_enb_create_tunnel_req_t * const create_tunnel_req_pP,
const rnti_t prior_rnti);
int gtpv1u_delete_x2u_tunnel(
const instance_t instanceP,
const gtpv1u_enb_delete_tunnel_req_t * const req_pP);
#endif /* GTPV1U_ENB_TASK_H_ */
@@ -47,5 +47,8 @@ gtpv1u_update_ngu_tunnel(
const rnti_t prior_rnti
);
int gtpv1u_delete_ngu_tunnel( const instance_t instance,
gtpv1u_gnb_delete_tunnel_req_t *req);
#endif /* GTPV1U_GNB_TASK_H_ */
+2 -7
View File
@@ -28,7 +28,6 @@
#include "sctp_eNB_task.h"
#include "x2ap_eNB.h"
#include "s1ap_eNB.h"
#include "udp_eNB_task.h"
#include "gtpv1u_eNB_task.h"
#if ENABLE_RAL
#include "lteRALue.h"
@@ -67,11 +66,7 @@ int create_tasks(uint32_t enb_nb) {
if (EPC_MODE_ENABLED && !NODE_IS_DU(type) && ! ( split73==SPLIT73_DU ) ) {
rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL);
AssertFatal(rc >= 0, "Create task for S1AP failed\n");
if (!(get_softmodem_params()->emulate_rf)){
rc = itti_create_task(TASK_UDP, udp_eNB_task, NULL);
AssertFatal(rc >= 0, "Create task for UDP failed\n");
}
rc = itti_create_task(TASK_GTPV1_U, gtpv1u_eNB_task, NULL);
rc = itti_create_task(TASK_GTPV1_U, gtpv1uTask, NULL);
AssertFatal(rc >= 0, "Create task for GTPV1U failed\n");
}
@@ -91,7 +86,7 @@ int create_tasks(uint32_t enb_nb) {
rc = itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL);
AssertFatal(rc >= 0, "Create task for DU F1AP failed\n");
// DU is now GTP-U instead of protobuf
rc = itti_create_task(TASK_GTPV1_U, gtpv1u_eNB_task, NULL);
rc = itti_create_task(TASK_GTPV1_U, gtpv1uTask, NULL);
AssertFatal(rc >= 0, "Create task for GTPV1U failed\n");
}
+1 -38
View File
@@ -28,7 +28,6 @@
#include "sctp_eNB_task.h"
#include "x2ap_eNB.h"
#include "s1ap_eNB.h"
#include "udp_eNB_task.h"
#include "gtpv1u_eNB_task.h"
#include "m2ap_eNB.h"
#include "m2ap_MCE.h"
@@ -75,46 +74,10 @@ int create_tasks_mbms(uint32_t enb_nb) {
rc = itti_create_task (TASK_MCE_APP, MCE_app_task, NULL);
AssertFatal(rc >= 0, "Create task for MCE APP failed\n");
// LOG_I(ENB_APP, "Creating ENB_APP eNB Task\n");
// rc = itti_create_task (TASK_ENB_APP, eNB_app_task, NULL);
// AssertFatal(rc >= 0, "Create task for eNB APP failed\n");
//
// LOG_I(RRC,"Creating RRC eNB Task\n");
// rc = itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL);
// AssertFatal(rc >= 0, "Create task for RRC eNB failed\n");
//
// if (EPC_MODE_ENABLED) {
// rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL);
// AssertFatal(rc >= 0, "Create task for SCTP failed\n");
// }
// rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL);
// AssertFatal(rc >= 0, "Create task for SCTP failed\n");
//
//
// if (EPC_MODE_ENABLED && !NODE_IS_DU(type)) {
// rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL);
// AssertFatal(rc >= 0, "Create task for S1AP failed\n");
// if (!(get_softmodem_params()->emulate_rf)){
// rc = itti_create_task(TASK_UDP, udp_eNB_task, NULL);
// AssertFatal(rc >= 0, "Create task for UDP failed\n");
// }
// rc = itti_create_task(TASK_GTPV1_U, gtpv1u_eNB_task, NULL);
// AssertFatal(rc >= 0, "Create task for GTPV1U failed\n");
// if (is_x2ap_enabled()) {
// rc = itti_create_task(TASK_X2AP, x2ap_task, NULL);
// AssertFatal(rc >= 0, "Create task for X2AP failed\n");
// } else {
// LOG_I(X2AP, "X2AP is disabled.\n");
// }
// }
////
if(!EPC_MODE_ENABLED){
// rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL);
// AssertFatal(rc >= 0, "Create task for SCTP failed\n");
rc = itti_create_task(TASK_UDP, udp_eNB_task, NULL);
AssertFatal(rc >= 0, "Create task for UDP failed\n");
rc = itti_create_task(TASK_GTPV1_U, gtpv1u_eNB_task, NULL);
rc = itti_create_task(TASK_GTPV1_U, gtpv1uTask, NULL);
AssertFatal(rc >= 0, "Create task for GTPV1U failed\n");
}
///
-1
View File
@@ -27,7 +27,6 @@
#include "sctp_eNB_task.h"
#include "s1ap_eNB.h"
#include "openair3/NAS/UE/nas_ue_task.h"
#include "udp_eNB_task.h"
#include "gtpv1u_eNB_task.h"
#if ENABLE_RAL
#include "lteRALue.h"
-83
View File
@@ -1,83 +0,0 @@
/*
* 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
*/
#ifndef __THREAD_IPC_H__
#define __THREAD_IPC_H__
#define SUB_FRAME_LENGTH 7680
#define FRAME_LENGTH 76800
#define UE_UL_DELAY 6 /*设置上行组帧在同步时钟基础上的延时(子帧个数)*/
#define UE_UL_SEND_DELAY 6 /*上行发送子帧号在接收子帧时间戳上的延时(子帧个数)*/
#define BUFFERMAX 5 /*环形缓冲区个数*/
#define LOWBUFFER 3 /*环形缓冲区下限, 不能为0*/
#define HIGHBUFFER 4 /*环形缓冲区上限*/
typedef struct {
long long subframe_num; /*子帧编号*/
int buffer[SUB_FRAME_LENGTH * 2]; /*一子帧数据*/
} buffer_t;
typedef struct {
int packet_num; /*环形缓冲区数据包计数器,表示环形缓冲区有效数据包个数*/
int isfull; /*标记环形缓冲区有效数据包是否达到上限标志*/
int isempty; /*标记环形缓冲区有效数据包是否达到下限标志*/
pthread_mutex_t buffer_mutex; /*环形缓冲区操作保护锁*/
pthread_cond_t full_cond; /*环形缓冲区上限条件变量,配合isfull使用 */
pthread_cond_t empty_cond; /*环形缓冲区下限条件变量,配合isempty使用*/
buffer_t loop_buf[BUFFERMAX]; /*环形缓冲区*/
} loop_buffer_op_t;
typedef struct {
int decoding_subframe_num; /*待解码子帧的编号*/
pthread_mutex_t buffer_mutex; /*对sync_buffer临界区的保护锁*/
int sync_buffer[SUB_FRAME_LENGTH * 10]; /*同步线程与下行解码线程数据共享缓冲区*/
} sync_buffer_t;
typedef struct {
unsigned int rx_timestamp; /*接收数据包第一个sample时间戳*/
unsigned int tx_timestamp; /*待发送数据包的时间戳*/
unsigned long long current_subframe; /*当前子帧编号*/
int ue_sync_state; /*表示UE是否在同步状态,0表示失同步,1表示同步*/
pthread_mutex_t sync_mutex; /*根据ue_sync_state标志,唤醒组帧线程*/
pthread_mutex_t ul_send_mutex; /*用于sync线程唤醒发送线程发送数据*/
pthread_mutex_t dl_decode_mutex;/*下行解码保护锁,用于sync线程唤醒解码线程解码*/
loop_buffer_op_t loop_buffer;
sync_buffer_t sync_buffer;
} g_thread_ipc_t;
void loop_buffer_reset(buffer_t *loop_buf);
int thread_ipc_init(void);
int thread_ipc_deinit(void);
int set_thread_attr(pthread_attr_t *attr, int policy, int priority, int cpuid);
int find_subframe_num(unsigned long long current_subframe_num, buffer_t *buf, int *flag);
int ue_unsync_thread_ipc_reset(void);
extern g_thread_ipc_t thread_ipc;
#endif