aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mate
diff options
context:
space:
mode:
authorStephen Fisher <steve@stephen-fisher.com>2007-03-26 06:10:52 +0000
committerStephen Fisher <steve@stephen-fisher.com>2007-03-26 06:10:52 +0000
commit46b8669566a546d6887d3f82aace2d8dea3608ff (patch)
treeb9f9d98a83bf6452d40eed647a29d2cd21cdfecd /plugins/mate
parent9fe056a3d70bdce224e64536f2fe8869b95e78e9 (diff)
Fix a bunch more warnings. Add -Werror when using --with-warnings-as-errors
under gcc to tools/lemon, plugins/mate and epan/ svn path=/trunk/; revision=21204
Diffstat (limited to 'plugins/mate')
-rw-r--r--plugins/mate/Makefile.am4
-rw-r--r--plugins/mate/mate_setup.c295
-rw-r--r--plugins/mate/mate_util.c39
3 files changed, 4 insertions, 334 deletions
diff --git a/plugins/mate/Makefile.am b/plugins/mate/Makefile.am
index 24673037db..270705bdda 100644
--- a/plugins/mate/Makefile.am
+++ b/plugins/mate/Makefile.am
@@ -26,6 +26,10 @@ INCLUDES = -I$(top_srcdir)
include Makefile.common
+if HAVE_WARNINGS_AS_ERRORS
+AM_CFLAGS = -Werror
+endif
+
plugindir = @plugindir@
plugin_LTLIBRARIES = mate.la
diff --git a/plugins/mate/mate_setup.c b/plugins/mate/mate_setup.c
index 06c35d0ce1..8073e9b602 100644
--- a/plugins/mate/mate_setup.c
+++ b/plugins/mate/mate_setup.c
@@ -569,301 +569,6 @@ extern mate_config* mate_cfg() {
return matecfg;
}
-static void append_avpl(GString* str, AVPL* avpl) {
- void* cookie = NULL;
- AVP* avp;
- gchar** vec;
- guint i;
-
- g_string_sprintfa(str,"( ");
-
- while(( avp = get_next_avp(avpl,&cookie) )) {
- switch (avp->o) {
- case '|' :
- g_string_sprintfa(str," %s {",avp->n);
-
- vec = g_strsplit(avp->v,"|",0);
-
- for (i = 0; vec[i]; i++) {
- g_string_sprintfa(str," \"%s\" |",vec[i]);
- }
-
- g_strfreev(vec);
-
- g_string_erase(str,str->len-1,1);
- g_string_sprintfa(str,"}, ");
- break;
- case '?':
- g_string_sprintfa(str,"%s, ",avp->n);
- break;
- default:
- g_string_sprintfa(str,"%s %c \"%s\", ",avp->n,avp->o,avp->v);
- break;
- }
- }
-
- if (str->len > 2) g_string_erase(str,str->len-2,1);
- g_string_sprintfa(str,")");
-}
-
-#if 0 /* XXX - Not used anywhere, for testing only? */
-static void print_transforms(gpointer k, gpointer v, gpointer p) {
- AVPL_Transf* t;
- GString* str = p;
-
- g_string_sprintfa(str,"Transform %s {\n",(gchar*)k);
-
- for (t = v; t; t = t->next) {
-
- if (t->match->len) {
- g_string_sprintfa(str,"\tMatch ");
-
- switch (t->match_mode) {
- case AVPL_STRICT:
- g_string_sprintfa(str,"Strict ");
- break;
- case AVPL_LOOSE:
- g_string_sprintfa(str,"Loose ");
- break;
- case AVPL_EVERY:
- g_string_sprintfa(str,"Every ");
- break;
- default:
- g_string_sprintfa(str,"None ");
- break;
- }
-
- append_avpl(str,t->match);
- }
-
- if (t->replace->len) {
- switch (t->replace_mode) {
- case AVPL_INSERT:
- g_string_sprintfa(str," Insert ");
- break;
- case AVPL_REPLACE:
- g_string_sprintfa(str," Replace ");
- break;
- default:
- g_string_sprintfa(str," None ");
- break;
- }
-
- append_avpl(str,t->replace);
- }
-
- g_string_sprintfa(str,";\n");
- }
-
- g_string_sprintfa(str,"};\n\n");
-}
-#endif /* 0 */
-
-static void append_transforms(GString* s, GPtrArray* ts) {
- guint i;
-
- if ( !ts || !ts->len ) return;
-
- g_string_sprintfa(s,"\tTransform ");
-
- for (i=0; i < ts->len; i++) {
- g_string_sprintfa(s,"%s, ",((AVPL_Transf*) g_ptr_array_index(ts,i))->name);
- }
-
- if (i>0) g_string_erase(s, s->len-2, 2);
- g_string_sprintfa(s,";\n");
-
-}
-
-static void print_hfid_hash(gpointer k, gpointer v, gpointer p _U_) {
- g_string_sprintfa((GString*)p,"\tExtract %s From %s;\n",(guint8*)v,my_protoname(*(int*)k));
-}
-
-/* XXX - Not used anywhere, for testing only? */
-#if 0
-static void print_pdu_config(mate_cfg_pdu* cfg, GString* s) {
- guint i;
- int hfid;
- const gchar* discard;
- const gchar* stop;
-
- discard = cfg->discard ? "TRUE": "FALSE";
- stop = cfg->last_extracted ? "TRUE" : "FALSE";
-
- g_string_sprintfa(s, "Pdu %s Proto %s Transport ",
- cfg->name,my_protoname(cfg->hfid_proto));
-
- for (i = 0; i < cfg->transport_ranges->len; i++) {
- hfid = *((int*) g_ptr_array_index(cfg->transport_ranges,i));
- g_string_sprintfa(s,"%s/",my_protoname(hfid));
- }
-
- g_string_erase(s, s->len-1, 1);
- g_string_sprintfa(s," {\n");
-
- if (cfg->payload_ranges) {
- g_string_sprintfa(s, "\tPayload ");
-
- for (i = 0; i < cfg->payload_ranges->len; i++) {
- hfid = *((int*) g_ptr_array_index(cfg->payload_ranges,i));
- g_string_sprintfa(s,"%s/",my_protoname(hfid));
- }
-
- if (i > 0) g_string_erase(s, s->len-1, 1);
-
- g_string_sprintfa(s,";\n");
-
- }
-
- g_hash_table_foreach(cfg->hfids_attr,print_hfid_hash,s);
-
- if (cfg->criterium) {
-
- g_string_sprintfa(s,"Criteria ");
-
- switch (cfg->criterium_accept_mode) {
- case ACCEPT_MODE:
- g_string_sprintfa(s,"Accept ");
- break;
- case REJECT_MODE:
- g_string_sprintfa(s,"Reject ");
- break;
- }
-
- switch(cfg->criterium_match_mode) {
- case AVPL_NO_MATCH:
- g_string_sprintfa(s,"None ");
- break;
- case AVPL_STRICT:
- g_string_sprintfa(s,"Strict ");
- break;
- case AVPL_LOOSE:
- g_string_sprintfa(s,"Loose ");
- break;
- case AVPL_EVERY:
- g_string_sprintfa(s,"Every ");
- break;
- }
-
- append_avpl(s, cfg->criterium);
- }
-
- append_transforms(s,cfg->transforms);
-
- g_string_sprintfa(s,"};\n\n");
-}
-
-static void print_gop_config(gchar* name _U_,mate_cfg_gop* cfg, GString* s) {
-
- g_string_sprintfa(s, "Gop %s On %s Match ",
- cfg->name,cfg->on_pdu);
-
- append_avpl(s, cfg->key);
-
- g_string_sprintfa(s," {\n");
-
- if (cfg->start) {
- g_string_sprintfa(s,"\tStart ");
- append_avpl(s, cfg->start);
- g_string_sprintfa(s,";\n");
- }
-
- if (cfg->stop) {
- g_string_sprintfa(s,"\tStop ");
- append_avpl(s, cfg->stop);
- g_string_sprintfa(s,";\n");
- }
-
- if (cfg->extra) {
- g_string_sprintfa(s,"\tExtra ");
- append_avpl(s, cfg->extra);
- g_string_sprintfa(s,";\n");
- }
-
- g_string_sprintfa(s,"\tDropUnassigned %s;\n",cfg->drop_unassigned ? "TRUE" : "FALSE");
- g_string_sprintfa(s,"\tShowTimes %s;\n",cfg->show_times ? "TRUE" : "FALSE");
-
- switch (cfg->pdu_tree_mode) {
- case GOP_NO_TREE:
- g_string_sprintfa(s,"\tShowTree NoTree;\n");
- break;
- case GOP_PDU_TREE:
- g_string_sprintfa(s,"\tShowTree PduTree;\n");
- break;
- case GOP_FRAME_TREE:
- g_string_sprintfa(s,"\tShowTree FrameTree;\n");
- break;
- case GOP_BASIC_PDU_TREE:
- break;
- }
-
- if (cfg->lifetime > 0) g_string_sprintfa(s,"\tLifetime %f;\n",cfg->lifetime);
- if (cfg->idle_timeout > 0) g_string_sprintfa(s,"\tIdleTimeout %f;\n",cfg->idle_timeout);
- if (cfg->expiration > 0) g_string_sprintfa(s,"\tExpiration %f;\n",cfg->expiration);
-
- append_transforms(s,cfg->transforms);
-
- g_string_sprintfa(s,"};\n\n");
-}
-
-static void print_gog_config(gchar* name _U_,mate_cfg_gog* cfg, GString* s) {
- void* cookie = NULL;
- AVPL* avpl;
-
- g_string_sprintfa(s, "Gog %s {\n",cfg->name);
-
- g_string_sprintfa(s,"\tShowTimes %s;\n",cfg->show_times ? "TRUE" : "FALSE");
-
- while (( avpl = get_next_avpl(cfg->keys,&cookie) )) {
- g_string_sprintfa(s,"\tMember %s ",avpl->name);
- append_avpl(s, avpl);
- g_string_sprintfa(s,";\n");
- }
-
- switch (cfg->gop_tree_mode) {
- case GOP_NULL_TREE:
- g_string_sprintfa(s,"\tGopTree NullTree;\n");
- break;
- case GOP_BASIC_TREE:
- break;
- case GOP_FULL_TREE:
- g_string_sprintfa(s,"\tGopTree FullTree;\n");
- break;
- }
-
- if (cfg->expiration > 0) g_string_sprintfa(s,"\tExpiration %f;\n",cfg->expiration);
-
- append_transforms(s,cfg->transforms);
-
- if (cfg->extra && cfg->extra->len) {
- g_string_sprintfa(s,"\tExtra ");
- append_avpl(s, cfg->extra);
- g_string_sprintfa(s,";\n");
- }
-
-
- g_string_sprintfa(s,"};\n\n");
-}
-
-static void print_config(void) {
- GString* config_text = g_string_new("\n");
- guint i;
-
- g_hash_table_foreach(matecfg->transfs,print_transforms,config_text);
-
- for (i=0; i < matecfg->pducfglist->len; i++) {
- print_pdu_config((mate_cfg_pdu*) g_ptr_array_index(matecfg->pducfglist,i),config_text);
- }
-
- g_hash_table_foreach(matecfg->gopcfgs,(GHFunc)print_gop_config,config_text);
- g_hash_table_foreach(matecfg->gogcfgs,(GHFunc)print_gog_config,config_text);
-
- g_message("Current configuration:\n%s\nDone;\n",config_text->str);
-
- g_string_free(config_text,TRUE);
-}
-#endif /* 0 */
-
extern mate_config* mate_make_config(const gchar* filename, int mate_hfid) {
gint* ett;
avp_init();
diff --git a/plugins/mate/mate_util.c b/plugins/mate/mate_util.c
index c93512dd31..1c66cea3df 100644
--- a/plugins/mate/mate_util.c
+++ b/plugins/mate/mate_util.c
@@ -429,13 +429,6 @@ extern AVP* avp_copy(AVP* from) {
return new;
}
-
-static void rename_avp(AVP* avp, gchar* name) {
- gchar* s = avp->n;
- avp->n = scs_subscribe(avp_strings,name);
- scs_unsubscribe(avp_strings,s);
-}
-
/**
* new_avpl:
* @name: the name the avpl will have.
@@ -1283,38 +1276,6 @@ extern AVPL* new_avpl_from_match(avpl_match_mode mode, const gchar* name,AVPL* s
}
/**
- * new_avpl_transform:
- *
- * creates an empty avpl transformation
- *
- * Return value: a pointer to the newly created avpl transformation
- **/
-static AVPL_Transf* new_avpl_transform(gchar* name, AVPL* mixed, avpl_match_mode match_mode, avpl_replace_mode replace_mode) {
- AVPL_Transf* t = g_malloc(sizeof(AVPL_Transf));
- AVP* avp;
-
- t->name = g_strdup(name);
- t->match = new_avpl("match");
- t->replace = new_avpl("replace");
- t->match_mode = match_mode;
- t->replace_mode = replace_mode;
- t->next = NULL;
- t->map = NULL;
-
- while (( avp = extract_first_avp(mixed) )) {
- if (*(avp->n) == '.') {
- rename_avp(avp,((avp->n)+1));
- insert_avp(t->replace, avp);
- } else {
- insert_avp(t->match, avp);
- }
- }
-
- return t;
-}
-
-
-/**
* delete_avpl_transform:
* @it: a pointer to the avpl transformation object
*