summaryrefslogtreecommitdiff
path: root/tools/test-server.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2011-07-05 18:30:54 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2011-07-16 17:50:47 +0300
commitce7d11f68d372ee8a04ba36a0d41e041e0213f09 (patch)
treeb0c153d6c5b377d99065a644104343c01147be05 /tools/test-server.c
parent349f19fc6d4a808e05f46b8751b30768c49753b5 (diff)
downloadobexd-ce7d11f68d372ee8a04ba36a0d41e041e0213f09.tar.gz
gobex: Add proper responses to all requests in test-server
Diffstat (limited to 'tools/test-server.c')
-rw-r--r--tools/test-server.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/tools/test-server.c b/tools/test-server.c
index 1567c4e..9f4e9c6 100644
--- a/tools/test-server.c
+++ b/tools/test-server.c
@@ -64,11 +64,26 @@ static void disconn_func(GObex *obex, GError *err, gpointer user_data)
static void req_func(GObex *obex, GObexPacket *req, gpointer user_data)
{
gboolean final;
- guint8 op = g_obex_packet_get_operation(req, &final);
+ guint8 rsp, op = g_obex_packet_get_operation(req, &final);
g_print("Request 0x%02x%s\n", op, final ? " (final)" : "");
- g_obex_response(obex, op, G_OBEX_RSP_SUCCESS, NULL, NULL);
+ switch (op) {
+ case G_OBEX_OP_CONNECT:
+ rsp = G_OBEX_RSP_SUCCESS;
+ break;
+ case G_OBEX_OP_PUT:
+ if (g_obex_packet_find_header(req, G_OBEX_HDR_ID_BODY))
+ rsp = G_OBEX_RSP_CONTINUE;
+ else
+ rsp = G_OBEX_RSP_SUCCESS;
+ break;
+ default:
+ rsp = G_OBEX_RSP_NOT_IMPLEMENTED;
+ break;
+ }
+
+ g_obex_response(obex, op, rsp, NULL, NULL);
}
static gboolean unix_accept(GIOChannel *chan, GIOCondition cond, gpointer data)