int C_TransIPTLS::config (T_pConfigValueList P_config_param_list) {
  GEN_DEBUG(1, "C_TransIP::config  ()");
  m_logInfo = NULL ;
  m_logError = NULL ;

  int                           L_ret = 0       ;
  T_ConfigValueList::iterator   L_config_it     ;

  if (!P_config_param_list->empty()) {
    for (L_config_it = P_config_param_list->begin() ;
	 L_config_it != P_config_param_list->end();
	 L_config_it++) {
      L_ret = analyze_config(*L_config_it) ;
      if (L_ret != 0) break ;
    }
  }

  return (L_ret);
}
Beispiel #2
0
extern mate_config* mate_make_config(const gchar* filename, int mate_hfid) {
	gint* ett;
	avp_init();

	matecfg = g_malloc(sizeof(mate_config));

	matecfg->hfid_mate = mate_hfid;

	matecfg->fields_filter = g_string_new("");
	matecfg->protos_filter = g_string_new("");

	matecfg->dbg_facility = NULL;

	matecfg->mate_lib_path = g_strdup_printf("%s%c%s%c",get_datafile_dir(),DIR_SEP,DEFAULT_MATE_LIB_PATH,DIR_SEP);

	matecfg->pducfgs = g_hash_table_new(g_str_hash,g_str_equal);
	matecfg->gopcfgs = g_hash_table_new(g_str_hash,g_str_equal);
	matecfg->gogcfgs = g_hash_table_new(g_str_hash,g_str_equal);
	matecfg->transfs = g_hash_table_new(g_str_hash,g_str_equal);

	matecfg->pducfglist = g_ptr_array_new();
	matecfg->gops_by_pduname = g_hash_table_new(g_str_hash,g_str_equal);
	matecfg->gogs_by_gopname = g_hash_table_new(g_str_hash,g_str_equal);

	matecfg->ett_root = -1;

	matecfg->hfrs = g_array_new(FALSE,FALSE,sizeof(hf_register_info));
	matecfg->ett  = g_array_new(FALSE,FALSE,sizeof(gint*));

	matecfg->defaults.pdu.drop_unassigned = FALSE;
	matecfg->defaults.pdu.discard = FALSE;
	matecfg->defaults.pdu.last_extracted = FALSE;
	matecfg->defaults.pdu.match_mode = AVPL_STRICT;
	matecfg->defaults.pdu.replace_mode = AVPL_INSERT;

		/* gop prefs */
	matecfg->defaults.gop.expiration = -1.0;
	matecfg->defaults.gop.idle_timeout = -1.0;
	matecfg->defaults.gop.lifetime = -1.0;
	matecfg->defaults.gop.pdu_tree_mode = GOP_FRAME_TREE;
	matecfg->defaults.gop.show_times = TRUE;
	matecfg->defaults.gop.drop_unassigned = FALSE;

		/* gog prefs */
	matecfg->defaults.gog.expiration = 5.0;
	matecfg->defaults.gog.show_times = TRUE;
	matecfg->defaults.gog.gop_tree_mode = GOP_BASIC_TREE;

	/* what to dbgprint */
	matecfg->dbg_lvl = 0;
	matecfg->dbg_pdu_lvl = 0;
	matecfg->dbg_gop_lvl = 0;
	matecfg->dbg_gog_lvl = 0;

	matecfg->config_error = g_string_new("");

	ett = &matecfg->ett_root;
	g_array_append_val(matecfg->ett,ett);

	if ( mate_load_config(filename,matecfg) ) {
		analyze_config();
	} else {
		report_failure("MATE failed to configure!\n"
					   "It is recommended that you fix your config and restart Wireshark.\n"
					   "The reported error is:\n%s\n",matecfg->config_error->str);

		/* if (matecfg) destroy_mate_config(matecfg,FALSE); */
		matecfg = NULL;
		return NULL;
	}

	if (matecfg->fields_filter->len > 1) {
		g_string_erase(matecfg->fields_filter,0,2);
		g_string_erase(matecfg->protos_filter,0,2);
	} else {
		/*destroy_mate_config(matecfg,FALSE);*/
		matecfg = NULL;
		return NULL;
	}

	matecfg->tap_filter = g_strdup_printf("(%s) && (%s)",matecfg->protos_filter->str,matecfg->fields_filter->str);

	return matecfg;
}