[asterisk-commits] kmoore: branch kmoore/event_system_strip r395394 - in /team/kmoore/event_syst...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 25 08:14:43 CDT 2013


Author: kmoore
Date: Thu Jul 25 08:14:41 2013
New Revision: 395394

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395394
Log:
Remove two more IEs and support code that is no longer necessary

Modified:
    team/kmoore/event_system_strip/include/asterisk/event_defs.h
    team/kmoore/event_system_strip/main/event.c
    team/kmoore/event_system_strip/tests/test_cel.c
    team/kmoore/event_system_strip/tests/test_event.c

Modified: team/kmoore/event_system_strip/include/asterisk/event_defs.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/event_system_strip/include/asterisk/event_defs.h?view=diff&rev=395394&r1=395393&r2=395394
==============================================================================
--- team/kmoore/event_system_strip/include/asterisk/event_defs.h (original)
+++ team/kmoore/event_system_strip/include/asterisk/event_defs.h Thu Jul 25 08:14:41 2013
@@ -67,20 +67,6 @@
 	 * Payload type: UINT (ast_event_ie_type)
 	 */
 	AST_EVENT_IE_EXISTS              = 0x0006,
-	/*!
-	 * \brief Device Name
-	 * Used by AST_EVENT_DEVICE_STATE_CHANGE
-	 * Payload type: STR
-	 */
-	AST_EVENT_IE_DEVICE              = 0x0007,
-	/*!
-	 * \brief Generic State IE
-	 * Used by AST_EVENT_DEVICE_STATE_CHANGE
-	 * Payload type: UINT
-	 * The actual state values depend on the event which
-	 * this IE is a part of.
-	 */
-	 AST_EVENT_IE_STATE              = 0x0008,
 	 /*!
 	  * \brief Context IE
 	  * Used by AST_EVENT_MWI

Modified: team/kmoore/event_system_strip/main/event.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/event_system_strip/main/event.c?view=diff&rev=395394&r1=395393&r2=395394
==============================================================================
--- team/kmoore/event_system_strip/main/event.c (original)
+++ team/kmoore/event_system_strip/main/event.c Thu Jul 25 08:14:41 2013
@@ -146,8 +146,6 @@
 	[AST_EVENT_IE_UNIQUEID]            = { AST_EVENT_IE_PLTYPE_UINT, "UniqueID" },
 	[AST_EVENT_IE_EVENTTYPE]           = { AST_EVENT_IE_PLTYPE_UINT, "EventType" },
 	[AST_EVENT_IE_EXISTS]              = { AST_EVENT_IE_PLTYPE_UINT, "Exists" },
-	[AST_EVENT_IE_DEVICE]              = { AST_EVENT_IE_PLTYPE_STR,  "Device" },
-	[AST_EVENT_IE_STATE]               = { AST_EVENT_IE_PLTYPE_UINT, "State" },
 	[AST_EVENT_IE_CONTEXT]             = { AST_EVENT_IE_PLTYPE_STR,  "Context" },
 	[AST_EVENT_IE_EID]                 = { AST_EVENT_IE_PLTYPE_RAW,  "EntityID" },
 	[AST_EVENT_IE_CEL_EVENT_TYPE]      = { AST_EVENT_IE_PLTYPE_UINT, "CELEventType" },
@@ -344,10 +342,6 @@
 	{
 		const char *substr = sub_ie_val->payload.str;
 		const char *estr = event_ie_val->payload.str;
-		if (sub_ie_val->ie_type == AST_EVENT_IE_DEVICE) {
-			substr = ast_tech_to_upper(ast_strdupa(substr));
-			estr = ast_tech_to_upper(ast_strdupa(estr));
-		}
 		res = !strcmp(substr, estr);
 		break;
 	}
@@ -519,11 +513,6 @@
 			e1str = ast_event_get_ie_str(event, ie_val->ie_type);
 			e2str = str;
 
-			if (ie_val->ie_type == AST_EVENT_IE_DEVICE) {
-				e1str = ast_tech_to_upper(ast_strdupa(e1str));
-				e2str = ast_tech_to_upper(ast_strdupa(e2str));
-			}
-
 			if (!strcmp(e1str, e2str)) {
 				return 1;
 			}
@@ -741,13 +730,7 @@
 		return -1;
 	}
 
-	if (ie_type == AST_EVENT_IE_DEVICE) {
-		char *uppertech = ast_strdupa(str);
-		ast_tech_to_upper(uppertech);
-		ie_val->payload.hash = ast_str_hash(uppertech);
-	} else {
-		ie_val->payload.hash = ast_str_hash(str);
-	}
+	ie_val->payload.hash = ast_str_hash(str);
 
 	AST_LIST_INSERT_TAIL(&sub->ie_vals, ie_val, entry);
 
@@ -1028,13 +1011,7 @@
 	str_payload = ast_alloca(payload_len);
 
 	strcpy(str_payload->str, str);
-	if (ie_type == AST_EVENT_IE_DEVICE) {
-		char *uppertech = ast_strdupa(str);
-		ast_tech_to_upper(uppertech);
-		str_payload->hash = ast_str_hash(uppertech);
-	} else {
-		str_payload->hash = ast_str_hash(str);
-	}
+	str_payload->hash = ast_str_hash(str);
 
 	return ast_event_append_ie_raw(event, ie_type, str_payload, payload_len);
 }

Modified: team/kmoore/event_system_strip/tests/test_cel.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/event_system_strip/tests/test_cel.c?view=diff&rev=395394&r1=395393&r2=395394
==============================================================================
--- team/kmoore/event_system_strip/tests/test_cel.c (original)
+++ team/kmoore/event_system_strip/tests/test_cel.c Thu Jul 25 08:14:41 2013
@@ -1719,11 +1719,6 @@
 			const char *e1str, *e2str;
 			e1str = ast_event_get_ie_str(event1, type);
 			e2str = str;
-
-			if (type == AST_EVENT_IE_DEVICE) {
-				e1str = ast_tech_to_upper(ast_strdupa(e1str));
-				e2str = ast_tech_to_upper(ast_strdupa(e2str));
-			}
 
 			if (!strcmp(e1str, e2str)) {
 				return 1;

Modified: team/kmoore/event_system_strip/tests/test_event.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/event_system_strip/tests/test_event.c?view=diff&rev=395394&r1=395393&r2=395394
==============================================================================
--- team/kmoore/event_system_strip/tests/test_event.c (original)
+++ team/kmoore/event_system_strip/tests/test_event.c Thu Jul 25 08:14:41 2013
@@ -100,13 +100,13 @@
 	}
 
 	/* Check #7: Check if a check for a str IE that isn't there works */
-	if ((foo = ast_event_get_ie_str(event, AST_EVENT_IE_DEVICE))) {
-		ast_test_status_update(test, "DEVICE IE check returned non-NULL %p\n", foo);
+	if ((foo = ast_event_get_ie_str(event, AST_EVENT_IE_CEL_CIDNAME))) {
+		ast_test_status_update(test, "CEL_CIDNAME IE check returned non-NULL %p\n", foo);
 		return -1;
 	}
 
 	/* Check #8: Check if a check for a uint IE that isn't there returns 0 */
-	if (ast_event_get_ie_uint(event, AST_EVENT_IE_STATE)) {
+	if (ast_event_get_ie_uint(event, AST_EVENT_IE_CEL_EVENT_TIME_USEC)) {
 		ast_test_status_update(test, "UNIQUEID IE should be 0\n");
 		return -1;
 	}
@@ -348,12 +348,12 @@
 	/*
 	 * Subscription TEST_SUBS_CUSTOM_STR:
 	 *  - allocate normally
-	 *  - subscribe to CUSTOM events with a DEVICE STR IE check
+	 *  - subscribe to CUSTOM events with a CEL_CIDNAME STR IE check
 	 */
 	ast_test_status_update(test, "Adding TEST_SUBS_CUSTOM_STR subscription\n");
 	test_subs[TEST_SUBS_CUSTOM_STR].sub = ast_event_subscribe(AST_EVENT_CUSTOM, event_sub_cb,
 		test_subs_class_type_str(TEST_SUBS_CUSTOM_STR), &test_subs[TEST_SUBS_CUSTOM_STR].data,
-		AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, "FOO/bar",
+		AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_PLTYPE_STR, "FOO/bar",
 		AST_EVENT_IE_END);
 	if (!test_subs[TEST_SUBS_CUSTOM_STR].sub) {
 		ast_test_status_update(test, "Failed to create TEST_SUBS_CUSTOM_STR subscription\n");
@@ -381,12 +381,12 @@
 	/*
 	 * Subscription TEST_SUBS_ALL_STR:
 	 *  - allocate normally
-	 *  - subscribe to ALL events with a DEVICE STR IE check
+	 *  - subscribe to ALL events with a CEL_CIDNAME STR IE check
 	 */
 	ast_test_status_update(test, "Adding TEST_SUBS_ALL_STR subscription\n");
 	test_subs[TEST_SUBS_ALL_STR].sub = ast_event_subscribe(AST_EVENT_ALL, event_sub_cb,
 		test_subs_class_type_str(TEST_SUBS_ALL_STR), &test_subs[TEST_SUBS_ALL_STR].data,
-		AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, "FOO/bar",
+		AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_PLTYPE_STR, "FOO/bar",
 		AST_EVENT_IE_END);
 	if (!test_subs[TEST_SUBS_ALL_STR].sub) {
 		ast_test_status_update(test, "Failed to create TEST_SUBS_ALL_STR subscription\n");
@@ -550,7 +550,7 @@
 		goto return_cleanup;
 	}
 
-	if (ast_event_sub_append_ie_str(test_subs[TEST_SUBS_CUSTOM_DYNAMIC].sub, AST_EVENT_IE_DEVICE, "FOO/bar")) {
+	if (ast_event_sub_append_ie_str(test_subs[TEST_SUBS_CUSTOM_DYNAMIC].sub, AST_EVENT_IE_CEL_CIDNAME, "FOO/bar")) {
 		ast_event_sub_destroy(test_subs[TEST_SUBS_CUSTOM_DYNAMIC].sub);
 		test_subs[TEST_SUBS_CUSTOM_DYNAMIC].sub = NULL;
 		ast_test_status_update(test, "Failed to append STR IE to TEST_SUBS_CUSTOM_DYNAMIC subscription\n");
@@ -567,7 +567,7 @@
 		goto return_cleanup;
 	}
 
-	if (ast_event_sub_append_ie_exists(test_subs[TEST_SUBS_CUSTOM_DYNAMIC].sub, AST_EVENT_IE_STATE)) {
+	if (ast_event_sub_append_ie_exists(test_subs[TEST_SUBS_CUSTOM_DYNAMIC].sub, AST_EVENT_IE_CEL_EVENT_TIME_USEC)) {
 		ast_event_sub_destroy(test_subs[TEST_SUBS_CUSTOM_DYNAMIC].sub);
 		test_subs[TEST_SUBS_CUSTOM_DYNAMIC].sub = NULL;
 		ast_test_status_update(test, "Failed to append EXISTS IE to TEST_SUBS_CUSTOM_DYNAMIC subscription\n");
@@ -590,7 +590,7 @@
 
 	/* Check STR matching. */
 	sub_res = ast_event_check_subscriber(AST_EVENT_CUSTOM,
-		AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, "FOO/bar",
+		AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_PLTYPE_STR, "FOO/bar",
 		AST_EVENT_IE_END);
 	if (sub_res != AST_EVENT_SUB_EXISTS) {
 		ast_test_status_update(test, "Str FOO/bar subscription did not exist\n");
@@ -599,7 +599,7 @@
 
 	/* Make sure that the tech portion of the device string is case-insensitive */
 	sub_res = ast_event_check_subscriber(AST_EVENT_CUSTOM,
-		AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, "foo/bar",
+		AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_PLTYPE_STR, "foo/bar",
 		AST_EVENT_IE_END);
 	if (sub_res != AST_EVENT_SUB_EXISTS) {
 		ast_test_status_update(test, "Str FOO/bar subscription lacks proper case-sensitivity for device strings\n");
@@ -609,7 +609,7 @@
 	/* Make sure that the non-tech portion of the device string is case-sensitive
 	 * and fails to match appropriately */
 	sub_res = ast_event_check_subscriber(AST_EVENT_CUSTOM,
-		AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, "FOO/BAR",
+		AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_PLTYPE_STR, "FOO/BAR",
 		AST_EVENT_IE_END);
 	if (sub_res == AST_EVENT_SUB_EXISTS) {
 		ast_test_status_update(test, "Str FOO/bar subscription lacks proper case-sensitivity for device strings\n");
@@ -617,7 +617,7 @@
 	}
 
 	sub_res = ast_event_check_subscriber(AST_EVENT_CUSTOM,
-		AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, "Money",
+		AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_PLTYPE_STR, "Money",
 		AST_EVENT_IE_END);
 	if (sub_res != AST_EVENT_SUB_NONE) {
 		ast_test_status_update(test, "Str Money subscription should not exist! (%d)\n",
@@ -716,7 +716,7 @@
 	 * TEST_SUBS_CUSTOM_RAW
 	 */
 	event = ast_event_new(AST_EVENT_CUSTOM,
-		AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, "Mula",
+		AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_PLTYPE_STR, "Mula",
 		AST_EVENT_IE_CEL_USEREVENT_NAME, AST_EVENT_IE_PLTYPE_RAW, "FOO/bar", sizeof("FOO/bar"),
 		AST_EVENT_IE_END);
 	if (!event) {
@@ -773,7 +773,7 @@
 	 */
 	event = ast_event_new(AST_EVENT_CUSTOM,
 		AST_EVENT_IE_CEL_USEREVENT_NAME, AST_EVENT_IE_PLTYPE_RAW, "FOO/bar", sizeof("FOO/bar") - 1,
-		AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, "FOO/bar",
+		AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_PLTYPE_STR, "FOO/bar",
 		AST_EVENT_IE_END);
 	if (!event) {
 		ast_test_status_update(test, "Failed to create event\n");
@@ -796,7 +796,7 @@
 	 * TEST_SUBS_CUSTOM_ANY
 	 */
 	event = ast_event_new(AST_EVENT_CUSTOM,
-		AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, "Misery",
+		AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_PLTYPE_STR, "Misery",
 		AST_EVENT_IE_CEL_USEREVENT_NAME, AST_EVENT_IE_PLTYPE_RAW, "FOO/bar", sizeof("FOO/bar"),
 		AST_EVENT_IE_END);
 	if (!event) {
@@ -899,8 +899,8 @@
 		AST_EVENT_IE_CEL_AMAFLAGS, AST_EVENT_IE_PLTYPE_UINT, 4,
 		AST_EVENT_IE_UNIQUEID, AST_EVENT_IE_PLTYPE_UINT, 5,
 		AST_EVENT_IE_CEL_USEREVENT_NAME, AST_EVENT_IE_PLTYPE_RAW, "800 km", strlen("800 km"),
-		AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, "FOO/bar",
-		AST_EVENT_IE_STATE, AST_EVENT_IE_PLTYPE_UINT, 5,
+		AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_PLTYPE_STR, "FOO/bar",
+		AST_EVENT_IE_CEL_EVENT_TIME_USEC, AST_EVENT_IE_PLTYPE_UINT, 5,
 		AST_EVENT_IE_END);
 	if (!event) {
 		ast_test_status_update(test, "Failed to create event\n");




More information about the asterisk-commits mailing list