From 561f66c1b89c8d6fa9c5f2a4ff7a0a606272d02a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Mon, 2 Jun 2008 17:45:03 +0000 Subject: Added an option to set default link-layer header type for each interface. Set linktype history for each interface so we don't mix them. Fixed some indents. svn path=/trunk/; revision=25411 --- capture_ui_utils.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'capture_ui_utils.c') diff --git a/capture_ui_utils.c b/capture_ui_utils.c index be5f9fa65e..41244a7eb2 100644 --- a/capture_ui_utils.c +++ b/capture_ui_utils.c @@ -96,6 +96,32 @@ capture_dev_user_descr_find(const gchar *if_name) return NULL; } +gint +capture_dev_user_linktype_find(const gchar *if_name) +{ + gchar *p, *next; + gint linktype; + + if (prefs.capture_devices_linktypes == NULL) { + /* There are no link-layer header types */ + return -1; + } + + if ((p = strstr(prefs.capture_devices_linktypes, if_name)) == NULL) { + /* There are, but there isn't one for this interface. */ + return -1; + } + + p += strlen(if_name) + 1; + linktype = strtol(p, &next, 10); + if (next == p || *next != ')' || linktype < 0) { + /* Syntax error */ + return -1; + } + + return linktype; +} + /* * Return as descriptive a name for an interface as we can get. * If the user has specified a comment, use that. Otherwise, -- cgit v1.2.3