[asterisk-commits] russell: branch group/security_events r192631 - /team/group/security_events/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 5 18:38:29 CDT 2009


Author: russell
Date: Tue May  5 18:38:26 2009
New Revision: 192631

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=192631
Log:
Set up some meta data in a data structure

Modified:
    team/group/security_events/res/res_security_log.c

Modified: team/group/security_events/res/res_security_log.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/security_events/res/res_security_log.c?view=diff&rev=192631&r1=192630&r2=192631
==============================================================================
--- team/group/security_events/res/res_security_log.c (original)
+++ team/group/security_events/res/res_security_log.c Tue May  5 18:38:26 2009
@@ -37,20 +37,28 @@
 
 static void failed_acl_handler(const struct ast_event *event);
 
-static struct {
+static const struct {
 	uint32_t version;
-	void (*handler)(const struct ast_event *event);
-} event_handlers[AST_SECURITY_EVENT_NUM_TYPES] attribute_unused = {
+#define MAX_SECURITY_IES 4
+	const enum ast_event_ie_type required_ies[MAX_SECURITY_IES];
+	const enum ast_event_ie_type optional_ies[MAX_SECURITY_IES];
+#undef MAX_SECURITY_IES
+} event_handlers[AST_SECURITY_EVENT_NUM_TYPES] = {
 	[AST_SECURITY_EVENT_FAILED_ACL] = {
 		.version = AST_SECURITY_EVENT_FAILED_ACL_VERSION,
-		.handler = failed_acl_handler,
+		.required_ies = {
+			AST_EVENT_IE_ACCOUNT_ID,
+			AST_EVENT_IE_SESSION_ID,
+			AST_EVENT_IE_LOCAL_ADDR,
+			AST_EVENT_IE_REMOTE_ADDR,
+		},
+		.optional_ies = {
+			AST_EVENT_IE_MODULE,
+			AST_EVENT_IE_ACL_NAME,
+			AST_EVENT_IE_SESSION_TV,
+		},
 	},
 };
-
-static void failed_acl_handler(const struct ast_event *event)
-{
-	/* XXX */
-}
 
 static void security_event_cb(const struct ast_event *event, void *data)
 {
@@ -76,10 +84,8 @@
 
 static int load_module(void)
 {
-	security_event_sub = ast_event_subscribe(AST_EVENT_SECURITY,
-			security_event_cb, NULL, AST_EVENT_IE_END);
-
-	if (!security_event_sub) {
+	if (!(security_event_sub = ast_event_subscribe(AST_EVENT_SECURITY,
+			security_event_cb, NULL, AST_EVENT_IE_END))) {
 		return AST_MODULE_LOAD_DECLINE;
 	}
 




More information about the asterisk-commits mailing list