Skip to content

Commit

Permalink
Update FDO SIM APIs to fix CSDK build (#271)
Browse files Browse the repository at this point in the history
Signed-off-by: Shrikant Temburwar <shrikant.temburwar@intel.com>
  • Loading branch information
shrikant1407 authored Feb 6, 2024
1 parent da90947 commit e044f13
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 85 deletions.
30 changes: 15 additions & 15 deletions device_modules/fdo_sim/fdo_sim.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)) {
Expand All @@ -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
Expand All @@ -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'.
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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)
{
Expand Down
44 changes: 22 additions & 22 deletions device_modules/fdo_sim/fdo_sim.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */
56 changes: 28 additions & 28 deletions device_modules/fdo_sim/fdo_sim_command.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -82,39 +82,39 @@ 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:
result = FDO_SI_FAILURE;
}

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,
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;

Expand All @@ -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;
}

Expand All @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand All @@ -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;
}
Loading

0 comments on commit e044f13

Please sign in to comment.