[gssdp] sniffer: Make network device configurable
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gssdp] sniffer: Make network device configurable
- Date: Mon, 1 Apr 2013 12:27:28 +0000 (UTC)
commit 14902d8e7344962ed5c8e545bd122a96b93d1449
Author: Jens Georg <jensg openismus com>
Date: Thu Mar 21 11:51:06 2013 +0100
sniffer: Make network device configurable
tools/gssdp-device-sniffer.c | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/tools/gssdp-device-sniffer.c b/tools/gssdp-device-sniffer.c
index b53858c..72280a1 100644
--- a/tools/gssdp-device-sniffer.c
+++ b/tools/gssdp-device-sniffer.c
@@ -27,12 +27,20 @@
#define UI_FILE "gssdp-device-sniffer.ui"
#define MAX_IP_LEN 16
+static char *interface = NULL;
+
GtkBuilder *builder;
GSSDPResourceBrowser *resource_browser;
GSSDPClient *client;
char *ip_filter = NULL;
gboolean capture_packets = TRUE;
+GOptionEntry entries[] =
+{
+ {"interface", 'i', 0, G_OPTION_ARG_STRING, &interface, "Network interface to listen on", NULL },
+ { NULL }
+};
+
G_MODULE_EXPORT
void
on_enable_packet_capture_activate (GtkCheckMenuItem *menuitem, gpointer user_data)
@@ -550,8 +558,18 @@ init_ui (gint *argc, gchar **argv[])
GtkWidget *main_window;
gint window_width, window_height;
gchar *ui_path = NULL;
-
- gtk_init (argc, argv);
+ GError *error = NULL;
+ GOptionContext *context;
+
+ context = g_option_context_new ("- graphical SSDP debug tool");
+ g_option_context_add_main_entries (context, entries, NULL);
+ g_option_context_add_group (context, gtk_get_option_group (TRUE));
+ if (!g_option_context_parse (context, argc, argv, &error)) {
+ g_print ("Failed to parse options: %s\n", error->message);
+ g_error_free (error);
+
+ return FALSE;
+ }
/* Try to fetch the ui file from the CWD first */
ui_path = UI_FILE;
@@ -604,6 +622,7 @@ init_upnp (void)
client = g_initable_new (GSSDP_TYPE_CLIENT,
NULL,
&error,
+ "interface", interface,
NULL);
if (error) {
g_printerr ("Error creating the GSSDP client: %s\n",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]