summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2011-07-04 16:23:54 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2011-07-16 17:50:46 +0300
commitde67352ef2711206ca771240c7e087608f0f1bcb (patch)
treee20b697efd6b8570d56aa7dba2d2b4d133060957 /tools
parent92c609a6f722de45434f2cf155f1d703b65b72ea (diff)
downloadobexd-de67352ef2711206ca771240c7e087608f0f1bcb.tar.gz
gobex: Add request callback to test-server
Diffstat (limited to 'tools')
-rw-r--r--tools/test-server.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/test-server.c b/tools/test-server.c
index 9be797c..192ab5f 100644
--- a/tools/test-server.c
+++ b/tools/test-server.c
@@ -56,11 +56,16 @@ static GOptionEntry options[] = {
static void disconn_func(GObex *obex, GError *err, gpointer user_data)
{
- g_print("Client disconnected\n");
+ g_print("Client disconnected: %s\n", err ? err->message : "<no err>");
clients = g_slist_remove(clients, obex);
g_obex_unref(obex);
}
+static void req_func(GObex *obex, GObexPacket *req, gpointer user_data)
+{
+ g_print("Request 0x%02x\n", g_obex_packet_get_operation(req, NULL));
+}
+
static gboolean unix_accept(GIOChannel *chan, GIOCondition cond, gpointer data)
{
struct sockaddr_un addr;
@@ -105,6 +110,7 @@ static gboolean unix_accept(GIOChannel *chan, GIOCondition cond, gpointer data)
obex = g_obex_new(io, transport, -1, -1);
g_io_channel_unref(io);
g_obex_set_disconnect_function(obex, disconn_func, NULL);
+ g_obex_set_request_function(obex, req_func, NULL);
clients = g_slist_append(clients, obex);;
return TRUE;