MPDC: Multi Party Domain Cryptosystem 1.0.0.0b (A0)
MPDC Interior protocol
logger.h
Go to the documentation of this file.
1/* 2025 Quantum Resistant Cryptographic Solutions Corporation
2 * All Rights Reserved.
3 *
4 * NOTICE: This software and all accompanying materials are the exclusive
5 * property of Quantum Resistant Cryptographic Solutions Corporation (QRCS).
6 * The intellectual and technical concepts contained within this implementation
7 * are proprietary to QRCS and its authorized licensors and are protected under
8 * applicable U.S. and international copyright, patent, and trade secret laws.
9 *
10 * CRYPTOGRAPHIC STANDARDS:
11 * - This software includes implementations of cryptographic algorithms such as
12 * SHA3, AES, and others. These algorithms are public domain or standardized
13 * by organizations such as NIST and are NOT the property of QRCS.
14 * - However, all source code, optimizations, and implementations in this library
15 * are original works of QRCS and are protected under this license.
16 *
17 * RESTRICTIONS:
18 * - Redistribution, modification, or unauthorized distribution of this software,
19 * in whole or in part, is strictly prohibited.
20 * - This software is provided for non-commercial, educational, and research
21 * purposes only. Commercial use in any form is expressly forbidden.
22 * - Licensing and authorized distribution are solely at the discretion of QRCS.
23 * - Any use of this software implies acceptance of these restrictions.
24 *
25 * DISCLAIMER:
26 * This software is provided "as is," without warranty of any kind, express or
27 * implied, including but not limited to warranties of merchantability or fitness
28 * for a particular purpose. QRCS disclaims all liability for any direct, indirect,
29 * incidental, or consequential damages resulting from the use or misuse of this software.
30 *
31 * FULL LICENSE:
32 * This software is subject to the **Quantum Resistant Cryptographic Solutions
33 * Proprietary License (QRCS-PL)**. The complete license terms are included
34 * in the LICENSE.txt file distributed with this software.
35 *
36 * Written by: John G. Underhill
37 * Contact: john.underhill@protonmail.com
38 */
39
40#ifndef MPDC_LOG_H
41#define MPDC_LOG_H
42
43#include "common.h"
44#include "commands.h"
45
73
77#define MPDC_LOGGING_MESSAGE_MAX 256
78
82#define MPDC_LOG_STRING_DEPTH 69
83
87#define MPDC_LOG_STRING_SIZE 64
88
92static const char MPDC_LOGGER_PATH[] = "MPDC";
93
97static const char MPDC_LOGGER_FILE[] = "mpdc.log";
98
102static const char MPDC_LOGGER_HEAD[] = "MPDC Version 1.0";
103
113MPDC_EXPORT_API void logger_default_path(char* path, size_t pathlen);
114
124MPDC_EXPORT_API bool mpdc_logger_dispose(const char* path);
125
135MPDC_EXPORT_API bool mpdc_logger_erase_all(const char* path);
136
144MPDC_EXPORT_API bool mpdc_logger_exists(const char* path);
145
153MPDC_EXPORT_API void mpdc_logger_initialize(const char* path);
154
164MPDC_EXPORT_API size_t mpdc_logger_get_size(const char* path);
165
173MPDC_EXPORT_API void mpdc_logger_reset(const char* path);
174
186MPDC_EXPORT_API size_t mpdc_logger_write_message(const char* path, const char* line, size_t linelen);
187
201MPDC_EXPORT_API size_t mpdc_logger_write_decorated_message(const char* path, mpdc_application_messages msgtype, const char* message, size_t msglen);
202
214MPDC_EXPORT_API size_t mpdc_logger_write_time_stamped_message(const char* path, const char* message, size_t msglen);
215
229MPDC_EXPORT_API size_t mpdc_logger_write_decorated_time_stamped_message(const char* path, mpdc_application_messages msgtype, const char* message, size_t msglen);
230
240MPDC_EXPORT_API size_t mpdc_logger_read_all(const char* path, char* output, size_t outlen);
241
252MPDC_EXPORT_API int64_t mpdc_logger_read_line(const char* path, char* output, size_t outlen, size_t linenum);
253
264MPDC_EXPORT_API size_t mpdc_logger_time_stamp(char* output, size_t outlen);
265
266
267#endif
The MPDC command enumerations.
mpdc_application_messages
The RDS application messages.
Definition commands.h:73
MPDC_EXPORT_API void mpdc_logger_reset(const char *path)
Reset the logger.
Definition logger.c:132
MPDC_EXPORT_API size_t mpdc_logger_write_decorated_message(const char *path, mpdc_application_messages msgtype, const char *message, size_t msglen)
Write a decorated message to the log file.
Definition logger.c:180
MPDC_EXPORT_API size_t mpdc_logger_write_decorated_time_stamped_message(const char *path, mpdc_application_messages msgtype, const char *message, size_t msglen)
Write a decorated, time-stamped message to the log file.
Definition logger.c:210
MPDC_EXPORT_API size_t mpdc_logger_time_stamp(char *output, size_t outlen)
Write a timestamp to a string.
Definition logger.c:318
MPDC_EXPORT_API size_t mpdc_logger_write_time_stamped_message(const char *path, const char *message, size_t msglen)
Write a time-stamped message to the log file.
Definition logger.c:238
MPDC_EXPORT_API size_t mpdc_logger_get_size(const char *path)
Get the size of the log file.
Definition logger.c:113
MPDC_EXPORT_API bool mpdc_logger_exists(const char *path)
Check if the log file exists.
Definition logger.c:94
MPDC_EXPORT_API bool mpdc_logger_dispose(const char *path)
Erase and delete the log file.
Definition logger.c:52
MPDC_EXPORT_API size_t mpdc_logger_write_message(const char *path, const char *line, size_t linelen)
Write a message to the log file.
Definition logger.c:149
MPDC_EXPORT_API void mpdc_logger_initialize(const char *path)
Initialize the logger.
Definition logger.c:39
MPDC_EXPORT_API size_t mpdc_logger_read_all(const char *path, char *output, size_t outlen)
Read the entire log into a character array.
Definition logger.c:268
MPDC_EXPORT_API bool mpdc_logger_erase_all(const char *path)
Erase the log file.
Definition logger.c:73
MPDC_EXPORT_API int64_t mpdc_logger_read_line(const char *path, char *output, size_t outlen, size_t linenum)
Read a single line from the log file.
Definition logger.c:293
MPDC_EXPORT_API void logger_default_path(char *path, size_t pathlen)
Get the default logging path.
Definition logger.c:12