From e044f13d1ff0a0c125e6ab631e6ad58f162189d8 Mon Sep 17 00:00:00 2001 From: Shrikant Temburwar Date: Tue, 6 Feb 2024 10:41:39 +0530 Subject: [PATCH] Update FDO SIM APIs to fix CSDK build (#271) Signed-off-by: Shrikant Temburwar --- device_modules/fdo_sim/fdo_sim.c | 30 ++++++------ device_modules/fdo_sim/fdo_sim.h | 44 +++++++++--------- device_modules/fdo_sim/fdo_sim_command.c | 56 +++++++++++------------ device_modules/fdo_sim/fdo_sim_download.c | 40 ++++++++-------- 4 files changed, 85 insertions(+), 85 deletions(-) diff --git a/device_modules/fdo_sim/fdo_sim.c b/device_modules/fdo_sim/fdo_sim.c index 77f1e8d7..ce61d01e 100644 --- a/device_modules/fdo_sim/fdo_sim.c +++ b/device_modules/fdo_sim/fdo_sim.c @@ -25,16 +25,16 @@ static bool ismore = false; /** * List of helper functions used in switch case * - * fdo_si_start - * fdo_si_failure - * fdo_si_has_more_dsi - * fdo_si_is_more_dsi - * fdo_si_get_dsi_count - * fdo_si_get_dsi - * fdo_end + * fdo_sim_start + * fdo_sim_failure + * fdo_sim_has_more_dsi + * fdo_sim_is_more_dsi + * fdo_sim_get_dsi_count + * fdo_sim_get_dsi + * fdo_sim_end */ -int fdo_si_start(fdor_t **fdor, fdow_t **fdow) +int fdo_sim_start(fdor_t **fdor, fdow_t **fdow) { int result = FDO_SI_INTERNAL_ERROR; @@ -60,7 +60,7 @@ int fdo_si_start(fdor_t **fdor, fdow_t **fdow) return result; } -int fdo_si_failure(fdor_t **fdor, fdow_t **fdow) +int fdo_sim_failure(fdor_t **fdor, fdow_t **fdow) { // perform clean-ups as needed if (!fsim_process_data(FDO_SIM_MOD_MSG_EXIT, NULL, 0, NULL, NULL)) { @@ -80,7 +80,7 @@ int fdo_si_failure(fdor_t **fdor, fdow_t **fdow) return FDO_SI_SUCCESS; } -int fdo_si_has_more_dsi(bool *has_more, bool hasmore) +int fdo_sim_has_more_dsi(bool *has_more, bool hasmore) { // calculate whether there is ServiceInfo to send NOW and update // 'has_more'. For testing purposes, set this to true here, and @@ -97,7 +97,7 @@ int fdo_si_has_more_dsi(bool *has_more, bool hasmore) return FDO_SI_SUCCESS; } -int fdo_si_is_more_dsi(bool *is_more) +int fdo_sim_is_more_dsi(bool *is_more) { // calculate whether there is ServiceInfo to send in the NEXT // iteration and update 'is_more'. @@ -113,7 +113,7 @@ int fdo_si_is_more_dsi(bool *is_more) return FDO_SI_SUCCESS; } -int fdo_si_get_dsi_count(uint16_t *num_module_messages) +int fdo_sim_get_dsi_count(uint16_t *num_module_messages) { // calculate the number of ServiceInfo items to send NOW and update // 'num_module_messages'. For testing purposes, set this to 1 here, and @@ -125,7 +125,7 @@ int fdo_si_get_dsi_count(uint16_t *num_module_messages) return FDO_SI_SUCCESS; } -int fdo_si_get_dsi(fdow_t **fdow, size_t mtu, char *module_message, +int fdo_sim_get_dsi(fdow_t **fdow, size_t mtu, char *module_message, uint8_t *module_val, size_t *module_val_sz, size_t bin_len, uint8_t *bin_data, size_t temp_module_val_sz, bool *hasmore, fdoSimModMsg *write_type, char *filename) @@ -171,11 +171,11 @@ int fdo_si_get_dsi(fdow_t **fdow, size_t mtu, char *module_message, result = FDO_SI_SUCCESS; end: result = - fdo_end(NULL, fdow, result, bin_data, NULL, 0, hasmore, write_type); + fdo_sim_end(NULL, fdow, result, bin_data, NULL, 0, hasmore, write_type); return result; } -int fdo_end(fdor_t **fdor, fdow_t **fdow, int result, uint8_t *bin_data, +int fdo_sim_end(fdor_t **fdor, fdow_t **fdow, int result, uint8_t *bin_data, uint8_t **exec_instr, size_t total_exec_array_length, bool *hasmore, fdoSimModMsg *write_type) { diff --git a/device_modules/fdo_sim/fdo_sim.h b/device_modules/fdo_sim/fdo_sim.h index 8504704d..63593c1c 100644 --- a/device_modules/fdo_sim/fdo_sim.h +++ b/device_modules/fdo_sim/fdo_sim.h @@ -88,41 +88,41 @@ int fdo_sim_command(fdo_sdk_si_type type, char *module_message, bool *is_more, size_t mtu); // Prototype definitions for functions that are implemented in the module -int fdo_si_start(fdor_t **fdor, fdow_t **fdow); -int fdo_si_failure(fdor_t **fdor, fdow_t **fdow); -int fdo_si_has_more_dsi(bool *has_more, bool hasmore); -int fdo_si_is_more_dsi(bool *is_more); -int fdo_si_get_dsi_count(uint16_t *num_module_messages); -int fdo_si_get_dsi(fdow_t **fdow, size_t mtu, char *module_message, +int fdo_sim_start(fdor_t **fdor, fdow_t **fdow); +int fdo_sim_failure(fdor_t **fdor, fdow_t **fdow); +int fdo_sim_has_more_dsi(bool *has_more, bool hasmore); +int fdo_sim_is_more_dsi(bool *is_more); +int fdo_sim_get_dsi_count(uint16_t *num_module_messages); +int fdo_sim_get_dsi(fdow_t **fdow, size_t mtu, char *module_message, uint8_t *module_val, size_t *module_val_sz, size_t bin_len, uint8_t *bin_data, size_t temp_module_val_sz, bool *hasmore, fdoSimModMsg *write_type, char *filename); -int fdo_si_set_osi_download(char *module_message, uint8_t *module_val, +int fdo_sim_set_osi_download(char *module_message, uint8_t *module_val, size_t *module_val_sz, int *strcmp_filedesc, int *strcmp_length, int *strcmp_sha_384, int *strcmp_write); -int fdo_si_set_osi_command(char *module_message, uint8_t *module_val, +int fdo_sim_set_osi_command(char *module_message, uint8_t *module_val, size_t *module_val_sz, int *strcmp_cmd, int *strcmp_args, int *strcmp_may_fail, int *strcmp_return_stdout, int *strcmp_return_stderr, int *strcmp_sig, int *strcmp_exec); -int fdo_si_set_osi_strcmp(size_t bin_len, uint8_t *bin_data); -int fdo_si_set_osi_sha_384(size_t bin_len, uint8_t *bin_data); -int fdo_si_set_osi_length(size_t bin_len); -int fdo_si_set_osi_write(size_t bin_len, uint8_t *bin_data); -int fdo_si_set_osi_may_fail(void); -int fdo_si_set_osi_return_stdout(void); -int fdo_si_set_osi_return_stderr(void); -int fdo_si_set_osi_cmd(size_t bin_len, uint8_t *bin_data); -int fdo_si_set_osi_sig(size_t sigValue); -int fdo_si_set_osi_args(int exec_array_index, size_t *exec_instructions_sz); -int fdo_si_set_osi_exec(uint8_t **exec_instr); -int fdo_si_set_osi_status_cb(size_t *status_cb_array_length); -int fdo_si_set_osi_fetch(size_t bin_len); -int fdo_end(fdor_t **fdor, fdow_t **fdow, int result, uint8_t *bin_data, +int fdo_sim_set_osi_strcmp(size_t bin_len, uint8_t *bin_data); +int fdo_sim_set_osi_sha_384(size_t bin_len, uint8_t *bin_data); +int fdo_sim_set_osi_length(size_t bin_len); +int fdo_sim_set_osi_write(size_t bin_len, uint8_t *bin_data); +int fdo_sim_set_osi_may_fail(void); +int fdo_sim_set_osi_return_stdout(void); +int fdo_sim_set_osi_return_stderr(void); +int fdo_sim_set_osi_cmd(size_t bin_len, uint8_t *bin_data); +int fdo_sim_set_osi_sig(size_t sigValue); +int fdo_sim_set_osi_args(int exec_array_index, size_t *exec_instructions_sz); +int fdo_sim_set_osi_exec(uint8_t **exec_instr); +int fdo_sim_set_osi_status_cb(size_t *status_cb_array_length); +int fdo_sim_set_osi_fetch(size_t bin_len); +int fdo_sim_end(fdor_t **fdor, fdow_t **fdow, int result, uint8_t *bin_data, uint8_t **exec_instr, size_t total_exec_array_length, bool *hasmore, fdoSimModMsg *write_type); #endif /* __FDO_SYS_H__ */ diff --git a/device_modules/fdo_sim/fdo_sim_command.c b/device_modules/fdo_sim/fdo_sim_command.c index 569b26e0..841a5345 100644 --- a/device_modules/fdo_sim/fdo_sim_command.c +++ b/device_modules/fdo_sim/fdo_sim_command.c @@ -50,29 +50,29 @@ int fdo_sim_command(fdo_sdk_si_type type, char *module_message, switch (type) { case FDO_SI_START: - result = fdo_si_start(&fdor, &fdow); + result = fdo_sim_start(&fdor, &fdow); goto end; case FDO_SI_END: case FDO_SI_FAILURE: - result = fdo_si_failure(&fdor, &fdow); + result = fdo_sim_failure(&fdor, &fdow); goto end; case FDO_SI_HAS_MORE_DSI: - result = fdo_si_has_more_dsi(has_more, hasmore); + result = fdo_sim_has_more_dsi(has_more, hasmore); goto end; case FDO_SI_IS_MORE_DSI: - result = fdo_si_is_more_dsi(is_more); + result = fdo_sim_is_more_dsi(is_more); goto end; case FDO_SI_GET_DSI_COUNT: - result = fdo_si_get_dsi_count(num_module_messages); + result = fdo_sim_get_dsi_count(num_module_messages); goto end; case FDO_SI_GET_DSI: - result = fdo_si_get_dsi(&fdow, mtu, module_message, module_val, + result = fdo_sim_get_dsi(&fdow, mtu, module_message, module_val, module_val_sz, bin_len, bin_data, temp_module_val_sz, &hasmore, &write_type, filename); goto end; case FDO_SI_SET_OSI: - result = fdo_si_set_osi_command( + result = fdo_sim_set_osi_command( module_message, module_val, module_val_sz, &strcmp_cmd, &strcmp_args, &strcmp_may_fail, &strcmp_return_stdout, &strcmp_return_stderr, &strcmp_sig, &strcmp_exec); @@ -82,26 +82,26 @@ int fdo_sim_command(fdo_sdk_si_type type, char *module_message, } if (strcmp_cmd == 0) { - result = fdo_si_set_osi_cmd(bin_len, bin_data); + result = fdo_sim_set_osi_cmd(bin_len, bin_data); goto end; } else if (strcmp_args == 0) { - result = fdo_si_set_osi_args(exec_array_index, + result = fdo_sim_set_osi_args(exec_array_index, &exec_instructions_sz); goto end; } else if (strcmp_may_fail == 0) { - result = fdo_si_set_osi_may_fail(); + result = fdo_sim_set_osi_may_fail(); goto end; } else if (strcmp_return_stdout == 0) { - result = fdo_si_set_osi_return_stdout(); + result = fdo_sim_set_osi_return_stdout(); goto end; } else if (strcmp_return_stderr == 0) { - result = fdo_si_set_osi_return_stderr(); + result = fdo_sim_set_osi_return_stderr(); goto end; } else if (strcmp_sig == 0) { - result = fdo_si_set_osi_sig(bin_len); + result = fdo_sim_set_osi_sig(bin_len); goto end; } else if (strcmp_exec == 0) { - result = fdo_si_set_osi_exec(fdo_exec_instr); + result = fdo_sim_set_osi_exec(fdo_exec_instr); goto end; } default: @@ -109,12 +109,12 @@ int fdo_sim_command(fdo_sdk_si_type type, char *module_message, } end: - result = fdo_end(&fdor, &fdow, result, bin_data, exec_instr, + result = fdo_sim_end(&fdor, &fdow, result, bin_data, exec_instr, total_exec_array_length, &hasmore, &write_type); return result; } -int fdo_si_set_osi_command(char *module_message, uint8_t *module_val, +int fdo_sim_set_osi_command(char *module_message, uint8_t *module_val, size_t *module_val_sz, int *strcmp_cmd, int *strcmp_args, int *strcmp_may_fail, int *strcmp_return_stdout, int *strcmp_return_stderr, @@ -168,7 +168,7 @@ int fdo_si_set_osi_command(char *module_message, uint8_t *module_val, return result; } -int fdo_si_set_osi_may_fail(void) +int fdo_sim_set_osi_may_fail(void) { bool may_fail; int result = FDO_SI_INTERNAL_ERROR; @@ -188,7 +188,7 @@ int fdo_si_set_osi_may_fail(void) return result; } -int fdo_si_set_osi_return_stdout(void) +int fdo_sim_set_osi_return_stdout(void) { bool return_stdout; int result = FDO_SI_INTERNAL_ERROR; @@ -207,7 +207,7 @@ int fdo_si_set_osi_return_stdout(void) return result; } -int fdo_si_set_osi_return_stderr(void) +int fdo_sim_set_osi_return_stderr(void) { bool return_stderr; int result = FDO_SI_INTERNAL_ERROR; @@ -226,7 +226,7 @@ int fdo_si_set_osi_return_stderr(void) return result; } -int fdo_si_set_osi_sig(size_t sigValue) +int fdo_sim_set_osi_sig(size_t sigValue) { int result = FDO_SI_INTERNAL_ERROR; @@ -248,7 +248,7 @@ int fdo_si_set_osi_sig(size_t sigValue) sigValue); if (sigValue == 9 || sigValue == 15) { - result = fdo_si_failure(&fdor, &fdow); + result = fdo_sim_failure(&fdor, &fdow); goto end; } @@ -257,7 +257,7 @@ int fdo_si_set_osi_sig(size_t sigValue) return result; } -int fdo_si_set_osi_cmd(size_t bin_len, uint8_t *bin_data) +int fdo_sim_set_osi_cmd(size_t bin_len, uint8_t *bin_data) { int result = FDO_SI_INTERNAL_ERROR; @@ -302,12 +302,12 @@ int fdo_si_set_osi_cmd(size_t bin_len, uint8_t *bin_data) } result = FDO_SI_SUCCESS; end: - result = fdo_end(&fdor, &fdow, result, bin_data, NULL, + result = fdo_sim_end(&fdor, &fdow, result, bin_data, NULL, total_exec_array_length, &hasmore, &write_type); return result; } -int fdo_si_set_osi_args(int exec_array_index, size_t *exec_instructions_sz) +int fdo_sim_set_osi_args(int exec_array_index, size_t *exec_instructions_sz) { int result = FDO_SI_INTERNAL_ERROR; int flag = 0; @@ -432,17 +432,17 @@ int fdo_si_set_osi_args(int exec_array_index, size_t *exec_instructions_sz) end: if (!flag) { result = - fdo_end(&fdor, &fdow, result, fdo_cmd, fdo_exec_instr, + fdo_sim_end(&fdor, &fdow, result, fdo_cmd, fdo_exec_instr, total_exec_array_length, &hasmore, &write_type); } else { result = - fdo_end(&fdor, &fdow, result, fdo_cmd, NULL, + fdo_sim_end(&fdor, &fdow, result, fdo_cmd, NULL, total_exec_array_length, &hasmore, &write_type); } return result; } -int fdo_si_set_osi_exec(uint8_t **exec_instr) +int fdo_sim_set_osi_exec(uint8_t **exec_instr) { int result = FDO_SI_INTERNAL_ERROR; @@ -462,7 +462,7 @@ int fdo_si_set_osi_exec(uint8_t **exec_instr) } result = FDO_SI_SUCCESS; end: - result = fdo_end(&fdor, &fdow, result, NULL, exec_instr, + result = fdo_sim_end(&fdor, &fdow, result, NULL, exec_instr, total_exec_array_length, &hasmore, &write_type); return result; } diff --git a/device_modules/fdo_sim/fdo_sim_download.c b/device_modules/fdo_sim/fdo_sim_download.c index c6c94f11..3f21ac7c 100644 --- a/device_modules/fdo_sim/fdo_sim_download.c +++ b/device_modules/fdo_sim/fdo_sim_download.c @@ -43,29 +43,29 @@ int fdo_sim_download(fdo_sdk_si_type type, char *module_message, switch (type) { case FDO_SI_START: - result = fdo_si_start(&fdor, &fdow); + result = fdo_sim_start(&fdor, &fdow); goto end; case FDO_SI_END: case FDO_SI_FAILURE: - result = fdo_si_failure(&fdor, &fdow); + result = fdo_sim_failure(&fdor, &fdow); goto end; case FDO_SI_HAS_MORE_DSI: - result = fdo_si_has_more_dsi(has_more, hasmore); + result = fdo_sim_has_more_dsi(has_more, hasmore); goto end; case FDO_SI_IS_MORE_DSI: - result = fdo_si_is_more_dsi(is_more); + result = fdo_sim_is_more_dsi(is_more); goto end; case FDO_SI_GET_DSI_COUNT: - result = fdo_si_get_dsi_count(num_module_messages); + result = fdo_sim_get_dsi_count(num_module_messages); goto end; case FDO_SI_GET_DSI: - result = fdo_si_get_dsi(&fdow, mtu, module_message, module_val, + result = fdo_sim_get_dsi(&fdow, mtu, module_message, module_val, module_val_sz, bin_len, bin_data, temp_module_val_sz, &hasmore, &write_type, filename); goto end; case FDO_SI_SET_OSI: - result = fdo_si_set_osi_download( + result = fdo_sim_set_osi_download( module_message, module_val, module_val_sz, &strcmp_filedesc, &strcmp_length, &strcmp_sha_384, &strcmp_write); @@ -74,16 +74,16 @@ int fdo_sim_download(fdo_sdk_si_type type, char *module_message, } if (strcmp_filedesc == 0) { - result = fdo_si_set_osi_strcmp(bin_len, bin_data); + result = fdo_sim_set_osi_strcmp(bin_len, bin_data); goto end; } else if (strcmp_length == 0) { - result = fdo_si_set_osi_length(bin_len); + result = fdo_sim_set_osi_length(bin_len); goto end; } else if (strcmp_sha_384 == 0) { - result = fdo_si_set_osi_sha_384(bin_len, bin_data); + result = fdo_sim_set_osi_sha_384(bin_len, bin_data); goto end; } else if (strcmp_write == 0) { - result = fdo_si_set_osi_write(bin_len, bin_data); + result = fdo_sim_set_osi_write(bin_len, bin_data); goto end; } default: @@ -91,12 +91,12 @@ int fdo_sim_download(fdo_sdk_si_type type, char *module_message, } end: - result = fdo_end(&fdor, &fdow, result, bin_data, NULL, 0, &hasmore, + result = fdo_sim_end(&fdor, &fdow, result, bin_data, NULL, 0, &hasmore, &write_type); return result; } -int fdo_si_set_osi_download(char *module_message, uint8_t *module_val, +int fdo_sim_set_osi_download(char *module_message, uint8_t *module_val, size_t *module_val_sz, int *strcmp_filedesc, int *strcmp_length, int *strcmp_sha_384, int *strcmp_write) @@ -141,7 +141,7 @@ int fdo_si_set_osi_download(char *module_message, uint8_t *module_val, return result; } -int fdo_si_set_osi_strcmp(size_t bin_len, uint8_t *bin_data) +int fdo_sim_set_osi_strcmp(size_t bin_len, uint8_t *bin_data) { int result = FDO_SI_INTERNAL_ERROR; @@ -191,12 +191,12 @@ int fdo_si_set_osi_strcmp(size_t bin_len, uint8_t *bin_data) LOG(LOG_INFO, "Module fdo.download - File created on path: %s\n", filename); end: - result = fdo_end(&fdor, &fdow, result, bin_data, NULL, 0, &hasmore, + result = fdo_sim_end(&fdor, &fdow, result, bin_data, NULL, 0, &hasmore, &write_type); return result; } -int fdo_si_set_osi_length(size_t bin_len) +int fdo_sim_set_osi_length(size_t bin_len) { int result = FDO_SI_INTERNAL_ERROR; @@ -221,7 +221,7 @@ int fdo_si_set_osi_length(size_t bin_len) return result; } -int fdo_si_set_osi_sha_384(size_t bin_len, uint8_t *bin_data) +int fdo_sim_set_osi_sha_384(size_t bin_len, uint8_t *bin_data) { int result = FDO_SI_INTERNAL_ERROR; @@ -277,12 +277,12 @@ int fdo_si_set_osi_sha_384(size_t bin_len, uint8_t *bin_data) } result = FDO_SI_SUCCESS; end: - result = fdo_end(&fdor, &fdow, result, bin_data, NULL, 0, &hasmore, + result = fdo_sim_end(&fdor, &fdow, result, bin_data, NULL, 0, &hasmore, &write_type); return result; } -int fdo_si_set_osi_write(size_t bin_len, uint8_t *bin_data) +int fdo_sim_set_osi_write(size_t bin_len, uint8_t *bin_data) { int result = FDO_SI_INTERNAL_ERROR; fdo_hash_t *hash = NULL; @@ -372,7 +372,7 @@ int fdo_si_set_osi_write(size_t bin_len, uint8_t *bin_data) if (!bin_len && file_data) { FSIMModuleFree(file_data); } - result = fdo_end(&fdor, &fdow, result, bin_data, NULL, 0, &hasmore, + result = fdo_sim_end(&fdor, &fdow, result, bin_data, NULL, 0, &hasmore, &write_type); return result; }