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

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


Author: kmoore
Date: Thu Jul 25 08:55:18 2013
New Revision: 395398

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395398
Log:
Rip out PLTYPE EXISTS

Modified:
    team/kmoore/event_system_strip/include/asterisk/event.h
    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.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/event_system_strip/include/asterisk/event.h?view=diff&rev=395398&r1=395397&r2=395398
==============================================================================
--- team/kmoore/event_system_strip/include/asterisk/event.h (original)
+++ team/kmoore/event_system_strip/include/asterisk/event.h Thu Jul 25 08:55:18 2013
@@ -90,9 +90,7 @@
  * and must end with AST_EVENT_IE_END.
  *
  * If the ie_type specified is *not* AST_EVENT_IE_END, then it must be followed
- * by a valid IE payload type.  If the payload type specified is
- * AST_EVENT_IE_PLTYPE_EXISTS, then the 3rd argument should not be provided.
- * Otherwise, a payload must also be specified.
+ * by a valid IE payload type.  A payload must also be specified.
  *
  * \return This returns a reference to the subscription for use with
  *         un-subscribing later.  If there is a failure in creating the
@@ -255,9 +253,7 @@
  * and must end with AST_EVENT_IE_END.
  *
  * If the ie_type specified is *not* AST_EVENT_IE_END, then it must be followed
- * by a valid IE payload type.  If the payload type specified is
- * AST_EVENT_IE_PLTYPE_EXISTS, then the 3rd argument should not be provided.
- * Otherwise, a payload must also be specified.
+ * by a valid IE payload type.  A payload must also be specified.
  *
  * \return This returns one of the values defined in the ast_event_subscriber_res
  *         enum which will indicate if subscribers exist that match the given
@@ -308,8 +304,7 @@
  * and must end with AST_EVENT_IE_END.
  *
  * If the ie_type specified is *not* AST_EVENT_IE_END, then it must be followed
- * by a valid IE payload type.  The payload type, EXISTS, should not be used here
- * because it makes no sense to do so.  So, a payload must also be specified
+ * by a valid IE payload type.  A payload must also be specified
  * after the IE payload type.
  *
  * \note The EID IE will be appended automatically when this function is used

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=395398&r1=395397&r2=395398
==============================================================================
--- 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:55:18 2013
@@ -249,8 +249,6 @@
  */
 enum ast_event_ie_pltype {
 	AST_EVENT_IE_PLTYPE_UNKNOWN = -1,
-	/*! Just check if it exists, not the value */
-	AST_EVENT_IE_PLTYPE_EXISTS,
 	/*! Unsigned Integer (Can be used for signed, too ...) */
 	AST_EVENT_IE_PLTYPE_UINT,
 	/*! String */

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=395398&r1=395397&r2=395398
==============================================================================
--- team/kmoore/event_system_strip/main/event.c (original)
+++ team/kmoore/event_system_strip/main/event.c Thu Jul 25 08:55:18 2013
@@ -278,7 +278,6 @@
 		ast_free(ie_val->payload.raw);
 		break;
 	case AST_EVENT_IE_PLTYPE_UINT:
-	case AST_EVENT_IE_PLTYPE_EXISTS:
 	case AST_EVENT_IE_PLTYPE_UNKNOWN:
 		break;
 	}
@@ -317,10 +316,6 @@
 	}
 
 	if (sub_ie_val->ie_pltype != event_ie_val->ie_pltype) {
-		if (sub_ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_EXISTS) {
-			/* The subscription only cares that this ie exists. */
-			return 1;
-		}
 		/* Payload types do not match. */
 		return 0;
 	}
@@ -340,9 +335,6 @@
 		res = (sub_ie_val->raw_datalen == event_ie_val->raw_datalen
 			&& !memcmp(sub_ie_val->payload.raw, event_ie_val->payload.raw,
 				sub_ie_val->raw_datalen));
-		break;
-	case AST_EVENT_IE_PLTYPE_EXISTS:
-		/* Should never get here since check_ie_vals cannot have this type. */
 		break;
 	case AST_EVENT_IE_PLTYPE_UNKNOWN:
 		/*
@@ -407,7 +399,6 @@
 			break;
 		}
 		case AST_EVENT_IE_PLTYPE_UNKNOWN:
-		case AST_EVENT_IE_PLTYPE_EXISTS:
 			/* Unsupported payload type. */
 			break;
 		}
@@ -507,11 +498,6 @@
 			&& !memcmp(buf, ast_event_get_ie_raw(event, ie_val->ie_type), ie_payload_len)) ? 1 : 0;
 	}
 
-	case AST_EVENT_IE_PLTYPE_EXISTS:
-	{
-		return ast_event_get_ie_raw(event, ie_val->ie_type) ? 1 : 0;
-	}
-
 	case AST_EVENT_IE_PLTYPE_UNKNOWN:
 		return 0;
 	}
@@ -536,9 +522,6 @@
 		switch (ie_val->ie_pltype) {
 		case AST_EVENT_IE_PLTYPE_UNKNOWN:
 			break;
-		case AST_EVENT_IE_PLTYPE_EXISTS:
-			ast_event_append_ie_uint(&event, AST_EVENT_IE_EXISTS, ie_val->ie_type);
-			break;
 		case AST_EVENT_IE_PLTYPE_UINT:
 			ast_event_append_ie_uint(&event, ie_val->ie_type, ie_val->payload.uint);
 			break;
@@ -633,27 +616,6 @@
 	ie_val->ie_type = ie_type;
 	ie_val->payload.uint = unsigned_int;
 	ie_val->ie_pltype = AST_EVENT_IE_PLTYPE_UINT;
-
-	AST_LIST_INSERT_TAIL(&sub->ie_vals, ie_val, entry);
-
-	return 0;
-}
-
-int ast_event_sub_append_ie_exists(struct ast_event_sub *sub,
-	enum ast_event_ie_type ie_type)
-{
-	struct ast_event_ie_val *ie_val;
-
-	if (ie_type <= 0 || ie_type >= AST_EVENT_IE_TOTAL) {
-		return -1;
-	}
-
-	if (!(ie_val = ast_calloc(1, sizeof(*ie_val)))) {
-		return -1;
-	}
-
-	ie_val->ie_type = ie_type;
-	ie_val->ie_pltype = AST_EVENT_IE_PLTYPE_EXISTS;
 
 	AST_LIST_INSERT_TAIL(&sub->ie_vals, ie_val, entry);
 
@@ -781,9 +743,6 @@
 			ast_event_sub_append_ie_raw(sub, ie_type, data, data_len);
 			break;
 		}
-		case AST_EVENT_IE_PLTYPE_EXISTS:
-			ast_event_sub_append_ie_exists(sub, ie_type);
-			break;
 		}
 	}
 	va_end(ap);
@@ -1024,7 +983,6 @@
 			break;
 		}
 		case AST_EVENT_IE_PLTYPE_UNKNOWN:
-		case AST_EVENT_IE_PLTYPE_EXISTS:
 			break;
 		}
 
@@ -1055,7 +1013,6 @@
 			ast_event_append_ie_raw(&event, ie_val->ie_type,
 					ie_val->payload.raw, ie_val->raw_datalen);
 			break;
-		case AST_EVENT_IE_PLTYPE_EXISTS:
 		case AST_EVENT_IE_PLTYPE_UNKNOWN:
 			break;
 		}

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=395398&r1=395397&r2=395398
==============================================================================
--- team/kmoore/event_system_strip/tests/test_cel.c (original)
+++ team/kmoore/event_system_strip/tests/test_cel.c Thu Jul 25 08:55:18 2013
@@ -1780,9 +1780,6 @@
 
 		switch (ie_pltype) {
 		case AST_EVENT_IE_PLTYPE_UNKNOWN:
-		case AST_EVENT_IE_PLTYPE_EXISTS:
-			ast_log(LOG_ERROR, "%s\n", ie_type_name);
-			break;
 		case AST_EVENT_IE_PLTYPE_STR:
 			ast_log(LOG_ERROR, "%.30s: %s\n", ie_type_name,
 					ast_event_iterator_get_ie_str(&i));

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=395398&r1=395397&r2=395398
==============================================================================
--- team/kmoore/event_system_strip/tests/test_event.c (original)
+++ team/kmoore/event_system_strip/tests/test_event.c Thu Jul 25 08:55:18 2013
@@ -432,7 +432,6 @@
 	test_subs[TEST_SUBS_CUSTOM_EXISTS].sub = ast_event_subscribe(AST_EVENT_CUSTOM, event_sub_cb,
 		test_subs_class_type_str(TEST_SUBS_CUSTOM_EXISTS), &test_subs[TEST_SUBS_CUSTOM_EXISTS].data,
 		AST_EVENT_IE_CEL_AMAFLAGS, AST_EVENT_IE_PLTYPE_UINT, 4,
-		AST_EVENT_IE_UNIQUEID, AST_EVENT_IE_PLTYPE_EXISTS,
 		AST_EVENT_IE_END);
 	if (!test_subs[TEST_SUBS_CUSTOM_EXISTS].sub) {
 		ast_test_status_update(test, "Failed to create TEST_SUBS_CUSTOM_EXISTS subscription\n");
@@ -508,14 +507,6 @@
 		goto return_cleanup;
 	}
 
-	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");
-		res = AST_TEST_FAIL;
-		goto return_cleanup;
-	}
-
 	if (ast_event_sub_activate(test_subs[TEST_SUBS_CUSTOM_DYNAMIC].sub)) {
 		ast_event_sub_destroy(test_subs[TEST_SUBS_CUSTOM_DYNAMIC].sub);
 		test_subs[TEST_SUBS_CUSTOM_DYNAMIC].sub = NULL;
@@ -588,25 +579,6 @@
 		AST_EVENT_IE_END);
 	if (sub_res != AST_EVENT_SUB_NONE) {
 		ast_test_status_update(test, "UINT=1 subscription should not exist! (%d)\n",
-			sub_res);
-		res = AST_TEST_FAIL;
-	}
-
-	/* Check EXISTS matching. */
-	sub_res = ast_event_check_subscriber(AST_EVENT_CUSTOM,
-		AST_EVENT_IE_CEL_AMAFLAGS, AST_EVENT_IE_PLTYPE_UINT, 4,
-		AST_EVENT_IE_UNIQUEID, AST_EVENT_IE_PLTYPE_UINT, 100,
-		AST_EVENT_IE_END);
-	if (sub_res != AST_EVENT_SUB_EXISTS) {
-		ast_test_status_update(test, "EXISTS subscription did not exist\n");
-		res = AST_TEST_FAIL;
-	}
-
-	sub_res = ast_event_check_subscriber(AST_EVENT_CUSTOM,
-		AST_EVENT_IE_CEL_AMAFLAGS, AST_EVENT_IE_PLTYPE_UINT, 4,
-		AST_EVENT_IE_END);
-	if (sub_res != AST_EVENT_SUB_NONE) {
-		ast_test_status_update(test, "EXISTS subscription should not exist! (%d)\n",
 			sub_res);
 		res = AST_TEST_FAIL;
 	}




More information about the asterisk-commits mailing list