From 62565d40cbd11e5c29da1efd6b2cf1e0cd65042f Mon Sep 17 00:00:00 2001
From: winckel <winckel@eurecom.fr>
Date: Tue, 12 Nov 2013 09:29:58 +0000
Subject: [PATCH] Added an option to generate dissect file (result of message
 types parsing). Blocked some TASK name used only by ITTI.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4357 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 .../utils/itti_analyzer/libparser/xml_parse.c | 24 +++++++++++++++----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/common/utils/itti_analyzer/libparser/xml_parse.c b/common/utils/itti_analyzer/libparser/xml_parse.c
index 03062ac2c1..f8ead59e99 100644
--- a/common/utils/itti_analyzer/libparser/xml_parse.c
+++ b/common/utils/itti_analyzer/libparser/xml_parse.c
@@ -1,6 +1,8 @@
 #include <string.h>
 #include <unistd.h>
 
+#include <gtk/gtk.h>
+
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 
@@ -9,6 +11,7 @@
 #include "union_type.h"
 
 #include "ui_interface.h"
+#include "ui_main_screen.h"
 #include "ui_notif_dlg.h"
 #include "ui_filters.h"
 
@@ -716,7 +719,10 @@ static int update_filters() {
         types = types->child->child;
 
         while (types != NULL) {
-            ui_filters_add(FILTER_ORIGIN_TASKS, types->init_value, types->name, ENTRY_ENABLED_UNDEFINED);
+            if ((strcmp (types->name, "TASK_FIRST") != 0) && (strcmp (types->name, "TASK_MAX") != 0))
+            {
+            	ui_filters_add(FILTER_ORIGIN_TASKS, types->init_value, types->name, ENTRY_ENABLED_UNDEFINED);
+            }
             types = types->next;
         }
     }
@@ -727,7 +733,10 @@ static int update_filters() {
         types = types->child->child;
 
         while (types != NULL) {
-            ui_filters_add(FILTER_DESTINATION_TASKS, types->init_value, types->name, ENTRY_ENABLED_UNDEFINED);
+            if ((strcmp (types->name, "TASK_FIRST") != 0) && (strcmp (types->name, "TASK_MAX") != 0))
+            {
+            	ui_filters_add(FILTER_DESTINATION_TASKS, types->init_value, types->name, ENTRY_ENABLED_UNDEFINED);
+            }
             types = types->next;
         }
     }
@@ -739,9 +748,11 @@ static int xml_parse_doc(xmlDocPtr doc) {
     xmlNode *root_element = NULL;
     types_t *head = NULL;
     int ret = 0;
-    FILE *dissect_file;
+    FILE *dissect_file = NULL;
 
-    dissect_file = fopen ("./dissect.xml", "w");
+    if (ui_main_data.dissect_file_name != NULL) {
+        dissect_file = fopen (ui_main_data.dissect_file_name, "w");
+    }
 
     /* Get the root element node */
     root_element = xmlDocGetRootElement(doc);
@@ -770,11 +781,14 @@ static int xml_parse_doc(xmlDocPtr doc) {
         // root->type_hr_display(root, 0);
         update_filters();
         if (dissect_file != NULL) {
+            g_debug("generating dissected types file \"%s\" ...", ui_main_data.dissect_file_name);
             root->type_file_print (root, 0, dissect_file);
         }
     }
 
-    fclose (dissect_file);
+    if (dissect_file != NULL) {
+        fclose (dissect_file);
+    }
 
     g_message("Parsed XML definition");
 
-- 
GitLab