BSL v1.0.0 - 16.g9d98179
AMMOS Bundle Protocol Security Library (BSL)
Loading...
Searching...
No Matches
log.h File Reference

Logging interface for the Mock BPA. More...

#include <stdbool.h>
#include <stdarg.h>
#include <sys/time.h>
+ Include dependency graph for log.h:
+ This graph shows which files directly or indirectly include this file:

Functions

void mock_bpa_LogOpen (void)
 Opens the event log.
 
void mock_bpa_LogClose (void)
 Closes the event log.
 
int mock_bpa_LogGetSeverity (int *severity, const char *name)
 Interpret a text name as a severity level.
 
void mock_bpa_LogSetLeastSeverity (int severity)
 Set the least severity enabled for logging.
 
bool mock_bpa_LogIsEnabledFor (int severity)
 Interface for BSL_HostDescriptors_t::log_is_enabled_for.
 
void mock_bpa_LogEvent (const struct timeval *timestamp, int severity, const char *filename, int lineno, const char *funcname, const char *format, va_list args)
 Interface for BSL_HostDescriptors_t::log_event.
 

Detailed Description

Logging interface for the Mock BPA.

Function Documentation

◆ mock_bpa_LogClose()

void mock_bpa_LogClose ( void  )

◆ mock_bpa_LogEvent()

void mock_bpa_LogEvent ( const struct timeval *  timestamp,
int  severity,
const char *  filename,
int  lineno,
const char *  funcname,
const char *  format,
va_list  args 
)

◆ mock_bpa_LogGetSeverity()

int mock_bpa_LogGetSeverity ( int *  severity,
const char *  name 
)

Interpret a text name as a severity level.

Parameters
[out]severityThe associated severity level.
[in]nameThe text name, which is case insensitive.
Returns
Zero if successful.

References BSL_CHKERR1, and sev_names.

◆ mock_bpa_LogIsEnabledFor()

bool mock_bpa_LogIsEnabledFor ( int  severity)

◆ mock_bpa_LogOpen()

void mock_bpa_LogOpen ( void  )

Opens the event log.

Note
This should be called once per process, not thread or library instance. At the end of the process there should be a call to mock_bpa_LogClose().

This is a mimic to POSIX openlog()

References event_queue, mock_bpa_LogEvent_event_t::message, MOCK_BPA_LOG_QUEUE_SIZE, mock_bpa_LogEvent_event_deinit(), mock_bpa_LogEvent_event_init(), mock_bpa_LogEvent_event_t::severity, thr_sink, thr_valid, work_sink(), and write_log().

Referenced by LLVMFuzzerInitialize(), main(), and suiteSetUp().

◆ mock_bpa_LogSetLeastSeverity()

void mock_bpa_LogSetLeastSeverity ( int  severity)

Set the least severity enabled for logging.

Other events will be dropped by the logging facility. This function is multi-thread safe.

Parameters
severityThe severity from a subset of the POSIX syslog values.

References least_severity.

Referenced by LLVMFuzzerInitialize(), and suiteSetUp().