[asterisk-commits] eliel: branch eliel/data_api_providers_gsoc2010 r273873 - /team/eliel/data_ap...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Jul 3 17:28:37 CDT 2010


Author: eliel
Date: Sat Jul  3 17:28:34 2010
New Revision: 273873

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=273873
Log:
channel types data provider implementation.


Modified:
    team/eliel/data_api_providers_gsoc2010/main/channel.c

Modified: team/eliel/data_api_providers_gsoc2010/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/eliel/data_api_providers_gsoc2010/main/channel.c?view=diff&rev=273873&r1=273872&r2=273873
==============================================================================
--- team/eliel/data_api_providers_gsoc2010/main/channel.c (original)
+++ team/eliel/data_api_providers_gsoc2010/main/channel.c Sat Jul  3 17:28:34 2010
@@ -6924,6 +6924,64 @@
 
 /*!
  * \internal
+ * \brief Implements the channeltypes provider.
+ */
+static int data_channeltypes_provider_handler(const struct ast_data_search *search,
+	struct ast_data *data_root)
+{
+	struct chanlist *cl;
+	struct ast_data *data_type;
+
+	AST_RWLIST_RDLOCK(&backends);
+	AST_RWLIST_TRAVERSE(&backends, cl, list) {
+		data_type = ast_data_add_node(data_root, "type");
+		if (!data_type) {
+			continue;
+		}
+		ast_data_add_str(data_type, "name", cl->tech->type);
+		ast_data_add_str(data_type, "description", cl->tech->description);
+		ast_data_add_bool(data_type, "devicestate", cl->tech->devicestate ? 1 : 0);
+		ast_data_add_bool(data_type, "indications", cl->tech->indicate ? 1 : 0);
+		ast_data_add_bool(data_type, "transfer", cl->tech->transfer ? 1 : 0);
+		ast_data_add_bool(data_type, "send_digit_begin", cl->tech->send_digit_begin ? 1 : 0);
+		ast_data_add_bool(data_type, "send_digit_end", cl->tech->send_digit_end ? 1 : 0);
+		ast_data_add_bool(data_type, "call", cl->tech->call ? 1 : 0);
+		ast_data_add_bool(data_type, "hangup", cl->tech->hangup ? 1 : 0);
+		ast_data_add_bool(data_type, "answer", cl->tech->answer ? 1 : 0);
+		ast_data_add_bool(data_type, "read", cl->tech->read ? 1 : 0);
+		ast_data_add_bool(data_type, "write", cl->tech->write ? 1 : 0);
+		ast_data_add_bool(data_type, "send_text", cl->tech->send_text ? 1 : 0);
+		ast_data_add_bool(data_type, "send_image", cl->tech->send_image ? 1 : 0);
+		ast_data_add_bool(data_type, "send_html", cl->tech->send_html ? 1 : 0);
+		ast_data_add_bool(data_type, "exception", cl->tech->exception ? 1 : 0);
+		ast_data_add_bool(data_type, "bridge", cl->tech->bridge ? 1 : 0);
+		ast_data_add_bool(data_type, "early_bridge", cl->tech->early_bridge ? 1 : 0);
+		ast_data_add_bool(data_type, "fixup", cl->tech->fixup ? 1 : 0);
+		ast_data_add_bool(data_type, "setoption", cl->tech->setoption ? 1 : 0);
+		ast_data_add_bool(data_type, "queryoption", cl->tech->queryoption ? 1 : 0);
+		ast_data_add_bool(data_type, "write_video", cl->tech->write_video ? 1 : 0);
+		ast_data_add_bool(data_type, "write_text", cl->tech->write_text ? 1 : 0);
+		ast_data_add_bool(data_type, "bridged_channel", cl->tech->bridged_channel ? 1 : 0);
+		ast_data_add_bool(data_type, "func_channel_read", cl->tech->func_channel_read ? 1 : 0);
+		ast_data_add_bool(data_type, "func_channel_write", cl->tech->func_channel_write ? 1 : 0);
+		ast_data_add_bool(data_type, "get_base_channel", cl->tech->get_base_channel ? 1 : 0);
+		ast_data_add_bool(data_type, "set_base_channel", cl->tech->set_base_channel ? 1 : 0);
+		ast_data_add_bool(data_type, "get_pvt_uniqueid", cl->tech->get_pvt_uniqueid ? 1 : 0);
+		ast_data_add_bool(data_type, "cc_callback", cl->tech->cc_callback ? 1 : 0);
+
+		ast_data_add_codecs(data_type, "capabilities", cl->tech->capabilities);
+
+		if (!ast_data_search_match(search, data_type)) {
+			ast_data_remove_node(data_root, data_type);
+		}
+	}
+	AST_RWLIST_UNLOCK(&backends);
+
+	return 0;
+}
+
+/*!
+ * \internal
  * \brief /asterisk/core/channels provider.
  */
 static const struct ast_data_handler channels_provider = {
@@ -6931,8 +6989,18 @@
 	.get = data_channels_provider_handler
 };
 
+/*!
+ * \internal
+ * \brief /asterisk/core/channeltypes provider.
+ */
+static const struct ast_data_handler channeltypes_provider = {
+	.version = AST_DATA_HANDLER_VERSION,
+	.get = data_channeltypes_provider_handler
+};
+
 static const struct ast_data_entry channel_providers[] = {
 	AST_DATA_ENTRY("/asterisk/core/channels", &channels_provider),
+	AST_DATA_ENTRY("/asterisk/core/channeltypes", &channeltypes_provider),
 };
 
 void ast_channels_init(void)




More information about the asterisk-commits mailing list