Merge lp:~bluetooth/ubuntu/lucid/obexd/main into lp:ubuntu/lucid/obexd

Proposed by Baptiste Mille-Mathias
Status: Merged
Merge reported by: James Westby
Merged at revision: not available
Proposed branch: lp:~bluetooth/ubuntu/lucid/obexd/main
Merge into: lp:ubuntu/lucid/obexd
Diff against target: 4906 lines (+1768/-999)
57 files modified
ChangeLog (+12/-0)
Makefile.am (+1/-0)
Makefile.in (+21/-18)
README (+1/-1)
aclocal.m4 (+8/-8)
client/main.c (+50/-13)
client/pbap.c (+8/-7)
client/pbap.h (+2/-2)
client/session.c (+314/-173)
client/session.h (+1/-1)
client/sync.c (+2/-2)
client/sync.h (+2/-2)
config.guess (+79/-139)
config.h.in (+3/-0)
config.sub (+31/-12)
configure (+97/-15)
configure.ac (+14/-4)
debian/changelog (+25/-1)
debian/patches/0001-Revert-Fix-the-session-is-shutdown-when-the-agent-ex.patch (+50/-0)
doc/agent-api.txt (+2/-3)
doc/client-api.txt (+1/-1)
doc/obexd-api.txt (+2/-3)
gdbus/gdbus.h (+11/-6)
gdbus/mainloop.c (+166/-107)
gdbus/object.c (+14/-14)
gdbus/watch.c (+368/-245)
ltmain.sh (+4/-4)
plugins/filesystem.c (+167/-48)
plugins/ftp.c (+8/-9)
plugins/opp.c (+7/-5)
plugins/pbap.c (+10/-3)
plugins/phonebook-dummy.c (+2/-2)
plugins/phonebook-ebook.c (+11/-13)
plugins/phonebook.h (+1/-1)
plugins/syncevolution.c (+29/-70)
plugins/telephony-dummy.c (+2/-2)
plugins/telephony.h (+1/-1)
src/bluetooth.c (+2/-3)
src/bluetooth.h (+2/-3)
src/btio.c (+2/-2)
src/btio.h (+2/-2)
src/dbus.h (+1/-1)
src/logging.c (+1/-1)
src/logging.h (+1/-1)
src/main.c (+1/-1)
src/manager.c (+13/-3)
src/mimetype.c (+83/-1)
src/mimetype.h (+10/-2)
src/obex.c (+86/-24)
src/obex.h (+3/-3)
src/obexd.h (+5/-1)
src/plugin.c (+1/-1)
src/plugin.h (+1/-1)
src/service.c (+8/-4)
src/service.h (+1/-1)
test/ftp-client (+17/-8)
test/main.c (+1/-1)
To merge this branch: bzr merge lp:~bluetooth/ubuntu/lucid/obexd/main
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+24151@code.launchpad.net

Description of the change

Revision of the 0.22-0ubuntu1, (did again, I used import-dsc this time, really better :)

To post a comment you must log in.
5. By Baptiste Mille-Mathias

Revert change in release 0.22 to fix bluetooth-sendto dialog not being

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog'
--- ChangeLog 2010-01-10 10:46:58 +0000
+++ ChangeLog 2010-04-28 20:38:30 +0000
@@ -1,3 +1,15 @@
1ver 0.22:
2 Fix file corruption during PUT operation.
3 Fix the response of PUT requests for PBAP.
4 Fix blocking while waiting capability script to exit.
5 Fix compilation issues with driver and plugin options.
6 Fix service driver selection when WHO header is informed.
7 Fix issue with PC-Suite WHO header.
8 Fix issue when mime type exists but is unknown.
9 Fix issue when opening file fails during SendFiles.
10 Fix error code response when there is no default vCard.
11 Fix a memory leak when opening a folder for listing.
12
1ver 0.21:13ver 0.21:
2 Fix crash caused by D-Bus timeout handling.14 Fix crash caused by D-Bus timeout handling.
3 Fix issue when the object size is unknown.15 Fix issue when the object size is unknown.
416
=== modified file 'Makefile.am'
--- Makefile.am 2010-01-10 10:46:58 +0000
+++ Makefile.am 2010-04-28 20:38:30 +0000
@@ -90,6 +90,7 @@
9090
91client_obex_client_SOURCES = $(gdbus_sources) $(gwobex_sources) client/main.c \91client_obex_client_SOURCES = $(gdbus_sources) $(gwobex_sources) client/main.c \
92 client/session.h client/session.c \92 client/session.h client/session.c \
93 src/logging.h src/logging.c \
93 client/pbap.h client/pbap.c \94 client/pbap.h client/pbap.c \
94 client/sync.h client/sync.c95 client/sync.h client/sync.c
9596
9697
=== modified file 'Makefile.in'
--- Makefile.in 2010-01-10 10:46:58 +0000
+++ Makefile.in 2010-04-28 20:38:30 +0000
@@ -1,4 +1,4 @@
1# Makefile.in generated by automake 1.11 from Makefile.am.1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@2# @configure_input@
33
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -89,8 +89,9 @@
89 gdbus/object.c gdbus/watch.c gwobex/gw-obex.h gwobex/gw-obex.c \89 gdbus/object.c gdbus/watch.c gwobex/gw-obex.h gwobex/gw-obex.c \
90 gwobex/obex-priv.h gwobex/obex-priv.c gwobex/obex-xfer.h \90 gwobex/obex-priv.h gwobex/obex-priv.c gwobex/obex-xfer.h \
91 gwobex/obex-xfer.c gwobex/utils.h gwobex/utils.c gwobex/log.h \91 gwobex/obex-xfer.c gwobex/utils.h gwobex/utils.c gwobex/log.h \
92 client/main.c client/session.h client/session.c client/pbap.h \92 client/main.c client/session.h client/session.c src/logging.h \
93 client/pbap.c client/sync.h client/sync.c93 src/logging.c client/pbap.h client/pbap.c client/sync.h \
94 client/sync.c
94am__dirstamp = $(am__leading_dot)dirstamp95am__dirstamp = $(am__leading_dot)dirstamp
95am__objects_1 = gdbus/mainloop.$(OBJEXT) gdbus/object.$(OBJEXT) \96am__objects_1 = gdbus/mainloop.$(OBJEXT) gdbus/object.$(OBJEXT) \
96 gdbus/watch.$(OBJEXT)97 gdbus/watch.$(OBJEXT)
@@ -98,8 +99,8 @@
98 gwobex/obex-xfer.$(OBJEXT) gwobex/utils.$(OBJEXT)99 gwobex/obex-xfer.$(OBJEXT) gwobex/utils.$(OBJEXT)
99@CLIENT_TRUE@am_client_obex_client_OBJECTS = $(am__objects_1) \100@CLIENT_TRUE@am_client_obex_client_OBJECTS = $(am__objects_1) \
100@CLIENT_TRUE@ $(am__objects_2) client/main.$(OBJEXT) \101@CLIENT_TRUE@ $(am__objects_2) client/main.$(OBJEXT) \
101@CLIENT_TRUE@ client/session.$(OBJEXT) client/pbap.$(OBJEXT) \102@CLIENT_TRUE@ client/session.$(OBJEXT) src/logging.$(OBJEXT) \
102@CLIENT_TRUE@ client/sync.$(OBJEXT)103@CLIENT_TRUE@ client/pbap.$(OBJEXT) client/sync.$(OBJEXT)
103client_obex_client_OBJECTS = $(am_client_obex_client_OBJECTS)104client_obex_client_OBJECTS = $(am_client_obex_client_OBJECTS)
104client_obex_client_DEPENDENCIES =105client_obex_client_DEPENDENCIES =
105AM_V_lt = $(am__v_lt_$(V))106AM_V_lt = $(am__v_lt_$(V))
@@ -354,6 +355,7 @@
354@SERVER_TRUE@test_obex_test_LDADD = @OPENOBEX_LIBS@ @BLUEZ_LIBS@ @GLIB_LIBS@355@SERVER_TRUE@test_obex_test_LDADD = @OPENOBEX_LIBS@ @BLUEZ_LIBS@ @GLIB_LIBS@
355@CLIENT_TRUE@client_obex_client_SOURCES = $(gdbus_sources) $(gwobex_sources) client/main.c \356@CLIENT_TRUE@client_obex_client_SOURCES = $(gdbus_sources) $(gwobex_sources) client/main.c \
356@CLIENT_TRUE@ client/session.h client/session.c \357@CLIENT_TRUE@ client/session.h client/session.c \
358@CLIENT_TRUE@ src/logging.h src/logging.c \
357@CLIENT_TRUE@ client/pbap.h client/pbap.c \359@CLIENT_TRUE@ client/pbap.h client/pbap.c \
358@CLIENT_TRUE@ client/sync.h client/sync.c360@CLIENT_TRUE@ client/sync.h client/sync.c
359361
@@ -552,6 +554,14 @@
552 client/$(DEPDIR)/$(am__dirstamp)554 client/$(DEPDIR)/$(am__dirstamp)
553client/session.$(OBJEXT): client/$(am__dirstamp) \555client/session.$(OBJEXT): client/$(am__dirstamp) \
554 client/$(DEPDIR)/$(am__dirstamp)556 client/$(DEPDIR)/$(am__dirstamp)
557src/$(am__dirstamp):
558 @$(MKDIR_P) src
559 @: > src/$(am__dirstamp)
560src/$(DEPDIR)/$(am__dirstamp):
561 @$(MKDIR_P) src/$(DEPDIR)
562 @: > src/$(DEPDIR)/$(am__dirstamp)
563src/logging.$(OBJEXT): src/$(am__dirstamp) \
564 src/$(DEPDIR)/$(am__dirstamp)
555client/pbap.$(OBJEXT): client/$(am__dirstamp) \565client/pbap.$(OBJEXT): client/$(am__dirstamp) \
556 client/$(DEPDIR)/$(am__dirstamp)566 client/$(DEPDIR)/$(am__dirstamp)
557client/sync.$(OBJEXT): client/$(am__dirstamp) \567client/sync.$(OBJEXT): client/$(am__dirstamp) \
@@ -575,17 +585,9 @@
575 plugins/$(DEPDIR)/$(am__dirstamp)585 plugins/$(DEPDIR)/$(am__dirstamp)
576plugins/syncevolution.$(OBJEXT): plugins/$(am__dirstamp) \586plugins/syncevolution.$(OBJEXT): plugins/$(am__dirstamp) \
577 plugins/$(DEPDIR)/$(am__dirstamp)587 plugins/$(DEPDIR)/$(am__dirstamp)
578src/$(am__dirstamp):
579 @$(MKDIR_P) src
580 @: > src/$(am__dirstamp)
581src/$(DEPDIR)/$(am__dirstamp):
582 @$(MKDIR_P) src/$(DEPDIR)
583 @: > src/$(DEPDIR)/$(am__dirstamp)
584src/main.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)588src/main.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
585src/plugin.$(OBJEXT): src/$(am__dirstamp) \589src/plugin.$(OBJEXT): src/$(am__dirstamp) \
586 src/$(DEPDIR)/$(am__dirstamp)590 src/$(DEPDIR)/$(am__dirstamp)
587src/logging.$(OBJEXT): src/$(am__dirstamp) \
588 src/$(DEPDIR)/$(am__dirstamp)
589src/btio.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)591src/btio.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
590src/manager.$(OBJEXT): src/$(am__dirstamp) \592src/manager.$(OBJEXT): src/$(am__dirstamp) \
591 src/$(DEPDIR)/$(am__dirstamp)593 src/$(DEPDIR)/$(am__dirstamp)
@@ -822,7 +824,8 @@
822 fi; \824 fi; \
823 done825 done
824 -test -n "$(am__skip_mode_fix)" \826 -test -n "$(am__skip_mode_fix)" \
825 || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \827 || find "$(distdir)" -type d ! -perm -755 \
828 -exec chmod u+rwx,go+rx {} \; -o \
826 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \829 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
827 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \830 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
828 ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \831 ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
@@ -866,17 +869,17 @@
866distcheck: dist869distcheck: dist
867 case '$(DIST_ARCHIVES)' in \870 case '$(DIST_ARCHIVES)' in \
868 *.tar.gz*) \871 *.tar.gz*) \
869 GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\872 GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
870 *.tar.bz2*) \873 *.tar.bz2*) \
871 bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\874 bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
872 *.tar.lzma*) \875 *.tar.lzma*) \
873 unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\876 lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
874 *.tar.xz*) \877 *.tar.xz*) \
875 xz -dc $(distdir).tar.xz | $(am__untar) ;;\878 xz -dc $(distdir).tar.xz | $(am__untar) ;;\
876 *.tar.Z*) \879 *.tar.Z*) \
877 uncompress -c $(distdir).tar.Z | $(am__untar) ;;\880 uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
878 *.shar.gz*) \881 *.shar.gz*) \
879 GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\882 GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
880 *.zip*) \883 *.zip*) \
881 unzip $(distdir).zip ;;\884 unzip $(distdir).zip ;;\
882 esac885 esac
883886
=== modified file 'README'
--- README 2009-07-27 19:02:30 +0000
+++ README 2010-04-28 20:38:30 +0000
@@ -1,7 +1,7 @@
1OBEX Server and Client1OBEX Server and Client
2**********************2**********************
33
4Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>4Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
55
66
7Compilation and installation7Compilation and installation
88
=== modified file 'aclocal.m4'
--- aclocal.m4 2009-07-27 19:02:30 +0000
+++ aclocal.m4 2010-04-28 20:38:30 +0000
@@ -1,4 +1,4 @@
1# generated automatically by aclocal 1.11 -*- Autoconf -*-1# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
22
3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.4# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
@@ -7862,15 +7862,15 @@
78627862
7863# Generated from ltversion.in.7863# Generated from ltversion.in.
78647864
7865# serial 3012 ltversion.m47865# serial 3017 ltversion.m4
7866# This file is part of GNU Libtool7866# This file is part of GNU Libtool
78677867
7868m4_define([LT_PACKAGE_VERSION], [2.2.6])7868m4_define([LT_PACKAGE_VERSION], [2.2.6b])
7869m4_define([LT_PACKAGE_REVISION], [1.3012])7869m4_define([LT_PACKAGE_REVISION], [1.3017])
78707870
7871AC_DEFUN([LTVERSION_VERSION],7871AC_DEFUN([LTVERSION_VERSION],
7872[macro_version='2.2.6'7872[macro_version='2.2.6b'
7873macro_revision='1.3012'7873macro_revision='1.3017'
7874_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])7874_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
7875_LT_DECL(, macro_revision, 0)7875_LT_DECL(, macro_revision, 0)
7876])7876])
@@ -8139,7 +8139,7 @@
8139[am__api_version='1.11'8139[am__api_version='1.11'
8140dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to8140dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
8141dnl require some minimum version. Point them to the right macro.8141dnl require some minimum version. Point them to the right macro.
8142m4_if([$1], [1.11], [],8142m4_if([$1], [1.11.1], [],
8143 [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl8143 [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
8144])8144])
81458145
@@ -8155,7 +8155,7 @@
8155# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.8155# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
8156# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.8156# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
8157AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],8157AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
8158[AM_AUTOMAKE_VERSION([1.11])dnl8158[AM_AUTOMAKE_VERSION([1.11.1])dnl
8159m4_ifndef([AC_AUTOCONF_VERSION],8159m4_ifndef([AC_AUTOCONF_VERSION],
8160 [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl8160 [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
8161_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])8161_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
81628162
=== modified file 'client/main.c'
--- client/main.c 2010-01-10 10:46:58 +0000
+++ client/main.c 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Client3 * OBEX Client
4 *4 *
5 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
@@ -29,10 +29,12 @@
29#include <stdlib.h>29#include <stdlib.h>
30#include <string.h>30#include <string.h>
31#include <signal.h>31#include <signal.h>
32#include <syslog.h>
3233
33#include <glib.h>34#include <glib.h>
34#include <gdbus.h>35#include <gdbus.h>
3536
37#include "logging.h"
36#include "session.h"38#include "session.h"
3739
38#define CLIENT_SERVICE "org.openobex.client"40#define CLIENT_SERVICE "org.openobex.client"
@@ -429,6 +431,17 @@
429431
430static GMainLoop *event_loop = NULL;432static GMainLoop *event_loop = NULL;
431433
434static gboolean option_debug = FALSE;
435static gboolean option_stderr = FALSE;
436
437static GOptionEntry options[] = {
438 { "debug", 'd', 0, G_OPTION_ARG_NONE, &option_debug,
439 "Enable debug information output" },
440 { "stderr", 's', 0, G_OPTION_ARG_NONE, &option_stderr,
441 "Write log information to stderr" },
442 { NULL },
443};
444
432static void sig_term(int sig)445static void sig_term(int sig)
433{446{
434 g_main_loop_quit(event_loop);447 g_main_loop_quit(event_loop);
@@ -436,32 +449,56 @@
436449
437int main(int argc, char *argv[])450int main(int argc, char *argv[])
438{451{
452 GOptionContext *context;
439 struct sigaction sa;453 struct sigaction sa;
440 DBusConnection *conn;454 DBusConnection *conn;
441 DBusError err;455 DBusError derr;
442456 GError *gerr = NULL;
443 dbus_error_init(&err);457 int log_option;
444458
445 conn = g_dbus_setup_bus(DBUS_BUS_SESSION, CLIENT_SERVICE, &err);459 context = g_option_context_new(NULL);
446 if (conn == NULL) {460 g_option_context_add_main_entries(context, options, NULL);
447 if (dbus_error_is_set(&err) == TRUE) {461
448 fprintf(stderr, "%s\n", err.message);462 g_option_context_parse(context, &argc, &argv, &gerr);
449 dbus_error_free(&err);463 if (gerr != NULL) {
450 } else464 g_printerr("%s\n", gerr->message);
451 fprintf(stderr, "Can't register with session bus\n");465 g_error_free(gerr);
466 exit(EXIT_FAILURE);
467 }
468
469 g_option_context_free(context);
470
471 dbus_error_init(&derr);
472
473 conn = g_dbus_setup_bus(DBUS_BUS_SESSION, CLIENT_SERVICE, &derr);
474 if (dbus_error_is_set(&derr) == TRUE) {
475 g_printerr("%s: %s\n", derr.name, derr.message);
476 dbus_error_free(&derr);
452 exit(EXIT_FAILURE);477 exit(EXIT_FAILURE);
453 }478 }
454479
455 if (g_dbus_register_interface(conn, CLIENT_PATH, CLIENT_INTERFACE,480 if (g_dbus_register_interface(conn, CLIENT_PATH, CLIENT_INTERFACE,
456 client_methods, NULL, NULL,481 client_methods, NULL, NULL,
457 NULL, NULL) == FALSE) {482 NULL, NULL) == FALSE) {
458 fprintf(stderr, "Can't register client interface\n");483 g_printerr("Can't register client interface\n");
459 dbus_connection_unref(conn);484 dbus_connection_unref(conn);
460 exit(EXIT_FAILURE);485 exit(EXIT_FAILURE);
461 }486 }
462487
463 event_loop = g_main_loop_new(NULL, FALSE);488 event_loop = g_main_loop_new(NULL, FALSE);
464489
490 log_option = LOG_NDELAY | LOG_PID;
491
492 if (option_stderr == TRUE)
493 log_option |= LOG_PERROR;
494
495 openlog("obex-client", log_option, LOG_DAEMON);
496
497 if (option_debug == TRUE) {
498 info("Enabling debug information");
499 enable_debug();
500 }
501
465 memset(&sa, 0, sizeof(sa));502 memset(&sa, 0, sizeof(sa));
466 sa.sa_handler = sig_term;503 sa.sa_handler = sig_term;
467 sigaction(SIGINT, &sa, NULL);504 sigaction(SIGINT, &sa, NULL);
468505
=== modified file 'client/pbap.c'
--- client/pbap.c 2010-01-10 10:46:58 +0000
+++ client/pbap.c 2010-04-28 20:38:30 +0000
@@ -2,8 +2,8 @@
2 *2 *
3 * OBEX Client3 * OBEX Client
4 *4 *
5 * Copyright (C) 2007-2008 Intel Corporation5 * Copyright (C) 2007-2010 Intel Corporation
6 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>6 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
7 *7 *
8 *8 *
9 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
@@ -30,6 +30,7 @@
30#include <glib.h>30#include <glib.h>
31#include <gdbus.h>31#include <gdbus.h>
3232
33#include "logging.h"
33#include "session.h"34#include "session.h"
34#include "pbap.h"35#include "pbap.h"
3536
@@ -298,8 +299,8 @@
298 struct apparam_hdr *hdr = (struct apparam_hdr *) buf;299 struct apparam_hdr *hdr = (struct apparam_hdr *) buf;
299300
300 if (hdr->len > size - APPARAM_HDR_SIZE) {301 if (hdr->len > size - APPARAM_HDR_SIZE) {
301 fprintf(stderr, "Unexpected PBAP pullphonebook app"302 error("Unexpected PBAP pullphonebook app"
302 " length, tag %d, len %d\n",303 " length, tag %d, len %d",
303 hdr->tag, hdr->len);304 hdr->tag, hdr->len);
304 return;305 return;
305 }306 }
@@ -317,8 +318,8 @@
317 *new_missed_calls = hdr->val[0];318 *new_missed_calls = hdr->val[0];
318 break;319 break;
319 default:320 default:
320 fprintf(stderr, "Unexpected PBAP pullphonebook app"321 error("Unexpected PBAP pullphonebook app"
321 " parameter, tag %d, len %d\n",322 " parameter, tag %d, len %d",
322 hdr->tag, hdr->len);323 hdr->tag, hdr->len);
323 }324 }
324325
@@ -443,7 +444,7 @@
443 func = phonebook_size_callback;444 func = phonebook_size_callback;
444 break;445 break;
445 default:446 default:
446 fprintf(stderr, "Unexpected type : 0x%2x\n", type);447 error("Unexpected type : 0x%2x", type);
447 return NULL;448 return NULL;
448 }449 }
449450
450451
=== modified file 'client/pbap.h'
--- client/pbap.h 2009-07-27 19:02:30 +0000
+++ client/pbap.h 2010-04-28 20:38:30 +0000
@@ -2,8 +2,8 @@
2 *2 *
3 * OBEX Client3 * OBEX Client
4 *4 *
5 * Copyright (C) 2007-2008 Intel Corporation5 * Copyright (C) 2007-2010 Intel Corporation
6 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>6 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
7 *7 *
8 *8 *
9 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
1010
=== modified file 'client/session.c'
--- client/session.c 2009-07-27 19:02:30 +0000
+++ client/session.c 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Client3 * OBEX Client
4 *4 *
5 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
@@ -39,6 +39,7 @@
39#include <bluetooth/sdp.h>39#include <bluetooth/sdp.h>
40#include <bluetooth/sdp_lib.h>40#include <bluetooth/sdp_lib.h>
4141
42#include "logging.h"
42#include "pbap.h"43#include "pbap.h"
43#include "sync.h"44#include "sync.h"
44#include "session.h"45#include "session.h"
@@ -55,6 +56,8 @@
5556
56#define DEFAULT_BUFFER_SIZE 409657#define DEFAULT_BUFFER_SIZE 4096
5758
59typedef int (*reply_callback_t) (struct session_data *session, void *data);
60
58static guint64 counter = 0;61static guint64 counter = 0;
5962
60static unsigned char pcsuite_uuid[] = { 0x00, 0x00, 0x50, 0x05, 0x00, 0x00,63static unsigned char pcsuite_uuid[] = { 0x00, 0x00, 0x50, 0x05, 0x00, 0x00,
@@ -68,6 +71,19 @@
68 void *data;71 void *data;
69};72};
7073
74struct pending_request {
75 struct session_data *session;
76 reply_callback_t callback;
77 void *data;
78};
79
80struct get_params {
81 const char *type;
82 const guint8 *apparam;
83 gint apparam_size;
84 session_callback_t func;
85};
86
71static struct session_data *session_ref(struct session_data *session)87static struct session_data *session_ref(struct session_data *session)
72{88{
73 g_atomic_int_inc(&session->refcount);89 g_atomic_int_inc(&session->refcount);
@@ -461,26 +477,6 @@
461 return 0;477 return 0;
462}478}
463479
464static void agent_request(DBusConnection *conn, const char *agent_name,
465 const char *agent_path, const char *transfer_path)
466{
467 DBusMessage *message;
468
469 if (agent_name == NULL || agent_path == NULL || transfer_path == NULL)
470 return;
471
472 message = dbus_message_new_method_call(agent_name,
473 agent_path, AGENT_INTERFACE, "Request");
474
475 dbus_message_append_args(message,
476 DBUS_TYPE_OBJECT_PATH, &transfer_path,
477 DBUS_TYPE_INVALID);
478
479 g_dbus_send_message(conn, message);
480
481 /* FIXME: Reply needs be handled */
482}
483
484static void agent_notify_progress(DBusConnection *conn, const char *agent_name,480static void agent_notify_progress(DBusConnection *conn, const char *agent_name,
485 const char *agent_path, const char *transfer_path,481 const char *agent_path, const char *transfer_path,
486 uint64_t transferred)482 uint64_t transferred)
@@ -592,21 +588,6 @@
592 session_unref(session);588 session_unref(session);
593}589}
594590
595int session_set_agent(struct session_data *session, const char *name,
596 const char *path)
597{
598 if (session == NULL)
599 return -EINVAL;
600
601 if (session->agent_name != NULL || session->agent_path != NULL)
602 return -EALREADY;
603
604 session->agent_name = g_strdup(name);
605 session->agent_path = g_strdup(path);
606
607 return 0;
608}
609
610static void append_entry(DBusMessageIter *dict,591static void append_entry(DBusMessageIter *dict,
611 const char *key, int type, void *val)592 const char *key, int type, void *val)
612{593{
@@ -978,9 +959,11 @@
978959
979static void unregister_transfer(struct session_data *session)960static void unregister_transfer(struct session_data *session)
980{961{
981 gw_obex_xfer_close(session->xfer, NULL);962 if (session->xfer) {
982 gw_obex_xfer_free(session->xfer);963 gw_obex_xfer_close(session->xfer, NULL);
983 session->xfer = NULL;964 gw_obex_xfer_free(session->xfer);
965 session->xfer = NULL;
966 }
984967
985 g_free(session->filename);968 g_free(session->filename);
986 session->filename = NULL;969 session->filename = NULL;
@@ -1081,7 +1064,7 @@
1081 }1064 }
10821065
1083 if (err) {1066 if (err) {
1084 fprintf(stderr, "gw_obex_xfer_read(): %s\n",1067 error("gw_obex_xfer_read(): %s",
1085 OBEX_ResponseToString(err));1068 OBEX_ResponseToString(err));
1086 goto complete;1069 goto complete;
1087 }1070 }
@@ -1157,7 +1140,7 @@
1157 }1140 }
11581141
1159 if (ret == FALSE) {1142 if (ret == FALSE) {
1160 fprintf(stderr, "gw_obex_xfer_read(): %s\n",1143 error("gw_obex_xfer_read(): %s",
1161 OBEX_ResponseToString(err));1144 OBEX_ResponseToString(err));
1162 goto complete;1145 goto complete;
1163 }1146 }
@@ -1215,13 +1198,212 @@
1215 g_free(callback);1198 g_free(callback);
1216}1199}
12171200
1201static void put_xfer_progress(GwObexXfer *xfer, gpointer user_data)
1202{
1203 struct session_data *session = user_data;
1204 ssize_t len;
1205 gint written;
1206
1207 if (session->buffer_len == 0) {
1208 session->buffer_len = DEFAULT_BUFFER_SIZE;
1209 session->buffer = g_new0(char, DEFAULT_BUFFER_SIZE);
1210 }
1211
1212 len = read(session->fd, session->buffer + session->filled,
1213 session->buffer_len - session->filled);
1214 if (len <= 0)
1215 goto complete;
1216
1217 if (gw_obex_xfer_write(xfer, session->buffer, session->filled + len,
1218 &written, NULL) == FALSE)
1219 goto complete;
1220
1221 if (gw_obex_xfer_flush(xfer, NULL) == FALSE)
1222 goto complete;
1223
1224 session->filled = (session->filled + len) - written;
1225
1226 memmove(session->buffer, session->buffer + written, session->filled);
1227
1228 session->transferred += written;
1229
1230 agent_notify_progress(session->conn, session->agent_name,
1231 session->agent_path, session->transfer_path,
1232 session->transferred);
1233 return;
1234
1235complete:
1236 if (len == 0)
1237 agent_notify_complete(session->conn, session->agent_name,
1238 session->agent_path, session->transfer_path);
1239 else
1240 agent_notify_error(session->conn, session->agent_name,
1241 session->agent_path, session->transfer_path,
1242 "Error sending object");
1243
1244 unregister_transfer(session);
1245
1246 if (session->pending->len > 0) {
1247 gchar *filename = g_ptr_array_index(session->pending, 0);
1248 gchar *basename = g_path_get_basename(filename);
1249
1250 g_ptr_array_remove(session->pending, filename);
1251
1252 session_send(session, filename, basename);
1253 g_free(filename);
1254 g_free(basename);
1255 }
1256
1257 session_unref(session);
1258}
1259
1260static void agent_request_reply(DBusPendingCall *call, gpointer user_data)
1261{
1262 struct pending_request *pending = user_data;
1263 struct session_data *session = pending->session;
1264 DBusMessage *reply = dbus_pending_call_steal_reply(call);
1265 const char *name;
1266 DBusError derr;
1267
1268 dbus_error_init(&derr);
1269 if (dbus_set_error_from_message(&derr, reply)) {
1270 error("Replied with an error: %s, %s",
1271 derr.name, derr.message);
1272 dbus_error_free(&derr);
1273 goto fail;
1274 }
1275
1276 dbus_message_get_args(reply, NULL,
1277 DBUS_TYPE_STRING, &name,
1278 DBUS_TYPE_INVALID);
1279
1280 if (strlen(name)) {
1281 g_free(session->name);
1282 session->name = g_strdup(name);
1283 }
1284
1285 if (pending->callback(session, pending->data))
1286 goto fail;
1287
1288 g_free(pending);
1289
1290 return;
1291
1292fail:
1293 unregister_transfer(session);
1294
1295 session_unref(session);
1296
1297 if (session->pending->len > 0) {
1298 gchar *filename = g_ptr_array_index(session->pending, 0);
1299 gchar *basename = g_path_get_basename(filename);
1300
1301 g_ptr_array_remove(session->pending, filename);
1302
1303 session_send(session, filename, basename);
1304 g_free(filename);
1305 g_free(basename);
1306 }
1307
1308 g_free(pending);
1309}
1310
1311static void agent_request(DBusConnection *conn, struct session_data *session,
1312 reply_callback_t cb, void *user_data)
1313{
1314 DBusMessage *message;
1315 DBusPendingCall *call;
1316 struct pending_request *pending;
1317
1318 if (session->agent_name == NULL || session->agent_path == NULL ||
1319 session->transfer_path == NULL) {
1320 if (cb(session, user_data))
1321 goto fail;
1322
1323 return;
1324 }
1325
1326 message = dbus_message_new_method_call(session->agent_name,
1327 session->agent_path, AGENT_INTERFACE, "Request");
1328
1329 dbus_message_append_args(message,
1330 DBUS_TYPE_OBJECT_PATH, &session->transfer_path,
1331 DBUS_TYPE_INVALID);
1332
1333 if (!dbus_connection_send_with_reply(conn, message, &call, -1)) {
1334 dbus_message_unref(message);
1335 return;
1336 }
1337
1338 dbus_message_unref(message);
1339
1340 pending = g_new0(struct pending_request, 1);
1341 pending->session = session;
1342 pending->callback = cb;
1343 pending->data = user_data;
1344
1345 dbus_pending_call_set_notify(call, agent_request_reply, pending, NULL);
1346 dbus_pending_call_unref(call);
1347
1348 return;
1349
1350fail:
1351 unregister_transfer(session);
1352
1353 session_unref(session);
1354}
1355
1356static int session_get_reply(struct session_data *session, void *data)
1357{
1358 struct get_params *params = data;
1359 struct callback_data *callback;
1360 GwObexXfer *xfer;
1361
1362 xfer = gw_obex_get_async_with_apparam(session->obex, session->filename,
1363 params->type, params->apparam, params->apparam_size,
1364 NULL);
1365
1366 if (xfer == NULL) {
1367 close(session->fd);
1368 session_unref(session);
1369 g_free(params);
1370 return -EIO;
1371 }
1372
1373 callback = g_try_malloc0(sizeof(*callback));
1374 if (callback == NULL) {
1375 close(session->fd);
1376 session_unref(session);
1377 gw_obex_xfer_free(xfer);
1378 g_free(params);
1379 return -ENOMEM;
1380 }
1381
1382 callback->session = session;
1383 callback->func = params->func;
1384
1385 if (params->type == NULL)
1386 gw_obex_xfer_set_callback(xfer, get_xfer_progress, callback);
1387 else
1388 gw_obex_xfer_set_callback(xfer, get_xfer_listing_progress,
1389 callback);
1390
1391 session->xfer = xfer;
1392
1393 agent_notify_progress(session->conn, session->agent_name,
1394 session->agent_path, session->transfer_path, 0);
1395
1396 g_free(params);
1397
1398 return 0;
1399}
1400
1218int session_get(struct session_data *session, const char *type,1401int session_get(struct session_data *session, const char *type,
1219 const char *filename, const char *targetname,1402 const char *filename, const char *targetname,
1220 const guint8 *apparam, gint apparam_size,1403 const guint8 *apparam, gint apparam_size,
1221 session_callback_t func)1404 session_callback_t func)
1222{1405{
1223 struct callback_data *callback;1406 struct get_params *params;
1224 GwObexXfer *xfer;
1225 int err, fd = 0;1407 int err, fd = 0;
12261408
1227 if (session->obex == NULL)1409 if (session->obex == NULL)
@@ -1234,12 +1416,13 @@
1234 fd = open(targetname, O_WRONLY | O_CREAT, 0600);1416 fd = open(targetname, O_WRONLY | O_CREAT, 0600);
1235 if (fd < 0) {1417 if (fd < 0) {
1236 err = errno;1418 err = errno;
1237 fprintf(stderr, "open(): %s(%d)\n", strerror(err), err);1419 error("open(): %s(%d)", strerror(err), err);
1238 return -err;1420 return -err;
1239 }1421 }
1240 }1422 }
12411423
1242 if (type == NULL || !g_str_equal(type, "x-obex/folder-listing")) {1424 /* for OBEX specific mime types we don't need to register a transfer */
1425 if (type == NULL || (strncmp(type, "x-obex/", 7) && strncmp(type, "x-bt/", 5))) {
1243 session->transfer_path = register_transfer(session->conn, session);1426 session->transfer_path = register_transfer(session->conn, session);
1244 if (session->transfer_path == NULL) {1427 if (session->transfer_path == NULL) {
1245 if (fd)1428 if (fd)
@@ -1257,38 +1440,13 @@
12571440
1258 session_ref(session);1441 session_ref(session);
12591442
1260 xfer = gw_obex_get_async_with_apparam(session->obex,1443 params = g_new0(struct get_params, 1);
1261 filename, type, apparam, apparam_size, NULL);1444 params->type = type;
1262 if (xfer == NULL) {1445 params->apparam = apparam;
1263 close(session->fd);1446 params->apparam_size = apparam_size;
1264 session_unref(session);1447 params->func = func;
1265 return -EIO;1448
1266 }1449 agent_request(session->conn, session, session_get_reply, params);
1267
1268 callback = g_try_malloc0(sizeof(*callback));
1269 if (callback == NULL) {
1270 close(session->fd);
1271 session_unref(session);
1272 gw_obex_xfer_free(xfer);
1273 return -ENOMEM;
1274 }
1275
1276 callback->session = session;
1277 callback->func = func;
1278
1279 if (type == NULL)
1280 gw_obex_xfer_set_callback(xfer, get_xfer_progress, callback);
1281 else
1282 gw_obex_xfer_set_callback(xfer, get_xfer_listing_progress,
1283 callback);
1284
1285 session->xfer = xfer;
1286
1287 agent_request(session->conn, session->agent_name,
1288 session->agent_path, session->transfer_path);
1289
1290 agent_notify_progress(session->conn, session->agent_name,
1291 session->agent_path, session->transfer_path, 0);
12921450
1293 return 0;1451 return 0;
1294}1452}
@@ -1458,93 +1616,56 @@
1458 { }1616 { }
1459};1617};
14601618
1461static void put_xfer_progress(GwObexXfer *xfer, gpointer user_data)1619
1620static int session_send_reply(struct session_data *session, void *data)
1462{1621{
1463 struct session_data *session = user_data;1622 GwObexXfer *xfer;
1464 ssize_t len;1623
1465 gint written;1624 xfer = gw_obex_put_async(session->obex, session->name, NULL,
14661625 session->size, -1, NULL);
1467 if (session->buffer_len == 0) {1626 if (xfer == NULL)
1468 session->buffer_len = DEFAULT_BUFFER_SIZE;1627 return -ENOTCONN;
1469 session->buffer = g_new0(char, DEFAULT_BUFFER_SIZE);1628
1470 }1629 gw_obex_xfer_set_callback(xfer, put_xfer_progress, session);
14711630
1472 len = read(session->fd, session->buffer + session->filled,1631 session->xfer = xfer;
1473 session->buffer_len - session->filled);
1474 if (len <= 0)
1475 goto complete;
1476
1477 if (gw_obex_xfer_write(xfer, session->buffer, session->filled + len,
1478 &written, NULL) == FALSE)
1479 goto complete;
1480
1481 if (gw_obex_xfer_flush(xfer, NULL) == FALSE)
1482 goto complete;
1483
1484 session->filled = (session->filled + len) - written;
1485
1486 memmove(session->buffer + written, session->buffer, session->filled);
1487
1488 session->transferred += written;
14891632
1490 agent_notify_progress(session->conn, session->agent_name,1633 agent_notify_progress(session->conn, session->agent_name,
1491 session->agent_path, session->transfer_path,1634 session->agent_path, session->transfer_path, 0);
1492 session->transferred);1635
1493 return;1636 return 0;
1494
1495complete:
1496 if (len == 0)
1497 agent_notify_complete(session->conn, session->agent_name,
1498 session->agent_path, session->transfer_path);
1499 else
1500 agent_notify_error(session->conn, session->agent_name,
1501 session->agent_path, session->transfer_path,
1502 "Error sending object");
1503
1504 unregister_transfer(session);
1505
1506 if (session->pending->len > 0) {
1507 gchar *filename = g_ptr_array_index(session->pending, 0);
1508 gchar *basename = g_path_get_basename(filename);
1509
1510 g_ptr_array_remove(session->pending, filename);
1511
1512 session_send(session, filename, basename);
1513 g_free(filename);
1514 g_free(basename);
1515 }
1516
1517 session_unref(session);
1518}1637}
15191638
1520int session_send(struct session_data *session, const char *filename,1639int session_send(struct session_data *session, const char *filename,
1521 const char *targetname)1640 const char *targetname)
1522{1641{
1523 GwObexXfer *xfer;
1524 struct stat st;1642 struct stat st;
1525 int fd;1643 int fd, err;
15261644
1527 if (session->obex == NULL)1645 if (session->obex == NULL)
1528 return -ENOTCONN;1646 return -ENOTCONN;
15291647
1530 if (session->xfer != NULL) {1648 if (session->transfer_path != NULL) {
1531 g_ptr_array_add(session->pending, g_strdup(filename));1649 g_ptr_array_add(session->pending, g_strdup(filename));
1532 return 0;1650 return 0;
1533 }1651 }
15341652
1653 session->transfer_path = register_transfer(session->conn, session);
1654 if (session->transfer_path == NULL) {
1655 err = -EINVAL;
1656 goto fail;
1657 }
1658
1535 fd = open(filename, O_RDONLY);1659 fd = open(filename, O_RDONLY);
1536 if (fd < 0)1660 if (fd < 0) {
1537 return -EIO;1661 err = -EIO;
1662 goto fail;
1663 }
15381664
1539 if (fstat(fd, &st) < 0) {1665 if (fstat(fd, &st) < 0) {
1540 close(fd);1666 close(fd);
1541 return -EIO;1667 err = -EIO;
1542 }1668 goto fail;
1543
1544 session->transfer_path = register_transfer(session->conn, session);
1545 if (session->transfer_path == NULL) {
1546 close(fd);
1547 return -EIO;
1548 }1669 }
15491670
1550 session->fd = fd;1671 session->fd = fd;
@@ -1555,22 +1676,16 @@
15551676
1556 session_ref(session);1677 session_ref(session);
15571678
1558 xfer = gw_obex_put_async(session->obex, session->name, NULL,1679 agent_request(session->conn, session, session_send_reply, NULL);
1559 session->size, -1, NULL);
1560 if (xfer == NULL)
1561 return -ENOTCONN;
1562
1563 gw_obex_xfer_set_callback(xfer, put_xfer_progress, session);
1564
1565 session->xfer = xfer;
1566
1567 agent_request(session->conn, session->agent_name,
1568 session->agent_path, session->transfer_path);
1569
1570 agent_notify_progress(session->conn, session->agent_name,
1571 session->agent_path, session->transfer_path, 0);
15721680
1573 return 0;1681 return 0;
1682
1683fail:
1684 agent_notify_error(session->conn, session->agent_name,
1685 session->agent_path, session->transfer_path,
1686 "Could not open file for sending");
1687
1688 return err;
1574}1689}
15751690
1576int session_pull(struct session_data *session,1691int session_pull(struct session_data *session,
@@ -1695,10 +1810,30 @@
1695 session_unref(session);1810 session_unref(session);
1696}1811}
16971812
1813
1814static int session_put_reply(struct session_data *session, void *data)
1815{
1816 GwObexXfer *xfer;
1817
1818 xfer = gw_obex_put_async(session->obex, session->name, NULL,
1819 session->size, -1, NULL);
1820 if (xfer == NULL)
1821 return -ENOTCONN;
1822
1823 session_ref(session);
1824
1825 gw_obex_xfer_set_callback(xfer, put_buf_xfer_progress, session);
1826
1827 session->xfer = xfer;
1828
1829 agent_notify_progress(session->conn, session->agent_name,
1830 session->agent_path, session->transfer_path, 0);
1831
1832 return 0;
1833}
1834
1698int session_put(struct session_data *session, char *buf, const char *targetname)1835int session_put(struct session_data *session, char *buf, const char *targetname)
1699{1836{
1700 GwObexXfer *xfer;
1701
1702 if (session->obex == NULL)1837 if (session->obex == NULL)
1703 return -ENOTCONN;1838 return -ENOTCONN;
17041839
@@ -1711,22 +1846,28 @@
1711 session->name = g_strdup(targetname);1846 session->name = g_strdup(targetname);
1712 session->buffer = buf;1847 session->buffer = buf;
17131848
1714 xfer = gw_obex_put_async(session->obex, session->name, NULL,1849 agent_request(session->conn, session, session_put_reply, NULL);
1715 session->size, -1, NULL);1850
1716 if (xfer == NULL)1851 return 0;
1717 return -ENOTCONN;1852}
1853
1854int session_set_agent(struct session_data *session, const char *name,
1855 const char *path)
1856{
1857 if (session == NULL)
1858 return -EINVAL;
1859
1860 if (session->agent_name != NULL || session->agent_path != NULL)
1861 return -EALREADY;
1862
1863 session->agent_name = g_strdup(name);
1864 session->agent_path = g_strdup(path);
1865
1866 session->owner_watch = g_dbus_add_disconnect_watch(session->conn,
1867 session->owner, owner_disconnected,
1868 session, NULL);
17181869
1719 session_ref(session);1870 session_ref(session);
17201871
1721 gw_obex_xfer_set_callback(xfer, put_buf_xfer_progress, session);
1722
1723 session->xfer = xfer;
1724
1725 agent_request(session->conn, session->agent_name,
1726 session->agent_path, session->transfer_path);
1727
1728 agent_notify_progress(session->conn, session->agent_name,
1729 session->agent_path, session->transfer_path, 0);
1730
1731 return 0;1872 return 0;
1732}1873}
17331874
=== modified file 'client/session.h'
--- client/session.h 2010-01-10 10:46:58 +0000
+++ client/session.h 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Client3 * OBEX Client
4 *4 *
5 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
99
=== modified file 'client/sync.c'
--- client/sync.c 2009-07-27 19:02:30 +0000
+++ client/sync.c 2010-04-28 20:38:30 +0000
@@ -2,8 +2,8 @@
2 *2 *
3 * OBEX Client3 * OBEX Client
4 *4 *
5 * Copyright (C) 2007-2009 Intel Corporation5 * Copyright (C) 2007-2010 Intel Corporation
6 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>6 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
7 *7 *
8 *8 *
9 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
1010
=== modified file 'client/sync.h'
--- client/sync.h 2009-07-27 19:02:30 +0000
+++ client/sync.h 2010-04-28 20:38:30 +0000
@@ -2,8 +2,8 @@
2 *2 *
3 * OBEX Client3 * OBEX Client
4 *4 *
5 * Copyright (C) 2007-2008 Intel Corporation5 * Copyright (C) 2007-2010 Intel Corporation
6 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>6 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
7 *7 *
8 *8 *
9 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
1010
=== modified file 'config.guess'
--- config.guess 2009-07-27 19:02:30 +0000
+++ config.guess 2010-04-28 20:38:30 +0000
@@ -1,10 +1,10 @@
1#! /bin/sh1#! /bin/sh
2# Attempt to guess a canonical system name.2# Attempt to guess a canonical system name.
3# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,3# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 20084# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
5# Free Software Foundation, Inc.5# Free Software Foundation, Inc.
66
7timestamp='2009-04-27'7timestamp='2009-11-20'
88
9# This file is free software; you can redistribute it and/or modify it9# This file is free software; you can redistribute it and/or modify it
10# under the terms of the GNU General Public License as published by10# under the terms of the GNU General Public License as published by
@@ -27,16 +27,16 @@
27# the same distribution terms that you use for the rest of that program.27# the same distribution terms that you use for the rest of that program.
2828
2929
30# Originally written by Per Bothner <per@bothner.com>.30# Originally written by Per Bothner. Please send patches (context
31# Please send patches to <config-patches@gnu.org>. Submit a context31# diff format) to <config-patches@gnu.org> and include a ChangeLog
32# diff and a properly formatted ChangeLog entry.32# entry.
33#33#
34# This script attempts to guess a canonical system name similar to34# This script attempts to guess a canonical system name similar to
35# config.sub. If it succeeds, it prints the system name on stdout, and35# config.sub. If it succeeds, it prints the system name on stdout, and
36# exits with 0. Otherwise, it exits with 1.36# exits with 0. Otherwise, it exits with 1.
37#37#
38# The plan is that this can be called by configure scripts if you38# You can get the latest version of this script from:
39# don't specify an explicit build system type.39# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
4040
41me=`echo "$0" | sed -e 's,.*/,,'`41me=`echo "$0" | sed -e 's,.*/,,'`
4242
@@ -170,7 +170,7 @@
170 arm*|i386|m68k|ns32k|sh3*|sparc|vax)170 arm*|i386|m68k|ns32k|sh3*|sparc|vax)
171 eval $set_cc_for_build171 eval $set_cc_for_build
172 if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \172 if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
173 | grep __ELF__ >/dev/null173 | grep -q __ELF__
174 then174 then
175 # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).175 # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
176 # Return netbsd for either. FIX?176 # Return netbsd for either. FIX?
@@ -333,6 +333,9 @@
333 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)333 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
334 echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`334 echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
335 exit ;;335 exit ;;
336 i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
337 echo i386-pc-auroraux${UNAME_RELEASE}
338 exit ;;
336 i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)339 i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
337 eval $set_cc_for_build340 eval $set_cc_for_build
338 SUN_ARCH="i386"341 SUN_ARCH="i386"
@@ -656,7 +659,7 @@
656 # => hppa64-hp-hpux11.23659 # => hppa64-hp-hpux11.23
657660
658 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |661 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
659 grep __LP64__ >/dev/null662 grep -q __LP64__
660 then663 then
661 HP_ARCH="hppa2.0w"664 HP_ARCH="hppa2.0w"
662 else665 else
@@ -807,12 +810,12 @@
807 i*:PW*:*)810 i*:PW*:*)
808 echo ${UNAME_MACHINE}-pc-pw32811 echo ${UNAME_MACHINE}-pc-pw32
809 exit ;;812 exit ;;
810 *:Interix*:[3456]*)813 *:Interix*:*)
811 case ${UNAME_MACHINE} in814 case ${UNAME_MACHINE} in
812 x86)815 x86)
813 echo i586-pc-interix${UNAME_RELEASE}816 echo i586-pc-interix${UNAME_RELEASE}
814 exit ;;817 exit ;;
815 EM64T | authenticamd | genuineintel)818 authenticamd | genuineintel | EM64T)
816 echo x86_64-unknown-interix${UNAME_RELEASE}819 echo x86_64-unknown-interix${UNAME_RELEASE}
817 exit ;;820 exit ;;
818 IA64)821 IA64)
@@ -822,6 +825,9 @@
822 [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)825 [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
823 echo i${UNAME_MACHINE}-pc-mks826 echo i${UNAME_MACHINE}-pc-mks
824 exit ;;827 exit ;;
828 8664:Windows_NT:*)
829 echo x86_64-pc-mks
830 exit ;;
825 i*:Windows_NT*:* | Pentium*:Windows_NT*:*)831 i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
826 # How do we know it's Interix rather than the generic POSIX subsystem?832 # How do we know it's Interix rather than the generic POSIX subsystem?
827 # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we833 # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -851,6 +857,20 @@
851 i*86:Minix:*:*)857 i*86:Minix:*:*)
852 echo ${UNAME_MACHINE}-pc-minix858 echo ${UNAME_MACHINE}-pc-minix
853 exit ;;859 exit ;;
860 alpha:Linux:*:*)
861 case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
862 EV5) UNAME_MACHINE=alphaev5 ;;
863 EV56) UNAME_MACHINE=alphaev56 ;;
864 PCA56) UNAME_MACHINE=alphapca56 ;;
865 PCA57) UNAME_MACHINE=alphapca56 ;;
866 EV6) UNAME_MACHINE=alphaev6 ;;
867 EV67) UNAME_MACHINE=alphaev67 ;;
868 EV68*) UNAME_MACHINE=alphaev68 ;;
869 esac
870 objdump --private-headers /bin/sh | grep -q ld.so.1
871 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
872 echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
873 exit ;;
854 arm*:Linux:*:*)874 arm*:Linux:*:*)
855 eval $set_cc_for_build875 eval $set_cc_for_build
856 if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \876 if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -873,6 +893,17 @@
873 frv:Linux:*:*)893 frv:Linux:*:*)
874 echo frv-unknown-linux-gnu894 echo frv-unknown-linux-gnu
875 exit ;;895 exit ;;
896 i*86:Linux:*:*)
897 LIBC=gnu
898 eval $set_cc_for_build
899 sed 's/^ //' << EOF >$dummy.c
900 #ifdef __dietlibc__
901 LIBC=dietlibc
902 #endif
903EOF
904 eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
905 echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
906 exit ;;
876 ia64:Linux:*:*)907 ia64:Linux:*:*)
877 echo ${UNAME_MACHINE}-unknown-linux-gnu908 echo ${UNAME_MACHINE}-unknown-linux-gnu
878 exit ;;909 exit ;;
@@ -882,78 +913,34 @@
882 m68*:Linux:*:*)913 m68*:Linux:*:*)
883 echo ${UNAME_MACHINE}-unknown-linux-gnu914 echo ${UNAME_MACHINE}-unknown-linux-gnu
884 exit ;;915 exit ;;
885 mips:Linux:*:*)916 mips:Linux:*:* | mips64:Linux:*:*)
886 eval $set_cc_for_build917 eval $set_cc_for_build
887 sed 's/^ //' << EOF >$dummy.c918 sed 's/^ //' << EOF >$dummy.c
888 #undef CPU919 #undef CPU
889 #undef mips920 #undef ${UNAME_MACHINE}
890 #undef mipsel921 #undef ${UNAME_MACHINE}el
891 #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)922 #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
892 CPU=mipsel923 CPU=${UNAME_MACHINE}el
893 #else924 #else
894 #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)925 #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
895 CPU=mips926 CPU=${UNAME_MACHINE}
896 #else927 #else
897 CPU=928 CPU=
898 #endif929 #endif
899 #endif930 #endif
900EOF931EOF
901 eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '932 eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
902 /^CPU/{
903 s: ::g
904 p
905 }'`"
906 test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
907 ;;
908 mips64:Linux:*:*)
909 eval $set_cc_for_build
910 sed 's/^ //' << EOF >$dummy.c
911 #undef CPU
912 #undef mips64
913 #undef mips64el
914 #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
915 CPU=mips64el
916 #else
917 #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
918 CPU=mips64
919 #else
920 CPU=
921 #endif
922 #endif
923EOF
924 eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
925 /^CPU/{
926 s: ::g
927 p
928 }'`"
929 test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }933 test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
930 ;;934 ;;
931 or32:Linux:*:*)935 or32:Linux:*:*)
932 echo or32-unknown-linux-gnu936 echo or32-unknown-linux-gnu
933 exit ;;937 exit ;;
934 ppc:Linux:*:*)
935 echo powerpc-unknown-linux-gnu
936 exit ;;
937 ppc64:Linux:*:*)
938 echo powerpc64-unknown-linux-gnu
939 exit ;;
940 alpha:Linux:*:*)
941 case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
942 EV5) UNAME_MACHINE=alphaev5 ;;
943 EV56) UNAME_MACHINE=alphaev56 ;;
944 PCA56) UNAME_MACHINE=alphapca56 ;;
945 PCA57) UNAME_MACHINE=alphapca56 ;;
946 EV6) UNAME_MACHINE=alphaev6 ;;
947 EV67) UNAME_MACHINE=alphaev67 ;;
948 EV68*) UNAME_MACHINE=alphaev68 ;;
949 esac
950 objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
951 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
952 echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
953 exit ;;
954 padre:Linux:*:*)938 padre:Linux:*:*)
955 echo sparc-unknown-linux-gnu939 echo sparc-unknown-linux-gnu
956 exit ;;940 exit ;;
941 parisc64:Linux:*:* | hppa64:Linux:*:*)
942 echo hppa64-unknown-linux-gnu
943 exit ;;
957 parisc:Linux:*:* | hppa:Linux:*:*)944 parisc:Linux:*:* | hppa:Linux:*:*)
958 # Look for CPU level945 # Look for CPU level
959 case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in946 case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@@ -962,8 +949,11 @@
962 *) echo hppa-unknown-linux-gnu ;;949 *) echo hppa-unknown-linux-gnu ;;
963 esac950 esac
964 exit ;;951 exit ;;
965 parisc64:Linux:*:* | hppa64:Linux:*:*)952 ppc64:Linux:*:*)
966 echo hppa64-unknown-linux-gnu953 echo powerpc64-unknown-linux-gnu
954 exit ;;
955 ppc:Linux:*:*)
956 echo powerpc-unknown-linux-gnu
967 exit ;;957 exit ;;
968 s390:Linux:*:* | s390x:Linux:*:*)958 s390:Linux:*:* | s390x:Linux:*:*)
969 echo ${UNAME_MACHINE}-ibm-linux959 echo ${UNAME_MACHINE}-ibm-linux
@@ -986,66 +976,6 @@
986 xtensa*:Linux:*:*)976 xtensa*:Linux:*:*)
987 echo ${UNAME_MACHINE}-unknown-linux-gnu977 echo ${UNAME_MACHINE}-unknown-linux-gnu
988 exit ;;978 exit ;;
989 i*86:Linux:*:*)
990 # The BFD linker knows what the default object file format is, so
991 # first see if it will tell us. cd to the root directory to prevent
992 # problems with other programs or directories called `ld' in the path.
993 # Set LC_ALL=C to ensure ld outputs messages in English.
994 ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
995 | sed -ne '/supported targets:/!d
996 s/[ ][ ]*/ /g
997 s/.*supported targets: *//
998 s/ .*//
999 p'`
1000 case "$ld_supported_targets" in
1001 elf32-i386)
1002 TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
1003 ;;
1004 a.out-i386-linux)
1005 echo "${UNAME_MACHINE}-pc-linux-gnuaout"
1006 exit ;;
1007 "")
1008 # Either a pre-BFD a.out linker (linux-gnuoldld) or
1009 # one that does not give us useful --help.
1010 echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
1011 exit ;;
1012 esac
1013 # Determine whether the default compiler is a.out or elf
1014 eval $set_cc_for_build
1015 sed 's/^ //' << EOF >$dummy.c
1016 #include <features.h>
1017 #ifdef __ELF__
1018 # ifdef __GLIBC__
1019 # if __GLIBC__ >= 2
1020 LIBC=gnu
1021 # else
1022 LIBC=gnulibc1
1023 # endif
1024 # else
1025 LIBC=gnulibc1
1026 # endif
1027 #else
1028 #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
1029 LIBC=gnu
1030 #else
1031 LIBC=gnuaout
1032 #endif
1033 #endif
1034 #ifdef __dietlibc__
1035 LIBC=dietlibc
1036 #endif
1037EOF
1038 eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
1039 /^LIBC/{
1040 s: ::g
1041 p
1042 }'`"
1043 test x"${LIBC}" != x && {
1044 echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
1045 exit
1046 }
1047 test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
1048 ;;
1049 i*86:DYNIX/ptx:4*:*)979 i*86:DYNIX/ptx:4*:*)
1050 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.980 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1051 # earlier versions are messed up and put the nodename in both981 # earlier versions are messed up and put the nodename in both
@@ -1074,7 +1004,7 @@
1074 i*86:syllable:*:*)1004 i*86:syllable:*:*)
1075 echo ${UNAME_MACHINE}-pc-syllable1005 echo ${UNAME_MACHINE}-pc-syllable
1076 exit ;;1006 exit ;;
1077 i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)1007 i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1078 echo i386-unknown-lynxos${UNAME_RELEASE}1008 echo i386-unknown-lynxos${UNAME_RELEASE}
1079 exit ;;1009 exit ;;
1080 i*86:*DOS:*:*)1010 i*86:*DOS:*:*)
@@ -1182,7 +1112,7 @@
1182 rs6000:LynxOS:2.*:*)1112 rs6000:LynxOS:2.*:*)
1183 echo rs6000-unknown-lynxos${UNAME_RELEASE}1113 echo rs6000-unknown-lynxos${UNAME_RELEASE}
1184 exit ;;1114 exit ;;
1185 PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)1115 PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1186 echo powerpc-unknown-lynxos${UNAME_RELEASE}1116 echo powerpc-unknown-lynxos${UNAME_RELEASE}
1187 exit ;;1117 exit ;;
1188 SM[BE]S:UNIX_SV:*:*)1118 SM[BE]S:UNIX_SV:*:*)
@@ -1275,6 +1205,16 @@
1275 *:Darwin:*:*)1205 *:Darwin:*:*)
1276 UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown1206 UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1277 case $UNAME_PROCESSOR in1207 case $UNAME_PROCESSOR in
1208 i386)
1209 eval $set_cc_for_build
1210 if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1211 if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1212 (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1213 grep IS_64BIT_ARCH >/dev/null
1214 then
1215 UNAME_PROCESSOR="x86_64"
1216 fi
1217 fi ;;
1278 unknown) UNAME_PROCESSOR=powerpc ;;1218 unknown) UNAME_PROCESSOR=powerpc ;;
1279 esac1219 esac
1280 echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}1220 echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
12811221
=== modified file 'config.h.in'
--- config.h.in 2009-07-27 19:02:30 +0000
+++ config.h.in 2010-04-28 20:38:30 +0000
@@ -43,6 +43,9 @@
43 */43 */
44#undef LT_OBJDIR44#undef LT_OBJDIR
4545
46/* Define to 1 if you need the dbus_connection_can_send_type() funnction. */
47#undef NEED_DBUS_CONNECTION_CAN_SEND_TYPE
48
46/* Define to 1 if you need the dbus_watch_get_unix_fd() function. */49/* Define to 1 if you need the dbus_watch_get_unix_fd() function. */
47#undef NEED_DBUS_WATCH_GET_UNIX_FD50#undef NEED_DBUS_WATCH_GET_UNIX_FD
4851
4952
=== modified file 'config.sub'
--- config.sub 2009-07-27 19:02:30 +0000
+++ config.sub 2010-04-28 20:38:30 +0000
@@ -1,10 +1,10 @@
1#! /bin/sh1#! /bin/sh
2# Configuration validation subroutine script.2# Configuration validation subroutine script.
3# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,3# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 20084# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
5# Free Software Foundation, Inc.5# Free Software Foundation, Inc.
66
7timestamp='2009-04-17'7timestamp='2009-11-20'
88
9# This file is (in principle) common to ALL GNU software.9# This file is (in principle) common to ALL GNU software.
10# The presence of a machine in this file suggests that SOME GNU software10# The presence of a machine in this file suggests that SOME GNU software
@@ -32,13 +32,16 @@
3232
3333
34# Please send patches to <config-patches@gnu.org>. Submit a context34# Please send patches to <config-patches@gnu.org>. Submit a context
35# diff and a properly formatted ChangeLog entry.35# diff and a properly formatted GNU ChangeLog entry.
36#36#
37# Configuration subroutine to validate and canonicalize a configuration type.37# Configuration subroutine to validate and canonicalize a configuration type.
38# Supply the specified configuration type as an argument.38# Supply the specified configuration type as an argument.
39# If it is invalid, we print an error message on stderr and exit with code 1.39# If it is invalid, we print an error message on stderr and exit with code 1.
40# Otherwise, we print the canonical config type on stdout and succeed.40# Otherwise, we print the canonical config type on stdout and succeed.
4141
42# You can get the latest version of this script from:
43# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
44
42# This file is supposed to be the same for all GNU packages45# This file is supposed to be the same for all GNU packages
43# and recognize all the CPU types, system types and aliases46# and recognize all the CPU types, system types and aliases
44# that are meaningful with *any* GNU software.47# that are meaningful with *any* GNU software.
@@ -149,10 +152,13 @@
149 -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\152 -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
150 -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \153 -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
151 -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \154 -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
152 -apple | -axis | -knuth | -cray)155 -apple | -axis | -knuth | -cray | -microblaze)
153 os=156 os=
154 basic_machine=$1157 basic_machine=$1
155 ;;158 ;;
159 -bluegene*)
160 os=-cnk
161 ;;
156 -sim | -cisco | -oki | -wec | -winbond)162 -sim | -cisco | -oki | -wec | -winbond)
157 os=163 os=
158 basic_machine=$1164 basic_machine=$1
@@ -281,6 +287,7 @@
281 | pdp10 | pdp11 | pj | pjl \287 | pdp10 | pdp11 | pj | pjl \
282 | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \288 | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
283 | pyramid \289 | pyramid \
290 | rx \
284 | score \291 | score \
285 | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \292 | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
286 | sh64 | sh64le \293 | sh64 | sh64le \
@@ -288,13 +295,14 @@
288 | sparcv8 | sparcv9 | sparcv9b | sparcv9v \295 | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
289 | spu | strongarm \296 | spu | strongarm \
290 | tahoe | thumb | tic4x | tic80 | tron \297 | tahoe | thumb | tic4x | tic80 | tron \
298 | ubicom32 \
291 | v850 | v850e \299 | v850 | v850e \
292 | we32k \300 | we32k \
293 | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \301 | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
294 | z8k | z80)302 | z8k | z80)
295 basic_machine=$basic_machine-unknown303 basic_machine=$basic_machine-unknown
296 ;;304 ;;
297 m6811 | m68hc11 | m6812 | m68hc12)305 m6811 | m68hc11 | m6812 | m68hc12 | picochip)
298 # Motorola 68HC11/12.306 # Motorola 68HC11/12.
299 basic_machine=$basic_machine-unknown307 basic_machine=$basic_machine-unknown
300 os=-none308 os=-none
@@ -337,7 +345,7 @@
337 | lm32-* \345 | lm32-* \
338 | m32c-* | m32r-* | m32rle-* \346 | m32c-* | m32r-* | m32rle-* \
339 | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \347 | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
340 | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \348 | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
341 | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \349 | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
342 | mips16-* \350 | mips16-* \
343 | mips64-* | mips64el-* \351 | mips64-* | mips64el-* \
@@ -365,7 +373,7 @@
365 | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \373 | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
366 | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \374 | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
367 | pyramid-* \375 | pyramid-* \
368 | romp-* | rs6000-* \376 | romp-* | rs6000-* | rx-* \
369 | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \377 | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
370 | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \378 | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
371 | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \379 | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
@@ -374,6 +382,7 @@
374 | tahoe-* | thumb-* \382 | tahoe-* | thumb-* \
375 | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \383 | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
376 | tron-* \384 | tron-* \
385 | ubicom32-* \
377 | v850-* | v850e-* | vax-* \386 | v850-* | v850e-* | vax-* \
378 | we32k-* \387 | we32k-* \
379 | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \388 | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
@@ -467,6 +476,10 @@
467 basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`476 basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
468 os=-linux477 os=-linux
469 ;;478 ;;
479 bluegene*)
480 basic_machine=powerpc-ibm
481 os=-cnk
482 ;;
470 c90)483 c90)
471 basic_machine=c90-cray484 basic_machine=c90-cray
472 os=-unicos485 os=-unicos
@@ -719,6 +732,9 @@
719 basic_machine=ns32k-utek732 basic_machine=ns32k-utek
720 os=-sysv733 os=-sysv
721 ;;734 ;;
735 microblaze)
736 basic_machine=microblaze-xilinx
737 ;;
722 mingw32)738 mingw32)
723 basic_machine=i386-pc739 basic_machine=i386-pc
724 os=-mingw32740 os=-mingw32
@@ -1240,6 +1256,9 @@
1240 # First match some system type aliases1256 # First match some system type aliases
1241 # that might get confused with valid system types.1257 # that might get confused with valid system types.
1242 # -solaris* is a basic system type, with this one exception.1258 # -solaris* is a basic system type, with this one exception.
1259 -auroraux)
1260 os=-auroraux
1261 ;;
1243 -solaris1 | -solaris1.*)1262 -solaris1 | -solaris1.*)
1244 os=`echo $os | sed -e 's|solaris1|sunos4|'`1263 os=`echo $os | sed -e 's|solaris1|sunos4|'`
1245 ;;1264 ;;
@@ -1260,9 +1279,9 @@
1260 # Each alternative MUST END IN A *, to match a version number.1279 # Each alternative MUST END IN A *, to match a version number.
1261 # -sysv* is not here because it comes later, after sysvr4.1280 # -sysv* is not here because it comes later, after sysvr4.
1262 -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \1281 -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
1263 | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\1282 | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
1264 | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \1283 | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
1265 | -kopensolaris* \1284 | -sym* | -kopensolaris* \
1266 | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \1285 | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
1267 | -aos* | -aros* \1286 | -aos* | -aros* \
1268 | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \1287 | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
@@ -1283,7 +1302,7 @@
1283 | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \1302 | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
1284 | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \1303 | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
1285 | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \1304 | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
1286 | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)1305 | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
1287 # Remember, each alternative MUST END IN *, to match a version number.1306 # Remember, each alternative MUST END IN *, to match a version number.
1288 ;;1307 ;;
1289 -qnx*)1308 -qnx*)
@@ -1613,7 +1632,7 @@
1613 -sunos*)1632 -sunos*)
1614 vendor=sun1633 vendor=sun
1615 ;;1634 ;;
1616 -aix*)1635 -cnk*|-aix*)
1617 vendor=ibm1636 vendor=ibm
1618 ;;1637 ;;
1619 -beos*)1638 -beos*)
16201639
=== modified file 'configure'
--- configure 2010-01-10 10:46:58 +0000
+++ configure 2010-04-28 20:38:30 +0000
@@ -1,6 +1,6 @@
1#! /bin/sh1#! /bin/sh
2# Guess values for system-dependent variables and create Makefiles.2# Guess values for system-dependent variables and create Makefiles.
3# Generated by GNU Autoconf 2.63 for obexd 0.21.3# Generated by GNU Autoconf 2.63 for obexd 0.22.
4#4#
5# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,5# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
6# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.6# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
@@ -743,8 +743,8 @@
743# Identity of this package.743# Identity of this package.
744PACKAGE_NAME='obexd'744PACKAGE_NAME='obexd'
745PACKAGE_TARNAME='obexd'745PACKAGE_TARNAME='obexd'
746PACKAGE_VERSION='0.21'746PACKAGE_VERSION='0.22'
747PACKAGE_STRING='obexd 0.21'747PACKAGE_STRING='obexd 0.22'
748PACKAGE_BUGREPORT=''748PACKAGE_BUGREPORT=''
749749
750ac_default_prefix=/usr/local750ac_default_prefix=/usr/local
@@ -1509,7 +1509,7 @@
1509 # Omit some internal or obsolete options to make the list less imposing.1509 # Omit some internal or obsolete options to make the list less imposing.
1510 # This message is too long to be a string in the A/UX 3.1 sh.1510 # This message is too long to be a string in the A/UX 3.1 sh.
1511 cat <<_ACEOF1511 cat <<_ACEOF
1512\`configure' configures obexd 0.21 to adapt to many kinds of systems.1512\`configure' configures obexd 0.22 to adapt to many kinds of systems.
15131513
1514Usage: $0 [OPTION]... [VAR=VALUE]...1514Usage: $0 [OPTION]... [VAR=VALUE]...
15151515
@@ -1579,7 +1579,7 @@
15791579
1580if test -n "$ac_init_help"; then1580if test -n "$ac_init_help"; then
1581 case $ac_init_help in1581 case $ac_init_help in
1582 short | recursive ) echo "Configuration of obexd 0.21:";;1582 short | recursive ) echo "Configuration of obexd 0.22:";;
1583 esac1583 esac
1584 cat <<\_ACEOF1584 cat <<\_ACEOF
15851585
@@ -1706,7 +1706,7 @@
1706test -n "$ac_init_help" && exit $ac_status1706test -n "$ac_init_help" && exit $ac_status
1707if $ac_init_version; then1707if $ac_init_version; then
1708 cat <<\_ACEOF1708 cat <<\_ACEOF
1709obexd configure 0.211709obexd configure 0.22
1710generated by GNU Autoconf 2.631710generated by GNU Autoconf 2.63
17111711
1712Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,1712Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1720,7 +1720,7 @@
1720This file contains any messages produced by compilers while1720This file contains any messages produced by compilers while
1721running configure, to aid debugging if configure makes a mistake.1721running configure, to aid debugging if configure makes a mistake.
17221722
1723It was created by obexd $as_me 0.21, which was1723It was created by obexd $as_me 0.22, which was
1724generated by GNU Autoconf 2.63. Invocation command line was1724generated by GNU Autoconf 2.63. Invocation command line was
17251725
1726 $ $0 $@1726 $ $0 $@
@@ -2570,7 +2570,7 @@
25702570
2571# Define the identity of the package.2571# Define the identity of the package.
2572 PACKAGE='obexd'2572 PACKAGE='obexd'
2573 VERSION='0.21'2573 VERSION='0.22'
25742574
25752575
2576cat >>confdefs.h <<_ACEOF2576cat >>confdefs.h <<_ACEOF
@@ -4040,8 +4040,8 @@
40404040
40414041
40424042
4043macro_version='2.2.6'4043macro_version='2.2.6b'
4044macro_revision='1.3012'4044macro_revision='1.3017'
40454045
40464046
40474047
@@ -11932,6 +11932,81 @@
1193211932
11933fi11933fi
1193411934
11935{ $as_echo "$as_me:$LINENO: checking for dbus_connection_can_send_type in -ldbus-1" >&5
11936$as_echo_n "checking for dbus_connection_can_send_type in -ldbus-1... " >&6; }
11937if test "${ac_cv_lib_dbus_1_dbus_connection_can_send_type+set}" = set; then
11938 $as_echo_n "(cached) " >&6
11939else
11940 ac_check_lib_save_LIBS=$LIBS
11941LIBS="-ldbus-1 $LIBS"
11942cat >conftest.$ac_ext <<_ACEOF
11943/* confdefs.h. */
11944_ACEOF
11945cat confdefs.h >>conftest.$ac_ext
11946cat >>conftest.$ac_ext <<_ACEOF
11947/* end confdefs.h. */
11948
11949/* Override any GCC internal prototype to avoid an error.
11950 Use char because int might match the return type of a GCC
11951 builtin and then its argument prototype would still apply. */
11952#ifdef __cplusplus
11953extern "C"
11954#endif
11955char dbus_connection_can_send_type ();
11956int
11957main ()
11958{
11959return dbus_connection_can_send_type ();
11960 ;
11961 return 0;
11962}
11963_ACEOF
11964rm -f conftest.$ac_objext conftest$ac_exeext
11965if { (ac_try="$ac_link"
11966case "(($ac_try" in
11967 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
11968 *) ac_try_echo=$ac_try;;
11969esac
11970eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
11971$as_echo "$ac_try_echo") >&5
11972 (eval "$ac_link") 2>conftest.er1
11973 ac_status=$?
11974 grep -v '^ *+' conftest.er1 >conftest.err
11975 rm -f conftest.er1
11976 cat conftest.err >&5
11977 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
11978 (exit $ac_status); } && {
11979 test -z "$ac_c_werror_flag" ||
11980 test ! -s conftest.err
11981 } && test -s conftest$ac_exeext && {
11982 test "$cross_compiling" = yes ||
11983 $as_test_x conftest$ac_exeext
11984 }; then
11985 ac_cv_lib_dbus_1_dbus_connection_can_send_type=yes
11986else
11987 $as_echo "$as_me: failed program was:" >&5
11988sed 's/^/| /' conftest.$ac_ext >&5
11989
11990 ac_cv_lib_dbus_1_dbus_connection_can_send_type=no
11991fi
11992
11993rm -rf conftest.dSYM
11994rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
11995 conftest$ac_exeext conftest.$ac_ext
11996LIBS=$ac_check_lib_save_LIBS
11997fi
11998{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dbus_1_dbus_connection_can_send_type" >&5
11999$as_echo "$ac_cv_lib_dbus_1_dbus_connection_can_send_type" >&6; }
12000if test "x$ac_cv_lib_dbus_1_dbus_connection_can_send_type" = x""yes; then
12001 dummy=yes
12002else
12003
12004cat >>confdefs.h <<\_ACEOF
12005#define NEED_DBUS_CONNECTION_CAN_SEND_TYPE 1
12006_ACEOF
12007
12008fi
12009
1193512010
1193612011
1193712012
@@ -12102,13 +12177,16 @@
1210212177
12103fi12178fi
1210412179
12105
12106phonebook_driver=dummy12180phonebook_driver=dummy
1210712181
12108# Check whether --with-phonebook was given.12182# Check whether --with-phonebook was given.
12109if test "${with_phonebook+set}" = set; then12183if test "${with_phonebook+set}" = set; then
12110 withval=$with_phonebook;12184 withval=$with_phonebook;
12111 phonebook_driver=${withval}12185 if (test "${withval}" = "no"); then
12186 phonebook_driver=dummy;
12187 else
12188 phonebook_driver=${withval};
12189 fi
1211212190
12113fi12191fi
1211412192
@@ -12277,7 +12355,11 @@
12277# Check whether --with-telephony was given.12355# Check whether --with-telephony was given.
12278if test "${with_telephony+set}" = set; then12356if test "${with_telephony+set}" = set; then
12279 withval=$with_telephony;12357 withval=$with_telephony;
12280 telephony_driver=${withval}12358 if (test "${withval}" = "no"); then
12359 telephony_driver=dummy;
12360 else
12361 telephony_driver=${withval};
12362 fi
1228112363
12282fi12364fi
1228312365
@@ -12781,7 +12863,7 @@
12781# report actual input values of CONFIG_FILES etc. instead of their12863# report actual input values of CONFIG_FILES etc. instead of their
12782# values after options handling.12864# values after options handling.
12783ac_log="12865ac_log="
12784This file was extended by obexd $as_me 0.21, which was12866This file was extended by obexd $as_me 0.22, which was
12785generated by GNU Autoconf 2.63. Invocation command line was12867generated by GNU Autoconf 2.63. Invocation command line was
1278612868
12787 CONFIG_FILES = $CONFIG_FILES12869 CONFIG_FILES = $CONFIG_FILES
@@ -12844,7 +12926,7 @@
12844_ACEOF12926_ACEOF
12845cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=112927cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
12846ac_cs_version="\\12928ac_cs_version="\\
12847obexd config.status 0.2112929obexd config.status 0.22
12848configured by $0, generated by GNU Autoconf 2.63,12930configured by $0, generated by GNU Autoconf 2.63,
12849 with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"12931 with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
1285012932
1285112933
=== modified file 'configure.ac'
--- configure.ac 2010-01-10 10:46:58 +0000
+++ configure.ac 2010-04-28 20:38:30 +0000
@@ -1,5 +1,5 @@
1AC_PREREQ(2.60)1AC_PREREQ(2.60)
2AC_INIT(obexd, 0.21)2AC_INIT(obexd, 0.22)
33
4AM_INIT_AUTOMAKE([foreign subdir-objects])4AM_INIT_AUTOMAKE([foreign subdir-objects])
5AM_CONFIG_HEADER(config.h)5AM_CONFIG_HEADER(config.h)
@@ -76,6 +76,9 @@
76AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes,76AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes,
77 AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1,77 AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1,
78 [Define to 1 if you need the dbus_watch_get_unix_fd() function.]))78 [Define to 1 if you need the dbus_watch_get_unix_fd() function.]))
79AC_CHECK_LIB(dbus-1, dbus_connection_can_send_type, dummy=yes,
80 AC_DEFINE(NEED_DBUS_CONNECTION_CAN_SEND_TYPE, 1,
81 [Define to 1 if you need the dbus_connection_can_send_type() funnction.]))
79AC_SUBST(DBUS_CFLAGS)82AC_SUBST(DBUS_CFLAGS)
80AC_SUBST(DBUS_LIBS)83AC_SUBST(DBUS_LIBS)
8184
@@ -102,10 +105,13 @@
102 CFLAGS="$CFLAGS -g"105 CFLAGS="$CFLAGS -g"
103 fi106 fi
104])107])
105
106phonebook_driver=dummy108phonebook_driver=dummy
107AC_ARG_WITH(phonebook, AC_HELP_STRING([--with-phonebook=DRIVER], [select phonebook driver]), [109AC_ARG_WITH(phonebook, AC_HELP_STRING([--with-phonebook=DRIVER], [select phonebook driver]), [
108 phonebook_driver=${withval}110 if (test "${withval}" = "no"); then
111 phonebook_driver=dummy;
112 else
113 phonebook_driver=${withval};
114 fi
109])115])
110116
111if (test "${phonebook_driver}" = "ebook"); then117if (test "${phonebook_driver}" = "ebook"); then
@@ -126,7 +132,11 @@
126132
127telephony_driver=dummy133telephony_driver=dummy
128AC_ARG_WITH(telephony, AC_HELP_STRING([--with-telephony=DRIVER], [select telephony driver]), [134AC_ARG_WITH(telephony, AC_HELP_STRING([--with-telephony=DRIVER], [select telephony driver]), [
129 telephony_driver=${withval}135 if (test "${withval}" = "no"); then
136 telephony_driver=dummy;
137 else
138 telephony_driver=${withval};
139 fi
130])140])
131141
132AC_SUBST([TELEPHONY_DRIVER], [telephony-${telephony_driver}.c])142AC_SUBST([TELEPHONY_DRIVER], [telephony-${telephony_driver}.c])
133143
=== modified file 'debian/changelog'
--- debian/changelog 2010-01-10 10:46:58 +0000
+++ debian/changelog 2010-04-28 20:38:30 +0000
@@ -1,4 +1,28 @@
1obexd (0.21-0ubuntu1) lucid; urgency=low1obexd (0.22-0ubuntu2) lucid-proposed; urgency=low
2
3 * debian/patches/0001-Revert-Fix-the-session-is-shutdown-when-the-agent-ex.patch
4 - Revert change in release 0.22 to fix bluetooth-sendto dialog not being
5 closed after transfer (LP: #559412)
6
7 -- Baptiste Mille-Mathias <baptiste.millemathias@gmail.com> Wed, 28 Apr 2010 21:20:16 +0200
8
9obexd (0.22-0ubuntu1) lucid; urgency=low
10
11 * New upstream release (LP: #539914):
12 - Fix file corruption during PUT operation. (LP: #421684]
13 - Fix the response of PUT requests for PBAP.
14 - Fix blocking while waiting capability script to exit.
15 - Fix compilation issues with driver and plugin options.
16 - Fix service driver selection when WHO header is informed.
17 - Fix issue with PC-Suite WHO header.
18 - Fix issue when mime type exists but is unknown.
19 - Fix issue when opening file fails during SendFiles.
20 - Fix error code response when there is no default vCard.
21 - Fix a memory leak when opening a folder for listing.
22
23 -- Baptiste Mille-Mathias <baptiste.millemathias@gmail.com> Mon, 15 Mar 2010 20:43:06 +0100
24
25obexd (0.21-0ubuntu1) karmic; urgency=low
226
3 * New upstream release: (LP: #505432)27 * New upstream release: (LP: #505432)
4 - Fix crash caused by D-Bus timeout handling.28 - Fix crash caused by D-Bus timeout handling.
529
=== added directory 'debian/patches'
=== added file 'debian/patches/0001-Revert-Fix-the-session-is-shutdown-when-the-agent-ex.patch'
--- debian/patches/0001-Revert-Fix-the-session-is-shutdown-when-the-agent-ex.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/0001-Revert-Fix-the-session-is-shutdown-when-the-agent-ex.patch 2010-04-28 20:38:30 +0000
@@ -0,0 +1,50 @@
1diff -Nur -x '*.orig' -x '*~' obexd/client/session.c obexd.new/client/session.c
2--- obexd/client/session.c 2010-04-26 21:41:26.362047000 +0200
3+++ obexd.new/client/session.c 2010-04-28 22:32:26.726018633 +0200
4@@ -588,6 +588,21 @@
5 session_unref(session);
6 }
7
8+int session_set_agent(struct session_data *session, const char *name,
9+ const char *path)
10+{
11+ if (session == NULL)
12+ return -EINVAL;
13+
14+ if (session->agent_name != NULL || session->agent_path != NULL)
15+ return -EALREADY;
16+
17+ session->agent_name = g_strdup(name);
18+ session->agent_path = g_strdup(path);
19+
20+ return 0;
21+}
22+
23 static void append_entry(DBusMessageIter *dict,
24 const char *key, int type, void *val)
25 {
26@@ -1850,24 +1865,3 @@
27
28 return 0;
29 }
30-
31-int session_set_agent(struct session_data *session, const char *name,
32- const char *path)
33-{
34- if (session == NULL)
35- return -EINVAL;
36-
37- if (session->agent_name != NULL || session->agent_path != NULL)
38- return -EALREADY;
39-
40- session->agent_name = g_strdup(name);
41- session->agent_path = g_strdup(path);
42-
43- session->owner_watch = g_dbus_add_disconnect_watch(session->conn,
44- session->owner, owner_disconnected,
45- session, NULL);
46-
47- session_ref(session);
48-
49- return 0;
50-}
051
=== modified file 'doc/agent-api.txt'
--- doc/agent-api.txt 2009-07-27 19:02:30 +0000
+++ doc/agent-api.txt 2010-04-28 20:38:30 +0000
@@ -1,9 +1,8 @@
1obexd Agent API description1obexd Agent API description
2**********************************2**********************************
33
4Copyright (C) 2007-2008 Nokia Corporation4Copyright (C) 2007-2010 Nokia Corporation
5Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT)5Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6Copyright (C) 2007-2008 Marcel Holtmann <marcel@holtmann.org>
76
87
9Agent hierarchy8Agent hierarchy
109
=== modified file 'doc/client-api.txt'
--- doc/client-api.txt 2010-01-10 10:46:58 +0000
+++ doc/client-api.txt 2010-04-28 20:38:30 +0000
@@ -1,7 +1,7 @@
1OBEX client API description1OBEX client API description
2***************************2***************************
33
4Copyright (C) 2007-2008 Marcel Holtmann <marcel@holtmann.org>4Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
55
66
7Client hierarchy7Client hierarchy
88
=== modified file 'doc/obexd-api.txt'
--- doc/obexd-api.txt 2009-07-27 19:02:30 +0000
+++ doc/obexd-api.txt 2010-04-28 20:38:30 +0000
@@ -1,9 +1,8 @@
1obexd API description1obexd API description
2**********************************2**********************************
33
4Copyright (C) 2007-2008 Nokia Corporation4Copyright (C) 2007-2010 Nokia Corporation
5Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT)5Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6Copyright (C) 2007-2008 Marcel Holtmann <marcel@holtmann.org>
76
87
9Manager hierarchy8Manager hierarchy
109
=== modified file 'gdbus/gdbus.h'
--- gdbus/gdbus.h 2010-01-10 10:46:58 +0000
+++ gdbus/gdbus.h 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * D-Bus helper library3 * D-Bus helper library
4 *4 *
5 * Copyright (C) 2004-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
@@ -40,6 +40,9 @@
40DBusConnection *g_dbus_setup_bus(DBusBusType type, const char *name,40DBusConnection *g_dbus_setup_bus(DBusBusType type, const char *name,
41 DBusError *error);41 DBusError *error);
4242
43DBusConnection *g_dbus_setup_private(DBusBusType type, const char *name,
44 DBusError *error);
45
43gboolean g_dbus_request_name(DBusConnection *connection, const char *name,46gboolean g_dbus_request_name(DBusConnection *connection, const char *name,
44 DBusError *error);47 DBusError *error);
4548
@@ -88,9 +91,9 @@
8891
89gboolean g_dbus_register_interface(DBusConnection *connection,92gboolean g_dbus_register_interface(DBusConnection *connection,
90 const char *path, const char *name,93 const char *path, const char *name,
91 GDBusMethodTable *methods,94 const GDBusMethodTable *methods,
92 GDBusSignalTable *signals,95 const GDBusSignalTable *signals,
93 GDBusPropertyTable *properties,96 const GDBusPropertyTable *properties,
94 void *user_data,97 void *user_data,
95 GDBusDestroyFunction destroy);98 GDBusDestroyFunction destroy);
96gboolean g_dbus_unregister_interface(DBusConnection *connection,99gboolean g_dbus_unregister_interface(DBusConnection *connection,
@@ -125,8 +128,10 @@
125 GDBusWatchFunction function,128 GDBusWatchFunction function,
126 void *user_data, GDBusDestroyFunction destroy);129 void *user_data, GDBusDestroyFunction destroy);
127guint g_dbus_add_signal_watch(DBusConnection *connection,130guint g_dbus_add_signal_watch(DBusConnection *connection,
128 const char *rule, GDBusSignalFunction function,131 const char *sender, const char *path,
129 void *user_data, GDBusDestroyFunction destroy);132 const char *interface, const char *member,
133 GDBusSignalFunction function, void *user_data,
134 GDBusDestroyFunction destroy);
130gboolean g_dbus_remove_watch(DBusConnection *connection, guint tag);135gboolean g_dbus_remove_watch(DBusConnection *connection, guint tag);
131void g_dbus_remove_all_watches(DBusConnection *connection);136void g_dbus_remove_all_watches(DBusConnection *connection);
132137
133138
=== modified file 'gdbus/mainloop.c'
--- gdbus/mainloop.c 2010-01-10 10:46:58 +0000
+++ gdbus/mainloop.c 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * D-Bus helper library3 * D-Bus helper library
4 *4 *
5 * Copyright (C) 2004-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
@@ -25,8 +25,6 @@
25#include <config.h>25#include <config.h>
26#endif26#endif
2727
28#include <stdint.h>
29
30#include <glib.h>28#include <glib.h>
31#include <dbus/dbus.h>29#include <dbus/dbus.h>
3230
@@ -42,116 +40,131 @@
42#define error(fmt...)40#define error(fmt...)
43#define debug(fmt...)41#define debug(fmt...)
4442
45typedef struct {43struct timeout_handler {
46 uint32_t id;44 guint id;
47 DBusTimeout *timeout;45 DBusTimeout *timeout;
48} timeout_handler_t;46};
4947
50struct watch_info {48struct watch_info {
51 guint watch_id;49 guint id;
52 GIOChannel *io;50 DBusWatch *watch;
53 DBusConnection *conn;51 DBusConnection *conn;
54};52};
5553
56struct server_info {
57 guint watch_id;
58 GIOChannel *io;
59 DBusServer *server;
60};
61
62struct disconnect_data {54struct disconnect_data {
63 GDBusWatchFunction disconnect_cb;55 GDBusWatchFunction function;
64 void *user_data;56 void *user_data;
65};57};
6658
67static DBusHandlerResult disconnect_filter(DBusConnection *conn,59static gboolean disconnected_signal(DBusConnection *conn,
68 DBusMessage *msg, void *data)60 DBusMessage *msg, void *data)
69{61{
70 struct disconnect_data *dc_data = data;62 struct disconnect_data *dc_data = data;
7163
72 if (dbus_message_is_signal(msg,64 error("Got disconnected from the system message bus");
73 DBUS_INTERFACE_LOCAL, "Disconnected") == TRUE) {65
74 error("Got disconnected from the system message bus");66 dc_data->function(conn, dc_data->user_data);
75 dc_data->disconnect_cb(conn, dc_data->user_data);67
76 dbus_connection_unref(conn);68 dbus_connection_unref(conn);
77 }69
7870 return TRUE;
79 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
80}71}
8172
82static gboolean message_dispatch_cb(void *data)73static gboolean message_dispatch(void *data)
83{74{
84 DBusConnection *connection = data;75 DBusConnection *conn = data;
8576
86 dbus_connection_ref(connection);77 dbus_connection_ref(conn);
8778
88 /* Dispatch messages */79 /* Dispatch messages */
89 while (dbus_connection_dispatch(connection) == DBUS_DISPATCH_DATA_REMAINS);80 while (dbus_connection_dispatch(conn) == DBUS_DISPATCH_DATA_REMAINS);
9081
91 dbus_connection_unref(connection);82 dbus_connection_unref(conn);
9283
93 return FALSE;84 return FALSE;
94}85}
9586
87static inline void queue_dispatch(DBusConnection *conn,
88 DBusDispatchStatus status)
89{
90 if (status == DBUS_DISPATCH_DATA_REMAINS)
91 g_timeout_add(DISPATCH_TIMEOUT, message_dispatch, conn);
92}
93
96static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data)94static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data)
97{95{
98 DBusWatch *watch = data;96 struct watch_info *info = data;
99 struct watch_info *info = dbus_watch_get_data(watch);97 unsigned int flags = 0;
100 int flags = 0;98
99 dbus_connection_ref(info->conn);
101100
102 if (cond & G_IO_IN) flags |= DBUS_WATCH_READABLE;101 if (cond & G_IO_IN) flags |= DBUS_WATCH_READABLE;
103 if (cond & G_IO_OUT) flags |= DBUS_WATCH_WRITABLE;102 if (cond & G_IO_OUT) flags |= DBUS_WATCH_WRITABLE;
104 if (cond & G_IO_HUP) flags |= DBUS_WATCH_HANGUP;103 if (cond & G_IO_HUP) flags |= DBUS_WATCH_HANGUP;
105 if (cond & G_IO_ERR) flags |= DBUS_WATCH_ERROR;104 if (cond & G_IO_ERR) flags |= DBUS_WATCH_ERROR;
106105
107 dbus_watch_handle(watch, flags);106 dbus_watch_handle(info->watch, flags);
108107
109 if (dbus_connection_get_dispatch_status(info->conn) == DBUS_DISPATCH_DATA_REMAINS)108 dbus_connection_unref(info->conn);
110 g_timeout_add(DISPATCH_TIMEOUT, message_dispatch_cb, info->conn);
111109
112 return TRUE;110 return TRUE;
113}111}
114112
113static void watch_info_free(void *data)
114{
115 struct watch_info *info = data;
116
117 if (info->id > 0) {
118 g_source_remove(info->id);
119 info->id = 0;
120 }
121
122 dbus_connection_unref(info->conn);
123
124 g_free(info);
125}
126
115static dbus_bool_t add_watch(DBusWatch *watch, void *data)127static dbus_bool_t add_watch(DBusWatch *watch, void *data)
116{128{
129 DBusConnection *conn = data;
117 GIOCondition cond = G_IO_HUP | G_IO_ERR;130 GIOCondition cond = G_IO_HUP | G_IO_ERR;
118 DBusConnection *conn = data;131 GIOChannel *chan;
119 struct watch_info *info;132 struct watch_info *info;
120 int fd, flags;133 unsigned int flags;
134 int fd;
121135
122 if (!dbus_watch_get_enabled(watch))136 if (!dbus_watch_get_enabled(watch))
123 return TRUE;137 return TRUE;
124138
125 info = g_new(struct watch_info, 1);139 info = g_new0(struct watch_info, 1);
126140
127 fd = dbus_watch_get_unix_fd(watch);141 fd = dbus_watch_get_unix_fd(watch);
128 info->io = g_io_channel_unix_new(fd);142 chan = g_io_channel_unix_new(fd);
143
144 info->watch = watch;
129 info->conn = dbus_connection_ref(conn);145 info->conn = dbus_connection_ref(conn);
130146
131 dbus_watch_set_data(watch, info, NULL);147 dbus_watch_set_data(watch, info, watch_info_free);
132148
133 flags = dbus_watch_get_flags(watch);149 flags = dbus_watch_get_flags(watch);
134150
135 if (flags & DBUS_WATCH_READABLE) cond |= G_IO_IN;151 if (flags & DBUS_WATCH_READABLE) cond |= G_IO_IN;
136 if (flags & DBUS_WATCH_WRITABLE) cond |= G_IO_OUT;152 if (flags & DBUS_WATCH_WRITABLE) cond |= G_IO_OUT;
137153
138 info->watch_id = g_io_add_watch(info->io, cond, watch_func, watch);154 info->id = g_io_add_watch(chan, cond, watch_func, info);
155
156 g_io_channel_unref(chan);
139157
140 return TRUE;158 return TRUE;
141}159}
142160
143static void remove_watch(DBusWatch *watch, void *data)161static void remove_watch(DBusWatch *watch, void *data)
144{162{
145 struct watch_info *info = dbus_watch_get_data(watch);163 if (dbus_watch_get_enabled(watch))
164 return;
146165
166 /* will trigger watch_info_free() */
147 dbus_watch_set_data(watch, NULL, NULL);167 dbus_watch_set_data(watch, NULL, NULL);
148
149 if (info) {
150 g_source_remove(info->watch_id);
151 g_io_channel_unref(info->io);
152 dbus_connection_unref(info->conn);
153 g_free(info);
154 }
155}168}
156169
157static void watch_toggled(DBusWatch *watch, void *data)170static void watch_toggled(DBusWatch *watch, void *data)
@@ -166,10 +179,12 @@
166179
167static gboolean timeout_handler_dispatch(gpointer data)180static gboolean timeout_handler_dispatch(gpointer data)
168{181{
169 timeout_handler_t *handler = data;182 struct timeout_handler *handler = data;
183
184 handler->id = 0;
170185
171 /* if not enabled should not be polled by the main loop */186 /* if not enabled should not be polled by the main loop */
172 if (dbus_timeout_get_enabled(handler->timeout) != TRUE)187 if (!dbus_timeout_get_enabled(handler->timeout))
173 return FALSE;188 return FALSE;
174189
175 dbus_timeout_handle(handler->timeout);190 dbus_timeout_handle(handler->timeout);
@@ -179,9 +194,7 @@
179194
180static void timeout_handler_free(void *data)195static void timeout_handler_free(void *data)
181{196{
182 timeout_handler_t *handler = data;197 struct timeout_handler *handler = data;
183 if (!handler)
184 return;
185198
186 if (handler->id > 0) {199 if (handler->id > 0) {
187 g_source_remove(handler->id);200 g_source_remove(handler->id);
@@ -193,35 +206,31 @@
193206
194static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data)207static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data)
195{208{
196 timeout_handler_t *handler;209 int interval = dbus_timeout_get_interval(timeout);
210 struct timeout_handler *handler;
197211
198 if (!dbus_timeout_get_enabled(timeout))212 if (!dbus_timeout_get_enabled(timeout))
199 return TRUE;213 return TRUE;
200214
201 handler = g_new0(timeout_handler_t, 1);215 handler = g_new0(struct timeout_handler, 1);
202216
203 handler->timeout = timeout;217 handler->timeout = timeout;
204 handler->id = g_timeout_add(dbus_timeout_get_interval(timeout),
205 timeout_handler_dispatch, handler);
206218
207 dbus_timeout_set_data(timeout, handler, timeout_handler_free);219 dbus_timeout_set_data(timeout, handler, timeout_handler_free);
208220
221 handler->id = g_timeout_add(interval, timeout_handler_dispatch,
222 handler);
223
209 return TRUE;224 return TRUE;
210}225}
211226
212static void remove_timeout(DBusTimeout *timeout, void *data)227static void remove_timeout(DBusTimeout *timeout, void *data)
213{228{
214 timeout_handler_t *handler;229 if (dbus_timeout_get_enabled(timeout))
215230 return;
216 handler = dbus_timeout_get_data(timeout);231
217232 /* will trigger timeout_handler_free() */
218 if (!handler)233 dbus_timeout_set_data(timeout, NULL, NULL);
219 return;
220
221 if (handler->id > 0) {
222 g_source_remove(handler->id);
223 handler->id = 0;
224 }
225}234}
226235
227static void timeout_toggled(DBusTimeout *timeout, void *data)236static void timeout_toggled(DBusTimeout *timeout, void *data)
@@ -232,63 +241,95 @@
232 remove_timeout(timeout, data);241 remove_timeout(timeout, data);
233}242}
234243
235static void dispatch_status_cb(DBusConnection *conn,244static void dispatch_status(DBusConnection *conn,
236 DBusDispatchStatus new_status, void *data)245 DBusDispatchStatus status, void *data)
237{246{
238 if (!dbus_connection_get_is_connected(conn))247 if (!dbus_connection_get_is_connected(conn))
239 return;248 return;
240249
241 if (new_status == DBUS_DISPATCH_DATA_REMAINS)250 queue_dispatch(conn, status);
242 g_timeout_add(DISPATCH_TIMEOUT, message_dispatch_cb, data);
243}251}
244252
245static void setup_dbus_with_main_loop(DBusConnection *conn)253static inline void setup_dbus_with_main_loop(DBusConnection *conn)
246{254{
247 dbus_connection_set_watch_functions(conn, add_watch, remove_watch,255 dbus_connection_set_watch_functions(conn, add_watch, remove_watch,
248 watch_toggled, conn, NULL);256 watch_toggled, conn, NULL);
249257
250 dbus_connection_set_timeout_functions(conn, add_timeout, remove_timeout,258 dbus_connection_set_timeout_functions(conn, add_timeout, remove_timeout,
251 timeout_toggled, conn, NULL);259 timeout_toggled, NULL, NULL);
252260
253 dbus_connection_set_dispatch_status_function(conn, dispatch_status_cb,261 dbus_connection_set_dispatch_status_function(conn, dispatch_status,
254 conn, NULL);262 NULL, NULL);
255}263}
256264
257DBusConnection *g_dbus_setup_bus(DBusBusType type, const char *name,265static gboolean setup_bus(DBusConnection *conn, const char *name,
258 DBusError *error)266 DBusError *error)
259{267{
260 DBusConnection *conn;268 gboolean result;
261269 DBusDispatchStatus status;
262 conn = dbus_bus_get(type, error);
263
264 if (error != NULL) {
265 if (dbus_error_is_set(error) == TRUE)
266 return NULL;
267 }
268
269 if (conn == NULL)
270 return NULL;
271270
272 if (name != NULL) {271 if (name != NULL) {
273 if (dbus_bus_request_name(conn, name,272 result = g_dbus_request_name(conn, name, error);
274 DBUS_NAME_FLAG_DO_NOT_QUEUE, error) !=
275 DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER ) {
276 dbus_connection_unref(conn);
277 return NULL;
278 }
279273
280 if (error != NULL) {274 if (error != NULL) {
281 if (dbus_error_is_set(error) == TRUE) {275 if (dbus_error_is_set(error) == TRUE)
282 dbus_connection_unref(conn);276 return FALSE;
283 return NULL;
284 }
285 }277 }
278
279 if (result == FALSE)
280 return FALSE;
286 }281 }
287282
288 setup_dbus_with_main_loop(conn);283 setup_dbus_with_main_loop(conn);
289284
290 if (dbus_connection_get_dispatch_status(conn) == DBUS_DISPATCH_DATA_REMAINS)285 status = dbus_connection_get_dispatch_status(conn);
291 g_timeout_add(DISPATCH_TIMEOUT, message_dispatch_cb, conn);286 queue_dispatch(conn, status);
287
288 return TRUE;
289}
290
291DBusConnection *g_dbus_setup_bus(DBusBusType type, const char *name,
292 DBusError *error)
293{
294 DBusConnection *conn;
295
296 conn = dbus_bus_get(type, error);
297
298 if (error != NULL) {
299 if (dbus_error_is_set(error) == TRUE)
300 return NULL;
301 }
302
303 if (conn == NULL)
304 return NULL;
305
306 if (setup_bus(conn, name, error) == FALSE) {
307 dbus_connection_unref(conn);
308 return NULL;
309 }
310
311 return conn;
312}
313
314DBusConnection *g_dbus_setup_private(DBusBusType type, const char *name,
315 DBusError *error)
316{
317 DBusConnection *conn;
318
319 conn = dbus_bus_get_private(type, error);
320
321 if (error != NULL) {
322 if (dbus_error_is_set(error) == TRUE)
323 return NULL;
324 }
325
326 if (conn == NULL)
327 return NULL;
328
329 if (setup_bus(conn, name, error) == FALSE) {
330 dbus_connection_unref(conn);
331 return NULL;
332 }
292333
293 return conn;334 return conn;
294}335}
@@ -296,6 +337,23 @@
296gboolean g_dbus_request_name(DBusConnection *connection, const char *name,337gboolean g_dbus_request_name(DBusConnection *connection, const char *name,
297 DBusError *error)338 DBusError *error)
298{339{
340 int result;
341
342 result = dbus_bus_request_name(connection, name,
343 DBUS_NAME_FLAG_DO_NOT_QUEUE, error);
344
345 if (error != NULL) {
346 if (dbus_error_is_set(error) == TRUE)
347 return FALSE;
348 }
349
350 if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
351 if (error != NULL)
352 dbus_set_error(error, name, "Name already in use");
353
354 return FALSE;
355 }
356
299 return TRUE;357 return TRUE;
300}358}
301359
@@ -305,16 +363,17 @@
305{363{
306 struct disconnect_data *dc_data;364 struct disconnect_data *dc_data;
307365
308 dc_data = g_new(struct disconnect_data, 1);366 dc_data = g_new0(struct disconnect_data, 1);
309367
310 dc_data->disconnect_cb = function;368 dc_data->function = function;
311 dc_data->user_data = user_data;369 dc_data->user_data = user_data;
312370
313 dbus_connection_set_exit_on_disconnect(connection, FALSE);371 dbus_connection_set_exit_on_disconnect(connection, FALSE);
314372
315 if (dbus_connection_add_filter(connection, disconnect_filter,373 if (g_dbus_add_signal_watch(connection, NULL, NULL,
316 dc_data, g_free) == FALSE) {374 DBUS_INTERFACE_LOCAL, "Disconnected",
317 error("Can't add D-Bus disconnect filter");375 disconnected_signal, dc_data, g_free) == 0) {
376 error("Failed to add watch for D-Bus Disconnected signal");
318 g_free(dc_data);377 g_free(dc_data);
319 return FALSE;378 return FALSE;
320 }379 }
321380
=== modified file 'gdbus/object.c'
--- gdbus/object.c 2010-01-10 10:46:58 +0000
+++ gdbus/object.c 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * D-Bus helper library3 * D-Bus helper library
4 *4 *
5 * Copyright (C) 2004-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
@@ -45,9 +45,9 @@
4545
46struct interface_data {46struct interface_data {
47 char *name;47 char *name;
48 GDBusMethodTable *methods;48 const GDBusMethodTable *methods;
49 GDBusSignalTable *signals;49 const GDBusSignalTable *signals;
50 GDBusPropertyTable *properties;50 const GDBusPropertyTable *properties;
51 void *user_data;51 void *user_data;
52 GDBusDestroyFunction destroy;52 GDBusDestroyFunction destroy;
53};53};
@@ -114,8 +114,8 @@
114114
115static void generate_interface_xml(GString *gstr, struct interface_data *iface)115static void generate_interface_xml(GString *gstr, struct interface_data *iface)
116{116{
117 GDBusMethodTable *method;117 const GDBusMethodTable *method;
118 GDBusSignalTable *signal;118 const GDBusSignalTable *signal;
119119
120 for (method = iface->methods; method && method->name; method++) {120 for (method = iface->methods; method && method->name; method++) {
121 if (!strlen(method->signature) && !strlen(method->reply))121 if (!strlen(method->signature) && !strlen(method->reply))
@@ -238,7 +238,7 @@
238{238{
239 struct generic_data *data = user_data;239 struct generic_data *data = user_data;
240 struct interface_data *iface;240 struct interface_data *iface;
241 GDBusMethodTable *method;241 const GDBusMethodTable *method;
242 const char *interface;242 const char *interface;
243243
244 interface = dbus_message_get_interface(message);244 interface = dbus_message_get_interface(message);
@@ -327,9 +327,9 @@
327};327};
328328
329static void add_interface(struct generic_data *data, const char *name,329static void add_interface(struct generic_data *data, const char *name,
330 GDBusMethodTable *methods,330 const GDBusMethodTable *methods,
331 GDBusSignalTable *signals,331 const GDBusSignalTable *signals,
332 GDBusPropertyTable *properties,332 const GDBusPropertyTable *properties,
333 void *user_data,333 void *user_data,
334 GDBusDestroyFunction destroy)334 GDBusDestroyFunction destroy)
335{335{
@@ -428,7 +428,7 @@
428{428{
429 struct generic_data *data = NULL;429 struct generic_data *data = NULL;
430 struct interface_data *iface;430 struct interface_data *iface;
431 GDBusSignalTable *signal;431 const GDBusSignalTable *signal;
432432
433 *args = NULL;433 *args = NULL;
434 if (!dbus_connection_get_object_path_data(conn, path,434 if (!dbus_connection_get_object_path_data(conn, path,
@@ -502,9 +502,9 @@
502502
503gboolean g_dbus_register_interface(DBusConnection *connection,503gboolean g_dbus_register_interface(DBusConnection *connection,
504 const char *path, const char *name,504 const char *path, const char *name,
505 GDBusMethodTable *methods,505 const GDBusMethodTable *methods,
506 GDBusSignalTable *signals,506 const GDBusSignalTable *signals,
507 GDBusPropertyTable *properties,507 const GDBusPropertyTable *properties,
508 void *user_data,508 void *user_data,
509 GDBusDestroyFunction destroy)509 GDBusDestroyFunction destroy)
510{510{
511511
=== modified file 'gdbus/watch.c'
--- gdbus/watch.c 2010-01-10 10:46:58 +0000
+++ gdbus/watch.c 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * D-Bus helper library3 * D-Bus helper library
4 *4 *
5 * Copyright (C) 2004-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
@@ -37,212 +37,335 @@
37#define error(fmt...)37#define error(fmt...)
38#define debug(fmt...)38#define debug(fmt...)
3939
40static DBusHandlerResult name_exit_filter(DBusConnection *connection,40static DBusHandlerResult message_filter(DBusConnection *connection,
41 DBusMessage *message, void *user_data);41 DBusMessage *message, void *user_data);
4242
43static guint listener_id = 0;43static guint listener_id = 0;
44static GSList *name_listeners = NULL;44static GSList *listeners = NULL;
4545
46struct name_callback {46struct filter_callback {
47 GDBusWatchFunction conn_func;47 GDBusWatchFunction conn_func;
48 GDBusWatchFunction disc_func;48 GDBusWatchFunction disc_func;
49 GDBusSignalFunction signal_func;
50 GDBusDestroyFunction destroy_func;
49 void *user_data;51 void *user_data;
50 guint id;52 guint id;
51};53};
5254
53struct name_data {55struct filter_data {
54 DBusConnection *connection;56 DBusConnection *connection;
55 char *name;57 DBusHandleMessageFunction handle_func;
58 char *sender;
59 char *path;
60 char *interface;
61 char *member;
62 char *argument;
56 GSList *callbacks;63 GSList *callbacks;
57 GSList *processed;64 GSList *processed;
58 gboolean lock;65 gboolean lock;
66 gboolean registered;
59};67};
6068
61static struct name_data *name_data_find(DBusConnection *connection,69static struct filter_data *filter_data_find(DBusConnection *connection,
62 const char *name)70 const char *sender,
71 const char *path,
72 const char *interface,
73 const char *member,
74 const char *argument)
63{75{
64 GSList *current;76 GSList *current;
6577
66 for (current = name_listeners;78 for (current = listeners;
67 current != NULL; current = current->next) {79 current != NULL; current = current->next) {
68 struct name_data *data = current->data;80 struct filter_data *data = current->data;
6981
70 if (connection != data->connection)82 if (connection != data->connection)
71 continue;83 continue;
7284
73 if (name == NULL || g_str_equal(name, data->name))85 if (sender && data->sender &&
74 return data;86 g_str_equal(sender, data->sender) == FALSE)
75 }87 continue;
7688
77 return NULL;89 if (path && data->path &&
78}90 g_str_equal(path, data->path) == FALSE)
7991 continue;
80static struct name_callback *name_callback_find(GSList *callbacks, guint id)92
81{93 if (interface && data->interface &&
82 GSList *current;94 g_str_equal(interface, data->interface) == FALSE)
8395 continue;
84 for (current = callbacks; current != NULL; current = current->next) {96
85 struct name_callback *cb = current->data;97 if (member && data->member &&
86 if (cb->id == id)98 g_str_equal(member, data->member) == FALSE)
87 return cb;99 continue;
88 }100
89101 if (argument && data->argument &&
90 return NULL;102 g_str_equal(argument, data->argument) == FALSE)
91}103 continue;
92104
93static void name_data_call_and_free(struct name_data *data)105 return data;
106 }
107
108 return NULL;
109}
110
111static void format_rule(struct filter_data *data, char *rule, size_t size)
112{
113 int offset;
114
115 offset = snprintf(rule, size, "type='signal'");
116
117 if (data->sender)
118 offset += snprintf(rule + offset, size - offset,
119 ",sender='%s'", data->sender);
120 if (data->path)
121 offset += snprintf(rule + offset, size - offset,
122 ",path='%s'", data->path);
123 if (data->interface)
124 offset += snprintf(rule + offset, size - offset,
125 ",interface='%s'", data->interface);
126 if (data->member)
127 offset += snprintf(rule + offset, size - offset,
128 ",member='%s'", data->member);
129 if (data->argument)
130 snprintf(rule + offset, size - offset,
131 ",arg0='%s'", data->argument);
132}
133
134static gboolean add_match(struct filter_data *data,
135 DBusHandleMessageFunction filter)
136{
137 DBusError err;
138 char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH];
139
140 format_rule(data, rule, sizeof(rule));
141 dbus_error_init(&err);
142
143 dbus_bus_add_match(data->connection, rule, &err);
144 if (dbus_error_is_set(&err)) {
145 error("Adding match rule \"%s\" failed: %s", rule,
146 err.message);
147 dbus_error_free(&err);
148 return FALSE;
149 }
150
151 data->handle_func = filter;
152 data->registered = TRUE;
153
154 return TRUE;
155}
156
157static gboolean remove_match(struct filter_data *data)
158{
159 DBusError err;
160 char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH];
161
162 format_rule(data, rule, sizeof(rule));
163
164 dbus_error_init(&err);
165
166 dbus_bus_remove_match(data->connection, rule, &err);
167 if (dbus_error_is_set(&err)) {
168 error("Removing owner match rule for %s failed: %s",
169 rule, err.message);
170 dbus_error_free(&err);
171 return FALSE;
172 }
173
174 return TRUE;
175}
176
177static struct filter_data *filter_data_get(DBusConnection *connection,
178 DBusHandleMessageFunction filter,
179 const char *sender,
180 const char *path,
181 const char *interface,
182 const char *member,
183 const char *argument)
184{
185 struct filter_data *data;
186
187 if (!filter_data_find(connection, NULL, NULL, NULL, NULL, NULL)) {
188 if (!dbus_connection_add_filter(connection,
189 message_filter, NULL, NULL)) {
190 error("dbus_connection_add_filter() failed");
191 return NULL;
192 }
193 }
194
195 data = filter_data_find(connection, sender, path, interface, member,
196 argument);
197 if (data)
198 return data;
199
200 data = g_new0(struct filter_data, 1);
201
202 data->connection = dbus_connection_ref(connection);
203 data->sender = g_strdup(sender);
204 data->path = g_strdup(path);
205 data->interface = g_strdup(interface);
206 data->member = g_strdup(member);
207 data->argument = g_strdup(argument);
208
209 if (!add_match(data, filter)) {
210 g_free(data);
211 return NULL;
212 }
213
214 listeners = g_slist_append(listeners, data);
215
216 return data;
217}
218
219static struct filter_callback *filter_data_find_callback(
220 struct filter_data *data,
221 guint id)
222{
223 GSList *l;
224
225 for (l = data->callbacks; l; l = l->next) {
226 struct filter_callback *cb = l->data;
227 if (cb->id == id)
228 return cb;
229 }
230 for (l = data->processed; l; l = l->next) {
231 struct filter_callback *cb = l->data;
232 if (cb->id == id)
233 return cb;
234 }
235
236 return NULL;
237}
238
239static void filter_data_free(struct filter_data *data)
240{
241 GSList *l;
242
243 for (l = data->callbacks; l != NULL; l = l->next)
244 g_free(l->data);
245
246 g_slist_free(data->callbacks);
247 g_free(data->sender);
248 g_free(data->path);
249 g_free(data->interface);
250 g_free(data->member);
251 g_free(data->argument);
252 dbus_connection_unref(data->connection);
253 g_free(data);
254}
255
256static void filter_data_call_and_free(struct filter_data *data)
94{257{
95 GSList *l;258 GSList *l;
96259
97 for (l = data->callbacks; l != NULL; l = l->next) {260 for (l = data->callbacks; l != NULL; l = l->next) {
98 struct name_callback *cb = l->data;261 struct filter_callback *cb = l->data;
99 if (cb->disc_func)262 if (cb->disc_func)
100 cb->disc_func(data->connection, cb->user_data);263 cb->disc_func(data->connection, cb->user_data);
264 if (cb->destroy_func)
265 cb->destroy_func(cb->user_data);
101 g_free(cb);266 g_free(cb);
102 }267 }
103268
104 g_slist_free(data->callbacks);269 filter_data_free(data);
105 g_free(data->name);270}
106 g_free(data);271
107}272static struct filter_callback *filter_data_add_callback(
108273 struct filter_data *data,
109static void name_data_free(struct name_data *data)
110{
111 GSList *l;
112
113 for (l = data->callbacks; l != NULL; l = l->next)
114 g_free(l->data);
115
116 g_slist_free(data->callbacks);
117 g_free(data->name);
118 g_free(data);
119}
120
121static int name_data_add(DBusConnection *connection, const char *name,
122 GDBusWatchFunction connect,274 GDBusWatchFunction connect,
123 GDBusWatchFunction disconnect,275 GDBusWatchFunction disconnect,
124 void *user_data, guint id)276 GDBusSignalFunction signal,
277 GDBusDestroyFunction destroy,
278 void *user_data)
125{279{
126 int first = 1;280 struct filter_callback *cb = NULL;
127 struct name_data *data = NULL;
128 struct name_callback *cb = NULL;
129281
130 cb = g_new(struct name_callback, 1);282 cb = g_new(struct filter_callback, 1);
131283
132 cb->conn_func = connect;284 cb->conn_func = connect;
133 cb->disc_func = disconnect;285 cb->disc_func = disconnect;
286 cb->signal_func = signal;
287 cb->destroy_func = destroy;
134 cb->user_data = user_data;288 cb->user_data = user_data;
135 cb->id = id;289 cb->id = ++listener_id;
136290
137 data = name_data_find(connection, name);
138 if (data) {
139 first = 0;
140 goto done;
141 }
142
143 data = g_new0(struct name_data, 1);
144
145 data->connection = connection;
146 data->name = g_strdup(name);
147
148 name_listeners = g_slist_append(name_listeners, data);
149
150done:
151 if (data->lock)291 if (data->lock)
152 data->processed = g_slist_append(data->processed, cb);292 data->processed = g_slist_append(data->processed, cb);
153 else293 else
154 data->callbacks = g_slist_append(data->callbacks, cb);294 data->callbacks = g_slist_append(data->callbacks, cb);
155295
156 return first;296 return cb;
157}297}
158298
159static void name_data_remove(DBusConnection *connection,299static gboolean filter_data_remove_callback(struct filter_data *data,
160 const char *name, guint id)300 struct filter_callback *cb)
161{301{
162 struct name_data *data;302 DBusConnection *connection;
163 struct name_callback *cb = NULL;303
164304 data->callbacks = g_slist_remove(data->callbacks, cb);
165 data = name_data_find(connection, name);305 data->processed = g_slist_remove(data->processed, cb);
166 if (!data)306
167 return;307 if (cb->destroy_func)
168308 cb->destroy_func(cb->user_data);
169 cb = name_callback_find(data->callbacks, id);309
170 if (cb) {310 g_free(cb);
171 data->callbacks = g_slist_remove(data->callbacks, cb);311
172 g_free(cb);312 /* Don't remove the filter if other callbacks exist or data is lock
173 }313 * processing callbacks */
174314 if (data->callbacks || data->lock)
175 if (data->callbacks)315 return TRUE;
176 return;316
177317 if (data->registered && !remove_match(data))
178 name_listeners = g_slist_remove(name_listeners, data);318 return FALSE;
179 name_data_free(data);319
320 connection = dbus_connection_ref(data->connection);
321 listeners = g_slist_remove(listeners, data);
322 filter_data_free(data);
180323
181 /* Remove filter if there are no listeners left for the connection */324 /* Remove filter if there are no listeners left for the connection */
182 data = name_data_find(connection, NULL);325 data = filter_data_find(connection, NULL, NULL, NULL, NULL, NULL);
183 if (!data)326 if (!data)
184 dbus_connection_remove_filter(connection,327 dbus_connection_remove_filter(connection, message_filter,
185 name_exit_filter,
186 NULL);328 NULL);
187}329
188330 dbus_connection_unref(connection);
189static gboolean add_match(DBusConnection *connection, const char *name)331
190{332 return TRUE;
191 DBusError err;333}
192 char match_string[128];334
193335static DBusHandlerResult signal_filter(DBusConnection *connection,
194 snprintf(match_string, sizeof(match_string),336 DBusMessage *message, void *user_data)
195 "interface=%s,member=NameOwnerChanged,arg0=%s",337{
196 DBUS_INTERFACE_DBUS, name);338 struct filter_data *data = user_data;
197339 struct filter_callback *cb;
198 dbus_error_init(&err);340
199341 while (data->callbacks) {
200 dbus_bus_add_match(connection, match_string, &err);342 cb = data->callbacks->data;
201343
202 if (dbus_error_is_set(&err)) {344 if (cb->signal_func && !cb->signal_func(connection, message,
203 error("Adding match rule \"%s\" failed: %s", match_string,345 cb->user_data)) {
204 err.message);346 filter_data_remove_callback(data, cb);
205 dbus_error_free(&err);347 continue;
206 return FALSE;348 }
207 }349
208350 /* Check if the watch was removed/freed by the callback
209 return TRUE;351 * function */
210}352 if (!g_slist_find(data->callbacks, cb))
211353 continue;
212static gboolean remove_match(DBusConnection *connection, const char *name)354
213{355 data->callbacks = g_slist_remove(data->callbacks, cb);
214 DBusError err;356 data->processed = g_slist_append(data->processed, cb);
215 char match_string[128];357 }
216358
217 snprintf(match_string, sizeof(match_string),359 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
218 "interface=%s,member=NameOwnerChanged,arg0=%s",360}
219 DBUS_INTERFACE_DBUS, name);361
220362static DBusHandlerResult service_filter(DBusConnection *connection,
221 dbus_error_init(&err);363 DBusMessage *message, void *user_data)
222364{
223 dbus_bus_remove_match(connection, match_string, &err);365 struct filter_data *data = user_data;
224366 struct filter_callback *cb;
225 if (dbus_error_is_set(&err)) {
226 error("Removing owner match rule for %s failed: %s",
227 name, err.message);
228 dbus_error_free(&err);
229 return FALSE;
230 }
231
232 return TRUE;
233}
234
235static DBusHandlerResult name_exit_filter(DBusConnection *connection,
236 DBusMessage *message, void *user_data)
237{
238 struct name_data *data;
239 struct name_callback *cb;
240 char *name, *old, *new;367 char *name, *old, *new;
241368
242 if (!dbus_message_is_signal(message, DBUS_INTERFACE_DBUS,
243 "NameOwnerChanged"))
244 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
245
246 if (!dbus_message_get_args(message, NULL,369 if (!dbus_message_get_args(message, NULL,
247 DBUS_TYPE_STRING, &name,370 DBUS_TYPE_STRING, &name,
248 DBUS_TYPE_STRING, &old,371 DBUS_TYPE_STRING, &old,
@@ -252,14 +375,6 @@
252 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;375 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
253 }376 }
254377
255 data = name_data_find(connection, name);
256 if (!data) {
257 error("Got NameOwnerChanged signal for %s which has no listeners", name);
258 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
259 }
260
261 data->lock = TRUE;
262
263 while (data->callbacks) {378 while (data->callbacks) {
264 cb = data->callbacks->data;379 cb = data->callbacks->data;
265380
@@ -286,24 +401,56 @@
286 data->processed = g_slist_append(data->processed, cb);401 data->processed = g_slist_append(data->processed, cb);
287 }402 }
288403
289 data->callbacks = data->processed;404 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
290 data->processed = NULL;405}
291 data->lock = FALSE;406
407
408static DBusHandlerResult message_filter(DBusConnection *connection,
409 DBusMessage *message, void *user_data)
410{
411 struct filter_data *data;
412 const char *sender, *path, *iface, *member, *arg = NULL;
413
414 /* Only filter signals */
415 if (dbus_message_get_type(message) != DBUS_MESSAGE_TYPE_SIGNAL)
416 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
417
418 sender = dbus_message_get_sender(message);
419 path = dbus_message_get_path(message);
420 iface = dbus_message_get_interface(message);
421 member = dbus_message_get_member(message);
422 dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &arg, DBUS_TYPE_INVALID);
423
424 data = filter_data_find(connection, sender, path, iface, member, arg);
425 if (!data) {
426 error("Got %s.%s signal which has no listeners", iface, member);
427 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
428 }
429
430 if (data->handle_func) {
431 data->lock = TRUE;
432
433 data->handle_func(connection, message, data);
434
435 data->callbacks = data->processed;
436 data->processed = NULL;
437 data->lock = FALSE;
438 }
292439
293 if (data->callbacks)440 if (data->callbacks)
294 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;441 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
295442
296 name_listeners = g_slist_remove(name_listeners, data);443 remove_match(data);
297 name_data_free(data);444
445 listeners = g_slist_remove(listeners, data);
446 filter_data_free(data);
298447
299 /* Remove filter if there no listener left for the connection */448 /* Remove filter if there no listener left for the connection */
300 data = name_data_find(connection, NULL);449 data = filter_data_find(connection, NULL, NULL, NULL, NULL, NULL);
301 if (!data)450 if (!data)
302 dbus_connection_remove_filter(connection, name_exit_filter,451 dbus_connection_remove_filter(connection, message_filter,
303 NULL);452 NULL);
304453
305 remove_match(connection, name);
306
307 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;454 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
308}455}
309456
@@ -388,6 +535,8 @@
388535
389 dbus_pending_call_set_notify(call, service_reply, data, NULL);536 dbus_pending_call_set_notify(call, service_reply, data, NULL);
390537
538 dbus_pending_call_unref(call);
539
391done:540done:
392 dbus_message_unref(message);541 dbus_message_unref(message);
393}542}
@@ -397,38 +546,27 @@
397 GDBusWatchFunction disconnect,546 GDBusWatchFunction disconnect,
398 void *user_data, GDBusDestroyFunction destroy)547 void *user_data, GDBusDestroyFunction destroy)
399{548{
400 int first;549 struct filter_data *data;
401550 struct filter_callback *cb;
402 if (!name_data_find(connection, NULL)) {551
403 if (!dbus_connection_add_filter(connection,552 if (!name)
404 name_exit_filter, NULL, NULL)) {553 return 0;
405 error("dbus_connection_add_filter() failed");554
406 return 0;555 data = filter_data_get(connection, service_filter, NULL, NULL,
407 }556 DBUS_INTERFACE_DBUS, "NameOwnerChanged",
408 }557 name);
409558 if (!data)
410 listener_id++;559 return 0;
411 first = name_data_add(connection, name, connect, disconnect,560
412 user_data, listener_id);561 cb = filter_data_add_callback(data, connect, disconnect, NULL, NULL,
413 /* The filter is already added if this is not the first callback562 user_data);
414 * registration for the name */563 if (!cb)
415 if (!first)564 return 0;
416 goto done;565
417
418 if (name) {
419 debug("name_listener_add(%s)", name);
420
421 if (!add_match(connection, name)) {
422 name_data_remove(connection, name, listener_id);
423 return 0;
424 }
425 }
426
427done:
428 if (connect)566 if (connect)
429 check_service(connection, name, connect, user_data);567 check_service(connection, name, connect, user_data);
430568
431 return listener_id;569 return cb->id;
432}570}
433571
434guint g_dbus_add_disconnect_watch(DBusConnection *connection, const char *name,572guint g_dbus_add_disconnect_watch(DBusConnection *connection, const char *name,
@@ -440,72 +578,57 @@
440}578}
441579
442guint g_dbus_add_signal_watch(DBusConnection *connection,580guint g_dbus_add_signal_watch(DBusConnection *connection,
443 const char *rule, GDBusSignalFunction function,581 const char *sender, const char *path,
444 void *user_data, GDBusDestroyFunction destroy)582 const char *interface, const char *member,
583 GDBusSignalFunction function, void *user_data,
584 GDBusDestroyFunction destroy)
445{585{
446 return 0;586 struct filter_data *data;
587 struct filter_callback *cb;
588
589 data = filter_data_get(connection, signal_filter, sender, path,
590 interface, member, NULL);
591 if (!data)
592 return 0;
593
594 cb = filter_data_add_callback(data, NULL, NULL, function, destroy,
595 user_data);
596 if (!cb)
597 return 0;
598
599 return cb->id;
447}600}
448601
449gboolean g_dbus_remove_watch(DBusConnection *connection, guint id)602gboolean g_dbus_remove_watch(DBusConnection *connection, guint id)
450{603{
451 struct name_data *data;604 struct filter_data *data;
452 struct name_callback *cb;605 struct filter_callback *cb;
453 GSList *ldata, *lcb;606 GSList *ldata;
454607
455 if (id == 0)608 if (id == 0)
456 return FALSE;609 return FALSE;
457610
458 for (ldata = name_listeners; ldata; ldata = ldata->next) {611 for (ldata = listeners; ldata; ldata = ldata->next) {
459 data = ldata->data;612 data = ldata->data;
460 for (lcb = data->callbacks; lcb; lcb = lcb->next) {613
461 cb = lcb->data;614 cb = filter_data_find_callback(data, id);
462 if (cb->id == id)615 if (cb) {
463 goto remove;616 filter_data_remove_callback(data, cb);
464 }617 return TRUE;
465 for (lcb = data->processed; lcb; lcb = lcb->next) {
466 cb = lcb->data;
467 if (cb->id == id)
468 goto remove;
469 }618 }
470 }619 }
471620
472 return FALSE;621 return FALSE;
473
474remove:
475 data->callbacks = g_slist_remove(data->callbacks, cb);
476 data->processed = g_slist_remove(data->processed, cb);
477 g_free(cb);
478
479 /* Don't remove the filter if other callbacks exist or data is lock
480 * processing callbacks */
481 if (data->callbacks || data->lock)
482 return TRUE;
483
484 if (data->name) {
485 if (!remove_match(data->connection, data->name))
486 return FALSE;
487 }
488
489 name_listeners = g_slist_remove(name_listeners, data);
490 name_data_free(data);
491
492 /* Remove filter if there are no listeners left for the connection */
493 data = name_data_find(connection, NULL);
494 if (!data)
495 dbus_connection_remove_filter(connection, name_exit_filter,
496 NULL);
497
498 return TRUE;
499}622}
500623
501void g_dbus_remove_all_watches(DBusConnection *connection)624void g_dbus_remove_all_watches(DBusConnection *connection)
502{625{
503 struct name_data *data;626 struct filter_data *data;
504627
505 while ((data = name_data_find(connection, NULL))) {628 while ((data = filter_data_find(connection, NULL, NULL, NULL, NULL, NULL))) {
506 name_listeners = g_slist_remove(name_listeners, data);629 listeners = g_slist_remove(listeners, data);
507 name_data_call_and_free(data);630 filter_data_call_and_free(data);
508 }631 }
509632
510 dbus_connection_remove_filter(connection, name_exit_filter, NULL);633 dbus_connection_remove_filter(connection, message_filter, NULL);
511}634}
512635
=== modified file 'ltmain.sh'
--- ltmain.sh 2009-07-27 19:02:30 +0000
+++ ltmain.sh 2010-04-28 20:38:30 +0000
@@ -1,6 +1,6 @@
1# Generated from ltmain.m4sh.1# Generated from ltmain.m4sh.
22
3# ltmain.sh (GNU libtool) 2.2.63# ltmain.sh (GNU libtool) 2.2.6b
4# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 19964# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
55
6# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.6# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
@@ -65,7 +65,7 @@
65# compiler: $LTCC65# compiler: $LTCC
66# compiler flags: $LTCFLAGS66# compiler flags: $LTCFLAGS
67# linker: $LD (gnu? $with_gnu_ld)67# linker: $LD (gnu? $with_gnu_ld)
68# $progname: (GNU libtool) 2.2.668# $progname: (GNU libtool) 2.2.6b
69# automake: $automake_version69# automake: $automake_version
70# autoconf: $autoconf_version70# autoconf: $autoconf_version
71#71#
@@ -73,9 +73,9 @@
7373
74PROGRAM=ltmain.sh74PROGRAM=ltmain.sh
75PACKAGE=libtool75PACKAGE=libtool
76VERSION=2.2.676VERSION=2.2.6b
77TIMESTAMP=""77TIMESTAMP=""
78package_revision=1.301278package_revision=1.3017
7979
80# Be Bourne compatible80# Be Bourne compatible
81if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then81if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
8282
=== modified file 'plugins/filesystem.c'
--- plugins/filesystem.c 2010-01-10 10:46:58 +0000
+++ plugins/filesystem.c 2010-04-28 20:38:30 +0000
@@ -2,8 +2,8 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2009 Intel Corporation5 * Copyright (C) 2009-2010 Intel Corporation
6 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>6 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
7 *7 *
8 *8 *
9 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
@@ -123,37 +123,49 @@
123}123}
124124
125static gpointer filesystem_open(const char *name, int oflag, mode_t mode,125static gpointer filesystem_open(const char *name, int oflag, mode_t mode,
126 size_t *size)126 size_t *size, int *err)
127{127{
128 struct stat stats;128 struct stat stats;
129 struct statvfs buf;129 struct statvfs buf;
130 int fd = open(name, oflag, mode);130 int fd = open(name, oflag, mode);
131131
132 if (fd < 0)132 if (fd < 0) {
133 if (err)
134 *err = -errno;
133 return NULL;135 return NULL;
136 }
134137
135 if (fstat(fd, &stats) < 0) {138 if (fstat(fd, &stats) < 0) {
136 error("fstat(fd=%d): %s (%d)", fd, strerror(errno), errno);139 if (err)
140 *err = -errno;
137 goto failed;141 goto failed;
138 }142 }
139143
140 if (oflag == O_RDONLY) {144 if (oflag == O_RDONLY) {
141 if (size)145 if (size)
142 *size = stats.st_size;146 *size = stats.st_size;
143 return GINT_TO_POINTER(fd);147 goto done;
144 }148 }
145149
146 if (fstatvfs(fd, &buf) < 0)150 if (fstatvfs(fd, &buf) < 0) {
151 if (err)
152 *err = -errno;
147 goto failed;153 goto failed;
154 }
148155
149 if (size == NULL)156 if (size == NULL)
150 return GINT_TO_POINTER(fd);157 goto done;
151158
152 if (buf.f_bsize * buf.f_bavail < *size) {159 if (buf.f_bsize * buf.f_bavail < *size) {
153 errno = ENOSPC;160 if (err)
161 *err = -ENOSPC;
154 goto failed;162 goto failed;
155 }163 }
156164
165done:
166 if (err)
167 *err = 0;
168
157 return GINT_TO_POINTER(fd);169 return GINT_TO_POINTER(fd);
158170
159failed:171failed:
@@ -163,71 +175,138 @@
163175
164static int filesystem_close(gpointer object)176static int filesystem_close(gpointer object)
165{177{
166 return close(GPOINTER_TO_INT(object));178 if (close(GPOINTER_TO_INT(object)) < 0)
179 return -errno;
180
181 return 0;
167}182}
168183
169static ssize_t filesystem_read(gpointer object, void *buf, size_t count)184static ssize_t filesystem_read(gpointer object, void *buf, size_t count)
170{185{
171 return read(GPOINTER_TO_INT(object), buf, count);186 ssize_t ret;
187
188 ret = read(GPOINTER_TO_INT(object), buf, count);
189 if (ret < 0)
190 return -errno;
191
192 return ret;
172}193}
173194
174static ssize_t filesystem_write(gpointer object, const void *buf, size_t count)195static ssize_t filesystem_write(gpointer object, const void *buf, size_t count)
175{196{
176 return write(GPOINTER_TO_INT(object), buf, count);197 ssize_t ret;
198
199 ret = write(GPOINTER_TO_INT(object), buf, count);
200 if (ret < 0)
201 return -errno;
202
203 return ret;
204}
205
206struct capability_object {
207 int pid;
208 int output;
209 int err;
210 guint watch;
211 GString *buffer;
212};
213
214static void script_exited(GPid pid, gint status, gpointer data)
215{
216 struct capability_object *object = data;
217 char buf[128];
218
219 object->pid = -1;
220
221 if (WEXITSTATUS(status) != EXIT_SUCCESS) {
222 memset(buf, 0, sizeof(buf));
223 if (read(object->err, buf, sizeof(buf)) > 0)
224 error("%s", buf);
225 obex_object_set_io_flags(data, G_IO_ERR, -EPERM);
226 } else
227 obex_object_set_io_flags(data, G_IO_IN, 0);
228
229 g_spawn_close_pid(pid);
230}
231
232static int capability_exec(const char **argv, int *output, int *err)
233{
234 GError *gerr = NULL;
235 int pid;
236 GSpawnFlags flags = G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH;
237
238 if (!g_spawn_async_with_pipes(NULL, (char **) argv, NULL, flags, NULL,
239 NULL, &pid, NULL, output, err, &gerr)) {
240 error("%s", gerr->message);
241 g_error_free(gerr);
242 return -EPERM;
243 }
244
245 return pid;
177}246}
178247
179static gpointer capability_open(const char *name, int oflag, mode_t mode,248static gpointer capability_open(const char *name, int oflag, mode_t mode,
180 size_t *size)249 size_t *size, int *err)
181{250{
182 GError *gerr = NULL;251 struct capability_object *object = NULL;
183 gchar *buf;252 gchar *buf;
184 gint exit;253 const char *argv[2];
185 gboolean ret;
186 GString *object;
187254
188 if (oflag != O_RDONLY)255 if (oflag != O_RDONLY)
189 goto fail;256 goto fail;
190257
258 object = g_new0(struct capability_object, 1);
259 object->pid = -1;
260 object->output = -1;
261 object->err = -1;
262
191 if (name[0] != '!') {263 if (name[0] != '!') {
264 GError *gerr = NULL;
265 gboolean ret;
266
192 ret = g_file_get_contents(name, &buf, NULL, &gerr);267 ret = g_file_get_contents(name, &buf, NULL, &gerr);
193 if (ret == FALSE) {268 if (ret == FALSE) {
194 error("%s", gerr->message);269 error("%s", gerr->message);
270 g_error_free(gerr);
195 goto fail;271 goto fail;
196 }272 }
197273
274 object->buffer = g_string_new(buf);
275
276 if (size)
277 *size = object->buffer->len;
278
198 goto done;279 goto done;
199 }280 }
200281
201 ret = g_spawn_command_line_sync(name + 1, &buf, NULL, &exit, &gerr);282 argv[0] = &name[1];
202 if (ret == FALSE) {283 argv[1] = NULL;
203 error("%s", gerr->message);284
204 goto fail;285 object->pid = capability_exec(argv, &object->output, &object->err);
205 }286 if (object->pid < 0)
206287 goto fail;
207 if (WEXITSTATUS(exit) != EXIT_SUCCESS) {288
208 error("%s failed", name + 1);289 object->watch = g_child_watch_add(object->pid, script_exited, object);
209 g_free(buf);290
210 goto fail;291 if (size)
211 }292 *size = 1;
212293
213done:294done:
214 object = g_string_new(buf);295 if (err)
215296 *err = 0;
216 if (size)
217 *size = object->len;
218297
219 return object;298 return object;
220299
221fail:300fail:
222 if (gerr)301 if (err)
223 g_error_free(gerr);302 *err = -EPERM;
224303
225 errno = EPERM;304 g_free(object);
226 return NULL;305 return NULL;
227}306}
228307
229static gpointer folder_open(const char *name, int oflag, mode_t mode,308static gpointer folder_open(const char *name, int oflag, mode_t mode,
230 size_t *size)309 size_t *size, int *err)
231{310{
232 struct obex_session *os;311 struct obex_session *os;
233 struct stat fstat, dstat;312 struct stat fstat, dstat;
@@ -235,7 +314,7 @@
235 DIR *dp;314 DIR *dp;
236 GString *object;315 GString *object;
237 gboolean root, pcsuite;316 gboolean root, pcsuite;
238 gint err;317 int ret;
239318
240 os = obex_get_session(NULL);319 os = obex_get_session(NULL);
241320
@@ -250,20 +329,21 @@
250329
251 dp = opendir(name);330 dp = opendir(name);
252 if (dp == NULL) {331 if (dp == NULL) {
253 errno = ENOENT;332 if (err)
333 *err = -ENOENT;
254 goto failed;334 goto failed;
255 }335 }
256336
257 if (root && os->server->symlinks)337 if (root && os->server->symlinks)
258 err = stat(name, &dstat);338 ret = stat(name, &dstat);
259 else {339 else {
260 object = g_string_append(object, FL_PARENT_FOLDER_ELEMENT);340 object = g_string_append(object, FL_PARENT_FOLDER_ELEMENT);
261 err = lstat(name, &dstat);341 ret = lstat(name, &dstat);
262 }342 }
263343
264 if (err < 0) {344 if (ret < 0) {
265 error("%s: %s(%d)", root ? "stat" : "lstat",345 if (err)
266 strerror(errno), errno);346 *err = -errno;
267 goto failed;347 goto failed;
268 }348 }
269349
@@ -284,11 +364,11 @@
284 fullname = g_build_filename(os->current_folder, ep->d_name, NULL);364 fullname = g_build_filename(os->current_folder, ep->d_name, NULL);
285365
286 if (root && os->server->symlinks)366 if (root && os->server->symlinks)
287 err = stat(fullname, &fstat);367 ret = stat(fullname, &fstat);
288 else368 else
289 err = lstat(fullname, &fstat);369 ret = lstat(fullname, &fstat);
290370
291 if (err < 0) {371 if (ret < 0) {
292 debug("%s: %s(%d)", root ? "stat" : "lstat",372 debug("%s: %s(%d)", root ? "stat" : "lstat",
293 strerror(errno), errno);373 strerror(errno), errno);
294 g_free(name);374 g_free(name);
@@ -310,13 +390,21 @@
310 g_free(line);390 g_free(line);
311 }391 }
312392
393 closedir(dp);
394
313 object = g_string_append(object, FL_BODY_END);395 object = g_string_append(object, FL_BODY_END);
314 if (size)396 if (size)
315 *size = object->len;397 *size = object->len;
316398
399 if (err)
400 *err = 0;
401
317 return object;402 return object;
318403
319failed:404failed:
405 if (dp)
406 closedir(dp);
407
320 g_string_free(object, TRUE);408 g_string_free(object, TRUE);
321 return NULL;409 return NULL;
322}410}
@@ -345,6 +433,37 @@
345 return len;433 return len;
346}434}
347435
436static ssize_t capability_read(gpointer object, void *buf, size_t count)
437{
438 struct capability_object *obj = object;
439
440 if (obj->buffer)
441 return string_read(obj->buffer, buf, count);
442
443 if (obj->pid >= 0)
444 return -EAGAIN;
445
446 return read(obj->output, buf, count);
447}
448
449static int capability_close(gpointer object)
450{
451 struct capability_object *obj = object;
452
453 if (obj->pid >= 0) {
454 g_source_remove(obj->watch);
455 kill(obj->pid, SIGTERM);
456 g_spawn_close_pid(obj->pid);
457 }
458
459 if (obj->buffer != NULL)
460 g_string_free(obj->buffer, TRUE);
461
462 g_free(obj);
463
464 return 0;
465}
466
348struct obex_mime_type_driver file = {467struct obex_mime_type_driver file = {
349 .open = filesystem_open,468 .open = filesystem_open,
350 .close = filesystem_close,469 .close = filesystem_close,
@@ -357,8 +476,8 @@
357 .target = FTP_TARGET,476 .target = FTP_TARGET,
358 .mimetype = "x-obex/capability",477 .mimetype = "x-obex/capability",
359 .open = capability_open,478 .open = capability_open,
360 .close = string_free,479 .close = capability_close,
361 .read = string_read,480 .read = capability_read,
362};481};
363482
364struct obex_mime_type_driver folder = {483struct obex_mime_type_driver folder = {
365484
=== modified file 'plugins/ftp.c'
--- plugins/ftp.c 2010-01-10 10:46:58 +0000
+++ plugins/ftp.c 2010-04-28 20:38:30 +0000
@@ -2,9 +2,8 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2008 Nokia Corporation5 * Copyright (C) 2007-2010 Nokia Corporation
6 * Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT)6 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
7 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>
8 *7 *
9 *8 *
10 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
@@ -94,6 +93,7 @@
94</record>"93</record>"
9594
96#define PCSUITE_CHANNEL 2495#define PCSUITE_CHANNEL 24
96#define PCSUITE_WHO_SIZE 8
97#define PCSUITE_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \97#define PCSUITE_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \
98<record> \98<record> \
99 <attribute id=\"0x0001\"> \99 <attribute id=\"0x0001\"> \
@@ -141,9 +141,8 @@
141 0xF9, 0xEC, 0x7B, 0xC4, 0x95, 0x3C, 0x11, 0xD2,141 0xF9, 0xEC, 0x7B, 0xC4, 0x95, 0x3C, 0x11, 0xD2,
142 0x98, 0x4E, 0x52, 0x54, 0x00, 0xDC, 0x9E, 0x09 };142 0x98, 0x4E, 0x52, 0x54, 0x00, 0xDC, 0x9E, 0x09 };
143143
144static const guint8 PCSUITE_TARGET[TARGET_SIZE] = {144static const guint8 PCSUITE_WHO[PCSUITE_WHO_SIZE] = {
145 0x00, 0x00, 0x50, 0x05, 0x00, 0x00, 0x10, 0x00,145 'P','C',' ','S','u','i','t','e' };
146 0x80, 0x00, 0x00, 0x02, 0xEE, 0x00, 0x00, 0x01 };
147146
148static gint get_by_type(struct obex_session *os, gchar *type, size_t *size)147static gint get_by_type(struct obex_session *os, gchar *type, size_t *size)
149{148{
@@ -156,7 +155,7 @@
156 if (g_str_equal(type, LST_TYPE))155 if (g_str_equal(type, LST_TYPE))
157 return os_prepare_get(os, os->current_folder, size);156 return os_prepare_get(os, os->current_folder, size);
158157
159 return FALSE;158 return -ENOENT;
160}159}
161160
162static gint ftp_prepare_get(struct obex_session *os, gchar *file,161static gint ftp_prepare_get(struct obex_session *os, gchar *file,
@@ -465,8 +464,8 @@
465 .record = PCSUITE_RECORD,464 .record = PCSUITE_RECORD,
466 .target = FTP_TARGET,465 .target = FTP_TARGET,
467 .target_size = TARGET_SIZE,466 .target_size = TARGET_SIZE,
468 .who = PCSUITE_TARGET,467 .who = PCSUITE_WHO,
469 .who_size = TARGET_SIZE,468 .who_size = PCSUITE_WHO_SIZE,
470 .connect = ftp_connect,469 .connect = ftp_connect,
471 .get = ftp_get,470 .get = ftp_get,
472 .put = ftp_put,471 .put = ftp_put,
473472
=== modified file 'plugins/opp.c'
--- plugins/opp.c 2010-01-10 10:46:58 +0000
+++ plugins/opp.c 2010-04-28 20:38:30 +0000
@@ -2,9 +2,8 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2008 Nokia Corporation5 * Copyright (C) 2007-2010 Nokia Corporation
6 * Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT)6 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
7 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>
8 *7 *
9 *8 *
10 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
@@ -193,8 +192,11 @@
193 goto fail;192 goto fail;
194193
195 if (g_str_equal(os->type, VCARD_TYPE)) {194 if (g_str_equal(os->type, VCARD_TYPE)) {
196 if (os_prepare_get(os, VCARD_FILE, &size) < 0)195 if (os_prepare_get(os, VCARD_FILE, &size) < 0) {
197 goto fail;196 OBEX_ObjectSetRsp(obj, OBEX_RSP_NOT_FOUND,
197 OBEX_RSP_NOT_FOUND);
198 return;
199 }
198 } else200 } else
199 goto fail;201 goto fail;
200202
201203
=== modified file 'plugins/pbap.c'
--- plugins/pbap.c 2010-01-10 10:46:58 +0000
+++ plugins/pbap.c 2010-04-28 20:38:30 +0000
@@ -2,8 +2,8 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2009 Intel Corporation5 * Copyright (C) 2009-2010 Intel Corporation
6 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>6 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
7 *7 *
8 *8 *
9 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
@@ -558,6 +558,12 @@
558 unregister_session(os->cid);558 unregister_session(os->cid);
559}559}
560560
561static gint pbap_chkput(obex_t *obex, obex_object_t *obj)
562{
563 /* Rejects all PUTs */
564 return -EINVAL;
565}
566
561struct obex_service_driver pbap = {567struct obex_service_driver pbap = {
562 .name = "Phonebook Access server",568 .name = "Phonebook Access server",
563 .service = OBEX_PBAP,569 .service = OBEX_PBAP,
@@ -568,7 +574,8 @@
568 .connect = pbap_connect,574 .connect = pbap_connect,
569 .get = pbap_get,575 .get = pbap_get,
570 .setpath = pbap_setpath,576 .setpath = pbap_setpath,
571 .disconnect = pbap_disconnect577 .disconnect = pbap_disconnect,
578 .chkput = pbap_chkput
572};579};
573580
574static int pbap_init(void)581static int pbap_init(void)
575582
=== modified file 'plugins/phonebook-dummy.c'
--- plugins/phonebook-dummy.c 2010-01-10 10:46:58 +0000
+++ plugins/phonebook-dummy.c 2010-04-28 20:38:30 +0000
@@ -2,8 +2,8 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2009 Intel Corporation5 * Copyright (C) 2009-2010 Intel Corporation
6 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>6 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
7 *7 *
8 *8 *
9 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
1010
=== modified file 'plugins/phonebook-ebook.c'
--- plugins/phonebook-ebook.c 2010-01-10 10:46:58 +0000
+++ plugins/phonebook-ebook.c 2010-04-28 20:38:30 +0000
@@ -2,8 +2,8 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2009 Intel Corporation5 * Copyright (C) 2009-2010 Intel Corporation
6 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>6 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
7 *7 *
8 *8 *
9 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
@@ -113,7 +113,7 @@
113 for (l = attrib_list; l; l = l->next) {113 for (l = attrib_list; l; l = l->next) {
114 int i;114 int i;
115 const char *attrib_name = e_vcard_attribute_get_name(115 const char *attrib_name = e_vcard_attribute_get_name(
116 (EVCardAttribute *)l->data);116 (EVCardAttribute *) l->data);
117117
118 for (i = 0; i <= 28; i++) {118 for (i = 0; i <= 28; i++) {
119 int mask;119 int mask;
@@ -123,10 +123,9 @@
123 continue;123 continue;
124 if (g_strcmp0(vcard_attribs[i], attrib_name))124 if (g_strcmp0(vcard_attribs[i], attrib_name))
125 continue;125 continue;
126 e_vcard_add_attribute(126 e_vcard_add_attribute(evcard_filtered,
127 evcard_filtered,127 e_vcard_attribute_copy(
128 e_vcard_attribute_copy(128 (EVCardAttribute *) l->data));
129 (EVCardAttribute *)l->data));
130 break;129 break;
131 }130 }
132 }131 }
@@ -365,7 +364,7 @@
365 for (l = attrib_list; l; l = l->next) {364 for (l = attrib_list; l; l = l->next) {
366 int i;365 int i;
367 const char *attrib_name = e_vcard_attribute_get_name(366 const char *attrib_name = e_vcard_attribute_get_name(
368 (EVCardAttribute *)l->data);367 (EVCardAttribute *) l->data);
369 for (i = 0; i <= 28; i++) {368 for (i = 0; i <= 28; i++) {
370 int mask;369 int mask;
371370
@@ -375,11 +374,10 @@
375 if (g_strcmp0(vcard_attribs[i], attrib_name))374 if (g_strcmp0(vcard_attribs[i], attrib_name))
376 continue;375 continue;
377376
378 e_vcard_add_attribute(377 e_vcard_add_attribute(evcard_filtered,
379 evcard_filtered,378 e_vcard_attribute_copy(
380 e_vcard_attribute_copy(379 (EVCardAttribute *) l->data));
381 (EVCardAttribute *)l->data));380 break;
382 break;
383 }381 }
384 }382 }
385 vcard = e_vcard_to_string(evcard_filtered, params->format);383 vcard = e_vcard_to_string(evcard_filtered, params->format);
386384
=== modified file 'plugins/phonebook.h'
--- plugins/phonebook.h 2010-01-10 10:46:58 +0000
+++ plugins/phonebook.h 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
99
=== modified file 'plugins/syncevolution.c'
--- plugins/syncevolution.c 2010-01-10 10:46:58 +0000
+++ plugins/syncevolution.c 2010-04-28 20:38:30 +0000
@@ -2,8 +2,8 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2008 Intel Corporation5 * Copyright (C) 2007-2010 Intel Corporation
6 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>6 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
7 *7 *
8 *8 *
9 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
@@ -43,6 +43,7 @@
43#include "dbus.h"43#include "dbus.h"
44#include "btio.h"44#include "btio.h"
45#include "obexd.h"45#include "obexd.h"
46#include "gdbus.h"
4647
47#define SYNCML_TARGET_SIZE 1148#define SYNCML_TARGET_SIZE 11
4849
@@ -85,13 +86,13 @@
85#define SYNCE_SERVER_INTERFACE "org.syncevolution.Server"86#define SYNCE_SERVER_INTERFACE "org.syncevolution.Server"
86#define SYNCE_CONN_INTERFACE "org.syncevolution.Connection"87#define SYNCE_CONN_INTERFACE "org.syncevolution.Connection"
8788
88static char match_string[256];
89
90struct synce_context {89struct synce_context {
91 struct obex_session *os;90 struct obex_session *os;
92 DBusConnection *dbus_conn;91 DBusConnection *dbus_conn;
93 gchar *conn_obj;92 gchar *conn_obj;
94 gboolean reply_received;93 gboolean reply_received;
94 guint reply_watch;
95 guint abort_watch;
95};96};
9697
97struct callback_data {98struct callback_data {
@@ -115,20 +116,6 @@
115 return NULL;116 return NULL;
116}117}
117118
118static struct synce_context *find_context_by_conn_obj(const char *path)
119{
120 GSList *l;
121
122 for (l = context_list; l != NULL; l = l->next) {
123 struct synce_context *context = l->data;
124
125 if (strcmp(context->conn_obj, path) == 0)
126 return context;
127 }
128
129 return NULL;
130}
131
132static void append_dict_entry(DBusMessageIter *dict, const char *key,119static void append_dict_entry(DBusMessageIter *dict, const char *key,
133 int type, void *val)120 int type, void *val)
134{121{
@@ -141,17 +128,18 @@
141 dbus_message_iter_close_container(dict, &entry);128 dbus_message_iter_close_container(dict, &entry);
142}129}
143130
144static void handle_connection_reply_signal(DBusMessage *msg,131static gboolean reply_signal(DBusConnection *conn, DBusMessage *msg,
145 const char *obj_path, void *data)132 void *data)
146{133{
147 struct synce_context *context = data;134 struct synce_context *context = data;
148 struct obex_session *os = context->os;135 struct obex_session *os = context->os;
136 const char *path = dbus_message_get_path(msg);
149 DBusMessageIter iter, array_iter;137 DBusMessageIter iter, array_iter;
150 gchar *value;138 gchar *value;
151 gint length;139 gint length;
152140
153 if (strcmp(context->conn_obj, obj_path) != 0)141 if (strcmp(context->conn_obj, path) != 0)
154 return;142 return FALSE;
155143
156 dbus_message_iter_init(msg, &iter);144 dbus_message_iter_init(msg, &iter);
157145
@@ -159,7 +147,7 @@
159 dbus_message_iter_get_fixed_array(&array_iter, &value, &length);147 dbus_message_iter_get_fixed_array(&array_iter, &value, &length);
160148
161 if (length == 0)149 if (length == 0)
162 return;150 return TRUE;
163151
164 os->buf = g_malloc(length);152 os->buf = g_malloc(length);
165 memcpy(os->buf, value, length);153 memcpy(os->buf, value, length);
@@ -167,10 +155,12 @@
167 os->finished = TRUE;155 os->finished = TRUE;
168 context->reply_received = TRUE;156 context->reply_received = TRUE;
169 OBEX_ResumeRequest(os->obex);157 OBEX_ResumeRequest(os->obex);
158
159 return TRUE;
170}160}
171161
172static void handle_connection_abort_signal(DBusMessage *msg,162static gboolean abort_signal(DBusConnection *conn, DBusMessage *msg,
173 const char *obj_path, void *data)163 void *data)
174{164{
175 struct synce_context *context = data;165 struct synce_context *context = data;
176 struct obex_session *os = context->os;166 struct obex_session *os = context->os;
@@ -179,35 +169,12 @@
179 os->finished = TRUE;169 os->finished = TRUE;
180 OBEX_ResumeRequest(os->obex);170 OBEX_ResumeRequest(os->obex);
181 OBEX_TransportDisconnect(os->obex);171 OBEX_TransportDisconnect(os->obex);
182}172
183173 return TRUE;
184static DBusHandlerResult signal_filter(DBusConnection *conn,
185 DBusMessage *msg, void *data)
186{
187 const char *path = dbus_message_get_path(msg);
188 struct synce_context *context;
189
190 if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL)
191 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
192
193 context = find_context_by_conn_obj(path);
194 if (!context)
195 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
196
197 if (dbus_message_is_signal(msg, SYNCE_CONN_INTERFACE, "Reply")) {
198 debug("Reply signal is received.");
199 handle_connection_reply_signal(msg, path, context);
200 } else if (dbus_message_is_signal(msg, SYNCE_CONN_INTERFACE, "Abort")) {
201 debug("Abort signal is received.");
202 handle_connection_abort_signal(msg, path, context);
203 }
204
205 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
206}174}
207175
208static void connect_cb(DBusPendingCall *call, void *user_data)176static void connect_cb(DBusPendingCall *call, void *user_data)
209{177{
210 static gboolean signal_filter_added = FALSE;
211 struct callback_data *cb_data = user_data;178 struct callback_data *cb_data = user_data;
212 obex_t *obex = cb_data->obex;179 obex_t *obex = cb_data->obex;
213 obex_object_t *obj = cb_data->obj;180 obex_object_t *obj = cb_data->obj;
@@ -240,22 +207,13 @@
240 debug("Got conn object %s from syncevolution", path);207 debug("Got conn object %s from syncevolution", path);
241 context->conn_obj = g_strdup(path);208 context->conn_obj = g_strdup(path);
242209
243 /* add signal filter */210 context->reply_watch = g_dbus_add_signal_watch(conn, NULL, path,
244 if (!signal_filter_added) {211 SYNCE_CONN_INTERFACE, "Reply",
245 if (!dbus_connection_add_filter(conn, signal_filter,212 reply_signal, context, NULL);
246 os, NULL)) {
247 error("Can't add signal filter");
248 dbus_message_unref(reply);
249 g_free(cb_data);
250 goto failed;
251 }
252 signal_filter_added = TRUE;
253 }
254213
255 snprintf(match_string, sizeof(match_string), "type=signal,interface=%s,"214 context->abort_watch = g_dbus_add_signal_watch(conn, NULL, path,
256 "path=%s", SYNCE_CONN_INTERFACE, context->conn_obj);215 SYNCE_CONN_INTERFACE, "Abort",
257 dbus_bus_add_match(conn, match_string, NULL);216 abort_signal, context, NULL);
258 dbus_connection_flush(conn);
259217
260 dbus_message_unref(reply);218 dbus_message_unref(reply);
261 g_free(cb_data);219 g_free(cb_data);
@@ -311,7 +269,7 @@
311 struct callback_data *cb_data;269 struct callback_data *cb_data;
312 struct synce_context *context;270 struct synce_context *context;
313271
314 conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);272 conn = obex_dbus_get_connection();
315 if (!conn)273 if (!conn)
316 goto failed;274 goto failed;
317275
@@ -507,10 +465,11 @@
507 dbus_pending_call_unref(call);465 dbus_pending_call_unref(call);
508466
509failed:467failed:
510 snprintf(match_string, sizeof(match_string),468 g_dbus_remove_watch(context->dbus_conn, context->reply_watch);
511 "type=signal,interface=%s,path=%s",469 context->reply_watch = 0;
512 SYNCE_CONN_INTERFACE, context->conn_obj);470 g_dbus_remove_watch(context->dbus_conn, context->abort_watch);
513 dbus_bus_remove_match(context->dbus_conn, match_string, NULL);471 context->abort_watch = 0;
472
514 g_free(context->conn_obj);473 g_free(context->conn_obj);
515 context->conn_obj = NULL;474 context->conn_obj = NULL;
516475
517476
=== modified file 'plugins/telephony-dummy.c'
--- plugins/telephony-dummy.c 2010-01-10 10:46:58 +0000
+++ plugins/telephony-dummy.c 2010-04-28 20:38:30 +0000
@@ -2,8 +2,8 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2009 Intel Corporation5 * Copyright (C) 2009-2010 Intel Corporation
6 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>6 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
7 *7 *
8 *8 *
9 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
1010
=== modified file 'plugins/telephony.h'
--- plugins/telephony.h 2010-01-10 10:46:58 +0000
+++ plugins/telephony.h 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
99
=== modified file 'src/bluetooth.c'
--- src/bluetooth.c 2010-01-10 10:46:58 +0000
+++ src/bluetooth.c 2010-04-28 20:38:30 +0000
@@ -2,9 +2,8 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2008 Nokia Corporation5 * Copyright (C) 2007-2010 Nokia Corporation
6 * Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT)6 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
7 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>
8 *7 *
9 *8 *
10 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
1110
=== modified file 'src/bluetooth.h'
--- src/bluetooth.h 2010-01-10 10:46:58 +0000
+++ src/bluetooth.h 2010-04-28 20:38:30 +0000
@@ -2,9 +2,8 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2008 Nokia Corporation5 * Copyright (C) 2007-2010 Nokia Corporation
6 * Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT)6 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
7 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>
8 *7 *
9 *8 *
10 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
1110
=== modified file 'src/btio.c'
--- src/btio.c 2010-01-10 10:46:58 +0000
+++ src/btio.c 2010-04-28 20:38:30 +0000
@@ -2,8 +2,8 @@
2 *2 *
3 * BlueZ - Bluetooth protocol stack for Linux3 * BlueZ - Bluetooth protocol stack for Linux
4 *4 *
5 * Copyright (C) 2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2009-2010 Marcel Holtmann <marcel@holtmann.org>
6 * Copyright (C) 2009 Nokia Corporation6 * Copyright (C) 2009-2010 Nokia Corporation
7 *7 *
8 *8 *
9 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
1010
=== modified file 'src/btio.h'
--- src/btio.h 2010-01-10 10:46:58 +0000
+++ src/btio.h 2010-04-28 20:38:30 +0000
@@ -2,8 +2,8 @@
2 *2 *
3 * BlueZ - Bluetooth protocol stack for Linux3 * BlueZ - Bluetooth protocol stack for Linux
4 *4 *
5 * Copyright (C) 2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2009-2010 Marcel Holtmann <marcel@holtmann.org>
6 * Copyright (C) 2009 Nokia Corporation6 * Copyright (C) 2009-2010 Nokia Corporation
7 *7 *
8 *8 *
9 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
1010
=== modified file 'src/dbus.h'
--- src/dbus.h 2009-07-27 19:02:30 +0000
+++ src/dbus.h 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT)5 * Copyright (C) 2007-2010 Nokia Corporation
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
99
=== modified file 'src/logging.c'
--- src/logging.c 2009-07-27 19:02:30 +0000
+++ src/logging.c 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
99
=== modified file 'src/logging.h'
--- src/logging.h 2009-07-27 19:02:30 +0000
+++ src/logging.h 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
99
=== modified file 'src/main.c'
--- src/main.c 2010-01-10 10:46:58 +0000
+++ src/main.c 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
99
=== modified file 'src/manager.c'
--- src/manager.c 2010-01-10 10:46:58 +0000
+++ src/manager.c 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
@@ -528,7 +528,8 @@
528528
529 dbus_error_init(&err);529 dbus_error_init(&err);
530530
531 connection = g_dbus_setup_bus(DBUS_BUS_SESSION, OPENOBEX_SERVICE, &err);531 connection = g_dbus_setup_private(DBUS_BUS_SESSION, OPENOBEX_SERVICE,
532 &err);
532 if (connection == NULL) {533 if (connection == NULL) {
533 if (dbus_error_is_set(&err) == TRUE) {534 if (dbus_error_is_set(&err) == TRUE) {
534 fprintf(stderr, "%s\n", err.message);535 fprintf(stderr, "%s\n", err.message);
@@ -539,8 +540,11 @@
539 }540 }
540541
541 system_conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, NULL);542 system_conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, NULL);
542 if (system_conn == NULL)543 if (system_conn == NULL) {
544 dbus_connection_unref(connection);
545 connection = NULL;
543 return FALSE;546 return FALSE;
547 }
544548
545 listener_id = g_dbus_add_service_watch(system_conn, "org.bluez",549 listener_id = g_dbus_add_service_watch(system_conn, "org.bluez",
546 name_acquired, name_released, NULL, NULL);550 name_acquired, name_released, NULL, NULL);
@@ -1028,4 +1032,10 @@
1028 g_free(path);1032 g_free(path);
1029}1033}
10301034
1035DBusConnection *obex_dbus_get_connection(void)
1036{
1037 if (connection == NULL)
1038 return NULL;
10311039
1040 return dbus_connection_ref(connection);
1041}
10321042
=== modified file 'src/mimetype.c'
--- src/mimetype.c 2010-01-10 10:46:58 +0000
+++ src/mimetype.c 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
@@ -38,6 +38,85 @@
3838
39static GSList *drivers = NULL;39static GSList *drivers = NULL;
4040
41static GSList *watches = NULL;
42
43struct io_watch {
44 gpointer object;
45 obex_object_io_func func;
46 gpointer user_data;
47};
48
49void obex_object_set_io_flags(gpointer object, int flags, int err)
50{
51 GSList *l;
52
53 for (l = watches; l; l = l->next) {
54 struct io_watch *watch = l->data;
55
56 if (watch->object != object)
57 continue;
58
59 if (watch->func(object, flags, err, watch->user_data) == TRUE)
60 continue;
61
62 if (g_slist_find(watches, watch) == NULL)
63 continue;
64
65 watches = g_slist_remove(watches, watch);
66 g_free(watch);
67 }
68}
69
70static struct io_watch *find_io_watch(gpointer object)
71{
72 GSList *l;
73
74 for (l = watches; l; l = l->next) {
75 struct io_watch *watch = l->data;
76
77 if (watch->object == object)
78 return watch;
79 }
80
81 return NULL;
82}
83
84static void reset_io_watch(gpointer object)
85{
86 struct io_watch *watch;
87
88 watch = find_io_watch(object);
89 if (watch == NULL)
90 return;
91
92 watches = g_slist_remove(watches, watch);
93 g_free(watch);
94}
95
96static int set_io_watch(gpointer object, obex_object_io_func func,
97 gpointer user_data)
98{
99 struct io_watch *watch;
100
101 if (func == NULL) {
102 reset_io_watch(object);
103 return 0;
104 }
105
106 watch = find_io_watch(object);
107 if (watch)
108 return -EPERM;
109
110 watch = g_new0(struct io_watch, 1);
111 watch->object = object;
112 watch->func = func;
113 watch->user_data = user_data;
114
115 watches = g_slist_append(watches, watch);
116
117 return 0;
118}
119
41struct obex_mime_type_driver *obex_mime_type_driver_find(const guint8 *target, const char *mimetype)120struct obex_mime_type_driver *obex_mime_type_driver_find(const guint8 *target, const char *mimetype)
42{121{
43 GSList *l;122 GSList *l;
@@ -68,6 +147,9 @@
68 return -EPERM;147 return -EPERM;
69 }148 }
70149
150 if (driver->set_io_watch == NULL)
151 driver->set_io_watch = set_io_watch;
152
71 debug("driver %p mimetype %s registered", driver, driver->mimetype);153 debug("driver %p mimetype %s registered", driver, driver->mimetype);
72154
73 drivers = g_slist_append(drivers, driver);155 drivers = g_slist_append(drivers, driver);
74156
=== modified file 'src/mimetype.h'
--- src/mimetype.h 2010-01-10 10:46:58 +0000
+++ src/mimetype.h 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
@@ -23,17 +23,25 @@
2323
24#define TARGET_SIZE 1624#define TARGET_SIZE 16
2525
26typedef gboolean (*obex_object_io_func) (gpointer object, int flags, int err,
27 gpointer user_data);
28
26struct obex_mime_type_driver {29struct obex_mime_type_driver {
27 const guint8 *target;30 const guint8 *target;
28 const char *mimetype;31 const char *mimetype;
29 gpointer (*open) (const char *name, int oflag, mode_t mode, size_t *size);32 gpointer (*open) (const char *name, int oflag, mode_t mode,
33 size_t *size, int *err);
30 int (*close) (gpointer object);34 int (*close) (gpointer object);
31 ssize_t (*read) (gpointer object, void *buf, size_t count);35 ssize_t (*read) (gpointer object, void *buf, size_t count);
32 ssize_t (*write) (gpointer object, const void *buf, size_t count);36 ssize_t (*write) (gpointer object, const void *buf, size_t count);
33 int (*remove) (const char *name);37 int (*remove) (const char *name);
38 int (*set_io_watch) (gpointer object, obex_object_io_func func,
39 gpointer user_data);
34};40};
3541
36int obex_mime_type_driver_register(struct obex_mime_type_driver *driver);42int obex_mime_type_driver_register(struct obex_mime_type_driver *driver);
37void obex_mime_type_driver_unregister(struct obex_mime_type_driver *driver);43void obex_mime_type_driver_unregister(struct obex_mime_type_driver *driver);
38struct obex_mime_type_driver *obex_mime_type_driver_find(const guint8 *target,44struct obex_mime_type_driver *obex_mime_type_driver_find(const guint8 *target,
39 const char *mimetype);45 const char *mimetype);
46
47void obex_object_set_io_flags(gpointer object, int flags, int err);
4048
=== modified file 'src/obex.c'
--- src/obex.c 2010-01-10 10:46:58 +0000
+++ src/obex.c 2010-04-28 20:38:30 +0000
@@ -2,9 +2,8 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2008 Nokia Corporation5 * Copyright (C) 2007-2010 Nokia Corporation
6 * Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT)6 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
7 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>
8 *7 *
9 *8 *
10 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
@@ -68,8 +67,10 @@
68static void os_reset_session(struct obex_session *os)67static void os_reset_session(struct obex_session *os)
69{68{
70 if (os->object) {69 if (os->object) {
70 os->driver->set_io_watch(os->object, NULL, NULL);
71 os->driver->close(os->object);71 os->driver->close(os->object);
72 os->object = NULL;72 os->object = NULL;
73 os->obj = NULL;
73 if (os->aborted && os->cmd == OBEX_CMD_PUT && os->current_folder) {74 if (os->aborted && os->cmd == OBEX_CMD_PUT && os->current_folder) {
74 gchar *path;75 gchar *path;
75 path = g_build_filename(os->current_folder, os->name, NULL);76 path = g_build_filename(os->current_folder, os->name, NULL);
@@ -90,6 +91,7 @@
90 g_free(os->buf);91 g_free(os->buf);
91 os->buf = NULL;92 os->buf = NULL;
92 }93 }
94
93 os->driver = NULL;95 os->driver = NULL;
94 os->aborted = FALSE;96 os->aborted = FALSE;
95 os->offset = 0;97 os->offset = 0;
@@ -386,10 +388,9 @@
386 gint err;388 gint err;
387 gpointer object;389 gpointer object;
388390
389 object = os->driver->open(filename, O_RDONLY, 0, size);391 object = os->driver->open(filename, O_RDONLY, 0, size, &err);
390 if (object == NULL) {392 if (object == NULL) {
391 err = -errno;393 error("open(%s): %s (%d)", filename, strerror(-err), -err);
392 error("open(%s): %s (%d)", filename, strerror(errno), errno);
393 goto fail;394 goto fail;
394 }395 }
395396
@@ -432,11 +433,13 @@
432433
433 len = os->driver->read(os->object, os->buf, os->tx_mtu);434 len = os->driver->read(os->object, os->buf, os->tx_mtu);
434 if (len < 0) {435 if (len < 0) {
435 gint err = errno;436 error("read(): %s (%d)", strerror(-len), -len);
436 error("read(): %s (%d)", strerror(err), err);437 if (len == -EAGAIN)
438 return len;
439
437 g_free(os->buf);440 g_free(os->buf);
438 os->buf = NULL;441 os->buf = NULL;
439 return -err;442 return len;
440 }443 }
441444
442 ptr = os->buf;445 ptr = os->buf;
@@ -465,13 +468,14 @@
465{468{
466 gchar *path;469 gchar *path;
467 gint len;470 gint len;
471 int err;
468472
469 path = g_build_filename(os->current_folder, os->name, NULL);473 path = g_build_filename(os->current_folder, os->name, NULL);
470 os->object = os->driver->open(path, O_WRONLY | O_CREAT | O_TRUNC, 0600,474 os->object = os->driver->open(path, O_WRONLY | O_CREAT | O_TRUNC, 0600,
471 os->size != OBJECT_SIZE_UNKNOWN ?475 os->size != OBJECT_SIZE_UNKNOWN ?
472 (size_t *) &os->size : NULL);476 (size_t *) &os->size : NULL, &err);
473 if (os->object == NULL) {477 if (os->object == NULL) {
474 error("open(%s): %s (%d)", path, strerror(errno), errno);478 error("open(%s): %s (%d)", path, strerror(-err), -err);
475 g_free(path);479 g_free(path);
476 return -EPERM;480 return -EPERM;
477 }481 }
@@ -489,13 +493,11 @@
489493
490 w = os->driver->write(os->object, os->buf + len, os->offset - len);494 w = os->driver->write(os->object, os->buf + len, os->offset - len);
491 if (w < 0) {495 if (w < 0) {
492 gint err = errno;496 error("write(%s): %s (%d)", path, strerror(-w), -w);
493 error("write(%s): %s (%d)", path, strerror(errno),497 if (w == -EINTR)
494 errno);
495 if (err == EINTR)
496 continue;498 continue;
497 else499 else
498 return -err;500 return w;
499 }501 }
500502
501 len += w;503 len += w;
@@ -544,11 +546,10 @@
544546
545 w = os->driver->write(os->object, buffer + len, size - len);547 w = os->driver->write(os->object, buffer + len, size - len);
546 if (w < 0) {548 if (w < 0) {
547 gint err = errno;549 if (w == -EINTR)
548 if (err == EINTR)
549 continue;550 continue;
550 else551 else
551 return -err;552 return w;
552 }553 }
553554
554 len += w;555 len += w;
@@ -559,6 +560,44 @@
559 return 0;560 return 0;
560}561}
561562
563static gboolean handle_async_io(gpointer object, int flags, int err,
564 gpointer user_data)
565{
566 struct obex_session *os = user_data;
567 int ret = 0;
568
569 if (err < 0) {
570 ret = err;
571 goto proceed;
572 }
573
574 if (flags & (G_IO_IN | G_IO_PRI))
575 ret = obex_write_stream(os, os->obex, os->obj);
576 else if (flags & G_IO_OUT)
577 ret = obex_read_stream(os, os->obex, os->obj);
578
579proceed:
580 switch (ret) {
581 case -EINVAL:
582 OBEX_ObjectSetRsp(os->obj, OBEX_RSP_BAD_REQUEST,
583 OBEX_RSP_BAD_REQUEST);
584 case -EPERM:
585 OBEX_ObjectSetRsp(os->obj, OBEX_RSP_FORBIDDEN,
586 OBEX_RSP_FORBIDDEN);
587 break;
588 default:
589 if (ret < 0)
590 OBEX_ObjectSetRsp(os->obj,
591 OBEX_RSP_INTERNAL_SERVER_ERROR,
592 OBEX_RSP_INTERNAL_SERVER_ERROR);
593 break;
594 }
595
596 OBEX_ResumeRequest(os->obex);
597
598 return FALSE;
599}
600
562static gboolean check_put(obex_t *obex, obex_object_t *obj)601static gboolean check_put(obex_t *obex, obex_object_t *obj)
563{602{
564 struct obex_session *os;603 struct obex_session *os;
@@ -645,7 +684,7 @@
645 }684 }
646 }685 }
647686
648 if (!os->service || !os->service->chkput)687 if (!os->service->chkput)
649 goto done;688 goto done;
650689
651 ret = os->service->chkput(obex, obj);690 ret = os->service->chkput(obex, obj);
@@ -659,6 +698,11 @@
659 case -EPERM:698 case -EPERM:
660 OBEX_ObjectSetRsp(obj, OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN);699 OBEX_ObjectSetRsp(obj, OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN);
661 return FALSE;700 return FALSE;
701 case -EAGAIN:
702 OBEX_SuspendRequest(obex, obj);
703 os->obj = obj;
704 os->driver->set_io_watch(os->object, handle_async_io, os);
705 return TRUE;
662 default:706 default:
663 debug("Unhandled chkput error: %d", ret);707 debug("Unhandled chkput error: %d", ret);
664 OBEX_ObjectSetRsp(obj, OBEX_RSP_INTERNAL_SERVER_ERROR,708 OBEX_ObjectSetRsp(obj, OBEX_RSP_INTERNAL_SERVER_ERROR,
@@ -727,13 +771,12 @@
727 case OBEX_CMD_PUT:771 case OBEX_CMD_PUT:
728 case OBEX_CMD_GET:772 case OBEX_CMD_GET:
729 case OBEX_CMD_SETPATH:773 case OBEX_CMD_SETPATH:
774 default:
730 os_session_mark_aborted(os);775 os_session_mark_aborted(os);
731 if (os->service->reset)776 if (os->service->reset)
732 os->service->reset(obex);777 os->service->reset(obex);
733 os_reset_session(os);778 os_reset_session(os);
734 break;779 break;
735 default:
736 break;
737 }780 }
738 break;781 break;
739 case OBEX_EV_REQHINT:782 case OBEX_EV_REQHINT:
@@ -758,7 +801,7 @@
758 case OBEX_EV_REQCHECK:801 case OBEX_EV_REQCHECK:
759 switch (cmd) {802 switch (cmd) {
760 case OBEX_CMD_PUT:803 case OBEX_CMD_PUT:
761 if (os->service && os->service->put)804 if (os->service)
762 check_put(obex, obj);805 check_put(obex, obj);
763 break;806 break;
764 default:807 default:
@@ -796,6 +839,11 @@
796 OBEX_ObjectSetRsp(obj,839 OBEX_ObjectSetRsp(obj,
797 OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN);840 OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN);
798 break;841 break;
842 case -EAGAIN:
843 OBEX_SuspendRequest(obex, obj);
844 os->obj = obj;
845 os->driver->set_io_watch(os->object, handle_async_io, os);
846 break;
799 default:847 default:
800 OBEX_ObjectSetRsp(obj,848 OBEX_ObjectSetRsp(obj,
801 OBEX_RSP_INTERNAL_SERVER_ERROR,849 OBEX_RSP_INTERNAL_SERVER_ERROR,
@@ -805,7 +853,21 @@
805853
806 break;854 break;
807 case OBEX_EV_STREAMEMPTY:855 case OBEX_EV_STREAMEMPTY:
808 obex_write_stream(os, obex, obj);856 switch (obex_write_stream(os, obex, obj)) {
857 case -EPERM:
858 OBEX_ObjectSetRsp(obj,
859 OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN);
860 break;
861 case -EAGAIN:
862 OBEX_SuspendRequest(obex, obj);
863 os->obj = obj;
864 os->driver->set_io_watch(os->object, handle_async_io,
865 os);
866 break;
867 default:
868 break;
869 }
870
809 break;871 break;
810 case OBEX_EV_LINKERR:872 case OBEX_EV_LINKERR:
811 break;873 break;
812874
=== modified file 'src/obex.h'
--- src/obex.h 2010-01-10 10:46:58 +0000
+++ src/obex.h 2010-04-28 20:38:30 +0000
@@ -2,9 +2,8 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2008 Nokia Corporation5 * Copyright (C) 2007-2010 Nokia Corporation
6 * Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT)6 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
7 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>
8 *7 *
9 *8 *
10 * This program is free software; you can redistribute it and/or modify9 * This program is free software; you can redistribute it and/or modify
@@ -78,6 +77,7 @@
78 struct server *server;77 struct server *server;
79 gboolean checked;78 gboolean checked;
80 obex_t *obex;79 obex_t *obex;
80 obex_object_t *obj;
81 struct obex_mime_type_driver *driver;81 struct obex_mime_type_driver *driver;
82 gboolean finished;82 gboolean finished;
83};83};
8484
=== modified file 'src/obexd.h'
--- src/obexd.h 2009-07-27 19:02:30 +0000
+++ src/obexd.h 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
@@ -21,6 +21,8 @@
21 *21 *
22 */22 */
2323
24#include <dbus/dbus.h>
25
24#define OPENOBEX_SERVICE "org.openobex"26#define OPENOBEX_SERVICE "org.openobex"
2527
26#define OPENOBEX_MANAGER_PATH "/"28#define OPENOBEX_MANAGER_PATH "/"
@@ -34,3 +36,5 @@
3436
35gboolean plugin_init(void);37gboolean plugin_init(void);
36void plugin_cleanup(void);38void plugin_cleanup(void);
39
40DBusConnection *obex_dbus_get_connection(void);
3741
=== modified file 'src/plugin.c'
--- src/plugin.c 2010-01-10 10:46:58 +0000
+++ src/plugin.c 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
99
=== modified file 'src/plugin.h'
--- src/plugin.h 2010-01-10 10:46:58 +0000
+++ src/plugin.h 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
99
=== modified file 'src/service.c'
--- src/service.c 2010-01-10 10:46:58 +0000
+++ src/service.c 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
@@ -49,8 +49,8 @@
49 struct obex_service_driver *driver = l->data;49 struct obex_service_driver *driver = l->data;
5050
51 if (driver->who && who &&51 if (driver->who && who &&
52 driver->who_size == who_size &&52 (driver->who_size != who_size ||
53 memcmp(driver->who, who, who_size) != 0)53 memcmp(driver->who, who, who_size) != 0))
54 continue;54 continue;
5555
56 if (driver->target == NULL && target == NULL)56 if (driver->target == NULL && target == NULL)
@@ -97,7 +97,11 @@
9797
98 debug("driver %p service %s registered", driver, driver->name);98 debug("driver %p service %s registered", driver, driver->name);
9999
100 drivers = g_slist_append(drivers, driver);100 /* Drivers that support who has priority */
101 if (driver->who)
102 drivers = g_slist_prepend(drivers, driver);
103 else
104 drivers = g_slist_append(drivers, driver);
101105
102 return 0;106 return 0;
103}107}
104108
=== modified file 'src/service.h'
--- src/service.h 2010-01-10 10:46:58 +0000
+++ src/service.h 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Server3 * OBEX Server
4 *4 *
5 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
99
=== modified file 'test/ftp-client'
--- test/ftp-client 2009-07-27 19:02:30 +0000
+++ test/ftp-client 2010-04-28 20:38:30 +0000
@@ -15,6 +15,11 @@
15 self.verbose = verbose15 self.verbose = verbose
1616
17 @dbus.service.method("org.openobex.Agent",17 @dbus.service.method("org.openobex.Agent",
18 in_signature="o", out_signature="s")
19 def Request(self, path):
20 return ""
21
22 @dbus.service.method("org.openobex.Agent",
18 in_signature="ot", out_signature="")23 in_signature="ot", out_signature="")
19 def Progress(self, path, transferred):24 def Progress(self, path, transferred):
20 if self.verbose:25 if self.verbose:
@@ -55,6 +60,11 @@
5560
56 return parser.parse_args()61 return parser.parse_args()
5762
63def error(err):
64 print err
65
66def void_reply():
67 pass
5868
59def change_folder(session, new_dir):69def change_folder(session, new_dir):
60 for node in new_dir.split("/"):70 for node in new_dir.split("/"):
@@ -69,11 +79,15 @@
6979
70def put_file(session, filename):80def put_file(session, filename):
71 session.PutFile(os.path.abspath(filename),81 session.PutFile(os.path.abspath(filename),
72 os.path.basename(filename))82 os.path.basename(filename),
83 reply_handler=void_reply,
84 error_handler=error)
7385
74def get_file(session, filename):86def get_file(session, filename):
75 session.GetFile(os.path.abspath(filename),87 session.GetFile(os.path.abspath(filename),
76 os.path.basename(filename))88 os.path.basename(filename),
89 reply_handler=void_reply,
90 error_handler=error)
7791
7892
79if __name__ == '__main__':93if __name__ == '__main__':
@@ -91,8 +105,6 @@
91 bus = dbus.SessionBus()105 bus = dbus.SessionBus()
92 mainloop = gobject.MainLoop()106 mainloop = gobject.MainLoop()
93107
94 need_mainloop = False
95
96 path = "/test/agent"108 path = "/test/agent"
97 agent = Agent(bus, path, options.verbose)109 agent = Agent(bus, path, options.verbose)
98110
@@ -117,12 +129,9 @@
117 list_folder(ftp)129 list_folder(ftp)
118130
119 if options.get_file:131 if options.get_file:
120 need_mainloop = True
121 get_file(ftp, options.get_file)132 get_file(ftp, options.get_file)
122133
123 if options.put_file:134 if options.put_file:
124 need_mainloop = True
125 put_file(ftp, options.put_file)135 put_file(ftp, options.put_file)
126136
127 if need_mainloop:137 mainloop.run()
128 mainloop.run()
129138
=== modified file 'test/main.c'
--- test/main.c 2009-07-27 19:02:30 +0000
+++ test/main.c 2010-04-28 20:38:30 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * OBEX Test3 * OBEX Test
4 *4 *
5 * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>5 * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
6 *6 *
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify

Subscribers

People subscribed via source and target branches