Commit Graph

1310 Commits

Author SHA1 Message Date
Luiz Augusto von Dentz
2dcb0e5616 obex-client: Rename org.bluez.obex.FileTransfer to org.bluez.obex.FileTransfer1
Rename the interface and move it to obexd-api.txt since it now belongs
to the same daemon.
2012-12-21 11:59:41 +02:00
Luiz Augusto von Dentz
1945cffc16 obex-client: Rename org.bluez.obex.ObjectPush to org.bluez.obex.ObjectPush1
Rename the interface and move it to obexd-api.txt since it now belongs
to the same daemon.
2012-12-21 11:59:41 +02:00
Luiz Augusto von Dentz
dc30b0deaa obex-client: Rename org.bluez.obex.Session to org.bluez.obex.Session1
Rename the interface and move it to obexd-api.txt since it now belongs
to the same daemon.
2012-12-21 11:59:41 +02:00
Luiz Augusto von Dentz
35990b8bdd obexd: Rename org.bluez.obex.Client to org.bluez.obex.Client1
Rename the interface and move it to obexd-api.txt since it now belongs
to the same daemon.
2012-12-21 11:59:41 +02:00
Luiz Augusto von Dentz
0cac99fe83 obexd: Define base path so in future it is easier to change it 2012-12-21 11:59:41 +02:00
Luiz Augusto von Dentz
a5c2b6e886 obexd: Align client and server spec of org.bluez.obex.Transfer1 2012-12-21 11:59:41 +02:00
Luiz Augusto von Dentz
6765affa2c obexd: Remove TransferStarted and TransferCompleted signals
This now handled by ObjectManager together with a new property called
Status.
2012-12-21 11:59:40 +02:00
Luiz Augusto von Dentz
84d01d66e1 obexd: Fix transfer path to include session path
Transfer path should use the session path as prefix
2012-12-21 11:59:40 +02:00
Luiz Augusto von Dentz
e62719c47b obexd: Fix session path to include manager path
Manager path is /org/bluez/obex so use it as prefix in the session path.
2012-12-21 11:59:40 +02:00
Luiz Augusto von Dentz
781d49a8e7 obexd: Rename org.bluez.obex.Session to org.bluez.obex.Session1 2012-12-21 11:59:40 +02:00
Luiz Augusto von Dentz
f170537b52 obexd: Rename org.bluez.obex.Transfer to org.bluez.obex.Transfer1 2012-12-21 11:59:40 +02:00
Luiz Augusto von Dentz
22c81fdae7 obexd: Rename org.bluez.obex.Agent to org.bluez.obex.Agent1 2012-12-21 11:59:40 +02:00
Luiz Augusto von Dentz
e3bb4f22e0 obexd: Rename Manager to AgentManager1 2012-12-21 11:59:40 +02:00
Marcel Holtmann
61c448fea1 obexd: Reorder command line options 2012-12-19 13:43:00 +01:00
Johan Hedberg
8b1c207d0f obexd: Remove unused D-Bus helper functions 2012-12-19 10:29:18 +02:00
Johan Hedberg
fb4c83061b obexd: Remove unused obex_server_find_driver function 2012-12-19 10:25:07 +02:00
Marcel Holtmann
d452870662 build: Add systemd integration for obexd 2012-12-18 22:00:01 +01:00
Marcel Holtmann
cc6cd08ee0 obexd: Use /org/bluez/obex as root path 2012-12-18 21:22:07 +01:00
Marcel Holtmann
459001327e obexd: Use a single bus name for obexd and obex-client 2012-12-18 21:19:18 +01:00
Johan Hedberg
91c50f7fa1 obexd: Merge obex-client into obexd daemon 2012-12-18 17:54:43 +02:00
Johan Hedberg
6934437fc7 obexd: Add client prefix to client manager functions
This is in preparation of merging the client into the daemon.
2012-12-18 16:03:42 +02:00
Luiz Augusto von Dentz
3eadc034c9 obex-client: Make use of g_dbus_get_properties to get transfer properties
In addition fix the reply generated by obc_transfer_create_dbus_reply to
not use a structure container instead use object, dict 'oa{sv}' as
indicated in the documentation.
2012-12-17 16:31:59 +02:00
Luiz Augusto von Dentz
27635e590b obex-client: Enable ObjectManager 2012-12-17 14:10:36 +02:00
Luiz Augusto von Dentz
e4cc2de1c7 obexd: Remove SessionCreated and SessionRemoved signals
With ObjectManager these signals no longer are necessary.
2012-12-17 14:10:34 +02:00
Luiz Augusto von Dentz
54f6035e45 obexd: Enable ObjectManager 2012-12-17 14:10:32 +02:00
Luiz Augusto von Dentz
b8972b65e5 obexd: Port session interface to use D-Bus Properties 2012-12-17 14:10:30 +02:00
Luiz Augusto von Dentz
e4f45a247b obex-client: Port transfer code to use D-Bus properties interface 2012-12-16 13:26:02 +02:00
Luiz Augusto von Dentz
6f5797da8b obex-client: Port session code to use D-Bus properties interface 2012-12-16 13:26:00 +02:00
Luiz Augusto von Dentz
82a76393fe obex-client: Port MAP module to use D-Bus properties interface 2012-12-16 13:25:57 +02:00
Luiz Augusto von Dentz
0fea59d098 build: Remove obexd usb plugin
This plugin is not longer maintained and used to work only in meego
times.
2012-12-13 14:23:59 +02:00
Marcel Holtmann
05f9475f66 obexd: Fix build breakage from profile conversion 2012-12-12 23:21:02 +01:00
Luiz Augusto von Dentz
326376321f obex-client: Remove calls to org.bluez.Manager and org.bluez.Adapter
With BlueZ 5 this API no longer exist or have changed.
2012-12-12 14:20:12 +02:00
Luiz Augusto von Dentz
6d326f3768 irmc: Remove record details
Standart service records are already supported by bluetoothd
2012-12-12 13:57:45 +02:00
Luiz Augusto von Dentz
57c994a273 mas: Remove record details
Standart service records are already supported by bluetoothd
2012-12-12 13:57:43 +02:00
Luiz Augusto von Dentz
df56abd1e9 pbap: Remove record details
Standart service records are already supported by bluetoothd
2012-12-12 13:57:41 +02:00
Luiz Augusto von Dentz
19040c9f72 ftp: Remove record details
Standart service records are already supported by bluetoothd
2012-12-12 13:57:39 +02:00
Luiz Augusto von Dentz
9106f01fe5 opp: Remove record details
Standart service records are already supported by bluetoothd
2012-12-12 13:57:37 +02:00
Luiz Augusto von Dentz
b06089c493 obexd: Add support for custom records
Services such as pcsuite and syncml use custom records not defined by
Bluetooth SIG so they have to be registered using ServiceRecord entry.
2012-12-12 13:57:34 +02:00
Luiz Augusto von Dentz
40b2cc329c obexd: Enable support SYNC profile 2012-12-12 13:57:15 +02:00
Luiz Augusto von Dentz
1abed724ce obexd: Enable support for MAS profile 2012-12-12 13:57:13 +02:00
Luiz Augusto von Dentz
23b28ab759 obexd: Port bluetooth plugin to use external profile support
This changes obexd to use ProfileManager.RegisterProfile
2012-12-12 13:56:12 +02:00
Marcel Holtmann
3539054aa9 obexd: Don't daemonize and just toggle foreground logging 2012-12-10 23:16:49 +01:00
Johan Hedberg
b8779d2202 Revert "Ensure config.h is included by using CPPFLAGS"
This reverts commit 8a03376544.

The patch needs to be split up and the gdbus/ changes were bogus
compared to the original commit message.

Conflicts:
	Makefile.am
	Makefile.obexd
	profiles/cyclingspeed/cyclingspeed.c
	profiles/heartrate/heartrate.c
	src/error.c
2012-12-07 12:46:04 +02:00
Lucas De Marchi
0375042892 Use entire include path for gobex.h 2012-12-05 17:23:04 +02:00
Lucas De Marchi
5714b14bce Reorder btio.h includes
Let "#include <btio/btio.h>" together with other includes using '<'
rather than '"'.
2012-12-05 17:23:04 +02:00
Lucas De Marchi
49b5612042 Use the entire include path for btio.h 2012-12-05 17:23:04 +02:00
Lucas De Marchi
aa77b0bea9 Use the entire include path for gdbus.h 2012-12-05 17:23:03 +02:00
Lucas De Marchi
8a03376544 Ensure config.h is included by using CPPFLAGS
Instead of trying to include config.h in each file over the tree and
possibly forgetting to include it, give a "-include config.h" argument
to the compiler so it's guaranteed that a) it will be included for all
source files and b) it will be the first header included.

gdbus/ directory is left out, since it would break other projects using
it.
2012-12-05 17:18:07 +02:00
Marcel Holtmann
41aa85d123 build: Compile obexd and obex-client 2012-12-04 23:38:48 +01:00
Luiz Augusto von Dentz
ff3d8766b7 obexd: Fix using BtIOType 2012-12-04 22:49:06 +01:00
Luiz Augusto von Dentz
cdfaf26ea9 obexd: Fix using BtIOType 2012-12-04 22:49:06 +01:00
Sunil Kumar Behera
ab156cd3c5 obexd: Add get_next_header() in message listing
In case of message listing we need to send application
parameters in response and also it is required for sending
response to message listing size request.
2012-12-04 22:49:06 +01:00
Sunil Kumar Behera
2ee7238d8f obexd: Reset ap_sent variable
For multiple subsequent request for message listing
we need to reset this variable to FALSE, so that each
time the get next header function is executed properly.
2012-12-04 22:49:06 +01:00
Luiz Augusto von Dentz
f3eeb2c93f obexd: Fix sending absolute path
As per OBEX spec the NAME header should not contain absolute paths
2012-12-04 22:49:06 +01:00
Luiz Augusto von Dentz
1f4a67568c obexd: Fix returning empty if messages was already listed
Once a message was already listed and inserted on the cache it could
not be listed again as the code was using the wrong key to lookup for
found messages then once we try to create the message again it fails
as the object already exists.
2012-12-04 22:49:06 +01:00
Luiz Augusto von Dentz
33b0aeda71 obexd: Fix freeing apparam data on PBAP module
Invalid read of size 8
   at 0x40EC04: g_obex_apparam_free (gobex-apparam.c:362)
   by 0x41A66A: obc_transfer_free (transfer.c:272)
   by 0x413221: pending_request_free (session.c:163)
   by 0x413659: session_terminate_transfer (session.c:745)
   by 0x41A53E: xfer_complete (transfer.c:518)
   by 0x41B5D7: get_xfer_progress_first (transfer.c:562)
   by 0x409750: handle_response (gobex.c:948)
   by 0x40A609: incoming_data (gobex.c:1191)
   by 0x371D047824: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x371D047B57: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x371D047F51: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x40542F: main (main.c:175)
 Address 0x4f64510 is 0 bytes inside a block of size 8 free'd
   at 0x4A079AE: free (vg_replace_malloc.c:427)
   by 0x371D04D50E: g_free (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x416060: phonebook_size_callback (pbap.c:266)
   by 0x413651: session_terminate_transfer (session.c:743)
   by 0x41A53E: xfer_complete (transfer.c:518)
   by 0x41B5D7: get_xfer_progress_first (transfer.c:562)
   by 0x409750: handle_response (gobex.c:948)
   by 0x40A609: incoming_data (gobex.c:1191)
   by 0x371D047824: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x371D047B57: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x371D047F51: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x40542F: main (main.c:175)
2012-12-04 22:49:06 +01:00
Luiz Augusto von Dentz
f1e88405c0 obexd: Fix not using port when it is set by the client
If the client set a channel/port the code would just ignore and attempt
to discover the service anyway.
2012-12-04 22:49:06 +01:00
Srinivasa Ragavan
d77a640090 obexd: Add implementation for UpdateInbox 2012-12-04 22:49:06 +01:00
Luiz Augusto von Dentz
ea5d38411a obexd: Fix build when using --with-messages=tracker
Commit 15b15167fb2dd82e2189cc1955def1818a7bc6a6 broke the build:

plugins/messages.c:324:42: error: unknown type name ‘messages_update_inbox_cb’
plugins/messages.c:331:5: error: unknown type name ‘messages_set_read_cb’
plugins/messages.c:337:6: error: unknown type name ‘messages_set_delete_cb’
2012-12-04 22:49:06 +01:00
Srinivasa Ragavan
920bbb3663 obexd: Add Message.SetProperty and Message.GetProperties implementation. 2012-12-04 22:49:05 +01:00
Srinivasa Ragavan
3ab485ec08 obexd: Update the file offset to the beginning after writing to the file
When the transfer file is opened in O_RDWR mode, just after the contents are
written to the file, the file offset has to be set to the beginning of the
file. If not subsequent read fails. This patch fixes this.
2012-12-04 22:49:05 +01:00
Luiz Augusto von Dentz
a103426e51 obexd: Make obc_transfer_put to accept NULL as filename
In that case contents should be valid so the modules can use
obc_transfer_put to create temporary files.
2012-12-04 22:49:05 +01:00
Luiz Augusto von Dentz
36d387af61 obexd: Avoid extra copies while passing apparam to transfer
By passing directly the reference to GObexApparam it is no longer
necessary to use intermediate buffers to pass data around.
2012-12-04 22:49:05 +01:00
Luiz Augusto von Dentz
d1db67a33b obexd: Fix not sending parameters to get message in map module
Attachment and charset are mandatory, so Message.Get now takes an
additional boolean parameter which the user application should set
if it wants the attachments to be downloaded, charset is always set
to UTF8.
2012-12-04 22:49:05 +01:00
Luiz Augusto von Dentz
7eac453589 obexd: Add MessageAccess.ListFilterFields 2012-12-04 22:49:05 +01:00
Luiz Augusto von Dentz
45779d1a57 obexd: Rename MessageAccess method GetMessagesListing to ListMessages
In addition to that add missing parsing of the filters
2012-12-04 22:49:05 +01:00
Luiz Augusto von Dentz
16d0190ea7 obexd: Rename MessageAccess method GetFolderListing to ListFolders
In addition to that add missing parsing of the filters.
2012-12-04 22:49:05 +01:00
Luiz Augusto von Dentz
0155c14fb2 obexd: Use larger timeout first packet in transfers
This align the client timeout for GET operations with g_obex_get_req_pkt
which does use 60 seconds to cover for extra interaction during the first
packet.
2012-12-04 22:49:05 +01:00
Luiz Augusto von Dentz
e24161f526 obexd: Unify callbacks for operations that only report status
This removes duplicated code.
2012-12-04 22:49:05 +01:00
Sunil Kumar Behera
9a117c332e obexd: Add set delete status function
This function will inform MAP server to modify
the delete status of a given message.
2012-12-04 22:49:05 +01:00
Sunil Kumar Behera
31ef868be5 obexd: Add set read status function
This function will inform MAP server to modify the
read status of a given message.
2012-12-04 22:49:05 +01:00
Sunil Kumar Behera
91b11b2841 obexd: Add support for MessageStatus
Add driver to support x-bt/messageStatus mimetype
2012-12-04 22:49:05 +01:00
Luiz Augusto von Dentz
f0f235584e obexd: Move common code to pull_phonebook 2012-12-04 22:49:05 +01:00
Luiz Augusto von Dentz
1dbe451cce obexd: Remove deprecated methods from PhonebookAccess
SetFormat, SetOrder, SetFilter and GetFilter methods are no longer
necessary as other methods now take them as parameters to avoid round
trips.
2012-12-04 22:49:04 +01:00
Luiz Augusto von Dentz
69048a0635 obexd: Add filters to PhonebookAccess.List and PhonebookAccess.Search
This avoid D-Bus round trips and is more aligned with what has been
proposed for MessageAccess interface.
2012-12-04 22:49:04 +01:00
Luiz Augusto von Dentz
6db2270154 obexd: Add filters to PhonebookAccess.Pull
This avoid D-Bus round trips and is more aligned with what has been
proposed for MessageAccess interface.
2012-12-04 22:49:04 +01:00
Luiz Augusto von Dentz
b3cd1f0538 obexd: Add filters to Phonebook.PullAll
This avoid D-Bus round trips and is more aligned with what has been
proposed for MessageAccess interface.
2012-12-04 22:49:04 +01:00
Srinivasa Ragavan
3b9daaaf0c obexd: Fix crash on map module
gboolean is expected to hold 0/1. But it is holding int return from
strcasecmp which crashes DBusMessage at:

_dbus_return_val_if_fail (*bool_p == 0 || *bool_p == 1, FALSE);

Trace:
0  0x00007ffff7328d95 in __GI_raise (sig=6) at raise.c:64
1  0x00007ffff732a2ab in __GI_abort () at abort.c:93
2  0x00007ffff78d0655 in _dbus_abort () at dbus-sysdeps.c:94
3  0x00007ffff78c75f1 in _dbus_warn_check_failed at dbus-internals.c:289
4  0x00007ffff78ba28b in dbus_message_iter_append_basic at dbus-message.c:2538
5  0x00000000004201c3 in append_variant at client/dbus.c:44
6  0x000000000042024e in obex_dbus_dict_append at client/dbus.c:65
7  0x000000000041dcc9 in parse_read at client/map.c:423
8  0x000000000041dfa7 in msg_element at client/map.c:518
9  0x00007ffff7b323b9 in emit_start_element at gmarkup.c:986
10 0x00007ffff7b33b44 in g_markup_parse_context_parse at gmarkup.c:1323
11 0x000000000041e1ad in message_listing_cb at client/map.c:586
12 0x000000000041744c in session_terminate_transfer client/session.c:743
13 0x00000000004174d7 in session_notify_complete at client/session.c:758
14 0x000000000041755a in transfer_complete at client/session.c:778
15 0x000000000041f57b in xfer_complete at client/transfer.c:521
16 0x000000000040efdf in transfer_complete at gobex/gobex-transfer.c:102
17 0x000000000040f418 in transfer_response at gobex/gobex-transfer.c:221
18 0x000000000040b320 in handle_response at gobex/gobex.c:948
19 0x000000000040bbc1 in incoming_data at gobex/gobex.c:1191
20 0x00007ffff7b2f94a in g_main_dispatch (context=0x62f130) at gmain.c:2515
21 g_main_context_dispatch (context=0x62f130) at gmain.c:3052
22 0x00007ffff7b2fd10 in g_main_context_iterate at gmain.c:3123
23 g_main_context_iterate at gmain.c:3060
24 0x00007ffff7b3010a in g_main_loop_run (loop=0x62e1b0) at gmain.c:3317
25 0x000000000041527d in main at client/main.c:175
2012-12-04 22:49:04 +01:00
Syam Sidhardhan
d860754d64 obexd: Remove redundant include errno.h 2012-12-04 22:49:04 +01:00
Syam Sidhardhan
139ca83753 obexd: Remove redundant include sys/stat.h 2012-12-04 22:49:04 +01:00
Sunil Kumar Behera
c00b7b2267 obexd: Add subject length parameter in GetMessageListing
Add subject length parameter to allow MAP server to
create subject as per MAP client length preference.
2012-12-04 22:49:04 +01:00
Sunil Kumar Behera
134bcbcc8d obexd: Add offset parameter decription
Add offset parameter description for
messages_get_messages_listing() function header
2012-12-04 22:49:04 +01:00
Sunil Kumar Behera
a558890eb4 obexd: Fix invalid oflag check
Change logic to check for O_WRONLY, as oflag is
created by an OR operation of O_WRONLY, O_CREAT and
O_TRUNC.
Message update is a PUT function, this check returns
bad response if GET is received.
2012-12-04 22:49:04 +01:00
Luiz Augusto von Dentz
c7523cb988 obexd: Remove map_ap.c
It is no longer needed as MAP plugin is now using GObexApparam API
2012-12-04 22:49:04 +01:00
Luiz Augusto von Dentz
b338757cd3 obexd: Make use of GObexApparam API 2012-12-04 22:49:04 +01:00
Luiz Augusto von Dentz
398d3e2353 obexd: Make use of GObexApparam API 2012-12-04 22:49:04 +01:00
Luiz Augusto von Dentz
eb3aaa4d92 obexd: Port PBAP module to use GObexApparam 2012-12-04 22:49:04 +01:00
Ludek Finstrle
789eb4921f obexd: Fix pbap_select using absolute path with known locations
pbap_select has to use absolute path with known location to support
repeatable pbap_select calls. In other way the second call fails.
2012-12-04 22:49:03 +01:00
Luiz Augusto von Dentz
527cf79f62 obexd: Fix possible memory leak in handling of location
path was not being freed before returning, the is also simplified so
the error is now given in the return of the function.
2012-12-04 22:49:03 +01:00
Luiz Augusto von Dentz
ee215d601f obexd: Fix possible memory leak in bluetooth driver
2,210 (64 direct, 2,146 indirect) bytes in 2 blocks are definitely lost in loss record 150 of 155
   at 0x4A0884D: malloc (vg_replace_malloc.c:263)
   by 0x3B2900F8A1: sdp_create (sdp.c:3656)
   by 0x3B2900FAE0: sdp_connect (sdp.c:4604)
   by 0x415902: adapter_reply (bluetooth.c:421)
   by 0x3B22C0C429: ??? (in /usr/lib64/libdbus-1.so.3.5.6)
   by 0x3B22C0F5E9: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.5.6)
   by 0x4059A7: message_dispatch (mainloop.c:76)
   by 0x32CD64822A: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x32CD647694: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x32CD6479C7: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x32CD647DC1: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3200.4)
   by 0x40567F: main (main.c:175)
2012-12-04 22:49:03 +01:00
Luiz Augusto von Dentz
62ebf8d0f3 obexd: Make handle of location more clear
Add proper defines for supported paths and convert relative
path absolute to align with PBAP paths.
2012-12-04 22:49:03 +01:00
Harald Schmitt
a806141efd obexd: phonebook: Replace magic strings for phonebook names and folders 2012-12-04 22:49:03 +01:00
Harald Schmitt
57015dac9e obexd: Fix phonebook contacts query
At the moment IRMC fails to connect for phonebook_ebook and
phonebook_tracker usage because the name parameter for phonebook_pull
is not an absolute path.
2012-12-04 22:49:03 +01:00
Luiz Augusto von Dentz
96e59fff47 obexd: Add Message.Get implementation 2012-12-04 22:49:03 +01:00
Luiz Augusto von Dentz
535a6589c5 obexd: Use filter instead of dummy as argument name in MAP
This is aligned with the documentation that uses filter as well.
2012-12-04 22:49:03 +01:00
Luiz Augusto von Dentz
9ac5d05af5 obexd: Change MessageAccess.GetMessageListing to not return raw xml
This parses the response and return as a list of dictionary where each
entry is a message and its properties,
2012-12-04 22:49:03 +01:00
Luiz Augusto von Dentz
3471e4760b obexd: Change MessageAccess.GetFolderListing to not return raw xml
This parses the response and return as a list of dictionary where each
entry is a folder and its properties, similar to what
FileTransfer.ListFolder does.
2012-12-04 22:49:03 +01:00
Luiz Augusto von Dentz
0acb3455f8 obexd: Fix wrong signature of MessageAccess.SetFolder
D-Bus string signature is 's' not 'string'
2012-12-04 22:49:03 +01:00
Szymon Janc
2d07cea3b3 obexd: Fix some common spelling errors
Fix spelling errors reported by codespell.
2012-12-04 22:49:03 +01:00
Szymon Janc
84c4c3bedc obexd: Fix dead assignments
Values stored are never read.
2012-12-04 22:49:03 +01:00
Szymon Janc
20340654cf obexd: Fix error returning in obc_transfer_put
Always set error on failure in obc_transfer_put. This is expected by
callers and will avoid possible NULL pointer dereference.

Also fix improper use of errno variable (calling error may modify it)
and some dead assignments to perr.
2012-12-04 22:49:03 +01:00
Szymon Janc
e1713aa11d obexd: Use g_malloc0 in get_filter_strs
Use g_malloc0 instead of g_try_malloc0 to allocate list. All users
expects to get valid pointer from it anyway. Also size of allocated
memory is small.
2012-12-04 22:49:02 +01:00
Szymon Janc
bd8e84312f obexd: Fix use of uninitialized count variable
If opendir() call fails count would be passed to callback
uninitialized.
2012-12-04 22:49:02 +01:00
Luiz Augusto von Dentz
a5524f5924 obexd: Fix memory leak in bluetooth driver
384 (184 direct, 200 indirect) bytes in 1 blocks are definitely lost in loss record 141 of 157
   at 0x4A0884D: malloc (vg_replace_malloc.c:263)
   by 0x392E217815: ??? (in /usr/lib64/libdbus-1.so.3.5.6)
   by 0x392E218632: dbus_message_new_method_call (in /usr/lib64/libdbus-1.so.3.5.6)
   by 0x413AD3: send_method_call (bluetooth.c:87)
   by 0x414933: manager_reply (bluetooth.c:496)
   by 0x392E20C429: ??? (in /usr/lib64/libdbus-1.so.3.5.6)
   by 0x392E20F5E9: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.5.6)
   by 0x405767: message_dispatch (mainloop.c:76)
   by 0x369E04827A: ??? (in /usr/lib64/libglib-2.0.so.0.3200.3)
   by 0x369E0476E4: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3200.3)
   by 0x369E047A17: ??? (in /usr/lib64/libglib-2.0.so.0.3200.3)
   by 0x369E047E11: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3200.3)
2012-12-04 22:49:02 +01:00
Mikel Astiz
9d13a70842 obexd: Fix cancellation of queued transfers
Cancelling queued (not started yet) transfers should not fail. Instead,
they must be removed from the queue, so we just need to call the
transfer callback.
2012-12-04 22:49:02 +01:00
Mikel Astiz
60b2e58209 obexd: Remove obc_transfer_abort
Refactor the code to remove function obc_transfer_abort, which is used
only once and is anyway coupled to the D-Bus API.
2012-12-04 22:49:02 +01:00
Mikel Astiz
68b394a78b obexd: Fix possible unreplied D-Bus message
If a previous cancel request is in progress, a second cancel request
should fail.

This by the way fixes unreplied D-Bus messages.
2012-12-04 22:49:02 +01:00
Luiz Augusto von Dentz
a9a5fcd7db obexd: Fix using org.openobex.Error
In addition use define so it is easier to change this in future
2012-12-04 22:49:02 +01:00
Luiz Augusto von Dentz
8a296cfcbb obexd: Use session path as prefix for transfer path
This should make it easier to identify to which session the transfer
belongs.
2012-12-04 22:49:02 +01:00
Luiz Augusto von Dentz
dc3076af72 obexd: Fix not using connection passed to obc_transfer_register
Make use of the connection parameter instead of assuming the connection
will always be to the session bus.
2012-12-04 22:49:02 +01:00
Luiz Augusto von Dentz
2a7ec51f94 obexd: Rename Transfer interface to org.bluez.obex.Transfer 2012-12-04 22:49:02 +01:00
Luiz Augusto von Dentz
e3d1b527ca obexd: Rename MessageAccess interface to org.bluez.obex.MessageAccess 2012-12-04 22:49:02 +01:00
Luiz Augusto von Dentz
dea7c760ce obexd: Rename Synchronization interface to org.bluez.obex.Synchronization 2012-12-04 22:49:02 +01:00
Luiz Augusto von Dentz
6ae1745820 obexd: Rename PhonebookAccess interface to org.bluez.obex.PhonebookAccess 2012-12-04 22:49:02 +01:00
Luiz Augusto von Dentz
712f112619 obexd: Rename FileTransfer interface to org.bluez.obex.FileTransfer 2012-12-04 22:49:02 +01:00
Luiz Augusto von Dentz
f542d96735 obexd: Rename ObjectPush interface to org.bluez.obex.ObjectPush 2012-12-04 22:49:01 +01:00
Luiz Augusto von Dentz
7d565a9c07 obexd: Rename session interface to org.bluez.obex.Session
The base is also changed to /org/bluez/obex to follow the new namespace
2012-12-04 22:49:01 +01:00
Luiz Augusto von Dentz
27a14618b1 obexd: Change namespace to org.bluez.obex.client 2012-12-04 22:49:01 +01:00
Luiz Augusto von Dentz
1ff927b793 obexd: Change agent interface to org.bluez.obex.Agent 2012-12-04 22:49:01 +01:00
Luiz Augusto von Dentz
d6ed7409b7 obexd: Change D-Bus namespace to org.bluez.obex
This changes the namespace from org.openobex to org.bluez.obex
2012-12-04 22:49:01 +01:00
Mikel Astiz
f44090ba4b obexd: Update copyright statement 2012-12-04 22:49:01 +01:00
Mikel Astiz
4b424100ef obexd: PhonebookAccess sessions return transfers
Return the D-Bus path of the transfer representing the operation.
2012-12-04 22:49:01 +01:00
Mikel Astiz
0a174f40c6 obexd: Synchronization sessions return transfers
Return the D-Bus path of the transfer representing the operation.
2012-12-04 22:49:01 +01:00
Mikel Astiz
d6f045dc5c obexd: FileTransfer sessions return transfers
Return the D-Bus path of the transfer representing the operation.
2012-12-04 22:49:01 +01:00
Mikel Astiz
6793dfe0d0 obexd: ObjectPush sessions return transfers
Return the D-Bus path of the transfer representing the operation.
2012-12-04 22:49:01 +01:00
Mikel Astiz
d3b779a77a obexd: Expose D-Bus data in internal transfer API
Expose in transfer API the D-Bus path and properties as should be
returned by transfer-initiating D-Bus methods.
2012-12-04 22:49:01 +01:00
Mikel Astiz
b5fe20a9a4 obexd: Support empty filename in obc_transfer_get
Passing an empty string as a filename for obc_transfer_get will be
similar to passing a NULL filename. This means a temporary file will be
created to store the content of the transfer.

NULL and "" are not exactly equivalent though: in case of NULL the file
will be automatically removed immediately after being open, which means
that the transfer initiator should also open the file to prevent it from
being removed (to be used from the modules). In this case, the filename
will not be exposed in D-Bus.

On the other hand, if "" is given, the file will be removed only in case
of error. So after success the transfer initiator should decide whether
the file should be removed or not.

This change is convenient in order to expose the same API in D-Bus.
2012-12-04 22:49:01 +01:00
Mikel Astiz
c8ec529a7c obexd: Make transfer filename optional
The property might not exist for certain transfers, typically when they
have been initiated internally.
2012-12-04 22:49:01 +01:00
Mikel Astiz
eae9cf3da1 obexd: Make FileTransfer.PutFile asynchronous
There is no reason to have inconsistent behavior between GetFile and
PutFile, in FileTransfer D-Bus API.

Before this change, PutFile reported success immediately after queueing
the transfer, even though the D-Bus signature includes the async flag.
2012-12-04 22:49:01 +01:00
Mikel Astiz
b91d48749b obexd: Expose all transfers in D-Bus
Relying on a internal policy (based on transfer type) to decide if a
transfer should be exposed or not in D-Bus has some limitations. The
simplest possible alternative to this is to expose all transfers in
D-Bus, assuming the overhead is not significant.
2012-12-04 22:49:00 +01:00
Mikel Astiz
b9f31ead5f obexd: Remove obsolete authentication code
After the removal of the agent, the implementation of the session can be
simplified by removing all authentication-related code.
2012-12-04 22:49:00 +01:00
Mikel Astiz
ef129dcce0 obexd: Remove internal transfer progress report
The new D-Bus API uses signals to report the progress updates, so the
internal progress callback is not needed any more.
2012-12-04 22:49:00 +01:00
Mikel Astiz
649a3ffdb8 obexd: Remove unused functions in transfer API
After the removal of the agent these functions are not useful any more.
2012-12-04 22:49:00 +01:00
Mikel Astiz
5e3bc6b93e obexd: Remove D-Bus agent
The authorization mechanism is entirely removed from the session, and
thus transfers are automatically started (once popped from the queue)
without confirmation and without any name/filename change.
2012-12-04 22:49:00 +01:00
Mikel Astiz
5119ebcc35 obexd: Use transfer owner instead of agent
The security checks in the transfers' D-Bus API will consider check for
the transfer owner's path (session owner) instead of the agent path.
2012-12-04 22:49:00 +01:00
Mikel Astiz
ce7b4cbd4c obexd: Add transfer event-reporting signals
These signals replace the old agent-based notification mechanism.
2012-12-04 22:49:00 +01:00
Mikel Astiz
febb9caf52 obexd: Add progress property to transfer
The number of transferred bytes is exposed in D-Bus using a specific
property for this purpose.

Internally, the value of this property does not necessarily match the
internal progress counter. In order to avoid D-Bus overhead, the
property will be updated once per second.
2012-12-04 22:49:00 +01:00
Mikel Astiz
5ac5f18a8b obexd: Add D-Bus helper library
No functionality changes. This is just about avoiding duplicated code.
2012-12-04 22:49:00 +01:00
Mikel Astiz
9250a662b3 obexd: Replace parameter dict with conventional ones 2012-12-04 22:49:00 +01:00
Mikel Astiz
3d7cfa6c5b obexd: Move GetCapabilities to session API 2012-12-04 22:49:00 +01:00
Mikel Astiz
1b6d5d12f3 obexd: Replace SendFiles with SendFile
The function is now asynchronous, since it will return only when the
transfer has been finished.
2012-12-04 22:49:00 +01:00
Mikel Astiz
0377b04bc8 obexd: Wrap OPP into specific session type 2012-12-04 22:49:00 +01:00
Mikel Astiz
8a1b3f32de obexd: Use constant instead of NULL variable
The filename will always be NULL for capability-requesting sessions, so
it doesn't make much sense to use such field.
2012-12-04 22:49:00 +01:00
Paul Seidler
65c6680728 obexd: Remove left over glib-helper.h support 2012-12-04 22:48:59 +01:00
Mikel Astiz
80a93e2a22 obexd: Simplify error-handling code
Refactor error-handling code to avoid duplicated code.
2012-12-04 22:48:59 +01:00
Mikel Astiz
1b0e0092dd obexd: Fix NULL dereference in case of error
obc_session_queue assumes that the given transfer is not NULL, so this
must be checked explicitly.
2012-12-04 22:48:59 +01:00
Lucas De Marchi
9692e783c3 obexd: Do not set signature and reply in GDBus tables
Use GDBUS_* macros, so signature and reply fields are not set in each
method/signal.
2012-12-04 22:48:59 +01:00
Lucas De Marchi
d67b588d2b obexd: Convert GDBus methods to use macro helpers
With these macro helpers we can separate in/out arguments and use their
own vector.
2012-12-04 22:48:59 +01:00
Marcel Holtmann
e39e821a6a obexd: Constify GDBus signal tables
Constify signal tables with the following command:

find . -name '*.[ch]' -exec \
         sed -i 's/\(GDBusSignalTable .* =\)/const \1/g' {} \;
2012-12-04 22:48:59 +01:00
Marcel Holtmann
fc009dd49e obexd: Constify GDBus method tables
Constify method tables with the following command:

find . -name '*.[ch]' -exec \
         sed -i 's/\(GDBusMethodTable .* =\)/const \1/g' {} \;
2012-12-04 22:48:59 +01:00
Luiz Augusto von Dentz
1282ed28f0 obexd: Fix not checking if GoepL2capPsm contains a valid PSM
In case the PSM is not valid ignore it so we are still able to connect
to RFCOMM.
2012-12-04 22:48:59 +01:00
Luiz Augusto von Dentz
b8c8567c3d obexd: Fix not setting port to 0 when listen fails
With some only kernels auto assigning psm seem to fail, leaving the psm
with wrong value:

obexd[2930]: plugins/bluetooth.c:start() listening on channel 9
obexd[2930]: bluetooth: unable to listen in psm 65535
obexd[2930]: plugins/bluetooth.c:start() listening on channel 10
obexd[2930]: bluetooth: unable to listen in psm 65535
2012-12-04 22:48:59 +01:00
Luiz Augusto von Dentz
0cbb1f10f2 obexd: Use stack memory for application parameters in pbap module
The maximum amount needed is known and sufficiently small to be in the
stack which is much simpler to deal with.
2012-12-04 22:48:59 +01:00
Luiz Augusto von Dentz
fcd02ad59b obexd: Add obc_transfer_set_params to set application parameters
The parameters are optional and only used in a few occasions so it
doesn't make sense to have that directly in obc_transfer_get and
obc_transfer_put.
2012-12-04 22:48:59 +01:00
Mikel Astiz
9b883a0264 obexd: Create transfers in modules
After this patch the modules are responsible for creating the transfers,
and these objects must be queued using the session API.

This way the transfer initiator has full access to the transfer object,
in case for example it wants to access some member variable.
2012-12-04 22:48:59 +01:00
Mikel Astiz
02cc0066d9 obexd: Flip parameter order in transfer API
This minor change makes the transfer API more consistent with the
parameter-order used in the session API.
2012-12-04 22:48:59 +01:00
Mikel Astiz
c342f70d6b obexd: Buffer-passing changes in transfer API
Transfer API now takes const buffers (both params and contents) and
internally copies the memory as necessary. This new API is safer to use,
which is convenient if the modules would start using it directly.
2012-12-04 22:48:58 +01:00
Mikel Astiz
fea2985b14 obexd: Transfer API splits create and register
The transfer-creating functions (obc_transfer_get and obc_transfer_put)
no longer register the transfer automatically.

This separation makes it possible that the modules would create the
transfers and then pass the object to the session, which would be
responsible for the registration.
2012-12-04 22:48:58 +01:00
Mikel Astiz
ec2a58fdae obexd: Split internal obc_transfer_register()
The creation process has been internally split into two steps: creation
and D-Bus registration. This is easier to understand and it also allows
to expose these two-steps in the transfer API.
2012-12-04 22:48:58 +01:00
Mikel Astiz
cc648c10fe obexd: Fix possible double free of params
obc_transfer_get() and obc_transfer_put() should only assume ownership
of the given params only in case of success. Otherwise some erros might
result in a double free of such memory.
2012-12-04 22:48:58 +01:00
Luiz Augusto von Dentz
68d8b41ec2 obexd: Add handler for SIGUSR2
This signal enables debug for obed so just do the same for obex-client
2012-12-04 22:48:58 +01:00
Luiz Augusto von Dentz
f9efbe9f80 obexd: Use signalfd to handle unix signals 2012-12-04 22:48:58 +01:00
Luiz Augusto von Dentz
55be67c681 obexd: Use signalfd to handle unix signals
Writing anything to syslog in the signal handler can cause a deadlock
with any ongoing syslog write.

This is also aligned with what BlueZ and other projects has been doing.
2012-12-04 22:48:58 +01:00
Luiz Augusto von Dentz
b248e814f2 obexd: Fix codying style
Fix lines that are over 80 columns
2012-12-04 22:48:58 +01:00
Jaganath Kanakkassery
2971a64fa7 obexd: Wait for abort completion before Transfer.Cancel returns
A new callback is given to g_obex_cancel_transfer() which will be
called when abort completes and then only "Cancel" method reply will
be sent to user
2012-12-04 22:48:58 +01:00
Mikel Astiz
5c92e9b1cc obexd: Remove transfer from queue before callback
It is safer to remove the transfer from the internal queue (including
session->p) before calling the transfer callback. This makes sure the
callback will not manipulate the session in a way that the transfer is
removed more than once.

This was previously protected with session->p->id != 0 checks, but once
the new callbacks have been adopted in session API, this logic can be
removed.
2012-12-04 22:48:58 +01:00
Mikel Astiz
c59cab5341 obexd: Remove deprecated part of session API
Once the modules are using the new callback style, the session API can
be simplified and the old functions to access session->p removed.
2012-12-04 22:48:58 +01:00
Mikel Astiz
6fb9a7a84b obexd: Use new session callback style in modules
The session API now provides the transfer object in the callback, so
the modules can directly access the transfer object.
2012-12-04 22:48:58 +01:00
Mikel Astiz
b782daebcd obexd: Give transfer pointer in session callbacks
Operations involving a transfer object will receive a pointer to such
transfer in the callback.

Note that the ownership of this object is not changed in any way,
meaning that the session is still responsible for it. However this
pointer can be useful during the execution of the callback, in order to
access data members of the transfer.
2012-12-04 22:48:58 +01:00
Mikel Astiz
907d414d26 obexd: Avoid GObex dependency from transfer.h
This workaround makes it possible to include transfer.h from the
modules, without adding a dependency to GObex.
2012-12-04 22:48:58 +01:00
Mikel Astiz
f41c43a6e5 obexd: Minor buffer access API changes
Trivial changes in buffer getters in both session and transfer,
regarding the access of transfer parameters:
	- const qualifiers added, to avoid unwanted frees
	- Buffers are now returned as void* instead of guint8*
2012-12-04 22:48:57 +01:00
Jaganath Kanakkassery
1e9bca91cc obexd: Emit TransferStarted signal only if stream start is success
Even if obex_put_stream_start() fails TransferStarted signal will be
emitted where as transfer start is actually failed.
2012-12-04 22:48:57 +01:00
Luiz Augusto von Dentz
936153406b obexd: Return request id when generating a request in session API
This is more consistent with other functions and allow the caller to
cancel the request using obc_session_cancel.
2012-12-04 22:48:57 +01:00
Luiz Augusto von Dentz
4d0d679535 obexd: Fix not propagating GError in session API functions
The errors should be properly forward to the caller and not just convert
to generic error.
2012-12-04 22:48:57 +01:00
Luiz Augusto von Dentz
0f4eb3e5ce obexd: Remove file in case of error
If the transfer operation is GET and it has not complete by the time its
freed remove the file as its contents maybe corrupted/incomplete.
2012-12-04 22:48:57 +01:00
Luiz Augusto von Dentz
0977754be8 obexd: open file during transfer creation
This simplify the API a bit by not having to call obc_transfer_set_file
to open the file.

In addition to that split transfer creation/registration function so
GET/PUT can have more specific logic and different paramenters.
2012-12-04 22:48:57 +01:00
Mikel Astiz
272ef02090 obexd: transfers take gobex when starting
gobex api should not be used by a transfer until it is started. This
seems more explicit if the pointer is not passed during creation.
2012-12-04 22:48:57 +01:00
Mikel Astiz
dd78f7c165 obexd: transfer api merges put and get
A new enum type is used to distinguish put and get transfers.

This is more convenient since it is done when registering the transfer,
and not when it is actually started. The main benefits would be:
    - Some actions can be taken during creation, such as opening files.
    - session.c gets simplified.
    - The size of a put transfer can be exposed in D-Bus, while queued.
    - The transfer operation (put or get) can be exposed in D-Bus.

None of these D-Bus changes are included in this patch.
2012-12-04 22:48:57 +01:00
Mikel Astiz
f3636d08a1 obexd: remove unused field
The errorcode field is set but never used, so it can safely be removed.
In addition there is no need for such a field, because errors can be
propagated using the available callback.
2012-12-04 22:48:57 +01:00
Luiz Augusto von Dentz
0cdd9bd069 obexd: Remove buffer based transfer
Simplify the code by using temporary files and eliminates reallocations.
2012-12-04 22:48:57 +01:00
Luiz Augusto von Dentz
05b22ad10b obexd: Fix possible memory leak on pbap module
16 bytes in 1 blocks are definitely lost in loss record 26 of 146
   at 0x4A075B2: realloc (vg_replace_malloc.c:525)
   by 0x3B5104B76D: g_realloc (in /lib64/libglib-2.0.so.0.3000.2)
   by 0x3B51064A96: ??? (in /lib64/libglib-2.0.so.0.3000.2)
   by 0x3B51065156: g_string_insert_len (in /lib64/libglib-2.0.so.0.3000.2)
   by 0x3B510305BC: ??? (in /lib64/libglib-2.0.so.0.3000.2)
   by 0x3B51031BE7: g_build_filename (in /lib64/libglib-2.0.so.0.3000.2)
   by 0x416FEE: pbap_select (pbap.c:254)
   by 0x406CCE: process_message (object.c:224)
   by 0x3B5301D9A0: ??? (in /lib64/libdbus-1.so.3.5.6)
   by 0x3B5300F92F: dbus_connection_dispatch (in /lib64/libdbus-1.so.3.5.6)
2012-12-04 22:48:57 +01:00
Luiz Augusto von Dentz
942bfc969d obexd: Fix regression when calling obc_session_shutdown within callback
Commit c07ddfbd019d3545cce2d7ec694143cdc55a2167 introduced the freeing of
the active pending request on obc_session_shutdown without checking if
the request was already processed/terminated.
2012-12-04 22:48:57 +01:00
Marcel Holtmann
d4dff22a7b obexd: Remove glib-helper.h support 2012-12-04 22:48:57 +01:00
Syam Sidhardhan
99f60e7937 obexd: Remove unused struct session_callback 2012-12-04 22:48:56 +01:00
Syam Sidhardhan
6bac0ac47b obexd: Remove headers declared but not defined 2012-12-04 22:48:56 +01:00
Syam Sidhardhan
6bf1fe6513 obexd: Use goto for avoiding code duplication 2012-12-04 22:48:56 +01:00
Syam Sidhardhan
0315434a0e obexd: Fix memory leak during session connect 2012-12-04 22:48:56 +01:00
Slawomir Bochenski
73ba38a475 obexd: Output parameters for GetMessagesListing
This sets the parameters returned from MAP backend for
GetMessagesListing to be used in application parameters header sent in
response.
2012-12-04 22:48:56 +01:00
Slawomir Bochenski
0edc37569f obexd: Input parameters for GetMessagesListing
This adds support for input application parameters header given in
GetMessagesListing request.
2012-12-04 22:48:56 +01:00
Slawomir Bochenski
a6be16b9d3 obexd: Mark filter strings const
This structure is used for giving filters as input argument to
messages_get_messages_listing(). There is no need for the string members
to be modifiable in this context. And making them const plays well with
map_ap_get_string(), from which the values of these members are going to
be retrieved.

The string pointers here are simply references to data held in map_ap_t
*inparams.
2012-12-04 22:48:56 +01:00
Slawomir Bochenski
6c120dcfc7 obexd: Output parameters in folder listing reply
This also introduces reusable any_get_next_header() that will be further
utilised in other requests returning application parameters header.
2012-12-04 22:48:56 +01:00
Slawomir Bochenski
832a725f35 obexd: Initial outgoing parameters support 2012-12-04 22:48:56 +01:00
Slawomir Bochenski
3e48e93775 obexd: Add implementation of map_ap_encode() 2012-12-04 22:48:56 +01:00
Frédéric Danis
5b3d5a1ad5 obexd: fix message-dummy.c build
If g_slist_free_full is not supported by glib, build fails with error:

plugins/messages.o: In function `get_folder_listing':
/home/fdanis/src/obexd/plugins/messages.c:199: undefined reference to `g_slist_free_full'
2012-12-04 22:48:56 +01:00
Johan Hedberg
d81f788767 obexd: map_ap: Fix whitespace errors 2012-12-04 22:48:56 +01:00
Slawomir Bochenski
733df07494 obexd: Use input parameters for folder listing 2012-12-04 22:48:56 +01:00
Slawomir Bochenski
63be38a1fc obexd: Add implementation for map_ap_get_* 2012-12-04 22:48:56 +01:00
Slawomir Bochenski
b5d625fea3 obexd: Process incoming parameters in GET/PUT 2012-12-04 22:48:55 +01:00
Slawomir Bochenski
9e8e506501 obexd: Add sorting of folder listing 2012-12-04 22:48:55 +01:00
Slawomir Bochenski
9663c4e2ed obexd: Code for returning folder listing 2012-12-04 22:48:55 +01:00