diff --git a/src/sm/rc_sm/rc_sm_agent.c b/src/sm/rc_sm/rc_sm_agent.c index 73eae02a22c86b38555eb84383c09911c153bcb9..a78ec2f28b040e2cda0ea1d05748a23a8263d74c 100644 --- a/src/sm/rc_sm/rc_sm_agent.c +++ b/src/sm/rc_sm/rc_sm_agent.c @@ -47,66 +47,6 @@ typedef struct{ } sm_rc_agent_t; /* -static -byte_array_t cp_str_to_ba(const char* str) -{ - assert(str != NULL); - - const size_t sz = strlen(str); - - byte_array_t dst = {.len = sz}; - - dst.buf = calloc(sz,sizeof(uint8_t)); - assert(dst.buf != NULL && "Memory exhausted"); - - memcpy(dst.buf, str, sz); - - return dst; -} -static -ran_function_name_t fill_rc_ran_func_name(void) -{ - ran_function_name_t dst = {0}; - - // RAN Function Short Name - // Mandatory - // PrintableString [1-150] - dst.name = cp_str_to_ba(SM_RAN_CTRL_SHORT_NAME); - - // RAN Function Service Model OID - // Mandatory - // PrintableString [1-1000] - - //iso(1) identified-organization(3) - //dod(6) internet(1) private(4) - //enterprise(1) 53148 e2(1) - // version1 (1) e2sm(2) e2sm-RC- - // IEs (3) - dst.oid = cp_str_to_ba(SM_RAN_CTRL_OID); - - // RAN Function Description - // Mandatory - // PrintableString [1- 150] - //RAN function RC “RAN Control†performs the following - //functionalities: - //- Exposure of RAN control and UE context related - //information. - //- Modification and initiation of RAN control related call - //processes and messages - //- Execution of policies that may result in change of - //RAN control behavior - - dst.description = cp_str_to_ba( SM_RAN_CTRL_DESCRIPTION); - - // RAN Function Instance - // Optional - // INTEGER -// long* instance; // OPTIONAL: it is suggested to be used when E2 Node declares -// multiple RAN Function ID supporting the same E2SM specification - - return dst; -} - static e2sm_rc_func_def_t fill_rc_ran_func_def(sm_rc_agent_t const* sm) { @@ -219,6 +159,50 @@ sm_ctrl_out_data_t on_control_rc_sm_ag(sm_agent_t const* sm_agent, sm_ctrl_req_d return ans; } +static +ran_function_name_t fill_ran_func_name(void) +{ + ran_function_name_t dst = {0}; + + // RAN Function Short Name + // Mandatory + // PrintableString [1-150] + dst.name = cp_str_to_ba(SM_RAN_CTRL_SHORT_NAME); + + // RAN Function Service Model OID + // Mandatory + // PrintableString [1-1000] + + //iso(1) identified-organization(3) + //dod(6) internet(1) private(4) + //enterprise(1) 53148 e2(1) + // version1 (1) e2sm(2) e2sm-RC- + // IEs (3) + dst.oid = cp_str_to_ba(SM_RAN_CTRL_OID); + + // RAN Function Description + // Mandatory + // PrintableString [1- 150] + //RAN function RC “RAN Control†performs the following + //functionalities: + //- Exposure of RAN control and UE context related + //information. + //- Modification and initiation of RAN control related call + //processes and messages + //- Execution of policies that may result in change of + //RAN control behavior + + dst.description = cp_str_to_ba(SM_RAN_CTRL_DESCRIPTION); + + // RAN Function Instance + // Optional + // INTEGER +// long* instance; // OPTIONAL: it is suggested to be used when E2 Node declares +// multiple RAN Function ID supporting the same E2SM specification + + return dst; +} + static sm_e2_setup_data_t on_e2_setup_rc_sm_ag(sm_agent_t const* sm_agent) { @@ -233,6 +217,7 @@ sm_e2_setup_data_t on_e2_setup_rc_sm_ag(sm_agent_t const* sm_agent) rc_e2_setup_t rc = {0}; // Will call the function read_rc_setup_sm sm->base.io.read_setup(&rc); + rc.ran_func_def.name = fill_ran_func_name(); e2sm_rc_func_def_t* ran_func = &rc.ran_func_def; defer({ free_e2sm_rc_func_def(ran_func); }); @@ -242,17 +227,7 @@ sm_e2_setup_data_t on_e2_setup_rc_sm_ag(sm_agent_t const* sm_agent) sm_e2_setup_data_t setup = {0}; setup.len_rfd = ba.len; setup.ran_fun_def = ba.buf; -/* - // RAN Function - setup.rf.def = cp_str_to_ba(SM_RAN_CTRL_SHORT_NAME); - setup.rf.id = SM_RC_ID; - setup.rf.rev = SM_RC_REV; - setup.rf.oid = calloc(1, sizeof(byte_array_t) ); - assert(setup.rf.oid != NULL && "Memory exhausted"); - - *setup.rf.oid = cp_str_to_ba(SM_RAN_CTRL_OID); -*/ return setup; }