Commit Graph

1310 Commits

Author SHA1 Message Date
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
Slawomir Bochenski
a09c8374d0 obexd: Actual code for folder listing retrieval 2012-12-04 22:48:55 +01:00
Mikel Astiz
a64765498f obexd: simplify obc_session_pull
Functions obc_session_get and obc_session_pull nearly share the same
code, so the later can be achieved by just calling the first one.

The session api is not modified in this patch.
2012-12-04 22:48:55 +01:00
Mikel Astiz
687141b979 obexd: refactor naming convention in session api
The terms "name", "filename" and "targetname" are used in session.h that
can be confusing. This patch proposes to follow the terminology in the
D-Bus api:
	- Name: the remote name of the object being transferred
	- Filename: the local filesystem name of a file being sent
	- Targetfile: the local filesystem name of a file being
		received
2012-12-04 22:48:55 +01:00
Mikel Astiz
1fee4d9205 obexd: fix naming convention in transfer api
The terms can be quite misleading, so this patch proposes to follow the
terminology in the D-Bus api:
       - Name: the remote name of the object being transferred
       - Filename: the name of the file in local the filesystem

Both values can be NULL independently.

This fixes the problem of using the terms differently in get and put
operations. The result was that the properties "Name" and "Filename" were
swapped in D-Bus in the case of get.

Once the fields map to obex fields, the interpretation of the response
from the agent becomes more complicated. Depending on the transfer type,
either the name or the filename field must be updated.
2012-12-04 22:48:55 +01:00
Mikel Astiz
84d105d8e0 obexd: add obc_transfer_set_filename
This is just a setter for the filename field in transfers.
2012-12-04 22:48:55 +01:00
Slawomir Bochenski
e6814f9e2e obexd: Add basic logic for folder listing 2012-12-04 22:48:55 +01:00
Slawomir Bochenski
81fb93fef7 obexd: Add stub for asynchronous folder listing 2012-12-04 22:48:55 +01:00
Divya Yadav
d37fe0b4cc obexd: Fix application parameter parsing in obex put
Fix for application parameter parsing which is missing
in obex put.
2012-12-04 22:48:55 +01:00
Luiz Augusto von Dentz
6d78da00e2 obexd: Remove unused public function
obex_io_error_quark is only used in session.c so can be static
2012-12-04 22:48:55 +01:00
Mikel Astiz
d381a6d934 obexd: free active transfer on session shutdown
The currently active request should be canceled just like any other
queued transfer. Otherwise obex timeout is reported.
2012-12-04 22:48:55 +01:00
Mikel Astiz
1eeaea6831 obexd: fix unreported canceled transfers
A session can be shut down from D-Bus, and therefore the pending
transfer callbacks must be reported.
2012-12-04 22:48:55 +01:00
Mikel Astiz
baa84b7232 obexd: fix canceling queued transfers
The Cancel() method in the D-Bus api should also abort queued transfers,
which should just be removed from the queue.
2012-12-04 22:48:55 +01:00
Mikel Astiz
19b460afbc obexd: terminate queued transfers properly
Previous implementation of session_terminate_transfer assumed that the
transfer being terminated would always be the active one. However, it
should be possible to cancel any queued transfer using the D-Bus api.
2012-12-04 22:48:54 +01:00
Mikel Astiz
81cc887ccd obexd: make sure callback does not match size
Otherwise it can be interpreted as successfully finished, which has its
own code path.
2012-12-04 22:48:54 +01:00
Mikel Astiz
902f089da6 obexd: expose obc_transfer_set_callback
This will allow setting the callback before the transfer is started,
particularly to report queued transfer cancellations.
2012-12-04 22:48:54 +01:00
Mikel Astiz
5189cfee80 obexd: process transfer queue only if none active
session_process_queue should make sure there is no active operation, to
avoid starting a second one at the same time.
2012-12-04 22:48:54 +01:00
Mikel Astiz
ffb675e39a obexd: fix cancel when no agent present
The authorization check should consider the scenario of no agent being
assigned to the transfer.
2012-12-04 22:48:54 +01:00
Mikel Astiz
7b944e8f00 obexd: fix obc_session_get_buffer
Size 0 should be reported if no transfer exists. Some existing code
relies on this behavior.
2012-12-04 22:48:54 +01:00
Luiz Augusto von Dentz
35e61613f5 obexd: map: Use ENOSYS to indicate not implemented function 2012-12-04 22:48:54 +01:00
Luiz Augusto von Dentz
81bdbef89e obexd: Use ENOSYS to indicate not implemented function 2012-12-04 22:48:54 +01:00
Luiz Augusto von Dentz
93c9b5a56f obexd: Use ENOSYS to indicate not implemented function 2012-12-04 22:48:54 +01:00
Luiz Augusto von Dentz
4c2a0c0da0 obexd: Use ENOSYS to indicate not implemented function 2012-12-04 22:48:54 +01:00
Luiz Augusto von Dentz
e57e3c4083 obexd: Make use of g_obex_errno_to_rsp to translate posix errors 2012-12-04 22:48:54 +01:00
Luiz Augusto von Dentz
f576cae0fb obexd: Fix queueing packet containing error while suspended
Queueing the error won't remove the original packet created by transfer
from the queue so upon resume gobex will attempt to send it again.

To fix this we no longer create a error packet instead the session is
market as aborted and the error stored so when gobex finally resumes the
error is forward properly.
2012-12-04 22:48:54 +01:00
Mikel Astiz
2e1ab9b75d obexd: queue transfers in pbap sessions
Previous implementation reported busy when trying to queue several
operations in the same session.
2012-12-04 22:48:54 +01:00
Mikel Astiz
2e6096423c obexd: queue transfers in ftp sessions
Previous implementation reported busy when trying to queue several
transfers in the same session.
2012-12-04 22:48:54 +01:00
Mikel Astiz
64e3360bf6 obexd: fix pbap select when same path given twice
If the same path is selected twice, the operation can be skipped but the
D-Bus response should still be sent.
2012-12-04 22:48:53 +01:00
Mikel Astiz
aae5348e9d obexd: fix incorrect error check
Previous statement always returned success.
2012-12-04 22:48:53 +01:00
Mikel Astiz
46e41cbc06 obexd: fix unreported error case
The authorization request of a queued transfer could fail, and this
needs to be reported to the transfer initiator. Otherwise it would
likely result in D-Bus timeouts.
2012-12-04 22:48:53 +01:00
Mikel Astiz
5655cb9c50 obexd: fix memory leak in obc_session_put
obc_session_put takes ownership of the given buffer, but did not free
the memory in case of error.
2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
318dfd0916 obexd: Add L2CAP support in bluetooth module
This adds support for reading GoepL2capPsm attribute from sdp record
and connect to it.
2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
713ca9d9ce obexd: Update record to support version 1.2 with GoepL2capPsm attribute 2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
5955e79c28 obexd: Update record to support version 1.2 with GoepL2capPsm attribute 2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
47f6ccd270 obexd: Add support for L2CAP transport
This uses driver port, if set (!= 0), as psm and export it in the service
record.
2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
10092d19c7 obexd: Add port to service driver
This add possibility to optional port in addition to channel.
2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
8303363e6e obexd: Fix sending GET while SRM is active
If SRM is active remote will be generating responses automatically
2012-12-04 22:48:53 +01:00
Jaganath Kanakkassery
533eb6f7e2 obexd: Fix length parameter of strncpy 2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
922d181945 obexd: remove gobex dependency of session
Modules should no longer need to access gobex directly
2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
fcc8068de6 obexd: remove use of gobex in ftp module
gobex should not be use directly as it can interfere with ongoing
requests of the session.
2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
f5a5c95953 obexd: remove use of gobex in map module
gobex should not be use directly as it can interfere with ongoing
requests of the session.
2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
c4b8c8adaf obexd: remove use of gobex in pbap module
gobex should not be use directly as it can interfere with ongoing
requests of the session.
2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
5e8a10df92 obexd: introduce obc_session_cancel 2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
514cc9d0bb obexd: introduce obc_session_delete 2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
2e91048ed5 obexd: introduce obc_session_move 2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
5c1c3c5d11 obexd: introduce obc_session_copy 2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
aa38bd0529 obexd: introduce obc_session_mkdir 2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
ed58b41924 obexd: introduce obc_session_setpath 2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
5da12f4189 obexd: fix not queuing requests properly
OBEX does not support requests in parallel so they have to be queued
like in SendFiles.
2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
65d9c7f8a5 obexd: remove unused field from obc_session 2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
f427608f89 obexd: fix not checking session_request return
In case session_request return an error proceed to the next
2012-12-04 22:48:52 +01:00
Jaganath Kanakkassery
b5a360fbfa obexd: Fix file not getting deleted when a push is aborted
Problem: Even if transfer is aborted file will be saved with partial
content.

Fix: In os_reset_session() os->cmd is checked for PUT before calling
driver->remove(), but os->cmd is never assigned.This fix sets os->cmd
wit respective opcode
2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
5ffb0bb37f obexd: Fix folder listing
parent-folder should indicates the existence of a parent folder which is
the opposit of what the code is currently doing.
2012-12-04 22:48:52 +01:00
Mikel Astiz
685ed406d0 obexd: Fix possible GLib assertion failure
In case of error there might be no io channel to shutdown.
2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
4e4c8e2348 obexd: simplify handling of D-Bus pending calls in bluetooth.c
There is no much of point to have a user_data if it is always the same
type, besides this code is very inefficient and cause a lookup in the list
of pending calls everytime a reply is received.
2012-12-04 22:48:51 +01:00
Luiz Augusto von Dentz
bab4ca5f16 obexd: move bluetooth specific code from session.c to bluetooth.c
This simplifies session.c code quite a bit and enables supporting other
transports in the future.
2012-12-04 22:48:51 +01:00
Luiz Augusto von Dentz
8c97039f4e obexd: add bluetooth transport driver 2012-12-04 22:48:51 +01:00
Luiz Augusto von Dentz
6a3f42a5bc obexd: add support for transport drivers 2012-12-04 22:48:51 +01:00
Luiz Augusto von Dentz
3c51a36628 obexd: remove unused field 2012-12-04 22:48:51 +01:00
Luiz Augusto von Dentz
7aa89d5567 obexd: fix circular dependency of session and transfer
Currently the code has to to pass session to transfer via user data
(void *) only to be casted to session.
2012-12-04 22:48:51 +01:00
Slawomir Bochenski
e749fef83d obexd: Add dumping of map_ap_t after decoding 2012-12-04 22:48:51 +01:00
Slawomir Bochenski
6868d525a6 obexd: Add implementation for map_ap_decode() 2012-12-04 22:48:51 +01:00
Slawomir Bochenski
b59066b15a obexd: Add implementation for map_ap_set_* 2012-12-04 22:48:51 +01:00
Slawomir Bochenski
ecd5269bdf obexd: map_ap.h: Remove MAP_AP_INVALID
Due to the change in MAP AP definitions resolving, there is no need for
guard value.
2012-12-04 22:48:51 +01:00
Slawomir Bochenski
b0274b335e obexd: Implementation of MAP AP core functions
This adds implementation for creation and destruction of map_ap_t and
the definitions of MAP supported application parameters.
2012-12-04 22:48:51 +01:00
Luiz Augusto von Dentz
cb74e05c97 obexd: fix not being able to read apparams when transfer is complete
Transfer id/xfer is set to zero when it is completed which should not
prevent the profiles to read the apparam of the last response.
2012-12-04 22:48:51 +01:00
Luiz Augusto von Dentz
f435b5843e obexd: fix parsing of apparam on pbap driver
Both hdr and size need to be updated otherwise no parameters will be
parsed.
2012-12-04 22:48:51 +01:00
Jaganath Kanakkassery
20d8a4eb4f obexd: Reset obex session in transfer_complete()
This fix solves the following issues in multiple file push.
Agent authorize is happening only for first file.
Transfer_completed signal is getting called only after last push
Incorrect value is sent for "total" and "transfered" signal from
second file onwards.
2012-12-04 22:48:51 +01:00
Jaganath Kanakkassery
aa6d455c9f obexd: Fix incorrect transfer path id during request authorization
Transfer is registered with id as cid, but authorize method
is called with id as pointer to obex session structure
2012-12-04 22:48:50 +01:00
Sunil Kumar Behera
e75b28ed4b obexd: Fix possible invalid memory access
Issue: As reported by static code analyzer (Coverity), if buffer is NULL
and aparams is not NULL, then buffer gets dereferenced in string_read
function.

Fix: Application parameter is allocated only if maxlistcount is zero
during phonebooksize request and buffer is allocated in case of pull
phonebook request, hence modify logic to avoid application parameter
check, as it is tightly coupled with maxlistcount.
2012-12-04 22:48:50 +01:00
Luiz Augusto von Dentz
25894c2cf4 obexd: Fix not responding SUCCESS code to GET in some conditions
When there is no body to be transfer obexd is responding with CONTINUE.
2012-12-04 22:48:50 +01:00
Luiz Augusto von Dentz
426fde90b2 obexd: Fix not responding when driver_get_headers return 0
When calling driver_get_headers it may not be ready but after the backend
respond the result can still be 0 which indicades no headers need to
added and we can start sending the body.
2012-12-04 22:48:50 +01:00
Johan Hedberg
c638f7d77b obexd: Fix coding style issues 2012-12-04 22:48:50 +01:00
Divya Yadav
4390cc444e obexd: Add UpdateInbox function
UpdateInbox function allows remote device to initiate an update of
the MSE inbox, i.e. the MSE shall contact the network to retrieve
new messages if available. If MSE does not support the network
update it shall answer with a 'Not implemented' error response.
2012-12-04 22:48:50 +01:00
Divya Yadav
9fb880095d obexd: messages-tracker: Fix coding style
Starting brace for a function should start on the next line.
2012-12-04 22:48:50 +01:00
Marcel Holtmann
9e0ad10a18 obexd: Fix compilation issues with standard includes 2012-12-04 22:48:50 +01:00
Johan Hedberg
9b2277a879 obexd: map: Rename GetMessagesListing to GetMessageListing 2012-12-04 22:48:50 +01:00
Bartosz Szatkowski
7ee7a67ce0 obexd: Add support for PullMessagesListing in MAP client
Just basic functionality for now, returning whole listing as a string
(no parsing) and no apparams handling.
2012-12-04 22:48:50 +01:00
Bartosz Szatkowski
8b15cbab9f obexd: Add basic support for MAP folder listing
For now just basic functionality - returning whole listing as a string
(no parsing for now) and no apparams handling.
2012-12-04 22:48:50 +01:00
Bartosz Szatkowski
76acb638b0 obexd: Add support for SetFolder in MAP client 2012-12-04 22:48:50 +01:00
Bartosz Szatkowski
9a9af3203b obexd: Add basic support for MAP client in obex-client 2012-12-04 22:48:50 +01:00
Slawomir Bochenski
180bf0230c obexd: Skeleton of application parameters support
This introduces skeleton of functions for supporting processing of
Message Access Profile specific OBEX application parameters. The code is
usable in both MSE (server) and MCE (client), thus the patch enables
linking the code to obexd and obex-client.
2012-12-04 22:48:50 +01:00
Slawomir Bochenski
afeb4ea4fd obexd: phonebook-tracker: Fix iso8601_utc_to_localtime
Timestamp returned from Tracker can optionally contain fractional
seconds. Original code treated any character after seconds as flag for
UTC timestamp. This patch changes it so now only the beginning of string
is scanned and the end of string is checked for UTC flag ('Z') presence.
2012-12-04 22:48:49 +01:00
Jaganath Kanakkassery
320dc79f0f obexd: Fix file size issue in GetProperties
In SendFiles, If application calls GetProperties before
Request method returns then the file size is zero.
2012-12-04 22:48:49 +01:00
Marcel Holtmann
2e51d19322 obexd: Remove OpenOBEX includes 2012-12-04 22:48:49 +01:00
Marcel Holtmann
b2b81a8bdb obexd: Remove OpenOBEX include and fix standard includes 2012-12-04 22:48:49 +01:00
Marcel Holtmann
f36146536c obexd: Remove OpenOBEX include and fix standard includes 2012-12-04 22:48:49 +01:00
Marcel Holtmann
464fac29c5 obexd: Remove OpenOBEX include and fix standard includes 2012-12-04 22:48:49 +01:00
Marcel Holtmann
b0de4be15a obexd: Remove OpenOBEX include 2012-12-04 22:48:49 +01:00
Luiz Augusto von Dentz
39a5f727d4 obexd: Port core daemon to gobex 2012-12-04 22:48:49 +01:00
Luiz Augusto von Dentz
d1116a27c2 obexd: Remove obex_get_id
Plugins that need the peer address/name should use obex_getpeername which
uses the transport driver to resolve it.
2012-12-04 22:48:49 +01:00
Luiz Augusto von Dentz
f225d135fc obexd: Fix calling getpeername directly on manager.c
Manager should be transport agnostic and not pretend the transport is
always RFCOMM since in future this might not be true even for Bluetooth.
2012-12-04 22:48:49 +01:00
Luiz Augusto von Dentz
5d609076ac obexd: add .getpeername support 2012-12-04 22:48:49 +01:00
Luiz Augusto von Dentz
09044e631d obexd: make use of secure flag for authorization
Using secure flag is probably safer here as other services beside OPP
may not require security/authorization.
2012-12-04 22:48:49 +01:00
Bartosz Szatkowski
d6fdefe906 obexd: Fix app params memory management 2012-12-04 22:48:49 +01:00
Mikel Astiz
c37d1d65dd obexd: syncevolution: fix missing header file
This missing include directive makes the syncevolution plugin fail to
compile. In Fedora 16 with gcc version 4.6.1 20110908, the output is:

make --no-print-directory all-am
  CC     plugins/syncevolution.o
In file included from plugins/syncevolution.c:40:0:
./src/mimetype.h:33:46: error: unknown type name ‘mode_t’
plugins/syncevolution.c:277:54: error: unknown type name ‘mode_t’
plugins/syncevolution.c:438:2: error: unknown field ‘open’ specified in initializer
plugins/syncevolution.c:438:10: error: ‘synce_open’ undeclared here (not in a function)
make[1]: *** [plugins/syncevolution.o] Error 1
2012-12-04 22:48:49 +01:00
Luiz Augusto von Dentz
084032f895 obexd: remove dependency on openobex 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
1704feb925 obexd: syncevolution: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
15b76b4e79 obexd: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
550222b05d obexd: remove duplicated includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
827f508860 obexd: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00