[asterisk-commits] kmoore: branch kmoore/stasis-bridge_events r385304 - in /team/kmoore/stasis-b...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 11 09:17:06 CDT 2013


Author: kmoore
Date: Thu Apr 11 09:17:02 2013
New Revision: 385304

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385304
Log:
A bit of renaming since this function and struct are more generic

Modified:
    team/kmoore/stasis-bridge_events/include/asterisk/manager.h
    team/kmoore/stasis-bridge_events/main/manager.c
    team/kmoore/stasis-bridge_events/main/manager_bridging.c
    team/kmoore/stasis-bridge_events/main/manager_channels.c

Modified: team/kmoore/stasis-bridge_events/include/asterisk/manager.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/include/asterisk/manager.h?view=diff&rev=385304&r1=385303&r2=385304
==============================================================================
--- team/kmoore/stasis-bridge_events/include/asterisk/manager.h (original)
+++ team/kmoore/stasis-bridge_events/include/asterisk/manager.h Thu Apr 11 09:17:02 2013
@@ -317,30 +317,29 @@
 struct ast_datastore *astman_datastore_find(struct mansession *s, const struct ast_datastore_info *info, const char *uid);
 
 /*! \brief Struct containing info for an AMI event to send out. */
-struct ast_manager_snapshot_event {
-	/*! event_flags manager_event() flags parameter. */
-	int event_flags;
-	/*!  manager_event manager_event() category. */
-	const char *manager_event;
+struct ast_manager_event_blob {
+	int event_flags;		/*!< Flags the event should be raised with. */
+	const char *manager_event;	/*!< The event to be raised, should be a string literal. */
 	AST_DECLARE_STRING_FIELDS(
-		/* extra fields to include in the event. */
-		AST_STRING_FIELD(extra_fields);
-		);
+		AST_STRING_FIELD(extra_fields);	/*!< Extra fields to include in the event. */
+	);
 };
 
 /*!
  * \since 12
  * \brief Construct a \ref snapshot_manager_event.
- * \param event_flags manager_event() flags parameter.
- * \param manager_event manager_event() category.
+ *
+ * \param event_flags Flags the event should be raised with.
+ * \param manager_event The event to be raised, should be a string literal.
  * \param extra_fields_fmt Format string for extra fields to include.
  *                         Or NO_EXTRA_FIELDS for no extra fields.
+ *
  * \return New \ref ast_manager_snapshot_event object.
  * \return \c NULL on error.
  */
-struct ast_manager_snapshot_event *
+struct ast_manager_event_blob *
 __attribute__((format(printf, 3, 4)))
-ast_manager_snapshot_event_create(
+ast_manager_event_blob_create(
 	int event_flags,
 	const char *manager_event,
 	const char *extra_fields_fmt,

Modified: team/kmoore/stasis-bridge_events/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/main/manager.c?view=diff&rev=385304&r1=385303&r2=385304
==============================================================================
--- team/kmoore/stasis-bridge_events/main/manager.c (original)
+++ team/kmoore/stasis-bridge_events/main/manager.c Thu Apr 11 09:17:02 2013
@@ -8012,27 +8012,27 @@
 	return datastore;
 }
 
-static void snapshot_manager_event_dtor(void *obj)
-{
-	struct ast_manager_snapshot_event *ev = obj;
+static void manager_event_blob_dtor(void *obj)
+{
+	struct ast_manager_event_blob *ev = obj;
 	ast_string_field_free_memory(ev);
 }
 
-struct ast_manager_snapshot_event *
+struct ast_manager_event_blob *
 __attribute__((format(printf, 3, 4)))
-ast_manager_snapshot_event_create(
+ast_manager_event_blob_create(
 	int event_flags,
 	const char *manager_event,
 	const char *extra_fields_fmt,
 	...)
 {
-	RAII_VAR(struct ast_manager_snapshot_event *, ev, NULL, ao2_cleanup);
+	RAII_VAR(struct ast_manager_event_blob *, ev, NULL, ao2_cleanup);
 	va_list argp;
 
 	ast_assert(extra_fields_fmt != NULL);
 	ast_assert(manager_event != NULL);
 
-	ev = ao2_alloc(sizeof(*ev), snapshot_manager_event_dtor);
+	ev = ao2_alloc(sizeof(*ev), manager_event_blob_dtor);
 	if (!ev) {
 		return NULL;
 	}

Modified: team/kmoore/stasis-bridge_events/main/manager_bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/main/manager_bridging.c?view=diff&rev=385304&r1=385303&r2=385304
==============================================================================
--- team/kmoore/stasis-bridge_events/main/manager_bridging.c (original)
+++ team/kmoore/stasis-bridge_events/main/manager_bridging.c Thu Apr 11 09:17:02 2013
@@ -165,12 +165,12 @@
 }
 
 /*! \brief Typedef for callbacks that get called on channel snapshot updates */
-typedef struct ast_manager_snapshot_event *(*bridge_snapshot_monitor)(
+typedef struct ast_manager_event_blob *(*bridge_snapshot_monitor)(
 	struct ast_bridge_snapshot *old_snapshot,
 	struct ast_bridge_snapshot *new_snapshot);
 
 /*! \brief Handle bridge creation */
-static struct ast_manager_snapshot_event *bridge_create(
+static struct ast_manager_event_blob *bridge_create(
 	struct ast_bridge_snapshot *old_snapshot,
 	struct ast_bridge_snapshot *new_snapshot)
 {
@@ -178,12 +178,12 @@
 		return NULL;
 	}
 
-	return ast_manager_snapshot_event_create(
+	return ast_manager_event_blob_create(
 		EVENT_FLAG_CALL, "BridgeCreate", NO_EXTRA_FIELDS);
 }
 
 /*! \brief Handle bridge destruction */
-static struct ast_manager_snapshot_event *bridge_destroy(
+static struct ast_manager_event_blob *bridge_destroy(
 	struct ast_bridge_snapshot *old_snapshot,
 	struct ast_bridge_snapshot *new_snapshot)
 {
@@ -191,7 +191,7 @@
 		return NULL;
 	}
 
-	return ast_manager_snapshot_event_create(
+	return ast_manager_event_blob_create(
 		EVENT_FLAG_CALL, "BridgeDestroy", NO_EXTRA_FIELDS);
 }
 
@@ -211,7 +211,7 @@
 }
 
 /*! \brief Handle channels entering and leaving */
-static struct ast_manager_snapshot_event *bridge_channel_diff(
+static struct ast_manager_event_blob *bridge_channel_diff(
 	struct ast_bridge_snapshot *old_snapshot,
 	struct ast_bridge_snapshot *new_snapshot)
 {
@@ -228,7 +228,7 @@
 	ao2_callback_data(new_snapshot->channels, OBJ_NODATA, find_diff, old_snapshot->channels, &new_diff);
 
 	if (new_diff) {
-		return ast_manager_snapshot_event_create(
+		return ast_manager_event_blob_create(
 			EVENT_FLAG_CALL, "BridgeEnter",
 			"Uniqueid: %s\r\n", new_diff);
 	}
@@ -237,7 +237,7 @@
 	ao2_callback_data(old_snapshot->channels, OBJ_NODATA, find_diff, new_snapshot->channels, &old_diff);
 
 	if (old_diff) {
-		return ast_manager_snapshot_event_create(
+		return ast_manager_event_blob_create(
 			EVENT_FLAG_CALL, "BridgeLeave",
 			"Uniqueid: %s\r\n", old_diff);
 	}
@@ -246,7 +246,7 @@
 }
 
 /*! \brief Handle bridge video source change */
-static struct ast_manager_snapshot_event *bridge_video_source(
+static struct ast_manager_event_blob *bridge_video_source(
 	struct ast_bridge_snapshot *old_snapshot,
 	struct ast_bridge_snapshot *new_snapshot)
 {
@@ -258,7 +258,7 @@
 		return NULL;
 	}
 
-	return ast_manager_snapshot_event_create(
+	return ast_manager_event_blob_create(
 		EVENT_FLAG_CALL, "BridgeVideoSourceChange",
 		"Uniqueid: %s\r\n", new_snapshot->video_source);
 }
@@ -277,7 +277,7 @@
 }
 
 /*! \brief Handle bridge video mode change */
-static struct ast_manager_snapshot_event *bridge_video_mode(
+static struct ast_manager_event_blob *bridge_video_mode(
 	struct ast_bridge_snapshot *old_snapshot,
 	struct ast_bridge_snapshot *new_snapshot)
 {
@@ -289,7 +289,7 @@
 		return NULL;
 	}
 
-	return ast_manager_snapshot_event_create(
+	return ast_manager_event_blob_create(
 		EVENT_FLAG_CALL, "BridgeVideoModeChange",
 		"BridgeVideoMode: %s\r\n", video_mode_to_str(new_snapshot->video_mode));
 }
@@ -322,7 +322,7 @@
 	new_snapshot = stasis_message_data(update->new_snapshot);
 
 	for (i = 0; i < ARRAY_LEN(bridge_monitors); ++i) {
-		RAII_VAR(struct ast_manager_snapshot_event *, ev, NULL, ao2_cleanup);
+		RAII_VAR(struct ast_manager_event_blob *, ev, NULL, ao2_cleanup);
 		ev = bridge_monitors[i](old_snapshot, new_snapshot);
 
 		if (!ev) {

Modified: team/kmoore/stasis-bridge_events/main/manager_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/main/manager_channels.c?view=diff&rev=385304&r1=385303&r2=385304
==============================================================================
--- team/kmoore/stasis-bridge_events/main/manager_channels.c (original)
+++ team/kmoore/stasis-bridge_events/main/manager_channels.c Thu Apr 11 09:17:02 2013
@@ -311,12 +311,12 @@
 }
 
 /*! \brief Typedef for callbacks that get called on channel snapshot updates */
-typedef struct ast_manager_snapshot_event *(*channel_snapshot_monitor)(
+typedef struct ast_manager_event_blob *(*channel_snapshot_monitor)(
 	struct ast_channel_snapshot *old_snapshot,
 	struct ast_channel_snapshot *new_snapshot);
 
 /*! \brief Handle channel state changes */
-static struct ast_manager_snapshot_event *channel_state_change(
+static struct ast_manager_event_blob *channel_state_change(
 	struct ast_channel_snapshot *old_snapshot,
 	struct ast_channel_snapshot *new_snapshot)
 {
@@ -333,7 +333,7 @@
 	 */
 
 	if (!old_snapshot) {
-		return ast_manager_snapshot_event_create(
+		return ast_manager_event_blob_create(
 			EVENT_FLAG_CALL, "Newchannel", NO_EXTRA_FIELDS);
 	}
 
@@ -341,7 +341,7 @@
 	is_hungup = ast_test_flag(&new_snapshot->flags, AST_FLAG_ZOMBIE) ? 1 : 0;
 
 	if (!was_hungup && is_hungup) {
-		return ast_manager_snapshot_event_create(
+		return ast_manager_event_blob_create(
 			EVENT_FLAG_CALL, "Hangup",
 			"Cause: %d\r\n"
 			"Cause-txt: %s\r\n",
@@ -350,7 +350,7 @@
 	}
 
 	if (old_snapshot->state != new_snapshot->state) {
-		return ast_manager_snapshot_event_create(
+		return ast_manager_event_blob_create(
 			EVENT_FLAG_CALL, "Newstate", NO_EXTRA_FIELDS);
 	}
 
@@ -386,7 +386,7 @@
 		strcmp(old_snapshot->exten, new_snapshot->exten) == 0;
 }
 
-static struct ast_manager_snapshot_event *channel_newexten(
+static struct ast_manager_event_blob *channel_newexten(
 	struct ast_channel_snapshot *old_snapshot,
 	struct ast_channel_snapshot *new_snapshot)
 {
@@ -405,7 +405,7 @@
 	}
 
 	/* DEPRECATED: Extension field deprecated in 12; remove in 14 */
-	return ast_manager_snapshot_event_create(
+	return ast_manager_event_blob_create(
 		EVENT_FLAG_CALL, "Newexten",
 		"Extension: %s\r\n"
 		"Application: %s\r\n"
@@ -432,7 +432,7 @@
 		strcmp(old_snapshot->caller_name, new_snapshot->caller_name) == 0;
 }
 
-static struct ast_manager_snapshot_event *channel_new_callerid(
+static struct ast_manager_event_blob *channel_new_callerid(
 	struct ast_channel_snapshot *old_snapshot,
 	struct ast_channel_snapshot *new_snapshot)
 {
@@ -445,7 +445,7 @@
 		return NULL;
 	}
 
-	return ast_manager_snapshot_event_create(
+	return ast_manager_event_blob_create(
 		EVENT_FLAG_CALL, "NewCallerid",
 		"CID-CallingPres: %d (%s)\r\n",
 		new_snapshot->caller_pres,
@@ -478,7 +478,7 @@
 	new_snapshot = stasis_message_data(update->new_snapshot);
 
 	for (i = 0; i < ARRAY_LEN(channel_monitors); ++i) {
-		RAII_VAR(struct ast_manager_snapshot_event *, ev, NULL, ao2_cleanup);
+		RAII_VAR(struct ast_manager_event_blob *, ev, NULL, ao2_cleanup);
 		ev = channel_monitors[i](old_snapshot, new_snapshot);
 
 		if (!ev) {




More information about the asterisk-commits mailing list