Commit Graph

11258 Commits

Author SHA1 Message Date
Luiz Augusto von Dentz
04bfae5d56 gobex: add unit test for PUT response with delay 2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
1c0b69678f gobex: fix removing wrong id on transfer_free
If statement checks for get_id handle but was removing req_id.
2012-12-04 22:22:04 +01:00
Bartosz Szatkowski
b8cc54f1b9 gobex: Add "cd ../dir" handling in setpath 2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
16e1f86a1e gobex: make connection id check less strict
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>
2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
ad8d85382f gobex: fix sending Connection ID header in all requests
According to both OBEX and GOEP specs Connection ID should only be
included in the first packet of a request.
2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
bc654c5048 gobex: fix not tracking received responses
obex->rx_last_op is only updated if there is no pending request which
means it only store last received request.
2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
30b091c42e gobex: fix checking connection id for ABORT
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>
2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
648e662542 gobex: add unit test for CONNECT followed by PUT request with random data
Note that in order to work the buffer had to be increased to OBEX maximum
MTU otherwise test_io_cb would be sending responses for each fragment it
has read which may not constitute a full packet.
2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
75447e6647 gobex: add unit test for CONNECT followed by GET wrong response 2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
4c7baae49e gobex: add unit test for CONNECT followed by PUT response 2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
8b6ff020b6 gobex: add unit test for CONNECT followed by PUT request 2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
6b1a901678 gobex: add unit test for CONNECT followed by GET response 2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
a28a22a707 gobex: add unit test for CONNECT followed by GET request 2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
4f64bb1b38 gobex: add unit test for CONNECT response 2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
e94ce4ff86 gobex: add unit test for CONNECT request 2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
704d8b47a3 gobex: add check for connection id
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.
2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
206f64d3ed gobex: remove extra define of G_OBEX_RSP_SUCCESS 2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
bf8b55059e gobex: dump data when G_OBEX_DEBUG_DATA is set 2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
85db8f76c3 gobex: log packets using G_OBEX_DEBUG_PACKET 2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
f6952b7e3a gobex: log headers using G_OBEX_DEBUG_HEADER 2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
48bbe41993 gobex: log transfers using G_OBEX_DEBUG_TRANSFER 2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
6690cd3b76 gobex: log commands using G_OBEX_DEBUG_COMMAND 2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
fffdbad4a8 gobex: log errors using G_OBEX_DEBUG_ERROR 2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
54da6b6ad2 gobex: add initial support for debug
This adds support for debug using GOBEX_DEBUG environment variable.
2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
e058d7a519 gobex: fix includes of config.h 2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
745e460a58 gobex: add missing checks for config.h 2012-12-04 22:22:03 +01:00
Johan Hedberg
3a7f9049c0 gobex: Fix decoding byte array headers with too small length
Length values of less than 3 are invalid.
2012-12-04 22:22:03 +01:00
Johan Hedberg
1c2da64348 gobex: Remove g_obex_packet_find_header
This was exactly the same as g_obex_packet_get_header.
2012-12-04 22:22:03 +01:00
Luiz Augusto von Dentz
68bd9dd92b gobex: add option to set input/output MTU to test-server 2012-12-04 22:22:02 +01:00
Luiz Augusto von Dentz
701f8845b5 gobex: add option to set input/output MTU to test-client 2012-12-04 22:22:02 +01:00
Johan Hedberg
81dd14a05e gobex: Use larger timeout first packet in transfers
Frequently upon receiving the first packet servers will perform some
sort of user interaction to authorize the incoming request. It's
therefore wise to use a larger timeout for this first packet on the
client side.
2012-12-04 22:22:02 +01:00
Johan Hedberg
a2204214c2 gobex: Fix request timeout handling when aborting 2012-12-04 22:22:02 +01:00
Johan Hedberg
5b613d1174 gobex: Protect against user callback freeing internal objects
A user callback could potentially do things like g_obex_cancel_request
or g_obex_unref while we are inside the IO watch callback. It is
therefore important to ensure that we are in a consistent state when the
user callback returns.
2012-12-04 22:22:02 +01:00
Johan Hedberg
5c50f04098 gobex: Protect against transfer_complete callback removing the transfer 2012-12-04 22:22:02 +01:00
Johan Hedberg
d21fef52df gobex: Add unit tests for Action command functions 2012-12-04 22:22:02 +01:00
Johan Hedberg
91e0e1c324 gobex: Fix opcode for Action command convenience functions 2012-12-04 22:22:02 +01:00
Johan Hedberg
afc903b0f3 gobex: Add support for Action command header offset (0) 2012-12-04 22:22:02 +01:00
Johan Hedberg
4549f997e8 gobex: Add client transfer functions taking a pre-created GObexPacket 2012-12-04 22:22:02 +01:00
Johan Hedberg
003421aed2 gobex: Add OBEX packet header addition convenience functions 2012-12-04 22:22:02 +01:00
Johan Hedberg
e12802a76b gobex: Add Action command convenience functions 2012-12-04 22:22:02 +01:00
Luiz Augusto von Dentz
971be76c62 gobex: add root support to test-server 2012-12-04 22:22:02 +01:00
Luiz Augusto von Dentz
2c5bb3ec41 gobex: Add Bluetooth support for test-server 2012-12-04 22:22:02 +01:00
Luiz Augusto von Dentz
7e7a99b039 gobex: Add Bluetooth support for test-client 2012-12-04 22:22:02 +01:00
Luiz Augusto von Dentz
b9794defb8 gobex: Add random put request test 2012-12-04 22:22:02 +01:00
Luiz Augusto von Dentz
c96d0645b3 gobex: fix setting final bit on PUT requests
Final bit should not be set when creating new request packets for PUT
since it may be not be the end of the body.
2012-12-04 22:22:02 +01:00
Luiz Augusto von Dentz
1e00bd8f5e gobex: fix not handling unkown transport type 2012-12-04 22:22:02 +01:00
Jakub Adamek
f264b1c744 gobex: Fix encoding of empty unicode headers
According to IrOBEX:
"An empty Name header is defined as a Name header of length 3 (one byte
opcode + two byte length)."

The current code encodes an empty header with 5 bytes, including two
bytes of null-terminator.

This patch assumes that this definition of emptiness applies to all
unicode headers, not just the name header.
2012-12-04 22:22:02 +01:00
Syam Sidhardhan
cb6fe44ba1 gobex: Remove bogus extra semicolons 2012-12-04 22:22:02 +01:00
Daniele Forsi
f64fe4f401 gobex: Fix compilation when NEED_G_SLIST_FREE_FULL is defined
To use the replacement for g_slist_free_full() both compat.h and
glib-helper.h need to be included.

Fixes:
gobex/gobex.c:911: error: implicit declaration of function 'g_slist_free_full'
tools/obex-server-tool.c:344: error: implicit declaration of function ‘g_slist_free_full’
2012-12-04 22:22:02 +01:00
Luiz Augusto von Dentz
c1b8f95c2a gobex: Make use of g_slist_free_full when elements are dynamically-allocated
This avoid having to iterate twice in the list to free its elements.
2012-12-04 22:22:02 +01:00