PQS: Post Quantum Shell 1.0.0.0a (A1)
A quantum safe shell application
logger.h File Reference

PQS logging functions. More...

#include "common.h"

Go to the source code of this file.

Macros

#define PQS_LOGGING_MESSAGE_MAX   256
 The maximum length of a logging message.
 

Functions

bool pqs_logger_exists (void)
 Test if the log file exists.
 
void pqs_logger_initialize (const char *path)
 Initialize the logger.
 
void pqs_logger_print (void)
 Print the log file.
 
void pqs_logger_read (char *output, size_t otplen)
 Read the contents of the log file.
 
void pqs_logger_reset (void)
 Reset the logger.
 
size_t pqs_logger_size (void)
 Get the log file size.
 
bool pqs_logger_write (const char *message)
 Write a message to the log file.
 
bool pqs_logger_test (void)
 Perform a manual test of the logger functions.
 

Detailed Description

PQS logging functions.

This header defines the internal logging functions used by the PQS protocol implementation. The logger provides capabilities for initializing, writing, reading, printing, and resetting the log file. It also includes functions for checking the existence of the log file and for performing a self-test of the logger functionality.

Note
These functions and constants are internal and non-exportable.

Macro Definition Documentation

◆ PQS_LOGGING_MESSAGE_MAX

#define PQS_LOGGING_MESSAGE_MAX   256

The maximum length of a logging message.

This macro defines the maximum number of characters allowed in a single log message.

Function Documentation

◆ pqs_logger_exists()

bool pqs_logger_exists ( void )

Test if the log file exists.

This function checks whether the log file exists in the default or specified path.

Returns
Returns true if the log file exists; otherwise, returns false.

◆ pqs_logger_initialize()

void pqs_logger_initialize ( const char * path)

Initialize the logger.

This function initializes the logging system by setting up the log file path and creating the log file if it does not already exist. The provided path is used as the location for the log file.

Parameters
pathThe log file path to be used for initialization.

◆ pqs_logger_print()

void pqs_logger_print ( void )

Print the log file.

This function outputs the contents of the log file to the console or another standard output.

◆ pqs_logger_read()

void pqs_logger_read ( char * output,
size_t otplen )

Read the contents of the log file.

This function reads the log file into the provided output buffer.

Parameters
outputThe output array where the log file contents will be stored.
otplenThe size (in bytes) of the output array.

◆ pqs_logger_reset()

void pqs_logger_reset ( void )

Reset the logger.

This function clears the log file by erasing all its contents, effectively resetting the logger.

◆ pqs_logger_size()

size_t pqs_logger_size ( void )

Get the log file size.

This function retrieves the size of the log file in bytes.

Returns
Returns the size (in bytes) of the log file.

◆ pqs_logger_test()

bool pqs_logger_test ( void )

Perform a manual test of the logger functions.

This function executes a series of tests on the logger to verify that the logging functions (such as initialization, writing, reading, and resetting) are operating correctly.

Returns
Returns true if the logger self-test is successful; otherwise, false.

◆ pqs_logger_write()

bool pqs_logger_write ( const char * message)

Write a message to the log file.

This function writes the specified log message to the log file. The message should be a null-terminated string.

Parameters
message[const] The log message to be written.
Returns
Returns true on successful writing; otherwise, false.