Commit Graph

11274 Commits

Author SHA1 Message Date
Luiz Augusto von Dentz
cd3e6c9c61 gobex: add unit test for PUT request with SRM 2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
74bb8e1474 gobex: add unit test for GET response with random data 2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
80c602ba33 gobex: add unit test for GET request with random data 2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
1e5b2ca160 gobex: add unit test for PUT response with random data 2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
ab6b0ae829 gobex: reduce duplicated code in g_obex_put_req
g_obex_put_req is quite similar to g_obex_put_req_pkt so now it just
call it to avoid duplicating this code.
2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
dd0e00c06f gobex: add defines for possible values of SRMP header
Also rename G_OBEX_HDR_SRM_PARAMETERS to just G_OBEX_HDR_SRMP as the spec
normally refer to it.
2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
474d67b631 gobex: add defines for possible values of SRM header 2012-12-04 22:22:04 +01:00
Mikel Astiz
7dbc36186e gobex: fix transfer search in transfer_complete
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.
2012-12-04 22:22:04 +01:00
Bartosz Szatkowski
d2b34b6a68 gobex: Add translating error codes to strings 2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
48497a481e gobex: add unit test for packet PUT request with random data 2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
13564dd509 gobex: remove unused delay on test_put_req_random 2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
19359ee369 gobex: fix wrong name of test_get_rsp_eagain 2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
37cfa1cc4c gobex: always set CONNECTION_ID to 1 on unit tests
This simplify the creation of new test by not requiring different
variables for every connection response.
2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
27249cbd0a gobex: add unit test for GET response with APPARAM 2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
c02e6e5e27 gobex: add unit test for GET request with APPARAM 2012-12-04 22:22:04 +01:00
Luiz Augusto von Dentz
7f604f1818 gobex: add unit test for GET request with delay 2012-12-04 22:22:04 +01:00
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