diff --git a/executables/agent_if/conf_file.h b/executables/agent_if/conf_file.h new file mode 100644 index 0000000000000000000000000000000000000000..9f62752176294ebf255eb9eac069fd12ffe37c84 --- /dev/null +++ b/executables/agent_if/conf_file.h @@ -0,0 +1,16 @@ +#ifndef FLEXRIC_CONFIGURATION_FILE_H +#define FLEXRIC_CONFIGURATION_FILE_H + +typedef struct { + char conf_file[128]; + char libs_dir[128]; +} args_t; + +char* get_near_ric_ip(args_t); +int is_regular_file(const char *path); +void print_usage(const char*); +int parse_args(int argc, char** argv, args_t* args); + +#endif + + diff --git a/executables/agent_if/e2_agent_api.h b/executables/agent_if/e2_agent_api.h index c922cad59097aff6e40a419770ee3427f95a1eef..f81397c12d4bcb9bb6be86c48ca9360294810038 100644 --- a/executables/agent_if/e2_agent_api.h +++ b/executables/agent_if/e2_agent_api.h @@ -25,13 +25,15 @@ #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); + sm_io_ag_t io, + args_t args); void stop_agent_api(void); diff --git a/executables/agent_if/ie/mac_data_ie.h b/executables/agent_if/ie/mac_data_ie.h index c9dbee6cf818dc968b3506f12430ca99f0bb9d39..b0437c2dfe805c5b8867be55abc089f673cbf11f 100644 --- a/executables/agent_if/ie/mac_data_ie.h +++ b/executables/agent_if/ie/mac_data_ie.h @@ -1,6 +1,10 @@ #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 */ @@ -53,7 +57,7 @@ typedef struct{ void free_mac_ind_hdr(mac_ind_hdr_t* src); -mac_ind_hdr_t cp_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); @@ -102,6 +106,8 @@ typedef struct int16_t slot; } 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; @@ -110,7 +116,7 @@ typedef struct { void free_mac_ind_msg(mac_ind_msg_t* src); -mac_ind_msg_t cp_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); @@ -224,6 +230,10 @@ typedef struct{ 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 /////////////// @@ -253,5 +263,9 @@ typedef struct{ mac_func_def_t func_def; } mac_ric_service_update_t; +#ifdef __cplusplus +} +#endif + #endif diff --git a/executables/agent_if/ie/pdcp_data_ie.h b/executables/agent_if/ie/pdcp_data_ie.h index 67ffd27cc4a6dd116dcbb6145821ce460b0964ae..b1c699de83d8522a5c297f36e11f1f39a1d52dff 100644 --- a/executables/agent_if/ie/pdcp_data_ie.h +++ b/executables/agent_if/ie/pdcp_data_ie.h @@ -24,6 +24,10 @@ #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 */ @@ -68,9 +72,9 @@ typedef struct{ uint32_t dummy; } pdcp_ind_hdr_t; -void free_pdcp_ind_hdr(pdcp_ind_hdr_t* src); +void free_pdcp_ind_hdr(pdcp_ind_hdr_t* src); -pdcp_ind_hdr_t cp_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); @@ -110,7 +114,7 @@ typedef struct { void free_pdcp_ind_msg(pdcp_ind_msg_t* msg); -pdcp_ind_msg_t cp_pdcp_ind_msg(pdcp_ind_msg_t* src); +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); @@ -224,6 +228,10 @@ typedef struct{ 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 /////////////// @@ -253,5 +261,9 @@ typedef struct{ pdcp_func_def_t func_def; } pdcp_ric_service_update_t; +#ifdef __cplusplus +} +#endif + #endif diff --git a/executables/agent_if/ie/rlc_data_ie.h b/executables/agent_if/ie/rlc_data_ie.h index 3c703be088fbf2f13e488b770d61ac398f3a974b..c342ba5259b30ba0ffd19481c54331b08a8308e4 100644 --- a/executables/agent_if/ie/rlc_data_ie.h +++ b/executables/agent_if/ie/rlc_data_ie.h @@ -22,6 +22,9 @@ #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 @@ -70,9 +73,9 @@ typedef struct{ uint32_t dummy; } rlc_ind_hdr_t; -void free_rlc_ind_hdr(rlc_ind_hdr_t* src); +void free_rlc_ind_hdr(rlc_ind_hdr_t* src); -rlc_ind_hdr_t cp_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); @@ -148,9 +151,9 @@ typedef struct { // uint8_t slot; } rlc_ind_msg_t; -void free_rlc_ind_msg(rlc_ind_msg_t* src); +void free_rlc_ind_msg(rlc_ind_msg_t* src); -rlc_ind_msg_t cp_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); @@ -270,6 +273,10 @@ typedef struct{ 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 /////////////// @@ -300,7 +307,9 @@ typedef struct{ } rlc_ric_service_update_t; - +#ifdef __cplusplus +} +#endif diff --git a/executables/agent_if/ie/slice_data_ie.h b/executables/agent_if/ie/slice_data_ie.h index c772ff6e3aa50f77566dc42f24dfb961a705e811..d85e617458f374aec6d5ccc62cb340891b399d38 100644 --- a/executables/agent_if/ie/slice_data_ie.h +++ b/executables/agent_if/ie/slice_data_ie.h @@ -22,6 +22,10 @@ #ifndef SLICE_DATA_INFORMATION_ELEMENTS_H #define SLICE_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 */ @@ -449,13 +453,13 @@ slice_func_def_t cp_slice_func_def(slice_func_def_t* src); bool eq_slice_func_def(slice_func_def_t* m0, slice_func_def_t* m1); - +/* void slice_free_ind_msg(slice_ind_msg_t* msg); void slice_free_ctrl_msg(slice_ctrl_msg_t* msg); void slice_free_ctrl_out(slice_ctrl_out_t* out); - +*/ ///////////////////////////////////////////////// ////////////////////////////////////////////////// ///////////////////////////////////////////////// @@ -485,6 +489,10 @@ typedef struct{ slice_call_proc_id_t* proc_id; } slice_ind_data_t; +void free_slice_ind_data(slice_ind_data_t* ind); + +slice_ind_data_t cp_slice_ind_data(slice_ind_data_t const* src); + /////////////// // RIC Control /////////////// @@ -514,6 +522,9 @@ typedef struct{ slice_func_def_t func_def; } slice_ric_service_update_t; +#ifdef __cplusplus +} +#endif #endif diff --git a/executables/agent_if/libe2_agent.a b/executables/agent_if/libe2_agent.a index bd7789fe1f3f5c56aa3a40c0ac114599039cf86e..4fc13c4f4d4b492c70576c597b80c28777a82a17 100644 Binary files a/executables/agent_if/libe2_agent.a and b/executables/agent_if/libe2_agent.a differ diff --git a/executables/agent_if/read/sm_ag_if_rd.c b/executables/agent_if/read/sm_ag_if_rd.c index 1c9a857f69cd7f87a2d75865ad367989e1ffb9c0..f79c0781a8a867e7cdcd2024877b2ccde22c8a75 100644 --- a/executables/agent_if/read/sm_ag_if_rd.c +++ b/executables/agent_if/read/sm_ag_if_rd.c @@ -21,34 +21,61 @@ #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 <assert.h> #include <stdlib.h> -void free_sm_rd_if(sm_ag_if_rd_t* d) +void free_sm_ag_if_rd(sm_ag_if_rd_t* d) { assert(d != NULL); - /* + if(d->type == MAC_STATS_V0){ - mac_ind_data_t* ind = &d->mac_stats; - free_mac_ind_hdr(&ind->hdr); - free_mac_ind_msg(&ind->msg); - free_mac_call_proc_id(ind->proc_id); + free_mac_ind_data(&d->mac_stats); + //mac_ind_data_t* ind = &d->mac_stats; + //free_mac_ind_hdr(&ind->hdr); + //free_mac_ind_msg(&ind->msg); + //free_mac_call_proc_id(ind->proc_id); } else if(d->type == RLC_STATS_V0){ - rlc_ind_data_t* ind = &d->rlc_stats; - free_rlc_ind_hdr(&ind->hdr); - free_rlc_ind_msg(&ind->msg); - free_rlc_call_proc_id(ind->proc_id); - } else -*/ - if(d->type == PDCP_STATS_V0){ + free_rlc_ind_data(&d->rlc_stats); + //rlc_ind_data_t* ind = &d->rlc_stats; + //free_rlc_ind_hdr(&ind->hdr); + //free_rlc_ind_msg(&ind->msg); + //free_rlc_call_proc_id(ind->proc_id); + } else if(d->type == PDCP_STATS_V0){ + free_pdcp_ind_data(&d->pdcp_stats); // pdcp_ind_data_t* ind = &d->pdcp_stats; // free_pdcp_ind_hdr(&ind->hdr); // free_pdcp_ind_msg(&ind->msg); // free_pdcp_call_proc_id(ind->proc_id); + } else if(d->type == SLICE_STATS_V0) { + free_slice_ind_data(&d->slice_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 { + assert("Unknown type or not implemented"); + } + + return ans; +} diff --git a/executables/agent_if/read/sm_ag_if_rd.h b/executables/agent_if/read/sm_ag_if_rd.h index 42fd4074899caea44d99c8dc1513c3f046dfe657..62d263825d1d8aac95c870d21de85e3c23c3ba0c 100644 --- a/executables/agent_if/read/sm_ag_if_rd.h +++ b/executables/agent_if/read/sm_ag_if_rd.h @@ -53,7 +53,9 @@ typedef struct{ } sm_ag_if_rd_t; -void free_sm_rd_if(sm_ag_if_rd_t* d); +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 diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 110d6571a5ca43d124eec84eaf78b84482cedae6..75eeddbdedb1f69869b3449a009b745d752f3568 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -1081,10 +1081,10 @@ int main( int argc, char **argv ) { 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}; - + args_t args = {.conf_file = "/usr/local/flexric/flexric.conf", .libs_dir = "/usr/local/flexric/"}; printf("[E2 NODE]: mcc = %d mnc = %d mnc_digit = %d nd_id = %d \n", mcc, mnc, mnc_digit_len, nb_id); - init_agent_api( mcc, mnc, mnc_digit_len, nb_id, io); + init_agent_api( mcc, mnc, mnc_digit_len, nb_id, io, args); ////////////////////////////////// //////////////////////////////////