mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
Compare commits
14 Commits
mp_testing
...
tc-ran
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48cce17ce8 | ||
|
|
b50a50889a | ||
|
|
6022c7f2d9 | ||
|
|
3e43815625 | ||
|
|
228e6f802d | ||
|
|
673fc48b67 | ||
|
|
e0b0287d27 | ||
|
|
51bf25a13c | ||
|
|
d1c452b275 | ||
|
|
076f503e67 | ||
|
|
52b737c5e8 | ||
|
|
bac05e1cf8 | ||
|
|
3de9ec0ede | ||
|
|
d6bc7c755a |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -23,3 +23,6 @@ tags
|
||||
nfapi_nr_interface_scf
|
||||
*.log
|
||||
*.out
|
||||
*.cmake
|
||||
*.o
|
||||
*.so
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
project (OpenAirInterface LANGUAGES C CXX)
|
||||
|
||||
# mir
|
||||
#set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
|
||||
include("macros.cmake")
|
||||
|
||||
# System packages that are required
|
||||
@@ -165,26 +168,26 @@ project (OpenAirInterface)
|
||||
##############################################
|
||||
# Base CUDA setting
|
||||
##############################################
|
||||
find_package(CUDA)
|
||||
if (CUDA_FOUND)
|
||||
message ("cuda include ${CUDA_INCLUDE_DIRS}")
|
||||
message ("cuda library ${CUDA_LIBRARY_DIRS}")
|
||||
#find_package(CUDA)
|
||||
#if (CUDA_FOUND)
|
||||
# message ("cuda include ${CUDA_INCLUDE_DIRS}")
|
||||
# message ("cuda library ${CUDA_LIBRARY_DIRS}")
|
||||
|
||||
add_definitions("-L/usr/local/cuda/lib64")
|
||||
# add_definitions("-L/usr/local/cuda/lib64")
|
||||
|
||||
SET(CUDA_NVCC_FLAGS
|
||||
"${CUDA_NVCC_FLAGS};-arch=sm_60;")
|
||||
# SET(CUDA_NVCC_FLAGS
|
||||
# "${CUDA_NVCC_FLAGS};-arch=sm_60;")
|
||||
|
||||
# Disable warnings for CUDA
|
||||
SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-lpthread;-w;-O3;--default-stream;per-thread;-I/usr/local/cuda/inc;-L/usr/local/cuda/lib -lcutil;-rdc=true;-lcudadevrt")
|
||||
SET(CUDA_VERBOSE_BUILD ON)
|
||||
SET(CUDA_HOST_COMPILER "/usr/bin/g++")
|
||||
#SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-lpthread;-w;-O3;--default-stream;per-thread;-I/usr/local/cuda/inc;-L/usr/local/cuda/lib -lcutil;-rdc=true;-lcudadevrt")
|
||||
#SET(CUDA_VERBOSE_BUILD ON)
|
||||
#SET(CUDA_HOST_COMPILER "/usr/bin/g++")
|
||||
|
||||
SET(CUDA_SEPARABLE_COMPILATION ON)
|
||||
#SET(CUDA_SEPARABLE_COMPILATION ON)
|
||||
|
||||
else (CUDA_FOUND)
|
||||
message ("No CUDA tool installed")
|
||||
endif ()
|
||||
#else (CUDA_FOUND)
|
||||
# message ("No CUDA tool installed")
|
||||
#endif ()
|
||||
|
||||
####################################################
|
||||
# compilation flags
|
||||
@@ -238,7 +241,7 @@ add_definitions("-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAV
|
||||
set(commonOpts "-pipe -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic")
|
||||
|
||||
set(CMAKE_C_FLAGS
|
||||
"${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} ${commonOpts} -std=gnu99 -funroll-loops")
|
||||
"${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} ${commonOpts} -std=gnu11 -funroll-loops")
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} ${commonOpts} -std=c++11")
|
||||
|
||||
@@ -259,7 +262,9 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ggdb2 -Wl,-rpath -Wl,${C
|
||||
set(debugOpt "-ggdb2 -DMALLOC_CHECK_=3 -fno-delete-null-pointer-checks")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${debugOpt} -O0")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${debugOpt} -O2")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3")
|
||||
# mir
|
||||
#set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -flto")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -flto")
|
||||
|
||||
# Enable assert() for RelWithDebInfo builds
|
||||
string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
@@ -894,7 +899,7 @@ add_boolean_option(TRACE_RLC_UM_TX_STATUS False "TRACE for RLC UM, TO BE CHANGE
|
||||
##########################
|
||||
# RRC LAYER OPTIONS
|
||||
##########################
|
||||
add_boolean_option(RRC_DEFAULT_RAB_IS_AM True "set the RLC mode to AM for the default bearer, otherwise it is UM.")
|
||||
add_boolean_option(RRC_DEFAULT_RAB_IS_AM False "set the RLC mode to AM for the default bearer, otherwise it is UM.")
|
||||
|
||||
|
||||
##########################
|
||||
@@ -1780,6 +1785,38 @@ set(NR_PDCP_SRC
|
||||
${OPENAIR2_DIR}/LAYER2/nr_pdcp/asn1_utils.c
|
||||
)
|
||||
|
||||
set(NR_TC_SM_SRC
|
||||
${OPENAIR2_DIR}/tc/alg_ds/alg/accumulate.c
|
||||
${OPENAIR2_DIR}/tc/alg_ds/alg/defer.c
|
||||
${OPENAIR2_DIR}/tc/alg_ds/alg/find.c
|
||||
${OPENAIR2_DIR}/tc/alg_ds/alg/for_each.c
|
||||
${OPENAIR2_DIR}/tc/alg_ds/alg/murmur_hash_32.c
|
||||
${OPENAIR2_DIR}/tc/alg_ds/alg/lower_bound.c
|
||||
${OPENAIR2_DIR}/tc/alg_ds/alg/eq_float.c
|
||||
${OPENAIR2_DIR}/tc/alg_ds/ds/seq_container/seq_arr.c
|
||||
${OPENAIR2_DIR}/tc/alg_ds/ds/seq_container/seq_ring.c
|
||||
${OPENAIR2_DIR}/tc/alg_ds/ds/seq_container/seq_list.c
|
||||
${OPENAIR2_DIR}/tc/alg_ds/ds/seq_container/seq_deque.c
|
||||
${OPENAIR2_DIR}/tc/alg_ds/ds/assoc_container/assoc_rb_tree.c
|
||||
${OPENAIR2_DIR}/tc/alg_ds/ds/assoc_container/assoc_rb_tree_lck.c
|
||||
${OPENAIR2_DIR}/tc/alg_ds/ds/assoc_container/assoc_ht_open_address.c
|
||||
${OPENAIR2_DIR}/tc/alg_ds/ds/assoc_container/bimap.c
|
||||
${OPENAIR2_DIR}/tc/alg_ds/meter/meter.c
|
||||
${OPENAIR2_DIR}/tc/alg_ds/ds/statistics/moving_average/mv_avg_time.c
|
||||
${OPENAIR2_DIR}/tc/alg_ds/ds/statistics/moving_average/mv_avg_elm.c
|
||||
# alg_ds/ds/trees/rb_tree.c
|
||||
#main.c
|
||||
${OPENAIR2_DIR}/tc/tc_api.c
|
||||
${OPENAIR2_DIR}/tc/tc.c
|
||||
${OPENAIR2_DIR}/tc/pkt.c
|
||||
${OPENAIR2_DIR}/tc/time/time.c
|
||||
${OPENAIR2_DIR}/tc/plc_shp_pair.c
|
||||
${OPENAIR2_DIR}/tc/shp/shp.c
|
||||
${OPENAIR2_DIR}/tc/plc/plc.c
|
||||
${OPENAIR2_DIR}/tc/tc_sm/ie/tc_data_ie.c
|
||||
)
|
||||
|
||||
|
||||
set(NR_SDAP_SRC
|
||||
${OPENAIR2_DIR}/SDAP/nr_sdap/nr_sdap.c
|
||||
${OPENAIR2_DIR}/SDAP/nr_sdap/nr_sdap_entity.c
|
||||
@@ -1828,6 +1865,7 @@ set(L2_NR_SRC
|
||||
${NR_RLC_SRC}
|
||||
${NR_PDCP_SRC}
|
||||
${NR_SDAP_SRC}
|
||||
${NR_TC_SM_SRC}
|
||||
${NR_RRC_DIR}/rrc_gNB.c
|
||||
${NR_RRC_DIR}/nr_rrc_common.c
|
||||
${NR_RRC_DIR}/L2_nr_interface.c
|
||||
@@ -1863,6 +1901,7 @@ set(NR_L2_SRC_UE
|
||||
${NR_RLC_SRC}
|
||||
${NR_PDCP_SRC}
|
||||
${NR_SDAP_SRC}
|
||||
${NR_TC_SM_SRC}
|
||||
${NR_UE_RRC_DIR}/L2_interface_ue.c
|
||||
${NR_UE_RRC_DIR}/main_ue.c
|
||||
${NR_RRC_DIR}/nr_rrc_config.c
|
||||
@@ -1993,6 +2032,12 @@ add_library(L2_NR
|
||||
${GNB_APP_SRC}
|
||||
)
|
||||
|
||||
#mir
|
||||
#set (TC_CURRENT_SOURCE_DIR ${OPENAIR_DIR}/openair2/tc)
|
||||
target_compile_definitions(L2_NR PRIVATE TC_CURRENT_SOURCE_DIR=${OPENAIR_DIR}/openair2/tc)
|
||||
|
||||
|
||||
|
||||
add_library(L2_LTE_NR
|
||||
${L2_RRC_SRC}
|
||||
${MAC_SRC}
|
||||
@@ -2720,7 +2765,7 @@ target_link_libraries (nr-softmodem
|
||||
-Wl,--end-group z dl)
|
||||
|
||||
target_link_libraries (nr-softmodem ${LIBXML2_LIBRARIES})
|
||||
target_link_libraries (nr-softmodem pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
|
||||
target_link_libraries (nr-softmodem pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES} ${OPENAIR_DIR}/executables/agent_if/libe2_agent.a)
|
||||
target_link_libraries (nr-softmodem ${LIB_LMS_LIBRARIES})
|
||||
target_link_libraries (nr-softmodem ${T_LIB})
|
||||
|
||||
|
||||
1
executables/agent_if/README.md
Normal file
1
executables/agent_if/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Bad design decision. Fix it after the Hackfest!!!
|
||||
55
executables/agent_if/ans/sm_ag_if_ans.h
Normal file
55
executables/agent_if/ans/sm_ag_if_ans.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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 SM_ANSWER_INTERFACE_H
|
||||
#define SM_ANSWER_INTERFACE_H
|
||||
|
||||
#include "../../mac_sm/ie/mac_data_ie.h"
|
||||
#include "../../rlc_sm/ie/rlc_data_ie.h"
|
||||
#include "../../pdcp_sm/ie/pdcp_data_ie.h"
|
||||
#include "../../slice_sm/ie/slice_data_ie.h"
|
||||
#include "../../tc_sm/ie/tc_data_ie.h"
|
||||
|
||||
|
||||
|
||||
typedef enum{
|
||||
MAC_AGENT_IF_CTRL_ANS_V0,
|
||||
RLC_AGENT_IF_CTRL_ANS_V0,
|
||||
PDCP_AGENT_IF_CTRL_ANS_V0,
|
||||
SLICE_AGENT_IF_CTRL_ANS_V0,
|
||||
TC_AGENT_IF_CTRL_ANS_V0,
|
||||
|
||||
SM_AGENT_IF_ANS_V0_END,
|
||||
} sm_ag_if_ans_e;
|
||||
|
||||
typedef struct{
|
||||
union {
|
||||
mac_ctrl_out_t mac;
|
||||
rlc_ctrl_out_t rlc;
|
||||
pdcp_ctrl_out_t pdcp;
|
||||
slice_ctrl_out_t slice;
|
||||
tc_ctrl_out_t tc;
|
||||
};
|
||||
sm_ag_if_ans_e type;
|
||||
} sm_ag_if_ans_t;
|
||||
|
||||
#endif
|
||||
|
||||
16
executables/agent_if/conf_file.h
Normal file
16
executables/agent_if/conf_file.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef FLEXRIC_CONFIGURATION_FILE_H
|
||||
#define FLEXRIC_CONFIGURATION_FILE_H
|
||||
|
||||
#define FR_CONF_FILE_LEN 128
|
||||
|
||||
typedef struct {
|
||||
char conf_file[FR_CONF_FILE_LEN];
|
||||
char libs_dir[FR_CONF_FILE_LEN];
|
||||
} fr_args_t;
|
||||
|
||||
fr_args_t init_fr_args(int argc, char* argv[]);
|
||||
|
||||
char* get_near_ric_ip(fr_args_t const*);
|
||||
|
||||
#endif
|
||||
|
||||
41
executables/agent_if/e2_agent_api.h
Normal file
41
executables/agent_if/e2_agent_api.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 E2_AGENT_API_MOSAIC_H
|
||||
#define E2_AGENT_API_MOSAIC_H
|
||||
|
||||
#include "sm_io.h"
|
||||
#include "conf_file.h"
|
||||
|
||||
void init_agent_api(int mcc,
|
||||
int mnc,
|
||||
int mnc_digit_len,
|
||||
int nb_id,
|
||||
sm_io_ag_t io,
|
||||
fr_args_t const* args);
|
||||
|
||||
|
||||
void stop_agent_api(void);
|
||||
|
||||
#endif
|
||||
|
||||
BIN
executables/agent_if/libe2_agent.a
Normal file
BIN
executables/agent_if/libe2_agent.a
Normal file
Binary file not shown.
2
executables/agent_if/read/README.md
Normal file
2
executables/agent_if/read/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
I do not like the idea of duplicating structs. Rethink the implementation!
|
||||
|
||||
75
executables/agent_if/read/sm_ag_if_rd.c
Normal file
75
executables/agent_if/read/sm_ag_if_rd.c
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#include "sm_ag_if_rd.h"
|
||||
#include "../../mac_sm/ie/mac_data_ie.h"
|
||||
#include "../../rlc_sm/ie/rlc_data_ie.h"
|
||||
#include "../../pdcp_sm/ie/pdcp_data_ie.h"
|
||||
#include "../../slice_sm/ie/slice_data_ie.h"
|
||||
#include "../../tc_sm/ie/tc_data_ie.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void free_sm_ag_if_rd(sm_ag_if_rd_t* d)
|
||||
{
|
||||
assert(d != NULL);
|
||||
|
||||
if(d->type == MAC_STATS_V0){
|
||||
free_mac_ind_data(&d->mac_stats);
|
||||
} else if(d->type == RLC_STATS_V0){
|
||||
free_rlc_ind_data(&d->rlc_stats);
|
||||
} else if(d->type == PDCP_STATS_V0){
|
||||
free_pdcp_ind_data(&d->pdcp_stats);
|
||||
} else if(d->type == SLICE_STATS_V0){
|
||||
free_slice_ind_data(&d->slice_stats);
|
||||
} else if(d->type == TC_STATS_V0){
|
||||
free_tc_ind_data(&d->tc_stats);
|
||||
} else {
|
||||
assert(0!=0 && "Unforeseen case");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sm_ag_if_rd_t cp_sm_ag_if_rd(sm_ag_if_rd_t const* d)
|
||||
{
|
||||
assert(d != NULL);
|
||||
|
||||
sm_ag_if_rd_t ans = {.type = d->type};
|
||||
|
||||
if(ans.type == MAC_STATS_V0){
|
||||
ans.mac_stats = cp_mac_ind_data(&d->mac_stats);
|
||||
} else if(ans.type == RLC_STATS_V0 ){
|
||||
ans.rlc_stats = cp_rlc_ind_data(&d->rlc_stats);
|
||||
} else if(ans.type == PDCP_STATS_V0) {
|
||||
ans.pdcp_stats = cp_pdcp_ind_data(&d->pdcp_stats);
|
||||
} else if(ans.type == SLICE_STATS_V0) {
|
||||
ans.slice_stats = cp_slice_ind_data(&d->slice_stats);
|
||||
} else if(ans.type == TC_STATS_V0) {
|
||||
ans.tc_stats = cp_tc_ind_data(&d->tc_stats);
|
||||
} else { //slice_ind_data_t slice_stats
|
||||
assert("Unknown type or not implemented");
|
||||
}
|
||||
|
||||
return ans;
|
||||
}
|
||||
|
||||
64
executables/agent_if/read/sm_ag_if_rd.h
Normal file
64
executables/agent_if/read/sm_ag_if_rd.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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 SM_READ_INTERFACE_H
|
||||
#define SM_READ_INTERFACE_H
|
||||
|
||||
// Interface between the SM and the agent/server.
|
||||
// The SM can call the functions here defined and implemented on the RAN/server to read data.
|
||||
|
||||
#include "../../mac_sm/ie/mac_data_ie.h"
|
||||
#include "../../rlc_sm/ie/rlc_data_ie.h"
|
||||
#include "../../pdcp_sm/ie/pdcp_data_ie.h"
|
||||
#include "../../slice_sm/ie/slice_data_ie.h"
|
||||
#include "../../tc_sm/ie/tc_data_ie.h"
|
||||
|
||||
|
||||
typedef enum{
|
||||
MAC_STATS_V0,
|
||||
RLC_STATS_V0,
|
||||
PDCP_STATS_V0,
|
||||
SLICE_STATS_V0,
|
||||
TC_STATS_V0,
|
||||
|
||||
SM_AGENT_IF_READ_V0_END,
|
||||
} sm_ag_if_rd_e;
|
||||
|
||||
// Do not change the order of data in the struct
|
||||
typedef struct{
|
||||
union {
|
||||
mac_ind_data_t mac_stats;
|
||||
rlc_ind_data_t rlc_stats;
|
||||
pdcp_ind_data_t pdcp_stats;
|
||||
slice_ind_data_t slice_stats;
|
||||
tc_ind_data_t tc_stats;
|
||||
};
|
||||
sm_ag_if_rd_e type;
|
||||
} sm_ag_if_rd_t;
|
||||
|
||||
|
||||
void free_sm_ag_if_rd(sm_ag_if_rd_t* d);
|
||||
|
||||
sm_ag_if_rd_t cp_sm_ag_if_rd(sm_ag_if_rd_t const* d);
|
||||
|
||||
#endif
|
||||
|
||||
55
executables/agent_if/sm_alloc.h
Normal file
55
executables/agent_if/sm_alloc.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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 SM_ALLOCATION_H
|
||||
#define SM_ALLOCATION_H
|
||||
|
||||
////////////////////////////////////
|
||||
// 5 ORAN E2AP procedures
|
||||
// defined in ORAN-WG3.E2SM-v01.00.00
|
||||
///////////////////////////////////
|
||||
|
||||
// (De)Allocation of the messages generated by the Service Models
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct{
|
||||
|
||||
void (*free_subs_data_msg)(void* msg);
|
||||
|
||||
void (*free_ind_data)(void* msg);
|
||||
|
||||
void (*free_ctrl_out_data)(void* msg);
|
||||
|
||||
void (*free_ctrl_req_data)(void* msg);
|
||||
|
||||
void (*free_e2_setup)(void* msg);
|
||||
|
||||
void (*free_ric_service_update)(void* msg);
|
||||
|
||||
} sm_alloc_t;
|
||||
|
||||
#endif
|
||||
|
||||
39
executables/agent_if/sm_io.h
Normal file
39
executables/agent_if/sm_io.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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 SM_INPUT_OUTPUT_H
|
||||
#define SM_INPUT_OUTPUT_H
|
||||
|
||||
#include "read/sm_ag_if_rd.h"
|
||||
#include "write/sm_ag_if_wr.h"
|
||||
#include "ans/sm_ag_if_ans.h"
|
||||
|
||||
// The SM agent uses this two functions to communicate with the RAN and with the server.
|
||||
typedef struct{
|
||||
|
||||
void (*read)(sm_ag_if_rd_t* data);
|
||||
|
||||
sm_ag_if_ans_t (*write)(sm_ag_if_wr_t const* data);
|
||||
|
||||
} sm_io_ag_t;
|
||||
|
||||
#endif
|
||||
|
||||
59
executables/agent_if/write/sm_ag_if_wr.h
Normal file
59
executables/agent_if/write/sm_ag_if_wr.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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 E2AP_SM_WR_IF_H
|
||||
#define E2AP_SM_WR_IF_H
|
||||
|
||||
#include "subscribe_timer.h"
|
||||
#include "../../pdcp_sm/ie/pdcp_data_ie.h"
|
||||
#include "../../rlc_sm/ie/rlc_data_ie.h"
|
||||
#include "../../mac_sm/ie/mac_data_ie.h"
|
||||
#include "../../slice_sm/ie/slice_data_ie.h"
|
||||
#include "../../tc_sm/ie/tc_data_ie.h"
|
||||
|
||||
typedef enum{
|
||||
SUBSCRIBE_TIMER = 0,
|
||||
MAC_CTRL_REQ_V0 = 1,
|
||||
RLC_CTRL_REQ_V0 = 2,
|
||||
PDCP_CTRL_REQ_V0 = 3,
|
||||
SLICE_CTRL_REQ_V0 = 4,
|
||||
TC_CTRL_REQ_V0 = 5,
|
||||
// PDCP_OUT_CTRL_V0 = 4,
|
||||
|
||||
SM_AGENT_IF_WRITE_V0_END,
|
||||
} sm_ag_if_wr_e;
|
||||
|
||||
typedef struct {
|
||||
union{
|
||||
subscribe_timer_t sub_timer;
|
||||
mac_ctrl_req_data_t mac_ctrl;
|
||||
rlc_ctrl_req_data_t rlc_ctrl;
|
||||
pdcp_ctrl_req_data_t pdcp_req_ctrl;
|
||||
slice_ctrl_req_data_t slice_req_ctrl;
|
||||
tc_ctrl_req_data_t tc_req_ctrl;
|
||||
// pdcp_ctrl_out_data_t pdcp_out_ctrl;
|
||||
};
|
||||
sm_ag_if_wr_e type;
|
||||
} sm_ag_if_wr_t;
|
||||
|
||||
#endif
|
||||
|
||||
35
executables/agent_if/write/subscribe_timer.h
Normal file
35
executables/agent_if/write/subscribe_timer.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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 SUBSCRIBE_TIMER_EUR_H
|
||||
#define SUBSCRIBE_TIMER_EUR_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct{
|
||||
uint32_t ms;
|
||||
} subscribe_timer_t;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
54
executables/mac_sm/CMakeLists.txt
Normal file
54
executables/mac_sm/CMakeLists.txt
Normal file
@@ -0,0 +1,54 @@
|
||||
cmake_minimum_required(VERSION 3.15) # setting this is required
|
||||
project(mac_sm) # this sets the project name
|
||||
|
||||
set(SM_ENCODING_MAC_SRC
|
||||
../sm_proc_data.c
|
||||
mac_sm_ric.c
|
||||
mac_sm_agent.c
|
||||
../../util/byte_array.c
|
||||
../../util/alg_ds/alg/defer.c
|
||||
../../util/alg_ds/alg/eq_float.c
|
||||
../../util/alg_ds/ds/seq_container/seq_arr.c
|
||||
../../util/alg_ds/ds/seq_container/seq_ring.c
|
||||
../../util/alg_ds/ds/assoc_container/assoc_rb_tree.c
|
||||
../../util/alg_ds/ds/assoc_container/bimap.c
|
||||
ie/mac_data_ie.c
|
||||
)
|
||||
|
||||
if(SM_ENCODING_MAC STREQUAL "PLAIN")
|
||||
add_library(mac_sm SHARED
|
||||
${SM_ENCODING_MAC_SRC}
|
||||
enc/mac_enc_plain.c
|
||||
dec/mac_dec_plain.c
|
||||
)
|
||||
|
||||
elseif(SM_ENCODING_MAC STREQUAL "ASN")
|
||||
message(FATAL_ERROR "MAC SM ASN not implemented")
|
||||
|
||||
add_subdirectory(ie/asn)
|
||||
|
||||
add_library(mac_sm SHARED
|
||||
${SM_ENCODING_MAC_SRC}
|
||||
enc/mac_enc_asn.c
|
||||
dec/mac_dec_asn.c
|
||||
)
|
||||
target_include_directories(mac_sm PRIVATE
|
||||
"ie/asn")
|
||||
target_compile_options(mac_sm PUBLIC "-DASN_DISABLE_OER_SUPPORT")
|
||||
target_compile_options(mac_sm PRIVATE -Wno-missing-field-initializers -Wno-unused-parameter)
|
||||
|
||||
elseif(SM_ENCODING_MAC STREQUAL "FLATBUFFERS" )
|
||||
message(FATAL_ERROR "MAC SM FB not implemented")
|
||||
add_library(mac_sm SHARED
|
||||
${SM_ENCODING_MAC_SRC}
|
||||
enc/mac_enc_fb.c
|
||||
dec/mac_dec_fb.c
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown SM encoding type")
|
||||
endif()
|
||||
|
||||
|
||||
target_compile_definitions(mac_sm PUBLIC ${SM_ENCODING_MAC})
|
||||
|
||||
|
||||
128
executables/mac_sm/dec/mac_dec_asn.c
Normal file
128
executables/mac_sm/dec/mac_dec_asn.c
Normal file
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "mac_dec_asn.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
//#include "../ie/asn/E2SM-MACStats-EventTriggerDefinition.h"
|
||||
//#include "../ie/asn/E2SM-MACStats-EventTriggerDefinition-Format1.h"
|
||||
//#include "../ie/asn/E2SM-MACStats-IndicationMessage.h"
|
||||
|
||||
|
||||
|
||||
mac_event_trigger_t mac_dec_event_trigger_asn(size_t len, uint8_t const buf[len])
|
||||
{
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
/*
|
||||
E2SM_MACStats_EventTriggerDefinition_t ev_tr = {0};
|
||||
E2SM_MACStats_EventTriggerDefinition_t* ev_tr_ptr = &ev_tr;
|
||||
|
||||
const enum asn_transfer_syntax syntax = ATS_ALIGNED_BASIC_PER;
|
||||
const asn_dec_rval_t rval = asn_decode(NULL, syntax, &asn_DEF_E2SM_MACStats_EventTriggerDefinition, (void **) &ev_tr_ptr, buf, len);
|
||||
assert(rval.code == RC_OK);
|
||||
|
||||
MACStats_TriggerNature_t val = ev_tr.choice.eventDefinition_Format1->triggerNature;
|
||||
mac_event_trigger_t ret = {0};
|
||||
if(val == MACStats_TriggerNature_oneMs ){
|
||||
ret.ms = 1;
|
||||
}else if( val == MACStats_TriggerNature_twoMs ){
|
||||
ret.ms = 2;
|
||||
} else if (val == MACStats_TriggerNature_fiveMs ) {
|
||||
ret.ms = 5;
|
||||
} else {
|
||||
assert(0!=0 && "Not implemented case");
|
||||
}
|
||||
|
||||
// Despite its name, it frees the elements allocated by asn_decode
|
||||
ASN_STRUCT_RESET(asn_DEF_E2SM_MACStats_EventTriggerDefinition, &ev_tr );
|
||||
|
||||
return ret;
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
mac_action_def_t mac_dec_action_def_asn(size_t len, uint8_t const action_def[len])
|
||||
{
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
mac_ind_hdr_t mac_dec_ind_hdr_asn(size_t len, uint8_t const ind_hdr[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
}
|
||||
|
||||
mac_ind_msg_t mac_dec_ind_msg_asn(size_t len, uint8_t const ind_msg[len])
|
||||
{
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
/*
|
||||
E2SM_MACStats_IndicationMessage_t ind_msg_asn = {0};
|
||||
E2SM_MACStats_IndicationMessage_t* ind_msg_ptr = &ind_msg_asn;
|
||||
|
||||
const enum asn_transfer_syntax syntax = ATS_ALIGNED_BASIC_PER;
|
||||
const asn_dec_rval_t rval = asn_decode(NULL, syntax, &asn_DEF_E2SM_MACStats_IndicationMessage, (void **) &ind_msg_ptr, ind_msg, len);
|
||||
assert(rval.code == RC_OK);
|
||||
|
||||
|
||||
mac_ind_msg_t ret = {.tx_bytes = ind_msg_asn.txBytes, .tx_pkts = ind_msg_asn.txPkts};
|
||||
ASN_STRUCT_RESET(asn_DEF_E2SM_MACStats_IndicationMessage, &ind_msg_asn);
|
||||
return ret;
|
||||
*/
|
||||
}
|
||||
|
||||
mac_call_proc_id_t mac_dec_call_proc_id_asn(size_t len, uint8_t const call_proc_id[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
}
|
||||
|
||||
mac_ctrl_hdr_t mac_dec_ctrl_hdr_asn(size_t len, uint8_t const ctrl_hdr[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
}
|
||||
|
||||
mac_ctrl_msg_t mac_dec_ctrl_msg_asn(size_t len, uint8_t const ctrl_msg[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
}
|
||||
|
||||
|
||||
mac_ctrl_out_t mac_dec_ctrl_out_asn(size_t len, uint8_t const ctrl_out[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
}
|
||||
|
||||
mac_func_def_t mac_dec_func_def_asn(size_t len, uint8_t const func_def[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
}
|
||||
|
||||
49
executables/mac_sm/dec/mac_dec_asn.h
Normal file
49
executables/mac_sm/dec/mac_dec_asn.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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 MAC_DECRYPTION_ASN_H
|
||||
#define MAC_DECRYPTION_ASN_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "../ie/mac_data_ie.h"
|
||||
|
||||
|
||||
mac_event_trigger_t mac_dec_event_trigger_asn(size_t len, uint8_t const ev_tr[len]);
|
||||
|
||||
mac_action_def_t mac_dec_action_def_asn(size_t len, uint8_t const action_def[len]);
|
||||
|
||||
mac_ind_hdr_t mac_dec_ind_hdr_asn(size_t len, uint8_t const ind_hdr[len]);
|
||||
|
||||
mac_ind_msg_t mac_dec_ind_msg_asn(size_t len, uint8_t const ind_msg[len]);
|
||||
|
||||
mac_call_proc_id_t mac_dec_call_proc_id_asn(size_t len, uint8_t const call_proc_id[len]);
|
||||
|
||||
mac_ctrl_hdr_t mac_dec_ctrl_hdr_asn(size_t len, uint8_t const ctrl_hdr[len]);
|
||||
|
||||
mac_ctrl_msg_t mac_dec_ctrl_msg_asn(size_t len, uint8_t const ctrl_msg[len]);
|
||||
|
||||
mac_ctrl_out_t mac_dec_ctrl_out_asn(size_t len, uint8_t const ctrl_out[len]);
|
||||
|
||||
mac_func_def_t mac_dec_func_def_asn(size_t len, uint8_t const func_def[len]);
|
||||
|
||||
#endif
|
||||
|
||||
130
executables/mac_sm/dec/mac_dec_fb.c
Normal file
130
executables/mac_sm/dec/mac_dec_fb.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "mac_dec_fb.h"
|
||||
|
||||
//#include "../ie/fb/e2sm_mac_stats_v00_builder.h"
|
||||
//#include "../ie/fb/e2sm_mac_stats_v00_verifier.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
mac_event_trigger_t mac_dec_event_trigger_fb(size_t len, uint8_t const ev_tr[len])
|
||||
{
|
||||
assert(len > 0);
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
/*
|
||||
assert(E2SM_MACStats_EventTrigger_verify_as_root(ev_tr, len) == 0 && "Invalid event trigger");
|
||||
|
||||
// int rc = E2SM_MACStats_EventTrigger_verify_as_root(ev_tr, len);
|
||||
// printf("EventTrigger is invalid: %s\n", flatcc_verify_error_string(rc));
|
||||
|
||||
E2SM_MACStats_EventTrigger_table_t ev_tr_fb = E2SM_MACStats_EventTrigger_as_root(ev_tr);
|
||||
assert(ev_tr_fb != NULL);
|
||||
|
||||
const uint8_t val = E2SM_MACStats_EventTrigger_trig(ev_tr_fb);
|
||||
|
||||
mac_event_trigger_t ret = {0};
|
||||
if(val == E2SM_MACStats_TriggerNature_oneMs){
|
||||
ret.ms = 1;
|
||||
} else if(val == E2SM_MACStats_TriggerNature_twoMs){
|
||||
ret.ms = 2;
|
||||
} else if(val == E2SM_MACStats_TriggerNature_fiveMs){
|
||||
ret.ms = 5;
|
||||
} else {
|
||||
assert(0!=0 && "Not foreseen case");
|
||||
}
|
||||
return ret;
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
mac_action_def_t mac_dec_action_def_fb(size_t len, uint8_t const action_def[len])
|
||||
{
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
mac_ind_hdr_t mac_dec_ind_hdr_fb(size_t len, uint8_t const ind_hdr[len])
|
||||
{
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
mac_ind_msg_t mac_dec_ind_msg_fb(size_t len, uint8_t const ind_msg[len])
|
||||
{
|
||||
assert(len > 0);
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
/*
|
||||
assert(E2SM_MACStats_IndicationMessage_verify_as_root(ind_msg, len) == 0 && "Invalid event trigger");
|
||||
|
||||
// int rc = E2SM_MACStats_EventTrigger_verify_as_root(ev_tr, len);
|
||||
// printf("EventTrigger is invalid: %s\n", flatcc_verify_error_string(rc));
|
||||
|
||||
|
||||
E2SM_MACStats_IndicationMessage_table_t ind_msg_fb = E2SM_MACStats_IndicationMessage_as_root(ind_msg);
|
||||
assert(ind_msg_fb != NULL);
|
||||
|
||||
mac_ind_msg_t ret = {0};
|
||||
ret.tx_bytes = E2SM_MACStats_IndicationMessage_tx_bytes(ind_msg_fb);
|
||||
ret.tx_pkts = E2SM_MACStats_IndicationMessage_tx_pkts(ind_msg_fb);
|
||||
return ret;
|
||||
*/
|
||||
}
|
||||
|
||||
mac_call_proc_id_t mac_dec_call_proc_id_fb(size_t len, uint8_t const call_proc_id[len])
|
||||
{
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
mac_ctrl_hdr_t mac_dec_ctrl_hdr_fb(size_t len, uint8_t const ctrl_hdr[len])
|
||||
{
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
mac_ctrl_msg_t mac_dec_ctrl_msg_fb(size_t len, uint8_t const ctrl_msg[len])
|
||||
{
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
|
||||
mac_ctrl_out_t mac_dec_ctrl_out_fb(size_t len, uint8_t const ctrl_out[len])
|
||||
{
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
mac_func_def_t mac_dec_func_def_fb(size_t len, uint8_t const func_def[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
|
||||
50
executables/mac_sm/dec/mac_dec_fb.h
Normal file
50
executables/mac_sm/dec/mac_dec_fb.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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 MAC_DECRYPTION_FLATBUFFERS_H
|
||||
#define MAC_DECRYPTION_FLATBUFFERS_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "../ie/mac_data_ie.h"
|
||||
|
||||
|
||||
mac_event_trigger_t mac_dec_event_trigger_fb(size_t len, uint8_t const ev_tr[len]);
|
||||
|
||||
mac_action_def_t mac_dec_action_def_fb(size_t len, uint8_t const action_def[len]);
|
||||
|
||||
mac_ind_hdr_t mac_dec_ind_hdr_fb(size_t len, uint8_t const ind_hdr[len]);
|
||||
|
||||
mac_ind_msg_t mac_dec_ind_msg_fb(size_t len, uint8_t const ind_msg[len]);
|
||||
|
||||
mac_call_proc_id_t mac_dec_call_proc_id_fb(size_t len, uint8_t const call_proc_id[len]);
|
||||
|
||||
mac_ctrl_hdr_t mac_dec_ctrl_hdr_fb(size_t len, uint8_t const ctrl_hdr[len]);
|
||||
|
||||
mac_ctrl_msg_t mac_dec_ctrl_msg_fb(size_t len, uint8_t const ctrl_msg[len]);
|
||||
|
||||
mac_ctrl_out_t mac_dec_ctrl_out_fb(size_t len, uint8_t const ctrl_out[len]);
|
||||
|
||||
mac_func_def_t mac_dec_func_def_fb(size_t len, uint8_t const func_def[len]);
|
||||
|
||||
#endif
|
||||
|
||||
92
executables/mac_sm/dec/mac_dec_generic.h
Normal file
92
executables/mac_sm/dec/mac_dec_generic.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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 MAC_DECRYPTION_GENERIC
|
||||
#define MAC_DECRYPTION_GENERIC
|
||||
|
||||
#include "mac_dec_asn.h"
|
||||
#include "mac_dec_fb.h"
|
||||
#include "mac_dec_plain.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// 9 Information Elements that are interpreted by the SM according
|
||||
// to ORAN-WG3.E2SM-v01.00.00 Technical Specification
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#define mac_dec_event_trigger(T,U,V) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_dec_event_trigger_plain, \
|
||||
mac_enc_asn_t*: mac_dec_event_trigger_asn,\
|
||||
mac_enc_fb_t*: mac_dec_event_trigger_fb,\
|
||||
default: mac_dec_event_trigger_plain) (U,V)
|
||||
|
||||
#define mac_dec_action_def(T,U,V) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_dec_action_def_plain, \
|
||||
mac_enc_asn_t*: mac_dec_action_def_asn, \
|
||||
mac_enc_fb_t*: mac_dec_action_def_fb, \
|
||||
default: mac_dec_action_def_plain) (U,V)
|
||||
|
||||
#define mac_dec_ind_hdr(T,U,V) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_dec_ind_hdr_plain , \
|
||||
mac_enc_asn_t*: mac_dec_ind_hdr_asn, \
|
||||
mac_enc_fb_t*: mac_dec_ind_hdr_fb, \
|
||||
default: mac_dec_ind_hdr_plain) (U,V)
|
||||
|
||||
#define mac_dec_ind_msg(T,U,V) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_dec_ind_msg_plain , \
|
||||
mac_enc_asn_t*: mac_dec_ind_msg_asn, \
|
||||
mac_enc_fb_t*: mac_dec_ind_msg_fb, \
|
||||
default: mac_dec_ind_msg_plain) (U,V)
|
||||
|
||||
#define mac_dec_call_proc_id(T,U,V) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_dec_call_proc_id_plain , \
|
||||
mac_enc_asn_t*: mac_dec_call_proc_id_asn, \
|
||||
mac_enc_fb_t*: mac_dec_call_proc_id_fb, \
|
||||
default: mac_dec_call_proc_id_plain) (U,V)
|
||||
|
||||
#define mac_dec_ctrl_hdr(T,U,V) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_dec_ctrl_hdr_plain , \
|
||||
mac_enc_asn_t*: mac_dec_ctrl_hdr_asn, \
|
||||
mac_enc_fb_t*: mac_dec_ctrl_hdr_fb, \
|
||||
default: mac_dec_ctrl_hdr_plain) (U,V)
|
||||
|
||||
#define mac_dec_ctrl_msg(T,U,V) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_dec_ctrl_msg_plain , \
|
||||
mac_enc_asn_t*: mac_dec_ctrl_msg_asn, \
|
||||
mac_enc_fb_t*: mac_dec_ctrl_msg_fb, \
|
||||
default: mac_dec_ctrl_msg_plain) (U,V)
|
||||
|
||||
#define mac_dec_ctrl_out(T,U,V) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_dec_ctrl_out_plain , \
|
||||
mac_enc_asn_t*: mac_dec_ctrl_out_asn, \
|
||||
mac_enc_fb_t*: mac_dec_ctrl_out_fb, \
|
||||
default: mac_dec_ctrl_out_plain) (U,V)
|
||||
|
||||
#define mac_dec_func_def(T,U,V) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_dec_func_def_plain, \
|
||||
mac_enc_asn_t*: mac_dec_func_def_asn, \
|
||||
mac_enc_fb_t*: mac_dec_func_def_fb, \
|
||||
default: mac_dec_func_def_plain) (U,V)
|
||||
|
||||
#endif
|
||||
|
||||
116
executables/mac_sm/dec/mac_dec_plain.c
Normal file
116
executables/mac_sm/dec/mac_dec_plain.c
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "mac_dec_plain.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
mac_event_trigger_t mac_dec_event_trigger_plain(size_t len, uint8_t const ev_tr[len])
|
||||
{
|
||||
mac_event_trigger_t ev = {0};
|
||||
memcpy(&ev.ms, ev_tr, sizeof(ev.ms));
|
||||
return ev;
|
||||
}
|
||||
|
||||
mac_action_def_t mac_dec_action_def_plain(size_t len, uint8_t const action_def[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(action_def != NULL);
|
||||
mac_action_def_t act_def;// = {0};
|
||||
return act_def;
|
||||
}
|
||||
|
||||
mac_ind_hdr_t mac_dec_ind_hdr_plain(size_t len, uint8_t const ind_hdr[len])
|
||||
{
|
||||
assert(len == sizeof(mac_ind_hdr_t));
|
||||
mac_ind_hdr_t ret;
|
||||
memcpy(&ret, ind_hdr, len);
|
||||
return ret;
|
||||
}
|
||||
|
||||
mac_ind_msg_t mac_dec_ind_msg_plain(size_t len, uint8_t const ind_msg[len])
|
||||
{
|
||||
// assert(len == sizeof(mac_ind_msg_t));
|
||||
mac_ind_msg_t ret;
|
||||
|
||||
static_assert(sizeof(uint32_t) == sizeof(ret.len_ue_stats), "Different sizes!");
|
||||
|
||||
const size_t len_sizeof = sizeof(ret.len_ue_stats);
|
||||
memcpy(&ret.len_ue_stats, ind_msg, len_sizeof);
|
||||
|
||||
if(ret.len_ue_stats > 0){
|
||||
ret.ue_stats = calloc(ret.len_ue_stats, sizeof(mac_ue_stats_impl_t));
|
||||
assert(ret.ue_stats != NULL && "Memory exhausted!");
|
||||
}
|
||||
|
||||
void* ptr = (void*)&ind_msg[len_sizeof];
|
||||
for(uint32_t i = 0; i < ret.len_ue_stats; ++i){
|
||||
memcpy(&ret.ue_stats[i], ptr, sizeof( mac_ue_stats_impl_t) );
|
||||
ptr += sizeof( mac_ue_stats_impl_t);
|
||||
}
|
||||
|
||||
memcpy(&ret.tstamp, ptr, sizeof(ret.tstamp));
|
||||
|
||||
ptr += sizeof(ret.tstamp);
|
||||
assert(ptr == ind_msg + len && "data layout mismacth");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
mac_call_proc_id_t mac_dec_call_proc_id_plain(size_t len, uint8_t const call_proc_id[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(call_proc_id != NULL);
|
||||
}
|
||||
|
||||
mac_ctrl_hdr_t mac_dec_ctrl_hdr_plain(size_t len, uint8_t const ctrl_hdr[len])
|
||||
{
|
||||
assert(len == sizeof(mac_ctrl_hdr_t));
|
||||
mac_ctrl_hdr_t ret;
|
||||
memcpy(&ret, ctrl_hdr, len);
|
||||
return ret;
|
||||
}
|
||||
|
||||
mac_ctrl_msg_t mac_dec_ctrl_msg_plain(size_t len, uint8_t const ctrl_msg[len])
|
||||
{
|
||||
assert(len == sizeof(mac_ctrl_msg_t));
|
||||
mac_ctrl_msg_t ret;
|
||||
memcpy(&ret, ctrl_msg, len);
|
||||
return ret;
|
||||
}
|
||||
|
||||
mac_ctrl_out_t mac_dec_ctrl_out_plain(size_t len, uint8_t const ctrl_out[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ctrl_out != NULL);
|
||||
}
|
||||
|
||||
mac_func_def_t mac_dec_func_def_plain(size_t len, uint8_t const func_def[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(func_def != NULL);
|
||||
}
|
||||
|
||||
|
||||
52
executables/mac_sm/dec/mac_dec_plain.h
Normal file
52
executables/mac_sm/dec/mac_dec_plain.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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 MAC_DECRYPTION_PLAIN_H
|
||||
#define MAC_DECRYPTION_PLAIN_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "../ie/mac_data_ie.h"
|
||||
|
||||
|
||||
mac_event_trigger_t mac_dec_event_trigger_plain(size_t len, uint8_t const ev_tr[len]);
|
||||
|
||||
mac_action_def_t mac_dec_action_def_plain(size_t len, uint8_t const action_def[len]);
|
||||
|
||||
mac_ind_hdr_t mac_dec_ind_hdr_plain(size_t len, uint8_t const ind_hdr[len]);
|
||||
|
||||
mac_ind_msg_t mac_dec_ind_msg_plain(size_t len, uint8_t const ind_msg[len]);
|
||||
|
||||
mac_call_proc_id_t mac_dec_call_proc_id_plain(size_t len, uint8_t const call_proc_id[len]);
|
||||
|
||||
mac_ctrl_hdr_t mac_dec_ctrl_hdr_plain(size_t len, uint8_t const ctrl_hdr[len]);
|
||||
|
||||
mac_ctrl_msg_t mac_dec_ctrl_msg_plain(size_t len, uint8_t const ctrl_msg[len]);
|
||||
|
||||
mac_ctrl_out_t mac_dec_ctrl_out_plain(size_t len, uint8_t const ctrl_out[len]);
|
||||
|
||||
mac_func_def_t mac_dec_func_def_plain(size_t len, uint8_t const func_def[len]);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
173
executables/mac_sm/enc/mac_enc_asn.c
Normal file
173
executables/mac_sm/enc/mac_enc_asn.c
Normal file
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "mac_enc_asn.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
//#include "../ie/asn/E2SM-MACStats-EventTriggerDefinition.h"
|
||||
//#include "../ie/asn/E2SM-MACStats-EventTriggerDefinition-Format1.h"
|
||||
//#include "../ie/asn/E2SM-MACStats-IndicationMessage.h"
|
||||
|
||||
|
||||
//#include "asn_application.h"
|
||||
|
||||
/*
|
||||
static
|
||||
byte_array_t encode(const void* pdu, asn_TYPE_descriptor_t type)
|
||||
{
|
||||
assert(pdu != NULL);
|
||||
byte_array_t b = {.buf = malloc(2048), .len = 2048};
|
||||
assert(b.buf != NULL);
|
||||
// xer_fprint(stderr, &asn_DEF_E2AP_PDU, pdu);
|
||||
const enum asn_transfer_syntax syntax = ATS_ALIGNED_BASIC_PER;
|
||||
asn_enc_rval_t er = asn_encode_to_buffer(NULL, syntax, &type, pdu, b.buf, b.len);
|
||||
assert(er.encoded < (ssize_t) b.len);
|
||||
if(er.encoded == -1) {
|
||||
printf("Failed the encoding in type %s and xml_type = %s\n", er.failed_type->name, er.failed_type->xml_tag);
|
||||
fflush(stdout);
|
||||
assert(0!=0 && "Failed encoding");
|
||||
}
|
||||
assert(er.encoded > -1);
|
||||
b.len = er.encoded;
|
||||
return b;
|
||||
}
|
||||
*/
|
||||
|
||||
byte_array_t mac_enc_event_trigger_asn(mac_event_trigger_t const* event_trigger)
|
||||
{
|
||||
assert(event_trigger != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
/*
|
||||
E2SM_MACStats_EventTriggerDefinition_t ev_tr = {0};
|
||||
|
||||
ev_tr.present = E2SM_MACStats_EventTriggerDefinition_PR_eventDefinition_Format1;
|
||||
|
||||
E2SM_MACStats_EventTriggerDefinition_Format1_t format = {0};
|
||||
|
||||
if(event_trigger->ms == 1){
|
||||
format.triggerNature = MACStats_TriggerNature_oneMs;
|
||||
} else if(event_trigger->ms == 2){
|
||||
format.triggerNature = MACStats_TriggerNature_twoMs;
|
||||
} else if(event_trigger->ms == 5){
|
||||
format.triggerNature = MACStats_TriggerNature_fiveMs;
|
||||
} else {
|
||||
assert(0!=0 && "Not valid event trigger value");
|
||||
}
|
||||
|
||||
ev_tr.choice.eventDefinition_Format1 = &format;
|
||||
byte_array_t ba = encode(&ev_tr, asn_DEF_E2SM_MACStats_EventTriggerDefinition);
|
||||
|
||||
return ba;
|
||||
*/
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_action_def_asn(mac_action_def_t const* action_def)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(action_def != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_ind_hdr_asn(mac_ind_hdr_t const* ind_hdr)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ind_hdr != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_ind_msg_asn(mac_ind_msg_t const* ind_msg)
|
||||
{
|
||||
assert(ind_msg != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
|
||||
/*
|
||||
E2SM_MACStats_IndicationMessage_t ind_msg_asn = {0};
|
||||
ind_msg_asn.txBytes = ind_msg->tx_bytes;
|
||||
ind_msg_asn.txPkts = ind_msg->tx_pkts;
|
||||
|
||||
byte_array_t ba = encode(&ind_msg_asn, asn_DEF_E2SM_MACStats_IndicationMessage);
|
||||
|
||||
return ba;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
byte_array_t mac_enc_call_proc_id_asn(mac_call_proc_id_t const* call_proc_id)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(call_proc_id != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_ctrl_hdr_asn(mac_ctrl_hdr_t const* ctrl_hdr)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ctrl_hdr != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_ctrl_msg_asn(mac_ctrl_msg_t const* ctrl_msg)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ctrl_msg != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
|
||||
byte_array_t mac_enc_ctrl_out_asn(mac_ctrl_out_t const* ctrl)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert( ctrl != NULL );
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_func_def_asn(mac_func_def_t const* func)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(func != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
55
executables/mac_sm/enc/mac_enc_asn.h
Normal file
55
executables/mac_sm/enc/mac_enc_asn.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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 MAC_ENCRYPTIOIN_ASN_H
|
||||
#define MAC_ENCRYPTIOIN_ASN_H
|
||||
|
||||
#include "../../../util/byte_array.h"
|
||||
#include "../ie/mac_data_ie.h"
|
||||
|
||||
// Used for static polymorphism.
|
||||
// See mac_enc_generic.h file
|
||||
typedef struct{
|
||||
|
||||
} mac_enc_asn_t;
|
||||
|
||||
byte_array_t mac_enc_event_trigger_asn(mac_event_trigger_t const* event_trigger);
|
||||
|
||||
byte_array_t mac_enc_action_def_asn(mac_action_def_t const*);
|
||||
|
||||
byte_array_t mac_enc_ind_hdr_asn(mac_ind_hdr_t const*);
|
||||
|
||||
byte_array_t mac_enc_ind_msg_asn(mac_ind_msg_t const*);
|
||||
|
||||
byte_array_t mac_enc_call_proc_id_asn(mac_call_proc_id_t const*);
|
||||
|
||||
byte_array_t mac_enc_ctrl_hdr_asn(mac_ctrl_hdr_t const*);
|
||||
|
||||
byte_array_t mac_enc_ctrl_msg_asn(mac_ctrl_msg_t const*);
|
||||
|
||||
byte_array_t mac_enc_ctrl_out_asn(mac_ctrl_out_t const*);
|
||||
|
||||
byte_array_t mac_enc_func_def_asn(mac_func_def_t const*);
|
||||
|
||||
#endif
|
||||
|
||||
174
executables/mac_sm/enc/mac_enc_fb.c
Normal file
174
executables/mac_sm/enc/mac_enc_fb.c
Normal file
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "mac_enc_fb.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
//#include "../ie/fb/e2sm_mac_stats_v00_builder.h"
|
||||
//#include "../ie/fb/e2sm_mac_stats_v00_verifier.h"
|
||||
|
||||
|
||||
|
||||
byte_array_t mac_enc_event_trigger_fb(mac_event_trigger_t const* event_trigger)
|
||||
{
|
||||
assert(event_trigger != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
|
||||
/*
|
||||
flatcc_builder_t builder;
|
||||
flatcc_builder_init(&builder);
|
||||
|
||||
E2SM_MACStats_EventTrigger_start_as_root(&builder);
|
||||
|
||||
if(event_trigger->ms == 1){
|
||||
E2SM_MACStats_EventTrigger_trig_add(&builder, E2SM_MACStats_TriggerNature_oneMs );
|
||||
} else if(event_trigger->ms == 2){
|
||||
E2SM_MACStats_EventTrigger_trig_add(&builder, E2SM_MACStats_TriggerNature_twoMs );
|
||||
} else if(event_trigger->ms == 5){
|
||||
E2SM_MACStats_EventTrigger_trig_add(&builder, E2SM_MACStats_TriggerNature_fiveMs );
|
||||
} else {
|
||||
assert(0!=0 && "Not foreseen state");
|
||||
}
|
||||
|
||||
|
||||
E2SM_MACStats_EventTrigger_end_as_root(&builder);
|
||||
|
||||
|
||||
size_t size = 0;
|
||||
uint8_t *buf = flatcc_builder_finalize_buffer(&builder, &size);
|
||||
byte_array_t ba = { .buf = buf, .len = size };
|
||||
|
||||
int ret;
|
||||
if ((ret = E2SM_MACStats_EventTrigger_verify_as_root(buf, size))) {
|
||||
printf("Event trigger is invalid: %s\n", flatcc_verify_error_string(ret));
|
||||
assert(0);
|
||||
}
|
||||
|
||||
flatcc_builder_clear(&builder);
|
||||
|
||||
return ba;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
byte_array_t mac_enc_action_def_fb(mac_action_def_t const* action_def)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(action_def != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_ind_hdr_fb(mac_ind_hdr_t const* ind_hdr)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ind_hdr != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_ind_msg_fb(mac_ind_msg_t const* ind_msg)
|
||||
{
|
||||
assert(ind_msg != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
/*
|
||||
flatcc_builder_t builder;
|
||||
flatcc_builder_init(&builder);
|
||||
|
||||
E2SM_MACStats_IndicationMessage_start_as_root(&builder);
|
||||
E2SM_MACStats_IndicationMessage_tx_bytes_add(&builder, ind_msg->tx_bytes);
|
||||
E2SM_MACStats_IndicationMessage_tx_pkts_add(&builder, ind_msg->tx_pkts);
|
||||
|
||||
E2SM_MACStats_EventTrigger_end_as_root(&builder);
|
||||
|
||||
size_t size = 0;
|
||||
uint8_t *buf = flatcc_builder_finalize_buffer(&builder, &size);
|
||||
byte_array_t ba = { .buf = buf, .len = size };
|
||||
|
||||
int ret;
|
||||
if ((ret = E2SM_MACStats_IndicationMessage_verify_as_root(buf, size))) {
|
||||
printf("Event trigger is invalid: %s\n", flatcc_verify_error_string(ret));
|
||||
assert(0);
|
||||
}
|
||||
|
||||
flatcc_builder_clear(&builder);
|
||||
|
||||
return ba;
|
||||
*/
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_call_proc_id_fb(mac_call_proc_id_t const* call_proc_id)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(call_proc_id != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_ctrl_hdr_fb(mac_ctrl_hdr_t const* ctrl_hdr)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ctrl_hdr != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_ctrl_msg_fb(mac_ctrl_msg_t const* ctrl_msg)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ctrl_msg != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_ctrl_out_fb(mac_ctrl_out_t const* ctrl)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ctrl != NULL );
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_func_def_fb(mac_func_def_t const* func)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(func != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
57
executables/mac_sm/enc/mac_enc_fb.h
Normal file
57
executables/mac_sm/enc/mac_enc_fb.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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 MAC_ENCRYPTION_FLATBUFFERS_H
|
||||
#define MAC_ENCRYPTION_FLATBUFFERS_H
|
||||
|
||||
#include "../../../util/byte_array.h"
|
||||
#include "../ie/mac_data_ie.h"
|
||||
|
||||
|
||||
// Used for static polymorphism.
|
||||
// View mac_enc_generic file
|
||||
typedef struct{
|
||||
|
||||
} mac_enc_fb_t;
|
||||
|
||||
byte_array_t mac_enc_event_trigger_fb(mac_event_trigger_t const* event_trigger);
|
||||
|
||||
byte_array_t mac_enc_action_def_fb(mac_action_def_t const*);
|
||||
|
||||
byte_array_t mac_enc_ind_hdr_fb(mac_ind_hdr_t const*);
|
||||
|
||||
byte_array_t mac_enc_ind_msg_fb(mac_ind_msg_t const*);
|
||||
|
||||
byte_array_t mac_enc_call_proc_id_fb(mac_call_proc_id_t const*);
|
||||
|
||||
byte_array_t mac_enc_ctrl_hdr_fb(mac_ctrl_hdr_t const*);
|
||||
|
||||
byte_array_t mac_enc_ctrl_msg_fb(mac_ctrl_msg_t const*);
|
||||
|
||||
byte_array_t mac_enc_ctrl_out_fb(mac_ctrl_out_t const*);
|
||||
|
||||
byte_array_t mac_enc_func_def_fb(mac_func_def_t const*);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
92
executables/mac_sm/enc/mac_enc_generic.h
Normal file
92
executables/mac_sm/enc/mac_enc_generic.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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 MAC_ENCRYPTION_GENERIC
|
||||
#define MAC_ENCRYPTION_GENERIC
|
||||
|
||||
#include "mac_enc_asn.h"
|
||||
#include "mac_enc_fb.h"
|
||||
#include "mac_enc_plain.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// 9 Information Elements that are interpreted by the SM according
|
||||
// to ORAN-WG3.E2SM-v01.00.00 Technical Specification
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#define mac_enc_event_trigger(T,U) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_enc_event_trigger_plain, \
|
||||
mac_enc_asn_t*: mac_enc_event_trigger_asn,\
|
||||
mac_enc_fb_t*: mac_enc_event_trigger_fb,\
|
||||
default: mac_enc_event_trigger_plain) (U)
|
||||
|
||||
#define mac_enc_action_def(T,U) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_enc_action_def_plain, \
|
||||
mac_enc_asn_t*: mac_enc_action_def_asn, \
|
||||
mac_enc_fb_t*: mac_enc_action_def_fb, \
|
||||
default: mac_enc_action_def_plain) (U)
|
||||
|
||||
#define mac_enc_ind_hdr(T,U) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_enc_ind_hdr_plain , \
|
||||
mac_enc_asn_t*: mac_enc_ind_hdr_asn, \
|
||||
mac_enc_fb_t*: mac_enc_ind_hdr_fb, \
|
||||
default: mac_enc_ind_hdr_plain) (U)
|
||||
|
||||
#define mac_enc_ind_msg(T,U) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_enc_ind_msg_plain , \
|
||||
mac_enc_asn_t*: mac_enc_ind_msg_asn, \
|
||||
mac_enc_fb_t*: mac_enc_ind_msg_fb, \
|
||||
default: mac_enc_ind_msg_plain) (U)
|
||||
|
||||
#define mac_enc_call_proc_id(T,U) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_enc_call_proc_id_plain , \
|
||||
mac_enc_asn_t*: mac_enc_call_proc_id_asn, \
|
||||
mac_enc_fb_t*: mac_enc_call_proc_id_fb, \
|
||||
default: mac_enc_call_proc_id_plain) (U)
|
||||
|
||||
#define mac_enc_ctrl_hdr(T,U) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_enc_ctrl_hdr_plain , \
|
||||
mac_enc_asn_t*: mac_enc_ctrl_hdr_asn, \
|
||||
mac_enc_fb_t*: mac_enc_ctrl_hdr_fb, \
|
||||
default: mac_enc_ctrl_hdr_plain) (U)
|
||||
|
||||
#define mac_enc_ctrl_msg(T,U) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_enc_ctrl_msg_plain , \
|
||||
mac_enc_asn_t*: mac_enc_ctrl_msg_asn, \
|
||||
mac_enc_fb_t*: mac_enc_ctrl_msg_fb, \
|
||||
default: mac_enc_ctrl_msg_plain) (U)
|
||||
|
||||
#define mac_enc_ctrl_out(T,U) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_enc_ctrl_out_plain , \
|
||||
mac_enc_asn_t*: mac_enc_ctrl_out_asn, \
|
||||
mac_enc_fb_t*: mac_enc_ctrl_out_fb, \
|
||||
default: mac_enc_ctrl_out_plain) (U)
|
||||
|
||||
#define mac_enc_func_def(T,U) _Generic ((T), \
|
||||
mac_enc_plain_t*: mac_enc_func_def_plain, \
|
||||
mac_enc_asn_t*: mac_enc_func_def_asn, \
|
||||
mac_enc_fb_t*: mac_enc_func_def_fb, \
|
||||
default: mac_enc_func_def_plain) (U)
|
||||
|
||||
#endif
|
||||
|
||||
149
executables/mac_sm/enc/mac_enc_plain.c
Normal file
149
executables/mac_sm/enc/mac_enc_plain.c
Normal file
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "mac_enc_plain.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
byte_array_t mac_enc_event_trigger_plain(mac_event_trigger_t const* event_trigger)
|
||||
{
|
||||
assert(event_trigger != NULL);
|
||||
byte_array_t ba = {0};
|
||||
|
||||
ba.len = sizeof(event_trigger->ms);
|
||||
ba.buf = malloc(ba.len);
|
||||
assert(ba.buf != NULL && "Memory exhausted");
|
||||
|
||||
memcpy(ba.buf, &event_trigger->ms, ba.len);
|
||||
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_action_def_plain(mac_action_def_t const* action_def)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(action_def != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_ind_hdr_plain(mac_ind_hdr_t const* ind_hdr)
|
||||
{
|
||||
assert(ind_hdr != NULL);
|
||||
|
||||
byte_array_t ba = {0};
|
||||
|
||||
ba.len = sizeof(mac_ind_hdr_t);
|
||||
ba.buf = malloc(sizeof(mac_ind_msg_t));
|
||||
assert(ba.buf != NULL && "memory exhausted");
|
||||
memcpy(ba.buf, ind_hdr, sizeof(mac_ind_hdr_t));
|
||||
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_ind_msg_plain(mac_ind_msg_t const* ind_msg)
|
||||
{
|
||||
assert(ind_msg != NULL);
|
||||
|
||||
byte_array_t ba = {0};
|
||||
const uint32_t len = sizeof(ind_msg->len_ue_stats)
|
||||
+ sizeof(mac_ue_stats_impl_t) * ind_msg->len_ue_stats
|
||||
+ sizeof(ind_msg->tstamp);
|
||||
ba.buf = calloc(1, len);
|
||||
assert(ba.buf != NULL);
|
||||
|
||||
memcpy(ba.buf, &ind_msg->len_ue_stats, sizeof(ind_msg->len_ue_stats));
|
||||
void* ptr = ba.buf + sizeof(ind_msg->len_ue_stats);
|
||||
|
||||
for(uint32_t i = 0; i < ind_msg->len_ue_stats; ++i){
|
||||
memcpy(ptr, &ind_msg->ue_stats[i], sizeof(ind_msg->ue_stats[0]));
|
||||
ptr += sizeof(ind_msg->ue_stats[0]);
|
||||
}
|
||||
|
||||
memcpy(ptr, &ind_msg->tstamp, sizeof(ind_msg->tstamp));
|
||||
ptr += sizeof(ind_msg->tstamp);
|
||||
|
||||
assert(ptr == ba.buf + len && "Data layout mismacth");
|
||||
|
||||
ba.len = len;
|
||||
return ba;
|
||||
}
|
||||
|
||||
|
||||
byte_array_t mac_enc_call_proc_id_plain(mac_call_proc_id_t const* call_proc_id)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(call_proc_id != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_ctrl_hdr_plain(mac_ctrl_hdr_t const* ctrl_hdr)
|
||||
{
|
||||
assert(ctrl_hdr != NULL);
|
||||
byte_array_t ba = {0};
|
||||
ba.buf = malloc(sizeof(mac_ind_msg_t));
|
||||
assert(ba.buf != NULL);
|
||||
|
||||
memcpy(ba.buf, ctrl_hdr, sizeof(mac_ctrl_hdr_t));
|
||||
|
||||
ba.len = sizeof(mac_ctrl_hdr_t);
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_ctrl_msg_plain(mac_ctrl_msg_t const* ctrl_msg)
|
||||
{
|
||||
assert(ctrl_msg != NULL);
|
||||
|
||||
byte_array_t ba = {0};
|
||||
ba.buf = malloc(sizeof(mac_ctrl_msg_t));
|
||||
assert(ba.buf != NULL);
|
||||
|
||||
memcpy(ba.buf, ctrl_msg, sizeof(mac_ctrl_msg_t));
|
||||
|
||||
ba.len = sizeof(mac_ctrl_hdr_t);
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_ctrl_out_plain(mac_ctrl_out_t const* ctrl)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ctrl != NULL );
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t mac_enc_func_def_plain(mac_func_def_t const* func)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(func != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
57
executables/mac_sm/enc/mac_enc_plain.h
Normal file
57
executables/mac_sm/enc/mac_enc_plain.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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 MAC_ENCRYPTION_PLAIN_H
|
||||
#define MAC_ENCRYPTION_PLAIN_H
|
||||
|
||||
#include "../../../util/byte_array.h"
|
||||
#include "../ie/mac_data_ie.h"
|
||||
|
||||
|
||||
// Used for static polymorphism.
|
||||
// View mac_enc_generic file
|
||||
typedef struct{
|
||||
|
||||
} mac_enc_plain_t;
|
||||
|
||||
|
||||
byte_array_t mac_enc_event_trigger_plain(mac_event_trigger_t const* event_trigger);
|
||||
|
||||
byte_array_t mac_enc_action_def_plain(mac_action_def_t const*);
|
||||
|
||||
byte_array_t mac_enc_ind_hdr_plain(mac_ind_hdr_t const*);
|
||||
|
||||
byte_array_t mac_enc_ind_msg_plain(mac_ind_msg_t const*);
|
||||
|
||||
byte_array_t mac_enc_call_proc_id_plain(mac_call_proc_id_t const*);
|
||||
|
||||
byte_array_t mac_enc_ctrl_hdr_plain(mac_ctrl_hdr_t const*);
|
||||
|
||||
byte_array_t mac_enc_ctrl_msg_plain(mac_ctrl_msg_t const*);
|
||||
|
||||
byte_array_t mac_enc_ctrl_out_plain(mac_ctrl_out_t const*);
|
||||
|
||||
byte_array_t mac_enc_func_def_plain(mac_func_def_t const*);
|
||||
|
||||
#endif
|
||||
|
||||
215
executables/mac_sm/ie/e2sm_mac_v00.asn
Normal file
215
executables/mac_sm/ie/e2sm_mac_v00.asn
Normal file
@@ -0,0 +1,215 @@
|
||||
-- ASN1 START
|
||||
-- **************************************************************
|
||||
-- E2SM-MAC Stats
|
||||
-- Information Element Definitions
|
||||
--
|
||||
-- **************************************************************
|
||||
|
||||
E2SM-MACStats-IEs { }
|
||||
|
||||
DEFINITIONS AUTOMATIC TAGS ::=
|
||||
|
||||
BEGIN
|
||||
|
||||
-- **************************************************************
|
||||
--
|
||||
-- Lists
|
||||
--
|
||||
-- **************************************************************
|
||||
|
||||
maxofRANParameters INTEGER ::= 255
|
||||
|
||||
-- E2 Service model IEs
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Event Trigger Definition OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- E2SM-MACStats-EventTriggerDefinition IE
|
||||
E2SM-MACStats-EventTriggerDefinition ::= CHOICE{
|
||||
eventDefinition-Format1 E2SM-MACStats-EventTriggerDefinition-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-MACStats-eventTriggerDefinition IE Format 1
|
||||
E2SM-MACStats-EventTriggerDefinition-Format1 ::= SEQUENCE{
|
||||
triggerNature MACStats-TriggerNature,
|
||||
...
|
||||
}
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Action Definition OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
E2SM-MACStats-ActionDefinition ::= CHOICE{
|
||||
actionDefinition-Format1 E2SM-MACStats-ActionDefinition-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-MACStats-actionDefinition IE used for Action Format 1
|
||||
E2SM-MACStats-ActionDefinition-Format1 ::= SEQUENCE{
|
||||
ranParameter-List SEQUENCE (SIZE(1..maxofRANParameters)) OF RANparameter-Item OPTIONAL,
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Indication Header OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
E2SM-MACStats-IndicationHeader ::= CHOICE{
|
||||
indicationHeader-Format1 E2SM-MACStats-IndicationHeader-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-MACStats-indicationHeader Format 1
|
||||
E2SM-MACStats-IndicationHeader-Format1 ::= SEQUENCE{
|
||||
indicationHeaderParam MACStats-Header,
|
||||
...
|
||||
}
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Indication Message OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- E2SM-MACStats-indicationMessage IE
|
||||
E2SM-MACStats-IndicationMessage ::= CHOICE{
|
||||
indicationMessage-Format1 E2SM-MACStats-IndicationMessage-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-MACStats-IndicationMessage Format 1
|
||||
E2SM-MACStats-IndicationMessage-Format1 ::= SEQUENCE{
|
||||
indicationMsgParam MACStats-Message,
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Call Process ID
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- Not defined in this E2SM
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Control Header OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- E2SM-MACStats-ControlHeader
|
||||
E2SM-MACStats-ControlHeader ::= CHOICE{
|
||||
controlHeader-Format1 E2SM-MACStats-ControlHeader-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-MACStats-ControlHeader Format 1
|
||||
E2SM-MACStats-ControlHeader-Format1 ::= SEQUENCE{
|
||||
controlHeaderParam MACStats-Header,
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Control Message OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- E2SM-MACStats-ControlMessage
|
||||
E2SM-MACStats-ControlMessage ::= CHOICE{
|
||||
controlMessage-Format1 E2SM-MACStats-ControlMessage-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-MACStats-controlMessage Format 1
|
||||
E2SM-MACStats-ControlMessage-Format1 ::= SEQUENCE{
|
||||
controlMsgParam MACStats-Message,
|
||||
...
|
||||
}
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Control Outcome OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- Not defined in this E2SM
|
||||
|
||||
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- RAN Function definition OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- Not defined in this E2SM
|
||||
|
||||
|
||||
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- commmon IEs
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- A
|
||||
-- B
|
||||
-- C
|
||||
-- D
|
||||
-- E
|
||||
-- F
|
||||
-- G
|
||||
-- H
|
||||
|
||||
MACStats-Header ::= INTEGER
|
||||
|
||||
MACStats-Message ::= OCTET STRING
|
||||
|
||||
MACStats-TriggerNature ::= ENUMERATED{
|
||||
oneMs,
|
||||
twoMs,
|
||||
fiveMs,
|
||||
...
|
||||
}
|
||||
-- I
|
||||
-- J
|
||||
-- K
|
||||
-- L
|
||||
-- M
|
||||
-- N
|
||||
-- O
|
||||
-- P
|
||||
-- Q
|
||||
-- R
|
||||
|
||||
|
||||
RANparameter-Item ::= SEQUENCE {
|
||||
ranParameter-ID RANparameter-ID,
|
||||
ranParameter-Name RANparameter-Name,
|
||||
ranParameter-Test RANparameter-Test,
|
||||
ranParameter-Value RANparameter-Value,
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
RANparameter-ID ::= INTEGER (0..maxofRANParameters)
|
||||
|
||||
RANparameter-Name ::= OCTET STRING
|
||||
|
||||
RANparameter-Test ::= ENUMERATED{
|
||||
equal,
|
||||
greaterthan,
|
||||
lessthan,
|
||||
contains,
|
||||
present,
|
||||
...
|
||||
}
|
||||
|
||||
RANparameter-Value ::= OCTET STRING
|
||||
|
||||
-- S
|
||||
-- T
|
||||
-- U
|
||||
-- V
|
||||
-- W
|
||||
-- X
|
||||
-- Y
|
||||
-- Z
|
||||
|
||||
END
|
||||
-- ASN1STOP
|
||||
|
||||
134
executables/mac_sm/ie/e2sm_mac_v00.fbs
Normal file
134
executables/mac_sm/ie/e2sm_mac_v00.fbs
Normal file
@@ -0,0 +1,134 @@
|
||||
// FLATBUFFERS START
|
||||
// **************************************************************
|
||||
// E2SM_MAC Stats
|
||||
// Information Element Definitions
|
||||
//
|
||||
// **************************************************************
|
||||
|
||||
|
||||
namespace E2SM_MACStats;
|
||||
|
||||
//-- ---------------------------------------------------
|
||||
//-- Event Trigger Definition OCTET STRING contents
|
||||
//-- ---------------------------------------------------
|
||||
|
||||
enum TriggerNature: uint8 { oneMs, twoMs, fiveMs }
|
||||
table EventTriggerDefinitionFormat1 {
|
||||
triggerNature: TriggerNature;
|
||||
}
|
||||
|
||||
table EventTrigger {
|
||||
trig: TriggerNature;
|
||||
}
|
||||
//root_type EventTrigger;
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Action Definition OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
enum RanParameterTest: uint8 { equal, greaterThan, lessThan, contains, present }
|
||||
table RanParameterItem {
|
||||
id: uint32;
|
||||
name: string;
|
||||
test: RanParameterTest;
|
||||
value: string;
|
||||
}
|
||||
table ActionDefinitionFormat1 {
|
||||
ranParameterList: [RanParameterItem];
|
||||
}
|
||||
union ActionDefinitionUnion {
|
||||
actionDefF1: ActionDefinitionFormat1
|
||||
}
|
||||
table ActionDefinition {
|
||||
def: ActionDefinitionUnion;
|
||||
}
|
||||
//root_type ActionDefinition;
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Indication Header OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
table IndicationHeaderFormat1 {
|
||||
param: int32;
|
||||
}
|
||||
union IndicationHeaderUnion {
|
||||
indHeaderF1: IndicationHeaderFormat1
|
||||
}
|
||||
table IndicationHeader {
|
||||
hdr: IndicationHeaderUnion;
|
||||
}
|
||||
//root_type IndicationHeader;
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Indication Message OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
table IndicationMessage {
|
||||
tx_bytes : uint32_t;
|
||||
tx_pkts : uint32_t;
|
||||
|
||||
}
|
||||
//root_type IndicationMessage;
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Call Process ID
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
// -- Not defined in this E2SM
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Control Header OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
table ControlHeaderFormat1 {
|
||||
param: int32;
|
||||
}
|
||||
union ControlHeaderUnion {
|
||||
ctrlHeaderF1: ControlHeaderFormat1
|
||||
}
|
||||
table ControlHeader {
|
||||
hdr: ControlHeaderUnion;
|
||||
}
|
||||
//root_type ControlHeader;
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Control Message OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
|
||||
table ControlMessageFormat1 {
|
||||
param: [uint8];
|
||||
}
|
||||
union ControlMessageUnion {
|
||||
ctrlMessageF1: ControlMessageFormat1
|
||||
}
|
||||
table ControlMessage {
|
||||
msg: ControlMessageUnion;
|
||||
}
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Control Outcome OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
// -- Not defined in this E2SM
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- RAN Function definition OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
// -- Not defined in this E2SM
|
||||
|
||||
|
||||
134
executables/mac_sm/ie/fb/e2sm_mac_stats_v00.fbs
Normal file
134
executables/mac_sm/ie/fb/e2sm_mac_stats_v00.fbs
Normal file
@@ -0,0 +1,134 @@
|
||||
// FLATBUFFERS START
|
||||
// **************************************************************
|
||||
// E2SM_MAC Stats
|
||||
// Information Element Definitions
|
||||
//
|
||||
// **************************************************************
|
||||
|
||||
|
||||
namespace E2SM_MACStats;
|
||||
|
||||
|
||||
//-- ---------------------------------------------------
|
||||
//-- Event Trigger Definition OCTET STRING contents
|
||||
//-- ---------------------------------------------------
|
||||
|
||||
enum TriggerNature: uint8 { oneMs, twoMs, fiveMs }
|
||||
table EventTriggerDefinitionFormat1 {
|
||||
triggerNature: TriggerNature;
|
||||
}
|
||||
|
||||
table EventTrigger {
|
||||
trig: TriggerNature;
|
||||
}
|
||||
//root_type EventTrigger;
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Action Definition OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
enum RanParameterTest: uint8 { equal, greaterThan, lessThan, contains, present }
|
||||
table RanParameterItem {
|
||||
id: uint32;
|
||||
name: string;
|
||||
test: RanParameterTest;
|
||||
value: string;
|
||||
}
|
||||
table ActionDefinitionFormat1 {
|
||||
ranParameterList: [RanParameterItem];
|
||||
}
|
||||
union ActionDefinitionUnion {
|
||||
actionDefF1: ActionDefinitionFormat1
|
||||
}
|
||||
table ActionDefinition {
|
||||
def: ActionDefinitionUnion;
|
||||
}
|
||||
//root_type ActionDefinition;
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Indication Header OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
table IndicationHeaderFormat1 {
|
||||
param: uint32;
|
||||
}
|
||||
union IndicationHeaderUnion {
|
||||
indHeaderF1: IndicationHeaderFormat1
|
||||
}
|
||||
table IndicationHeader {
|
||||
hdr: IndicationHeaderUnion;
|
||||
}
|
||||
//root_type IndicationHeader;
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Indication Message OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
table IndicationMessage {
|
||||
tx_bytes : uint32;
|
||||
tx_pkts : uint32;
|
||||
}
|
||||
//root_type IndicationMessage;
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Call Process ID
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
// -- Not defined in this E2SM
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Control Header OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
table ControlHeaderFormat1 {
|
||||
param: uint32;
|
||||
}
|
||||
union ControlHeaderUnion {
|
||||
ctrlHeaderF1: ControlHeaderFormat1
|
||||
}
|
||||
table ControlHeader {
|
||||
hdr: ControlHeaderUnion;
|
||||
}
|
||||
//root_type ControlHeader;
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Control Message OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
|
||||
table ControlMessageFormat1 {
|
||||
param: [uint8];
|
||||
}
|
||||
union ControlMessageUnion {
|
||||
ctrlMessageF1: ControlMessageFormat1
|
||||
}
|
||||
table ControlMessage {
|
||||
msg: ControlMessageUnion;
|
||||
}
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Control Outcome OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
// -- Not defined in this E2SM
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- RAN Function definition OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
// -- Not defined in this E2SM
|
||||
|
||||
|
||||
489
executables/mac_sm/ie/fb/e2sm_mac_stats_v00_builder.h
Normal file
489
executables/mac_sm/ie/fb/e2sm_mac_stats_v00_builder.h
Normal file
@@ -0,0 +1,489 @@
|
||||
#ifndef E2SM_MAC_STATS_V00_BUILDER_H
|
||||
#define E2SM_MAC_STATS_V00_BUILDER_H
|
||||
|
||||
/* Generated by flatcc 0.6.1-dev FlatBuffers schema compiler for C by dvide.com */
|
||||
|
||||
#ifndef E2SM_MAC_STATS_V00_READER_H
|
||||
#include "e2sm_mac_stats_v00_reader.h"
|
||||
#endif
|
||||
#ifndef FLATBUFFERS_COMMON_BUILDER_H
|
||||
#include "flatbuffers_common_builder.h"
|
||||
#endif
|
||||
#include "flatcc/flatcc_prologue.h"
|
||||
#ifndef flatbuffers_identifier
|
||||
#define flatbuffers_identifier 0
|
||||
#endif
|
||||
#ifndef flatbuffers_extension
|
||||
#define flatbuffers_extension "bin"
|
||||
#endif
|
||||
|
||||
#define __E2SM_MACStats_TriggerNature_formal_args , E2SM_MACStats_TriggerNature_enum_t v0
|
||||
#define __E2SM_MACStats_TriggerNature_call_args , v0
|
||||
__flatbuffers_build_scalar(flatbuffers_, E2SM_MACStats_TriggerNature, E2SM_MACStats_TriggerNature_enum_t)
|
||||
#define __E2SM_MACStats_RanParameterTest_formal_args , E2SM_MACStats_RanParameterTest_enum_t v0
|
||||
#define __E2SM_MACStats_RanParameterTest_call_args , v0
|
||||
__flatbuffers_build_scalar(flatbuffers_, E2SM_MACStats_RanParameterTest, E2SM_MACStats_RanParameterTest_enum_t)
|
||||
|
||||
typedef flatbuffers_union_ref_t E2SM_MACStats_ActionDefinitionUnion_union_ref_t;
|
||||
typedef flatbuffers_union_vec_ref_t E2SM_MACStats_ActionDefinitionUnion_union_vec_ref_t;
|
||||
static E2SM_MACStats_ActionDefinitionUnion_union_ref_t E2SM_MACStats_ActionDefinitionUnion_clone(flatbuffers_builder_t *B, E2SM_MACStats_ActionDefinitionUnion_union_t t);
|
||||
typedef flatbuffers_union_ref_t E2SM_MACStats_IndicationHeaderUnion_union_ref_t;
|
||||
typedef flatbuffers_union_vec_ref_t E2SM_MACStats_IndicationHeaderUnion_union_vec_ref_t;
|
||||
static E2SM_MACStats_IndicationHeaderUnion_union_ref_t E2SM_MACStats_IndicationHeaderUnion_clone(flatbuffers_builder_t *B, E2SM_MACStats_IndicationHeaderUnion_union_t t);
|
||||
typedef flatbuffers_union_ref_t E2SM_MACStats_ControlHeaderUnion_union_ref_t;
|
||||
typedef flatbuffers_union_vec_ref_t E2SM_MACStats_ControlHeaderUnion_union_vec_ref_t;
|
||||
static E2SM_MACStats_ControlHeaderUnion_union_ref_t E2SM_MACStats_ControlHeaderUnion_clone(flatbuffers_builder_t *B, E2SM_MACStats_ControlHeaderUnion_union_t t);
|
||||
typedef flatbuffers_union_ref_t E2SM_MACStats_ControlMessageUnion_union_ref_t;
|
||||
typedef flatbuffers_union_vec_ref_t E2SM_MACStats_ControlMessageUnion_union_vec_ref_t;
|
||||
static E2SM_MACStats_ControlMessageUnion_union_ref_t E2SM_MACStats_ControlMessageUnion_clone(flatbuffers_builder_t *B, E2SM_MACStats_ControlMessageUnion_union_t t);
|
||||
|
||||
static const flatbuffers_voffset_t __E2SM_MACStats_EventTriggerDefinitionFormat1_required[] = { 0 };
|
||||
typedef flatbuffers_ref_t E2SM_MACStats_EventTriggerDefinitionFormat1_ref_t;
|
||||
static E2SM_MACStats_EventTriggerDefinitionFormat1_ref_t E2SM_MACStats_EventTriggerDefinitionFormat1_clone(flatbuffers_builder_t *B, E2SM_MACStats_EventTriggerDefinitionFormat1_table_t t);
|
||||
__flatbuffers_build_table(flatbuffers_, E2SM_MACStats_EventTriggerDefinitionFormat1, 1)
|
||||
|
||||
static const flatbuffers_voffset_t __E2SM_MACStats_EventTrigger_required[] = { 0 };
|
||||
typedef flatbuffers_ref_t E2SM_MACStats_EventTrigger_ref_t;
|
||||
static E2SM_MACStats_EventTrigger_ref_t E2SM_MACStats_EventTrigger_clone(flatbuffers_builder_t *B, E2SM_MACStats_EventTrigger_table_t t);
|
||||
__flatbuffers_build_table(flatbuffers_, E2SM_MACStats_EventTrigger, 1)
|
||||
|
||||
static const flatbuffers_voffset_t __E2SM_MACStats_RanParameterItem_required[] = { 0 };
|
||||
typedef flatbuffers_ref_t E2SM_MACStats_RanParameterItem_ref_t;
|
||||
static E2SM_MACStats_RanParameterItem_ref_t E2SM_MACStats_RanParameterItem_clone(flatbuffers_builder_t *B, E2SM_MACStats_RanParameterItem_table_t t);
|
||||
__flatbuffers_build_table(flatbuffers_, E2SM_MACStats_RanParameterItem, 4)
|
||||
|
||||
static const flatbuffers_voffset_t __E2SM_MACStats_ActionDefinitionFormat1_required[] = { 0 };
|
||||
typedef flatbuffers_ref_t E2SM_MACStats_ActionDefinitionFormat1_ref_t;
|
||||
static E2SM_MACStats_ActionDefinitionFormat1_ref_t E2SM_MACStats_ActionDefinitionFormat1_clone(flatbuffers_builder_t *B, E2SM_MACStats_ActionDefinitionFormat1_table_t t);
|
||||
__flatbuffers_build_table(flatbuffers_, E2SM_MACStats_ActionDefinitionFormat1, 1)
|
||||
|
||||
static const flatbuffers_voffset_t __E2SM_MACStats_ActionDefinition_required[] = { 0 };
|
||||
typedef flatbuffers_ref_t E2SM_MACStats_ActionDefinition_ref_t;
|
||||
static E2SM_MACStats_ActionDefinition_ref_t E2SM_MACStats_ActionDefinition_clone(flatbuffers_builder_t *B, E2SM_MACStats_ActionDefinition_table_t t);
|
||||
__flatbuffers_build_table(flatbuffers_, E2SM_MACStats_ActionDefinition, 2)
|
||||
|
||||
static const flatbuffers_voffset_t __E2SM_MACStats_IndicationHeaderFormat1_required[] = { 0 };
|
||||
typedef flatbuffers_ref_t E2SM_MACStats_IndicationHeaderFormat1_ref_t;
|
||||
static E2SM_MACStats_IndicationHeaderFormat1_ref_t E2SM_MACStats_IndicationHeaderFormat1_clone(flatbuffers_builder_t *B, E2SM_MACStats_IndicationHeaderFormat1_table_t t);
|
||||
__flatbuffers_build_table(flatbuffers_, E2SM_MACStats_IndicationHeaderFormat1, 1)
|
||||
|
||||
static const flatbuffers_voffset_t __E2SM_MACStats_IndicationHeader_required[] = { 0 };
|
||||
typedef flatbuffers_ref_t E2SM_MACStats_IndicationHeader_ref_t;
|
||||
static E2SM_MACStats_IndicationHeader_ref_t E2SM_MACStats_IndicationHeader_clone(flatbuffers_builder_t *B, E2SM_MACStats_IndicationHeader_table_t t);
|
||||
__flatbuffers_build_table(flatbuffers_, E2SM_MACStats_IndicationHeader, 2)
|
||||
|
||||
static const flatbuffers_voffset_t __E2SM_MACStats_IndicationMessage_required[] = { 0 };
|
||||
typedef flatbuffers_ref_t E2SM_MACStats_IndicationMessage_ref_t;
|
||||
static E2SM_MACStats_IndicationMessage_ref_t E2SM_MACStats_IndicationMessage_clone(flatbuffers_builder_t *B, E2SM_MACStats_IndicationMessage_table_t t);
|
||||
__flatbuffers_build_table(flatbuffers_, E2SM_MACStats_IndicationMessage, 2)
|
||||
|
||||
static const flatbuffers_voffset_t __E2SM_MACStats_ControlHeaderFormat1_required[] = { 0 };
|
||||
typedef flatbuffers_ref_t E2SM_MACStats_ControlHeaderFormat1_ref_t;
|
||||
static E2SM_MACStats_ControlHeaderFormat1_ref_t E2SM_MACStats_ControlHeaderFormat1_clone(flatbuffers_builder_t *B, E2SM_MACStats_ControlHeaderFormat1_table_t t);
|
||||
__flatbuffers_build_table(flatbuffers_, E2SM_MACStats_ControlHeaderFormat1, 1)
|
||||
|
||||
static const flatbuffers_voffset_t __E2SM_MACStats_ControlHeader_required[] = { 0 };
|
||||
typedef flatbuffers_ref_t E2SM_MACStats_ControlHeader_ref_t;
|
||||
static E2SM_MACStats_ControlHeader_ref_t E2SM_MACStats_ControlHeader_clone(flatbuffers_builder_t *B, E2SM_MACStats_ControlHeader_table_t t);
|
||||
__flatbuffers_build_table(flatbuffers_, E2SM_MACStats_ControlHeader, 2)
|
||||
|
||||
static const flatbuffers_voffset_t __E2SM_MACStats_ControlMessageFormat1_required[] = { 0 };
|
||||
typedef flatbuffers_ref_t E2SM_MACStats_ControlMessageFormat1_ref_t;
|
||||
static E2SM_MACStats_ControlMessageFormat1_ref_t E2SM_MACStats_ControlMessageFormat1_clone(flatbuffers_builder_t *B, E2SM_MACStats_ControlMessageFormat1_table_t t);
|
||||
__flatbuffers_build_table(flatbuffers_, E2SM_MACStats_ControlMessageFormat1, 1)
|
||||
|
||||
static const flatbuffers_voffset_t __E2SM_MACStats_ControlMessage_required[] = { 0 };
|
||||
typedef flatbuffers_ref_t E2SM_MACStats_ControlMessage_ref_t;
|
||||
static E2SM_MACStats_ControlMessage_ref_t E2SM_MACStats_ControlMessage_clone(flatbuffers_builder_t *B, E2SM_MACStats_ControlMessage_table_t t);
|
||||
__flatbuffers_build_table(flatbuffers_, E2SM_MACStats_ControlMessage, 2)
|
||||
|
||||
#define __E2SM_MACStats_EventTriggerDefinitionFormat1_formal_args , E2SM_MACStats_TriggerNature_enum_t v0
|
||||
#define __E2SM_MACStats_EventTriggerDefinitionFormat1_call_args , v0
|
||||
static inline E2SM_MACStats_EventTriggerDefinitionFormat1_ref_t E2SM_MACStats_EventTriggerDefinitionFormat1_create(flatbuffers_builder_t *B __E2SM_MACStats_EventTriggerDefinitionFormat1_formal_args);
|
||||
__flatbuffers_build_table_prolog(flatbuffers_, E2SM_MACStats_EventTriggerDefinitionFormat1, E2SM_MACStats_EventTriggerDefinitionFormat1_file_identifier, E2SM_MACStats_EventTriggerDefinitionFormat1_type_identifier)
|
||||
|
||||
#define __E2SM_MACStats_EventTrigger_formal_args , E2SM_MACStats_TriggerNature_enum_t v0
|
||||
#define __E2SM_MACStats_EventTrigger_call_args , v0
|
||||
static inline E2SM_MACStats_EventTrigger_ref_t E2SM_MACStats_EventTrigger_create(flatbuffers_builder_t *B __E2SM_MACStats_EventTrigger_formal_args);
|
||||
__flatbuffers_build_table_prolog(flatbuffers_, E2SM_MACStats_EventTrigger, E2SM_MACStats_EventTrigger_file_identifier, E2SM_MACStats_EventTrigger_type_identifier)
|
||||
|
||||
#define __E2SM_MACStats_RanParameterItem_formal_args , uint32_t v0, flatbuffers_string_ref_t v1, E2SM_MACStats_RanParameterTest_enum_t v2, flatbuffers_string_ref_t v3
|
||||
#define __E2SM_MACStats_RanParameterItem_call_args , v0, v1, v2, v3
|
||||
static inline E2SM_MACStats_RanParameterItem_ref_t E2SM_MACStats_RanParameterItem_create(flatbuffers_builder_t *B __E2SM_MACStats_RanParameterItem_formal_args);
|
||||
__flatbuffers_build_table_prolog(flatbuffers_, E2SM_MACStats_RanParameterItem, E2SM_MACStats_RanParameterItem_file_identifier, E2SM_MACStats_RanParameterItem_type_identifier)
|
||||
|
||||
#define __E2SM_MACStats_ActionDefinitionFormat1_formal_args , E2SM_MACStats_RanParameterItem_vec_ref_t v0
|
||||
#define __E2SM_MACStats_ActionDefinitionFormat1_call_args , v0
|
||||
static inline E2SM_MACStats_ActionDefinitionFormat1_ref_t E2SM_MACStats_ActionDefinitionFormat1_create(flatbuffers_builder_t *B __E2SM_MACStats_ActionDefinitionFormat1_formal_args);
|
||||
__flatbuffers_build_table_prolog(flatbuffers_, E2SM_MACStats_ActionDefinitionFormat1, E2SM_MACStats_ActionDefinitionFormat1_file_identifier, E2SM_MACStats_ActionDefinitionFormat1_type_identifier)
|
||||
|
||||
#define __E2SM_MACStats_ActionDefinition_formal_args , E2SM_MACStats_ActionDefinitionUnion_union_ref_t v1
|
||||
#define __E2SM_MACStats_ActionDefinition_call_args , v1
|
||||
static inline E2SM_MACStats_ActionDefinition_ref_t E2SM_MACStats_ActionDefinition_create(flatbuffers_builder_t *B __E2SM_MACStats_ActionDefinition_formal_args);
|
||||
__flatbuffers_build_table_prolog(flatbuffers_, E2SM_MACStats_ActionDefinition, E2SM_MACStats_ActionDefinition_file_identifier, E2SM_MACStats_ActionDefinition_type_identifier)
|
||||
|
||||
#define __E2SM_MACStats_IndicationHeaderFormat1_formal_args , uint32_t v0
|
||||
#define __E2SM_MACStats_IndicationHeaderFormat1_call_args , v0
|
||||
static inline E2SM_MACStats_IndicationHeaderFormat1_ref_t E2SM_MACStats_IndicationHeaderFormat1_create(flatbuffers_builder_t *B __E2SM_MACStats_IndicationHeaderFormat1_formal_args);
|
||||
__flatbuffers_build_table_prolog(flatbuffers_, E2SM_MACStats_IndicationHeaderFormat1, E2SM_MACStats_IndicationHeaderFormat1_file_identifier, E2SM_MACStats_IndicationHeaderFormat1_type_identifier)
|
||||
|
||||
#define __E2SM_MACStats_IndicationHeader_formal_args , E2SM_MACStats_IndicationHeaderUnion_union_ref_t v1
|
||||
#define __E2SM_MACStats_IndicationHeader_call_args , v1
|
||||
static inline E2SM_MACStats_IndicationHeader_ref_t E2SM_MACStats_IndicationHeader_create(flatbuffers_builder_t *B __E2SM_MACStats_IndicationHeader_formal_args);
|
||||
__flatbuffers_build_table_prolog(flatbuffers_, E2SM_MACStats_IndicationHeader, E2SM_MACStats_IndicationHeader_file_identifier, E2SM_MACStats_IndicationHeader_type_identifier)
|
||||
|
||||
#define __E2SM_MACStats_IndicationMessage_formal_args , uint32_t v0, uint32_t v1
|
||||
#define __E2SM_MACStats_IndicationMessage_call_args , v0, v1
|
||||
static inline E2SM_MACStats_IndicationMessage_ref_t E2SM_MACStats_IndicationMessage_create(flatbuffers_builder_t *B __E2SM_MACStats_IndicationMessage_formal_args);
|
||||
__flatbuffers_build_table_prolog(flatbuffers_, E2SM_MACStats_IndicationMessage, E2SM_MACStats_IndicationMessage_file_identifier, E2SM_MACStats_IndicationMessage_type_identifier)
|
||||
|
||||
#define __E2SM_MACStats_ControlHeaderFormat1_formal_args , uint32_t v0
|
||||
#define __E2SM_MACStats_ControlHeaderFormat1_call_args , v0
|
||||
static inline E2SM_MACStats_ControlHeaderFormat1_ref_t E2SM_MACStats_ControlHeaderFormat1_create(flatbuffers_builder_t *B __E2SM_MACStats_ControlHeaderFormat1_formal_args);
|
||||
__flatbuffers_build_table_prolog(flatbuffers_, E2SM_MACStats_ControlHeaderFormat1, E2SM_MACStats_ControlHeaderFormat1_file_identifier, E2SM_MACStats_ControlHeaderFormat1_type_identifier)
|
||||
|
||||
#define __E2SM_MACStats_ControlHeader_formal_args , E2SM_MACStats_ControlHeaderUnion_union_ref_t v1
|
||||
#define __E2SM_MACStats_ControlHeader_call_args , v1
|
||||
static inline E2SM_MACStats_ControlHeader_ref_t E2SM_MACStats_ControlHeader_create(flatbuffers_builder_t *B __E2SM_MACStats_ControlHeader_formal_args);
|
||||
__flatbuffers_build_table_prolog(flatbuffers_, E2SM_MACStats_ControlHeader, E2SM_MACStats_ControlHeader_file_identifier, E2SM_MACStats_ControlHeader_type_identifier)
|
||||
|
||||
#define __E2SM_MACStats_ControlMessageFormat1_formal_args , flatbuffers_uint8_vec_ref_t v0
|
||||
#define __E2SM_MACStats_ControlMessageFormat1_call_args , v0
|
||||
static inline E2SM_MACStats_ControlMessageFormat1_ref_t E2SM_MACStats_ControlMessageFormat1_create(flatbuffers_builder_t *B __E2SM_MACStats_ControlMessageFormat1_formal_args);
|
||||
__flatbuffers_build_table_prolog(flatbuffers_, E2SM_MACStats_ControlMessageFormat1, E2SM_MACStats_ControlMessageFormat1_file_identifier, E2SM_MACStats_ControlMessageFormat1_type_identifier)
|
||||
|
||||
#define __E2SM_MACStats_ControlMessage_formal_args , E2SM_MACStats_ControlMessageUnion_union_ref_t v1
|
||||
#define __E2SM_MACStats_ControlMessage_call_args , v1
|
||||
static inline E2SM_MACStats_ControlMessage_ref_t E2SM_MACStats_ControlMessage_create(flatbuffers_builder_t *B __E2SM_MACStats_ControlMessage_formal_args);
|
||||
__flatbuffers_build_table_prolog(flatbuffers_, E2SM_MACStats_ControlMessage, E2SM_MACStats_ControlMessage_file_identifier, E2SM_MACStats_ControlMessage_type_identifier)
|
||||
|
||||
static inline E2SM_MACStats_ActionDefinitionUnion_union_ref_t E2SM_MACStats_ActionDefinitionUnion_as_NONE(void)
|
||||
{ E2SM_MACStats_ActionDefinitionUnion_union_ref_t uref; uref.type = E2SM_MACStats_ActionDefinitionUnion_NONE; uref.value = 0; return uref; }
|
||||
static inline E2SM_MACStats_ActionDefinitionUnion_union_ref_t E2SM_MACStats_ActionDefinitionUnion_as_actionDefF1(E2SM_MACStats_ActionDefinitionFormat1_ref_t ref)
|
||||
{ E2SM_MACStats_ActionDefinitionUnion_union_ref_t uref; uref.type = E2SM_MACStats_ActionDefinitionUnion_actionDefF1; uref.value = ref; return uref; }
|
||||
__flatbuffers_build_union_vector(flatbuffers_, E2SM_MACStats_ActionDefinitionUnion)
|
||||
|
||||
static E2SM_MACStats_ActionDefinitionUnion_union_ref_t E2SM_MACStats_ActionDefinitionUnion_clone(flatbuffers_builder_t *B, E2SM_MACStats_ActionDefinitionUnion_union_t u)
|
||||
{
|
||||
switch (u.type) {
|
||||
case 1: return E2SM_MACStats_ActionDefinitionUnion_as_actionDefF1(E2SM_MACStats_ActionDefinitionFormat1_clone(B, (E2SM_MACStats_ActionDefinitionFormat1_table_t)u.value));
|
||||
default: return E2SM_MACStats_ActionDefinitionUnion_as_NONE();
|
||||
}
|
||||
}
|
||||
|
||||
static inline E2SM_MACStats_IndicationHeaderUnion_union_ref_t E2SM_MACStats_IndicationHeaderUnion_as_NONE(void)
|
||||
{ E2SM_MACStats_IndicationHeaderUnion_union_ref_t uref; uref.type = E2SM_MACStats_IndicationHeaderUnion_NONE; uref.value = 0; return uref; }
|
||||
static inline E2SM_MACStats_IndicationHeaderUnion_union_ref_t E2SM_MACStats_IndicationHeaderUnion_as_indHeaderF1(E2SM_MACStats_IndicationHeaderFormat1_ref_t ref)
|
||||
{ E2SM_MACStats_IndicationHeaderUnion_union_ref_t uref; uref.type = E2SM_MACStats_IndicationHeaderUnion_indHeaderF1; uref.value = ref; return uref; }
|
||||
__flatbuffers_build_union_vector(flatbuffers_, E2SM_MACStats_IndicationHeaderUnion)
|
||||
|
||||
static E2SM_MACStats_IndicationHeaderUnion_union_ref_t E2SM_MACStats_IndicationHeaderUnion_clone(flatbuffers_builder_t *B, E2SM_MACStats_IndicationHeaderUnion_union_t u)
|
||||
{
|
||||
switch (u.type) {
|
||||
case 1: return E2SM_MACStats_IndicationHeaderUnion_as_indHeaderF1(E2SM_MACStats_IndicationHeaderFormat1_clone(B, (E2SM_MACStats_IndicationHeaderFormat1_table_t)u.value));
|
||||
default: return E2SM_MACStats_IndicationHeaderUnion_as_NONE();
|
||||
}
|
||||
}
|
||||
|
||||
static inline E2SM_MACStats_ControlHeaderUnion_union_ref_t E2SM_MACStats_ControlHeaderUnion_as_NONE(void)
|
||||
{ E2SM_MACStats_ControlHeaderUnion_union_ref_t uref; uref.type = E2SM_MACStats_ControlHeaderUnion_NONE; uref.value = 0; return uref; }
|
||||
static inline E2SM_MACStats_ControlHeaderUnion_union_ref_t E2SM_MACStats_ControlHeaderUnion_as_ctrlHeaderF1(E2SM_MACStats_ControlHeaderFormat1_ref_t ref)
|
||||
{ E2SM_MACStats_ControlHeaderUnion_union_ref_t uref; uref.type = E2SM_MACStats_ControlHeaderUnion_ctrlHeaderF1; uref.value = ref; return uref; }
|
||||
__flatbuffers_build_union_vector(flatbuffers_, E2SM_MACStats_ControlHeaderUnion)
|
||||
|
||||
static E2SM_MACStats_ControlHeaderUnion_union_ref_t E2SM_MACStats_ControlHeaderUnion_clone(flatbuffers_builder_t *B, E2SM_MACStats_ControlHeaderUnion_union_t u)
|
||||
{
|
||||
switch (u.type) {
|
||||
case 1: return E2SM_MACStats_ControlHeaderUnion_as_ctrlHeaderF1(E2SM_MACStats_ControlHeaderFormat1_clone(B, (E2SM_MACStats_ControlHeaderFormat1_table_t)u.value));
|
||||
default: return E2SM_MACStats_ControlHeaderUnion_as_NONE();
|
||||
}
|
||||
}
|
||||
|
||||
static inline E2SM_MACStats_ControlMessageUnion_union_ref_t E2SM_MACStats_ControlMessageUnion_as_NONE(void)
|
||||
{ E2SM_MACStats_ControlMessageUnion_union_ref_t uref; uref.type = E2SM_MACStats_ControlMessageUnion_NONE; uref.value = 0; return uref; }
|
||||
static inline E2SM_MACStats_ControlMessageUnion_union_ref_t E2SM_MACStats_ControlMessageUnion_as_ctrlMessageF1(E2SM_MACStats_ControlMessageFormat1_ref_t ref)
|
||||
{ E2SM_MACStats_ControlMessageUnion_union_ref_t uref; uref.type = E2SM_MACStats_ControlMessageUnion_ctrlMessageF1; uref.value = ref; return uref; }
|
||||
__flatbuffers_build_union_vector(flatbuffers_, E2SM_MACStats_ControlMessageUnion)
|
||||
|
||||
static E2SM_MACStats_ControlMessageUnion_union_ref_t E2SM_MACStats_ControlMessageUnion_clone(flatbuffers_builder_t *B, E2SM_MACStats_ControlMessageUnion_union_t u)
|
||||
{
|
||||
switch (u.type) {
|
||||
case 1: return E2SM_MACStats_ControlMessageUnion_as_ctrlMessageF1(E2SM_MACStats_ControlMessageFormat1_clone(B, (E2SM_MACStats_ControlMessageFormat1_table_t)u.value));
|
||||
default: return E2SM_MACStats_ControlMessageUnion_as_NONE();
|
||||
}
|
||||
}
|
||||
|
||||
__flatbuffers_build_scalar_field(0, flatbuffers_, E2SM_MACStats_EventTriggerDefinitionFormat1_triggerNature, E2SM_MACStats_TriggerNature, E2SM_MACStats_TriggerNature_enum_t, 1, 1, UINT8_C(0), E2SM_MACStats_EventTriggerDefinitionFormat1)
|
||||
|
||||
static inline E2SM_MACStats_EventTriggerDefinitionFormat1_ref_t E2SM_MACStats_EventTriggerDefinitionFormat1_create(flatbuffers_builder_t *B __E2SM_MACStats_EventTriggerDefinitionFormat1_formal_args)
|
||||
{
|
||||
if (E2SM_MACStats_EventTriggerDefinitionFormat1_start(B)
|
||||
|| E2SM_MACStats_EventTriggerDefinitionFormat1_triggerNature_add(B, v0)) {
|
||||
return 0;
|
||||
}
|
||||
return E2SM_MACStats_EventTriggerDefinitionFormat1_end(B);
|
||||
}
|
||||
|
||||
static E2SM_MACStats_EventTriggerDefinitionFormat1_ref_t E2SM_MACStats_EventTriggerDefinitionFormat1_clone(flatbuffers_builder_t *B, E2SM_MACStats_EventTriggerDefinitionFormat1_table_t t)
|
||||
{
|
||||
__flatbuffers_memoize_begin(B, t);
|
||||
if (E2SM_MACStats_EventTriggerDefinitionFormat1_start(B)
|
||||
|| E2SM_MACStats_EventTriggerDefinitionFormat1_triggerNature_pick(B, t)) {
|
||||
return 0;
|
||||
}
|
||||
__flatbuffers_memoize_end(B, t, E2SM_MACStats_EventTriggerDefinitionFormat1_end(B));
|
||||
}
|
||||
|
||||
__flatbuffers_build_scalar_field(0, flatbuffers_, E2SM_MACStats_EventTrigger_trig, E2SM_MACStats_TriggerNature, E2SM_MACStats_TriggerNature_enum_t, 1, 1, UINT8_C(0), E2SM_MACStats_EventTrigger)
|
||||
|
||||
static inline E2SM_MACStats_EventTrigger_ref_t E2SM_MACStats_EventTrigger_create(flatbuffers_builder_t *B __E2SM_MACStats_EventTrigger_formal_args)
|
||||
{
|
||||
if (E2SM_MACStats_EventTrigger_start(B)
|
||||
|| E2SM_MACStats_EventTrigger_trig_add(B, v0)) {
|
||||
return 0;
|
||||
}
|
||||
return E2SM_MACStats_EventTrigger_end(B);
|
||||
}
|
||||
|
||||
static E2SM_MACStats_EventTrigger_ref_t E2SM_MACStats_EventTrigger_clone(flatbuffers_builder_t *B, E2SM_MACStats_EventTrigger_table_t t)
|
||||
{
|
||||
__flatbuffers_memoize_begin(B, t);
|
||||
if (E2SM_MACStats_EventTrigger_start(B)
|
||||
|| E2SM_MACStats_EventTrigger_trig_pick(B, t)) {
|
||||
return 0;
|
||||
}
|
||||
__flatbuffers_memoize_end(B, t, E2SM_MACStats_EventTrigger_end(B));
|
||||
}
|
||||
|
||||
__flatbuffers_build_scalar_field(0, flatbuffers_, E2SM_MACStats_RanParameterItem_id, flatbuffers_uint32, uint32_t, 4, 4, UINT32_C(0), E2SM_MACStats_RanParameterItem)
|
||||
__flatbuffers_build_string_field(1, flatbuffers_, E2SM_MACStats_RanParameterItem_name, E2SM_MACStats_RanParameterItem)
|
||||
__flatbuffers_build_scalar_field(2, flatbuffers_, E2SM_MACStats_RanParameterItem_test, E2SM_MACStats_RanParameterTest, E2SM_MACStats_RanParameterTest_enum_t, 1, 1, UINT8_C(0), E2SM_MACStats_RanParameterItem)
|
||||
__flatbuffers_build_string_field(3, flatbuffers_, E2SM_MACStats_RanParameterItem_value, E2SM_MACStats_RanParameterItem)
|
||||
|
||||
static inline E2SM_MACStats_RanParameterItem_ref_t E2SM_MACStats_RanParameterItem_create(flatbuffers_builder_t *B __E2SM_MACStats_RanParameterItem_formal_args)
|
||||
{
|
||||
if (E2SM_MACStats_RanParameterItem_start(B)
|
||||
|| E2SM_MACStats_RanParameterItem_id_add(B, v0)
|
||||
|| E2SM_MACStats_RanParameterItem_name_add(B, v1)
|
||||
|| E2SM_MACStats_RanParameterItem_value_add(B, v3)
|
||||
|| E2SM_MACStats_RanParameterItem_test_add(B, v2)) {
|
||||
return 0;
|
||||
}
|
||||
return E2SM_MACStats_RanParameterItem_end(B);
|
||||
}
|
||||
|
||||
static E2SM_MACStats_RanParameterItem_ref_t E2SM_MACStats_RanParameterItem_clone(flatbuffers_builder_t *B, E2SM_MACStats_RanParameterItem_table_t t)
|
||||
{
|
||||
__flatbuffers_memoize_begin(B, t);
|
||||
if (E2SM_MACStats_RanParameterItem_start(B)
|
||||
|| E2SM_MACStats_RanParameterItem_id_pick(B, t)
|
||||
|| E2SM_MACStats_RanParameterItem_name_pick(B, t)
|
||||
|| E2SM_MACStats_RanParameterItem_value_pick(B, t)
|
||||
|| E2SM_MACStats_RanParameterItem_test_pick(B, t)) {
|
||||
return 0;
|
||||
}
|
||||
__flatbuffers_memoize_end(B, t, E2SM_MACStats_RanParameterItem_end(B));
|
||||
}
|
||||
|
||||
__flatbuffers_build_table_vector_field(0, flatbuffers_, E2SM_MACStats_ActionDefinitionFormat1_ranParameterList, E2SM_MACStats_RanParameterItem, E2SM_MACStats_ActionDefinitionFormat1)
|
||||
|
||||
static inline E2SM_MACStats_ActionDefinitionFormat1_ref_t E2SM_MACStats_ActionDefinitionFormat1_create(flatbuffers_builder_t *B __E2SM_MACStats_ActionDefinitionFormat1_formal_args)
|
||||
{
|
||||
if (E2SM_MACStats_ActionDefinitionFormat1_start(B)
|
||||
|| E2SM_MACStats_ActionDefinitionFormat1_ranParameterList_add(B, v0)) {
|
||||
return 0;
|
||||
}
|
||||
return E2SM_MACStats_ActionDefinitionFormat1_end(B);
|
||||
}
|
||||
|
||||
static E2SM_MACStats_ActionDefinitionFormat1_ref_t E2SM_MACStats_ActionDefinitionFormat1_clone(flatbuffers_builder_t *B, E2SM_MACStats_ActionDefinitionFormat1_table_t t)
|
||||
{
|
||||
__flatbuffers_memoize_begin(B, t);
|
||||
if (E2SM_MACStats_ActionDefinitionFormat1_start(B)
|
||||
|| E2SM_MACStats_ActionDefinitionFormat1_ranParameterList_pick(B, t)) {
|
||||
return 0;
|
||||
}
|
||||
__flatbuffers_memoize_end(B, t, E2SM_MACStats_ActionDefinitionFormat1_end(B));
|
||||
}
|
||||
|
||||
__flatbuffers_build_union_field(1, flatbuffers_, E2SM_MACStats_ActionDefinition_def, E2SM_MACStats_ActionDefinitionUnion, E2SM_MACStats_ActionDefinition)
|
||||
__flatbuffers_build_union_table_value_field(flatbuffers_, E2SM_MACStats_ActionDefinition_def, E2SM_MACStats_ActionDefinitionUnion, actionDefF1, E2SM_MACStats_ActionDefinitionFormat1)
|
||||
|
||||
static inline E2SM_MACStats_ActionDefinition_ref_t E2SM_MACStats_ActionDefinition_create(flatbuffers_builder_t *B __E2SM_MACStats_ActionDefinition_formal_args)
|
||||
{
|
||||
if (E2SM_MACStats_ActionDefinition_start(B)
|
||||
|| E2SM_MACStats_ActionDefinition_def_add_value(B, v1)
|
||||
|| E2SM_MACStats_ActionDefinition_def_add_type(B, v1.type)) {
|
||||
return 0;
|
||||
}
|
||||
return E2SM_MACStats_ActionDefinition_end(B);
|
||||
}
|
||||
|
||||
static E2SM_MACStats_ActionDefinition_ref_t E2SM_MACStats_ActionDefinition_clone(flatbuffers_builder_t *B, E2SM_MACStats_ActionDefinition_table_t t)
|
||||
{
|
||||
__flatbuffers_memoize_begin(B, t);
|
||||
if (E2SM_MACStats_ActionDefinition_start(B)
|
||||
|| E2SM_MACStats_ActionDefinition_def_pick(B, t)) {
|
||||
return 0;
|
||||
}
|
||||
__flatbuffers_memoize_end(B, t, E2SM_MACStats_ActionDefinition_end(B));
|
||||
}
|
||||
|
||||
__flatbuffers_build_scalar_field(0, flatbuffers_, E2SM_MACStats_IndicationHeaderFormat1_param, flatbuffers_uint32, uint32_t, 4, 4, UINT32_C(0), E2SM_MACStats_IndicationHeaderFormat1)
|
||||
|
||||
static inline E2SM_MACStats_IndicationHeaderFormat1_ref_t E2SM_MACStats_IndicationHeaderFormat1_create(flatbuffers_builder_t *B __E2SM_MACStats_IndicationHeaderFormat1_formal_args)
|
||||
{
|
||||
if (E2SM_MACStats_IndicationHeaderFormat1_start(B)
|
||||
|| E2SM_MACStats_IndicationHeaderFormat1_param_add(B, v0)) {
|
||||
return 0;
|
||||
}
|
||||
return E2SM_MACStats_IndicationHeaderFormat1_end(B);
|
||||
}
|
||||
|
||||
static E2SM_MACStats_IndicationHeaderFormat1_ref_t E2SM_MACStats_IndicationHeaderFormat1_clone(flatbuffers_builder_t *B, E2SM_MACStats_IndicationHeaderFormat1_table_t t)
|
||||
{
|
||||
__flatbuffers_memoize_begin(B, t);
|
||||
if (E2SM_MACStats_IndicationHeaderFormat1_start(B)
|
||||
|| E2SM_MACStats_IndicationHeaderFormat1_param_pick(B, t)) {
|
||||
return 0;
|
||||
}
|
||||
__flatbuffers_memoize_end(B, t, E2SM_MACStats_IndicationHeaderFormat1_end(B));
|
||||
}
|
||||
|
||||
__flatbuffers_build_union_field(1, flatbuffers_, E2SM_MACStats_IndicationHeader_hdr, E2SM_MACStats_IndicationHeaderUnion, E2SM_MACStats_IndicationHeader)
|
||||
__flatbuffers_build_union_table_value_field(flatbuffers_, E2SM_MACStats_IndicationHeader_hdr, E2SM_MACStats_IndicationHeaderUnion, indHeaderF1, E2SM_MACStats_IndicationHeaderFormat1)
|
||||
|
||||
static inline E2SM_MACStats_IndicationHeader_ref_t E2SM_MACStats_IndicationHeader_create(flatbuffers_builder_t *B __E2SM_MACStats_IndicationHeader_formal_args)
|
||||
{
|
||||
if (E2SM_MACStats_IndicationHeader_start(B)
|
||||
|| E2SM_MACStats_IndicationHeader_hdr_add_value(B, v1)
|
||||
|| E2SM_MACStats_IndicationHeader_hdr_add_type(B, v1.type)) {
|
||||
return 0;
|
||||
}
|
||||
return E2SM_MACStats_IndicationHeader_end(B);
|
||||
}
|
||||
|
||||
static E2SM_MACStats_IndicationHeader_ref_t E2SM_MACStats_IndicationHeader_clone(flatbuffers_builder_t *B, E2SM_MACStats_IndicationHeader_table_t t)
|
||||
{
|
||||
__flatbuffers_memoize_begin(B, t);
|
||||
if (E2SM_MACStats_IndicationHeader_start(B)
|
||||
|| E2SM_MACStats_IndicationHeader_hdr_pick(B, t)) {
|
||||
return 0;
|
||||
}
|
||||
__flatbuffers_memoize_end(B, t, E2SM_MACStats_IndicationHeader_end(B));
|
||||
}
|
||||
|
||||
__flatbuffers_build_scalar_field(0, flatbuffers_, E2SM_MACStats_IndicationMessage_tx_bytes, flatbuffers_uint32, uint32_t, 4, 4, UINT32_C(0), E2SM_MACStats_IndicationMessage)
|
||||
__flatbuffers_build_scalar_field(1, flatbuffers_, E2SM_MACStats_IndicationMessage_tx_pkts, flatbuffers_uint32, uint32_t, 4, 4, UINT32_C(0), E2SM_MACStats_IndicationMessage)
|
||||
|
||||
static inline E2SM_MACStats_IndicationMessage_ref_t E2SM_MACStats_IndicationMessage_create(flatbuffers_builder_t *B __E2SM_MACStats_IndicationMessage_formal_args)
|
||||
{
|
||||
if (E2SM_MACStats_IndicationMessage_start(B)
|
||||
|| E2SM_MACStats_IndicationMessage_tx_bytes_add(B, v0)
|
||||
|| E2SM_MACStats_IndicationMessage_tx_pkts_add(B, v1)) {
|
||||
return 0;
|
||||
}
|
||||
return E2SM_MACStats_IndicationMessage_end(B);
|
||||
}
|
||||
|
||||
static E2SM_MACStats_IndicationMessage_ref_t E2SM_MACStats_IndicationMessage_clone(flatbuffers_builder_t *B, E2SM_MACStats_IndicationMessage_table_t t)
|
||||
{
|
||||
__flatbuffers_memoize_begin(B, t);
|
||||
if (E2SM_MACStats_IndicationMessage_start(B)
|
||||
|| E2SM_MACStats_IndicationMessage_tx_bytes_pick(B, t)
|
||||
|| E2SM_MACStats_IndicationMessage_tx_pkts_pick(B, t)) {
|
||||
return 0;
|
||||
}
|
||||
__flatbuffers_memoize_end(B, t, E2SM_MACStats_IndicationMessage_end(B));
|
||||
}
|
||||
|
||||
__flatbuffers_build_scalar_field(0, flatbuffers_, E2SM_MACStats_ControlHeaderFormat1_param, flatbuffers_uint32, uint32_t, 4, 4, UINT32_C(0), E2SM_MACStats_ControlHeaderFormat1)
|
||||
|
||||
static inline E2SM_MACStats_ControlHeaderFormat1_ref_t E2SM_MACStats_ControlHeaderFormat1_create(flatbuffers_builder_t *B __E2SM_MACStats_ControlHeaderFormat1_formal_args)
|
||||
{
|
||||
if (E2SM_MACStats_ControlHeaderFormat1_start(B)
|
||||
|| E2SM_MACStats_ControlHeaderFormat1_param_add(B, v0)) {
|
||||
return 0;
|
||||
}
|
||||
return E2SM_MACStats_ControlHeaderFormat1_end(B);
|
||||
}
|
||||
|
||||
static E2SM_MACStats_ControlHeaderFormat1_ref_t E2SM_MACStats_ControlHeaderFormat1_clone(flatbuffers_builder_t *B, E2SM_MACStats_ControlHeaderFormat1_table_t t)
|
||||
{
|
||||
__flatbuffers_memoize_begin(B, t);
|
||||
if (E2SM_MACStats_ControlHeaderFormat1_start(B)
|
||||
|| E2SM_MACStats_ControlHeaderFormat1_param_pick(B, t)) {
|
||||
return 0;
|
||||
}
|
||||
__flatbuffers_memoize_end(B, t, E2SM_MACStats_ControlHeaderFormat1_end(B));
|
||||
}
|
||||
|
||||
__flatbuffers_build_union_field(1, flatbuffers_, E2SM_MACStats_ControlHeader_hdr, E2SM_MACStats_ControlHeaderUnion, E2SM_MACStats_ControlHeader)
|
||||
__flatbuffers_build_union_table_value_field(flatbuffers_, E2SM_MACStats_ControlHeader_hdr, E2SM_MACStats_ControlHeaderUnion, ctrlHeaderF1, E2SM_MACStats_ControlHeaderFormat1)
|
||||
|
||||
static inline E2SM_MACStats_ControlHeader_ref_t E2SM_MACStats_ControlHeader_create(flatbuffers_builder_t *B __E2SM_MACStats_ControlHeader_formal_args)
|
||||
{
|
||||
if (E2SM_MACStats_ControlHeader_start(B)
|
||||
|| E2SM_MACStats_ControlHeader_hdr_add_value(B, v1)
|
||||
|| E2SM_MACStats_ControlHeader_hdr_add_type(B, v1.type)) {
|
||||
return 0;
|
||||
}
|
||||
return E2SM_MACStats_ControlHeader_end(B);
|
||||
}
|
||||
|
||||
static E2SM_MACStats_ControlHeader_ref_t E2SM_MACStats_ControlHeader_clone(flatbuffers_builder_t *B, E2SM_MACStats_ControlHeader_table_t t)
|
||||
{
|
||||
__flatbuffers_memoize_begin(B, t);
|
||||
if (E2SM_MACStats_ControlHeader_start(B)
|
||||
|| E2SM_MACStats_ControlHeader_hdr_pick(B, t)) {
|
||||
return 0;
|
||||
}
|
||||
__flatbuffers_memoize_end(B, t, E2SM_MACStats_ControlHeader_end(B));
|
||||
}
|
||||
|
||||
__flatbuffers_build_vector_field(0, flatbuffers_, E2SM_MACStats_ControlMessageFormat1_param, flatbuffers_uint8, uint8_t, E2SM_MACStats_ControlMessageFormat1)
|
||||
|
||||
static inline E2SM_MACStats_ControlMessageFormat1_ref_t E2SM_MACStats_ControlMessageFormat1_create(flatbuffers_builder_t *B __E2SM_MACStats_ControlMessageFormat1_formal_args)
|
||||
{
|
||||
if (E2SM_MACStats_ControlMessageFormat1_start(B)
|
||||
|| E2SM_MACStats_ControlMessageFormat1_param_add(B, v0)) {
|
||||
return 0;
|
||||
}
|
||||
return E2SM_MACStats_ControlMessageFormat1_end(B);
|
||||
}
|
||||
|
||||
static E2SM_MACStats_ControlMessageFormat1_ref_t E2SM_MACStats_ControlMessageFormat1_clone(flatbuffers_builder_t *B, E2SM_MACStats_ControlMessageFormat1_table_t t)
|
||||
{
|
||||
__flatbuffers_memoize_begin(B, t);
|
||||
if (E2SM_MACStats_ControlMessageFormat1_start(B)
|
||||
|| E2SM_MACStats_ControlMessageFormat1_param_pick(B, t)) {
|
||||
return 0;
|
||||
}
|
||||
__flatbuffers_memoize_end(B, t, E2SM_MACStats_ControlMessageFormat1_end(B));
|
||||
}
|
||||
|
||||
__flatbuffers_build_union_field(1, flatbuffers_, E2SM_MACStats_ControlMessage_msg, E2SM_MACStats_ControlMessageUnion, E2SM_MACStats_ControlMessage)
|
||||
__flatbuffers_build_union_table_value_field(flatbuffers_, E2SM_MACStats_ControlMessage_msg, E2SM_MACStats_ControlMessageUnion, ctrlMessageF1, E2SM_MACStats_ControlMessageFormat1)
|
||||
|
||||
static inline E2SM_MACStats_ControlMessage_ref_t E2SM_MACStats_ControlMessage_create(flatbuffers_builder_t *B __E2SM_MACStats_ControlMessage_formal_args)
|
||||
{
|
||||
if (E2SM_MACStats_ControlMessage_start(B)
|
||||
|| E2SM_MACStats_ControlMessage_msg_add_value(B, v1)
|
||||
|| E2SM_MACStats_ControlMessage_msg_add_type(B, v1.type)) {
|
||||
return 0;
|
||||
}
|
||||
return E2SM_MACStats_ControlMessage_end(B);
|
||||
}
|
||||
|
||||
static E2SM_MACStats_ControlMessage_ref_t E2SM_MACStats_ControlMessage_clone(flatbuffers_builder_t *B, E2SM_MACStats_ControlMessage_table_t t)
|
||||
{
|
||||
__flatbuffers_memoize_begin(B, t);
|
||||
if (E2SM_MACStats_ControlMessage_start(B)
|
||||
|| E2SM_MACStats_ControlMessage_msg_pick(B, t)) {
|
||||
return 0;
|
||||
}
|
||||
__flatbuffers_memoize_end(B, t, E2SM_MACStats_ControlMessage_end(B));
|
||||
}
|
||||
|
||||
#include "flatcc/flatcc_epilogue.h"
|
||||
#endif /* E2SM_MAC_STATS_V00_BUILDER_H */
|
||||
497
executables/mac_sm/ie/fb/e2sm_mac_stats_v00_reader.h
Normal file
497
executables/mac_sm/ie/fb/e2sm_mac_stats_v00_reader.h
Normal file
@@ -0,0 +1,497 @@
|
||||
#ifndef E2SM_MAC_STATS_V00_READER_H
|
||||
#define E2SM_MAC_STATS_V00_READER_H
|
||||
|
||||
/* Generated by flatcc 0.6.1-dev FlatBuffers schema compiler for C by dvide.com */
|
||||
|
||||
#ifndef FLATBUFFERS_COMMON_READER_H
|
||||
#include "flatbuffers_common_reader.h"
|
||||
#endif
|
||||
#include "flatcc/flatcc_flatbuffers.h"
|
||||
#ifndef __alignas_is_defined
|
||||
#include <stdalign.h>
|
||||
#endif
|
||||
#include "flatcc/flatcc_prologue.h"
|
||||
#ifndef flatbuffers_identifier
|
||||
#define flatbuffers_identifier 0
|
||||
#endif
|
||||
#ifndef flatbuffers_extension
|
||||
#define flatbuffers_extension "bin"
|
||||
#endif
|
||||
|
||||
|
||||
typedef const struct E2SM_MACStats_EventTriggerDefinitionFormat1_table *E2SM_MACStats_EventTriggerDefinitionFormat1_table_t;
|
||||
typedef struct E2SM_MACStats_EventTriggerDefinitionFormat1_table *E2SM_MACStats_EventTriggerDefinitionFormat1_mutable_table_t;
|
||||
typedef const flatbuffers_uoffset_t *E2SM_MACStats_EventTriggerDefinitionFormat1_vec_t;
|
||||
typedef flatbuffers_uoffset_t *E2SM_MACStats_EventTriggerDefinitionFormat1_mutable_vec_t;
|
||||
typedef const struct E2SM_MACStats_EventTrigger_table *E2SM_MACStats_EventTrigger_table_t;
|
||||
typedef struct E2SM_MACStats_EventTrigger_table *E2SM_MACStats_EventTrigger_mutable_table_t;
|
||||
typedef const flatbuffers_uoffset_t *E2SM_MACStats_EventTrigger_vec_t;
|
||||
typedef flatbuffers_uoffset_t *E2SM_MACStats_EventTrigger_mutable_vec_t;
|
||||
typedef const struct E2SM_MACStats_RanParameterItem_table *E2SM_MACStats_RanParameterItem_table_t;
|
||||
typedef struct E2SM_MACStats_RanParameterItem_table *E2SM_MACStats_RanParameterItem_mutable_table_t;
|
||||
typedef const flatbuffers_uoffset_t *E2SM_MACStats_RanParameterItem_vec_t;
|
||||
typedef flatbuffers_uoffset_t *E2SM_MACStats_RanParameterItem_mutable_vec_t;
|
||||
typedef const struct E2SM_MACStats_ActionDefinitionFormat1_table *E2SM_MACStats_ActionDefinitionFormat1_table_t;
|
||||
typedef struct E2SM_MACStats_ActionDefinitionFormat1_table *E2SM_MACStats_ActionDefinitionFormat1_mutable_table_t;
|
||||
typedef const flatbuffers_uoffset_t *E2SM_MACStats_ActionDefinitionFormat1_vec_t;
|
||||
typedef flatbuffers_uoffset_t *E2SM_MACStats_ActionDefinitionFormat1_mutable_vec_t;
|
||||
typedef const struct E2SM_MACStats_ActionDefinition_table *E2SM_MACStats_ActionDefinition_table_t;
|
||||
typedef struct E2SM_MACStats_ActionDefinition_table *E2SM_MACStats_ActionDefinition_mutable_table_t;
|
||||
typedef const flatbuffers_uoffset_t *E2SM_MACStats_ActionDefinition_vec_t;
|
||||
typedef flatbuffers_uoffset_t *E2SM_MACStats_ActionDefinition_mutable_vec_t;
|
||||
typedef const struct E2SM_MACStats_IndicationHeaderFormat1_table *E2SM_MACStats_IndicationHeaderFormat1_table_t;
|
||||
typedef struct E2SM_MACStats_IndicationHeaderFormat1_table *E2SM_MACStats_IndicationHeaderFormat1_mutable_table_t;
|
||||
typedef const flatbuffers_uoffset_t *E2SM_MACStats_IndicationHeaderFormat1_vec_t;
|
||||
typedef flatbuffers_uoffset_t *E2SM_MACStats_IndicationHeaderFormat1_mutable_vec_t;
|
||||
typedef const struct E2SM_MACStats_IndicationHeader_table *E2SM_MACStats_IndicationHeader_table_t;
|
||||
typedef struct E2SM_MACStats_IndicationHeader_table *E2SM_MACStats_IndicationHeader_mutable_table_t;
|
||||
typedef const flatbuffers_uoffset_t *E2SM_MACStats_IndicationHeader_vec_t;
|
||||
typedef flatbuffers_uoffset_t *E2SM_MACStats_IndicationHeader_mutable_vec_t;
|
||||
typedef const struct E2SM_MACStats_IndicationMessage_table *E2SM_MACStats_IndicationMessage_table_t;
|
||||
typedef struct E2SM_MACStats_IndicationMessage_table *E2SM_MACStats_IndicationMessage_mutable_table_t;
|
||||
typedef const flatbuffers_uoffset_t *E2SM_MACStats_IndicationMessage_vec_t;
|
||||
typedef flatbuffers_uoffset_t *E2SM_MACStats_IndicationMessage_mutable_vec_t;
|
||||
typedef const struct E2SM_MACStats_ControlHeaderFormat1_table *E2SM_MACStats_ControlHeaderFormat1_table_t;
|
||||
typedef struct E2SM_MACStats_ControlHeaderFormat1_table *E2SM_MACStats_ControlHeaderFormat1_mutable_table_t;
|
||||
typedef const flatbuffers_uoffset_t *E2SM_MACStats_ControlHeaderFormat1_vec_t;
|
||||
typedef flatbuffers_uoffset_t *E2SM_MACStats_ControlHeaderFormat1_mutable_vec_t;
|
||||
typedef const struct E2SM_MACStats_ControlHeader_table *E2SM_MACStats_ControlHeader_table_t;
|
||||
typedef struct E2SM_MACStats_ControlHeader_table *E2SM_MACStats_ControlHeader_mutable_table_t;
|
||||
typedef const flatbuffers_uoffset_t *E2SM_MACStats_ControlHeader_vec_t;
|
||||
typedef flatbuffers_uoffset_t *E2SM_MACStats_ControlHeader_mutable_vec_t;
|
||||
typedef const struct E2SM_MACStats_ControlMessageFormat1_table *E2SM_MACStats_ControlMessageFormat1_table_t;
|
||||
typedef struct E2SM_MACStats_ControlMessageFormat1_table *E2SM_MACStats_ControlMessageFormat1_mutable_table_t;
|
||||
typedef const flatbuffers_uoffset_t *E2SM_MACStats_ControlMessageFormat1_vec_t;
|
||||
typedef flatbuffers_uoffset_t *E2SM_MACStats_ControlMessageFormat1_mutable_vec_t;
|
||||
typedef const struct E2SM_MACStats_ControlMessage_table *E2SM_MACStats_ControlMessage_table_t;
|
||||
typedef struct E2SM_MACStats_ControlMessage_table *E2SM_MACStats_ControlMessage_mutable_table_t;
|
||||
typedef const flatbuffers_uoffset_t *E2SM_MACStats_ControlMessage_vec_t;
|
||||
typedef flatbuffers_uoffset_t *E2SM_MACStats_ControlMessage_mutable_vec_t;
|
||||
#ifndef E2SM_MACStats_EventTriggerDefinitionFormat1_file_identifier
|
||||
#define E2SM_MACStats_EventTriggerDefinitionFormat1_file_identifier 0
|
||||
#endif
|
||||
/* deprecated, use E2SM_MACStats_EventTriggerDefinitionFormat1_file_identifier */
|
||||
#ifndef E2SM_MACStats_EventTriggerDefinitionFormat1_identifier
|
||||
#define E2SM_MACStats_EventTriggerDefinitionFormat1_identifier 0
|
||||
#endif
|
||||
#define E2SM_MACStats_EventTriggerDefinitionFormat1_type_hash ((flatbuffers_thash_t)0xa4afb806)
|
||||
#define E2SM_MACStats_EventTriggerDefinitionFormat1_type_identifier "\x06\xb8\xaf\xa4"
|
||||
#ifndef E2SM_MACStats_EventTriggerDefinitionFormat1_file_extension
|
||||
#define E2SM_MACStats_EventTriggerDefinitionFormat1_file_extension "bin"
|
||||
#endif
|
||||
#ifndef E2SM_MACStats_EventTrigger_file_identifier
|
||||
#define E2SM_MACStats_EventTrigger_file_identifier 0
|
||||
#endif
|
||||
/* deprecated, use E2SM_MACStats_EventTrigger_file_identifier */
|
||||
#ifndef E2SM_MACStats_EventTrigger_identifier
|
||||
#define E2SM_MACStats_EventTrigger_identifier 0
|
||||
#endif
|
||||
#define E2SM_MACStats_EventTrigger_type_hash ((flatbuffers_thash_t)0x61fc5df5)
|
||||
#define E2SM_MACStats_EventTrigger_type_identifier "\xf5\x5d\xfc\x61"
|
||||
#ifndef E2SM_MACStats_EventTrigger_file_extension
|
||||
#define E2SM_MACStats_EventTrigger_file_extension "bin"
|
||||
#endif
|
||||
#ifndef E2SM_MACStats_RanParameterItem_file_identifier
|
||||
#define E2SM_MACStats_RanParameterItem_file_identifier 0
|
||||
#endif
|
||||
/* deprecated, use E2SM_MACStats_RanParameterItem_file_identifier */
|
||||
#ifndef E2SM_MACStats_RanParameterItem_identifier
|
||||
#define E2SM_MACStats_RanParameterItem_identifier 0
|
||||
#endif
|
||||
#define E2SM_MACStats_RanParameterItem_type_hash ((flatbuffers_thash_t)0x3441db06)
|
||||
#define E2SM_MACStats_RanParameterItem_type_identifier "\x06\xdb\x41\x34"
|
||||
#ifndef E2SM_MACStats_RanParameterItem_file_extension
|
||||
#define E2SM_MACStats_RanParameterItem_file_extension "bin"
|
||||
#endif
|
||||
#ifndef E2SM_MACStats_ActionDefinitionFormat1_file_identifier
|
||||
#define E2SM_MACStats_ActionDefinitionFormat1_file_identifier 0
|
||||
#endif
|
||||
/* deprecated, use E2SM_MACStats_ActionDefinitionFormat1_file_identifier */
|
||||
#ifndef E2SM_MACStats_ActionDefinitionFormat1_identifier
|
||||
#define E2SM_MACStats_ActionDefinitionFormat1_identifier 0
|
||||
#endif
|
||||
#define E2SM_MACStats_ActionDefinitionFormat1_type_hash ((flatbuffers_thash_t)0xa552a9f4)
|
||||
#define E2SM_MACStats_ActionDefinitionFormat1_type_identifier "\xf4\xa9\x52\xa5"
|
||||
#ifndef E2SM_MACStats_ActionDefinitionFormat1_file_extension
|
||||
#define E2SM_MACStats_ActionDefinitionFormat1_file_extension "bin"
|
||||
#endif
|
||||
#ifndef E2SM_MACStats_ActionDefinition_file_identifier
|
||||
#define E2SM_MACStats_ActionDefinition_file_identifier 0
|
||||
#endif
|
||||
/* deprecated, use E2SM_MACStats_ActionDefinition_file_identifier */
|
||||
#ifndef E2SM_MACStats_ActionDefinition_identifier
|
||||
#define E2SM_MACStats_ActionDefinition_identifier 0
|
||||
#endif
|
||||
#define E2SM_MACStats_ActionDefinition_type_hash ((flatbuffers_thash_t)0x932bdbfe)
|
||||
#define E2SM_MACStats_ActionDefinition_type_identifier "\xfe\xdb\x2b\x93"
|
||||
#ifndef E2SM_MACStats_ActionDefinition_file_extension
|
||||
#define E2SM_MACStats_ActionDefinition_file_extension "bin"
|
||||
#endif
|
||||
#ifndef E2SM_MACStats_IndicationHeaderFormat1_file_identifier
|
||||
#define E2SM_MACStats_IndicationHeaderFormat1_file_identifier 0
|
||||
#endif
|
||||
/* deprecated, use E2SM_MACStats_IndicationHeaderFormat1_file_identifier */
|
||||
#ifndef E2SM_MACStats_IndicationHeaderFormat1_identifier
|
||||
#define E2SM_MACStats_IndicationHeaderFormat1_identifier 0
|
||||
#endif
|
||||
#define E2SM_MACStats_IndicationHeaderFormat1_type_hash ((flatbuffers_thash_t)0xc3383164)
|
||||
#define E2SM_MACStats_IndicationHeaderFormat1_type_identifier "\x64\x31\x38\xc3"
|
||||
#ifndef E2SM_MACStats_IndicationHeaderFormat1_file_extension
|
||||
#define E2SM_MACStats_IndicationHeaderFormat1_file_extension "bin"
|
||||
#endif
|
||||
#ifndef E2SM_MACStats_IndicationHeader_file_identifier
|
||||
#define E2SM_MACStats_IndicationHeader_file_identifier 0
|
||||
#endif
|
||||
/* deprecated, use E2SM_MACStats_IndicationHeader_file_identifier */
|
||||
#ifndef E2SM_MACStats_IndicationHeader_identifier
|
||||
#define E2SM_MACStats_IndicationHeader_identifier 0
|
||||
#endif
|
||||
#define E2SM_MACStats_IndicationHeader_type_hash ((flatbuffers_thash_t)0x46e2edae)
|
||||
#define E2SM_MACStats_IndicationHeader_type_identifier "\xae\xed\xe2\x46"
|
||||
#ifndef E2SM_MACStats_IndicationHeader_file_extension
|
||||
#define E2SM_MACStats_IndicationHeader_file_extension "bin"
|
||||
#endif
|
||||
#ifndef E2SM_MACStats_IndicationMessage_file_identifier
|
||||
#define E2SM_MACStats_IndicationMessage_file_identifier 0
|
||||
#endif
|
||||
/* deprecated, use E2SM_MACStats_IndicationMessage_file_identifier */
|
||||
#ifndef E2SM_MACStats_IndicationMessage_identifier
|
||||
#define E2SM_MACStats_IndicationMessage_identifier 0
|
||||
#endif
|
||||
#define E2SM_MACStats_IndicationMessage_type_hash ((flatbuffers_thash_t)0xb295c5c6)
|
||||
#define E2SM_MACStats_IndicationMessage_type_identifier "\xc6\xc5\x95\xb2"
|
||||
#ifndef E2SM_MACStats_IndicationMessage_file_extension
|
||||
#define E2SM_MACStats_IndicationMessage_file_extension "bin"
|
||||
#endif
|
||||
#ifndef E2SM_MACStats_ControlHeaderFormat1_file_identifier
|
||||
#define E2SM_MACStats_ControlHeaderFormat1_file_identifier 0
|
||||
#endif
|
||||
/* deprecated, use E2SM_MACStats_ControlHeaderFormat1_file_identifier */
|
||||
#ifndef E2SM_MACStats_ControlHeaderFormat1_identifier
|
||||
#define E2SM_MACStats_ControlHeaderFormat1_identifier 0
|
||||
#endif
|
||||
#define E2SM_MACStats_ControlHeaderFormat1_type_hash ((flatbuffers_thash_t)0x9e4de7)
|
||||
#define E2SM_MACStats_ControlHeaderFormat1_type_identifier "\xe7\x4d\x9e\x00"
|
||||
#ifndef E2SM_MACStats_ControlHeaderFormat1_file_extension
|
||||
#define E2SM_MACStats_ControlHeaderFormat1_file_extension "bin"
|
||||
#endif
|
||||
#ifndef E2SM_MACStats_ControlHeader_file_identifier
|
||||
#define E2SM_MACStats_ControlHeader_file_identifier 0
|
||||
#endif
|
||||
/* deprecated, use E2SM_MACStats_ControlHeader_file_identifier */
|
||||
#ifndef E2SM_MACStats_ControlHeader_identifier
|
||||
#define E2SM_MACStats_ControlHeader_identifier 0
|
||||
#endif
|
||||
#define E2SM_MACStats_ControlHeader_type_hash ((flatbuffers_thash_t)0x4a731723)
|
||||
#define E2SM_MACStats_ControlHeader_type_identifier "\x23\x17\x73\x4a"
|
||||
#ifndef E2SM_MACStats_ControlHeader_file_extension
|
||||
#define E2SM_MACStats_ControlHeader_file_extension "bin"
|
||||
#endif
|
||||
#ifndef E2SM_MACStats_ControlMessageFormat1_file_identifier
|
||||
#define E2SM_MACStats_ControlMessageFormat1_file_identifier 0
|
||||
#endif
|
||||
/* deprecated, use E2SM_MACStats_ControlMessageFormat1_file_identifier */
|
||||
#ifndef E2SM_MACStats_ControlMessageFormat1_identifier
|
||||
#define E2SM_MACStats_ControlMessageFormat1_identifier 0
|
||||
#endif
|
||||
#define E2SM_MACStats_ControlMessageFormat1_type_hash ((flatbuffers_thash_t)0x63080dbd)
|
||||
#define E2SM_MACStats_ControlMessageFormat1_type_identifier "\xbd\x0d\x08\x63"
|
||||
#ifndef E2SM_MACStats_ControlMessageFormat1_file_extension
|
||||
#define E2SM_MACStats_ControlMessageFormat1_file_extension "bin"
|
||||
#endif
|
||||
#ifndef E2SM_MACStats_ControlMessage_file_identifier
|
||||
#define E2SM_MACStats_ControlMessage_file_identifier 0
|
||||
#endif
|
||||
/* deprecated, use E2SM_MACStats_ControlMessage_file_identifier */
|
||||
#ifndef E2SM_MACStats_ControlMessage_identifier
|
||||
#define E2SM_MACStats_ControlMessage_identifier 0
|
||||
#endif
|
||||
#define E2SM_MACStats_ControlMessage_type_hash ((flatbuffers_thash_t)0xee935501)
|
||||
#define E2SM_MACStats_ControlMessage_type_identifier "\x01\x55\x93\xee"
|
||||
#ifndef E2SM_MACStats_ControlMessage_file_extension
|
||||
#define E2SM_MACStats_ControlMessage_file_extension "bin"
|
||||
#endif
|
||||
|
||||
typedef uint8_t E2SM_MACStats_TriggerNature_enum_t;
|
||||
__flatbuffers_define_integer_type(E2SM_MACStats_TriggerNature, E2SM_MACStats_TriggerNature_enum_t, 8)
|
||||
#define E2SM_MACStats_TriggerNature_oneMs ((E2SM_MACStats_TriggerNature_enum_t)UINT8_C(0))
|
||||
#define E2SM_MACStats_TriggerNature_twoMs ((E2SM_MACStats_TriggerNature_enum_t)UINT8_C(1))
|
||||
#define E2SM_MACStats_TriggerNature_fiveMs ((E2SM_MACStats_TriggerNature_enum_t)UINT8_C(2))
|
||||
|
||||
static inline const char *E2SM_MACStats_TriggerNature_name(E2SM_MACStats_TriggerNature_enum_t value)
|
||||
{
|
||||
switch (value) {
|
||||
case E2SM_MACStats_TriggerNature_oneMs: return "oneMs";
|
||||
case E2SM_MACStats_TriggerNature_twoMs: return "twoMs";
|
||||
case E2SM_MACStats_TriggerNature_fiveMs: return "fiveMs";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_TriggerNature_is_known_value(E2SM_MACStats_TriggerNature_enum_t value)
|
||||
{
|
||||
switch (value) {
|
||||
case E2SM_MACStats_TriggerNature_oneMs: return 1;
|
||||
case E2SM_MACStats_TriggerNature_twoMs: return 1;
|
||||
case E2SM_MACStats_TriggerNature_fiveMs: return 1;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
typedef uint8_t E2SM_MACStats_RanParameterTest_enum_t;
|
||||
__flatbuffers_define_integer_type(E2SM_MACStats_RanParameterTest, E2SM_MACStats_RanParameterTest_enum_t, 8)
|
||||
#define E2SM_MACStats_RanParameterTest_equal ((E2SM_MACStats_RanParameterTest_enum_t)UINT8_C(0))
|
||||
#define E2SM_MACStats_RanParameterTest_greaterThan ((E2SM_MACStats_RanParameterTest_enum_t)UINT8_C(1))
|
||||
#define E2SM_MACStats_RanParameterTest_lessThan ((E2SM_MACStats_RanParameterTest_enum_t)UINT8_C(2))
|
||||
#define E2SM_MACStats_RanParameterTest_contains ((E2SM_MACStats_RanParameterTest_enum_t)UINT8_C(3))
|
||||
#define E2SM_MACStats_RanParameterTest_present ((E2SM_MACStats_RanParameterTest_enum_t)UINT8_C(4))
|
||||
|
||||
static inline const char *E2SM_MACStats_RanParameterTest_name(E2SM_MACStats_RanParameterTest_enum_t value)
|
||||
{
|
||||
switch (value) {
|
||||
case E2SM_MACStats_RanParameterTest_equal: return "equal";
|
||||
case E2SM_MACStats_RanParameterTest_greaterThan: return "greaterThan";
|
||||
case E2SM_MACStats_RanParameterTest_lessThan: return "lessThan";
|
||||
case E2SM_MACStats_RanParameterTest_contains: return "contains";
|
||||
case E2SM_MACStats_RanParameterTest_present: return "present";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_RanParameterTest_is_known_value(E2SM_MACStats_RanParameterTest_enum_t value)
|
||||
{
|
||||
switch (value) {
|
||||
case E2SM_MACStats_RanParameterTest_equal: return 1;
|
||||
case E2SM_MACStats_RanParameterTest_greaterThan: return 1;
|
||||
case E2SM_MACStats_RanParameterTest_lessThan: return 1;
|
||||
case E2SM_MACStats_RanParameterTest_contains: return 1;
|
||||
case E2SM_MACStats_RanParameterTest_present: return 1;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct E2SM_MACStats_EventTriggerDefinitionFormat1_table { uint8_t unused__; };
|
||||
|
||||
static inline size_t E2SM_MACStats_EventTriggerDefinitionFormat1_vec_len(E2SM_MACStats_EventTriggerDefinitionFormat1_vec_t vec)
|
||||
__flatbuffers_vec_len(vec)
|
||||
static inline E2SM_MACStats_EventTriggerDefinitionFormat1_table_t E2SM_MACStats_EventTriggerDefinitionFormat1_vec_at(E2SM_MACStats_EventTriggerDefinitionFormat1_vec_t vec, size_t i)
|
||||
__flatbuffers_offset_vec_at(E2SM_MACStats_EventTriggerDefinitionFormat1_table_t, vec, i, 0)
|
||||
__flatbuffers_table_as_root(E2SM_MACStats_EventTriggerDefinitionFormat1)
|
||||
|
||||
__flatbuffers_define_scalar_field(0, E2SM_MACStats_EventTriggerDefinitionFormat1, triggerNature, E2SM_MACStats_TriggerNature, E2SM_MACStats_TriggerNature_enum_t, UINT8_C(0))
|
||||
|
||||
struct E2SM_MACStats_EventTrigger_table { uint8_t unused__; };
|
||||
|
||||
static inline size_t E2SM_MACStats_EventTrigger_vec_len(E2SM_MACStats_EventTrigger_vec_t vec)
|
||||
__flatbuffers_vec_len(vec)
|
||||
static inline E2SM_MACStats_EventTrigger_table_t E2SM_MACStats_EventTrigger_vec_at(E2SM_MACStats_EventTrigger_vec_t vec, size_t i)
|
||||
__flatbuffers_offset_vec_at(E2SM_MACStats_EventTrigger_table_t, vec, i, 0)
|
||||
__flatbuffers_table_as_root(E2SM_MACStats_EventTrigger)
|
||||
|
||||
__flatbuffers_define_scalar_field(0, E2SM_MACStats_EventTrigger, trig, E2SM_MACStats_TriggerNature, E2SM_MACStats_TriggerNature_enum_t, UINT8_C(0))
|
||||
|
||||
struct E2SM_MACStats_RanParameterItem_table { uint8_t unused__; };
|
||||
|
||||
static inline size_t E2SM_MACStats_RanParameterItem_vec_len(E2SM_MACStats_RanParameterItem_vec_t vec)
|
||||
__flatbuffers_vec_len(vec)
|
||||
static inline E2SM_MACStats_RanParameterItem_table_t E2SM_MACStats_RanParameterItem_vec_at(E2SM_MACStats_RanParameterItem_vec_t vec, size_t i)
|
||||
__flatbuffers_offset_vec_at(E2SM_MACStats_RanParameterItem_table_t, vec, i, 0)
|
||||
__flatbuffers_table_as_root(E2SM_MACStats_RanParameterItem)
|
||||
|
||||
__flatbuffers_define_scalar_field(0, E2SM_MACStats_RanParameterItem, id, flatbuffers_uint32, uint32_t, UINT32_C(0))
|
||||
__flatbuffers_define_string_field(1, E2SM_MACStats_RanParameterItem, name, 0)
|
||||
__flatbuffers_define_scalar_field(2, E2SM_MACStats_RanParameterItem, test, E2SM_MACStats_RanParameterTest, E2SM_MACStats_RanParameterTest_enum_t, UINT8_C(0))
|
||||
__flatbuffers_define_string_field(3, E2SM_MACStats_RanParameterItem, value, 0)
|
||||
|
||||
struct E2SM_MACStats_ActionDefinitionFormat1_table { uint8_t unused__; };
|
||||
|
||||
static inline size_t E2SM_MACStats_ActionDefinitionFormat1_vec_len(E2SM_MACStats_ActionDefinitionFormat1_vec_t vec)
|
||||
__flatbuffers_vec_len(vec)
|
||||
static inline E2SM_MACStats_ActionDefinitionFormat1_table_t E2SM_MACStats_ActionDefinitionFormat1_vec_at(E2SM_MACStats_ActionDefinitionFormat1_vec_t vec, size_t i)
|
||||
__flatbuffers_offset_vec_at(E2SM_MACStats_ActionDefinitionFormat1_table_t, vec, i, 0)
|
||||
__flatbuffers_table_as_root(E2SM_MACStats_ActionDefinitionFormat1)
|
||||
|
||||
__flatbuffers_define_vector_field(0, E2SM_MACStats_ActionDefinitionFormat1, ranParameterList, E2SM_MACStats_RanParameterItem_vec_t, 0)
|
||||
typedef uint8_t E2SM_MACStats_ActionDefinitionUnion_union_type_t;
|
||||
__flatbuffers_define_integer_type(E2SM_MACStats_ActionDefinitionUnion, E2SM_MACStats_ActionDefinitionUnion_union_type_t, 8)
|
||||
__flatbuffers_define_union(flatbuffers_, E2SM_MACStats_ActionDefinitionUnion)
|
||||
#define E2SM_MACStats_ActionDefinitionUnion_NONE ((E2SM_MACStats_ActionDefinitionUnion_union_type_t)UINT8_C(0))
|
||||
#define E2SM_MACStats_ActionDefinitionUnion_actionDefF1 ((E2SM_MACStats_ActionDefinitionUnion_union_type_t)UINT8_C(1))
|
||||
|
||||
static inline const char *E2SM_MACStats_ActionDefinitionUnion_type_name(E2SM_MACStats_ActionDefinitionUnion_union_type_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case E2SM_MACStats_ActionDefinitionUnion_NONE: return "NONE";
|
||||
case E2SM_MACStats_ActionDefinitionUnion_actionDefF1: return "actionDefF1";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ActionDefinitionUnion_is_known_type(E2SM_MACStats_ActionDefinitionUnion_union_type_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case E2SM_MACStats_ActionDefinitionUnion_NONE: return 1;
|
||||
case E2SM_MACStats_ActionDefinitionUnion_actionDefF1: return 1;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct E2SM_MACStats_ActionDefinition_table { uint8_t unused__; };
|
||||
|
||||
static inline size_t E2SM_MACStats_ActionDefinition_vec_len(E2SM_MACStats_ActionDefinition_vec_t vec)
|
||||
__flatbuffers_vec_len(vec)
|
||||
static inline E2SM_MACStats_ActionDefinition_table_t E2SM_MACStats_ActionDefinition_vec_at(E2SM_MACStats_ActionDefinition_vec_t vec, size_t i)
|
||||
__flatbuffers_offset_vec_at(E2SM_MACStats_ActionDefinition_table_t, vec, i, 0)
|
||||
__flatbuffers_table_as_root(E2SM_MACStats_ActionDefinition)
|
||||
|
||||
__flatbuffers_define_union_field(flatbuffers_, 1, E2SM_MACStats_ActionDefinition, def, E2SM_MACStats_ActionDefinitionUnion, 0)
|
||||
|
||||
struct E2SM_MACStats_IndicationHeaderFormat1_table { uint8_t unused__; };
|
||||
|
||||
static inline size_t E2SM_MACStats_IndicationHeaderFormat1_vec_len(E2SM_MACStats_IndicationHeaderFormat1_vec_t vec)
|
||||
__flatbuffers_vec_len(vec)
|
||||
static inline E2SM_MACStats_IndicationHeaderFormat1_table_t E2SM_MACStats_IndicationHeaderFormat1_vec_at(E2SM_MACStats_IndicationHeaderFormat1_vec_t vec, size_t i)
|
||||
__flatbuffers_offset_vec_at(E2SM_MACStats_IndicationHeaderFormat1_table_t, vec, i, 0)
|
||||
__flatbuffers_table_as_root(E2SM_MACStats_IndicationHeaderFormat1)
|
||||
|
||||
__flatbuffers_define_scalar_field(0, E2SM_MACStats_IndicationHeaderFormat1, param, flatbuffers_uint32, uint32_t, UINT32_C(0))
|
||||
typedef uint8_t E2SM_MACStats_IndicationHeaderUnion_union_type_t;
|
||||
__flatbuffers_define_integer_type(E2SM_MACStats_IndicationHeaderUnion, E2SM_MACStats_IndicationHeaderUnion_union_type_t, 8)
|
||||
__flatbuffers_define_union(flatbuffers_, E2SM_MACStats_IndicationHeaderUnion)
|
||||
#define E2SM_MACStats_IndicationHeaderUnion_NONE ((E2SM_MACStats_IndicationHeaderUnion_union_type_t)UINT8_C(0))
|
||||
#define E2SM_MACStats_IndicationHeaderUnion_indHeaderF1 ((E2SM_MACStats_IndicationHeaderUnion_union_type_t)UINT8_C(1))
|
||||
|
||||
static inline const char *E2SM_MACStats_IndicationHeaderUnion_type_name(E2SM_MACStats_IndicationHeaderUnion_union_type_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case E2SM_MACStats_IndicationHeaderUnion_NONE: return "NONE";
|
||||
case E2SM_MACStats_IndicationHeaderUnion_indHeaderF1: return "indHeaderF1";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_IndicationHeaderUnion_is_known_type(E2SM_MACStats_IndicationHeaderUnion_union_type_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case E2SM_MACStats_IndicationHeaderUnion_NONE: return 1;
|
||||
case E2SM_MACStats_IndicationHeaderUnion_indHeaderF1: return 1;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct E2SM_MACStats_IndicationHeader_table { uint8_t unused__; };
|
||||
|
||||
static inline size_t E2SM_MACStats_IndicationHeader_vec_len(E2SM_MACStats_IndicationHeader_vec_t vec)
|
||||
__flatbuffers_vec_len(vec)
|
||||
static inline E2SM_MACStats_IndicationHeader_table_t E2SM_MACStats_IndicationHeader_vec_at(E2SM_MACStats_IndicationHeader_vec_t vec, size_t i)
|
||||
__flatbuffers_offset_vec_at(E2SM_MACStats_IndicationHeader_table_t, vec, i, 0)
|
||||
__flatbuffers_table_as_root(E2SM_MACStats_IndicationHeader)
|
||||
|
||||
__flatbuffers_define_union_field(flatbuffers_, 1, E2SM_MACStats_IndicationHeader, hdr, E2SM_MACStats_IndicationHeaderUnion, 0)
|
||||
|
||||
struct E2SM_MACStats_IndicationMessage_table { uint8_t unused__; };
|
||||
|
||||
static inline size_t E2SM_MACStats_IndicationMessage_vec_len(E2SM_MACStats_IndicationMessage_vec_t vec)
|
||||
__flatbuffers_vec_len(vec)
|
||||
static inline E2SM_MACStats_IndicationMessage_table_t E2SM_MACStats_IndicationMessage_vec_at(E2SM_MACStats_IndicationMessage_vec_t vec, size_t i)
|
||||
__flatbuffers_offset_vec_at(E2SM_MACStats_IndicationMessage_table_t, vec, i, 0)
|
||||
__flatbuffers_table_as_root(E2SM_MACStats_IndicationMessage)
|
||||
|
||||
__flatbuffers_define_scalar_field(0, E2SM_MACStats_IndicationMessage, tx_bytes, flatbuffers_uint32, uint32_t, UINT32_C(0))
|
||||
__flatbuffers_define_scalar_field(1, E2SM_MACStats_IndicationMessage, tx_pkts, flatbuffers_uint32, uint32_t, UINT32_C(0))
|
||||
|
||||
struct E2SM_MACStats_ControlHeaderFormat1_table { uint8_t unused__; };
|
||||
|
||||
static inline size_t E2SM_MACStats_ControlHeaderFormat1_vec_len(E2SM_MACStats_ControlHeaderFormat1_vec_t vec)
|
||||
__flatbuffers_vec_len(vec)
|
||||
static inline E2SM_MACStats_ControlHeaderFormat1_table_t E2SM_MACStats_ControlHeaderFormat1_vec_at(E2SM_MACStats_ControlHeaderFormat1_vec_t vec, size_t i)
|
||||
__flatbuffers_offset_vec_at(E2SM_MACStats_ControlHeaderFormat1_table_t, vec, i, 0)
|
||||
__flatbuffers_table_as_root(E2SM_MACStats_ControlHeaderFormat1)
|
||||
|
||||
__flatbuffers_define_scalar_field(0, E2SM_MACStats_ControlHeaderFormat1, param, flatbuffers_uint32, uint32_t, UINT32_C(0))
|
||||
typedef uint8_t E2SM_MACStats_ControlHeaderUnion_union_type_t;
|
||||
__flatbuffers_define_integer_type(E2SM_MACStats_ControlHeaderUnion, E2SM_MACStats_ControlHeaderUnion_union_type_t, 8)
|
||||
__flatbuffers_define_union(flatbuffers_, E2SM_MACStats_ControlHeaderUnion)
|
||||
#define E2SM_MACStats_ControlHeaderUnion_NONE ((E2SM_MACStats_ControlHeaderUnion_union_type_t)UINT8_C(0))
|
||||
#define E2SM_MACStats_ControlHeaderUnion_ctrlHeaderF1 ((E2SM_MACStats_ControlHeaderUnion_union_type_t)UINT8_C(1))
|
||||
|
||||
static inline const char *E2SM_MACStats_ControlHeaderUnion_type_name(E2SM_MACStats_ControlHeaderUnion_union_type_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case E2SM_MACStats_ControlHeaderUnion_NONE: return "NONE";
|
||||
case E2SM_MACStats_ControlHeaderUnion_ctrlHeaderF1: return "ctrlHeaderF1";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlHeaderUnion_is_known_type(E2SM_MACStats_ControlHeaderUnion_union_type_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case E2SM_MACStats_ControlHeaderUnion_NONE: return 1;
|
||||
case E2SM_MACStats_ControlHeaderUnion_ctrlHeaderF1: return 1;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct E2SM_MACStats_ControlHeader_table { uint8_t unused__; };
|
||||
|
||||
static inline size_t E2SM_MACStats_ControlHeader_vec_len(E2SM_MACStats_ControlHeader_vec_t vec)
|
||||
__flatbuffers_vec_len(vec)
|
||||
static inline E2SM_MACStats_ControlHeader_table_t E2SM_MACStats_ControlHeader_vec_at(E2SM_MACStats_ControlHeader_vec_t vec, size_t i)
|
||||
__flatbuffers_offset_vec_at(E2SM_MACStats_ControlHeader_table_t, vec, i, 0)
|
||||
__flatbuffers_table_as_root(E2SM_MACStats_ControlHeader)
|
||||
|
||||
__flatbuffers_define_union_field(flatbuffers_, 1, E2SM_MACStats_ControlHeader, hdr, E2SM_MACStats_ControlHeaderUnion, 0)
|
||||
|
||||
struct E2SM_MACStats_ControlMessageFormat1_table { uint8_t unused__; };
|
||||
|
||||
static inline size_t E2SM_MACStats_ControlMessageFormat1_vec_len(E2SM_MACStats_ControlMessageFormat1_vec_t vec)
|
||||
__flatbuffers_vec_len(vec)
|
||||
static inline E2SM_MACStats_ControlMessageFormat1_table_t E2SM_MACStats_ControlMessageFormat1_vec_at(E2SM_MACStats_ControlMessageFormat1_vec_t vec, size_t i)
|
||||
__flatbuffers_offset_vec_at(E2SM_MACStats_ControlMessageFormat1_table_t, vec, i, 0)
|
||||
__flatbuffers_table_as_root(E2SM_MACStats_ControlMessageFormat1)
|
||||
|
||||
__flatbuffers_define_vector_field(0, E2SM_MACStats_ControlMessageFormat1, param, flatbuffers_uint8_vec_t, 0)
|
||||
typedef uint8_t E2SM_MACStats_ControlMessageUnion_union_type_t;
|
||||
__flatbuffers_define_integer_type(E2SM_MACStats_ControlMessageUnion, E2SM_MACStats_ControlMessageUnion_union_type_t, 8)
|
||||
__flatbuffers_define_union(flatbuffers_, E2SM_MACStats_ControlMessageUnion)
|
||||
#define E2SM_MACStats_ControlMessageUnion_NONE ((E2SM_MACStats_ControlMessageUnion_union_type_t)UINT8_C(0))
|
||||
#define E2SM_MACStats_ControlMessageUnion_ctrlMessageF1 ((E2SM_MACStats_ControlMessageUnion_union_type_t)UINT8_C(1))
|
||||
|
||||
static inline const char *E2SM_MACStats_ControlMessageUnion_type_name(E2SM_MACStats_ControlMessageUnion_union_type_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case E2SM_MACStats_ControlMessageUnion_NONE: return "NONE";
|
||||
case E2SM_MACStats_ControlMessageUnion_ctrlMessageF1: return "ctrlMessageF1";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlMessageUnion_is_known_type(E2SM_MACStats_ControlMessageUnion_union_type_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case E2SM_MACStats_ControlMessageUnion_NONE: return 1;
|
||||
case E2SM_MACStats_ControlMessageUnion_ctrlMessageF1: return 1;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct E2SM_MACStats_ControlMessage_table { uint8_t unused__; };
|
||||
|
||||
static inline size_t E2SM_MACStats_ControlMessage_vec_len(E2SM_MACStats_ControlMessage_vec_t vec)
|
||||
__flatbuffers_vec_len(vec)
|
||||
static inline E2SM_MACStats_ControlMessage_table_t E2SM_MACStats_ControlMessage_vec_at(E2SM_MACStats_ControlMessage_vec_t vec, size_t i)
|
||||
__flatbuffers_offset_vec_at(E2SM_MACStats_ControlMessage_table_t, vec, i, 0)
|
||||
__flatbuffers_table_as_root(E2SM_MACStats_ControlMessage)
|
||||
|
||||
__flatbuffers_define_union_field(flatbuffers_, 1, E2SM_MACStats_ControlMessage, msg, E2SM_MACStats_ControlMessageUnion, 0)
|
||||
|
||||
|
||||
#include "flatcc/flatcc_epilogue.h"
|
||||
#endif /* E2SM_MAC_STATS_V00_READER_H */
|
||||
386
executables/mac_sm/ie/fb/e2sm_mac_stats_v00_verifier.h
Normal file
386
executables/mac_sm/ie/fb/e2sm_mac_stats_v00_verifier.h
Normal file
@@ -0,0 +1,386 @@
|
||||
#ifndef E2SM_MAC_STATS_V00_VERIFIER_H
|
||||
#define E2SM_MAC_STATS_V00_VERIFIER_H
|
||||
|
||||
/* Generated by flatcc 0.6.1-dev FlatBuffers schema compiler for C by dvide.com */
|
||||
|
||||
#ifndef E2SM_MAC_STATS_V00_READER_H
|
||||
#include "e2sm_mac_stats_v00_reader.h"
|
||||
#endif
|
||||
#include "flatcc/flatcc_verifier.h"
|
||||
#include "flatcc/flatcc_prologue.h"
|
||||
|
||||
static int E2SM_MACStats_EventTriggerDefinitionFormat1_verify_table(flatcc_table_verifier_descriptor_t *td);
|
||||
static int E2SM_MACStats_EventTrigger_verify_table(flatcc_table_verifier_descriptor_t *td);
|
||||
static int E2SM_MACStats_RanParameterItem_verify_table(flatcc_table_verifier_descriptor_t *td);
|
||||
static int E2SM_MACStats_ActionDefinitionFormat1_verify_table(flatcc_table_verifier_descriptor_t *td);
|
||||
static int E2SM_MACStats_ActionDefinition_verify_table(flatcc_table_verifier_descriptor_t *td);
|
||||
static int E2SM_MACStats_IndicationHeaderFormat1_verify_table(flatcc_table_verifier_descriptor_t *td);
|
||||
static int E2SM_MACStats_IndicationHeader_verify_table(flatcc_table_verifier_descriptor_t *td);
|
||||
static int E2SM_MACStats_IndicationMessage_verify_table(flatcc_table_verifier_descriptor_t *td);
|
||||
static int E2SM_MACStats_ControlHeaderFormat1_verify_table(flatcc_table_verifier_descriptor_t *td);
|
||||
static int E2SM_MACStats_ControlHeader_verify_table(flatcc_table_verifier_descriptor_t *td);
|
||||
static int E2SM_MACStats_ControlMessageFormat1_verify_table(flatcc_table_verifier_descriptor_t *td);
|
||||
static int E2SM_MACStats_ControlMessage_verify_table(flatcc_table_verifier_descriptor_t *td);
|
||||
|
||||
static int E2SM_MACStats_ActionDefinitionUnion_union_verifier(flatcc_union_verifier_descriptor_t *ud)
|
||||
{
|
||||
switch (ud->type) {
|
||||
case 1: return flatcc_verify_union_table(ud, E2SM_MACStats_ActionDefinitionFormat1_verify_table); /* actionDefF1 */
|
||||
default: return flatcc_verify_ok;
|
||||
}
|
||||
}
|
||||
|
||||
static int E2SM_MACStats_IndicationHeaderUnion_union_verifier(flatcc_union_verifier_descriptor_t *ud)
|
||||
{
|
||||
switch (ud->type) {
|
||||
case 1: return flatcc_verify_union_table(ud, E2SM_MACStats_IndicationHeaderFormat1_verify_table); /* indHeaderF1 */
|
||||
default: return flatcc_verify_ok;
|
||||
}
|
||||
}
|
||||
|
||||
static int E2SM_MACStats_ControlHeaderUnion_union_verifier(flatcc_union_verifier_descriptor_t *ud)
|
||||
{
|
||||
switch (ud->type) {
|
||||
case 1: return flatcc_verify_union_table(ud, E2SM_MACStats_ControlHeaderFormat1_verify_table); /* ctrlHeaderF1 */
|
||||
default: return flatcc_verify_ok;
|
||||
}
|
||||
}
|
||||
|
||||
static int E2SM_MACStats_ControlMessageUnion_union_verifier(flatcc_union_verifier_descriptor_t *ud)
|
||||
{
|
||||
switch (ud->type) {
|
||||
case 1: return flatcc_verify_union_table(ud, E2SM_MACStats_ControlMessageFormat1_verify_table); /* ctrlMessageF1 */
|
||||
default: return flatcc_verify_ok;
|
||||
}
|
||||
}
|
||||
|
||||
static int E2SM_MACStats_EventTriggerDefinitionFormat1_verify_table(flatcc_table_verifier_descriptor_t *td)
|
||||
{
|
||||
int ret;
|
||||
if ((ret = flatcc_verify_field(td, 0, 1, 1) /* triggerNature */)) return ret;
|
||||
return flatcc_verify_ok;
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_EventTriggerDefinitionFormat1_verify_as_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_EventTriggerDefinitionFormat1_identifier, &E2SM_MACStats_EventTriggerDefinitionFormat1_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_EventTriggerDefinitionFormat1_verify_as_typed_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_EventTriggerDefinitionFormat1_type_identifier, &E2SM_MACStats_EventTriggerDefinitionFormat1_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_EventTriggerDefinitionFormat1_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, fid, &E2SM_MACStats_EventTriggerDefinitionFormat1_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_EventTriggerDefinitionFormat1_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
|
||||
{
|
||||
return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &E2SM_MACStats_EventTriggerDefinitionFormat1_verify_table);
|
||||
}
|
||||
|
||||
static int E2SM_MACStats_EventTrigger_verify_table(flatcc_table_verifier_descriptor_t *td)
|
||||
{
|
||||
int ret;
|
||||
if ((ret = flatcc_verify_field(td, 0, 1, 1) /* trig */)) return ret;
|
||||
return flatcc_verify_ok;
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_EventTrigger_verify_as_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_EventTrigger_identifier, &E2SM_MACStats_EventTrigger_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_EventTrigger_verify_as_typed_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_EventTrigger_type_identifier, &E2SM_MACStats_EventTrigger_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_EventTrigger_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, fid, &E2SM_MACStats_EventTrigger_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_EventTrigger_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
|
||||
{
|
||||
return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &E2SM_MACStats_EventTrigger_verify_table);
|
||||
}
|
||||
|
||||
static int E2SM_MACStats_RanParameterItem_verify_table(flatcc_table_verifier_descriptor_t *td)
|
||||
{
|
||||
int ret;
|
||||
if ((ret = flatcc_verify_field(td, 0, 4, 4) /* id */)) return ret;
|
||||
if ((ret = flatcc_verify_string_field(td, 1, 0) /* name */)) return ret;
|
||||
if ((ret = flatcc_verify_field(td, 2, 1, 1) /* test */)) return ret;
|
||||
if ((ret = flatcc_verify_string_field(td, 3, 0) /* value */)) return ret;
|
||||
return flatcc_verify_ok;
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_RanParameterItem_verify_as_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_RanParameterItem_identifier, &E2SM_MACStats_RanParameterItem_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_RanParameterItem_verify_as_typed_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_RanParameterItem_type_identifier, &E2SM_MACStats_RanParameterItem_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_RanParameterItem_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, fid, &E2SM_MACStats_RanParameterItem_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_RanParameterItem_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
|
||||
{
|
||||
return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &E2SM_MACStats_RanParameterItem_verify_table);
|
||||
}
|
||||
|
||||
static int E2SM_MACStats_ActionDefinitionFormat1_verify_table(flatcc_table_verifier_descriptor_t *td)
|
||||
{
|
||||
int ret;
|
||||
if ((ret = flatcc_verify_table_vector_field(td, 0, 0, &E2SM_MACStats_RanParameterItem_verify_table) /* ranParameterList */)) return ret;
|
||||
return flatcc_verify_ok;
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ActionDefinitionFormat1_verify_as_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_ActionDefinitionFormat1_identifier, &E2SM_MACStats_ActionDefinitionFormat1_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ActionDefinitionFormat1_verify_as_typed_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_ActionDefinitionFormat1_type_identifier, &E2SM_MACStats_ActionDefinitionFormat1_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ActionDefinitionFormat1_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, fid, &E2SM_MACStats_ActionDefinitionFormat1_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ActionDefinitionFormat1_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
|
||||
{
|
||||
return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &E2SM_MACStats_ActionDefinitionFormat1_verify_table);
|
||||
}
|
||||
|
||||
static int E2SM_MACStats_ActionDefinition_verify_table(flatcc_table_verifier_descriptor_t *td)
|
||||
{
|
||||
int ret;
|
||||
if ((ret = flatcc_verify_union_field(td, 1, 0, &E2SM_MACStats_ActionDefinitionUnion_union_verifier) /* def */)) return ret;
|
||||
return flatcc_verify_ok;
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ActionDefinition_verify_as_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_ActionDefinition_identifier, &E2SM_MACStats_ActionDefinition_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ActionDefinition_verify_as_typed_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_ActionDefinition_type_identifier, &E2SM_MACStats_ActionDefinition_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ActionDefinition_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, fid, &E2SM_MACStats_ActionDefinition_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ActionDefinition_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
|
||||
{
|
||||
return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &E2SM_MACStats_ActionDefinition_verify_table);
|
||||
}
|
||||
|
||||
static int E2SM_MACStats_IndicationHeaderFormat1_verify_table(flatcc_table_verifier_descriptor_t *td)
|
||||
{
|
||||
int ret;
|
||||
if ((ret = flatcc_verify_field(td, 0, 4, 4) /* param */)) return ret;
|
||||
return flatcc_verify_ok;
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_IndicationHeaderFormat1_verify_as_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_IndicationHeaderFormat1_identifier, &E2SM_MACStats_IndicationHeaderFormat1_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_IndicationHeaderFormat1_verify_as_typed_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_IndicationHeaderFormat1_type_identifier, &E2SM_MACStats_IndicationHeaderFormat1_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_IndicationHeaderFormat1_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, fid, &E2SM_MACStats_IndicationHeaderFormat1_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_IndicationHeaderFormat1_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
|
||||
{
|
||||
return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &E2SM_MACStats_IndicationHeaderFormat1_verify_table);
|
||||
}
|
||||
|
||||
static int E2SM_MACStats_IndicationHeader_verify_table(flatcc_table_verifier_descriptor_t *td)
|
||||
{
|
||||
int ret;
|
||||
if ((ret = flatcc_verify_union_field(td, 1, 0, &E2SM_MACStats_IndicationHeaderUnion_union_verifier) /* hdr */)) return ret;
|
||||
return flatcc_verify_ok;
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_IndicationHeader_verify_as_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_IndicationHeader_identifier, &E2SM_MACStats_IndicationHeader_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_IndicationHeader_verify_as_typed_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_IndicationHeader_type_identifier, &E2SM_MACStats_IndicationHeader_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_IndicationHeader_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, fid, &E2SM_MACStats_IndicationHeader_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_IndicationHeader_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
|
||||
{
|
||||
return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &E2SM_MACStats_IndicationHeader_verify_table);
|
||||
}
|
||||
|
||||
static int E2SM_MACStats_IndicationMessage_verify_table(flatcc_table_verifier_descriptor_t *td)
|
||||
{
|
||||
int ret;
|
||||
if ((ret = flatcc_verify_field(td, 0, 4, 4) /* tx_bytes */)) return ret;
|
||||
if ((ret = flatcc_verify_field(td, 1, 4, 4) /* tx_pkts */)) return ret;
|
||||
return flatcc_verify_ok;
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_IndicationMessage_verify_as_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_IndicationMessage_identifier, &E2SM_MACStats_IndicationMessage_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_IndicationMessage_verify_as_typed_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_IndicationMessage_type_identifier, &E2SM_MACStats_IndicationMessage_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_IndicationMessage_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, fid, &E2SM_MACStats_IndicationMessage_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_IndicationMessage_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
|
||||
{
|
||||
return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &E2SM_MACStats_IndicationMessage_verify_table);
|
||||
}
|
||||
|
||||
static int E2SM_MACStats_ControlHeaderFormat1_verify_table(flatcc_table_verifier_descriptor_t *td)
|
||||
{
|
||||
int ret;
|
||||
if ((ret = flatcc_verify_field(td, 0, 4, 4) /* param */)) return ret;
|
||||
return flatcc_verify_ok;
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlHeaderFormat1_verify_as_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_ControlHeaderFormat1_identifier, &E2SM_MACStats_ControlHeaderFormat1_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlHeaderFormat1_verify_as_typed_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_ControlHeaderFormat1_type_identifier, &E2SM_MACStats_ControlHeaderFormat1_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlHeaderFormat1_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, fid, &E2SM_MACStats_ControlHeaderFormat1_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlHeaderFormat1_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
|
||||
{
|
||||
return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &E2SM_MACStats_ControlHeaderFormat1_verify_table);
|
||||
}
|
||||
|
||||
static int E2SM_MACStats_ControlHeader_verify_table(flatcc_table_verifier_descriptor_t *td)
|
||||
{
|
||||
int ret;
|
||||
if ((ret = flatcc_verify_union_field(td, 1, 0, &E2SM_MACStats_ControlHeaderUnion_union_verifier) /* hdr */)) return ret;
|
||||
return flatcc_verify_ok;
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlHeader_verify_as_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_ControlHeader_identifier, &E2SM_MACStats_ControlHeader_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlHeader_verify_as_typed_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_ControlHeader_type_identifier, &E2SM_MACStats_ControlHeader_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlHeader_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, fid, &E2SM_MACStats_ControlHeader_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlHeader_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
|
||||
{
|
||||
return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &E2SM_MACStats_ControlHeader_verify_table);
|
||||
}
|
||||
|
||||
static int E2SM_MACStats_ControlMessageFormat1_verify_table(flatcc_table_verifier_descriptor_t *td)
|
||||
{
|
||||
int ret;
|
||||
if ((ret = flatcc_verify_vector_field(td, 0, 0, 1, 1, INT64_C(4294967295)) /* param */)) return ret;
|
||||
return flatcc_verify_ok;
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlMessageFormat1_verify_as_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_ControlMessageFormat1_identifier, &E2SM_MACStats_ControlMessageFormat1_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlMessageFormat1_verify_as_typed_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_ControlMessageFormat1_type_identifier, &E2SM_MACStats_ControlMessageFormat1_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlMessageFormat1_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, fid, &E2SM_MACStats_ControlMessageFormat1_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlMessageFormat1_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
|
||||
{
|
||||
return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &E2SM_MACStats_ControlMessageFormat1_verify_table);
|
||||
}
|
||||
|
||||
static int E2SM_MACStats_ControlMessage_verify_table(flatcc_table_verifier_descriptor_t *td)
|
||||
{
|
||||
int ret;
|
||||
if ((ret = flatcc_verify_union_field(td, 1, 0, &E2SM_MACStats_ControlMessageUnion_union_verifier) /* msg */)) return ret;
|
||||
return flatcc_verify_ok;
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlMessage_verify_as_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_ControlMessage_identifier, &E2SM_MACStats_ControlMessage_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlMessage_verify_as_typed_root(const void *buf, size_t bufsiz)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, E2SM_MACStats_ControlMessage_type_identifier, &E2SM_MACStats_ControlMessage_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlMessage_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
|
||||
{
|
||||
return flatcc_verify_table_as_root(buf, bufsiz, fid, &E2SM_MACStats_ControlMessage_verify_table);
|
||||
}
|
||||
|
||||
static inline int E2SM_MACStats_ControlMessage_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
|
||||
{
|
||||
return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &E2SM_MACStats_ControlMessage_verify_table);
|
||||
}
|
||||
|
||||
#include "flatcc/flatcc_epilogue.h"
|
||||
#endif /* E2SM_MAC_STATS_V00_VERIFIER_H */
|
||||
685
executables/mac_sm/ie/fb/flatbuffers_common_builder.h
Normal file
685
executables/mac_sm/ie/fb/flatbuffers_common_builder.h
Normal file
@@ -0,0 +1,685 @@
|
||||
#ifndef FLATBUFFERS_COMMON_BUILDER_H
|
||||
#define FLATBUFFERS_COMMON_BUILDER_H
|
||||
|
||||
/* Generated by flatcc 0.6.1-dev FlatBuffers schema compiler for C by dvide.com */
|
||||
|
||||
/* Common FlatBuffers build functionality for C. */
|
||||
|
||||
#include "flatcc/flatcc_prologue.h"
|
||||
#ifndef FLATBUILDER_H
|
||||
#include "flatcc/flatcc_builder.h"
|
||||
#endif
|
||||
typedef flatcc_builder_t flatbuffers_builder_t;
|
||||
typedef flatcc_builder_ref_t flatbuffers_ref_t;
|
||||
typedef flatcc_builder_ref_t flatbuffers_vec_ref_t;
|
||||
typedef flatcc_builder_union_ref_t flatbuffers_union_ref_t;
|
||||
typedef flatcc_builder_union_vec_ref_t flatbuffers_union_vec_ref_t;
|
||||
/* integer return code (ref and ptr always fail on 0) */
|
||||
#define flatbuffers_failed(x) ((x) < 0)
|
||||
typedef flatbuffers_ref_t flatbuffers_root_t;
|
||||
#define flatbuffers_root(ref) ((flatbuffers_root_t)(ref))
|
||||
|
||||
#define __flatbuffers_memoize_begin(B, src)\
|
||||
do { flatcc_builder_ref_t _ref; if ((_ref = flatcc_builder_refmap_find((B), (src)))) return _ref; } while (0)
|
||||
#define __flatbuffers_memoize_end(B, src, op) do { return flatcc_builder_refmap_insert((B), (src), (op)); } while (0)
|
||||
#define __flatbuffers_memoize(B, src, op) do { __flatbuffers_memoize_begin(B, src); __flatbuffers_memoize_end(B, src, op); } while (0)
|
||||
|
||||
#define __flatbuffers_build_buffer(NS)\
|
||||
typedef NS ## ref_t NS ## buffer_ref_t;\
|
||||
static inline int NS ## buffer_start(NS ## builder_t *B, const NS ##fid_t fid)\
|
||||
{ return flatcc_builder_start_buffer(B, fid, 0, 0); }\
|
||||
static inline int NS ## buffer_start_with_size(NS ## builder_t *B, const NS ##fid_t fid)\
|
||||
{ return flatcc_builder_start_buffer(B, fid, 0, flatcc_builder_with_size); }\
|
||||
static inline int NS ## buffer_start_aligned(NS ## builder_t *B, NS ##fid_t fid, uint16_t block_align)\
|
||||
{ return flatcc_builder_start_buffer(B, fid, block_align, 0); }\
|
||||
static inline int NS ## buffer_start_aligned_with_size(NS ## builder_t *B, NS ##fid_t fid, uint16_t block_align)\
|
||||
{ return flatcc_builder_start_buffer(B, fid, block_align, flatcc_builder_with_size); }\
|
||||
static inline NS ## buffer_ref_t NS ## buffer_end(NS ## builder_t *B, NS ## ref_t root)\
|
||||
{ return flatcc_builder_end_buffer(B, root); }
|
||||
|
||||
#define __flatbuffers_build_table_root(NS, N, FID, TFID)\
|
||||
static inline int N ## _start_as_root(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_start(B, FID) ? -1 : N ## _start(B); }\
|
||||
static inline int N ## _start_as_root_with_size(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_start_with_size(B, FID) ? -1 : N ## _start(B); }\
|
||||
static inline int N ## _start_as_typed_root(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_start(B, TFID) ? -1 : N ## _start(B); }\
|
||||
static inline int N ## _start_as_typed_root_with_size(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_start_with_size(B, TFID) ? -1 : N ## _start(B); }\
|
||||
static inline NS ## buffer_ref_t N ## _end_as_root(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_end(B, N ## _end(B)); }\
|
||||
static inline NS ## buffer_ref_t N ## _end_as_typed_root(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_end(B, N ## _end(B)); }\
|
||||
static inline NS ## buffer_ref_t N ## _create_as_root(NS ## builder_t *B __ ## N ## _formal_args)\
|
||||
{ if (NS ## buffer_start(B, FID)) return 0; return NS ## buffer_end(B, N ## _create(B __ ## N ## _call_args)); }\
|
||||
static inline NS ## buffer_ref_t N ## _create_as_root_with_size(NS ## builder_t *B __ ## N ## _formal_args)\
|
||||
{ if (NS ## buffer_start_with_size(B, FID)) return 0; return NS ## buffer_end(B, N ## _create(B __ ## N ## _call_args)); }\
|
||||
static inline NS ## buffer_ref_t N ## _create_as_typed_root(NS ## builder_t *B __ ## N ## _formal_args)\
|
||||
{ if (NS ## buffer_start(B, TFID)) return 0; return NS ## buffer_end(B, N ## _create(B __ ## N ## _call_args)); }\
|
||||
static inline NS ## buffer_ref_t N ## _create_as_typed_root_with_size(NS ## builder_t *B __ ## N ## _formal_args)\
|
||||
{ if (NS ## buffer_start_with_size(B, TFID)) return 0; return NS ## buffer_end(B, N ## _create(B __ ## N ## _call_args)); }\
|
||||
static inline NS ## buffer_ref_t N ## _clone_as_root(NS ## builder_t *B, N ## _table_t t)\
|
||||
{ if (NS ## buffer_start(B, FID)) return 0; return NS ## buffer_end(B, N ## _clone(B, t)); }\
|
||||
static inline NS ## buffer_ref_t N ## _clone_as_root_with_size(NS ## builder_t *B, N ## _table_t t)\
|
||||
{ if (NS ## buffer_start_with_size(B, FID)) return 0; return NS ## buffer_end(B, N ## _clone(B, t)); }\
|
||||
static inline NS ## buffer_ref_t N ## _clone_as_typed_root(NS ## builder_t *B, N ## _table_t t)\
|
||||
{ if (NS ## buffer_start(B, TFID)) return 0;return NS ## buffer_end(B, N ## _clone(B, t)); }\
|
||||
static inline NS ## buffer_ref_t N ## _clone_as_typed_root_with_size(NS ## builder_t *B, N ## _table_t t)\
|
||||
{ if (NS ## buffer_start_with_size(B, TFID)) return 0; return NS ## buffer_end(B, N ## _clone(B, t)); }
|
||||
|
||||
#define __flatbuffers_build_table_prolog(NS, N, FID, TFID)\
|
||||
__flatbuffers_build_table_vector_ops(NS, N ## _vec, N)\
|
||||
__flatbuffers_build_table_root(NS, N, FID, TFID)
|
||||
|
||||
#define __flatbuffers_build_struct_root(NS, N, A, FID, TFID)\
|
||||
static inline N ## _t *N ## _start_as_root(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_start(B, FID) ? 0 : N ## _start(B); }\
|
||||
static inline N ## _t *N ## _start_as_root_with_size(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_start_with_size(B, FID) ? 0 : N ## _start(B); }\
|
||||
static inline N ## _t *N ## _start_as_typed_root(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_start(B, TFID) ? 0 : N ## _start(B); }\
|
||||
static inline N ## _t *N ## _start_as_typed_root_with_size(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_start_with_size(B, TFID) ? 0 : N ## _start(B); }\
|
||||
static inline NS ## buffer_ref_t N ## _end_as_root(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_end(B, N ## _end(B)); }\
|
||||
static inline NS ## buffer_ref_t N ## _end_as_typed_root(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_end(B, N ## _end(B)); }\
|
||||
static inline NS ## buffer_ref_t N ## _end_pe_as_root(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_end(B, N ## _end_pe(B)); }\
|
||||
static inline NS ## buffer_ref_t N ## _end_pe_as_typed_root(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_end(B, N ## _end_pe(B)); }\
|
||||
static inline NS ## buffer_ref_t N ## _create_as_root(NS ## builder_t *B __ ## N ## _formal_args)\
|
||||
{ return flatcc_builder_create_buffer(B, FID, 0,\
|
||||
N ## _create(B __ ## N ## _call_args), A, 0); }\
|
||||
static inline NS ## buffer_ref_t N ## _create_as_root_with_size(NS ## builder_t *B __ ## N ## _formal_args)\
|
||||
{ return flatcc_builder_create_buffer(B, FID, 0,\
|
||||
N ## _create(B __ ## N ## _call_args), A, flatcc_builder_with_size); }\
|
||||
static inline NS ## buffer_ref_t N ## _create_as_typed_root(NS ## builder_t *B __ ## N ## _formal_args)\
|
||||
{ return flatcc_builder_create_buffer(B, TFID, 0,\
|
||||
N ## _create(B __ ## N ## _call_args), A, 0); }\
|
||||
static inline NS ## buffer_ref_t N ## _create_as_typed_root_with_size(NS ## builder_t *B __ ## N ## _formal_args)\
|
||||
{ return flatcc_builder_create_buffer(B, TFID, 0,\
|
||||
N ## _create(B __ ## N ## _call_args), A, flatcc_builder_with_size); }\
|
||||
static inline NS ## buffer_ref_t N ## _clone_as_root(NS ## builder_t *B, N ## _struct_t p)\
|
||||
{ return flatcc_builder_create_buffer(B, FID, 0, N ## _clone(B, p), A, 0); }\
|
||||
static inline NS ## buffer_ref_t N ## _clone_as_root_with_size(NS ## builder_t *B, N ## _struct_t p)\
|
||||
{ return flatcc_builder_create_buffer(B, FID, 0, N ## _clone(B, p), A, flatcc_builder_with_size); }\
|
||||
static inline NS ## buffer_ref_t N ## _clone_as_typed_root(NS ## builder_t *B, N ## _struct_t p)\
|
||||
{ return flatcc_builder_create_buffer(B, TFID, 0, N ## _clone(B, p), A, 0); }\
|
||||
static inline NS ## buffer_ref_t N ## _clone_as_typed_root_with_size(NS ## builder_t *B, N ## _struct_t p)\
|
||||
{ return flatcc_builder_create_buffer(B, TFID, 0, N ## _clone(B, p), A, flatcc_builder_with_size); }
|
||||
|
||||
#define __flatbuffers_build_nested_table_root(NS, N, TN, FID, TFID)\
|
||||
static inline int N ## _start_as_root(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_start(B, FID) ? -1 : TN ## _start(B); }\
|
||||
static inline int N ## _start_as_typed_root(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_start(B, TFID) ? -1 : TN ## _start(B); }\
|
||||
static inline int N ## _end_as_root(NS ## builder_t *B)\
|
||||
{ return N ## _add(B, NS ## buffer_end(B, TN ## _end(B))); }\
|
||||
static inline int N ## _end_as_typed_root(NS ## builder_t *B)\
|
||||
{ return N ## _add(B, NS ## buffer_end(B, TN ## _end(B))); }\
|
||||
static inline int N ## _nest(NS ## builder_t *B, void *data, size_t size, uint16_t align)\
|
||||
{ return N ## _add(B, flatcc_builder_create_vector(B, data, size, 1,\
|
||||
align ? align : 8, FLATBUFFERS_COUNT_MAX(1))); }\
|
||||
static inline int N ## _typed_nest(NS ## builder_t *B, void *data, size_t size, uint16_t align)\
|
||||
{ return N ## _add(B, flatcc_builder_create_vector(B, data, size, 1,\
|
||||
align ? align : 8, FLATBUFFERS_COUNT_MAX(1))); }\
|
||||
static inline int N ## _clone_as_root(NS ## builder_t *B, TN ## _table_t t)\
|
||||
{ return N ## _add(B, TN ## _clone_as_root(B, t)); }\
|
||||
static inline int N ## _clone_as_typed_root(NS ## builder_t *B, TN ## _table_t t)\
|
||||
{ return N ## _add(B, TN ## _clone_as_typed_root(B, t)); }
|
||||
|
||||
#define __flatbuffers_build_nested_struct_root(NS, N, TN, A, FID, TFID)\
|
||||
static inline TN ## _t *N ## _start_as_root(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_start(B, FID) ? 0 : TN ## _start(B); }\
|
||||
static inline TN ## _t *N ## _start_as_typed_root(NS ## builder_t *B)\
|
||||
{ return NS ## buffer_start(B, FID) ? 0 : TN ## _start(B); }\
|
||||
static inline int N ## _end_as_root(NS ## builder_t *B)\
|
||||
{ return N ## _add(B, NS ## buffer_end(B, TN ## _end(B))); }\
|
||||
static inline int N ## _end_as_typed_root(NS ## builder_t *B)\
|
||||
{ return N ## _add(B, NS ## buffer_end(B, TN ## _end(B))); }\
|
||||
static inline int N ## _end_pe_as_root(NS ## builder_t *B)\
|
||||
{ return N ## _add(B, NS ## buffer_end(B, TN ## _end_pe(B))); }\
|
||||
static inline int N ## _create_as_root(NS ## builder_t *B __ ## TN ## _formal_args)\
|
||||
{ return N ## _add(B, flatcc_builder_create_buffer(B, FID, 0,\
|
||||
TN ## _create(B __ ## TN ## _call_args), A, flatcc_builder_is_nested)); }\
|
||||
static inline int N ## _create_as_typed_root(NS ## builder_t *B __ ## TN ## _formal_args)\
|
||||
{ return N ## _add(B, flatcc_builder_create_buffer(B, TFID, 0,\
|
||||
TN ## _create(B __ ## TN ## _call_args), A, flatcc_builder_is_nested)); }\
|
||||
static inline int N ## _nest(NS ## builder_t *B, void *data, size_t size, uint16_t align)\
|
||||
{ return N ## _add(B, flatcc_builder_create_vector(B, data, size, 1,\
|
||||
align < A ? A : align, FLATBUFFERS_COUNT_MAX(1))); }\
|
||||
static inline int N ## _typed_nest(NS ## builder_t *B, void *data, size_t size, uint16_t align)\
|
||||
{ return N ## _add(B, flatcc_builder_create_vector(B, data, size, 1,\
|
||||
align < A ? A : align, FLATBUFFERS_COUNT_MAX(1))); }\
|
||||
static inline int N ## _clone_as_root(NS ## builder_t *B, TN ## _struct_t p)\
|
||||
{ return N ## _add(B, TN ## _clone_as_root(B, p)); }\
|
||||
static inline int N ## _clone_as_typed_root(NS ## builder_t *B, TN ## _struct_t p)\
|
||||
{ return N ## _add(B, TN ## _clone_as_typed_root(B, p)); }
|
||||
|
||||
#define __flatbuffers_build_vector_ops(NS, V, N, TN, T)\
|
||||
static inline T *V ## _extend(NS ## builder_t *B, size_t len)\
|
||||
{ return (T *)flatcc_builder_extend_vector(B, len); }\
|
||||
static inline T *V ## _append(NS ## builder_t *B, const T *data, size_t len)\
|
||||
{ return (T *)flatcc_builder_append_vector(B, data, len); }\
|
||||
static inline int V ## _truncate(NS ## builder_t *B, size_t len)\
|
||||
{ return flatcc_builder_truncate_vector(B, len); }\
|
||||
static inline T *V ## _edit(NS ## builder_t *B)\
|
||||
{ return (T *)flatcc_builder_vector_edit(B); }\
|
||||
static inline size_t V ## _reserved_len(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_vector_count(B); }\
|
||||
static inline T *V ## _push(NS ## builder_t *B, const T *p)\
|
||||
{ T *_p; return (_p = (T *)flatcc_builder_extend_vector(B, 1)) ? (memcpy(_p, p, TN ## __size()), _p) : 0; }\
|
||||
static inline T *V ## _push_copy(NS ## builder_t *B, const T *p)\
|
||||
{ T *_p; return (_p = (T *)flatcc_builder_extend_vector(B, 1)) ? TN ## _copy(_p, p) : 0; }\
|
||||
static inline T *V ## _push_clone(NS ## builder_t *B, const T *p)\
|
||||
{ T *_p; return (_p = (T *)flatcc_builder_extend_vector(B, 1)) ? TN ## _copy(_p, p) : 0; }\
|
||||
static inline T *V ## _push_create(NS ## builder_t *B __ ## TN ## _formal_args)\
|
||||
{ T *_p; return (_p = (T *)flatcc_builder_extend_vector(B, 1)) ? TN ## _assign(_p __ ## TN ## _call_args) : 0; }
|
||||
|
||||
#define __flatbuffers_build_vector(NS, N, T, S, A)\
|
||||
typedef NS ## ref_t N ## _vec_ref_t;\
|
||||
static inline int N ## _vec_start(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_start_vector(B, S, A, FLATBUFFERS_COUNT_MAX(S)); }\
|
||||
static inline N ## _vec_ref_t N ## _vec_end_pe(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_end_vector(B); }\
|
||||
static inline N ## _vec_ref_t N ## _vec_end(NS ## builder_t *B)\
|
||||
{ if (!NS ## is_native_pe()) { size_t i, n; T *p = (T *)flatcc_builder_vector_edit(B);\
|
||||
for (i = 0, n = flatcc_builder_vector_count(B); i < n; ++i)\
|
||||
{ N ## _to_pe(N ## __ptr_add(p, i)); }} return flatcc_builder_end_vector(B); }\
|
||||
static inline N ## _vec_ref_t N ## _vec_create_pe(NS ## builder_t *B, const T *data, size_t len)\
|
||||
{ return flatcc_builder_create_vector(B, data, len, S, A, FLATBUFFERS_COUNT_MAX(S)); }\
|
||||
static inline N ## _vec_ref_t N ## _vec_create(NS ## builder_t *B, const T *data, size_t len)\
|
||||
{ if (!NS ## is_native_pe()) { size_t i; T *p; int ret = flatcc_builder_start_vector(B, S, A, FLATBUFFERS_COUNT_MAX(S)); if (ret) { return ret; }\
|
||||
p = (T *)flatcc_builder_extend_vector(B, len); if (!p) return 0;\
|
||||
for (i = 0; i < len; ++i) { N ## _copy_to_pe(N ## __ptr_add(p, i), N ## __const_ptr_add(data, i)); }\
|
||||
return flatcc_builder_end_vector(B); } else return flatcc_builder_create_vector(B, data, len, S, A, FLATBUFFERS_COUNT_MAX(S)); }\
|
||||
static inline N ## _vec_ref_t N ## _vec_clone(NS ## builder_t *B, N ##_vec_t vec)\
|
||||
{ __flatbuffers_memoize(B, vec, flatcc_builder_create_vector(B, vec, N ## _vec_len(vec), S, A, FLATBUFFERS_COUNT_MAX(S))); }\
|
||||
static inline N ## _vec_ref_t N ## _vec_slice(NS ## builder_t *B, N ##_vec_t vec, size_t index, size_t len)\
|
||||
{ size_t n = N ## _vec_len(vec); if (index >= n) index = n; n -= index; if (len > n) len = n;\
|
||||
return flatcc_builder_create_vector(B, N ## __const_ptr_add(vec, index), len, S, A, FLATBUFFERS_COUNT_MAX(S)); }\
|
||||
__flatbuffers_build_vector_ops(NS, N ## _vec, N, N, T)
|
||||
|
||||
#define __flatbuffers_build_union_vector_ops(NS, V, N, TN)\
|
||||
static inline TN ## _union_ref_t *V ## _extend(NS ## builder_t *B, size_t len)\
|
||||
{ return flatcc_builder_extend_union_vector(B, len); }\
|
||||
static inline TN ## _union_ref_t *V ## _append(NS ## builder_t *B, const TN ## _union_ref_t *data, size_t len)\
|
||||
{ return flatcc_builder_append_union_vector(B, data, len); }\
|
||||
static inline int V ## _truncate(NS ## builder_t *B, size_t len)\
|
||||
{ return flatcc_builder_truncate_union_vector(B, len); }\
|
||||
static inline TN ## _union_ref_t *V ## _edit(NS ## builder_t *B)\
|
||||
{ return (TN ## _union_ref_t *) flatcc_builder_union_vector_edit(B); }\
|
||||
static inline size_t V ## _reserved_len(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_union_vector_count(B); }\
|
||||
static inline TN ## _union_ref_t *V ## _push(NS ## builder_t *B, const TN ## _union_ref_t ref)\
|
||||
{ return flatcc_builder_union_vector_push(B, ref); }\
|
||||
static inline TN ## _union_ref_t *V ## _push_clone(NS ## builder_t *B, TN ## _union_t u)\
|
||||
{ return TN ## _vec_push(B, TN ## _clone(B, u)); }
|
||||
|
||||
#define __flatbuffers_build_union_vector(NS, N)\
|
||||
static inline int N ## _vec_start(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_start_union_vector(B); }\
|
||||
static inline N ## _union_vec_ref_t N ## _vec_end(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_end_union_vector(B); }\
|
||||
static inline N ## _union_vec_ref_t N ## _vec_create(NS ## builder_t *B, const N ## _union_ref_t *data, size_t len)\
|
||||
{ return flatcc_builder_create_union_vector(B, data, len); }\
|
||||
__flatbuffers_build_union_vector_ops(NS, N ## _vec, N, N)\
|
||||
/* Preserves DAG structure separately for type and value vector, so a type vector could be shared for many value vectors. */\
|
||||
static inline N ## _union_vec_ref_t N ## _vec_clone(NS ## builder_t *B, N ##_union_vec_t vec)\
|
||||
{ N ## _union_vec_ref_t _uvref, _ret = { 0, 0 }; NS ## union_ref_t _uref; size_t _i, _len;\
|
||||
if (vec.type == 0) return _ret;\
|
||||
_uvref.type = flatcc_builder_refmap_find(B, vec.type); _uvref.value = flatcc_builder_refmap_find(B, vec.value);\
|
||||
_len = N ## _union_vec_len(vec); if (_uvref.type == 0) {\
|
||||
_uvref.type = flatcc_builder_refmap_insert(B, vec.type, (flatcc_builder_create_type_vector(B, vec.type, _len))); }\
|
||||
if (_uvref.type == 0) return _ret; if (_uvref.value == 0) {\
|
||||
if (flatcc_builder_start_offset_vector(B)) return _ret;\
|
||||
for (_i = 0; _i < _len; ++_i) { _uref = N ## _clone(B, N ## _union_vec_at(vec, _i));\
|
||||
if (!_uref.value || !(flatcc_builder_offset_vector_push(B, _uref.value))) return _ret; }\
|
||||
_uvref.value = flatcc_builder_refmap_insert(B, vec.value, flatcc_builder_end_offset_vector(B));\
|
||||
if (_uvref.value == 0) return _ret; } return _uvref; }
|
||||
|
||||
#define __flatbuffers_build_string_vector_ops(NS, N)\
|
||||
static inline int N ## _push_start(NS ## builder_t *B)\
|
||||
{ return NS ## string_start(B); }\
|
||||
static inline NS ## string_ref_t *N ## _push_end(NS ## builder_t *B)\
|
||||
{ return NS ## string_vec_push(B, NS ## string_end(B)); }\
|
||||
static inline NS ## string_ref_t *N ## _push_create(NS ## builder_t *B, const char *s, size_t len)\
|
||||
{ return NS ## string_vec_push(B, NS ## string_create(B, s, len)); }\
|
||||
static inline NS ## string_ref_t *N ## _push_create_str(NS ## builder_t *B, const char *s)\
|
||||
{ return NS ## string_vec_push(B, NS ## string_create_str(B, s)); }\
|
||||
static inline NS ## string_ref_t *N ## _push_create_strn(NS ## builder_t *B, const char *s, size_t max_len)\
|
||||
{ return NS ## string_vec_push(B, NS ## string_create_strn(B, s, max_len)); }\
|
||||
static inline NS ## string_ref_t *N ## _push_clone(NS ## builder_t *B, NS ## string_t string)\
|
||||
{ return NS ## string_vec_push(B, NS ## string_clone(B, string)); }\
|
||||
static inline NS ## string_ref_t *N ## _push_slice(NS ## builder_t *B, NS ## string_t string, size_t index, size_t len)\
|
||||
{ return NS ## string_vec_push(B, NS ## string_slice(B, string, index, len)); }
|
||||
|
||||
#define __flatbuffers_build_table_vector_ops(NS, N, TN)\
|
||||
static inline int N ## _push_start(NS ## builder_t *B)\
|
||||
{ return TN ## _start(B); }\
|
||||
static inline TN ## _ref_t *N ## _push_end(NS ## builder_t *B)\
|
||||
{ return N ## _push(B, TN ## _end(B)); }\
|
||||
static inline TN ## _ref_t *N ## _push_create(NS ## builder_t *B __ ## TN ##_formal_args)\
|
||||
{ return N ## _push(B, TN ## _create(B __ ## TN ## _call_args)); }
|
||||
|
||||
#define __flatbuffers_build_offset_vector_ops(NS, V, N, TN)\
|
||||
static inline TN ## _ref_t *V ## _extend(NS ## builder_t *B, size_t len)\
|
||||
{ return flatcc_builder_extend_offset_vector(B, len); }\
|
||||
static inline TN ## _ref_t *V ## _append(NS ## builder_t *B, const TN ## _ref_t *data, size_t len)\
|
||||
{ return flatcc_builder_append_offset_vector(B, data, len); }\
|
||||
static inline int V ## _truncate(NS ## builder_t *B, size_t len)\
|
||||
{ return flatcc_builder_truncate_offset_vector(B, len); }\
|
||||
static inline TN ## _ref_t *V ## _edit(NS ## builder_t *B)\
|
||||
{ return (TN ## _ref_t *)flatcc_builder_offset_vector_edit(B); }\
|
||||
static inline size_t V ## _reserved_len(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_offset_vector_count(B); }\
|
||||
static inline TN ## _ref_t *V ## _push(NS ## builder_t *B, const TN ## _ref_t ref)\
|
||||
{ return ref ? flatcc_builder_offset_vector_push(B, ref) : 0; }
|
||||
|
||||
#define __flatbuffers_build_offset_vector(NS, N)\
|
||||
typedef NS ## ref_t N ## _vec_ref_t;\
|
||||
static inline int N ## _vec_start(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_start_offset_vector(B); }\
|
||||
static inline N ## _vec_ref_t N ## _vec_end(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_end_offset_vector(B); }\
|
||||
static inline N ## _vec_ref_t N ## _vec_create(NS ## builder_t *B, const N ## _ref_t *data, size_t len)\
|
||||
{ return flatcc_builder_create_offset_vector(B, data, len); }\
|
||||
__flatbuffers_build_offset_vector_ops(NS, N ## _vec, N, N)\
|
||||
static inline N ## _vec_ref_t N ## _vec_clone(NS ## builder_t *B, N ##_vec_t vec)\
|
||||
{ int _ret; N ## _ref_t _e; size_t _i, _len; __flatbuffers_memoize_begin(B, vec);\
|
||||
_len = N ## _vec_len(vec); if (flatcc_builder_start_offset_vector(B)) return 0;\
|
||||
for (_i = 0; _i < _len; ++_i) { if (!(_e = N ## _clone(B, N ## _vec_at(vec, _i)))) return 0;\
|
||||
if (!flatcc_builder_offset_vector_push(B, _e)) return 0; }\
|
||||
__flatbuffers_memoize_end(B, vec, flatcc_builder_end_offset_vector(B)); }\
|
||||
|
||||
#define __flatbuffers_build_string_ops(NS, N)\
|
||||
static inline char *N ## _append(NS ## builder_t *B, const char *s, size_t len)\
|
||||
{ return flatcc_builder_append_string(B, s, len); }\
|
||||
static inline char *N ## _append_str(NS ## builder_t *B, const char *s)\
|
||||
{ return flatcc_builder_append_string_str(B, s); }\
|
||||
static inline char *N ## _append_strn(NS ## builder_t *B, const char *s, size_t len)\
|
||||
{ return flatcc_builder_append_string_strn(B, s, len); }\
|
||||
static inline size_t N ## _reserved_len(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_string_len(B); }\
|
||||
static inline char *N ## _extend(NS ## builder_t *B, size_t len)\
|
||||
{ return flatcc_builder_extend_string(B, len); }\
|
||||
static inline char *N ## _edit(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_string_edit(B); }\
|
||||
static inline int N ## _truncate(NS ## builder_t *B, size_t len)\
|
||||
{ return flatcc_builder_truncate_string(B, len); }
|
||||
|
||||
#define __flatbuffers_build_string(NS)\
|
||||
typedef NS ## ref_t NS ## string_ref_t;\
|
||||
static inline int NS ## string_start(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_start_string(B); }\
|
||||
static inline NS ## string_ref_t NS ## string_end(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_end_string(B); }\
|
||||
static inline NS ## ref_t NS ## string_create(NS ## builder_t *B, const char *s, size_t len)\
|
||||
{ return flatcc_builder_create_string(B, s, len); }\
|
||||
static inline NS ## ref_t NS ## string_create_str(NS ## builder_t *B, const char *s)\
|
||||
{ return flatcc_builder_create_string_str(B, s); }\
|
||||
static inline NS ## ref_t NS ## string_create_strn(NS ## builder_t *B, const char *s, size_t len)\
|
||||
{ return flatcc_builder_create_string_strn(B, s, len); }\
|
||||
static inline NS ## string_ref_t NS ## string_clone(NS ## builder_t *B, NS ## string_t string)\
|
||||
{ __flatbuffers_memoize(B, string, flatcc_builder_create_string(B, string, NS ## string_len(string))); }\
|
||||
static inline NS ## string_ref_t NS ## string_slice(NS ## builder_t *B, NS ## string_t string, size_t index, size_t len)\
|
||||
{ size_t n = NS ## string_len(string); if (index >= n) index = n; n -= index; if (len > n) len = n;\
|
||||
return flatcc_builder_create_string(B, string + index, len); }\
|
||||
__flatbuffers_build_string_ops(NS, NS ## string)\
|
||||
__flatbuffers_build_offset_vector(NS, NS ## string)
|
||||
|
||||
#define __flatbuffers_copy_from_pe(P, P2, N) (*(P) = N ## _read_from_pe(P2), (P))
|
||||
#define __flatbuffers_from_pe(P, N) (*(P) = N ## _read_from_pe(P), (P))
|
||||
#define __flatbuffers_copy_to_pe(P, P2, N) (N ## _write_to_pe((P), *(P2)), (P))
|
||||
#define __flatbuffers_to_pe(P, N) (N ## _write_to_pe((P), *(P)), (P))
|
||||
#define __flatbuffers_define_fixed_array_primitives(NS, N, T)\
|
||||
static inline T *N ## _array_copy(T *p, const T *p2, size_t n)\
|
||||
{ memcpy(p, p2, n * sizeof(T)); return p; }\
|
||||
static inline T *N ## _array_copy_from_pe(T *p, const T *p2, size_t n)\
|
||||
{ size_t i; if (NS ## is_native_pe()) memcpy(p, p2, n * sizeof(T)); else\
|
||||
for (i = 0; i < n; ++i) N ## _copy_from_pe(&p[i], &p2[i]); return p; }\
|
||||
static inline T *N ## _array_copy_to_pe(T *p, const T *p2, size_t n)\
|
||||
{ size_t i; if (NS ## is_native_pe()) memcpy(p, p2, n * sizeof(T)); else\
|
||||
for (i = 0; i < n; ++i) N ## _copy_to_pe(&p[i], &p2[i]); return p; }
|
||||
#define __flatbuffers_define_scalar_primitives(NS, N, T)\
|
||||
static inline T *N ## _from_pe(T *p) { return __ ## NS ## from_pe(p, N); }\
|
||||
static inline T *N ## _to_pe(T *p) { return __ ## NS ## to_pe(p, N); }\
|
||||
static inline T *N ## _copy(T *p, const T *p2) { *p = *p2; return p; }\
|
||||
static inline T *N ## _copy_from_pe(T *p, const T *p2)\
|
||||
{ return __ ## NS ## copy_from_pe(p, p2, N); }\
|
||||
static inline T *N ## _copy_to_pe(T *p, const T *p2) \
|
||||
{ return __ ## NS ## copy_to_pe(p, p2, N); }\
|
||||
static inline T *N ## _assign(T *p, const T v0) { *p = v0; return p; }\
|
||||
static inline T *N ## _assign_from_pe(T *p, T v0)\
|
||||
{ *p = N ## _read_from_pe(&v0); return p; }\
|
||||
static inline T *N ## _assign_to_pe(T *p, T v0)\
|
||||
{ N ## _write_to_pe(p, v0); return p; }
|
||||
#define __flatbuffers_build_scalar(NS, N, T)\
|
||||
__ ## NS ## define_scalar_primitives(NS, N, T)\
|
||||
__ ## NS ## define_fixed_array_primitives(NS, N, T)\
|
||||
__ ## NS ## build_vector(NS, N, T, sizeof(T), sizeof(T))
|
||||
/* Depends on generated copy_to/from_pe functions, and the type. */
|
||||
#define __flatbuffers_define_struct_primitives(NS, N)\
|
||||
static inline N ## _t *N ##_to_pe(N ## _t *p)\
|
||||
{ if (!NS ## is_native_pe()) { N ## _copy_to_pe(p, p); }; return p; }\
|
||||
static inline N ## _t *N ##_from_pe(N ## _t *p)\
|
||||
{ if (!NS ## is_native_pe()) { N ## _copy_from_pe(p, p); }; return p; }\
|
||||
static inline N ## _t *N ## _clear(N ## _t *p) { return (N ## _t *)memset(p, 0, N ## __size()); }
|
||||
|
||||
/* Depends on generated copy/assign_to/from_pe functions, and the type. */
|
||||
#define __flatbuffers_build_struct(NS, N, S, A, FID, TFID)\
|
||||
__ ## NS ## define_struct_primitives(NS, N)\
|
||||
typedef NS ## ref_t N ## _ref_t;\
|
||||
static inline N ## _t *N ## _start(NS ## builder_t *B)\
|
||||
{ return (N ## _t *)flatcc_builder_start_struct(B, S, A); }\
|
||||
static inline N ## _ref_t N ## _end(NS ## builder_t *B)\
|
||||
{ if (!NS ## is_native_pe()) { N ## _to_pe((N ## _t *)flatcc_builder_struct_edit(B)); }\
|
||||
return flatcc_builder_end_struct(B); }\
|
||||
static inline N ## _ref_t N ## _end_pe(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_end_struct(B); }\
|
||||
static inline N ## _ref_t N ## _create(NS ## builder_t *B __ ## N ## _formal_args)\
|
||||
{ N ## _t *_p = N ## _start(B); if (!_p) return 0; N ##_assign_to_pe(_p __ ## N ## _call_args);\
|
||||
return N ## _end_pe(B); }\
|
||||
static inline N ## _ref_t N ## _clone(NS ## builder_t *B, N ## _struct_t p)\
|
||||
{ N ## _t *_p; __flatbuffers_memoize_begin(B, p); _p = N ## _start(B); if (!_p) return 0;\
|
||||
N ## _copy(_p, p); __flatbuffers_memoize_end(B, p, N ##_end_pe(B)); }\
|
||||
__flatbuffers_build_vector(NS, N, N ## _t, S, A)\
|
||||
__flatbuffers_build_struct_root(NS, N, A, FID, TFID)\
|
||||
|
||||
#define __flatbuffers_struct_clear_field(p) memset((p), 0, sizeof(*(p)))
|
||||
#define __flatbuffers_build_table(NS, N, K)\
|
||||
static inline int N ## _start(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_start_table(B, K); }\
|
||||
static inline N ## _ref_t N ## _end(NS ## builder_t *B)\
|
||||
{ FLATCC_ASSERT(flatcc_builder_check_required(B, __ ## N ## _required,\
|
||||
sizeof(__ ## N ## _required) / sizeof(__ ## N ## _required[0]) - 1));\
|
||||
return flatcc_builder_end_table(B); }\
|
||||
__flatbuffers_build_offset_vector(NS, N)
|
||||
|
||||
#define __flatbuffers_build_table_field(ID, NS, N, TN, TT)\
|
||||
static inline int N ## _add(NS ## builder_t *B, TN ## _ref_t ref)\
|
||||
{ TN ## _ref_t *_p; return (ref && (_p = flatcc_builder_table_add_offset(B, ID))) ?\
|
||||
((*_p = ref), 0) : -1; }\
|
||||
static inline int N ## _start(NS ## builder_t *B)\
|
||||
{ return TN ## _start(B); }\
|
||||
static inline int N ## _end(NS ## builder_t *B)\
|
||||
{ return N ## _add(B, TN ## _end(B)); }\
|
||||
static inline TN ## _ref_t N ## _create(NS ## builder_t *B __ ## TN ##_formal_args)\
|
||||
{ return N ## _add(B, TN ## _create(B __ ## TN ## _call_args)); }\
|
||||
static inline int N ## _clone(NS ## builder_t *B, TN ## _table_t p)\
|
||||
{ return N ## _add(B, TN ## _clone(B, p)); }\
|
||||
static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\
|
||||
{ TN ## _table_t _p = N ## _get(t); return _p ? N ## _clone(B, _p) : 0; }
|
||||
|
||||
#define __flatbuffers_build_union_field(ID, NS, N, TN, TT)\
|
||||
static inline int N ## _add(NS ## builder_t *B, TN ## _union_ref_t uref)\
|
||||
{ NS ## ref_t *_p; TN ## _union_type_t *_pt; if (uref.type == TN ## _NONE) return 0; if (uref.value == 0) return -1;\
|
||||
if (!(_pt = (TN ## _union_type_t *)flatcc_builder_table_add(B, ID - 1, sizeof(*_pt), sizeof(*_pt)))) return -1;\
|
||||
*_pt = uref.type; if (!(_p = flatcc_builder_table_add_offset(B, ID))) return -1; *_p = uref.value; return 0; }\
|
||||
static inline int N ## _add_type(NS ## builder_t *B, TN ## _union_type_t type)\
|
||||
{ TN ## _union_type_t *_pt; if (type == TN ## _NONE) return 0; return (_pt = (TN ## _union_type_t *)flatcc_builder_table_add(B, ID - 1,\
|
||||
sizeof(*_pt), sizeof(*_pt))) ? ((*_pt = type), 0) : -1; }\
|
||||
static inline int N ## _add_value(NS ## builder_t *B, TN ## _union_ref_t uref)\
|
||||
{ NS ## ref_t *p; if (uref.type == TN ## _NONE) return 0; return (p = flatcc_builder_table_add_offset(B, ID)) ?\
|
||||
((*p = uref.value), 0) : -1; }\
|
||||
static inline int N ## _clone(NS ## builder_t *B, TN ## _union_t p)\
|
||||
{ return N ## _add(B, TN ## _clone(B, p)); }\
|
||||
static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\
|
||||
{ TN ## _union_t _p = N ## _union(t); return _p.type ? N ## _clone(B, _p) : 0; }
|
||||
|
||||
/* M is the union value name and T is its type, i.e. the qualified name. */
|
||||
#define __flatbuffers_build_union_table_value_field(NS, N, NU, M, T)\
|
||||
static inline int N ## _ ## M ## _add(NS ## builder_t *B, T ## _ref_t ref)\
|
||||
{ return N ## _add(B, NU ## _as_ ## M (ref)); }\
|
||||
static inline int N ## _ ## M ## _start(NS ## builder_t *B)\
|
||||
{ return T ## _start(B); }\
|
||||
static inline int N ## _ ## M ## _end(NS ## builder_t *B)\
|
||||
{ T ## _ref_t ref = T ## _end(B);\
|
||||
return ref ? N ## _ ## M ## _add(B, ref) : -1; }\
|
||||
static inline int N ## _ ## M ## _create(NS ## builder_t *B __ ## T ##_formal_args)\
|
||||
{ T ## _ref_t ref = T ## _create(B __ ## T ## _call_args);\
|
||||
return ref ? N ## _add(B, NU ## _as_ ## M(ref)) : -1; }\
|
||||
static inline int N ## _ ## M ## _clone(NS ## builder_t *B, T ## _table_t t)\
|
||||
{ T ## _ref_t ref = T ## _clone(B, t);\
|
||||
return ref ? N ## _add(B, NU ## _as_ ## M(ref)) : -1; }
|
||||
|
||||
/* M is the union value name and T is its type, i.e. the qualified name. */
|
||||
#define __flatbuffers_build_union_struct_value_field(NS, N, NU, M, T)\
|
||||
static inline int N ## _ ## M ## _add(NS ## builder_t *B, T ## _ref_t ref)\
|
||||
{ return N ## _add(B, NU ## _as_ ## M (ref)); }\
|
||||
static inline T ## _t *N ## _ ## M ## _start(NS ## builder_t *B)\
|
||||
{ return T ## _start(B); }\
|
||||
static inline int N ## _ ## M ## _end(NS ## builder_t *B)\
|
||||
{ T ## _ref_t ref = T ## _end(B);\
|
||||
return ref ? N ## _ ## M ## _add(B, ref) : -1; }\
|
||||
static inline int N ## _ ## M ## _create(NS ## builder_t *B __ ## T ##_formal_args)\
|
||||
{ T ## _ref_t ref = T ## _create(B __ ## T ## _call_args);\
|
||||
return ref ? N ## _add(B, NU ## _as_ ## M(ref)) : -1; }\
|
||||
static inline int N ## _ ## M ## _end_pe(NS ## builder_t *B)\
|
||||
{ T ## _ref_t ref = T ## _end_pe(B);\
|
||||
return ref ? N ## _add(B, NU ## _as_ ## M(ref)) : -1; }\
|
||||
static inline int N ## _ ## M ## _clone(NS ## builder_t *B, T ## _struct_t p)\
|
||||
{ T ## _ref_t ref = T ## _clone(B, p);\
|
||||
return ref ? N ## _add(B, NU ## _as_ ## M(ref)) : -1; }
|
||||
#define __flatbuffers_build_union_string_value_field(NS, N, NU, M)\
|
||||
static inline int N ## _ ## M ## _add(NS ## builder_t *B, NS ## string_ref_t ref)\
|
||||
{ return N ## _add(B, NU ## _as_ ## M (ref)); }\
|
||||
__flatbuffers_build_string_field_ops(NS, N ## _ ## M)
|
||||
|
||||
/* NS: common namespace, ID: table field id (not offset), TN: name of type T, TT: name of table type
|
||||
* S: sizeof of scalar type, A: alignment of type T, default value V of type T. */
|
||||
#define __flatbuffers_build_scalar_field(ID, NS, N, TN, T, S, A, V, TT)\
|
||||
static inline int N ## _add(NS ## builder_t *B, const T v)\
|
||||
{ T *_p; if (v == V) return 0; if (!(_p = (T *)flatcc_builder_table_add(B, ID, S, A))) return -1;\
|
||||
TN ## _assign_to_pe(_p, v); return 0; }\
|
||||
static inline int N ## _force_add(NS ## builder_t *B, const T v)\
|
||||
{ T *_p; if (!(_p = (T *)flatcc_builder_table_add(B, ID, S, A))) return -1;\
|
||||
TN ## _assign_to_pe(_p, v); return 0; }\
|
||||
/* Clone does not skip default values and expects pe endian content. */\
|
||||
static inline int N ## _clone(NS ## builder_t *B, const T *p)\
|
||||
{ return 0 == flatcc_builder_table_add_copy(B, ID, p, S, A) ? -1 : 0; }\
|
||||
/* Transferring a missing field is a nop success with 0 as result. */\
|
||||
static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\
|
||||
{ const T *_p = N ## _get_ptr(t); return _p ? N ## _clone(B, _p) : 0; }
|
||||
|
||||
/* NS: common namespace, ID: table field id (not offset), TN: name of type T, TT: name of table type
|
||||
* S: sizeof of scalar type, A: alignment of type T. */
|
||||
#define __flatbuffers_build_scalar_optional_field(ID, NS, N, TN, T, S, A, TT)\
|
||||
static inline int N ## _add(NS ## builder_t *B, const T v)\
|
||||
{ T *_p; if (!(_p = (T *)flatcc_builder_table_add(B, ID, S, A))) return -1;\
|
||||
TN ## _assign_to_pe(_p, v); return 0; }\
|
||||
/* Clone does not skip default values and expects pe endian content. */\
|
||||
static inline int N ## _clone(NS ## builder_t *B, const T *p)\
|
||||
{ return 0 == flatcc_builder_table_add_copy(B, ID, p, S, A) ? -1 : 0; }\
|
||||
/* Transferring a missing field is a nop success with 0 as result. */\
|
||||
static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\
|
||||
{ const T *_p = N ## _get_ptr(t); return _p ? N ## _clone(B, _p) : 0; }
|
||||
|
||||
#define __flatbuffers_build_struct_field(ID, NS, N, TN, S, A, TT)\
|
||||
static inline TN ## _t *N ## _start(NS ## builder_t *B)\
|
||||
{ return (TN ## _t *)flatcc_builder_table_add(B, ID, S, A); }\
|
||||
static inline int N ## _end(NS ## builder_t *B)\
|
||||
{ if (!NS ## is_native_pe()) { TN ## _to_pe((TN ## _t *)flatcc_builder_table_edit(B, S)); } return 0; }\
|
||||
static inline int N ## _end_pe(NS ## builder_t *B) { return 0; }\
|
||||
static inline int N ## _create(NS ## builder_t *B __ ## TN ## _formal_args)\
|
||||
{ TN ## _t *_p = N ## _start(B); if (!_p) return -1; TN ##_assign_to_pe(_p __ ## TN ## _call_args);\
|
||||
return 0; }\
|
||||
static inline int N ## _add(NS ## builder_t *B, const TN ## _t *p)\
|
||||
{ TN ## _t *_p = N ## _start(B); if (!_p) return -1; TN ##_copy_to_pe(_p, p); return 0; }\
|
||||
static inline int N ## _clone(NS ## builder_t *B, TN ## _struct_t p)\
|
||||
{ return 0 == flatcc_builder_table_add_copy(B, ID, p, S, A) ? -1 : 0; }\
|
||||
static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\
|
||||
{ TN ## _struct_t _p = N ## _get(t); return _p ? N ## _clone(B, _p) : 0; }
|
||||
|
||||
#define __flatbuffers_build_vector_field(ID, NS, N, TN, T, TT)\
|
||||
static inline int N ## _add(NS ## builder_t *B, TN ## _vec_ref_t ref)\
|
||||
{ TN ## _vec_ref_t *_p; return (ref && (_p = flatcc_builder_table_add_offset(B, ID))) ? ((*_p = ref), 0) : -1; }\
|
||||
static inline int N ## _start(NS ## builder_t *B)\
|
||||
{ return TN ## _vec_start(B); }\
|
||||
static inline int N ## _end_pe(NS ## builder_t *B)\
|
||||
{ return N ## _add(B, TN ## _vec_end_pe(B)); }\
|
||||
static inline int N ## _end(NS ## builder_t *B)\
|
||||
{ return N ## _add(B, TN ## _vec_end(B)); }\
|
||||
static inline int N ## _create_pe(NS ## builder_t *B, const T *data, size_t len)\
|
||||
{ return N ## _add(B, TN ## _vec_create_pe(B, data, len)); }\
|
||||
static inline int N ## _create(NS ## builder_t *B, const T *data, size_t len)\
|
||||
{ return N ## _add(B, TN ## _vec_create(B, data, len)); }\
|
||||
static inline int N ## _slice(NS ## builder_t *B, TN ## _vec_t vec, size_t index, size_t len)\
|
||||
{ return N ## _add(B, TN ## _vec_slice(B, vec, index, len)); }\
|
||||
static inline int N ## _clone(NS ## builder_t *B, TN ## _vec_t vec)\
|
||||
{ return N ## _add(B, TN ## _vec_clone(B, vec)); }\
|
||||
static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\
|
||||
{ TN ## _vec_t _p = N ## _get(t); return _p ? N ## _clone(B, _p) : 0; }\
|
||||
__flatbuffers_build_vector_ops(NS, N, N, TN, T)\
|
||||
|
||||
#define __flatbuffers_build_offset_vector_field(ID, NS, N, TN, TT)\
|
||||
static inline int N ## _add(NS ## builder_t *B, TN ## _vec_ref_t ref)\
|
||||
{ TN ## _vec_ref_t *_p; return (ref && (_p = flatcc_builder_table_add_offset(B, ID))) ? ((*_p = ref), 0) : -1; }\
|
||||
static inline int N ## _start(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_start_offset_vector(B); }\
|
||||
static inline int N ## _end(NS ## builder_t *B)\
|
||||
{ return N ## _add(B, flatcc_builder_end_offset_vector(B)); }\
|
||||
static inline int N ## _create(NS ## builder_t *B, const TN ## _ref_t *data, size_t len)\
|
||||
{ return N ## _add(B, flatcc_builder_create_offset_vector(B, data, len)); }\
|
||||
__flatbuffers_build_offset_vector_ops(NS, N, N, TN)\
|
||||
static inline int N ## _clone(NS ## builder_t *B, TN ## _vec_t vec)\
|
||||
{ return N ## _add(B, TN ## _vec_clone(B, vec)); }\
|
||||
static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\
|
||||
{ TN ## _vec_t _p = N ## _get(t); return _p ? N ## _clone(B, _p) : 0; }
|
||||
|
||||
/* depends on N ## _add which differs for union member fields and ordinary fields */\
|
||||
#define __flatbuffers_build_string_field_ops(NS, N)\
|
||||
static inline int N ## _start(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_start_string(B); }\
|
||||
static inline int N ## _end(NS ## builder_t *B)\
|
||||
{ return N ## _add(B, flatcc_builder_end_string(B)); }\
|
||||
static inline int N ## _create(NS ## builder_t *B, const char *s, size_t len)\
|
||||
{ return N ## _add(B, flatcc_builder_create_string(B, s, len)); }\
|
||||
static inline int N ## _create_str(NS ## builder_t *B, const char *s)\
|
||||
{ return N ## _add(B, flatcc_builder_create_string_str(B, s)); }\
|
||||
static inline int N ## _create_strn(NS ## builder_t *B, const char *s, size_t max_len)\
|
||||
{ return N ## _add(B, flatcc_builder_create_string_strn(B, s, max_len)); }\
|
||||
static inline int N ## _clone(NS ## builder_t *B, NS ## string_t string)\
|
||||
{ return N ## _add(B, NS ## string_clone(B, string)); }\
|
||||
static inline int N ## _slice(NS ## builder_t *B, NS ## string_t string, size_t index, size_t len)\
|
||||
{ return N ## _add(B, NS ## string_slice(B, string, index, len)); }\
|
||||
__flatbuffers_build_string_ops(NS, N)
|
||||
|
||||
#define __flatbuffers_build_string_field(ID, NS, N, TT)\
|
||||
static inline int N ## _add(NS ## builder_t *B, NS ## string_ref_t ref)\
|
||||
{ NS ## string_ref_t *_p; return (ref && (_p = flatcc_builder_table_add_offset(B, ID))) ? ((*_p = ref), 0) : -1; }\
|
||||
__flatbuffers_build_string_field_ops(NS, N)\
|
||||
static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\
|
||||
{ NS ## string_t _p = N ## _get(t); return _p ? N ## _clone(B, _p) : 0; }
|
||||
|
||||
#define __flatbuffers_build_table_vector_field(ID, NS, N, TN, TT)\
|
||||
__flatbuffers_build_offset_vector_field(ID, NS, N, TN, TT)\
|
||||
__flatbuffers_build_table_vector_ops(NS, N, TN)
|
||||
|
||||
#define __flatbuffers_build_union_vector_field(ID, NS, N, TN, TT)\
|
||||
static inline int N ## _add(NS ## builder_t *B, TN ## _union_vec_ref_t uvref)\
|
||||
{ NS ## vec_ref_t *_p; if (!uvref.type || !uvref.value) return uvref.type == uvref.value ? 0 : -1;\
|
||||
if (!(_p = flatcc_builder_table_add_offset(B, ID - 1))) return -1; *_p = uvref.type;\
|
||||
if (!(_p = flatcc_builder_table_add_offset(B, ID))) return -1; *_p = uvref.value; return 0; }\
|
||||
static inline int N ## _start(NS ## builder_t *B)\
|
||||
{ return flatcc_builder_start_union_vector(B); }\
|
||||
static inline int N ## _end(NS ## builder_t *B)\
|
||||
{ return N ## _add(B, flatcc_builder_end_union_vector(B)); }\
|
||||
static inline int N ## _create(NS ## builder_t *B, const TN ## _union_ref_t *data, size_t len)\
|
||||
{ return N ## _add(B, flatcc_builder_create_union_vector(B, data, len)); }\
|
||||
__flatbuffers_build_union_vector_ops(NS, N, N, TN)\
|
||||
static inline int N ## _clone(NS ## builder_t *B, TN ## _union_vec_t vec)\
|
||||
{ return N ## _add(B, TN ## _vec_clone(B, vec)); }\
|
||||
static inline int N ## _pick(NS ## builder_t *B, TT ## _table_t t)\
|
||||
{ TN ## _union_vec_t _p = N ## _union(t); return _p.type ? N ## _clone(B, _p) : 0; }
|
||||
|
||||
#define __flatbuffers_build_union_table_vector_value_field(NS, N, NU, M, T)\
|
||||
static inline int N ## _ ## M ## _push_start(NS ## builder_t *B)\
|
||||
{ return T ## _start(B); }\
|
||||
static inline NU ## _union_ref_t *N ## _ ## M ## _push_end(NS ## builder_t *B)\
|
||||
{ return NU ## _vec_push(B, NU ## _as_ ## M (T ## _end(B))); }\
|
||||
static inline NU ## _union_ref_t *N ## _ ## M ## _push(NS ## builder_t *B, T ## _ref_t ref)\
|
||||
{ return NU ## _vec_push(B, NU ## _as_ ## M (ref)); }\
|
||||
static inline NU ## _union_ref_t *N ## _ ## M ## _push_create(NS ## builder_t *B __ ## T ##_formal_args)\
|
||||
{ return NU ## _vec_push(B, NU ## _as_ ## M(T ## _create(B __ ## T ## _call_args))); }\
|
||||
static inline NU ## _union_ref_t *N ## _ ## M ## _push_clone(NS ## builder_t *B, T ## _table_t t)\
|
||||
{ return NU ## _vec_push(B, NU ## _as_ ## M(T ## _clone(B, t))); }
|
||||
|
||||
#define __flatbuffers_build_union_struct_vector_value_field(NS, N, NU, M, T)\
|
||||
static inline T ## _t *N ## _ ## M ## _push_start(NS ## builder_t *B)\
|
||||
{ return T ## _start(B); }\
|
||||
static inline NU ## _union_ref_t *N ## _ ## M ## _push_end(NS ## builder_t *B)\
|
||||
{ return NU ## _vec_push(B, NU ## _as_ ## M (T ## _end(B))); }\
|
||||
static inline NU ## _union_ref_t *N ## _ ## M ## _push(NS ## builder_t *B, T ## _ref_t ref)\
|
||||
{ return NU ## _vec_push(B, NU ## _as_ ## M (ref)); }\
|
||||
static inline NU ## _union_ref_t *N ## _ ## M ## _push_create(NS ## builder_t *B __ ## T ##_formal_args)\
|
||||
{ return NU ## _vec_push(B, NU ## _as_ ## M(T ## _create(B __ ## T ## _call_args))); }\
|
||||
static inline NU ## _union_ref_t *N ## _ ## M ## _push_clone(NS ## builder_t *B, T ## _struct_t p)\
|
||||
{ return NU ## _vec_push(B, NU ## _as_ ## M(T ## _clone(B, p))); }
|
||||
|
||||
#define __flatbuffers_build_union_string_vector_value_field(NS, N, NU, M)\
|
||||
static inline NU ## _union_ref_t *N ## _ ## M ## _push(NS ## builder_t *B, NS ## string_ref_t ref)\
|
||||
{ return NU ## _vec_push(B, NU ## _as_ ## M (ref)); }\
|
||||
static inline int N ## _ ## M ## _push_start(NS ## builder_t *B)\
|
||||
{ return NS ## string_start(B); }\
|
||||
static inline NU ## _union_ref_t *N ## _ ## M ## _push_end(NS ## builder_t *B)\
|
||||
{ return NU ## _vec_push(B, NU ## _as_ ## M(NS ## string_end(B))); }\
|
||||
static inline NU ## _union_ref_t *N ## _ ## M ## _push_create(NS ## builder_t *B, const char *s, size_t len)\
|
||||
{ return NU ## _vec_push(B, NU ## _as_ ## M(NS ## string_create(B, s, len))); }\
|
||||
static inline NU ## _union_ref_t *N ## _ ## M ## _push_create_str(NS ## builder_t *B, const char *s)\
|
||||
{ return NU ## _vec_push(B, NU ## _as_ ## M(NS ## string_create_str(B, s))); }\
|
||||
static inline NU ## _union_ref_t *N ## _ ## M ## _push_create_strn(NS ## builder_t *B, const char *s, size_t max_len)\
|
||||
{ return NU ## _vec_push(B, NU ## _as_ ## M(NS ## string_create_strn(B, s, max_len))); }\
|
||||
static inline NU ## _union_ref_t *N ## _ ## M ## _push_clone(NS ## builder_t *B, NS ## string_t string)\
|
||||
{ return NU ## _vec_push(B, NU ## _as_ ## M(NS ## string_clone(B, string))); }\
|
||||
static inline NU ## _union_ref_t *N ## _ ## M ## _push_slice(NS ## builder_t *B, NS ## string_t string, size_t index, size_t len)\
|
||||
{ return NU ## _vec_push(B, NU ## _as_ ## M(NS ## string_slice(B, string, index, len))); }
|
||||
|
||||
#define __flatbuffers_build_string_vector_field(ID, NS, N, TT)\
|
||||
__flatbuffers_build_offset_vector_field(ID, NS, N, NS ## string, TT)\
|
||||
__flatbuffers_build_string_vector_ops(NS, N)
|
||||
|
||||
#define __flatbuffers_char_formal_args , char v0
|
||||
#define __flatbuffers_char_call_args , v0
|
||||
#define __flatbuffers_uint8_formal_args , uint8_t v0
|
||||
#define __flatbuffers_uint8_call_args , v0
|
||||
#define __flatbuffers_int8_formal_args , int8_t v0
|
||||
#define __flatbuffers_int8_call_args , v0
|
||||
#define __flatbuffers_bool_formal_args , flatbuffers_bool_t v0
|
||||
#define __flatbuffers_bool_call_args , v0
|
||||
#define __flatbuffers_uint16_formal_args , uint16_t v0
|
||||
#define __flatbuffers_uint16_call_args , v0
|
||||
#define __flatbuffers_uint32_formal_args , uint32_t v0
|
||||
#define __flatbuffers_uint32_call_args , v0
|
||||
#define __flatbuffers_uint64_formal_args , uint64_t v0
|
||||
#define __flatbuffers_uint64_call_args , v0
|
||||
#define __flatbuffers_int16_formal_args , int16_t v0
|
||||
#define __flatbuffers_int16_call_args , v0
|
||||
#define __flatbuffers_int32_formal_args , int32_t v0
|
||||
#define __flatbuffers_int32_call_args , v0
|
||||
#define __flatbuffers_int64_formal_args , int64_t v0
|
||||
#define __flatbuffers_int64_call_args , v0
|
||||
#define __flatbuffers_float_formal_args , float v0
|
||||
#define __flatbuffers_float_call_args , v0
|
||||
#define __flatbuffers_double_formal_args , double v0
|
||||
#define __flatbuffers_double_call_args , v0
|
||||
|
||||
__flatbuffers_build_scalar(flatbuffers_, flatbuffers_char, char)
|
||||
__flatbuffers_build_scalar(flatbuffers_, flatbuffers_uint8, uint8_t)
|
||||
__flatbuffers_build_scalar(flatbuffers_, flatbuffers_int8, int8_t)
|
||||
__flatbuffers_build_scalar(flatbuffers_, flatbuffers_bool, flatbuffers_bool_t)
|
||||
__flatbuffers_build_scalar(flatbuffers_, flatbuffers_uint16, uint16_t)
|
||||
__flatbuffers_build_scalar(flatbuffers_, flatbuffers_uint32, uint32_t)
|
||||
__flatbuffers_build_scalar(flatbuffers_, flatbuffers_uint64, uint64_t)
|
||||
__flatbuffers_build_scalar(flatbuffers_, flatbuffers_int16, int16_t)
|
||||
__flatbuffers_build_scalar(flatbuffers_, flatbuffers_int32, int32_t)
|
||||
__flatbuffers_build_scalar(flatbuffers_, flatbuffers_int64, int64_t)
|
||||
__flatbuffers_build_scalar(flatbuffers_, flatbuffers_float, float)
|
||||
__flatbuffers_build_scalar(flatbuffers_, flatbuffers_double, double)
|
||||
|
||||
__flatbuffers_build_string(flatbuffers_)
|
||||
|
||||
__flatbuffers_build_buffer(flatbuffers_)
|
||||
#include "flatcc/flatcc_epilogue.h"
|
||||
#endif /* FLATBUFFERS_COMMON_BUILDER_H */
|
||||
578
executables/mac_sm/ie/fb/flatbuffers_common_reader.h
Normal file
578
executables/mac_sm/ie/fb/flatbuffers_common_reader.h
Normal file
@@ -0,0 +1,578 @@
|
||||
#ifndef FLATBUFFERS_COMMON_READER_H
|
||||
#define FLATBUFFERS_COMMON_READER_H
|
||||
|
||||
/* Generated by flatcc 0.6.1-dev FlatBuffers schema compiler for C by dvide.com */
|
||||
|
||||
/* Common FlatBuffers read functionality for C. */
|
||||
|
||||
#include "flatcc/flatcc_prologue.h"
|
||||
#include "flatcc/flatcc_flatbuffers.h"
|
||||
|
||||
|
||||
#define __flatbuffers_read_scalar_at_byteoffset(N, p, o) N ## _read_from_pe((uint8_t *)(p) + (o))
|
||||
#define __flatbuffers_read_scalar(N, p) N ## _read_from_pe(p)
|
||||
#define __flatbuffers_read_vt(ID, offset, t)\
|
||||
flatbuffers_voffset_t offset = 0;\
|
||||
{ flatbuffers_voffset_t id__tmp, *vt__tmp;\
|
||||
FLATCC_ASSERT(t != 0 && "null pointer table access");\
|
||||
id__tmp = ID;\
|
||||
vt__tmp = (flatbuffers_voffset_t *)((uint8_t *)(t) -\
|
||||
__flatbuffers_soffset_read_from_pe(t));\
|
||||
if (__flatbuffers_voffset_read_from_pe(vt__tmp) >= sizeof(vt__tmp[0]) * (id__tmp + 3u)) {\
|
||||
offset = __flatbuffers_voffset_read_from_pe(vt__tmp + id__tmp + 2);\
|
||||
}\
|
||||
}
|
||||
#define __flatbuffers_field_present(ID, t) { __flatbuffers_read_vt(ID, offset__tmp, t) return offset__tmp != 0; }
|
||||
#define __flatbuffers_scalar_field(T, ID, t)\
|
||||
{\
|
||||
__flatbuffers_read_vt(ID, offset__tmp, t)\
|
||||
if (offset__tmp) {\
|
||||
return (const T *)((uint8_t *)(t) + offset__tmp);\
|
||||
}\
|
||||
return 0;\
|
||||
}
|
||||
#define __flatbuffers_define_scalar_field(ID, N, NK, TK, T, V)\
|
||||
static inline T N ## _ ## NK ## _get(N ## _table_t t__tmp)\
|
||||
{ __flatbuffers_read_vt(ID, offset__tmp, t__tmp)\
|
||||
return offset__tmp ? __flatbuffers_read_scalar_at_byteoffset(TK, t__tmp, offset__tmp) : V;\
|
||||
}\
|
||||
static inline T N ## _ ## NK(N ## _table_t t__tmp)\
|
||||
{ __flatbuffers_read_vt(ID, offset__tmp, t__tmp)\
|
||||
return offset__tmp ? __flatbuffers_read_scalar_at_byteoffset(TK, t__tmp, offset__tmp) : V;\
|
||||
}\
|
||||
static inline const T *N ## _ ## NK ## _get_ptr(N ## _table_t t__tmp)\
|
||||
__flatbuffers_scalar_field(T, ID, t__tmp)\
|
||||
static inline int N ## _ ## NK ## _is_present(N ## _table_t t__tmp)\
|
||||
__flatbuffers_field_present(ID, t__tmp)\
|
||||
__flatbuffers_define_scan_by_scalar_field(N, NK, T)
|
||||
#define __flatbuffers_define_scalar_optional_field(ID, N, NK, TK, T, V)\
|
||||
__flatbuffers_define_scalar_field(ID, N, NK, TK, T, V)\
|
||||
static inline TK ## _option_t N ## _ ## NK ## _option(N ## _table_t t__tmp)\
|
||||
{ TK ## _option_t ret; __flatbuffers_read_vt(ID, offset__tmp, t__tmp)\
|
||||
ret.is_null = offset__tmp == 0; ret.value = offset__tmp ?\
|
||||
__flatbuffers_read_scalar_at_byteoffset(TK, t__tmp, offset__tmp) : V;\
|
||||
return ret; }
|
||||
#define __flatbuffers_struct_field(T, ID, t, r)\
|
||||
{\
|
||||
__flatbuffers_read_vt(ID, offset__tmp, t)\
|
||||
if (offset__tmp) {\
|
||||
return (T)((uint8_t *)(t) + offset__tmp);\
|
||||
}\
|
||||
FLATCC_ASSERT(!(r) && "required field missing");\
|
||||
return 0;\
|
||||
}
|
||||
#define __flatbuffers_offset_field(T, ID, t, r, adjust)\
|
||||
{\
|
||||
flatbuffers_uoffset_t *elem__tmp;\
|
||||
__flatbuffers_read_vt(ID, offset__tmp, t)\
|
||||
if (offset__tmp) {\
|
||||
elem__tmp = (flatbuffers_uoffset_t *)((uint8_t *)(t) + offset__tmp);\
|
||||
/* Add sizeof so C api can have raw access past header field. */\
|
||||
return (T)((uint8_t *)(elem__tmp) + adjust +\
|
||||
__flatbuffers_uoffset_read_from_pe(elem__tmp));\
|
||||
}\
|
||||
FLATCC_ASSERT(!(r) && "required field missing");\
|
||||
return 0;\
|
||||
}
|
||||
#define __flatbuffers_vector_field(T, ID, t, r) __flatbuffers_offset_field(T, ID, t, r, sizeof(flatbuffers_uoffset_t))
|
||||
#define __flatbuffers_table_field(T, ID, t, r) __flatbuffers_offset_field(T, ID, t, r, 0)
|
||||
#define __flatbuffers_define_struct_field(ID, N, NK, T, r)\
|
||||
static inline T N ## _ ## NK ## _get(N ## _table_t t__tmp)\
|
||||
__flatbuffers_struct_field(T, ID, t__tmp, r)\
|
||||
static inline T N ## _ ## NK(N ## _table_t t__tmp)\
|
||||
__flatbuffers_struct_field(T, ID, t__tmp, r)\
|
||||
static inline int N ## _ ## NK ## _is_present(N ## _table_t t__tmp)\
|
||||
__flatbuffers_field_present(ID, t__tmp)
|
||||
#define __flatbuffers_define_vector_field(ID, N, NK, T, r)\
|
||||
static inline T N ## _ ## NK ## _get(N ## _table_t t__tmp)\
|
||||
__flatbuffers_vector_field(T, ID, t__tmp, r)\
|
||||
static inline T N ## _ ## NK(N ## _table_t t__tmp)\
|
||||
__flatbuffers_vector_field(T, ID, t__tmp, r)\
|
||||
static inline int N ## _ ## NK ## _is_present(N ## _table_t t__tmp)\
|
||||
__flatbuffers_field_present(ID, t__tmp)
|
||||
#define __flatbuffers_define_table_field(ID, N, NK, T, r)\
|
||||
static inline T N ## _ ## NK ## _get(N ## _table_t t__tmp)\
|
||||
__flatbuffers_table_field(T, ID, t__tmp, r)\
|
||||
static inline T N ## _ ## NK(N ## _table_t t__tmp)\
|
||||
__flatbuffers_table_field(T, ID, t__tmp, r)\
|
||||
static inline int N ## _ ## NK ## _is_present(N ## _table_t t__tmp)\
|
||||
__flatbuffers_field_present(ID, t__tmp)
|
||||
#define __flatbuffers_define_string_field(ID, N, NK, r)\
|
||||
static inline flatbuffers_string_t N ## _ ## NK ## _get(N ## _table_t t__tmp)\
|
||||
__flatbuffers_vector_field(flatbuffers_string_t, ID, t__tmp, r)\
|
||||
static inline flatbuffers_string_t N ## _ ## NK(N ## _table_t t__tmp)\
|
||||
__flatbuffers_vector_field(flatbuffers_string_t, ID, t__tmp, r)\
|
||||
static inline int N ## _ ## NK ## _is_present(N ## _table_t t__tmp)\
|
||||
__flatbuffers_field_present(ID, t__tmp)\
|
||||
__flatbuffers_define_scan_by_string_field(N, NK)
|
||||
#define __flatbuffers_vec_len(vec)\
|
||||
{ return (vec) ? (size_t)__flatbuffers_uoffset_read_from_pe((flatbuffers_uoffset_t *)vec - 1) : 0; }
|
||||
#define __flatbuffers_string_len(s) __flatbuffers_vec_len(s)
|
||||
static inline size_t flatbuffers_vec_len(const void *vec)
|
||||
__flatbuffers_vec_len(vec)
|
||||
#define __flatbuffers_scalar_vec_at(N, vec, i)\
|
||||
{ FLATCC_ASSERT(flatbuffers_vec_len(vec) > (i) && "index out of range");\
|
||||
return __flatbuffers_read_scalar(N, &(vec)[i]); }
|
||||
#define __flatbuffers_struct_vec_at(vec, i)\
|
||||
{ FLATCC_ASSERT(flatbuffers_vec_len(vec) > (i) && "index out of range"); return (vec) + (i); }
|
||||
/* `adjust` skips past the header for string vectors. */
|
||||
#define __flatbuffers_offset_vec_at(T, vec, i, adjust)\
|
||||
{ const flatbuffers_uoffset_t *elem__tmp = (vec) + (i);\
|
||||
FLATCC_ASSERT(flatbuffers_vec_len(vec) > (i) && "index out of range");\
|
||||
return (T)((uint8_t *)(elem__tmp) + (size_t)__flatbuffers_uoffset_read_from_pe(elem__tmp) + (adjust)); }
|
||||
#define __flatbuffers_define_scalar_vec_len(N)\
|
||||
static inline size_t N ## _vec_len(N ##_vec_t vec__tmp)\
|
||||
{ return flatbuffers_vec_len(vec__tmp); }
|
||||
#define __flatbuffers_define_scalar_vec_at(N, T) \
|
||||
static inline T N ## _vec_at(N ## _vec_t vec__tmp, size_t i__tmp)\
|
||||
__flatbuffers_scalar_vec_at(N, vec__tmp, i__tmp)
|
||||
typedef const char *flatbuffers_string_t;
|
||||
static inline size_t flatbuffers_string_len(flatbuffers_string_t s)
|
||||
__flatbuffers_string_len(s)
|
||||
typedef const flatbuffers_uoffset_t *flatbuffers_string_vec_t;
|
||||
typedef flatbuffers_uoffset_t *flatbuffers_string_mutable_vec_t;
|
||||
static inline size_t flatbuffers_string_vec_len(flatbuffers_string_vec_t vec)
|
||||
__flatbuffers_vec_len(vec)
|
||||
static inline flatbuffers_string_t flatbuffers_string_vec_at(flatbuffers_string_vec_t vec, size_t i)
|
||||
__flatbuffers_offset_vec_at(flatbuffers_string_t, vec, i, sizeof(vec[0]))
|
||||
typedef const void *flatbuffers_generic_t;
|
||||
typedef void *flatbuffers_mutable_generic_t;
|
||||
static inline flatbuffers_string_t flatbuffers_string_cast_from_generic(const flatbuffers_generic_t p)
|
||||
{ return p ? ((const char *)p) + __flatbuffers_uoffset__size() : 0; }
|
||||
typedef const flatbuffers_uoffset_t *flatbuffers_generic_vec_t;
|
||||
typedef flatbuffers_uoffset_t *flatbuffers_generic_table_mutable_vec_t;
|
||||
static inline size_t flatbuffers_generic_vec_len(flatbuffers_generic_vec_t vec)
|
||||
__flatbuffers_vec_len(vec)
|
||||
static inline flatbuffers_generic_t flatbuffers_generic_vec_at(flatbuffers_generic_vec_t vec, size_t i)
|
||||
__flatbuffers_offset_vec_at(flatbuffers_generic_t, vec, i, 0)
|
||||
static inline flatbuffers_generic_t flatbuffers_generic_vec_at_as_string(flatbuffers_generic_vec_t vec, size_t i)
|
||||
__flatbuffers_offset_vec_at(flatbuffers_generic_t, vec, i, sizeof(vec[0]))
|
||||
typedef struct flatbuffers_union {
|
||||
flatbuffers_union_type_t type;
|
||||
flatbuffers_generic_t value;
|
||||
} flatbuffers_union_t;
|
||||
typedef struct flatbuffers_union_vec {
|
||||
const flatbuffers_union_type_t *type;
|
||||
const flatbuffers_uoffset_t *value;
|
||||
} flatbuffers_union_vec_t;
|
||||
typedef struct flatbuffers_mutable_union {
|
||||
flatbuffers_union_type_t type;
|
||||
flatbuffers_mutable_generic_t value;
|
||||
} flatbuffers_mutable_union_t;
|
||||
typedef struct flatbuffers_mutable_union_vec {
|
||||
flatbuffers_union_type_t *type;
|
||||
flatbuffers_uoffset_t *value;
|
||||
} flatbuffers_mutable_union_vec_t;
|
||||
static inline flatbuffers_mutable_union_t flatbuffers_mutable_union_cast(flatbuffers_union_t u__tmp)\
|
||||
{ flatbuffers_mutable_union_t mu = { u__tmp.type, (flatbuffers_mutable_generic_t)u__tmp.value };\
|
||||
return mu; }
|
||||
static inline flatbuffers_mutable_union_vec_t flatbuffers_mutable_union_vec_cast(flatbuffers_union_vec_t uv__tmp)\
|
||||
{ flatbuffers_mutable_union_vec_t muv =\
|
||||
{ (flatbuffers_union_type_t *)uv__tmp.type, (flatbuffers_uoffset_t *)uv__tmp.value }; return muv; }
|
||||
#define __flatbuffers_union_type_field(ID, t)\
|
||||
{\
|
||||
__flatbuffers_read_vt(ID, offset__tmp, t)\
|
||||
return offset__tmp ? __flatbuffers_read_scalar_at_byteoffset(__flatbuffers_utype, t, offset__tmp) : 0;\
|
||||
}
|
||||
static inline flatbuffers_string_t flatbuffers_string_cast_from_union(const flatbuffers_union_t u__tmp)\
|
||||
{ return flatbuffers_string_cast_from_generic(u__tmp.value); }
|
||||
#define __flatbuffers_define_union_field(NS, ID, N, NK, T, r)\
|
||||
static inline T ## _union_type_t N ## _ ## NK ## _type_get(N ## _table_t t__tmp)\
|
||||
__## NS ## union_type_field(((ID) - 1), t__tmp)\
|
||||
static inline NS ## generic_t N ## _ ## NK ## _get(N ## _table_t t__tmp)\
|
||||
__## NS ## table_field(NS ## generic_t, ID, t__tmp, r)\
|
||||
static inline T ## _union_type_t N ## _ ## NK ## _type(N ## _table_t t__tmp)\
|
||||
__## NS ## union_type_field(((ID) - 1), t__tmp)\
|
||||
static inline NS ## generic_t N ## _ ## NK(N ## _table_t t__tmp)\
|
||||
__## NS ## table_field(NS ## generic_t, ID, t__tmp, r)\
|
||||
static inline int N ## _ ## NK ## _is_present(N ## _table_t t__tmp)\
|
||||
__## NS ## field_present(ID, t__tmp)\
|
||||
static inline T ## _union_t N ## _ ## NK ## _union(N ## _table_t t__tmp)\
|
||||
{ T ## _union_t u__tmp = { 0, 0 }; u__tmp.type = N ## _ ## NK ## _type_get(t__tmp);\
|
||||
if (u__tmp.type == 0) return u__tmp; u__tmp.value = N ## _ ## NK ## _get(t__tmp); return u__tmp; }\
|
||||
static inline NS ## string_t N ## _ ## NK ## _as_string(N ## _table_t t__tmp)\
|
||||
{ return NS ## string_cast_from_generic(N ## _ ## NK ## _get(t__tmp)); }\
|
||||
|
||||
#define __flatbuffers_define_union_vector_ops(NS, T)\
|
||||
static inline size_t T ## _union_vec_len(T ## _union_vec_t uv__tmp)\
|
||||
{ return NS ## vec_len(uv__tmp.type); }\
|
||||
static inline T ## _union_t T ## _union_vec_at(T ## _union_vec_t uv__tmp, size_t i__tmp)\
|
||||
{ T ## _union_t u__tmp = { 0, 0 }; size_t n__tmp = NS ## vec_len(uv__tmp.type);\
|
||||
FLATCC_ASSERT(n__tmp > (i__tmp) && "index out of range"); u__tmp.type = uv__tmp.type[i__tmp];\
|
||||
/* Unknown type is treated as NONE for schema evolution. */\
|
||||
if (u__tmp.type == 0) return u__tmp;\
|
||||
u__tmp.value = NS ## generic_vec_at(uv__tmp.value, i__tmp); return u__tmp; }\
|
||||
static inline NS ## string_t T ## _union_vec_at_as_string(T ## _union_vec_t uv__tmp, size_t i__tmp)\
|
||||
{ return (NS ## string_t) NS ## generic_vec_at_as_string(uv__tmp.value, i__tmp); }\
|
||||
|
||||
#define __flatbuffers_define_union_vector(NS, T)\
|
||||
typedef NS ## union_vec_t T ## _union_vec_t;\
|
||||
typedef NS ## mutable_union_vec_t T ## _mutable_union_vec_t;\
|
||||
static inline T ## _mutable_union_vec_t T ## _mutable_union_vec_cast(T ## _union_vec_t u__tmp)\
|
||||
{ return NS ## mutable_union_vec_cast(u__tmp); }\
|
||||
__## NS ## define_union_vector_ops(NS, T)
|
||||
#define __flatbuffers_define_union(NS, T)\
|
||||
typedef NS ## union_t T ## _union_t;\
|
||||
typedef NS ## mutable_union_t T ## _mutable_union_t;\
|
||||
static inline T ## _mutable_union_t T ## _mutable_union_cast(T ## _union_t u__tmp)\
|
||||
{ return NS ## mutable_union_cast(u__tmp); }\
|
||||
__## NS ## define_union_vector(NS, T)
|
||||
#define __flatbuffers_define_union_vector_field(NS, ID, N, NK, T, r)\
|
||||
__## NS ## define_vector_field(ID - 1, N, NK ## _type, T ## _vec_t, r)\
|
||||
__## NS ## define_vector_field(ID, N, NK, flatbuffers_generic_vec_t, r)\
|
||||
static inline T ## _union_vec_t N ## _ ## NK ## _union(N ## _table_t t__tmp)\
|
||||
{ T ## _union_vec_t uv__tmp; uv__tmp.type = N ## _ ## NK ## _type_get(t__tmp);\
|
||||
uv__tmp.value = N ## _ ## NK(t__tmp);\
|
||||
FLATCC_ASSERT(NS ## vec_len(uv__tmp.type) == NS ## vec_len(uv__tmp.value)\
|
||||
&& "union vector type length mismatch"); return uv__tmp; }
|
||||
#include <string.h>
|
||||
static const size_t flatbuffers_not_found = (size_t)-1;
|
||||
static const size_t flatbuffers_end = (size_t)-1;
|
||||
#define __flatbuffers_identity(n) (n)
|
||||
#define __flatbuffers_min(a, b) ((a) < (b) ? (a) : (b))
|
||||
/* Subtraction doesn't work for unsigned types. */
|
||||
#define __flatbuffers_scalar_cmp(x, y, n) ((x) < (y) ? -1 : (x) > (y))
|
||||
static inline int __flatbuffers_string_n_cmp(flatbuffers_string_t v, const char *s, size_t n)
|
||||
{ size_t nv = flatbuffers_string_len(v); int x = strncmp(v, s, nv < n ? nv : n);
|
||||
return x != 0 ? x : nv < n ? -1 : nv > n; }
|
||||
/* `n` arg unused, but needed by string find macro expansion. */
|
||||
static inline int __flatbuffers_string_cmp(flatbuffers_string_t v, const char *s, size_t n) { (void)n; return strcmp(v, s); }
|
||||
/* A = identity if searching scalar vectors rather than key fields. */
|
||||
/* Returns lowest matching index or not_found. */
|
||||
#define __flatbuffers_find_by_field(A, V, E, L, K, Kn, T, D)\
|
||||
{ T v__tmp; size_t a__tmp = 0, b__tmp, m__tmp; if (!(b__tmp = L(V))) { return flatbuffers_not_found; }\
|
||||
--b__tmp;\
|
||||
while (a__tmp < b__tmp) {\
|
||||
m__tmp = a__tmp + ((b__tmp - a__tmp) >> 1);\
|
||||
v__tmp = A(E(V, m__tmp));\
|
||||
if ((D(v__tmp, (K), (Kn))) < 0) {\
|
||||
a__tmp = m__tmp + 1;\
|
||||
} else {\
|
||||
b__tmp = m__tmp;\
|
||||
}\
|
||||
}\
|
||||
if (a__tmp == b__tmp) {\
|
||||
v__tmp = A(E(V, a__tmp));\
|
||||
if (D(v__tmp, (K), (Kn)) == 0) {\
|
||||
return a__tmp;\
|
||||
}\
|
||||
}\
|
||||
return flatbuffers_not_found;\
|
||||
}
|
||||
#define __flatbuffers_find_by_scalar_field(A, V, E, L, K, T)\
|
||||
__flatbuffers_find_by_field(A, V, E, L, K, 0, T, __flatbuffers_scalar_cmp)
|
||||
#define __flatbuffers_find_by_string_field(A, V, E, L, K)\
|
||||
__flatbuffers_find_by_field(A, V, E, L, K, 0, flatbuffers_string_t, __flatbuffers_string_cmp)
|
||||
#define __flatbuffers_find_by_string_n_field(A, V, E, L, K, Kn)\
|
||||
__flatbuffers_find_by_field(A, V, E, L, K, Kn, flatbuffers_string_t, __flatbuffers_string_n_cmp)
|
||||
#define __flatbuffers_define_find_by_scalar_field(N, NK, TK)\
|
||||
static inline size_t N ## _vec_find_by_ ## NK(N ## _vec_t vec__tmp, TK key__tmp)\
|
||||
__flatbuffers_find_by_scalar_field(N ## _ ## NK, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, TK)
|
||||
#define __flatbuffers_define_scalar_find(N, T)\
|
||||
static inline size_t N ## _vec_find(N ## _vec_t vec__tmp, T key__tmp)\
|
||||
__flatbuffers_find_by_scalar_field(__flatbuffers_identity, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T)
|
||||
#define __flatbuffers_define_find_by_string_field(N, NK) \
|
||||
/* Note: find only works on vectors sorted by this field. */\
|
||||
static inline size_t N ## _vec_find_by_ ## NK(N ## _vec_t vec__tmp, const char *s__tmp)\
|
||||
__flatbuffers_find_by_string_field(N ## _ ## NK, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp)\
|
||||
static inline size_t N ## _vec_find_n_by_ ## NK(N ## _vec_t vec__tmp, const char *s__tmp, size_t n__tmp)\
|
||||
__flatbuffers_find_by_string_n_field(N ## _ ## NK, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp, n__tmp)
|
||||
#define __flatbuffers_define_default_find_by_scalar_field(N, NK, TK)\
|
||||
static inline size_t N ## _vec_find(N ## _vec_t vec__tmp, TK key__tmp)\
|
||||
{ return N ## _vec_find_by_ ## NK(vec__tmp, key__tmp); }
|
||||
#define __flatbuffers_define_default_find_by_string_field(N, NK) \
|
||||
static inline size_t N ## _vec_find(N ## _vec_t vec__tmp, const char *s__tmp)\
|
||||
{ return N ## _vec_find_by_ ## NK(vec__tmp, s__tmp); }\
|
||||
static inline size_t N ## _vec_find_n(N ## _vec_t vec__tmp, const char *s__tmp, size_t n__tmp)\
|
||||
{ return N ## _vec_find_n_by_ ## NK(vec__tmp, s__tmp, n__tmp); }
|
||||
/* A = identity if searching scalar vectors rather than key fields. */
|
||||
/* Returns lowest matching index or not_found. */
|
||||
#define __flatbuffers_scan_by_field(b, e, A, V, E, L, K, Kn, T, D)\
|
||||
{ T v__tmp; size_t i__tmp;\
|
||||
for (i__tmp = b; i__tmp < e; ++i__tmp) {\
|
||||
v__tmp = A(E(V, i__tmp));\
|
||||
if (D(v__tmp, (K), (Kn)) == 0) {\
|
||||
return i__tmp;\
|
||||
}\
|
||||
}\
|
||||
return flatbuffers_not_found;\
|
||||
}
|
||||
#define __flatbuffers_rscan_by_field(b, e, A, V, E, L, K, Kn, T, D)\
|
||||
{ T v__tmp; size_t i__tmp = e;\
|
||||
while (i__tmp-- > b) {\
|
||||
v__tmp = A(E(V, i__tmp));\
|
||||
if (D(v__tmp, (K), (Kn)) == 0) {\
|
||||
return i__tmp;\
|
||||
}\
|
||||
}\
|
||||
return flatbuffers_not_found;\
|
||||
}
|
||||
#define __flatbuffers_scan_by_scalar_field(b, e, A, V, E, L, K, T)\
|
||||
__flatbuffers_scan_by_field(b, e, A, V, E, L, K, 0, T, __flatbuffers_scalar_cmp)
|
||||
#define __flatbuffers_scan_by_string_field(b, e, A, V, E, L, K)\
|
||||
__flatbuffers_scan_by_field(b, e, A, V, E, L, K, 0, flatbuffers_string_t, __flatbuffers_string_cmp)
|
||||
#define __flatbuffers_scan_by_string_n_field(b, e, A, V, E, L, K, Kn)\
|
||||
__flatbuffers_scan_by_field(b, e, A, V, E, L, K, Kn, flatbuffers_string_t, __flatbuffers_string_n_cmp)
|
||||
#define __flatbuffers_rscan_by_scalar_field(b, e, A, V, E, L, K, T)\
|
||||
__flatbuffers_rscan_by_field(b, e, A, V, E, L, K, 0, T, __flatbuffers_scalar_cmp)
|
||||
#define __flatbuffers_rscan_by_string_field(b, e, A, V, E, L, K)\
|
||||
__flatbuffers_rscan_by_field(b, e, A, V, E, L, K, 0, flatbuffers_string_t, __flatbuffers_string_cmp)
|
||||
#define __flatbuffers_rscan_by_string_n_field(b, e, A, V, E, L, K, Kn)\
|
||||
__flatbuffers_rscan_by_field(b, e, A, V, E, L, K, Kn, flatbuffers_string_t, __flatbuffers_string_n_cmp)
|
||||
#define __flatbuffers_define_scan_by_scalar_field(N, NK, T)\
|
||||
static inline size_t N ## _vec_scan_by_ ## NK(N ## _vec_t vec__tmp, T key__tmp)\
|
||||
__flatbuffers_scan_by_scalar_field(0, N ## _vec_len(vec__tmp), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T)\
|
||||
static inline size_t N ## _vec_scan_ex_by_ ## NK(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, T key__tmp)\
|
||||
__flatbuffers_scan_by_scalar_field(begin__tmp, __flatbuffers_min(end__tmp, N ## _vec_len(vec__tmp)), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T)\
|
||||
static inline size_t N ## _vec_rscan_by_ ## NK(N ## _vec_t vec__tmp, T key__tmp)\
|
||||
__flatbuffers_rscan_by_scalar_field(0, N ## _vec_len(vec__tmp), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T)\
|
||||
static inline size_t N ## _vec_rscan_ex_by_ ## NK(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, T key__tmp)\
|
||||
__flatbuffers_rscan_by_scalar_field(begin__tmp, __flatbuffers_min(end__tmp, N ## _vec_len(vec__tmp)), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T)
|
||||
#define __flatbuffers_define_scalar_scan(N, T)\
|
||||
static inline size_t N ## _vec_scan(N ## _vec_t vec__tmp, T key__tmp)\
|
||||
__flatbuffers_scan_by_scalar_field(0, N ## _vec_len(vec__tmp), __flatbuffers_identity, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T)\
|
||||
static inline size_t N ## _vec_scan_ex(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, T key__tmp)\
|
||||
__flatbuffers_scan_by_scalar_field(begin__tmp, __flatbuffers_min(end__tmp, N ## _vec_len(vec__tmp)), __flatbuffers_identity, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T)\
|
||||
static inline size_t N ## _vec_rscan(N ## _vec_t vec__tmp, T key__tmp)\
|
||||
__flatbuffers_rscan_by_scalar_field(0, N ## _vec_len(vec__tmp), __flatbuffers_identity, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T)\
|
||||
static inline size_t N ## _vec_rscan_ex(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, T key__tmp)\
|
||||
__flatbuffers_rscan_by_scalar_field(begin__tmp, __flatbuffers_min(end__tmp, N ## _vec_len(vec__tmp)), __flatbuffers_identity, vec__tmp, N ## _vec_at, N ## _vec_len, key__tmp, T)
|
||||
#define __flatbuffers_define_scan_by_string_field(N, NK) \
|
||||
static inline size_t N ## _vec_scan_by_ ## NK(N ## _vec_t vec__tmp, const char *s__tmp)\
|
||||
__flatbuffers_scan_by_string_field(0, N ## _vec_len(vec__tmp), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp)\
|
||||
static inline size_t N ## _vec_scan_n_by_ ## NK(N ## _vec_t vec__tmp, const char *s__tmp, size_t n__tmp)\
|
||||
__flatbuffers_scan_by_string_n_field(0, N ## _vec_len(vec__tmp), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp, n__tmp)\
|
||||
static inline size_t N ## _vec_scan_ex_by_ ## NK(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, const char *s__tmp)\
|
||||
__flatbuffers_scan_by_string_field(begin__tmp, __flatbuffers_min(end__tmp, N ## _vec_len(vec__tmp)), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp)\
|
||||
static inline size_t N ## _vec_scan_ex_n_by_ ## NK(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, const char *s__tmp, size_t n__tmp)\
|
||||
__flatbuffers_scan_by_string_n_field(begin__tmp, __flatbuffers_min( end__tmp, N ## _vec_len(vec__tmp)), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp, n__tmp)\
|
||||
static inline size_t N ## _vec_rscan_by_ ## NK(N ## _vec_t vec__tmp, const char *s__tmp)\
|
||||
__flatbuffers_rscan_by_string_field(0, N ## _vec_len(vec__tmp), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp)\
|
||||
static inline size_t N ## _vec_rscan_n_by_ ## NK(N ## _vec_t vec__tmp, const char *s__tmp, size_t n__tmp)\
|
||||
__flatbuffers_rscan_by_string_n_field(0, N ## _vec_len(vec__tmp), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp, n__tmp)\
|
||||
static inline size_t N ## _vec_rscan_ex_by_ ## NK(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, const char *s__tmp)\
|
||||
__flatbuffers_rscan_by_string_field(begin__tmp, __flatbuffers_min(end__tmp, N ## _vec_len(vec__tmp)), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp)\
|
||||
static inline size_t N ## _vec_rscan_ex_n_by_ ## NK(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, const char *s__tmp, size_t n__tmp)\
|
||||
__flatbuffers_rscan_by_string_n_field(begin__tmp, __flatbuffers_min( end__tmp, N ## _vec_len(vec__tmp)), N ## _ ## NK ## _get, vec__tmp, N ## _vec_at, N ## _vec_len, s__tmp, n__tmp)
|
||||
#define __flatbuffers_define_default_scan_by_scalar_field(N, NK, TK)\
|
||||
static inline size_t N ## _vec_scan(N ## _vec_t vec__tmp, TK key__tmp)\
|
||||
{ return N ## _vec_scan_by_ ## NK(vec__tmp, key__tmp); }\
|
||||
static inline size_t N ## _vec_scan_ex(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, TK key__tmp)\
|
||||
{ return N ## _vec_scan_ex_by_ ## NK(vec__tmp, begin__tmp, end__tmp, key__tmp); }\
|
||||
static inline size_t N ## _vec_rscan(N ## _vec_t vec__tmp, TK key__tmp)\
|
||||
{ return N ## _vec_rscan_by_ ## NK(vec__tmp, key__tmp); }\
|
||||
static inline size_t N ## _vec_rscan_ex(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, TK key__tmp)\
|
||||
{ return N ## _vec_rscan_ex_by_ ## NK(vec__tmp, begin__tmp, end__tmp, key__tmp); }
|
||||
#define __flatbuffers_define_default_scan_by_string_field(N, NK) \
|
||||
static inline size_t N ## _vec_scan(N ## _vec_t vec__tmp, const char *s__tmp)\
|
||||
{ return N ## _vec_scan_by_ ## NK(vec__tmp, s__tmp); }\
|
||||
static inline size_t N ## _vec_scan_n(N ## _vec_t vec__tmp, const char *s__tmp, size_t n__tmp)\
|
||||
{ return N ## _vec_scan_n_by_ ## NK(vec__tmp, s__tmp, n__tmp); }\
|
||||
static inline size_t N ## _vec_scan_ex(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, const char *s__tmp)\
|
||||
{ return N ## _vec_scan_ex_by_ ## NK(vec__tmp, begin__tmp, end__tmp, s__tmp); }\
|
||||
static inline size_t N ## _vec_scan_ex_n(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, const char *s__tmp, size_t n__tmp)\
|
||||
{ return N ## _vec_scan_ex_n_by_ ## NK(vec__tmp, begin__tmp, end__tmp, s__tmp, n__tmp); }\
|
||||
static inline size_t N ## _vec_rscan(N ## _vec_t vec__tmp, const char *s__tmp)\
|
||||
{ return N ## _vec_rscan_by_ ## NK(vec__tmp, s__tmp); }\
|
||||
static inline size_t N ## _vec_rscan_n(N ## _vec_t vec__tmp, const char *s__tmp, size_t n__tmp)\
|
||||
{ return N ## _vec_rscan_n_by_ ## NK(vec__tmp, s__tmp, n__tmp); }\
|
||||
static inline size_t N ## _vec_rscan_ex(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, const char *s__tmp)\
|
||||
{ return N ## _vec_rscan_ex_by_ ## NK(vec__tmp, begin__tmp, end__tmp, s__tmp); }\
|
||||
static inline size_t N ## _vec_rscan_ex_n(N ## _vec_t vec__tmp, size_t begin__tmp, size_t end__tmp, const char *s__tmp, size_t n__tmp)\
|
||||
{ return N ## _vec_rscan_ex_n_by_ ## NK(vec__tmp, begin__tmp, end__tmp, s__tmp, n__tmp); }
|
||||
#define __flatbuffers_heap_sort(N, X, A, E, L, TK, TE, D, S)\
|
||||
static inline void __ ## N ## X ## __heap_sift_down(\
|
||||
N ## _mutable_vec_t vec__tmp, size_t start__tmp, size_t end__tmp)\
|
||||
{ size_t child__tmp, root__tmp; TK v1__tmp, v2__tmp, vroot__tmp;\
|
||||
root__tmp = start__tmp;\
|
||||
while ((root__tmp << 1) <= end__tmp) {\
|
||||
child__tmp = root__tmp << 1;\
|
||||
if (child__tmp < end__tmp) {\
|
||||
v1__tmp = A(E(vec__tmp, child__tmp));\
|
||||
v2__tmp = A(E(vec__tmp, child__tmp + 1));\
|
||||
if (D(v1__tmp, v2__tmp) < 0) {\
|
||||
child__tmp++;\
|
||||
}\
|
||||
}\
|
||||
vroot__tmp = A(E(vec__tmp, root__tmp));\
|
||||
v1__tmp = A(E(vec__tmp, child__tmp));\
|
||||
if (D(vroot__tmp, v1__tmp) < 0) {\
|
||||
S(vec__tmp, root__tmp, child__tmp, TE);\
|
||||
root__tmp = child__tmp;\
|
||||
} else {\
|
||||
return;\
|
||||
}\
|
||||
}\
|
||||
}\
|
||||
static inline void __ ## N ## X ## __heap_sort(N ## _mutable_vec_t vec__tmp)\
|
||||
{ size_t start__tmp, end__tmp, size__tmp;\
|
||||
size__tmp = L(vec__tmp); if (size__tmp == 0) return; end__tmp = size__tmp - 1; start__tmp = size__tmp >> 1;\
|
||||
do { __ ## N ## X ## __heap_sift_down(vec__tmp, start__tmp, end__tmp); } while (start__tmp--);\
|
||||
while (end__tmp > 0) { \
|
||||
S(vec__tmp, 0, end__tmp, TE);\
|
||||
__ ## N ## X ## __heap_sift_down(vec__tmp, 0, --end__tmp); } }
|
||||
#define __flatbuffers_define_sort_by_field(N, NK, TK, TE, D, S)\
|
||||
__flatbuffers_heap_sort(N, _sort_by_ ## NK, N ## _ ## NK ## _get, N ## _vec_at, N ## _vec_len, TK, TE, D, S)\
|
||||
static inline void N ## _vec_sort_by_ ## NK(N ## _mutable_vec_t vec__tmp)\
|
||||
{ __ ## N ## _sort_by_ ## NK ## __heap_sort(vec__tmp); }
|
||||
#define __flatbuffers_define_sort(N, TK, TE, D, S)\
|
||||
__flatbuffers_heap_sort(N, , __flatbuffers_identity, N ## _vec_at, N ## _vec_len, TK, TE, D, S)\
|
||||
static inline void N ## _vec_sort(N ## _mutable_vec_t vec__tmp) { __ ## N ## __heap_sort(vec__tmp); }
|
||||
#define __flatbuffers_scalar_diff(x, y) ((x) < (y) ? -1 : (x) > (y))
|
||||
#define __flatbuffers_string_diff(x, y) __flatbuffers_string_n_cmp((x), (const char *)(y), flatbuffers_string_len(y))
|
||||
#define __flatbuffers_value_swap(vec, a, b, TE) { TE x__tmp = vec[b]; vec[b] = vec[a]; vec[a] = x__tmp; }
|
||||
#define __flatbuffers_uoffset_swap(vec, a, b, TE)\
|
||||
{ TE ta__tmp, tb__tmp, d__tmp;\
|
||||
d__tmp = (TE)((a - b) * sizeof(vec[0]));\
|
||||
ta__tmp = __flatbuffers_uoffset_read_from_pe(vec + b) - d__tmp;\
|
||||
tb__tmp = __flatbuffers_uoffset_read_from_pe(vec + a) + d__tmp;\
|
||||
__flatbuffers_uoffset_write_to_pe(vec + a, ta__tmp);\
|
||||
__flatbuffers_uoffset_write_to_pe(vec + b, tb__tmp); }
|
||||
#define __flatbuffers_scalar_swap(vec, a, b, TE) __flatbuffers_value_swap(vec, a, b, TE)
|
||||
#define __flatbuffers_string_swap(vec, a, b, TE) __flatbuffers_uoffset_swap(vec, a, b, TE)
|
||||
#define __flatbuffers_struct_swap(vec, a, b, TE) __flatbuffers_value_swap(vec, a, b, TE)
|
||||
#define __flatbuffers_table_swap(vec, a, b, TE) __flatbuffers_uoffset_swap(vec, a, b, TE)
|
||||
#define __flatbuffers_define_struct_sort_by_scalar_field(N, NK, TK, TE)\
|
||||
__flatbuffers_define_sort_by_field(N, NK, TK, TE, __flatbuffers_scalar_diff, __flatbuffers_struct_swap)
|
||||
#define __flatbuffers_define_table_sort_by_scalar_field(N, NK, TK)\
|
||||
__flatbuffers_define_sort_by_field(N, NK, TK, flatbuffers_uoffset_t, __flatbuffers_scalar_diff, __flatbuffers_table_swap)
|
||||
#define __flatbuffers_define_table_sort_by_string_field(N, NK)\
|
||||
__flatbuffers_define_sort_by_field(N, NK, flatbuffers_string_t, flatbuffers_uoffset_t, __flatbuffers_string_diff, __flatbuffers_table_swap)
|
||||
#define __flatbuffers_define_scalar_sort(N, T) __flatbuffers_define_sort(N, T, T, __flatbuffers_scalar_diff, __flatbuffers_scalar_swap)
|
||||
#define __flatbuffers_define_string_sort() __flatbuffers_define_sort(flatbuffers_string, flatbuffers_string_t, flatbuffers_uoffset_t, __flatbuffers_string_diff, __flatbuffers_string_swap)
|
||||
#define __flatbuffers_sort_vector_field(N, NK, T, t)\
|
||||
{ T ## _mutable_vec_t v__tmp = (T ## _mutable_vec_t) N ## _ ## NK ## _get(t);\
|
||||
if (v__tmp) T ## _vec_sort(v__tmp); }
|
||||
#define __flatbuffers_sort_table_field(N, NK, T, t)\
|
||||
{ T ## _sort((T ## _mutable_table_t)N ## _ ## NK ## _get(t)); }
|
||||
#define __flatbuffers_sort_union_field(N, NK, T, t)\
|
||||
{ T ## _sort(T ## _mutable_union_cast(N ## _ ## NK ## _union(t))); }
|
||||
#define __flatbuffers_sort_table_vector_field_elements(N, NK, T, t)\
|
||||
{ T ## _vec_t v__tmp = N ## _ ## NK ## _get(t); size_t i__tmp, n__tmp;\
|
||||
n__tmp = T ## _vec_len(v__tmp); for (i__tmp = 0; i__tmp < n__tmp; ++i__tmp) {\
|
||||
T ## _sort((T ## _mutable_table_t)T ## _vec_at(v__tmp, i__tmp)); }}
|
||||
#define __flatbuffers_sort_union_vector_field_elements(N, NK, T, t)\
|
||||
{ T ## _union_vec_t v__tmp = N ## _ ## NK ## _union(t); size_t i__tmp, n__tmp;\
|
||||
n__tmp = T ## _union_vec_len(v__tmp); for (i__tmp = 0; i__tmp < n__tmp; ++i__tmp) {\
|
||||
T ## _sort(T ## _mutable_union_cast(T ## _union_vec_at(v__tmp, i__tmp))); }}
|
||||
#define __flatbuffers_define_scalar_vector(N, T)\
|
||||
typedef const T *N ## _vec_t;\
|
||||
typedef T *N ## _mutable_vec_t;\
|
||||
__flatbuffers_define_scalar_vec_len(N)\
|
||||
__flatbuffers_define_scalar_vec_at(N, T)\
|
||||
__flatbuffers_define_scalar_find(N, T)\
|
||||
__flatbuffers_define_scalar_scan(N, T)\
|
||||
__flatbuffers_define_scalar_sort(N, T)
|
||||
|
||||
#define __flatbuffers_define_integer_type(N, T, W)\
|
||||
__flatcc_define_integer_accessors(N, T, W, flatbuffers_endian)\
|
||||
__flatbuffers_define_scalar_vector(N, T)
|
||||
__flatbuffers_define_scalar_vector(flatbuffers_bool, flatbuffers_bool_t)
|
||||
__flatbuffers_define_scalar_vector(flatbuffers_char, char)
|
||||
__flatbuffers_define_scalar_vector(flatbuffers_uint8, uint8_t)
|
||||
__flatbuffers_define_scalar_vector(flatbuffers_int8, int8_t)
|
||||
__flatbuffers_define_scalar_vector(flatbuffers_uint16, uint16_t)
|
||||
__flatbuffers_define_scalar_vector(flatbuffers_int16, int16_t)
|
||||
__flatbuffers_define_scalar_vector(flatbuffers_uint32, uint32_t)
|
||||
__flatbuffers_define_scalar_vector(flatbuffers_int32, int32_t)
|
||||
__flatbuffers_define_scalar_vector(flatbuffers_uint64, uint64_t)
|
||||
__flatbuffers_define_scalar_vector(flatbuffers_int64, int64_t)
|
||||
__flatbuffers_define_scalar_vector(flatbuffers_float, float)
|
||||
__flatbuffers_define_scalar_vector(flatbuffers_double, double)
|
||||
__flatbuffers_define_scalar_vector(flatbuffers_union_type, flatbuffers_union_type_t)
|
||||
static inline size_t flatbuffers_string_vec_find(flatbuffers_string_vec_t vec, const char *s)
|
||||
__flatbuffers_find_by_string_field(__flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s)
|
||||
static inline size_t flatbuffers_string_vec_find_n(flatbuffers_string_vec_t vec, const char *s, size_t n)
|
||||
__flatbuffers_find_by_string_n_field(__flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s, n)
|
||||
static inline size_t flatbuffers_string_vec_scan(flatbuffers_string_vec_t vec, const char *s)
|
||||
__flatbuffers_scan_by_string_field(0, flatbuffers_string_vec_len(vec), __flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s)
|
||||
static inline size_t flatbuffers_string_vec_scan_n(flatbuffers_string_vec_t vec, const char *s, size_t n)
|
||||
__flatbuffers_scan_by_string_n_field(0, flatbuffers_string_vec_len(vec), __flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s, n)
|
||||
static inline size_t flatbuffers_string_vec_scan_ex(flatbuffers_string_vec_t vec, size_t begin, size_t end, const char *s)
|
||||
__flatbuffers_scan_by_string_field(begin, __flatbuffers_min(end, flatbuffers_string_vec_len(vec)), __flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s)
|
||||
static inline size_t flatbuffers_string_vec_scan_ex_n(flatbuffers_string_vec_t vec, size_t begin, size_t end, const char *s, size_t n)
|
||||
__flatbuffers_scan_by_string_n_field(begin, __flatbuffers_min(end, flatbuffers_string_vec_len(vec)), __flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s, n)
|
||||
static inline size_t flatbuffers_string_vec_rscan(flatbuffers_string_vec_t vec, const char *s)
|
||||
__flatbuffers_rscan_by_string_field(0, flatbuffers_string_vec_len(vec), __flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s)
|
||||
static inline size_t flatbuffers_string_vec_rscan_n(flatbuffers_string_vec_t vec, const char *s, size_t n)
|
||||
__flatbuffers_rscan_by_string_n_field(0, flatbuffers_string_vec_len(vec), __flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s, n)
|
||||
static inline size_t flatbuffers_string_vec_rscan_ex(flatbuffers_string_vec_t vec, size_t begin, size_t end, const char *s)
|
||||
__flatbuffers_rscan_by_string_field(begin, __flatbuffers_min(end, flatbuffers_string_vec_len(vec)), __flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s)
|
||||
static inline size_t flatbuffers_string_vec_rscan_ex_n(flatbuffers_string_vec_t vec, size_t begin, size_t end, const char *s, size_t n)
|
||||
__flatbuffers_rscan_by_string_n_field(begin, __flatbuffers_min(end, flatbuffers_string_vec_len(vec)), __flatbuffers_identity, vec, flatbuffers_string_vec_at, flatbuffers_string_vec_len, s, n)
|
||||
__flatbuffers_define_string_sort()
|
||||
#define __flatbuffers_define_struct_scalar_fixed_array_field(N, NK, TK, T, L)\
|
||||
static inline T N ## _ ## NK ## _get(N ## _struct_t t__tmp, size_t i__tmp)\
|
||||
{ if (!t__tmp || i__tmp >= L) return 0;\
|
||||
return __flatbuffers_read_scalar(TK, &(t__tmp->NK[i__tmp])); }\
|
||||
static inline const T *N ## _ ## NK ## _get_ptr(N ## _struct_t t__tmp)\
|
||||
{ return t__tmp ? t__tmp->NK : 0; }\
|
||||
static inline size_t N ## _ ## NK ## _get_len(void) { return L; }\
|
||||
static inline T N ## _ ## NK (N ## _struct_t t__tmp, size_t i__tmp)\
|
||||
{ return N ## _ ## NK ## _get(t__tmp, i__tmp); }
|
||||
#define __flatbuffers_define_struct_struct_fixed_array_field(N, NK, T, L)\
|
||||
static inline T N ## _ ## NK ## _get(N ## _struct_t t__tmp, size_t i__tmp)\
|
||||
{ if (!t__tmp || i__tmp >= L) return 0; return t__tmp->NK + i__tmp; }static inline T N ## _ ## NK ## _get_ptr(N ## _struct_t t__tmp)\
|
||||
{ return t__tmp ? t__tmp->NK : 0; }\
|
||||
static inline size_t N ## _ ## NK ## _get_len(void) { return L; }\
|
||||
static inline T N ## _ ## NK(N ## _struct_t t__tmp, size_t i__tmp)\
|
||||
{ if (!t__tmp || i__tmp >= L) return 0; return t__tmp->NK + i__tmp; }
|
||||
#define __flatbuffers_define_struct_scalar_field(N, NK, TK, T)\
|
||||
static inline T N ## _ ## NK ## _get(N ## _struct_t t__tmp)\
|
||||
{ return t__tmp ? __flatbuffers_read_scalar(TK, &(t__tmp->NK)) : 0; }\
|
||||
static inline const T *N ## _ ## NK ## _get_ptr(N ## _struct_t t__tmp)\
|
||||
{ return t__tmp ? &(t__tmp->NK) : 0; }\
|
||||
static inline T N ## _ ## NK (N ## _struct_t t__tmp)\
|
||||
{ return t__tmp ? __flatbuffers_read_scalar(TK, &(t__tmp->NK)) : 0; }\
|
||||
__flatbuffers_define_scan_by_scalar_field(N, NK, T)
|
||||
#define __flatbuffers_define_struct_struct_field(N, NK, T)\
|
||||
static inline T N ## _ ## NK ## _get(N ## _struct_t t__tmp) { return t__tmp ? &(t__tmp->NK) : 0; }\
|
||||
static inline T N ## _ ## NK (N ## _struct_t t__tmp) { return t__tmp ? &(t__tmp->NK) : 0; }
|
||||
/* If fid is null, the function returns true without testing as buffer is not expected to have any id. */
|
||||
static inline int flatbuffers_has_identifier(const void *buffer, const char *fid)
|
||||
{ flatbuffers_thash_t id, id2 = 0; if (fid == 0) { return 1; };
|
||||
id2 = flatbuffers_type_hash_from_string(fid);
|
||||
id = __flatbuffers_thash_read_from_pe(((flatbuffers_uoffset_t *)buffer) + 1);
|
||||
return id2 == 0 || id == id2; }
|
||||
static inline int flatbuffers_has_type_hash(const void *buffer, flatbuffers_thash_t thash)
|
||||
{ return thash == 0 || (__flatbuffers_thash_read_from_pe((flatbuffers_uoffset_t *)buffer + 1) == thash); }
|
||||
|
||||
static inline flatbuffers_thash_t flatbuffers_get_type_hash(const void *buffer)
|
||||
{ return __flatbuffers_thash_read_from_pe((flatbuffers_uoffset_t *)buffer + 1); }
|
||||
|
||||
#define flatbuffers_verify_endian() flatbuffers_has_identifier("\x00\x00\x00\x00" "1234", "1234")
|
||||
static inline void *flatbuffers_read_size_prefix(void *b, size_t *size_out)
|
||||
{ if (size_out) { *size_out = (size_t)__flatbuffers_uoffset_read_from_pe(b); }
|
||||
return (uint8_t *)b + sizeof(flatbuffers_uoffset_t); }
|
||||
/* Null file identifier accepts anything, otherwise fid should be 4 characters. */
|
||||
#define __flatbuffers_read_root(T, K, buffer, fid)\
|
||||
((!buffer || !flatbuffers_has_identifier(buffer, fid)) ? 0 :\
|
||||
((T ## _ ## K ## t)(((uint8_t *)buffer) +\
|
||||
__flatbuffers_uoffset_read_from_pe(buffer))))
|
||||
#define __flatbuffers_read_typed_root(T, K, buffer, thash)\
|
||||
((!buffer || !flatbuffers_has_type_hash(buffer, thash)) ? 0 :\
|
||||
((T ## _ ## K ## t)(((uint8_t *)buffer) +\
|
||||
__flatbuffers_uoffset_read_from_pe(buffer))))
|
||||
#define __flatbuffers_nested_buffer_as_root(C, N, T, K)\
|
||||
static inline T ## _ ## K ## t C ## _ ## N ## _as_root_with_identifier(C ## _ ## table_t t__tmp, const char *fid__tmp)\
|
||||
{ const uint8_t *buffer__tmp = C ## _ ## N(t__tmp); return __flatbuffers_read_root(T, K, buffer__tmp, fid__tmp); }\
|
||||
static inline T ## _ ## K ## t C ## _ ## N ## _as_typed_root(C ## _ ## table_t t__tmp)\
|
||||
{ const uint8_t *buffer__tmp = C ## _ ## N(t__tmp); return __flatbuffers_read_root(T, K, buffer__tmp, C ## _ ## type_identifier); }\
|
||||
static inline T ## _ ## K ## t C ## _ ## N ## _as_root(C ## _ ## table_t t__tmp)\
|
||||
{ const char *fid__tmp = T ## _file_identifier;\
|
||||
const uint8_t *buffer__tmp = C ## _ ## N(t__tmp); return __flatbuffers_read_root(T, K, buffer__tmp, fid__tmp); }
|
||||
#define __flatbuffers_buffer_as_root(N, K)\
|
||||
static inline N ## _ ## K ## t N ## _as_root_with_identifier(const void *buffer__tmp, const char *fid__tmp)\
|
||||
{ return __flatbuffers_read_root(N, K, buffer__tmp, fid__tmp); }\
|
||||
static inline N ## _ ## K ## t N ## _as_root_with_type_hash(const void *buffer__tmp, flatbuffers_thash_t thash__tmp)\
|
||||
{ return __flatbuffers_read_typed_root(N, K, buffer__tmp, thash__tmp); }\
|
||||
static inline N ## _ ## K ## t N ## _as_root(const void *buffer__tmp)\
|
||||
{ const char *fid__tmp = N ## _file_identifier;\
|
||||
return __flatbuffers_read_root(N, K, buffer__tmp, fid__tmp); }\
|
||||
static inline N ## _ ## K ## t N ## _as_typed_root(const void *buffer__tmp)\
|
||||
{ return __flatbuffers_read_typed_root(N, K, buffer__tmp, N ## _type_hash); }
|
||||
#define __flatbuffers_struct_as_root(N) __flatbuffers_buffer_as_root(N, struct_)
|
||||
#define __flatbuffers_table_as_root(N) __flatbuffers_buffer_as_root(N, table_)
|
||||
|
||||
#include "flatcc/flatcc_epilogue.h"
|
||||
#endif /* FLATBUFFERS_COMMON_H */
|
||||
411
executables/mac_sm/ie/mac_data_ie.c
Normal file
411
executables/mac_sm/ie/mac_data_ie.c
Normal file
@@ -0,0 +1,411 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#include "mac_data_ie.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "../../../util/alg_ds/alg/eq_float.h"
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Event Trigger Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_mac_event_trigger(mac_event_trigger_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
assert(0!=0 && "Not implemented" );
|
||||
}
|
||||
|
||||
mac_event_trigger_t cp_mac_event_trigger( mac_event_trigger_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
assert(0!=0 && "Not implemented" );
|
||||
|
||||
mac_event_trigger_t et = {0};
|
||||
return et;
|
||||
}
|
||||
|
||||
bool eq_mac_event_trigger(mac_event_trigger_t* m0, mac_event_trigger_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Action Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_mac_action_def(mac_action_def_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
}
|
||||
|
||||
mac_action_def_t cp_mac_action_def(mac_action_def_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
mac_action_def_t ad = {0};
|
||||
return ad;
|
||||
}
|
||||
|
||||
bool eq_mac_action_def(mac_event_trigger_t* m0, mac_event_trigger_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Indication Header
|
||||
/////////////////////////////////////
|
||||
|
||||
|
||||
void free_mac_ind_hdr(mac_ind_hdr_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
(void)src;
|
||||
}
|
||||
|
||||
mac_ind_hdr_t cp_mac_ind_hdr(mac_ind_hdr_t const* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
mac_ind_hdr_t dst = {0};
|
||||
dst.dummy = src->dummy;
|
||||
return dst;
|
||||
}
|
||||
|
||||
bool eq_mac_ind_hdr(mac_ind_hdr_t* m0, mac_ind_hdr_t* m1)
|
||||
{
|
||||
assert(m0 != 0);
|
||||
assert(m1 != 0);
|
||||
|
||||
if(m0->dummy != m1->dummy)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Indication Message
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_mac_ind_msg(mac_ind_msg_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
if(src->len_ue_stats > 0){
|
||||
assert(src->ue_stats != NULL);
|
||||
free(src->ue_stats);
|
||||
}
|
||||
}
|
||||
|
||||
mac_ue_stats_impl_t cp_mac_ue_stats_impl(mac_ue_stats_impl_t const* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
mac_ue_stats_impl_t dst = { .dl_aggr_tbs = src->dl_aggr_tbs,
|
||||
.ul_aggr_tbs = src->ul_aggr_tbs,
|
||||
.dl_aggr_bytes_sdus = src->dl_aggr_bytes_sdus,
|
||||
.ul_aggr_bytes_sdus = src->ul_aggr_bytes_sdus,
|
||||
|
||||
.pusch_snr = src->pusch_snr, //: float = -64;
|
||||
.pucch_snr = src->pucch_snr, //: float = -64;
|
||||
|
||||
.rnti = src->rnti,
|
||||
.dl_aggr_prb = src->dl_aggr_prb,
|
||||
.ul_aggr_prb = src->ul_aggr_prb,
|
||||
.dl_aggr_sdus = src->dl_aggr_sdus,
|
||||
.ul_aggr_sdus = src->ul_aggr_sdus,
|
||||
.dl_aggr_retx_prb = src->dl_aggr_retx_prb,
|
||||
|
||||
.wb_cqi = src->wb_cqi,
|
||||
.dl_mcs1 = src->dl_mcs1,
|
||||
.ul_mcs1 = src->ul_mcs1,
|
||||
.dl_mcs2 = src->dl_mcs2,
|
||||
.ul_mcs2 = src->ul_mcs2,
|
||||
.phr = src->phr
|
||||
};
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
mac_ind_msg_t cp_mac_ind_msg( mac_ind_msg_t const* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
mac_ind_msg_t dst = {0};
|
||||
|
||||
dst.len_ue_stats = src->len_ue_stats;
|
||||
if(dst.len_ue_stats > 0){
|
||||
dst.ue_stats = calloc(dst.len_ue_stats, sizeof( mac_ue_stats_impl_t) );
|
||||
assert(dst.ue_stats != NULL && "Memory exhausted");
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < dst.len_ue_stats; ++i){
|
||||
dst.ue_stats[i] = cp_mac_ue_stats_impl(&src->ue_stats[i]);
|
||||
}
|
||||
|
||||
//memcpy(ret.ue_stats, src->ue_stats, sizeof( mac_ue_stats_impl_t )*ret.len_ue_stats);
|
||||
|
||||
dst.tstamp = src->tstamp;
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
bool eq_mac_ind_msg(mac_ind_msg_t* m0, mac_ind_msg_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
if(m0->len_ue_stats != m1->len_ue_stats || m0->tstamp != m1->tstamp)
|
||||
return false;
|
||||
|
||||
for(uint32_t i = 0 ; i < m0->len_ue_stats; ++i){
|
||||
mac_ue_stats_impl_t* ue0 = &m0->ue_stats[i];
|
||||
mac_ue_stats_impl_t* ue1 = &m1->ue_stats[i];
|
||||
|
||||
if(
|
||||
ue0->dl_aggr_tbs != ue1->dl_aggr_tbs ||
|
||||
ue0->ul_aggr_tbs != ue1->ul_aggr_tbs ||
|
||||
ue0->dl_aggr_bytes_sdus != ue1->dl_aggr_bytes_sdus ||
|
||||
ue0->ul_aggr_bytes_sdus != ue1->ul_aggr_bytes_sdus ||
|
||||
ue0->rnti != ue1->rnti ||
|
||||
ue0->dl_aggr_prb != ue1->dl_aggr_prb ||
|
||||
ue0->ul_aggr_prb != ue1->ul_aggr_prb ||
|
||||
ue0->dl_aggr_sdus != ue1-> dl_aggr_sdus ||
|
||||
ue0->ul_aggr_sdus != ue1->ul_aggr_sdus ||
|
||||
ue0->dl_aggr_retx_prb != ue1->dl_aggr_retx_prb ||
|
||||
ue0->wb_cqi != ue1->wb_cqi ||
|
||||
ue0->dl_mcs1 != ue1->dl_mcs1 ||
|
||||
ue0->ul_mcs1 != ue1->ul_mcs1 ||
|
||||
ue0->dl_mcs2 != ue1->dl_mcs2 ||
|
||||
ue0->ul_mcs2 != ue1->ul_mcs2 ||
|
||||
ue0->phr != ue1->phr ||
|
||||
eq_float(ue0->pusch_snr, ue1->pusch_snr, 0.0000001) == false ||
|
||||
eq_float(ue0->pucch_snr, ue0->pucch_snr, 0.0000001) == false
|
||||
)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Call Process ID
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_mac_call_proc_id(mac_call_proc_id_t* src)
|
||||
{
|
||||
// Note that the src could be NULL
|
||||
free(src);
|
||||
}
|
||||
|
||||
mac_call_proc_id_t cp_mac_call_proc_id( mac_call_proc_id_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
mac_call_proc_id_t dst = {0};
|
||||
|
||||
dst.dummy = src->dummy;
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
bool eq_mac_call_proc_id(mac_call_proc_id_t* m0, mac_call_proc_id_t* m1)
|
||||
{
|
||||
if(m0 == NULL && m1 == NULL)
|
||||
return true;
|
||||
if(m0 == NULL)
|
||||
return false;
|
||||
if(m1 == NULL)
|
||||
return false;
|
||||
|
||||
if(m0->dummy != m1->dummy)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Header
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_mac_ctrl_hdr( mac_ctrl_hdr_t* src)
|
||||
{
|
||||
|
||||
assert(src != NULL);
|
||||
assert(0!=0 && "Not implemented" );
|
||||
}
|
||||
|
||||
mac_ctrl_hdr_t cp_mac_ctrl_hdr(mac_ctrl_hdr_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
assert(0!=0 && "Not implemented" );
|
||||
mac_ctrl_hdr_t ret = {0};
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool eq_mac_ctrl_hdr(mac_ctrl_hdr_t* m0, mac_ctrl_hdr_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Message
|
||||
/////////////////////////////////////
|
||||
|
||||
|
||||
void free_mac_ctrl_msg( mac_ctrl_msg_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
}
|
||||
|
||||
mac_ctrl_msg_t cp_mac_ctrl_msg(mac_ctrl_msg_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
mac_ctrl_msg_t ret = {0};
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool eq_mac_ctrl_msg(mac_ctrl_msg_t* m0, mac_ctrl_msg_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Outcome
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_mac_ctrl_out(mac_ctrl_out_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
}
|
||||
|
||||
mac_ctrl_out_t cp_mac_ctrl_out(mac_ctrl_out_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
mac_ctrl_out_t ret = {0};
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool eq_mac_ctrl_out(mac_ctrl_out_t* m0, mac_ctrl_out_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RAN Function Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_mac_func_def( mac_func_def_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
}
|
||||
|
||||
mac_func_def_t cp_mac_func_def(mac_func_def_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
mac_func_def_t ret = {0};
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool eq_mac_func_def(mac_func_def_t* m0, mac_func_def_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////
|
||||
// RIC Indication
|
||||
///////////////
|
||||
|
||||
mac_ind_data_t cp_mac_ind_data( mac_ind_data_t const* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
mac_ind_data_t dst = {0};
|
||||
dst.hdr = cp_mac_ind_hdr(&src->hdr);
|
||||
dst.msg = cp_mac_ind_msg(&src->msg);
|
||||
|
||||
if(src->proc_id != NULL){
|
||||
dst.proc_id = malloc(sizeof(mac_call_proc_id_t));
|
||||
assert(dst.proc_id != NULL && "Memory exhausted");
|
||||
*dst.proc_id = cp_mac_call_proc_id(src->proc_id);
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
void free_mac_ind_data(mac_ind_data_t* ind)
|
||||
{
|
||||
assert(ind != NULL);
|
||||
free_mac_ind_hdr(&ind->hdr);
|
||||
free_mac_ind_msg(&ind->msg);
|
||||
free_mac_call_proc_id(ind->proc_id);
|
||||
}
|
||||
|
||||
|
||||
280
executables/mac_sm/ie/mac_data_ie.h
Normal file
280
executables/mac_sm/ie/mac_data_ie.h
Normal file
@@ -0,0 +1,280 @@
|
||||
/*
|
||||
* 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 MAC_DATA_INFORMATION_ELEMENTS_H
|
||||
#define MAC_DATA_INFORMATION_ELEMENTS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 9 Information Elements (IE) , RIC Event Trigger Definition, RIC Action Definition, RIC Indication Header, RIC Indication Message, RIC Call Process ID, RIC Control Header, RIC Control Message, RIC Control Outcome and RAN Function Definition defined by ORAN-WG3.E2SM-v01.00.00 at Section 5
|
||||
*/
|
||||
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Event Trigger Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct {
|
||||
uint32_t ms;
|
||||
} mac_event_trigger_t;
|
||||
|
||||
void free_mac_event_trigger(mac_event_trigger_t* src);
|
||||
|
||||
mac_event_trigger_t cp_mac_event_trigger( mac_event_trigger_t* src);
|
||||
|
||||
bool eq_mac_event_trigger(mac_event_trigger_t* m0, mac_event_trigger_t* m1);
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Action Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint32_t dummy;
|
||||
} mac_action_def_t;
|
||||
|
||||
void free_mac_action_def(mac_action_def_t* src);
|
||||
|
||||
mac_action_def_t cp_mac_action_def(mac_action_def_t* src);
|
||||
|
||||
bool eq_mac_action_def(mac_event_trigger_t* m0, mac_event_trigger_t* m1);
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Indication Header
|
||||
/////////////////////////////////////
|
||||
|
||||
|
||||
typedef struct{
|
||||
uint32_t dummy;
|
||||
} mac_ind_hdr_t;
|
||||
|
||||
void free_mac_ind_hdr(mac_ind_hdr_t* src);
|
||||
|
||||
mac_ind_hdr_t cp_mac_ind_hdr(mac_ind_hdr_t const* src);
|
||||
|
||||
bool eq_mac_ind_hdr(mac_ind_hdr_t* m0, mac_ind_hdr_t* m1);
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Indication Message
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint64_t dl_aggr_tbs;
|
||||
uint64_t ul_aggr_tbs;
|
||||
uint64_t dl_aggr_bytes_sdus;
|
||||
uint64_t ul_aggr_bytes_sdus;
|
||||
|
||||
float pusch_snr; //: float = -64;
|
||||
float pucch_snr; //: float = -64;
|
||||
|
||||
uint32_t rnti;
|
||||
uint32_t dl_aggr_prb;
|
||||
uint32_t ul_aggr_prb;
|
||||
uint32_t dl_aggr_sdus;
|
||||
uint32_t ul_aggr_sdus;
|
||||
uint32_t dl_aggr_retx_prb;
|
||||
|
||||
uint8_t wb_cqi;
|
||||
uint8_t dl_mcs1;
|
||||
uint8_t ul_mcs1;
|
||||
uint8_t dl_mcs2;
|
||||
uint8_t ul_mcs2;
|
||||
int8_t phr;
|
||||
} mac_ue_stats_impl_t;
|
||||
|
||||
mac_ue_stats_impl_t cp_mac_ue_stats_impl(mac_ue_stats_impl_t const* src);
|
||||
|
||||
typedef struct {
|
||||
uint32_t len_ue_stats;
|
||||
mac_ue_stats_impl_t* ue_stats;
|
||||
int64_t tstamp;
|
||||
} mac_ind_msg_t;
|
||||
|
||||
void free_mac_ind_msg(mac_ind_msg_t* src);
|
||||
|
||||
mac_ind_msg_t cp_mac_ind_msg(mac_ind_msg_t const* src);
|
||||
|
||||
bool eq_mac_ind_msg(mac_ind_msg_t* m0, mac_ind_msg_t* m1);
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Call Process ID
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct {
|
||||
uint32_t dummy;
|
||||
} mac_call_proc_id_t;
|
||||
|
||||
void free_mac_call_proc_id( mac_call_proc_id_t* src);
|
||||
|
||||
mac_call_proc_id_t cp_mac_call_proc_id( mac_call_proc_id_t* src);
|
||||
|
||||
bool eq_mac_call_proc_id(mac_call_proc_id_t* m0, mac_call_proc_id_t* m1);
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Header
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct {
|
||||
uint32_t dummy;
|
||||
} mac_ctrl_hdr_t;
|
||||
|
||||
void free_mac_ctrl_hdr( mac_ctrl_hdr_t* src);
|
||||
|
||||
mac_ctrl_hdr_t cp_mac_ctrl_hdr(mac_ctrl_hdr_t* src);
|
||||
|
||||
bool eq_mac_ctrl_hdr(mac_ctrl_hdr_t* m0, mac_ctrl_hdr_t* m1);
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Message
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct {
|
||||
uint32_t action;
|
||||
} mac_ctrl_msg_t;
|
||||
|
||||
void free_mac_ctrl_msg( mac_ctrl_msg_t* src);
|
||||
|
||||
mac_ctrl_msg_t cp_mac_ctrl_msg(mac_ctrl_msg_t* src);
|
||||
|
||||
bool eq_mac_ctrl_msg(mac_ctrl_msg_t* m0, mac_ctrl_msg_t* m1);
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Outcome
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef enum{
|
||||
MAC_CTRL_OUT_OK,
|
||||
|
||||
|
||||
MAC_CTRL_OUT_END
|
||||
} mac_ctrl_out_e;
|
||||
|
||||
typedef struct {
|
||||
mac_ctrl_out_e ans;
|
||||
} mac_ctrl_out_t;
|
||||
|
||||
void free_mac_ctrl_out(mac_ctrl_out_t* src);
|
||||
|
||||
mac_ctrl_out_t cp_mac_ctrl_out(mac_ctrl_out_t* src);
|
||||
|
||||
bool eq_mac_ctrl_out(mac_ctrl_out_t* m0, mac_ctrl_out_t* m1);
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RAN Function Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct {
|
||||
uint32_t dummy;
|
||||
} mac_func_def_t;
|
||||
|
||||
void free_mac_func_def( mac_func_def_t* src);
|
||||
|
||||
mac_func_def_t cp_mac_func_def(mac_func_def_t* src);
|
||||
|
||||
bool eq_mac_func_def(mac_func_def_t* m0, mac_func_def_t* m1);
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
/*
|
||||
* O-RAN defined 5 Procedures: RIC Subscription, RIC Indication, RIC Control, E2 Setup and RIC Service Update
|
||||
* */
|
||||
|
||||
|
||||
///////////////
|
||||
/// RIC Subscription
|
||||
///////////////
|
||||
|
||||
typedef struct{
|
||||
mac_event_trigger_t et;
|
||||
mac_action_def_t* ad;
|
||||
} mac_sub_data_t;
|
||||
|
||||
///////////////
|
||||
// RIC Indication
|
||||
///////////////
|
||||
|
||||
typedef struct{
|
||||
mac_ind_hdr_t hdr;
|
||||
mac_ind_msg_t msg;
|
||||
mac_call_proc_id_t* proc_id;
|
||||
} mac_ind_data_t;
|
||||
|
||||
mac_ind_data_t cp_mac_ind_data( mac_ind_data_t const* src);
|
||||
|
||||
void free_mac_ind_data(mac_ind_data_t* ind);
|
||||
|
||||
///////////////
|
||||
// RIC Control
|
||||
///////////////
|
||||
|
||||
typedef struct{
|
||||
mac_ctrl_hdr_t hdr;
|
||||
mac_ctrl_msg_t msg;
|
||||
} mac_ctrl_req_data_t;
|
||||
|
||||
typedef struct{
|
||||
mac_ctrl_out_t* out;
|
||||
} mac_ctrl_out_data_t;
|
||||
|
||||
///////////////
|
||||
// E2 Setup
|
||||
///////////////
|
||||
|
||||
typedef struct{
|
||||
mac_func_def_t func_def;
|
||||
} mac_e2_setup_data_t;
|
||||
|
||||
///////////////
|
||||
// RIC Service Update
|
||||
///////////////
|
||||
|
||||
typedef struct{
|
||||
mac_func_def_t func_def;
|
||||
} mac_ric_service_update_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
211
executables/mac_sm/mac_sm_agent.c
Normal file
211
executables/mac_sm/mac_sm_agent.c
Normal file
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "mac_sm_agent.h"
|
||||
#include "mac_sm_id.h"
|
||||
#include "enc/mac_enc_generic.h"
|
||||
#include "dec/mac_dec_generic.h"
|
||||
#include "../../util/alg_ds/alg/defer.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct{
|
||||
|
||||
sm_agent_t base;
|
||||
|
||||
#ifdef ASN
|
||||
mac_enc_asn_t enc;
|
||||
#elif FLATBUFFERS
|
||||
mac_enc_fb_t enc;
|
||||
#elif PLAIN
|
||||
mac_enc_plain_t enc;
|
||||
#else
|
||||
static_assert(false, "No encryptioin type selected");
|
||||
#endif
|
||||
|
||||
} sm_mac_agent_t;
|
||||
|
||||
|
||||
// Function pointers provided by the RAN for the
|
||||
// 5 procedures,
|
||||
// subscription, indication, control,
|
||||
// E2 Setup and RIC Service Update.
|
||||
//
|
||||
static
|
||||
subscribe_timer_t on_subscription_mac_sm_ag(sm_agent_t* sm_agent, const sm_subs_data_t* data)
|
||||
{
|
||||
assert(sm_agent != NULL);
|
||||
assert(data != NULL);
|
||||
|
||||
sm_mac_agent_t* sm = (sm_mac_agent_t*)sm_agent;
|
||||
|
||||
mac_event_trigger_t ev = mac_dec_event_trigger(&sm->enc, data->len_et, data->event_trigger);
|
||||
|
||||
subscribe_timer_t timer = {.ms = ev.ms };
|
||||
return timer;
|
||||
// const sm_wr_if_t wr = {.type = SUBSCRIBE_TIMER, .sub_timer = timer };
|
||||
|
||||
// sm->base.io.write(&wr);
|
||||
|
||||
// printf("on_subscription called with event trigger = %u \n", ev.ms);
|
||||
}
|
||||
|
||||
static
|
||||
sm_ind_data_t on_indication_mac_sm_ag(sm_agent_t* sm_agent)
|
||||
{
|
||||
//printf("on_indication called \n");
|
||||
|
||||
assert(sm_agent != NULL);
|
||||
sm_mac_agent_t* sm = (sm_mac_agent_t*)sm_agent;
|
||||
|
||||
sm_ind_data_t ret = {0};
|
||||
|
||||
// Fill Indication Header
|
||||
mac_ind_hdr_t hdr = {.dummy = 0 };
|
||||
byte_array_t ba_hdr = mac_enc_ind_hdr(&sm->enc, &hdr );
|
||||
ret.ind_hdr = ba_hdr.buf;
|
||||
ret.len_hdr = ba_hdr.len;
|
||||
|
||||
// Fill Indication Message
|
||||
|
||||
sm_ag_if_rd_t rd_if = {0};
|
||||
|
||||
rd_if.type = MAC_STATS_V0;
|
||||
// This may allocate memory by the RAN
|
||||
sm->base.io.read(&rd_if);
|
||||
// Liberate the memory if previously allocated by the RAN. It sucks
|
||||
// defer({ free_sm_rd_if(&rd_if); }; );
|
||||
mac_ind_data_t* ind = &rd_if.mac_stats;
|
||||
defer({ free_mac_ind_hdr(&ind->hdr) ;});
|
||||
defer({ free_mac_ind_msg(&ind->msg) ;});
|
||||
defer({ free_mac_call_proc_id(ind->proc_id);});
|
||||
|
||||
|
||||
byte_array_t ba = mac_enc_ind_msg(&sm->enc, &rd_if.mac_stats.msg);
|
||||
|
||||
ret.ind_msg = ba.buf;
|
||||
ret.len_msg = ba.len;
|
||||
|
||||
// Fill the optional Call Process ID
|
||||
ret.call_process_id = NULL;
|
||||
ret.len_cpid = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static
|
||||
sm_ctrl_out_data_t on_control_mac_sm_ag(sm_agent_t* sm_agent, sm_ctrl_req_data_t const* data)
|
||||
{
|
||||
assert(sm_agent != NULL);
|
||||
assert(data != NULL);
|
||||
sm_mac_agent_t* sm = (sm_mac_agent_t*) sm_agent;
|
||||
|
||||
mac_ctrl_hdr_t hdr = mac_dec_ctrl_hdr(&sm->enc, data->len_hdr, data->ctrl_hdr);
|
||||
assert(hdr.dummy == 0 && "Only dummy == 0 supported ");
|
||||
|
||||
mac_ctrl_msg_t msg = mac_dec_ctrl_msg(&sm->enc, data->len_msg, data->ctrl_msg);
|
||||
assert(msg.action == 42 && "Only action number 42 supported");
|
||||
|
||||
sm_ag_if_wr_t wr = {.type = MAC_CTRL_REQ_V0 };
|
||||
wr.mac_ctrl.hdr.dummy = 0;
|
||||
wr.mac_ctrl.msg.action = msg.action;
|
||||
|
||||
sm->base.io.write(&wr);
|
||||
sm_ctrl_out_data_t ret = {0};
|
||||
ret.len_out = 0;
|
||||
ret.ctrl_out = NULL;
|
||||
|
||||
//printf("on_control called \n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
static
|
||||
sm_e2_setup_t on_e2_setup_mac_sm_ag(sm_agent_t* sm_agent)
|
||||
{
|
||||
assert(sm_agent != NULL);
|
||||
// printf("[E2SM MAC] on_e2_setup called \n");
|
||||
|
||||
sm_mac_agent_t* sm = (sm_mac_agent_t*)sm_agent;
|
||||
|
||||
sm_e2_setup_t setup = {.len_rfd =0, .ran_fun_def = NULL };
|
||||
|
||||
setup.len_rfd = strlen(sm->base.ran_func_name);
|
||||
setup.ran_fun_def = calloc(1, strlen(sm->base.ran_func_name));
|
||||
assert(setup.ran_fun_def != NULL);
|
||||
memcpy(setup.ran_fun_def, sm->base.ran_func_name, strlen(sm->base.ran_func_name));
|
||||
|
||||
return setup;
|
||||
}
|
||||
|
||||
static
|
||||
void on_ric_service_update_mac_sm_ag(sm_agent_t* sm_agent, sm_ric_service_update_t const* data)
|
||||
{
|
||||
assert(sm_agent != NULL);
|
||||
assert(data != NULL);
|
||||
|
||||
|
||||
printf("on_ric_service_update called \n");
|
||||
}
|
||||
|
||||
static
|
||||
void free_mac_sm_ag(sm_agent_t* sm_agent)
|
||||
{
|
||||
assert(sm_agent != NULL);
|
||||
sm_mac_agent_t* sm = (sm_mac_agent_t*)sm_agent;
|
||||
free(sm);
|
||||
}
|
||||
|
||||
|
||||
sm_agent_t* make_mac_sm_agent(sm_io_ag_t io)
|
||||
{
|
||||
sm_mac_agent_t* sm = calloc(1, sizeof(sm_mac_agent_t));
|
||||
assert(sm != NULL && "Memory exhausted!!!");
|
||||
|
||||
|
||||
sm->base.io = io;
|
||||
sm->base.free_sm = free_mac_sm_ag;
|
||||
|
||||
sm->base.proc.on_subscription = on_subscription_mac_sm_ag;
|
||||
sm->base.proc.on_indication = on_indication_mac_sm_ag;
|
||||
sm->base.proc.on_control = on_control_mac_sm_ag;
|
||||
sm->base.proc.on_ric_service_update = on_ric_service_update_mac_sm_ag;
|
||||
sm->base.proc.on_e2_setup = on_e2_setup_mac_sm_ag;
|
||||
sm->base.handle = NULL;
|
||||
|
||||
*(uint16_t*)(&sm->base.ran_func_id) = SM_MAC_ID;
|
||||
assert(strlen( SM_MAC_STR ) < sizeof(sm->base.ran_func_name));
|
||||
memcpy(sm->base.ran_func_name, SM_MAC_STR, strlen(SM_MAC_STR));
|
||||
|
||||
return &sm->base;
|
||||
}
|
||||
|
||||
|
||||
uint16_t id_mac_sm_agent(sm_agent_t const* sm_agent )
|
||||
{
|
||||
assert(sm_agent != NULL);
|
||||
sm_mac_agent_t* sm = (sm_mac_agent_t*)sm_agent;
|
||||
return sm->base.ran_func_id;
|
||||
}
|
||||
|
||||
35
executables/mac_sm/mac_sm_agent.h
Normal file
35
executables/mac_sm/mac_sm_agent.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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 MAC_SERVICE_MODEL_AGENT_H
|
||||
#define MAC_SERVICE_MODEL_AGENT_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../sm_agent.h"
|
||||
|
||||
sm_agent_t* make_mac_sm_agent(sm_io_ag_t io);
|
||||
|
||||
#endif
|
||||
|
||||
46
executables/mac_sm/mac_sm_id.h
Normal file
46
executables/mac_sm/mac_sm_id.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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 MAC_SERVICE_MODEL_ID_H
|
||||
#define MAC_SERVICE_MODEL_ID_H
|
||||
|
||||
|
||||
/*
|
||||
* Service Model ID needed for the agent as well as for the ric to ensure that they match.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
static
|
||||
const uint16_t SM_MAC_ID = 142;
|
||||
|
||||
static
|
||||
const char* __attribute__((unused))SM_MAC_STR = "MAC_STATS_V0";
|
||||
|
||||
|
||||
//static
|
||||
//const char* complete_version = ;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
262
executables/mac_sm/mac_sm_ric.c
Normal file
262
executables/mac_sm/mac_sm_ric.c
Normal file
@@ -0,0 +1,262 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "mac_sm_ric.h"
|
||||
#include "mac_sm_id.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "enc/mac_enc_generic.h"
|
||||
#include "dec/mac_dec_generic.h"
|
||||
|
||||
typedef struct{
|
||||
sm_ric_t base;
|
||||
|
||||
#ifdef ASN
|
||||
mac_enc_asn_t enc;
|
||||
#elif FLATBUFFERS
|
||||
mac_enc_fb_t enc;
|
||||
#elif PLAIN
|
||||
mac_enc_plain_t enc;
|
||||
#else
|
||||
static_assert(false, "No encryption type selected");
|
||||
#endif
|
||||
} sm_mac_ric_t;
|
||||
|
||||
|
||||
static
|
||||
sm_subs_data_t on_subscription_mac_sm_ric(sm_ric_t const* sm_ric, const char* cmd)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(cmd != NULL);
|
||||
sm_mac_ric_t* sm = (sm_mac_ric_t*)sm_ric;
|
||||
|
||||
mac_event_trigger_t ev = {0};
|
||||
|
||||
const int max_str_sz = 10;
|
||||
if(strncmp(cmd, "1_ms", max_str_sz) == 0 ){
|
||||
ev.ms = 1;
|
||||
} else if (strncmp(cmd, "2_ms", max_str_sz) == 0 ) {
|
||||
ev.ms = 2;
|
||||
} else if (strncmp(cmd, "5_ms", max_str_sz) == 0 ) {
|
||||
ev.ms = 5;
|
||||
} else {
|
||||
assert(0 != 0 && "Invalid input");
|
||||
}
|
||||
const byte_array_t ba = mac_enc_event_trigger(&sm->enc, &ev);
|
||||
|
||||
sm_subs_data_t data = {0};
|
||||
|
||||
// Event trigger IE
|
||||
data.event_trigger = ba.buf;
|
||||
data.len_et = ba.len;
|
||||
|
||||
// Action Definition IE
|
||||
data.action_def = NULL;
|
||||
data.len_ad = 0;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
static
|
||||
sm_ag_if_rd_t on_indication_mac_sm_ric(sm_ric_t const* sm_ric, sm_ind_data_t* data)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(data != NULL);
|
||||
sm_mac_ric_t* sm = (sm_mac_ric_t*)sm_ric;
|
||||
|
||||
sm_ag_if_rd_t rd_if = {.type = MAC_STATS_V0};
|
||||
rd_if.mac_stats.msg = mac_dec_ind_msg(&sm->enc, data->len_msg, data->ind_msg);
|
||||
|
||||
return rd_if;
|
||||
}
|
||||
|
||||
static
|
||||
sm_ctrl_req_data_t ric_on_control_req_mac_sm_ric(sm_ric_t const* sm_ric, const sm_ag_if_wr_t * data)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(data != NULL);
|
||||
assert(data->type == MAC_CTRL_REQ_V0 );
|
||||
mac_ctrl_req_data_t const* req = &data->mac_ctrl;
|
||||
assert(req->hdr.dummy == 0);
|
||||
assert(req->msg.action == 42);
|
||||
|
||||
sm_mac_ric_t* sm = (sm_mac_ric_t*)sm_ric;
|
||||
|
||||
byte_array_t ba = mac_enc_ctrl_hdr(&sm->enc, &req->hdr);
|
||||
|
||||
sm_ctrl_req_data_t ret_data = {0};
|
||||
ret_data.ctrl_hdr = ba.buf;
|
||||
ret_data.len_hdr = ba.len;
|
||||
|
||||
ba = mac_enc_ctrl_msg(&sm->enc, &req->msg);
|
||||
ret_data.ctrl_msg = ba.buf;
|
||||
ret_data.len_msg = ba.len;
|
||||
|
||||
return ret_data;
|
||||
}
|
||||
|
||||
static
|
||||
sm_ag_if_ans_t ric_on_control_out_mac_sm_ric(sm_ric_t const* sm_ric,const sm_ctrl_out_data_t * out)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(out != NULL);
|
||||
|
||||
sm_mac_ric_t* sm = (sm_mac_ric_t*)sm_ric;
|
||||
|
||||
sm_ag_if_ans_t ag_if = {.type = MAC_AGENT_IF_CTRL_ANS_V0};
|
||||
ag_if.mac = mac_dec_ctrl_out(&sm->enc, out->len_out, out->ctrl_out);
|
||||
assert(ag_if.mac.ans == MAC_CTRL_OUT_OK);
|
||||
|
||||
return ag_if;
|
||||
}
|
||||
|
||||
static
|
||||
void ric_on_e2_setup_mac_sm_ric(sm_ric_t const* sm_ric, sm_e2_setup_t const* setup)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(setup == NULL);
|
||||
// sm_mac_ric_t* sm = (sm_mac_ric_t*)sm_ric;
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
static
|
||||
sm_ric_service_update_t on_ric_service_update_mac_sm_ric(sm_ric_t const* sm_ric, const char* data)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(data != NULL);
|
||||
// sm_mac_ric_t* sm = (sm_mac_ric_t*)sm_ric;
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
static
|
||||
void free_mac_sm_ric(sm_ric_t* sm_ric)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
sm_mac_ric_t* sm = (sm_mac_ric_t*)sm_ric;
|
||||
free(sm);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Allocation SM functions. The memory malloc by the SM is also freed by it.
|
||||
//
|
||||
|
||||
static
|
||||
void free_subs_data_mac_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
static
|
||||
void free_ind_data_mac_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
|
||||
mac_ind_data_t* ind = (mac_ind_data_t*)msg;
|
||||
|
||||
free_mac_ind_hdr(&ind->hdr);
|
||||
free_mac_ind_msg(&ind->msg);
|
||||
if(ind->proc_id != NULL){
|
||||
free_mac_call_proc_id(ind->proc_id);
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void free_ctrl_req_data_mac_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void free_ctrl_out_data_mac_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
static
|
||||
void free_e2_setup_mac_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
static
|
||||
void free_ric_service_update_mac_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
|
||||
sm_ric_t* make_mac_sm_ric(void /* sm_io_ric_t io */)
|
||||
{
|
||||
sm_mac_ric_t* sm = calloc(1, sizeof(sm_mac_ric_t));
|
||||
assert(sm != NULL && "Memory exhausted");
|
||||
|
||||
*((uint16_t*)&sm->base.ran_func_id) = SM_MAC_ID;
|
||||
|
||||
sm->base.free_sm = free_mac_sm_ric;
|
||||
|
||||
// Memory (De)Allocation
|
||||
sm->base.alloc.free_subs_data_msg = free_subs_data_mac_sm_ric;
|
||||
sm->base.alloc.free_ind_data = free_ind_data_mac_sm_ric ;
|
||||
sm->base.alloc.free_ctrl_req_data = free_ctrl_req_data_mac_sm_ric;
|
||||
sm->base.alloc.free_ctrl_out_data = free_ctrl_out_data_mac_sm_ric;
|
||||
sm->base.alloc.free_e2_setup = free_e2_setup_mac_sm_ric;
|
||||
sm->base.alloc.free_ric_service_update = free_ric_service_update_mac_sm_ric;
|
||||
|
||||
|
||||
// O-RAN E2SM 5 Procedures
|
||||
sm->base.proc.on_subscription = on_subscription_mac_sm_ric;
|
||||
sm->base.proc.on_indication = on_indication_mac_sm_ric;
|
||||
|
||||
// Control needs two calls
|
||||
sm->base.proc.on_control_req = ric_on_control_req_mac_sm_ric;
|
||||
sm->base.proc.on_control_out = ric_on_control_out_mac_sm_ric;
|
||||
|
||||
sm->base.proc.on_e2_setup = ric_on_e2_setup_mac_sm_ric;
|
||||
sm->base.proc.on_ric_service_update = on_ric_service_update_mac_sm_ric;
|
||||
sm->base.handle = NULL;
|
||||
|
||||
assert(strlen( SM_MAC_STR ) < sizeof(sm->base.ran_func_name));
|
||||
memcpy(sm->base.ran_func_name, SM_MAC_STR, strlen(SM_MAC_STR));
|
||||
|
||||
return &sm->base;
|
||||
}
|
||||
|
||||
|
||||
uint16_t id_sm_mac_ric(sm_ric_t const* sm_ric)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
sm_mac_ric_t* sm = (sm_mac_ric_t*)sm_ric;
|
||||
return sm->base.ran_func_id;
|
||||
}
|
||||
|
||||
36
executables/mac_sm/mac_sm_ric.h
Normal file
36
executables/mac_sm/mac_sm_ric.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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 MAC_SERVICE_MODEL_SERVER_H
|
||||
#define MAC_SERVICE_MODEL_SERVER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../../sm/sm_ric.h"
|
||||
|
||||
sm_ric_t* make_mac_sm_ric(void);
|
||||
|
||||
uint16_t id_mac_sm_ric(sm_ric_t const* );
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
112
executables/mac_sm/test/CMakeLists.txt
Normal file
112
executables/mac_sm/test/CMakeLists.txt
Normal file
@@ -0,0 +1,112 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project (TEST_MAC_SM)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_FLAGS "-Wall -Wextra")
|
||||
|
||||
set(default_build_type "Debug")
|
||||
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
|
||||
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
||||
endif()
|
||||
|
||||
|
||||
set(COMPILER "GCC" CACHE STRING "Compiler")
|
||||
set_property(CACHE COMPILER PROPERTY STRINGS "GCC" "CLANG")
|
||||
|
||||
if(COMPILER STREQUAL CLANG)
|
||||
add_compile_options("$<$<CONFIG:DEBUG>:-fblocks;>")
|
||||
add_link_options("$<$<CONFIG:DEBUG>:-lBlocksRuntime;>")
|
||||
endif()
|
||||
|
||||
|
||||
set(SANITIZER "ADDRESS" CACHE STRING "Sanitizers")
|
||||
set_property(CACHE SANITIZER PROPERTY STRINGS "NONE" "ADDRESS" "THREAD")
|
||||
message(STATUS "Selected SANITIZER TYPE: ${SANITIZER}")
|
||||
|
||||
if(SANITIZER STREQUAL "ADDRESS")
|
||||
add_compile_options("$<$<CONFIG:DEBUG>:-fno-omit-frame-pointer;-fsanitize=address>")
|
||||
add_link_options("$<$<CONFIG:DEBUG>:-fsanitize=address>")
|
||||
elseif(SANITIZER STREQUAL "THREAD" )
|
||||
add_compile_options("$<$<CONFIG:DEBUG>:-fsanitize=thread;-g;>")
|
||||
add_link_options("$<$<CONFIG:DEBUG>:-fsanitize=thread;>")
|
||||
endif()
|
||||
|
||||
option(CODE_COVERAGE "Code coverage" ON)
|
||||
if(CODE_COVERAGE)
|
||||
add_compile_options("$<$<CONFIG:DEBUG>:-fprofile-arcs;-ftest-coverage>")
|
||||
add_link_options("$<$<CONFIG:DEBUG>:-lgcov;-coverage;>")
|
||||
message(STATUS "CODE COVERAGE ON")
|
||||
endif()
|
||||
|
||||
option(CODE_PROFILER "Code Profiler" ON)
|
||||
if(CODE_PROFILER)
|
||||
message(STATUS "CODE PROFILER ON")
|
||||
add_compile_options("$<$<CONFIG:DEBUG>:-pg>")
|
||||
add_link_options("$<$<CONFIG:DEBUG>:-pg;>")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
set(SM_ENCODING_MAC "PLAIN" CACHE STRING "The MAC SM encoding to use")
|
||||
set_property(CACHE SM_ENCODING_MAC PROPERTY STRINGS "PLAIN" "ASN" "FLATBUFFERS")
|
||||
message(STATUS "Selected MAC SM_ENCODING: ${SM_ENCODING_MAC}")
|
||||
|
||||
if(SM_ENCODING_MAC STREQUAL "PLAIN")
|
||||
add_executable(test_mac_sm
|
||||
main.c
|
||||
../../sm_proc_data.c
|
||||
../mac_sm_agent.c
|
||||
../mac_sm_ric.c
|
||||
../enc/mac_enc_plain.c
|
||||
../dec/mac_dec_plain.c
|
||||
../ie/mac_data_ie.c
|
||||
../../../util/alg_ds/alg/eq_float.c
|
||||
../../../util/alg_ds/alg/defer.c
|
||||
)
|
||||
elseif(SM_ENCODING_MAC STREQUAL "ASN")
|
||||
message(FATAL_ERROR "ASN encoding for MAC SM not implemented" )
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}../ie/asn/ )
|
||||
file(GLOB asn_sources "../ie/asn/*.c")
|
||||
include_directories("/usr/local/share/asn1c/")
|
||||
target_compile_options(test_mac_sm PUBLIC "-DASN_DISABLE_OER_SUPPORT")
|
||||
|
||||
add_executable(test_mac_sm
|
||||
main.c
|
||||
../../sm_proc_data.c
|
||||
../mac_sm_agent.c
|
||||
../mac_sm_ric.c
|
||||
../enc/mac_enc_asn.c
|
||||
../dec/mac_dec_asn.c
|
||||
../ie/mac_data_ie.c
|
||||
../../../util/alg_ds/alg/eq_float.c
|
||||
../../../util/alg_ds/alg/defer.c
|
||||
${asn_sources}
|
||||
)
|
||||
elseif(SM_ENCODING_MAC STREQUAL "FLATBUFFERS")
|
||||
message(FATAL_ERROR "FB encoding for MAC SM not implemented" )
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}../ie/fb/ )
|
||||
add_executable(test_mac_sm
|
||||
main.c
|
||||
../../sm_proc_data.c
|
||||
../mac_sm_agent.c
|
||||
../mac_sm_ric.c
|
||||
../enc/mac_enc_fb.c
|
||||
../dec/mac_dec_fb.c
|
||||
../ie/mac_data_ie.c
|
||||
../../../util/alg_ds/alg/eq_float.c
|
||||
../../../util/alg_ds/alg/defer.c
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown encoding type" )
|
||||
endif()
|
||||
|
||||
target_compile_definitions(test_mac_sm PUBLIC ${SM_ENCODING_MAC})
|
||||
target_link_libraries(test_mac_sm PUBLIC -pthread)
|
||||
|
||||
175
executables/mac_sm/test/main.c
Normal file
175
executables/mac_sm/test/main.c
Normal file
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "../../mac_sm/mac_sm_agent.h"
|
||||
#include "../../mac_sm/mac_sm_ric.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
static
|
||||
mac_ind_data_t cp;
|
||||
|
||||
///
|
||||
// Functions implemented and specific to the RAN
|
||||
//
|
||||
|
||||
void fill_mac_ind_data(mac_ind_data_t* ind_data)
|
||||
{
|
||||
srand(time(0));
|
||||
|
||||
int const mod = 1024;
|
||||
|
||||
mac_ind_msg_t* ind_msg = &ind_data->msg;
|
||||
|
||||
int const NUM_UES = abs(rand()%10);
|
||||
|
||||
ind_msg->len_ue_stats = NUM_UES;
|
||||
|
||||
ind_msg->tstamp = 123456789;
|
||||
|
||||
if(NUM_UES > 0){
|
||||
ind_msg->ue_stats = calloc(NUM_UES, sizeof(mac_ue_stats_impl_t));
|
||||
assert(ind_msg->ue_stats != NULL && "memory exhausted");
|
||||
}
|
||||
|
||||
for(uint32_t i = 0; i < ind_msg->len_ue_stats; ++i){
|
||||
ind_msg->ue_stats[i].dl_aggr_tbs = abs(rand()%mod);
|
||||
ind_msg->ue_stats[i].ul_aggr_tbs = abs(rand()%mod);
|
||||
ind_msg->ue_stats[i].dl_aggr_bytes_sdus = abs(rand()%mod);
|
||||
ind_msg->ue_stats[i].ul_aggr_bytes_sdus = abs(rand()%mod);
|
||||
ind_msg->ue_stats[i].pusch_snr = 64.0; //: float = -64;
|
||||
ind_msg->ue_stats[i].pucch_snr = 64.0; //: float = -64;
|
||||
ind_msg->ue_stats[i].rnti = abs(rand()%mod);
|
||||
ind_msg->ue_stats[i].dl_aggr_prb = abs(rand()%mod);
|
||||
ind_msg->ue_stats[i].ul_aggr_prb = abs(rand()%mod);
|
||||
ind_msg->ue_stats[i].dl_aggr_sdus = abs(rand()%mod);
|
||||
ind_msg->ue_stats[i].ul_aggr_sdus= abs(rand()%mod);
|
||||
ind_msg->ue_stats[i].dl_aggr_retx_prb= abs(rand()%mod);
|
||||
ind_msg->ue_stats[i].wb_cqi= abs(rand()%mod);
|
||||
ind_msg->ue_stats[i].dl_mcs1= abs(rand()%mod);
|
||||
ind_msg->ue_stats[i].ul_mcs1= abs(rand()%mod);
|
||||
ind_msg->ue_stats[i].dl_mcs2= abs(rand()%mod);
|
||||
ind_msg->ue_stats[i].ul_mcs2= abs(rand()%mod);
|
||||
ind_msg->ue_stats[i].phr= abs(rand()%mod);
|
||||
}
|
||||
|
||||
cp.hdr = cp_mac_ind_hdr(&ind_data->hdr);
|
||||
cp.msg = cp_mac_ind_msg(&ind_data->msg);
|
||||
}
|
||||
|
||||
|
||||
/////
|
||||
// AGENT
|
||||
////
|
||||
|
||||
static
|
||||
|
||||
void read_RAN(sm_ag_if_rd_t* read)
|
||||
{
|
||||
assert(read != NULL);
|
||||
assert(read->type == MAC_STATS_V0);
|
||||
|
||||
fill_mac_ind_data(&read->mac_stats);
|
||||
}
|
||||
|
||||
static
|
||||
sm_ag_if_ans_t write_RAN(const sm_ag_if_wr_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
sm_ag_if_ans_t ans = {0};
|
||||
return ans;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
// Check Functions
|
||||
// //////////////////////////
|
||||
|
||||
static
|
||||
void check_eq_ran_function(sm_agent_t const* ag, sm_ric_t const* ric)
|
||||
{
|
||||
assert(ag != NULL);
|
||||
assert(ric != NULL);
|
||||
assert(ag->ran_func_id == ric->ran_func_id);
|
||||
}
|
||||
|
||||
// RIC -> E2
|
||||
static
|
||||
void check_subscription(sm_agent_t* ag, sm_ric_t* ric)
|
||||
{
|
||||
assert(ag != NULL);
|
||||
assert(ric != NULL);
|
||||
|
||||
sm_subs_data_t data = ric->proc.on_subscription(ric, "2_ms");
|
||||
ag->proc.on_subscription(ag, &data);
|
||||
|
||||
free_sm_subs_data(&data);
|
||||
}
|
||||
|
||||
// E2 -> RIC
|
||||
static
|
||||
void check_indication(sm_agent_t* ag, sm_ric_t* ric)
|
||||
{
|
||||
assert(ag != NULL);
|
||||
assert(ric != NULL);
|
||||
|
||||
sm_ind_data_t sm_data = ag->proc.on_indication(ag);
|
||||
sm_ag_if_rd_t msg = ric->proc.on_indication(ric, &sm_data);
|
||||
|
||||
assert(msg.type == MAC_STATS_V0);
|
||||
mac_ind_data_t* data = &msg.mac_stats;
|
||||
|
||||
assert(eq_mac_ind_hdr(&data->hdr, &cp.hdr) == true);
|
||||
assert(eq_mac_ind_msg(&data->msg, &cp.msg) == true);
|
||||
assert(eq_mac_call_proc_id(data->proc_id, cp.proc_id) == true);
|
||||
|
||||
free_mac_ind_hdr(&data->hdr);
|
||||
free_mac_ind_msg(&data->msg);
|
||||
|
||||
free_sm_ind_data(&sm_data);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
sm_io_ag_t io_ag = {.read = read_RAN, .write = write_RAN};
|
||||
sm_agent_t* sm_ag = make_mac_sm_agent(io_ag);
|
||||
sm_ric_t* sm_ric = make_mac_sm_ric();
|
||||
|
||||
check_eq_ran_function(sm_ag, sm_ric);
|
||||
check_subscription(sm_ag, sm_ric);
|
||||
check_indication(sm_ag, sm_ric);
|
||||
|
||||
sm_ag->free_sm(sm_ag);
|
||||
sm_ric->free_sm(sm_ric);
|
||||
|
||||
printf("Success\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -81,6 +81,28 @@ unsigned short config_frames[4] = {2,9,11,13};
|
||||
#include <openair3/ocp-gtpu/gtp_itf.h>
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
|
||||
//////////////////////////////////
|
||||
//// E2 Agent headers
|
||||
//////////////////////////////////
|
||||
#include "../openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
|
||||
|
||||
|
||||
#include "agent_if/read/sm_ag_if_rd.h"
|
||||
#include "agent_if/sm_io.h"
|
||||
#include "agent_if/e2_agent_api.h"
|
||||
#include "openair2/LAYER2/nr_rlc/nr_rlc_entity.h"
|
||||
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h"
|
||||
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
|
||||
#include "openair2/LAYER2/nr_pdcp/nr_pdcp.h"
|
||||
#include <time.h>
|
||||
#include "openair2/tc/tc_api.h"
|
||||
|
||||
//////////////////////////////////
|
||||
//////////////////////////////////
|
||||
//////////////////////////////////
|
||||
|
||||
|
||||
|
||||
pthread_cond_t nfapi_sync_cond;
|
||||
pthread_mutex_t nfapi_sync_mutex;
|
||||
int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
|
||||
@@ -600,6 +622,338 @@ void init_pdcp(void) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static
|
||||
const int mod_id = 0;
|
||||
|
||||
static
|
||||
int64_t time_now_us(void)
|
||||
{
|
||||
struct timespec tms;
|
||||
|
||||
/* The C11 way */
|
||||
/* if (! timespec_get(&tms, TIME_UTC)) */
|
||||
|
||||
/* POSIX.1-2008 way */
|
||||
if (clock_gettime(CLOCK_REALTIME,&tms)) {
|
||||
return -1;
|
||||
}
|
||||
/* seconds, multiplied with 1 million */
|
||||
int64_t micros = tms.tv_sec * 1000000;
|
||||
/* Add full microseconds */
|
||||
micros += tms.tv_nsec/1000;
|
||||
/* round up if necessary */
|
||||
if (tms.tv_nsec % 1000 >= 500) {
|
||||
++micros;
|
||||
}
|
||||
return micros;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void read_mac_sm(mac_ind_msg_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
data->tstamp = time_now_us();
|
||||
|
||||
// assert(0!=0 && "Read MAC called");
|
||||
|
||||
const NR_UE_info_t* UE_info = &RC.nrmac[mod_id]->UE_info;
|
||||
const size_t num_ues = UE_info->num_UEs;
|
||||
|
||||
data->len_ue_stats = num_ues;
|
||||
if(data->len_ue_stats > 0){
|
||||
data->ue_stats = calloc(data->len_ue_stats, sizeof(mac_ue_stats_impl_t));
|
||||
assert( data->ue_stats != NULL && "Memory exhausted" );
|
||||
}
|
||||
|
||||
const NR_list_t* ue_list = &UE_info->list;
|
||||
size_t i = 0;
|
||||
for (int ue_id = ue_list->head; ue_id >= 0; ue_id = ue_list->next[ue_id]) {
|
||||
const NR_UE_sched_ctrl_t* sched_ctrl = &UE_info->UE_sched_ctrl[ue_id];
|
||||
const NR_mac_stats_t* uestats = &UE_info->mac_stats[ue_id];
|
||||
mac_ue_stats_impl_t* rd = &data->ue_stats[i];
|
||||
|
||||
rd->dl_aggr_tbs = uestats->dlsch_total_bytes;
|
||||
rd->ul_aggr_tbs = uestats->ulsch_total_bytes_rx;
|
||||
|
||||
|
||||
rd->rnti = UE_info->rnti[ue_id];
|
||||
rd->dl_aggr_prb = uestats->dlsch_total_rbs;
|
||||
rd->ul_aggr_prb = uestats->ulsch_total_rbs;
|
||||
rd->dl_aggr_retx_prb = uestats->dlsch_total_rbs_retx ;
|
||||
|
||||
rd->dl_aggr_bytes_sdus = uestats->lc_bytes_tx[3] ;
|
||||
rd->ul_aggr_bytes_sdus = uestats->lc_bytes_rx[3];
|
||||
|
||||
rd->dl_aggr_sdus = uestats->dlsch_num_mac_sdu;
|
||||
rd->ul_aggr_sdus = uestats->ulsch_num_mac_sdu;
|
||||
|
||||
rd->pusch_snr = (float) sched_ctrl->pusch_snrx10 / 10; //: float = -64;
|
||||
rd->pucch_snr = (float) sched_ctrl->pucch_snrx10 / 10 ; //: float = -64;
|
||||
|
||||
// no CQI measurements implemented in OAI 5G yet
|
||||
rd->wb_cqi = 0;
|
||||
rd->dl_mcs1 = sched_ctrl->sched_pdsch.mcs;
|
||||
rd->ul_mcs1 = sched_ctrl->sched_pusch.mcs ;
|
||||
rd->dl_mcs2 = 0;
|
||||
rd->ul_mcs2 = 0;
|
||||
rd->phr = sched_ctrl->ph;
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
uint32_t num_act_rb(NR_UE_info_t const* UE_info)
|
||||
{
|
||||
assert(UE_info!= NULL);
|
||||
|
||||
const NR_list_t* ue_list = &UE_info->list;
|
||||
|
||||
uint32_t act_rb = 0;
|
||||
for (int ue_id = ue_list->head; ue_id >= 0; ue_id = ue_list->next[ue_id]) {
|
||||
uint16_t const rnti = UE_info->rnti[ue_id];
|
||||
for(int rb_id = 1; rb_id < 6; ++rb_id ){
|
||||
nr_rlc_statistics_t rlc = {0};
|
||||
const int srb_flag = 0;
|
||||
const int rc = nr_rlc_get_statistics(rnti, srb_flag, rb_id, &rlc);
|
||||
if(rc == 1) ++act_rb;
|
||||
}
|
||||
}
|
||||
return act_rb;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void read_rlc_sm(rlc_ind_msg_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
// use MAC structures to get RNTIs
|
||||
const NR_UE_info_t* UE_info = &RC.nrmac[mod_id]->UE_info;
|
||||
uint32_t const act_rb = num_act_rb(UE_info);
|
||||
|
||||
//assert(0!=0 && "Read RLC called");
|
||||
|
||||
data->len = act_rb;
|
||||
if(data->len > 0){
|
||||
data->rb = calloc(data->len, sizeof(rlc_radio_bearer_stats_t));
|
||||
assert(data->rb != NULL && "Memory exhausted");
|
||||
}
|
||||
|
||||
data->tstamp = time_now_us();
|
||||
|
||||
const NR_list_t* ue_list = &UE_info->list;
|
||||
uint32_t i = 0;
|
||||
for (int ue_id = ue_list->head; ue_id >= 0; ue_id = ue_list->next[ue_id]) {
|
||||
uint16_t const rnti = UE_info->rnti[ue_id];
|
||||
//for every LC ID
|
||||
for(int rb_id = 1; rb_id < 6; ++rb_id ){
|
||||
nr_rlc_statistics_t rb_rlc = {0};
|
||||
const int srb_flag = 0;
|
||||
const int rc = nr_rlc_get_statistics(rnti, srb_flag, rb_id, &rb_rlc);
|
||||
if(rc == 0) continue;
|
||||
rlc_radio_bearer_stats_t* sm_rb = &data->rb[i];
|
||||
|
||||
sm_rb->txpdu_pkts = rb_rlc.txpdu_pkts;
|
||||
sm_rb->txpdu_bytes = rb_rlc.txpdu_bytes; /* aggregated amount of transmitted bytes in RLC PDUs */
|
||||
sm_rb->txpdu_wt_ms = rb_rlc.txpdu_wt_ms; /* aggregated head-of-line tx packet waiting time to be transmitted (i.e. send to the MAC layer) */
|
||||
sm_rb->txpdu_dd_pkts = rb_rlc.txpdu_dd_pkts; /* aggregated number of dropped or discarded tx packets by RLC */
|
||||
sm_rb->txpdu_dd_bytes = rb_rlc.txpdu_dd_bytes; /* aggregated amount of bytes dropped or discarded tx packets by RLC */
|
||||
sm_rb->txpdu_retx_pkts = rb_rlc.txpdu_retx_pkts; /* aggregated number of tx pdus/pkts to be re-transmitted (only applicable to RLC AM) */
|
||||
sm_rb->txpdu_retx_bytes = rb_rlc.txpdu_retx_bytes ; /* aggregated amount of bytes to be re-transmitted (only applicable to RLC AM) */
|
||||
sm_rb->txpdu_segmented = rb_rlc.txpdu_segmented ; /* aggregated number of segmentations */
|
||||
sm_rb->txpdu_status_pkts = rb_rlc.txpdu_status_pkts ; /* aggregated number of tx status pdus/pkts (only applicable to RLC AM) */
|
||||
sm_rb->txpdu_status_bytes = rb_rlc.txpdu_status_bytes ; /* aggregated amount of tx status bytes (only applicable to RLC AM) */
|
||||
sm_rb->txbuf_occ_bytes = rb_rlc.txbuf_occ_bytes ; /* current tx buffer occupancy in terms of amount of bytes (average: NOT IMPLEMENTED) */
|
||||
sm_rb->txbuf_occ_pkts = rb_rlc.txbuf_occ_pkts ; /* current tx buffer occupancy in terms of number of packets (average: NOT IMPLEMENTED) */
|
||||
|
||||
/* RX */
|
||||
sm_rb->rxpdu_pkts = rb_rlc.rxpdu_pkts ; /* aggregated number of received RLC PDUs */
|
||||
sm_rb->rxpdu_bytes = rb_rlc.rxpdu_bytes ; /* amount of bytes received by the RLC */
|
||||
sm_rb->rxpdu_dup_pkts = rb_rlc.rxpdu_dup_pkts ; /* aggregated number of duplicate packets */
|
||||
sm_rb->rxpdu_dup_bytes = rb_rlc.rxpdu_dup_bytes ; /* aggregated amount of duplicated bytes */
|
||||
sm_rb->rxpdu_dd_pkts = rb_rlc.rxpdu_dd_pkts ; /* aggregated number of rx packets dropped or discarded by RLC */
|
||||
sm_rb->rxpdu_dd_bytes = rb_rlc.rxpdu_dd_bytes ; /* aggregated amount of rx bytes dropped or discarded by RLC */
|
||||
sm_rb->rxpdu_ow_pkts = rb_rlc.rxpdu_ow_pkts ; /* aggregated number of out of window received RLC pdu */
|
||||
sm_rb->rxpdu_ow_bytes = rb_rlc.rxpdu_ow_bytes ; /* aggregated number of out of window bytes received RLC pdu */
|
||||
sm_rb->rxpdu_status_pkts = rb_rlc.rxpdu_status_pkts ; /* aggregated number of rx status pdus/pkts (only applicable to RLC AM) */
|
||||
sm_rb->rxpdu_status_bytes = rb_rlc.rxpdu_status_bytes ; /* aggregated amount of rx status bytes (only applicable to RLC AM) */
|
||||
|
||||
sm_rb->rxbuf_occ_bytes = rb_rlc.rxbuf_occ_bytes ; /* current rx buffer occupancy in terms of amount of bytes (average: NOT IMPLEMENTED) */
|
||||
sm_rb->rxbuf_occ_pkts = rb_rlc.rxbuf_occ_pkts ; /* current rx buffer occupancy in terms of number of packets (average: NOT IMPLEMENTED) */
|
||||
|
||||
/* TX */
|
||||
sm_rb->txsdu_pkts = rb_rlc.txsdu_pkts ; /* number of SDUs delivered */
|
||||
sm_rb->txsdu_bytes = rb_rlc.txsdu_bytes ; /* number of bytes of SDUs delivered */
|
||||
|
||||
/* RX */
|
||||
sm_rb->rxsdu_pkts = rb_rlc.rxsdu_pkts ; /* number of SDUs received */
|
||||
sm_rb->rxsdu_bytes = rb_rlc.rxsdu_bytes ; /* number of bytes of SDUs received */
|
||||
sm_rb->rxsdu_dd_pkts = rb_rlc.rxsdu_dd_pkts ; /* number of dropped or discarded SDUs */
|
||||
sm_rb->rxsdu_dd_bytes = rb_rlc.rxsdu_dd_bytes ; /* number of bytes of SDUs dropped or discarded */
|
||||
|
||||
sm_rb->mode = rb_rlc.mode; /* 0: RLC AM, 1: RLC UM, 2: RLC TM */
|
||||
sm_rb->rnti = rnti;
|
||||
sm_rb->rbid = rb_id;
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void read_pdcp_sm(pdcp_ind_msg_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
//assert(0!=0 && "Calling PDCP");
|
||||
// for the moment and while we don't have a split base station, we use the
|
||||
// MAC structures to obtain the RNTIs which we use to query the PDCP
|
||||
const NR_UE_info_t* UE_info = &RC.nrmac[mod_id]->UE_info;
|
||||
uint32_t const act_rb = num_act_rb(UE_info);
|
||||
|
||||
data->len = act_rb;
|
||||
data->tstamp = time_now_us();
|
||||
// data->slot = 0;
|
||||
|
||||
if(data->len > 0){
|
||||
data->rb = calloc(data->len , sizeof(pdcp_radio_bearer_stats_t));
|
||||
assert(data->rb != NULL && "Memory exhausted!");
|
||||
}
|
||||
|
||||
size_t i = 0;
|
||||
const NR_list_t* ue_list = &UE_info->list;
|
||||
for (int ue_id = ue_list->head; ue_id >= 0; ue_id = ue_list->next[ue_id]) {
|
||||
|
||||
const int rnti = UE_info->rnti[ue_id];
|
||||
for(size_t rb_id = 1; rb_id < 6; ++rb_id){
|
||||
nr_pdcp_statistics_t pdcp = {0};
|
||||
|
||||
const int srb_flag = 0;
|
||||
const int rc = nr_pdcp_get_statistics(rnti, srb_flag, rb_id, &pdcp);
|
||||
|
||||
if(rc == 0) continue;
|
||||
|
||||
pdcp_radio_bearer_stats_t* rd = &data->rb[i];
|
||||
|
||||
|
||||
rd->txpdu_pkts = pdcp.txpdu_pkts ; /* aggregated number of tx packets */
|
||||
rd->txpdu_bytes = pdcp.txpdu_bytes; /* aggregated bytes of tx packets */
|
||||
rd->txpdu_sn = pdcp.txpdu_sn ; /* current sequence number of last tx packet (or TX_NEXT) */
|
||||
rd->rxpdu_pkts = pdcp.rxpdu_pkts ; /* aggregated number of rx packets */
|
||||
rd->rxpdu_bytes = pdcp.rxpdu_bytes ; /* aggregated bytes of rx packets */
|
||||
rd->rxpdu_sn = pdcp.rxpdu_sn ; /* current sequence number of last rx packet (or RX_NEXT) */
|
||||
rd->rxpdu_oo_pkts = pdcp.rxpdu_oo_pkts ; /* aggregated number of out-of-order rx pkts (or RX_REORD) */
|
||||
rd->rxpdu_oo_bytes = pdcp.rxpdu_oo_bytes ; /* aggregated amount of out-of-order rx bytes */
|
||||
rd->rxpdu_dd_pkts = pdcp.rxpdu_dd_pkts ; /* aggregated number of duplicated discarded packets (or dropped packets because of other reasons such as integrity failure) (or RX_DELIV) */
|
||||
rd->rxpdu_dd_bytes = pdcp.rxpdu_dd_bytes; /* aggregated amount of discarded packets' bytes */
|
||||
rd->rxpdu_ro_count = pdcp.rxpdu_ro_count ; /* this state variable indicates the COUNT value following the COUNT value associated with the PDCP Data PDU which triggered t-Reordering. (RX_REORD) */
|
||||
rd->txsdu_pkts = pdcp.txsdu_pkts ; /* number of SDUs delivered */
|
||||
rd->txsdu_bytes = pdcp.txsdu_bytes ; /* number of bytes of SDUs delivered */
|
||||
rd->rxsdu_pkts = pdcp.rxsdu_pkts ; /* number of SDUs received */
|
||||
rd->rxsdu_bytes = pdcp.rxsdu_bytes ; /* number of bytes of SDUs received */
|
||||
rd->rnti = rnti;
|
||||
rd->mode = pdcp.mode; /* 0: PDCP AM, 1: PDCP UM, 2: PDCP TM */
|
||||
rd->rbid = rb_id;
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void read_tc_sm(tc_ind_msg_t* data )
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
//assert(0!=0 && "Calling PDCP");
|
||||
// for the moment and while we don't have a split base station, we use the
|
||||
// MAC structures to obtain the RNTIs which we use to query the PDCP
|
||||
const NR_UE_info_t* UE_info = &RC.nrmac[mod_id]->UE_info;
|
||||
const NR_list_t* ue_list = &UE_info->list;
|
||||
for (int ue_id = ue_list->head; ue_id >= 0; ue_id = ue_list->next[ue_id]) {
|
||||
const int rnti = UE_info->rnti[ue_id];
|
||||
int const rb_id = 4;
|
||||
tc_rc_t rc = tc_get_or_create(rnti, rb_id);
|
||||
|
||||
tc_ind_data_t ind = tc_ind_data(rc.tc);
|
||||
*data = cp_tc_ind_msg(&ind.msg);
|
||||
|
||||
free_tc_ind_data(&ind);
|
||||
}
|
||||
|
||||
//uint32_t const act_rb = num_act_rb(UE_info);
|
||||
//data->len_q = act_rb;
|
||||
//data->tstamp = time_now_us();
|
||||
|
||||
//printf("Read TC called \n");
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void read_RAN(sm_ag_if_rd_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data->type == MAC_STATS_V0
|
||||
|| data->type == RLC_STATS_V0
|
||||
|| data->type == PDCP_STATS_V0
|
||||
|| data->type == TC_STATS_V0
|
||||
);
|
||||
|
||||
if(data->type == MAC_STATS_V0 ){
|
||||
read_mac_sm(&data->mac_stats.msg);
|
||||
// printf("calling REAd MAC\n");
|
||||
}else if(data->type == RLC_STATS_V0) {
|
||||
read_rlc_sm(&data->rlc_stats.msg);
|
||||
// printf("calling REAd RLC\n");
|
||||
} else if(data->type == PDCP_STATS_V0){
|
||||
read_pdcp_sm(&data->pdcp_stats.msg);
|
||||
//printf("calling REAd PDCP\n");
|
||||
} else if(data->type == TC_STATS_V0){
|
||||
read_tc_sm(&data->tc_stats.msg);
|
||||
// } else if(RRC_STATS_V0){
|
||||
// read_rrc_sm(&data->rrc_stats);
|
||||
} else {
|
||||
assert(0!=0 && "Unknown data type!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static
|
||||
sm_ag_if_ans_t write_RAN(sm_ag_if_wr_t const* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
assert(data->type == TC_CTRL_REQ_V0);
|
||||
|
||||
const NR_UE_info_t* UE_info = &RC.nrmac[mod_id]->UE_info;
|
||||
const NR_list_t* ue_list = &UE_info->list;
|
||||
for (int ue_id = ue_list->head; ue_id >= 0; ue_id = ue_list->next[ue_id]) {
|
||||
const int rnti = UE_info->rnti[ue_id];
|
||||
int const rb_id = 1;
|
||||
tc_rc_t rc = tc_get_or_create(rnti, rb_id);
|
||||
|
||||
// Configuration (add/delete)
|
||||
tc_ctrl_out_t out = tc_conf(rc.tc, &data->tc_req_ctrl.msg);
|
||||
assert(out.out == TC_CTRL_OUT_OK);
|
||||
|
||||
printf("Succesfully conf called tstamp %ld \n", time_now_us());
|
||||
}
|
||||
|
||||
sm_ag_if_ans_t ans = {.type = TC_AGENT_IF_CTRL_ANS_V0 };
|
||||
|
||||
return ans;
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char **argv ) {
|
||||
int ru_id, CC_id = 0;
|
||||
start_background_system();
|
||||
@@ -747,7 +1101,28 @@ int main( int argc, char **argv ) {
|
||||
}
|
||||
|
||||
config_sync_var=0;
|
||||
//////////////////////////////////
|
||||
//////////////////////////////////
|
||||
//// Init the E2 Agent
|
||||
|
||||
sleep(2);
|
||||
const gNB_RRC_INST* rrc = RC.nrrrc[mod_id];
|
||||
assert(rrc != NULL && "rrc cannot be NULL");
|
||||
|
||||
const int mcc = rrc->configuration.mcc[0]; // 208;
|
||||
const int mnc = rrc->configuration.mnc[0]; // 94;
|
||||
const int mnc_digit_len = rrc->configuration.mnc_digit_length[0]; // 2;
|
||||
const int nb_id = rrc->configuration.cell_identity; //42;
|
||||
sm_io_ag_t io = {.read = read_RAN, .write = write_RAN};
|
||||
|
||||
printf("[E2 NODE]: mcc = %d mnc = %d mnc_digit = %d nd_id = %d \n", mcc, mnc, mnc_digit_len, nb_id);
|
||||
|
||||
fr_args_t args = init_fr_args(1, NULL);
|
||||
init_agent_api( mcc, mnc, mnc_digit_len, nb_id, io, &args);
|
||||
//////////////////////////////////
|
||||
//////////////////////////////////
|
||||
|
||||
|
||||
if (NFAPI_MODE==NFAPI_MODE_PNF) {
|
||||
wait_nfapi_init("main?");
|
||||
}
|
||||
|
||||
50
executables/pdcp_sm/CMakeLists.txt
Normal file
50
executables/pdcp_sm/CMakeLists.txt
Normal file
@@ -0,0 +1,50 @@
|
||||
cmake_minimum_required(VERSION 3.15) # setting this is required
|
||||
project(pdcp_sm) # this sets the project name
|
||||
|
||||
set(SM_ENCODING_PDCP_SRC
|
||||
../sm_proc_data.c
|
||||
pdcp_sm_ric.c
|
||||
pdcp_sm_agent.c
|
||||
../../util/byte_array.c
|
||||
../../util/alg_ds/alg/defer.c
|
||||
../../util/alg_ds/alg/eq_float.c
|
||||
../../util/alg_ds/ds/seq_container/seq_arr.c
|
||||
../../util/alg_ds/ds/seq_container/seq_ring.c
|
||||
../../util/alg_ds/ds/assoc_container/assoc_rb_tree.c
|
||||
../../util/alg_ds/ds/assoc_container/bimap.c
|
||||
ie/pdcp_data_ie.c
|
||||
)
|
||||
|
||||
if(SM_ENCODING_PDCP STREQUAL "PLAIN")
|
||||
add_library(pdcp_sm SHARED
|
||||
${SM_ENCODING_PDCP_SRC}
|
||||
enc/pdcp_enc_plain.c
|
||||
dec/pdcp_dec_plain.c
|
||||
)
|
||||
elseif(SM_ENCODING_PDCP STREQUAL "ASN" )
|
||||
message(FATAL_ERROR "SM Encoding PDCP ASN not implemented")
|
||||
add_subdirectory(ie/asn)
|
||||
add_library(pdcp_sm SHARED
|
||||
${SM_ENCODING_PDCP_SRC}
|
||||
enc/pdcp_enc_asn.c
|
||||
dec/pdcp_dec_asn.c
|
||||
)
|
||||
target_include_directories(pdcp_sm
|
||||
PRIVATE
|
||||
"ie/asn")
|
||||
target_compile_options(pdcp_sm_lib PUBLIC "-DASN_DISABLE_OER_SUPPORT")
|
||||
target_compile_options(pdcp_sm_lib PRIVATE -Wno-missing-field-initializers -Wno-unused-parameter)
|
||||
|
||||
elseif(SM_ENCODING_PDCP STREQUAL "FLATBUFFERS" )
|
||||
message(FATAL_ERROR "SM Encoding PDCP FB not implemented")
|
||||
add_library(pdcp_sm SHARED
|
||||
${SM_ENCODING_PDCP_SRC}
|
||||
enc/pdcp_enc_fb.c
|
||||
dec/pdcp_dec_fb.c
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR "Unknnown path")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(pdcp_sm PUBLIC ${SM_ENCODING_PDCP})
|
||||
|
||||
99
executables/pdcp_sm/dec/pdcp_dec_asn.c
Normal file
99
executables/pdcp_sm/dec/pdcp_dec_asn.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "pdcp_dec_asn.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
pdcp_event_trigger_t pdcp_dec_event_trigger_asn(size_t len, uint8_t const buf[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(buf != NULL);
|
||||
pdcp_event_trigger_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
pdcp_action_def_t pdcp_dec_action_def_asn(size_t len, uint8_t const action_def[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(action_def != NULL);
|
||||
pdcp_action_def_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
pdcp_ind_hdr_t pdcp_dec_ind_hdr_asn(size_t len, uint8_t const ind_hdr[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ind_hdr != NULL);
|
||||
pdcp_ind_hdr_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
pdcp_ind_msg_t pdcp_dec_ind_msg_asn(size_t len, uint8_t const ind_msg[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ind_msg != NULL);
|
||||
pdcp_ind_msg_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
pdcp_call_proc_id_t pdcp_dec_call_proc_id_asn(size_t len, uint8_t const call_proc_id[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(call_proc_id != NULL);
|
||||
pdcp_call_proc_id_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
pdcp_ctrl_hdr_t pdcp_dec_ctrl_hdr_asn(size_t len, uint8_t const ctrl_hdr[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ctrl_hdr != NULL);
|
||||
pdcp_ctrl_hdr_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
pdcp_ctrl_msg_t pdcp_dec_ctrl_msg_asn(size_t len, uint8_t const ctrl_msg[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ctrl_msg != NULL);
|
||||
pdcp_ctrl_msg_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
pdcp_ctrl_out_t pdcp_dec_ctrl_out_asn(size_t len, uint8_t const ctrl_out[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ctrl_out!= NULL);
|
||||
pdcp_ctrl_out_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
pdcp_func_def_t pdcp_dec_func_def_asn(size_t len, uint8_t const func[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(func != NULL);
|
||||
pdcp_func_def_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
49
executables/pdcp_sm/dec/pdcp_dec_asn.h
Normal file
49
executables/pdcp_sm/dec/pdcp_dec_asn.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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 PDCP_DECRYPTION_ASN_H
|
||||
#define PDCP_DECRYPTION_ASN_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "../ie/pdcp_data_ie.h"
|
||||
|
||||
|
||||
pdcp_event_trigger_t pdcp_dec_event_trigger_asn(size_t len, uint8_t const ev_tr[len]);
|
||||
|
||||
pdcp_action_def_t pdcp_dec_action_def_asn(size_t len, uint8_t const action_def[len]);
|
||||
|
||||
pdcp_ind_hdr_t pdcp_dec_ind_hdr_asn(size_t len, uint8_t const ind_hdr[len]);
|
||||
|
||||
pdcp_ind_msg_t pdcp_dec_ind_msg_asn(size_t len, uint8_t const ind_msg[len]);
|
||||
|
||||
pdcp_call_proc_id_t pdcp_dec_call_proc_id_asn(size_t len, uint8_t const call_proc_id[len]);
|
||||
|
||||
pdcp_ctrl_hdr_t pdcp_dec_ctrl_hdr_asn(size_t len, uint8_t const ctrl_hdr[len]);
|
||||
|
||||
pdcp_ctrl_msg_t pdcp_dec_ctrl_msg_asn(size_t len, uint8_t const ctrl_msg[len]);
|
||||
|
||||
pdcp_ctrl_out_t pdcp_dec_ctrl_out_asn(size_t len, uint8_t const ctrl_out[len]);
|
||||
|
||||
pdcp_func_def_t pdcp_dec_func_def_asn(size_t len, uint8_t const func[len]);
|
||||
|
||||
#endif
|
||||
|
||||
99
executables/pdcp_sm/dec/pdcp_dec_fb.c
Normal file
99
executables/pdcp_sm/dec/pdcp_dec_fb.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "pdcp_dec_fb.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
pdcp_event_trigger_t pdcp_dec_event_trigger_fb(size_t len, uint8_t const ev_tr[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ev_tr != NULL);
|
||||
pdcp_event_trigger_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
pdcp_action_def_t pdcp_dec_action_def_fb(size_t len, uint8_t const action_def[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(action_def != NULL);
|
||||
pdcp_action_def_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
pdcp_ind_hdr_t pdcp_dec_ind_hdr_fb(size_t len, uint8_t const ind_hdr[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ind_hdr != NULL);
|
||||
pdcp_ind_hdr_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
pdcp_ind_msg_t pdcp_dec_ind_msg_fb(size_t len, uint8_t const ind_msg[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ind_msg != NULL);
|
||||
pdcp_ind_msg_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
pdcp_call_proc_id_t pdcp_dec_call_proc_id_fb(size_t len, uint8_t const call_proc_id[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(call_proc_id != NULL);
|
||||
pdcp_call_proc_id_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
pdcp_ctrl_hdr_t pdcp_dec_ctrl_hdr_fb(size_t len, uint8_t const ctrl_hdr[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ctrl_hdr != NULL);
|
||||
pdcp_ctrl_hdr_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
pdcp_ctrl_msg_t pdcp_dec_ctrl_msg_fb(size_t len, uint8_t const ctrl_msg[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ctrl_msg != NULL);
|
||||
pdcp_ctrl_msg_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
pdcp_ctrl_out_t pdcp_dec_ctrl_out_fb(size_t len, uint8_t const ctrl_out[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ctrl_out!= NULL);
|
||||
pdcp_ctrl_out_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
pdcp_func_def_t pdcp_dec_func_def_fb(size_t len, uint8_t const func[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(func != NULL);
|
||||
pdcp_func_def_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
50
executables/pdcp_sm/dec/pdcp_dec_fb.h
Normal file
50
executables/pdcp_sm/dec/pdcp_dec_fb.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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 PDCP_DECRYPTION_FLATBUFFERS_H
|
||||
#define PDCP_DECRYPTION_FLATBUFFERS_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "../ie/pdcp_data_ie.h"
|
||||
|
||||
|
||||
pdcp_event_trigger_t pdcp_dec_event_trigger_fb(size_t len, uint8_t const ev_tr[len]);
|
||||
|
||||
pdcp_action_def_t pdcp_dec_action_def_fb(size_t len, uint8_t const action_def[len]);
|
||||
|
||||
pdcp_ind_hdr_t pdcp_dec_ind_hdr_fb(size_t len, uint8_t const ind_hdr[len]);
|
||||
|
||||
pdcp_ind_msg_t pdcp_dec_ind_msg_fb(size_t len, uint8_t const ind_msg[len]);
|
||||
|
||||
pdcp_call_proc_id_t pdcp_dec_call_proc_id_fb(size_t len, uint8_t const call_proc_id[len]);
|
||||
|
||||
pdcp_ctrl_hdr_t pdcp_dec_ctrl_hdr_fb(size_t len, uint8_t const ctrl_hdr[len]);
|
||||
|
||||
pdcp_ctrl_msg_t pdcp_dec_ctrl_msg_fb(size_t len, uint8_t const ctrl_msg[len]);
|
||||
|
||||
pdcp_ctrl_out_t pdcp_dec_ctrl_out_fb(size_t len, uint8_t const ctrl_out[len]);
|
||||
|
||||
pdcp_func_def_t pdcp_dec_func_def_fb(size_t len, uint8_t const func[len]);
|
||||
|
||||
#endif
|
||||
|
||||
92
executables/pdcp_sm/dec/pdcp_dec_generic.h
Normal file
92
executables/pdcp_sm/dec/pdcp_dec_generic.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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 PDCP_DECRYPTION_GENERIC
|
||||
#define PDCP_DECRYPTION_GENERIC
|
||||
|
||||
#include "pdcp_dec_asn.h"
|
||||
#include "pdcp_dec_fb.h"
|
||||
#include "pdcp_dec_plain.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// 9 Information Elements that are interpreted by the SM according
|
||||
// to ORAN-WG3.E2SM-v01.00.00 Technical Specification
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#define pdcp_dec_event_trigger(T,U,V) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_dec_event_trigger_plain, \
|
||||
pdcp_enc_asn_t*: pdcp_dec_event_trigger_asn,\
|
||||
pdcp_enc_fb_t*: pdcp_dec_event_trigger_fb,\
|
||||
default: pdcp_dec_event_trigger_plain) (U,V)
|
||||
|
||||
#define pdcp_dec_action_def(T,U,V) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_dec_action_def_plain, \
|
||||
pdcp_enc_asn_t*: pdcp_dec_action_def_asn, \
|
||||
pdcp_enc_fb_t*: pdcp_dec_action_def_fb, \
|
||||
default: pdcp_dec_action_def_plain) (U,V)
|
||||
|
||||
#define pdcp_dec_ind_hdr(T,U,V) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_dec_ind_hdr_plain , \
|
||||
pdcp_enc_asn_t*: pdcp_dec_ind_hdr_asn, \
|
||||
pdcp_enc_fb_t*: pdcp_dec_ind_hdr_fb, \
|
||||
default: pdcp_dec_ind_hdr_plain) (U,V)
|
||||
|
||||
#define pdcp_dec_ind_msg(T,U,V) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_dec_ind_msg_plain , \
|
||||
pdcp_enc_asn_t*: pdcp_dec_ind_msg_asn, \
|
||||
pdcp_enc_fb_t*: pdcp_dec_ind_msg_fb, \
|
||||
default: pdcp_dec_ind_msg_plain) (U,V)
|
||||
|
||||
#define pdcp_dec_call_proc_id(T,U,V) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_dec_call_proc_id_plain , \
|
||||
pdcp_enc_asn_t*: pdcp_dec_call_proc_id_asn, \
|
||||
pdcp_enc_fb_t*: pdcp_dec_call_proc_id_fb, \
|
||||
default: pdcp_dec_call_proc_id_plain) (U,V)
|
||||
|
||||
#define pdcp_dec_ctrl_hdr(T,U,V) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_dec_ctrl_hdr_plain , \
|
||||
pdcp_enc_asn_t*: pdcp_dec_ctrl_hdr_asn, \
|
||||
pdcp_enc_fb_t*: pdcp_dec_ctrl_hdr_fb, \
|
||||
default: pdcp_dec_ctrl_hdr_plain) (U,V)
|
||||
|
||||
#define pdcp_dec_ctrl_msg(T,U,V) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_dec_ctrl_msg_plain , \
|
||||
pdcp_enc_asn_t*: pdcp_dec_ctrl_msg_asn, \
|
||||
pdcp_enc_fb_t*: pdcp_dec_ctrl_msg_fb, \
|
||||
default: pdcp_dec_ctrl_msg_plain) (U,V)
|
||||
|
||||
#define pdcp_dec_ctrl_out(T,U,V) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_dec_ctrl_out_plain , \
|
||||
pdcp_enc_asn_t*: pdcp_dec_ctrl_out_asn, \
|
||||
pdcp_enc_fb_t*: pdcp_dec_ctrl_out_fb, \
|
||||
default: pdcp_dec_ctrl_out_plain) (U,V)
|
||||
|
||||
#define pdcp_dec_func_def(T,U,V) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_dec_func_def_plain, \
|
||||
pdcp_enc_asn_t*: pdcp_dec_func_def_asn, \
|
||||
pdcp_enc_fb_t*: pdcp_dec_func_def_fb, \
|
||||
default: pdcp_dec_func_def_plain) (U,V)
|
||||
|
||||
#endif
|
||||
|
||||
123
executables/pdcp_sm/dec/pdcp_dec_plain.c
Normal file
123
executables/pdcp_sm/dec/pdcp_dec_plain.c
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "pdcp_dec_plain.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
pdcp_event_trigger_t pdcp_dec_event_trigger_plain(size_t len, uint8_t const ev_tr[len])
|
||||
{
|
||||
pdcp_event_trigger_t ev = {0};
|
||||
memcpy(&ev.ms, ev_tr, sizeof(ev.ms));
|
||||
return ev;
|
||||
}
|
||||
|
||||
pdcp_action_def_t pdcp_dec_action_def_plain(size_t len, uint8_t const action_def[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(action_def != NULL);
|
||||
pdcp_action_def_t act_def;// = {0};
|
||||
return act_def;
|
||||
}
|
||||
|
||||
pdcp_ind_hdr_t pdcp_dec_ind_hdr_plain(size_t len, uint8_t const ind_hdr[len])
|
||||
{
|
||||
assert(len == sizeof(pdcp_ind_hdr_t));
|
||||
pdcp_ind_hdr_t ret;
|
||||
memcpy(&ret, ind_hdr, len);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pdcp_ind_msg_t pdcp_dec_ind_msg_plain(size_t len, uint8_t const ind_msg[len])
|
||||
{
|
||||
assert(len >= sizeof(uint32_t) + sizeof(int64_t));
|
||||
// uint16_t) + sizeof(uint8_t)); // pdcp_ind_msg_t));
|
||||
pdcp_ind_msg_t ret;
|
||||
|
||||
void* it = (void*)ind_msg;
|
||||
memcpy(&ret.len, ind_msg, sizeof(ret.len));
|
||||
it += sizeof(ret.len);
|
||||
|
||||
if(ret.len > 0){
|
||||
ret.rb = calloc(ret.len, sizeof(pdcp_radio_bearer_stats_t));
|
||||
assert(ret.rb != NULL && "Memory exhausted!");
|
||||
}
|
||||
|
||||
for(uint32_t i = 0; i < ret.len; ++i){
|
||||
memcpy(&ret.rb[i] , it, sizeof(pdcp_radio_bearer_stats_t));
|
||||
it += sizeof(pdcp_radio_bearer_stats_t);
|
||||
}
|
||||
|
||||
memcpy(&ret.tstamp, it, sizeof(ret.tstamp));
|
||||
it += sizeof(ret.tstamp);
|
||||
|
||||
// memcpy(&ret.slot, it, sizeof(ret.slot));
|
||||
// it += sizeof(ret.slot);
|
||||
|
||||
assert(it == ind_msg + len && "Data layout mismatch");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
pdcp_call_proc_id_t pdcp_dec_call_proc_id_plain(size_t len, uint8_t const call_proc_id[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(call_proc_id != NULL);
|
||||
}
|
||||
|
||||
pdcp_ctrl_hdr_t pdcp_dec_ctrl_hdr_plain(size_t len, uint8_t const ctrl_hdr[len])
|
||||
{
|
||||
assert(len == sizeof(pdcp_ctrl_hdr_t));
|
||||
pdcp_ctrl_hdr_t ret;
|
||||
memcpy(&ret, ctrl_hdr, len);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pdcp_ctrl_msg_t pdcp_dec_ctrl_msg_plain(size_t len, uint8_t const ctrl_msg[len])
|
||||
{
|
||||
assert(len == sizeof(pdcp_ctrl_msg_t));
|
||||
pdcp_ctrl_msg_t ret;
|
||||
memcpy(&ret, ctrl_msg, len);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pdcp_ctrl_out_t pdcp_dec_ctrl_out_plain(size_t len, uint8_t const ctrl_out[len])
|
||||
{
|
||||
assert(len > 0);
|
||||
assert(ctrl_out!= NULL);
|
||||
assert(len == sizeof( pdcp_ctrl_out_t ) );
|
||||
pdcp_ctrl_out_t out = {0};
|
||||
memcpy(&out, ctrl_out, len);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
pdcp_func_def_t pdcp_dec_func_def_plain(size_t len, uint8_t const func[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(func != NULL);
|
||||
}
|
||||
|
||||
|
||||
51
executables/pdcp_sm/dec/pdcp_dec_plain.h
Normal file
51
executables/pdcp_sm/dec/pdcp_dec_plain.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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 PDCP_DECRYPTION_PLAIN_H
|
||||
#define PDCP_DECRYPTION_PLAIN_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "../ie/pdcp_data_ie.h"
|
||||
|
||||
|
||||
pdcp_event_trigger_t pdcp_dec_event_trigger_plain(size_t len, uint8_t const ev_tr[len]);
|
||||
|
||||
pdcp_action_def_t pdcp_dec_action_def_plain(size_t len, uint8_t const action_def[len]);
|
||||
|
||||
pdcp_ind_hdr_t pdcp_dec_ind_hdr_plain(size_t len, uint8_t const ind_hdr[len]);
|
||||
|
||||
pdcp_ind_msg_t pdcp_dec_ind_msg_plain(size_t len, uint8_t const ind_msg[len]);
|
||||
|
||||
pdcp_call_proc_id_t pdcp_dec_call_proc_id_plain(size_t len, uint8_t const call_proc_id[len]);
|
||||
|
||||
pdcp_ctrl_hdr_t pdcp_dec_ctrl_hdr_plain(size_t len, uint8_t const ctrl_hdr[len]);
|
||||
|
||||
pdcp_ctrl_msg_t pdcp_dec_ctrl_msg_plain(size_t len, uint8_t const ctrl_msg[len]);
|
||||
|
||||
pdcp_ctrl_out_t pdcp_dec_ctrl_out_plain(size_t len, uint8_t const ctrl_out[len]);
|
||||
|
||||
pdcp_func_def_t pdcp_dec_func_def_plain(size_t len, uint8_t const func[len]);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
135
executables/pdcp_sm/enc/pdcp_enc_asn.c
Normal file
135
executables/pdcp_sm/enc/pdcp_enc_asn.c
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "pdcp_enc_asn.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
//#include "asn_application.h"
|
||||
|
||||
/*
|
||||
static
|
||||
byte_array_t encode(const void* pdu, asn_TYPE_descriptor_t type)
|
||||
{
|
||||
assert(pdu != NULL);
|
||||
byte_array_t b = {.buf = malloc(2048), .len = 2048};
|
||||
assert(b.buf != NULL);
|
||||
// xer_fprint(stderr, &asn_DEF_E2AP_PDU, pdu);
|
||||
const enum asn_transfer_syntax syntax = ATS_ALIGNED_BASIC_PER;
|
||||
asn_enc_rval_t er = asn_encode_to_buffer(NULL, syntax, &type, pdu, b.buf, b.len);
|
||||
assert(er.encoded < (ssize_t) b.len);
|
||||
if(er.encoded == -1) {
|
||||
printf("Failed the encoding in type %s and xml_type = %s\n", er.failed_type->name, er.failed_type->xml_tag);
|
||||
fflush(stdout);
|
||||
assert(0!=0 && "Failed encoding");
|
||||
}
|
||||
assert(er.encoded > -1);
|
||||
b.len = er.encoded;
|
||||
return b;
|
||||
}
|
||||
*/
|
||||
|
||||
byte_array_t pdcp_enc_event_trigger_asn(pdcp_event_trigger_t const* event_trigger)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(event_trigger != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_action_def_asn(pdcp_action_def_t const* action_def)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(action_def != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_ind_hdr_asn(pdcp_ind_hdr_t const* ind_hdr)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ind_hdr != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_ind_msg_asn(pdcp_ind_msg_t const* ind_msg)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ind_msg != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
|
||||
byte_array_t pdcp_enc_call_proc_id_asn(pdcp_call_proc_id_t const* call_proc_id)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(call_proc_id != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_hdr_asn(pdcp_ctrl_hdr_t const* ctrl_hdr)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ctrl_hdr != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_msg_asn(pdcp_ctrl_msg_t const* ctrl_msg)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ctrl_msg != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_out_asn(pdcp_ctrl_out_t const* ctrl_out)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ctrl_out != NULL );
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_func_def_asn(pdcp_func_def_t const* func)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(func != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
54
executables/pdcp_sm/enc/pdcp_enc_asn.h
Normal file
54
executables/pdcp_sm/enc/pdcp_enc_asn.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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 PDCP_ENCRYPTIOIN_ASN_H
|
||||
#define PDCP_ENCRYPTIOIN_ASN_H
|
||||
|
||||
#include "../../../util/byte_array.h"
|
||||
#include "../ie/pdcp_data_ie.h"
|
||||
|
||||
// Used for static polymorphism.
|
||||
// See pdcp_enc_generic.h file
|
||||
typedef struct{
|
||||
|
||||
} pdcp_enc_asn_t;
|
||||
|
||||
byte_array_t pdcp_enc_event_trigger_asn(pdcp_event_trigger_t const* event_trigger);
|
||||
|
||||
byte_array_t pdcp_enc_action_def_asn(pdcp_action_def_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_ind_hdr_asn(pdcp_ind_hdr_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_ind_msg_asn(pdcp_ind_msg_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_call_proc_id_asn(pdcp_call_proc_id_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_hdr_asn(pdcp_ctrl_hdr_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_msg_asn(pdcp_ctrl_msg_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_out_asn(pdcp_ctrl_out_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_func_def_asn(pdcp_func_def_t const*);
|
||||
|
||||
#endif
|
||||
|
||||
143
executables/pdcp_sm/enc/pdcp_enc_fb.c
Normal file
143
executables/pdcp_sm/enc/pdcp_enc_fb.c
Normal file
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#include "pdcp_enc_fb.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
//#include "../ie/fb/e2sm_pdcp_stats_v00_builder.h"
|
||||
//#include "../ie/fb/e2sm_pdcp_stats_v00_verifier.h"
|
||||
|
||||
|
||||
/*
|
||||
byte_array_t pdcp_enc_event_trigger_fb(pdcp_event_trigger_t const* event_trigger)
|
||||
{
|
||||
assert(event_trigger != NULL);
|
||||
|
||||
flatcc_builder_t builder;
|
||||
flatcc_builder_init(&builder);
|
||||
|
||||
E2SM_MACStats_EventTrigger_start_as_root(&builder);
|
||||
|
||||
if(event_trigger->ms == 1){
|
||||
E2SM_MACStats_EventTrigger_trig_add(&builder, E2SM_MACStats_TriggerNature_oneMs );
|
||||
} else if(event_trigger->ms == 2){
|
||||
E2SM_MACStats_EventTrigger_trig_add(&builder, E2SM_MACStats_TriggerNature_twoMs );
|
||||
} else if(event_trigger->ms == 5){
|
||||
E2SM_MACStats_EventTrigger_trig_add(&builder, E2SM_MACStats_TriggerNature_fiveMs );
|
||||
} else {
|
||||
assert(0!=0 && "Not foreseen state");
|
||||
}
|
||||
|
||||
|
||||
E2SM_MACStats_EventTrigger_end_as_root(&builder);
|
||||
|
||||
|
||||
size_t size = 0;
|
||||
uint8_t *buf = flatcc_builder_finalize_buffer(&builder, &size);
|
||||
byte_array_t ba = { .buf = buf, .len = size };
|
||||
|
||||
int ret;
|
||||
if ((ret = E2SM_MACStats_EventTrigger_verify_as_root(buf, size))) {
|
||||
printf("Event trigger is invalid: %s\n", flatcc_verify_error_string(ret));
|
||||
assert(0);
|
||||
}
|
||||
|
||||
flatcc_builder_clear(&builder);
|
||||
|
||||
return ba;
|
||||
}
|
||||
*/
|
||||
|
||||
byte_array_t pdcp_enc_action_def_fb(pdcp_action_def_t const* action_def)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(action_def != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_ind_hdr_fb(pdcp_ind_hdr_t const* ind_hdr)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ind_hdr != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_ind_msg_fb(pdcp_ind_msg_t const* ind_msg)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ind_msg != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_call_proc_id_fb(pdcp_call_proc_id_t const* call_proc_id)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(call_proc_id != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_hdr_fb(pdcp_ctrl_hdr_t const* ctrl_hdr)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ctrl_hdr != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_msg_fb(pdcp_ctrl_msg_t const* ctrl_msg)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ctrl_msg != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_out_fb(pdcp_ctrl_out_t const* ctrl_out)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ctrl_out != NULL );
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_func_def_fb(pdcp_func_def_t const* func)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(func != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
56
executables/pdcp_sm/enc/pdcp_enc_fb.h
Normal file
56
executables/pdcp_sm/enc/pdcp_enc_fb.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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 PDCP_ENCRYPTION_FLATBUFFERS_H
|
||||
#define PDCP_ENCRYPTION_FLATBUFFERS_H
|
||||
|
||||
#include "../../../util/byte_array.h"
|
||||
#include "../ie/pdcp_data_ie.h"
|
||||
|
||||
|
||||
// Used for static polymorphism.
|
||||
// View pdcp_enc_generic file
|
||||
typedef struct{
|
||||
|
||||
} pdcp_enc_fb_t;
|
||||
|
||||
byte_array_t pdcp_enc_event_trigger_fb(pdcp_event_trigger_t const* event_trigger);
|
||||
|
||||
byte_array_t pdcp_enc_action_def_fb(pdcp_action_def_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_ind_hdr_fb(pdcp_ind_hdr_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_ind_msg_fb(pdcp_ind_msg_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_call_proc_id_fb(pdcp_call_proc_id_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_hdr_fb(pdcp_ctrl_hdr_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_msg_fb(pdcp_ctrl_msg_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_out_fb(pdcp_ctrl_out_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_func_def_fb(pdcp_func_def_t const*);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
92
executables/pdcp_sm/enc/pdcp_enc_generic.h
Normal file
92
executables/pdcp_sm/enc/pdcp_enc_generic.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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 PDCP_ENCRYPTION_GENERIC
|
||||
#define PDCP_ENCRYPTION_GENERIC
|
||||
|
||||
#include "pdcp_enc_asn.h"
|
||||
#include "pdcp_enc_fb.h"
|
||||
#include "pdcp_enc_plain.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// 9 Information Elements that are interpreted by the SM according
|
||||
// to ORAN-WG3.E2SM-v01.00.00 Technical Specification
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#define pdcp_enc_event_trigger(T,U) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_enc_event_trigger_plain, \
|
||||
pdcp_enc_asn_t*: pdcp_enc_event_trigger_asn,\
|
||||
pdcp_enc_fb_t*: pdcp_enc_event_trigger_fb,\
|
||||
default: pdcp_enc_event_trigger_plain) (U)
|
||||
|
||||
#define pdcp_enc_action_def(T,U) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_enc_action_def_plain, \
|
||||
pdcp_enc_asn_t*: pdcp_enc_action_def_asn, \
|
||||
pdcp_enc_fb_t*: pdcp_enc_action_def_fb, \
|
||||
default: pdcp_enc_action_def_plain) (U)
|
||||
|
||||
#define pdcp_enc_ind_hdr(T,U) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_enc_ind_hdr_plain , \
|
||||
pdcp_enc_asn_t*: pdcp_enc_ind_hdr_asn, \
|
||||
pdcp_enc_fb_t*: pdcp_enc_ind_hdr_fb, \
|
||||
default: pdcp_enc_ind_hdr_plain) (U)
|
||||
|
||||
#define pdcp_enc_ind_msg(T,U) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_enc_ind_msg_plain , \
|
||||
pdcp_enc_asn_t*: pdcp_enc_ind_msg_asn, \
|
||||
pdcp_enc_fb_t*: pdcp_enc_ind_msg_fb, \
|
||||
default: pdcp_enc_ind_msg_plain) (U)
|
||||
|
||||
#define pdcp_enc_call_proc_id(T,U) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_enc_call_proc_id_plain , \
|
||||
pdcp_enc_asn_t*: pdcp_enc_call_proc_id_asn, \
|
||||
pdcp_enc_fb_t*: pdcp_enc_call_proc_id_fb, \
|
||||
default: pdcp_enc_call_proc_id_plain) (U)
|
||||
|
||||
#define pdcp_enc_ctrl_hdr(T,U) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_enc_ctrl_hdr_plain , \
|
||||
pdcp_enc_asn_t*: pdcp_enc_ctrl_hdr_asn, \
|
||||
pdcp_enc_fb_t*: pdcp_enc_ctrl_hdr_fb, \
|
||||
default: pdcp_enc_ctrl_hdr_plain) (U)
|
||||
|
||||
#define pdcp_enc_ctrl_msg(T,U) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_enc_ctrl_msg_plain , \
|
||||
pdcp_enc_asn_t*: pdcp_enc_ctrl_msg_asn, \
|
||||
pdcp_enc_fb_t*: pdcp_enc_ctrl_msg_fb, \
|
||||
default: pdcp_enc_ctrl_msg_plain) (U)
|
||||
|
||||
#define pdcp_enc_ctrl_out(T,U) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_enc_ctrl_out_plain , \
|
||||
pdcp_enc_asn_t*: pdcp_enc_ctrl_out_asn, \
|
||||
pdcp_enc_fb_t*: pdcp_enc_ctrl_out_fb, \
|
||||
default: pdcp_enc_ctrl_out_plain) (U)
|
||||
|
||||
#define pdcp_enc_func_def(T,U) _Generic ((T), \
|
||||
pdcp_enc_plain_t*: pdcp_enc_func_def_plain, \
|
||||
pdcp_enc_asn_t*: pdcp_enc_func_def_asn, \
|
||||
pdcp_enc_fb_t*: pdcp_enc_func_def_fb, \
|
||||
default: pdcp_enc_func_def_plain) (U)
|
||||
|
||||
#endif
|
||||
|
||||
159
executables/pdcp_sm/enc/pdcp_enc_plain.c
Normal file
159
executables/pdcp_sm/enc/pdcp_enc_plain.c
Normal file
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "pdcp_enc_plain.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
byte_array_t pdcp_enc_event_trigger_plain(pdcp_event_trigger_t const* event_trigger)
|
||||
{
|
||||
assert(event_trigger != NULL);
|
||||
byte_array_t ba = {0};
|
||||
|
||||
ba.len = sizeof(event_trigger->ms);
|
||||
ba.buf = malloc(ba.len);
|
||||
assert(ba.buf != NULL && "Memory exhausted");
|
||||
|
||||
memcpy(ba.buf, &event_trigger->ms, ba.len);
|
||||
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_action_def_plain(pdcp_action_def_t const* action_def)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(action_def != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_ind_hdr_plain(pdcp_ind_hdr_t const* ind_hdr)
|
||||
{
|
||||
assert(ind_hdr != NULL);
|
||||
|
||||
byte_array_t ba = {0};
|
||||
|
||||
ba.len = sizeof(pdcp_ind_hdr_t);
|
||||
ba.buf = malloc(sizeof(pdcp_ind_msg_t));
|
||||
assert(ba.buf != NULL && "memory exhausted");
|
||||
memcpy(ba.buf, ind_hdr, sizeof(pdcp_ind_hdr_t));
|
||||
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_ind_msg_plain(pdcp_ind_msg_t const* ind_msg)
|
||||
{
|
||||
assert(ind_msg != NULL);
|
||||
|
||||
byte_array_t ba = {0};
|
||||
|
||||
size_t const sz = sizeof(ind_msg->len) +
|
||||
sizeof(ind_msg->tstamp) +
|
||||
// sizeof(ind_msg->slot) +
|
||||
sizeof(pdcp_radio_bearer_stats_t )*ind_msg->len;
|
||||
|
||||
ba.buf = malloc(sz);
|
||||
assert(ba.buf != NULL && "Memory exhausted");
|
||||
|
||||
memcpy(ba.buf, &ind_msg->len, sizeof(ind_msg->len) );
|
||||
|
||||
void* it = ba.buf + sizeof(ind_msg->len);
|
||||
|
||||
for(uint32_t i = 0 ; i < ind_msg->len; ++i){
|
||||
memcpy(it, &ind_msg->rb[i], sizeof(pdcp_radio_bearer_stats_t));
|
||||
it += sizeof(pdcp_radio_bearer_stats_t);
|
||||
}
|
||||
|
||||
memcpy(it, &ind_msg->tstamp, sizeof(ind_msg->tstamp));
|
||||
it += sizeof(ind_msg->tstamp);
|
||||
// memcpy(it, &ind_msg->slot, sizeof(ind_msg->slot));
|
||||
// it += sizeof(ind_msg->slot);
|
||||
assert(it == ba.buf + sz && "Mismatch of data layout" );
|
||||
|
||||
ba.len = sz;
|
||||
return ba;
|
||||
}
|
||||
|
||||
|
||||
byte_array_t pdcp_enc_call_proc_id_plain(pdcp_call_proc_id_t const* call_proc_id)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(call_proc_id != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_hdr_plain(pdcp_ctrl_hdr_t const* ctrl_hdr)
|
||||
{
|
||||
assert(ctrl_hdr != NULL);
|
||||
byte_array_t ba = {0};
|
||||
ba.buf = malloc(sizeof(pdcp_ind_msg_t));
|
||||
assert(ba.buf != NULL && "Memory exhausted");
|
||||
|
||||
memcpy(ba.buf, ctrl_hdr, sizeof(pdcp_ctrl_hdr_t));
|
||||
|
||||
ba.len = sizeof(pdcp_ctrl_hdr_t);
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_msg_plain(pdcp_ctrl_msg_t const* ctrl_msg)
|
||||
{
|
||||
assert(ctrl_msg != NULL);
|
||||
|
||||
byte_array_t ba = {0};
|
||||
ba.buf = malloc(sizeof(pdcp_ctrl_msg_t));
|
||||
assert(ba.buf != NULL && "Memory exhausted");
|
||||
|
||||
memcpy(ba.buf, ctrl_msg, sizeof(pdcp_ctrl_msg_t));
|
||||
|
||||
ba.len = sizeof(pdcp_ctrl_hdr_t);
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_out_plain(pdcp_ctrl_out_t const* ctrl_out)
|
||||
{
|
||||
assert(ctrl_out != NULL );
|
||||
byte_array_t ba = {0};
|
||||
ba.buf = malloc(sizeof(pdcp_ctrl_out_t ) );
|
||||
assert(ba.buf != NULL && "Memory exhausted");
|
||||
|
||||
memcpy(ba.buf, ctrl_out, sizeof(pdcp_ctrl_out_t));
|
||||
ba.len = sizeof(pdcp_ctrl_out_t);
|
||||
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t pdcp_enc_func_def_plain(pdcp_func_def_t const* func)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(func!= NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
57
executables/pdcp_sm/enc/pdcp_enc_plain.h
Normal file
57
executables/pdcp_sm/enc/pdcp_enc_plain.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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 PDCP_ENCRYPTION_PLAIN_H
|
||||
#define PDCP_ENCRYPTION_PLAIN_H
|
||||
|
||||
#include "../../../util/byte_array.h"
|
||||
#include "../ie/pdcp_data_ie.h"
|
||||
|
||||
|
||||
// Used for static polymorphism.
|
||||
// View pdcp_enc_generic file
|
||||
typedef struct{
|
||||
|
||||
} pdcp_enc_plain_t;
|
||||
|
||||
|
||||
byte_array_t pdcp_enc_event_trigger_plain(pdcp_event_trigger_t const* event_trigger);
|
||||
|
||||
byte_array_t pdcp_enc_action_def_plain(pdcp_action_def_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_ind_hdr_plain(pdcp_ind_hdr_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_ind_msg_plain(pdcp_ind_msg_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_call_proc_id_plain(pdcp_call_proc_id_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_hdr_plain(pdcp_ctrl_hdr_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_msg_plain(pdcp_ctrl_msg_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_ctrl_out_plain(pdcp_ctrl_out_t const*);
|
||||
|
||||
byte_array_t pdcp_enc_func_def_plain(pdcp_func_def_t const*);
|
||||
|
||||
#endif
|
||||
|
||||
238
executables/pdcp_sm/ie/e2sm_pdcp_v00.asn
Normal file
238
executables/pdcp_sm/ie/e2sm_pdcp_v00.asn
Normal file
@@ -0,0 +1,238 @@
|
||||
--/*
|
||||
-- * 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
|
||||
-- */
|
||||
|
||||
|
||||
|
||||
-- ASN1 START
|
||||
-- **************************************************************
|
||||
-- E2SM-PDCP Stats
|
||||
-- Information Element Definitions
|
||||
--
|
||||
-- **************************************************************
|
||||
|
||||
E2SM-PDCPStats-IEs { }
|
||||
|
||||
DEFINITIONS AUTOMATIC TAGS ::=
|
||||
|
||||
BEGIN
|
||||
|
||||
-- **************************************************************
|
||||
--
|
||||
-- Lists
|
||||
--
|
||||
-- **************************************************************
|
||||
|
||||
maxofRANParameters INTEGER ::= 255
|
||||
|
||||
-- E2 Service model IEs
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Event Trigger Definition OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- E2SM-PDCPStats-EventTriggerDefinition IE
|
||||
E2SM-PDCPStats-EventTriggerDefinition ::= CHOICE{
|
||||
eventDefinition-Format1 E2SM-PDCPStats-EventTriggerDefinition-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-PDCPStats-eventTriggerDefinition IE Format 1
|
||||
E2SM-PDCPStats-EventTriggerDefinition-Format1 ::= SEQUENCE{
|
||||
triggerNature PDCPStats-TriggerNature,
|
||||
...
|
||||
}
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Action Definition OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
E2SM-PDCPStats-ActionDefinition ::= CHOICE{
|
||||
actionDefinition-Format1 E2SM-PDCPStats-ActionDefinition-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-PDCPStats-actionDefinition IE used for Action Format 1
|
||||
E2SM-PDCPStats-ActionDefinition-Format1 ::= SEQUENCE{
|
||||
ranParameter-List SEQUENCE (SIZE(1..maxofRANParameters)) OF RANparameter-Item OPTIONAL,
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Indication Header OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
E2SM-PDCPStats-IndicationHeader ::= CHOICE{
|
||||
indicationHeader-Format1 E2SM-PDCPStats-IndicationHeader-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-PDCPStats-indicationHeader Format 1
|
||||
E2SM-PDCPStats-IndicationHeader-Format1 ::= SEQUENCE{
|
||||
indicationHeaderParam PDCPStats-Header,
|
||||
...
|
||||
}
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Indication Message OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- E2SM-PDCPStats-indicationMessage IE
|
||||
E2SM-PDCPStats-IndicationMessage ::= CHOICE{
|
||||
indicationMessage-Format1 E2SM-PDCPStats-IndicationMessage-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-PDCPStats-IndicationMessage Format 1
|
||||
E2SM-PDCPStats-IndicationMessage-Format1 ::= SEQUENCE{
|
||||
indicationMsgParam PDCPStats-Message,
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Call Process ID
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- Not defined in this E2SM
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Control Header OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- E2SM-PDCPStats-ControlHeader
|
||||
E2SM-PDCPStats-ControlHeader ::= CHOICE{
|
||||
controlHeader-Format1 E2SM-PDCPStats-ControlHeader-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-PDCPStats-ControlHeader Format 1
|
||||
E2SM-PDCPStats-ControlHeader-Format1 ::= SEQUENCE{
|
||||
controlHeaderParam PDCPStats-Header,
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Control Message OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- E2SM-PDCPStats-ControlMessage
|
||||
E2SM-PDCPStats-ControlMessage ::= CHOICE{
|
||||
controlMessage-Format1 E2SM-PDCPStats-ControlMessage-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-PDCPStats-controlMessage Format 1
|
||||
E2SM-PDCPStats-ControlMessage-Format1 ::= SEQUENCE{
|
||||
controlMsgParam PDCPStats-Message,
|
||||
...
|
||||
}
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Control Outcome OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- Not defined in this E2SM
|
||||
|
||||
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- RAN Function definition OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- Not defined in this E2SM
|
||||
|
||||
|
||||
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- commmon IEs
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- A
|
||||
-- B
|
||||
-- C
|
||||
-- D
|
||||
-- E
|
||||
-- F
|
||||
-- G
|
||||
-- H
|
||||
|
||||
PDCPStats-Header ::= INTEGER
|
||||
|
||||
PDCPStats-Message ::= OCTET STRING
|
||||
|
||||
PDCPStats-TriggerNature ::= ENUMERATED{
|
||||
oneMs,
|
||||
twoMs,
|
||||
fiveMs,
|
||||
...
|
||||
}
|
||||
-- I
|
||||
-- J
|
||||
-- K
|
||||
-- L
|
||||
-- M
|
||||
-- N
|
||||
-- O
|
||||
-- P
|
||||
-- Q
|
||||
-- R
|
||||
|
||||
|
||||
RANparameter-Item ::= SEQUENCE {
|
||||
ranParameter-ID RANparameter-ID,
|
||||
ranParameter-Name RANparameter-Name,
|
||||
ranParameter-Test RANparameter-Test,
|
||||
ranParameter-Value RANparameter-Value,
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
RANparameter-ID ::= INTEGER (0..maxofRANParameters)
|
||||
|
||||
RANparameter-Name ::= OCTET STRING
|
||||
|
||||
RANparameter-Test ::= ENUMERATED{
|
||||
equal,
|
||||
greaterthan,
|
||||
lessthan,
|
||||
contains,
|
||||
present,
|
||||
...
|
||||
}
|
||||
|
||||
RANparameter-Value ::= OCTET STRING
|
||||
|
||||
-- S
|
||||
-- T
|
||||
-- U
|
||||
-- V
|
||||
-- W
|
||||
-- X
|
||||
-- Y
|
||||
-- Z
|
||||
|
||||
END
|
||||
-- ASN1STOP
|
||||
|
||||
160
executables/pdcp_sm/ie/e2sm_pdcp_v00.fbs
Normal file
160
executables/pdcp_sm/ie/e2sm_pdcp_v00.fbs
Normal file
@@ -0,0 +1,160 @@
|
||||
// /*
|
||||
// * 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
|
||||
// */
|
||||
|
||||
|
||||
|
||||
// FLATBUFFERS START
|
||||
// **************************************************************
|
||||
// E2SM_PDCP Stats
|
||||
// Information Element Definitions
|
||||
//
|
||||
// **************************************************************
|
||||
|
||||
|
||||
// TODO IMPORTANT!!! TO ALIGN WITH THE PDCP IE
|
||||
|
||||
namespace E2SM_PDCPStats;
|
||||
|
||||
|
||||
//-- ---------------------------------------------------
|
||||
//-- Event Trigger Definition OCTET STRING contents
|
||||
//-- ---------------------------------------------------
|
||||
|
||||
enum TriggerNature: uint8 { oneMs, twoMs, fiveMs }
|
||||
table EventTriggerDefinitionFormat1 {
|
||||
triggerNature: TriggerNature;
|
||||
}
|
||||
|
||||
table EventTrigger {
|
||||
trig: TriggerNature;
|
||||
}
|
||||
//root_type EventTrigger;
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Action Definition OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
enum RanParameterTest: uint8 { equal, greaterThan, lessThan, contains, present }
|
||||
table RanParameterItem {
|
||||
id: uint32;
|
||||
name: string;
|
||||
test: RanParameterTest;
|
||||
value: string;
|
||||
}
|
||||
table ActionDefinitionFormat1 {
|
||||
ranParameterList: [RanParameterItem];
|
||||
}
|
||||
union ActionDefinitionUnion {
|
||||
actionDefF1: ActionDefinitionFormat1
|
||||
}
|
||||
table ActionDefinition {
|
||||
def: ActionDefinitionUnion;
|
||||
}
|
||||
//root_type ActionDefinition;
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Indication Header OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
table IndicationHeaderFormat1 {
|
||||
param: int32;
|
||||
}
|
||||
union IndicationHeaderUnion {
|
||||
indHeaderF1: IndicationHeaderFormat1
|
||||
}
|
||||
table IndicationHeader {
|
||||
hdr: IndicationHeaderUnion;
|
||||
}
|
||||
//root_type IndicationHeader;
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Indication Message OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
table IndicationMessage {
|
||||
tx_bytes : uint32_t;
|
||||
tx_pkts : uint32_t;
|
||||
|
||||
}
|
||||
//root_type IndicationMessage;
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Call Process ID
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
// -- Not defined in this E2SM
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Control Header OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
table ControlHeaderFormat1 {
|
||||
param: int32;
|
||||
}
|
||||
union ControlHeaderUnion {
|
||||
ctrlHeaderF1: ControlHeaderFormat1
|
||||
}
|
||||
table ControlHeader {
|
||||
hdr: ControlHeaderUnion;
|
||||
}
|
||||
//root_type ControlHeader;
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Control Message OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
|
||||
table ControlMessageFormat1 {
|
||||
param: [uint8];
|
||||
}
|
||||
union ControlMessageUnion {
|
||||
ctrlMessageF1: ControlMessageFormat1
|
||||
}
|
||||
table ControlMessage {
|
||||
msg: ControlMessageUnion;
|
||||
}
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- Control Outcome OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
// -- Not defined in this E2SM
|
||||
|
||||
|
||||
|
||||
// -- ---------------------------------------------------
|
||||
// -- RAN Function definition OCTET STRING contents
|
||||
// -- ---------------------------------------------------
|
||||
|
||||
// -- Not defined in this E2SM
|
||||
|
||||
|
||||
438
executables/pdcp_sm/ie/pdcp_data_ie.c
Normal file
438
executables/pdcp_sm/ie/pdcp_data_ie.c
Normal file
@@ -0,0 +1,438 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#include "pdcp_data_ie.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Event Trigger Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_pdcp_event_trigger(pdcp_event_trigger_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
assert(0!=0 && "Not implemented" );
|
||||
}
|
||||
|
||||
pdcp_event_trigger_t cp_pdcp_event_trigger( pdcp_event_trigger_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
assert(0!=0 && "Not implemented" );
|
||||
|
||||
pdcp_event_trigger_t et = {0};
|
||||
return et;
|
||||
}
|
||||
|
||||
bool eq_pdcp_event_trigger(pdcp_event_trigger_t* m0, pdcp_event_trigger_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Action Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_pdcp_action_def(pdcp_action_def_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
}
|
||||
|
||||
pdcp_action_def_t cp_pdcp_action_def(pdcp_action_def_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
pdcp_action_def_t ad = {0};
|
||||
return ad;
|
||||
}
|
||||
|
||||
bool eq_pdcp_action_def(pdcp_event_trigger_t* m0, pdcp_event_trigger_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Indication Header
|
||||
/////////////////////////////////////
|
||||
|
||||
|
||||
void free_pdcp_ind_hdr(pdcp_ind_hdr_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
(void)src;
|
||||
}
|
||||
|
||||
pdcp_ind_hdr_t cp_pdcp_ind_hdr(pdcp_ind_hdr_t const* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
pdcp_ind_hdr_t dst = {0};
|
||||
dst.dummy = src->dummy;
|
||||
return dst;
|
||||
}
|
||||
|
||||
bool eq_pdcp_ind_hdr(pdcp_ind_hdr_t* m0, pdcp_ind_hdr_t* m1)
|
||||
{
|
||||
assert(m0 != 0);
|
||||
assert(m1 != 0);
|
||||
|
||||
if(m0->dummy != m1->dummy)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Indication Message
|
||||
/////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static
|
||||
bool check_pdcp_mode(uint8_t mode)
|
||||
{
|
||||
assert(mode == 0 || mode == 1 || mode == 2);
|
||||
return true;
|
||||
}
|
||||
|
||||
static
|
||||
bool check_pdcp_rbid(uint8_t rbid)
|
||||
{
|
||||
assert(rbid < 11); // [0,2] for srb and [3,10] for drb
|
||||
return true;
|
||||
}
|
||||
|
||||
static
|
||||
bool check_pdcp_bearer(pdcp_radio_bearer_stats_t* rb)
|
||||
{
|
||||
assert(rb != NULL);
|
||||
|
||||
// Pkts need to be less than bytes since a packet can only have [1,MTU+header)
|
||||
assert(rb->txpdu_pkts <= rb->txpdu_bytes);
|
||||
assert(rb->rxpdu_pkts <= rb->rxpdu_bytes);
|
||||
assert(rb->txsdu_pkts <= rb->txsdu_bytes);
|
||||
assert(rb->rxsdu_pkts <= rb->rxsdu_bytes);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static
|
||||
bool check_pdcp_invariants(pdcp_ind_msg_t const* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
|
||||
for(uint32_t i = 0; i < msg->len; ++i){
|
||||
pdcp_radio_bearer_stats_t* rb = &msg->rb[i];
|
||||
check_pdcp_mode(rb->mode);
|
||||
check_pdcp_rbid(rb->rbid);
|
||||
check_pdcp_bearer(rb);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void free_pdcp_ind_msg(pdcp_ind_msg_t* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
assert(check_pdcp_invariants(msg));
|
||||
|
||||
if(msg->len > 0)
|
||||
free(msg->rb);
|
||||
}
|
||||
|
||||
pdcp_ind_msg_t cp_pdcp_ind_msg(pdcp_ind_msg_t const* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
assert(check_pdcp_invariants(src));
|
||||
|
||||
pdcp_ind_msg_t dst = {0};
|
||||
|
||||
dst.tstamp = src->tstamp;
|
||||
// dst.frame = src->frame;
|
||||
// dst.slot = src->slot;
|
||||
dst.len = src->len;
|
||||
|
||||
|
||||
if(dst.len > 0){
|
||||
dst.rb = calloc(dst.len, sizeof(*dst.rb) );
|
||||
assert(dst.rb != NULL && "Memory exhausted");
|
||||
}
|
||||
|
||||
memcpy(dst.rb, src->rb, sizeof(*dst.rb)*src->len);
|
||||
return dst;
|
||||
}
|
||||
|
||||
bool eq_pdcp_ind_msg(pdcp_ind_msg_t* m0, pdcp_ind_msg_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
assert(check_pdcp_invariants(m0));
|
||||
assert(check_pdcp_invariants(m1));
|
||||
|
||||
if(m0->tstamp != m1->tstamp ||
|
||||
m0->len != m1->len ){
|
||||
assert(0 != 0 && "Impossible!");
|
||||
return false;
|
||||
}
|
||||
|
||||
for(uint32_t i =0; i < m0->len; ++i){
|
||||
pdcp_radio_bearer_stats_t* rb0 = &m0->rb[i];
|
||||
pdcp_radio_bearer_stats_t* rb1 = &m1->rb[i];
|
||||
|
||||
if( rb0->txpdu_pkts != rb1->txpdu_pkts ||
|
||||
rb0->txpdu_bytes != rb1->txpdu_bytes ||
|
||||
rb0->txpdu_sn != rb1->txpdu_sn ||
|
||||
rb0->rxpdu_pkts != rb1->rxpdu_pkts ||
|
||||
rb0->rxpdu_bytes != rb1->rxpdu_bytes ||
|
||||
rb0->rxpdu_sn != rb1->rxpdu_sn ||
|
||||
rb0->rxpdu_oo_pkts != rb1->rxpdu_oo_pkts ||
|
||||
rb0->rxpdu_oo_bytes != rb1->rxpdu_oo_bytes ||
|
||||
rb0->rxpdu_dd_pkts != rb1->rxpdu_dd_pkts ||
|
||||
rb0->rxpdu_dd_bytes != rb1->rxpdu_dd_bytes ||
|
||||
rb0->rxpdu_ro_count != rb1->rxpdu_ro_count ||
|
||||
rb0->txsdu_pkts != rb1->txsdu_pkts ||
|
||||
rb0->txsdu_bytes != rb1->txsdu_bytes ||
|
||||
rb0->rxsdu_pkts != rb1->rxsdu_pkts ||
|
||||
rb0->rxsdu_bytes != rb1->rxsdu_bytes ||
|
||||
rb0->rnti != rb1->rnti ||
|
||||
rb0->mode != rb1->mode ||
|
||||
rb0->rbid != rb1->rbid){
|
||||
|
||||
assert(0 != 0 && "Impossible!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Call Process ID
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_pdcp_call_proc_id(pdcp_call_proc_id_t* src)
|
||||
{
|
||||
// Note that the src could be NULL
|
||||
free(src);
|
||||
}
|
||||
|
||||
pdcp_call_proc_id_t cp_pdcp_call_proc_id( pdcp_call_proc_id_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
pdcp_call_proc_id_t dst = {0};
|
||||
|
||||
dst.dummy = src->dummy;
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
bool eq_pdcp_call_proc_id(pdcp_call_proc_id_t* m0, pdcp_call_proc_id_t* m1)
|
||||
{
|
||||
if(m0 == NULL && m1 == NULL)
|
||||
return true;
|
||||
if(m0 == NULL)
|
||||
return false;
|
||||
if(m1 == NULL)
|
||||
return false;
|
||||
|
||||
if(m0->dummy != m1->dummy)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Header
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_pdcp_ctrl_hdr( pdcp_ctrl_hdr_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
// No memory allocated
|
||||
(void)src;
|
||||
}
|
||||
|
||||
pdcp_ctrl_hdr_t cp_pdcp_ctrl_hdr(pdcp_ctrl_hdr_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
assert(0!=0 && "Not implemented" );
|
||||
pdcp_ctrl_hdr_t ret = {0};
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool eq_pdcp_ctrl_hdr(pdcp_ctrl_hdr_t* m0, pdcp_ctrl_hdr_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Message
|
||||
/////////////////////////////////////
|
||||
|
||||
|
||||
void free_pdcp_ctrl_msg( pdcp_ctrl_msg_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
// No memory allocated, so nothing to free
|
||||
(void)src;
|
||||
}
|
||||
|
||||
pdcp_ctrl_msg_t cp_pdcp_ctrl_msg(pdcp_ctrl_msg_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
pdcp_ctrl_msg_t ret = {0};
|
||||
|
||||
ret.action = src->action;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool eq_pdcp_ctrl_msg(pdcp_ctrl_msg_t* m0, pdcp_ctrl_msg_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
if(m0->action == m1->action)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Outcome
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_pdcp_ctrl_out(pdcp_ctrl_out_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
(void)src;
|
||||
// No heap memory allocated
|
||||
}
|
||||
|
||||
pdcp_ctrl_out_t cp_pdcp_ctrl_out(pdcp_ctrl_out_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
pdcp_ctrl_out_t ret = {0};
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool eq_pdcp_ctrl_out(pdcp_ctrl_out_t* m0, pdcp_ctrl_out_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RAN Function Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_pdcp_func_def( pdcp_func_def_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
}
|
||||
|
||||
pdcp_func_def_t cp_pdcp_func_def(pdcp_func_def_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
pdcp_func_def_t ret = {0};
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool eq_pdcp_func_def(pdcp_func_def_t* m0, pdcp_func_def_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////
|
||||
// RIC Indication
|
||||
///////////////
|
||||
|
||||
void free_pdcp_ind_data(pdcp_ind_data_t* ind)
|
||||
{
|
||||
assert(ind != NULL);
|
||||
|
||||
free_pdcp_ind_hdr(&ind->hdr);
|
||||
free_pdcp_ind_msg(&ind->msg);
|
||||
free_pdcp_call_proc_id(ind->proc_id);
|
||||
}
|
||||
|
||||
pdcp_ind_data_t cp_pdcp_ind_data(pdcp_ind_data_t const* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
pdcp_ind_data_t dst = {0};
|
||||
|
||||
dst.hdr = cp_pdcp_ind_hdr(&src->hdr);
|
||||
dst.msg = cp_pdcp_ind_msg(&src->msg);
|
||||
|
||||
if(src->proc_id != NULL){
|
||||
dst.proc_id = malloc(sizeof(*dst.proc_id) );
|
||||
assert(dst.proc_id != NULL && "Memory exhausted");
|
||||
*dst.proc_id = cp_pdcp_call_proc_id(src->proc_id);
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
271
executables/pdcp_sm/ie/pdcp_data_ie.h
Normal file
271
executables/pdcp_sm/ie/pdcp_data_ie.h
Normal file
@@ -0,0 +1,271 @@
|
||||
/*
|
||||
* 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 PDCP_DATA_INFORMATION_ELEMENTS_H
|
||||
#define PDCP_DATA_INFORMATION_ELEMENTS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* 9 Information Elements (IE) , RIC Event Trigger Definition, RIC Action Definition, RIC Indication Header, RIC Indication Message, RIC Call Process ID, RIC Control Header, RIC Control Message, RIC Control Outcome and RAN Function Definition defined by ORAN-WG3.E2SM-v01.00.00 at Section 5
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Event Trigger Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct {
|
||||
uint32_t ms;
|
||||
} pdcp_event_trigger_t;
|
||||
|
||||
void free_pdcp_event_trigger(pdcp_event_trigger_t* src);
|
||||
|
||||
pdcp_event_trigger_t cp_pdcp_event_trigger( pdcp_event_trigger_t* src);
|
||||
|
||||
bool eq_pdcp_event_trigger(pdcp_event_trigger_t* m0, pdcp_event_trigger_t* m1);
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Action Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct {
|
||||
uint32_t dummy;
|
||||
} pdcp_action_def_t;
|
||||
|
||||
void free_pdcp_action_def(pdcp_action_def_t* src);
|
||||
|
||||
pdcp_action_def_t cp_pdcp_action_def(pdcp_action_def_t* src);
|
||||
|
||||
bool eq_pdcp_action_def(pdcp_event_trigger_t* m0, pdcp_event_trigger_t* m1);
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Indication Header
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct{
|
||||
uint32_t dummy;
|
||||
} pdcp_ind_hdr_t;
|
||||
|
||||
void free_pdcp_ind_hdr(pdcp_ind_hdr_t* src);
|
||||
|
||||
pdcp_ind_hdr_t cp_pdcp_ind_hdr(pdcp_ind_hdr_t const* src);
|
||||
|
||||
bool eq_pdcp_ind_hdr(pdcp_ind_hdr_t* m0, pdcp_ind_hdr_t* m1);
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Indication Message
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct{
|
||||
uint32_t txpdu_pkts; /* aggregated number of tx packets */
|
||||
uint32_t txpdu_bytes; /* aggregated bytes of tx packets */
|
||||
uint32_t txpdu_sn; /* current sequence number of last tx packet (or TX_NEXT) */
|
||||
uint32_t rxpdu_pkts; /* aggregated number of rx packets */
|
||||
uint32_t rxpdu_bytes; /* aggregated bytes of rx packets */
|
||||
uint32_t rxpdu_sn; /* current sequence number of last rx packet (or RX_NEXT) */
|
||||
uint32_t rxpdu_oo_pkts; /* aggregated number of out-of-order rx pkts (or RX_REORD) */
|
||||
uint32_t rxpdu_oo_bytes; /* aggregated amount of out-of-order rx bytes */
|
||||
uint32_t rxpdu_dd_pkts; /* aggregated number of duplicated discarded packets */
|
||||
uint32_t rxpdu_dd_bytes; /* aggregated amount of discarded packets' bytes */
|
||||
uint32_t rxpdu_ro_count; /* this state variable indicates the COUNT value */
|
||||
uint32_t txsdu_pkts; /* number of SDUs delivered */
|
||||
uint32_t txsdu_bytes; /* number of bytes of SDUs delivered */
|
||||
uint32_t rxsdu_pkts; /* number of SDUs received */
|
||||
uint32_t rxsdu_bytes; /* number of bytes of SDUs received */
|
||||
uint32_t rnti;
|
||||
uint8_t mode; /* 0: PDCP AM, 1: PDCP UM, 2: PDCP TM */
|
||||
uint8_t rbid;
|
||||
} pdcp_radio_bearer_stats_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t len;
|
||||
pdcp_radio_bearer_stats_t* rb;
|
||||
int64_t tstamp;
|
||||
|
||||
// uint16_t frame;
|
||||
// uint8_t slot;
|
||||
} pdcp_ind_msg_t;
|
||||
|
||||
void free_pdcp_ind_msg(pdcp_ind_msg_t* msg);
|
||||
|
||||
pdcp_ind_msg_t cp_pdcp_ind_msg(pdcp_ind_msg_t const* src);
|
||||
|
||||
bool eq_pdcp_ind_msg(pdcp_ind_msg_t* m0, pdcp_ind_msg_t* m1);
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Call Process ID
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct {
|
||||
uint32_t dummy;
|
||||
} pdcp_call_proc_id_t;
|
||||
|
||||
void free_pdcp_call_proc_id( pdcp_call_proc_id_t* src);
|
||||
|
||||
pdcp_call_proc_id_t cp_pdcp_call_proc_id( pdcp_call_proc_id_t* src);
|
||||
|
||||
bool eq_pdcp_call_proc_id(pdcp_call_proc_id_t* m0, pdcp_call_proc_id_t* m1);
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Header
|
||||
/////////////////////////////////////
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint32_t dummy;
|
||||
} pdcp_ctrl_hdr_t;
|
||||
|
||||
void free_pdcp_ctrl_hdr( pdcp_ctrl_hdr_t* src);
|
||||
|
||||
pdcp_ctrl_hdr_t cp_pdcp_ctrl_hdr(pdcp_ctrl_hdr_t* src);
|
||||
|
||||
bool eq_pdcp_ctrl_hdr(pdcp_ctrl_hdr_t* m0, pdcp_ctrl_hdr_t* m1);
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Message
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct {
|
||||
uint32_t action;
|
||||
} pdcp_ctrl_msg_t;
|
||||
|
||||
void free_pdcp_ctrl_msg( pdcp_ctrl_msg_t* src);
|
||||
|
||||
pdcp_ctrl_msg_t cp_pdcp_ctrl_msg(pdcp_ctrl_msg_t* src);
|
||||
|
||||
bool eq_pdcp_ctrl_msg(pdcp_ctrl_msg_t* m0, pdcp_ctrl_msg_t* m1);
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Outcome
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef enum{
|
||||
PDCP_CTRL_OUT_OK,
|
||||
|
||||
|
||||
PDCP_CTRL_OUT_END
|
||||
} pdcp_ctrl_out_e;
|
||||
|
||||
typedef struct {
|
||||
pdcp_ctrl_out_e ans;
|
||||
} pdcp_ctrl_out_t;
|
||||
|
||||
void free_pdcp_ctrl_out(pdcp_ctrl_out_t* src);
|
||||
|
||||
pdcp_ctrl_out_t cp_pdcp_ctrl_out(pdcp_ctrl_out_t* src);
|
||||
|
||||
bool eq_pdcp_ctrl_out(pdcp_ctrl_out_t* m0, pdcp_ctrl_out_t* m1);
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RAN Function Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct {
|
||||
uint32_t dummy;
|
||||
} pdcp_func_def_t;
|
||||
|
||||
void free_pdcp_func_def( pdcp_func_def_t* src);
|
||||
|
||||
pdcp_func_def_t cp_pdcp_func_def(pdcp_func_def_t* src);
|
||||
|
||||
bool eq_pdcp_func_def(pdcp_func_def_t* m0, pdcp_func_def_t* m1);
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
/*
|
||||
* O-RAN defined 5 Procedures: RIC Subscription, RIC Indication, RIC Control, E2 Setup and RIC Service Update
|
||||
* */
|
||||
|
||||
|
||||
///////////////
|
||||
/// RIC Subscription
|
||||
///////////////
|
||||
|
||||
typedef struct{
|
||||
pdcp_event_trigger_t et;
|
||||
pdcp_action_def_t* ad;
|
||||
} pdcp_sub_data_t;
|
||||
|
||||
|
||||
///////////////
|
||||
// RIC Indication
|
||||
///////////////
|
||||
|
||||
typedef struct{
|
||||
pdcp_ind_hdr_t hdr;
|
||||
pdcp_ind_msg_t msg;
|
||||
pdcp_call_proc_id_t* proc_id;
|
||||
} pdcp_ind_data_t;
|
||||
|
||||
void free_pdcp_ind_data(pdcp_ind_data_t* ind);
|
||||
|
||||
pdcp_ind_data_t cp_pdcp_ind_data(pdcp_ind_data_t const* src);
|
||||
|
||||
|
||||
///////////////
|
||||
// RIC Control
|
||||
///////////////
|
||||
|
||||
typedef struct{
|
||||
pdcp_ctrl_hdr_t hdr;
|
||||
pdcp_ctrl_msg_t msg;
|
||||
} pdcp_ctrl_req_data_t;
|
||||
|
||||
typedef struct{
|
||||
pdcp_ctrl_out_t* out;
|
||||
} pdcp_ctrl_out_data_t;
|
||||
|
||||
///////////////
|
||||
// E2 Setup
|
||||
///////////////
|
||||
|
||||
typedef struct{
|
||||
pdcp_func_def_t func_def;
|
||||
} pdcp_e2_setup_data_t;
|
||||
|
||||
///////////////
|
||||
// RIC Service Update
|
||||
///////////////
|
||||
|
||||
typedef struct{
|
||||
pdcp_func_def_t func_def;
|
||||
} pdcp_ric_service_update_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
199
executables/pdcp_sm/pdcp_sm_agent.c
Normal file
199
executables/pdcp_sm/pdcp_sm_agent.c
Normal file
@@ -0,0 +1,199 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#include "pdcp_sm_agent.h"
|
||||
#include "pdcp_sm_id.h"
|
||||
#include "enc/pdcp_enc_generic.h"
|
||||
#include "dec/pdcp_dec_generic.h"
|
||||
#include "../../util/alg_ds/alg/defer.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct{
|
||||
|
||||
sm_agent_t base;
|
||||
|
||||
#ifdef ASN
|
||||
pdcp_enc_asn_t enc;
|
||||
#elif FLATBUFFERS
|
||||
pdcp_enc_fb_t enc;
|
||||
#elif PLAIN
|
||||
pdcp_enc_plain_t enc;
|
||||
#else
|
||||
static_assert(false, "No encryptioin type selected");
|
||||
#endif
|
||||
|
||||
} sm_pdcp_agent_t;
|
||||
|
||||
|
||||
// Function pointers provided by the RAN for the
|
||||
// 5 procedures,
|
||||
// subscription, indication, control,
|
||||
// E2 Setup and RIC Service Update.
|
||||
//
|
||||
static
|
||||
subscribe_timer_t on_subscription_pdcp_sm_ag(sm_agent_t* sm_agent, const sm_subs_data_t* data)
|
||||
{
|
||||
assert(sm_agent != NULL);
|
||||
assert(data != NULL);
|
||||
|
||||
sm_pdcp_agent_t* sm = (sm_pdcp_agent_t*)sm_agent;
|
||||
|
||||
pdcp_event_trigger_t ev = pdcp_dec_event_trigger(&sm->enc, data->len_et, data->event_trigger);
|
||||
|
||||
subscribe_timer_t timer = {.ms = ev.ms };
|
||||
return timer;
|
||||
}
|
||||
|
||||
static
|
||||
sm_ind_data_t on_indication_pdcp_sm_ag(sm_agent_t* sm_agent)
|
||||
{
|
||||
//printf("on_indication called \n");
|
||||
|
||||
assert(sm_agent != NULL);
|
||||
sm_pdcp_agent_t* sm = (sm_pdcp_agent_t*)sm_agent;
|
||||
|
||||
sm_ind_data_t ret = {0};
|
||||
|
||||
// Fill Indication Header
|
||||
pdcp_ind_hdr_t hdr = {.dummy = 0 };
|
||||
byte_array_t ba_hdr = pdcp_enc_ind_hdr(&sm->enc, &hdr );
|
||||
ret.ind_hdr = ba_hdr.buf;
|
||||
ret.len_hdr = ba_hdr.len;
|
||||
|
||||
// Fill Indication Message
|
||||
sm_ag_if_rd_t rd_if = {0};
|
||||
rd_if.type = PDCP_STATS_V0;
|
||||
sm->base.io.read(&rd_if);
|
||||
|
||||
// Liberate the memory if previously allocated by the RAN. It sucks
|
||||
pdcp_ind_data_t* ind = &rd_if.pdcp_stats;
|
||||
defer({ free_pdcp_ind_hdr(&ind->hdr) ;});
|
||||
defer({ free_pdcp_ind_msg(&ind->msg) ;});
|
||||
defer({ free_pdcp_call_proc_id(ind->proc_id);});
|
||||
|
||||
byte_array_t ba = pdcp_enc_ind_msg(&sm->enc, &rd_if.pdcp_stats.msg);
|
||||
ret.ind_msg = ba.buf;
|
||||
ret.len_msg = ba.len;
|
||||
|
||||
// Fill Call Process ID
|
||||
ret.call_process_id = NULL;
|
||||
ret.len_cpid = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static
|
||||
sm_ctrl_out_data_t on_control_pdcp_sm_ag(sm_agent_t* sm_agent, sm_ctrl_req_data_t const* data)
|
||||
{
|
||||
assert(sm_agent != NULL);
|
||||
assert(data != NULL);
|
||||
sm_pdcp_agent_t* sm = (sm_pdcp_agent_t*) sm_agent;
|
||||
|
||||
pdcp_ctrl_hdr_t hdr = pdcp_dec_ctrl_hdr(&sm->enc, data->len_hdr, data->ctrl_hdr);
|
||||
defer({ free_pdcp_ctrl_hdr(&hdr); });
|
||||
assert(hdr.dummy == 0 && "Only dummy == 0 supported ");
|
||||
|
||||
pdcp_ctrl_msg_t msg = pdcp_dec_ctrl_msg(&sm->enc, data->len_msg, data->ctrl_msg);
|
||||
defer({ free_pdcp_ctrl_msg(&msg); });
|
||||
assert(msg.action == 42 && "Only action number 42 supported");
|
||||
|
||||
sm_ag_if_wr_t wr = {.type = PDCP_CTRL_REQ_V0 };
|
||||
wr.pdcp_req_ctrl.msg = cp_pdcp_ctrl_msg(&msg);
|
||||
|
||||
// Call the RAN
|
||||
sm_ag_if_ans_t ans = sm->base.io.write(&wr);
|
||||
assert(ans.type == PDCP_AGENT_IF_CTRL_ANS_V0);
|
||||
defer({ free_pdcp_ctrl_out(&ans.pdcp); });
|
||||
|
||||
// Encode the answer from the RAN
|
||||
byte_array_t ba = pdcp_enc_ctrl_out(&sm->enc, &ans.pdcp);
|
||||
|
||||
sm_ctrl_out_data_t ret = {0};
|
||||
ret.len_out = ba.len;
|
||||
ret.ctrl_out = ba.buf;
|
||||
|
||||
// printf("on_control called \n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
static
|
||||
sm_e2_setup_t on_e2_setup_pdcp_sm_ag(sm_agent_t* sm_agent)
|
||||
{
|
||||
assert(sm_agent != NULL);
|
||||
//printf("on_e2_setup called \n");
|
||||
sm_pdcp_agent_t* sm = (sm_pdcp_agent_t*)sm_agent;
|
||||
|
||||
sm_e2_setup_t setup = {.len_rfd =0, .ran_fun_def = NULL };
|
||||
|
||||
setup.len_rfd = strlen(sm->base.ran_func_name);
|
||||
setup.ran_fun_def = calloc(1, strlen(sm->base.ran_func_name));
|
||||
assert(setup.ran_fun_def != NULL);
|
||||
memcpy(setup.ran_fun_def, sm->base.ran_func_name, strlen(sm->base.ran_func_name));
|
||||
|
||||
return setup;
|
||||
}
|
||||
|
||||
static
|
||||
void on_ric_service_update_pdcp_sm_ag(sm_agent_t* sm_agent, sm_ric_service_update_t const* data)
|
||||
{
|
||||
assert(sm_agent != NULL);
|
||||
assert(data != NULL);
|
||||
|
||||
|
||||
printf("on_ric_service_update called \n");
|
||||
}
|
||||
|
||||
static
|
||||
void free_pdcp_sm_ag(sm_agent_t* sm_agent)
|
||||
{
|
||||
assert(sm_agent != NULL);
|
||||
sm_pdcp_agent_t* sm = (sm_pdcp_agent_t*)sm_agent;
|
||||
free(sm);
|
||||
}
|
||||
|
||||
|
||||
sm_agent_t* make_pdcp_sm_agent(sm_io_ag_t io)
|
||||
{
|
||||
sm_pdcp_agent_t* sm = calloc(1, sizeof(*sm));
|
||||
assert(sm != NULL && "Memory exhausted!!!");
|
||||
|
||||
*(uint16_t*)(&sm->base.ran_func_id) = SM_PDCP_ID;
|
||||
|
||||
sm->base.io = io;
|
||||
sm->base.free_sm = free_pdcp_sm_ag;
|
||||
|
||||
// O-RAN E2SM 5 Procedures
|
||||
sm->base.proc.on_subscription = on_subscription_pdcp_sm_ag;
|
||||
sm->base.proc.on_indication = on_indication_pdcp_sm_ag;
|
||||
sm->base.proc.on_control = on_control_pdcp_sm_ag;
|
||||
sm->base.proc.on_ric_service_update = on_ric_service_update_pdcp_sm_ag;
|
||||
sm->base.proc.on_e2_setup = on_e2_setup_pdcp_sm_ag;
|
||||
|
||||
assert(strlen(SM_PDCP_STR) < sizeof( sm->base.ran_func_name) );
|
||||
memcpy(sm->base.ran_func_name, SM_PDCP_STR, strlen(SM_PDCP_STR));
|
||||
|
||||
return &sm->base;
|
||||
}
|
||||
|
||||
31
executables/pdcp_sm/pdcp_sm_agent.h
Normal file
31
executables/pdcp_sm/pdcp_sm_agent.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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 PDCP_SERVICE_MODEL_AGENT_H
|
||||
#define PDCP_SERVICE_MODEL_AGENT_H
|
||||
|
||||
#include "../sm_agent.h"
|
||||
|
||||
sm_agent_t* make_pdcp_sm_agent(sm_io_ag_t io);
|
||||
|
||||
#endif
|
||||
|
||||
43
executables/pdcp_sm/pdcp_sm_id.h
Normal file
43
executables/pdcp_sm/pdcp_sm_id.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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 PDCP_SERVICE_MODEL_ID_H
|
||||
#define PDCP_SERVICE_MODEL_ID_H
|
||||
|
||||
|
||||
/*
|
||||
* Service Model ID needed for the agent as well as for the ric to ensure that they match.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
static
|
||||
const uint16_t SM_PDCP_ID = 144;
|
||||
|
||||
static
|
||||
const char* SM_PDCP_STR = "PDCP_STATS_V0";
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
253
executables/pdcp_sm/pdcp_sm_ric.c
Normal file
253
executables/pdcp_sm/pdcp_sm_ric.c
Normal file
@@ -0,0 +1,253 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#include "pdcp_sm_ric.h"
|
||||
#include "pdcp_sm_id.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include "../../util/alg_ds/alg/defer.h"
|
||||
|
||||
#include "enc/pdcp_enc_generic.h"
|
||||
#include "dec/pdcp_dec_generic.h"
|
||||
|
||||
typedef struct{
|
||||
sm_ric_t base;
|
||||
|
||||
#ifdef ASN
|
||||
pdcp_enc_asn_t enc;
|
||||
#elif FLATBUFFERS
|
||||
pdcp_enc_fb_t enc;
|
||||
#elif PLAIN
|
||||
pdcp_enc_plain_t enc;
|
||||
#else
|
||||
static_assert(false, "No encryption type selected");
|
||||
#endif
|
||||
} sm_pdcp_ric_t;
|
||||
|
||||
|
||||
static
|
||||
sm_subs_data_t on_subscription_pdcp_sm_ric(sm_ric_t const* sm_ric, const char* cmd)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(cmd != NULL);
|
||||
sm_pdcp_ric_t* sm = (sm_pdcp_ric_t*)sm_ric;
|
||||
|
||||
pdcp_event_trigger_t ev = {0};
|
||||
|
||||
const int max_str_sz = 10;
|
||||
if(strncmp(cmd, "1_ms", max_str_sz) == 0 ){
|
||||
ev.ms = 1;
|
||||
} else if (strncmp(cmd, "2_ms", max_str_sz) == 0 ) {
|
||||
ev.ms = 2;
|
||||
} else if (strncmp(cmd, "5_ms", max_str_sz) == 0 ) {
|
||||
ev.ms = 5;
|
||||
} else {
|
||||
assert(0 != 0 && "Invalid input");
|
||||
}
|
||||
const byte_array_t ba = pdcp_enc_event_trigger(&sm->enc, &ev);
|
||||
|
||||
sm_subs_data_t data = {0};
|
||||
|
||||
// Event trigger IE
|
||||
data.event_trigger = ba.buf;
|
||||
data.len_et = ba.len;
|
||||
|
||||
// Action Definition IE
|
||||
data.action_def = NULL;
|
||||
data.len_ad = 0;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
static
|
||||
sm_ag_if_rd_t on_indication_pdcp_sm_ric(sm_ric_t const* sm_ric, sm_ind_data_t* data)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(data != NULL);
|
||||
sm_pdcp_ric_t* sm = (sm_pdcp_ric_t*)sm_ric;
|
||||
|
||||
sm_ag_if_rd_t rd_if = {0};
|
||||
rd_if.type = PDCP_STATS_V0;
|
||||
|
||||
rd_if.pdcp_stats.hdr = pdcp_dec_ind_hdr(&sm->enc, data->len_hdr, data->ind_hdr);
|
||||
rd_if.pdcp_stats.msg = pdcp_dec_ind_msg(&sm->enc, data->len_msg, data->ind_msg);
|
||||
|
||||
return rd_if;
|
||||
}
|
||||
|
||||
static
|
||||
sm_ctrl_req_data_t on_control_req_pdcp_sm_ric(sm_ric_t const* sm_ric, sm_ag_if_wr_t const* data_v)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(data_v != NULL);
|
||||
assert(data_v->type == PDCP_CTRL_REQ_V0);
|
||||
|
||||
sm_pdcp_ric_t* sm = (sm_pdcp_ric_t*)sm_ric;
|
||||
|
||||
pdcp_ctrl_req_data_t const* req = &data_v->pdcp_req_ctrl;
|
||||
|
||||
sm_ctrl_req_data_t ret_data = {0};
|
||||
|
||||
|
||||
byte_array_t ba = pdcp_enc_ctrl_hdr(&sm->enc, &req->hdr);
|
||||
ret_data.ctrl_hdr = ba.buf;
|
||||
ret_data.len_hdr = ba.len;
|
||||
|
||||
ba = pdcp_enc_ctrl_msg(&sm->enc, &req->msg);
|
||||
ret_data.ctrl_msg = ba.buf;
|
||||
ret_data.len_msg = ba.len;
|
||||
return ret_data;
|
||||
}
|
||||
|
||||
static
|
||||
sm_ag_if_ans_t on_control_out_pdcp_sm_ric(sm_ric_t const* sm_ric, sm_ctrl_out_data_t const* out)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(out != NULL);
|
||||
sm_pdcp_ric_t* sm = (sm_pdcp_ric_t*)sm_ric;
|
||||
assert(out->len_out > 0);
|
||||
assert(out->ctrl_out != NULL);
|
||||
|
||||
sm_ag_if_ans_t ans = { 0 };
|
||||
ans.type = PDCP_AGENT_IF_CTRL_ANS_V0;
|
||||
ans.pdcp = pdcp_dec_ctrl_out(&sm->enc, out->len_out, out->ctrl_out);
|
||||
|
||||
return ans;
|
||||
}
|
||||
|
||||
static
|
||||
void on_e2_setup_pdcp_sm_ric(sm_ric_t const* sm_ric, sm_e2_setup_t const* setup)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(setup == NULL);
|
||||
// sm_pdcp_ric_t* sm = (sm_pdcp_ric_t*)sm_ric;
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
static
|
||||
sm_ric_service_update_t on_ric_service_update_pdcp_sm_ric(sm_ric_t const* sm_ric, const char* data)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(data != NULL);
|
||||
// sm_pdcp_ric_t* sm = (sm_pdcp_ric_t*)sm_ric;
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
static
|
||||
void free_pdcp_sm_ric(sm_ric_t* sm_ric)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
sm_pdcp_ric_t* sm = (sm_pdcp_ric_t*)sm_ric;
|
||||
free(sm);
|
||||
}
|
||||
|
||||
//
|
||||
// Allocation SM functions. The memory malloc by the SM is also freed by it.
|
||||
//
|
||||
|
||||
static
|
||||
void free_subs_data_pdcp_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
static
|
||||
void free_ind_data_pdcp_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
|
||||
pdcp_ind_data_t* ind = (pdcp_ind_data_t*)msg;
|
||||
|
||||
free_pdcp_ind_hdr(&ind->hdr);
|
||||
free_pdcp_ind_msg(&ind->msg);
|
||||
}
|
||||
|
||||
static
|
||||
void free_ctrl_req_data_pdcp_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
|
||||
sm_ctrl_req_data_t* ctrl = (sm_ctrl_req_data_t*)msg;
|
||||
free_sm_ctrl_req_data(ctrl);
|
||||
}
|
||||
|
||||
static
|
||||
void free_ctrl_out_data_pdcp_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
|
||||
sm_ctrl_out_data_t* ctrl = (sm_ctrl_out_data_t*)msg;
|
||||
free_sm_ctrl_out_data(ctrl);
|
||||
}
|
||||
|
||||
static
|
||||
void free_e2_setup_pdcp_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
static
|
||||
void free_ric_service_update_pdcp_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
|
||||
sm_ric_t* make_pdcp_sm_ric(void /* sm_io_ric_t io */)
|
||||
{
|
||||
sm_pdcp_ric_t* sm = calloc(1, sizeof(sm_pdcp_ric_t));
|
||||
assert(sm != NULL && "Memory exhausted");
|
||||
|
||||
*((uint16_t*)&sm->base.ran_func_id) = SM_PDCP_ID;
|
||||
|
||||
sm->base.free_sm = free_pdcp_sm_ric;
|
||||
|
||||
// Memory (De)Allocation
|
||||
sm->base.alloc.free_subs_data_msg = free_subs_data_pdcp_sm_ric;
|
||||
sm->base.alloc.free_ind_data = free_ind_data_pdcp_sm_ric ;
|
||||
sm->base.alloc.free_ctrl_req_data = free_ctrl_req_data_pdcp_sm_ric;
|
||||
sm->base.alloc.free_ctrl_out_data = free_ctrl_out_data_pdcp_sm_ric;
|
||||
sm->base.alloc.free_e2_setup = free_e2_setup_pdcp_sm_ric;
|
||||
sm->base.alloc.free_ric_service_update = free_ric_service_update_pdcp_sm_ric;
|
||||
|
||||
// ORAN E2SM 5 Procedures
|
||||
sm->base.proc.on_subscription = on_subscription_pdcp_sm_ric;
|
||||
sm->base.proc.on_indication = on_indication_pdcp_sm_ric;
|
||||
// Control needs two calls
|
||||
sm->base.proc.on_control_req = on_control_req_pdcp_sm_ric;
|
||||
sm->base.proc.on_control_out = on_control_out_pdcp_sm_ric;
|
||||
|
||||
sm->base.proc.on_e2_setup = on_e2_setup_pdcp_sm_ric;
|
||||
sm->base.proc.on_ric_service_update = on_ric_service_update_pdcp_sm_ric;
|
||||
|
||||
assert(strlen(SM_PDCP_STR) < sizeof( sm->base.ran_func_name) );
|
||||
memcpy(sm->base.ran_func_name, SM_PDCP_STR, strlen(SM_PDCP_STR));
|
||||
|
||||
return &sm->base;
|
||||
}
|
||||
|
||||
31
executables/pdcp_sm/pdcp_sm_ric.h
Normal file
31
executables/pdcp_sm/pdcp_sm_ric.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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 PDCP_SERVICE_MODEL_SERVER_H
|
||||
#define PDCP_SERVICE_MODEL_SERVER_H
|
||||
|
||||
#include "../sm_ric.h"
|
||||
|
||||
sm_ric_t* make_pdcp_sm_ric(void);
|
||||
|
||||
#endif
|
||||
|
||||
109
executables/pdcp_sm/test/CMakeLists.txt
Normal file
109
executables/pdcp_sm/test/CMakeLists.txt
Normal file
@@ -0,0 +1,109 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project (TEST_PDCP_SM)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_FLAGS "-Wall -Wextra")
|
||||
|
||||
set(default_build_type "Debug")
|
||||
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
|
||||
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
||||
endif()
|
||||
|
||||
|
||||
set(COMPILER "GCC" CACHE STRING "Compiler")
|
||||
set_property(CACHE COMPILER PROPERTY STRINGS "GCC" "CLANG")
|
||||
|
||||
if(COMPILER STREQUAL CLANG)
|
||||
add_compile_options("-fblocks;")
|
||||
add_link_options("-lBlocksRuntime;")
|
||||
endif()
|
||||
|
||||
|
||||
set(SANITIZER "ADDRESS" CACHE STRING "Sanitizers")
|
||||
set_property(CACHE SANITIZER PROPERTY STRINGS "NONE" "ADDRESS" "THREAD")
|
||||
message(STATUS "Selected SANITIZER TYPE: ${SANITIZER}")
|
||||
|
||||
if(SANITIZER STREQUAL "ADDRESS")
|
||||
add_compile_options("$<$<CONFIG:DEBUG>:-fno-omit-frame-pointer;-fsanitize=address>")
|
||||
add_link_options("$<$<CONFIG:DEBUG>:-fsanitize=address>")
|
||||
elseif(SANITIZER STREQUAL "THREAD" )
|
||||
add_compile_options("$<$<CONFIG:DEBUG>:-fsanitize=thread;-g;>")
|
||||
add_link_options("$<$<CONFIG:DEBUG>:-fsanitize=thread;>")
|
||||
endif()
|
||||
|
||||
option(CODE_COVERAGE "Code coverage" ON)
|
||||
if(CODE_COVERAGE)
|
||||
add_compile_options("$<$<CONFIG:DEBUG>:-fprofile-arcs;-ftest-coverage>")
|
||||
add_link_options("$<$<CONFIG:DEBUG>:-lgcov;-coverage;>")
|
||||
message(STATUS "CODE COVERAGE ON")
|
||||
endif()
|
||||
|
||||
option(CODE_PROFILER "Code Profiler" ON)
|
||||
if(CODE_PROFILER)
|
||||
message(STATUS "CODE PROFILER ON")
|
||||
add_compile_options("$<$<CONFIG:DEBUG>:-pg>")
|
||||
add_link_options("$<$<CONFIG:DEBUG>:-pg;>")
|
||||
endif()
|
||||
|
||||
set(SM_ENCODING_PDCP "PLAIN" CACHE STRING "The PDCP SM encoding to use")
|
||||
set_property(CACHE SM_ENCODING_PDCP PROPERTY STRINGS "PLAIN" "ASN" "FLATBUFFERS")
|
||||
message(STATUS "Selected PDCP SM_ENCODING: ${SM_ENCODING_PDCP}")
|
||||
|
||||
|
||||
if(SM_ENCODING_PDCP STREQUAL "PLAIN")
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
add_executable(test_pdcp_sm
|
||||
main.c
|
||||
../../sm_proc_data.c
|
||||
../pdcp_sm_agent.c
|
||||
../pdcp_sm_ric.c
|
||||
../enc/pdcp_enc_plain.c
|
||||
../dec/pdcp_dec_plain.c
|
||||
../../../util/alg_ds/alg/defer.c
|
||||
../../../util/alg_ds/alg/eq_float.c
|
||||
../ie/pdcp_data_ie.c
|
||||
../../agent_if/read/sm_ag_if_rd.c
|
||||
)
|
||||
elseif(SM_ENCODING_PDCP STREQUAL "ASN")
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}../ie/asn/ )
|
||||
file(GLOB asn_sources "../ie/asn/*.c")
|
||||
#include_directories("/usr/local/share/asn1c/")
|
||||
target_compile_options(test_pdcp_sm PUBLIC "-DASN_DISABLE_OER_SUPPORT")
|
||||
add_executable(test_pdcp_sm
|
||||
main.c
|
||||
../../sm_proc_data.c
|
||||
../pdcp_sm_agent.c
|
||||
../pdcp_sm_server.c
|
||||
../enc/pdcp_enc_asn.c
|
||||
../dec/pdcp_dec_asn.c
|
||||
../../util/alg_ds/alg/defer.c
|
||||
../../util/alg_ds/alg/eq_float.c
|
||||
../ie/pdcp_data_ie.c
|
||||
../../if_sm/read/sm_rd_if.c
|
||||
${asn_sources}
|
||||
)
|
||||
elseif(SM_ENCODING_PDCP STREQUAL "FLATBUFFERS")
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}../ie/fb/ )
|
||||
add_executable(test_pdcp_sm
|
||||
main.c
|
||||
../../sm_proc_data.c
|
||||
../pdcp_sm_agent.c
|
||||
../pdcp_sm_server.c
|
||||
../enc/pdcp_enc_fb.c
|
||||
../dec/pdcp_dec_fb.c
|
||||
../../../util/alg_ds/alg/defer.c
|
||||
../../../util/alg_ds/alg/eq_float.c
|
||||
../ie/pdcp_data_ie.c
|
||||
../../if_sm/read/sm_rd_if.c
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(test_pdcp_sm PUBLIC ${SM_ENCODING_PDCP})
|
||||
target_link_libraries(test_pdcp_sm PUBLIC -pthread)
|
||||
|
||||
28
executables/pdcp_sm/test/README.md
Normal file
28
executables/pdcp_sm/test/README.md
Normal file
@@ -0,0 +1,28 @@
|
||||
To build the project
|
||||
|
||||
## Profiling
|
||||
```bash
|
||||
gprof ./build/test_pdcp_sm gmon.out > analysis.txt
|
||||
```
|
||||
|
||||
## Coverage
|
||||
|
||||
```bash
|
||||
find . -name ".gcno"
|
||||
```
|
||||
|
||||
cd to the path
|
||||
|
||||
```bash
|
||||
lcov -t "result" -o ex_test.info -c -d .
|
||||
genhtml -o res ex_test.info
|
||||
firefox res/index.html
|
||||
```
|
||||
|
||||
## Compiler
|
||||
For clang, select CLANG from the ccmake and enter the following line
|
||||
|
||||
```bash
|
||||
cmake .. -D CMAKE_C_COMPILER=clang
|
||||
```
|
||||
|
||||
222
executables/pdcp_sm/test/main.c
Normal file
222
executables/pdcp_sm/test/main.c
Normal file
@@ -0,0 +1,222 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#include "../../pdcp_sm/pdcp_sm_agent.h"
|
||||
#include "../../pdcp_sm/pdcp_sm_ric.h"
|
||||
|
||||
#include "../../../util/alg_ds/alg/defer.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
///
|
||||
// Functions implemented and specific to the RAN
|
||||
//
|
||||
|
||||
static
|
||||
pdcp_ind_data_t cp;
|
||||
|
||||
static
|
||||
void fill_pdcp_ind_data(pdcp_ind_data_t* ind_data)
|
||||
{
|
||||
srand(time(0));
|
||||
|
||||
pdcp_ind_msg_t* ind_msg = &ind_data->msg;
|
||||
|
||||
ind_msg->len = abs(rand()%10);
|
||||
ind_msg->tstamp = 1234567894;
|
||||
// ind_msg->slot = 3;
|
||||
|
||||
if(ind_msg->len > 0){
|
||||
ind_msg->rb = calloc(ind_msg->len, sizeof(pdcp_radio_bearer_stats_t));
|
||||
assert(ind_msg->rb != NULL && "Memory exhausted!");
|
||||
}
|
||||
|
||||
for(uint32_t i = 0; i < ind_msg->len; ++i){
|
||||
pdcp_radio_bearer_stats_t* rb = &ind_msg->rb[i];
|
||||
|
||||
int const mod = 1024;
|
||||
rb->txpdu_bytes = abs(rand()%mod); /* aggregated bytes of tx packets */
|
||||
rb->txpdu_pkts = rb->txpdu_bytes != 0 ? rb->txpdu_bytes - rand()%rb->txpdu_bytes : 0; /* aggregated number of tx packets */
|
||||
rb->txpdu_sn= abs(rand()%mod); /* current sequence number of last tx packet (or TX_NEXT) */
|
||||
|
||||
rb->rxpdu_bytes = abs(rand()%mod); /* aggregated bytes of rx packets */
|
||||
rb->rxpdu_pkts = rb->rxpdu_bytes != 0 ? rb->rxpdu_bytes - rand()%rb->rxpdu_bytes : 0; /* aggregated number of rx packets */
|
||||
rb->rxpdu_sn= abs(rand()%mod); /* current sequence number of last rx packet (or RX_NEXT) */
|
||||
rb->rxpdu_oo_pkts= abs(rand()%mod); /* aggregated number of out-of-order rx pkts (or RX_REORD) */
|
||||
rb->rxpdu_oo_bytes= abs(rand()%mod); /* aggregated amount of out-of-order rx bytes */
|
||||
rb->rxpdu_dd_pkts= abs(rand()%mod); /* aggregated number of duplicated discarded packets (or dropped packets because of other reasons such as integrity failure) (or RX_DELIV) */
|
||||
rb->rxpdu_dd_bytes= abs(rand()%mod); /* aggregated amount of discarded packets' bytes */
|
||||
rb->rxpdu_ro_count= abs(rand()%mod); /* this state variable indicates the COUNT value following the COUNT value associated with the PDCP Data PDU which triggered t-Reordering. (RX_REORD) */
|
||||
rb->txsdu_bytes = abs(rand()%mod); /* number of bytes of SDUs delivered */
|
||||
rb->txsdu_pkts = rb->txsdu_bytes != 0 ? rb->txsdu_bytes - rand()% rb->txsdu_bytes : 0; /* number of SDUs delivered */
|
||||
|
||||
rb->rxsdu_bytes = abs(rand()%mod); /* number of bytes of SDUs received */
|
||||
rb->rxsdu_pkts = rb->rxsdu_bytes != 0 ? rb->rxsdu_bytes - rand()%rb->rxsdu_bytes : 0; /* number of SDUs received */
|
||||
|
||||
rb->rnti= abs(rand()%mod);
|
||||
rb->mode= abs(rand()%3); /* 0: PDCP AM, 1: PDCP UM, 2: PDCP TM */
|
||||
rb->rbid= abs(rand()%11);
|
||||
}
|
||||
|
||||
cp.hdr = cp_pdcp_ind_hdr(&ind_data->hdr);
|
||||
cp.msg = cp_pdcp_ind_msg(&ind_data->msg);
|
||||
}
|
||||
|
||||
/////
|
||||
// AGENT
|
||||
////
|
||||
|
||||
static
|
||||
void read_RAN(sm_ag_if_rd_t* read)
|
||||
{
|
||||
assert(read != NULL);
|
||||
assert(read->type == PDCP_STATS_V0);
|
||||
|
||||
fill_pdcp_ind_data(&read->pdcp_stats);
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
sm_ag_if_ans_t write_RAN(const sm_ag_if_wr_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data->type == SUBSCRIBE_TIMER
|
||||
|| data->type == PDCP_CTRL_REQ_V0 );
|
||||
|
||||
if(data->type == SUBSCRIBE_TIMER){
|
||||
printf("SUBSCRIBE_TIMER called with ms = %u \n", data->sub_timer.ms);
|
||||
sm_ag_if_ans_t ans = {.type =PDCP_AGENT_IF_CTRL_ANS_V0 };
|
||||
return ans;
|
||||
}
|
||||
|
||||
assert(data->type == PDCP_CTRL_REQ_V0 );
|
||||
pdcp_ctrl_req_data_t const* req = &data->pdcp_req_ctrl;
|
||||
|
||||
assert(req->hdr.dummy == 0);
|
||||
assert(req->msg.action == 42);
|
||||
|
||||
pdcp_ctrl_out_t out = {.ans = PDCP_CTRL_OUT_OK };
|
||||
sm_ag_if_ans_t ans = {.type = PDCP_AGENT_IF_CTRL_ANS_V0, .pdcp = out };
|
||||
|
||||
return ans;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
// Check Functions
|
||||
// //////////////////////////
|
||||
|
||||
static
|
||||
void check_eq_ran_function(sm_agent_t const* ag, sm_ric_t const* ric)
|
||||
{
|
||||
assert(ag != NULL);
|
||||
assert(ric != NULL);
|
||||
assert(ag->ran_func_id == ric->ran_func_id);
|
||||
}
|
||||
|
||||
// RIC -> E2
|
||||
static
|
||||
void check_subscription(sm_agent_t* ag, sm_ric_t* ric)
|
||||
{
|
||||
assert(ag != NULL);
|
||||
assert(ric != NULL);
|
||||
|
||||
sm_subs_data_t data = ric->proc.on_subscription(ric, "2_ms");
|
||||
ag->proc.on_subscription(ag, &data);
|
||||
|
||||
free_sm_subs_data(&data);
|
||||
}
|
||||
|
||||
// E2 -> RIC
|
||||
static
|
||||
void check_indication(sm_agent_t* ag, sm_ric_t* ric)
|
||||
{
|
||||
assert(ag != NULL);
|
||||
assert(ric != NULL);
|
||||
|
||||
sm_ind_data_t sm_data = ag->proc.on_indication(ag);
|
||||
defer({free_sm_ind_data(&sm_data);});
|
||||
|
||||
sm_ag_if_rd_t msg = ric->proc.on_indication(ric, &sm_data);
|
||||
|
||||
assert(msg.type == PDCP_STATS_V0);
|
||||
pdcp_ind_data_t* data = &msg.pdcp_stats;
|
||||
defer({ ric->alloc.free_ind_data(data); });
|
||||
|
||||
assert(eq_pdcp_ind_hdr(&data->hdr, &cp.hdr) == true);
|
||||
assert(eq_pdcp_ind_msg(&data->msg, &cp.msg) == true);
|
||||
assert(eq_pdcp_call_proc_id(data->proc_id, cp.proc_id) == true);
|
||||
|
||||
free_pdcp_ind_hdr(&cp.hdr);
|
||||
free_pdcp_ind_msg(&cp.msg);
|
||||
}
|
||||
|
||||
// RIC -> E2
|
||||
static
|
||||
void check_control(sm_agent_t* ag, sm_ric_t* ric)
|
||||
{
|
||||
assert(ag != NULL);
|
||||
assert(ric != NULL);
|
||||
|
||||
pdcp_ctrl_req_data_t data = {0};
|
||||
data.hdr.dummy = 0;
|
||||
data.msg.action = 42;
|
||||
|
||||
sm_ag_if_wr_t wr = {.type = PDCP_CTRL_REQ_V0, .pdcp_req_ctrl = data };
|
||||
|
||||
sm_ctrl_req_data_t sm_data = ric->proc.on_control_req(ric, &wr);
|
||||
defer({ ric->alloc.free_ctrl_req_data(&sm_data); } );
|
||||
|
||||
sm_ctrl_out_data_t out = ag->proc.on_control(ag, &sm_data);
|
||||
defer({ free_sm_ctrl_out_data(&out); });
|
||||
|
||||
sm_ag_if_ans_t sm_data_out = ric->proc.on_control_out(ric, &out);
|
||||
assert(sm_data_out.type == PDCP_AGENT_IF_CTRL_ANS_V0 );
|
||||
assert(sm_data_out.pdcp.ans == PDCP_CTRL_OUT_OK );
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
sm_io_ag_t io_ag = {.read = read_RAN, .write = write_RAN};
|
||||
sm_agent_t* sm_ag = make_pdcp_sm_agent(io_ag);
|
||||
|
||||
sm_ric_t* sm_ric = make_pdcp_sm_ric();
|
||||
|
||||
for(int i =0; i < 262144; ++i){
|
||||
check_eq_ran_function(sm_ag, sm_ric);
|
||||
check_subscription(sm_ag, sm_ric);
|
||||
check_indication(sm_ag, sm_ric);
|
||||
check_control(sm_ag, sm_ric);
|
||||
}
|
||||
|
||||
sm_ag->free_sm(sm_ag);
|
||||
sm_ric->free_sm(sm_ric);
|
||||
|
||||
printf("Success\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
51
executables/rlc_sm/CMakeLists.txt
Normal file
51
executables/rlc_sm/CMakeLists.txt
Normal file
@@ -0,0 +1,51 @@
|
||||
cmake_minimum_required(VERSION 3.15) # setting this is required
|
||||
project(rlc_sm) # this sets the project name
|
||||
|
||||
set(SM_ENCODING_RLC_SRC
|
||||
../sm_proc_data.c
|
||||
rlc_sm_agent.c
|
||||
rlc_sm_ric.c
|
||||
../../util/byte_array.c
|
||||
../../util/alg_ds/alg/defer.c
|
||||
../../util/alg_ds/alg/eq_float.c
|
||||
../../util/alg_ds/ds/seq_container/seq_arr.c
|
||||
../../util/alg_ds/ds/seq_container/seq_ring.c
|
||||
../../util/alg_ds/ds/assoc_container/assoc_rb_tree.c
|
||||
../../util/alg_ds/ds/assoc_container/bimap.c
|
||||
ie/rlc_data_ie.c
|
||||
)
|
||||
|
||||
|
||||
if(SM_ENCODING_RLC STREQUAL "PLAIN")
|
||||
add_library(rlc_sm SHARED
|
||||
${SM_ENCODING_RLC_SRC}
|
||||
enc/rlc_enc_plain.c
|
||||
dec/rlc_dec_plain.c
|
||||
)
|
||||
|
||||
elseif(SM_ENCODING_RLC STREQUAL "ASN" )
|
||||
message(FATAL_ERROR "RLC SM ASN not implemented")
|
||||
add_subdirectory(ie/asn)
|
||||
|
||||
add_library(rlc_sm SHARED
|
||||
${SM_ENCODING_RLC_SRC}
|
||||
enc/rlc_enc_asn.c
|
||||
dec/rlc_dec_asn.c
|
||||
)
|
||||
target_include_directories(rlc_sm PRIVATE "ie/asn")
|
||||
target_compile_options(rlc_sm PUBLIC "-DASN_DISABLE_OER_SUPPORT")
|
||||
target_compile_options(rlc_sm PRIVATE -Wno-missing-field-initializers -Wno-unused-parameter)
|
||||
|
||||
elseif(SM_ENCODING_RLC STREQUAL "FLATBUFFERS" )
|
||||
message(FATAL_ERROR "RLC SM FB not implemented")
|
||||
add_library(rlc_sm SHARED
|
||||
${SM_ENCODING_RLC_SRC}
|
||||
enc/rlc_enc_fb.c
|
||||
dec/rlc_dec_fb.c
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown SM encoding type ")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(rlc_sm PUBLIC ${SM_ENCODING_RLC})
|
||||
|
||||
99
executables/rlc_sm/dec/rlc_dec_asn.c
Normal file
99
executables/rlc_sm/dec/rlc_dec_asn.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "rlc_dec_asn.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
rlc_event_trigger_t rlc_dec_event_trigger_asn(size_t len, uint8_t const buf[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(buf != NULL);
|
||||
rlc_event_trigger_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
rlc_action_def_t rlc_dec_action_def_asn(size_t len, uint8_t const action_def[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(action_def != NULL);
|
||||
rlc_action_def_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
rlc_ind_hdr_t rlc_dec_ind_hdr_asn(size_t len, uint8_t const ind_hdr[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ind_hdr != NULL);
|
||||
rlc_ind_hdr_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
rlc_ind_msg_t rlc_dec_ind_msg_asn(size_t len, uint8_t const ind_msg[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ind_msg != NULL);
|
||||
rlc_ind_msg_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
rlc_call_proc_id_t rlc_dec_call_proc_id_asn(size_t len, uint8_t const call_proc_id[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(call_proc_id != NULL);
|
||||
rlc_call_proc_id_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
rlc_ctrl_hdr_t rlc_dec_ctrl_hdr_asn(size_t len, uint8_t const ctrl_hdr[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ctrl_hdr != NULL);
|
||||
rlc_ctrl_hdr_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
rlc_ctrl_msg_t rlc_dec_ctrl_msg_asn(size_t len, uint8_t const ctrl_msg[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ctrl_msg != NULL);
|
||||
rlc_ctrl_msg_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
rlc_ctrl_out_t rlc_dec_ctrl_out_asn(size_t len, uint8_t const ctrl_out[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert( ctrl_out != NULL);
|
||||
rlc_ctrl_out_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
rlc_func_def_t rlc_dec_func_def_asn(size_t len, uint8_t const func_def[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(func_def != NULL);
|
||||
rlc_func_def_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
49
executables/rlc_sm/dec/rlc_dec_asn.h
Normal file
49
executables/rlc_sm/dec/rlc_dec_asn.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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 RLC_DECRYPTION_ASN_H
|
||||
#define RLC_DECRYPTION_ASN_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "../ie/rlc_data_ie.h"
|
||||
|
||||
|
||||
rlc_event_trigger_t rlc_dec_event_trigger_asn(size_t len, uint8_t const ev_tr[len]);
|
||||
|
||||
rlc_action_def_t rlc_dec_action_def_asn(size_t len, uint8_t const action_def[len]);
|
||||
|
||||
rlc_ind_hdr_t rlc_dec_ind_hdr_asn(size_t len, uint8_t const ind_hdr[len]);
|
||||
|
||||
rlc_ind_msg_t rlc_dec_ind_msg_asn(size_t len, uint8_t const ind_msg[len]);
|
||||
|
||||
rlc_call_proc_id_t rlc_dec_call_proc_id_asn(size_t len, uint8_t const call_proc_id[len]);
|
||||
|
||||
rlc_ctrl_hdr_t rlc_dec_ctrl_hdr_asn(size_t len, uint8_t const ctrl_hdr[len]);
|
||||
|
||||
rlc_ctrl_msg_t rlc_dec_ctrl_msg_asn(size_t len, uint8_t const ctrl_msg[len]);
|
||||
|
||||
rlc_ctrl_out_t rlc_dec_ctrl_out_asn(size_t len, uint8_t const ctrl_out[len]);
|
||||
|
||||
rlc_func_def_t rlc_dec_func_def_asn(size_t len, uint8_t const func_def[len]);
|
||||
|
||||
#endif
|
||||
|
||||
99
executables/rlc_sm/dec/rlc_dec_fb.c
Normal file
99
executables/rlc_sm/dec/rlc_dec_fb.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#include "rlc_dec_fb.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
rlc_event_trigger_t rlc_dec_event_trigger_fb(size_t len, uint8_t const ev_tr[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ev_tr != NULL);
|
||||
rlc_event_trigger_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
rlc_action_def_t rlc_dec_action_def_fb(size_t len, uint8_t const action_def[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(action_def != NULL);
|
||||
rlc_action_def_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
rlc_ind_hdr_t rlc_dec_ind_hdr_fb(size_t len, uint8_t const ind_hdr[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ind_hdr != NULL);
|
||||
rlc_ind_hdr_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
rlc_ind_msg_t rlc_dec_ind_msg_fb(size_t len, uint8_t const ind_msg[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ind_msg != NULL);
|
||||
rlc_ind_msg_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
rlc_call_proc_id_t rlc_dec_call_proc_id_fb(size_t len, uint8_t const call_proc_id[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(call_proc_id != NULL);
|
||||
rlc_call_proc_id_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
rlc_ctrl_hdr_t rlc_dec_ctrl_hdr_fb(size_t len, uint8_t const ctrl_hdr[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ctrl_hdr != NULL);
|
||||
rlc_ctrl_hdr_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
rlc_ctrl_msg_t rlc_dec_ctrl_msg_fb(size_t len, uint8_t const ctrl_msg[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ctrl_msg != NULL);
|
||||
rlc_ctrl_msg_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
|
||||
rlc_ctrl_out_t rlc_dec_ctrl_out_fb(size_t len, uint8_t const ctrl_out[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ctrl_out!= NULL);
|
||||
rlc_ctrl_out_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
rlc_func_def_t rlc_dec_func_def_fb(size_t len, uint8_t const func_def[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(func_def != NULL);
|
||||
rlc_func_def_t avoid_warning;
|
||||
return avoid_warning;
|
||||
}
|
||||
|
||||
49
executables/rlc_sm/dec/rlc_dec_fb.h
Normal file
49
executables/rlc_sm/dec/rlc_dec_fb.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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 RLC_DECRYPTION_FLATBUFFERS_H
|
||||
#define RLC_DECRYPTION_FLATBUFFERS_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "../ie/rlc_data_ie.h"
|
||||
|
||||
|
||||
rlc_event_trigger_t rlc_dec_event_trigger_fb(size_t len, uint8_t const ev_tr[len]);
|
||||
|
||||
rlc_action_def_t rlc_dec_action_def_fb(size_t len, uint8_t const action_def[len]);
|
||||
|
||||
rlc_ind_hdr_t rlc_dec_ind_hdr_fb(size_t len, uint8_t const ind_hdr[len]);
|
||||
|
||||
rlc_ind_msg_t rlc_dec_ind_msg_fb(size_t len, uint8_t const ind_msg[len]);
|
||||
|
||||
rlc_call_proc_id_t rlc_dec_call_proc_id_fb(size_t len, uint8_t const call_proc_id[len]);
|
||||
|
||||
rlc_ctrl_hdr_t rlc_dec_ctrl_hdr_fb(size_t len, uint8_t const ctrl_hdr[len]);
|
||||
|
||||
rlc_ctrl_msg_t rlc_dec_ctrl_msg_fb(size_t len, uint8_t const ctrl_msg[len]);
|
||||
|
||||
rlc_ctrl_out_t rlc_dec_ctrl_out_fb(size_t len, uint8_t const ctrl_out[len]);
|
||||
|
||||
rlc_func_def_t rlc_dec_func_def_fb(size_t len, uint8_t const func_def[len]);
|
||||
|
||||
#endif
|
||||
|
||||
91
executables/rlc_sm/dec/rlc_dec_generic.h
Normal file
91
executables/rlc_sm/dec/rlc_dec_generic.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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 RLC_DECRYPTION_GENERIC
|
||||
#define RLC_DECRYPTION_GENERIC
|
||||
|
||||
#include "rlc_dec_asn.h"
|
||||
#include "rlc_dec_fb.h"
|
||||
#include "rlc_dec_plain.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// 9 Information Elements that are interpreted by the SM according
|
||||
// to ORAN-WG3.E2SM-v01.00.00 Technical Specification
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#define rlc_dec_event_trigger(T,U,V) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_dec_event_trigger_plain, \
|
||||
rlc_enc_asn_t*: rlc_dec_event_trigger_asn,\
|
||||
rlc_enc_fb_t*: rlc_dec_event_trigger_fb,\
|
||||
default: rlc_dec_event_trigger_plain) (U,V)
|
||||
|
||||
#define rlc_dec_action_def(T,U,V) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_dec_action_def_plain, \
|
||||
rlc_enc_asn_t*: rlc_dec_action_def_asn, \
|
||||
rlc_enc_fb_t*: rlc_dec_action_def_fb, \
|
||||
default: rlc_dec_action_def_plain) (U,V)
|
||||
|
||||
#define rlc_dec_ind_hdr(T,U,V) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_dec_ind_hdr_plain , \
|
||||
rlc_enc_asn_t*: rlc_dec_ind_hdr_asn, \
|
||||
rlc_enc_fb_t*: rlc_dec_ind_hdr_fb, \
|
||||
default: rlc_dec_ind_hdr_plain) (U,V)
|
||||
|
||||
#define rlc_dec_ind_msg(T,U,V) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_dec_ind_msg_plain , \
|
||||
rlc_enc_asn_t*: rlc_dec_ind_msg_asn, \
|
||||
rlc_enc_fb_t*: rlc_dec_ind_msg_fb, \
|
||||
default: rlc_dec_ind_msg_plain) (U,V)
|
||||
|
||||
#define rlc_dec_call_proc_id(T,U,V) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_dec_call_proc_id_plain , \
|
||||
rlc_enc_asn_t*: rlc_dec_call_proc_id_asn, \
|
||||
rlc_enc_fb_t*: rlc_dec_call_proc_id_fb, \
|
||||
default: rlc_dec_call_proc_id_plain) (U,V)
|
||||
|
||||
#define rlc_dec_ctrl_hdr(T,U,V) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_dec_ctrl_hdr_plain , \
|
||||
rlc_enc_asn_t*: rlc_dec_ctrl_hdr_asn, \
|
||||
rlc_enc_fb_t*: rlc_dec_ctrl_hdr_fb, \
|
||||
default: rlc_dec_ctrl_hdr_plain) (U,V)
|
||||
|
||||
#define rlc_dec_ctrl_msg(T,U,V) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_dec_ctrl_msg_plain , \
|
||||
rlc_enc_asn_t*: rlc_dec_ctrl_msg_asn, \
|
||||
rlc_enc_fb_t*: rlc_dec_ctrl_msg_fb, \
|
||||
default: rlc_dec_ctrl_msg_plain) (U,V)
|
||||
|
||||
#define rlc_dec_ctrl_out(T,U,V) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_dec_ctrl_out_plain , \
|
||||
rlc_enc_asn_t*: rlc_dec_ctrl_out_asn, \
|
||||
rlc_enc_fb_t*: rlc_dec_ctrl_out_fb, \
|
||||
default: rlc_dec_ctrl_out_plain) (U,V)
|
||||
|
||||
#define rlc_dec_func_def(T,U,V) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_dec_func_def_plain, \
|
||||
rlc_enc_asn_t*: rlc_dec_func_def_asn, \
|
||||
rlc_enc_fb_t*: rlc_dec_func_def_fb, \
|
||||
default: rlc_dec_func_def_plain) (U,V)
|
||||
|
||||
#endif
|
||||
|
||||
129
executables/rlc_sm/dec/rlc_dec_plain.c
Normal file
129
executables/rlc_sm/dec/rlc_dec_plain.c
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#include "rlc_dec_plain.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static inline
|
||||
size_t next_pow2(size_t x)
|
||||
{
|
||||
static_assert(sizeof(x) == 8, "Need this size to work correctly");
|
||||
x -= 1;
|
||||
x |= (x >> 1);
|
||||
x |= (x >> 2);
|
||||
x |= (x >> 4);
|
||||
x |= (x >> 8);
|
||||
x |= (x >> 16);
|
||||
x |= (x >> 32);
|
||||
|
||||
return x + 1;
|
||||
|
||||
}
|
||||
|
||||
rlc_event_trigger_t rlc_dec_event_trigger_plain(size_t len, uint8_t const ev_tr[len])
|
||||
{
|
||||
rlc_event_trigger_t ev = {0};
|
||||
memcpy(&ev.ms, ev_tr, sizeof(ev.ms));
|
||||
return ev;
|
||||
}
|
||||
|
||||
rlc_action_def_t rlc_dec_action_def_plain(size_t len, uint8_t const action_def[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(action_def != NULL);
|
||||
rlc_action_def_t act_def;// = {0};
|
||||
return act_def;
|
||||
}
|
||||
|
||||
rlc_ind_hdr_t rlc_dec_ind_hdr_plain(size_t len, uint8_t const ind_hdr[len])
|
||||
{
|
||||
assert(len == sizeof(rlc_ind_hdr_t));
|
||||
rlc_ind_hdr_t ret;
|
||||
memcpy(&ret, ind_hdr, len);
|
||||
return ret;
|
||||
}
|
||||
|
||||
rlc_ind_msg_t rlc_dec_ind_msg_plain(size_t len, uint8_t const ind_msg[len])
|
||||
{
|
||||
assert(next_pow2(len) >= sizeof(rlc_ind_msg_t) - sizeof(rlc_radio_bearer_stats_t*) && "Less bytes than the case where there are not active Radio bearers! Next pow2 trick used for aligned struct");
|
||||
rlc_ind_msg_t ret = {0};
|
||||
|
||||
memcpy(&ret.len, ind_msg, sizeof(ret.len));
|
||||
if(ret.len > 0){
|
||||
ret.rb = calloc(ret.len, sizeof(rlc_radio_bearer_stats_t) );
|
||||
assert(ret.rb != NULL && "memory exhausted");
|
||||
}
|
||||
|
||||
void const* it = ind_msg + sizeof(ret.len);
|
||||
for(uint32_t i = 0; i < ret.len; ++i){
|
||||
memcpy(&ret.rb[i], it, sizeof(ret.rb[i]) );
|
||||
it += sizeof(ret.rb[i]);
|
||||
}
|
||||
|
||||
memcpy(&ret.tstamp, it, sizeof(ret.tstamp));
|
||||
it += sizeof(ret.tstamp);
|
||||
|
||||
// memcpy(&ret.slot, it, sizeof(ret.slot));
|
||||
// it += sizeof(ret.slot);
|
||||
|
||||
assert(it == &ind_msg[len] && "Mismatch of data layout");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
rlc_call_proc_id_t rlc_dec_call_proc_id_plain(size_t len, uint8_t const call_proc_id[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(call_proc_id != NULL);
|
||||
}
|
||||
|
||||
rlc_ctrl_hdr_t rlc_dec_ctrl_hdr_plain(size_t len, uint8_t const ctrl_hdr[len])
|
||||
{
|
||||
assert(len == sizeof(rlc_ctrl_hdr_t));
|
||||
rlc_ctrl_hdr_t ret;
|
||||
memcpy(&ret, ctrl_hdr, len);
|
||||
return ret;
|
||||
}
|
||||
|
||||
rlc_ctrl_msg_t rlc_dec_ctrl_msg_plain(size_t len, uint8_t const ctrl_msg[len])
|
||||
{
|
||||
assert(len == sizeof(rlc_ctrl_msg_t));
|
||||
rlc_ctrl_msg_t ret;
|
||||
memcpy(&ret, ctrl_msg, len);
|
||||
return ret;
|
||||
}
|
||||
|
||||
rlc_ctrl_out_t rlc_dec_ctrl_out_plain(size_t len, uint8_t const ctrl_out[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(ctrl_out!= NULL);
|
||||
}
|
||||
|
||||
rlc_func_def_t rlc_dec_func_def_plain(size_t len, uint8_t const func_def[len])
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
assert(func_def != NULL);
|
||||
}
|
||||
|
||||
50
executables/rlc_sm/dec/rlc_dec_plain.h
Normal file
50
executables/rlc_sm/dec/rlc_dec_plain.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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 RLC_DECRYPTION_PLAIN_H
|
||||
#define RLC_DECRYPTION_PLAIN_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "../ie/rlc_data_ie.h"
|
||||
|
||||
|
||||
rlc_event_trigger_t rlc_dec_event_trigger_plain(size_t len, uint8_t const ev_tr[len]);
|
||||
|
||||
rlc_action_def_t rlc_dec_action_def_plain(size_t len, uint8_t const action_def[len]);
|
||||
|
||||
rlc_ind_hdr_t rlc_dec_ind_hdr_plain(size_t len, uint8_t const ind_hdr[len]);
|
||||
|
||||
rlc_ind_msg_t rlc_dec_ind_msg_plain(size_t len, uint8_t const ind_msg[len]);
|
||||
|
||||
rlc_call_proc_id_t rlc_dec_call_proc_id_plain(size_t len, uint8_t const call_proc_id[len]);
|
||||
|
||||
rlc_ctrl_hdr_t rlc_dec_ctrl_hdr_plain(size_t len, uint8_t const ctrl_hdr[len]);
|
||||
|
||||
rlc_ctrl_msg_t rlc_dec_ctrl_msg_plain(size_t len, uint8_t const ctrl_msg[len]);
|
||||
|
||||
rlc_ctrl_out_t rlc_dec_ctrl_out_plain(size_t len, uint8_t const ctrl_out[len]);
|
||||
|
||||
rlc_func_def_t rlc_dec_func_def_plain(size_t len, uint8_t const func_def[len]);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
135
executables/rlc_sm/enc/rlc_enc_asn.c
Normal file
135
executables/rlc_sm/enc/rlc_enc_asn.c
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "rlc_enc_asn.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
//#include "asn_application.h"
|
||||
|
||||
/*
|
||||
static
|
||||
byte_array_t encode(const void* pdu, asn_TYPE_descriptor_t type)
|
||||
{
|
||||
assert(pdu != NULL);
|
||||
byte_array_t b = {.buf = malloc(2048), .len = 2048};
|
||||
assert(b.buf != NULL);
|
||||
// xer_fprint(stderr, &asn_DEF_E2AP_PDU, pdu);
|
||||
const enum asn_transfer_syntax syntax = ATS_ALIGNED_BASIC_PER;
|
||||
asn_enc_rval_t er = asn_encode_to_buffer(NULL, syntax, &type, pdu, b.buf, b.len);
|
||||
assert(er.encoded < (ssize_t) b.len);
|
||||
if(er.encoded == -1) {
|
||||
printf("Failed the encoding in type %s and xml_type = %s\n", er.failed_type->name, er.failed_type->xml_tag);
|
||||
fflush(stdout);
|
||||
assert(0!=0 && "Failed encoding");
|
||||
}
|
||||
assert(er.encoded > -1);
|
||||
b.len = er.encoded;
|
||||
return b;
|
||||
}
|
||||
*/
|
||||
|
||||
byte_array_t rlc_enc_event_trigger_asn(rlc_event_trigger_t const* event_trigger)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(event_trigger != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_action_def_asn(rlc_action_def_t const* action_def)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(action_def != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_ind_hdr_asn(rlc_ind_hdr_t const* ind_hdr)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ind_hdr != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_ind_msg_asn(rlc_ind_msg_t const* ind_msg)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ind_msg != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
|
||||
byte_array_t rlc_enc_call_proc_id_asn(rlc_call_proc_id_t const* call_proc_id)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(call_proc_id != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_ctrl_hdr_asn(rlc_ctrl_hdr_t const* ctrl_hdr)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ctrl_hdr != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_ctrl_msg_asn(rlc_ctrl_msg_t const* ctrl_msg)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ctrl_msg != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_ctrl_out_asn(rlc_ctrl_out_t const* ctrl)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert( ctrl != NULL );
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_func_def_asn(rlc_func_def_t const* func)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(func != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
55
executables/rlc_sm/enc/rlc_enc_asn.h
Normal file
55
executables/rlc_sm/enc/rlc_enc_asn.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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 RLC_ENCRYPTIOIN_ASN_H
|
||||
#define RLC_ENCRYPTIOIN_ASN_H
|
||||
|
||||
#include "../../../util/byte_array.h"
|
||||
#include "../ie/rlc_data_ie.h"
|
||||
|
||||
// Used for static polymorphism.
|
||||
// See rlc_enc_generic.h file
|
||||
typedef struct{
|
||||
|
||||
} rlc_enc_asn_t;
|
||||
|
||||
byte_array_t rlc_enc_event_trigger_asn(rlc_event_trigger_t const* event_trigger);
|
||||
|
||||
byte_array_t rlc_enc_action_def_asn(rlc_action_def_t const*);
|
||||
|
||||
byte_array_t rlc_enc_ind_hdr_asn(rlc_ind_hdr_t const*);
|
||||
|
||||
byte_array_t rlc_enc_ind_msg_asn(rlc_ind_msg_t const*);
|
||||
|
||||
byte_array_t rlc_enc_call_proc_id_asn(rlc_call_proc_id_t const*);
|
||||
|
||||
byte_array_t rlc_enc_ctrl_hdr_asn(rlc_ctrl_hdr_t const*);
|
||||
|
||||
byte_array_t rlc_enc_ctrl_msg_asn(rlc_ctrl_msg_t const*);
|
||||
|
||||
byte_array_t rlc_enc_ctrl_out_asn(rlc_ctrl_out_t const*);
|
||||
|
||||
byte_array_t rlc_enc_func_def_asn(rlc_func_def_t const*);
|
||||
|
||||
#endif
|
||||
|
||||
145
executables/rlc_sm/enc/rlc_enc_fb.c
Normal file
145
executables/rlc_sm/enc/rlc_enc_fb.c
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "rlc_enc_fb.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
//#include "../ie/fb/e2sm_rlc_stats_v00_builder.h"
|
||||
//#include "../ie/fb/e2sm_rlc_stats_v00_verifier.h"
|
||||
|
||||
|
||||
/*
|
||||
byte_array_t rlc_enc_event_trigger_fb(rlc_event_trigger_t const* event_trigger)
|
||||
{
|
||||
assert(event_trigger != NULL);
|
||||
|
||||
flatcc_builder_t builder;
|
||||
flatcc_builder_init(&builder);
|
||||
|
||||
E2SM_MACStats_EventTrigger_start_as_root(&builder);
|
||||
|
||||
if(event_trigger->ms == 1){
|
||||
E2SM_MACStats_EventTrigger_trig_add(&builder, E2SM_MACStats_TriggerNature_oneMs );
|
||||
} else if(event_trigger->ms == 2){
|
||||
E2SM_MACStats_EventTrigger_trig_add(&builder, E2SM_MACStats_TriggerNature_twoMs );
|
||||
} else if(event_trigger->ms == 5){
|
||||
E2SM_MACStats_EventTrigger_trig_add(&builder, E2SM_MACStats_TriggerNature_fiveMs );
|
||||
} else {
|
||||
assert(0!=0 && "Not foreseen state");
|
||||
}
|
||||
|
||||
|
||||
E2SM_MACStats_EventTrigger_end_as_root(&builder);
|
||||
|
||||
|
||||
size_t size = 0;
|
||||
uint8_t *buf = flatcc_builder_finalize_buffer(&builder, &size);
|
||||
byte_array_t ba = { .buf = buf, .len = size };
|
||||
|
||||
int ret;
|
||||
if ((ret = E2SM_MACStats_EventTrigger_verify_as_root(buf, size))) {
|
||||
printf("Event trigger is invalid: %s\n", flatcc_verify_error_string(ret));
|
||||
assert(0);
|
||||
}
|
||||
|
||||
flatcc_builder_clear(&builder);
|
||||
|
||||
return ba;
|
||||
}
|
||||
*/
|
||||
|
||||
byte_array_t rlc_enc_action_def_fb(rlc_action_def_t const* action_def)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(action_def != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_ind_hdr_fb(rlc_ind_hdr_t const* ind_hdr)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ind_hdr != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_ind_msg_fb(rlc_ind_msg_t const* ind_msg)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ind_msg != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_call_proc_id_fb(rlc_call_proc_id_t const* call_proc_id)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(call_proc_id != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_ctrl_hdr_fb(rlc_ctrl_hdr_t const* ctrl_hdr)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ctrl_hdr != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_ctrl_msg_fb(rlc_ctrl_msg_t const* ctrl_msg)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ctrl_msg != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
|
||||
byte_array_t rlc_enc_ctrl_out_fb(rlc_ctrl_out_t const* ctrl)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(ctrl != NULL );
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_func_def_fb(rlc_func_def_t const* func)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(func != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
56
executables/rlc_sm/enc/rlc_enc_fb.h
Normal file
56
executables/rlc_sm/enc/rlc_enc_fb.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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 RLC_ENCRYPTION_FLATBUFFERS_H
|
||||
#define RLC_ENCRYPTION_FLATBUFFERS_H
|
||||
|
||||
#include "../../../util/byte_array.h"
|
||||
#include "../ie/rlc_data_ie.h"
|
||||
|
||||
|
||||
// Used for static polymorphism.
|
||||
// View rlc_enc_generic file
|
||||
typedef struct{
|
||||
|
||||
} rlc_enc_fb_t;
|
||||
|
||||
byte_array_t rlc_enc_event_trigger_fb(rlc_event_trigger_t const* event_trigger);
|
||||
|
||||
byte_array_t rlc_enc_action_def_fb(rlc_action_def_t const*);
|
||||
|
||||
byte_array_t rlc_enc_ind_hdr_fb(rlc_ind_hdr_t const*);
|
||||
|
||||
byte_array_t rlc_enc_ind_msg_fb(rlc_ind_msg_t const*);
|
||||
|
||||
byte_array_t rlc_enc_call_proc_id_fb(rlc_call_proc_id_t const*);
|
||||
|
||||
byte_array_t rlc_enc_ctrl_hdr_fb(rlc_ctrl_hdr_t const*);
|
||||
|
||||
byte_array_t rlc_enc_ctrl_msg_fb(rlc_ctrl_msg_t const*);
|
||||
|
||||
byte_array_t rlc_enc_ctrl_out_fb(rlc_ctrl_out_t const*);
|
||||
|
||||
byte_array_t rlc_enc_func_def_fb(rlc_func_def_t const*);
|
||||
|
||||
#endif
|
||||
|
||||
91
executables/rlc_sm/enc/rlc_enc_generic.h
Normal file
91
executables/rlc_sm/enc/rlc_enc_generic.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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 RLC_ENCRYPTION_GENERIC
|
||||
#define RLC_ENCRYPTION_GENERIC
|
||||
|
||||
#include "rlc_enc_asn.h"
|
||||
#include "rlc_enc_fb.h"
|
||||
#include "rlc_enc_plain.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// 9 Information Elements that are interpreted by the SM according
|
||||
// to ORAN-WG3.E2SM-v01.00.00 Technical Specification
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#define rlc_enc_event_trigger(T,U) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_enc_event_trigger_plain, \
|
||||
rlc_enc_asn_t*: rlc_enc_event_trigger_asn,\
|
||||
rlc_enc_fb_t*: rlc_enc_event_trigger_fb,\
|
||||
default: rlc_enc_event_trigger_plain) (U)
|
||||
|
||||
#define rlc_enc_action_def(T,U) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_enc_action_def_plain, \
|
||||
rlc_enc_asn_t*: rlc_enc_action_def_asn, \
|
||||
rlc_enc_fb_t*: rlc_enc_action_def_fb, \
|
||||
default: rlc_enc_action_def_plain) (U)
|
||||
|
||||
#define rlc_enc_ind_hdr(T,U) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_enc_ind_hdr_plain , \
|
||||
rlc_enc_asn_t*: rlc_enc_ind_hdr_asn, \
|
||||
rlc_enc_fb_t*: rlc_enc_ind_hdr_fb, \
|
||||
default: rlc_enc_ind_hdr_plain) (U)
|
||||
|
||||
#define rlc_enc_ind_msg(T,U) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_enc_ind_msg_plain , \
|
||||
rlc_enc_asn_t*: rlc_enc_ind_msg_asn, \
|
||||
rlc_enc_fb_t*: rlc_enc_ind_msg_fb, \
|
||||
default: rlc_enc_ind_msg_plain) (U)
|
||||
|
||||
#define rlc_enc_call_proc_id(T,U) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_enc_call_proc_id_plain , \
|
||||
rlc_enc_asn_t*: rlc_enc_call_proc_id_asn, \
|
||||
rlc_enc_fb_t*: rlc_enc_call_proc_id_fb, \
|
||||
default: rlc_enc_call_proc_id_plain) (U)
|
||||
|
||||
#define rlc_enc_ctrl_hdr(T,U) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_enc_ctrl_hdr_plain , \
|
||||
rlc_enc_asn_t*: rlc_enc_ctrl_hdr_asn, \
|
||||
rlc_enc_fb_t*: rlc_enc_ctrl_hdr_fb, \
|
||||
default: rlc_enc_ctrl_hdr_plain) (U)
|
||||
|
||||
#define rlc_enc_ctrl_msg(T,U) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_enc_ctrl_msg_plain , \
|
||||
rlc_enc_asn_t*: rlc_enc_ctrl_msg_asn, \
|
||||
rlc_enc_fb_t*: rlc_enc_ctrl_msg_fb, \
|
||||
default: rlc_enc_ctrl_msg_plain) (U)
|
||||
|
||||
#define rlc_enc_ctrl_out(T,U) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_enc_ctrl_out_plain , \
|
||||
rlc_enc_asn_t*: rlc_enc_ctrl_out_asn, \
|
||||
rlc_enc_fb_t*: rlc_enc_ctrl_out_fb, \
|
||||
default: rlc_enc_ctrl_out_plain) (U)
|
||||
|
||||
#define rlc_enc_func_def(T,U) _Generic ((T), \
|
||||
rlc_enc_plain_t*: rlc_enc_func_def_plain, \
|
||||
rlc_enc_asn_t*: rlc_enc_func_def_asn, \
|
||||
rlc_enc_fb_t*: rlc_enc_func_def_fb, \
|
||||
default: rlc_enc_func_def_plain) (U)
|
||||
|
||||
#endif
|
||||
|
||||
155
executables/rlc_sm/enc/rlc_enc_plain.c
Normal file
155
executables/rlc_sm/enc/rlc_enc_plain.c
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "rlc_enc_plain.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
byte_array_t rlc_enc_event_trigger_plain(rlc_event_trigger_t const* event_trigger)
|
||||
{
|
||||
assert(event_trigger != NULL);
|
||||
byte_array_t ba = {0};
|
||||
|
||||
ba.len = sizeof(event_trigger->ms);
|
||||
ba.buf = malloc(ba.len);
|
||||
assert(ba.buf != NULL && "Memory exhausted");
|
||||
|
||||
memcpy(ba.buf, &event_trigger->ms, ba.len);
|
||||
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_action_def_plain(rlc_action_def_t const* action_def)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(action_def != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_ind_hdr_plain(rlc_ind_hdr_t const* ind_hdr)
|
||||
{
|
||||
assert(ind_hdr != NULL);
|
||||
|
||||
byte_array_t ba = {0};
|
||||
|
||||
ba.len = sizeof(rlc_ind_hdr_t);
|
||||
ba.buf = malloc(sizeof(rlc_ind_msg_t));
|
||||
assert(ba.buf != NULL && "memory exhausted");
|
||||
memcpy(ba.buf, ind_hdr, sizeof(rlc_ind_hdr_t));
|
||||
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_ind_msg_plain(rlc_ind_msg_t const* ind_msg)
|
||||
{
|
||||
assert(ind_msg != NULL);
|
||||
|
||||
byte_array_t ba = {0};
|
||||
|
||||
size_t const sz = sizeof(ind_msg->len) +
|
||||
sizeof(rlc_radio_bearer_stats_t)*ind_msg->len +
|
||||
sizeof(ind_msg->tstamp);
|
||||
|
||||
// printf("Size of the byte array = %lu\n", sz);
|
||||
|
||||
ba.buf = malloc(sz);
|
||||
assert(ba.buf != NULL && "Memory exhausted");
|
||||
|
||||
memcpy(ba.buf, &ind_msg->len, sizeof(ind_msg->len));
|
||||
|
||||
void* it = ba.buf + sizeof(ind_msg->len);
|
||||
for(uint32_t i = 0; i < ind_msg->len ; ++i){
|
||||
memcpy(it, &ind_msg->rb[i], sizeof(ind_msg->rb[i]));
|
||||
it += sizeof(ind_msg->rb[i]);
|
||||
}
|
||||
|
||||
memcpy(it, &ind_msg->tstamp, sizeof(ind_msg->tstamp));
|
||||
it += sizeof(ind_msg->tstamp);
|
||||
|
||||
// memcpy(it, &ind_msg->slot, sizeof(ind_msg->slot));
|
||||
// it += sizeof(ind_msg->slot);
|
||||
|
||||
assert(it == ba.buf + sz && "Mismatch of data layout");
|
||||
|
||||
ba.len = sz;
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_call_proc_id_plain(rlc_call_proc_id_t const* call_proc_id)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(call_proc_id != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_ctrl_hdr_plain(rlc_ctrl_hdr_t const* ctrl_hdr)
|
||||
{
|
||||
assert(ctrl_hdr != NULL);
|
||||
byte_array_t ba = {0};
|
||||
ba.buf = malloc(sizeof(rlc_ind_msg_t));
|
||||
assert(ba.buf != NULL && "Memory exhausted");
|
||||
|
||||
memcpy(ba.buf, ctrl_hdr, sizeof(rlc_ctrl_hdr_t));
|
||||
|
||||
ba.len = sizeof(rlc_ctrl_hdr_t);
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_ctrl_msg_plain(rlc_ctrl_msg_t const* ctrl_msg)
|
||||
{
|
||||
assert(ctrl_msg != NULL);
|
||||
|
||||
byte_array_t ba = {0};
|
||||
ba.buf = malloc(sizeof(rlc_ctrl_msg_t));
|
||||
assert(ba.buf != NULL && "Memory exhausted");
|
||||
|
||||
memcpy(ba.buf, ctrl_msg, sizeof(rlc_ctrl_msg_t));
|
||||
|
||||
ba.len = sizeof(rlc_ctrl_hdr_t);
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_ctrl_out_plain(rlc_ctrl_out_t const* ctrl)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert( ctrl != NULL );
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
byte_array_t rlc_enc_func_def_plain(rlc_func_def_t const* func)
|
||||
{
|
||||
assert(0!=0 && "Not implemented");
|
||||
|
||||
assert(func != NULL);
|
||||
byte_array_t ba = {0};
|
||||
return ba;
|
||||
}
|
||||
|
||||
57
executables/rlc_sm/enc/rlc_enc_plain.h
Normal file
57
executables/rlc_sm/enc/rlc_enc_plain.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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 RLC_ENCRYPTION_PLAIN_H
|
||||
#define RLC_ENCRYPTION_PLAIN_H
|
||||
|
||||
#include "../../../util/byte_array.h"
|
||||
#include "../ie/rlc_data_ie.h"
|
||||
|
||||
|
||||
// Used for static polymorphism.
|
||||
// View rlc_enc_generic file
|
||||
typedef struct{
|
||||
|
||||
} rlc_enc_plain_t;
|
||||
|
||||
|
||||
byte_array_t rlc_enc_event_trigger_plain(rlc_event_trigger_t const* event_trigger);
|
||||
|
||||
byte_array_t rlc_enc_action_def_plain(rlc_action_def_t const*);
|
||||
|
||||
byte_array_t rlc_enc_ind_hdr_plain(rlc_ind_hdr_t const*);
|
||||
|
||||
byte_array_t rlc_enc_ind_msg_plain(rlc_ind_msg_t const*);
|
||||
|
||||
byte_array_t rlc_enc_call_proc_id_plain(rlc_call_proc_id_t const*);
|
||||
|
||||
byte_array_t rlc_enc_ctrl_hdr_plain(rlc_ctrl_hdr_t const*);
|
||||
|
||||
byte_array_t rlc_enc_ctrl_msg_plain(rlc_ctrl_msg_t const*);
|
||||
|
||||
byte_array_t rlc_enc_ctrl_out_plain(rlc_ctrl_out_t const*);
|
||||
|
||||
byte_array_t rlc_enc_func_def_plain(rlc_func_def_t const*);
|
||||
|
||||
#endif
|
||||
|
||||
215
executables/rlc_sm/ie/e2sm_rlc_v00.asn
Normal file
215
executables/rlc_sm/ie/e2sm_rlc_v00.asn
Normal file
@@ -0,0 +1,215 @@
|
||||
-- ASN1 START
|
||||
-- **************************************************************
|
||||
-- E2SM-MAC Stats
|
||||
-- Information Element Definitions
|
||||
--
|
||||
-- **************************************************************
|
||||
|
||||
E2SM-MACStats-IEs { }
|
||||
|
||||
DEFINITIONS AUTOMATIC TAGS ::=
|
||||
|
||||
BEGIN
|
||||
|
||||
-- **************************************************************
|
||||
--
|
||||
-- Lists
|
||||
--
|
||||
-- **************************************************************
|
||||
|
||||
maxofRANParameters INTEGER ::= 255
|
||||
|
||||
-- E2 Service model IEs
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Event Trigger Definition OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- E2SM-MACStats-EventTriggerDefinition IE
|
||||
E2SM-MACStats-EventTriggerDefinition ::= CHOICE{
|
||||
eventDefinition-Format1 E2SM-MACStats-EventTriggerDefinition-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-MACStats-eventTriggerDefinition IE Format 1
|
||||
E2SM-MACStats-EventTriggerDefinition-Format1 ::= SEQUENCE{
|
||||
triggerNature MACStats-TriggerNature,
|
||||
...
|
||||
}
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Action Definition OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
E2SM-MACStats-ActionDefinition ::= CHOICE{
|
||||
actionDefinition-Format1 E2SM-MACStats-ActionDefinition-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-MACStats-actionDefinition IE used for Action Format 1
|
||||
E2SM-MACStats-ActionDefinition-Format1 ::= SEQUENCE{
|
||||
ranParameter-List SEQUENCE (SIZE(1..maxofRANParameters)) OF RANparameter-Item OPTIONAL,
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Indication Header OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
E2SM-MACStats-IndicationHeader ::= CHOICE{
|
||||
indicationHeader-Format1 E2SM-MACStats-IndicationHeader-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-MACStats-indicationHeader Format 1
|
||||
E2SM-MACStats-IndicationHeader-Format1 ::= SEQUENCE{
|
||||
indicationHeaderParam MACStats-Header,
|
||||
...
|
||||
}
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Indication Message OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- E2SM-MACStats-indicationMessage IE
|
||||
E2SM-MACStats-IndicationMessage ::= CHOICE{
|
||||
indicationMessage-Format1 E2SM-MACStats-IndicationMessage-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-MACStats-IndicationMessage Format 1
|
||||
E2SM-MACStats-IndicationMessage-Format1 ::= SEQUENCE{
|
||||
indicationMsgParam MACStats-Message,
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Call Process ID
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- Not defined in this E2SM
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Control Header OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- E2SM-MACStats-ControlHeader
|
||||
E2SM-MACStats-ControlHeader ::= CHOICE{
|
||||
controlHeader-Format1 E2SM-MACStats-ControlHeader-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-MACStats-ControlHeader Format 1
|
||||
E2SM-MACStats-ControlHeader-Format1 ::= SEQUENCE{
|
||||
controlHeaderParam MACStats-Header,
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Control Message OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- E2SM-MACStats-ControlMessage
|
||||
E2SM-MACStats-ControlMessage ::= CHOICE{
|
||||
controlMessage-Format1 E2SM-MACStats-ControlMessage-Format1,
|
||||
...
|
||||
}
|
||||
|
||||
-- E2SM-MACStats-controlMessage Format 1
|
||||
E2SM-MACStats-ControlMessage-Format1 ::= SEQUENCE{
|
||||
controlMsgParam MACStats-Message,
|
||||
...
|
||||
}
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- Control Outcome OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- Not defined in this E2SM
|
||||
|
||||
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- RAN Function definition OCTET STRING contents
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- Not defined in this E2SM
|
||||
|
||||
|
||||
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- commmon IEs
|
||||
-- ---------------------------------------------------
|
||||
|
||||
-- A
|
||||
-- B
|
||||
-- C
|
||||
-- D
|
||||
-- E
|
||||
-- F
|
||||
-- G
|
||||
-- H
|
||||
|
||||
MACStats-Header ::= INTEGER
|
||||
|
||||
MACStats-Message ::= OCTET STRING
|
||||
|
||||
MACStats-TriggerNature ::= ENUMERATED{
|
||||
oneMs,
|
||||
twoMs,
|
||||
fiveMs,
|
||||
...
|
||||
}
|
||||
-- I
|
||||
-- J
|
||||
-- K
|
||||
-- L
|
||||
-- M
|
||||
-- N
|
||||
-- O
|
||||
-- P
|
||||
-- Q
|
||||
-- R
|
||||
|
||||
|
||||
RANparameter-Item ::= SEQUENCE {
|
||||
ranParameter-ID RANparameter-ID,
|
||||
ranParameter-Name RANparameter-Name,
|
||||
ranParameter-Test RANparameter-Test,
|
||||
ranParameter-Value RANparameter-Value,
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
RANparameter-ID ::= INTEGER (0..maxofRANParameters)
|
||||
|
||||
RANparameter-Name ::= OCTET STRING
|
||||
|
||||
RANparameter-Test ::= ENUMERATED{
|
||||
equal,
|
||||
greaterthan,
|
||||
lessthan,
|
||||
contains,
|
||||
present,
|
||||
...
|
||||
}
|
||||
|
||||
RANparameter-Value ::= OCTET STRING
|
||||
|
||||
-- S
|
||||
-- T
|
||||
-- U
|
||||
-- V
|
||||
-- W
|
||||
-- X
|
||||
-- Y
|
||||
-- Z
|
||||
|
||||
END
|
||||
-- ASN1STOP
|
||||
|
||||
88
executables/rlc_sm/ie/e2sm_rlc_v00.fbs
Normal file
88
executables/rlc_sm/ie/e2sm_rlc_v00.fbs
Normal file
@@ -0,0 +1,88 @@
|
||||
namespace rlc.stats;
|
||||
|
||||
table EventTrigger {
|
||||
ms : uint32;
|
||||
}
|
||||
//root_type EventTrigger;
|
||||
|
||||
|
||||
//table ActionDefinition {
|
||||
//}
|
||||
//root_type ActionDefinition;
|
||||
|
||||
|
||||
table IndicationHeader {
|
||||
dummy: uint32;
|
||||
}
|
||||
//root_type IndicationHeader;
|
||||
|
||||
|
||||
table RadioBearerStats {
|
||||
|
||||
txpdu_pkts: uint64;
|
||||
txpdu_bytes: uint64;
|
||||
txpdu_wt_ms: uint64;
|
||||
txpdu_dd_pkts: uint64;
|
||||
txpdu_dd_bytes: uint64;
|
||||
txpdu_retx_pkts: uint64;
|
||||
txpdu_retx_bytes: uint64;
|
||||
txpdu_segmented: uint64;
|
||||
txpdu_status_pkts: uint64;
|
||||
txpdu_status_bytes: uint64;
|
||||
txbuf_occ_bytes: uint64;
|
||||
txbuf_occ_pkts: uint64;
|
||||
rxpdu_pkts: uint64;
|
||||
rxpdu_bytes: uint64;
|
||||
rxpdu_dup_pkts: uint64;
|
||||
rxpdu_dup_bytes: uint64;
|
||||
rxpdu_dd_pkts: uint64;
|
||||
rxpdu_dd_bytes: uint64;
|
||||
rxpdu_ow_pkts: uint64;
|
||||
rxpdu_ow_bytes: uint64;
|
||||
rxpdu_status_pkts: uint64;
|
||||
rxpdu_status_bytes: uint64;
|
||||
rxbuf_occ_bytes: uint64;
|
||||
rxbuf_occ_pkts: uint64;
|
||||
txsdu_pkts: uint64;
|
||||
txsdu_bytes: uint64;
|
||||
rxsdu_pkts: uint64;
|
||||
rxsdu_bytes: uint64;
|
||||
rxsdu_dd_pkts: uint64;
|
||||
rxsdu_dd_bytes: uint64;
|
||||
rnti : uint16;
|
||||
mode : uint8;
|
||||
rbid : uint8;
|
||||
}
|
||||
|
||||
//table UEStats {
|
||||
// rnti: uint16;
|
||||
// rb: [RBStats];
|
||||
//}
|
||||
|
||||
table IndicationMessage {
|
||||
|
||||
rbStats : [RadioBearerStats]
|
||||
|
||||
frame: uint16;
|
||||
slot : uint8;
|
||||
|
||||
// ueStats: [UEStats];
|
||||
}
|
||||
|
||||
//root_type IndicationMessage;
|
||||
|
||||
|
||||
// No ControlHeader in this SM
|
||||
|
||||
|
||||
// No ControlMessage in this SM
|
||||
|
||||
|
||||
// No CallProcessId in this SM
|
||||
|
||||
|
||||
//table RanFunctionDefinition {
|
||||
// supportedReportStyles: [ReportStyle];
|
||||
//}
|
||||
//root_type RanFunctionDefinition;
|
||||
|
||||
396
executables/rlc_sm/ie/rlc_data_ie.c
Normal file
396
executables/rlc_sm/ie/rlc_data_ie.c
Normal file
@@ -0,0 +1,396 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#include "rlc_data_ie.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Event Trigger Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_rlc_event_trigger(rlc_event_trigger_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
assert(0!=0 && "Not implemented" );
|
||||
}
|
||||
|
||||
rlc_event_trigger_t cp_rlc_event_trigger( rlc_event_trigger_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
assert(0!=0 && "Not implemented" );
|
||||
|
||||
rlc_event_trigger_t et = {0};
|
||||
return et;
|
||||
}
|
||||
|
||||
bool eq_rlc_event_trigger(rlc_event_trigger_t* m0, rlc_event_trigger_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Action Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_rlc_action_def(rlc_action_def_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
}
|
||||
|
||||
rlc_action_def_t cp_rlc_action_def(rlc_action_def_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
rlc_action_def_t ad = {0};
|
||||
return ad;
|
||||
}
|
||||
|
||||
bool eq_rlc_action_def(rlc_event_trigger_t* m0, rlc_event_trigger_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Indication Header
|
||||
/////////////////////////////////////
|
||||
|
||||
|
||||
void free_rlc_ind_hdr(rlc_ind_hdr_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
(void)src;
|
||||
}
|
||||
|
||||
rlc_ind_hdr_t cp_rlc_ind_hdr(rlc_ind_hdr_t const* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
rlc_ind_hdr_t dst = {0};
|
||||
dst.dummy = src->dummy;
|
||||
return dst;
|
||||
}
|
||||
|
||||
bool eq_rlc_ind_hdr(rlc_ind_hdr_t* m0, rlc_ind_hdr_t* m1)
|
||||
{
|
||||
assert(m0 != 0);
|
||||
assert(m1 != 0);
|
||||
|
||||
if(m0->dummy != m1->dummy)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Indication Message
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_rlc_ind_msg(rlc_ind_msg_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
if(src->len > 0){
|
||||
assert(src->rb != NULL);
|
||||
free(src->rb);
|
||||
}
|
||||
}
|
||||
|
||||
rlc_ind_msg_t cp_rlc_ind_msg(rlc_ind_msg_t const* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
rlc_ind_msg_t cp = {.len = src->len, .tstamp = src->tstamp};
|
||||
|
||||
if(cp.len > 0){
|
||||
cp.rb = calloc(cp.len, sizeof(rlc_radio_bearer_stats_t));
|
||||
assert(cp.rb != NULL && "memory exhausted");
|
||||
}
|
||||
|
||||
memcpy(cp.rb, src->rb, sizeof(rlc_radio_bearer_stats_t)*cp.len);
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
bool eq_rlc_ind_msg(rlc_ind_msg_t* m0, rlc_ind_msg_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
if(m0->tstamp != m1->tstamp ||
|
||||
m0->len != m1->len)
|
||||
return false;
|
||||
|
||||
for(uint32_t i =0; i < m0->len; ++i){
|
||||
rlc_radio_bearer_stats_t const* rb0 = &m0->rb[i];
|
||||
rlc_radio_bearer_stats_t const* rb1 = &m1->rb[i];
|
||||
if(
|
||||
rb0->txpdu_pkts != rb1->txpdu_pkts ||
|
||||
rb0->txpdu_bytes != rb1->txpdu_bytes ||
|
||||
rb0->txpdu_wt_ms != rb1->txpdu_wt_ms ||
|
||||
rb0->txpdu_dd_pkts != rb1->txpdu_dd_pkts ||
|
||||
rb0->txpdu_dd_bytes != rb1->txpdu_dd_bytes ||
|
||||
rb0->txpdu_retx_pkts != rb1->txpdu_retx_pkts ||
|
||||
rb0->txpdu_retx_bytes != rb1->txpdu_retx_bytes ||
|
||||
rb0->txpdu_segmented != rb1->txpdu_segmented ||
|
||||
rb0->txpdu_status_pkts != rb1->txpdu_status_pkts ||
|
||||
rb0->txpdu_status_bytes != rb1->txpdu_status_bytes ||
|
||||
rb0->txbuf_occ_bytes != rb1-> txbuf_occ_bytes ||
|
||||
rb0->txbuf_occ_pkts != rb1->txbuf_occ_pkts ||
|
||||
rb0->rxpdu_pkts != rb1->rxpdu_pkts ||
|
||||
rb0->rxpdu_bytes != rb1->rxpdu_bytes ||
|
||||
rb0->rxpdu_dup_pkts != rb1->rxpdu_dup_pkts ||
|
||||
rb0->rxpdu_dup_bytes != rb1->rxpdu_dup_bytes ||
|
||||
rb0->rxpdu_dd_pkts != rb1->rxpdu_dd_pkts ||
|
||||
rb0->rxpdu_dd_bytes != rb1->rxpdu_dd_bytes ||
|
||||
rb0->rxpdu_ow_pkts != rb1->rxpdu_ow_pkts ||
|
||||
rb0->rxpdu_ow_bytes != rb1->rxpdu_ow_bytes ||
|
||||
rb0->rxpdu_status_pkts != rb1->rxpdu_status_pkts ||
|
||||
rb0->rxpdu_status_bytes != rb1->rxpdu_status_bytes ||
|
||||
rb0->rxbuf_occ_bytes != rb1->rxbuf_occ_bytes ||
|
||||
rb0->rxbuf_occ_pkts != rb1->rxbuf_occ_pkts ||
|
||||
rb0->txsdu_pkts != rb1->txsdu_pkts ||
|
||||
rb0->txsdu_bytes != rb1->txsdu_bytes ||
|
||||
rb0->rxsdu_pkts != rb1->rxsdu_pkts ||
|
||||
rb0->rxsdu_bytes != rb1->rxsdu_bytes ||
|
||||
rb0->rxsdu_dd_pkts != rb1->rxsdu_dd_pkts ||
|
||||
rb0->rxsdu_dd_bytes != rb1->rxsdu_dd_bytes ||
|
||||
rb0->rnti != rb1->rnti ||
|
||||
rb0->mode != rb1->mode ||
|
||||
rb0->rbid != rb1->rbid
|
||||
)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Call Process ID
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_rlc_call_proc_id(rlc_call_proc_id_t* src)
|
||||
{
|
||||
// Note that the src could be NULL
|
||||
free(src);
|
||||
}
|
||||
|
||||
rlc_call_proc_id_t cp_rlc_call_proc_id( rlc_call_proc_id_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
rlc_call_proc_id_t dst = {0};
|
||||
|
||||
dst.dummy = src->dummy;
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
bool eq_rlc_call_proc_id(rlc_call_proc_id_t* m0, rlc_call_proc_id_t* m1)
|
||||
{
|
||||
if(m0 == NULL && m1 == NULL)
|
||||
return true;
|
||||
if(m0 == NULL)
|
||||
return false;
|
||||
if(m1 == NULL)
|
||||
return false;
|
||||
|
||||
if(m0->dummy != m1->dummy)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Header
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_rlc_ctrl_hdr( rlc_ctrl_hdr_t* src)
|
||||
{
|
||||
|
||||
assert(src != NULL);
|
||||
assert(0!=0 && "Not implemented" );
|
||||
}
|
||||
|
||||
rlc_ctrl_hdr_t cp_rlc_ctrl_hdr(rlc_ctrl_hdr_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
assert(0!=0 && "Not implemented" );
|
||||
rlc_ctrl_hdr_t ret = {0};
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool eq_rlc_ctrl_hdr(rlc_ctrl_hdr_t* m0, rlc_ctrl_hdr_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Message
|
||||
/////////////////////////////////////
|
||||
|
||||
|
||||
void free_rlc_ctrl_msg( rlc_ctrl_msg_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
}
|
||||
|
||||
rlc_ctrl_msg_t cp_rlc_ctrl_msg(rlc_ctrl_msg_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
rlc_ctrl_msg_t ret = {0};
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool eq_rlc_ctrl_msg(rlc_ctrl_msg_t* m0, rlc_ctrl_msg_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Outcome
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_rlc_ctrl_out(rlc_ctrl_out_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
}
|
||||
|
||||
rlc_ctrl_out_t cp_rlc_ctrl_out(rlc_ctrl_out_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
rlc_ctrl_out_t ret = {0};
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool eq_rlc_ctrl_out(rlc_ctrl_out_t* m0, rlc_ctrl_out_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RAN Function Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
void free_rlc_func_def( rlc_func_def_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
}
|
||||
|
||||
rlc_func_def_t cp_rlc_func_def(rlc_func_def_t* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
rlc_func_def_t ret = {0};
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool eq_rlc_func_def(rlc_func_def_t* m0, rlc_func_def_t* m1)
|
||||
{
|
||||
assert(m0 != NULL);
|
||||
assert(m1 != NULL);
|
||||
|
||||
assert(0!=0 && "Not implemented" );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
///////////////
|
||||
// RIC Indication
|
||||
///////////////
|
||||
|
||||
void free_rlc_ind_data(rlc_ind_data_t* ind)
|
||||
{
|
||||
assert(ind != NULL);
|
||||
|
||||
free_rlc_ind_hdr(&ind->hdr);
|
||||
free_rlc_ind_msg(&ind->msg);
|
||||
free_rlc_call_proc_id(ind->proc_id);
|
||||
}
|
||||
|
||||
rlc_ind_data_t cp_rlc_ind_data(rlc_ind_data_t const* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
rlc_ind_data_t dst = {0};
|
||||
|
||||
dst.hdr = cp_rlc_ind_hdr(&src->hdr);
|
||||
dst.msg = cp_rlc_ind_msg(&src->msg);
|
||||
|
||||
if(src->proc_id != NULL){
|
||||
dst.proc_id = malloc(sizeof(rlc_call_proc_id_t));
|
||||
assert(dst.proc_id != NULL && "Memory exhausted");
|
||||
*dst.proc_id = cp_rlc_call_proc_id(src->proc_id);
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
313
executables/rlc_sm/ie/rlc_data_ie.h
Normal file
313
executables/rlc_sm/ie/rlc_data_ie.h
Normal file
@@ -0,0 +1,313 @@
|
||||
/*
|
||||
* 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 RLC_DATA_INFORMATION_ELEMENTS_H
|
||||
#define RLC_DATA_INFORMATION_ELEMENTS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 9 Information Elements (IE) , RIC Event Trigger Definition, RIC Action Definition, RIC Indication Header, RIC Indication Message, RIC Call Process ID, RIC Control Header, RIC Control Message, RIC Control Outcome and RAN Function Definition defined by ORAN-WG3.E2SM-v01.00.00 at Section 5
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Event Trigger Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct {
|
||||
uint32_t ms;
|
||||
} rlc_event_trigger_t;
|
||||
|
||||
void free_rlc_event_trigger(rlc_event_trigger_t* src);
|
||||
|
||||
rlc_event_trigger_t cp_rlc_event_trigger( rlc_event_trigger_t* src);
|
||||
|
||||
bool eq_rlc_event_trigger(rlc_event_trigger_t* m0, rlc_event_trigger_t* m1);
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Action Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct {
|
||||
uint32_t dummy;
|
||||
} rlc_action_def_t;
|
||||
|
||||
void free_rlc_action_def(rlc_action_def_t* src);
|
||||
|
||||
rlc_action_def_t cp_rlc_action_def(rlc_action_def_t* src);
|
||||
|
||||
bool eq_rlc_action_def(rlc_event_trigger_t* m0, rlc_event_trigger_t* m1);
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Indication Header
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct{
|
||||
uint32_t dummy;
|
||||
} rlc_ind_hdr_t;
|
||||
|
||||
void free_rlc_ind_hdr(rlc_ind_hdr_t* src);
|
||||
|
||||
rlc_ind_hdr_t cp_rlc_ind_hdr(rlc_ind_hdr_t const* src);
|
||||
|
||||
bool eq_rlc_ind_hdr(rlc_ind_hdr_t* m0, rlc_ind_hdr_t* m1);
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Indication Message
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct {
|
||||
/* PDU stats */
|
||||
/* TX */
|
||||
uint32_t txpdu_pkts; /* aggregated number of transmitted RLC PDUs */
|
||||
uint32_t txpdu_bytes; /* aggregated amount of transmitted bytes in RLC PDUs */
|
||||
/* TODO? */
|
||||
uint32_t txpdu_wt_ms; /* aggregated head-of-line tx packet waiting time to be transmitted (i.e. send to the MAC layer) */
|
||||
uint32_t txpdu_dd_pkts; /* aggregated number of dropped or discarded tx packets by RLC */
|
||||
uint32_t txpdu_dd_bytes; /* aggregated amount of bytes dropped or discarded tx packets by RLC */
|
||||
uint32_t txpdu_retx_pkts; /* aggregated number of tx pdus/pkts to be re-transmitted (only applicable to RLC AM) */
|
||||
uint32_t txpdu_retx_bytes; /* aggregated amount of bytes to be re-transmitted (only applicable to RLC AM) */
|
||||
uint32_t txpdu_segmented; /* aggregated number of segmentations */
|
||||
uint32_t txpdu_status_pkts; /* aggregated number of tx status pdus/pkts (only applicable to RLC AM) */
|
||||
uint32_t txpdu_status_bytes; /* aggregated amount of tx status bytes (only applicable to RLC AM) */
|
||||
/* TODO? */
|
||||
uint32_t txbuf_occ_bytes; /* current tx buffer occupancy in terms of amount of bytes (average: NOT IMPLEMENTED) */
|
||||
/* TODO? */
|
||||
uint32_t txbuf_occ_pkts; /* current tx buffer occupancy in terms of number of packets (average: NOT IMPLEMENTED) */
|
||||
/* txbuf_wd_ms: the time window for which the txbuf occupancy value is obtained - NOT IMPLEMENTED */
|
||||
|
||||
/* RX */
|
||||
uint32_t rxpdu_pkts; /* aggregated number of received RLC PDUs */
|
||||
uint32_t rxpdu_bytes; /* amount of bytes received by the RLC */
|
||||
uint32_t rxpdu_dup_pkts; /* aggregated number of duplicate packets */
|
||||
uint32_t rxpdu_dup_bytes; /* aggregated amount of duplicated bytes */
|
||||
uint32_t rxpdu_dd_pkts; /* aggregated number of rx packets dropped or discarded by RLC */
|
||||
uint32_t rxpdu_dd_bytes; /* aggregated amount of rx bytes dropped or discarded by RLC */
|
||||
uint32_t rxpdu_ow_pkts; /* aggregated number of out of window received RLC pdu */
|
||||
uint32_t rxpdu_ow_bytes; /* aggregated number of out of window bytes received RLC pdu */
|
||||
uint32_t rxpdu_status_pkts; /* aggregated number of rx status pdus/pkts (only applicable to RLC AM) */
|
||||
uint32_t rxpdu_status_bytes; /* aggregated amount of rx status bytes (only applicable to RLC AM) */
|
||||
/* rxpdu_rotout_ms: flag indicating rx reordering timeout in ms - NOT IMPLEMENTED */
|
||||
/* rxpdu_potout_ms: flag indicating the poll retransmit time out in ms - NOT IMPLEMENTED */
|
||||
/* rxpdu_sptout_ms: flag indicating status prohibit timeout in ms - NOT IMPLEMENTED */
|
||||
/* TODO? */
|
||||
uint32_t rxbuf_occ_bytes; /* current rx buffer occupancy in terms of amount of bytes (average: NOT IMPLEMENTED) */
|
||||
/* TODO? */
|
||||
uint32_t rxbuf_occ_pkts; /* current rx buffer occupancy in terms of number of packets (average: NOT IMPLEMENTED) */
|
||||
|
||||
/* SDU stats */
|
||||
/* TX */
|
||||
uint32_t txsdu_pkts; /* number of SDUs delivered */
|
||||
uint32_t txsdu_bytes; /* number of bytes of SDUs delivered */
|
||||
|
||||
/* RX */
|
||||
uint32_t rxsdu_pkts; /* number of SDUs received */
|
||||
uint32_t rxsdu_bytes; /* number of bytes of SDUs received */
|
||||
uint32_t rxsdu_dd_pkts; /* number of dropped or discarded SDUs */
|
||||
uint32_t rxsdu_dd_bytes; /* number of bytes of SDUs dropped or discarded */
|
||||
|
||||
uint32_t rnti;
|
||||
uint8_t mode; /* 0: RLC AM, 1: RLC UM, 2: RLC TM */
|
||||
uint8_t rbid;
|
||||
|
||||
} rlc_radio_bearer_stats_t;
|
||||
|
||||
typedef struct {
|
||||
rlc_radio_bearer_stats_t* rb;
|
||||
uint32_t len;
|
||||
|
||||
int64_t tstamp;
|
||||
// uint16_t frame;
|
||||
// uint8_t slot;
|
||||
} rlc_ind_msg_t;
|
||||
|
||||
void free_rlc_ind_msg(rlc_ind_msg_t* src);
|
||||
|
||||
rlc_ind_msg_t cp_rlc_ind_msg(rlc_ind_msg_t const* src);
|
||||
|
||||
bool eq_rlc_ind_msg(rlc_ind_msg_t* m0, rlc_ind_msg_t* m1);
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Call Process ID
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct {
|
||||
uint32_t dummy;
|
||||
} rlc_call_proc_id_t;
|
||||
|
||||
void free_rlc_call_proc_id( rlc_call_proc_id_t* src);
|
||||
|
||||
rlc_call_proc_id_t cp_rlc_call_proc_id( rlc_call_proc_id_t* src);
|
||||
|
||||
bool eq_rlc_call_proc_id(rlc_call_proc_id_t* m0, rlc_call_proc_id_t* m1);
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Header
|
||||
/////////////////////////////////////
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint32_t dummy;
|
||||
} rlc_ctrl_hdr_t;
|
||||
|
||||
void free_rlc_ctrl_hdr( rlc_ctrl_hdr_t* src);
|
||||
|
||||
rlc_ctrl_hdr_t cp_rlc_ctrl_hdr(rlc_ctrl_hdr_t* src);
|
||||
|
||||
bool eq_rlc_ctrl_hdr(rlc_ctrl_hdr_t* m0, rlc_ctrl_hdr_t* m1);
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Message
|
||||
/////////////////////////////////////
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint32_t action;
|
||||
} rlc_ctrl_msg_t;
|
||||
|
||||
void free_rlc_ctrl_msg( rlc_ctrl_msg_t* src);
|
||||
|
||||
rlc_ctrl_msg_t cp_rlc_ctrl_msg(rlc_ctrl_msg_t* src);
|
||||
|
||||
bool eq_rlc_ctrl_msg(rlc_ctrl_msg_t* m0, rlc_ctrl_msg_t* m1);
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RIC Control Outcome
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef enum{
|
||||
RLC_CTRL_OUT_OK,
|
||||
|
||||
RLC_CTRL_OUT_END
|
||||
} rlc_ctrl_out_e;
|
||||
|
||||
|
||||
typedef struct {
|
||||
rlc_ctrl_out_e ans;
|
||||
} rlc_ctrl_out_t;
|
||||
|
||||
void free_rlc_ctrl_out(rlc_ctrl_out_t* src);
|
||||
|
||||
rlc_ctrl_out_t cp_rlc_ctrl_out(rlc_ctrl_out_t* src);
|
||||
|
||||
bool eq_rlc_ctrl_out(rlc_ctrl_out_t* m0, rlc_ctrl_out_t* m1);
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// RAN Function Definition
|
||||
/////////////////////////////////////
|
||||
|
||||
typedef struct {
|
||||
uint32_t dummy;
|
||||
} rlc_func_def_t;
|
||||
|
||||
void free_rlc_func_def( rlc_func_def_t* src);
|
||||
|
||||
rlc_func_def_t cp_rlc_func_def(rlc_func_def_t* src);
|
||||
|
||||
bool eq_rlc_func_def(rlc_func_def_t* m0, rlc_func_def_t* m1);
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
|
||||
/*
|
||||
* O-RAN defined 5 Procedures: RIC Subscription, RIC Indication, RIC Control, E2 Setup and RIC Service Update
|
||||
* */
|
||||
|
||||
|
||||
///////////////
|
||||
/// RIC Subscription
|
||||
///////////////
|
||||
|
||||
typedef struct{
|
||||
rlc_event_trigger_t et;
|
||||
rlc_action_def_t* ad;
|
||||
} rlc_sub_data_t;
|
||||
|
||||
///////////////
|
||||
// RIC Indication
|
||||
///////////////
|
||||
|
||||
typedef struct{
|
||||
rlc_ind_hdr_t hdr;
|
||||
rlc_ind_msg_t msg;
|
||||
rlc_call_proc_id_t* proc_id;
|
||||
} rlc_ind_data_t;
|
||||
|
||||
void free_rlc_ind_data(rlc_ind_data_t* ind);
|
||||
|
||||
rlc_ind_data_t cp_rlc_ind_data(rlc_ind_data_t const* src);
|
||||
|
||||
///////////////
|
||||
// RIC Control
|
||||
///////////////
|
||||
|
||||
typedef struct{
|
||||
rlc_ctrl_hdr_t hdr;
|
||||
rlc_ctrl_msg_t msg;
|
||||
} rlc_ctrl_req_data_t;
|
||||
|
||||
typedef struct{
|
||||
rlc_ctrl_out_t* out;
|
||||
} rlc_ctrl_out_data_t;
|
||||
|
||||
///////////////
|
||||
// E2 Setup
|
||||
///////////////
|
||||
|
||||
typedef struct{
|
||||
rlc_func_def_t func_def;
|
||||
} rlc_e2_setup_data_t;
|
||||
|
||||
///////////////
|
||||
// RIC Service Update
|
||||
///////////////
|
||||
|
||||
typedef struct{
|
||||
rlc_func_def_t func_def;
|
||||
} rlc_ric_service_update_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
202
executables/rlc_sm/rlc_sm_agent.c
Normal file
202
executables/rlc_sm/rlc_sm_agent.c
Normal file
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#include "rlc_sm_agent.h"
|
||||
#include "rlc_sm_id.h"
|
||||
#include "enc/rlc_enc_generic.h"
|
||||
#include "dec/rlc_dec_generic.h"
|
||||
#include "../../util/alg_ds/alg/defer.h"
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct{
|
||||
|
||||
sm_agent_t base;
|
||||
|
||||
#ifdef ASN
|
||||
rlc_enc_asn_t enc;
|
||||
#elif FLATBUFFERS
|
||||
rlc_enc_fb_t enc;
|
||||
#elif PLAIN
|
||||
rlc_enc_plain_t enc;
|
||||
#else
|
||||
static_assert(false, "No encryption type selected");
|
||||
#endif
|
||||
|
||||
} sm_rlc_agent_t;
|
||||
|
||||
|
||||
// Function pointers provided by the RAN for the
|
||||
// 5 procedures,
|
||||
// subscription, indication, control,
|
||||
// E2 Setup and RIC Service Update.
|
||||
//
|
||||
static
|
||||
subscribe_timer_t on_subscription_rlc_sm_ag(sm_agent_t* sm_agent, const sm_subs_data_t* data)
|
||||
{
|
||||
assert(sm_agent != NULL);
|
||||
assert(data != NULL);
|
||||
|
||||
sm_rlc_agent_t* sm = (sm_rlc_agent_t*)sm_agent;
|
||||
|
||||
rlc_event_trigger_t ev = rlc_dec_event_trigger(&sm->enc, data->len_et, data->event_trigger);
|
||||
|
||||
subscribe_timer_t timer = {.ms = ev.ms };
|
||||
return timer;
|
||||
}
|
||||
|
||||
static
|
||||
sm_ind_data_t on_indication_rlc_sm_ag(sm_agent_t* sm_agent)
|
||||
{
|
||||
// printf("on_indication RLC called \n");
|
||||
|
||||
assert(sm_agent != NULL);
|
||||
sm_rlc_agent_t* sm = (sm_rlc_agent_t*)sm_agent;
|
||||
|
||||
sm_ind_data_t ret = {0};
|
||||
|
||||
// Fill Indication Header
|
||||
rlc_ind_hdr_t hdr = {.dummy = 0 };
|
||||
byte_array_t ba_hdr = rlc_enc_ind_hdr(&sm->enc, &hdr );
|
||||
ret.ind_hdr = ba_hdr.buf;
|
||||
ret.len_hdr = ba_hdr.len;
|
||||
|
||||
// Fill Indication Message
|
||||
sm_ag_if_rd_t rd_if = {0};
|
||||
rd_if.type = RLC_STATS_V0;
|
||||
sm->base.io.read(&rd_if);
|
||||
|
||||
// Liberate the memory if previously allocated by the RAN. It sucks
|
||||
rlc_ind_data_t* ind = &rd_if.rlc_stats;
|
||||
defer({ free_rlc_ind_hdr(&ind->hdr) ;});
|
||||
defer({ free_rlc_ind_msg(&ind->msg) ;});
|
||||
defer({ free_rlc_call_proc_id(ind->proc_id);});
|
||||
|
||||
byte_array_t ba = rlc_enc_ind_msg(&sm->enc, &rd_if.rlc_stats.msg);
|
||||
ret.ind_msg = ba.buf;
|
||||
ret.len_msg = ba.len;
|
||||
|
||||
// Fill Call Process ID
|
||||
ret.call_process_id = NULL;
|
||||
ret.len_cpid = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static
|
||||
sm_ctrl_out_data_t on_control_rlc_sm_ag(sm_agent_t* sm_agent, sm_ctrl_req_data_t const* data)
|
||||
{
|
||||
assert(sm_agent != NULL);
|
||||
assert(data != NULL);
|
||||
sm_rlc_agent_t* sm = (sm_rlc_agent_t*) sm_agent;
|
||||
|
||||
rlc_ctrl_hdr_t hdr = rlc_dec_ctrl_hdr(&sm->enc, data->len_hdr, data->ctrl_hdr);
|
||||
assert(hdr.dummy == 0 && "Only dummy == 0 supported ");
|
||||
|
||||
rlc_ctrl_msg_t msg = rlc_dec_ctrl_msg(&sm->enc, data->len_msg, data->ctrl_msg);
|
||||
assert(msg.action == 42 && "Only action number 42 supported");
|
||||
|
||||
sm_ag_if_wr_t wr = {.type = RLC_CTRL_REQ_V0 };
|
||||
wr.rlc_ctrl.hdr.dummy = 0;
|
||||
wr.rlc_ctrl.msg.action = msg.action;
|
||||
|
||||
sm->base.io.write(&wr);
|
||||
|
||||
// Answer from the E2 Node
|
||||
sm_ctrl_out_data_t ret = {0};
|
||||
ret.ctrl_out = NULL;
|
||||
ret.len_out = 0;
|
||||
|
||||
printf("on_control called \n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
static
|
||||
sm_e2_setup_t on_e2_setup_rlc_sm_ag(sm_agent_t* sm_agent)
|
||||
{
|
||||
assert(sm_agent != NULL);
|
||||
//printf("on_e2_setup called \n");
|
||||
sm_rlc_agent_t* sm = (sm_rlc_agent_t*)sm_agent;
|
||||
|
||||
sm_e2_setup_t setup = {.len_rfd =0, .ran_fun_def = NULL };
|
||||
|
||||
setup.len_rfd = strlen(sm->base.ran_func_name);
|
||||
setup.ran_fun_def = calloc(1, strlen(sm->base.ran_func_name));
|
||||
assert(setup.ran_fun_def != NULL);
|
||||
memcpy(setup.ran_fun_def, sm->base.ran_func_name, strlen(sm->base.ran_func_name));
|
||||
|
||||
return setup;
|
||||
}
|
||||
|
||||
static
|
||||
void on_ric_service_update_rlc_sm_ag(sm_agent_t* sm_agent, sm_ric_service_update_t const* data)
|
||||
{
|
||||
assert(sm_agent != NULL);
|
||||
assert(data != NULL);
|
||||
|
||||
|
||||
printf("on_ric_service_update called \n");
|
||||
}
|
||||
|
||||
static
|
||||
void free_rlc_sm_ag(sm_agent_t* sm_agent)
|
||||
{
|
||||
assert(sm_agent != NULL);
|
||||
sm_rlc_agent_t* sm = (sm_rlc_agent_t*)sm_agent;
|
||||
free(sm);
|
||||
}
|
||||
|
||||
|
||||
sm_agent_t* make_rlc_sm_agent(sm_io_ag_t io)
|
||||
{
|
||||
sm_rlc_agent_t* sm = calloc(1, sizeof(sm_rlc_agent_t));
|
||||
assert(sm != NULL && "Memory exhausted!!!");
|
||||
|
||||
*(uint16_t*)(&sm->base.ran_func_id) = SM_RLC_ID;
|
||||
|
||||
sm->base.io = io;
|
||||
sm->base.free_sm = free_rlc_sm_ag;
|
||||
|
||||
sm->base.proc.on_subscription = on_subscription_rlc_sm_ag;
|
||||
sm->base.proc.on_indication = on_indication_rlc_sm_ag;
|
||||
sm->base.proc.on_control = on_control_rlc_sm_ag;
|
||||
sm->base.proc.on_ric_service_update = on_ric_service_update_rlc_sm_ag;
|
||||
sm->base.proc.on_e2_setup = on_e2_setup_rlc_sm_ag;
|
||||
sm->base.handle = NULL;
|
||||
|
||||
assert(strlen(SM_RLC_STR) < sizeof( sm->base.ran_func_name) );
|
||||
memcpy(sm->base.ran_func_name, SM_RLC_STR, strlen(SM_RLC_STR));
|
||||
|
||||
return &sm->base;
|
||||
}
|
||||
|
||||
|
||||
uint16_t id_rlc_sm_agent(sm_agent_t const* sm_agent )
|
||||
{
|
||||
assert(sm_agent != NULL);
|
||||
sm_rlc_agent_t* sm = (sm_rlc_agent_t*)sm_agent;
|
||||
return sm->base.ran_func_id;
|
||||
}
|
||||
|
||||
34
executables/rlc_sm/rlc_sm_agent.h
Normal file
34
executables/rlc_sm/rlc_sm_agent.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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 RLC_SERVICE_MODEL_AGENT_H
|
||||
#define RLC_SERVICE_MODEL_AGENT_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../sm_agent.h"
|
||||
|
||||
sm_agent_t* make_rlc_sm_agent(sm_io_ag_t io);
|
||||
|
||||
#endif
|
||||
|
||||
40
executables/rlc_sm/rlc_sm_id.h
Normal file
40
executables/rlc_sm/rlc_sm_id.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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 RLC_SERVICE_MODEL_ID_H
|
||||
#define RLC_SERVICE_MODEL_ID_H
|
||||
|
||||
|
||||
/*
|
||||
* Service Model ID needed for the agent as well as for the ric to ensure that they match.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
static
|
||||
const uint16_t SM_RLC_ID = 143;
|
||||
|
||||
static
|
||||
const char* __attribute__((unused))SM_RLC_STR = "RLC_STATS_V0";
|
||||
|
||||
#endif
|
||||
|
||||
265
executables/rlc_sm/rlc_sm_ric.c
Normal file
265
executables/rlc_sm/rlc_sm_ric.c
Normal file
@@ -0,0 +1,265 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#include "rlc_sm_ric.h"
|
||||
#include "rlc_sm_id.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "enc/rlc_enc_generic.h"
|
||||
#include "dec/rlc_dec_generic.h"
|
||||
|
||||
typedef struct{
|
||||
sm_ric_t base;
|
||||
|
||||
#ifdef ASN
|
||||
rlc_enc_asn_t enc;
|
||||
#elif FLATBUFFERS
|
||||
rlc_enc_fb_t enc;
|
||||
#elif PLAIN
|
||||
rlc_enc_plain_t enc;
|
||||
#else
|
||||
static_assert(false, "No encryption type selected");
|
||||
#endif
|
||||
} sm_rlc_ric_t;
|
||||
|
||||
|
||||
static
|
||||
sm_subs_data_t on_subscription_rlc_sm_ric(sm_ric_t const* sm_ric, const char* cmd)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(cmd != NULL);
|
||||
sm_rlc_ric_t* sm = (sm_rlc_ric_t*)sm_ric;
|
||||
|
||||
rlc_event_trigger_t ev = {0};
|
||||
|
||||
const int max_str_sz = 10;
|
||||
if(strncmp(cmd, "1_ms", max_str_sz) == 0 ){
|
||||
ev.ms = 1;
|
||||
} else if (strncmp(cmd, "2_ms", max_str_sz) == 0 ) {
|
||||
ev.ms = 2;
|
||||
} else if (strncmp(cmd, "5_ms", max_str_sz) == 0 ) {
|
||||
ev.ms = 5;
|
||||
} else {
|
||||
assert(0 != 0 && "Invalid input");
|
||||
}
|
||||
const byte_array_t ba = rlc_enc_event_trigger(&sm->enc, &ev);
|
||||
|
||||
sm_subs_data_t data = {0};
|
||||
|
||||
// Event trigger IE
|
||||
data.event_trigger = ba.buf;
|
||||
data.len_et = ba.len;
|
||||
|
||||
// Action Definition IE
|
||||
data.action_def = NULL;
|
||||
data.len_ad = 0;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
static
|
||||
sm_ag_if_rd_t on_indication_rlc_sm_ric(sm_ric_t const* sm_ric, sm_ind_data_t* data)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(data != NULL);
|
||||
sm_rlc_ric_t* sm = (sm_rlc_ric_t*)sm_ric;
|
||||
|
||||
sm_ag_if_rd_t rd_if = {.type = RLC_STATS_V0};
|
||||
|
||||
rd_if.rlc_stats.msg = rlc_dec_ind_msg(&sm->enc, data->len_msg, data->ind_msg);
|
||||
rd_if.rlc_stats.hdr = rlc_dec_ind_hdr(&sm->enc, data->len_hdr, data->ind_hdr);
|
||||
|
||||
// ToDO: fill the structure properly
|
||||
// assert(sizeof(rlc_ind_msg_t) == sizeof(rlc_rd_stats_t) && "memcpy not allowed if the structs are different");
|
||||
// memcpy(&rd_if.rlc_stats, &ind_msg, sizeof(rlc_rd_stats_t));
|
||||
|
||||
//rd_if.rlc_stats.tx_bytes = msg.tx_bytes;
|
||||
//rd_if.rlc_stats.tx_pkts = msg.tx_pkts;
|
||||
|
||||
return rd_if;
|
||||
}
|
||||
|
||||
static
|
||||
sm_ctrl_req_data_t ric_on_control_req_rlc_sm_ric(sm_ric_t const* sm_ric, const sm_ag_if_wr_t* data)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(data != NULL);
|
||||
assert(data->type == RLC_CTRL_REQ_V0);
|
||||
rlc_ctrl_req_data_t const* req = &data->rlc_ctrl;
|
||||
assert(req->hdr.dummy == 0);
|
||||
assert(req->msg.action == 42);
|
||||
|
||||
sm_rlc_ric_t* sm = (sm_rlc_ric_t*)sm_ric;
|
||||
|
||||
byte_array_t ba = rlc_enc_ctrl_hdr(&sm->enc, &req->hdr);
|
||||
|
||||
sm_ctrl_req_data_t ret_data = {0};
|
||||
ret_data.ctrl_hdr = ba.buf;
|
||||
ret_data.len_hdr = ba.len;
|
||||
|
||||
ba = rlc_enc_ctrl_msg(&sm->enc, &req->msg);
|
||||
ret_data.ctrl_msg = ba.buf;
|
||||
ret_data.len_msg = ba.len;
|
||||
|
||||
return ret_data;
|
||||
}
|
||||
|
||||
static
|
||||
sm_ag_if_ans_t ric_on_control_out_rlc_sm_ric(sm_ric_t const* sm_ric,const sm_ctrl_out_data_t * out)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(out != NULL);
|
||||
|
||||
sm_rlc_ric_t* sm = (sm_rlc_ric_t*)sm_ric;
|
||||
|
||||
sm_ag_if_ans_t ag_if = {.type = MAC_AGENT_IF_CTRL_ANS_V0};
|
||||
ag_if.rlc = rlc_dec_ctrl_out(&sm->enc, out->len_out, out->ctrl_out);
|
||||
assert(ag_if.rlc.ans == RLC_CTRL_OUT_OK);
|
||||
|
||||
return ag_if;
|
||||
}
|
||||
|
||||
static
|
||||
void ric_on_e2_setup_rlc_sm_ric(sm_ric_t const* sm_ric, sm_e2_setup_t const* setup)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(setup == NULL);
|
||||
// sm_rlc_ric_t* sm = (sm_rlc_ric_t*)sm_ric;
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
static
|
||||
sm_ric_service_update_t on_ric_service_update_rlc_sm_ric(sm_ric_t const* sm_ric, const char* data)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
assert(data != NULL);
|
||||
// sm_rlc_ric_t* sm = (sm_rlc_ric_t*)sm_ric;
|
||||
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
static
|
||||
void free_rlc_sm_ric(sm_ric_t* sm_ric)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
sm_rlc_ric_t* sm = (sm_rlc_ric_t*)sm_ric;
|
||||
free(sm);
|
||||
}
|
||||
|
||||
//
|
||||
// Allocation SM functions. The memory malloc by the SM is also freed by it.
|
||||
//
|
||||
|
||||
static
|
||||
void free_subs_data_rlc_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
static
|
||||
void free_ind_data_rlc_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
rlc_ind_data_t* ind = (rlc_ind_data_t*)msg;
|
||||
free_rlc_ind_hdr(&ind->hdr);
|
||||
free_rlc_ind_msg(&ind->msg);
|
||||
|
||||
}
|
||||
|
||||
static
|
||||
void free_ctrl_req_data_rlc_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
static
|
||||
void free_ctrl_out_data_rlc_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
static
|
||||
void free_e2_setup_rlc_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
static
|
||||
void free_ric_service_update_rlc_sm_ric(void* msg)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
|
||||
|
||||
sm_ric_t* make_rlc_sm_ric(void /* sm_io_ric_t io */)
|
||||
{
|
||||
sm_rlc_ric_t* sm = calloc(1,sizeof(sm_rlc_ric_t));
|
||||
assert(sm != NULL && "Memory exhausted");
|
||||
|
||||
*((uint16_t*)&sm->base.ran_func_id) = SM_RLC_ID;
|
||||
|
||||
sm->base.free_sm = free_rlc_sm_ric;
|
||||
|
||||
// Memory (De)Allocation
|
||||
sm->base.alloc.free_subs_data_msg = free_subs_data_rlc_sm_ric;
|
||||
sm->base.alloc.free_ind_data = free_ind_data_rlc_sm_ric ;
|
||||
sm->base.alloc.free_ctrl_req_data = free_ctrl_req_data_rlc_sm_ric;
|
||||
sm->base.alloc.free_ctrl_out_data = free_ctrl_out_data_rlc_sm_ric;
|
||||
|
||||
sm->base.alloc.free_e2_setup = free_e2_setup_rlc_sm_ric;
|
||||
sm->base.alloc.free_ric_service_update = free_ric_service_update_rlc_sm_ric;
|
||||
|
||||
// O-RAN E2SM 5 Procedures
|
||||
sm->base.proc.on_subscription = on_subscription_rlc_sm_ric;
|
||||
sm->base.proc.on_indication = on_indication_rlc_sm_ric;
|
||||
|
||||
sm->base.proc.on_control_req = ric_on_control_req_rlc_sm_ric;
|
||||
sm->base.proc.on_control_out = ric_on_control_out_rlc_sm_ric;
|
||||
|
||||
sm->base.proc.on_e2_setup = ric_on_e2_setup_rlc_sm_ric;
|
||||
sm->base.proc.on_ric_service_update = on_ric_service_update_rlc_sm_ric;
|
||||
sm->base.handle = NULL;
|
||||
|
||||
assert(strlen(SM_RLC_STR) < sizeof( sm->base.ran_func_name) );
|
||||
memcpy(sm->base.ran_func_name, SM_RLC_STR, strlen(SM_RLC_STR));
|
||||
|
||||
|
||||
return &sm->base;
|
||||
}
|
||||
|
||||
|
||||
uint16_t id_sm_rlc_ric(sm_ric_t const* sm_ric)
|
||||
{
|
||||
assert(sm_ric != NULL);
|
||||
sm_rlc_ric_t* sm = (sm_rlc_ric_t*)sm_ric;
|
||||
return sm->base.ran_func_id;
|
||||
}
|
||||
|
||||
35
executables/rlc_sm/rlc_sm_ric.h
Normal file
35
executables/rlc_sm/rlc_sm_ric.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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 RLC_SERVICE_MODEL_SERVER_H
|
||||
#define RLC_SERVICE_MODEL_SERVER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../../sm/sm_ric.h"
|
||||
|
||||
sm_ric_t* make_rlc_sm_ric(void);
|
||||
|
||||
uint16_t id_rlc_sm_ric(sm_ric_t const* );
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
43
executables/rlc_sm/test/CMakeLists.txt
Normal file
43
executables/rlc_sm/test/CMakeLists.txt
Normal file
@@ -0,0 +1,43 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project (RLC_SM)
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
set (CMAKE_C_FLAGS "-Wall -std=c11 -g -fsanitize=address -fno-omit-frame-pointer")
|
||||
|
||||
|
||||
set(SM_ENCODING "PLAIN" CACHE STRING "The E2AP encoding to use")
|
||||
set_property(CACHE SM_ENCODING PROPERTY STRINGS "PLAIN" "ASN" "FLATBUFFERS")
|
||||
message(STATUS "Selected SM_ENCODING: ${SM_ENCODING}")
|
||||
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}../ie/asn/ )
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}../ie/fb/ )
|
||||
include_directories("/usr/local/share/asn1c/")
|
||||
|
||||
|
||||
file(GLOB asn_sources "../ie/asn/*.c")
|
||||
|
||||
add_executable(test_rlc_sm main.c
|
||||
../../sm_proc_data.c
|
||||
../rlc_sm_agent.c
|
||||
../rlc_sm_ric.c
|
||||
../enc/rlc_enc_plain.c
|
||||
../enc/rlc_enc_fb.c
|
||||
../enc/rlc_enc_asn.c
|
||||
../dec/rlc_dec_plain.c
|
||||
../dec/rlc_dec_fb.c
|
||||
../dec/rlc_dec_asn.c
|
||||
../ie/rlc_data_ie.c
|
||||
../../../util/alg_ds/alg/defer.c
|
||||
../../../util/alg_ds/alg/eq_float.c
|
||||
${asn_sources}
|
||||
)
|
||||
|
||||
target_compile_definitions(test_rlc_sm PUBLIC ${SM_ENCODING})
|
||||
target_compile_options(test_rlc_sm PUBLIC "-DASN_DISABLE_OER_SUPPORT")
|
||||
target_link_libraries(test_rlc_sm PUBLIC -pthread)
|
||||
|
||||
|
||||
|
||||
|
||||
222
executables/rlc_sm/test/main.c
Normal file
222
executables/rlc_sm/test/main.c
Normal file
@@ -0,0 +1,222 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#include "../../rlc_sm/rlc_sm_agent.h"
|
||||
#include "../../rlc_sm/rlc_sm_ric.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <pthread.h>
|
||||
|
||||
static
|
||||
rlc_ind_data_t cp;
|
||||
|
||||
|
||||
void fill_rlc_ind_data(rlc_ind_data_t* ind_data)
|
||||
{
|
||||
|
||||
srand(time(0));
|
||||
|
||||
int const mod_len = 24;
|
||||
int const mod = 1024;
|
||||
|
||||
rlc_ind_msg_t* ind_msg = &ind_data->msg;
|
||||
|
||||
ind_msg->len = abs(rand()%mod_len);
|
||||
if(ind_msg->len > 0 ){
|
||||
ind_msg->rb = calloc(ind_msg->len, sizeof(rlc_radio_bearer_stats_t) );
|
||||
assert(ind_msg->rb != NULL);
|
||||
}
|
||||
printf("Value of the len = %u \n", ind_msg->len);
|
||||
|
||||
for(uint32_t i = 0; i < ind_msg->len; ++i){
|
||||
rlc_radio_bearer_stats_t* rb = &ind_msg->rb[i];
|
||||
|
||||
rb->txpdu_pkts=abs(rand()%mod) ; /* aggregated number of transmitted RLC PDUs */
|
||||
rb->txpdu_bytes=abs(rand()%mod); /* aggregated amount of transmitted bytes in RLC PDUs */
|
||||
/* TODO? */
|
||||
rb->txpdu_wt_ms=abs(rand()%mod); /* aggregated head-of-line tx packet waiting time to be transmitted (i.e. send to the MAC layer) */
|
||||
rb->txpdu_dd_pkts=abs(rand()%mod); /* aggregated number of dropped or discarded tx packets by RLC */
|
||||
rb->txpdu_dd_bytes=abs(rand()%mod); /* aggregated amount of bytes dropped or discarded tx packets by RLC */
|
||||
rb->txpdu_retx_pkts=abs(rand()%mod); /* aggregated number of tx pdus/pkts to be re-transmitted (only applicable to RLC AM) */
|
||||
rb->txpdu_retx_bytes=abs(rand()%mod); /* aggregated amount of bytes to be re-transmitted (only applicable to RLC AM) */
|
||||
rb->txpdu_segmented=abs(rand()%mod); /* aggregated number of segmentations */
|
||||
rb->txpdu_status_pkts=abs(rand()%mod); /* aggregated number of tx status pdus/pkts (only applicable to RLC AM) */
|
||||
rb->txpdu_status_bytes=abs(rand()%mod); /* aggregated amount of tx status bytes (only applicable to RLC AM) */
|
||||
/* TODO? */
|
||||
rb->txbuf_occ_bytes=abs(rand()%mod); /* current tx buffer occupancy in terms of amount of bytes (average: NOT IMPLEMENTED) */
|
||||
/* TODO? */
|
||||
rb->txbuf_occ_pkts=abs(rand()%mod); /* current tx buffer occupancy in terms of number of packets (average: NOT IMPLEMENTED) */
|
||||
/* txbuf_wd_ms: the time window for which the txbuf occupancy value is obtained - NOT IMPLEMENTED */
|
||||
|
||||
/* RX */
|
||||
rb->rxpdu_pkts=abs(rand()%mod); /* aggregated number of received RLC PDUs */
|
||||
rb->rxpdu_bytes=abs(rand()%mod); /* amount of bytes received by the RLC */
|
||||
rb->rxpdu_dup_pkts=abs(rand()%mod); /* aggregated number of duplicate packets */
|
||||
rb->rxpdu_dup_bytes=abs(rand()%mod); /* aggregated amount of duplicated bytes */
|
||||
rb->rxpdu_dd_pkts=abs(rand()%mod); /* aggregated number of rx packets dropped or discarded by RLC */
|
||||
rb->rxpdu_dd_bytes=abs(rand()%mod); /* aggregated amount of rx bytes dropped or discarded by RLC */
|
||||
rb->rxpdu_ow_pkts=abs(rand()%mod); /* aggregated number of out of window received RLC pdu */
|
||||
rb->rxpdu_ow_bytes=abs(rand()%mod); /* aggregated number of out of window bytes received RLC pdu */
|
||||
rb->rxpdu_status_pkts=abs(rand()%mod); /* aggregated number of rx status pdus/pkts (only applicable to RLC AM) */
|
||||
rb->rxpdu_status_bytes=abs(rand()%mod); /* aggregated amount of rx status bytes (only applicable to RLC AM) */
|
||||
/* rxpdu_rotout_ms: flag indicating rx reordering timeout in ms - NOT IMPLEMENTED */
|
||||
/* rxpdu_potout_ms: flag indicating the poll retransmit time out in ms - NOT IMPLEMENTED */
|
||||
/* rxpdu_sptout_ms: flag indicating status prohibit timeout in ms - NOT IMPLEMENTED */
|
||||
/* TODO? */
|
||||
rb->rxbuf_occ_bytes=abs(rand()%mod); /* current rx buffer occupancy in terms of amount of bytes (average: NOT IMPLEMENTED) */
|
||||
/* TODO? */
|
||||
rb->rxbuf_occ_pkts=abs(rand()%mod); /* current rx buffer occupancy in terms of number of packets (average: NOT IMPLEMENTED) */
|
||||
|
||||
/* SDU stats */
|
||||
/* TX */
|
||||
rb->txsdu_pkts=abs(rand()%mod); /* number of SDUs delivered */
|
||||
rb->txsdu_bytes=abs(rand()%mod); /* number of bytes of SDUs delivered */
|
||||
|
||||
/* RX */
|
||||
rb->rxsdu_pkts=abs(rand()%mod); /* number of SDUs received */
|
||||
rb->rxsdu_bytes=abs(rand()%mod); /* number of bytes of SDUs received */
|
||||
rb->rxsdu_dd_pkts=abs(rand()%mod); /* number of dropped or discarded SDUs */
|
||||
rb->rxsdu_dd_bytes=abs(rand()%mod); /* number of bytes of SDUs dropped or discarded */
|
||||
|
||||
rb->rnti=abs(rand()%mod);
|
||||
rb->mode=abs(rand()%mod); /* 0: RLC AM, 1: RLC UM, 2: RLC TM */
|
||||
rb->rbid=abs(rand()%mod);
|
||||
|
||||
}
|
||||
|
||||
cp.hdr = cp_rlc_ind_hdr(&ind_data->hdr);
|
||||
cp.msg = cp_rlc_ind_msg(&ind_data->msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////
|
||||
// AGENT
|
||||
////
|
||||
|
||||
static
|
||||
void read_RAN(sm_ag_if_rd_t* read)
|
||||
{
|
||||
assert(read != NULL);
|
||||
assert(read->type == RLC_STATS_V0);
|
||||
|
||||
fill_rlc_ind_data(&read->rlc_stats);
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
sm_ag_if_ans_t write_RAN(sm_ag_if_wr_t const* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
sm_ag_if_ans_t ans = {0};
|
||||
return ans;
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
// Check Functions
|
||||
// //////////////////////////
|
||||
|
||||
static
|
||||
void check_eq_ran_function(sm_agent_t const* ag, sm_ric_t const* ric)
|
||||
{
|
||||
assert(ag != NULL);
|
||||
assert(ric != NULL);
|
||||
assert(ag->ran_func_id == ric->ran_func_id);
|
||||
}
|
||||
|
||||
// RIC -> E2
|
||||
static
|
||||
void check_subscription(sm_agent_t* ag, sm_ric_t* ric)
|
||||
{
|
||||
assert(ag != NULL);
|
||||
assert(ric != NULL);
|
||||
|
||||
sm_subs_data_t data = ric->proc.on_subscription(ric, "2_ms");
|
||||
ag->proc.on_subscription(ag, &data);
|
||||
|
||||
free_sm_subs_data(&data);
|
||||
}
|
||||
|
||||
// E2 -> RIC
|
||||
static
|
||||
void check_indication(sm_agent_t* ag, sm_ric_t* ric)
|
||||
{
|
||||
assert(ag != NULL);
|
||||
assert(ric != NULL);
|
||||
|
||||
sm_ind_data_t sm_data = ag->proc.on_indication(ag);
|
||||
if(sm_data.call_process_id != NULL){
|
||||
assert(sm_data.len_cpid != 0);
|
||||
}
|
||||
if(sm_data.ind_hdr != NULL){
|
||||
assert(sm_data.len_hdr != 0);
|
||||
}
|
||||
if(sm_data.ind_msg != NULL){
|
||||
assert(sm_data.len_msg != 0);
|
||||
}
|
||||
|
||||
sm_ag_if_rd_t msg = ric->proc.on_indication(ric, &sm_data);
|
||||
|
||||
assert(msg.type == RLC_STATS_V0);
|
||||
|
||||
|
||||
rlc_ind_data_t* data = &msg.rlc_stats;
|
||||
|
||||
if(msg.rlc_stats.msg.rb != NULL){
|
||||
assert(msg.rlc_stats.msg.len != 0);
|
||||
}
|
||||
|
||||
|
||||
assert(eq_rlc_ind_hdr(&data->hdr, &cp.hdr) == true);
|
||||
assert(eq_rlc_ind_msg(&data->msg, &cp.msg) == true);
|
||||
assert(eq_rlc_call_proc_id(data->proc_id, cp.proc_id) == true);
|
||||
|
||||
free_rlc_ind_hdr(&data->hdr);
|
||||
free_rlc_ind_msg(&data->msg);
|
||||
|
||||
free_sm_ind_data(&sm_data);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
sm_io_ag_t io_ag = {.read = read_RAN, .write = write_RAN};
|
||||
sm_agent_t* sm_ag = make_rlc_sm_agent(io_ag);
|
||||
|
||||
sm_ric_t* sm_ric = make_rlc_sm_ric();
|
||||
|
||||
check_eq_ran_function(sm_ag, sm_ric);
|
||||
check_subscription(sm_ag, sm_ric);
|
||||
check_indication(sm_ag, sm_ric);
|
||||
|
||||
sm_ag->free_sm(sm_ag);
|
||||
sm_ric->free_sm(sm_ric);
|
||||
|
||||
printf("Success\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user