BSL v0.0.0
AMMOS Bundle Protocol Security Library (BSL)
|
Implementation of event logging using stderr output stream. More...
#include <pthread.h>
#include <stdarg.h>
#include <stdio.h>
#include <strings.h>
#include <sys/time.h>
#include <time.h>
#include <BPSecLib_Private.h>
#include <BSLConfig.h>
#include <m-buffer.h>
#include <m-string.h>
Go to the source code of this file.
Data Structures | |
struct | BSL_LogEvent_event_t |
A single event for the log. More... | |
Macros | |
#define | BSL_LOG_QUEUE_SIZE 100 |
Number of events to buffer to I/O thread. | |
#define | M_OPL_BSL_LogEvent_event_t() (INIT(API_2(BSL_LogEvent_event_init)), CLEAR(API_2(BSL_LogEvent_event_deinit))) |
OPLIST for BSL_LogEvent_event_t. | |
Functions | |
static void | BSL_LogEvent_event_init (BSL_LogEvent_event_t *obj) |
static void | BSL_LogEvent_event_deinit (BSL_LogEvent_event_t *obj) |
uint8_t * | BSL_Log_DumpAsHexString (uint8_t *dstbuf, size_t dstlen, const uint8_t *srcbuf, size_t srclen) |
NOLINTEND. | |
static void | write_log (const BSL_LogEvent_event_t *event) |
NOLINTBEGIN. | |
static void * | work_sink (void *arg) |
NOLINTEND. | |
void | BSL_openlog (void) |
Opens the event log. | |
void | BSL_closelog (void) |
Closes the event log. | |
void | BSL_LogEvent (int severity, const char *filename, int lineno, const char *funcname, const char *format,...) |
Log an event. | |
Variables | |
static const char * | sev_names [] |
static BSL_LogEvent_queue_t | event_queue |
NOLINTBEGIN. | |
static pthread_t | thr_sink |
Sink thread ID. | |
static atomic_bool | thr_valid = ATOMIC_VAR_INIT(false) |
True if thr_sink is valid. | |
Implementation of event logging using stderr output stream.
Definition in file LoggingStderr.c.
#define BSL_LOG_QUEUE_SIZE 100 |
Number of events to buffer to I/O thread.
Definition at line 40 of file LoggingStderr.c.
#define M_OPL_BSL_LogEvent_event_t | ( | ) | (INIT(API_2(BSL_LogEvent_event_init)), CLEAR(API_2(BSL_LogEvent_event_deinit))) |
OPLIST for BSL_LogEvent_event_t.
Definition at line 86 of file LoggingStderr.c.
void BSL_closelog | ( | void | ) |
Closes the event log.
This is a mimic to POSIX closelog()
Definition at line 195 of file LoggingStderr.c.
References event_queue, BSL_LogEvent_event_t::message, BSL_LogEvent_event_t::severity, thr_sink, thr_valid, and write_log().
uint8_t * BSL_Log_DumpAsHexString | ( | uint8_t * | dstbuf, |
size_t | dstlen, | ||
const uint8_t * | srcbuf, | ||
size_t | srclen | ||
) |
NOLINTEND.
Helper function to print the ASCII encoding of a given bytestream to a given target buffer.
Definition at line 101 of file LoggingStderr.c.
void BSL_LogEvent | ( | int | severity, |
const char * | filename, | ||
int | lineno, | ||
const char * | funcname, | ||
const char * | format, | ||
... | |||
) |
Log an event.
severity | The severity from a subset of the POSIX syslog values. | |
[in] | filename | The originating file name, which may include directory parts. |
[in] | lineno | The originating file line number. |
[in] | funcname | The originating function name. |
[in] | format | The log message format string. |
... | Values for the format string. |
Definition at line 220 of file LoggingStderr.c.
References BSL_LogEvent_event_t::context, event_queue, BSL_LogEvent_event_t::message, BSL_LogEvent_event_t::severity, thr_valid, and write_log().
|
static |
Definition at line 79 of file LoggingStderr.c.
|
static |
Definition at line 70 of file LoggingStderr.c.
void BSL_openlog | ( | void | ) |
Opens the event log.
This is a mimic to POSIX openlog()
Definition at line 175 of file LoggingStderr.c.
References BSL_LOG_QUEUE_SIZE, event_queue, BSL_LogEvent_event_t::message, BSL_LogEvent_event_t::severity, thr_sink, thr_valid, work_sink(), and write_log().
|
static |
NOLINTEND.
Definition at line 157 of file LoggingStderr.c.
References event_queue, BSL_LogEvent_event_t::message, and write_log().
Referenced by BSL_openlog().
|
static |
NOLINTBEGIN.
Definition at line 119 of file LoggingStderr.c.
References BSL_LogEvent_event_t::context, BSL_LogEvent_event_t::message, BSL_LogEvent_event_t::thread, and BSL_LogEvent_event_t::timestamp.
Referenced by BSL_closelog(), BSL_LogEvent(), BSL_openlog(), and work_sink().
|
static |
NOLINTBEGIN.
Shared safe queue
Definition at line 94 of file LoggingStderr.c.
Referenced by BSL_closelog(), BSL_LogEvent(), BSL_openlog(), and work_sink().
|
static |
Definition at line 43 of file LoggingStderr.c.
|
static |
Sink thread ID.
Definition at line 96 of file LoggingStderr.c.
Referenced by BSL_closelog(), and BSL_openlog().
|
static |
True if thr_sink is valid.
Definition at line 98 of file LoggingStderr.c.
Referenced by BSL_closelog(), BSL_LogEvent(), and BSL_openlog().