Merge lp:~bluetooth/ubuntu/lucid/obexd/main into lp:ubuntu/lucid/obexd
- Lucid (10.04)
- main
- Merge into lucid
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu branches | Pending | ||
Review via email: mp+24151@code.launchpad.net |
Commit message
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
1 | === modified file 'ChangeLog' | |||
2 | --- ChangeLog 2010-01-10 10:46:58 +0000 | |||
3 | +++ ChangeLog 2010-04-28 20:38:30 +0000 | |||
4 | @@ -1,3 +1,15 @@ | |||
5 | 1 | ver 0.22: | ||
6 | 2 | Fix file corruption during PUT operation. | ||
7 | 3 | Fix the response of PUT requests for PBAP. | ||
8 | 4 | Fix blocking while waiting capability script to exit. | ||
9 | 5 | Fix compilation issues with driver and plugin options. | ||
10 | 6 | Fix service driver selection when WHO header is informed. | ||
11 | 7 | Fix issue with PC-Suite WHO header. | ||
12 | 8 | Fix issue when mime type exists but is unknown. | ||
13 | 9 | Fix issue when opening file fails during SendFiles. | ||
14 | 10 | Fix error code response when there is no default vCard. | ||
15 | 11 | Fix a memory leak when opening a folder for listing. | ||
16 | 12 | |||
17 | 1 | ver 0.21: | 13 | ver 0.21: |
18 | 2 | Fix crash caused by D-Bus timeout handling. | 14 | Fix crash caused by D-Bus timeout handling. |
19 | 3 | Fix issue when the object size is unknown. | 15 | Fix issue when the object size is unknown. |
20 | 4 | 16 | ||
21 | === modified file 'Makefile.am' | |||
22 | --- Makefile.am 2010-01-10 10:46:58 +0000 | |||
23 | +++ Makefile.am 2010-04-28 20:38:30 +0000 | |||
24 | @@ -90,6 +90,7 @@ | |||
25 | 90 | 90 | ||
26 | 91 | client_obex_client_SOURCES = $(gdbus_sources) $(gwobex_sources) client/main.c \ | 91 | client_obex_client_SOURCES = $(gdbus_sources) $(gwobex_sources) client/main.c \ |
27 | 92 | client/session.h client/session.c \ | 92 | client/session.h client/session.c \ |
28 | 93 | src/logging.h src/logging.c \ | ||
29 | 93 | client/pbap.h client/pbap.c \ | 94 | client/pbap.h client/pbap.c \ |
30 | 94 | client/sync.h client/sync.c | 95 | client/sync.h client/sync.c |
31 | 95 | 96 | ||
32 | 96 | 97 | ||
33 | === modified file 'Makefile.in' | |||
34 | --- Makefile.in 2010-01-10 10:46:58 +0000 | |||
35 | +++ Makefile.in 2010-04-28 20:38:30 +0000 | |||
36 | @@ -1,4 +1,4 @@ | |||
38 | 1 | # Makefile.in generated by automake 1.11 from Makefile.am. | 1 | # Makefile.in generated by automake 1.11.1 from Makefile.am. |
39 | 2 | # @configure_input@ | 2 | # @configure_input@ |
40 | 3 | 3 | ||
41 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
42 | @@ -89,8 +89,9 @@ | |||
43 | 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 \ |
44 | 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 \ |
45 | 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 \ |
48 | 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 \ |
49 | 93 | client/pbap.c client/sync.h client/sync.c | 93 | src/logging.c client/pbap.h client/pbap.c client/sync.h \ |
50 | 94 | client/sync.c | ||
51 | 94 | am__dirstamp = $(am__leading_dot)dirstamp | 95 | am__dirstamp = $(am__leading_dot)dirstamp |
52 | 95 | am__objects_1 = gdbus/mainloop.$(OBJEXT) gdbus/object.$(OBJEXT) \ | 96 | am__objects_1 = gdbus/mainloop.$(OBJEXT) gdbus/object.$(OBJEXT) \ |
53 | 96 | gdbus/watch.$(OBJEXT) | 97 | gdbus/watch.$(OBJEXT) |
54 | @@ -98,8 +99,8 @@ | |||
55 | 98 | gwobex/obex-xfer.$(OBJEXT) gwobex/utils.$(OBJEXT) | 99 | gwobex/obex-xfer.$(OBJEXT) gwobex/utils.$(OBJEXT) |
56 | 99 | @CLIENT_TRUE@am_client_obex_client_OBJECTS = $(am__objects_1) \ | 100 | @CLIENT_TRUE@am_client_obex_client_OBJECTS = $(am__objects_1) \ |
57 | 100 | @CLIENT_TRUE@ $(am__objects_2) client/main.$(OBJEXT) \ | 101 | @CLIENT_TRUE@ $(am__objects_2) client/main.$(OBJEXT) \ |
60 | 101 | @CLIENT_TRUE@ client/session.$(OBJEXT) client/pbap.$(OBJEXT) \ | 102 | @CLIENT_TRUE@ client/session.$(OBJEXT) src/logging.$(OBJEXT) \ |
61 | 102 | @CLIENT_TRUE@ client/sync.$(OBJEXT) | 103 | @CLIENT_TRUE@ client/pbap.$(OBJEXT) client/sync.$(OBJEXT) |
62 | 103 | client_obex_client_OBJECTS = $(am_client_obex_client_OBJECTS) | 104 | client_obex_client_OBJECTS = $(am_client_obex_client_OBJECTS) |
63 | 104 | client_obex_client_DEPENDENCIES = | 105 | client_obex_client_DEPENDENCIES = |
64 | 105 | AM_V_lt = $(am__v_lt_$(V)) | 106 | AM_V_lt = $(am__v_lt_$(V)) |
65 | @@ -354,6 +355,7 @@ | |||
66 | 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@ |
67 | 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 \ |
68 | 356 | @CLIENT_TRUE@ client/session.h client/session.c \ | 357 | @CLIENT_TRUE@ client/session.h client/session.c \ |
69 | 358 | @CLIENT_TRUE@ src/logging.h src/logging.c \ | ||
70 | 357 | @CLIENT_TRUE@ client/pbap.h client/pbap.c \ | 359 | @CLIENT_TRUE@ client/pbap.h client/pbap.c \ |
71 | 358 | @CLIENT_TRUE@ client/sync.h client/sync.c | 360 | @CLIENT_TRUE@ client/sync.h client/sync.c |
72 | 359 | 361 | ||
73 | @@ -552,6 +554,14 @@ | |||
74 | 552 | client/$(DEPDIR)/$(am__dirstamp) | 554 | client/$(DEPDIR)/$(am__dirstamp) |
75 | 553 | client/session.$(OBJEXT): client/$(am__dirstamp) \ | 555 | client/session.$(OBJEXT): client/$(am__dirstamp) \ |
76 | 554 | client/$(DEPDIR)/$(am__dirstamp) | 556 | client/$(DEPDIR)/$(am__dirstamp) |
77 | 557 | src/$(am__dirstamp): | ||
78 | 558 | @$(MKDIR_P) src | ||
79 | 559 | @: > src/$(am__dirstamp) | ||
80 | 560 | src/$(DEPDIR)/$(am__dirstamp): | ||
81 | 561 | @$(MKDIR_P) src/$(DEPDIR) | ||
82 | 562 | @: > src/$(DEPDIR)/$(am__dirstamp) | ||
83 | 563 | src/logging.$(OBJEXT): src/$(am__dirstamp) \ | ||
84 | 564 | src/$(DEPDIR)/$(am__dirstamp) | ||
85 | 555 | client/pbap.$(OBJEXT): client/$(am__dirstamp) \ | 565 | client/pbap.$(OBJEXT): client/$(am__dirstamp) \ |
86 | 556 | client/$(DEPDIR)/$(am__dirstamp) | 566 | client/$(DEPDIR)/$(am__dirstamp) |
87 | 557 | client/sync.$(OBJEXT): client/$(am__dirstamp) \ | 567 | client/sync.$(OBJEXT): client/$(am__dirstamp) \ |
88 | @@ -575,17 +585,9 @@ | |||
89 | 575 | plugins/$(DEPDIR)/$(am__dirstamp) | 585 | plugins/$(DEPDIR)/$(am__dirstamp) |
90 | 576 | plugins/syncevolution.$(OBJEXT): plugins/$(am__dirstamp) \ | 586 | plugins/syncevolution.$(OBJEXT): plugins/$(am__dirstamp) \ |
91 | 577 | plugins/$(DEPDIR)/$(am__dirstamp) | 587 | plugins/$(DEPDIR)/$(am__dirstamp) |
92 | 578 | src/$(am__dirstamp): | ||
93 | 579 | @$(MKDIR_P) src | ||
94 | 580 | @: > src/$(am__dirstamp) | ||
95 | 581 | src/$(DEPDIR)/$(am__dirstamp): | ||
96 | 582 | @$(MKDIR_P) src/$(DEPDIR) | ||
97 | 583 | @: > src/$(DEPDIR)/$(am__dirstamp) | ||
98 | 584 | src/main.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) | 588 | src/main.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) |
99 | 585 | src/plugin.$(OBJEXT): src/$(am__dirstamp) \ | 589 | src/plugin.$(OBJEXT): src/$(am__dirstamp) \ |
100 | 586 | src/$(DEPDIR)/$(am__dirstamp) | 590 | src/$(DEPDIR)/$(am__dirstamp) |
101 | 587 | src/logging.$(OBJEXT): src/$(am__dirstamp) \ | ||
102 | 588 | src/$(DEPDIR)/$(am__dirstamp) | ||
103 | 589 | src/btio.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) | 591 | src/btio.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) |
104 | 590 | src/manager.$(OBJEXT): src/$(am__dirstamp) \ | 592 | src/manager.$(OBJEXT): src/$(am__dirstamp) \ |
105 | 591 | src/$(DEPDIR)/$(am__dirstamp) | 593 | src/$(DEPDIR)/$(am__dirstamp) |
106 | @@ -822,7 +824,8 @@ | |||
107 | 822 | fi; \ | 824 | fi; \ |
108 | 823 | done | 825 | done |
109 | 824 | -test -n "$(am__skip_mode_fix)" \ | 826 | -test -n "$(am__skip_mode_fix)" \ |
111 | 825 | || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ | 827 | || find "$(distdir)" -type d ! -perm -755 \ |
112 | 828 | -exec chmod u+rwx,go+rx {} \; -o \ | ||
113 | 826 | ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ | 829 | ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ |
114 | 827 | ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ | 830 | ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ |
115 | 828 | ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ | 831 | ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ |
116 | @@ -866,17 +869,17 @@ | |||
117 | 866 | distcheck: dist | 869 | distcheck: dist |
118 | 867 | case '$(DIST_ARCHIVES)' in \ | 870 | case '$(DIST_ARCHIVES)' in \ |
119 | 868 | *.tar.gz*) \ | 871 | *.tar.gz*) \ |
121 | 869 | GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ | 872 | GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ |
122 | 870 | *.tar.bz2*) \ | 873 | *.tar.bz2*) \ |
124 | 871 | bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ | 874 | bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ |
125 | 872 | *.tar.lzma*) \ | 875 | *.tar.lzma*) \ |
127 | 873 | unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ | 876 | lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ |
128 | 874 | *.tar.xz*) \ | 877 | *.tar.xz*) \ |
129 | 875 | xz -dc $(distdir).tar.xz | $(am__untar) ;;\ | 878 | xz -dc $(distdir).tar.xz | $(am__untar) ;;\ |
130 | 876 | *.tar.Z*) \ | 879 | *.tar.Z*) \ |
131 | 877 | uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ | 880 | uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ |
132 | 878 | *.shar.gz*) \ | 881 | *.shar.gz*) \ |
134 | 879 | GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ | 882 | GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ |
135 | 880 | *.zip*) \ | 883 | *.zip*) \ |
136 | 881 | unzip $(distdir).zip ;;\ | 884 | unzip $(distdir).zip ;;\ |
137 | 882 | esac | 885 | esac |
138 | 883 | 886 | ||
139 | === modified file 'README' | |||
140 | --- README 2009-07-27 19:02:30 +0000 | |||
141 | +++ README 2010-04-28 20:38:30 +0000 | |||
142 | @@ -1,7 +1,7 @@ | |||
143 | 1 | OBEX Server and Client | 1 | OBEX Server and Client |
144 | 2 | ********************** | 2 | ********************** |
145 | 3 | 3 | ||
147 | 4 | Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 4 | Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
148 | 5 | 5 | ||
149 | 6 | 6 | ||
150 | 7 | Compilation and installation | 7 | Compilation and installation |
151 | 8 | 8 | ||
152 | === modified file 'aclocal.m4' | |||
153 | --- aclocal.m4 2009-07-27 19:02:30 +0000 | |||
154 | +++ aclocal.m4 2010-04-28 20:38:30 +0000 | |||
155 | @@ -1,4 +1,4 @@ | |||
157 | 1 | # generated automatically by aclocal 1.11 -*- Autoconf -*- | 1 | # generated automatically by aclocal 1.11.1 -*- Autoconf -*- |
158 | 2 | 2 | ||
159 | 3 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, | 3 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
160 | 4 | # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. | 4 | # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
161 | @@ -7862,15 +7862,15 @@ | |||
162 | 7862 | 7862 | ||
163 | 7863 | # Generated from ltversion.in. | 7863 | # Generated from ltversion.in. |
164 | 7864 | 7864 | ||
166 | 7865 | # serial 3012 ltversion.m4 | 7865 | # serial 3017 ltversion.m4 |
167 | 7866 | # This file is part of GNU Libtool | 7866 | # This file is part of GNU Libtool |
168 | 7867 | 7867 | ||
171 | 7868 | m4_define([LT_PACKAGE_VERSION], [2.2.6]) | 7868 | m4_define([LT_PACKAGE_VERSION], [2.2.6b]) |
172 | 7869 | m4_define([LT_PACKAGE_REVISION], [1.3012]) | 7869 | m4_define([LT_PACKAGE_REVISION], [1.3017]) |
173 | 7870 | 7870 | ||
174 | 7871 | AC_DEFUN([LTVERSION_VERSION], | 7871 | AC_DEFUN([LTVERSION_VERSION], |
177 | 7872 | [macro_version='2.2.6' | 7872 | [macro_version='2.2.6b' |
178 | 7873 | macro_revision='1.3012' | 7873 | macro_revision='1.3017' |
179 | 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?]) |
180 | 7875 | _LT_DECL(, macro_revision, 0) | 7875 | _LT_DECL(, macro_revision, 0) |
181 | 7876 | ]) | 7876 | ]) |
182 | @@ -8139,7 +8139,7 @@ | |||
183 | 8139 | [am__api_version='1.11' | 8139 | [am__api_version='1.11' |
184 | 8140 | dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to | 8140 | dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to |
185 | 8141 | dnl require some minimum version. Point them to the right macro. | 8141 | dnl require some minimum version. Point them to the right macro. |
187 | 8142 | m4_if([$1], [1.11], [], | 8142 | m4_if([$1], [1.11.1], [], |
188 | 8143 | [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl | 8143 | [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl |
189 | 8144 | ]) | 8144 | ]) |
190 | 8145 | 8145 | ||
191 | @@ -8155,7 +8155,7 @@ | |||
192 | 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. |
193 | 8156 | # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. | 8156 | # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. |
194 | 8157 | AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], | 8157 | AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], |
196 | 8158 | [AM_AUTOMAKE_VERSION([1.11])dnl | 8158 | [AM_AUTOMAKE_VERSION([1.11.1])dnl |
197 | 8159 | m4_ifndef([AC_AUTOCONF_VERSION], | 8159 | m4_ifndef([AC_AUTOCONF_VERSION], |
198 | 8160 | [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl | 8160 | [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl |
199 | 8161 | _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) | 8161 | _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) |
200 | 8162 | 8162 | ||
201 | === modified file 'client/main.c' | |||
202 | --- client/main.c 2010-01-10 10:46:58 +0000 | |||
203 | +++ client/main.c 2010-04-28 20:38:30 +0000 | |||
204 | @@ -2,7 +2,7 @@ | |||
205 | 2 | * | 2 | * |
206 | 3 | * OBEX Client | 3 | * OBEX Client |
207 | 4 | * | 4 | * |
209 | 5 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
210 | 6 | * | 6 | * |
211 | 7 | * | 7 | * |
212 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
213 | @@ -29,10 +29,12 @@ | |||
214 | 29 | #include <stdlib.h> | 29 | #include <stdlib.h> |
215 | 30 | #include <string.h> | 30 | #include <string.h> |
216 | 31 | #include <signal.h> | 31 | #include <signal.h> |
217 | 32 | #include <syslog.h> | ||
218 | 32 | 33 | ||
219 | 33 | #include <glib.h> | 34 | #include <glib.h> |
220 | 34 | #include <gdbus.h> | 35 | #include <gdbus.h> |
221 | 35 | 36 | ||
222 | 37 | #include "logging.h" | ||
223 | 36 | #include "session.h" | 38 | #include "session.h" |
224 | 37 | 39 | ||
225 | 38 | #define CLIENT_SERVICE "org.openobex.client" | 40 | #define CLIENT_SERVICE "org.openobex.client" |
226 | @@ -429,6 +431,17 @@ | |||
227 | 429 | 431 | ||
228 | 430 | static GMainLoop *event_loop = NULL; | 432 | static GMainLoop *event_loop = NULL; |
229 | 431 | 433 | ||
230 | 434 | static gboolean option_debug = FALSE; | ||
231 | 435 | static gboolean option_stderr = FALSE; | ||
232 | 436 | |||
233 | 437 | static GOptionEntry options[] = { | ||
234 | 438 | { "debug", 'd', 0, G_OPTION_ARG_NONE, &option_debug, | ||
235 | 439 | "Enable debug information output" }, | ||
236 | 440 | { "stderr", 's', 0, G_OPTION_ARG_NONE, &option_stderr, | ||
237 | 441 | "Write log information to stderr" }, | ||
238 | 442 | { NULL }, | ||
239 | 443 | }; | ||
240 | 444 | |||
241 | 432 | static void sig_term(int sig) | 445 | static void sig_term(int sig) |
242 | 433 | { | 446 | { |
243 | 434 | g_main_loop_quit(event_loop); | 447 | g_main_loop_quit(event_loop); |
244 | @@ -436,32 +449,56 @@ | |||
245 | 436 | 449 | ||
246 | 437 | int main(int argc, char *argv[]) | 450 | int main(int argc, char *argv[]) |
247 | 438 | { | 451 | { |
248 | 452 | GOptionContext *context; | ||
249 | 439 | struct sigaction sa; | 453 | struct sigaction sa; |
250 | 440 | DBusConnection *conn; | 454 | DBusConnection *conn; |
262 | 441 | DBusError err; | 455 | DBusError derr; |
263 | 442 | 456 | GError *gerr = NULL; | |
264 | 443 | dbus_error_init(&err); | 457 | int log_option; |
265 | 444 | 458 | ||
266 | 445 | conn = g_dbus_setup_bus(DBUS_BUS_SESSION, CLIENT_SERVICE, &err); | 459 | context = g_option_context_new(NULL); |
267 | 446 | if (conn == NULL) { | 460 | g_option_context_add_main_entries(context, options, NULL); |
268 | 447 | if (dbus_error_is_set(&err) == TRUE) { | 461 | |
269 | 448 | fprintf(stderr, "%s\n", err.message); | 462 | g_option_context_parse(context, &argc, &argv, &gerr); |
270 | 449 | dbus_error_free(&err); | 463 | if (gerr != NULL) { |
271 | 450 | } else | 464 | g_printerr("%s\n", gerr->message); |
272 | 451 | fprintf(stderr, "Can't register with session bus\n"); | 465 | g_error_free(gerr); |
273 | 466 | exit(EXIT_FAILURE); | ||
274 | 467 | } | ||
275 | 468 | |||
276 | 469 | g_option_context_free(context); | ||
277 | 470 | |||
278 | 471 | dbus_error_init(&derr); | ||
279 | 472 | |||
280 | 473 | conn = g_dbus_setup_bus(DBUS_BUS_SESSION, CLIENT_SERVICE, &derr); | ||
281 | 474 | if (dbus_error_is_set(&derr) == TRUE) { | ||
282 | 475 | g_printerr("%s: %s\n", derr.name, derr.message); | ||
283 | 476 | dbus_error_free(&derr); | ||
284 | 452 | exit(EXIT_FAILURE); | 477 | exit(EXIT_FAILURE); |
285 | 453 | } | 478 | } |
286 | 454 | 479 | ||
287 | 455 | if (g_dbus_register_interface(conn, CLIENT_PATH, CLIENT_INTERFACE, | 480 | if (g_dbus_register_interface(conn, CLIENT_PATH, CLIENT_INTERFACE, |
288 | 456 | client_methods, NULL, NULL, | 481 | client_methods, NULL, NULL, |
289 | 457 | NULL, NULL) == FALSE) { | 482 | NULL, NULL) == FALSE) { |
291 | 458 | fprintf(stderr, "Can't register client interface\n"); | 483 | g_printerr("Can't register client interface\n"); |
292 | 459 | dbus_connection_unref(conn); | 484 | dbus_connection_unref(conn); |
293 | 460 | exit(EXIT_FAILURE); | 485 | exit(EXIT_FAILURE); |
294 | 461 | } | 486 | } |
295 | 462 | 487 | ||
296 | 463 | event_loop = g_main_loop_new(NULL, FALSE); | 488 | event_loop = g_main_loop_new(NULL, FALSE); |
297 | 464 | 489 | ||
298 | 490 | log_option = LOG_NDELAY | LOG_PID; | ||
299 | 491 | |||
300 | 492 | if (option_stderr == TRUE) | ||
301 | 493 | log_option |= LOG_PERROR; | ||
302 | 494 | |||
303 | 495 | openlog("obex-client", log_option, LOG_DAEMON); | ||
304 | 496 | |||
305 | 497 | if (option_debug == TRUE) { | ||
306 | 498 | info("Enabling debug information"); | ||
307 | 499 | enable_debug(); | ||
308 | 500 | } | ||
309 | 501 | |||
310 | 465 | memset(&sa, 0, sizeof(sa)); | 502 | memset(&sa, 0, sizeof(sa)); |
311 | 466 | sa.sa_handler = sig_term; | 503 | sa.sa_handler = sig_term; |
312 | 467 | sigaction(SIGINT, &sa, NULL); | 504 | sigaction(SIGINT, &sa, NULL); |
313 | 468 | 505 | ||
314 | === modified file 'client/pbap.c' | |||
315 | --- client/pbap.c 2010-01-10 10:46:58 +0000 | |||
316 | +++ client/pbap.c 2010-04-28 20:38:30 +0000 | |||
317 | @@ -2,8 +2,8 @@ | |||
318 | 2 | * | 2 | * |
319 | 3 | * OBEX Client | 3 | * OBEX Client |
320 | 4 | * | 4 | * |
323 | 5 | * Copyright (C) 2007-2008 Intel Corporation | 5 | * Copyright (C) 2007-2010 Intel Corporation |
324 | 6 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 6 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
325 | 7 | * | 7 | * |
326 | 8 | * | 8 | * |
327 | 9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
328 | @@ -30,6 +30,7 @@ | |||
329 | 30 | #include <glib.h> | 30 | #include <glib.h> |
330 | 31 | #include <gdbus.h> | 31 | #include <gdbus.h> |
331 | 32 | 32 | ||
332 | 33 | #include "logging.h" | ||
333 | 33 | #include "session.h" | 34 | #include "session.h" |
334 | 34 | #include "pbap.h" | 35 | #include "pbap.h" |
335 | 35 | 36 | ||
336 | @@ -298,8 +299,8 @@ | |||
337 | 298 | struct apparam_hdr *hdr = (struct apparam_hdr *) buf; | 299 | struct apparam_hdr *hdr = (struct apparam_hdr *) buf; |
338 | 299 | 300 | ||
339 | 300 | if (hdr->len > size - APPARAM_HDR_SIZE) { | 301 | if (hdr->len > size - APPARAM_HDR_SIZE) { |
342 | 301 | fprintf(stderr, "Unexpected PBAP pullphonebook app" | 302 | error("Unexpected PBAP pullphonebook app" |
343 | 302 | " length, tag %d, len %d\n", | 303 | " length, tag %d, len %d", |
344 | 303 | hdr->tag, hdr->len); | 304 | hdr->tag, hdr->len); |
345 | 304 | return; | 305 | return; |
346 | 305 | } | 306 | } |
347 | @@ -317,8 +318,8 @@ | |||
348 | 317 | *new_missed_calls = hdr->val[0]; | 318 | *new_missed_calls = hdr->val[0]; |
349 | 318 | break; | 319 | break; |
350 | 319 | default: | 320 | default: |
353 | 320 | fprintf(stderr, "Unexpected PBAP pullphonebook app" | 321 | error("Unexpected PBAP pullphonebook app" |
354 | 321 | " parameter, tag %d, len %d\n", | 322 | " parameter, tag %d, len %d", |
355 | 322 | hdr->tag, hdr->len); | 323 | hdr->tag, hdr->len); |
356 | 323 | } | 324 | } |
357 | 324 | 325 | ||
358 | @@ -443,7 +444,7 @@ | |||
359 | 443 | func = phonebook_size_callback; | 444 | func = phonebook_size_callback; |
360 | 444 | break; | 445 | break; |
361 | 445 | default: | 446 | default: |
363 | 446 | fprintf(stderr, "Unexpected type : 0x%2x\n", type); | 447 | error("Unexpected type : 0x%2x", type); |
364 | 447 | return NULL; | 448 | return NULL; |
365 | 448 | } | 449 | } |
366 | 449 | 450 | ||
367 | 450 | 451 | ||
368 | === modified file 'client/pbap.h' | |||
369 | --- client/pbap.h 2009-07-27 19:02:30 +0000 | |||
370 | +++ client/pbap.h 2010-04-28 20:38:30 +0000 | |||
371 | @@ -2,8 +2,8 @@ | |||
372 | 2 | * | 2 | * |
373 | 3 | * OBEX Client | 3 | * OBEX Client |
374 | 4 | * | 4 | * |
377 | 5 | * Copyright (C) 2007-2008 Intel Corporation | 5 | * Copyright (C) 2007-2010 Intel Corporation |
378 | 6 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 6 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
379 | 7 | * | 7 | * |
380 | 8 | * | 8 | * |
381 | 9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
382 | 10 | 10 | ||
383 | === modified file 'client/session.c' | |||
384 | --- client/session.c 2009-07-27 19:02:30 +0000 | |||
385 | +++ client/session.c 2010-04-28 20:38:30 +0000 | |||
386 | @@ -2,7 +2,7 @@ | |||
387 | 2 | * | 2 | * |
388 | 3 | * OBEX Client | 3 | * OBEX Client |
389 | 4 | * | 4 | * |
391 | 5 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
392 | 6 | * | 6 | * |
393 | 7 | * | 7 | * |
394 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
395 | @@ -39,6 +39,7 @@ | |||
396 | 39 | #include <bluetooth/sdp.h> | 39 | #include <bluetooth/sdp.h> |
397 | 40 | #include <bluetooth/sdp_lib.h> | 40 | #include <bluetooth/sdp_lib.h> |
398 | 41 | 41 | ||
399 | 42 | #include "logging.h" | ||
400 | 42 | #include "pbap.h" | 43 | #include "pbap.h" |
401 | 43 | #include "sync.h" | 44 | #include "sync.h" |
402 | 44 | #include "session.h" | 45 | #include "session.h" |
403 | @@ -55,6 +56,8 @@ | |||
404 | 55 | 56 | ||
405 | 56 | #define DEFAULT_BUFFER_SIZE 4096 | 57 | #define DEFAULT_BUFFER_SIZE 4096 |
406 | 57 | 58 | ||
407 | 59 | typedef int (*reply_callback_t) (struct session_data *session, void *data); | ||
408 | 60 | |||
409 | 58 | static guint64 counter = 0; | 61 | static guint64 counter = 0; |
410 | 59 | 62 | ||
411 | 60 | static unsigned char pcsuite_uuid[] = { 0x00, 0x00, 0x50, 0x05, 0x00, 0x00, | 63 | static unsigned char pcsuite_uuid[] = { 0x00, 0x00, 0x50, 0x05, 0x00, 0x00, |
412 | @@ -68,6 +71,19 @@ | |||
413 | 68 | void *data; | 71 | void *data; |
414 | 69 | }; | 72 | }; |
415 | 70 | 73 | ||
416 | 74 | struct pending_request { | ||
417 | 75 | struct session_data *session; | ||
418 | 76 | reply_callback_t callback; | ||
419 | 77 | void *data; | ||
420 | 78 | }; | ||
421 | 79 | |||
422 | 80 | struct get_params { | ||
423 | 81 | const char *type; | ||
424 | 82 | const guint8 *apparam; | ||
425 | 83 | gint apparam_size; | ||
426 | 84 | session_callback_t func; | ||
427 | 85 | }; | ||
428 | 86 | |||
429 | 71 | static struct session_data *session_ref(struct session_data *session) | 87 | static struct session_data *session_ref(struct session_data *session) |
430 | 72 | { | 88 | { |
431 | 73 | g_atomic_int_inc(&session->refcount); | 89 | g_atomic_int_inc(&session->refcount); |
432 | @@ -461,26 +477,6 @@ | |||
433 | 461 | return 0; | 477 | return 0; |
434 | 462 | } | 478 | } |
435 | 463 | 479 | ||
436 | 464 | static void agent_request(DBusConnection *conn, const char *agent_name, | ||
437 | 465 | const char *agent_path, const char *transfer_path) | ||
438 | 466 | { | ||
439 | 467 | DBusMessage *message; | ||
440 | 468 | |||
441 | 469 | if (agent_name == NULL || agent_path == NULL || transfer_path == NULL) | ||
442 | 470 | return; | ||
443 | 471 | |||
444 | 472 | message = dbus_message_new_method_call(agent_name, | ||
445 | 473 | agent_path, AGENT_INTERFACE, "Request"); | ||
446 | 474 | |||
447 | 475 | dbus_message_append_args(message, | ||
448 | 476 | DBUS_TYPE_OBJECT_PATH, &transfer_path, | ||
449 | 477 | DBUS_TYPE_INVALID); | ||
450 | 478 | |||
451 | 479 | g_dbus_send_message(conn, message); | ||
452 | 480 | |||
453 | 481 | /* FIXME: Reply needs be handled */ | ||
454 | 482 | } | ||
455 | 483 | |||
456 | 484 | static void agent_notify_progress(DBusConnection *conn, const char *agent_name, | 480 | static void agent_notify_progress(DBusConnection *conn, const char *agent_name, |
457 | 485 | const char *agent_path, const char *transfer_path, | 481 | const char *agent_path, const char *transfer_path, |
458 | 486 | uint64_t transferred) | 482 | uint64_t transferred) |
459 | @@ -592,21 +588,6 @@ | |||
460 | 592 | session_unref(session); | 588 | session_unref(session); |
461 | 593 | } | 589 | } |
462 | 594 | 590 | ||
463 | 595 | int session_set_agent(struct session_data *session, const char *name, | ||
464 | 596 | const char *path) | ||
465 | 597 | { | ||
466 | 598 | if (session == NULL) | ||
467 | 599 | return -EINVAL; | ||
468 | 600 | |||
469 | 601 | if (session->agent_name != NULL || session->agent_path != NULL) | ||
470 | 602 | return -EALREADY; | ||
471 | 603 | |||
472 | 604 | session->agent_name = g_strdup(name); | ||
473 | 605 | session->agent_path = g_strdup(path); | ||
474 | 606 | |||
475 | 607 | return 0; | ||
476 | 608 | } | ||
477 | 609 | |||
478 | 610 | static void append_entry(DBusMessageIter *dict, | 591 | static void append_entry(DBusMessageIter *dict, |
479 | 611 | const char *key, int type, void *val) | 592 | const char *key, int type, void *val) |
480 | 612 | { | 593 | { |
481 | @@ -978,9 +959,11 @@ | |||
482 | 978 | 959 | ||
483 | 979 | static void unregister_transfer(struct session_data *session) | 960 | static void unregister_transfer(struct session_data *session) |
484 | 980 | { | 961 | { |
488 | 981 | gw_obex_xfer_close(session->xfer, NULL); | 962 | if (session->xfer) { |
489 | 982 | gw_obex_xfer_free(session->xfer); | 963 | gw_obex_xfer_close(session->xfer, NULL); |
490 | 983 | session->xfer = NULL; | 964 | gw_obex_xfer_free(session->xfer); |
491 | 965 | session->xfer = NULL; | ||
492 | 966 | } | ||
493 | 984 | 967 | ||
494 | 985 | g_free(session->filename); | 968 | g_free(session->filename); |
495 | 986 | session->filename = NULL; | 969 | session->filename = NULL; |
496 | @@ -1081,7 +1064,7 @@ | |||
497 | 1081 | } | 1064 | } |
498 | 1082 | 1065 | ||
499 | 1083 | if (err) { | 1066 | if (err) { |
501 | 1084 | fprintf(stderr, "gw_obex_xfer_read(): %s\n", | 1067 | error("gw_obex_xfer_read(): %s", |
502 | 1085 | OBEX_ResponseToString(err)); | 1068 | OBEX_ResponseToString(err)); |
503 | 1086 | goto complete; | 1069 | goto complete; |
504 | 1087 | } | 1070 | } |
505 | @@ -1157,7 +1140,7 @@ | |||
506 | 1157 | } | 1140 | } |
507 | 1158 | 1141 | ||
508 | 1159 | if (ret == FALSE) { | 1142 | if (ret == FALSE) { |
510 | 1160 | fprintf(stderr, "gw_obex_xfer_read(): %s\n", | 1143 | error("gw_obex_xfer_read(): %s", |
511 | 1161 | OBEX_ResponseToString(err)); | 1144 | OBEX_ResponseToString(err)); |
512 | 1162 | goto complete; | 1145 | goto complete; |
513 | 1163 | } | 1146 | } |
514 | @@ -1215,13 +1198,212 @@ | |||
515 | 1215 | g_free(callback); | 1198 | g_free(callback); |
516 | 1216 | } | 1199 | } |
517 | 1217 | 1200 | ||
518 | 1201 | static void put_xfer_progress(GwObexXfer *xfer, gpointer user_data) | ||
519 | 1202 | { | ||
520 | 1203 | struct session_data *session = user_data; | ||
521 | 1204 | ssize_t len; | ||
522 | 1205 | gint written; | ||
523 | 1206 | |||
524 | 1207 | if (session->buffer_len == 0) { | ||
525 | 1208 | session->buffer_len = DEFAULT_BUFFER_SIZE; | ||
526 | 1209 | session->buffer = g_new0(char, DEFAULT_BUFFER_SIZE); | ||
527 | 1210 | } | ||
528 | 1211 | |||
529 | 1212 | len = read(session->fd, session->buffer + session->filled, | ||
530 | 1213 | session->buffer_len - session->filled); | ||
531 | 1214 | if (len <= 0) | ||
532 | 1215 | goto complete; | ||
533 | 1216 | |||
534 | 1217 | if (gw_obex_xfer_write(xfer, session->buffer, session->filled + len, | ||
535 | 1218 | &written, NULL) == FALSE) | ||
536 | 1219 | goto complete; | ||
537 | 1220 | |||
538 | 1221 | if (gw_obex_xfer_flush(xfer, NULL) == FALSE) | ||
539 | 1222 | goto complete; | ||
540 | 1223 | |||
541 | 1224 | session->filled = (session->filled + len) - written; | ||
542 | 1225 | |||
543 | 1226 | memmove(session->buffer, session->buffer + written, session->filled); | ||
544 | 1227 | |||
545 | 1228 | session->transferred += written; | ||
546 | 1229 | |||
547 | 1230 | agent_notify_progress(session->conn, session->agent_name, | ||
548 | 1231 | session->agent_path, session->transfer_path, | ||
549 | 1232 | session->transferred); | ||
550 | 1233 | return; | ||
551 | 1234 | |||
552 | 1235 | complete: | ||
553 | 1236 | if (len == 0) | ||
554 | 1237 | agent_notify_complete(session->conn, session->agent_name, | ||
555 | 1238 | session->agent_path, session->transfer_path); | ||
556 | 1239 | else | ||
557 | 1240 | agent_notify_error(session->conn, session->agent_name, | ||
558 | 1241 | session->agent_path, session->transfer_path, | ||
559 | 1242 | "Error sending object"); | ||
560 | 1243 | |||
561 | 1244 | unregister_transfer(session); | ||
562 | 1245 | |||
563 | 1246 | if (session->pending->len > 0) { | ||
564 | 1247 | gchar *filename = g_ptr_array_index(session->pending, 0); | ||
565 | 1248 | gchar *basename = g_path_get_basename(filename); | ||
566 | 1249 | |||
567 | 1250 | g_ptr_array_remove(session->pending, filename); | ||
568 | 1251 | |||
569 | 1252 | session_send(session, filename, basename); | ||
570 | 1253 | g_free(filename); | ||
571 | 1254 | g_free(basename); | ||
572 | 1255 | } | ||
573 | 1256 | |||
574 | 1257 | session_unref(session); | ||
575 | 1258 | } | ||
576 | 1259 | |||
577 | 1260 | static void agent_request_reply(DBusPendingCall *call, gpointer user_data) | ||
578 | 1261 | { | ||
579 | 1262 | struct pending_request *pending = user_data; | ||
580 | 1263 | struct session_data *session = pending->session; | ||
581 | 1264 | DBusMessage *reply = dbus_pending_call_steal_reply(call); | ||
582 | 1265 | const char *name; | ||
583 | 1266 | DBusError derr; | ||
584 | 1267 | |||
585 | 1268 | dbus_error_init(&derr); | ||
586 | 1269 | if (dbus_set_error_from_message(&derr, reply)) { | ||
587 | 1270 | error("Replied with an error: %s, %s", | ||
588 | 1271 | derr.name, derr.message); | ||
589 | 1272 | dbus_error_free(&derr); | ||
590 | 1273 | goto fail; | ||
591 | 1274 | } | ||
592 | 1275 | |||
593 | 1276 | dbus_message_get_args(reply, NULL, | ||
594 | 1277 | DBUS_TYPE_STRING, &name, | ||
595 | 1278 | DBUS_TYPE_INVALID); | ||
596 | 1279 | |||
597 | 1280 | if (strlen(name)) { | ||
598 | 1281 | g_free(session->name); | ||
599 | 1282 | session->name = g_strdup(name); | ||
600 | 1283 | } | ||
601 | 1284 | |||
602 | 1285 | if (pending->callback(session, pending->data)) | ||
603 | 1286 | goto fail; | ||
604 | 1287 | |||
605 | 1288 | g_free(pending); | ||
606 | 1289 | |||
607 | 1290 | return; | ||
608 | 1291 | |||
609 | 1292 | fail: | ||
610 | 1293 | unregister_transfer(session); | ||
611 | 1294 | |||
612 | 1295 | session_unref(session); | ||
613 | 1296 | |||
614 | 1297 | if (session->pending->len > 0) { | ||
615 | 1298 | gchar *filename = g_ptr_array_index(session->pending, 0); | ||
616 | 1299 | gchar *basename = g_path_get_basename(filename); | ||
617 | 1300 | |||
618 | 1301 | g_ptr_array_remove(session->pending, filename); | ||
619 | 1302 | |||
620 | 1303 | session_send(session, filename, basename); | ||
621 | 1304 | g_free(filename); | ||
622 | 1305 | g_free(basename); | ||
623 | 1306 | } | ||
624 | 1307 | |||
625 | 1308 | g_free(pending); | ||
626 | 1309 | } | ||
627 | 1310 | |||
628 | 1311 | static void agent_request(DBusConnection *conn, struct session_data *session, | ||
629 | 1312 | reply_callback_t cb, void *user_data) | ||
630 | 1313 | { | ||
631 | 1314 | DBusMessage *message; | ||
632 | 1315 | DBusPendingCall *call; | ||
633 | 1316 | struct pending_request *pending; | ||
634 | 1317 | |||
635 | 1318 | if (session->agent_name == NULL || session->agent_path == NULL || | ||
636 | 1319 | session->transfer_path == NULL) { | ||
637 | 1320 | if (cb(session, user_data)) | ||
638 | 1321 | goto fail; | ||
639 | 1322 | |||
640 | 1323 | return; | ||
641 | 1324 | } | ||
642 | 1325 | |||
643 | 1326 | message = dbus_message_new_method_call(session->agent_name, | ||
644 | 1327 | session->agent_path, AGENT_INTERFACE, "Request"); | ||
645 | 1328 | |||
646 | 1329 | dbus_message_append_args(message, | ||
647 | 1330 | DBUS_TYPE_OBJECT_PATH, &session->transfer_path, | ||
648 | 1331 | DBUS_TYPE_INVALID); | ||
649 | 1332 | |||
650 | 1333 | if (!dbus_connection_send_with_reply(conn, message, &call, -1)) { | ||
651 | 1334 | dbus_message_unref(message); | ||
652 | 1335 | return; | ||
653 | 1336 | } | ||
654 | 1337 | |||
655 | 1338 | dbus_message_unref(message); | ||
656 | 1339 | |||
657 | 1340 | pending = g_new0(struct pending_request, 1); | ||
658 | 1341 | pending->session = session; | ||
659 | 1342 | pending->callback = cb; | ||
660 | 1343 | pending->data = user_data; | ||
661 | 1344 | |||
662 | 1345 | dbus_pending_call_set_notify(call, agent_request_reply, pending, NULL); | ||
663 | 1346 | dbus_pending_call_unref(call); | ||
664 | 1347 | |||
665 | 1348 | return; | ||
666 | 1349 | |||
667 | 1350 | fail: | ||
668 | 1351 | unregister_transfer(session); | ||
669 | 1352 | |||
670 | 1353 | session_unref(session); | ||
671 | 1354 | } | ||
672 | 1355 | |||
673 | 1356 | static int session_get_reply(struct session_data *session, void *data) | ||
674 | 1357 | { | ||
675 | 1358 | struct get_params *params = data; | ||
676 | 1359 | struct callback_data *callback; | ||
677 | 1360 | GwObexXfer *xfer; | ||
678 | 1361 | |||
679 | 1362 | xfer = gw_obex_get_async_with_apparam(session->obex, session->filename, | ||
680 | 1363 | params->type, params->apparam, params->apparam_size, | ||
681 | 1364 | NULL); | ||
682 | 1365 | |||
683 | 1366 | if (xfer == NULL) { | ||
684 | 1367 | close(session->fd); | ||
685 | 1368 | session_unref(session); | ||
686 | 1369 | g_free(params); | ||
687 | 1370 | return -EIO; | ||
688 | 1371 | } | ||
689 | 1372 | |||
690 | 1373 | callback = g_try_malloc0(sizeof(*callback)); | ||
691 | 1374 | if (callback == NULL) { | ||
692 | 1375 | close(session->fd); | ||
693 | 1376 | session_unref(session); | ||
694 | 1377 | gw_obex_xfer_free(xfer); | ||
695 | 1378 | g_free(params); | ||
696 | 1379 | return -ENOMEM; | ||
697 | 1380 | } | ||
698 | 1381 | |||
699 | 1382 | callback->session = session; | ||
700 | 1383 | callback->func = params->func; | ||
701 | 1384 | |||
702 | 1385 | if (params->type == NULL) | ||
703 | 1386 | gw_obex_xfer_set_callback(xfer, get_xfer_progress, callback); | ||
704 | 1387 | else | ||
705 | 1388 | gw_obex_xfer_set_callback(xfer, get_xfer_listing_progress, | ||
706 | 1389 | callback); | ||
707 | 1390 | |||
708 | 1391 | session->xfer = xfer; | ||
709 | 1392 | |||
710 | 1393 | agent_notify_progress(session->conn, session->agent_name, | ||
711 | 1394 | session->agent_path, session->transfer_path, 0); | ||
712 | 1395 | |||
713 | 1396 | g_free(params); | ||
714 | 1397 | |||
715 | 1398 | return 0; | ||
716 | 1399 | } | ||
717 | 1400 | |||
718 | 1218 | int session_get(struct session_data *session, const char *type, | 1401 | int session_get(struct session_data *session, const char *type, |
719 | 1219 | const char *filename, const char *targetname, | 1402 | const char *filename, const char *targetname, |
720 | 1220 | const guint8 *apparam, gint apparam_size, | 1403 | const guint8 *apparam, gint apparam_size, |
721 | 1221 | session_callback_t func) | 1404 | session_callback_t func) |
722 | 1222 | { | 1405 | { |
725 | 1223 | struct callback_data *callback; | 1406 | struct get_params *params; |
724 | 1224 | GwObexXfer *xfer; | ||
726 | 1225 | int err, fd = 0; | 1407 | int err, fd = 0; |
727 | 1226 | 1408 | ||
728 | 1227 | if (session->obex == NULL) | 1409 | if (session->obex == NULL) |
729 | @@ -1234,12 +1416,13 @@ | |||
730 | 1234 | fd = open(targetname, O_WRONLY | O_CREAT, 0600); | 1416 | fd = open(targetname, O_WRONLY | O_CREAT, 0600); |
731 | 1235 | if (fd < 0) { | 1417 | if (fd < 0) { |
732 | 1236 | err = errno; | 1418 | err = errno; |
734 | 1237 | fprintf(stderr, "open(): %s(%d)\n", strerror(err), err); | 1419 | error("open(): %s(%d)", strerror(err), err); |
735 | 1238 | return -err; | 1420 | return -err; |
736 | 1239 | } | 1421 | } |
737 | 1240 | } | 1422 | } |
738 | 1241 | 1423 | ||
740 | 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 */ |
741 | 1425 | if (type == NULL || (strncmp(type, "x-obex/", 7) && strncmp(type, "x-bt/", 5))) { | ||
742 | 1243 | session->transfer_path = register_transfer(session->conn, session); | 1426 | session->transfer_path = register_transfer(session->conn, session); |
743 | 1244 | if (session->transfer_path == NULL) { | 1427 | if (session->transfer_path == NULL) { |
744 | 1245 | if (fd) | 1428 | if (fd) |
745 | @@ -1257,38 +1440,13 @@ | |||
746 | 1257 | 1440 | ||
747 | 1258 | session_ref(session); | 1441 | session_ref(session); |
748 | 1259 | 1442 | ||
781 | 1260 | xfer = gw_obex_get_async_with_apparam(session->obex, | 1443 | params = g_new0(struct get_params, 1); |
782 | 1261 | filename, type, apparam, apparam_size, NULL); | 1444 | params->type = type; |
783 | 1262 | if (xfer == NULL) { | 1445 | params->apparam = apparam; |
784 | 1263 | close(session->fd); | 1446 | params->apparam_size = apparam_size; |
785 | 1264 | session_unref(session); | 1447 | params->func = func; |
786 | 1265 | return -EIO; | 1448 | |
787 | 1266 | } | 1449 | agent_request(session->conn, session, session_get_reply, params); |
756 | 1267 | |||
757 | 1268 | callback = g_try_malloc0(sizeof(*callback)); | ||
758 | 1269 | if (callback == NULL) { | ||
759 | 1270 | close(session->fd); | ||
760 | 1271 | session_unref(session); | ||
761 | 1272 | gw_obex_xfer_free(xfer); | ||
762 | 1273 | return -ENOMEM; | ||
763 | 1274 | } | ||
764 | 1275 | |||
765 | 1276 | callback->session = session; | ||
766 | 1277 | callback->func = func; | ||
767 | 1278 | |||
768 | 1279 | if (type == NULL) | ||
769 | 1280 | gw_obex_xfer_set_callback(xfer, get_xfer_progress, callback); | ||
770 | 1281 | else | ||
771 | 1282 | gw_obex_xfer_set_callback(xfer, get_xfer_listing_progress, | ||
772 | 1283 | callback); | ||
773 | 1284 | |||
774 | 1285 | session->xfer = xfer; | ||
775 | 1286 | |||
776 | 1287 | agent_request(session->conn, session->agent_name, | ||
777 | 1288 | session->agent_path, session->transfer_path); | ||
778 | 1289 | |||
779 | 1290 | agent_notify_progress(session->conn, session->agent_name, | ||
780 | 1291 | session->agent_path, session->transfer_path, 0); | ||
788 | 1292 | 1450 | ||
789 | 1293 | return 0; | 1451 | return 0; |
790 | 1294 | } | 1452 | } |
791 | @@ -1458,93 +1616,56 @@ | |||
792 | 1458 | { } | 1616 | { } |
793 | 1459 | }; | 1617 | }; |
794 | 1460 | 1618 | ||
796 | 1461 | static void put_xfer_progress(GwObexXfer *xfer, gpointer user_data) | 1619 | |
797 | 1620 | static int session_send_reply(struct session_data *session, void *data) | ||
798 | 1462 | { | 1621 | { |
825 | 1463 | struct session_data *session = user_data; | 1622 | GwObexXfer *xfer; |
826 | 1464 | ssize_t len; | 1623 | |
827 | 1465 | gint written; | 1624 | xfer = gw_obex_put_async(session->obex, session->name, NULL, |
828 | 1466 | 1625 | session->size, -1, NULL); | |
829 | 1467 | if (session->buffer_len == 0) { | 1626 | if (xfer == NULL) |
830 | 1468 | session->buffer_len = DEFAULT_BUFFER_SIZE; | 1627 | return -ENOTCONN; |
831 | 1469 | session->buffer = g_new0(char, DEFAULT_BUFFER_SIZE); | 1628 | |
832 | 1470 | } | 1629 | gw_obex_xfer_set_callback(xfer, put_xfer_progress, session); |
833 | 1471 | 1630 | ||
834 | 1472 | len = read(session->fd, session->buffer + session->filled, | 1631 | session->xfer = xfer; |
809 | 1473 | session->buffer_len - session->filled); | ||
810 | 1474 | if (len <= 0) | ||
811 | 1475 | goto complete; | ||
812 | 1476 | |||
813 | 1477 | if (gw_obex_xfer_write(xfer, session->buffer, session->filled + len, | ||
814 | 1478 | &written, NULL) == FALSE) | ||
815 | 1479 | goto complete; | ||
816 | 1480 | |||
817 | 1481 | if (gw_obex_xfer_flush(xfer, NULL) == FALSE) | ||
818 | 1482 | goto complete; | ||
819 | 1483 | |||
820 | 1484 | session->filled = (session->filled + len) - written; | ||
821 | 1485 | |||
822 | 1486 | memmove(session->buffer + written, session->buffer, session->filled); | ||
823 | 1487 | |||
824 | 1488 | session->transferred += written; | ||
835 | 1489 | 1632 | ||
836 | 1490 | agent_notify_progress(session->conn, session->agent_name, | 1633 | agent_notify_progress(session->conn, session->agent_name, |
864 | 1491 | session->agent_path, session->transfer_path, | 1634 | session->agent_path, session->transfer_path, 0); |
865 | 1492 | session->transferred); | 1635 | |
866 | 1493 | return; | 1636 | return 0; |
840 | 1494 | |||
841 | 1495 | complete: | ||
842 | 1496 | if (len == 0) | ||
843 | 1497 | agent_notify_complete(session->conn, session->agent_name, | ||
844 | 1498 | session->agent_path, session->transfer_path); | ||
845 | 1499 | else | ||
846 | 1500 | agent_notify_error(session->conn, session->agent_name, | ||
847 | 1501 | session->agent_path, session->transfer_path, | ||
848 | 1502 | "Error sending object"); | ||
849 | 1503 | |||
850 | 1504 | unregister_transfer(session); | ||
851 | 1505 | |||
852 | 1506 | if (session->pending->len > 0) { | ||
853 | 1507 | gchar *filename = g_ptr_array_index(session->pending, 0); | ||
854 | 1508 | gchar *basename = g_path_get_basename(filename); | ||
855 | 1509 | |||
856 | 1510 | g_ptr_array_remove(session->pending, filename); | ||
857 | 1511 | |||
858 | 1512 | session_send(session, filename, basename); | ||
859 | 1513 | g_free(filename); | ||
860 | 1514 | g_free(basename); | ||
861 | 1515 | } | ||
862 | 1516 | |||
863 | 1517 | session_unref(session); | ||
867 | 1518 | } | 1637 | } |
868 | 1519 | 1638 | ||
869 | 1520 | int session_send(struct session_data *session, const char *filename, | 1639 | int session_send(struct session_data *session, const char *filename, |
870 | 1521 | const char *targetname) | 1640 | const char *targetname) |
871 | 1522 | { | 1641 | { |
872 | 1523 | GwObexXfer *xfer; | ||
873 | 1524 | struct stat st; | 1642 | struct stat st; |
875 | 1525 | int fd; | 1643 | int fd, err; |
876 | 1526 | 1644 | ||
877 | 1527 | if (session->obex == NULL) | 1645 | if (session->obex == NULL) |
878 | 1528 | return -ENOTCONN; | 1646 | return -ENOTCONN; |
879 | 1529 | 1647 | ||
881 | 1530 | if (session->xfer != NULL) { | 1648 | if (session->transfer_path != NULL) { |
882 | 1531 | g_ptr_array_add(session->pending, g_strdup(filename)); | 1649 | g_ptr_array_add(session->pending, g_strdup(filename)); |
883 | 1532 | return 0; | 1650 | return 0; |
884 | 1533 | } | 1651 | } |
885 | 1534 | 1652 | ||
886 | 1653 | session->transfer_path = register_transfer(session->conn, session); | ||
887 | 1654 | if (session->transfer_path == NULL) { | ||
888 | 1655 | err = -EINVAL; | ||
889 | 1656 | goto fail; | ||
890 | 1657 | } | ||
891 | 1658 | |||
892 | 1535 | fd = open(filename, O_RDONLY); | 1659 | fd = open(filename, O_RDONLY); |
895 | 1536 | if (fd < 0) | 1660 | if (fd < 0) { |
896 | 1537 | return -EIO; | 1661 | err = -EIO; |
897 | 1662 | goto fail; | ||
898 | 1663 | } | ||
899 | 1538 | 1664 | ||
900 | 1539 | if (fstat(fd, &st) < 0) { | 1665 | if (fstat(fd, &st) < 0) { |
901 | 1540 | close(fd); | 1666 | close(fd); |
909 | 1541 | return -EIO; | 1667 | err = -EIO; |
910 | 1542 | } | 1668 | goto fail; |
904 | 1543 | |||
905 | 1544 | session->transfer_path = register_transfer(session->conn, session); | ||
906 | 1545 | if (session->transfer_path == NULL) { | ||
907 | 1546 | close(fd); | ||
908 | 1547 | return -EIO; | ||
911 | 1548 | } | 1669 | } |
912 | 1549 | 1670 | ||
913 | 1550 | session->fd = fd; | 1671 | session->fd = fd; |
914 | @@ -1555,22 +1676,16 @@ | |||
915 | 1555 | 1676 | ||
916 | 1556 | session_ref(session); | 1677 | session_ref(session); |
917 | 1557 | 1678 | ||
932 | 1558 | xfer = gw_obex_put_async(session->obex, session->name, NULL, | 1679 | agent_request(session->conn, session, session_send_reply, NULL); |
919 | 1559 | session->size, -1, NULL); | ||
920 | 1560 | if (xfer == NULL) | ||
921 | 1561 | return -ENOTCONN; | ||
922 | 1562 | |||
923 | 1563 | gw_obex_xfer_set_callback(xfer, put_xfer_progress, session); | ||
924 | 1564 | |||
925 | 1565 | session->xfer = xfer; | ||
926 | 1566 | |||
927 | 1567 | agent_request(session->conn, session->agent_name, | ||
928 | 1568 | session->agent_path, session->transfer_path); | ||
929 | 1569 | |||
930 | 1570 | agent_notify_progress(session->conn, session->agent_name, | ||
931 | 1571 | session->agent_path, session->transfer_path, 0); | ||
933 | 1572 | 1680 | ||
934 | 1573 | return 0; | 1681 | return 0; |
935 | 1682 | |||
936 | 1683 | fail: | ||
937 | 1684 | agent_notify_error(session->conn, session->agent_name, | ||
938 | 1685 | session->agent_path, session->transfer_path, | ||
939 | 1686 | "Could not open file for sending"); | ||
940 | 1687 | |||
941 | 1688 | return err; | ||
942 | 1574 | } | 1689 | } |
943 | 1575 | 1690 | ||
944 | 1576 | int session_pull(struct session_data *session, | 1691 | int session_pull(struct session_data *session, |
945 | @@ -1695,10 +1810,30 @@ | |||
946 | 1695 | session_unref(session); | 1810 | session_unref(session); |
947 | 1696 | } | 1811 | } |
948 | 1697 | 1812 | ||
949 | 1813 | |||
950 | 1814 | static int session_put_reply(struct session_data *session, void *data) | ||
951 | 1815 | { | ||
952 | 1816 | GwObexXfer *xfer; | ||
953 | 1817 | |||
954 | 1818 | xfer = gw_obex_put_async(session->obex, session->name, NULL, | ||
955 | 1819 | session->size, -1, NULL); | ||
956 | 1820 | if (xfer == NULL) | ||
957 | 1821 | return -ENOTCONN; | ||
958 | 1822 | |||
959 | 1823 | session_ref(session); | ||
960 | 1824 | |||
961 | 1825 | gw_obex_xfer_set_callback(xfer, put_buf_xfer_progress, session); | ||
962 | 1826 | |||
963 | 1827 | session->xfer = xfer; | ||
964 | 1828 | |||
965 | 1829 | agent_notify_progress(session->conn, session->agent_name, | ||
966 | 1830 | session->agent_path, session->transfer_path, 0); | ||
967 | 1831 | |||
968 | 1832 | return 0; | ||
969 | 1833 | } | ||
970 | 1834 | |||
971 | 1698 | int session_put(struct session_data *session, char *buf, const char *targetname) | 1835 | int session_put(struct session_data *session, char *buf, const char *targetname) |
972 | 1699 | { | 1836 | { |
973 | 1700 | GwObexXfer *xfer; | ||
974 | 1701 | |||
975 | 1702 | if (session->obex == NULL) | 1837 | if (session->obex == NULL) |
976 | 1703 | return -ENOTCONN; | 1838 | return -ENOTCONN; |
977 | 1704 | 1839 | ||
978 | @@ -1711,22 +1846,28 @@ | |||
979 | 1711 | session->name = g_strdup(targetname); | 1846 | session->name = g_strdup(targetname); |
980 | 1712 | session->buffer = buf; | 1847 | session->buffer = buf; |
981 | 1713 | 1848 | ||
986 | 1714 | xfer = gw_obex_put_async(session->obex, session->name, NULL, | 1849 | agent_request(session->conn, session, session_put_reply, NULL); |
987 | 1715 | session->size, -1, NULL); | 1850 | |
988 | 1716 | if (xfer == NULL) | 1851 | return 0; |
989 | 1717 | return -ENOTCONN; | 1852 | } |
990 | 1853 | |||
991 | 1854 | int session_set_agent(struct session_data *session, const char *name, | ||
992 | 1855 | const char *path) | ||
993 | 1856 | { | ||
994 | 1857 | if (session == NULL) | ||
995 | 1858 | return -EINVAL; | ||
996 | 1859 | |||
997 | 1860 | if (session->agent_name != NULL || session->agent_path != NULL) | ||
998 | 1861 | return -EALREADY; | ||
999 | 1862 | |||
1000 | 1863 | session->agent_name = g_strdup(name); | ||
1001 | 1864 | session->agent_path = g_strdup(path); | ||
1002 | 1865 | |||
1003 | 1866 | session->owner_watch = g_dbus_add_disconnect_watch(session->conn, | ||
1004 | 1867 | session->owner, owner_disconnected, | ||
1005 | 1868 | session, NULL); | ||
1006 | 1718 | 1869 | ||
1007 | 1719 | session_ref(session); | 1870 | session_ref(session); |
1008 | 1720 | 1871 | ||
1009 | 1721 | gw_obex_xfer_set_callback(xfer, put_buf_xfer_progress, session); | ||
1010 | 1722 | |||
1011 | 1723 | session->xfer = xfer; | ||
1012 | 1724 | |||
1013 | 1725 | agent_request(session->conn, session->agent_name, | ||
1014 | 1726 | session->agent_path, session->transfer_path); | ||
1015 | 1727 | |||
1016 | 1728 | agent_notify_progress(session->conn, session->agent_name, | ||
1017 | 1729 | session->agent_path, session->transfer_path, 0); | ||
1018 | 1730 | |||
1019 | 1731 | return 0; | 1872 | return 0; |
1020 | 1732 | } | 1873 | } |
1021 | 1733 | 1874 | ||
1022 | === modified file 'client/session.h' | |||
1023 | --- client/session.h 2010-01-10 10:46:58 +0000 | |||
1024 | +++ client/session.h 2010-04-28 20:38:30 +0000 | |||
1025 | @@ -2,7 +2,7 @@ | |||
1026 | 2 | * | 2 | * |
1027 | 3 | * OBEX Client | 3 | * OBEX Client |
1028 | 4 | * | 4 | * |
1030 | 5 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
1031 | 6 | * | 6 | * |
1032 | 7 | * | 7 | * |
1033 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
1034 | 9 | 9 | ||
1035 | === modified file 'client/sync.c' | |||
1036 | --- client/sync.c 2009-07-27 19:02:30 +0000 | |||
1037 | +++ client/sync.c 2010-04-28 20:38:30 +0000 | |||
1038 | @@ -2,8 +2,8 @@ | |||
1039 | 2 | * | 2 | * |
1040 | 3 | * OBEX Client | 3 | * OBEX Client |
1041 | 4 | * | 4 | * |
1044 | 5 | * Copyright (C) 2007-2009 Intel Corporation | 5 | * Copyright (C) 2007-2010 Intel Corporation |
1045 | 6 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 6 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
1046 | 7 | * | 7 | * |
1047 | 8 | * | 8 | * |
1048 | 9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
1049 | 10 | 10 | ||
1050 | === modified file 'client/sync.h' | |||
1051 | --- client/sync.h 2009-07-27 19:02:30 +0000 | |||
1052 | +++ client/sync.h 2010-04-28 20:38:30 +0000 | |||
1053 | @@ -2,8 +2,8 @@ | |||
1054 | 2 | * | 2 | * |
1055 | 3 | * OBEX Client | 3 | * OBEX Client |
1056 | 4 | * | 4 | * |
1059 | 5 | * Copyright (C) 2007-2008 Intel Corporation | 5 | * Copyright (C) 2007-2010 Intel Corporation |
1060 | 6 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 6 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
1061 | 7 | * | 7 | * |
1062 | 8 | * | 8 | * |
1063 | 9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
1064 | 10 | 10 | ||
1065 | === modified file 'config.guess' | |||
1066 | --- config.guess 2009-07-27 19:02:30 +0000 | |||
1067 | +++ config.guess 2010-04-28 20:38:30 +0000 | |||
1068 | @@ -1,10 +1,10 @@ | |||
1069 | 1 | #! /bin/sh | 1 | #! /bin/sh |
1070 | 2 | # Attempt to guess a canonical system name. | 2 | # Attempt to guess a canonical system name. |
1071 | 3 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, | 3 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
1073 | 4 | # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 | 4 | # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
1074 | 5 | # Free Software Foundation, Inc. | 5 | # Free Software Foundation, Inc. |
1075 | 6 | 6 | ||
1077 | 7 | timestamp='2009-04-27' | 7 | timestamp='2009-11-20' |
1078 | 8 | 8 | ||
1079 | 9 | # This file is free software; you can redistribute it and/or modify it | 9 | # This file is free software; you can redistribute it and/or modify it |
1080 | 10 | # under the terms of the GNU General Public License as published by | 10 | # under the terms of the GNU General Public License as published by |
1081 | @@ -27,16 +27,16 @@ | |||
1082 | 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. |
1083 | 28 | 28 | ||
1084 | 29 | 29 | ||
1088 | 30 | # Originally written by Per Bothner <per@bothner.com>. | 30 | # Originally written by Per Bothner. Please send patches (context |
1089 | 31 | # Please send patches to <config-patches@gnu.org>. Submit a context | 31 | # diff format) to <config-patches@gnu.org> and include a ChangeLog |
1090 | 32 | # diff and a properly formatted ChangeLog entry. | 32 | # entry. |
1091 | 33 | # | 33 | # |
1092 | 34 | # This script attempts to guess a canonical system name similar to | 34 | # This script attempts to guess a canonical system name similar to |
1093 | 35 | # config.sub. If it succeeds, it prints the system name on stdout, and | 35 | # config.sub. If it succeeds, it prints the system name on stdout, and |
1094 | 36 | # exits with 0. Otherwise, it exits with 1. | 36 | # exits with 0. Otherwise, it exits with 1. |
1095 | 37 | # | 37 | # |
1098 | 38 | # The plan is that this can be called by configure scripts if you | 38 | # You can get the latest version of this script from: |
1099 | 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 |
1100 | 40 | 40 | ||
1101 | 41 | me=`echo "$0" | sed -e 's,.*/,,'` | 41 | me=`echo "$0" | sed -e 's,.*/,,'` |
1102 | 42 | 42 | ||
1103 | @@ -170,7 +170,7 @@ | |||
1104 | 170 | arm*|i386|m68k|ns32k|sh3*|sparc|vax) | 170 | arm*|i386|m68k|ns32k|sh3*|sparc|vax) |
1105 | 171 | eval $set_cc_for_build | 171 | eval $set_cc_for_build |
1106 | 172 | if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | 172 | if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ |
1108 | 173 | | grep __ELF__ >/dev/null | 173 | | grep -q __ELF__ |
1109 | 174 | then | 174 | then |
1110 | 175 | # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). | 175 | # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). |
1111 | 176 | # Return netbsd for either. FIX? | 176 | # Return netbsd for either. FIX? |
1112 | @@ -333,6 +333,9 @@ | |||
1113 | 333 | sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) | 333 | sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) |
1114 | 334 | echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` | 334 | echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` |
1115 | 335 | exit ;; | 335 | exit ;; |
1116 | 336 | i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) | ||
1117 | 337 | echo i386-pc-auroraux${UNAME_RELEASE} | ||
1118 | 338 | exit ;; | ||
1119 | 336 | i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) | 339 | i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) |
1120 | 337 | eval $set_cc_for_build | 340 | eval $set_cc_for_build |
1121 | 338 | SUN_ARCH="i386" | 341 | SUN_ARCH="i386" |
1122 | @@ -656,7 +659,7 @@ | |||
1123 | 656 | # => hppa64-hp-hpux11.23 | 659 | # => hppa64-hp-hpux11.23 |
1124 | 657 | 660 | ||
1125 | 658 | if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | | 661 | if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | |
1127 | 659 | grep __LP64__ >/dev/null | 662 | grep -q __LP64__ |
1128 | 660 | then | 663 | then |
1129 | 661 | HP_ARCH="hppa2.0w" | 664 | HP_ARCH="hppa2.0w" |
1130 | 662 | else | 665 | else |
1131 | @@ -807,12 +810,12 @@ | |||
1132 | 807 | i*:PW*:*) | 810 | i*:PW*:*) |
1133 | 808 | echo ${UNAME_MACHINE}-pc-pw32 | 811 | echo ${UNAME_MACHINE}-pc-pw32 |
1134 | 809 | exit ;; | 812 | exit ;; |
1136 | 810 | *:Interix*:[3456]*) | 813 | *:Interix*:*) |
1137 | 811 | case ${UNAME_MACHINE} in | 814 | case ${UNAME_MACHINE} in |
1138 | 812 | x86) | 815 | x86) |
1139 | 813 | echo i586-pc-interix${UNAME_RELEASE} | 816 | echo i586-pc-interix${UNAME_RELEASE} |
1140 | 814 | exit ;; | 817 | exit ;; |
1142 | 815 | EM64T | authenticamd | genuineintel) | 818 | authenticamd | genuineintel | EM64T) |
1143 | 816 | echo x86_64-unknown-interix${UNAME_RELEASE} | 819 | echo x86_64-unknown-interix${UNAME_RELEASE} |
1144 | 817 | exit ;; | 820 | exit ;; |
1145 | 818 | IA64) | 821 | IA64) |
1146 | @@ -822,6 +825,9 @@ | |||
1147 | 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:*) |
1148 | 823 | echo i${UNAME_MACHINE}-pc-mks | 826 | echo i${UNAME_MACHINE}-pc-mks |
1149 | 824 | exit ;; | 827 | exit ;; |
1150 | 828 | 8664:Windows_NT:*) | ||
1151 | 829 | echo x86_64-pc-mks | ||
1152 | 830 | exit ;; | ||
1153 | 825 | i*:Windows_NT*:* | Pentium*:Windows_NT*:*) | 831 | i*:Windows_NT*:* | Pentium*:Windows_NT*:*) |
1154 | 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? |
1155 | 827 | # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we | 833 | # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we |
1156 | @@ -851,6 +857,20 @@ | |||
1157 | 851 | i*86:Minix:*:*) | 857 | i*86:Minix:*:*) |
1158 | 852 | echo ${UNAME_MACHINE}-pc-minix | 858 | echo ${UNAME_MACHINE}-pc-minix |
1159 | 853 | exit ;; | 859 | exit ;; |
1160 | 860 | alpha:Linux:*:*) | ||
1161 | 861 | case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in | ||
1162 | 862 | EV5) UNAME_MACHINE=alphaev5 ;; | ||
1163 | 863 | EV56) UNAME_MACHINE=alphaev56 ;; | ||
1164 | 864 | PCA56) UNAME_MACHINE=alphapca56 ;; | ||
1165 | 865 | PCA57) UNAME_MACHINE=alphapca56 ;; | ||
1166 | 866 | EV6) UNAME_MACHINE=alphaev6 ;; | ||
1167 | 867 | EV67) UNAME_MACHINE=alphaev67 ;; | ||
1168 | 868 | EV68*) UNAME_MACHINE=alphaev68 ;; | ||
1169 | 869 | esac | ||
1170 | 870 | objdump --private-headers /bin/sh | grep -q ld.so.1 | ||
1171 | 871 | if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi | ||
1172 | 872 | echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} | ||
1173 | 873 | exit ;; | ||
1174 | 854 | arm*:Linux:*:*) | 874 | arm*:Linux:*:*) |
1175 | 855 | eval $set_cc_for_build | 875 | eval $set_cc_for_build |
1176 | 856 | if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | 876 | if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ |
1177 | @@ -873,6 +893,17 @@ | |||
1178 | 873 | frv:Linux:*:*) | 893 | frv:Linux:*:*) |
1179 | 874 | echo frv-unknown-linux-gnu | 894 | echo frv-unknown-linux-gnu |
1180 | 875 | exit ;; | 895 | exit ;; |
1181 | 896 | i*86:Linux:*:*) | ||
1182 | 897 | LIBC=gnu | ||
1183 | 898 | eval $set_cc_for_build | ||
1184 | 899 | sed 's/^ //' << EOF >$dummy.c | ||
1185 | 900 | #ifdef __dietlibc__ | ||
1186 | 901 | LIBC=dietlibc | ||
1187 | 902 | #endif | ||
1188 | 903 | EOF | ||
1189 | 904 | eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` | ||
1190 | 905 | echo "${UNAME_MACHINE}-pc-linux-${LIBC}" | ||
1191 | 906 | exit ;; | ||
1192 | 876 | ia64:Linux:*:*) | 907 | ia64:Linux:*:*) |
1193 | 877 | echo ${UNAME_MACHINE}-unknown-linux-gnu | 908 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
1194 | 878 | exit ;; | 909 | exit ;; |
1195 | @@ -882,78 +913,34 @@ | |||
1196 | 882 | m68*:Linux:*:*) | 913 | m68*:Linux:*:*) |
1197 | 883 | echo ${UNAME_MACHINE}-unknown-linux-gnu | 914 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
1198 | 884 | exit ;; | 915 | exit ;; |
1243 | 885 | mips:Linux:*:*) | 916 | mips:Linux:*:* | mips64:Linux:*:*) |
1244 | 886 | eval $set_cc_for_build | 917 | eval $set_cc_for_build |
1245 | 887 | sed 's/^ //' << EOF >$dummy.c | 918 | sed 's/^ //' << EOF >$dummy.c |
1246 | 888 | #undef CPU | 919 | #undef CPU |
1247 | 889 | #undef mips | 920 | #undef ${UNAME_MACHINE} |
1248 | 890 | #undef mipsel | 921 | #undef ${UNAME_MACHINE}el |
1249 | 891 | #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) | 922 | #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) |
1250 | 892 | CPU=mipsel | 923 | CPU=${UNAME_MACHINE}el |
1251 | 893 | #else | 924 | #else |
1252 | 894 | #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) | 925 | #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) |
1253 | 895 | CPU=mips | 926 | CPU=${UNAME_MACHINE} |
1254 | 896 | #else | 927 | #else |
1255 | 897 | CPU= | 928 | CPU= |
1256 | 898 | #endif | 929 | #endif |
1257 | 899 | #endif | 930 | #endif |
1258 | 900 | EOF | 931 | EOF |
1259 | 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'` |
1216 | 902 | /^CPU/{ | ||
1217 | 903 | s: ::g | ||
1218 | 904 | p | ||
1219 | 905 | }'`" | ||
1220 | 906 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } | ||
1221 | 907 | ;; | ||
1222 | 908 | mips64:Linux:*:*) | ||
1223 | 909 | eval $set_cc_for_build | ||
1224 | 910 | sed 's/^ //' << EOF >$dummy.c | ||
1225 | 911 | #undef CPU | ||
1226 | 912 | #undef mips64 | ||
1227 | 913 | #undef mips64el | ||
1228 | 914 | #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) | ||
1229 | 915 | CPU=mips64el | ||
1230 | 916 | #else | ||
1231 | 917 | #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) | ||
1232 | 918 | CPU=mips64 | ||
1233 | 919 | #else | ||
1234 | 920 | CPU= | ||
1235 | 921 | #endif | ||
1236 | 922 | #endif | ||
1237 | 923 | EOF | ||
1238 | 924 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' | ||
1239 | 925 | /^CPU/{ | ||
1240 | 926 | s: ::g | ||
1241 | 927 | p | ||
1242 | 928 | }'`" | ||
1260 | 929 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } | 933 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } |
1261 | 930 | ;; | 934 | ;; |
1262 | 931 | or32:Linux:*:*) | 935 | or32:Linux:*:*) |
1263 | 932 | echo or32-unknown-linux-gnu | 936 | echo or32-unknown-linux-gnu |
1264 | 933 | exit ;; | 937 | exit ;; |
1265 | 934 | ppc:Linux:*:*) | ||
1266 | 935 | echo powerpc-unknown-linux-gnu | ||
1267 | 936 | exit ;; | ||
1268 | 937 | ppc64:Linux:*:*) | ||
1269 | 938 | echo powerpc64-unknown-linux-gnu | ||
1270 | 939 | exit ;; | ||
1271 | 940 | alpha:Linux:*:*) | ||
1272 | 941 | case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in | ||
1273 | 942 | EV5) UNAME_MACHINE=alphaev5 ;; | ||
1274 | 943 | EV56) UNAME_MACHINE=alphaev56 ;; | ||
1275 | 944 | PCA56) UNAME_MACHINE=alphapca56 ;; | ||
1276 | 945 | PCA57) UNAME_MACHINE=alphapca56 ;; | ||
1277 | 946 | EV6) UNAME_MACHINE=alphaev6 ;; | ||
1278 | 947 | EV67) UNAME_MACHINE=alphaev67 ;; | ||
1279 | 948 | EV68*) UNAME_MACHINE=alphaev68 ;; | ||
1280 | 949 | esac | ||
1281 | 950 | objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null | ||
1282 | 951 | if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi | ||
1283 | 952 | echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} | ||
1284 | 953 | exit ;; | ||
1285 | 954 | padre:Linux:*:*) | 938 | padre:Linux:*:*) |
1286 | 955 | echo sparc-unknown-linux-gnu | 939 | echo sparc-unknown-linux-gnu |
1287 | 956 | exit ;; | 940 | exit ;; |
1288 | 941 | parisc64:Linux:*:* | hppa64:Linux:*:*) | ||
1289 | 942 | echo hppa64-unknown-linux-gnu | ||
1290 | 943 | exit ;; | ||
1291 | 957 | parisc:Linux:*:* | hppa:Linux:*:*) | 944 | parisc:Linux:*:* | hppa:Linux:*:*) |
1292 | 958 | # Look for CPU level | 945 | # Look for CPU level |
1293 | 959 | case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in | 946 | case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in |
1294 | @@ -962,8 +949,11 @@ | |||
1295 | 962 | *) echo hppa-unknown-linux-gnu ;; | 949 | *) echo hppa-unknown-linux-gnu ;; |
1296 | 963 | esac | 950 | esac |
1297 | 964 | exit ;; | 951 | exit ;; |
1300 | 965 | parisc64:Linux:*:* | hppa64:Linux:*:*) | 952 | ppc64:Linux:*:*) |
1301 | 966 | echo hppa64-unknown-linux-gnu | 953 | echo powerpc64-unknown-linux-gnu |
1302 | 954 | exit ;; | ||
1303 | 955 | ppc:Linux:*:*) | ||
1304 | 956 | echo powerpc-unknown-linux-gnu | ||
1305 | 967 | exit ;; | 957 | exit ;; |
1306 | 968 | s390:Linux:*:* | s390x:Linux:*:*) | 958 | s390:Linux:*:* | s390x:Linux:*:*) |
1307 | 969 | echo ${UNAME_MACHINE}-ibm-linux | 959 | echo ${UNAME_MACHINE}-ibm-linux |
1308 | @@ -986,66 +976,6 @@ | |||
1309 | 986 | xtensa*:Linux:*:*) | 976 | xtensa*:Linux:*:*) |
1310 | 987 | echo ${UNAME_MACHINE}-unknown-linux-gnu | 977 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
1311 | 988 | exit ;; | 978 | exit ;; |
1312 | 989 | i*86:Linux:*:*) | ||
1313 | 990 | # The BFD linker knows what the default object file format is, so | ||
1314 | 991 | # first see if it will tell us. cd to the root directory to prevent | ||
1315 | 992 | # problems with other programs or directories called `ld' in the path. | ||
1316 | 993 | # Set LC_ALL=C to ensure ld outputs messages in English. | ||
1317 | 994 | ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | ||
1318 | 995 | | sed -ne '/supported targets:/!d | ||
1319 | 996 | s/[ ][ ]*/ /g | ||
1320 | 997 | s/.*supported targets: *// | ||
1321 | 998 | s/ .*// | ||
1322 | 999 | p'` | ||
1323 | 1000 | case "$ld_supported_targets" in | ||
1324 | 1001 | elf32-i386) | ||
1325 | 1002 | TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" | ||
1326 | 1003 | ;; | ||
1327 | 1004 | a.out-i386-linux) | ||
1328 | 1005 | echo "${UNAME_MACHINE}-pc-linux-gnuaout" | ||
1329 | 1006 | exit ;; | ||
1330 | 1007 | "") | ||
1331 | 1008 | # Either a pre-BFD a.out linker (linux-gnuoldld) or | ||
1332 | 1009 | # one that does not give us useful --help. | ||
1333 | 1010 | echo "${UNAME_MACHINE}-pc-linux-gnuoldld" | ||
1334 | 1011 | exit ;; | ||
1335 | 1012 | esac | ||
1336 | 1013 | # Determine whether the default compiler is a.out or elf | ||
1337 | 1014 | eval $set_cc_for_build | ||
1338 | 1015 | sed 's/^ //' << EOF >$dummy.c | ||
1339 | 1016 | #include <features.h> | ||
1340 | 1017 | #ifdef __ELF__ | ||
1341 | 1018 | # ifdef __GLIBC__ | ||
1342 | 1019 | # if __GLIBC__ >= 2 | ||
1343 | 1020 | LIBC=gnu | ||
1344 | 1021 | # else | ||
1345 | 1022 | LIBC=gnulibc1 | ||
1346 | 1023 | # endif | ||
1347 | 1024 | # else | ||
1348 | 1025 | LIBC=gnulibc1 | ||
1349 | 1026 | # endif | ||
1350 | 1027 | #else | ||
1351 | 1028 | #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) | ||
1352 | 1029 | LIBC=gnu | ||
1353 | 1030 | #else | ||
1354 | 1031 | LIBC=gnuaout | ||
1355 | 1032 | #endif | ||
1356 | 1033 | #endif | ||
1357 | 1034 | #ifdef __dietlibc__ | ||
1358 | 1035 | LIBC=dietlibc | ||
1359 | 1036 | #endif | ||
1360 | 1037 | EOF | ||
1361 | 1038 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' | ||
1362 | 1039 | /^LIBC/{ | ||
1363 | 1040 | s: ::g | ||
1364 | 1041 | p | ||
1365 | 1042 | }'`" | ||
1366 | 1043 | test x"${LIBC}" != x && { | ||
1367 | 1044 | echo "${UNAME_MACHINE}-pc-linux-${LIBC}" | ||
1368 | 1045 | exit | ||
1369 | 1046 | } | ||
1370 | 1047 | test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } | ||
1371 | 1048 | ;; | ||
1372 | 1049 | i*86:DYNIX/ptx:4*:*) | 979 | i*86:DYNIX/ptx:4*:*) |
1373 | 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. |
1374 | 1051 | # earlier versions are messed up and put the nodename in both | 981 | # earlier versions are messed up and put the nodename in both |
1375 | @@ -1074,7 +1004,7 @@ | |||
1376 | 1074 | i*86:syllable:*:*) | 1004 | i*86:syllable:*:*) |
1377 | 1075 | echo ${UNAME_MACHINE}-pc-syllable | 1005 | echo ${UNAME_MACHINE}-pc-syllable |
1378 | 1076 | exit ;; | 1006 | exit ;; |
1380 | 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]*:*) |
1381 | 1078 | echo i386-unknown-lynxos${UNAME_RELEASE} | 1008 | echo i386-unknown-lynxos${UNAME_RELEASE} |
1382 | 1079 | exit ;; | 1009 | exit ;; |
1383 | 1080 | i*86:*DOS:*:*) | 1010 | i*86:*DOS:*:*) |
1384 | @@ -1182,7 +1112,7 @@ | |||
1385 | 1182 | rs6000:LynxOS:2.*:*) | 1112 | rs6000:LynxOS:2.*:*) |
1386 | 1183 | echo rs6000-unknown-lynxos${UNAME_RELEASE} | 1113 | echo rs6000-unknown-lynxos${UNAME_RELEASE} |
1387 | 1184 | exit ;; | 1114 | exit ;; |
1389 | 1185 | PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) | 1115 | PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) |
1390 | 1186 | echo powerpc-unknown-lynxos${UNAME_RELEASE} | 1116 | echo powerpc-unknown-lynxos${UNAME_RELEASE} |
1391 | 1187 | exit ;; | 1117 | exit ;; |
1392 | 1188 | SM[BE]S:UNIX_SV:*:*) | 1118 | SM[BE]S:UNIX_SV:*:*) |
1393 | @@ -1275,6 +1205,16 @@ | |||
1394 | 1275 | *:Darwin:*:*) | 1205 | *:Darwin:*:*) |
1395 | 1276 | UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown | 1206 | UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown |
1396 | 1277 | case $UNAME_PROCESSOR in | 1207 | case $UNAME_PROCESSOR in |
1397 | 1208 | i386) | ||
1398 | 1209 | eval $set_cc_for_build | ||
1399 | 1210 | if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then | ||
1400 | 1211 | if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ | ||
1401 | 1212 | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ | ||
1402 | 1213 | grep IS_64BIT_ARCH >/dev/null | ||
1403 | 1214 | then | ||
1404 | 1215 | UNAME_PROCESSOR="x86_64" | ||
1405 | 1216 | fi | ||
1406 | 1217 | fi ;; | ||
1407 | 1278 | unknown) UNAME_PROCESSOR=powerpc ;; | 1218 | unknown) UNAME_PROCESSOR=powerpc ;; |
1408 | 1279 | esac | 1219 | esac |
1409 | 1280 | echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} | 1220 | echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} |
1410 | 1281 | 1221 | ||
1411 | === modified file 'config.h.in' | |||
1412 | --- config.h.in 2009-07-27 19:02:30 +0000 | |||
1413 | +++ config.h.in 2010-04-28 20:38:30 +0000 | |||
1414 | @@ -43,6 +43,9 @@ | |||
1415 | 43 | */ | 43 | */ |
1416 | 44 | #undef LT_OBJDIR | 44 | #undef LT_OBJDIR |
1417 | 45 | 45 | ||
1418 | 46 | /* Define to 1 if you need the dbus_connection_can_send_type() funnction. */ | ||
1419 | 47 | #undef NEED_DBUS_CONNECTION_CAN_SEND_TYPE | ||
1420 | 48 | |||
1421 | 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. */ |
1422 | 47 | #undef NEED_DBUS_WATCH_GET_UNIX_FD | 50 | #undef NEED_DBUS_WATCH_GET_UNIX_FD |
1423 | 48 | 51 | ||
1424 | 49 | 52 | ||
1425 | === modified file 'config.sub' | |||
1426 | --- config.sub 2009-07-27 19:02:30 +0000 | |||
1427 | +++ config.sub 2010-04-28 20:38:30 +0000 | |||
1428 | @@ -1,10 +1,10 @@ | |||
1429 | 1 | #! /bin/sh | 1 | #! /bin/sh |
1430 | 2 | # Configuration validation subroutine script. | 2 | # Configuration validation subroutine script. |
1431 | 3 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, | 3 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
1433 | 4 | # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 | 4 | # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
1434 | 5 | # Free Software Foundation, Inc. | 5 | # Free Software Foundation, Inc. |
1435 | 6 | 6 | ||
1437 | 7 | timestamp='2009-04-17' | 7 | timestamp='2009-11-20' |
1438 | 8 | 8 | ||
1439 | 9 | # This file is (in principle) common to ALL GNU software. | 9 | # This file is (in principle) common to ALL GNU software. |
1440 | 10 | # The presence of a machine in this file suggests that SOME GNU software | 10 | # The presence of a machine in this file suggests that SOME GNU software |
1441 | @@ -32,13 +32,16 @@ | |||
1442 | 32 | 32 | ||
1443 | 33 | 33 | ||
1444 | 34 | # Please send patches to <config-patches@gnu.org>. Submit a context | 34 | # Please send patches to <config-patches@gnu.org>. Submit a context |
1446 | 35 | # diff and a properly formatted ChangeLog entry. | 35 | # diff and a properly formatted GNU ChangeLog entry. |
1447 | 36 | # | 36 | # |
1448 | 37 | # Configuration subroutine to validate and canonicalize a configuration type. | 37 | # Configuration subroutine to validate and canonicalize a configuration type. |
1449 | 38 | # Supply the specified configuration type as an argument. | 38 | # Supply the specified configuration type as an argument. |
1450 | 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. |
1451 | 40 | # Otherwise, we print the canonical config type on stdout and succeed. | 40 | # Otherwise, we print the canonical config type on stdout and succeed. |
1452 | 41 | 41 | ||
1453 | 42 | # You can get the latest version of this script from: | ||
1454 | 43 | # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD | ||
1455 | 44 | |||
1456 | 42 | # This file is supposed to be the same for all GNU packages | 45 | # This file is supposed to be the same for all GNU packages |
1457 | 43 | # and recognize all the CPU types, system types and aliases | 46 | # and recognize all the CPU types, system types and aliases |
1458 | 44 | # that are meaningful with *any* GNU software. | 47 | # that are meaningful with *any* GNU software. |
1459 | @@ -149,10 +152,13 @@ | |||
1460 | 149 | -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ | 152 | -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ |
1461 | 150 | -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ | 153 | -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ |
1462 | 151 | -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ | 154 | -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ |
1464 | 152 | -apple | -axis | -knuth | -cray) | 155 | -apple | -axis | -knuth | -cray | -microblaze) |
1465 | 153 | os= | 156 | os= |
1466 | 154 | basic_machine=$1 | 157 | basic_machine=$1 |
1467 | 155 | ;; | 158 | ;; |
1468 | 159 | -bluegene*) | ||
1469 | 160 | os=-cnk | ||
1470 | 161 | ;; | ||
1471 | 156 | -sim | -cisco | -oki | -wec | -winbond) | 162 | -sim | -cisco | -oki | -wec | -winbond) |
1472 | 157 | os= | 163 | os= |
1473 | 158 | basic_machine=$1 | 164 | basic_machine=$1 |
1474 | @@ -281,6 +287,7 @@ | |||
1475 | 281 | | pdp10 | pdp11 | pj | pjl \ | 287 | | pdp10 | pdp11 | pj | pjl \ |
1476 | 282 | | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | 288 | | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ |
1477 | 283 | | pyramid \ | 289 | | pyramid \ |
1478 | 290 | | rx \ | ||
1479 | 284 | | score \ | 291 | | score \ |
1480 | 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 \ |
1481 | 286 | | sh64 | sh64le \ | 293 | | sh64 | sh64le \ |
1482 | @@ -288,13 +295,14 @@ | |||
1483 | 288 | | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | 295 | | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ |
1484 | 289 | | spu | strongarm \ | 296 | | spu | strongarm \ |
1485 | 290 | | tahoe | thumb | tic4x | tic80 | tron \ | 297 | | tahoe | thumb | tic4x | tic80 | tron \ |
1486 | 298 | | ubicom32 \ | ||
1487 | 291 | | v850 | v850e \ | 299 | | v850 | v850e \ |
1488 | 292 | | we32k \ | 300 | | we32k \ |
1489 | 293 | | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | 301 | | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ |
1490 | 294 | | z8k | z80) | 302 | | z8k | z80) |
1491 | 295 | basic_machine=$basic_machine-unknown | 303 | basic_machine=$basic_machine-unknown |
1492 | 296 | ;; | 304 | ;; |
1494 | 297 | m6811 | m68hc11 | m6812 | m68hc12) | 305 | m6811 | m68hc11 | m6812 | m68hc12 | picochip) |
1495 | 298 | # Motorola 68HC11/12. | 306 | # Motorola 68HC11/12. |
1496 | 299 | basic_machine=$basic_machine-unknown | 307 | basic_machine=$basic_machine-unknown |
1497 | 300 | os=-none | 308 | os=-none |
1498 | @@ -337,7 +345,7 @@ | |||
1499 | 337 | | lm32-* \ | 345 | | lm32-* \ |
1500 | 338 | | m32c-* | m32r-* | m32rle-* \ | 346 | | m32c-* | m32r-* | m32rle-* \ |
1501 | 339 | | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | 347 | | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ |
1503 | 340 | | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | 348 | | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ |
1504 | 341 | | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | 349 | | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ |
1505 | 342 | | mips16-* \ | 350 | | mips16-* \ |
1506 | 343 | | mips64-* | mips64el-* \ | 351 | | mips64-* | mips64el-* \ |
1507 | @@ -365,7 +373,7 @@ | |||
1508 | 365 | | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | 373 | | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ |
1509 | 366 | | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | 374 | | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ |
1510 | 367 | | pyramid-* \ | 375 | | pyramid-* \ |
1512 | 368 | | romp-* | rs6000-* \ | 376 | | romp-* | rs6000-* | rx-* \ |
1513 | 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-* \ |
1514 | 370 | | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | 378 | | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ |
1515 | 371 | | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | 379 | | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ |
1516 | @@ -374,6 +382,7 @@ | |||
1517 | 374 | | tahoe-* | thumb-* \ | 382 | | tahoe-* | thumb-* \ |
1518 | 375 | | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | 383 | | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ |
1519 | 376 | | tron-* \ | 384 | | tron-* \ |
1520 | 385 | | ubicom32-* \ | ||
1521 | 377 | | v850-* | v850e-* | vax-* \ | 386 | | v850-* | v850e-* | vax-* \ |
1522 | 378 | | we32k-* \ | 387 | | we32k-* \ |
1523 | 379 | | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | 388 | | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ |
1524 | @@ -467,6 +476,10 @@ | |||
1525 | 467 | basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` | 476 | basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` |
1526 | 468 | os=-linux | 477 | os=-linux |
1527 | 469 | ;; | 478 | ;; |
1528 | 479 | bluegene*) | ||
1529 | 480 | basic_machine=powerpc-ibm | ||
1530 | 481 | os=-cnk | ||
1531 | 482 | ;; | ||
1532 | 470 | c90) | 483 | c90) |
1533 | 471 | basic_machine=c90-cray | 484 | basic_machine=c90-cray |
1534 | 472 | os=-unicos | 485 | os=-unicos |
1535 | @@ -719,6 +732,9 @@ | |||
1536 | 719 | basic_machine=ns32k-utek | 732 | basic_machine=ns32k-utek |
1537 | 720 | os=-sysv | 733 | os=-sysv |
1538 | 721 | ;; | 734 | ;; |
1539 | 735 | microblaze) | ||
1540 | 736 | basic_machine=microblaze-xilinx | ||
1541 | 737 | ;; | ||
1542 | 722 | mingw32) | 738 | mingw32) |
1543 | 723 | basic_machine=i386-pc | 739 | basic_machine=i386-pc |
1544 | 724 | os=-mingw32 | 740 | os=-mingw32 |
1545 | @@ -1240,6 +1256,9 @@ | |||
1546 | 1240 | # First match some system type aliases | 1256 | # First match some system type aliases |
1547 | 1241 | # that might get confused with valid system types. | 1257 | # that might get confused with valid system types. |
1548 | 1242 | # -solaris* is a basic system type, with this one exception. | 1258 | # -solaris* is a basic system type, with this one exception. |
1549 | 1259 | -auroraux) | ||
1550 | 1260 | os=-auroraux | ||
1551 | 1261 | ;; | ||
1552 | 1243 | -solaris1 | -solaris1.*) | 1262 | -solaris1 | -solaris1.*) |
1553 | 1244 | os=`echo $os | sed -e 's|solaris1|sunos4|'` | 1263 | os=`echo $os | sed -e 's|solaris1|sunos4|'` |
1554 | 1245 | ;; | 1264 | ;; |
1555 | @@ -1260,9 +1279,9 @@ | |||
1556 | 1260 | # Each alternative MUST END IN A *, to match a version number. | 1279 | # Each alternative MUST END IN A *, to match a version number. |
1557 | 1261 | # -sysv* is not here because it comes later, after sysvr4. | 1280 | # -sysv* is not here because it comes later, after sysvr4. |
1558 | 1262 | -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | 1281 | -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ |
1562 | 1263 | | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | 1282 | | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ |
1563 | 1264 | | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | 1283 | | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ |
1564 | 1265 | | -kopensolaris* \ | 1284 | | -sym* | -kopensolaris* \ |
1565 | 1266 | | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | 1285 | | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ |
1566 | 1267 | | -aos* | -aros* \ | 1286 | | -aos* | -aros* \ |
1567 | 1268 | | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | 1287 | | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ |
1568 | @@ -1283,7 +1302,7 @@ | |||
1569 | 1283 | | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | 1302 | | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ |
1570 | 1284 | | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | 1303 | | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ |
1571 | 1285 | | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | 1304 | | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ |
1573 | 1286 | | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) | 1305 | | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) |
1574 | 1287 | # Remember, each alternative MUST END IN *, to match a version number. | 1306 | # Remember, each alternative MUST END IN *, to match a version number. |
1575 | 1288 | ;; | 1307 | ;; |
1576 | 1289 | -qnx*) | 1308 | -qnx*) |
1577 | @@ -1613,7 +1632,7 @@ | |||
1578 | 1613 | -sunos*) | 1632 | -sunos*) |
1579 | 1614 | vendor=sun | 1633 | vendor=sun |
1580 | 1615 | ;; | 1634 | ;; |
1582 | 1616 | -aix*) | 1635 | -cnk*|-aix*) |
1583 | 1617 | vendor=ibm | 1636 | vendor=ibm |
1584 | 1618 | ;; | 1637 | ;; |
1585 | 1619 | -beos*) | 1638 | -beos*) |
1586 | 1620 | 1639 | ||
1587 | === modified file 'configure' | |||
1588 | --- configure 2010-01-10 10:46:58 +0000 | |||
1589 | +++ configure 2010-04-28 20:38:30 +0000 | |||
1590 | @@ -1,6 +1,6 @@ | |||
1591 | 1 | #! /bin/sh | 1 | #! /bin/sh |
1592 | 2 | # Guess values for system-dependent variables and create Makefiles. | 2 | # Guess values for system-dependent variables and create Makefiles. |
1594 | 3 | # Generated by GNU Autoconf 2.63 for obexd 0.21. | 3 | # Generated by GNU Autoconf 2.63 for obexd 0.22. |
1595 | 4 | # | 4 | # |
1596 | 5 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, | 5 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, |
1597 | 6 | # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. | 6 | # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
1598 | @@ -743,8 +743,8 @@ | |||
1599 | 743 | # Identity of this package. | 743 | # Identity of this package. |
1600 | 744 | PACKAGE_NAME='obexd' | 744 | PACKAGE_NAME='obexd' |
1601 | 745 | PACKAGE_TARNAME='obexd' | 745 | PACKAGE_TARNAME='obexd' |
1604 | 746 | PACKAGE_VERSION='0.21' | 746 | PACKAGE_VERSION='0.22' |
1605 | 747 | PACKAGE_STRING='obexd 0.21' | 747 | PACKAGE_STRING='obexd 0.22' |
1606 | 748 | PACKAGE_BUGREPORT='' | 748 | PACKAGE_BUGREPORT='' |
1607 | 749 | 749 | ||
1608 | 750 | ac_default_prefix=/usr/local | 750 | ac_default_prefix=/usr/local |
1609 | @@ -1509,7 +1509,7 @@ | |||
1610 | 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. |
1611 | 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. |
1612 | 1511 | cat <<_ACEOF | 1511 | cat <<_ACEOF |
1614 | 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. |
1615 | 1513 | 1513 | ||
1616 | 1514 | Usage: $0 [OPTION]... [VAR=VALUE]... | 1514 | Usage: $0 [OPTION]... [VAR=VALUE]... |
1617 | 1515 | 1515 | ||
1618 | @@ -1579,7 +1579,7 @@ | |||
1619 | 1579 | 1579 | ||
1620 | 1580 | if test -n "$ac_init_help"; then | 1580 | if test -n "$ac_init_help"; then |
1621 | 1581 | case $ac_init_help in | 1581 | case $ac_init_help in |
1623 | 1582 | short | recursive ) echo "Configuration of obexd 0.21:";; | 1582 | short | recursive ) echo "Configuration of obexd 0.22:";; |
1624 | 1583 | esac | 1583 | esac |
1625 | 1584 | cat <<\_ACEOF | 1584 | cat <<\_ACEOF |
1626 | 1585 | 1585 | ||
1627 | @@ -1706,7 +1706,7 @@ | |||
1628 | 1706 | test -n "$ac_init_help" && exit $ac_status | 1706 | test -n "$ac_init_help" && exit $ac_status |
1629 | 1707 | if $ac_init_version; then | 1707 | if $ac_init_version; then |
1630 | 1708 | cat <<\_ACEOF | 1708 | cat <<\_ACEOF |
1632 | 1709 | obexd configure 0.21 | 1709 | obexd configure 0.22 |
1633 | 1710 | generated by GNU Autoconf 2.63 | 1710 | generated by GNU Autoconf 2.63 |
1634 | 1711 | 1711 | ||
1635 | 1712 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, | 1712 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, |
1636 | @@ -1720,7 +1720,7 @@ | |||
1637 | 1720 | This file contains any messages produced by compilers while | 1720 | This file contains any messages produced by compilers while |
1638 | 1721 | running configure, to aid debugging if configure makes a mistake. | 1721 | running configure, to aid debugging if configure makes a mistake. |
1639 | 1722 | 1722 | ||
1641 | 1723 | It was created by obexd $as_me 0.21, which was | 1723 | It was created by obexd $as_me 0.22, which was |
1642 | 1724 | generated by GNU Autoconf 2.63. Invocation command line was | 1724 | generated by GNU Autoconf 2.63. Invocation command line was |
1643 | 1725 | 1725 | ||
1644 | 1726 | $ $0 $@ | 1726 | $ $0 $@ |
1645 | @@ -2570,7 +2570,7 @@ | |||
1646 | 2570 | 2570 | ||
1647 | 2571 | # Define the identity of the package. | 2571 | # Define the identity of the package. |
1648 | 2572 | PACKAGE='obexd' | 2572 | PACKAGE='obexd' |
1650 | 2573 | VERSION='0.21' | 2573 | VERSION='0.22' |
1651 | 2574 | 2574 | ||
1652 | 2575 | 2575 | ||
1653 | 2576 | cat >>confdefs.h <<_ACEOF | 2576 | cat >>confdefs.h <<_ACEOF |
1654 | @@ -4040,8 +4040,8 @@ | |||
1655 | 4040 | 4040 | ||
1656 | 4041 | 4041 | ||
1657 | 4042 | 4042 | ||
1660 | 4043 | macro_version='2.2.6' | 4043 | macro_version='2.2.6b' |
1661 | 4044 | macro_revision='1.3012' | 4044 | macro_revision='1.3017' |
1662 | 4045 | 4045 | ||
1663 | 4046 | 4046 | ||
1664 | 4047 | 4047 | ||
1665 | @@ -11932,6 +11932,81 @@ | |||
1666 | 11932 | 11932 | ||
1667 | 11933 | fi | 11933 | fi |
1668 | 11934 | 11934 | ||
1669 | 11935 | { $as_echo "$as_me:$LINENO: checking for dbus_connection_can_send_type in -ldbus-1" >&5 | ||
1670 | 11936 | $as_echo_n "checking for dbus_connection_can_send_type in -ldbus-1... " >&6; } | ||
1671 | 11937 | if test "${ac_cv_lib_dbus_1_dbus_connection_can_send_type+set}" = set; then | ||
1672 | 11938 | $as_echo_n "(cached) " >&6 | ||
1673 | 11939 | else | ||
1674 | 11940 | ac_check_lib_save_LIBS=$LIBS | ||
1675 | 11941 | LIBS="-ldbus-1 $LIBS" | ||
1676 | 11942 | cat >conftest.$ac_ext <<_ACEOF | ||
1677 | 11943 | /* confdefs.h. */ | ||
1678 | 11944 | _ACEOF | ||
1679 | 11945 | cat confdefs.h >>conftest.$ac_ext | ||
1680 | 11946 | cat >>conftest.$ac_ext <<_ACEOF | ||
1681 | 11947 | /* end confdefs.h. */ | ||
1682 | 11948 | |||
1683 | 11949 | /* Override any GCC internal prototype to avoid an error. | ||
1684 | 11950 | Use char because int might match the return type of a GCC | ||
1685 | 11951 | builtin and then its argument prototype would still apply. */ | ||
1686 | 11952 | #ifdef __cplusplus | ||
1687 | 11953 | extern "C" | ||
1688 | 11954 | #endif | ||
1689 | 11955 | char dbus_connection_can_send_type (); | ||
1690 | 11956 | int | ||
1691 | 11957 | main () | ||
1692 | 11958 | { | ||
1693 | 11959 | return dbus_connection_can_send_type (); | ||
1694 | 11960 | ; | ||
1695 | 11961 | return 0; | ||
1696 | 11962 | } | ||
1697 | 11963 | _ACEOF | ||
1698 | 11964 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
1699 | 11965 | if { (ac_try="$ac_link" | ||
1700 | 11966 | case "(($ac_try" in | ||
1701 | 11967 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
1702 | 11968 | *) ac_try_echo=$ac_try;; | ||
1703 | 11969 | esac | ||
1704 | 11970 | eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" | ||
1705 | 11971 | $as_echo "$ac_try_echo") >&5 | ||
1706 | 11972 | (eval "$ac_link") 2>conftest.er1 | ||
1707 | 11973 | ac_status=$? | ||
1708 | 11974 | grep -v '^ *+' conftest.er1 >conftest.err | ||
1709 | 11975 | rm -f conftest.er1 | ||
1710 | 11976 | cat conftest.err >&5 | ||
1711 | 11977 | $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
1712 | 11978 | (exit $ac_status); } && { | ||
1713 | 11979 | test -z "$ac_c_werror_flag" || | ||
1714 | 11980 | test ! -s conftest.err | ||
1715 | 11981 | } && test -s conftest$ac_exeext && { | ||
1716 | 11982 | test "$cross_compiling" = yes || | ||
1717 | 11983 | $as_test_x conftest$ac_exeext | ||
1718 | 11984 | }; then | ||
1719 | 11985 | ac_cv_lib_dbus_1_dbus_connection_can_send_type=yes | ||
1720 | 11986 | else | ||
1721 | 11987 | $as_echo "$as_me: failed program was:" >&5 | ||
1722 | 11988 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
1723 | 11989 | |||
1724 | 11990 | ac_cv_lib_dbus_1_dbus_connection_can_send_type=no | ||
1725 | 11991 | fi | ||
1726 | 11992 | |||
1727 | 11993 | rm -rf conftest.dSYM | ||
1728 | 11994 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ | ||
1729 | 11995 | conftest$ac_exeext conftest.$ac_ext | ||
1730 | 11996 | LIBS=$ac_check_lib_save_LIBS | ||
1731 | 11997 | fi | ||
1732 | 11998 | { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dbus_1_dbus_connection_can_send_type" >&5 | ||
1733 | 11999 | $as_echo "$ac_cv_lib_dbus_1_dbus_connection_can_send_type" >&6; } | ||
1734 | 12000 | if test "x$ac_cv_lib_dbus_1_dbus_connection_can_send_type" = x""yes; then | ||
1735 | 12001 | dummy=yes | ||
1736 | 12002 | else | ||
1737 | 12003 | |||
1738 | 12004 | cat >>confdefs.h <<\_ACEOF | ||
1739 | 12005 | #define NEED_DBUS_CONNECTION_CAN_SEND_TYPE 1 | ||
1740 | 12006 | _ACEOF | ||
1741 | 12007 | |||
1742 | 12008 | fi | ||
1743 | 12009 | |||
1744 | 11935 | 12010 | ||
1745 | 11936 | 12011 | ||
1746 | 11937 | 12012 | ||
1747 | @@ -12102,13 +12177,16 @@ | |||
1748 | 12102 | 12177 | ||
1749 | 12103 | fi | 12178 | fi |
1750 | 12104 | 12179 | ||
1751 | 12105 | |||
1752 | 12106 | phonebook_driver=dummy | 12180 | phonebook_driver=dummy |
1753 | 12107 | 12181 | ||
1754 | 12108 | # Check whether --with-phonebook was given. | 12182 | # Check whether --with-phonebook was given. |
1755 | 12109 | if test "${with_phonebook+set}" = set; then | 12183 | if test "${with_phonebook+set}" = set; then |
1756 | 12110 | withval=$with_phonebook; | 12184 | withval=$with_phonebook; |
1758 | 12111 | phonebook_driver=${withval} | 12185 | if (test "${withval}" = "no"); then |
1759 | 12186 | phonebook_driver=dummy; | ||
1760 | 12187 | else | ||
1761 | 12188 | phonebook_driver=${withval}; | ||
1762 | 12189 | fi | ||
1763 | 12112 | 12190 | ||
1764 | 12113 | fi | 12191 | fi |
1765 | 12114 | 12192 | ||
1766 | @@ -12277,7 +12355,11 @@ | |||
1767 | 12277 | # Check whether --with-telephony was given. | 12355 | # Check whether --with-telephony was given. |
1768 | 12278 | if test "${with_telephony+set}" = set; then | 12356 | if test "${with_telephony+set}" = set; then |
1769 | 12279 | withval=$with_telephony; | 12357 | withval=$with_telephony; |
1771 | 12280 | telephony_driver=${withval} | 12358 | if (test "${withval}" = "no"); then |
1772 | 12359 | telephony_driver=dummy; | ||
1773 | 12360 | else | ||
1774 | 12361 | telephony_driver=${withval}; | ||
1775 | 12362 | fi | ||
1776 | 12281 | 12363 | ||
1777 | 12282 | fi | 12364 | fi |
1778 | 12283 | 12365 | ||
1779 | @@ -12781,7 +12863,7 @@ | |||
1780 | 12781 | # report actual input values of CONFIG_FILES etc. instead of their | 12863 | # report actual input values of CONFIG_FILES etc. instead of their |
1781 | 12782 | # values after options handling. | 12864 | # values after options handling. |
1782 | 12783 | ac_log=" | 12865 | ac_log=" |
1784 | 12784 | This file was extended by obexd $as_me 0.21, which was | 12866 | This file was extended by obexd $as_me 0.22, which was |
1785 | 12785 | generated by GNU Autoconf 2.63. Invocation command line was | 12867 | generated by GNU Autoconf 2.63. Invocation command line was |
1786 | 12786 | 12868 | ||
1787 | 12787 | CONFIG_FILES = $CONFIG_FILES | 12869 | CONFIG_FILES = $CONFIG_FILES |
1788 | @@ -12844,7 +12926,7 @@ | |||
1789 | 12844 | _ACEOF | 12926 | _ACEOF |
1790 | 12845 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | 12927 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
1791 | 12846 | ac_cs_version="\\ | 12928 | ac_cs_version="\\ |
1793 | 12847 | obexd config.status 0.21 | 12929 | obexd config.status 0.22 |
1794 | 12848 | configured by $0, generated by GNU Autoconf 2.63, | 12930 | configured by $0, generated by GNU Autoconf 2.63, |
1795 | 12849 | with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" | 12931 | with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" |
1796 | 12850 | 12932 | ||
1797 | 12851 | 12933 | ||
1798 | === modified file 'configure.ac' | |||
1799 | --- configure.ac 2010-01-10 10:46:58 +0000 | |||
1800 | +++ configure.ac 2010-04-28 20:38:30 +0000 | |||
1801 | @@ -1,5 +1,5 @@ | |||
1802 | 1 | AC_PREREQ(2.60) | 1 | AC_PREREQ(2.60) |
1804 | 2 | AC_INIT(obexd, 0.21) | 2 | AC_INIT(obexd, 0.22) |
1805 | 3 | 3 | ||
1806 | 4 | AM_INIT_AUTOMAKE([foreign subdir-objects]) | 4 | AM_INIT_AUTOMAKE([foreign subdir-objects]) |
1807 | 5 | AM_CONFIG_HEADER(config.h) | 5 | AM_CONFIG_HEADER(config.h) |
1808 | @@ -76,6 +76,9 @@ | |||
1809 | 76 | AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes, | 76 | AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes, |
1810 | 77 | AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1, | 77 | AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1, |
1811 | 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.])) |
1812 | 79 | AC_CHECK_LIB(dbus-1, dbus_connection_can_send_type, dummy=yes, | ||
1813 | 80 | AC_DEFINE(NEED_DBUS_CONNECTION_CAN_SEND_TYPE, 1, | ||
1814 | 81 | [Define to 1 if you need the dbus_connection_can_send_type() funnction.])) | ||
1815 | 79 | AC_SUBST(DBUS_CFLAGS) | 82 | AC_SUBST(DBUS_CFLAGS) |
1816 | 80 | AC_SUBST(DBUS_LIBS) | 83 | AC_SUBST(DBUS_LIBS) |
1817 | 81 | 84 | ||
1818 | @@ -102,10 +105,13 @@ | |||
1819 | 102 | CFLAGS="$CFLAGS -g" | 105 | CFLAGS="$CFLAGS -g" |
1820 | 103 | fi | 106 | fi |
1821 | 104 | ]) | 107 | ]) |
1822 | 105 | |||
1823 | 106 | phonebook_driver=dummy | 108 | phonebook_driver=dummy |
1824 | 107 | AC_ARG_WITH(phonebook, AC_HELP_STRING([--with-phonebook=DRIVER], [select phonebook driver]), [ | 109 | AC_ARG_WITH(phonebook, AC_HELP_STRING([--with-phonebook=DRIVER], [select phonebook driver]), [ |
1826 | 108 | phonebook_driver=${withval} | 110 | if (test "${withval}" = "no"); then |
1827 | 111 | phonebook_driver=dummy; | ||
1828 | 112 | else | ||
1829 | 113 | phonebook_driver=${withval}; | ||
1830 | 114 | fi | ||
1831 | 109 | ]) | 115 | ]) |
1832 | 110 | 116 | ||
1833 | 111 | if (test "${phonebook_driver}" = "ebook"); then | 117 | if (test "${phonebook_driver}" = "ebook"); then |
1834 | @@ -126,7 +132,11 @@ | |||
1835 | 126 | 132 | ||
1836 | 127 | telephony_driver=dummy | 133 | telephony_driver=dummy |
1837 | 128 | AC_ARG_WITH(telephony, AC_HELP_STRING([--with-telephony=DRIVER], [select telephony driver]), [ | 134 | AC_ARG_WITH(telephony, AC_HELP_STRING([--with-telephony=DRIVER], [select telephony driver]), [ |
1839 | 129 | telephony_driver=${withval} | 135 | if (test "${withval}" = "no"); then |
1840 | 136 | telephony_driver=dummy; | ||
1841 | 137 | else | ||
1842 | 138 | telephony_driver=${withval}; | ||
1843 | 139 | fi | ||
1844 | 130 | ]) | 140 | ]) |
1845 | 131 | 141 | ||
1846 | 132 | AC_SUBST([TELEPHONY_DRIVER], [telephony-${telephony_driver}.c]) | 142 | AC_SUBST([TELEPHONY_DRIVER], [telephony-${telephony_driver}.c]) |
1847 | 133 | 143 | ||
1848 | === modified file 'debian/changelog' | |||
1849 | --- debian/changelog 2010-01-10 10:46:58 +0000 | |||
1850 | +++ debian/changelog 2010-04-28 20:38:30 +0000 | |||
1851 | @@ -1,4 +1,28 @@ | |||
1853 | 1 | obexd (0.21-0ubuntu1) lucid; urgency=low | 1 | obexd (0.22-0ubuntu2) lucid-proposed; urgency=low |
1854 | 2 | |||
1855 | 3 | * debian/patches/0001-Revert-Fix-the-session-is-shutdown-when-the-agent-ex.patch | ||
1856 | 4 | - Revert change in release 0.22 to fix bluetooth-sendto dialog not being | ||
1857 | 5 | closed after transfer (LP: #559412) | ||
1858 | 6 | |||
1859 | 7 | -- Baptiste Mille-Mathias <baptiste.millemathias@gmail.com> Wed, 28 Apr 2010 21:20:16 +0200 | ||
1860 | 8 | |||
1861 | 9 | obexd (0.22-0ubuntu1) lucid; urgency=low | ||
1862 | 10 | |||
1863 | 11 | * New upstream release (LP: #539914): | ||
1864 | 12 | - Fix file corruption during PUT operation. (LP: #421684] | ||
1865 | 13 | - Fix the response of PUT requests for PBAP. | ||
1866 | 14 | - Fix blocking while waiting capability script to exit. | ||
1867 | 15 | - Fix compilation issues with driver and plugin options. | ||
1868 | 16 | - Fix service driver selection when WHO header is informed. | ||
1869 | 17 | - Fix issue with PC-Suite WHO header. | ||
1870 | 18 | - Fix issue when mime type exists but is unknown. | ||
1871 | 19 | - Fix issue when opening file fails during SendFiles. | ||
1872 | 20 | - Fix error code response when there is no default vCard. | ||
1873 | 21 | - Fix a memory leak when opening a folder for listing. | ||
1874 | 22 | |||
1875 | 23 | -- Baptiste Mille-Mathias <baptiste.millemathias@gmail.com> Mon, 15 Mar 2010 20:43:06 +0100 | ||
1876 | 24 | |||
1877 | 25 | obexd (0.21-0ubuntu1) karmic; urgency=low | ||
1878 | 2 | 26 | ||
1879 | 3 | * New upstream release: (LP: #505432) | 27 | * New upstream release: (LP: #505432) |
1880 | 4 | - Fix crash caused by D-Bus timeout handling. | 28 | - Fix crash caused by D-Bus timeout handling. |
1881 | 5 | 29 | ||
1882 | === added directory 'debian/patches' | |||
1883 | === added file 'debian/patches/0001-Revert-Fix-the-session-is-shutdown-when-the-agent-ex.patch' | |||
1884 | --- debian/patches/0001-Revert-Fix-the-session-is-shutdown-when-the-agent-ex.patch 1970-01-01 00:00:00 +0000 | |||
1885 | +++ debian/patches/0001-Revert-Fix-the-session-is-shutdown-when-the-agent-ex.patch 2010-04-28 20:38:30 +0000 | |||
1886 | @@ -0,0 +1,50 @@ | |||
1887 | 1 | diff -Nur -x '*.orig' -x '*~' obexd/client/session.c obexd.new/client/session.c | ||
1888 | 2 | --- obexd/client/session.c 2010-04-26 21:41:26.362047000 +0200 | ||
1889 | 3 | +++ obexd.new/client/session.c 2010-04-28 22:32:26.726018633 +0200 | ||
1890 | 4 | @@ -588,6 +588,21 @@ | ||
1891 | 5 | session_unref(session); | ||
1892 | 6 | } | ||
1893 | 7 | |||
1894 | 8 | +int session_set_agent(struct session_data *session, const char *name, | ||
1895 | 9 | + const char *path) | ||
1896 | 10 | +{ | ||
1897 | 11 | + if (session == NULL) | ||
1898 | 12 | + return -EINVAL; | ||
1899 | 13 | + | ||
1900 | 14 | + if (session->agent_name != NULL || session->agent_path != NULL) | ||
1901 | 15 | + return -EALREADY; | ||
1902 | 16 | + | ||
1903 | 17 | + session->agent_name = g_strdup(name); | ||
1904 | 18 | + session->agent_path = g_strdup(path); | ||
1905 | 19 | + | ||
1906 | 20 | + return 0; | ||
1907 | 21 | +} | ||
1908 | 22 | + | ||
1909 | 23 | static void append_entry(DBusMessageIter *dict, | ||
1910 | 24 | const char *key, int type, void *val) | ||
1911 | 25 | { | ||
1912 | 26 | @@ -1850,24 +1865,3 @@ | ||
1913 | 27 | |||
1914 | 28 | return 0; | ||
1915 | 29 | } | ||
1916 | 30 | - | ||
1917 | 31 | -int session_set_agent(struct session_data *session, const char *name, | ||
1918 | 32 | - const char *path) | ||
1919 | 33 | -{ | ||
1920 | 34 | - if (session == NULL) | ||
1921 | 35 | - return -EINVAL; | ||
1922 | 36 | - | ||
1923 | 37 | - if (session->agent_name != NULL || session->agent_path != NULL) | ||
1924 | 38 | - return -EALREADY; | ||
1925 | 39 | - | ||
1926 | 40 | - session->agent_name = g_strdup(name); | ||
1927 | 41 | - session->agent_path = g_strdup(path); | ||
1928 | 42 | - | ||
1929 | 43 | - session->owner_watch = g_dbus_add_disconnect_watch(session->conn, | ||
1930 | 44 | - session->owner, owner_disconnected, | ||
1931 | 45 | - session, NULL); | ||
1932 | 46 | - | ||
1933 | 47 | - session_ref(session); | ||
1934 | 48 | - | ||
1935 | 49 | - return 0; | ||
1936 | 50 | -} | ||
1937 | 0 | 51 | ||
1938 | === modified file 'doc/agent-api.txt' | |||
1939 | --- doc/agent-api.txt 2009-07-27 19:02:30 +0000 | |||
1940 | +++ doc/agent-api.txt 2010-04-28 20:38:30 +0000 | |||
1941 | @@ -1,9 +1,8 @@ | |||
1942 | 1 | obexd Agent API description | 1 | obexd Agent API description |
1943 | 2 | ********************************** | 2 | ********************************** |
1944 | 3 | 3 | ||
1948 | 4 | Copyright (C) 2007-2008 Nokia Corporation | 4 | Copyright (C) 2007-2010 Nokia Corporation |
1949 | 5 | Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT) | 5 | Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
1947 | 6 | Copyright (C) 2007-2008 Marcel Holtmann <marcel@holtmann.org> | ||
1950 | 7 | 6 | ||
1951 | 8 | 7 | ||
1952 | 9 | Agent hierarchy | 8 | Agent hierarchy |
1953 | 10 | 9 | ||
1954 | === modified file 'doc/client-api.txt' | |||
1955 | --- doc/client-api.txt 2010-01-10 10:46:58 +0000 | |||
1956 | +++ doc/client-api.txt 2010-04-28 20:38:30 +0000 | |||
1957 | @@ -1,7 +1,7 @@ | |||
1958 | 1 | OBEX client API description | 1 | OBEX client API description |
1959 | 2 | *************************** | 2 | *************************** |
1960 | 3 | 3 | ||
1962 | 4 | Copyright (C) 2007-2008 Marcel Holtmann <marcel@holtmann.org> | 4 | Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
1963 | 5 | 5 | ||
1964 | 6 | 6 | ||
1965 | 7 | Client hierarchy | 7 | Client hierarchy |
1966 | 8 | 8 | ||
1967 | === modified file 'doc/obexd-api.txt' | |||
1968 | --- doc/obexd-api.txt 2009-07-27 19:02:30 +0000 | |||
1969 | +++ doc/obexd-api.txt 2010-04-28 20:38:30 +0000 | |||
1970 | @@ -1,9 +1,8 @@ | |||
1971 | 1 | obexd API description | 1 | obexd API description |
1972 | 2 | ********************************** | 2 | ********************************** |
1973 | 3 | 3 | ||
1977 | 4 | Copyright (C) 2007-2008 Nokia Corporation | 4 | Copyright (C) 2007-2010 Nokia Corporation |
1978 | 5 | Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT) | 5 | Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
1976 | 6 | Copyright (C) 2007-2008 Marcel Holtmann <marcel@holtmann.org> | ||
1979 | 7 | 6 | ||
1980 | 8 | 7 | ||
1981 | 9 | Manager hierarchy | 8 | Manager hierarchy |
1982 | 10 | 9 | ||
1983 | === modified file 'gdbus/gdbus.h' | |||
1984 | --- gdbus/gdbus.h 2010-01-10 10:46:58 +0000 | |||
1985 | +++ gdbus/gdbus.h 2010-04-28 20:38:30 +0000 | |||
1986 | @@ -2,7 +2,7 @@ | |||
1987 | 2 | * | 2 | * |
1988 | 3 | * D-Bus helper library | 3 | * D-Bus helper library |
1989 | 4 | * | 4 | * |
1991 | 5 | * Copyright (C) 2004-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org> |
1992 | 6 | * | 6 | * |
1993 | 7 | * | 7 | * |
1994 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
1995 | @@ -40,6 +40,9 @@ | |||
1996 | 40 | DBusConnection *g_dbus_setup_bus(DBusBusType type, const char *name, | 40 | DBusConnection *g_dbus_setup_bus(DBusBusType type, const char *name, |
1997 | 41 | DBusError *error); | 41 | DBusError *error); |
1998 | 42 | 42 | ||
1999 | 43 | DBusConnection *g_dbus_setup_private(DBusBusType type, const char *name, | ||
2000 | 44 | DBusError *error); | ||
2001 | 45 | |||
2002 | 43 | gboolean g_dbus_request_name(DBusConnection *connection, const char *name, | 46 | gboolean g_dbus_request_name(DBusConnection *connection, const char *name, |
2003 | 44 | DBusError *error); | 47 | DBusError *error); |
2004 | 45 | 48 | ||
2005 | @@ -88,9 +91,9 @@ | |||
2006 | 88 | 91 | ||
2007 | 89 | gboolean g_dbus_register_interface(DBusConnection *connection, | 92 | gboolean g_dbus_register_interface(DBusConnection *connection, |
2008 | 90 | const char *path, const char *name, | 93 | const char *path, const char *name, |
2012 | 91 | GDBusMethodTable *methods, | 94 | const GDBusMethodTable *methods, |
2013 | 92 | GDBusSignalTable *signals, | 95 | const GDBusSignalTable *signals, |
2014 | 93 | GDBusPropertyTable *properties, | 96 | const GDBusPropertyTable *properties, |
2015 | 94 | void *user_data, | 97 | void *user_data, |
2016 | 95 | GDBusDestroyFunction destroy); | 98 | GDBusDestroyFunction destroy); |
2017 | 96 | gboolean g_dbus_unregister_interface(DBusConnection *connection, | 99 | gboolean g_dbus_unregister_interface(DBusConnection *connection, |
2018 | @@ -125,8 +128,10 @@ | |||
2019 | 125 | GDBusWatchFunction function, | 128 | GDBusWatchFunction function, |
2020 | 126 | void *user_data, GDBusDestroyFunction destroy); | 129 | void *user_data, GDBusDestroyFunction destroy); |
2021 | 127 | guint g_dbus_add_signal_watch(DBusConnection *connection, | 130 | guint g_dbus_add_signal_watch(DBusConnection *connection, |
2024 | 128 | const char *rule, GDBusSignalFunction function, | 131 | const char *sender, const char *path, |
2025 | 129 | void *user_data, GDBusDestroyFunction destroy); | 132 | const char *interface, const char *member, |
2026 | 133 | GDBusSignalFunction function, void *user_data, | ||
2027 | 134 | GDBusDestroyFunction destroy); | ||
2028 | 130 | gboolean g_dbus_remove_watch(DBusConnection *connection, guint tag); | 135 | gboolean g_dbus_remove_watch(DBusConnection *connection, guint tag); |
2029 | 131 | void g_dbus_remove_all_watches(DBusConnection *connection); | 136 | void g_dbus_remove_all_watches(DBusConnection *connection); |
2030 | 132 | 137 | ||
2031 | 133 | 138 | ||
2032 | === modified file 'gdbus/mainloop.c' | |||
2033 | --- gdbus/mainloop.c 2010-01-10 10:46:58 +0000 | |||
2034 | +++ gdbus/mainloop.c 2010-04-28 20:38:30 +0000 | |||
2035 | @@ -2,7 +2,7 @@ | |||
2036 | 2 | * | 2 | * |
2037 | 3 | * D-Bus helper library | 3 | * D-Bus helper library |
2038 | 4 | * | 4 | * |
2040 | 5 | * Copyright (C) 2004-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org> |
2041 | 6 | * | 6 | * |
2042 | 7 | * | 7 | * |
2043 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
2044 | @@ -25,8 +25,6 @@ | |||
2045 | 25 | #include <config.h> | 25 | #include <config.h> |
2046 | 26 | #endif | 26 | #endif |
2047 | 27 | 27 | ||
2048 | 28 | #include <stdint.h> | ||
2049 | 29 | |||
2050 | 30 | #include <glib.h> | 28 | #include <glib.h> |
2051 | 31 | #include <dbus/dbus.h> | 29 | #include <dbus/dbus.h> |
2052 | 32 | 30 | ||
2053 | @@ -42,116 +40,131 @@ | |||
2054 | 42 | #define error(fmt...) | 40 | #define error(fmt...) |
2055 | 43 | #define debug(fmt...) | 41 | #define debug(fmt...) |
2056 | 44 | 42 | ||
2059 | 45 | typedef struct { | 43 | struct timeout_handler { |
2060 | 46 | uint32_t id; | 44 | guint id; |
2061 | 47 | DBusTimeout *timeout; | 45 | DBusTimeout *timeout; |
2063 | 48 | } timeout_handler_t; | 46 | }; |
2064 | 49 | 47 | ||
2065 | 50 | struct watch_info { | 48 | struct watch_info { |
2068 | 51 | guint watch_id; | 49 | guint id; |
2069 | 52 | GIOChannel *io; | 50 | DBusWatch *watch; |
2070 | 53 | DBusConnection *conn; | 51 | DBusConnection *conn; |
2071 | 54 | }; | 52 | }; |
2072 | 55 | 53 | ||
2073 | 56 | struct server_info { | ||
2074 | 57 | guint watch_id; | ||
2075 | 58 | GIOChannel *io; | ||
2076 | 59 | DBusServer *server; | ||
2077 | 60 | }; | ||
2078 | 61 | |||
2079 | 62 | struct disconnect_data { | 54 | struct disconnect_data { |
2081 | 63 | GDBusWatchFunction disconnect_cb; | 55 | GDBusWatchFunction function; |
2082 | 64 | void *user_data; | 56 | void *user_data; |
2083 | 65 | }; | 57 | }; |
2084 | 66 | 58 | ||
2086 | 67 | static DBusHandlerResult disconnect_filter(DBusConnection *conn, | 59 | static gboolean disconnected_signal(DBusConnection *conn, |
2087 | 68 | DBusMessage *msg, void *data) | 60 | DBusMessage *msg, void *data) |
2088 | 69 | { | 61 | { |
2089 | 70 | struct disconnect_data *dc_data = data; | 62 | struct disconnect_data *dc_data = data; |
2090 | 71 | 63 | ||
2099 | 72 | if (dbus_message_is_signal(msg, | 64 | error("Got disconnected from the system message bus"); |
2100 | 73 | DBUS_INTERFACE_LOCAL, "Disconnected") == TRUE) { | 65 | |
2101 | 74 | error("Got disconnected from the system message bus"); | 66 | dc_data->function(conn, dc_data->user_data); |
2102 | 75 | dc_data->disconnect_cb(conn, dc_data->user_data); | 67 | |
2103 | 76 | dbus_connection_unref(conn); | 68 | dbus_connection_unref(conn); |
2104 | 77 | } | 69 | |
2105 | 78 | 70 | return TRUE; | |
2098 | 79 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | ||
2106 | 80 | } | 71 | } |
2107 | 81 | 72 | ||
2109 | 82 | static gboolean message_dispatch_cb(void *data) | 73 | static gboolean message_dispatch(void *data) |
2110 | 83 | { | 74 | { |
2112 | 84 | DBusConnection *connection = data; | 75 | DBusConnection *conn = data; |
2113 | 85 | 76 | ||
2115 | 86 | dbus_connection_ref(connection); | 77 | dbus_connection_ref(conn); |
2116 | 87 | 78 | ||
2117 | 88 | /* Dispatch messages */ | 79 | /* Dispatch messages */ |
2119 | 89 | while (dbus_connection_dispatch(connection) == DBUS_DISPATCH_DATA_REMAINS); | 80 | while (dbus_connection_dispatch(conn) == DBUS_DISPATCH_DATA_REMAINS); |
2120 | 90 | 81 | ||
2122 | 91 | dbus_connection_unref(connection); | 82 | dbus_connection_unref(conn); |
2123 | 92 | 83 | ||
2124 | 93 | return FALSE; | 84 | return FALSE; |
2125 | 94 | } | 85 | } |
2126 | 95 | 86 | ||
2127 | 87 | static inline void queue_dispatch(DBusConnection *conn, | ||
2128 | 88 | DBusDispatchStatus status) | ||
2129 | 89 | { | ||
2130 | 90 | if (status == DBUS_DISPATCH_DATA_REMAINS) | ||
2131 | 91 | g_timeout_add(DISPATCH_TIMEOUT, message_dispatch, conn); | ||
2132 | 92 | } | ||
2133 | 93 | |||
2134 | 96 | static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data) | 94 | static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data) |
2135 | 97 | { | 95 | { |
2139 | 98 | DBusWatch *watch = data; | 96 | struct watch_info *info = data; |
2140 | 99 | struct watch_info *info = dbus_watch_get_data(watch); | 97 | unsigned int flags = 0; |
2141 | 100 | int flags = 0; | 98 | |
2142 | 99 | dbus_connection_ref(info->conn); | ||
2143 | 101 | 100 | ||
2144 | 102 | if (cond & G_IO_IN) flags |= DBUS_WATCH_READABLE; | 101 | if (cond & G_IO_IN) flags |= DBUS_WATCH_READABLE; |
2145 | 103 | if (cond & G_IO_OUT) flags |= DBUS_WATCH_WRITABLE; | 102 | if (cond & G_IO_OUT) flags |= DBUS_WATCH_WRITABLE; |
2146 | 104 | if (cond & G_IO_HUP) flags |= DBUS_WATCH_HANGUP; | 103 | if (cond & G_IO_HUP) flags |= DBUS_WATCH_HANGUP; |
2147 | 105 | if (cond & G_IO_ERR) flags |= DBUS_WATCH_ERROR; | 104 | if (cond & G_IO_ERR) flags |= DBUS_WATCH_ERROR; |
2148 | 106 | 105 | ||
2150 | 107 | dbus_watch_handle(watch, flags); | 106 | dbus_watch_handle(info->watch, flags); |
2151 | 108 | 107 | ||
2154 | 109 | if (dbus_connection_get_dispatch_status(info->conn) == DBUS_DISPATCH_DATA_REMAINS) | 108 | dbus_connection_unref(info->conn); |
2153 | 110 | g_timeout_add(DISPATCH_TIMEOUT, message_dispatch_cb, info->conn); | ||
2155 | 111 | 109 | ||
2156 | 112 | return TRUE; | 110 | return TRUE; |
2157 | 113 | } | 111 | } |
2158 | 114 | 112 | ||
2159 | 113 | static void watch_info_free(void *data) | ||
2160 | 114 | { | ||
2161 | 115 | struct watch_info *info = data; | ||
2162 | 116 | |||
2163 | 117 | if (info->id > 0) { | ||
2164 | 118 | g_source_remove(info->id); | ||
2165 | 119 | info->id = 0; | ||
2166 | 120 | } | ||
2167 | 121 | |||
2168 | 122 | dbus_connection_unref(info->conn); | ||
2169 | 123 | |||
2170 | 124 | g_free(info); | ||
2171 | 125 | } | ||
2172 | 126 | |||
2173 | 115 | static dbus_bool_t add_watch(DBusWatch *watch, void *data) | 127 | static dbus_bool_t add_watch(DBusWatch *watch, void *data) |
2174 | 116 | { | 128 | { |
2175 | 129 | DBusConnection *conn = data; | ||
2176 | 117 | GIOCondition cond = G_IO_HUP | G_IO_ERR; | 130 | GIOCondition cond = G_IO_HUP | G_IO_ERR; |
2178 | 118 | DBusConnection *conn = data; | 131 | GIOChannel *chan; |
2179 | 119 | struct watch_info *info; | 132 | struct watch_info *info; |
2181 | 120 | int fd, flags; | 133 | unsigned int flags; |
2182 | 134 | int fd; | ||
2183 | 121 | 135 | ||
2184 | 122 | if (!dbus_watch_get_enabled(watch)) | 136 | if (!dbus_watch_get_enabled(watch)) |
2185 | 123 | return TRUE; | 137 | return TRUE; |
2186 | 124 | 138 | ||
2188 | 125 | info = g_new(struct watch_info, 1); | 139 | info = g_new0(struct watch_info, 1); |
2189 | 126 | 140 | ||
2190 | 127 | fd = dbus_watch_get_unix_fd(watch); | 141 | fd = dbus_watch_get_unix_fd(watch); |
2192 | 128 | info->io = g_io_channel_unix_new(fd); | 142 | chan = g_io_channel_unix_new(fd); |
2193 | 143 | |||
2194 | 144 | info->watch = watch; | ||
2195 | 129 | info->conn = dbus_connection_ref(conn); | 145 | info->conn = dbus_connection_ref(conn); |
2196 | 130 | 146 | ||
2198 | 131 | dbus_watch_set_data(watch, info, NULL); | 147 | dbus_watch_set_data(watch, info, watch_info_free); |
2199 | 132 | 148 | ||
2200 | 133 | flags = dbus_watch_get_flags(watch); | 149 | flags = dbus_watch_get_flags(watch); |
2201 | 134 | 150 | ||
2202 | 135 | if (flags & DBUS_WATCH_READABLE) cond |= G_IO_IN; | 151 | if (flags & DBUS_WATCH_READABLE) cond |= G_IO_IN; |
2203 | 136 | if (flags & DBUS_WATCH_WRITABLE) cond |= G_IO_OUT; | 152 | if (flags & DBUS_WATCH_WRITABLE) cond |= G_IO_OUT; |
2204 | 137 | 153 | ||
2206 | 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); |
2207 | 155 | |||
2208 | 156 | g_io_channel_unref(chan); | ||
2209 | 139 | 157 | ||
2210 | 140 | return TRUE; | 158 | return TRUE; |
2211 | 141 | } | 159 | } |
2212 | 142 | 160 | ||
2213 | 143 | static void remove_watch(DBusWatch *watch, void *data) | 161 | static void remove_watch(DBusWatch *watch, void *data) |
2214 | 144 | { | 162 | { |
2216 | 145 | struct watch_info *info = dbus_watch_get_data(watch); | 163 | if (dbus_watch_get_enabled(watch)) |
2217 | 164 | return; | ||
2218 | 146 | 165 | ||
2219 | 166 | /* will trigger watch_info_free() */ | ||
2220 | 147 | dbus_watch_set_data(watch, NULL, NULL); | 167 | dbus_watch_set_data(watch, NULL, NULL); |
2221 | 148 | |||
2222 | 149 | if (info) { | ||
2223 | 150 | g_source_remove(info->watch_id); | ||
2224 | 151 | g_io_channel_unref(info->io); | ||
2225 | 152 | dbus_connection_unref(info->conn); | ||
2226 | 153 | g_free(info); | ||
2227 | 154 | } | ||
2228 | 155 | } | 168 | } |
2229 | 156 | 169 | ||
2230 | 157 | static void watch_toggled(DBusWatch *watch, void *data) | 170 | static void watch_toggled(DBusWatch *watch, void *data) |
2231 | @@ -166,10 +179,12 @@ | |||
2232 | 166 | 179 | ||
2233 | 167 | static gboolean timeout_handler_dispatch(gpointer data) | 180 | static gboolean timeout_handler_dispatch(gpointer data) |
2234 | 168 | { | 181 | { |
2236 | 169 | timeout_handler_t *handler = data; | 182 | struct timeout_handler *handler = data; |
2237 | 183 | |||
2238 | 184 | handler->id = 0; | ||
2239 | 170 | 185 | ||
2240 | 171 | /* if not enabled should not be polled by the main loop */ | 186 | /* if not enabled should not be polled by the main loop */ |
2242 | 172 | if (dbus_timeout_get_enabled(handler->timeout) != TRUE) | 187 | if (!dbus_timeout_get_enabled(handler->timeout)) |
2243 | 173 | return FALSE; | 188 | return FALSE; |
2244 | 174 | 189 | ||
2245 | 175 | dbus_timeout_handle(handler->timeout); | 190 | dbus_timeout_handle(handler->timeout); |
2246 | @@ -179,9 +194,7 @@ | |||
2247 | 179 | 194 | ||
2248 | 180 | static void timeout_handler_free(void *data) | 195 | static void timeout_handler_free(void *data) |
2249 | 181 | { | 196 | { |
2253 | 182 | timeout_handler_t *handler = data; | 197 | struct timeout_handler *handler = data; |
2251 | 183 | if (!handler) | ||
2252 | 184 | return; | ||
2254 | 185 | 198 | ||
2255 | 186 | if (handler->id > 0) { | 199 | if (handler->id > 0) { |
2256 | 187 | g_source_remove(handler->id); | 200 | g_source_remove(handler->id); |
2257 | @@ -193,35 +206,31 @@ | |||
2258 | 193 | 206 | ||
2259 | 194 | static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data) | 207 | static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data) |
2260 | 195 | { | 208 | { |
2262 | 196 | timeout_handler_t *handler; | 209 | int interval = dbus_timeout_get_interval(timeout); |
2263 | 210 | struct timeout_handler *handler; | ||
2264 | 197 | 211 | ||
2265 | 198 | if (!dbus_timeout_get_enabled(timeout)) | 212 | if (!dbus_timeout_get_enabled(timeout)) |
2266 | 199 | return TRUE; | 213 | return TRUE; |
2267 | 200 | 214 | ||
2269 | 201 | handler = g_new0(timeout_handler_t, 1); | 215 | handler = g_new0(struct timeout_handler, 1); |
2270 | 202 | 216 | ||
2271 | 203 | handler->timeout = timeout; | 217 | handler->timeout = timeout; |
2272 | 204 | handler->id = g_timeout_add(dbus_timeout_get_interval(timeout), | ||
2273 | 205 | timeout_handler_dispatch, handler); | ||
2274 | 206 | 218 | ||
2275 | 207 | dbus_timeout_set_data(timeout, handler, timeout_handler_free); | 219 | dbus_timeout_set_data(timeout, handler, timeout_handler_free); |
2276 | 208 | 220 | ||
2277 | 221 | handler->id = g_timeout_add(interval, timeout_handler_dispatch, | ||
2278 | 222 | handler); | ||
2279 | 223 | |||
2280 | 209 | return TRUE; | 224 | return TRUE; |
2281 | 210 | } | 225 | } |
2282 | 211 | 226 | ||
2283 | 212 | static void remove_timeout(DBusTimeout *timeout, void *data) | 227 | static void remove_timeout(DBusTimeout *timeout, void *data) |
2284 | 213 | { | 228 | { |
2296 | 214 | timeout_handler_t *handler; | 229 | if (dbus_timeout_get_enabled(timeout)) |
2297 | 215 | 230 | return; | |
2298 | 216 | handler = dbus_timeout_get_data(timeout); | 231 | |
2299 | 217 | 232 | /* will trigger timeout_handler_free() */ | |
2300 | 218 | if (!handler) | 233 | dbus_timeout_set_data(timeout, NULL, NULL); |
2290 | 219 | return; | ||
2291 | 220 | |||
2292 | 221 | if (handler->id > 0) { | ||
2293 | 222 | g_source_remove(handler->id); | ||
2294 | 223 | handler->id = 0; | ||
2295 | 224 | } | ||
2301 | 225 | } | 234 | } |
2302 | 226 | 235 | ||
2303 | 227 | static void timeout_toggled(DBusTimeout *timeout, void *data) | 236 | static void timeout_toggled(DBusTimeout *timeout, void *data) |
2304 | @@ -232,63 +241,95 @@ | |||
2305 | 232 | remove_timeout(timeout, data); | 241 | remove_timeout(timeout, data); |
2306 | 233 | } | 242 | } |
2307 | 234 | 243 | ||
2310 | 235 | static void dispatch_status_cb(DBusConnection *conn, | 244 | static void dispatch_status(DBusConnection *conn, |
2311 | 236 | DBusDispatchStatus new_status, void *data) | 245 | DBusDispatchStatus status, void *data) |
2312 | 237 | { | 246 | { |
2313 | 238 | if (!dbus_connection_get_is_connected(conn)) | 247 | if (!dbus_connection_get_is_connected(conn)) |
2314 | 239 | return; | 248 | return; |
2315 | 240 | 249 | ||
2318 | 241 | if (new_status == DBUS_DISPATCH_DATA_REMAINS) | 250 | queue_dispatch(conn, status); |
2317 | 242 | g_timeout_add(DISPATCH_TIMEOUT, message_dispatch_cb, data); | ||
2319 | 243 | } | 251 | } |
2320 | 244 | 252 | ||
2322 | 245 | static void setup_dbus_with_main_loop(DBusConnection *conn) | 253 | static inline void setup_dbus_with_main_loop(DBusConnection *conn) |
2323 | 246 | { | 254 | { |
2324 | 247 | dbus_connection_set_watch_functions(conn, add_watch, remove_watch, | 255 | dbus_connection_set_watch_functions(conn, add_watch, remove_watch, |
2325 | 248 | watch_toggled, conn, NULL); | 256 | watch_toggled, conn, NULL); |
2326 | 249 | 257 | ||
2327 | 250 | dbus_connection_set_timeout_functions(conn, add_timeout, remove_timeout, | 258 | dbus_connection_set_timeout_functions(conn, add_timeout, remove_timeout, |
2329 | 251 | timeout_toggled, conn, NULL); | 259 | timeout_toggled, NULL, NULL); |
2330 | 252 | 260 | ||
2333 | 253 | dbus_connection_set_dispatch_status_function(conn, dispatch_status_cb, | 261 | dbus_connection_set_dispatch_status_function(conn, dispatch_status, |
2334 | 254 | conn, NULL); | 262 | NULL, NULL); |
2335 | 255 | } | 263 | } |
2336 | 256 | 264 | ||
2339 | 257 | DBusConnection *g_dbus_setup_bus(DBusBusType type, const char *name, | 265 | static gboolean setup_bus(DBusConnection *conn, const char *name, |
2340 | 258 | DBusError *error) | 266 | DBusError *error) |
2341 | 259 | { | 267 | { |
2353 | 260 | DBusConnection *conn; | 268 | gboolean result; |
2354 | 261 | 269 | DBusDispatchStatus status; | |
2344 | 262 | conn = dbus_bus_get(type, error); | ||
2345 | 263 | |||
2346 | 264 | if (error != NULL) { | ||
2347 | 265 | if (dbus_error_is_set(error) == TRUE) | ||
2348 | 266 | return NULL; | ||
2349 | 267 | } | ||
2350 | 268 | |||
2351 | 269 | if (conn == NULL) | ||
2352 | 270 | return NULL; | ||
2355 | 271 | 270 | ||
2356 | 272 | if (name != NULL) { | 271 | if (name != NULL) { |
2363 | 273 | if (dbus_bus_request_name(conn, name, | 272 | result = g_dbus_request_name(conn, name, error); |
2358 | 274 | DBUS_NAME_FLAG_DO_NOT_QUEUE, error) != | ||
2359 | 275 | DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER ) { | ||
2360 | 276 | dbus_connection_unref(conn); | ||
2361 | 277 | return NULL; | ||
2362 | 278 | } | ||
2364 | 279 | 273 | ||
2365 | 280 | if (error != NULL) { | 274 | if (error != NULL) { |
2370 | 281 | if (dbus_error_is_set(error) == TRUE) { | 275 | if (dbus_error_is_set(error) == TRUE) |
2371 | 282 | dbus_connection_unref(conn); | 276 | return FALSE; |
2368 | 283 | return NULL; | ||
2369 | 284 | } | ||
2372 | 285 | } | 277 | } |
2373 | 278 | |||
2374 | 279 | if (result == FALSE) | ||
2375 | 280 | return FALSE; | ||
2376 | 286 | } | 281 | } |
2377 | 287 | 282 | ||
2378 | 288 | setup_dbus_with_main_loop(conn); | 283 | setup_dbus_with_main_loop(conn); |
2379 | 289 | 284 | ||
2382 | 290 | if (dbus_connection_get_dispatch_status(conn) == DBUS_DISPATCH_DATA_REMAINS) | 285 | status = dbus_connection_get_dispatch_status(conn); |
2383 | 291 | g_timeout_add(DISPATCH_TIMEOUT, message_dispatch_cb, conn); | 286 | queue_dispatch(conn, status); |
2384 | 287 | |||
2385 | 288 | return TRUE; | ||
2386 | 289 | } | ||
2387 | 290 | |||
2388 | 291 | DBusConnection *g_dbus_setup_bus(DBusBusType type, const char *name, | ||
2389 | 292 | DBusError *error) | ||
2390 | 293 | { | ||
2391 | 294 | DBusConnection *conn; | ||
2392 | 295 | |||
2393 | 296 | conn = dbus_bus_get(type, error); | ||
2394 | 297 | |||
2395 | 298 | if (error != NULL) { | ||
2396 | 299 | if (dbus_error_is_set(error) == TRUE) | ||
2397 | 300 | return NULL; | ||
2398 | 301 | } | ||
2399 | 302 | |||
2400 | 303 | if (conn == NULL) | ||
2401 | 304 | return NULL; | ||
2402 | 305 | |||
2403 | 306 | if (setup_bus(conn, name, error) == FALSE) { | ||
2404 | 307 | dbus_connection_unref(conn); | ||
2405 | 308 | return NULL; | ||
2406 | 309 | } | ||
2407 | 310 | |||
2408 | 311 | return conn; | ||
2409 | 312 | } | ||
2410 | 313 | |||
2411 | 314 | DBusConnection *g_dbus_setup_private(DBusBusType type, const char *name, | ||
2412 | 315 | DBusError *error) | ||
2413 | 316 | { | ||
2414 | 317 | DBusConnection *conn; | ||
2415 | 318 | |||
2416 | 319 | conn = dbus_bus_get_private(type, error); | ||
2417 | 320 | |||
2418 | 321 | if (error != NULL) { | ||
2419 | 322 | if (dbus_error_is_set(error) == TRUE) | ||
2420 | 323 | return NULL; | ||
2421 | 324 | } | ||
2422 | 325 | |||
2423 | 326 | if (conn == NULL) | ||
2424 | 327 | return NULL; | ||
2425 | 328 | |||
2426 | 329 | if (setup_bus(conn, name, error) == FALSE) { | ||
2427 | 330 | dbus_connection_unref(conn); | ||
2428 | 331 | return NULL; | ||
2429 | 332 | } | ||
2430 | 292 | 333 | ||
2431 | 293 | return conn; | 334 | return conn; |
2432 | 294 | } | 335 | } |
2433 | @@ -296,6 +337,23 @@ | |||
2434 | 296 | gboolean g_dbus_request_name(DBusConnection *connection, const char *name, | 337 | gboolean g_dbus_request_name(DBusConnection *connection, const char *name, |
2435 | 297 | DBusError *error) | 338 | DBusError *error) |
2436 | 298 | { | 339 | { |
2437 | 340 | int result; | ||
2438 | 341 | |||
2439 | 342 | result = dbus_bus_request_name(connection, name, | ||
2440 | 343 | DBUS_NAME_FLAG_DO_NOT_QUEUE, error); | ||
2441 | 344 | |||
2442 | 345 | if (error != NULL) { | ||
2443 | 346 | if (dbus_error_is_set(error) == TRUE) | ||
2444 | 347 | return FALSE; | ||
2445 | 348 | } | ||
2446 | 349 | |||
2447 | 350 | if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { | ||
2448 | 351 | if (error != NULL) | ||
2449 | 352 | dbus_set_error(error, name, "Name already in use"); | ||
2450 | 353 | |||
2451 | 354 | return FALSE; | ||
2452 | 355 | } | ||
2453 | 356 | |||
2454 | 299 | return TRUE; | 357 | return TRUE; |
2455 | 300 | } | 358 | } |
2456 | 301 | 359 | ||
2457 | @@ -305,16 +363,17 @@ | |||
2458 | 305 | { | 363 | { |
2459 | 306 | struct disconnect_data *dc_data; | 364 | struct disconnect_data *dc_data; |
2460 | 307 | 365 | ||
2462 | 308 | dc_data = g_new(struct disconnect_data, 1); | 366 | dc_data = g_new0(struct disconnect_data, 1); |
2463 | 309 | 367 | ||
2465 | 310 | dc_data->disconnect_cb = function; | 368 | dc_data->function = function; |
2466 | 311 | dc_data->user_data = user_data; | 369 | dc_data->user_data = user_data; |
2467 | 312 | 370 | ||
2468 | 313 | dbus_connection_set_exit_on_disconnect(connection, FALSE); | 371 | dbus_connection_set_exit_on_disconnect(connection, FALSE); |
2469 | 314 | 372 | ||
2473 | 315 | if (dbus_connection_add_filter(connection, disconnect_filter, | 373 | if (g_dbus_add_signal_watch(connection, NULL, NULL, |
2474 | 316 | dc_data, g_free) == FALSE) { | 374 | DBUS_INTERFACE_LOCAL, "Disconnected", |
2475 | 317 | error("Can't add D-Bus disconnect filter"); | 375 | disconnected_signal, dc_data, g_free) == 0) { |
2476 | 376 | error("Failed to add watch for D-Bus Disconnected signal"); | ||
2477 | 318 | g_free(dc_data); | 377 | g_free(dc_data); |
2478 | 319 | return FALSE; | 378 | return FALSE; |
2479 | 320 | } | 379 | } |
2480 | 321 | 380 | ||
2481 | === modified file 'gdbus/object.c' | |||
2482 | --- gdbus/object.c 2010-01-10 10:46:58 +0000 | |||
2483 | +++ gdbus/object.c 2010-04-28 20:38:30 +0000 | |||
2484 | @@ -2,7 +2,7 @@ | |||
2485 | 2 | * | 2 | * |
2486 | 3 | * D-Bus helper library | 3 | * D-Bus helper library |
2487 | 4 | * | 4 | * |
2489 | 5 | * Copyright (C) 2004-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org> |
2490 | 6 | * | 6 | * |
2491 | 7 | * | 7 | * |
2492 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
2493 | @@ -45,9 +45,9 @@ | |||
2494 | 45 | 45 | ||
2495 | 46 | struct interface_data { | 46 | struct interface_data { |
2496 | 47 | char *name; | 47 | char *name; |
2500 | 48 | GDBusMethodTable *methods; | 48 | const GDBusMethodTable *methods; |
2501 | 49 | GDBusSignalTable *signals; | 49 | const GDBusSignalTable *signals; |
2502 | 50 | GDBusPropertyTable *properties; | 50 | const GDBusPropertyTable *properties; |
2503 | 51 | void *user_data; | 51 | void *user_data; |
2504 | 52 | GDBusDestroyFunction destroy; | 52 | GDBusDestroyFunction destroy; |
2505 | 53 | }; | 53 | }; |
2506 | @@ -114,8 +114,8 @@ | |||
2507 | 114 | 114 | ||
2508 | 115 | static void generate_interface_xml(GString *gstr, struct interface_data *iface) | 115 | static void generate_interface_xml(GString *gstr, struct interface_data *iface) |
2509 | 116 | { | 116 | { |
2512 | 117 | GDBusMethodTable *method; | 117 | const GDBusMethodTable *method; |
2513 | 118 | GDBusSignalTable *signal; | 118 | const GDBusSignalTable *signal; |
2514 | 119 | 119 | ||
2515 | 120 | for (method = iface->methods; method && method->name; method++) { | 120 | for (method = iface->methods; method && method->name; method++) { |
2516 | 121 | if (!strlen(method->signature) && !strlen(method->reply)) | 121 | if (!strlen(method->signature) && !strlen(method->reply)) |
2517 | @@ -238,7 +238,7 @@ | |||
2518 | 238 | { | 238 | { |
2519 | 239 | struct generic_data *data = user_data; | 239 | struct generic_data *data = user_data; |
2520 | 240 | struct interface_data *iface; | 240 | struct interface_data *iface; |
2522 | 241 | GDBusMethodTable *method; | 241 | const GDBusMethodTable *method; |
2523 | 242 | const char *interface; | 242 | const char *interface; |
2524 | 243 | 243 | ||
2525 | 244 | interface = dbus_message_get_interface(message); | 244 | interface = dbus_message_get_interface(message); |
2526 | @@ -327,9 +327,9 @@ | |||
2527 | 327 | }; | 327 | }; |
2528 | 328 | 328 | ||
2529 | 329 | static void add_interface(struct generic_data *data, const char *name, | 329 | static void add_interface(struct generic_data *data, const char *name, |
2533 | 330 | GDBusMethodTable *methods, | 330 | const GDBusMethodTable *methods, |
2534 | 331 | GDBusSignalTable *signals, | 331 | const GDBusSignalTable *signals, |
2535 | 332 | GDBusPropertyTable *properties, | 332 | const GDBusPropertyTable *properties, |
2536 | 333 | void *user_data, | 333 | void *user_data, |
2537 | 334 | GDBusDestroyFunction destroy) | 334 | GDBusDestroyFunction destroy) |
2538 | 335 | { | 335 | { |
2539 | @@ -428,7 +428,7 @@ | |||
2540 | 428 | { | 428 | { |
2541 | 429 | struct generic_data *data = NULL; | 429 | struct generic_data *data = NULL; |
2542 | 430 | struct interface_data *iface; | 430 | struct interface_data *iface; |
2544 | 431 | GDBusSignalTable *signal; | 431 | const GDBusSignalTable *signal; |
2545 | 432 | 432 | ||
2546 | 433 | *args = NULL; | 433 | *args = NULL; |
2547 | 434 | if (!dbus_connection_get_object_path_data(conn, path, | 434 | if (!dbus_connection_get_object_path_data(conn, path, |
2548 | @@ -502,9 +502,9 @@ | |||
2549 | 502 | 502 | ||
2550 | 503 | gboolean g_dbus_register_interface(DBusConnection *connection, | 503 | gboolean g_dbus_register_interface(DBusConnection *connection, |
2551 | 504 | const char *path, const char *name, | 504 | const char *path, const char *name, |
2555 | 505 | GDBusMethodTable *methods, | 505 | const GDBusMethodTable *methods, |
2556 | 506 | GDBusSignalTable *signals, | 506 | const GDBusSignalTable *signals, |
2557 | 507 | GDBusPropertyTable *properties, | 507 | const GDBusPropertyTable *properties, |
2558 | 508 | void *user_data, | 508 | void *user_data, |
2559 | 509 | GDBusDestroyFunction destroy) | 509 | GDBusDestroyFunction destroy) |
2560 | 510 | { | 510 | { |
2561 | 511 | 511 | ||
2562 | === modified file 'gdbus/watch.c' | |||
2563 | --- gdbus/watch.c 2010-01-10 10:46:58 +0000 | |||
2564 | +++ gdbus/watch.c 2010-04-28 20:38:30 +0000 | |||
2565 | @@ -2,7 +2,7 @@ | |||
2566 | 2 | * | 2 | * |
2567 | 3 | * D-Bus helper library | 3 | * D-Bus helper library |
2568 | 4 | * | 4 | * |
2570 | 5 | * Copyright (C) 2004-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org> |
2571 | 6 | * | 6 | * |
2572 | 7 | * | 7 | * |
2573 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
2574 | @@ -37,212 +37,335 @@ | |||
2575 | 37 | #define error(fmt...) | 37 | #define error(fmt...) |
2576 | 38 | #define debug(fmt...) | 38 | #define debug(fmt...) |
2577 | 39 | 39 | ||
2579 | 40 | static DBusHandlerResult name_exit_filter(DBusConnection *connection, | 40 | static DBusHandlerResult message_filter(DBusConnection *connection, |
2580 | 41 | DBusMessage *message, void *user_data); | 41 | DBusMessage *message, void *user_data); |
2581 | 42 | 42 | ||
2582 | 43 | static guint listener_id = 0; | 43 | static guint listener_id = 0; |
2584 | 44 | static GSList *name_listeners = NULL; | 44 | static GSList *listeners = NULL; |
2585 | 45 | 45 | ||
2587 | 46 | struct name_callback { | 46 | struct filter_callback { |
2588 | 47 | GDBusWatchFunction conn_func; | 47 | GDBusWatchFunction conn_func; |
2589 | 48 | GDBusWatchFunction disc_func; | 48 | GDBusWatchFunction disc_func; |
2590 | 49 | GDBusSignalFunction signal_func; | ||
2591 | 50 | GDBusDestroyFunction destroy_func; | ||
2592 | 49 | void *user_data; | 51 | void *user_data; |
2593 | 50 | guint id; | 52 | guint id; |
2594 | 51 | }; | 53 | }; |
2595 | 52 | 54 | ||
2597 | 53 | struct name_data { | 55 | struct filter_data { |
2598 | 54 | DBusConnection *connection; | 56 | DBusConnection *connection; |
2600 | 55 | char *name; | 57 | DBusHandleMessageFunction handle_func; |
2601 | 58 | char *sender; | ||
2602 | 59 | char *path; | ||
2603 | 60 | char *interface; | ||
2604 | 61 | char *member; | ||
2605 | 62 | char *argument; | ||
2606 | 56 | GSList *callbacks; | 63 | GSList *callbacks; |
2607 | 57 | GSList *processed; | 64 | GSList *processed; |
2608 | 58 | gboolean lock; | 65 | gboolean lock; |
2609 | 66 | gboolean registered; | ||
2610 | 59 | }; | 67 | }; |
2611 | 60 | 68 | ||
2614 | 61 | static struct name_data *name_data_find(DBusConnection *connection, | 69 | static struct filter_data *filter_data_find(DBusConnection *connection, |
2615 | 62 | const char *name) | 70 | const char *sender, |
2616 | 71 | const char *path, | ||
2617 | 72 | const char *interface, | ||
2618 | 73 | const char *member, | ||
2619 | 74 | const char *argument) | ||
2620 | 63 | { | 75 | { |
2621 | 64 | GSList *current; | 76 | GSList *current; |
2622 | 65 | 77 | ||
2624 | 66 | for (current = name_listeners; | 78 | for (current = listeners; |
2625 | 67 | current != NULL; current = current->next) { | 79 | current != NULL; current = current->next) { |
2627 | 68 | struct name_data *data = current->data; | 80 | struct filter_data *data = current->data; |
2628 | 69 | 81 | ||
2629 | 70 | if (connection != data->connection) | 82 | if (connection != data->connection) |
2630 | 71 | continue; | 83 | continue; |
2631 | 72 | 84 | ||
2653 | 73 | if (name == NULL || g_str_equal(name, data->name)) | 85 | if (sender && data->sender && |
2654 | 74 | return data; | 86 | g_str_equal(sender, data->sender) == FALSE) |
2655 | 75 | } | 87 | continue; |
2656 | 76 | 88 | ||
2657 | 77 | return NULL; | 89 | if (path && data->path && |
2658 | 78 | } | 90 | g_str_equal(path, data->path) == FALSE) |
2659 | 79 | 91 | continue; | |
2660 | 80 | static struct name_callback *name_callback_find(GSList *callbacks, guint id) | 92 | |
2661 | 81 | { | 93 | if (interface && data->interface && |
2662 | 82 | GSList *current; | 94 | g_str_equal(interface, data->interface) == FALSE) |
2663 | 83 | 95 | continue; | |
2664 | 84 | for (current = callbacks; current != NULL; current = current->next) { | 96 | |
2665 | 85 | struct name_callback *cb = current->data; | 97 | if (member && data->member && |
2666 | 86 | if (cb->id == id) | 98 | g_str_equal(member, data->member) == FALSE) |
2667 | 87 | return cb; | 99 | continue; |
2668 | 88 | } | 100 | |
2669 | 89 | 101 | if (argument && data->argument && | |
2670 | 90 | return NULL; | 102 | g_str_equal(argument, data->argument) == FALSE) |
2671 | 91 | } | 103 | continue; |
2672 | 92 | 104 | ||
2673 | 93 | static void name_data_call_and_free(struct name_data *data) | 105 | return data; |
2674 | 106 | } | ||
2675 | 107 | |||
2676 | 108 | return NULL; | ||
2677 | 109 | } | ||
2678 | 110 | |||
2679 | 111 | static void format_rule(struct filter_data *data, char *rule, size_t size) | ||
2680 | 112 | { | ||
2681 | 113 | int offset; | ||
2682 | 114 | |||
2683 | 115 | offset = snprintf(rule, size, "type='signal'"); | ||
2684 | 116 | |||
2685 | 117 | if (data->sender) | ||
2686 | 118 | offset += snprintf(rule + offset, size - offset, | ||
2687 | 119 | ",sender='%s'", data->sender); | ||
2688 | 120 | if (data->path) | ||
2689 | 121 | offset += snprintf(rule + offset, size - offset, | ||
2690 | 122 | ",path='%s'", data->path); | ||
2691 | 123 | if (data->interface) | ||
2692 | 124 | offset += snprintf(rule + offset, size - offset, | ||
2693 | 125 | ",interface='%s'", data->interface); | ||
2694 | 126 | if (data->member) | ||
2695 | 127 | offset += snprintf(rule + offset, size - offset, | ||
2696 | 128 | ",member='%s'", data->member); | ||
2697 | 129 | if (data->argument) | ||
2698 | 130 | snprintf(rule + offset, size - offset, | ||
2699 | 131 | ",arg0='%s'", data->argument); | ||
2700 | 132 | } | ||
2701 | 133 | |||
2702 | 134 | static gboolean add_match(struct filter_data *data, | ||
2703 | 135 | DBusHandleMessageFunction filter) | ||
2704 | 136 | { | ||
2705 | 137 | DBusError err; | ||
2706 | 138 | char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; | ||
2707 | 139 | |||
2708 | 140 | format_rule(data, rule, sizeof(rule)); | ||
2709 | 141 | dbus_error_init(&err); | ||
2710 | 142 | |||
2711 | 143 | dbus_bus_add_match(data->connection, rule, &err); | ||
2712 | 144 | if (dbus_error_is_set(&err)) { | ||
2713 | 145 | error("Adding match rule \"%s\" failed: %s", rule, | ||
2714 | 146 | err.message); | ||
2715 | 147 | dbus_error_free(&err); | ||
2716 | 148 | return FALSE; | ||
2717 | 149 | } | ||
2718 | 150 | |||
2719 | 151 | data->handle_func = filter; | ||
2720 | 152 | data->registered = TRUE; | ||
2721 | 153 | |||
2722 | 154 | return TRUE; | ||
2723 | 155 | } | ||
2724 | 156 | |||
2725 | 157 | static gboolean remove_match(struct filter_data *data) | ||
2726 | 158 | { | ||
2727 | 159 | DBusError err; | ||
2728 | 160 | char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; | ||
2729 | 161 | |||
2730 | 162 | format_rule(data, rule, sizeof(rule)); | ||
2731 | 163 | |||
2732 | 164 | dbus_error_init(&err); | ||
2733 | 165 | |||
2734 | 166 | dbus_bus_remove_match(data->connection, rule, &err); | ||
2735 | 167 | if (dbus_error_is_set(&err)) { | ||
2736 | 168 | error("Removing owner match rule for %s failed: %s", | ||
2737 | 169 | rule, err.message); | ||
2738 | 170 | dbus_error_free(&err); | ||
2739 | 171 | return FALSE; | ||
2740 | 172 | } | ||
2741 | 173 | |||
2742 | 174 | return TRUE; | ||
2743 | 175 | } | ||
2744 | 176 | |||
2745 | 177 | static struct filter_data *filter_data_get(DBusConnection *connection, | ||
2746 | 178 | DBusHandleMessageFunction filter, | ||
2747 | 179 | const char *sender, | ||
2748 | 180 | const char *path, | ||
2749 | 181 | const char *interface, | ||
2750 | 182 | const char *member, | ||
2751 | 183 | const char *argument) | ||
2752 | 184 | { | ||
2753 | 185 | struct filter_data *data; | ||
2754 | 186 | |||
2755 | 187 | if (!filter_data_find(connection, NULL, NULL, NULL, NULL, NULL)) { | ||
2756 | 188 | if (!dbus_connection_add_filter(connection, | ||
2757 | 189 | message_filter, NULL, NULL)) { | ||
2758 | 190 | error("dbus_connection_add_filter() failed"); | ||
2759 | 191 | return NULL; | ||
2760 | 192 | } | ||
2761 | 193 | } | ||
2762 | 194 | |||
2763 | 195 | data = filter_data_find(connection, sender, path, interface, member, | ||
2764 | 196 | argument); | ||
2765 | 197 | if (data) | ||
2766 | 198 | return data; | ||
2767 | 199 | |||
2768 | 200 | data = g_new0(struct filter_data, 1); | ||
2769 | 201 | |||
2770 | 202 | data->connection = dbus_connection_ref(connection); | ||
2771 | 203 | data->sender = g_strdup(sender); | ||
2772 | 204 | data->path = g_strdup(path); | ||
2773 | 205 | data->interface = g_strdup(interface); | ||
2774 | 206 | data->member = g_strdup(member); | ||
2775 | 207 | data->argument = g_strdup(argument); | ||
2776 | 208 | |||
2777 | 209 | if (!add_match(data, filter)) { | ||
2778 | 210 | g_free(data); | ||
2779 | 211 | return NULL; | ||
2780 | 212 | } | ||
2781 | 213 | |||
2782 | 214 | listeners = g_slist_append(listeners, data); | ||
2783 | 215 | |||
2784 | 216 | return data; | ||
2785 | 217 | } | ||
2786 | 218 | |||
2787 | 219 | static struct filter_callback *filter_data_find_callback( | ||
2788 | 220 | struct filter_data *data, | ||
2789 | 221 | guint id) | ||
2790 | 222 | { | ||
2791 | 223 | GSList *l; | ||
2792 | 224 | |||
2793 | 225 | for (l = data->callbacks; l; l = l->next) { | ||
2794 | 226 | struct filter_callback *cb = l->data; | ||
2795 | 227 | if (cb->id == id) | ||
2796 | 228 | return cb; | ||
2797 | 229 | } | ||
2798 | 230 | for (l = data->processed; l; l = l->next) { | ||
2799 | 231 | struct filter_callback *cb = l->data; | ||
2800 | 232 | if (cb->id == id) | ||
2801 | 233 | return cb; | ||
2802 | 234 | } | ||
2803 | 235 | |||
2804 | 236 | return NULL; | ||
2805 | 237 | } | ||
2806 | 238 | |||
2807 | 239 | static void filter_data_free(struct filter_data *data) | ||
2808 | 240 | { | ||
2809 | 241 | GSList *l; | ||
2810 | 242 | |||
2811 | 243 | for (l = data->callbacks; l != NULL; l = l->next) | ||
2812 | 244 | g_free(l->data); | ||
2813 | 245 | |||
2814 | 246 | g_slist_free(data->callbacks); | ||
2815 | 247 | g_free(data->sender); | ||
2816 | 248 | g_free(data->path); | ||
2817 | 249 | g_free(data->interface); | ||
2818 | 250 | g_free(data->member); | ||
2819 | 251 | g_free(data->argument); | ||
2820 | 252 | dbus_connection_unref(data->connection); | ||
2821 | 253 | g_free(data); | ||
2822 | 254 | } | ||
2823 | 255 | |||
2824 | 256 | static void filter_data_call_and_free(struct filter_data *data) | ||
2825 | 94 | { | 257 | { |
2826 | 95 | GSList *l; | 258 | GSList *l; |
2827 | 96 | 259 | ||
2828 | 97 | for (l = data->callbacks; l != NULL; l = l->next) { | 260 | for (l = data->callbacks; l != NULL; l = l->next) { |
2830 | 98 | struct name_callback *cb = l->data; | 261 | struct filter_callback *cb = l->data; |
2831 | 99 | if (cb->disc_func) | 262 | if (cb->disc_func) |
2832 | 100 | cb->disc_func(data->connection, cb->user_data); | 263 | cb->disc_func(data->connection, cb->user_data); |
2833 | 264 | if (cb->destroy_func) | ||
2834 | 265 | cb->destroy_func(cb->user_data); | ||
2835 | 101 | g_free(cb); | 266 | g_free(cb); |
2836 | 102 | } | 267 | } |
2837 | 103 | 268 | ||
2856 | 104 | g_slist_free(data->callbacks); | 269 | filter_data_free(data); |
2857 | 105 | g_free(data->name); | 270 | } |
2858 | 106 | g_free(data); | 271 | |
2859 | 107 | } | 272 | static struct filter_callback *filter_data_add_callback( |
2860 | 108 | 273 | struct filter_data *data, | |
2843 | 109 | static void name_data_free(struct name_data *data) | ||
2844 | 110 | { | ||
2845 | 111 | GSList *l; | ||
2846 | 112 | |||
2847 | 113 | for (l = data->callbacks; l != NULL; l = l->next) | ||
2848 | 114 | g_free(l->data); | ||
2849 | 115 | |||
2850 | 116 | g_slist_free(data->callbacks); | ||
2851 | 117 | g_free(data->name); | ||
2852 | 118 | g_free(data); | ||
2853 | 119 | } | ||
2854 | 120 | |||
2855 | 121 | static int name_data_add(DBusConnection *connection, const char *name, | ||
2861 | 122 | GDBusWatchFunction connect, | 274 | GDBusWatchFunction connect, |
2862 | 123 | GDBusWatchFunction disconnect, | 275 | GDBusWatchFunction disconnect, |
2864 | 124 | void *user_data, guint id) | 276 | GDBusSignalFunction signal, |
2865 | 277 | GDBusDestroyFunction destroy, | ||
2866 | 278 | void *user_data) | ||
2867 | 125 | { | 279 | { |
2871 | 126 | int first = 1; | 280 | struct filter_callback *cb = NULL; |
2869 | 127 | struct name_data *data = NULL; | ||
2870 | 128 | struct name_callback *cb = NULL; | ||
2872 | 129 | 281 | ||
2874 | 130 | cb = g_new(struct name_callback, 1); | 282 | cb = g_new(struct filter_callback, 1); |
2875 | 131 | 283 | ||
2876 | 132 | cb->conn_func = connect; | 284 | cb->conn_func = connect; |
2877 | 133 | cb->disc_func = disconnect; | 285 | cb->disc_func = disconnect; |
2878 | 286 | cb->signal_func = signal; | ||
2879 | 287 | cb->destroy_func = destroy; | ||
2880 | 134 | cb->user_data = user_data; | 288 | cb->user_data = user_data; |
2897 | 135 | cb->id = id; | 289 | cb->id = ++listener_id; |
2898 | 136 | 290 | ||
2883 | 137 | data = name_data_find(connection, name); | ||
2884 | 138 | if (data) { | ||
2885 | 139 | first = 0; | ||
2886 | 140 | goto done; | ||
2887 | 141 | } | ||
2888 | 142 | |||
2889 | 143 | data = g_new0(struct name_data, 1); | ||
2890 | 144 | |||
2891 | 145 | data->connection = connection; | ||
2892 | 146 | data->name = g_strdup(name); | ||
2893 | 147 | |||
2894 | 148 | name_listeners = g_slist_append(name_listeners, data); | ||
2895 | 149 | |||
2896 | 150 | done: | ||
2899 | 151 | if (data->lock) | 291 | if (data->lock) |
2900 | 152 | data->processed = g_slist_append(data->processed, cb); | 292 | data->processed = g_slist_append(data->processed, cb); |
2901 | 153 | else | 293 | else |
2902 | 154 | data->callbacks = g_slist_append(data->callbacks, cb); | 294 | data->callbacks = g_slist_append(data->callbacks, cb); |
2903 | 155 | 295 | ||
2905 | 156 | return first; | 296 | return cb; |
2906 | 157 | } | 297 | } |
2907 | 158 | 298 | ||
2910 | 159 | static void name_data_remove(DBusConnection *connection, | 299 | static gboolean filter_data_remove_callback(struct filter_data *data, |
2911 | 160 | const char *name, guint id) | 300 | struct filter_callback *cb) |
2912 | 161 | { | 301 | { |
2931 | 162 | struct name_data *data; | 302 | DBusConnection *connection; |
2932 | 163 | struct name_callback *cb = NULL; | 303 | |
2933 | 164 | 304 | data->callbacks = g_slist_remove(data->callbacks, cb); | |
2934 | 165 | data = name_data_find(connection, name); | 305 | data->processed = g_slist_remove(data->processed, cb); |
2935 | 166 | if (!data) | 306 | |
2936 | 167 | return; | 307 | if (cb->destroy_func) |
2937 | 168 | 308 | cb->destroy_func(cb->user_data); | |
2938 | 169 | cb = name_callback_find(data->callbacks, id); | 309 | |
2939 | 170 | if (cb) { | 310 | g_free(cb); |
2940 | 171 | data->callbacks = g_slist_remove(data->callbacks, cb); | 311 | |
2941 | 172 | g_free(cb); | 312 | /* Don't remove the filter if other callbacks exist or data is lock |
2942 | 173 | } | 313 | * processing callbacks */ |
2943 | 174 | 314 | if (data->callbacks || data->lock) | |
2944 | 175 | if (data->callbacks) | 315 | return TRUE; |
2945 | 176 | return; | 316 | |
2946 | 177 | 317 | if (data->registered && !remove_match(data)) | |
2947 | 178 | name_listeners = g_slist_remove(name_listeners, data); | 318 | return FALSE; |
2948 | 179 | name_data_free(data); | 319 | |
2949 | 320 | connection = dbus_connection_ref(data->connection); | ||
2950 | 321 | listeners = g_slist_remove(listeners, data); | ||
2951 | 322 | filter_data_free(data); | ||
2952 | 180 | 323 | ||
2953 | 181 | /* Remove filter if there are no listeners left for the connection */ | 324 | /* Remove filter if there are no listeners left for the connection */ |
2955 | 182 | data = name_data_find(connection, NULL); | 325 | data = filter_data_find(connection, NULL, NULL, NULL, NULL, NULL); |
2956 | 183 | if (!data) | 326 | if (!data) |
2959 | 184 | dbus_connection_remove_filter(connection, | 327 | dbus_connection_remove_filter(connection, message_filter, |
2958 | 185 | name_exit_filter, | ||
2960 | 186 | NULL); | 328 | NULL); |
3014 | 187 | } | 329 | |
3015 | 188 | 330 | dbus_connection_unref(connection); | |
3016 | 189 | static gboolean add_match(DBusConnection *connection, const char *name) | 331 | |
3017 | 190 | { | 332 | return TRUE; |
3018 | 191 | DBusError err; | 333 | } |
3019 | 192 | char match_string[128]; | 334 | |
3020 | 193 | 335 | static DBusHandlerResult signal_filter(DBusConnection *connection, | |
3021 | 194 | snprintf(match_string, sizeof(match_string), | 336 | DBusMessage *message, void *user_data) |
3022 | 195 | "interface=%s,member=NameOwnerChanged,arg0=%s", | 337 | { |
3023 | 196 | DBUS_INTERFACE_DBUS, name); | 338 | struct filter_data *data = user_data; |
3024 | 197 | 339 | struct filter_callback *cb; | |
3025 | 198 | dbus_error_init(&err); | 340 | |
3026 | 199 | 341 | while (data->callbacks) { | |
3027 | 200 | dbus_bus_add_match(connection, match_string, &err); | 342 | cb = data->callbacks->data; |
3028 | 201 | 343 | ||
3029 | 202 | if (dbus_error_is_set(&err)) { | 344 | if (cb->signal_func && !cb->signal_func(connection, message, |
3030 | 203 | error("Adding match rule \"%s\" failed: %s", match_string, | 345 | cb->user_data)) { |
3031 | 204 | err.message); | 346 | filter_data_remove_callback(data, cb); |
3032 | 205 | dbus_error_free(&err); | 347 | continue; |
3033 | 206 | return FALSE; | 348 | } |
3034 | 207 | } | 349 | |
3035 | 208 | 350 | /* Check if the watch was removed/freed by the callback | |
3036 | 209 | return TRUE; | 351 | * function */ |
3037 | 210 | } | 352 | if (!g_slist_find(data->callbacks, cb)) |
3038 | 211 | 353 | continue; | |
3039 | 212 | static gboolean remove_match(DBusConnection *connection, const char *name) | 354 | |
3040 | 213 | { | 355 | data->callbacks = g_slist_remove(data->callbacks, cb); |
3041 | 214 | DBusError err; | 356 | data->processed = g_slist_append(data->processed, cb); |
3042 | 215 | char match_string[128]; | 357 | } |
3043 | 216 | 358 | ||
3044 | 217 | snprintf(match_string, sizeof(match_string), | 359 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
3045 | 218 | "interface=%s,member=NameOwnerChanged,arg0=%s", | 360 | } |
3046 | 219 | DBUS_INTERFACE_DBUS, name); | 361 | |
3047 | 220 | 362 | static DBusHandlerResult service_filter(DBusConnection *connection, | |
3048 | 221 | dbus_error_init(&err); | 363 | DBusMessage *message, void *user_data) |
3049 | 222 | 364 | { | |
3050 | 223 | dbus_bus_remove_match(connection, match_string, &err); | 365 | struct filter_data *data = user_data; |
3051 | 224 | 366 | struct filter_callback *cb; | |
2999 | 225 | if (dbus_error_is_set(&err)) { | ||
3000 | 226 | error("Removing owner match rule for %s failed: %s", | ||
3001 | 227 | name, err.message); | ||
3002 | 228 | dbus_error_free(&err); | ||
3003 | 229 | return FALSE; | ||
3004 | 230 | } | ||
3005 | 231 | |||
3006 | 232 | return TRUE; | ||
3007 | 233 | } | ||
3008 | 234 | |||
3009 | 235 | static DBusHandlerResult name_exit_filter(DBusConnection *connection, | ||
3010 | 236 | DBusMessage *message, void *user_data) | ||
3011 | 237 | { | ||
3012 | 238 | struct name_data *data; | ||
3013 | 239 | struct name_callback *cb; | ||
3052 | 240 | char *name, *old, *new; | 367 | char *name, *old, *new; |
3053 | 241 | 368 | ||
3054 | 242 | if (!dbus_message_is_signal(message, DBUS_INTERFACE_DBUS, | ||
3055 | 243 | "NameOwnerChanged")) | ||
3056 | 244 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | ||
3057 | 245 | |||
3058 | 246 | if (!dbus_message_get_args(message, NULL, | 369 | if (!dbus_message_get_args(message, NULL, |
3059 | 247 | DBUS_TYPE_STRING, &name, | 370 | DBUS_TYPE_STRING, &name, |
3060 | 248 | DBUS_TYPE_STRING, &old, | 371 | DBUS_TYPE_STRING, &old, |
3061 | @@ -252,14 +375,6 @@ | |||
3062 | 252 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | 375 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
3063 | 253 | } | 376 | } |
3064 | 254 | 377 | ||
3065 | 255 | data = name_data_find(connection, name); | ||
3066 | 256 | if (!data) { | ||
3067 | 257 | error("Got NameOwnerChanged signal for %s which has no listeners", name); | ||
3068 | 258 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | ||
3069 | 259 | } | ||
3070 | 260 | |||
3071 | 261 | data->lock = TRUE; | ||
3072 | 262 | |||
3073 | 263 | while (data->callbacks) { | 378 | while (data->callbacks) { |
3074 | 264 | cb = data->callbacks->data; | 379 | cb = data->callbacks->data; |
3075 | 265 | 380 | ||
3076 | @@ -286,24 +401,56 @@ | |||
3077 | 286 | data->processed = g_slist_append(data->processed, cb); | 401 | data->processed = g_slist_append(data->processed, cb); |
3078 | 287 | } | 402 | } |
3079 | 288 | 403 | ||
3083 | 289 | data->callbacks = data->processed; | 404 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
3084 | 290 | data->processed = NULL; | 405 | } |
3085 | 291 | data->lock = FALSE; | 406 | |
3086 | 407 | |||
3087 | 408 | static DBusHandlerResult message_filter(DBusConnection *connection, | ||
3088 | 409 | DBusMessage *message, void *user_data) | ||
3089 | 410 | { | ||
3090 | 411 | struct filter_data *data; | ||
3091 | 412 | const char *sender, *path, *iface, *member, *arg = NULL; | ||
3092 | 413 | |||
3093 | 414 | /* Only filter signals */ | ||
3094 | 415 | if (dbus_message_get_type(message) != DBUS_MESSAGE_TYPE_SIGNAL) | ||
3095 | 416 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | ||
3096 | 417 | |||
3097 | 418 | sender = dbus_message_get_sender(message); | ||
3098 | 419 | path = dbus_message_get_path(message); | ||
3099 | 420 | iface = dbus_message_get_interface(message); | ||
3100 | 421 | member = dbus_message_get_member(message); | ||
3101 | 422 | dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &arg, DBUS_TYPE_INVALID); | ||
3102 | 423 | |||
3103 | 424 | data = filter_data_find(connection, sender, path, iface, member, arg); | ||
3104 | 425 | if (!data) { | ||
3105 | 426 | error("Got %s.%s signal which has no listeners", iface, member); | ||
3106 | 427 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | ||
3107 | 428 | } | ||
3108 | 429 | |||
3109 | 430 | if (data->handle_func) { | ||
3110 | 431 | data->lock = TRUE; | ||
3111 | 432 | |||
3112 | 433 | data->handle_func(connection, message, data); | ||
3113 | 434 | |||
3114 | 435 | data->callbacks = data->processed; | ||
3115 | 436 | data->processed = NULL; | ||
3116 | 437 | data->lock = FALSE; | ||
3117 | 438 | } | ||
3118 | 292 | 439 | ||
3119 | 293 | if (data->callbacks) | 440 | if (data->callbacks) |
3120 | 294 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | 441 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
3121 | 295 | 442 | ||
3124 | 296 | name_listeners = g_slist_remove(name_listeners, data); | 443 | remove_match(data); |
3125 | 297 | name_data_free(data); | 444 | |
3126 | 445 | listeners = g_slist_remove(listeners, data); | ||
3127 | 446 | filter_data_free(data); | ||
3128 | 298 | 447 | ||
3129 | 299 | /* Remove filter if there no listener left for the connection */ | 448 | /* Remove filter if there no listener left for the connection */ |
3131 | 300 | data = name_data_find(connection, NULL); | 449 | data = filter_data_find(connection, NULL, NULL, NULL, NULL, NULL); |
3132 | 301 | if (!data) | 450 | if (!data) |
3134 | 302 | dbus_connection_remove_filter(connection, name_exit_filter, | 451 | dbus_connection_remove_filter(connection, message_filter, |
3135 | 303 | NULL); | 452 | NULL); |
3136 | 304 | 453 | ||
3137 | 305 | remove_match(connection, name); | ||
3138 | 306 | |||
3139 | 307 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | 454 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
3140 | 308 | } | 455 | } |
3141 | 309 | 456 | ||
3142 | @@ -388,6 +535,8 @@ | |||
3143 | 388 | 535 | ||
3144 | 389 | dbus_pending_call_set_notify(call, service_reply, data, NULL); | 536 | dbus_pending_call_set_notify(call, service_reply, data, NULL); |
3145 | 390 | 537 | ||
3146 | 538 | dbus_pending_call_unref(call); | ||
3147 | 539 | |||
3148 | 391 | done: | 540 | done: |
3149 | 392 | dbus_message_unref(message); | 541 | dbus_message_unref(message); |
3150 | 393 | } | 542 | } |
3151 | @@ -397,38 +546,27 @@ | |||
3152 | 397 | GDBusWatchFunction disconnect, | 546 | GDBusWatchFunction disconnect, |
3153 | 398 | void *user_data, GDBusDestroyFunction destroy) | 547 | void *user_data, GDBusDestroyFunction destroy) |
3154 | 399 | { | 548 | { |
3183 | 400 | int first; | 549 | struct filter_data *data; |
3184 | 401 | 550 | struct filter_callback *cb; | |
3185 | 402 | if (!name_data_find(connection, NULL)) { | 551 | |
3186 | 403 | if (!dbus_connection_add_filter(connection, | 552 | if (!name) |
3187 | 404 | name_exit_filter, NULL, NULL)) { | 553 | return 0; |
3188 | 405 | error("dbus_connection_add_filter() failed"); | 554 | |
3189 | 406 | return 0; | 555 | data = filter_data_get(connection, service_filter, NULL, NULL, |
3190 | 407 | } | 556 | DBUS_INTERFACE_DBUS, "NameOwnerChanged", |
3191 | 408 | } | 557 | name); |
3192 | 409 | 558 | if (!data) | |
3193 | 410 | listener_id++; | 559 | return 0; |
3194 | 411 | first = name_data_add(connection, name, connect, disconnect, | 560 | |
3195 | 412 | user_data, listener_id); | 561 | cb = filter_data_add_callback(data, connect, disconnect, NULL, NULL, |
3196 | 413 | /* The filter is already added if this is not the first callback | 562 | user_data); |
3197 | 414 | * registration for the name */ | 563 | if (!cb) |
3198 | 415 | if (!first) | 564 | return 0; |
3199 | 416 | goto done; | 565 | |
3172 | 417 | |||
3173 | 418 | if (name) { | ||
3174 | 419 | debug("name_listener_add(%s)", name); | ||
3175 | 420 | |||
3176 | 421 | if (!add_match(connection, name)) { | ||
3177 | 422 | name_data_remove(connection, name, listener_id); | ||
3178 | 423 | return 0; | ||
3179 | 424 | } | ||
3180 | 425 | } | ||
3181 | 426 | |||
3182 | 427 | done: | ||
3200 | 428 | if (connect) | 566 | if (connect) |
3201 | 429 | check_service(connection, name, connect, user_data); | 567 | check_service(connection, name, connect, user_data); |
3202 | 430 | 568 | ||
3204 | 431 | return listener_id; | 569 | return cb->id; |
3205 | 432 | } | 570 | } |
3206 | 433 | 571 | ||
3207 | 434 | guint g_dbus_add_disconnect_watch(DBusConnection *connection, const char *name, | 572 | guint g_dbus_add_disconnect_watch(DBusConnection *connection, const char *name, |
3208 | @@ -440,72 +578,57 @@ | |||
3209 | 440 | } | 578 | } |
3210 | 441 | 579 | ||
3211 | 442 | guint g_dbus_add_signal_watch(DBusConnection *connection, | 580 | guint g_dbus_add_signal_watch(DBusConnection *connection, |
3214 | 443 | const char *rule, GDBusSignalFunction function, | 581 | const char *sender, const char *path, |
3215 | 444 | void *user_data, GDBusDestroyFunction destroy) | 582 | const char *interface, const char *member, |
3216 | 583 | GDBusSignalFunction function, void *user_data, | ||
3217 | 584 | GDBusDestroyFunction destroy) | ||
3218 | 445 | { | 585 | { |
3220 | 446 | return 0; | 586 | struct filter_data *data; |
3221 | 587 | struct filter_callback *cb; | ||
3222 | 588 | |||
3223 | 589 | data = filter_data_get(connection, signal_filter, sender, path, | ||
3224 | 590 | interface, member, NULL); | ||
3225 | 591 | if (!data) | ||
3226 | 592 | return 0; | ||
3227 | 593 | |||
3228 | 594 | cb = filter_data_add_callback(data, NULL, NULL, function, destroy, | ||
3229 | 595 | user_data); | ||
3230 | 596 | if (!cb) | ||
3231 | 597 | return 0; | ||
3232 | 598 | |||
3233 | 599 | return cb->id; | ||
3234 | 447 | } | 600 | } |
3235 | 448 | 601 | ||
3236 | 449 | gboolean g_dbus_remove_watch(DBusConnection *connection, guint id) | 602 | gboolean g_dbus_remove_watch(DBusConnection *connection, guint id) |
3237 | 450 | { | 603 | { |
3241 | 451 | struct name_data *data; | 604 | struct filter_data *data; |
3242 | 452 | struct name_callback *cb; | 605 | struct filter_callback *cb; |
3243 | 453 | GSList *ldata, *lcb; | 606 | GSList *ldata; |
3244 | 454 | 607 | ||
3245 | 455 | if (id == 0) | 608 | if (id == 0) |
3246 | 456 | return FALSE; | 609 | return FALSE; |
3247 | 457 | 610 | ||
3249 | 458 | for (ldata = name_listeners; ldata; ldata = ldata->next) { | 611 | for (ldata = listeners; ldata; ldata = ldata->next) { |
3250 | 459 | data = ldata->data; | 612 | data = ldata->data; |
3260 | 460 | for (lcb = data->callbacks; lcb; lcb = lcb->next) { | 613 | |
3261 | 461 | cb = lcb->data; | 614 | cb = filter_data_find_callback(data, id); |
3262 | 462 | if (cb->id == id) | 615 | if (cb) { |
3263 | 463 | goto remove; | 616 | filter_data_remove_callback(data, cb); |
3264 | 464 | } | 617 | return TRUE; |
3256 | 465 | for (lcb = data->processed; lcb; lcb = lcb->next) { | ||
3257 | 466 | cb = lcb->data; | ||
3258 | 467 | if (cb->id == id) | ||
3259 | 468 | goto remove; | ||
3265 | 469 | } | 618 | } |
3266 | 470 | } | 619 | } |
3267 | 471 | 620 | ||
3268 | 472 | return FALSE; | 621 | return FALSE; |
3269 | 473 | |||
3270 | 474 | remove: | ||
3271 | 475 | data->callbacks = g_slist_remove(data->callbacks, cb); | ||
3272 | 476 | data->processed = g_slist_remove(data->processed, cb); | ||
3273 | 477 | g_free(cb); | ||
3274 | 478 | |||
3275 | 479 | /* Don't remove the filter if other callbacks exist or data is lock | ||
3276 | 480 | * processing callbacks */ | ||
3277 | 481 | if (data->callbacks || data->lock) | ||
3278 | 482 | return TRUE; | ||
3279 | 483 | |||
3280 | 484 | if (data->name) { | ||
3281 | 485 | if (!remove_match(data->connection, data->name)) | ||
3282 | 486 | return FALSE; | ||
3283 | 487 | } | ||
3284 | 488 | |||
3285 | 489 | name_listeners = g_slist_remove(name_listeners, data); | ||
3286 | 490 | name_data_free(data); | ||
3287 | 491 | |||
3288 | 492 | /* Remove filter if there are no listeners left for the connection */ | ||
3289 | 493 | data = name_data_find(connection, NULL); | ||
3290 | 494 | if (!data) | ||
3291 | 495 | dbus_connection_remove_filter(connection, name_exit_filter, | ||
3292 | 496 | NULL); | ||
3293 | 497 | |||
3294 | 498 | return TRUE; | ||
3295 | 499 | } | 622 | } |
3296 | 500 | 623 | ||
3297 | 501 | void g_dbus_remove_all_watches(DBusConnection *connection) | 624 | void g_dbus_remove_all_watches(DBusConnection *connection) |
3298 | 502 | { | 625 | { |
3300 | 503 | struct name_data *data; | 626 | struct filter_data *data; |
3301 | 504 | 627 | ||
3305 | 505 | while ((data = name_data_find(connection, NULL))) { | 628 | while ((data = filter_data_find(connection, NULL, NULL, NULL, NULL, NULL))) { |
3306 | 506 | name_listeners = g_slist_remove(name_listeners, data); | 629 | listeners = g_slist_remove(listeners, data); |
3307 | 507 | name_data_call_and_free(data); | 630 | filter_data_call_and_free(data); |
3308 | 508 | } | 631 | } |
3309 | 509 | 632 | ||
3311 | 510 | dbus_connection_remove_filter(connection, name_exit_filter, NULL); | 633 | dbus_connection_remove_filter(connection, message_filter, NULL); |
3312 | 511 | } | 634 | } |
3313 | 512 | 635 | ||
3314 | === modified file 'ltmain.sh' | |||
3315 | --- ltmain.sh 2009-07-27 19:02:30 +0000 | |||
3316 | +++ ltmain.sh 2010-04-28 20:38:30 +0000 | |||
3317 | @@ -1,6 +1,6 @@ | |||
3318 | 1 | # Generated from ltmain.m4sh. | 1 | # Generated from ltmain.m4sh. |
3319 | 2 | 2 | ||
3321 | 3 | # ltmain.sh (GNU libtool) 2.2.6 | 3 | # ltmain.sh (GNU libtool) 2.2.6b |
3322 | 4 | # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 | 4 | # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
3323 | 5 | 5 | ||
3324 | 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. |
3325 | @@ -65,7 +65,7 @@ | |||
3326 | 65 | # compiler: $LTCC | 65 | # compiler: $LTCC |
3327 | 66 | # compiler flags: $LTCFLAGS | 66 | # compiler flags: $LTCFLAGS |
3328 | 67 | # linker: $LD (gnu? $with_gnu_ld) | 67 | # linker: $LD (gnu? $with_gnu_ld) |
3330 | 68 | # $progname: (GNU libtool) 2.2.6 | 68 | # $progname: (GNU libtool) 2.2.6b |
3331 | 69 | # automake: $automake_version | 69 | # automake: $automake_version |
3332 | 70 | # autoconf: $autoconf_version | 70 | # autoconf: $autoconf_version |
3333 | 71 | # | 71 | # |
3334 | @@ -73,9 +73,9 @@ | |||
3335 | 73 | 73 | ||
3336 | 74 | PROGRAM=ltmain.sh | 74 | PROGRAM=ltmain.sh |
3337 | 75 | PACKAGE=libtool | 75 | PACKAGE=libtool |
3339 | 76 | VERSION=2.2.6 | 76 | VERSION=2.2.6b |
3340 | 77 | TIMESTAMP="" | 77 | TIMESTAMP="" |
3342 | 78 | package_revision=1.3012 | 78 | package_revision=1.3017 |
3343 | 79 | 79 | ||
3344 | 80 | # Be Bourne compatible | 80 | # Be Bourne compatible |
3345 | 81 | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then | 81 | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then |
3346 | 82 | 82 | ||
3347 | === modified file 'plugins/filesystem.c' | |||
3348 | --- plugins/filesystem.c 2010-01-10 10:46:58 +0000 | |||
3349 | +++ plugins/filesystem.c 2010-04-28 20:38:30 +0000 | |||
3350 | @@ -2,8 +2,8 @@ | |||
3351 | 2 | * | 2 | * |
3352 | 3 | * OBEX Server | 3 | * OBEX Server |
3353 | 4 | * | 4 | * |
3356 | 5 | * Copyright (C) 2009 Intel Corporation | 5 | * Copyright (C) 2009-2010 Intel Corporation |
3357 | 6 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 6 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
3358 | 7 | * | 7 | * |
3359 | 8 | * | 8 | * |
3360 | 9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
3361 | @@ -123,37 +123,49 @@ | |||
3362 | 123 | } | 123 | } |
3363 | 124 | 124 | ||
3364 | 125 | static gpointer filesystem_open(const char *name, int oflag, mode_t mode, | 125 | static gpointer filesystem_open(const char *name, int oflag, mode_t mode, |
3366 | 126 | size_t *size) | 126 | size_t *size, int *err) |
3367 | 127 | { | 127 | { |
3368 | 128 | struct stat stats; | 128 | struct stat stats; |
3369 | 129 | struct statvfs buf; | 129 | struct statvfs buf; |
3370 | 130 | int fd = open(name, oflag, mode); | 130 | int fd = open(name, oflag, mode); |
3371 | 131 | 131 | ||
3373 | 132 | if (fd < 0) | 132 | if (fd < 0) { |
3374 | 133 | if (err) | ||
3375 | 134 | *err = -errno; | ||
3376 | 133 | return NULL; | 135 | return NULL; |
3377 | 136 | } | ||
3378 | 134 | 137 | ||
3379 | 135 | if (fstat(fd, &stats) < 0) { | 138 | if (fstat(fd, &stats) < 0) { |
3381 | 136 | error("fstat(fd=%d): %s (%d)", fd, strerror(errno), errno); | 139 | if (err) |
3382 | 140 | *err = -errno; | ||
3383 | 137 | goto failed; | 141 | goto failed; |
3384 | 138 | } | 142 | } |
3385 | 139 | 143 | ||
3386 | 140 | if (oflag == O_RDONLY) { | 144 | if (oflag == O_RDONLY) { |
3387 | 141 | if (size) | 145 | if (size) |
3388 | 142 | *size = stats.st_size; | 146 | *size = stats.st_size; |
3390 | 143 | return GINT_TO_POINTER(fd); | 147 | goto done; |
3391 | 144 | } | 148 | } |
3392 | 145 | 149 | ||
3394 | 146 | if (fstatvfs(fd, &buf) < 0) | 150 | if (fstatvfs(fd, &buf) < 0) { |
3395 | 151 | if (err) | ||
3396 | 152 | *err = -errno; | ||
3397 | 147 | goto failed; | 153 | goto failed; |
3398 | 154 | } | ||
3399 | 148 | 155 | ||
3400 | 149 | if (size == NULL) | 156 | if (size == NULL) |
3402 | 150 | return GINT_TO_POINTER(fd); | 157 | goto done; |
3403 | 151 | 158 | ||
3404 | 152 | if (buf.f_bsize * buf.f_bavail < *size) { | 159 | if (buf.f_bsize * buf.f_bavail < *size) { |
3406 | 153 | errno = ENOSPC; | 160 | if (err) |
3407 | 161 | *err = -ENOSPC; | ||
3408 | 154 | goto failed; | 162 | goto failed; |
3409 | 155 | } | 163 | } |
3410 | 156 | 164 | ||
3411 | 165 | done: | ||
3412 | 166 | if (err) | ||
3413 | 167 | *err = 0; | ||
3414 | 168 | |||
3415 | 157 | return GINT_TO_POINTER(fd); | 169 | return GINT_TO_POINTER(fd); |
3416 | 158 | 170 | ||
3417 | 159 | failed: | 171 | failed: |
3418 | @@ -163,71 +175,138 @@ | |||
3419 | 163 | 175 | ||
3420 | 164 | static int filesystem_close(gpointer object) | 176 | static int filesystem_close(gpointer object) |
3421 | 165 | { | 177 | { |
3423 | 166 | return close(GPOINTER_TO_INT(object)); | 178 | if (close(GPOINTER_TO_INT(object)) < 0) |
3424 | 179 | return -errno; | ||
3425 | 180 | |||
3426 | 181 | return 0; | ||
3427 | 167 | } | 182 | } |
3428 | 168 | 183 | ||
3429 | 169 | static ssize_t filesystem_read(gpointer object, void *buf, size_t count) | 184 | static ssize_t filesystem_read(gpointer object, void *buf, size_t count) |
3430 | 170 | { | 185 | { |
3432 | 171 | return read(GPOINTER_TO_INT(object), buf, count); | 186 | ssize_t ret; |
3433 | 187 | |||
3434 | 188 | ret = read(GPOINTER_TO_INT(object), buf, count); | ||
3435 | 189 | if (ret < 0) | ||
3436 | 190 | return -errno; | ||
3437 | 191 | |||
3438 | 192 | return ret; | ||
3439 | 172 | } | 193 | } |
3440 | 173 | 194 | ||
3441 | 174 | static ssize_t filesystem_write(gpointer object, const void *buf, size_t count) | 195 | static ssize_t filesystem_write(gpointer object, const void *buf, size_t count) |
3442 | 175 | { | 196 | { |
3444 | 176 | return write(GPOINTER_TO_INT(object), buf, count); | 197 | ssize_t ret; |
3445 | 198 | |||
3446 | 199 | ret = write(GPOINTER_TO_INT(object), buf, count); | ||
3447 | 200 | if (ret < 0) | ||
3448 | 201 | return -errno; | ||
3449 | 202 | |||
3450 | 203 | return ret; | ||
3451 | 204 | } | ||
3452 | 205 | |||
3453 | 206 | struct capability_object { | ||
3454 | 207 | int pid; | ||
3455 | 208 | int output; | ||
3456 | 209 | int err; | ||
3457 | 210 | guint watch; | ||
3458 | 211 | GString *buffer; | ||
3459 | 212 | }; | ||
3460 | 213 | |||
3461 | 214 | static void script_exited(GPid pid, gint status, gpointer data) | ||
3462 | 215 | { | ||
3463 | 216 | struct capability_object *object = data; | ||
3464 | 217 | char buf[128]; | ||
3465 | 218 | |||
3466 | 219 | object->pid = -1; | ||
3467 | 220 | |||
3468 | 221 | if (WEXITSTATUS(status) != EXIT_SUCCESS) { | ||
3469 | 222 | memset(buf, 0, sizeof(buf)); | ||
3470 | 223 | if (read(object->err, buf, sizeof(buf)) > 0) | ||
3471 | 224 | error("%s", buf); | ||
3472 | 225 | obex_object_set_io_flags(data, G_IO_ERR, -EPERM); | ||
3473 | 226 | } else | ||
3474 | 227 | obex_object_set_io_flags(data, G_IO_IN, 0); | ||
3475 | 228 | |||
3476 | 229 | g_spawn_close_pid(pid); | ||
3477 | 230 | } | ||
3478 | 231 | |||
3479 | 232 | static int capability_exec(const char **argv, int *output, int *err) | ||
3480 | 233 | { | ||
3481 | 234 | GError *gerr = NULL; | ||
3482 | 235 | int pid; | ||
3483 | 236 | GSpawnFlags flags = G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH; | ||
3484 | 237 | |||
3485 | 238 | if (!g_spawn_async_with_pipes(NULL, (char **) argv, NULL, flags, NULL, | ||
3486 | 239 | NULL, &pid, NULL, output, err, &gerr)) { | ||
3487 | 240 | error("%s", gerr->message); | ||
3488 | 241 | g_error_free(gerr); | ||
3489 | 242 | return -EPERM; | ||
3490 | 243 | } | ||
3491 | 244 | |||
3492 | 245 | return pid; | ||
3493 | 177 | } | 246 | } |
3494 | 178 | 247 | ||
3495 | 179 | static gpointer capability_open(const char *name, int oflag, mode_t mode, | 248 | static gpointer capability_open(const char *name, int oflag, mode_t mode, |
3497 | 180 | size_t *size) | 249 | size_t *size, int *err) |
3498 | 181 | { | 250 | { |
3500 | 182 | GError *gerr = NULL; | 251 | struct capability_object *object = NULL; |
3501 | 183 | gchar *buf; | 252 | gchar *buf; |
3505 | 184 | gint exit; | 253 | const char *argv[2]; |
3503 | 185 | gboolean ret; | ||
3504 | 186 | GString *object; | ||
3506 | 187 | 254 | ||
3507 | 188 | if (oflag != O_RDONLY) | 255 | if (oflag != O_RDONLY) |
3508 | 189 | goto fail; | 256 | goto fail; |
3509 | 190 | 257 | ||
3510 | 258 | object = g_new0(struct capability_object, 1); | ||
3511 | 259 | object->pid = -1; | ||
3512 | 260 | object->output = -1; | ||
3513 | 261 | object->err = -1; | ||
3514 | 262 | |||
3515 | 191 | if (name[0] != '!') { | 263 | if (name[0] != '!') { |
3516 | 264 | GError *gerr = NULL; | ||
3517 | 265 | gboolean ret; | ||
3518 | 266 | |||
3519 | 192 | ret = g_file_get_contents(name, &buf, NULL, &gerr); | 267 | ret = g_file_get_contents(name, &buf, NULL, &gerr); |
3520 | 193 | if (ret == FALSE) { | 268 | if (ret == FALSE) { |
3521 | 194 | error("%s", gerr->message); | 269 | error("%s", gerr->message); |
3522 | 270 | g_error_free(gerr); | ||
3523 | 195 | goto fail; | 271 | goto fail; |
3524 | 196 | } | 272 | } |
3525 | 197 | 273 | ||
3526 | 274 | object->buffer = g_string_new(buf); | ||
3527 | 275 | |||
3528 | 276 | if (size) | ||
3529 | 277 | *size = object->buffer->len; | ||
3530 | 278 | |||
3531 | 198 | goto done; | 279 | goto done; |
3532 | 199 | } | 280 | } |
3533 | 200 | 281 | ||
3545 | 201 | ret = g_spawn_command_line_sync(name + 1, &buf, NULL, &exit, &gerr); | 282 | argv[0] = &name[1]; |
3546 | 202 | if (ret == FALSE) { | 283 | argv[1] = NULL; |
3547 | 203 | error("%s", gerr->message); | 284 | |
3548 | 204 | goto fail; | 285 | object->pid = capability_exec(argv, &object->output, &object->err); |
3549 | 205 | } | 286 | if (object->pid < 0) |
3550 | 206 | 287 | goto fail; | |
3551 | 207 | if (WEXITSTATUS(exit) != EXIT_SUCCESS) { | 288 | |
3552 | 208 | error("%s failed", name + 1); | 289 | object->watch = g_child_watch_add(object->pid, script_exited, object); |
3553 | 209 | g_free(buf); | 290 | |
3554 | 210 | goto fail; | 291 | if (size) |
3555 | 211 | } | 292 | *size = 1; |
3556 | 212 | 293 | ||
3557 | 213 | done: | 294 | done: |
3562 | 214 | object = g_string_new(buf); | 295 | if (err) |
3563 | 215 | 296 | *err = 0; | |
3560 | 216 | if (size) | ||
3561 | 217 | *size = object->len; | ||
3564 | 218 | 297 | ||
3565 | 219 | return object; | 298 | return object; |
3566 | 220 | 299 | ||
3567 | 221 | fail: | 300 | fail: |
3570 | 222 | if (gerr) | 301 | if (err) |
3571 | 223 | g_error_free(gerr); | 302 | *err = -EPERM; |
3572 | 224 | 303 | ||
3574 | 225 | errno = EPERM; | 304 | g_free(object); |
3575 | 226 | return NULL; | 305 | return NULL; |
3576 | 227 | } | 306 | } |
3577 | 228 | 307 | ||
3578 | 229 | static gpointer folder_open(const char *name, int oflag, mode_t mode, | 308 | static gpointer folder_open(const char *name, int oflag, mode_t mode, |
3580 | 230 | size_t *size) | 309 | size_t *size, int *err) |
3581 | 231 | { | 310 | { |
3582 | 232 | struct obex_session *os; | 311 | struct obex_session *os; |
3583 | 233 | struct stat fstat, dstat; | 312 | struct stat fstat, dstat; |
3584 | @@ -235,7 +314,7 @@ | |||
3585 | 235 | DIR *dp; | 314 | DIR *dp; |
3586 | 236 | GString *object; | 315 | GString *object; |
3587 | 237 | gboolean root, pcsuite; | 316 | gboolean root, pcsuite; |
3589 | 238 | gint err; | 317 | int ret; |
3590 | 239 | 318 | ||
3591 | 240 | os = obex_get_session(NULL); | 319 | os = obex_get_session(NULL); |
3592 | 241 | 320 | ||
3593 | @@ -250,20 +329,21 @@ | |||
3594 | 250 | 329 | ||
3595 | 251 | dp = opendir(name); | 330 | dp = opendir(name); |
3596 | 252 | if (dp == NULL) { | 331 | if (dp == NULL) { |
3598 | 253 | errno = ENOENT; | 332 | if (err) |
3599 | 333 | *err = -ENOENT; | ||
3600 | 254 | goto failed; | 334 | goto failed; |
3601 | 255 | } | 335 | } |
3602 | 256 | 336 | ||
3603 | 257 | if (root && os->server->symlinks) | 337 | if (root && os->server->symlinks) |
3605 | 258 | err = stat(name, &dstat); | 338 | ret = stat(name, &dstat); |
3606 | 259 | else { | 339 | else { |
3607 | 260 | object = g_string_append(object, FL_PARENT_FOLDER_ELEMENT); | 340 | object = g_string_append(object, FL_PARENT_FOLDER_ELEMENT); |
3609 | 261 | err = lstat(name, &dstat); | 341 | ret = lstat(name, &dstat); |
3610 | 262 | } | 342 | } |
3611 | 263 | 343 | ||
3615 | 264 | if (err < 0) { | 344 | if (ret < 0) { |
3616 | 265 | error("%s: %s(%d)", root ? "stat" : "lstat", | 345 | if (err) |
3617 | 266 | strerror(errno), errno); | 346 | *err = -errno; |
3618 | 267 | goto failed; | 347 | goto failed; |
3619 | 268 | } | 348 | } |
3620 | 269 | 349 | ||
3621 | @@ -284,11 +364,11 @@ | |||
3622 | 284 | fullname = g_build_filename(os->current_folder, ep->d_name, NULL); | 364 | fullname = g_build_filename(os->current_folder, ep->d_name, NULL); |
3623 | 285 | 365 | ||
3624 | 286 | if (root && os->server->symlinks) | 366 | if (root && os->server->symlinks) |
3626 | 287 | err = stat(fullname, &fstat); | 367 | ret = stat(fullname, &fstat); |
3627 | 288 | else | 368 | else |
3629 | 289 | err = lstat(fullname, &fstat); | 369 | ret = lstat(fullname, &fstat); |
3630 | 290 | 370 | ||
3632 | 291 | if (err < 0) { | 371 | if (ret < 0) { |
3633 | 292 | debug("%s: %s(%d)", root ? "stat" : "lstat", | 372 | debug("%s: %s(%d)", root ? "stat" : "lstat", |
3634 | 293 | strerror(errno), errno); | 373 | strerror(errno), errno); |
3635 | 294 | g_free(name); | 374 | g_free(name); |
3636 | @@ -310,13 +390,21 @@ | |||
3637 | 310 | g_free(line); | 390 | g_free(line); |
3638 | 311 | } | 391 | } |
3639 | 312 | 392 | ||
3640 | 393 | closedir(dp); | ||
3641 | 394 | |||
3642 | 313 | object = g_string_append(object, FL_BODY_END); | 395 | object = g_string_append(object, FL_BODY_END); |
3643 | 314 | if (size) | 396 | if (size) |
3644 | 315 | *size = object->len; | 397 | *size = object->len; |
3645 | 316 | 398 | ||
3646 | 399 | if (err) | ||
3647 | 400 | *err = 0; | ||
3648 | 401 | |||
3649 | 317 | return object; | 402 | return object; |
3650 | 318 | 403 | ||
3651 | 319 | failed: | 404 | failed: |
3652 | 405 | if (dp) | ||
3653 | 406 | closedir(dp); | ||
3654 | 407 | |||
3655 | 320 | g_string_free(object, TRUE); | 408 | g_string_free(object, TRUE); |
3656 | 321 | return NULL; | 409 | return NULL; |
3657 | 322 | } | 410 | } |
3658 | @@ -345,6 +433,37 @@ | |||
3659 | 345 | return len; | 433 | return len; |
3660 | 346 | } | 434 | } |
3661 | 347 | 435 | ||
3662 | 436 | static ssize_t capability_read(gpointer object, void *buf, size_t count) | ||
3663 | 437 | { | ||
3664 | 438 | struct capability_object *obj = object; | ||
3665 | 439 | |||
3666 | 440 | if (obj->buffer) | ||
3667 | 441 | return string_read(obj->buffer, buf, count); | ||
3668 | 442 | |||
3669 | 443 | if (obj->pid >= 0) | ||
3670 | 444 | return -EAGAIN; | ||
3671 | 445 | |||
3672 | 446 | return read(obj->output, buf, count); | ||
3673 | 447 | } | ||
3674 | 448 | |||
3675 | 449 | static int capability_close(gpointer object) | ||
3676 | 450 | { | ||
3677 | 451 | struct capability_object *obj = object; | ||
3678 | 452 | |||
3679 | 453 | if (obj->pid >= 0) { | ||
3680 | 454 | g_source_remove(obj->watch); | ||
3681 | 455 | kill(obj->pid, SIGTERM); | ||
3682 | 456 | g_spawn_close_pid(obj->pid); | ||
3683 | 457 | } | ||
3684 | 458 | |||
3685 | 459 | if (obj->buffer != NULL) | ||
3686 | 460 | g_string_free(obj->buffer, TRUE); | ||
3687 | 461 | |||
3688 | 462 | g_free(obj); | ||
3689 | 463 | |||
3690 | 464 | return 0; | ||
3691 | 465 | } | ||
3692 | 466 | |||
3693 | 348 | struct obex_mime_type_driver file = { | 467 | struct obex_mime_type_driver file = { |
3694 | 349 | .open = filesystem_open, | 468 | .open = filesystem_open, |
3695 | 350 | .close = filesystem_close, | 469 | .close = filesystem_close, |
3696 | @@ -357,8 +476,8 @@ | |||
3697 | 357 | .target = FTP_TARGET, | 476 | .target = FTP_TARGET, |
3698 | 358 | .mimetype = "x-obex/capability", | 477 | .mimetype = "x-obex/capability", |
3699 | 359 | .open = capability_open, | 478 | .open = capability_open, |
3702 | 360 | .close = string_free, | 479 | .close = capability_close, |
3703 | 361 | .read = string_read, | 480 | .read = capability_read, |
3704 | 362 | }; | 481 | }; |
3705 | 363 | 482 | ||
3706 | 364 | struct obex_mime_type_driver folder = { | 483 | struct obex_mime_type_driver folder = { |
3707 | 365 | 484 | ||
3708 | === modified file 'plugins/ftp.c' | |||
3709 | --- plugins/ftp.c 2010-01-10 10:46:58 +0000 | |||
3710 | +++ plugins/ftp.c 2010-04-28 20:38:30 +0000 | |||
3711 | @@ -2,9 +2,8 @@ | |||
3712 | 2 | * | 2 | * |
3713 | 3 | * OBEX Server | 3 | * OBEX Server |
3714 | 4 | * | 4 | * |
3718 | 5 | * Copyright (C) 2007-2008 Nokia Corporation | 5 | * Copyright (C) 2007-2010 Nokia Corporation |
3719 | 6 | * Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT) | 6 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
3717 | 7 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | ||
3720 | 8 | * | 7 | * |
3721 | 9 | * | 8 | * |
3722 | 10 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
3723 | @@ -94,6 +93,7 @@ | |||
3724 | 94 | </record>" | 93 | </record>" |
3725 | 95 | 94 | ||
3726 | 96 | #define PCSUITE_CHANNEL 24 | 95 | #define PCSUITE_CHANNEL 24 |
3727 | 96 | #define PCSUITE_WHO_SIZE 8 | ||
3728 | 97 | #define PCSUITE_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \ | 97 | #define PCSUITE_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \ |
3729 | 98 | <record> \ | 98 | <record> \ |
3730 | 99 | <attribute id=\"0x0001\"> \ | 99 | <attribute id=\"0x0001\"> \ |
3731 | @@ -141,9 +141,8 @@ | |||
3732 | 141 | 0xF9, 0xEC, 0x7B, 0xC4, 0x95, 0x3C, 0x11, 0xD2, | 141 | 0xF9, 0xEC, 0x7B, 0xC4, 0x95, 0x3C, 0x11, 0xD2, |
3733 | 142 | 0x98, 0x4E, 0x52, 0x54, 0x00, 0xDC, 0x9E, 0x09 }; | 142 | 0x98, 0x4E, 0x52, 0x54, 0x00, 0xDC, 0x9E, 0x09 }; |
3734 | 143 | 143 | ||
3738 | 144 | static const guint8 PCSUITE_TARGET[TARGET_SIZE] = { | 144 | static const guint8 PCSUITE_WHO[PCSUITE_WHO_SIZE] = { |
3739 | 145 | 0x00, 0x00, 0x50, 0x05, 0x00, 0x00, 0x10, 0x00, | 145 | 'P','C',' ','S','u','i','t','e' }; |
3737 | 146 | 0x80, 0x00, 0x00, 0x02, 0xEE, 0x00, 0x00, 0x01 }; | ||
3740 | 147 | 146 | ||
3741 | 148 | static gint get_by_type(struct obex_session *os, gchar *type, size_t *size) | 147 | static gint get_by_type(struct obex_session *os, gchar *type, size_t *size) |
3742 | 149 | { | 148 | { |
3743 | @@ -156,7 +155,7 @@ | |||
3744 | 156 | if (g_str_equal(type, LST_TYPE)) | 155 | if (g_str_equal(type, LST_TYPE)) |
3745 | 157 | return os_prepare_get(os, os->current_folder, size); | 156 | return os_prepare_get(os, os->current_folder, size); |
3746 | 158 | 157 | ||
3748 | 159 | return FALSE; | 158 | return -ENOENT; |
3749 | 160 | } | 159 | } |
3750 | 161 | 160 | ||
3751 | 162 | static gint ftp_prepare_get(struct obex_session *os, gchar *file, | 161 | static gint ftp_prepare_get(struct obex_session *os, gchar *file, |
3752 | @@ -465,8 +464,8 @@ | |||
3753 | 465 | .record = PCSUITE_RECORD, | 464 | .record = PCSUITE_RECORD, |
3754 | 466 | .target = FTP_TARGET, | 465 | .target = FTP_TARGET, |
3755 | 467 | .target_size = TARGET_SIZE, | 466 | .target_size = TARGET_SIZE, |
3758 | 468 | .who = PCSUITE_TARGET, | 467 | .who = PCSUITE_WHO, |
3759 | 469 | .who_size = TARGET_SIZE, | 468 | .who_size = PCSUITE_WHO_SIZE, |
3760 | 470 | .connect = ftp_connect, | 469 | .connect = ftp_connect, |
3761 | 471 | .get = ftp_get, | 470 | .get = ftp_get, |
3762 | 472 | .put = ftp_put, | 471 | .put = ftp_put, |
3763 | 473 | 472 | ||
3764 | === modified file 'plugins/opp.c' | |||
3765 | --- plugins/opp.c 2010-01-10 10:46:58 +0000 | |||
3766 | +++ plugins/opp.c 2010-04-28 20:38:30 +0000 | |||
3767 | @@ -2,9 +2,8 @@ | |||
3768 | 2 | * | 2 | * |
3769 | 3 | * OBEX Server | 3 | * OBEX Server |
3770 | 4 | * | 4 | * |
3774 | 5 | * Copyright (C) 2007-2008 Nokia Corporation | 5 | * Copyright (C) 2007-2010 Nokia Corporation |
3775 | 6 | * Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT) | 6 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
3773 | 7 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | ||
3776 | 8 | * | 7 | * |
3777 | 9 | * | 8 | * |
3778 | 10 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
3779 | @@ -193,8 +192,11 @@ | |||
3780 | 193 | goto fail; | 192 | goto fail; |
3781 | 194 | 193 | ||
3782 | 195 | if (g_str_equal(os->type, VCARD_TYPE)) { | 194 | if (g_str_equal(os->type, VCARD_TYPE)) { |
3785 | 196 | if (os_prepare_get(os, VCARD_FILE, &size) < 0) | 195 | if (os_prepare_get(os, VCARD_FILE, &size) < 0) { |
3786 | 197 | goto fail; | 196 | OBEX_ObjectSetRsp(obj, OBEX_RSP_NOT_FOUND, |
3787 | 197 | OBEX_RSP_NOT_FOUND); | ||
3788 | 198 | return; | ||
3789 | 199 | } | ||
3790 | 198 | } else | 200 | } else |
3791 | 199 | goto fail; | 201 | goto fail; |
3792 | 200 | 202 | ||
3793 | 201 | 203 | ||
3794 | === modified file 'plugins/pbap.c' | |||
3795 | --- plugins/pbap.c 2010-01-10 10:46:58 +0000 | |||
3796 | +++ plugins/pbap.c 2010-04-28 20:38:30 +0000 | |||
3797 | @@ -2,8 +2,8 @@ | |||
3798 | 2 | * | 2 | * |
3799 | 3 | * OBEX Server | 3 | * OBEX Server |
3800 | 4 | * | 4 | * |
3803 | 5 | * Copyright (C) 2009 Intel Corporation | 5 | * Copyright (C) 2009-2010 Intel Corporation |
3804 | 6 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 6 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
3805 | 7 | * | 7 | * |
3806 | 8 | * | 8 | * |
3807 | 9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
3808 | @@ -558,6 +558,12 @@ | |||
3809 | 558 | unregister_session(os->cid); | 558 | unregister_session(os->cid); |
3810 | 559 | } | 559 | } |
3811 | 560 | 560 | ||
3812 | 561 | static gint pbap_chkput(obex_t *obex, obex_object_t *obj) | ||
3813 | 562 | { | ||
3814 | 563 | /* Rejects all PUTs */ | ||
3815 | 564 | return -EINVAL; | ||
3816 | 565 | } | ||
3817 | 566 | |||
3818 | 561 | struct obex_service_driver pbap = { | 567 | struct obex_service_driver pbap = { |
3819 | 562 | .name = "Phonebook Access server", | 568 | .name = "Phonebook Access server", |
3820 | 563 | .service = OBEX_PBAP, | 569 | .service = OBEX_PBAP, |
3821 | @@ -568,7 +574,8 @@ | |||
3822 | 568 | .connect = pbap_connect, | 574 | .connect = pbap_connect, |
3823 | 569 | .get = pbap_get, | 575 | .get = pbap_get, |
3824 | 570 | .setpath = pbap_setpath, | 576 | .setpath = pbap_setpath, |
3826 | 571 | .disconnect = pbap_disconnect | 577 | .disconnect = pbap_disconnect, |
3827 | 578 | .chkput = pbap_chkput | ||
3828 | 572 | }; | 579 | }; |
3829 | 573 | 580 | ||
3830 | 574 | static int pbap_init(void) | 581 | static int pbap_init(void) |
3831 | 575 | 582 | ||
3832 | === modified file 'plugins/phonebook-dummy.c' | |||
3833 | --- plugins/phonebook-dummy.c 2010-01-10 10:46:58 +0000 | |||
3834 | +++ plugins/phonebook-dummy.c 2010-04-28 20:38:30 +0000 | |||
3835 | @@ -2,8 +2,8 @@ | |||
3836 | 2 | * | 2 | * |
3837 | 3 | * OBEX Server | 3 | * OBEX Server |
3838 | 4 | * | 4 | * |
3841 | 5 | * Copyright (C) 2009 Intel Corporation | 5 | * Copyright (C) 2009-2010 Intel Corporation |
3842 | 6 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 6 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
3843 | 7 | * | 7 | * |
3844 | 8 | * | 8 | * |
3845 | 9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
3846 | 10 | 10 | ||
3847 | === modified file 'plugins/phonebook-ebook.c' | |||
3848 | --- plugins/phonebook-ebook.c 2010-01-10 10:46:58 +0000 | |||
3849 | +++ plugins/phonebook-ebook.c 2010-04-28 20:38:30 +0000 | |||
3850 | @@ -2,8 +2,8 @@ | |||
3851 | 2 | * | 2 | * |
3852 | 3 | * OBEX Server | 3 | * OBEX Server |
3853 | 4 | * | 4 | * |
3856 | 5 | * Copyright (C) 2009 Intel Corporation | 5 | * Copyright (C) 2009-2010 Intel Corporation |
3857 | 6 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 6 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
3858 | 7 | * | 7 | * |
3859 | 8 | * | 8 | * |
3860 | 9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
3861 | @@ -113,7 +113,7 @@ | |||
3862 | 113 | for (l = attrib_list; l; l = l->next) { | 113 | for (l = attrib_list; l; l = l->next) { |
3863 | 114 | int i; | 114 | int i; |
3864 | 115 | const char *attrib_name = e_vcard_attribute_get_name( | 115 | const char *attrib_name = e_vcard_attribute_get_name( |
3866 | 116 | (EVCardAttribute *)l->data); | 116 | (EVCardAttribute *) l->data); |
3867 | 117 | 117 | ||
3868 | 118 | for (i = 0; i <= 28; i++) { | 118 | for (i = 0; i <= 28; i++) { |
3869 | 119 | int mask; | 119 | int mask; |
3870 | @@ -123,10 +123,9 @@ | |||
3871 | 123 | continue; | 123 | continue; |
3872 | 124 | if (g_strcmp0(vcard_attribs[i], attrib_name)) | 124 | if (g_strcmp0(vcard_attribs[i], attrib_name)) |
3873 | 125 | continue; | 125 | continue; |
3878 | 126 | e_vcard_add_attribute( | 126 | e_vcard_add_attribute(evcard_filtered, |
3879 | 127 | evcard_filtered, | 127 | e_vcard_attribute_copy( |
3880 | 128 | e_vcard_attribute_copy( | 128 | (EVCardAttribute *) l->data)); |
3877 | 129 | (EVCardAttribute *)l->data)); | ||
3881 | 130 | break; | 129 | break; |
3882 | 131 | } | 130 | } |
3883 | 132 | } | 131 | } |
3884 | @@ -365,7 +364,7 @@ | |||
3885 | 365 | for (l = attrib_list; l; l = l->next) { | 364 | for (l = attrib_list; l; l = l->next) { |
3886 | 366 | int i; | 365 | int i; |
3887 | 367 | const char *attrib_name = e_vcard_attribute_get_name( | 366 | const char *attrib_name = e_vcard_attribute_get_name( |
3889 | 368 | (EVCardAttribute *)l->data); | 367 | (EVCardAttribute *) l->data); |
3890 | 369 | for (i = 0; i <= 28; i++) { | 368 | for (i = 0; i <= 28; i++) { |
3891 | 370 | int mask; | 369 | int mask; |
3892 | 371 | 370 | ||
3893 | @@ -375,11 +374,10 @@ | |||
3894 | 375 | if (g_strcmp0(vcard_attribs[i], attrib_name)) | 374 | if (g_strcmp0(vcard_attribs[i], attrib_name)) |
3895 | 376 | continue; | 375 | continue; |
3896 | 377 | 376 | ||
3902 | 378 | e_vcard_add_attribute( | 377 | e_vcard_add_attribute(evcard_filtered, |
3903 | 379 | evcard_filtered, | 378 | e_vcard_attribute_copy( |
3904 | 380 | e_vcard_attribute_copy( | 379 | (EVCardAttribute *) l->data)); |
3905 | 381 | (EVCardAttribute *)l->data)); | 380 | break; |
3901 | 382 | break; | ||
3906 | 383 | } | 381 | } |
3907 | 384 | } | 382 | } |
3908 | 385 | vcard = e_vcard_to_string(evcard_filtered, params->format); | 383 | vcard = e_vcard_to_string(evcard_filtered, params->format); |
3909 | 386 | 384 | ||
3910 | === modified file 'plugins/phonebook.h' | |||
3911 | --- plugins/phonebook.h 2010-01-10 10:46:58 +0000 | |||
3912 | +++ plugins/phonebook.h 2010-04-28 20:38:30 +0000 | |||
3913 | @@ -2,7 +2,7 @@ | |||
3914 | 2 | * | 2 | * |
3915 | 3 | * OBEX Server | 3 | * OBEX Server |
3916 | 4 | * | 4 | * |
3918 | 5 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
3919 | 6 | * | 6 | * |
3920 | 7 | * | 7 | * |
3921 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
3922 | 9 | 9 | ||
3923 | === modified file 'plugins/syncevolution.c' | |||
3924 | --- plugins/syncevolution.c 2010-01-10 10:46:58 +0000 | |||
3925 | +++ plugins/syncevolution.c 2010-04-28 20:38:30 +0000 | |||
3926 | @@ -2,8 +2,8 @@ | |||
3927 | 2 | * | 2 | * |
3928 | 3 | * OBEX Server | 3 | * OBEX Server |
3929 | 4 | * | 4 | * |
3932 | 5 | * Copyright (C) 2007-2008 Intel Corporation | 5 | * Copyright (C) 2007-2010 Intel Corporation |
3933 | 6 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 6 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
3934 | 7 | * | 7 | * |
3935 | 8 | * | 8 | * |
3936 | 9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
3937 | @@ -43,6 +43,7 @@ | |||
3938 | 43 | #include "dbus.h" | 43 | #include "dbus.h" |
3939 | 44 | #include "btio.h" | 44 | #include "btio.h" |
3940 | 45 | #include "obexd.h" | 45 | #include "obexd.h" |
3941 | 46 | #include "gdbus.h" | ||
3942 | 46 | 47 | ||
3943 | 47 | #define SYNCML_TARGET_SIZE 11 | 48 | #define SYNCML_TARGET_SIZE 11 |
3944 | 48 | 49 | ||
3945 | @@ -85,13 +86,13 @@ | |||
3946 | 85 | #define SYNCE_SERVER_INTERFACE "org.syncevolution.Server" | 86 | #define SYNCE_SERVER_INTERFACE "org.syncevolution.Server" |
3947 | 86 | #define SYNCE_CONN_INTERFACE "org.syncevolution.Connection" | 87 | #define SYNCE_CONN_INTERFACE "org.syncevolution.Connection" |
3948 | 87 | 88 | ||
3949 | 88 | static char match_string[256]; | ||
3950 | 89 | |||
3951 | 90 | struct synce_context { | 89 | struct synce_context { |
3952 | 91 | struct obex_session *os; | 90 | struct obex_session *os; |
3953 | 92 | DBusConnection *dbus_conn; | 91 | DBusConnection *dbus_conn; |
3954 | 93 | gchar *conn_obj; | 92 | gchar *conn_obj; |
3955 | 94 | gboolean reply_received; | 93 | gboolean reply_received; |
3956 | 94 | guint reply_watch; | ||
3957 | 95 | guint abort_watch; | ||
3958 | 95 | }; | 96 | }; |
3959 | 96 | 97 | ||
3960 | 97 | struct callback_data { | 98 | struct callback_data { |
3961 | @@ -115,20 +116,6 @@ | |||
3962 | 115 | return NULL; | 116 | return NULL; |
3963 | 116 | } | 117 | } |
3964 | 117 | 118 | ||
3965 | 118 | static struct synce_context *find_context_by_conn_obj(const char *path) | ||
3966 | 119 | { | ||
3967 | 120 | GSList *l; | ||
3968 | 121 | |||
3969 | 122 | for (l = context_list; l != NULL; l = l->next) { | ||
3970 | 123 | struct synce_context *context = l->data; | ||
3971 | 124 | |||
3972 | 125 | if (strcmp(context->conn_obj, path) == 0) | ||
3973 | 126 | return context; | ||
3974 | 127 | } | ||
3975 | 128 | |||
3976 | 129 | return NULL; | ||
3977 | 130 | } | ||
3978 | 131 | |||
3979 | 132 | static void append_dict_entry(DBusMessageIter *dict, const char *key, | 119 | static void append_dict_entry(DBusMessageIter *dict, const char *key, |
3980 | 133 | int type, void *val) | 120 | int type, void *val) |
3981 | 134 | { | 121 | { |
3982 | @@ -141,17 +128,18 @@ | |||
3983 | 141 | dbus_message_iter_close_container(dict, &entry); | 128 | dbus_message_iter_close_container(dict, &entry); |
3984 | 142 | } | 129 | } |
3985 | 143 | 130 | ||
3988 | 144 | static void handle_connection_reply_signal(DBusMessage *msg, | 131 | static gboolean reply_signal(DBusConnection *conn, DBusMessage *msg, |
3989 | 145 | const char *obj_path, void *data) | 132 | void *data) |
3990 | 146 | { | 133 | { |
3991 | 147 | struct synce_context *context = data; | 134 | struct synce_context *context = data; |
3992 | 148 | struct obex_session *os = context->os; | 135 | struct obex_session *os = context->os; |
3993 | 136 | const char *path = dbus_message_get_path(msg); | ||
3994 | 149 | DBusMessageIter iter, array_iter; | 137 | DBusMessageIter iter, array_iter; |
3995 | 150 | gchar *value; | 138 | gchar *value; |
3996 | 151 | gint length; | 139 | gint length; |
3997 | 152 | 140 | ||
4000 | 153 | if (strcmp(context->conn_obj, obj_path) != 0) | 141 | if (strcmp(context->conn_obj, path) != 0) |
4001 | 154 | return; | 142 | return FALSE; |
4002 | 155 | 143 | ||
4003 | 156 | dbus_message_iter_init(msg, &iter); | 144 | dbus_message_iter_init(msg, &iter); |
4004 | 157 | 145 | ||
4005 | @@ -159,7 +147,7 @@ | |||
4006 | 159 | dbus_message_iter_get_fixed_array(&array_iter, &value, &length); | 147 | dbus_message_iter_get_fixed_array(&array_iter, &value, &length); |
4007 | 160 | 148 | ||
4008 | 161 | if (length == 0) | 149 | if (length == 0) |
4010 | 162 | return; | 150 | return TRUE; |
4011 | 163 | 151 | ||
4012 | 164 | os->buf = g_malloc(length); | 152 | os->buf = g_malloc(length); |
4013 | 165 | memcpy(os->buf, value, length); | 153 | memcpy(os->buf, value, length); |
4014 | @@ -167,10 +155,12 @@ | |||
4015 | 167 | os->finished = TRUE; | 155 | os->finished = TRUE; |
4016 | 168 | context->reply_received = TRUE; | 156 | context->reply_received = TRUE; |
4017 | 169 | OBEX_ResumeRequest(os->obex); | 157 | OBEX_ResumeRequest(os->obex); |
4018 | 158 | |||
4019 | 159 | return TRUE; | ||
4020 | 170 | } | 160 | } |
4021 | 171 | 161 | ||
4024 | 172 | static void handle_connection_abort_signal(DBusMessage *msg, | 162 | static gboolean abort_signal(DBusConnection *conn, DBusMessage *msg, |
4025 | 173 | const char *obj_path, void *data) | 163 | void *data) |
4026 | 174 | { | 164 | { |
4027 | 175 | struct synce_context *context = data; | 165 | struct synce_context *context = data; |
4028 | 176 | struct obex_session *os = context->os; | 166 | struct obex_session *os = context->os; |
4029 | @@ -179,35 +169,12 @@ | |||
4030 | 179 | os->finished = TRUE; | 169 | os->finished = TRUE; |
4031 | 180 | OBEX_ResumeRequest(os->obex); | 170 | OBEX_ResumeRequest(os->obex); |
4032 | 181 | OBEX_TransportDisconnect(os->obex); | 171 | OBEX_TransportDisconnect(os->obex); |
4057 | 182 | } | 172 | |
4058 | 183 | 173 | return TRUE; | |
4035 | 184 | static DBusHandlerResult signal_filter(DBusConnection *conn, | ||
4036 | 185 | DBusMessage *msg, void *data) | ||
4037 | 186 | { | ||
4038 | 187 | const char *path = dbus_message_get_path(msg); | ||
4039 | 188 | struct synce_context *context; | ||
4040 | 189 | |||
4041 | 190 | if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL) | ||
4042 | 191 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | ||
4043 | 192 | |||
4044 | 193 | context = find_context_by_conn_obj(path); | ||
4045 | 194 | if (!context) | ||
4046 | 195 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | ||
4047 | 196 | |||
4048 | 197 | if (dbus_message_is_signal(msg, SYNCE_CONN_INTERFACE, "Reply")) { | ||
4049 | 198 | debug("Reply signal is received."); | ||
4050 | 199 | handle_connection_reply_signal(msg, path, context); | ||
4051 | 200 | } else if (dbus_message_is_signal(msg, SYNCE_CONN_INTERFACE, "Abort")) { | ||
4052 | 201 | debug("Abort signal is received."); | ||
4053 | 202 | handle_connection_abort_signal(msg, path, context); | ||
4054 | 203 | } | ||
4055 | 204 | |||
4056 | 205 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | ||
4059 | 206 | } | 174 | } |
4060 | 207 | 175 | ||
4061 | 208 | static void connect_cb(DBusPendingCall *call, void *user_data) | 176 | static void connect_cb(DBusPendingCall *call, void *user_data) |
4062 | 209 | { | 177 | { |
4063 | 210 | static gboolean signal_filter_added = FALSE; | ||
4064 | 211 | struct callback_data *cb_data = user_data; | 178 | struct callback_data *cb_data = user_data; |
4065 | 212 | obex_t *obex = cb_data->obex; | 179 | obex_t *obex = cb_data->obex; |
4066 | 213 | obex_object_t *obj = cb_data->obj; | 180 | obex_object_t *obj = cb_data->obj; |
4067 | @@ -240,22 +207,13 @@ | |||
4068 | 240 | debug("Got conn object %s from syncevolution", path); | 207 | debug("Got conn object %s from syncevolution", path); |
4069 | 241 | context->conn_obj = g_strdup(path); | 208 | context->conn_obj = g_strdup(path); |
4070 | 242 | 209 | ||
4082 | 243 | /* add signal filter */ | 210 | context->reply_watch = g_dbus_add_signal_watch(conn, NULL, path, |
4083 | 244 | if (!signal_filter_added) { | 211 | SYNCE_CONN_INTERFACE, "Reply", |
4084 | 245 | if (!dbus_connection_add_filter(conn, signal_filter, | 212 | reply_signal, context, NULL); |
4074 | 246 | os, NULL)) { | ||
4075 | 247 | error("Can't add signal filter"); | ||
4076 | 248 | dbus_message_unref(reply); | ||
4077 | 249 | g_free(cb_data); | ||
4078 | 250 | goto failed; | ||
4079 | 251 | } | ||
4080 | 252 | signal_filter_added = TRUE; | ||
4081 | 253 | } | ||
4085 | 254 | 213 | ||
4090 | 255 | snprintf(match_string, sizeof(match_string), "type=signal,interface=%s," | 214 | context->abort_watch = g_dbus_add_signal_watch(conn, NULL, path, |
4091 | 256 | "path=%s", SYNCE_CONN_INTERFACE, context->conn_obj); | 215 | SYNCE_CONN_INTERFACE, "Abort", |
4092 | 257 | dbus_bus_add_match(conn, match_string, NULL); | 216 | abort_signal, context, NULL); |
4089 | 258 | dbus_connection_flush(conn); | ||
4093 | 259 | 217 | ||
4094 | 260 | dbus_message_unref(reply); | 218 | dbus_message_unref(reply); |
4095 | 261 | g_free(cb_data); | 219 | g_free(cb_data); |
4096 | @@ -311,7 +269,7 @@ | |||
4097 | 311 | struct callback_data *cb_data; | 269 | struct callback_data *cb_data; |
4098 | 312 | struct synce_context *context; | 270 | struct synce_context *context; |
4099 | 313 | 271 | ||
4101 | 314 | conn = dbus_bus_get(DBUS_BUS_SESSION, NULL); | 272 | conn = obex_dbus_get_connection(); |
4102 | 315 | if (!conn) | 273 | if (!conn) |
4103 | 316 | goto failed; | 274 | goto failed; |
4104 | 317 | 275 | ||
4105 | @@ -507,10 +465,11 @@ | |||
4106 | 507 | dbus_pending_call_unref(call); | 465 | dbus_pending_call_unref(call); |
4107 | 508 | 466 | ||
4108 | 509 | failed: | 467 | failed: |
4113 | 510 | snprintf(match_string, sizeof(match_string), | 468 | g_dbus_remove_watch(context->dbus_conn, context->reply_watch); |
4114 | 511 | "type=signal,interface=%s,path=%s", | 469 | context->reply_watch = 0; |
4115 | 512 | SYNCE_CONN_INTERFACE, context->conn_obj); | 470 | g_dbus_remove_watch(context->dbus_conn, context->abort_watch); |
4116 | 513 | dbus_bus_remove_match(context->dbus_conn, match_string, NULL); | 471 | context->abort_watch = 0; |
4117 | 472 | |||
4118 | 514 | g_free(context->conn_obj); | 473 | g_free(context->conn_obj); |
4119 | 515 | context->conn_obj = NULL; | 474 | context->conn_obj = NULL; |
4120 | 516 | 475 | ||
4121 | 517 | 476 | ||
4122 | === modified file 'plugins/telephony-dummy.c' | |||
4123 | --- plugins/telephony-dummy.c 2010-01-10 10:46:58 +0000 | |||
4124 | +++ plugins/telephony-dummy.c 2010-04-28 20:38:30 +0000 | |||
4125 | @@ -2,8 +2,8 @@ | |||
4126 | 2 | * | 2 | * |
4127 | 3 | * OBEX Server | 3 | * OBEX Server |
4128 | 4 | * | 4 | * |
4131 | 5 | * Copyright (C) 2009 Intel Corporation | 5 | * Copyright (C) 2009-2010 Intel Corporation |
4132 | 6 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 6 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4133 | 7 | * | 7 | * |
4134 | 8 | * | 8 | * |
4135 | 9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
4136 | 10 | 10 | ||
4137 | === modified file 'plugins/telephony.h' | |||
4138 | --- plugins/telephony.h 2010-01-10 10:46:58 +0000 | |||
4139 | +++ plugins/telephony.h 2010-04-28 20:38:30 +0000 | |||
4140 | @@ -2,7 +2,7 @@ | |||
4141 | 2 | * | 2 | * |
4142 | 3 | * OBEX Server | 3 | * OBEX Server |
4143 | 4 | * | 4 | * |
4145 | 5 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4146 | 6 | * | 6 | * |
4147 | 7 | * | 7 | * |
4148 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
4149 | 9 | 9 | ||
4150 | === modified file 'src/bluetooth.c' | |||
4151 | --- src/bluetooth.c 2010-01-10 10:46:58 +0000 | |||
4152 | +++ src/bluetooth.c 2010-04-28 20:38:30 +0000 | |||
4153 | @@ -2,9 +2,8 @@ | |||
4154 | 2 | * | 2 | * |
4155 | 3 | * OBEX Server | 3 | * OBEX Server |
4156 | 4 | * | 4 | * |
4160 | 5 | * Copyright (C) 2007-2008 Nokia Corporation | 5 | * Copyright (C) 2007-2010 Nokia Corporation |
4161 | 6 | * Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT) | 6 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4159 | 7 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | ||
4162 | 8 | * | 7 | * |
4163 | 9 | * | 8 | * |
4164 | 10 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
4165 | 11 | 10 | ||
4166 | === modified file 'src/bluetooth.h' | |||
4167 | --- src/bluetooth.h 2010-01-10 10:46:58 +0000 | |||
4168 | +++ src/bluetooth.h 2010-04-28 20:38:30 +0000 | |||
4169 | @@ -2,9 +2,8 @@ | |||
4170 | 2 | * | 2 | * |
4171 | 3 | * OBEX Server | 3 | * OBEX Server |
4172 | 4 | * | 4 | * |
4176 | 5 | * Copyright (C) 2007-2008 Nokia Corporation | 5 | * Copyright (C) 2007-2010 Nokia Corporation |
4177 | 6 | * Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT) | 6 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4175 | 7 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | ||
4178 | 8 | * | 7 | * |
4179 | 9 | * | 8 | * |
4180 | 10 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
4181 | 11 | 10 | ||
4182 | === modified file 'src/btio.c' | |||
4183 | --- src/btio.c 2010-01-10 10:46:58 +0000 | |||
4184 | +++ src/btio.c 2010-04-28 20:38:30 +0000 | |||
4185 | @@ -2,8 +2,8 @@ | |||
4186 | 2 | * | 2 | * |
4187 | 3 | * BlueZ - Bluetooth protocol stack for Linux | 3 | * BlueZ - Bluetooth protocol stack for Linux |
4188 | 4 | * | 4 | * |
4191 | 5 | * Copyright (C) 2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2009-2010 Marcel Holtmann <marcel@holtmann.org> |
4192 | 6 | * Copyright (C) 2009 Nokia Corporation | 6 | * Copyright (C) 2009-2010 Nokia Corporation |
4193 | 7 | * | 7 | * |
4194 | 8 | * | 8 | * |
4195 | 9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
4196 | 10 | 10 | ||
4197 | === modified file 'src/btio.h' | |||
4198 | --- src/btio.h 2010-01-10 10:46:58 +0000 | |||
4199 | +++ src/btio.h 2010-04-28 20:38:30 +0000 | |||
4200 | @@ -2,8 +2,8 @@ | |||
4201 | 2 | * | 2 | * |
4202 | 3 | * BlueZ - Bluetooth protocol stack for Linux | 3 | * BlueZ - Bluetooth protocol stack for Linux |
4203 | 4 | * | 4 | * |
4206 | 5 | * Copyright (C) 2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2009-2010 Marcel Holtmann <marcel@holtmann.org> |
4207 | 6 | * Copyright (C) 2009 Nokia Corporation | 6 | * Copyright (C) 2009-2010 Nokia Corporation |
4208 | 7 | * | 7 | * |
4209 | 8 | * | 8 | * |
4210 | 9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
4211 | 10 | 10 | ||
4212 | === modified file 'src/dbus.h' | |||
4213 | --- src/dbus.h 2009-07-27 19:02:30 +0000 | |||
4214 | +++ src/dbus.h 2010-04-28 20:38:30 +0000 | |||
4215 | @@ -2,7 +2,7 @@ | |||
4216 | 2 | * | 2 | * |
4217 | 3 | * OBEX Server | 3 | * OBEX Server |
4218 | 4 | * | 4 | * |
4220 | 5 | * Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT) | 5 | * Copyright (C) 2007-2010 Nokia Corporation |
4221 | 6 | * | 6 | * |
4222 | 7 | * | 7 | * |
4223 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
4224 | 9 | 9 | ||
4225 | === modified file 'src/logging.c' | |||
4226 | --- src/logging.c 2009-07-27 19:02:30 +0000 | |||
4227 | +++ src/logging.c 2010-04-28 20:38:30 +0000 | |||
4228 | @@ -2,7 +2,7 @@ | |||
4229 | 2 | * | 2 | * |
4230 | 3 | * OBEX Server | 3 | * OBEX Server |
4231 | 4 | * | 4 | * |
4233 | 5 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4234 | 6 | * | 6 | * |
4235 | 7 | * | 7 | * |
4236 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
4237 | 9 | 9 | ||
4238 | === modified file 'src/logging.h' | |||
4239 | --- src/logging.h 2009-07-27 19:02:30 +0000 | |||
4240 | +++ src/logging.h 2010-04-28 20:38:30 +0000 | |||
4241 | @@ -2,7 +2,7 @@ | |||
4242 | 2 | * | 2 | * |
4243 | 3 | * OBEX Server | 3 | * OBEX Server |
4244 | 4 | * | 4 | * |
4246 | 5 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4247 | 6 | * | 6 | * |
4248 | 7 | * | 7 | * |
4249 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
4250 | 9 | 9 | ||
4251 | === modified file 'src/main.c' | |||
4252 | --- src/main.c 2010-01-10 10:46:58 +0000 | |||
4253 | +++ src/main.c 2010-04-28 20:38:30 +0000 | |||
4254 | @@ -2,7 +2,7 @@ | |||
4255 | 2 | * | 2 | * |
4256 | 3 | * OBEX Server | 3 | * OBEX Server |
4257 | 4 | * | 4 | * |
4259 | 5 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4260 | 6 | * | 6 | * |
4261 | 7 | * | 7 | * |
4262 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
4263 | 9 | 9 | ||
4264 | === modified file 'src/manager.c' | |||
4265 | --- src/manager.c 2010-01-10 10:46:58 +0000 | |||
4266 | +++ src/manager.c 2010-04-28 20:38:30 +0000 | |||
4267 | @@ -2,7 +2,7 @@ | |||
4268 | 2 | * | 2 | * |
4269 | 3 | * OBEX Server | 3 | * OBEX Server |
4270 | 4 | * | 4 | * |
4272 | 5 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4273 | 6 | * | 6 | * |
4274 | 7 | * | 7 | * |
4275 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
4276 | @@ -528,7 +528,8 @@ | |||
4277 | 528 | 528 | ||
4278 | 529 | dbus_error_init(&err); | 529 | dbus_error_init(&err); |
4279 | 530 | 530 | ||
4281 | 531 | connection = g_dbus_setup_bus(DBUS_BUS_SESSION, OPENOBEX_SERVICE, &err); | 531 | connection = g_dbus_setup_private(DBUS_BUS_SESSION, OPENOBEX_SERVICE, |
4282 | 532 | &err); | ||
4283 | 532 | if (connection == NULL) { | 533 | if (connection == NULL) { |
4284 | 533 | if (dbus_error_is_set(&err) == TRUE) { | 534 | if (dbus_error_is_set(&err) == TRUE) { |
4285 | 534 | fprintf(stderr, "%s\n", err.message); | 535 | fprintf(stderr, "%s\n", err.message); |
4286 | @@ -539,8 +540,11 @@ | |||
4287 | 539 | } | 540 | } |
4288 | 540 | 541 | ||
4289 | 541 | system_conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, NULL); | 542 | system_conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, NULL); |
4291 | 542 | if (system_conn == NULL) | 543 | if (system_conn == NULL) { |
4292 | 544 | dbus_connection_unref(connection); | ||
4293 | 545 | connection = NULL; | ||
4294 | 543 | return FALSE; | 546 | return FALSE; |
4295 | 547 | } | ||
4296 | 544 | 548 | ||
4297 | 545 | listener_id = g_dbus_add_service_watch(system_conn, "org.bluez", | 549 | listener_id = g_dbus_add_service_watch(system_conn, "org.bluez", |
4298 | 546 | name_acquired, name_released, NULL, NULL); | 550 | name_acquired, name_released, NULL, NULL); |
4299 | @@ -1028,4 +1032,10 @@ | |||
4300 | 1028 | g_free(path); | 1032 | g_free(path); |
4301 | 1029 | } | 1033 | } |
4302 | 1030 | 1034 | ||
4303 | 1035 | DBusConnection *obex_dbus_get_connection(void) | ||
4304 | 1036 | { | ||
4305 | 1037 | if (connection == NULL) | ||
4306 | 1038 | return NULL; | ||
4307 | 1031 | 1039 | ||
4308 | 1040 | return dbus_connection_ref(connection); | ||
4309 | 1041 | } | ||
4310 | 1032 | 1042 | ||
4311 | === modified file 'src/mimetype.c' | |||
4312 | --- src/mimetype.c 2010-01-10 10:46:58 +0000 | |||
4313 | +++ src/mimetype.c 2010-04-28 20:38:30 +0000 | |||
4314 | @@ -2,7 +2,7 @@ | |||
4315 | 2 | * | 2 | * |
4316 | 3 | * OBEX Server | 3 | * OBEX Server |
4317 | 4 | * | 4 | * |
4319 | 5 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4320 | 6 | * | 6 | * |
4321 | 7 | * | 7 | * |
4322 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
4323 | @@ -38,6 +38,85 @@ | |||
4324 | 38 | 38 | ||
4325 | 39 | static GSList *drivers = NULL; | 39 | static GSList *drivers = NULL; |
4326 | 40 | 40 | ||
4327 | 41 | static GSList *watches = NULL; | ||
4328 | 42 | |||
4329 | 43 | struct io_watch { | ||
4330 | 44 | gpointer object; | ||
4331 | 45 | obex_object_io_func func; | ||
4332 | 46 | gpointer user_data; | ||
4333 | 47 | }; | ||
4334 | 48 | |||
4335 | 49 | void obex_object_set_io_flags(gpointer object, int flags, int err) | ||
4336 | 50 | { | ||
4337 | 51 | GSList *l; | ||
4338 | 52 | |||
4339 | 53 | for (l = watches; l; l = l->next) { | ||
4340 | 54 | struct io_watch *watch = l->data; | ||
4341 | 55 | |||
4342 | 56 | if (watch->object != object) | ||
4343 | 57 | continue; | ||
4344 | 58 | |||
4345 | 59 | if (watch->func(object, flags, err, watch->user_data) == TRUE) | ||
4346 | 60 | continue; | ||
4347 | 61 | |||
4348 | 62 | if (g_slist_find(watches, watch) == NULL) | ||
4349 | 63 | continue; | ||
4350 | 64 | |||
4351 | 65 | watches = g_slist_remove(watches, watch); | ||
4352 | 66 | g_free(watch); | ||
4353 | 67 | } | ||
4354 | 68 | } | ||
4355 | 69 | |||
4356 | 70 | static struct io_watch *find_io_watch(gpointer object) | ||
4357 | 71 | { | ||
4358 | 72 | GSList *l; | ||
4359 | 73 | |||
4360 | 74 | for (l = watches; l; l = l->next) { | ||
4361 | 75 | struct io_watch *watch = l->data; | ||
4362 | 76 | |||
4363 | 77 | if (watch->object == object) | ||
4364 | 78 | return watch; | ||
4365 | 79 | } | ||
4366 | 80 | |||
4367 | 81 | return NULL; | ||
4368 | 82 | } | ||
4369 | 83 | |||
4370 | 84 | static void reset_io_watch(gpointer object) | ||
4371 | 85 | { | ||
4372 | 86 | struct io_watch *watch; | ||
4373 | 87 | |||
4374 | 88 | watch = find_io_watch(object); | ||
4375 | 89 | if (watch == NULL) | ||
4376 | 90 | return; | ||
4377 | 91 | |||
4378 | 92 | watches = g_slist_remove(watches, watch); | ||
4379 | 93 | g_free(watch); | ||
4380 | 94 | } | ||
4381 | 95 | |||
4382 | 96 | static int set_io_watch(gpointer object, obex_object_io_func func, | ||
4383 | 97 | gpointer user_data) | ||
4384 | 98 | { | ||
4385 | 99 | struct io_watch *watch; | ||
4386 | 100 | |||
4387 | 101 | if (func == NULL) { | ||
4388 | 102 | reset_io_watch(object); | ||
4389 | 103 | return 0; | ||
4390 | 104 | } | ||
4391 | 105 | |||
4392 | 106 | watch = find_io_watch(object); | ||
4393 | 107 | if (watch) | ||
4394 | 108 | return -EPERM; | ||
4395 | 109 | |||
4396 | 110 | watch = g_new0(struct io_watch, 1); | ||
4397 | 111 | watch->object = object; | ||
4398 | 112 | watch->func = func; | ||
4399 | 113 | watch->user_data = user_data; | ||
4400 | 114 | |||
4401 | 115 | watches = g_slist_append(watches, watch); | ||
4402 | 116 | |||
4403 | 117 | return 0; | ||
4404 | 118 | } | ||
4405 | 119 | |||
4406 | 41 | struct obex_mime_type_driver *obex_mime_type_driver_find(const guint8 *target, const char *mimetype) | 120 | struct obex_mime_type_driver *obex_mime_type_driver_find(const guint8 *target, const char *mimetype) |
4407 | 42 | { | 121 | { |
4408 | 43 | GSList *l; | 122 | GSList *l; |
4409 | @@ -68,6 +147,9 @@ | |||
4410 | 68 | return -EPERM; | 147 | return -EPERM; |
4411 | 69 | } | 148 | } |
4412 | 70 | 149 | ||
4413 | 150 | if (driver->set_io_watch == NULL) | ||
4414 | 151 | driver->set_io_watch = set_io_watch; | ||
4415 | 152 | |||
4416 | 71 | debug("driver %p mimetype %s registered", driver, driver->mimetype); | 153 | debug("driver %p mimetype %s registered", driver, driver->mimetype); |
4417 | 72 | 154 | ||
4418 | 73 | drivers = g_slist_append(drivers, driver); | 155 | drivers = g_slist_append(drivers, driver); |
4419 | 74 | 156 | ||
4420 | === modified file 'src/mimetype.h' | |||
4421 | --- src/mimetype.h 2010-01-10 10:46:58 +0000 | |||
4422 | +++ src/mimetype.h 2010-04-28 20:38:30 +0000 | |||
4423 | @@ -2,7 +2,7 @@ | |||
4424 | 2 | * | 2 | * |
4425 | 3 | * OBEX Server | 3 | * OBEX Server |
4426 | 4 | * | 4 | * |
4428 | 5 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4429 | 6 | * | 6 | * |
4430 | 7 | * | 7 | * |
4431 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
4432 | @@ -23,17 +23,25 @@ | |||
4433 | 23 | 23 | ||
4434 | 24 | #define TARGET_SIZE 16 | 24 | #define TARGET_SIZE 16 |
4435 | 25 | 25 | ||
4436 | 26 | typedef gboolean (*obex_object_io_func) (gpointer object, int flags, int err, | ||
4437 | 27 | gpointer user_data); | ||
4438 | 28 | |||
4439 | 26 | struct obex_mime_type_driver { | 29 | struct obex_mime_type_driver { |
4440 | 27 | const guint8 *target; | 30 | const guint8 *target; |
4441 | 28 | const char *mimetype; | 31 | const char *mimetype; |
4443 | 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, |
4444 | 33 | size_t *size, int *err); | ||
4445 | 30 | int (*close) (gpointer object); | 34 | int (*close) (gpointer object); |
4446 | 31 | ssize_t (*read) (gpointer object, void *buf, size_t count); | 35 | ssize_t (*read) (gpointer object, void *buf, size_t count); |
4447 | 32 | ssize_t (*write) (gpointer object, const void *buf, size_t count); | 36 | ssize_t (*write) (gpointer object, const void *buf, size_t count); |
4448 | 33 | int (*remove) (const char *name); | 37 | int (*remove) (const char *name); |
4449 | 38 | int (*set_io_watch) (gpointer object, obex_object_io_func func, | ||
4450 | 39 | gpointer user_data); | ||
4451 | 34 | }; | 40 | }; |
4452 | 35 | 41 | ||
4453 | 36 | int obex_mime_type_driver_register(struct obex_mime_type_driver *driver); | 42 | int obex_mime_type_driver_register(struct obex_mime_type_driver *driver); |
4454 | 37 | void obex_mime_type_driver_unregister(struct obex_mime_type_driver *driver); | 43 | void obex_mime_type_driver_unregister(struct obex_mime_type_driver *driver); |
4455 | 38 | struct obex_mime_type_driver *obex_mime_type_driver_find(const guint8 *target, | 44 | struct obex_mime_type_driver *obex_mime_type_driver_find(const guint8 *target, |
4456 | 39 | const char *mimetype); | 45 | const char *mimetype); |
4457 | 46 | |||
4458 | 47 | void obex_object_set_io_flags(gpointer object, int flags, int err); | ||
4459 | 40 | 48 | ||
4460 | === modified file 'src/obex.c' | |||
4461 | --- src/obex.c 2010-01-10 10:46:58 +0000 | |||
4462 | +++ src/obex.c 2010-04-28 20:38:30 +0000 | |||
4463 | @@ -2,9 +2,8 @@ | |||
4464 | 2 | * | 2 | * |
4465 | 3 | * OBEX Server | 3 | * OBEX Server |
4466 | 4 | * | 4 | * |
4470 | 5 | * Copyright (C) 2007-2008 Nokia Corporation | 5 | * Copyright (C) 2007-2010 Nokia Corporation |
4471 | 6 | * Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT) | 6 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4469 | 7 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | ||
4472 | 8 | * | 7 | * |
4473 | 9 | * | 8 | * |
4474 | 10 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
4475 | @@ -68,8 +67,10 @@ | |||
4476 | 68 | static void os_reset_session(struct obex_session *os) | 67 | static void os_reset_session(struct obex_session *os) |
4477 | 69 | { | 68 | { |
4478 | 70 | if (os->object) { | 69 | if (os->object) { |
4479 | 70 | os->driver->set_io_watch(os->object, NULL, NULL); | ||
4480 | 71 | os->driver->close(os->object); | 71 | os->driver->close(os->object); |
4481 | 72 | os->object = NULL; | 72 | os->object = NULL; |
4482 | 73 | os->obj = NULL; | ||
4483 | 73 | if (os->aborted && os->cmd == OBEX_CMD_PUT && os->current_folder) { | 74 | if (os->aborted && os->cmd == OBEX_CMD_PUT && os->current_folder) { |
4484 | 74 | gchar *path; | 75 | gchar *path; |
4485 | 75 | path = g_build_filename(os->current_folder, os->name, NULL); | 76 | path = g_build_filename(os->current_folder, os->name, NULL); |
4486 | @@ -90,6 +91,7 @@ | |||
4487 | 90 | g_free(os->buf); | 91 | g_free(os->buf); |
4488 | 91 | os->buf = NULL; | 92 | os->buf = NULL; |
4489 | 92 | } | 93 | } |
4490 | 94 | |||
4491 | 93 | os->driver = NULL; | 95 | os->driver = NULL; |
4492 | 94 | os->aborted = FALSE; | 96 | os->aborted = FALSE; |
4493 | 95 | os->offset = 0; | 97 | os->offset = 0; |
4494 | @@ -386,10 +388,9 @@ | |||
4495 | 386 | gint err; | 388 | gint err; |
4496 | 387 | gpointer object; | 389 | gpointer object; |
4497 | 388 | 390 | ||
4499 | 389 | object = os->driver->open(filename, O_RDONLY, 0, size); | 391 | object = os->driver->open(filename, O_RDONLY, 0, size, &err); |
4500 | 390 | if (object == NULL) { | 392 | if (object == NULL) { |
4503 | 391 | err = -errno; | 393 | error("open(%s): %s (%d)", filename, strerror(-err), -err); |
4502 | 392 | error("open(%s): %s (%d)", filename, strerror(errno), errno); | ||
4504 | 393 | goto fail; | 394 | goto fail; |
4505 | 394 | } | 395 | } |
4506 | 395 | 396 | ||
4507 | @@ -432,11 +433,13 @@ | |||
4508 | 432 | 433 | ||
4509 | 433 | len = os->driver->read(os->object, os->buf, os->tx_mtu); | 434 | len = os->driver->read(os->object, os->buf, os->tx_mtu); |
4510 | 434 | if (len < 0) { | 435 | if (len < 0) { |
4513 | 435 | gint err = errno; | 436 | error("read(): %s (%d)", strerror(-len), -len); |
4514 | 436 | error("read(): %s (%d)", strerror(err), err); | 437 | if (len == -EAGAIN) |
4515 | 438 | return len; | ||
4516 | 439 | |||
4517 | 437 | g_free(os->buf); | 440 | g_free(os->buf); |
4518 | 438 | os->buf = NULL; | 441 | os->buf = NULL; |
4520 | 439 | return -err; | 442 | return len; |
4521 | 440 | } | 443 | } |
4522 | 441 | 444 | ||
4523 | 442 | ptr = os->buf; | 445 | ptr = os->buf; |
4524 | @@ -465,13 +468,14 @@ | |||
4525 | 465 | { | 468 | { |
4526 | 466 | gchar *path; | 469 | gchar *path; |
4527 | 467 | gint len; | 470 | gint len; |
4528 | 471 | int err; | ||
4529 | 468 | 472 | ||
4530 | 469 | path = g_build_filename(os->current_folder, os->name, NULL); | 473 | path = g_build_filename(os->current_folder, os->name, NULL); |
4531 | 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, |
4532 | 471 | os->size != OBJECT_SIZE_UNKNOWN ? | 475 | os->size != OBJECT_SIZE_UNKNOWN ? |
4534 | 472 | (size_t *) &os->size : NULL); | 476 | (size_t *) &os->size : NULL, &err); |
4535 | 473 | if (os->object == NULL) { | 477 | if (os->object == NULL) { |
4537 | 474 | error("open(%s): %s (%d)", path, strerror(errno), errno); | 478 | error("open(%s): %s (%d)", path, strerror(-err), -err); |
4538 | 475 | g_free(path); | 479 | g_free(path); |
4539 | 476 | return -EPERM; | 480 | return -EPERM; |
4540 | 477 | } | 481 | } |
4541 | @@ -489,13 +493,11 @@ | |||
4542 | 489 | 493 | ||
4543 | 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); |
4544 | 491 | if (w < 0) { | 495 | if (w < 0) { |
4549 | 492 | gint err = errno; | 496 | error("write(%s): %s (%d)", path, strerror(-w), -w); |
4550 | 493 | error("write(%s): %s (%d)", path, strerror(errno), | 497 | if (w == -EINTR) |
4547 | 494 | errno); | ||
4548 | 495 | if (err == EINTR) | ||
4551 | 496 | continue; | 498 | continue; |
4552 | 497 | else | 499 | else |
4554 | 498 | return -err; | 500 | return w; |
4555 | 499 | } | 501 | } |
4556 | 500 | 502 | ||
4557 | 501 | len += w; | 503 | len += w; |
4558 | @@ -544,11 +546,10 @@ | |||
4559 | 544 | 546 | ||
4560 | 545 | w = os->driver->write(os->object, buffer + len, size - len); | 547 | w = os->driver->write(os->object, buffer + len, size - len); |
4561 | 546 | if (w < 0) { | 548 | if (w < 0) { |
4564 | 547 | gint err = errno; | 549 | if (w == -EINTR) |
4563 | 548 | if (err == EINTR) | ||
4565 | 549 | continue; | 550 | continue; |
4566 | 550 | else | 551 | else |
4568 | 551 | return -err; | 552 | return w; |
4569 | 552 | } | 553 | } |
4570 | 553 | 554 | ||
4571 | 554 | len += w; | 555 | len += w; |
4572 | @@ -559,6 +560,44 @@ | |||
4573 | 559 | return 0; | 560 | return 0; |
4574 | 560 | } | 561 | } |
4575 | 561 | 562 | ||
4576 | 563 | static gboolean handle_async_io(gpointer object, int flags, int err, | ||
4577 | 564 | gpointer user_data) | ||
4578 | 565 | { | ||
4579 | 566 | struct obex_session *os = user_data; | ||
4580 | 567 | int ret = 0; | ||
4581 | 568 | |||
4582 | 569 | if (err < 0) { | ||
4583 | 570 | ret = err; | ||
4584 | 571 | goto proceed; | ||
4585 | 572 | } | ||
4586 | 573 | |||
4587 | 574 | if (flags & (G_IO_IN | G_IO_PRI)) | ||
4588 | 575 | ret = obex_write_stream(os, os->obex, os->obj); | ||
4589 | 576 | else if (flags & G_IO_OUT) | ||
4590 | 577 | ret = obex_read_stream(os, os->obex, os->obj); | ||
4591 | 578 | |||
4592 | 579 | proceed: | ||
4593 | 580 | switch (ret) { | ||
4594 | 581 | case -EINVAL: | ||
4595 | 582 | OBEX_ObjectSetRsp(os->obj, OBEX_RSP_BAD_REQUEST, | ||
4596 | 583 | OBEX_RSP_BAD_REQUEST); | ||
4597 | 584 | case -EPERM: | ||
4598 | 585 | OBEX_ObjectSetRsp(os->obj, OBEX_RSP_FORBIDDEN, | ||
4599 | 586 | OBEX_RSP_FORBIDDEN); | ||
4600 | 587 | break; | ||
4601 | 588 | default: | ||
4602 | 589 | if (ret < 0) | ||
4603 | 590 | OBEX_ObjectSetRsp(os->obj, | ||
4604 | 591 | OBEX_RSP_INTERNAL_SERVER_ERROR, | ||
4605 | 592 | OBEX_RSP_INTERNAL_SERVER_ERROR); | ||
4606 | 593 | break; | ||
4607 | 594 | } | ||
4608 | 595 | |||
4609 | 596 | OBEX_ResumeRequest(os->obex); | ||
4610 | 597 | |||
4611 | 598 | return FALSE; | ||
4612 | 599 | } | ||
4613 | 600 | |||
4614 | 562 | static gboolean check_put(obex_t *obex, obex_object_t *obj) | 601 | static gboolean check_put(obex_t *obex, obex_object_t *obj) |
4615 | 563 | { | 602 | { |
4616 | 564 | struct obex_session *os; | 603 | struct obex_session *os; |
4617 | @@ -645,7 +684,7 @@ | |||
4618 | 645 | } | 684 | } |
4619 | 646 | } | 685 | } |
4620 | 647 | 686 | ||
4622 | 648 | if (!os->service || !os->service->chkput) | 687 | if (!os->service->chkput) |
4623 | 649 | goto done; | 688 | goto done; |
4624 | 650 | 689 | ||
4625 | 651 | ret = os->service->chkput(obex, obj); | 690 | ret = os->service->chkput(obex, obj); |
4626 | @@ -659,6 +698,11 @@ | |||
4627 | 659 | case -EPERM: | 698 | case -EPERM: |
4628 | 660 | OBEX_ObjectSetRsp(obj, OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN); | 699 | OBEX_ObjectSetRsp(obj, OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN); |
4629 | 661 | return FALSE; | 700 | return FALSE; |
4630 | 701 | case -EAGAIN: | ||
4631 | 702 | OBEX_SuspendRequest(obex, obj); | ||
4632 | 703 | os->obj = obj; | ||
4633 | 704 | os->driver->set_io_watch(os->object, handle_async_io, os); | ||
4634 | 705 | return TRUE; | ||
4635 | 662 | default: | 706 | default: |
4636 | 663 | debug("Unhandled chkput error: %d", ret); | 707 | debug("Unhandled chkput error: %d", ret); |
4637 | 664 | OBEX_ObjectSetRsp(obj, OBEX_RSP_INTERNAL_SERVER_ERROR, | 708 | OBEX_ObjectSetRsp(obj, OBEX_RSP_INTERNAL_SERVER_ERROR, |
4638 | @@ -727,13 +771,12 @@ | |||
4639 | 727 | case OBEX_CMD_PUT: | 771 | case OBEX_CMD_PUT: |
4640 | 728 | case OBEX_CMD_GET: | 772 | case OBEX_CMD_GET: |
4641 | 729 | case OBEX_CMD_SETPATH: | 773 | case OBEX_CMD_SETPATH: |
4642 | 774 | default: | ||
4643 | 730 | os_session_mark_aborted(os); | 775 | os_session_mark_aborted(os); |
4644 | 731 | if (os->service->reset) | 776 | if (os->service->reset) |
4645 | 732 | os->service->reset(obex); | 777 | os->service->reset(obex); |
4646 | 733 | os_reset_session(os); | 778 | os_reset_session(os); |
4647 | 734 | break; | 779 | break; |
4648 | 735 | default: | ||
4649 | 736 | break; | ||
4650 | 737 | } | 780 | } |
4651 | 738 | break; | 781 | break; |
4652 | 739 | case OBEX_EV_REQHINT: | 782 | case OBEX_EV_REQHINT: |
4653 | @@ -758,7 +801,7 @@ | |||
4654 | 758 | case OBEX_EV_REQCHECK: | 801 | case OBEX_EV_REQCHECK: |
4655 | 759 | switch (cmd) { | 802 | switch (cmd) { |
4656 | 760 | case OBEX_CMD_PUT: | 803 | case OBEX_CMD_PUT: |
4658 | 761 | if (os->service && os->service->put) | 804 | if (os->service) |
4659 | 762 | check_put(obex, obj); | 805 | check_put(obex, obj); |
4660 | 763 | break; | 806 | break; |
4661 | 764 | default: | 807 | default: |
4662 | @@ -796,6 +839,11 @@ | |||
4663 | 796 | OBEX_ObjectSetRsp(obj, | 839 | OBEX_ObjectSetRsp(obj, |
4664 | 797 | OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN); | 840 | OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN); |
4665 | 798 | break; | 841 | break; |
4666 | 842 | case -EAGAIN: | ||
4667 | 843 | OBEX_SuspendRequest(obex, obj); | ||
4668 | 844 | os->obj = obj; | ||
4669 | 845 | os->driver->set_io_watch(os->object, handle_async_io, os); | ||
4670 | 846 | break; | ||
4671 | 799 | default: | 847 | default: |
4672 | 800 | OBEX_ObjectSetRsp(obj, | 848 | OBEX_ObjectSetRsp(obj, |
4673 | 801 | OBEX_RSP_INTERNAL_SERVER_ERROR, | 849 | OBEX_RSP_INTERNAL_SERVER_ERROR, |
4674 | @@ -805,7 +853,21 @@ | |||
4675 | 805 | 853 | ||
4676 | 806 | break; | 854 | break; |
4677 | 807 | case OBEX_EV_STREAMEMPTY: | 855 | case OBEX_EV_STREAMEMPTY: |
4679 | 808 | obex_write_stream(os, obex, obj); | 856 | switch (obex_write_stream(os, obex, obj)) { |
4680 | 857 | case -EPERM: | ||
4681 | 858 | OBEX_ObjectSetRsp(obj, | ||
4682 | 859 | OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN); | ||
4683 | 860 | break; | ||
4684 | 861 | case -EAGAIN: | ||
4685 | 862 | OBEX_SuspendRequest(obex, obj); | ||
4686 | 863 | os->obj = obj; | ||
4687 | 864 | os->driver->set_io_watch(os->object, handle_async_io, | ||
4688 | 865 | os); | ||
4689 | 866 | break; | ||
4690 | 867 | default: | ||
4691 | 868 | break; | ||
4692 | 869 | } | ||
4693 | 870 | |||
4694 | 809 | break; | 871 | break; |
4695 | 810 | case OBEX_EV_LINKERR: | 872 | case OBEX_EV_LINKERR: |
4696 | 811 | break; | 873 | break; |
4697 | 812 | 874 | ||
4698 | === modified file 'src/obex.h' | |||
4699 | --- src/obex.h 2010-01-10 10:46:58 +0000 | |||
4700 | +++ src/obex.h 2010-04-28 20:38:30 +0000 | |||
4701 | @@ -2,9 +2,8 @@ | |||
4702 | 2 | * | 2 | * |
4703 | 3 | * OBEX Server | 3 | * OBEX Server |
4704 | 4 | * | 4 | * |
4708 | 5 | * Copyright (C) 2007-2008 Nokia Corporation | 5 | * Copyright (C) 2007-2010 Nokia Corporation |
4709 | 6 | * Copyright (C) 2007-2008 Instituto Nokia de Tecnologia (INdT) | 6 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4707 | 7 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | ||
4710 | 8 | * | 7 | * |
4711 | 9 | * | 8 | * |
4712 | 10 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
4713 | @@ -78,6 +77,7 @@ | |||
4714 | 78 | struct server *server; | 77 | struct server *server; |
4715 | 79 | gboolean checked; | 78 | gboolean checked; |
4716 | 80 | obex_t *obex; | 79 | obex_t *obex; |
4717 | 80 | obex_object_t *obj; | ||
4718 | 81 | struct obex_mime_type_driver *driver; | 81 | struct obex_mime_type_driver *driver; |
4719 | 82 | gboolean finished; | 82 | gboolean finished; |
4720 | 83 | }; | 83 | }; |
4721 | 84 | 84 | ||
4722 | === modified file 'src/obexd.h' | |||
4723 | --- src/obexd.h 2009-07-27 19:02:30 +0000 | |||
4724 | +++ src/obexd.h 2010-04-28 20:38:30 +0000 | |||
4725 | @@ -2,7 +2,7 @@ | |||
4726 | 2 | * | 2 | * |
4727 | 3 | * OBEX Server | 3 | * OBEX Server |
4728 | 4 | * | 4 | * |
4730 | 5 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4731 | 6 | * | 6 | * |
4732 | 7 | * | 7 | * |
4733 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
4734 | @@ -21,6 +21,8 @@ | |||
4735 | 21 | * | 21 | * |
4736 | 22 | */ | 22 | */ |
4737 | 23 | 23 | ||
4738 | 24 | #include <dbus/dbus.h> | ||
4739 | 25 | |||
4740 | 24 | #define OPENOBEX_SERVICE "org.openobex" | 26 | #define OPENOBEX_SERVICE "org.openobex" |
4741 | 25 | 27 | ||
4742 | 26 | #define OPENOBEX_MANAGER_PATH "/" | 28 | #define OPENOBEX_MANAGER_PATH "/" |
4743 | @@ -34,3 +36,5 @@ | |||
4744 | 34 | 36 | ||
4745 | 35 | gboolean plugin_init(void); | 37 | gboolean plugin_init(void); |
4746 | 36 | void plugin_cleanup(void); | 38 | void plugin_cleanup(void); |
4747 | 39 | |||
4748 | 40 | DBusConnection *obex_dbus_get_connection(void); | ||
4749 | 37 | 41 | ||
4750 | === modified file 'src/plugin.c' | |||
4751 | --- src/plugin.c 2010-01-10 10:46:58 +0000 | |||
4752 | +++ src/plugin.c 2010-04-28 20:38:30 +0000 | |||
4753 | @@ -2,7 +2,7 @@ | |||
4754 | 2 | * | 2 | * |
4755 | 3 | * OBEX Server | 3 | * OBEX Server |
4756 | 4 | * | 4 | * |
4758 | 5 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4759 | 6 | * | 6 | * |
4760 | 7 | * | 7 | * |
4761 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
4762 | 9 | 9 | ||
4763 | === modified file 'src/plugin.h' | |||
4764 | --- src/plugin.h 2010-01-10 10:46:58 +0000 | |||
4765 | +++ src/plugin.h 2010-04-28 20:38:30 +0000 | |||
4766 | @@ -2,7 +2,7 @@ | |||
4767 | 2 | * | 2 | * |
4768 | 3 | * OBEX Server | 3 | * OBEX Server |
4769 | 4 | * | 4 | * |
4771 | 5 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4772 | 6 | * | 6 | * |
4773 | 7 | * | 7 | * |
4774 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
4775 | 9 | 9 | ||
4776 | === modified file 'src/service.c' | |||
4777 | --- src/service.c 2010-01-10 10:46:58 +0000 | |||
4778 | +++ src/service.c 2010-04-28 20:38:30 +0000 | |||
4779 | @@ -2,7 +2,7 @@ | |||
4780 | 2 | * | 2 | * |
4781 | 3 | * OBEX Server | 3 | * OBEX Server |
4782 | 4 | * | 4 | * |
4784 | 5 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4785 | 6 | * | 6 | * |
4786 | 7 | * | 7 | * |
4787 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
4788 | @@ -49,8 +49,8 @@ | |||
4789 | 49 | struct obex_service_driver *driver = l->data; | 49 | struct obex_service_driver *driver = l->data; |
4790 | 50 | 50 | ||
4791 | 51 | if (driver->who && who && | 51 | if (driver->who && who && |
4794 | 52 | driver->who_size == who_size && | 52 | (driver->who_size != who_size || |
4795 | 53 | memcmp(driver->who, who, who_size) != 0) | 53 | memcmp(driver->who, who, who_size) != 0)) |
4796 | 54 | continue; | 54 | continue; |
4797 | 55 | 55 | ||
4798 | 56 | if (driver->target == NULL && target == NULL) | 56 | if (driver->target == NULL && target == NULL) |
4799 | @@ -97,7 +97,11 @@ | |||
4800 | 97 | 97 | ||
4801 | 98 | debug("driver %p service %s registered", driver, driver->name); | 98 | debug("driver %p service %s registered", driver, driver->name); |
4802 | 99 | 99 | ||
4804 | 100 | drivers = g_slist_append(drivers, driver); | 100 | /* Drivers that support who has priority */ |
4805 | 101 | if (driver->who) | ||
4806 | 102 | drivers = g_slist_prepend(drivers, driver); | ||
4807 | 103 | else | ||
4808 | 104 | drivers = g_slist_append(drivers, driver); | ||
4809 | 101 | 105 | ||
4810 | 102 | return 0; | 106 | return 0; |
4811 | 103 | } | 107 | } |
4812 | 104 | 108 | ||
4813 | === modified file 'src/service.h' | |||
4814 | --- src/service.h 2010-01-10 10:46:58 +0000 | |||
4815 | +++ src/service.h 2010-04-28 20:38:30 +0000 | |||
4816 | @@ -2,7 +2,7 @@ | |||
4817 | 2 | * | 2 | * |
4818 | 3 | * OBEX Server | 3 | * OBEX Server |
4819 | 4 | * | 4 | * |
4821 | 5 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4822 | 6 | * | 6 | * |
4823 | 7 | * | 7 | * |
4824 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
4825 | 9 | 9 | ||
4826 | === modified file 'test/ftp-client' | |||
4827 | --- test/ftp-client 2009-07-27 19:02:30 +0000 | |||
4828 | +++ test/ftp-client 2010-04-28 20:38:30 +0000 | |||
4829 | @@ -15,6 +15,11 @@ | |||
4830 | 15 | self.verbose = verbose | 15 | self.verbose = verbose |
4831 | 16 | 16 | ||
4832 | 17 | @dbus.service.method("org.openobex.Agent", | 17 | @dbus.service.method("org.openobex.Agent", |
4833 | 18 | in_signature="o", out_signature="s") | ||
4834 | 19 | def Request(self, path): | ||
4835 | 20 | return "" | ||
4836 | 21 | |||
4837 | 22 | @dbus.service.method("org.openobex.Agent", | ||
4838 | 18 | in_signature="ot", out_signature="") | 23 | in_signature="ot", out_signature="") |
4839 | 19 | def Progress(self, path, transferred): | 24 | def Progress(self, path, transferred): |
4840 | 20 | if self.verbose: | 25 | if self.verbose: |
4841 | @@ -55,6 +60,11 @@ | |||
4842 | 55 | 60 | ||
4843 | 56 | return parser.parse_args() | 61 | return parser.parse_args() |
4844 | 57 | 62 | ||
4845 | 63 | def error(err): | ||
4846 | 64 | print err | ||
4847 | 65 | |||
4848 | 66 | def void_reply(): | ||
4849 | 67 | pass | ||
4850 | 58 | 68 | ||
4851 | 59 | def change_folder(session, new_dir): | 69 | def change_folder(session, new_dir): |
4852 | 60 | for node in new_dir.split("/"): | 70 | for node in new_dir.split("/"): |
4853 | @@ -69,11 +79,15 @@ | |||
4854 | 69 | 79 | ||
4855 | 70 | def put_file(session, filename): | 80 | def put_file(session, filename): |
4856 | 71 | session.PutFile(os.path.abspath(filename), | 81 | session.PutFile(os.path.abspath(filename), |
4858 | 72 | os.path.basename(filename)) | 82 | os.path.basename(filename), |
4859 | 83 | reply_handler=void_reply, | ||
4860 | 84 | error_handler=error) | ||
4861 | 73 | 85 | ||
4862 | 74 | def get_file(session, filename): | 86 | def get_file(session, filename): |
4863 | 75 | session.GetFile(os.path.abspath(filename), | 87 | session.GetFile(os.path.abspath(filename), |
4865 | 76 | os.path.basename(filename)) | 88 | os.path.basename(filename), |
4866 | 89 | reply_handler=void_reply, | ||
4867 | 90 | error_handler=error) | ||
4868 | 77 | 91 | ||
4869 | 78 | 92 | ||
4870 | 79 | if __name__ == '__main__': | 93 | if __name__ == '__main__': |
4871 | @@ -91,8 +105,6 @@ | |||
4872 | 91 | bus = dbus.SessionBus() | 105 | bus = dbus.SessionBus() |
4873 | 92 | mainloop = gobject.MainLoop() | 106 | mainloop = gobject.MainLoop() |
4874 | 93 | 107 | ||
4875 | 94 | need_mainloop = False | ||
4876 | 95 | |||
4877 | 96 | path = "/test/agent" | 108 | path = "/test/agent" |
4878 | 97 | agent = Agent(bus, path, options.verbose) | 109 | agent = Agent(bus, path, options.verbose) |
4879 | 98 | 110 | ||
4880 | @@ -117,12 +129,9 @@ | |||
4881 | 117 | list_folder(ftp) | 129 | list_folder(ftp) |
4882 | 118 | 130 | ||
4883 | 119 | if options.get_file: | 131 | if options.get_file: |
4884 | 120 | need_mainloop = True | ||
4885 | 121 | get_file(ftp, options.get_file) | 132 | get_file(ftp, options.get_file) |
4886 | 122 | 133 | ||
4887 | 123 | if options.put_file: | 134 | if options.put_file: |
4888 | 124 | need_mainloop = True | ||
4889 | 125 | put_file(ftp, options.put_file) | 135 | put_file(ftp, options.put_file) |
4890 | 126 | 136 | ||
4893 | 127 | if need_mainloop: | 137 | mainloop.run() |
4892 | 128 | mainloop.run() | ||
4894 | 129 | 138 | ||
4895 | === modified file 'test/main.c' | |||
4896 | --- test/main.c 2009-07-27 19:02:30 +0000 | |||
4897 | +++ test/main.c 2010-04-28 20:38:30 +0000 | |||
4898 | @@ -2,7 +2,7 @@ | |||
4899 | 2 | * | 2 | * |
4900 | 3 | * OBEX Test | 3 | * OBEX Test |
4901 | 4 | * | 4 | * |
4903 | 5 | * Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> |
4904 | 6 | * | 6 | * |
4905 | 7 | * | 7 | * |
4906 | 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |