1 /* EtherApe 2 * Copyright (C) 2000 Juan Toledo 3 * Copyright (C) 2011 Riccardo Ghetta 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef PREFERENCES_H 20 #define PREFERENCES_H 21 22 #ifdef HAVE_CONFIG_H 23 #include "config.h" 24 #endif 25 #include "common.h" 26 27 /* 28 * Preferences data. 29 * 30 * Note that this is strictly for options that live in the config file; 31 * options set by command-line flags should go elsewhere. 32 */ 33 struct pref_struct 34 { 35 gboolean name_res; /* Whether dns lookups are performed */ 36 gboolean diagram_only; /* Do not use text on the diagram */ 37 gboolean group_unk; /* Whether to display as one every unkown port protocol */ 38 gboolean headless; /* don't update display (TODO: implement a proper text mode) */ 39 gdouble node_radius_multiplier; /* used to calculate the radius of the 40 * displayed nodes. So that the user can 41 * select with certain precision this 42 * value, the GUI uses the log10 of the 43 * multiplier */ 44 gdouble inner_ring_scale; /* scale of inner ring in proportion to outer ring */ 45 size_mode_t size_mode; /* Default mode for node size and 46 * link width calculation */ 47 node_size_variable_t node_size_variable; /* Default variable that sets the node 48 * size */ 49 gchar *filter; /* Pcap filter to be used */ 50 gchar *text_color; /* text color */ 51 gchar *fontname; /* Font to be used for text display */ 52 gchar *centered_nodes; /* Name/IP/CIDR-range of nodes to center (optional) */ 53 guint stack_level; /* Which level of the protocol stack 54 * we will concentrate on */ 55 56 gboolean bck_image_enabled; /* Whether or not to use a background image */ 57 gchar *bck_image_path; /* Path to the background image (optional) */ 58 59 /* Whether or not these respective UI elements are shown */ 60 gboolean show_statusbar; 61 gboolean show_toolbar; 62 gboolean show_legend; 63 64 statspos_t pcap_stats_pos; /* Position at which to display pcap stats */ 65 66 /* after this time has passed without traffic on a protocol, it's removed 67 * from the global protocol stats */ 68 gdouble proto_timeout_time; 69 70 /* After this time has passed with no traffic for a node, it 71 * disappears from the diagram */ 72 gdouble gui_node_timeout_time; 73 74 /* After this time has passed with no traffic for a node, it 75 * is deleted from memory */ 76 gdouble proto_node_timeout_time; 77 78 gchar * *colors; /* list of colors to be used on the diagram. Format is 79 * color[;protocol[,protocol ...]] [color[;protocol] ... 80 * where color is represented by sis hex digits (RGB) */ 81 82 /* After this time has passed with no traffic for a link, it 83 * disappears from the diagram */ 84 gdouble gui_link_timeout_time; 85 86 /* after this time has passed without traffic, the link is removed */ 87 gdouble proto_link_timeout_time; 88 89 guint32 refresh_period; /* Time between diagram refreshes */ 90 gdouble averaging_time; /* Microseconds of time we consider to 91 * calculate traffic averages */ 92 }; 93 94 extern struct pref_struct pref; 95 96 /* Parsed version pref.centered_nodes */ 97 extern GList *centered_node_speclist; 98 99 /* preferences methods */ 100 gboolean load_config(struct pref_struct *p); 101 void save_config(const struct pref_struct *p); 102 void free_config(struct pref_struct *t); 103 void copy_config(struct pref_struct *tgt, const struct pref_struct *src); 104 105 typedef void (*config_edit_fn)(struct pref_struct *p, void *data); 106 void mutate_saved_config(config_edit_fn edit, void *data); 107 108 #endif 109