summaryrefslogtreecommitdiff
path: root/gobex
Commit message (Collapse)AuthorAgeFilesLines
* gobex: Revert g_obex_pending_req_abort to static pending_req_abortLuiz Augusto von Dentz2013-09-292-4/+2
| | | | | | | This reverts the changes introduced in 9095deb82572112fc0870095bf2222964610eafe that made pending_req_abort public which is not necessary considering g_obex_cancel_req can do the same and is safe to call even if the request is not pending.
* gobex: Fix crash on g_obex_pending_req_abortLuiz Augusto von Dentz2013-09-291-1/+4
| | | | | | | | | | | | | | | | | | | It is not safe to call g_obex_pending_req_abort directly as pending_req can be NULL: Invalid read of size 4 at 0x41231E: g_obex_pending_req_abort (gobex.c:693) by 0x416A8A: g_obex_cancel_transfer (gobex-transfer.c:647) by 0x42DEF2: obc_transfer_cancel (transfer.c:180) by 0x43D833: process_message.isra.5 (object.c:259) by 0x3B0701CE85: ??? (in /usr/lib64/libdbus-1.so.3.7.4) by 0x3B0700FA30: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.7.4) by 0x43A5B7: message_dispatch (mainloop.c:76) by 0x3B03C48962: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C47E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C48157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C48559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x40D53C: main (main.c:319) Address 0x30 is not stack'd, malloc'd or (recently) free'd
* codingstyle: Change __FUNCTION__ to __func__Andrei Emeltchenko2013-09-111-1/+1
| | | | | | | | | | The __func__ macro is part of the C99 standard whereas __FUNCTION__ is a legacy gcc specific alias for it: http://gcc.gnu.org/onlinedocs/gcc/Function-Names.html Additionally, checkpatch.pl that's commonly used to verify coding style also recommends to use __func__ instead of __FUNCTION__.
* gobex: Add proper message to transfer errorsLuiz Augusto von Dentz2013-08-121-2/+2
| | | | | This improve the error message when a transfer fails by using g_obex_strerror to decode the response code to a human readable string.
* gobex: Get rid of gcharLucas De Marchi2013-05-021-8/+8
| | | | Use plain char instead of gchar.
* gobex: Get rid of gintLucas De Marchi2013-05-012-8/+8
| | | | | Use plain int instead of gint. In glib gint is always a typedef to int, so it's safe to use it even for callbacks with glib.
* gobex: Use gcc builtin instead of g_atomicLucas De Marchi2013-04-091-6/+8
| | | | | | | | | | | | | g_atomic_* end up using G_STATIC_ASSERT, causing gcc 4.8 to yell due to -Wunused-local-typedefs. /usr/include/glib-2.0/glib/gmacros.h:162:53: error: typedef ‘_GStaticAssertCompileTimeAssertion_2’ locally defined but not used [-Werror=unused-local-typedefs] #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] Most of the uses of atomic operations were wrong. They were fixed as well. If we are using atomic operations, reading the variable again later for logging is not an option, we should use the return of the atomic function used to fetch the variable.
* gobex: Fix GPL version referenceJohan Hedberg2013-02-1512-24/+36
| | | | | These files (like everything else in the tree) should be GPL 2 or later instead of GPL 2 only.
* Revert "Ensure config.h is included by using CPPFLAGS"Johan Hedberg2012-12-076-0/+24
| | | | | | | | | | | | | | This reverts commit 8a03376544b046a84301847d1594f6c3674983ff. The patch needs to be split up and the gdbus/ changes were bogus compared to the original commit message. Conflicts: Makefile.am Makefile.obexd profiles/cyclingspeed/cyclingspeed.c profiles/heartrate/heartrate.c src/error.c
* Ensure config.h is included by using CPPFLAGSLucas De Marchi2012-12-056-24/+0
| | | | | | | | | | Instead of trying to include config.h in each file over the tree and possibly forgetting to include it, give a "-include config.h" argument to the compiler so it's guaranteed that a) it will be included for all source files and b) it will be the first header included. gdbus/ directory is left out, since it would break other projects using it.
* gobex: Fix build on 32 bits systemsLuiz Augusto von Dentz2012-12-041-8/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GUINT_TO_POINTER does not cast properly in older version of GLib (< 2.31) causing the following errors: cc1: warnings being treated as errors gobex/gobex-apparam.c: In function ‘g_obex_apparam_set_bytes’: gobex/gobex-apparam.c:176:38: error: cast to pointer from integer of different size gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_uint8’: gobex/gobex-apparam.c:243:43: error: cast to pointer from integer of different size gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_uint16’: gobex/gobex-apparam.c:261:43: error: cast to pointer from integer of different size gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_uint32’: gobex/gobex-apparam.c:282:43: error: cast to pointer from integer of different size gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_uint64’: gobex/gobex-apparam.c:303:43: error: cast to pointer from integer of different size gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_string’: gobex/gobex-apparam.c:324:43: error: cast to pointer from integer of different size gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_bytes’: gobex/gobex-apparam.c:342:43: error: cast to pointer from integer of different size make[1]: *** [gobex/gobex-apparam.o] Error 1 make: *** [all] Error 2
* gobex: Add debug option to apparamLuiz Augusto von Dentz2012-12-043-9/+52
| | | | This adds "apparam" to the debug options of GOBEX_DEBUG
* gobex: Integrate GObexApparam with GObexHeaderLuiz Augusto von Dentz2012-12-042-0/+28
| | | | | | This introduce 2 new convenient functions: g_obex_header_get_apparam which parses and decode an header into GObexApparam and gobex_header_new_apparam that encode GObexApparam into GObexHeader.
* gobex: Introduce GObexApparam APILuiz Augusto von Dentz2012-12-042-0/+373
| | | | | | | GObexApparam abstract the handling of application parameter tags, it can be used to read/parse application parameter header data using g_obex_apparam_get_* functions or to generate the data using g_obex_apparam_set_*.
* gobex: Fix not printing debug messages when GOBEX_DEBUG is setLuiz Augusto von Dentz2012-12-042-4/+6
| | | | | g_debug doesn't print anything if domain is not present in G_MESSAGES_DEBUG.
* gobex: Change UTF name to standardNeal Peacock2012-12-041-1/+1
|
* gobex: Fix dead assignments in gobex-header.cSzymon Janc2012-12-041-5/+5
| | | | Values stored are never read.
* gobex: Add callback and userdata parameter to g_obex_cancel_transfer()Jaganath Kanakkassery2012-12-043-5/+21
| | | | | | If callback is provided in g_obex_cancel_transfer() current complete callback will be replaced by the new one and user will be informed when abort completes.
* gobex: build: Remove glib-helper.h supportMarcel Holtmann2012-12-041-1/+0
|
* gobex: fix callback remove when canceling transferMikel Astiz2012-12-041-0/+3
| | | | | This code path could lead to situations where the callback is later used, making the daemon crash.
* gobex: Use ENOSYS to correspond to OBEX not implementedLuiz Augusto von Dentz2012-12-041-1/+2
| | | | | | | ENOSYS correspond to function not implemented which is exactly what the OBEX error code means. Also since EINVAL means invalid argument that now map to OBEX bad request
* gobex: Translate posix error code to proper OBEX response opcodeLuiz Augusto von Dentz2012-12-043-2/+29
| | | | | | This patch create a map between posix errors code and OBEX response opcode and use it to generate a proper response in case a transfer failed instead of always responding with internal error.
* gobex: Fix ABORT request not processingJaganath Kanakkassery2012-12-041-1/+1
| | | | | G_OBEX_OP_ABORT is defined as 0x7f but error checking of opcode is done for greater than 0x1f. So abort request is simply ignored.
* gobex: fix automatically including SRM header in CONNECT responsesLuiz Augusto von Dentz2012-12-041-0/+1
| | | | | | | | | | | | | | | | | | | | GOEP 2.0 test specification forbids the server to include SRM headers in CONNECT response: "3.16 TP/SRM/BI-03-C Process an OBEX CONNECT request (incorrectly) containing a SRM header: • Expected Outcome Pass Verdict: – On receiving the invalid SRM header in the OBEX_CONNECT request, the IUT responds with a SUCCESS without a SRM header. – OBEX/L2CAP channel is established. Fail Verdict: – On receiving the invalid SRM header in the OBEX_CONNECT request, the IUT does not respond with a SUCCESS and/or includes a SRM header in the response. – OBEX/L2CAP channel is not established or OBEX/RFCOMM channel is established."
* gobex: fix not disabling SRM when dealing with GET responsesLuiz Augusto von Dentz2012-12-041-103/+115
| | | | While sending the final bit can be changed during encoding.
* gobex: Remove reduntant NULL assignmentJaganath Kanakkassery2012-12-041-2/+0
|
* gobex: automatically use SRM when transport type is SOCK_SEQPACKETLuiz Augusto von Dentz2012-12-041-1/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This simplifies the applications so SRM setup phase became transparent while using SOCK_SEQPACKET which is useful for GOEP 2.0 since in that case we can only use SRM if the transport is L2CAP. This also follows GOEP 2.0 Page 14 - 4.6 Using Single Response Mode: "The Server cannot issue an enable request, but can only issue a response to an enable request from the Client. SRM will remain in effect for the duration of the operation that enabled it (PUT or GET) ... SRM headers shall not be sent in CONNECT request or response packets." and Page 22 - 5.4 Establishment of OBEX Connection: "SRM headers shall not be sent in the Connect request or response packets (note, this is to preserve backwards compatibility). SRM shall be enabled through Put and Get operations only." So only in case of PUT or GET requests SRM is automatically configured, applications can still enable it manually for other operations by adding the headers like before but it is not recommended. Note that it would be a good practice to indicate SRM support by using value 0x02, but since that should happens during CONNECT command it is not done automatically for requests when acting as a client, server responding to indicate requests will automatically add SRM headers though.
* gobex: handle Single Response Mode Parameters (SRMP) headersLuiz Augusto von Dentz2012-12-041-5/+34
| | | | | Single Response Mode Parameters is a 1-byte quantity containing the value for the parameters used for SRM.
* gobex: handle Single Response Mode (SRM) headersLuiz Augusto von Dentz2012-12-043-33/+216
| | | | | Single Response Mode (SRM) is a 1-byte quantity containing a value to enable or disable SRM, as well as to indicate support for SRM.
* gobex: introduce g_obex_get_rsp_pktLuiz Augusto von Dentz2012-12-042-12/+27
| | | | | g_obex_get_rsp_pkt takes a response packet which sometimes is more convenient for adding headers.
* gobex: reduce duplicated code in g_obex_put_reqLuiz Augusto von Dentz2012-12-041-16/+2
| | | | | g_obex_put_req is quite similar to g_obex_put_req_pkt so now it just call it to avoid duplicating this code.
* gobex: add defines for possible values of SRMP headerLuiz Augusto von Dentz2012-12-041-1/+6
| | | | | Also rename G_OBEX_HDR_SRM_PARAMETERS to just G_OBEX_HDR_SRMP as the spec normally refer to it.
* gobex: add defines for possible values of SRM headerLuiz Augusto von Dentz2012-12-041-0/+5
|
* gobex: fix transfer search in transfer_completeMikel Astiz2012-12-041-11/+19
| | | | | | | | | The previous approach searched the transfer pointer itself, assuming that the transfers has not been modified if the pointer is in the list. However the callback could have removed the transfer and registered another one, which can eventually point to the same memory location. This is solved by looking for the transfer id instead of the pointer.
* gobex: Add translating error codes to stringsBartosz Szatkowski2012-12-042-0/+59
|
* gobex: fix removing wrong id on transfer_freeLuiz Augusto von Dentz2012-12-041-1/+1
| | | | If statement checks for get_id handle but was removing req_id.
* gobex: Add "cd ../dir" handling in setpathBartosz Szatkowski2012-12-041-4/+10
|
* gobex: make connection id check less strictLuiz Augusto von Dentz2012-12-041-1/+1
| | | | | | | | | | | | | | | | OBEX spec says: Only the first packet in the request needs to contain the Connection Id header... If a Connection Id header is received with an invalid connection identifier, it is recommended that the operation be rejected with the response code (0xD3) “Service Unavailable”. Since not all requests packets need to contain Connection Id header we should only try to validate it in case a header is received. Reported by Hendrik Sattler <post@hendrik-sattler.de>
* gobex: fix sending Connection ID header in all requestsLuiz Augusto von Dentz2012-12-041-0/+3
| | | | | According to both OBEX and GOEP specs Connection ID should only be included in the first packet of a request.
* gobex: fix not tracking received responsesLuiz Augusto von Dentz2012-12-041-2/+3
| | | | | obex->rx_last_op is only updated if there is no pending request which means it only store last received request.
* gobex: fix checking connection id for ABORTLuiz Augusto von Dentz2012-12-041-2/+9
| | | | | | | OBEX spec state that it is optional to send a Connection Id header in an OBEX ABORT operation. Reported by Hendrik Sattler <post@hendrik-sattler.de>
* gobex: add check for connection idLuiz Augusto von Dentz2012-12-041-3/+26
| | | | | | Since gobex maintain the connection id of the session it is more convenient to check whether the incoming request connection matches before calling the application handlers.
* gobex: remove extra define of G_OBEX_RSP_SUCCESSLuiz Augusto von Dentz2012-12-041-1/+0
|
* gobex: dump data when G_OBEX_DEBUG_DATA is setLuiz Augusto von Dentz2012-12-041-3/+12
|
* gobex: log packets using G_OBEX_DEBUG_PACKETLuiz Augusto von Dentz2012-12-041-0/+38
|
* gobex: log headers using G_OBEX_DEBUG_HEADERLuiz Augusto von Dentz2012-12-041-0/+49
|
* gobex: log transfers using G_OBEX_DEBUG_TRANSFERLuiz Augusto von Dentz2012-12-041-0/+50
|
* gobex: log commands using G_OBEX_DEBUG_COMMANDLuiz Augusto von Dentz2012-12-041-0/+26
|
* gobex: log errors using G_OBEX_DEBUG_ERRORLuiz Augusto von Dentz2012-12-044-7/+37
|
* gobex: add initial support for debugLuiz Augusto von Dentz2012-12-042-0/+96
| | | | This adds support for debug using GOBEX_DEBUG environment variable.