Asterisk - The Open Source Telephony Project
21.4.1
|
Security Event Reporting Helpers. More...
#include "asterisk.h"
#include "asterisk/utils.h"
#include "asterisk/strings.h"
#include "asterisk/network.h"
#include "asterisk/event.h"
#include "asterisk/security_events.h"
#include "asterisk/netsock2.h"
#include "asterisk/stasis.h"
#include "asterisk/json.h"
#include "asterisk/astobj2.h"
Go to the source code of this file.
Macros | |
#define | MAX_SECURITY_IES 12 |
#define | SEC_EVT_FIELD(e, field) (offsetof(struct ast_security_event_##e, field)) |
Enumerations | |
enum | ie_required { NOT_REQUIRED, REQUIRED, NOT_REQUIRED, REQUIRED } |
Functions | |
static int | add_ip_json_object (struct ast_json *json, enum ast_event_ie_type ie_type, const struct ast_security_event_ip_addr *addr) |
static int | add_json_object (struct ast_json *json, const struct ast_security_event_common *sec, const struct ast_security_event_ie_type *ie_type, enum ie_required req) |
static struct ast_json * | alloc_security_event_json_object (const struct ast_security_event_common *sec) |
static int | append_event_str_from_json (struct ast_str **str, struct ast_json *json, const struct ast_security_event_ie_type *ies) |
static int | append_event_str_single (struct ast_str **str, struct ast_json *json, const enum ast_event_ie_type ie_type) |
const char * | ast_security_event_get_name (const enum ast_security_event_type event_type) |
Get the name of a security event sub-type. More... | |
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. More... | |
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. More... | |
int | ast_security_event_report (const struct ast_security_event_common *sec) |
Report a security event. More... | |
const char * | ast_security_event_severity_get_name (const enum ast_security_event_severity severity) |
Get the name of a security event severity. More... | |
int | ast_security_stasis_init (void) |
initializes stasis topic/event types for ast_security_topic and ast_security_event_type More... | |
struct stasis_topic * | ast_security_topic (void) |
A stasis_topic which publishes messages for security related issues. More... | |
static int | check_event_type (const enum ast_security_event_type event_type) |
static int | handle_security_event (const struct ast_security_event_common *sec) |
static struct ast_manager_event_blob * | security_event_to_ami (struct stasis_message *message) |
static struct ast_manager_event_blob * | security_event_to_ami_blob (struct ast_json *json) |
static void | security_stasis_cleanup (void) |
STASIS_MESSAGE_TYPE_DEFN (ast_security_event_type,.to_ami=security_event_to_ami,) | |
Message type for security events. | |
Variables | |
struct { | |
const char * name | |
struct ast_security_event_ie_type optional_ies [MAX_SECURITY_IES] | |
struct ast_security_event_ie_type required_ies [MAX_SECURITY_IES] | |
enum ast_security_event_severity severity | |
uint32_t version | |
} | sec_events [AST_SECURITY_EVENT_NUM_TYPES] |
static const size_t | SECURITY_EVENT_BUF_INIT_LEN = 256 |
static struct stasis_topic * | security_topic |
Security Topic. | |
struct { | |
enum ast_security_event_severity severity | |
const char * str | |
} | severities [] |
Security Event Reporting Helpers.
Definition in file main/security_events.c.
const char* ast_security_event_get_name | ( | const enum ast_security_event_type | event_type | ) |
Get the name of a security event sub-type.
[in] | event_type | security event sub-type |
NULL | if event_type is invalid |
non-NULL | the name of the security event type |
Definition at line 895 of file main/security_events.c.
Referenced by ast_security_event_report().
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.
[in] | event_type | security event sub-type |
NULL | invalid event_type |
non-NULL | An array terminated with the value AST_EVENT_IE_END |
Definition at line 914 of file main/security_events.c.
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.
[in] | event_type | security event sub-type |
NULL | invalid event_type |
non-NULL | An array terminated with the value AST_EVENT_IE_END |
Definition at line 904 of file main/security_events.c.
int ast_security_event_report | ( | const struct ast_security_event_common * | sec | ) |
Report a security event.
[in] | sec | security event data. Callers of this function should never declare an instance of ast_security_event_common directly. The argument should be an instance of a specific security event descriptor which has ast_security_event_common at the very beginning. |
0 | success |
non-zero | failure |
Definition at line 1171 of file main/security_events.c.
References ast_security_event_get_name(), AST_SECURITY_EVENT_NUM_TYPES, ast_security_event_common::event_type, and ast_security_event_common::version.
Referenced by ast_sip_report_auth_challenge_sent(), ast_sip_report_auth_failed_challenge_response(), ast_sip_report_auth_success(), ast_sip_report_failed_acl(), ast_sip_report_invalid_endpoint(), ast_sip_report_mem_limit(), and ast_sip_report_req_no_support().
const char* ast_security_event_severity_get_name | ( | const enum ast_security_event_severity | severity | ) |
Get the name of a security event severity.
[in] | severity | security event severity |
NULL | if severity is invalid |
non-NULL | the name of the security event severity |
Definition at line 871 of file main/security_events.c.
int ast_security_stasis_init | ( | void | ) |
initializes stasis topic/event types for ast_security_topic and ast_security_event_type
0 | on success |
-1 | on failure |
Definition at line 483 of file main/security_events.c.
References ast_register_cleanup(), STASIS_MESSAGE_TYPE_INIT, and stasis_topic_create().
struct stasis_topic* ast_security_topic | ( | void | ) |
A stasis_topic which publishes messages for security related issues.
NULL | on error |
Definition at line 380 of file main/security_events.c.
References security_topic.
Referenced by manager_subscriptions_init(), and rtp_reload().
const { ... } severities[] |