|
SIAP: Secure Infrastructure Access Protocol 1.0.0.0a (A1)
A post-quantum secure user verification system and access control mechanism
|
SIAP logging functions. More...
#include "siapcommon.h"Go to the source code of this file.
Macros | |
| #define | SIAP_LOGGING_MESSAGE_MAX 256U |
| Maximum length of a log message. | |
Functions | |
| bool | siap_logger_exists (void) |
| Check if the SIAP log file exists. | |
| void | siap_logger_initialize (const char *path) |
| Initialize the SIAP logger. | |
| void | siap_logger_print (void) |
| Print the contents of the SIAP log file. | |
| void | siap_logger_read (char *output, size_t otplen) |
| Read the SIAP log file into a provided buffer. | |
| void | siap_logger_reset (void) |
| Reset the SIAP log. | |
| size_t | siap_logger_size (void) |
| Get the current size of the SIAP log file. | |
| bool | siap_logger_write (const char *message) |
| Write a message to the SIAP log file. | |
| bool | siap_logger_test (void) |
| Run a manual test of the SIAP logger functions. | |
SIAP logging functions.
This header file defines the internal logging functions for the Quantum Secure Messaging Protocol (SIAP). The logging subsystem provides basic functionality to create, manage, and inspect log files. These functions allow the SIAP system to record operational events, errors, and other informational messages which can be used for debugging and monitoring purposes.
The following constants are defined:
SIAP_LOGGING_MESSAGE_MAX: Maximum length allowed for a single log message.SIAP_LOGGER_PATH: The default directory path for SIAP log files.SIAP_LOGGER_FILE: The default filename for the SIAP log.SIAP_LOGGER_HEAD: The header string for the log file, which typically includes version information.| #define SIAP_LOGGING_MESSAGE_MAX 256U |
Maximum length of a log message.
This macro defines the maximum number of characters that a single log message may contain.
| bool siap_logger_exists | ( | void | ) |
Check if the SIAP log file exists.
This function checks for the existence of the SIAP log file in the configured logging directory.
| void siap_logger_initialize | ( | const char * | path | ) |
Initialize the SIAP logger.
This function initializes the logging subsystem by setting the log file path and creating the log file if it does not already exist. The default header (SIAP_LOGGER_HEAD) is written to the log file upon initialization.
| path | The file path or directory where the log file should be created. |
| void siap_logger_print | ( | void | ) |
Print the contents of the SIAP log file.
This function outputs the entire contents of the SIAP log file to the standard output or designated debug stream. It is useful for real-time monitoring and debugging purposes.
| void siap_logger_read | ( | char * | output, |
| size_t | otplen ) |
Read the SIAP log file into a provided buffer.
This function reads the content of the SIAP log file and copies it into the specified output buffer. The caller must ensure that the output buffer is large enough to hold the log data, up to otplen bytes.
| output | A pointer to the buffer where the log content will be stored. |
| otplen | The size, in bytes, of the output buffer. |
| void siap_logger_reset | ( | void | ) |
Reset the SIAP log.
This function erases all the contents of the SIAP log file, effectively resetting it to an empty state. This operation is useful for clearing old log data before starting a new session.
| size_t siap_logger_size | ( | void | ) |
Get the current size of the SIAP log file.
This function returns the size of the log file in bytes. It can be used to monitor log growth and manage log rotation.
| bool siap_logger_test | ( | void | ) |
Run a manual test of the SIAP logger functions.
This function performs a series of tests on the SIAP logging subsystem. The test routine includes:
The function returns true if all logger operations work as expected.
| bool siap_logger_write | ( | const char * | message | ) |
Write a message to the SIAP log file.
This function writes the specified log message to the SIAP log file. The message should be a null-terminated string, and its length should not exceed SIAP_LOGGING_MESSAGE_MAX characters.
| message | [const] The log message to be written. |