00001 /* 00002 * Asterisk -- An open source telephony toolkit. 00003 * 00004 * Copyright (C) 2009, Digium, Inc. 00005 * 00006 * Russell Bryant <russell@digium.com> 00007 * 00008 * See http://www.asterisk.org for more information about 00009 * the Asterisk project. Please do not directly contact 00010 * any of the maintainers of this project for assistance; 00011 * the project provides a web site, mailing lists and IRC 00012 * channels for your use. 00013 * 00014 * This program is free software, distributed under the terms of 00015 * the GNU General Public License Version 2. See the LICENSE file 00016 * at the top of the source tree. 00017 */ 00018 00019 /*! 00020 * \file 00021 * 00022 * \brief Security Event Reporting API 00023 * 00024 * \author Russell Bryant <russell@digium.com> 00025 */ 00026 00027 #ifndef __AST_SECURITY_EVENTS_H__ 00028 #define __AST_SECURITY_EVENTS_H__ 00029 00030 #include "asterisk/event.h" 00031 00032 /* Data structure definitions */ 00033 #include "asterisk/security_events_defs.h" 00034 00035 #if defined(__cplusplus) || defined(c_plusplus) 00036 extern "C" { 00037 #endif 00038 00039 /*! 00040 * \brief Report a security event 00041 * 00042 * \param[in] sec security event data. Callers of this function should never 00043 * declare an instance of ast_security_event_common directly. The 00044 * argument should be an instance of a specific security event 00045 * descriptor which has ast_security_event_common at the very 00046 * beginning. 00047 * 00048 * \retval 0 success 00049 * \retval non-zero failure 00050 */ 00051 int ast_security_event_report(const struct ast_security_event_common *sec); 00052 00053 struct ast_security_event_ie_type { 00054 enum ast_event_ie_type ie_type; 00055 /*! \brief For internal usage */ 00056 size_t offset; 00057 }; 00058 00059 /*! 00060 * \brief Get the list of required IEs for a given security event sub-type 00061 * 00062 * \param[in] event_type security event sub-type 00063 * 00064 * \retval NULL invalid event_type 00065 * \retval non-NULL An array terminated with the value AST_EVENT_IE_END 00066 * 00067 * \since 1.8 00068 */ 00069 const struct ast_security_event_ie_type *ast_security_event_get_required_ies( 00070 const enum ast_security_event_type event_type); 00071 00072 /*! 00073 * \brief Get the list of optional IEs for a given security event sub-type 00074 * 00075 * \param[in] event_type security event sub-type 00076 * 00077 * \retval NULL invalid event_type 00078 * \retval non-NULL An array terminated with the value AST_EVENT_IE_END 00079 * 00080 * \since 1.8 00081 */ 00082 const struct ast_security_event_ie_type *ast_security_event_get_optional_ies( 00083 const enum ast_security_event_type event_type); 00084 00085 /*! 00086 * \brief Get the name of a security event sub-type 00087 * 00088 * \param[in] event_type security event sub-type 00089 * 00090 * \retval NULL if event_type is invalid 00091 * \retval non-NULL the name of the security event type 00092 * 00093 * \since 1.8 00094 */ 00095 const char *ast_security_event_get_name(const enum ast_security_event_type event_type); 00096 00097 /*! 00098 * \brief Get the name of a security event severity 00099 * 00100 * \param[in] severity security event severity 00101 * 00102 * \retval NULL if severity is invalid 00103 * \retval non-NULL the name of the security event severity 00104 * 00105 * \since 1.8 00106 */ 00107 const char *ast_security_event_severity_get_name( 00108 const enum ast_security_event_severity severity); 00109 00110 #if defined(__cplusplus) || defined(c_plusplus) 00111 } 00112 #endif 00113 00114 #endif /* __AST_SECURITY_EVENTS_H__ */