Security Event Reporting API. More...


Go to the source code of this file.
Data Structures | |
| struct | ast_security_event_ie_type |
Functions | |
| const char * | ast_security_event_get_name (const enum ast_security_event_type event_type) |
| Get the name of a security event sub-type. | |
| 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_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_security_event_report (const struct ast_security_event_common *sec) |
| Report a security event. | |
| const char * | ast_security_event_severity_get_name (const enum ast_security_event_severity severity) |
| Get the name of a security event severity. | |
Security Event Reporting API.
Definition in file security_events.h.
| 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 383 of file security_events.c.
References check_event_type(), and sec_events.
Referenced by security_event_cb().
{
if (check_event_type(event_type)) {
return NULL;
}
return sec_events[event_type].name;
}
| struct ast_security_event_ie_type* ast_security_event_get_optional_ies | ( | const enum ast_security_event_type | event_type | ) | [read] |
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 402 of file security_events.c.
References check_event_type(), and sec_events.
Referenced by handle_security_event(), and security_event_cb().
{
if (check_event_type(event_type)) {
return NULL;
}
return sec_events[event_type].optional_ies;
}
| struct ast_security_event_ie_type* ast_security_event_get_required_ies | ( | const enum ast_security_event_type | event_type | ) | [read] |
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 392 of file security_events.c.
References check_event_type(), and sec_events.
Referenced by handle_security_event(), and security_event_cb().
{
if (check_event_type(event_type)) {
return NULL;
}
return sec_events[event_type].required_ies;
}
| 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 621 of file security_events.c.
References ast_log(), AST_SECURITY_EVENT_NUM_TYPES, ast_security_event_common::event_type, handle_security_event(), LOG_ERROR, LOG_WARNING, sec_events, and ast_security_event_common::version.
Referenced by report_auth_success(), report_failed_acl(), report_failed_challenge_response(), report_inval_password(), report_invalid_user(), report_req_bad_format(), report_req_not_allowed(), and report_session_limit().
{
int res;
if (sec->event_type < 0 || sec->event_type >= AST_SECURITY_EVENT_NUM_TYPES) {
ast_log(LOG_ERROR, "Invalid security event type\n");
return -1;
}
if (!sec_events[sec->event_type].name) {
ast_log(LOG_WARNING, "Security event type %u not handled\n",
sec->event_type);
return -1;
}
if (sec->version != sec_events[sec->event_type].version) {
ast_log(LOG_WARNING, "Security event %u version mismatch\n",
sec->event_type);
return -1;
}
res = handle_security_event(sec);
return res;
}
| 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 359 of file security_events.c.
References ARRAY_LEN, and severities.
Referenced by alloc_event().
{
unsigned int i;
for (i = 0; i < ARRAY_LEN(severities); i++) {
if (severities[i].severity == severity) {
return severities[i].str;
}
}
return NULL;
}