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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 5 09:39:33 CDT 2009


Author: russell
Date: Tue May  5 09:39:29 2009
New Revision: 192404

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=192404
Log:
implement common event handler code

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=192404&r1=192403&r2=192404
==============================================================================
--- team/group/security_events/res/res_security_log.c (original)
+++ team/group/security_events/res/res_security_log.c Tue May  5 09:39:29 2009
@@ -54,7 +54,24 @@
 
 static void security_event_cb(const struct ast_event *event, void *data)
 {
-	/* XXX */
+	enum ast_security_event_type event_type;
+	uint32_t version;
+
+	event_type = ast_event_get_ie_uint(event, AST_EVENT_IE_SECURITY_EVENT);
+
+	if (event_type < 0 || event_type >= AST_SECURITY_EVENT_NUM_TYPES) {
+		ast_log(LOG_ERROR, "Invalid security event type %u\n", event_type);
+		return;
+	}
+
+	version = ast_event_get_ie_uint(event, AST_EVENT_IE_EVENT_VERSION);
+
+	if (version != event_handlers[event_type].version) {
+		ast_log(LOG_WARNING, "Version skew for event type %u\n", event_type);
+		return;
+	}
+
+	event_handlers[event_type].handler(event);
 }
 
 static int load_module(void)




More information about the asterisk-commits mailing list