summaryrefslogtreecommitdiff
path: root/include/asterisk
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2013-05-17 17:36:10 +0000
committerJonathan Rose <jrose@digium.com>2013-05-17 17:36:10 +0000
commitb90bba7a303bf57c3c874a1c8f506d39d4e78a9c (patch)
tree56e6ca0d885b1e9e11856a6be44b4b92582f5606 /include/asterisk
parent15945a7185187a3d79c7c7247a297bf92b49c139 (diff)
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
Diffstat (limited to 'include/asterisk')
-rw-r--r--include/asterisk/acl.h16
-rw-r--r--include/asterisk/json.h14
-rw-r--r--include/asterisk/netsock2.h8
-rw-r--r--include/asterisk/res_sip.h12
-rw-r--r--include/asterisk/security_events.h36
-rw-r--r--include/asterisk/security_events_defs.h12
6 files changed, 66 insertions, 32 deletions
diff --git a/include/asterisk/acl.h b/include/asterisk/acl.h
index 537a30d32..89eff7857 100644
--- a/include/asterisk/acl.h
+++ b/include/asterisk/acl.h
@@ -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);
diff --git a/include/asterisk/json.h b/include/asterisk/json.h
index 8e646584d..978d6396a 100644
--- a/include/asterisk/json.h
+++ b/include/asterisk/json.h
@@ -19,6 +19,8 @@
#ifndef _ASTERISK_JSON_H
#define _ASTERISK_JSON_H
+#include "asterisk/netsock2.h"
+
/*! \file
*
* \brief Asterisk JSON abstraction layer.
@@ -863,6 +865,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.
*
* If a \c NULL is passed for \c context or \c exten, or -1 for \c priority,
diff --git a/include/asterisk/netsock2.h b/include/asterisk/netsock2.h
index 435eda53d..a039d1bc6 100644
--- a/include/asterisk/netsock2.h
+++ b/include/asterisk/netsock2.h
@@ -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.
*
diff --git a/include/asterisk/res_sip.h b/include/asterisk/res_sip.h
index 7cfc38260..aee27aa9e 100644
--- a/include/asterisk/res_sip.h
+++ b/include/asterisk/res_sip.h
@@ -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 */
diff --git a/include/asterisk/security_events.h b/include/asterisk/security_events.h
index 461b671a4..a971444a4 100644
--- a/include/asterisk/security_events.h
+++ b/include/asterisk/security_events.h
@@ -57,6 +57,42 @@ struct ast_security_event_ie_type {
};
/*!
+ * \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
*
* \param[in] event_type security event sub-type
diff --git a/include/asterisk/security_events_defs.h b/include/asterisk/security_events_defs.h
index c73eb2987..6f32dae31 100644
--- a/include/asterisk/security_events_defs.h
+++ b/include/asterisk/security_events_defs.h
@@ -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;
};
/*!