Commit Graph

1141 Commits

Author SHA1 Message Date
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