Commit 4394cf07 authored by winckel's avatar winckel

Added emty and text ITTI message types.

Modified struct type display for text messages.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4874 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent b95d95f4
/* This message asks for task initialization */
MESSAGE_DEF(INITIALIZE_MESSAGE, MESSAGE_PRIORITY_MED, struct {}, initialize_message)
MESSAGE_DEF(INITIALIZE_MESSAGE, MESSAGE_PRIORITY_MED, IttiMsgEmpty, initialize_message)
/* This message asks for task activation */
MESSAGE_DEF(ACTIVATE_MESSAGE, MESSAGE_PRIORITY_MED, struct {}, activate_message)
MESSAGE_DEF(ACTIVATE_MESSAGE, MESSAGE_PRIORITY_MED, IttiMsgEmpty, activate_message)
/* This message asks for task deactivation */
MESSAGE_DEF(DEACTIVATE_MESSAGE, MESSAGE_PRIORITY_MED, struct {}, deactivate_message)
MESSAGE_DEF(DEACTIVATE_MESSAGE, MESSAGE_PRIORITY_MED, IttiMsgEmpty, deactivate_message)
/* This message asks for task termination */
MESSAGE_DEF(TERMINATE_MESSAGE, MESSAGE_PRIORITY_MAX, struct {}, terminate_message)
MESSAGE_DEF(TERMINATE_MESSAGE, MESSAGE_PRIORITY_MAX, IttiMsgEmpty, terminate_message)
/* Test message used for debug */
MESSAGE_DEF(MESSAGE_TEST, MESSAGE_PRIORITY_MED, struct {}, message_test)
MESSAGE_DEF(MESSAGE_TEST, MESSAGE_PRIORITY_MED, IttiMsgEmpty, message_test)
/* Error message */
MESSAGE_DEF(ERROR_LOG, MESSAGE_PRIORITY_MAX, struct {}, error_log)
MESSAGE_DEF(ERROR_LOG, MESSAGE_PRIORITY_MAX, IttiMsgEmpty, error_log)
/* Warning message */
MESSAGE_DEF(WARNING_LOG, MESSAGE_PRIORITY_MAX, struct {}, warning_log)
MESSAGE_DEF(WARNING_LOG, MESSAGE_PRIORITY_MAX, IttiMsgEmpty, warning_log)
/* Notice message */
MESSAGE_DEF(NOTICE_LOG, MESSAGE_PRIORITY_MED, struct {}, notice_log)
MESSAGE_DEF(NOTICE_LOG, MESSAGE_PRIORITY_MED, IttiMsgEmpty, notice_log)
/* Info message */
MESSAGE_DEF(INFO_LOG, MESSAGE_PRIORITY_MED, struct {}, info_log)
MESSAGE_DEF(INFO_LOG, MESSAGE_PRIORITY_MED, IttiMsgEmpty, info_log)
/* Debug message */
MESSAGE_DEF(DEBUG_LOG, MESSAGE_PRIORITY_MED, struct {}, debug_log)
MESSAGE_DEF(DEBUG_LOG, MESSAGE_PRIORITY_MED, IttiMsgEmpty, debug_log)
/* Generic log message for text */
MESSAGE_DEF(GENERIC_LOG, MESSAGE_PRIORITY_MED, struct {}, generic_log)
MESSAGE_DEF(GENERIC_LOG, MESSAGE_PRIORITY_MED, IttiMsgEmpty, generic_log)
/*
* intertask_messages_types.h
*
* Created on: Jan 14, 2014
* Author: laurent winckel
*/
#ifndef INTERTASK_MESSAGES_TYPES_H_
#define INTERTASK_MESSAGES_TYPES_H_
typedef struct IttiMsgEmpty_s
{
} IttiMsgEmpty;
typedef struct IttiMsgText_s
{
uint32_t size;
char text[];
} IttiMsgText;
#endif /* INTERTASK_MESSAGES_TYPES_H_ */
......@@ -16,14 +16,14 @@ int struct_dissect_from_buffer(
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
int i;
int length = 0;
char cbuf[50 + (type->name ? strlen (type->name) : 0)];
int length = 0;
char *name;
DISPLAY_PARSE_INFO("structure", type->name, offset, parent_offset);
memset (cbuf, 0, sizeof(cbuf));
DISPLAY_PARSE_INFO("structure", type->name, offset, parent_offset);
if (new_line) {
DISPLAY_TYPE("Str");
}
......@@ -34,16 +34,32 @@ int struct_dissect_from_buffer(
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);
for (i = 0; i < type->nb_members; i++) {
if (type->members_child[i] != NULL)
type->members_child[i]->type_dissect_from_buffer (
type->members_child[i], ui_set_signal_text_cb, user_data,
buffer, offset, parent_offset, indent + DISPLAY_TAB_SIZE, TRUE);
if ((strcmp (type->name, "IttiMsgText_s") == 0) &&
(type->members_child[0] != NULL) && (strcmp (type->members_child[0]->name, "size") == 0) &&
(type->members_child[1] != NULL) && (strcmp (type->members_child[1]->name, "text") == 0))
{
uint8_t *buf;
length = buffer_get_uint32_t (buffer, offset + parent_offset);
buf = malloc (length + 1);
buf[0] = '\n';
buffer_fetch_nbytes(buffer, parent_offset + offset + 32, length, &buf[1]);
ui_set_signal_text_cb(user_data, buf, length);
}
else
{
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);
for (i = 0; i < type->nb_members; i++) {
if (type->members_child[i] != NULL)
type->members_child[i]->type_dissect_from_buffer (
type->members_child[i], ui_set_signal_text_cb, user_data,
buffer, offset, parent_offset, indent + DISPLAY_TAB_SIZE, TRUE);
}
}
DISPLAY_BRACE(
......
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