1 /* 2 * jnettop, network online traffic visualiser 3 * Copyright (C) 2002-2005 Jakub Skopal 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, write to the Free Software 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * 19 * $Header: /cvsroot/jnettop/jnettop/jconfig.h,v 1.5 2006/04/12 07:47:01 merunka Exp $ 20 * 21 */ 22 23 #ifndef __JCONFIG_H__ 24 #define __JCONFIG_H__ 25 26 #include "jbase.h" 27 28 typedef struct __jconfig_settings { 29 const char *deviceName; 30 const jbase_device *device; 31 gboolean onoffContentFiltering; 32 gboolean onoffPromisc; 33 gboolean onoffResolver; 34 guint localAggregation; 35 guint remoteAggregation; 36 37 GPtrArray * _bpfFilters; 38 int _selectedBpfFilter; 39 char * _adHocBpfFilter; 40 jbase_network_mask_list * _networkMaskList; 41 } jconfig_settings; 42 43 gboolean jconfig_Setup(); 44 gboolean jconfig_ParseFile(char *configFileName); 45 void jconfig_SetDefaults(); 46 void jconfig_ConfigureModules(); 47 48 const char * jconfig_GetSelectedBpfFilterText(); 49 const char * jconfig_GetSelectedBpfFilterName(); 50 void jconfig_AddBpfFilter(char *filterName, char *filterText); 51 int jconfig_FindBpfFilterByName(char *filterName); 52 53 void jconfig_AddLocalNetwork(const jbase_mutableaddress *network, const jbase_mutableaddress *netmask, int af); 54 int jconfig_FindMatchingLocalNetworkIndex(const jbase_mutableaddress *network, int af); 55 56 void jconfig_SelectDevice(const char *deviceName); 57 58 extern jconfig_settings jconfig_Settings; 59 60 #define JCONFIG_BPFFILTERS_LEN (jconfig_Settings._bpfFilters->len/2) 61 #define JCONFIG_BPFFILTERS_GETNAME(i) ((char*)g_ptr_array_index(jconfig_Settings._bpfFilters, (i)*2)) 62 #define JCONFIG_BPFFILTERS_GETTEXT(i) ((char*)g_ptr_array_index(jconfig_Settings._bpfFilters, (i)*2+1)) 63 #define JCONFIG_BPFFILTERS_SETSELECTEDFILTER(i) (jconfig_Settings._selectedBpfFilter = i) 64 #define JCONFIG_BPFFILTERS_SETNONE (jconfig_Settings._selectedBpfFilter = -1) 65 #define JCONFIG_BPFFILTERS_SELECTEDISNONE (jconfig_Settings._selectedBpfFilter == -1) 66 67 #endif 68