File utility module implementation file. More...
Go to the source code of this file.
Functions | |
E_MCL_ERROR_CODE | file_util_fopen (const char *file_name, const char *mode, void **file_descriptor) |
E_MCL_ERROR_CODE | file_util_fopen_without_log (const char *file_name, const char *mode, void **file_descriptor) |
E_MCL_ERROR_CODE | file_util_fclose (void *file_descriptor) |
E_MCL_ERROR_CODE | file_util_fclose_without_log (void *file_descriptor) |
E_MCL_ERROR_CODE | file_util_fwrite (const void *data, mcl_size_t size, mcl_size_t count, void *file_descriptor) |
E_MCL_ERROR_CODE | file_util_fwrite_without_log (const void *data, mcl_size_t size, mcl_size_t count, void *file_descriptor) |
void | file_util_fread (void *data, mcl_size_t size, mcl_size_t count, void *file_descriptor, mcl_size_t *actual_count) |
E_MCL_ERROR_CODE | file_util_fputs (const char *data, void *file_descriptor) |
E_MCL_ERROR_CODE | file_util_fgets (char *data, mcl_size_t data_size, void *file_descriptor) |
E_MCL_ERROR_CODE | file_util_fstat (void *file_descriptor, struct stat *file_attributes) |
E_MCL_ERROR_CODE | file_util_fflush (void *file_descriptor) |
E_MCL_ERROR_CODE | file_util_fflush_without_log (void *file_descriptor) |
mcl_bool_t | file_util_check_if_regular_file (const mcl_stat_t *file_attributes) |
File utility module implementation file.
Definition in file file_util.c.
mcl_bool_t file_util_check_if_regular_file | ( | const mcl_stat_t * | file_attributes | ) |
This function is used to check if file is a regular file.
[in] | file_attributes | Structure holding the file attributes. |
Definition at line 216 of file file_util.c.
References DEBUG_ENTRY, DEBUG_LEAVE, and MCL_FALSE.
Referenced by file_initialize().
E_MCL_ERROR_CODE file_util_fclose | ( | void * | file_descriptor | ) |
This function is used to close the file opened beforehand.
[in] | file_descriptor | File descriptor of the file to close. |
Definition at line 52 of file file_util.c.
References DEBUG_ENTRY, DEBUG_LEAVE, and file_util_fclose_without_log().
Referenced by _check_file_path(), file_destroy(), storage_load_rsa_registration_information(), storage_load_shared_secret_registration_information(), storage_save_rsa_registration_information(), and storage_save_shared_secret_registration_information().
E_MCL_ERROR_CODE file_util_fclose_without_log | ( | void * | file_descriptor | ) |
This function is used to close the file opened beforehand. It has the same functionality as file_util_fclose except that it does not log any debug messages.
[in] | file_descriptor | File descriptor of the file to close. |
Definition at line 62 of file file_util.c.
References MCL_FAIL, MCL_NULL, and MCL_OK.
Referenced by file_util_fclose(), and mcl_log_util_finalize().
E_MCL_ERROR_CODE file_util_fflush | ( | void * | file_descriptor | ) |
This function flushes pending content to file_descriptor
.
[in] | file_descriptor | File descriptor obtained by opening the file. |
Definition at line 182 of file file_util.c.
References DEBUG_ENTRY, DEBUG_LEAVE, and file_util_fflush_without_log().
E_MCL_ERROR_CODE file_util_fflush_without_log | ( | void * | file_descriptor | ) |
This function flushes pending content to file_descriptor
.
[in] | file_descriptor | File descriptor obtained by opening the file. |
Definition at line 192 of file file_util.c.
References MCL_ERROR, MCL_FAIL, and MCL_OK.
Referenced by file_util_fflush(), and log_util_default_callback().
E_MCL_ERROR_CODE file_util_fgets | ( | char * | data, |
mcl_size_t | data_size, | ||
void * | file_descriptor | ||
) |
This function is used to read a string from a file. A maximum of data_size
- 1 characters are read from the file and a terminating null character is immediately added after the last character of data
. No additional characters are read after the new line character of after end of file.
[out] | data | Pointer to the string to read from file. |
[in] | data_size | Maximum number of characters to read from file including the null terminator. |
[in] | file_descriptor | File descriptor of the file to read from. |
Definition at line 135 of file file_util.c.
References DEBUG_ENTRY, DEBUG_LEAVE, MCL_DEBUG, MCL_FAIL, MCL_NULL, and MCL_OK.
Referenced by _get_private_key(), _get_public_key(), storage_load_rsa_registration_information(), and storage_load_shared_secret_registration_information().
E_MCL_ERROR_CODE file_util_fopen | ( | const char * | file_name, |
const char * | mode, | ||
void ** | file_descriptor | ||
) |
This function is used to open a file.
[in] | file_name | File name to open. |
[in] | mode | Mode of the file to open. Please refer to the modes of fopen() function in ANSI standard. |
[out] | file_descriptor | File descriptor for the file opened. This descriptor is used to process the file. |
Definition at line 22 of file file_util.c.
References DEBUG_ENTRY, DEBUG_LEAVE, and file_util_fopen_without_log().
Referenced by _check_file_path(), file_initialize(), storage_load_rsa_registration_information(), storage_load_shared_secret_registration_information(), storage_save_rsa_registration_information(), and storage_save_shared_secret_registration_information().
E_MCL_ERROR_CODE file_util_fopen_without_log | ( | const char * | file_name, |
const char * | mode, | ||
void ** | file_descriptor | ||
) |
This function is used to open a file.
[in] | file_name | File name to open. |
[in] | mode | Mode of the file to open. Please refer to the modes of fopen() function in ANSI standard. |
[out] | file_descriptor | File descriptor for the file opened. This descriptor is used to process the file. |
Definition at line 32 of file file_util.c.
References MCL_FAIL, MCL_NULL, and MCL_OK.
Referenced by file_util_fopen(), and mcl_log_util_initialize().
E_MCL_ERROR_CODE file_util_fputs | ( | const char * | data, |
void * | file_descriptor | ||
) |
This function is used to write a string to a file. The terminating null character is not written.
[in] | data | Pointer to the string to write to file. |
[in] | file_descriptor | File descriptor of the file to write to. |
Definition at line 115 of file file_util.c.
References DEBUG_ENTRY, DEBUG_LEAVE, MCL_ERROR, MCL_FAIL, and MCL_OK.
Referenced by storage_save_rsa_registration_information(), and storage_save_shared_secret_registration_information().
void file_util_fread | ( | void * | data, |
mcl_size_t | size, | ||
mcl_size_t | count, | ||
void * | file_descriptor, | ||
mcl_size_t * | actual_count | ||
) |
This function is used to read data from a file into memory.
[in] | data | Pointer to the memory (size x count bytes allocated a priori) to store the data from the file. |
[in] | size | Size of each element requested. |
[in] | count | Number of elements requested. |
[in] | file_descriptor | File descriptor of the file to read from. |
[out] | actual_count | Number of elements actually read from file. |
Definition at line 105 of file file_util.c.
References DEBUG_ENTRY, and DEBUG_LEAVE.
Referenced by _get_payload_from_file().
E_MCL_ERROR_CODE file_util_fstat | ( | void * | file_descriptor, |
struct stat * | file_attributes | ||
) |
Definition at line 155 of file file_util.c.
References DEBUG_ENTRY, DEBUG_LEAVE, MCL_ERROR, MCL_FAIL, and MCL_OK.
Referenced by file_initialize().
E_MCL_ERROR_CODE file_util_fwrite | ( | const void * | data, |
mcl_size_t | size, | ||
mcl_size_t | count, | ||
void * | file_descriptor | ||
) |
This function is used to write data in memory to a file.
[in] | data | Pointer to the data to write to file. |
[in] | size | Size of each element in data . |
[in] | count | Number of elements in data . |
[in] | file_descriptor | File descriptor of the file to write to. |
Definition at line 78 of file file_util.c.
References DEBUG_ENTRY, DEBUG_LEAVE, and file_util_fwrite_without_log().
E_MCL_ERROR_CODE file_util_fwrite_without_log | ( | const void * | data, |
mcl_size_t | size, | ||
mcl_size_t | count, | ||
void * | file_descriptor | ||
) |
This function is used to write data in memory to a file.
[in] | data | Pointer to the data to write to file. |
[in] | size | Size of each element in data . |
[in] | count | Number of elements in data . |
[in] | file_descriptor | File descriptor of the file to write to. |
Definition at line 88 of file file_util.c.
References MCL_ERROR, MCL_FAIL, and MCL_OK.
Referenced by file_util_fwrite(), and log_util_default_callback().