summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2012-04-27 14:33:16 (GMT)
committerMarcel Holtmann <marcel@holtmann.org>2012-04-27 14:45:01 (GMT)
commitb9d16f7fe9c5f42cd14b5839a81deae3ccd94c14 (patch)
treed3819cbe4ab2dcb83f2cbc2422e6ee469e6bb109 /tools
parent39d675b3ff57daa893239afff879757eb692122e (diff)
downloadconnman-b9d16f7fe9c5f42cd14b5839a81deae3ccd94c14.zip
connman-b9d16f7fe9c5f42cd14b5839a81deae3ccd94c14.tar.gz
connman-b9d16f7fe9c5f42cd14b5839a81deae3ccd94c14.tar.bz2
tools: Add WISPr route request debug printouts
Update g_web_request_get() and add WISPr route request debug printouts.
Diffstat (limited to 'tools')
-rw-r--r--tools/web-test.c2
-rw-r--r--tools/wispr.c25
2 files changed, 23 insertions, 4 deletions
diff --git a/tools/web-test.c b/tools/web-test.c
index 82ea46b..aac8602 100644
--- a/tools/web-test.c
+++ b/tools/web-test.c
@@ -150,7 +150,7 @@ int main(int argc, char *argv[])
timer = g_timer_new();
- if (g_web_request_get(web, argv[1], web_result, NULL) == 0) {
+ if (g_web_request_get(web, argv[1], web_result, NULL, NULL) == 0) {
fprintf(stderr, "Failed to start request\n");
return 1;
}
diff --git a/tools/wispr.c b/tools/wispr.c
index 88f09c1..b140506 100644
--- a/tools/wispr.c
+++ b/tools/wispr.c
@@ -31,6 +31,7 @@
#include <string.h>
#include <signal.h>
#include <termios.h>
+#include <netdb.h>
#include <gweb/gweb.h>
@@ -475,6 +476,24 @@ static gboolean wispr_input(const guint8 **data, gsize *length,
return FALSE;
}
+static gboolean wispr_route(const char *addr, int ai_family, int if_index,
+ gpointer user_data)
+{
+ char *family = "unknown";
+
+ if (ai_family == AF_INET)
+ family = "IPv4";
+ else if (ai_family == AF_INET6)
+ family = "IPv6";
+
+ printf("Route request: %s %s index %d\n", family, addr, if_index);
+
+ if (ai_family != AF_INET && ai_family != AF_INET6)
+ return FALSE;
+
+ return TRUE;
+}
+
static gboolean wispr_result(GWebResult *result, gpointer user_data)
{
struct wispr_session *wispr = user_data;
@@ -515,7 +534,7 @@ static gboolean wispr_result(GWebResult *result, gpointer user_data)
printf("\n");
wispr->request = g_web_request_get(wispr->web, redirect,
- wispr_result, wispr);
+ wispr_result, wispr_route, wispr);
return FALSE;
}
@@ -575,7 +594,7 @@ static gboolean wispr_result(GWebResult *result, gpointer user_data)
printf("\n");
wispr->request = g_web_request_get(wispr->web, redirect,
- wispr_result, wispr);
+ wispr_result, NULL, wispr);
return FALSE;
}
@@ -678,7 +697,7 @@ int main(int argc, char *argv[])
parser_callback, &wispr);
wispr.request = g_web_request_get(wispr.web, option_url,
- wispr_result, &wispr);
+ wispr_result, wispr_route, &wispr);
if (wispr.request == 0) {
fprintf(stderr, "Failed to start request\n");