From 088ffa504e571648f23fd4b51f40bd327fcf302b Mon Sep 17 00:00:00 2001 From: Luis Ontanon Date: Mon, 12 Dec 2005 23:23:32 +0000 Subject: - add Debug and Default declarations. - supress unwanted console printouts. svn path=/trunk/; revision=16769 --- plugins/mate/mate_grammar.lemon | 72 +++++++++++++++++++++++++++++++++++++++++ plugins/mate/mate_parser.l | 9 +++++- plugins/mate/mate_runtime.c | 6 +++- plugins/mate/mate_setup.c | 5 --- plugins/mate/packet-mate.c | 2 -- 5 files changed, 85 insertions(+), 9 deletions(-) (limited to 'plugins/mate') diff --git a/plugins/mate/mate_grammar.lemon b/plugins/mate/mate_grammar.lemon index fe7904b24b..cfbd2e86a5 100644 --- a/plugins/mate/mate_grammar.lemon +++ b/plugins/mate/mate_grammar.lemon @@ -254,8 +254,80 @@ decl ::= pdu_decl. decl ::= gop_decl. decl ::= gog_decl. decl ::= transform_decl. +decl ::= defaults_decl. +decl ::= debug_decl. decl ::= DONE_KW SEMICOLON. +/************* DEBUG +*/ + +debug_decl ::= DEBUG_KW OPEN_BRACE dbgfile_default dbglevel_default pdu_dbglevel_default gop_dbglevel_default gog_dbglevel_default CLOSE_BRACE SEMICOLON. + +dbgfile_default ::= FILENAME_KW QUOTED(Filename) SEMICOLON. { mc->dbg_facility = fopen(Filename,"w"); if (mc->dbg_facility == NULL) report_open_failure(Filename,errno,FALSE); } +dbgfile_default ::= FILENAME_KW NAME(Filename) SEMICOLON. { mc->dbg_facility = fopen(Filename,"w"); if (mc->dbg_facility == NULL) report_open_failure(Filename,errno,FALSE); } +dbgfile_default ::= . + +dbglevel_default ::= LEVEL_KW INTEGER(LevelString) SEMICOLON. { mc->dbg_lvl = (int) strtol(LevelString,NULL,10); } +dbglevel_default ::= . + +pdu_dbglevel_default ::= PDU_KW LEVEL_KW INTEGER(LevelString) SEMICOLON. { mc->dbg_pdu_lvl = (int) strtol(LevelString,NULL,10); } +pdu_dbglevel_default ::= . + +gop_dbglevel_default ::= GOP_KW LEVEL_KW INTEGER(LevelString) SEMICOLON. { mc->dbg_gop_lvl = (int) strtol(LevelString,NULL,10); } +gop_dbglevel_default ::= . + +gog_dbglevel_default ::= GOG_KW LEVEL_KW INTEGER(LevelString) SEMICOLON. { mc->dbg_gog_lvl = (int) strtol(LevelString,NULL,10); } +gog_dbglevel_default ::= . + + +/************* DEFAULTS +*/ + +defaults_decl ::= DEFAULT_KW OPEN_BRACE pdu_defaults gop_defaults gog_defaults CLOSE_BRACE SEMICOLON. + +pdu_defaults ::= PDU_KW OPEN_BRACE pdu_last_extracted_default pdu_drop_unassigned_default pdu_discard_default CLOSE_BRACE SEMICOLON. +pdu_defaults ::= . + +pdu_last_extracted_default ::= LAST_EXTRACTED_KW true_false(Flag) SEMICOLON. { mc->defaults.pdu.last_extracted = Flag; } +pdu_last_extracted_default ::= . + +pdu_drop_unassigned_default ::= DROP_UNASSIGNED_KW true_false(Flag) SEMICOLON. { mc->defaults.pdu.drop_unassigned = Flag; } +pdu_drop_unassigned_default ::= . + +pdu_discard_default ::= DISCARD_PDU_DATA_KW true_false(Flag) SEMICOLON. { mc->defaults.pdu.discard = Flag; } +pdu_discard_default ::= . + +gop_defaults ::= GOP_KW OPEN_BRACE gop_expiration_default gop_idle_timeout_default gop_lifetime_default gop_drop_unassigned_default gop_tree_mode_default gop_show_times_default CLOSE_BRACE SEMICOLON. +gop_defaults ::= . + +gop_expiration_default ::= EXPIRATION_KW time_value(B) SEMICOLON. { mc->defaults.gop.expiration = B; } +gop_expiration_default ::= . + +gop_idle_timeout_default ::= IDLE_TIMEOUT_KW time_value(B) SEMICOLON. { mc->defaults.gop.idle_timeout = B; } +gop_idle_timeout_default ::= . + +gop_lifetime_default ::= LIFETIME_KW time_value(B) SEMICOLON. { mc->defaults.gop.lifetime = B; } +gop_lifetime_default ::= . + +gop_drop_unassigned_default ::= DROP_UNASSIGNED_KW true_false(B) SEMICOLON. { mc->defaults.gop.drop_unassigned = B; } +gop_drop_unassigned_default ::= . + +gop_tree_mode_default ::= SHOW_TREE_KW gop_tree_mode(B) SEMICOLON. { mc->defaults.gop.pdu_tree_mode = B; } +gop_tree_mode_default ::= . + +gop_show_times_default ::= SHOW_TIMES_KW true_false(B) SEMICOLON. { mc->defaults.gop.show_times = B; } +gop_show_times_default ::= . + +gog_defaults ::= GOG_KW OPEN_BRACE gog_expiration_default gop_tree_mode_default gog_goptree_default CLOSE_BRACE SEMICOLON. +gog_defaults ::= . + +gog_expiration_default ::= EXPIRATION_KW time_value(B) SEMICOLON. { mc->defaults.gop.expiration = B; } +gog_expiration_default ::= . + +gog_goptree_default ::= GOP_TREE_KW gop_tree_type(B) SEMICOLON. { mc->defaults.gog.gop_tree_mode = B; } +gog_goptree_default ::= . + + /******************************************* TRANSFORM */ diff --git a/plugins/mate/mate_parser.l b/plugins/mate/mate_parser.l index 3aeb2235bb..5c4e7a322d 100644 --- a/plugins/mate/mate_parser.l +++ b/plugins/mate/mate_parser.l @@ -92,7 +92,10 @@ drop_unassigned_kw DropUnassigned discard_pdu_data_kw DiscardPduData last_pdu_kw LastPdu done_kw Done - +filename_kw Filename +debug_kw Debug +level_kw Level +default_kw Default open_parens "(" @@ -221,6 +224,10 @@ blk_cmnt_stop "*/" {discard_pdu_data_kw} MATE_PARSE(TOKEN_DISCARD_PDU_DATA_KW); {last_pdu_kw} MATE_PARSE(TOKEN_LAST_PDU_KW); {done_kw} MATE_PARSE(TOKEN_DONE_KW); +{filename_kw} MATE_PARSE(TOKEN_FILENAME_KW); +{debug_kw} MATE_PARSE(TOKEN_DEBUG_KW); +{level_kw} MATE_PARSE(TOKEN_LEVEL_KW); +{default_kw} MATE_PARSE(TOKEN_DEFAULT_KW); {open_parens} MATE_PARSE(TOKEN_OPEN_PARENS); {close_parens} MATE_PARSE(TOKEN_CLOSE_PARENS); diff --git a/plugins/mate/mate_runtime.c b/plugins/mate/mate_runtime.c index 362c8d3e31..6de9024466 100644 --- a/plugins/mate/mate_runtime.c +++ b/plugins/mate/mate_runtime.c @@ -161,7 +161,11 @@ extern void initialize_mate_runtime(void) { dbg_pdu = &(mc->dbg_pdu_lvl); dbg_gop = &(mc->dbg_gop_lvl); dbg_gog = &(mc->dbg_gog_lvl); - + dbg = &(mc->dbg_lvl); + dbg_facility = mc->dbg_facility; + + dbg_print(dbg, 1, dbg_facility, "starting mate"); + } else { rd = NULL; } diff --git a/plugins/mate/mate_setup.c b/plugins/mate/mate_setup.c index 7e98d49933..4b3fe1a9de 100644 --- a/plugins/mate/mate_setup.c +++ b/plugins/mate/mate_setup.c @@ -917,11 +917,6 @@ extern mate_config* mate_make_config(const gchar* filename, int mate_hfid) { if ( mate_load_config(filename,matecfg) ) { analyze_config(); - - /* if (dbg_cfg_lvl > 0) { */ - print_config(); - /* } */ - } else { report_failure("MATE failed to configue!\n" "It is recomended that you fix your config and restart ethereal.\n" diff --git a/plugins/mate/packet-mate.c b/plugins/mate/packet-mate.c index 744c35bf36..81d4165321 100644 --- a/plugins/mate/packet-mate.c +++ b/plugins/mate/packet-mate.c @@ -340,8 +340,6 @@ proto_reg_handoff_mate(void) proto_register_subtree_array((gint**) mc->ett->data, mc->ett->len); register_init_routine(initialize_mate_runtime); - g_warning("filter: %s",mc->tap_filter); - tap_error = register_tap_listener("frame", &mate_tap_data, (char*) mc->tap_filter, (tap_reset_cb) NULL, -- cgit v1.2.3