Commit Graph

1141 Commits

Author SHA1 Message Date
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
Luiz Augusto von Dentz
cf54532db9 obexd: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
9ac7ce0d5a obexd: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
3b952d6320 obexd: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
142e154b8d obexd: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
3c91531f1d obexd: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
30d6274498 obexd: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
6e5ae4dc5c obexd: remove duplicated includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
7c358987f9 obexd: Remove use of obex_object_t from service.h
Plugins including service.h need to include openobex headers because of
this.
2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
dcab04f113 obexd: Introduce obex_get_non_header_data
This function remove the need of calling OBEX_ObjectGetNonHdrData in the
plugins.
2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
8c9942c4a3 obexd: Remove use of obex_object_t on obex.h
Plugins including obex.h need to include openobex headers because of
this.
2012-12-04 22:48:47 +01:00
Luiz Augusto von Dentz
e682892a95 obexd: Remove unused function obex_aparam_write 2012-12-04 22:48:47 +01:00
Slawomir Bochenski
e24d619fc3 obexd: phonebook-tracker: Seek for contact name deeper
Some contacts in Tracker can have no name fields set nor nickname. This
patch enhances the way the contact name is obtained:

1) If there is no nco:nickname set for contact, use nco:imNickname from
its related IM data.
2) As the N field is mandatory in both vCard 2.1 and 3.0 and it's the
most useful field for PBAP clients, if its components are not present
in Tracker, use nco:fullname (thus promote FN to N) or if nco:fullname
is also not present, then use previously obtained nickname for N field.
2012-12-04 22:48:47 +01:00
Syam Sidhardhan
cd80166367 obexd: Fix dbus memory leak 2012-12-04 22:48:47 +01:00
Syam Sidhardhan
0a3fef0442 obexd: Fix empty parameter list in function declaration 2012-12-04 22:48:47 +01:00
Rafal Michalski
7ffd0a2eb8 obexd: Fix missing URL vCard's field with OTHER subtype
Previously URL vCard's field (imported with default OTHER subtype) was
missing after pulling entire phonebook or single vCard (for phonebook
and each call history as well).
This patch fixes that issue by adjusting queries to URL field.
2012-12-04 22:48:47 +01:00
Luiz Augusto von Dentz
1f3e8d2f12 obexd: fix coding style
Make use of tabs instead of spaces
2012-12-04 22:48:47 +01:00
Luiz Augusto von Dentz
18f3c34d66 obexd: remove pcsuite code
pcsuite code has been moved to pcsuite plugin and this code is no
longer used.
2012-12-04 22:48:47 +01:00
Luiz Augusto von Dentz
2cbf0ddd22 obexd: remove unnecessary includes
As a mimetype driver only plugin filesystem should not depend on
service.h nor obex.h
2012-12-04 22:48:47 +01:00
Luiz Augusto von Dentz
eea0ef5d80 obexd: Make obex_server_init to initialized all services registered
This way we don't have to keep adding new entries to main.c everytime
a new service is introduced.
2012-12-04 22:48:47 +01:00
Luiz Augusto von Dentz
b53c0f2086 obexd: Move secure flag to service driver
The driver already define the channel so it makes sense to have the
secure flag in the same place.
2012-12-04 22:48:47 +01:00
Luiz Augusto von Dentz
c178167496 obexd: Remove options per server
Options are general so it is pointless to copy them to each server.
2012-12-04 22:48:46 +01:00
Luiz Augusto von Dentz
f87d83c858 obexd: Removed unused fields of obex_server 2012-12-04 22:48:46 +01:00
Luiz Augusto von Dentz
3f038ba4e7 obexd: Remove config.h from src/obex.h
config.h should only be included in .c files
2012-12-04 22:48:46 +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
Rafal Michalski
6df190c813 obexd: Remove unnecessary code line breaking
This patch removes unnecessary code line breaking.
2012-12-04 22:48:46 +01:00
Rafal Michalski
82fbbb6b20 obexd: Fix pulling single vCard for parameters header missing
According to PBAP specification (ANNEX A), all application-parameters
are optional in case of pulling single vCard entry, so header for
application-parameters can be omitted, and it would be valid as well.
Previously pulling single vCard was always failing with "Bad Request"
status in such a circumstance.
This patch fixes that issue and pulling single vCard is done successfully
with "OK" status. Output vCard would contain all fields under 2.1 format
(as for default settings).
2012-12-04 22:48:46 +01:00
Rafal Michalski
38e0847e6c obexd: Fix breaking long lines in vCard's fields
Previously limit length for vCard's (vCard 2.1 with Quoted Printable
encoding) property line was always set as 75 (QP_LINE_LEN), after
processing each single subfield (for instance under ADR property).
Thus it was not possible to reach limit equal to 0 (then breaking line
is required) for all property subfields.
This patch fixes that issue and length of first line, containing property
parameters, is limited as well.
2012-12-04 22:48:46 +01:00
Rafal Michalski
ec7d965650 obexd: Support for encoding UTF-8 characters in vCard's fields
This patch provides additional condition for selection of Quoted Printable
encoding (for vCard's 2.1 fields). It will be satisfied if there is any
byte which value is out of range standard ASCII set. Such byte may be
a part of sequence (composed of more than single byte) for non-standard
characters specified by UTF-8 and if detected, CHARSET parameter for
property is set as "UTF-8".
This fix is required since without such improvement some carkits may
display non-standard characters incorrectly (for instance they may be
omitted completely).
2012-12-04 22:48:46 +01:00
Radoslaw Jablonski
03f4a2e6ff obexd: Add NULL-field checking in vcard_printf_address
Without that checking strlen(..) could be called with NULL
as param and this will result crash (in some scenarios
'field' may be NULL)
2012-12-04 22:48:46 +01:00
Radoslaw Jablonski
5f73860fe8 obexd: Add check for empty string in vcard_printf_fullname
If tag value is empty there is possibility to quickly create
empty tag without entering to rest of the logic.
Checking for empty parameter at the begining is included
basicaly in every print tag function in code - here somehow
was missing.
2012-12-04 22:48:46 +01:00
Slawomir Bochenski
93f6f455d1 obexd: Fix OPP not sending TransferCompleted signal
Commit 934b3b2f5f8432b67822be9f83a141fe3783cbd7 introduced a regression
in OPP, by making it not send TransferCompleted signal. This happened
because OPP was calling manager_emit_transfer_completed() on .reset(),
and manager_emit_transfer_completed() in turn checks if the os->object
is not NULL. This fixes this by moving clearing os->object after doing
service driver .reset().
2012-12-04 22:48:46 +01:00
Luiz Augusto von Dentz
f0f5cbcc71 obexd: Fix possible crash when using syncevolution plugin
Context os need to be set since synce_write uses it, in addiction
check if context is valid in synce_open.
2012-12-04 22:48:46 +01:00
Slawomir Bochenski
0994419d4f obexd: Simplify code for calling mime driver flush()
OBEX_EV_REQ is the last thing that we are going to receive on PUT and
this is always going to be delivered. As the service driver will start
receiving data at or before its .put(), we can simply call flush() after
that. This also makes flush() usable in PUTs without length header.
2012-12-04 22:48:46 +01:00
Slawomir Bochenski
63296fb1c2 obexd: Pass through error returned by open in PUTs 2012-12-04 22:48:46 +01:00
Slawomir Bochenski
0c44f9ad54 obexd: Utilise os_set_response in check_put 2012-12-04 22:48:45 +01:00
Slawomir Bochenski
b39b605f32 obexd: Write pending bytes only if mime object is open
Without this in case of "non-checked" PUT there were calls to write()
prior to any obex_put_stream_start().
2012-12-04 22:48:45 +01:00
Slawomir Bochenski
9857369dc8 obexd: Fix missing format in call to g_error_new 2012-12-04 22:48:45 +01:00
Slawomir Bochenski
db4e3be989 obexd: Reverse order of calls in os_reset_session
This replaces:
service->get/put, mime->open, ..., service->reset, mime->close
logic, with a more appropriate:
service->get/put, mime->open, ..., mime->close, service->reset
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
Rafal Michalski
622b339004 obexd: Simplify vCard's phone number printing
Previously, it was trynig to create string (by snprintf function
and stored in "buf" buffer) containing "%s" formatting piece for
"vcard_printf" function.
In this case "\%" is not valid escape sequence (it is "%%" for percent
character) - backslash is ignored, so sequence "\%s" is treated as "%s"
and replaced by string for "number" field when snprintf function is
executed. Hence "vcard_printf" function has nothing to do with "number"
field, since "buf" does not contain any "%s" formatting sequence.

This patch make simplification for printing phone number field by
avoiding storing formatting pieces (for instance "%%s"). Now string
for phone number field is stored directly in "field" buffer
(common with Quoted Printable encoding) and simply passed to
"vcard_printf" function.
2012-12-04 22:48:45 +01:00
Rafal Michalski
0b2354016f obexd: Remove magic number indicating size of buffer
This patch removes "magic number" indicating buffer's size
in "vcard_printf_number" function and replace it by value defined under
LEN_MAX. Now it would be consistent with the rest of code, since all
functions from vcard_prinf_* family use LEN_MAX to indicate size
of buffer which may store some vCard's field content.
2012-12-04 22:48:45 +01:00
Rafal Michalski
96ca20c858 obexd: Remove unnecessary character in comment
This patch removes unnecessary comment's character.
2012-12-04 22:48:45 +01:00
Rafal Michalski
19737e50a7 obexd: Remove unnecessary empty lines
This patch removes unnecessary empty lines.
2012-12-04 22:48:45 +01:00
Johan Hedberg
31795baa26 obexd: Fix minor coding style issues in filesystem.c 2012-12-04 22:48:45 +01:00
Johan Hedberg
c948d5b9bd obexd: Fix g_filename_to_utf8 failure check 2012-12-04 22:48:45 +01:00
Johan Hedberg
6c56e60db1 obexd: Fix target size in Connect reply WHO header
Not all targets are 16 bytes (e.g. SyncML is 9).
2012-12-04 22:48:45 +01:00
Rafal Michalski
b58216bbe3 obexd: Support for Quoted Printable encoding
According to vCard 2.1 specification, this patch provides Quoted Printable
encoding (described in RFC1521 document), which is specific for vCard 2.1
formatting and should be preferable for instance, if vcard's property
field contains multiple lines (vCard's 2.1 spec. says: Multiple lines
of formatted text are separated with a Quoted Printable CRLF sequence
of "=0D" followed by "=0A" followed by a Quoted Printable softline
break sequence of "=").

In general all characters can be replaced with "=<Hex>" where "<Hex>"
is the 2-character hexadecimal representation of the character's decimal
value. Characters with decimal values of 33 through 60 inclusive, and 62
through 126, inclusive, may be represented as the ASCII characters.

Quoted Printable lines of text must also be limited to less than 76
characters. For longer lines soft line breaks must be used - an equal sign
as the last character on a encoded line indicates such soft line break
in the encoded text.

In this case, Quoted Printable is selected, if vCard's 2.1 field contains
newline character or some specific ASCII character from set:
'!', '"', '#', '$', '@', '[', '\', ']', '^', '`', '{', '|', '}', '~'.
(it is not mandatory but each character from this set will be encoded
as Quoted Printable spec. suggests).

Equal sign character in vCard's field is always encoded (it is mandatory
and Quoted Printable encoding is taken into account if this character present
in vCard's field) since it is special character used for encoding characters
and indicating soft line breaks.

Horizontal tab and space characters are always encoded. It's mandatory only
if they are not followed by any other character. Always encoding makes
simplification, since we don't need to care about position of these characters.

According to vCard 2.1 specification semicolon character, present in vCard's
field, must be escaped with backslash character. Since backslash is always
encoded it gives sequence "=5C;" (instead of "\;").
2012-12-04 22:48:45 +01:00
Rafal Michalski
d882e5c6ca obexd: Escape semicolons in vCard's fields
This patch provides possibility to escape only semicolon character
in vCard's fields, as vCard 2.1 specification requires
(for comparision vCard 3.0 requires escaping for set of characters:
'\n', '\r', ';', ',', '\').
2012-12-04 22:48:45 +01:00
Rafal Michalski
7c98394abf obexd: Extend functions parameter list for vCard's format
This patch extends some functions ("get_escaped_fields" and some from
"vcard_printf_*" family) parameter list for format value, since it would
be needed to select escaping and encoding method, depending on vCard's
type (vCard 2.1 or vCard 3.0).
2012-12-04 22:48:44 +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
Rafal Michalski
34d1a73395 obexd: Fix semicolon delimiter issue in address fields
Previously semicolon was used as delimiter when address vCard fields
are concatenated (at the moment of fetching from database via query).
It was introducing confusion at the moment of splitting address string
into seperate fields, since these fields may contain semicolons as well.
In this case it leads to treating some semicolons - characters in address
fields - as real delimiters (no escaped but it should) and other
semicolons - real delimiters - as characters in address field
(escaped but it shouldn't).
This patch fixes problem described above, since semicolon delimiter
is replaced by character called Unit Separator (equal to '\37') which
shouldn't be present in address fields.
2012-12-04 22:48:44 +01:00
Rafal Michalski
a4b6035009 obexd: Refactoring address fields handled in vcard module
This patch introduces phonebook_addr struct for more intuitive
handling address fields from backend. Now address fields are managed
by linked list (wrapped by structure) and it is used for printing vCard
address fields, instead of buffers set (combined with g_strsplit
and snprintf functions).
2012-12-04 22:48:44 +01:00
Bartosz Szatkowski
11f7e9efe7 obexd: Fix memory issue in folder listing 2012-12-04 22:48:44 +01:00
Bartosz Szatkowski
8f582cad7e obexd: Fix folder and path handling 2012-12-04 22:48:44 +01:00
Johan Hedberg
208d6b0692 obexd: Minor coding style fixes to mas.c 2012-12-04 22:48:44 +01:00
Slawomir Bochenski
e833801e74 obexd: Use pointers to const where appropriate 2012-12-04 22:48:44 +01:00
Slawomir Bochenski
9a12077a94 obexd: Add basic support for message retrieval 2012-12-04 22:48:44 +01:00
Slawomir Bochenski
027df908d8 obexd: Add basic messages listing retrieval support 2012-12-04 22:48:44 +01:00
Slawomir Bochenski
3ceea5ccb5 obexd: Fix type of read_status in message_filter 2012-12-04 22:48:44 +01:00
Slawomir Bochenski
2716950f85 obexd: Add typedef for folder listing callback 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
Johan Hedberg
8db017fec4 obexd: Rename dbus.h to manager.g 2012-12-04 22:48:44 +01:00
Johan Hedberg
902ba758b0 obexd: Rename obex_dbus_get_connection to manager_dbus_get_connection 2012-12-04 22:48:43 +01:00
Johan Hedberg
2a14f573bd obexd: Clean up header files 2012-12-04 22:48:43 +01:00
Johan Hedberg
15f6d2e1f8 obexd: Remove gwobex
Not needed anymore since obex-client now uses gobex.
2012-12-04 22:48:43 +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
Slawomir Bochenski
2b3644a987 obexd: Simplify counting new missed calls
This replaces parsing missed calls listing that was used to get the number of
missed calls that have been unread with a simple SPARQL query.

Previous code was trying to deal with misbehaviour of commhistoryd but still
was failing in some cases. commhistoryd is now fixed.
2012-12-04 22:48:43 +01:00
Johan Hedberg
984a6511c4 obexd: Fix missing NULL check in agent_cancel
The agent_cancel function can potentially be called when there's no
agent registered, so there should be proper handling of this situation.
2012-12-04 22:48:43 +01:00
Slawomir Bochenski
aaecee599b obexd: Fix condition for skipping folders 2012-12-04 22:48:43 +01:00