Commit 7a178e01 authored by winckel's avatar winckel

Reorganized and completed menus:

- Separated "File" into "Filters and "Messages" menus.
- Added "Enable filtering".
- Added "Reload messages file".
- Added "Go to first message".
- Added "Go to message".
- Added "Go to last message".
- Added "Display message header"
- Added "Display brace"
- Added menu key shortcuts (mnemonic and accelerator).
Created an entry box for message goto input number and modified the search function to select the closest lower number if input number is not present in messages list.
Cleared message content view when needed.
Blocked message content redisplay when not needed.
Added a signal handler to capture events on message list tree view.
Modified message content display format.
Modified some log points.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4426 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent f6c2677a
...@@ -84,7 +84,7 @@ static int socket_read_itti_message(socket_data_t *socket_data, ...@@ -84,7 +84,7 @@ static int socket_read_itti_message(socket_data_t *socket_data,
g_assert(message_header != NULL); g_assert(message_header != NULL);
// g_debug("Attempting to read signal header from socket"); g_debug("Attempting to read signal header from socket");
/* Read the sub-header of signal */ /* Read the sub-header of signal */
while (data_read != sizeof(itti_signal_header_t)) { while (data_read != sizeof(itti_signal_header_t)) {
...@@ -124,7 +124,7 @@ static int socket_read_itti_message(socket_data_t *socket_data, ...@@ -124,7 +124,7 @@ static int socket_read_itti_message(socket_data_t *socket_data,
socket_notify_gui_update(socket_data); socket_notify_gui_update(socket_data);
} }
// g_debug("Successfully read new signal %u from socket", itti_signal_header.message_number); g_debug("Successfully read new signal %u from socket", itti_signal_header.message_number);
return total_data_read + sizeof(itti_signal_header); return total_data_read + sizeof(itti_signal_header);
} }
......
...@@ -8,10 +8,12 @@ ...@@ -8,10 +8,12 @@
#include "ui_interface.h" #include "ui_interface.h"
int array_dissect_from_buffer( int array_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent) buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{ {
struct types_s *type_child; types_t *type_child;
int length = 0;
char cbuf[50];
DISPLAY_PARSE_INFO("array", type->name, offset, parent_offset); DISPLAY_PARSE_INFO("array", type->name, offset, parent_offset);
...@@ -49,22 +51,23 @@ int array_dissect_from_buffer( ...@@ -49,22 +51,23 @@ int array_dissect_from_buffer(
} }
} }
for (i = 0; i < (items - zero_counter); i++) for (i = 0; i < (items - zero_counter); i++)
{
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "[%d] ", i));
ui_set_signal_text_cb(user_data, cbuf, length);
type->child->type_dissect_from_buffer ( type->child->type_dissect_from_buffer (
type->child, ui_set_signal_text_cb, user_data, buffer, parent_offset, type->child, ui_set_signal_text_cb, user_data, buffer, parent_offset,
offset + i * type_child->size, type->name == NULL ? indent : indent + DISPLAY_TAB_SIZE); offset + i * type_child->size, indent,
FALSE);
}
if (zero_counter > 0) if (zero_counter > 0)
{ {
int length = 0; INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "[%d .. %d] ", i, items -1));
char cbuf[50];
INDENTED_STRING(cbuf, type->name == NULL ? indent : indent + DISPLAY_TAB_SIZE,);
length = sprintf(cbuf, "[%d .. %d] ", i, items -1);
ui_set_signal_text_cb(user_data, cbuf, length); ui_set_signal_text_cb(user_data, cbuf, length);
type->child->type_dissect_from_buffer ( type->child->type_dissect_from_buffer (
type->child, ui_set_signal_text_cb, user_data, type->child, ui_set_signal_text_cb, user_data,
buffer, parent_offset, offset + i * type_child->size, 0); buffer, parent_offset, offset + i * type_child->size, indent, FALSE);
} }
} }
if (type->name) { if (type->name) {
...@@ -74,7 +77,7 @@ int array_dissect_from_buffer( ...@@ -74,7 +77,7 @@ int array_dissect_from_buffer(
return 0; return 0;
} }
int array_type_file_print(struct types_s *type, int indent, FILE *file) { int array_type_file_print(types_t *type, int indent, FILE *file) {
if (type == NULL) if (type == NULL)
return -1; return -1;
INDENTED(file, indent, fprintf(file, "<Array>\n")); INDENTED(file, indent, fprintf(file, "<Array>\n"));
...@@ -93,7 +96,7 @@ int array_type_file_print(struct types_s *type, int indent, FILE *file) { ...@@ -93,7 +96,7 @@ int array_type_file_print(struct types_s *type, int indent, FILE *file) {
return 0; return 0;
} }
int array_type_hr_display(struct types_s *type, int indent) { int array_type_hr_display(types_t *type, int indent) {
if (type == NULL) if (type == NULL)
return -1; return -1;
INDENTED(stdout, indent, printf("<Array>\n")); INDENTED(stdout, indent, printf("<Array>\n"));
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
#define ARRAY_TYPE_H_ #define ARRAY_TYPE_H_
int array_dissect_from_buffer( int array_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent); buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int array_type_hr_display(struct types_s *type, int indent); int array_type_hr_display(types_t *type, int indent);
int array_type_file_print(struct types_s *type, int indent, FILE *file); int array_type_file_print(types_t *type, int indent, FILE *file);
#endif /* ARRAY_TYPE_H_ */ #endif /* ARRAY_TYPE_H_ */
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "enum_type.h" #include "enum_type.h"
#include "ui_interface.h" #include "ui_interface.h"
char *enum_type_get_name_from_value(struct types_s *type, uint32_t value) char *enum_type_get_name_from_value(types_t *type, uint32_t value)
{ {
char *enum_name = "UNKNOWN"; char *enum_name = "UNKNOWN";
types_t *enum_value; types_t *enum_value;
...@@ -22,8 +22,8 @@ char *enum_type_get_name_from_value(struct types_s *type, uint32_t value) ...@@ -22,8 +22,8 @@ char *enum_type_get_name_from_value(struct types_s *type, uint32_t value)
} }
int enum_type_dissect_from_buffer( int enum_type_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent) buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{ {
uint32_t value = 0; uint32_t value = 0;
types_t *values; types_t *values;
...@@ -37,7 +37,7 @@ int enum_type_dissect_from_buffer( ...@@ -37,7 +37,7 @@ int enum_type_dissect_from_buffer(
values->parent = type; values->parent = type;
values->type_dissect_from_buffer( values->type_dissect_from_buffer(
values, ui_set_signal_text_cb, user_data, buffer, offset, parent_offset, values, ui_set_signal_text_cb, user_data, buffer, offset, parent_offset,
type->name == NULL ? indent: indent + DISPLAY_TAB_SIZE); type->name == NULL ? indent: indent + DISPLAY_TAB_SIZE, FALSE);
break; break;
} }
} }
...@@ -46,14 +46,13 @@ int enum_type_dissect_from_buffer( ...@@ -46,14 +46,13 @@ int enum_type_dissect_from_buffer(
char cbuf[50]; char cbuf[50];
length = sprintf(cbuf, "(0x%08x) UNKNOWN;\n", value); length = sprintf(cbuf, "(0x%08x) UNKNOWN;\n", value);
ui_set_signal_text_cb(user_data, cbuf, length); ui_set_signal_text_cb(user_data, cbuf, length);
} }
return 0; return 0;
} }
int enum_type_file_print(struct types_s *type, int indent, FILE *file) int enum_type_file_print(types_t *type, int indent, FILE *file)
{ {
types_t *values; types_t *values;
...@@ -77,7 +76,7 @@ int enum_type_file_print(struct types_s *type, int indent, FILE *file) ...@@ -77,7 +76,7 @@ int enum_type_file_print(struct types_s *type, int indent, FILE *file)
return 0; return 0;
} }
int enum_type_hr_display(struct types_s *type, int indent) int enum_type_hr_display(types_t *type, int indent)
{ {
types_t *values; types_t *values;
......
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
#ifndef ENUM_TYPE_H_ #ifndef ENUM_TYPE_H_
#define ENUM_TYPE_H_ #define ENUM_TYPE_H_
char *enum_type_get_name_from_value(struct types_s *type, uint32_t value); char *enum_type_get_name_from_value(types_t *type, uint32_t value);
int enum_type_dissect_from_buffer( int enum_type_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent); buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int enum_type_file_print(struct types_s *type, int indent, FILE *file); int enum_type_file_print(types_t *type, int indent, FILE *file);
int enum_type_hr_display(struct types_s *type, int indent); int enum_type_hr_display(types_t *type, int indent);
#endif /* ENUM_TYPE_H_ */ #endif /* ENUM_TYPE_H_ */
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
uint32_t last_enum_value; uint32_t last_enum_value;
int enum_value_dissect_from_buffer( int enum_value_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent) buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{ {
struct types_s *type_parent = NULL; types_t *type_parent = NULL;
uint32_t value = 0; uint32_t value = 0;
DISPLAY_PARSE_INFO("enum_value", type->name, offset, parent_offset); DISPLAY_PARSE_INFO("enum_value", type->name, offset, parent_offset);
...@@ -40,16 +40,14 @@ int enum_value_dissect_from_buffer( ...@@ -40,16 +40,14 @@ int enum_value_dissect_from_buffer(
last_enum_value = 0; last_enum_value = 0;
} }
} }
sprintf(cbuf, "(0x%08x) %s;\n", value, type->name); length = sprintf(cbuf, "(0x%08x) %s;\n", value, type->name);
length = strlen(cbuf);
ui_set_signal_text_cb(user_data, cbuf, length); ui_set_signal_text_cb(user_data, cbuf, length);
} }
return 0; return 0;
} }
int enum_value_file_print(struct types_s *type, int indent, FILE *file) int enum_value_file_print(types_t *type, int indent, FILE *file)
{ {
if (type == NULL) if (type == NULL)
return -1; return -1;
...@@ -63,7 +61,7 @@ int enum_value_file_print(struct types_s *type, int indent, FILE *file) ...@@ -63,7 +61,7 @@ int enum_value_file_print(struct types_s *type, int indent, FILE *file)
return 0; return 0;
} }
int enum_value_type_hr_display(struct types_s *type, int indent) int enum_value_type_hr_display(types_t *type, int indent)
{ {
if (type == NULL) if (type == NULL)
return -1; return -1;
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
extern uint32_t last_enum_value; extern uint32_t last_enum_value;
int enum_value_dissect_from_buffer( int enum_value_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent); buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int enum_value_file_print(struct types_s *type, int indent, FILE *file); int enum_value_file_print(types_t *type, int indent, FILE *file);
int enum_value_type_hr_display(struct types_s *type, int indent); int enum_value_type_hr_display(types_t *type, int indent);
#endif /* ENUM_VALUE_TYPE_H_ */ #endif /* ENUM_VALUE_TYPE_H_ */
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
#include "ui_interface.h" #include "ui_interface.h"
int field_dissect_from_buffer( int field_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent) buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{ {
int length = 0; int length = 0;
char cbuf[50]; char cbuf[50];
struct types_s *type_child; types_t *type_child;
char array_info[50]; char array_info[50];
int indent_child; new_line = FALSE;
DISPLAY_PARSE_INFO("field", type->name, offset, parent_offset); DISPLAY_PARSE_INFO("field", type->name, offset, parent_offset);
...@@ -41,7 +41,7 @@ int field_dissect_from_buffer( ...@@ -41,7 +41,7 @@ int field_dissect_from_buffer(
} }
if (type_child->type == TYPE_ARRAY) { if (type_child->type == TYPE_ARRAY) {
struct types_s *type_array_child; types_t *type_array_child;
/* Ignore TYPEDEF children */ /* Ignore TYPEDEF children */
for (type_array_child = type_child->child; for (type_array_child = type_child->child;
...@@ -56,34 +56,45 @@ int field_dissect_from_buffer( ...@@ -56,34 +56,45 @@ int field_dissect_from_buffer(
} }
DISPLAY_TYPE("Fld"); DISPLAY_TYPE("Fld");
INDENTED_STRING(cbuf, indent, sprintf(cbuf, ".%s%s = ", type->name ? type->name : "Field", array_info));
length = strlen (cbuf);
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, ".%s%s = ", type->name ? type->name : "Field", array_info));
ui_set_signal_text_cb(user_data, cbuf, length); ui_set_signal_text_cb(user_data, cbuf, length);
indent_child = indent; if (type_child->type == TYPE_ARRAY) {
if (type_child->type == TYPE_ARRAY || type_child->type == TYPE_STRUCT || type_child->type == TYPE_UNION) {
DISPLAY_BRACE(ui_set_signal_text_cb(user_data, "{", 1);) DISPLAY_BRACE(ui_set_signal_text_cb(user_data, "{", 1);)
ui_set_signal_text_cb(user_data, "\n", 1); ui_set_signal_text_cb(user_data, "\n", 1);
indent_child += DISPLAY_TAB_SIZE; new_line = TRUE;
} }
if (type_child->type == TYPE_FUNDAMENTAL || type_child->type == TYPE_POINTER) { /*
indent_child = 0; if (type_child->type == TYPE_STRUCT || type_child->type == TYPE_UNION) {
DISPLAY_BRACE(ui_set_signal_text_cb(user_data, "{", 1);)
ui_set_signal_text_cb(user_data, "\n", 1);
new_line = TRUE;
} }
*/
type->child->parent = type; type->child->parent = type;
CHECK_FCT(type->child->type_dissect_from_buffer( type->child->type_dissect_from_buffer(
type->child, ui_set_signal_text_cb, user_data, buffer, type->child, ui_set_signal_text_cb, user_data, buffer,
parent_offset, offset + type->offset, indent_child)); parent_offset, offset + type->offset, new_line ? indent + DISPLAY_TAB_SIZE : indent, new_line);
DISPLAY_BRACE(
if (type_child->type == TYPE_ARRAY) {
DISPLAY_TYPE("Fld");
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "};\n"));
ui_set_signal_text_cb(user_data, cbuf, length);
});
/*
DISPLAY_BRACE( DISPLAY_BRACE(
if (type_child->type == TYPE_ARRAY || type_child->type == TYPE_STRUCT || type_child->type == TYPE_UNION) { if (type_child->type == TYPE_STRUCT || type_child->type == TYPE_UNION) {
DISPLAY_TYPE("Fld"); DISPLAY_TYPE("Fld");
INDENTED_STRING(cbuf, indent, sprintf(cbuf, "};\n")); INDENTED_STRING(cbuf, indent, sprintf(cbuf, "};\n"));
length = strlen (cbuf); length = strlen (cbuf);
ui_set_signal_text_cb(user_data, cbuf, length); ui_set_signal_text_cb(user_data, cbuf, length);
}); });
*/
} }
} }
} }
...@@ -94,19 +105,16 @@ int field_dissect_from_buffer( ...@@ -94,19 +105,16 @@ int field_dissect_from_buffer(
CHECK_FCT(buffer_fetch_bits(buffer, offset + type->offset + parent_offset, type->bits, &value)); CHECK_FCT(buffer_fetch_bits(buffer, offset + type->offset + parent_offset, type->bits, &value));
DISPLAY_TYPE("Fld"); DISPLAY_TYPE("Fld");
INDENTED_STRING(
cbuf,
indent,
sprintf(cbuf, ".%s:%d = (0x%0*x) %d;\n", type->name ? type->name : "Field", type->bits, (type->bits + 3) / 4, value, value));
length = strlen (cbuf);
INDENTED_STRING(cbuf, indent,
length = sprintf(cbuf, ".%s:%d = (0x%0*x) %d;\n", type->name ? type->name : "Field", type->bits, (type->bits + 3) / 4, value, value));
ui_set_signal_text_cb(user_data, cbuf, length); ui_set_signal_text_cb(user_data, cbuf, length);
} }
return 0; return 0;
} }
int field_type_file_print(struct types_s *type, int indent, FILE *file) { int field_type_file_print(types_t *type, int indent, FILE *file) {
if (type == NULL) if (type == NULL)
return -1; return -1;
INDENTED(file, indent, fprintf(file, "<Field>\n")); INDENTED(file, indent, fprintf(file, "<Field>\n"));
...@@ -127,7 +135,7 @@ int field_type_file_print(struct types_s *type, int indent, FILE *file) { ...@@ -127,7 +135,7 @@ int field_type_file_print(struct types_s *type, int indent, FILE *file) {
return 0; return 0;
} }
int field_type_hr_display(struct types_s *type, int indent) { int field_type_hr_display(types_t *type, int indent) {
if (type == NULL) if (type == NULL)
return -1; return -1;
INDENTED(stdout, indent, printf("<Field>\n")); INDENTED(stdout, indent, printf("<Field>\n"));
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
#define FIELD_TYPE_H_ #define FIELD_TYPE_H_
int field_dissect_from_buffer( int field_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent); buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int field_type_file_print(struct types_s *type, int indent, FILE *file); int field_type_file_print(types_t *type, int indent, FILE *file);
int field_type_hr_display(struct types_s *type, int indent); int field_type_hr_display(types_t *type, int indent);
#endif /* FIELD_TYPE_H_ */ #endif /* FIELD_TYPE_H_ */
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "file_type.h" #include "file_type.h"
int file_type_file_print(struct types_s *type, int indent, FILE *file) int file_type_file_print(types_t *type, int indent, FILE *file)
{ {
if (type == NULL) if (type == NULL)
return -1; return -1;
...@@ -17,7 +17,7 @@ int file_type_file_print(struct types_s *type, int indent, FILE *file) ...@@ -17,7 +17,7 @@ int file_type_file_print(struct types_s *type, int indent, FILE *file)
return 0; return 0;
} }
int file_type_hr_display(struct types_s *type, int indent) int file_type_hr_display(types_t *type, int indent)
{ {
if (type == NULL) if (type == NULL)
return -1; return -1;
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
#ifndef FILE_TYPE_H_ #ifndef FILE_TYPE_H_
#define FILE_TYPE_H_ #define FILE_TYPE_H_
int file_type_file_print(struct types_s *type, int indent, FILE *file); int file_type_file_print(types_t *type, int indent, FILE *file);
int file_type_hr_display(struct types_s *type, int indent); int file_type_hr_display(types_t *type, int indent);
#endif /* FILE_TYPE_H_ */ #endif /* FILE_TYPE_H_ */
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "fundamental_type.h" #include "fundamental_type.h"
#include "ui_interface.h" #include "ui_interface.h"
uint64_t fundamental_read_from_buffer(struct types_s *type, buffer_t *buffer, uint32_t offset, uint32_t parent_offset) { uint64_t fundamental_read_from_buffer(types_t *type, buffer_t *buffer, uint32_t offset, uint32_t parent_offset) {
uint64_t value; uint64_t value;
switch (type->size) { switch (type->size) {
...@@ -36,8 +36,8 @@ uint64_t fundamental_read_from_buffer(struct types_s *type, buffer_t *buffer, ui ...@@ -36,8 +36,8 @@ uint64_t fundamental_read_from_buffer(struct types_s *type, buffer_t *buffer, ui
} }
int fundamental_dissect_from_buffer( int fundamental_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent) buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{ {
int length = 0; int length = 0;
char cbuf[200]; char cbuf[200];
...@@ -55,6 +55,7 @@ int fundamental_dissect_from_buffer( ...@@ -55,6 +55,7 @@ int fundamental_dissect_from_buffer(
value64 = fundamental_read_from_buffer(type, buffer, offset, parent_offset); value64 = fundamental_read_from_buffer(type, buffer, offset, parent_offset);
indent = new_line ? indent : 0;
if (indent > 0) if (indent > 0)
{ {
DISPLAY_TYPE("Fun"); DISPLAY_TYPE("Fun");
...@@ -63,39 +64,36 @@ int fundamental_dissect_from_buffer( ...@@ -63,39 +64,36 @@ int fundamental_dissect_from_buffer(
case 8: case 8:
value8 = (uint8_t) value64; value8 = (uint8_t) value64;
INDENTED_STRING(cbuf, indent, INDENTED_STRING(cbuf, indent,
sprintf(cbuf, type_unsigned ? "(0x%02" PRIx8 ") %3" PRIu8 " '%c';\n" : "(0x%02" PRIx8 ") %4" PRId8 " '%c';\n", value8, value8, isprint(value8) ? value8 : '.')); length = sprintf(cbuf, type_unsigned ? "(0x%02" PRIx8 ") %3" PRIu8 " '%c';\n" : "(0x%02" PRIx8 ") %4" PRId8 " '%c';\n", value8, value8, isprint(value8) ? value8 : '.'));
break; break;
case 16: case 16:
value16 = (uint16_t) value64; value16 = (uint16_t) value64;
INDENTED_STRING(cbuf, indent, INDENTED_STRING(cbuf, indent,
sprintf(cbuf, type_unsigned ? "(0x%04" PRIx16 ") %5" PRIu16 ";\n" : "(0x%04" PRIx16 ") %6" PRId16 ";\n", value16, value16)); length = sprintf(cbuf, type_unsigned ? "(0x%04" PRIx16 ") %5" PRIu16 ";\n" : "(0x%04" PRIx16 ") %6" PRId16 ";\n", value16, value16));
break; break;
case 32: case 32:
value32 = (uint32_t) value64; value32 = (uint32_t) value64;
INDENTED_STRING(cbuf, indent, INDENTED_STRING(cbuf, indent,
sprintf(cbuf, type_unsigned ? "(0x%08" PRIx32 ") %9" PRIu32 ";\n" : "(0x%08" PRIx32 ") %10" PRId32 ";\n", value32, value32)); length = sprintf(cbuf, type_unsigned ? "(0x%08" PRIx32 ") %9" PRIu32 ";\n" : "(0x%08" PRIx32 ") %10" PRId32 ";\n", value32, value32));
break; break;
case 64: case 64:
INDENTED_STRING(cbuf, indent, INDENTED_STRING(cbuf, indent,
sprintf(cbuf, type_unsigned ? "(0x%016" PRIx64 ") %20" PRIu64 ";\n" : "(0x%016" PRIx64 ") %20" PRId64 ";\n", value64, value64)); length = sprintf(cbuf, type_unsigned ? "(0x%016" PRIx64 ") %20" PRIu64 ";\n" : "(0x%016" PRIx64 ") %20" PRId64 ";\n", value64, value64));
break; break;
default: default:
/* ??? */ /* ??? */
break; break;
} }
length = strlen (cbuf);
ui_set_signal_text_cb(user_data, cbuf, length); ui_set_signal_text_cb(user_data, cbuf, length);
return 0; return 0;
} }
int fundamental_type_file_print(struct types_s *type, int indent, FILE *file) { int fundamental_type_file_print(types_t *type, int indent, FILE *file) {
if (type == NULL) if (type == NULL)
return -1; return -1;
INDENTED(file, indent, fprintf(file, "<Fundamental>\n")); INDENTED(file, indent, fprintf(file, "<Fundamental>\n"));
...@@ -109,7 +107,7 @@ int fundamental_type_file_print(struct types_s *type, int indent, FILE *file) { ...@@ -109,7 +107,7 @@ int fundamental_type_file_print(struct types_s *type, int indent, FILE *file) {
return 0; return 0;
} }
int fundamental_type_hr_display(struct types_s *type, int indent) { int fundamental_type_hr_display(types_t *type, int indent) {
if (type == NULL) if (type == NULL)
return -1; return -1;
INDENTED(stdout, indent, printf("<Fundamental>\n")); INDENTED(stdout, indent, printf("<Fundamental>\n"));
......
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
#ifndef FUNDAMENTAL_TYPE_H_ #ifndef FUNDAMENTAL_TYPE_H_
#define FUNDAMENTAL_TYPE_H_ #define FUNDAMENTAL_TYPE_H_
uint64_t fundamental_read_from_buffer(struct types_s *type, buffer_t *buffer, uint32_t offset, uint32_t parent_offset); uint64_t fundamental_read_from_buffer(types_t *type, buffer_t *buffer, uint32_t offset, uint32_t parent_offset);
int fundamental_dissect_from_buffer( int fundamental_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent); buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int fundamental_type_file_print(struct types_s *type, int indent, FILE *file); int fundamental_type_file_print(types_t *type, int indent, FILE *file);
int fundamental_type_hr_display(struct types_s *type, int indent); int fundamental_type_hr_display(types_t *type, int indent);
#endif /* FUNDAMENTAL_TYPE_H_ */ #endif /* FUNDAMENTAL_TYPE_H_ */
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#include "ui_interface.h" #include "ui_interface.h"
int pointer_dissect_from_buffer( int pointer_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent) buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{ {
int length = 0, i; int length = 0, i;
char cbuf[200]; char cbuf[200];
...@@ -21,37 +21,37 @@ int pointer_dissect_from_buffer( ...@@ -21,37 +21,37 @@ int pointer_dissect_from_buffer(
buffer_fetch_nbytes(buffer, parent_offset + offset, type->size / 8, value); buffer_fetch_nbytes(buffer, parent_offset + offset, type->size / 8, value);
DISPLAY_TYPE("Ptr"); indent = new_line ? indent : 0;
if (indent > 0)
{
DISPLAY_TYPE("Ptr");
}
if (type->child->name && type->child) { if (type->child->name && type->child) {
/* /*
INDENTED(stdout, indent, fprintf(stdout, "<%s>0x%08x</%s>\n", INDENTED(stdout, indent, fprintf(stdout, "<%s>0x%08x</%s>\n",
type->child->name, value, type->child->name)); type->child->name, value, type->child->name));
*/ */
INDENTED_STRING(cbuf, indent, sprintf(cbuf, "(%s *) 0x", type->child->name)); INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "(%s *) 0x", type->child->name));
} }
else { else {
/* /*
INDENTED(stdout, indent, fprintf(stdout, "<Pointer>0x%08x</Pointer>\n", INDENTED(stdout, indent, fprintf(stdout, "<Pointer>0x%08x</Pointer>\n",
value)); value));
*/ */
INDENTED_STRING(cbuf, indent, sprintf(cbuf, "(void *) 0x")); INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "(void *) 0x"));
} }
length = strlen (cbuf);
/* Append the value */ /* Append the value */
for (i = type->size / 8 - 1; i >= 0; i--) { for (i = type->size / 8 - 1; i >= 0; i--) {
length += sprintf(&cbuf[length], "%02x", value[i]); length += sprintf(&cbuf[length], "%02x", value[i]);
} }
length += sprintf(&cbuf[length], ";\n"); length += sprintf(&cbuf[length], ";\n");
ui_set_signal_text_cb(user_data, cbuf, length); ui_set_signal_text_cb(user_data, cbuf, length);
return 0; return 0;
} }
int pointer_type_file_print(struct types_s *type, int indent, FILE *file) { int pointer_type_file_print(types_t *type, int indent, FILE *file) {
if (type == NULL) if (type == NULL)
return -1; return -1;
INDENTED(file, indent, fprintf(file, "<Pointer>\n")); INDENTED(file, indent, fprintf(file, "<Pointer>\n"));
...@@ -75,6 +75,6 @@ int pointer_type_file_print(struct types_s *type, int indent, FILE *file) { ...@@ -75,6 +75,6 @@ int pointer_type_file_print(struct types_s *type, int indent, FILE *file) {
return 0; return 0;
} }
int pointer_type_hr_display(struct types_s *type, int indent) { int pointer_type_hr_display(types_t *type, int indent) {
return pointer_type_file_print(type, indent, stdout); return pointer_type_file_print(type, indent, stdout);
} }
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
#define POINTER_TYPE_H_ #define POINTER_TYPE_H_
int pointer_dissect_from_buffer( int pointer_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent); buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int pointer_type_file_print(struct types_s *type, int indent, FILE *file); int pointer_type_file_print(types_t *type, int indent, FILE *file);
int pointer_type_hr_display(struct types_s *type, int indent); int pointer_type_hr_display(types_t *type, int indent);
#endif /* POINTER_TYPE_H_ */ #endif /* POINTER_TYPE_H_ */
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#include "ui_interface.h" #include "ui_interface.h"
int reference_dissect_from_buffer( int reference_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent) buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{ {
DISPLAY_PARSE_INFO("reference", type->name, offset, parent_offset); DISPLAY_PARSE_INFO("reference", type->name, offset, parent_offset);
...@@ -18,7 +18,7 @@ int reference_dissect_from_buffer( ...@@ -18,7 +18,7 @@ int reference_dissect_from_buffer(
if (type->child != NULL) if (type->child != NULL)
type->child->type_dissect_from_buffer(type->child, ui_set_signal_text_cb, type->child->type_dissect_from_buffer(type->child, ui_set_signal_text_cb,
user_data, buffer, offset, parent_offset, user_data, buffer, offset, parent_offset,
type->name == NULL ? indent: indent + DISPLAY_TAB_SIZE); type->name == NULL ? indent: indent + DISPLAY_TAB_SIZE, TRUE);
if (type->name) { if (type->name) {
INDENTED(stdout, indent, fprintf(stdout, "</%s>\n", type->name)); INDENTED(stdout, indent, fprintf(stdout, "</%s>\n", type->name));
} }
...@@ -26,7 +26,7 @@ int reference_dissect_from_buffer( ...@@ -26,7 +26,7 @@ int reference_dissect_from_buffer(
return 0; return 0;
} }
int reference_type_file_print(struct types_s *type, int indent, FILE *file) int reference_type_file_print(types_t *type, int indent, FILE *file)
{ {
if (type == NULL) if (type == NULL)
return -1; return -1;
...@@ -49,7 +49,7 @@ int reference_type_file_print(struct types_s *type, int indent, FILE *file) ...@@ -49,7 +49,7 @@ int reference_type_file_print(struct types_s *type, int indent, FILE *file)
return 0; return 0;
} }
int reference_type_hr_display(struct types_s *type, int indent) int reference_type_hr_display(types_t *type, int indent)
{ {
if (type == NULL) if (type == NULL)
return -1; return -1;
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
#define REFERENCE_TYPE_H_ #define REFERENCE_TYPE_H_
int reference_dissect_from_buffer( int reference_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent); buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int reference_type_file_print(struct types_s *type, int indent, FILE *file); int reference_type_file_print(types_t *type, int indent, FILE *file);
int reference_type_hr_display(struct types_s *type, int indent); int reference_type_hr_display(types_t *type, int indent);
#endif /* REFERENCE_TYPE_H_ */ #endif /* REFERENCE_TYPE_H_ */
...@@ -10,47 +10,50 @@ ...@@ -10,47 +10,50 @@
#include "ui_interface.h" #include "ui_interface.h"
int struct_dissect_from_buffer( int struct_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent) buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{ {
int i; int i;
int length = 0; int length = 0;
char cbuf[200]; char cbuf[200];
char *name;
DISPLAY_PARSE_INFO("structure", type->name, offset, parent_offset); DISPLAY_PARSE_INFO("structure", type->name, offset, parent_offset);
memset (cbuf, 0, 200); memset (cbuf, 0, 200);
if (type->name) { if (new_line) {
DISPLAY_TYPE("Str"); DISPLAY_TYPE("Str");
INDENTED_STRING(cbuf, indent, sprintf (cbuf, "%s =%s\n", type->name, "" DISPLAY_BRACE(" {")));
} }
length = strlen (cbuf); if (type->name) {
name = type->name;
}
else {
name = "_anonymous_";
}
INDENTED_STRING(cbuf, new_line ? indent : 0, length = sprintf (cbuf, "%s :", name));
DISPLAY_BRACE(length += sprintf(&cbuf[length], " {"););
length += sprintf(&cbuf[length], "\n");
ui_set_signal_text_cb(user_data, cbuf, length); ui_set_signal_text_cb(user_data, cbuf, length);
for (i = 0; i < type->nb_members; i++) { for (i = 0; i < type->nb_members; i++) {
if (type->members_child[i] != NULL) if (type->members_child[i] != NULL)
type->members_child[i]->type_dissect_from_buffer ( type->members_child[i]->type_dissect_from_buffer (
type->members_child[i], ui_set_signal_text_cb, user_data, type->members_child[i], ui_set_signal_text_cb, user_data,
buffer, offset, parent_offset, buffer, offset, parent_offset, indent + DISPLAY_TAB_SIZE, TRUE);
type->name == NULL ? indent : indent + DISPLAY_TAB_SIZE);
} }
DISPLAY_BRACE( DISPLAY_BRACE(
if (type->name) { DISPLAY_TYPE("Str");
DISPLAY_TYPE("Str");
INDENTED_STRING(cbuf, indent, sprintf(cbuf, "};\n"));
}
length = strlen (cbuf);
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "};\n"));
ui_set_signal_text_cb(user_data, cbuf, length);) ui_set_signal_text_cb(user_data, cbuf, length);)
return 0; return 0;
} }
int struct_type_file_print(struct types_s *type, int indent, FILE *file) { int struct_type_file_print(types_t *type, int indent, FILE *file) {
int i; int i;
if (type == NULL) if (type == NULL)
return -1; return -1;
...@@ -78,7 +81,7 @@ int struct_type_file_print(struct types_s *type, int indent, FILE *file) { ...@@ -78,7 +81,7 @@ int struct_type_file_print(struct types_s *type, int indent, FILE *file) {
return 0; return 0;
} }
int struct_type_hr_display(struct types_s *type, int indent) { int struct_type_hr_display(types_t *type, int indent) {
int i; int i;
if (type == NULL) if (type == NULL)
return -1; return -1;
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
#define STRUCT_TYPE_H_ #define STRUCT_TYPE_H_
int struct_dissect_from_buffer( int struct_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent); buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int struct_type_hr_display(struct types_s *type, int indent); int struct_type_hr_display(types_t *type, int indent);
int struct_type_file_print(struct types_s *type, int indent, FILE *file); int struct_type_file_print(types_t *type, int indent, FILE *file);
#endif /* STRUCT_TYPE_H_ */ #endif /* STRUCT_TYPE_H_ */
...@@ -7,22 +7,41 @@ ...@@ -7,22 +7,41 @@
#include "ui_interface.h" #include "ui_interface.h"
int typedef_dissect_from_buffer( int typedef_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent) buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{ {
int length = 0;
char cbuf[200];
types_t *type_child = NULL;
DISPLAY_PARSE_INFO("typedef", type->name, offset, parent_offset); DISPLAY_PARSE_INFO("typedef", type->name, offset, parent_offset);
if (type->child != NULL) {
/* Ignore TYPEDEF children */
for (type_child = type->child; type_child != NULL && type_child->type == TYPE_TYPEDEF; type_child =
type_child->child) {
}
}
if ((type_child == NULL) || (type_child->type != TYPE_FUNDAMENTAL))
{
INDENTED_STRING(cbuf, new_line ? indent : 0, length = sprintf (cbuf, "%s, ", type->name));
ui_set_signal_text_cb(user_data, cbuf, length);
new_line = FALSE;
}
/* Simply call next_type */ /* Simply call next_type */
if (type->child != NULL) { if (type->child != NULL) {
type->child->parent = type; type->child->parent = type;
type->child->type_dissect_from_buffer( type->child->type_dissect_from_buffer(
type->child, ui_set_signal_text_cb, user_data, buffer, offset, parent_offset, indent); type->child, ui_set_signal_text_cb, user_data, buffer, offset, parent_offset, indent, new_line);
} }
return 0; return 0;
} }
int typedef_type_file_print(struct types_s *type, int indent, FILE *file) int typedef_type_file_print(types_t *type, int indent, FILE *file)
{ {
if (type == NULL) if (type == NULL)
return -1; return -1;
...@@ -46,7 +65,7 @@ int typedef_type_file_print(struct types_s *type, int indent, FILE *file) ...@@ -46,7 +65,7 @@ int typedef_type_file_print(struct types_s *type, int indent, FILE *file)
return 0; return 0;
} }
int typedef_type_hr_display(struct types_s *type, int indent) int typedef_type_hr_display(types_t *type, int indent)
{ {
if (type == NULL) if (type == NULL)
return -1; return -1;
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
#ifndef TYPEDEF_TYPE_H_ #ifndef TYPEDEF_TYPE_H_
#define TYPEDEF_TYPE_H_ #define TYPEDEF_TYPE_H_
int typedef_type_file_print(struct types_s *type, int indent, FILE *file); int typedef_type_file_print(types_t *type, int indent, FILE *file);
int typedef_type_hr_display(struct types_s *type, int indent); int typedef_type_hr_display(types_t *type, int indent);
int typedef_dissect_from_buffer( int typedef_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent); buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
#endif /* TYPEDEF_TYPE_H_ */ #endif /* TYPEDEF_TYPE_H_ */
#include <stdio.h> #include <stdio.h>
#include "buffers.h" #include "buffers.h"
#include "ui_main_screen.h"
#include "ui_interface.h" #include "ui_interface.h"
#ifndef TYPES_H_ #ifndef TYPES_H_
...@@ -13,10 +14,10 @@ ...@@ -13,10 +14,10 @@
#define ENABLE_DISPLAY_PARSE_INFO 0 #define ENABLE_DISPLAY_PARSE_INFO 0
/* Activate to show braces, in increase the number of displayed lines (formating option)*/ /* Activate to show braces, in increase the number of displayed lines (formating option)*/
#define ENABLE_DISPLAY_BRACE 0 #define ENABLE_DISPLAY_BRACE 1
#if (ENABLE_DISPLAY_TYPE != 0) #if (ENABLE_DISPLAY_TYPE != 0)
# define DISPLAY_TYPE(tYPE) ui_set_signal_text_cb(user_data, tYPE, strlen(tYPE)); # define DISPLAY_TYPE(tYPE) ui_set_signal_text_cb(user_data, tYPE" ", strlen(tYPE) + 1);
#else #else
# define DISPLAY_TYPE(tYPE) # define DISPLAY_TYPE(tYPE)
#endif #endif
...@@ -35,7 +36,7 @@ ...@@ -35,7 +36,7 @@
#endif #endif
#if (ENABLE_DISPLAY_BRACE != 0) #if (ENABLE_DISPLAY_BRACE != 0)
# define DISPLAY_BRACE(cODE) cODE # define DISPLAY_BRACE(cODE) if (ui_main_data.display_brace) {cODE}
#else #else
# define DISPLAY_BRACE(cODE) # define DISPLAY_BRACE(cODE)
#endif #endif
...@@ -74,7 +75,7 @@ typedef int (*type_file_print_t)(struct types_s *type, int indent, FILE *file); ...@@ -74,7 +75,7 @@ typedef int (*type_file_print_t)(struct types_s *type, int indent, FILE *file);
**/ **/
typedef int (*type_dissect_from_buffer_t)( typedef int (*type_dissect_from_buffer_t)(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent); buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
typedef struct types_s { typedef struct types_s {
/* The type of the current description */ /* The type of the current description */
......
...@@ -12,29 +12,49 @@ ...@@ -12,29 +12,49 @@
/* There is only one special case of union which is associated to an index: the message id */ /* There is only one special case of union which is associated to an index: the message id */
int union_msg_dissect_from_buffer( int union_msg_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent) buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{ {
uint32_t message_id; uint32_t message_id;
int length = 0;
char cbuf[200];
DISPLAY_PARSE_INFO("union_msg", type->name, offset, parent_offset); DISPLAY_PARSE_INFO("union_msg", type->name, offset, parent_offset);
CHECK_FCT(get_message_id(type->head, buffer, &message_id)); CHECK_FCT(get_message_id(type->head, buffer, &message_id));
if (type->name) {
DISPLAY_TYPE("Uni");
length = sprintf(cbuf, "%s |", type->name);
DISPLAY_BRACE(length += sprintf(&cbuf[length], " {"););
length += sprintf(&cbuf[length], "\n");
ui_set_signal_text_cb(user_data, cbuf, length);
}
if (type->members_child[message_id] != NULL) if (type->members_child[message_id] != NULL)
type->members_child[message_id]->type_dissect_from_buffer( type->members_child[message_id]->type_dissect_from_buffer(
type->members_child[message_id], ui_set_signal_text_cb, user_data, type->members_child[message_id], ui_set_signal_text_cb, user_data,
buffer, offset, parent_offset, indent); buffer, offset, parent_offset, type->name == NULL ? indent : indent + DISPLAY_TAB_SIZE, TRUE);
DISPLAY_BRACE(
if (type->name) {
DISPLAY_TYPE("Uni");
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "};\n"));
ui_set_signal_text_cb(user_data, cbuf, length);
});
return RC_OK; return RC_OK;
} }
int union_dissect_from_buffer( int union_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent) buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{ {
int length = 0; int length = 0;
char cbuf[200]; char cbuf[200];
char *name;
int union_child = 0; int union_child = 0;
DISPLAY_PARSE_INFO("union", type->name, offset, parent_offset); DISPLAY_PARSE_INFO("union", type->name, offset, parent_offset);
...@@ -44,10 +64,20 @@ int union_dissect_from_buffer( ...@@ -44,10 +64,20 @@ int union_dissect_from_buffer(
// CHECK_FCT(buffer_has_enouch_data(buffer, offset + parent_offset, type->size / 8)); // CHECK_FCT(buffer_has_enouch_data(buffer, offset + parent_offset, type->size / 8));
if (type->name) { if (type->name) {
// INDENTED(stdout, indent, fprintf(stdout, "<%s>\n", type->name)); name = type->name;
}
else {
name = "_anonymous_";
}
if (new_line) {
DISPLAY_TYPE("Uni"); DISPLAY_TYPE("Uni");
INDENTED_STRING(cbuf, indent, sprintf(cbuf, "%s {\n", type->name)); }
INDENTED_STRING(cbuf, new_line ? indent : 0, length = sprintf(cbuf, "%s |", name));
DISPLAY_BRACE(length += sprintf(&cbuf[length], " {"););
length += sprintf(&cbuf[length], "\n");
ui_set_signal_text_cb(user_data, cbuf, length);
if (type->name) {
if (type->parent != NULL) if (type->parent != NULL)
{ {
if ((type->parent->name != NULL) && (strcmp(type->parent->name, "choice") == 0)) if ((type->parent->name != NULL) && (strcmp(type->parent->name, "choice") == 0))
...@@ -64,29 +94,25 @@ int union_dissect_from_buffer( ...@@ -64,29 +94,25 @@ int union_dissect_from_buffer(
} }
} }
length = strlen (cbuf);
ui_set_signal_text_cb(user_data, cbuf, length);
/* Only dissect the first field present in unions */ /* Only dissect the first field present in unions */
if (type->members_child[union_child] != NULL) if (type->members_child[union_child] != NULL)
type->members_child[union_child]->type_dissect_from_buffer( type->members_child[union_child]->type_dissect_from_buffer(
type->members_child[union_child], ui_set_signal_text_cb, user_data, buffer, type->members_child[union_child], ui_set_signal_text_cb, user_data, buffer,
offset, parent_offset, type->name == NULL ? indent : indent + DISPLAY_TAB_SIZE); offset, parent_offset, indent + DISPLAY_TAB_SIZE, TRUE);
if (type->name) { DISPLAY_BRACE(
DISPLAY_TYPE("Uni"); DISPLAY_TYPE("Uni");
INDENTED_STRING(cbuf, indent, sprintf(cbuf, "};\n")); INDENTED_STRING(cbuf, indent, sprintf(cbuf, "};\n"));
}
length = strlen (cbuf); length = strlen (cbuf);
ui_set_signal_text_cb(user_data, cbuf, length); ui_set_signal_text_cb(user_data, cbuf, length););
return 0; return 0;
} }
int union_type_file_print(struct types_s *type, int indent, FILE *file) { int union_type_file_print(types_t *type, int indent, FILE *file) {
int i; int i;
if (type == NULL) if (type == NULL)
return -1; return -1;
...@@ -112,7 +138,7 @@ int union_type_file_print(struct types_s *type, int indent, FILE *file) { ...@@ -112,7 +138,7 @@ int union_type_file_print(struct types_s *type, int indent, FILE *file) {
return 0; return 0;
} }
int union_type_hr_display(struct types_s *type, int indent) { int union_type_hr_display(types_t *type, int indent) {
int i; int i;
if (type == NULL) if (type == NULL)
return -1; return -1;
......
...@@ -4,15 +4,15 @@ ...@@ -4,15 +4,15 @@
#define UNION_TYPE_H_ #define UNION_TYPE_H_
int union_msg_dissect_from_buffer( int union_msg_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent); buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int union_dissect_from_buffer( int union_dissect_from_buffer(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent); buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int union_type_file_print(struct types_s *type, int indent, FILE *file); int union_type_file_print(types_t *type, int indent, FILE *file);
int union_type_hr_display(struct types_s *type, int indent); int union_type_hr_display(types_t *type, int indent);
#endif /* UNION_TYPE_H_ */ #endif /* UNION_TYPE_H_ */
...@@ -788,6 +788,9 @@ static int xml_parse_doc(xmlDocPtr doc) { ...@@ -788,6 +788,9 @@ static int xml_parse_doc(xmlDocPtr doc) {
/* Locate the header part of a message */ /* Locate the header part of a message */
CHECK_FCT(locate_type("ittiMsgHeader", head, &message_header_type)); CHECK_FCT(locate_type("ittiMsgHeader", head, &message_header_type));
/* Locate the main message part */
CHECK_FCT(locate_type("msg", head, &message_type));
/* Locate the origin task id field */ /* Locate the origin task id field */
CHECK_FCT(locate_type("originTaskId", message_header_type, &origin_task_id_type)); CHECK_FCT(locate_type("originTaskId", message_header_type, &origin_task_id_type));
/* Locate the destination task id field */ /* Locate the destination task id field */
...@@ -830,7 +833,7 @@ int dissect_signal_header(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signa ...@@ -830,7 +833,7 @@ int dissect_signal_header(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signa
message_header_type->type_dissect_from_buffer( message_header_type->type_dissect_from_buffer(
message_header_type, ui_set_signal_text_cb, cb_user_data, message_header_type, ui_set_signal_text_cb, cb_user_data,
buffer, 0, 0, INDENT_START); buffer, 0, 0, INDENT_START, TRUE);
return RC_OK; return RC_OK;
} }
...@@ -838,7 +841,7 @@ int dissect_signal_header(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signa ...@@ -838,7 +841,7 @@ int dissect_signal_header(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signa
int dissect_signal(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_cb, int dissect_signal(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_cb,
gpointer cb_user_data) gpointer cb_user_data)
{ {
if (root == NULL) { if (message_type == NULL) {
g_error("No messages format definition provided"); g_error("No messages format definition provided");
return RC_FAIL; return RC_FAIL;
} }
...@@ -848,8 +851,8 @@ int dissect_signal(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_ ...@@ -848,8 +851,8 @@ int dissect_signal(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_
return RC_FAIL; return RC_FAIL;
} }
root->type_dissect_from_buffer(root, ui_set_signal_text_cb, cb_user_data, message_type->type_dissect_from_buffer(message_type, ui_set_signal_text_cb, cb_user_data,
buffer, 0, 0, INDENT_START); buffer, 0, 0, INDENT_START, TRUE);
return RC_OK; return RC_OK;
} }
...@@ -18,6 +18,7 @@ types_t *origin_task_id_type = NULL; ...@@ -18,6 +18,7 @@ types_t *origin_task_id_type = NULL;
types_t *destination_task_id_type = NULL; types_t *destination_task_id_type = NULL;
types_t *instance_type = NULL; types_t *instance_type = NULL;
types_t *message_header_type = NULL; types_t *message_header_type = NULL;
types_t *message_type = NULL;
types_t *message_size_type = NULL; types_t *message_size_type = NULL;
int locate_root(const char *root_name, types_t *head, types_t **root_elm) { int locate_root(const char *root_name, types_t *head, types_t **root_elm) {
......
...@@ -9,6 +9,7 @@ extern types_t *origin_task_id_type; ...@@ -9,6 +9,7 @@ extern types_t *origin_task_id_type;
extern types_t *destination_task_id_type; extern types_t *destination_task_id_type;
extern types_t *instance_type; extern types_t *instance_type;
extern types_t *message_header_type; extern types_t *message_header_type;
extern types_t *message_type;
extern types_t *message_size_type; extern types_t *message_size_type;
int locate_root(const char *root_name, types_t *head, types_t **root); int locate_root(const char *root_name, types_t *head, types_t **root);
......
...@@ -14,7 +14,7 @@ typedef enum { ...@@ -14,7 +14,7 @@ typedef enum {
RESOLV_NOT_FOUND = -3, RESOLV_NOT_FOUND = -3,
} resolv_rc_e; } resolv_rc_e;
int search_id(types_t *head, types_t **found, int id) static int search_id(types_t *head, types_t **found, int id)
{ {
types_t *next_type; types_t *next_type;
...@@ -101,7 +101,7 @@ int resolve_struct(types_t **head) ...@@ -101,7 +101,7 @@ int resolve_struct(types_t **head)
if (next_type->type != TYPE_STRUCT) if (next_type->type != TYPE_STRUCT)
continue; continue;
// g_debug("Trying to resolve struct members %s with type %d", next_type->name, next_type->id); g_debug("Trying to resolve struct members %s with type %d", next_type->name, next_type->id);
/* Struct may have no member */ /* Struct may have no member */
if (next_type->members == NULL) if (next_type->members == NULL)
...@@ -115,10 +115,10 @@ int resolve_struct(types_t **head) ...@@ -115,10 +115,10 @@ int resolve_struct(types_t **head)
while(member != NULL) while(member != NULL)
{ {
if (next_type->nb_members == 0) { if (next_type->nb_members == 0) {
next_type->members_child = malloc(sizeof(struct types_s *)); next_type->members_child = malloc(sizeof(types_t *));
} else { } else {
next_type->members_child = realloc(next_type->members_child, next_type->members_child = realloc(next_type->members_child,
(next_type->nb_members + 1) * sizeof(struct types_s *)); (next_type->nb_members + 1) * sizeof(types_t *));
} }
if (search_id(*head, &next_type->members_child[next_type->nb_members], atoi(member)) != RESOLV_OK) { if (search_id(*head, &next_type->members_child[next_type->nb_members], atoi(member)) != RESOLV_OK) {
/* We have to remove this reference */ /* We have to remove this reference */
...@@ -160,7 +160,7 @@ int resolve_union(types_t **head) ...@@ -160,7 +160,7 @@ int resolve_union(types_t **head)
if (next_type->type != TYPE_UNION) if (next_type->type != TYPE_UNION)
continue; continue;
// printf("Trying to resolve struct members %s with type %d\n", next_type->name, next_type->id); g_debug("Trying to resolve union members %s with type %d\n", next_type->name, next_type->id);
/* Struct may have no member */ /* Struct may have no member */
if (next_type->members == NULL) if (next_type->members == NULL)
...@@ -174,10 +174,10 @@ int resolve_union(types_t **head) ...@@ -174,10 +174,10 @@ int resolve_union(types_t **head)
while(member != NULL) while(member != NULL)
{ {
if (next_type->nb_members == 0) { if (next_type->nb_members == 0) {
next_type->members_child = malloc(sizeof(struct types_s *)); next_type->members_child = malloc(sizeof(types_t *));
} else { } else {
next_type->members_child = realloc(next_type->members_child, next_type->members_child = realloc(next_type->members_child,
(next_type->nb_members + 1) * sizeof(struct types_s *)); (next_type->nb_members + 1) * sizeof(types_t *));
} }
if (search_id(*head, &next_type->members_child[next_type->nb_members], atoi(member)) != RESOLV_OK) { if (search_id(*head, &next_type->members_child[next_type->nb_members], atoi(member)) != RESOLV_OK) {
/* We have to remove this reference */ /* We have to remove this reference */
...@@ -208,8 +208,8 @@ int resolve_pointer_type(types_t **head) ...@@ -208,8 +208,8 @@ int resolve_pointer_type(types_t **head)
if (next_type->type != TYPE_POINTER) if (next_type->type != TYPE_POINTER)
continue; continue;
// g_debug("Trying to resolve pointer id %d with type %d", g_debug("Trying to resolve pointer id %d with type %d",
// next_type->id, next_type->type_xml); next_type->id, next_type->type_xml);
if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) { if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) {
/* We have to remove this reference */ /* We have to remove this reference */
...@@ -235,8 +235,8 @@ int resolve_reference(types_t **head) ...@@ -235,8 +235,8 @@ int resolve_reference(types_t **head)
if (next_type->type != TYPE_REFERENCE) if (next_type->type != TYPE_REFERENCE)
continue; continue;
// printf("Trying to resolve reference id %d with type %d\n", g_debug("Trying to resolve reference id %d with type %d\n",
// next_type->id, next_type->type_xml); next_type->id, next_type->type_xml);
if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) { if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) {
/* We have to remove this reference */ /* We have to remove this reference */
...@@ -262,8 +262,8 @@ int resolve_field(types_t **head) ...@@ -262,8 +262,8 @@ int resolve_field(types_t **head)
if (next_type->type != TYPE_FIELD) if (next_type->type != TYPE_FIELD)
continue; continue;
// printf("Trying to resolve pointer id %d with type %d\n", g_debug("Trying to resolve pointer id %d with type %d\n",
// next_type->id, next_type->type_xml); next_type->id, next_type->type_xml);
if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) { if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) {
/* We have to remove this reference */ /* We have to remove this reference */
...@@ -289,8 +289,8 @@ int resolve_array(types_t **head) ...@@ -289,8 +289,8 @@ int resolve_array(types_t **head)
if (next_type->type != TYPE_ARRAY) if (next_type->type != TYPE_ARRAY)
continue; continue;
// printf("Trying to resolve array id %d with type %d\n", g_debug("Trying to resolve array id %d with type %d\n",
// next_type->id, next_type->type_xml); next_type->id, next_type->type_xml);
if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) { if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) {
/* We have to remove this reference */ /* We have to remove this reference */
...@@ -316,8 +316,8 @@ int resolve_function(types_t **head) ...@@ -316,8 +316,8 @@ int resolve_function(types_t **head)
if (next_type->type != TYPE_FUNCTION) if (next_type->type != TYPE_FUNCTION)
continue; continue;
// g_debug("Trying to resolve function id %d with type %d", g_debug("Trying to resolve function id %d with type %d",
// next_type->id, next_type->type_xml); next_type->id, next_type->type_xml);
if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) { if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) {
/* We have to remove this reference */ /* We have to remove this reference */
...@@ -348,7 +348,7 @@ int resolve_file(types_t **head) ...@@ -348,7 +348,7 @@ int resolve_file(types_t **head)
continue; continue;
} }
// printf("Trying to resolve file %s\n", next_type->file); g_debug("Trying to resolve file %s\n", next_type->file);
if (search_file(*head, &next_type->file_ref, atoi(&next_type->file[1])) != RESOLV_OK) { if (search_file(*head, &next_type->file_ref, atoi(&next_type->file[1])) != RESOLV_OK) {
/* We have to remove this reference */ /* We have to remove this reference */
......
...@@ -101,6 +101,16 @@ gboolean ui_callback_on_save_filters(GtkWidget *widget, gpointer data) ...@@ -101,6 +101,16 @@ gboolean ui_callback_on_save_filters(GtkWidget *widget, gpointer data)
return TRUE; return TRUE;
} }
gboolean ui_callback_on_enable_filters(GtkWidget *widget, gpointer data)
{
gboolean enabled;
enabled = gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON(ui_main_data.filters_enabled));
gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON(ui_main_data.filters_enabled), !enabled);
return TRUE;
}
gboolean ui_callback_on_about(GtkWidget *widget, gpointer data) gboolean ui_callback_on_about(GtkWidget *widget, gpointer data)
{ {
#if defined(PACKAGE_STRING) #if defined(PACKAGE_STRING)
...@@ -115,55 +125,92 @@ gboolean ui_callback_on_about(GtkWidget *widget, gpointer data) ...@@ -115,55 +125,92 @@ gboolean ui_callback_on_about(GtkWidget *widget, gpointer data)
gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path,
gboolean path_currently_selected, gpointer user_data) gboolean path_currently_selected, gpointer user_data)
{ {
static gpointer buffer_current;
ui_text_view_t *text_view; ui_text_view_t *text_view;
GtkTreeIter iter; GtkTreeIter iter;
text_view = (ui_text_view_t *) user_data; if (ui_tree_view_last_event)
{
g_debug("last_event %p %d %d", ui_tree_view_last_event, ui_tree_view_last_event->type, ui_tree_view_last_event->button);
g_assert(text_view != NULL); if (ui_tree_view_last_event->type == GDK_BUTTON_PRESS)
{
/* Callback is due to a button click */
ui_main_data.follow_last = FALSE;
if (gtk_tree_model_get_iter (model, &iter, path)) if (ui_tree_view_last_event->button == 3)
{ {
GValue buffer_store = G_VALUE_INIT; /* It was a right mouse click */
gpointer buffer; }
}
GValue message_id_store = G_VALUE_INIT; ui_tree_view_last_event = NULL;
guint message_id; }
gtk_tree_model_get_value (model, &iter, COL_BUFFER, &buffer_store); g_debug("Message selected %d %p %p %s", path_currently_selected, buffer_current, path, gtk_tree_path_to_string(path));
buffer = g_value_get_pointer (&buffer_store);
gtk_tree_model_get_value (model, &iter, COL_MESSAGE_ID, &message_id_store); if (!path_currently_selected)
message_id = g_value_get_uint(&message_id_store); {
text_view = (ui_text_view_t *) user_data;
if (!path_currently_selected) g_assert(text_view != NULL);
{
/* Clear the view */
CHECK_FCT_DO(ui_signal_dissect_clear_view(text_view), return FALSE);
if ((strcmp (message_id_to_string (message_id), "ERROR") == 0) if (gtk_tree_model_get_iter(model, &iter, path))
|| (strcmp (message_id_to_string (message_id), "WARNING") == 0) {
|| (strcmp (message_id_to_string (message_id), "GENERIC_LOG") == 0)) GValue buffer_store = G_VALUE_INIT;
{ gpointer buffer;
gchar *data;
gint data_size;
uint32_t message_header_type_size;
CHECK_FCT_DO(dissect_signal_header((buffer_t*)buffer, ui_signal_set_text, text_view), return FALSE); GValue message_id_store = G_VALUE_INIT;
guint message_id;
message_header_type_size = get_message_header_type_size (); gtk_tree_model_get_value(model, &iter, COL_BUFFER, &buffer_store);
data = (gchar *) buffer_at_offset ((buffer_t*) buffer, message_header_type_size); buffer = g_value_get_pointer(&buffer_store);
data_size = get_message_size ((buffer_t*) buffer);
g_debug("message header type size: %u, data size: %u", message_header_type_size, data_size); g_debug(" Get iter %p %p", buffer_current, buffer);
ui_signal_set_text (text_view, "\n", 1); if (buffer_current != buffer)
ui_signal_set_text (text_view, data, data_size);
}
else
{ {
/* Dissect the signal */ buffer_current = buffer;
CHECK_FCT_DO(dissect_signal((buffer_t*)buffer, ui_signal_set_text, text_view), return FALSE);
gtk_tree_model_get_value(model, &iter, COL_MESSAGE_ID, &message_id_store);
message_id = g_value_get_uint(&message_id_store);
/* Clear the view */
CHECK_FCT_DO(ui_signal_dissect_clear_view(text_view), return FALSE);
if (ui_main_data.display_message_header)
{
CHECK_FCT_DO(dissect_signal_header((buffer_t*)buffer, ui_signal_set_text, text_view), return FALSE);
}
if ((strcmp(message_id_to_string(message_id), "ERROR_LOG") == 0)
|| (strcmp(message_id_to_string(message_id), "WARNING_LOG") == 0)
|| (strcmp(message_id_to_string(message_id), "GENERIC_LOG") == 0))
{
gchar *data;
gint data_size;
uint32_t message_header_type_size;
if (ui_main_data.display_message_header)
{
ui_signal_set_text(text_view, "\n", 1);
}
message_header_type_size = get_message_header_type_size();
data = (gchar *) buffer_at_offset((buffer_t*) buffer, message_header_type_size);
data_size = get_message_size((buffer_t*) buffer);
g_debug(" message header type size: %u, data size: %u %p %d", message_header_type_size, data_size,
buffer, ui_main_data.follow_last);
ui_signal_set_text(text_view, data, data_size);
} else
{
g_debug(" dissect message %d %p %d", message_id, buffer, ui_main_data.follow_last);
/* Dissect the signal */
CHECK_FCT_DO(dissect_signal((buffer_t*)buffer, ui_signal_set_text, text_view), return FALSE);
}
} }
} }
} }
...@@ -172,6 +219,7 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel ...@@ -172,6 +219,7 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
void ui_signal_add_to_list(gpointer data, gpointer user_data) void ui_signal_add_to_list(gpointer data, gpointer user_data)
{ {
gboolean goto_last = user_data ? TRUE : FALSE;
buffer_t *signal_buffer; buffer_t *signal_buffer;
GtkTreePath *path; GtkTreePath *path;
GtkTreeViewColumn *focus_column; GtkTreeViewColumn *focus_column;
...@@ -205,11 +253,10 @@ void ui_signal_add_to_list(gpointer data, gpointer user_data) ...@@ -205,11 +253,10 @@ void ui_signal_add_to_list(gpointer data, gpointer user_data)
/* Increment number of messages */ /* Increment number of messages */
ui_main_data.nb_message_received++; ui_main_data.nb_message_received++;
/* Check if no signal was selected in the list or if it was the last signal */ if ((ui_main_data.follow_last) && (goto_last))
if ((ui_main_data.path_last == NULL) || (path == NULL) || (gtk_tree_path_compare(ui_main_data.path_last, path) == 0))
{ {
/* Advance to the new last signal */ /* Advance to the new last signal */
ui_callback_signal_go_to_last (NULL, NULL); ui_tree_view_select_row (ui_tree_view_get_filtered_number() - 1);
} }
} }
...@@ -225,7 +272,7 @@ static gboolean ui_handle_update_signal_list(gint fd, void *data, size_t data_le ...@@ -225,7 +272,7 @@ static gboolean ui_handle_update_signal_list(gint fd, void *data, size_t data_le
g_assert(signal_list_message != NULL); g_assert(signal_list_message != NULL);
g_assert(signal_list_message->signal_list != NULL); g_assert(signal_list_message->signal_list != NULL);
g_list_foreach (signal_list_message->signal_list, ui_signal_add_to_list, NULL); g_list_foreach (signal_list_message->signal_list, ui_signal_add_to_list, (gpointer) TRUE);
/* Free the list but not user data associated with each element */ /* Free the list but not user data associated with each element */
g_list_free (signal_list_message->signal_list); g_list_free (signal_list_message->signal_list);
...@@ -378,25 +425,46 @@ gboolean ui_callback_on_disconnect(GtkWidget *widget, gpointer data) ...@@ -378,25 +425,46 @@ gboolean ui_callback_on_disconnect(GtkWidget *widget, gpointer data)
return TRUE; return TRUE;
} }
gboolean ui_callback_signal_go_to_first(GtkWidget *widget, gpointer data)
{
ui_tree_view_select_row (0);
ui_main_data.follow_last = FALSE;
return TRUE;
}
gboolean ui_callback_signal_go_to(GtkWidget *widget, gpointer data) gboolean ui_callback_signal_go_to(GtkWidget *widget, gpointer data)
{ {
ui_tree_view_select_row (ui_main_data.nb_message_received / 2, NULL); gtk_window_set_focus (GTK_WINDOW(ui_main_data.window), ui_main_data.signals_go_to_entry);
return TRUE; return TRUE;
} }
gboolean ui_callback_signal_go_to_first(GtkWidget *widget, gpointer data) gboolean ui_callback_signal_go_to_entry(GtkWidget *widget, gpointer data)
{ {
ui_tree_view_select_row (0, NULL); // gtk_entry_buffer_set_text(GTK_ENTRY(ui_main_data.signals_go_to_entry), "");
gtk_window_set_focus (GTK_WINDOW(ui_main_data.window), ui_main_data.signalslist);
return TRUE; return TRUE;
} }
gboolean ui_callback_signal_go_to_last(GtkWidget *widget, gpointer data) gboolean ui_callback_signal_go_to_last(GtkWidget *widget, gpointer data)
{ {
GtkTreePath *path; ui_tree_view_select_row (ui_tree_view_get_filtered_number() - 1);
ui_main_data.follow_last = TRUE;
return TRUE;
}
ui_tree_view_select_row (ui_tree_view_get_filtered_number() - 1, &path); gboolean ui_callback_display_message_header(GtkWidget *widget, gpointer data)
ui_main_data.path_last = path; {
ui_main_data.display_message_header = !ui_main_data.display_message_header;
// TODO refresh textview.
return TRUE;
}
gboolean ui_callback_display_brace(GtkWidget *widget, gpointer data)
{
ui_main_data.display_brace = !ui_main_data.display_brace;
// TODO refresh textview.
return TRUE; return TRUE;
} }
...@@ -411,7 +479,7 @@ gboolean ui_callback_signal_clear_list(GtkWidget *widget, gpointer data) ...@@ -411,7 +479,7 @@ gboolean ui_callback_signal_clear_list(GtkWidget *widget, gpointer data)
if (ui_main_data.text_view != NULL) if (ui_main_data.text_view != NULL)
{ {
// ui_signal_dissect_clear_view(ui_main_data.text_view); ui_signal_dissect_clear_view(ui_main_data.text_view);
} }
return TRUE; return TRUE;
......
...@@ -18,6 +18,9 @@ gboolean ui_callback_on_open_filters(GtkWidget *widget, ...@@ -18,6 +18,9 @@ gboolean ui_callback_on_open_filters(GtkWidget *widget,
gboolean ui_callback_on_save_filters(GtkWidget *widget, gboolean ui_callback_on_save_filters(GtkWidget *widget,
gpointer data); gpointer data);
gboolean ui_callback_on_enable_filters(GtkWidget *widget,
gpointer data);
gboolean ui_callback_on_about(GtkWidget *widget, gboolean ui_callback_on_about(GtkWidget *widget,
gpointer data); gpointer data);
...@@ -41,15 +44,24 @@ ui_callback_on_select_signal(GtkTreeSelection *selection, ...@@ -41,15 +44,24 @@ ui_callback_on_select_signal(GtkTreeSelection *selection,
gboolean path_currently_selected, gboolean path_currently_selected,
gpointer userdata); gpointer userdata);
gboolean ui_callback_signal_go_to_first(GtkWidget *widget,
gpointer data);
gboolean ui_callback_signal_go_to(GtkWidget *widget, gboolean ui_callback_signal_go_to(GtkWidget *widget,
gpointer data); gpointer data);
gboolean ui_callback_signal_go_to_first(GtkWidget *widget, gboolean ui_callback_signal_go_to_entry(GtkWidget *widget,
gpointer data); gpointer data);
gboolean ui_callback_signal_go_to_last(GtkWidget *widget, gboolean ui_callback_signal_go_to_last(GtkWidget *widget,
gpointer data); gpointer data);
gboolean ui_callback_display_message_header(GtkWidget *widget,
gpointer data);
gboolean ui_callback_display_brace(GtkWidget *widget,
gpointer data);
gboolean ui_callback_signal_clear_list(GtkWidget *widget, gboolean ui_callback_signal_clear_list(GtkWidget *widget,
gpointer data); gpointer data);
......
...@@ -22,7 +22,7 @@ gboolean ui_callback_on_pipe_notification( ...@@ -22,7 +22,7 @@ gboolean ui_callback_on_pipe_notification(
/* avoid reentrancy problems and stack overflow */ /* avoid reentrancy problems and stack overflow */
g_source_remove(pipe_input->pipe_input_id); g_source_remove(pipe_input->pipe_input_id);
// g_debug("Received new data on pipe %d", pipe_input->pipe_input_id); g_debug("Received new data on pipe %d", pipe_input->pipe_input_id);
if (pipe_input->input_cb(pipe_input->source_fd, pipe_input->user_data)) { if (pipe_input->input_cb(pipe_input->source_fd, pipe_input->user_data)) {
/* restore pipe handler */ /* restore pipe handler */
......
...@@ -22,6 +22,11 @@ ...@@ -22,6 +22,11 @@
ui_main_data_t ui_main_data; ui_main_data_t ui_main_data;
gchar *LOG_DOMAIN_PARSE = "Parse";
gchar *LOG_DOMAIN_PIPE = "Pipe";
gchar *LOG_DOMAIN_SOCKET = "Socket";
gchar *LOG_DOMAIN_UI = "UI";
static void ui_help(void) static void ui_help(void)
{ {
printf ("Usage: itti_analyser [options]\n\n" printf ("Usage: itti_analyser [options]\n\n"
...@@ -112,6 +117,8 @@ static int ui_idle_callback(gpointer data) ...@@ -112,6 +117,8 @@ static int ui_idle_callback(gpointer data)
{ {
g_debug("Entering idle state"); g_debug("Entering idle state");
gtk_window_set_focus (GTK_WINDOW(ui_main_data.window), ui_main_data.signalslist);
/* Read filters file */ /* Read filters file */
if (ui_main_data.filters_file_name != NULL) if (ui_main_data.filters_file_name != NULL)
{ {
...@@ -168,6 +175,7 @@ int ui_gtk_initialize(int argc, char *argv[]) ...@@ -168,6 +175,7 @@ int ui_gtk_initialize(int argc, char *argv[])
ui_main_data.window = gtk_window_new (GTK_WINDOW_TOPLEVEL); ui_main_data.window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
ui_init_filters (TRUE, FALSE); ui_init_filters (TRUE, FALSE);
// gtk_window_set_default_icon_from_file ("../analyzer.png", NULL);
gtk_window_set_default_icon_name (GTK_STOCK_FIND); gtk_window_set_default_icon_name (GTK_STOCK_FIND);
gtk_window_set_position (GTK_WINDOW(ui_main_data.window), GTK_WIN_POS_CENTER); gtk_window_set_position (GTK_WINDOW(ui_main_data.window), GTK_WIN_POS_CENTER);
......
#include "ui_signal_dissect_view.h"
#ifndef UI_MAIN_SCREEN_H_ #ifndef UI_MAIN_SCREEN_H_
#define UI_MAIN_SCREEN_H_ #define UI_MAIN_SCREEN_H_
#include <gtk/gtk.h>
#include "ui_signal_dissect_view.h"
typedef struct { typedef struct {
GtkWidget *window; GtkWidget *window;
GtkWidget *ip_entry; GtkWidget *ip_entry;
...@@ -29,12 +31,14 @@ typedef struct { ...@@ -29,12 +31,14 @@ typedef struct {
/* Signal list buttons */ /* Signal list buttons */
/* Clear signals button */ /* Clear signals button */
GtkToolItem *signals_go_to_button; GtkWidget *signals_go_to_entry;
GtkToolItem *signals_go_to_last_button; GtkToolItem *signals_go_to_last_button;
GtkToolItem *signals_go_to_first_button; GtkToolItem *signals_go_to_first_button;
gboolean display_message_header;
gboolean display_brace;
GtkTreeSelection *selection; GtkTreeSelection *selection;
GtkTreePath *path_last; gboolean follow_last;
/* Nb of messages received */ /* Nb of messages received */
guint nb_message_received; guint nb_message_received;
......
...@@ -27,6 +27,11 @@ int ui_notebook_create(GtkWidget *vbox) ...@@ -27,6 +27,11 @@ int ui_notebook_create(GtkWidget *vbox)
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox_notebook, NULL); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox_notebook, NULL);
gtk_notebook_set_tab_label_text (GTK_NOTEBOOK(notebook), vbox_notebook, "Messages list"); gtk_notebook_set_tab_label_text (GTK_NOTEBOOK(notebook), vbox_notebook, "Messages list");
vbox_notebook = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox_notebook, NULL);
gtk_notebook_set_tab_label_text (GTK_NOTEBOOK(notebook), vbox_notebook, "Filters");
/* Add the notebook to the vbox of the main window */ /* Add the notebook to the vbox of the main window */
gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
......
...@@ -104,6 +104,7 @@ int ui_messages_read(char *filename) ...@@ -104,6 +104,7 @@ int ui_messages_read(char *filename)
size = st.st_size; size = st.st_size;
ui_callback_signal_clear_list (NULL, NULL); ui_callback_signal_clear_list (NULL, NULL);
ui_main_data.follow_last = TRUE;
/* Initialize the progress bar */ /* Initialize the progress bar */
ui_progress_bar_set_fraction(0); ui_progress_bar_set_fraction(0);
...@@ -162,18 +163,20 @@ int ui_messages_read(char *filename) ...@@ -162,18 +163,20 @@ int ui_messages_read(char *filename)
buffer->message_number = itti_signal_header->message_number; buffer->message_number = itti_signal_header->message_number;
ui_signal_add_to_list (buffer, NULL); ui_signal_add_to_list (buffer, ((read_messages % 100) == 0) ? (gpointer) 1: NULL);
read_messages++;
if (read_messages % 100 == 0) if ((read_messages % 100) == 0)
{ {
ui_progress_bar_set_fraction(read_fraction); ui_progress_bar_set_fraction(read_fraction);
ui_gtk_flush_events (); ui_gtk_flush_events ();
} }
read_messages++;
break; break;
} }
case ITTI_DUMP_XML_DEFINITION: case ITTI_DUMP_XML_DEFINITION:
ui_gtk_flush_events ();
xml_parse_buffer (input_data, input_data_length); xml_parse_buffer (input_data, input_data_length);
ui_gtk_flush_events (); ui_gtk_flush_events ();
break; break;
...@@ -197,6 +200,12 @@ int ui_messages_read(char *filename) ...@@ -197,6 +200,12 @@ int ui_messages_read(char *filename)
/* Enable buttons to move in the list of signals */ /* Enable buttons to move in the list of signals */
ui_set_sensitive_move_buttons (TRUE); ui_set_sensitive_move_buttons (TRUE);
if (ui_main_data.follow_last)
{
/* Advance to the last signal */
ui_tree_view_select_row (ui_tree_view_get_filtered_number() - 1);
}
basename = g_path_get_basename(filename); basename = g_path_get_basename(filename);
ui_set_title ("\"%s\"", basename); ui_set_title ("\"%s\"", basename);
} }
......
...@@ -51,12 +51,11 @@ int ui_signal_dissect_clear_view(ui_text_view_t *text_view) ...@@ -51,12 +51,11 @@ int ui_signal_dissect_clear_view(ui_text_view_t *text_view)
if (text_view->text_view != NULL) if (text_view->text_view != NULL)
{ {
text_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_view->text_view)); /* Create an empty text buffer */
text_buffer = gtk_text_buffer_new(NULL);
gtk_text_buffer_set_text(text_buffer, "", 0);
/* If a text buffer is present for the textview remove it */ gtk_text_view_set_buffer(GTK_TEXT_VIEW(text_view->text_view), text_buffer);
if (text_buffer != NULL) {
gtk_text_view_set_buffer(GTK_TEXT_VIEW(text_view->text_view), NULL);
}
} }
return RC_OK; return RC_OK;
......
...@@ -25,6 +25,8 @@ typedef struct ...@@ -25,6 +25,8 @@ typedef struct
static ui_store_t ui_store; static ui_store_t ui_store;
GdkEventButton *ui_tree_view_last_event;
static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter, ui_store_t *store) static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter, ui_store_t *store)
{ {
uint32_t msg_number; uint32_t msg_number;
...@@ -52,6 +54,24 @@ static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter, ...@@ -52,6 +54,24 @@ static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter,
return enabled; return enabled;
} }
static gboolean onButtonPressed(GtkWidget *treeview, GdkEventButton *event, gpointer userdata)
{
g_debug("onButtonPressed %p %p %p %d %d", treeview, event, userdata, event->type, event->button);
ui_tree_view_last_event = event;
return FALSE;
}
/*
static gboolean onButtonRelease(GtkWidget *treeview, GdkEventButton *event, gpointer userdata)
{
g_debug("onButtonRelease %p %p %p %d %d", treeview, event, userdata, event->type, event->button);
// last_event = event;
return FALSE;
}
*/
static void static void
ui_tree_view_init_list(GtkWidget *list) ui_tree_view_init_list(GtkWidget *list)
{ {
...@@ -176,7 +196,45 @@ void ui_tree_view_destroy_list(GtkWidget *list) ...@@ -176,7 +196,45 @@ void ui_tree_view_destroy_list(GtkWidget *list)
/* Reset number of messages */ /* Reset number of messages */
ui_main_data.nb_message_received = 0; ui_main_data.nb_message_received = 0;
ui_main_data.path_last = NULL; }
/* Search for the message with its message number equal to the given value or the previous one */
static gboolean ui_tree_view_search (GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *iter,
gpointer search_data)
{
uint32_t msg_number;
uint32_t key_value = atoi(key);
gtk_tree_model_get (model, iter, column, &msg_number, -1);
g_debug ("ui_tree_view_search %d %d", key_value, msg_number);
if (key_value == msg_number)
{
/* Value found, use this message */
return 0;
}
{
GtkTreeIter iter_next = *iter;
if (gtk_tree_model_iter_next(model, &iter_next))
{
gtk_tree_model_get (model, &iter_next, column, &msg_number, -1);
if (key_value < msg_number)
{
/* Next value will be greater, use this message */
return 0;
}
}
else
{
/* Last value, use this message */
return 0;
}
}
return 1;
} }
int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox) int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox)
...@@ -192,6 +250,8 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox) ...@@ -192,6 +250,8 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox)
ui_main_data.signalslist = gtk_tree_view_new(); ui_main_data.signalslist = gtk_tree_view_new();
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(ui_main_data.signalslist), TRUE); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(ui_main_data.signalslist), TRUE);
gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW(ui_main_data.signalslist), ui_tree_view_search, NULL, NULL);
gtk_tree_view_set_search_entry (GTK_TREE_VIEW(ui_main_data.signalslist), GTK_ENTRY(ui_main_data.signals_go_to_entry));
/* Disable multiple selection */ /* Disable multiple selection */
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(ui_main_data.signalslist)); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(ui_main_data.signalslist));
...@@ -210,6 +270,9 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox) ...@@ -210,6 +270,9 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox)
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 5);
g_signal_connect(G_OBJECT(ui_main_data.signalslist), "button-press-event", G_CALLBACK (onButtonPressed), NULL);
// g_signal_connect(G_OBJECT(ui_main_data.signalslist), "button-release-event", G_CALLBACK (onButtonRelease), NULL);
/* Connect callback on row selection */ /* Connect callback on row selection */
gtk_tree_selection_set_select_function(selection, ui_callback_on_select_signal, gtk_tree_selection_set_select_function(selection, ui_callback_on_select_signal,
ui_main_data.text_view, NULL); ui_main_data.text_view, NULL);
...@@ -249,20 +312,16 @@ int ui_tree_view_new_signal_ind(const uint32_t message_number, const gchar *lte_ ...@@ -249,20 +312,16 @@ int ui_tree_view_new_signal_ind(const uint32_t message_number, const gchar *lte_
return RC_OK; return RC_OK;
} }
void ui_tree_view_select_row(gint row, GtkTreePath **path) void ui_tree_view_select_row(gint row)
{ {
GtkTreePath *path_row; GtkTreePath *path_row;
path_row = gtk_tree_path_new_from_indices(row, -1); path_row = gtk_tree_path_new_from_indices(row, -1);
/* Select the message in requested row */ /* Select the message in requested row */
gtk_tree_view_set_cursor(GTK_TREE_VIEW(ui_main_data.signalslist), path_row, NULL, FALSE); gtk_tree_view_set_cursor(GTK_TREE_VIEW(ui_main_data.signalslist), path_row, NULL, FALSE);
/* Center the message in the middle of the list if possible */ /* Center the message in the middle of the list if possible */
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(ui_main_data.signalslist), path_row, NULL, TRUE, 0.5, 0.0); gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(ui_main_data.signalslist), path_row, NULL, TRUE, 0.5, 0.0);
if (path != NULL)
{
*path = path_row;
}
} }
void ui_tree_view_refilter(void) void ui_tree_view_refilter(void)
......
...@@ -18,6 +18,8 @@ typedef enum ...@@ -18,6 +18,8 @@ typedef enum
NUM_COLS NUM_COLS
} col_type_e; } col_type_e;
extern GdkEventButton *ui_tree_view_last_event;
int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox); int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox);
int ui_tree_view_new_signal_ind(const uint32_t message_number, const gchar *lte_time, int ui_tree_view_new_signal_ind(const uint32_t message_number, const gchar *lte_time,
...@@ -28,7 +30,7 @@ int ui_tree_view_new_signal_ind(const uint32_t message_number, const gchar *lte_ ...@@ -28,7 +30,7 @@ int ui_tree_view_new_signal_ind(const uint32_t message_number, const gchar *lte_
void ui_tree_view_destroy_list(GtkWidget *list); void ui_tree_view_destroy_list(GtkWidget *list);
void ui_tree_view_select_row(gint row, GtkTreePath **path); void ui_tree_view_select_row(gint row);
void ui_tree_view_refilter(void); void ui_tree_view_refilter(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment