aboutsummaryrefslogtreecommitdiffstats
path: root/capture_ui_utils.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2008-06-02 17:45:03 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2008-06-02 17:45:03 +0000
commit561f66c1b89c8d6fa9c5f2a4ff7a0a606272d02a (patch)
treeb9ca81b2c1eca1516c88fe5e1cf7f7c22ce83de6 /capture_ui_utils.c
parentd623efba636b2939306d7059e03b1aaa2f10d80e (diff)
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
Diffstat (limited to 'capture_ui_utils.c')
-rw-r--r--capture_ui_utils.c26
1 files changed, 26 insertions, 0 deletions
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,