Commit Graph

194 Commits

Author SHA1 Message Date
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
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
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
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
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
Bartosz Szatkowski
d6fdefe906 obexd: Fix app params memory management 2012-12-04 22:48:49 +01:00
Slawomir Bochenski
c0ad77f7e8 obexd: Fix crash on error in agent_request_reply
This fixes regression introduced by
63becff48820dc50a30ae495e286e858a886d9dd, causing obex-client to crash
in cases of e.g. remote site rejecting pushed file.

The req->function set by user of agent API may request agent object
deletion. This in turn checks if agent->pending is set and if it is,
it tries to cancel the pending call and frees pending call data. As at
this point we are already handling call response and we are going to
free this pending call data, agent->pending can be set to NULL prior to
calling req->function, thus preventing premature freeing of later
dereferenced req.
2012-12-04 22:48:46 +01:00
Slawomir Bochenski
9857369dc8 obexd: Fix missing format in call to g_error_new 2012-12-04 22:48:45 +01:00
Luiz Augusto von Dentz
230e706f80 obexd: Fix possible crash when indicating progress
The amount of transferred bytes should only be updated after it has
been sent.
2012-12-04 22:48:45 +01:00
Luiz Augusto von Dentz
9d1f970eb2 obexd: fix possible crash on GetFile
Invalid read of size 8
   at 0x413DA1: get_file_callback (ftp.c:184)
   by 0x40A74E: transfer_complete (gobex-transfer.c:73)
   by 0x40AB91: transfer_response (gobex-transfer.c:172)
   by 0x40847A: handle_response (gobex.c:629)
   by 0x408C06: incoming_data (gobex.c:811)
   by 0x3E01043DBC: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2910.0)
   by 0x3E010445A7: ??? (in /lib64/libglib-2.0.so.0.2910.0)
   by 0x3E01044AF4: g_main_loop_run (in /lib64/libglib-2.0.so.0.2910.0)
   by 0x404CD4: main (main.c:102)
 Address 0x8 is not stack'd, malloc'd or (recently) free'd
2012-12-04 22:48:44 +01:00
Johan Hedberg
081807736b obexd: Remove g_obex_packet_find_header
This was exactly the same as g_obex_packet_get_header.
2012-12-04 22:48:44 +01:00
Luiz Augusto von Dentz
0e31d0f56b obexd: port to gobex
This remove gwobex dependency of the client using gobex instead.

Based on initial work by Johan Hedberg <johan.hedberg@intel.com>
2012-12-04 22:48:43 +01:00
Luiz Augusto von Dentz
6b7b19c972 obexd: add FileTransfer.CopyFile implementation 2012-12-04 22:48:43 +01:00
Luiz Augusto von Dentz
501fa35265 obexd: add FileTransfer.MoveFile implementation 2012-12-04 22:48:43 +01:00
Luiz Augusto von Dentz
3fbffebe57 obexd: add sync target
sync target implements sync driver
2012-12-04 22:48:42 +01:00
Luiz Augusto von Dentz
e976fc0a57 obexd: add pbap target
pbap target implements phonebook access driver
2012-12-04 22:48:42 +01:00
Luiz Augusto von Dentz
044d002f1f obexd: add ftp target
ftp target implements file transfer and Nokia Pc Suite drivers.
2012-12-04 22:48:42 +01:00
Luiz Augusto von Dentz
9e64065e4f obexd: add opp target
opp target implements object push driver
2012-12-04 22:48:42 +01:00
Luiz Augusto von Dentz
29eb13b108 obexd: make use of obc_ prefix for public functions
This should indicate more clearer which function are public to the
drivers.
2012-12-04 22:48:42 +01:00
Luiz Augusto von Dentz
590fd450bb obexd: add target driver support
This simplify target matching to a single place making it easier to add
new targets/profiles.

Matching is done by either friendly name e.g. opp, ftp... or Bluetooth
UUID.

Drivers are probed when a session is established and removed when the
session is destroyed.
2012-12-04 22:48:42 +01:00
Luiz Augusto von Dentz
ec0e7836cf obexd: move __obex_log_init before manager_init
This enables us to log target during initialization
2012-12-04 22:48:42 +01:00
Luiz Augusto von Dentz
7605e6c809 obexd: add target module vtable
New targets/profiles can be introduced by just adding an entry to the
table and register their drivers similarly to a plugin.
2012-12-04 22:48:42 +01:00
Luiz Augusto von Dentz
c3dee209a0 obexd: separate manager interface code from main
Move manager interface code to it own file.
2012-12-04 22:48:41 +01:00
Luiz Augusto von Dentz
22c7e9f390 obexd: separate agent code from session
This should improve modularization of code
2012-12-04 22:48:41 +01:00
Luiz Augusto von Dentz
fd15f3a28a obexd: separate ftp code from session
This should improve modularization of code
2012-12-04 22:48:41 +01:00
Luiz Augusto von Dentz
b5c28914a1 obexd: make transfer structure private
This make it easier to modularize obex-client
2012-12-04 22:48:41 +01:00
Luiz Augusto von Dentz
d06d20882a obexd: make session structure private
Session data should not be acessible directly otherwise it cause too
much dependency by profile specific code which is quite inefficient in
the long term.
2012-12-04 22:48:41 +01:00
Dmitriy Paliy
b17209a9b4 obexd: Add adapter ReleaseSession to obex-client
Release of adapter session is added to obex-client when closing OBEX
transfer.
2012-12-04 22:48:39 +01:00
Dmitriy Paliy
821da85bb6 obexd: Add handling of system D-Bus method calls
Sending system D-Bus method calls (DefaultAdapter, FindAdapter
and RequestSession) and handling of pending D-Bus calls is added
to obex-client.
2012-12-04 22:48:39 +01:00
Dmitriy Paliy
d89ad62c05 obexd: Split up session_create in separate functions
Connection of RFCOMM and SDP are extracted from session_create function
into session_connect. Such allows making asynchronous calls before
creating connections.
2012-12-04 22:48:39 +01:00
Dmitriy Paliy
bbcc0f34da obexd: Add system bus connection in obex-client
Connection to system bus is added in obex-client. Purpose is to carry
out OBEX transfers within a single adapter's session.
2012-12-04 22:48:39 +01:00
Dmitriy Paliy
d8d19199e8 obexd: remove unnecessary brackets 2012-12-04 22:48:38 +01:00
Bartosz Szatkowski
bca372b405 obexd: Fix endian conversion for appparams in pbap client 2012-12-04 22:48:36 +01:00
Luiz Augusto von Dentz
50071dde9c obexd: add support for reusing session for the same client
If the a client owning a session attempt to send a new file just reuse
the same session instead of trying to connect again.
2012-12-04 22:48:36 +01:00
Luiz Augusto von Dentz
4780531beb obexd: fix not canceling connection request if client exit bus
There is no point on proceeding with sdp/rfcomm connections if client
exit the bus.
2012-12-04 22:48:36 +01:00
Luiz Augusto von Dentz
553f3949b5 obexd: remove unused variable 2012-12-04 22:48:35 +01:00
Luiz Augusto von Dentz
932949fe49 obexd: Add support for stat files bigger than 2GB on 32-bit systems
From stat documentation:

"(stat())  path  refers to a file whose size cannot be represented in the
type off_t.  This can occur when an application compiled on a 32-bit
platform without -D_FILE_OFFSET_BITS=64 calls stat() on a file whose size
exceeds (2<<31)-1 bits."

To fix this now size header is omitted when the file is over 32-bit, but
it is able to transfer it by using 64-bit variables. In addition to that
folder-listing now should report such big sizes properly.
2012-12-04 22:48:32 +01:00
Luiz Augusto von Dentz
127fe7b3cf obexd: Fix logging for obex-client
Since obex-client and obexd share the same log code they both were using
obexd for openlog which makes it very confusing when reading the logs.

To fix this now __obex_log_init takes the binary name so that each daemon
can be properly labeled.
2012-12-04 22:48:31 +01:00
Luiz Augusto von Dentz
22d757b954 obexd: Fix possible crash when processing session callback
If the callback removes the pending data it cause this:

==20639== Invalid read of size 4
==20639==    at 0x80553E9: free_pending (session.c:112)
==20639==    by 0x8056C83: session_request_reply (session.c:837)
==20639==    by 0x412F7E0: ??? (in /lib/libdbus-1.so.3.5.2)
==20639==    by 0x411D975: ??? (in /lib/libdbus-1.so.3.5.2)
==20639==    by 0x4120B81: dbus_connection_dispatch (in /lib/libdbus-1.so.3.5.2)
==20639==    by 0x804C27F: message_dispatch (mainloop.c:80)
==20639==    by 0x407EFCB: ??? (in /lib/libglib-2.0.so.0.2600.1)
==20639==    by 0x407E854: g_main_context_dispatch (in /lib/libglib-2.0.so.0.2600.1)
==20639==    by 0x4082667: ??? (in /lib/libglib-2.0.so.0.2600.1)
==20639==    by 0x4082BA6: g_main_loop_run (in /lib/libglib-2.0.so.0.2600.1)
==20639==    by 0x8055171: main (main.c:625)
==20639==  Address 0x4363c88 is 0 bytes inside a block of size 12 free'd
==20639==    at 0x40257ED: free (vg_replace_malloc.c:366)
==20639==    by 0x4087485: g_free (in /lib/libglib-2.0.so.0.2600.1)
==20639==    by 0x80553FE: free_pending (session.c:115)
==20639==    by 0x805543C: agent_free (session.c:127)
==20639==    by 0x80566A6: session_free (session.c:149)
==20639==    by 0x8056BCA: session_terminate_transfer (session.c:914)
==20639==    by 0x8056F61: session_prepare_put (session.c:1397)
==20639==    by 0x8056C74: session_request_reply (session.c:835)
==20639==    by 0x412F7E0: ??? (in /lib/libdbus-1.so.3.5.2)
==20639==    by 0x411D975: ??? (in /lib/libdbus-1.so.3.5.2)
==20639==    by 0x4120B81: dbus_connection_dispatch (in /lib/libdbus-1.so.3.5.2)
==20639==    by 0x804C27F: message_dispatch (mainloop.c:80)

To fix this agent->pending is now reset to NULL before calling the
callback, so even if the session is terminated it won't cause a free to
pending data, which is fine since it is latter freed on callback return.
2012-12-04 22:48:31 +01:00