#include "asterisk/event.h"
#include "asterisk/security_events_defs.h"
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. | |
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. | |
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. |
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().
Referenced by security_event_cb().
00384 { 00385 if (check_event_type(event_type)) { 00386 return NULL; 00387 } 00388 00389 return sec_events[event_type].name; 00390 }
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 402 of file security_events.c.
References check_event_type().
Referenced by handle_security_event(), and security_event_cb().
00404 { 00405 if (check_event_type(event_type)) { 00406 return NULL; 00407 } 00408 00409 return sec_events[event_type].optional_ies; 00410 }
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 392 of file security_events.c.
References check_event_type().
Referenced by handle_security_event(), and security_event_cb().
00394 { 00395 if (check_event_type(event_type)) { 00396 return NULL; 00397 } 00398 00399 return sec_events[event_type].required_ies; 00400 }
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, 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().
00622 { 00623 int res; 00624 00625 if (sec->event_type < 0 || sec->event_type >= AST_SECURITY_EVENT_NUM_TYPES) { 00626 ast_log(LOG_ERROR, "Invalid security event type\n"); 00627 return -1; 00628 } 00629 00630 if (!sec_events[sec->event_type].name) { 00631 ast_log(LOG_WARNING, "Security event type %u not handled\n", 00632 sec->event_type); 00633 return -1; 00634 } 00635 00636 if (sec->version != sec_events[sec->event_type].version) { 00637 ast_log(LOG_WARNING, "Security event %u version mismatch\n", 00638 sec->event_type); 00639 return -1; 00640 } 00641 00642 res = handle_security_event(sec); 00643 00644 return res; 00645 }
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().
00361 { 00362 unsigned int i; 00363 00364 for (i = 0; i < ARRAY_LEN(severities); i++) { 00365 if (severities[i].severity == severity) { 00366 return severities[i].str; 00367 } 00368 } 00369 00370 return NULL; 00371 }