};
#if defined(HAVE_PCAP_CREATE)
- static gint num_capture_cols = 7;
- static const gchar *capture_cols[7] = {
- "INTERFACE",
- "LINK",
- "PMODE",
- "SNAPLEN",
- "MONITOR",
- "BUFFER",
- "FILTER"};
+/* Can set monitor mode and buffer size. */
+static gint num_capture_cols = 7;
+static const gchar *capture_cols[7] = {
+ "INTERFACE",
+ "LINK",
+ "PMODE",
+ "SNAPLEN",
+ "MONITOR",
+ "BUFFER",
+ "FILTER"
+};
+#define CAPTURE_COL_TYPE_DESCRIPTION \
+ "Possible values: INTERFACE, LINK, PMODE, SNAPLEN, MONITOR, BUFFER, FILTER\n"
#elif defined(_WIN32) && !defined (HAVE_PCAP_CREATE)
- static gint num_capture_cols = 6;
- static const gchar *capture_cols[6] = {
- "INTERFACE",
- "LINK",
- "PMODE",
- "SNAPLEN",
- "BUFFER",
- "FILTER"};
+/* Can set buffer size but not monitor mode. */
+static gint num_capture_cols = 6;
+static const gchar *capture_cols[6] = {
+ "INTERFACE",
+ "LINK",
+ "PMODE",
+ "SNAPLEN",
+ "BUFFER",
+ "FILTER"
+};
+#define CAPTURE_COL_TYPE_DESCRIPTION \
+ "Possible values: INTERFACE, LINK, PMODE, SNAPLEN, BUFFER, FILTER\n"
#else
- static gint num_capture_cols = 5;
- static const gchar *capture_cols[5] = {
- "INTERFACE",
- "LINK",
- "PMODE",
- "SNAPLEN",
- "FILTER"};
+/* Can neither set buffer size nor monitor mode. */
+static gint num_capture_cols = 5;
+static const gchar *capture_cols[5] = {
+ "INTERFACE",
+ "LINK",
+ "PMODE",
+ "SNAPLEN",
+ "FILTER"
+};
+#define CAPTURE_COL_TYPE_DESCRIPTION \
+ "Possible values: INTERFACE, LINK, PMODE, SNAPLEN, FILTER\n"
#endif
/*
guchar c;
/* this module may have been created as a subtree item previously */
- if((module = find_subtree(parent, title))) {
+ if ((module = find_subtree(parent, title))) {
/* the module is currently a subtree */
module->name = name;
module->apply_cb = apply_cb;
subtree_module = protocols_module;
- if(subtree) {
+ if (subtree) {
/* take a copy of the buffer, orig keeps a base pointer while ptr
* walks through the string */
orig = ptr = g_strdup(subtree);
- while(ptr && *ptr) {
+ while (ptr && *ptr) {
- if((sep = strchr(ptr, '/')))
+ if ((sep = strchr(ptr, '/')))
*sep++ = '\0';
- if(!(new_module = find_subtree(subtree_module, ptr))) {
+ if (!(new_module = find_subtree(subtree_module, ptr))) {
/*
* There's no such module; create it, with the description
* being the name (if it's later registered explicitly
module_t *module = (module_t*)value;
call_foreach_t *call_data = (call_foreach_t*)data;
- if (!module->obsolete) {
+ if (!module->obsolete)
call_data->ret = (*call_data->callback)(module, call_data->user_data);
- }
+
return (call_data->ret != 0);
}
* Make sure the preference name doesn't begin with the
* module name, as that's redundant and Just Silly.
*/
- if(!((strncmp(name, module->name, strlen(module->name)) != 0) ||
+ if (!((strncmp(name, module->name, strlen(module->name)) != 0) ||
(((name[strlen(module->name)]) != '.') && ((name[strlen(module->name)]) != '_'))))
g_error("Preference %s begins with the module name", name);
}
}
if (list_entry == NULL)
- {
return NULL; /* no such preference */
- }
return (struct preference *) list_entry->data;
}
extern gboolean
prefs_get_preference_obsolete(pref_t *pref)
{
- if (pref) {
+ if (pref)
return pref->type == PREF_OBSOLETE ? TRUE : FALSE;
- }
+
return TRUE;
}
static void stats_callback(void)
{
/* Test for a sane tap update interval */
- if (prefs.tap_update_interval < 100 || prefs.tap_update_interval > 10000) {
- prefs.tap_update_interval = TAP_UPDATE_DEFAULT_INTERVAL;
- }
+ if (prefs.tap_update_interval < 100 || prefs.tap_update_interval > 10000)
+ prefs.tap_update_interval = TAP_UPDATE_DEFAULT_INTERVAL;
#ifdef HAVE_LIBPORTAUDIO
/* Test for a sane max channels entry */
if (prefs.rtp_player_max_visible < 1 || prefs.rtp_player_max_visible > 10)
- prefs.rtp_player_max_visible = RTP_PLAYER_DEFAULT_VISIBLE;
+ prefs.rtp_player_max_visible = RTP_PLAYER_DEFAULT_VISIBLE;
#endif
}
prefs_fmt = g_strdup(col_format_to_string(cfmt->fmt));
}
if (!cfmt->visible) {
- if (cols_hidden->len) {
+ if (cols_hidden->len)
g_string_append (cols_hidden, ",");
- }
g_string_append (cols_hidden, prefs_fmt);
}
clp = clp->next;
}
/* Check to make sure all column formats are valid. */
col_l_elt = g_list_first(col_l);
- while(col_l_elt) {
+ while (col_l_elt) {
fmt_data cfmt_check;
/* Go past the title. */
llen = g_list_length(col_l);
*col_num_pref->varp.uint = llen / 2;
col_l_elt = g_list_first(col_l);
- while(col_l_elt) {
+ while (col_l_elt) {
cfmt = g_new(fmt_data,1);
cfmt->title = g_strdup((gchar *)col_l_elt->data);
col_l_elt = col_l_elt->next;
/* Verify that all the column names are valid. If not, use the entire list of valid columns.
*/
- while(col_l_elt) {
+ while (col_l_elt) {
gboolean found_match = FALSE;
col_name = (gchar *)col_l_elt->data;
}
col_l_elt = g_list_first(col_l);
- while(col_l_elt) {
+ while (col_l_elt) {
col_name = (gchar *)col_l_elt->data;
prefs.capture_columns = g_list_append(prefs.capture_columns, col_name);
col_l_elt = col_l_elt->next;
}
static char * capture_column_type_description_cb(void) {
- return g_strdup_printf(
+ return g_strdup(
"List of columns to be displayed in the capture options dialog.\n"
- "Possible values: INTERFACE, LINK, PMODE, SNAPLEN, MONITOR, BUFFER, FILTER\n");
+ CAPTURE_COL_TYPE_DESCRIPTION);
}
static gboolean capture_column_is_default_cb(pref_t* pref) {
/* Ensure the same column count */
if (((pref_col == NULL) && (def_col != NULL)) ||
- ((pref_col != NULL) && (def_col == NULL)))
+ ((pref_col != NULL) && (def_col == NULL)))
is_default = FALSE;
return is_default;
GList *col_l = NULL;
gchar *col, *capture_column_str;
-
while (clp) {
col = (gchar *) clp->data;
col_l = g_list_append(col_l, g_strdup(col));
item_count++;
str = (gchar *)cur->data;
- if (cur != first) {
+ if (cur != first)
g_string_append_c(joined_str, ',');
- }
if (item_count % 2) {
/* Wrap the line. */
g_string_append(joined_str, "\n\t");
- } else {
+ } else
g_string_append_c(joined_str, ' ');
- }
quoted_str = g_strescape(str, "");
g_string_append_printf(joined_str, "\"%s\"", quoted_str);
/* Try to read in the profile name in the first line of the preferences file. */
got_c = getc(pf);
- if(got_c) {
+ if (got_c) {
char firstl[100];
if (fgets(firstl, 100, pf) != NULL) {
} else if (strcmp(module->name, "smpp") == 0) {
/* Handle preferences that moved from SMPP. */
module_t *new_module = prefs_find_module("gsm-sms-ud");
- if(new_module){
+ if (new_module){
if (strcmp(dotp, "port_number_udh_means_wsp") == 0)
pref = prefs_find_preference(new_module, "port_number_udh_means_wsp");
else if (strcmp(dotp, "try_dissect_1st_fragment") == 0)
/* "eth.qinq_ethertype" has been changed(restored) to "vlan.qinq.ethertype" */
if (strcmp(dotp, "qinq_ethertype") == 0) {
module_t *new_module = prefs_find_module("vlan");
- if(new_module) {
+ if (new_module) {
pref = prefs_find_preference(new_module, "qinq_ethertype");
module = new_module;
}
arg.pf = gui_pref_arg->pf;
g_list_foreach(arg.module->prefs, write_pref, &arg);
- if(prefs_module_has_submodules(module))
+ if (prefs_module_has_submodules(module))
return prefs_modules_foreach_submodules(module, write_module_prefs, user_data);
return 0;