Esempio n. 1
0
void
nameres_prefs_fetch(GtkWidget *w)
{
	GtkWidget *m_resolv_cb, *n_resolv_cb, *t_resolv_cb;
#if defined(HAVE_C_ARES) || defined(HAVE_GNU_ADNS)
	GtkWidget *c_resolv_cb, *resolv_concurrency_te;
#endif /* HAVE_C_ARES || HAVE_GNU_ADNS */
#ifdef HAVE_LIBSMI
	GtkWidget	*load_smi_modules_cb, *suppress_smi_errors_cb;
	gboolean	load_smi_modules_orig;
#endif

	m_resolv_cb = (GtkWidget *)g_object_get_data(G_OBJECT(w), M_RESOLVE_KEY);
	n_resolv_cb = (GtkWidget *)g_object_get_data(G_OBJECT(w), N_RESOLVE_KEY);
	t_resolv_cb = (GtkWidget *)g_object_get_data(G_OBJECT(w), T_RESOLVE_KEY);
#if defined(HAVE_C_ARES) || defined(HAVE_GNU_ADNS)
	c_resolv_cb = (GtkWidget *)g_object_get_data(G_OBJECT(w), C_RESOLVE_KEY);

	resolv_concurrency_te = (GtkWidget *)g_object_get_data(G_OBJECT(w), RESOLVE_CONCURRENCY_KEY);
#endif /* HAVE_C_ARES || HAVE_GNU_ADNS */

	prefs.name_resolve = RESOLV_NONE;
	prefs.name_resolve |= (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (m_resolv_cb)) ? RESOLV_MAC : RESOLV_NONE);
	prefs.name_resolve |= (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (n_resolv_cb)) ? RESOLV_NETWORK : RESOLV_NONE);
	prefs.name_resolve |= (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (t_resolv_cb)) ? RESOLV_TRANSPORT : RESOLV_NONE);
#if defined(HAVE_C_ARES) || defined(HAVE_GNU_ADNS)
	prefs.name_resolve |= (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (c_resolv_cb)) ? RESOLV_CONCURRENT : RESOLV_NONE);

	prefs.name_resolve_concurrency = strtol (gtk_entry_get_text(
		GTK_ENTRY(resolv_concurrency_te)), NULL, 10);
#endif /* HAVE_C_ARES || HAVE_GNU_ADNS */
#ifdef HAVE_LIBSMI
	load_smi_modules_orig = prefs.load_smi_modules;
	load_smi_modules_cb = (GtkWidget *)g_object_get_data(G_OBJECT(w), LOAD_SMI_MODULES_KEY);
	prefs.load_smi_modules = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (load_smi_modules_cb));
	suppress_smi_errors_cb = (GtkWidget *)g_object_get_data(G_OBJECT(w), SUPPRESS_SMI_ERRORS_KEY);
	prefs.suppress_smi_errors = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (suppress_smi_errors_cb));

	/* Perform actions needed when enabling/disabling OID resolution */
	if (load_smi_modules_orig && !prefs.load_smi_modules) {
		prefs.load_smi_modules = TRUE; /* hack to make oids_cleanup() actually do something */
		oids_cleanup();
		prefs.load_smi_modules = FALSE; /* end hack */
	} else if (!load_smi_modules_orig && prefs.load_smi_modules) {
		oids_init();
	}
#endif
}
Esempio n. 2
0
void
epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_data),
	  void (*register_all_handoffs_func)(register_cb cb, gpointer client_data),
	  register_cb cb,
	  gpointer client_data,
	  void (*report_failure)(const char *, va_list),
	  void (*report_open_failure)(const char *, int, gboolean),
	  void (*report_read_failure)(const char *, int),
	  void (*report_write_failure)(const char *, int))
{
	init_report_err(report_failure, report_open_failure,
	    report_read_failure, report_write_failure);

	/* initialize memory allocation subsystem */
	ep_init_chunk();
	se_init_chunk();

	/* initialize the GUID to name mapping table */
	guids_init();

	except_init();
#ifdef HAVE_LIBGNUTLS
	gnutls_global_init();
#elif defined(HAVE_LIBGCRYPT)
	gcry_check_version(NULL);
#endif
	tvbuff_init();
	tap_init();
	prefs_init();
	proto_init(register_all_protocols_func, register_all_handoffs_func,
	    cb, client_data);
	packet_init();
	dfilter_init();
	final_registration_all_protocols();
	host_name_lookup_init();
	expert_init();
	oids_init();
#ifdef HAVE_LUA_5_1
	wslua_init(NULL);
#endif
#ifdef HAVE_GEOIP
	geoip_db_init();
#endif

}
Esempio n. 3
0
int
main(int argc, char **argv)
{
    int result;

    g_test_init(&argc, &argv, NULL);

    /* /oids/2encoded */
    g_test_add_func("/oids/2encoded/subids/simple",   oids_test_2encoded_subids_simple);
    g_test_add_func("/oids/2encoded/subids/bad",   oids_test_2encoded_subids_bad);
    g_test_add_func("/oids/2encoded/string/simple",   oids_test_2encoded_string_simple);
    g_test_add_func("/oids/2encoded/string/short",   oids_test_2encoded_string_short);
    g_test_add_func("/oids/2encoded/string/long",   oids_test_2encoded_string_long);
    g_test_add_func("/oids/2encoded/string/tooshort",   oids_test_2encoded_string_tooshort);

    /* /oids/2subids */
    g_test_add_func("/oids/2subids/string",   oids_test_2subids_string);
    g_test_add_func("/oids/2subids/string/tooshort",   oids_test_2subids_string_tooshort);
    g_test_add_func("/oids/2subids/encoded",   oids_test_2subids_encoded);
    g_test_add_func("/oids/2subids/encoded/long",   oids_test_2subids_encoded_long);
    g_test_add_func("/oids/2subids/encoded/absviasub",   oids_test_2subids_encoded_absviasub);
    g_test_add_func("/oids/2subids/encoded/relviasub",   oids_test_2subids_encoded_relviasub);


    /* /oids/2string */
    g_test_add_func("/oids/2string/subids/abs",   oids_test_2string_subids_abs);
    g_test_add_func("/oids/2string/subids/rel",   oids_test_2string_subids_rel);
    g_test_add_func("/oids/2string/subids/absviarel",   oids_test_2string_subids_absviarel);
    g_test_add_func("/oids/2string/subids/relsizes",   oids_test_2string_subids_relsizes);
    g_test_add_func("/oids/2string/encoded",   oids_test_2string_encoded);
    g_test_add_func("/oids/2string/encoded/rel",   oids_test_2string_encoded_rel);

    /* /oids/2resolved */
    g_test_add_func("/oids/2resolved/subids",   oids_test_2resolved_subids);
    g_test_add_func("/oids/2resolved/encoded",   oids_test_2resolved_encoded);
    g_test_add_func("/oids/2resolved/encoded/rel",   oids_test_2resolved_encoded_rel);
    g_test_add_func("/oids/2resolved/string",   oids_test_2resolved_string);

    /* /oids/2both */
    g_test_add_func("/oids/2both/subids",   oids_test_2both_subids);
    g_test_add_func("/oids/2both/encoded",   oids_test_2both_encoded);
    g_test_add_func("/oids/2both/string",   oids_test_2both_string);

    /* /oids/2struct */
    g_test_add_func("/oids/2struct/subids",   oids_test_2struct_subids);
    g_test_add_func("/oids/2struct/encoded",   oids_test_2struct_encoded);
    g_test_add_func("/oids/2struct/string",   oids_test_2struct_string);

    /* /oids/add */
    g_test_add_func("/oids/add/subids",   oids_test_add_subids);
    g_test_add_func("/oids/add/encoded",   oids_test_add_encoded);
    g_test_add_func("/oids/add/string",   oids_test_add_string);

    emem_init();
    wmem_init();
    oids_init();
    result = g_test_run();
    oids_cleanup();
    wmem_cleanup();
    /*
     * This might have been a good place for a call to ep_free_all() but that is not part of the
     * public interface for emem.h
     */
    return result;
}