Stasis: Update security events to use Stasis

Also moves ACL messages to the security topic and gets rid of the
ACL topic

(closes issue ASTERISK-21103)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2496/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388975 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jonathan Rose
2013-05-17 17:36:10 +00:00
parent 15945a7185
commit b90bba7a30
25 changed files with 539 additions and 413 deletions

View File

@@ -386,20 +386,14 @@ int ast_named_acl_init(void);
int ast_named_acl_reload(void);
/*!
* \brief accessor for the ACL stasis topic
* \brief a \ref stasis_message_type for changes against a named ACL or the set of all named ACLs
* \since 12
*
* \retval NULL if the stasis topic hasn't been created or has been disabled
* \retval a pointer to the ACL stasis topic
*/
struct stasis_topic *ast_acl_topic(void);
/*!
* \brief accessor for the named ACL change stasis message type
* \since 12
* \retval NULL on error
* \retval \ref stasis_message_type for named ACL changes
*
* \retval NULL if the ACL change message type hasn't been created or has been canceled
* \retval a pointer to the ACL change message type
* \note Messages of this type should always be issued on and expected from the
* \ref ast_security_topic \ref stasis_topic
*/
struct stasis_message_type *ast_named_acl_change_type(void);

View File

@@ -19,6 +19,8 @@
#ifndef _ASTERISK_JSON_H
#define _ASTERISK_JSON_H
#include "asterisk/netsock2.h"
/*! \file
*
* \brief Asterisk JSON abstraction layer.
@@ -862,6 +864,18 @@ struct ast_json *ast_json_name_number(const char *name, const char *number);
*/
struct ast_json *ast_json_timeval(const struct timeval tv, const char *zone);
/*!
* \brief Construct an IP address as JSON
*
* XXX some comments describing the need for this here
*
* \param addr ast_sockaddr to encode
* \param transport_type ast_transport to include in the address string if any. Should just be one.
* \return JSON string containing the IP address with optional transport information
* \return \c NULL on error.
*/
struct ast_json *ast_json_ipaddr(const struct ast_sockaddr *addr, enum ast_transport transport_type);
/*!
* \brief Construct a context/exten/priority as JSON.
*

View File

@@ -42,6 +42,14 @@ enum {
AST_AF_INET6 = 10,
};
enum ast_transport {
AST_TRANSPORT_UDP = 1,
AST_TRANSPORT_TCP = 1 << 1,
AST_TRANSPORT_TLS = 1 << 2,
AST_TRANSPORT_WS = 1 << 3,
AST_TRANSPORT_WSS = 1 << 4,
};
/*!
* \brief Socket address structure.
*

View File

@@ -68,16 +68,6 @@ struct ast_sip_domain_alias {
);
};
/*!
* \brief Types of supported transports
*/
enum ast_sip_transport_type {
AST_SIP_TRANSPORT_UDP,
AST_SIP_TRANSPORT_TCP,
AST_SIP_TRANSPORT_TLS,
/* XXX Websocket ? */
};
/*! \brief Maximum number of ciphers supported for a TLS transport */
#define SIP_TLS_MAX_CIPHERS 64
@@ -104,7 +94,7 @@ struct ast_sip_transport {
AST_STRING_FIELD(domain);
);
/*! Type of transport */
enum ast_sip_transport_type type;
enum ast_transport type;
/*! Address and port to bind to */
pj_sockaddr host;
/*! Number of simultaneous asynchronous operations */

View File

@@ -56,6 +56,42 @@ struct ast_security_event_ie_type {
size_t offset;
};
/*!
* \brief A \ref stasis_topic which publishes messages for security related issues.
* \since 12
*
* \retval \ref stasis_topic for security related issues.
* \retval NULL on error
*/
struct stasis_topic *ast_security_topic(void);
/*!
* \brief A \ref stasis_message_type for security events
* \since 12
*
* \retval NULL on error
* \retval \ref stasis_message_type for security events
*
* \note Messages of this type should always be issued on and expected from
* the \ref ast_security_topic \ref stasis_topic
*/
struct stasis_message_type *ast_security_event_type(void);
/*!
* \brief initializes stasis topic/event types for \ref ast_security_topic and \ref ast_security_event_type
* \since 12
*
* \retval 0 on success
* \retval -1 on failure
*/
int ast_security_stasis_init(void);
/*!
* \brief removes stasis topic/event types for \ref ast_security_topic and \ref ast_security_event_type
* \since 12
*/
void ast_security_stasis_cleanup(void);
/*!
* \brief Get the list of required IEs for a given security event sub-type
*

View File

@@ -28,6 +28,7 @@
#define __AST_SECURITY_EVENTS_DEFS_H__
#include "asterisk/network.h"
#include "asterisk/netsock2.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
@@ -140,20 +141,11 @@ enum ast_security_event_severity {
AST_SECURITY_EVENT_SEVERITY_ERROR = (1 << 1),
};
/*!
* \brief Transport types
*/
enum ast_security_event_transport_type {
AST_SECURITY_EVENT_TRANSPORT_UDP,
AST_SECURITY_EVENT_TRANSPORT_TCP,
AST_SECURITY_EVENT_TRANSPORT_TLS,
};
#define AST_SEC_EVT(e) ((struct ast_security_event_common *) e)
struct ast_security_event_ip_addr {
const struct ast_sockaddr *addr;
enum ast_security_event_transport_type transport;
enum ast_transport transport;
};
/*!