Asterisk - The Open Source Telephony Project  18.5.0
include/asterisk/security_events.h
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2009, Digium, Inc.
5  *
6  * Russell Bryant <[email protected]>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18 
19 /*!
20  * \file
21  *
22  * \brief Security Event Reporting API
23  *
24  * \author Russell Bryant <[email protected]>
25  */
26 
27 #ifndef __AST_SECURITY_EVENTS_H__
28 #define __AST_SECURITY_EVENTS_H__
29 
30 #include "asterisk/event.h"
31 
32 /* Data structure definitions */
34 
35 #if defined(__cplusplus) || defined(c_plusplus)
36 extern "C" {
37 #endif
38 
39 /*!
40  * \brief Report a security event
41  *
42  * \param[in] sec security event data. Callers of this function should never
43  * declare an instance of ast_security_event_common directly. The
44  * argument should be an instance of a specific security event
45  * descriptor which has ast_security_event_common at the very
46  * beginning.
47  *
48  * \retval 0 success
49  * \retval non-zero failure
50  */
52 
55  /*! \brief For internal usage */
56  size_t offset;
57 };
58 
59 /*!
60  * \brief A \ref stasis_topic which publishes messages for security related issues.
61  * \since 12
62  *
63  * \retval \ref stasis_topic for security related issues.
64  * \retval NULL on error
65  */
66 struct stasis_topic *ast_security_topic(void);
67 
68 /*!
69  * \brief A \ref stasis_message_type for security events
70  * \since 12
71  *
72  * \retval NULL on error
73  * \retval \ref stasis_message_type for security events
74  *
75  * \note Messages of this type should always be issued on and expected from
76  * the \ref ast_security_topic \ref stasis_topic
77  */
79 
80 /*!
81  * \brief initializes stasis topic/event types for \ref ast_security_topic and \ref ast_security_event_type
82  * \since 12
83  *
84  * \retval 0 on success
85  * \retval -1 on failure
86  */
87 int ast_security_stasis_init(void);
88 
89 /*!
90  * \brief Get the list of required IEs for a given security event sub-type
91  *
92  * \param[in] event_type security event sub-type
93  *
94  * \retval NULL invalid event_type
95  * \retval non-NULL An array terminated with the value AST_EVENT_IE_END
96  *
97  * \since 1.8
98  */
100  const enum ast_security_event_type event_type);
101 
102 /*!
103  * \brief Get the list of optional IEs for a given security event sub-type
104  *
105  * \param[in] event_type security event sub-type
106  *
107  * \retval NULL invalid event_type
108  * \retval non-NULL An array terminated with the value AST_EVENT_IE_END
109  *
110  * \since 1.8
111  */
113  const enum ast_security_event_type event_type);
114 
115 /*!
116  * \brief Get the name of a security event sub-type
117  *
118  * \param[in] event_type security event sub-type
119  *
120  * \retval NULL if event_type is invalid
121  * \retval non-NULL the name of the security event type
122  *
123  * \since 1.8
124  */
125 const char *ast_security_event_get_name(const enum ast_security_event_type event_type);
126 
127 /*!
128  * \brief Get the name of a security event severity
129  *
130  * \param[in] severity security event severity
131  *
132  * \retval NULL if severity is invalid
133  * \retval non-NULL the name of the security event severity
134  *
135  * \since 1.8
136  */
139 
140 #if defined(__cplusplus) || defined(c_plusplus)
141 }
142 #endif
143 
144 #endif /* __AST_SECURITY_EVENTS_H__ */
ast_security_event_severity
the severity of a security event
ast_security_event_type
Security event types.
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.
int ast_security_stasis_init(void)
initializes stasis topic/event types for ast_security_topic and ast_security_event_type ...
Common structure elements.
const char * ast_security_event_severity_get_name(const enum ast_security_event_severity severity)
Get the name of a security event severity.
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.
ast_event_ie_type
Event Information Element types.
Definition: event_defs.h:68
struct stasis_message_type * ast_security_event_type(void)
A stasis_message_type for security events.
Security Event Reporting Data Structures.
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.
enum ast_security_event_severity severity
int ast_security_event_report(const struct ast_security_event_common *sec)
Report a security event.