OSDN Git Service

android-x86/external-bluetooth-bluez.git
11 years agoobexd: Make handle of location more clear
Luiz Augusto von Dentz [Fri, 27 Jul 2012 14:56:57 +0000 (17:56 +0300)]
obexd: Make handle of location more clear

Add proper defines for supported paths and convert relative
path absolute to align with PBAP paths.

11 years agoobexd: phonebook: Replace magic strings for phonebook names and folders
Harald Schmitt [Wed, 18 Jul 2012 14:53:08 +0000 (16:53 +0200)]
obexd: phonebook: Replace magic strings for phonebook names and folders

11 years agoobexd: Fix phonebook contacts query
Harald Schmitt [Wed, 18 Jul 2012 14:53:07 +0000 (16:53 +0200)]
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.

11 years agoobexd: Add Message.Get implementation
Luiz Augusto von Dentz [Tue, 3 Jul 2012 18:28:13 +0000 (21:28 +0300)]
obexd: Add Message.Get implementation

11 years agoobexd: Use filter instead of dummy as argument name in MAP
Luiz Augusto von Dentz [Tue, 3 Jul 2012 18:28:11 +0000 (21:28 +0300)]
obexd: Use filter instead of dummy as argument name in MAP

This is aligned with the documentation that uses filter as well.

11 years agoobexd: Change MessageAccess.GetMessageListing to not return raw xml
Luiz Augusto von Dentz [Tue, 3 Jul 2012 18:28:08 +0000 (21:28 +0300)]
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,

11 years agoobexd: Change MessageAccess.GetFolderListing to not return raw xml
Luiz Augusto von Dentz [Tue, 3 Jul 2012 18:28:05 +0000 (21:28 +0300)]
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.

11 years agoobexd: Fix wrong signature of MessageAccess.SetFolder
Luiz Augusto von Dentz [Wed, 20 Jun 2012 10:51:32 +0000 (13:51 +0300)]
obexd: Fix wrong signature of MessageAccess.SetFolder

D-Bus string signature is 's' not 'string'

11 years agoobexd: Fix some common spelling errors
Szymon Janc [Wed, 13 Jun 2012 20:49:23 +0000 (22:49 +0200)]
obexd: Fix some common spelling errors

Fix spelling errors reported by codespell.

11 years agoobexd: Fix dead assignments
Szymon Janc [Wed, 13 Jun 2012 20:49:21 +0000 (22:49 +0200)]
obexd: Fix dead assignments

Values stored are never read.

11 years agoobexd: Fix error returning in obc_transfer_put
Szymon Janc [Wed, 13 Jun 2012 20:49:19 +0000 (22:49 +0200)]
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.

11 years agoobexd: Use g_malloc0 in get_filter_strs
Szymon Janc [Wed, 13 Jun 2012 20:49:18 +0000 (22:49 +0200)]
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.

11 years agoobexd: Fix use of uninitialized count variable
Szymon Janc [Wed, 13 Jun 2012 20:49:17 +0000 (22:49 +0200)]
obexd: Fix use of uninitialized count variable

If opendir() call fails count would be passed to callback
uninitialized.

11 years agoobexd: Fix memory leak in bluetooth driver
Luiz Augusto von Dentz [Wed, 13 Jun 2012 08:31:51 +0000 (11:31 +0300)]
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)

11 years agoobexd: Fix cancellation of queued transfers
Mikel Astiz [Tue, 12 Jun 2012 12:10:26 +0000 (14:10 +0200)]
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.

11 years agoobexd: Remove obc_transfer_abort
Mikel Astiz [Tue, 12 Jun 2012 12:10:25 +0000 (14:10 +0200)]
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.

11 years agoobexd: Fix possible unreplied D-Bus message
Mikel Astiz [Tue, 12 Jun 2012 12:10:24 +0000 (14:10 +0200)]
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.

11 years agoobexd: Fix using org.openobex.Error
Luiz Augusto von Dentz [Mon, 11 Jun 2012 10:30:39 +0000 (13:30 +0300)]
obexd: Fix using org.openobex.Error

In addition use define so it is easier to change this in future

11 years agoobexd: Use session path as prefix for transfer path
Luiz Augusto von Dentz [Thu, 7 Jun 2012 08:31:13 +0000 (11:31 +0300)]
obexd: Use session path as prefix for transfer path

This should make it easier to identify to which session the transfer
belongs.

11 years agoobexd: Fix not using connection passed to obc_transfer_register
Luiz Augusto von Dentz [Thu, 7 Jun 2012 08:31:12 +0000 (11:31 +0300)]
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.

11 years agoobexd: Rename Transfer interface to org.bluez.obex.Transfer
Luiz Augusto von Dentz [Fri, 1 Jun 2012 11:08:01 +0000 (14:08 +0300)]
obexd: Rename Transfer interface to org.bluez.obex.Transfer

11 years agoobexd: Rename MessageAccess interface to org.bluez.obex.MessageAccess
Luiz Augusto von Dentz [Fri, 1 Jun 2012 10:40:11 +0000 (13:40 +0300)]
obexd: Rename MessageAccess interface to org.bluez.obex.MessageAccess

11 years agoobexd: Rename Synchronization interface to org.bluez.obex.Synchronization
Luiz Augusto von Dentz [Fri, 1 Jun 2012 10:39:20 +0000 (13:39 +0300)]
obexd: Rename Synchronization interface to org.bluez.obex.Synchronization

11 years agoobexd: Rename PhonebookAccess interface to org.bluez.obex.PhonebookAccess
Luiz Augusto von Dentz [Fri, 1 Jun 2012 10:37:50 +0000 (13:37 +0300)]
obexd: Rename PhonebookAccess interface to org.bluez.obex.PhonebookAccess

11 years agoobexd: Rename FileTransfer interface to org.bluez.obex.FileTransfer
Luiz Augusto von Dentz [Fri, 1 Jun 2012 10:36:09 +0000 (13:36 +0300)]
obexd: Rename FileTransfer interface to org.bluez.obex.FileTransfer

11 years agoobexd: Rename ObjectPush interface to org.bluez.obex.ObjectPush
Luiz Augusto von Dentz [Fri, 1 Jun 2012 10:33:09 +0000 (13:33 +0300)]
obexd: Rename ObjectPush interface to org.bluez.obex.ObjectPush

11 years agoobexd: Rename session interface to org.bluez.obex.Session
Luiz Augusto von Dentz [Fri, 1 Jun 2012 10:27:44 +0000 (13:27 +0300)]
obexd: Rename session interface to org.bluez.obex.Session

The base is also changed to /org/bluez/obex to follow the new namespace

11 years agoobexd: Change namespace to org.bluez.obex.client
Luiz Augusto von Dentz [Fri, 1 Jun 2012 10:23:36 +0000 (13:23 +0300)]
obexd: Change namespace to org.bluez.obex.client

11 years agoobexd: Change agent interface to org.bluez.obex.Agent
Luiz Augusto von Dentz [Wed, 23 May 2012 12:20:40 +0000 (15:20 +0300)]
obexd: Change agent interface to org.bluez.obex.Agent

11 years agoobexd: Change D-Bus namespace to org.bluez.obex
Luiz Augusto von Dentz [Wed, 23 May 2012 10:53:06 +0000 (13:53 +0300)]
obexd: Change D-Bus namespace to org.bluez.obex

This changes the namespace from org.openobex to org.bluez.obex

11 years agoobexd: Update copyright statement
Mikel Astiz [Mon, 4 Jun 2012 09:37:58 +0000 (11:37 +0200)]
obexd: Update copyright statement

11 years agoobexd: PhonebookAccess sessions return transfers
Mikel Astiz [Mon, 4 Jun 2012 09:37:54 +0000 (11:37 +0200)]
obexd: PhonebookAccess sessions return transfers

Return the D-Bus path of the transfer representing the operation.

11 years agoobexd: Synchronization sessions return transfers
Mikel Astiz [Mon, 4 Jun 2012 09:37:52 +0000 (11:37 +0200)]
obexd: Synchronization sessions return transfers

Return the D-Bus path of the transfer representing the operation.

11 years agoobexd: FileTransfer sessions return transfers
Mikel Astiz [Mon, 4 Jun 2012 09:37:50 +0000 (11:37 +0200)]
obexd: FileTransfer sessions return transfers

Return the D-Bus path of the transfer representing the operation.

11 years agoobexd: ObjectPush sessions return transfers
Mikel Astiz [Mon, 4 Jun 2012 09:37:48 +0000 (11:37 +0200)]
obexd: ObjectPush sessions return transfers

Return the D-Bus path of the transfer representing the operation.

11 years agoobexd: Expose D-Bus data in internal transfer API
Mikel Astiz [Mon, 4 Jun 2012 09:37:47 +0000 (11:37 +0200)]
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.

11 years agoobexd: Support empty filename in obc_transfer_get
Mikel Astiz [Mon, 4 Jun 2012 09:37:46 +0000 (11:37 +0200)]
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.

11 years agoobexd: Make transfer filename optional
Mikel Astiz [Mon, 4 Jun 2012 09:37:44 +0000 (11:37 +0200)]
obexd: Make transfer filename optional

The property might not exist for certain transfers, typically when they
have been initiated internally.

11 years agoobexd: Make FileTransfer.PutFile asynchronous
Mikel Astiz [Wed, 30 May 2012 15:50:22 +0000 (17:50 +0200)]
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.

11 years agoobexd: Expose all transfers in D-Bus
Mikel Astiz [Wed, 30 May 2012 15:50:21 +0000 (17:50 +0200)]
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.

11 years agoobexd: Remove obsolete authentication code
Mikel Astiz [Wed, 30 May 2012 15:50:20 +0000 (17:50 +0200)]
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.

11 years agoobexd: Remove internal transfer progress report
Mikel Astiz [Wed, 30 May 2012 15:50:19 +0000 (17:50 +0200)]
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.

11 years agoobexd: Remove unused functions in transfer API
Mikel Astiz [Wed, 30 May 2012 15:50:18 +0000 (17:50 +0200)]
obexd: Remove unused functions in transfer API

After the removal of the agent these functions are not useful any more.

11 years agoobexd: Remove D-Bus agent
Mikel Astiz [Wed, 30 May 2012 15:50:17 +0000 (17:50 +0200)]
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.

11 years agoobexd: Use transfer owner instead of agent
Mikel Astiz [Wed, 30 May 2012 15:50:16 +0000 (17:50 +0200)]
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.

11 years agoobexd: Add transfer event-reporting signals
Mikel Astiz [Wed, 30 May 2012 15:50:14 +0000 (17:50 +0200)]
obexd: Add transfer event-reporting signals

These signals replace the old agent-based notification mechanism.

11 years agoobexd: Add progress property to transfer
Mikel Astiz [Wed, 30 May 2012 15:50:12 +0000 (17:50 +0200)]
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.

11 years agoobexd: Add D-Bus helper library
Mikel Astiz [Wed, 30 May 2012 15:50:10 +0000 (17:50 +0200)]
obexd: Add D-Bus helper library

No functionality changes. This is just about avoiding duplicated code.

11 years agoobexd: Replace parameter dict with conventional ones
Mikel Astiz [Mon, 21 May 2012 09:07:13 +0000 (11:07 +0200)]
obexd: Replace parameter dict with conventional ones

11 years agoobexd: Move GetCapabilities to session API
Mikel Astiz [Mon, 21 May 2012 09:07:11 +0000 (11:07 +0200)]
obexd: Move GetCapabilities to session API

11 years agoobexd: Replace SendFiles with SendFile
Mikel Astiz [Mon, 21 May 2012 09:07:08 +0000 (11:07 +0200)]
obexd: Replace SendFiles with SendFile

The function is now asynchronous, since it will return only when the
transfer has been finished.

11 years agoobexd: Wrap OPP into specific session type
Mikel Astiz [Mon, 21 May 2012 09:07:05 +0000 (11:07 +0200)]
obexd: Wrap OPP into specific session type

11 years agoobexd: Use constant instead of NULL variable
Mikel Astiz [Mon, 21 May 2012 09:07:04 +0000 (11:07 +0200)]
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.

11 years agoobexd: Remove left over glib-helper.h support
Paul Seidler [Mon, 21 May 2012 14:59:27 +0000 (16:59 +0200)]
obexd: Remove left over glib-helper.h support

11 years agoobexd: Simplify error-handling code
Mikel Astiz [Fri, 18 May 2012 07:54:04 +0000 (09:54 +0200)]
obexd: Simplify error-handling code

Refactor error-handling code to avoid duplicated code.

11 years agoobexd: Fix NULL dereference in case of error
Mikel Astiz [Fri, 18 May 2012 07:54:03 +0000 (09:54 +0200)]
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.

11 years agoobexd: Do not set signature and reply in GDBus tables
Lucas De Marchi [Fri, 18 May 2012 18:32:04 +0000 (15:32 -0300)]
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.

11 years agoobexd: Convert GDBus methods to use macro helpers
Lucas De Marchi [Fri, 18 May 2012 18:32:01 +0000 (15:32 -0300)]
obexd: Convert GDBus methods to use macro helpers

With these macro helpers we can separate in/out arguments and use their
own vector.

11 years agoobexd: Constify GDBus signal tables
Marcel Holtmann [Fri, 18 May 2012 03:34:51 +0000 (20:34 -0700)]
obexd: Constify GDBus signal tables

Constify signal tables with the following command:

find . -name '*.[ch]' -exec \
         sed -i 's/\(GDBusSignalTable .* =\)/const \1/g' {} \;

11 years agoobexd: Constify GDBus method tables
Marcel Holtmann [Fri, 18 May 2012 03:34:07 +0000 (20:34 -0700)]
obexd: Constify GDBus method tables

Constify method tables with the following command:

find . -name '*.[ch]' -exec \
         sed -i 's/\(GDBusMethodTable .* =\)/const \1/g' {} \;

11 years agoobexd: Fix not checking if GoepL2capPsm contains a valid PSM
Luiz Augusto von Dentz [Tue, 15 May 2012 16:16:46 +0000 (19:16 +0300)]
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.

11 years agoobexd: Fix not setting port to 0 when listen fails
Luiz Augusto von Dentz [Tue, 15 May 2012 16:16:45 +0000 (19:16 +0300)]
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

11 years agoobexd: Use stack memory for application parameters in pbap module
Luiz Augusto von Dentz [Mon, 14 May 2012 13:46:01 +0000 (16:46 +0300)]
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.

11 years agoobexd: Add obc_transfer_set_params to set application parameters
Luiz Augusto von Dentz [Mon, 14 May 2012 10:06:07 +0000 (13:06 +0300)]
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.

11 years agoobexd: Create transfers in modules
Mikel Astiz [Fri, 4 May 2012 12:39:38 +0000 (14:39 +0200)]
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.

11 years agoobexd: Flip parameter order in transfer API
Mikel Astiz [Fri, 4 May 2012 12:39:37 +0000 (14:39 +0200)]
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.

11 years agoobexd: Buffer-passing changes in transfer API
Mikel Astiz [Fri, 4 May 2012 12:39:36 +0000 (14:39 +0200)]
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.

11 years agoobexd: Transfer API splits create and register
Mikel Astiz [Fri, 4 May 2012 12:39:35 +0000 (14:39 +0200)]
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.

11 years agoobexd: Split internal obc_transfer_register()
Mikel Astiz [Fri, 4 May 2012 12:39:34 +0000 (14:39 +0200)]
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.

11 years agoobexd: Fix possible double free of params
Mikel Astiz [Fri, 4 May 2012 12:39:33 +0000 (14:39 +0200)]
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.

11 years agoobexd: Add handler for SIGUSR2
Luiz Augusto von Dentz [Tue, 8 May 2012 00:00:53 +0000 (17:00 -0700)]
obexd: Add handler for SIGUSR2

This signal enables debug for obed so just do the same for obex-client

11 years agoobexd: Use signalfd to handle unix signals
Luiz Augusto von Dentz [Tue, 8 May 2012 00:00:52 +0000 (17:00 -0700)]
obexd: Use signalfd to handle unix signals

11 years agoobexd: Use signalfd to handle unix signals
Luiz Augusto von Dentz [Tue, 8 May 2012 00:00:51 +0000 (17:00 -0700)]
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.

11 years agoobexd: Fix codying style
Luiz Augusto von Dentz [Mon, 7 May 2012 14:14:30 +0000 (07:14 -0700)]
obexd: Fix codying style

Fix lines that are over 80 columns

11 years agoobexd: Wait for abort completion before Transfer.Cancel returns
Jaganath Kanakkassery [Fri, 4 May 2012 09:57:05 +0000 (15:27 +0530)]
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

11 years agoobexd: Remove transfer from queue before callback
Mikel Astiz [Thu, 3 May 2012 08:28:30 +0000 (10:28 +0200)]
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.

11 years agoobexd: Remove deprecated part of session API
Mikel Astiz [Thu, 3 May 2012 08:28:29 +0000 (10:28 +0200)]
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.

11 years agoobexd: Use new session callback style in modules
Mikel Astiz [Thu, 3 May 2012 08:28:28 +0000 (10:28 +0200)]
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.

11 years agoobexd: Give transfer pointer in session callbacks
Mikel Astiz [Thu, 3 May 2012 08:28:27 +0000 (10:28 +0200)]
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.

11 years agoobexd: Avoid GObex dependency from transfer.h
Mikel Astiz [Thu, 3 May 2012 08:28:26 +0000 (10:28 +0200)]
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.

11 years agoobexd: Minor buffer access API changes
Mikel Astiz [Thu, 3 May 2012 08:28:25 +0000 (10:28 +0200)]
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*

11 years agoobexd: Emit TransferStarted signal only if stream start is success
Jaganath Kanakkassery [Mon, 30 Apr 2012 11:11:41 +0000 (16:41 +0530)]
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.

11 years agoobexd: Return request id when generating a request in session API
Luiz Augusto von Dentz [Thu, 26 Apr 2012 15:11:05 +0000 (18:11 +0300)]
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.

11 years agoobexd: Fix not propagating GError in session API functions
Luiz Augusto von Dentz [Thu, 26 Apr 2012 15:11:04 +0000 (18:11 +0300)]
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.

11 years agoobexd: Remove file in case of error
Luiz Augusto von Dentz [Tue, 24 Apr 2012 12:03:15 +0000 (15:03 +0300)]
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.

11 years agoobexd: open file during transfer creation
Luiz Augusto von Dentz [Tue, 24 Apr 2012 12:03:14 +0000 (15:03 +0300)]
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.

11 years agoobexd: transfers take gobex when starting
Mikel Astiz [Tue, 24 Apr 2012 12:03:13 +0000 (15:03 +0300)]
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.

11 years agoobexd: transfer api merges put and get
Mikel Astiz [Tue, 24 Apr 2012 12:03:12 +0000 (15:03 +0300)]
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.

11 years agoobexd: remove unused field
Mikel Astiz [Tue, 24 Apr 2012 12:03:11 +0000 (15:03 +0300)]
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.

11 years agoobexd: Remove buffer based transfer
Luiz Augusto von Dentz [Tue, 24 Apr 2012 12:03:10 +0000 (15:03 +0300)]
obexd: Remove buffer based transfer

Simplify the code by using temporary files and eliminates reallocations.

11 years agoobexd: Fix possible memory leak on pbap module
Luiz Augusto von Dentz [Wed, 18 Apr 2012 13:51:51 +0000 (16:51 +0300)]
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)

11 years agoobexd: Fix regression when calling obc_session_shutdown within callback
Luiz Augusto von Dentz [Mon, 16 Apr 2012 10:40:07 +0000 (13:40 +0300)]
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.

11 years agoobexd: Remove glib-helper.h support
Marcel Holtmann [Mon, 16 Apr 2012 16:09:34 +0000 (18:09 +0200)]
obexd: Remove glib-helper.h support

11 years agoobexd: Remove unused struct session_callback
Syam Sidhardhan [Thu, 12 Apr 2012 15:03:15 +0000 (20:33 +0530)]
obexd: Remove unused struct session_callback

11 years agoobexd: Remove headers declared but not defined
Syam Sidhardhan [Thu, 12 Apr 2012 15:03:14 +0000 (20:33 +0530)]
obexd: Remove headers declared but not defined

11 years agoobexd: Use goto for avoiding code duplication
Syam Sidhardhan [Thu, 12 Apr 2012 15:03:13 +0000 (20:33 +0530)]
obexd: Use goto for avoiding code duplication

11 years agoobexd: Fix memory leak during session connect
Syam Sidhardhan [Thu, 12 Apr 2012 15:03:12 +0000 (20:33 +0530)]
obexd: Fix memory leak during session connect

11 years agoobexd: Output parameters for GetMessagesListing
Slawomir Bochenski [Thu, 12 Apr 2012 18:53:29 +0000 (20:53 +0200)]
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.

11 years agoobexd: Input parameters for GetMessagesListing
Slawomir Bochenski [Thu, 12 Apr 2012 18:53:28 +0000 (20:53 +0200)]
obexd: Input parameters for GetMessagesListing

This adds support for input application parameters header given in
GetMessagesListing request.

11 years agoobexd: Mark filter strings const
Slawomir Bochenski [Thu, 12 Apr 2012 18:53:27 +0000 (20:53 +0200)]
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.