67 if (!required && !json_string) {
147 ast_verb(3,
"Security Logging Enabled\n");
154 if (security_stasis_sub) {
160 ast_verb(3,
"Security Logging Disabled\n");
#define AST_THREADSTORAGE(name)
Define a thread storage variable.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
static void append_json(struct ast_str **str, struct ast_json *json, const struct ast_security_event_ie_type *ies, enum ie_required required)
Asterisk main include file. File version handling, generic pbx functions.
ast_security_event_type
Security event types.
Security Event Reporting API.
String manipulation functions.
struct stasis_topic * ast_security_topic(void)
A stasis_topic which publishes messages for security related issues.
const char * ast_security_event_get_name(const enum ast_security_event_type event_type)
Get the name of a security event sub-type.
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
int stasis_subscription_set_filter(struct stasis_subscription *subscription, enum stasis_subscription_message_filter filter)
Set the message type filtering level on a subscription.
#define ast_log_dynamic_level(level,...)
Send a log message to a dynamically registered log level.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definitions to aid in the use of thread local storage.
#define ast_verb(level,...)
const struct ast_security_event_ie_type * ast_security_event_get_required_ies(const enum ast_security_event_type event_type)
Get the list of required IEs for a given security event sub-type.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
void ast_logger_unregister_level(const char *name)
Unregister a previously registered logger level.
static const char LOG_SECURITY_NAME[]
ast_event_ie_type
Event Information Element types.
Asterisk JSON abstraction layer.
static void append_json_single(struct ast_str **str, struct ast_json *json, const enum ast_event_ie_type ie_type, enum ie_required required)
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
static struct stasis_subscription * security_stasis_sub
int ast_logger_register_level(const char *name)
Register a new logger level.
#define stasis_subscribe(topic, callback, data)
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
static void security_event_stasis_cb(struct ast_json *json)
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
enum ast_event_ie_type ie_type
static const size_t SECURITY_EVENT_BUF_INIT_LEN
struct stasis_subscription * stasis_unsubscribe_and_join(struct stasis_subscription *subscription)
Cancel a subscription, blocking until the last message is processed.
Module has failed to load, may be in an inconsistent state.
static void security_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
This must stay at the end.
Support for logging to various files, console and syslog Configuration in file logger.conf.
const struct ast_security_event_ie_type * ast_security_event_get_optional_ies(const enum ast_security_event_type event_type)
Get the list of optional IEs for a given security event sub-type.
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
const char * ast_event_get_ie_type_name(enum ast_event_ie_type ie_type)
Get the string representation of an information element type.
static int load_module(void)
int stasis_subscription_accept_message_type(struct stasis_subscription *subscription, const struct stasis_message_type *type)
Indicate to a subscription that we are interested in a message type.
struct stasis_forward * sub
Abstract JSON element (object, array, string, int, ...).
static int unload_module(void)
struct ast_str * ast_str_thread_get(struct ast_threadstorage *ts, size_t init_len)
Retrieve a thread locally stored dynamic string.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
intmax_t ast_json_integer_get(const struct ast_json *integer)
Get the value from a JSON integer.
static struct ast_threadstorage security_event_buf