This email list is read-only. Emails sent to this list will be discarded ---------------------------------- README | 6 +- acinclude.m4 | 16 ++++++ client/main.c | 95 +++++++++++++++++++++++++++++++++- client/pbap.c | 21 ++++---- client/pbap.h | 2 +- client/session.c | 30 ++++++----- client/session.h | 5 +- configure.ac | 6 +-- doc/client-api.txt | 14 +++-- gdbus/gdbus.h | 2 +- gdbus/mainloop.c | 2 +- gdbus/object.c | 16 ++++-- gdbus/watch.c | 2 +- plugins/ebook.c | 2 +- src/bluetooth.c | 3 +- src/bluetooth.h | 2 +- src/ftp.c | 2 +- src/logging.c | 4 +- src/logging.h | 2 +- src/main.c | 2 +- src/manager.c | 139 +++++++++++++++++++++++++++++++------------------ src/obex.c | 2 +- src/obex.h | 2 +- src/obexd.h | 2 +- src/opp.c | 2 +- src/pbap.c | 8 ++- src/phonebook.c | 6 +- src/phonebook.h | 2 +- src/plugin.c | 3 +- src/plugin.h | 2 +- test/Makefile.am | 2 +- test/get-capabilities | 20 +++++++ test/main.c | 2 +- test/pbap-client | 42 +++++++++++++++ 34 files changed, 348 insertions(+), 120 deletions(-)
New commits: commit 1b690263ed779fc89f842060681acfdac681752f Author: Marcel Holtmann <[email protected]> Date: Thu Jan 1 19:30:39 2009 +0100 Update copyright information commit af145cdcca411e485d6855d1757233677c02412a Author: Luiz Augusto von Dentz <[email protected]> Date: Wed Dec 24 10:36:22 2008 -0300 Resolve adapter object path before calling RequestAuthorization. commit 910623d6a53ad8e8fd611ba92698fb1a14ea74a7 Author: Luiz Augusto von Dentz <[email protected]> Date: Wed Dec 24 10:36:09 2008 -0300 Add script test to GetCapabilities. commit 35362ed09a371cb0663d345db09aa53294306756 Author: Luiz Augusto von Dentz <[email protected]> Date: Wed Dec 24 10:35:48 2008 -0300 Update client API documentation to mention GetCapabilties. commit 59f150ff91eb4d396cede1a6cb1d3c7b61866ffe Author: Luiz Augusto von Dentz <[email protected]> Date: Wed Dec 24 10:35:29 2008 -0300 Introduce GetCapabilities support to client API. commit 8d821b6b95f0e60172c888c0331d083924a344eb Author: Raymond Liu <[email protected]> Date: Wed Dec 24 10:54:47 2008 +0800 Check if path is valid before unregistering it commit 9097e89c031123ba0cdd1276afafeb9e68ab0cfe Author: Marcel Holtmann <[email protected]> Date: Tue Dec 23 06:18:10 2008 +0100 Enable verbose compiler warnings in maintainer mode commit f45908c02c3c8cfa1c81caa96690dcd850c291b2 Author: Marcel Holtmann <[email protected]> Date: Tue Dec 23 06:17:16 2008 +0100 Fix local includes commit f017e03445ff8c2d79f076d7627360c679f4899f Author: Marcel Holtmann <[email protected]> Date: Tue Dec 23 06:16:51 2008 +0100 Move debug statement after variable declaration commit 1c37c56a5dada50883d61c26e4d1e75d61fccd6e Author: Marcel Holtmann <[email protected]> Date: Tue Dec 23 06:12:56 2008 +0100 The static keyword has to come first commit 5d60736729b2898e6a395cdb5e7b566e7385f73a Author: Marcel Holtmann <[email protected]> Date: Tue Dec 23 03:32:32 2008 +0100 Fix issue with signed/unsigned comparison commit 605a15dd8b4d2d0ab09926b2e1910aa2521f814b Author: Marcel Holtmann <[email protected]> Date: Sun Dec 21 22:32:00 2008 +0100 Turn warnings into errors when debugging is enabled commit e7157de42712202bb67bcebb2cefef9f3ecf4837 Author: Marcel Holtmann <[email protected]> Date: Sun Dec 21 22:30:29 2008 +0100 Require at minimum autoconf 2.60 commit c27e26358d368fb81460f3cd9137c3d49f8176e4 Author: Marcel Holtmann <[email protected]> Date: Sat Dec 20 21:52:38 2008 +0100 Use tabs for indentation commit 3f3cb91fa0dc76034a06bf4f54586f99a05ff747 Author: Marcel Holtmann <[email protected]> Date: Fri Dec 19 07:24:03 2008 +0100 Return if function type is not provided commit 75a05a9aad6377a78a5daa83c39cdc2faf6ee4bf Author: Marcel Holtmann <[email protected]> Date: Fri Dec 19 07:22:34 2008 +0100 Fix up PBAP test script and add it to distribution commit 3ca5e1ac7c37582b9ba9b21c23f24aedf520ca6a Author: Raymond Liu <[email protected]> Date: Fri Dec 19 10:54:35 2008 +0800 Add test script for PBAP client commit 34b2d7deb9b05d87e2aac2182a44c02901b34ba8 Author: Raymond Liu <[email protected]> Date: Thu Dec 18 18:08:24 2008 +0800 Rename SetFilters/GetFilters/ListAllFilters to SetFilter/GetFilter/ListFilterFields commit e332f56d7fe0c2f52a9a75a0eefed0686ad6277e Author: Forrest Zhao <[email protected]> Date: Thu Dec 18 12:18:41 2008 +0800 for PBAP Pullvardlisting the name header could be empty Diff in this email is a maximum of 400 lines. diff --git a/README b/README index 1d1713e..b785841 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ OBEX Server and Client ********************** -Copyright (C) 2007-2008 Marcel Holtmann <[email protected]> +Copyright (C) 2007-2009 Marcel Holtmann <[email protected]> Compilation and installation @@ -17,8 +17,8 @@ In order to compile OBEX daemons you need following software packages: To configure run: ./configure --prefix=/usr --libexecdir=/usr/lib/obex \ --mandir=/usr/share/man --sysconfdir=/etc - -Configure automatically searches for all required components and packages. + +Configure automatically searches for all required components and packages. To compile and install run: make && make install diff --git a/acinclude.m4 b/acinclude.m4 index 95486c3..c17ea28 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -9,3 +9,19 @@ AC_DEFUN([AC_PROG_CC_PIE], [ rm -rf conftest* ]) ]) + +AC_DEFUN([COMPILER_FLAGS], [ + if (test "${CFLAGS}" = ""); then + CFLAGS="-Wall -O2 -D_FORTIFY_SOURCE=2" + fi + if (test "$USE_MAINTAINER_MODE" = "yes"); then + CFLAGS+=" -Werror -Wextra" + CFLAGS+=" -Wno-sign-compare" + CFLAGS+=" -Wno-unused-parameter" + CFLAGS+=" -Wno-missing-field-initializers" + CFLAGS+=" -Wdeclaration-after-statement" + CFLAGS+=" -Wmissing-declarations" + CFLAGS+=" -Wredundant-decls" + CFLAGS+=" -Wcast-align" + fi +]) diff --git a/client/main.c b/client/main.c index 0ce274a..81c4ccf 100644 --- a/client/main.c +++ b/client/main.c @@ -2,7 +2,7 @@ * * OBEX Client * - * Copyright (C) 2007-2008 Marcel Holtmann <[email protected]> + * Copyright (C) 2007-2009 Marcel Holtmann <[email protected]> * * * This program is free software; you can redistribute it and/or modify @@ -309,6 +309,97 @@ static DBusMessage *create_session(DBusConnection *connection, return g_dbus_create_error(message, "org.openobex.Error.Failed", NULL); } +static void capabilities_complete_callback(struct session_data *session, + void *user_data) +{ + struct send_data *data = user_data; + char *capabilities; + + if (session->obex == NULL) { + DBusMessage *error = g_dbus_create_error(data->message, + "org.openobex.Error.Failed", NULL); + g_dbus_send_message(data->connection, error); + goto done; + } + + capabilities = g_strndup(session->buffer, session->filled); + + g_dbus_send_reply(data->connection, data->message, + DBUS_TYPE_STRING, &capabilities, + DBUS_TYPE_INVALID); + + g_free(capabilities); + +done: + + dbus_message_unref(data->message); + dbus_connection_unref(data->connection); + g_free(data->sender); + g_free(data); +} + +static void capability_session_callback(struct session_data *session, + void *user_data) +{ + struct send_data *data = user_data; + + if (session->obex == NULL) { + DBusMessage *error = g_dbus_create_error(data->message, + "org.openobex.Error.Failed", NULL); + g_dbus_send_message(data->connection, error); + goto done; + } + + session_pull(session, "x-obex/capability", NULL, + capabilities_complete_callback, data); + + return; + +done: + dbus_message_unref(data->message); + dbus_connection_unref(data->connection); + g_free(data->sender); + g_free(data); +} + +static DBusMessage *get_capabilities(DBusConnection *connection, + DBusMessage *message, void *user_data) +{ + DBusMessageIter iter, dict; + struct send_data *data; + const char *source = NULL, *dest = NULL, *target = NULL; + + dbus_message_iter_init(message, &iter); + dbus_message_iter_recurse(&iter, &dict); + + parse_device_dict(&dict, &source, &dest, &target); + if (dest == NULL) + return g_dbus_create_error(message, + "org.openobex.Error.InvalidArguments", NULL); + + data = g_try_malloc0(sizeof(*data)); + if (data == NULL) + return g_dbus_create_error(message, + "org.openobex.Error.NoMemory", NULL); + + data->connection = dbus_connection_ref(connection); + data->message = dbus_message_ref(message); + data->sender = g_strdup(dbus_message_get_sender(message)); + + if (!target) + target = "OPP"; + + if (session_create(source, dest, target, capability_session_callback, data) == 0) + return NULL; + + dbus_message_unref(data->message); + dbus_connection_unref(data->connection); + g_free(data->sender); + g_free(data); + + return g_dbus_create_error(message, "org.openobex.Error.Failed", NULL); +} + static GDBusMethodTable client_methods[] = { { "SendFiles", "a{sv}aso", "", send_files, G_DBUS_METHOD_FLAG_ASYNC }, @@ -318,6 +409,8 @@ static GDBusMethodTable client_methods[] = { G_DBUS_METHOD_FLAG_ASYNC }, { "CreateSession", "a{sv}", "o", create_session, G_DBUS_METHOD_FLAG_ASYNC }, + { "GetCapabilities", "a{sv}", "s", get_capabilities, + G_DBUS_METHOD_FLAG_ASYNC }, { } }; diff --git a/client/pbap.c b/client/pbap.c index 46cc09f..34add5c 100644 --- a/client/pbap.c +++ b/client/pbap.c @@ -3,7 +3,7 @@ * OBEX Client * * Copyright (C) 2007-2008 Intel Corporation - * Copyright (C) 2007-2008 Marcel Holtmann <[email protected]> + * Copyright (C) 2007-2009 Marcel Holtmann <[email protected]> * * * This program is free software; you can redistribute it and/or modify @@ -441,6 +441,7 @@ static DBusMessage *pull_phonebook(struct session_data *session, break; default: fprintf(stderr, "Unexpected type : 0x%2x\n", type); + return NULL; } if (session_get(session, "x-bt/phonebook", name, NULL, @@ -615,7 +616,7 @@ static int remove_filter(struct session_data *session, const char *filterstr) return 0; } -static gchar **get_filters(uint64_t filter, gint *size) +static gchar **get_filter_strs(uint64_t filter, gint *size) { gchar **list, **item; gint i; @@ -843,7 +844,7 @@ static DBusMessage *pbap_set_order(DBusConnection *connection, return dbus_message_new_method_return(message); } -static DBusMessage *pbap_set_filters(DBusConnection *connection, +static DBusMessage *pbap_set_filter(DBusConnection *connection, DBusMessage *message, void *user_data) { struct session_data *session = user_data; @@ -876,7 +877,7 @@ done: return dbus_message_new_method_return(message); } -static DBusMessage *pbap_get_filters(DBusConnection *connection, +static DBusMessage *pbap_get_filter(DBusConnection *connection, DBusMessage *message, void *user_data) { struct session_data *session = user_data; @@ -885,7 +886,7 @@ static DBusMessage *pbap_get_filters(DBusConnection *connection, gint size; DBusMessage *reply; - filters = get_filters(pbapdata->filter, &size); + filters = get_filter_strs(pbapdata->filter, &size); reply = dbus_message_new_method_return(message); dbus_message_append_args(reply, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &filters, size, @@ -895,14 +896,14 @@ static DBusMessage *pbap_get_filters(DBusConnection *connection, return reply; } -static DBusMessage *pbap_list_all_filters(DBusConnection *connection, +static DBusMessage *pbap_list_filter_fields(DBusConnection *connection, DBusMessage *message, void *user_data) { gchar **filters = NULL; gint size; DBusMessage *reply; - filters = get_filters(FILTER_ALL, &size); + filters = get_filter_strs(FILTER_ALL, &size); reply = dbus_message_new_method_return(message); dbus_message_append_args(reply, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &filters, size, @@ -926,9 +927,9 @@ static GDBusMethodTable pbap_methods[] = { G_DBUS_METHOD_FLAG_ASYNC }, { "SetFormat", "s", "", pbap_set_format }, { "SetOrder", "s", "", pbap_set_order }, - { "SetFilters", "as", "", pbap_set_filters }, - { "GetFilters", "", "as", pbap_get_filters }, - { "ListAllFilters", "", "as", pbap_list_all_filters }, + { "SetFilter", "as", "", pbap_set_filter }, + { "GetFilter", "", "as", pbap_get_filter }, + { "ListFilterFields", "", "as", pbap_list_filter_fields }, { } }; diff --git a/client/pbap.h b/client/pbap.h index c0513d9..de799cf 100644 --- a/client/pbap.h +++ b/client/pbap.h @@ -3,7 +3,7 @@ * OBEX Client * * Copyright (C) 2007-2008 Intel Corporation - * Copyright (C) 2007-2008 Marcel Holtmann <[email protected]> + * Copyright (C) 2007-2009 Marcel Holtmann <[email protected]> * * * This program is free software; you can redistribute it and/or modify diff --git a/client/session.c b/client/session.c index 0a6decc..4f920d7 100644 --- a/client/session.c +++ b/client/session.c @@ -2,7 +2,7 @@ * * OBEX Client * - * Copyright (C) 2007-2008 Marcel Holtmann <[email protected]> + * Copyright (C) 2007-2009 Marcel Holtmann <[email protected]> * * * This program is free software; you can redistribute it and/or modify @@ -56,6 +56,10 @@ static guint64 counter = 0; +static unsigned char pcsuite_uuid[] = { 0x00, 0x00, 0x50, 0x05, 0x00, 0x00, + 0x10, 0x00, 0x80, 0x00, 0x00, 0x02, + 0xEE, 0x00, 0x00, 0x01 }; + struct callback_data { struct session_data *session; sdp_session_t *sdp; @@ -109,7 +113,7 @@ static void session_unref(struct session_data *session) g_dbus_unregister_interface(session->conn, session->transfer_path, TRANSFER_INTERFACE); - switch (session->uuid) { + switch (session->uuid.value.uuid16) { case OBEX_FILETRANS_SVCLASS_ID: g_dbus_unregister_interface(session->conn, session->path, FTP_INTERFACE); @@ -311,7 +315,6 @@ static gboolean service_callback(GIOChannel *io, GIOCondition cond, struct callback_data *callback = user_data; sdp_list_t *search, *attrid; uint32_t range = 0x0000ffff; - uuid_t uuid; if (cond & (G_IO_NVAL | G_IO_ERR)) goto failed; @@ -319,9 +322,7 @@ static gboolean service_callback(GIOChannel *io, GIOCondition cond, if (sdp_set_notify(callback->sdp, search_callback, callback) < 0) goto failed; - sdp_uuid16_create(&uuid, callback->session->uuid); - - search = sdp_list_append(NULL, &uuid); + search = sdp_list_append(NULL, &callback->session->uuid); attrid = sdp_list_append(NULL, &range); if (sdp_service_search_attr_async(callback->sdp, @@ -404,15 +405,17 @@ int session_create(const char *source, str2ba(destination, &session->dst); if (!g_ascii_strncasecmp(target, "OPP", 3)) { - session->uuid = OBEX_OBJPUSH_SVCLASS_ID; + sdp_uuid16_create(&session->uuid, OBEX_OBJPUSH_SVCLASS_ID); } else if (!g_ascii_strncasecmp(target, "FTP", 3)) { - session->uuid = OBEX_FILETRANS_SVCLASS_ID; + sdp_uuid16_create(&session->uuid, OBEX_FILETRANS_SVCLASS_ID); session->target = OBEX_FTP_UUID; session->target_len = OBEX_FTP_UUID_LEN; } else if (!g_ascii_strncasecmp(target, "PBAP", 4)) { - session->uuid = PBAP_PSE_SVCLASS_ID; + sdp_uuid16_create(&session->uuid, PBAP_PSE_SVCLASS_ID); session->target = OBEX_PBAP_UUID; session->target_len = OBEX_PBAP_UUID_LEN; + } else if (!g_ascii_strncasecmp(target, "PCSUITE", 7)) { + sdp_uuid128_create(&session->uuid, pcsuite_uuid); } else { return -EINVAL; } @@ -1090,9 +1093,10 @@ complete: session->filled); agent_notify_complete(session->conn, session->agent_name, session->agent_path, session->transfer_path); - - callback->func(callback->session, callback->data); } + + callback->func(callback->session, callback->data); + unregister_transfer(session); session_unref(callback->session); @@ -1577,7 +1581,7 @@ int session_pull(struct session_data *session, if (xfer == NULL) return -ENOTCONN; - gw_obex_xfer_set_callback(xfer, get_xfer_progress, callback); + gw_obex_xfer_set_callback(xfer, get_xfer_listing_progress, callback); session->xfer = xfer; @@ -1596,7 +1600,7 @@ int session_register(struct session_data *session) NULL, NULL, session, NULL) == FALSE) return -EIO; - switch (session->uuid) { + switch (session->uuid.value.uuid16) { case OBEX_FILETRANS_SVCLASS_ID: result = g_dbus_register_interface(session->conn, session->path, FTP_INTERFACE, diff --git a/client/session.h b/client/session.h index 1af2503..d502565 100644 --- a/client/session.h +++ b/client/session.h @@ -2,7 +2,7 @@ * * OBEX Client * - * Copyright (C) 2007-2008 Marcel Holtmann <[email protected]> + * Copyright (C) 2007-2009 Marcel Holtmann <[email protected]> * * * This program is free software; you can redistribute it and/or modify @@ -25,6 +25,7 @@ #include <gdbus.h> #include <bluetooth/bluetooth.h> +#include <bluetooth/sdp.h> #include <gw-obex.h> struct session_data { @@ -34,7 +35,7 @@ struct session_data { uint8_t channel; const char *target; /* OBEX Target UUID */ int target_len; - uint16_t uuid; /* Bluetooth Service Class */ + uuid_t uuid; /* Bluetooth Service Class */ gchar *name; _______________________________________________ Commits mailing list [email protected] https://lists.moblin.org/mailman/listinfo/commits
