* [Bluez-devel] Service.ListTrusts()
@ 2007-08-17 10:29 Tom Patzig
0 siblings, 0 replies; 2+ messages in thread
From: Tom Patzig @ 2007-08-17 10:29 UTC (permalink / raw)
To: BlueZ development
[-- Attachment #1: Type: text/plain, Size: 371 bytes --]
Hi,
final version of the patch.
* Renamed the method to ListTrusts()
* Removed ListUsers() skeleton
* Removed Listusers() in dbus-api.txt
* Added ListTrusts() in dbus-api.txt
Tom
--
--------------------------------------------
Tom Patzig <tpatzig@suse.de>
Novell / SUSE
SUSE LINUX Products GmbH - Nürnberg - AG Nürnberg - HRB 16746 - GF: Markus Rex
[-- Attachment #2: service_listTrusted.diff --]
[-- Type: text/x-patch, Size: 2210 bytes --]
--- hcid/dbus-api.txt
+++ hcid/dbus-api.txt
@@ -1193,10 +1193,10 @@
file. The Start and Stop methods are not applicable to
external services and will return an error.
- array{string} ListUsers() [experimental]
+ array{string} ListTrusts()
- Returns list of current users (device addresses)
- of the service.
+ Returns a list of remote devices that are trusted
+ for the service.
void RemoveUser(string address) [experimental]
--- hcid/dbus-service.c
+++ hcid/dbus-service.c
@@ -525,12 +525,6 @@
return send_message_and_unref(conn, reply);
}
-static DBusHandlerResult list_users(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
static DBusHandlerResult remove_user(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -566,6 +560,37 @@
return send_message_and_unref(conn, reply);
}
+static DBusHandlerResult list_trusted(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct service *service = data;
+ DBusMessage *reply;
+ GSList *trusts, *l;
+ char **addrs;
+ int len;
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ trusts = list_trusts(BDADDR_ANY, service->ident);
+
+ addrs = g_new(char *, g_slist_length(trusts));
+
+ for (l = trusts, len = 0; l; l = l->next, len++)
+ addrs[len] = l->data;
+
+ dbus_message_append_args(reply,
+ DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
+ &addrs, len,
+ DBUS_TYPE_INVALID);
+
+ g_free(addrs);
+ g_slist_foreach(trusts, (GFunc) g_free, NULL);
+ g_slist_free(trusts);
+
+ return send_message_and_unref(conn, reply);
+}
+
static DBusHandlerResult is_trusted(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -639,6 +664,7 @@
{ "SetTrusted", set_trusted, "s", "" },
{ "IsTrusted", is_trusted, "s", "b" },
{ "RemoveTrust", remove_trust, "s", "" },
+ { "ListTrusts", list_trusted, "", "as" },
{ NULL, NULL, NULL, NULL }
};
[-- Attachment #3: Type: text/plain, Size: 315 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
[-- Attachment #4: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bluez-devel] Service.ListTrusts()
@ 2007-08-17 11:41 Tom Patzig
0 siblings, 0 replies; 2+ messages in thread
From: Tom Patzig @ 2007-08-17 11:41 UTC (permalink / raw)
To: BlueZ development
[-- Attachment #1: Type: text/plain, Size: 341 bytes --]
Hi,
updated version of the patch.
* removed ListUsers()
* removed RemoveUser()
* removed remove_user()
* removed RemoveUser from dbus-api.txt
Tom
--
--------------------------------------------
Tom Patzig <tpatzig@suse.de>
Novell / SUSE
SUSE LINUX Products GmbH - Nürnberg - AG Nürnberg - HRB 16746 - GF: Markus Rex
[-- Attachment #2: service_listTrusted.diff --]
[-- Type: text/x-patch, Size: 2733 bytes --]
--- hcid/dbus-api.txt
+++ hcid/dbus-api.txt
@@ -1193,15 +1193,10 @@
file. The Start and Stop methods are not applicable to
external services and will return an error.
- array{string} ListUsers() [experimental]
+ array{string} ListTrusts()
- Returns list of current users (device addresses)
- of the service.
-
- void RemoveUser(string address) [experimental]
-
- Removes a user of the service. The address parameter
- must match one of the current users of the service.
+ Returns a list of remote devices that are trusted
+ for the service.
void SetTrusted(string address) [experimental]
--- hcid/dbus-service.c
+++ hcid/dbus-service.c
@@ -525,18 +525,6 @@
return send_message_and_unref(conn, reply);
}
-static DBusHandlerResult list_users(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-static DBusHandlerResult remove_user(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
static DBusHandlerResult set_trusted(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -566,6 +554,37 @@
return send_message_and_unref(conn, reply);
}
+static DBusHandlerResult list_trusted(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct service *service = data;
+ DBusMessage *reply;
+ GSList *trusts, *l;
+ char **addrs;
+ int len;
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ trusts = list_trusts(BDADDR_ANY, service->ident);
+
+ addrs = g_new(char *, g_slist_length(trusts));
+
+ for (l = trusts, len = 0; l; l = l->next, len++)
+ addrs[len] = l->data;
+
+ dbus_message_append_args(reply,
+ DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
+ &addrs, len,
+ DBUS_TYPE_INVALID);
+
+ g_free(addrs);
+ g_slist_foreach(trusts, (GFunc) g_free, NULL);
+ g_slist_free(trusts);
+
+ return send_message_and_unref(conn, reply);
+}
+
static DBusHandlerResult is_trusted(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -634,11 +653,10 @@
{ "Stop", stop, "", "" },
{ "IsRunning", is_running, "", "b" },
{ "IsExternal", is_external, "", "b" },
- { "ListUsers", list_users, "", "as" },
- { "RemoveUser", remove_user, "s", "" },
{ "SetTrusted", set_trusted, "s", "" },
{ "IsTrusted", is_trusted, "s", "b" },
{ "RemoveTrust", remove_trust, "s", "" },
+ { "ListTrusts", list_trusted, "", "as" },
{ NULL, NULL, NULL, NULL }
};
[-- Attachment #3: Type: text/plain, Size: 315 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
[-- Attachment #4: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-17 11:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-17 10:29 [Bluez-devel] Service.ListTrusts() Tom Patzig
-- strict thread matches above, loose matches on Subject: below --
2007-08-17 11:41 Tom Patzig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox