- Added new feature to ITTI:
* Possibilty to dump formatted strings directly to the analyzer - Updated itti_analyzer accordingly git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4413 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
@@ -189,7 +189,7 @@ int itti_send_broadcast_message(MessageDef *message_p) {
|
||||
|
||||
DevAssert(message_p != NULL);
|
||||
|
||||
origin_thread_id = TASK_GET_THREAD_ID(message_p->header.originTaskId);
|
||||
origin_thread_id = TASK_GET_THREAD_ID(message_p->ittiMsgHeader.originTaskId);
|
||||
|
||||
destination_task_id = TASK_FIRST;
|
||||
for (thread_id = THREAD_FIRST; thread_id < itti_desc.thread_max; thread_id++) {
|
||||
@@ -208,7 +208,7 @@ int itti_send_broadcast_message(MessageDef *message_p) {
|
||||
|
||||
memcpy (new_message_p, message_p, sizeof(MessageDef));
|
||||
result = itti_send_msg_to_task (destination_task_id, INSTANCE_DEFAULT, new_message_p);
|
||||
DevCheck(result >= 0, message_p->header.messageId, thread_id, destination_task_id);
|
||||
DevCheck(result >= 0, message_p->ittiMsgHeader.messageId, thread_id, destination_task_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -217,22 +217,29 @@ int itti_send_broadcast_message(MessageDef *message_p) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline MessageDef *itti_alloc_new_message(task_id_t origin_task_id, MessagesIds message_id) {
|
||||
inline MessageDef *itti_alloc_new_message_sized(task_id_t origin_task_id, MessagesIds message_id, MessageHeaderSize size)
|
||||
{
|
||||
MessageDef *temp = NULL;
|
||||
|
||||
DevCheck(message_id < itti_desc.messages_id_max, message_id, itti_desc.messages_id_max, 0);
|
||||
|
||||
temp = calloc (1, MESSAGE_SIZE(message_id));
|
||||
temp = calloc (1, sizeof(MessageHeader) + size);
|
||||
DevAssert(temp != NULL);
|
||||
|
||||
temp->header.messageId = message_id;
|
||||
temp->header.originTaskId = origin_task_id;
|
||||
temp->header.size = itti_desc.messages_info[message_id].size;
|
||||
temp->ittiMsgHeader.messageId = message_id;
|
||||
temp->ittiMsgHeader.originTaskId = origin_task_id;
|
||||
temp->ittiMsgHeader.ittiMsgSize = size;
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
int itti_send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *message) {
|
||||
inline MessageDef *itti_alloc_new_message(task_id_t origin_task_id, MessagesIds message_id)
|
||||
{
|
||||
return itti_alloc_new_message_sized(origin_task_id, message_id, itti_desc.messages_info[message_id].size);
|
||||
}
|
||||
|
||||
int itti_send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *message)
|
||||
{
|
||||
thread_id_t thread_id = TASK_GET_THREAD_ID(task_id);
|
||||
message_list_t *new;
|
||||
uint32_t priority;
|
||||
@@ -242,11 +249,11 @@ int itti_send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *me
|
||||
DevAssert(message != NULL);
|
||||
DevCheck(task_id < itti_desc.task_max, task_id, itti_desc.task_max, 0);
|
||||
|
||||
message->header.destinationTaskId = task_id;
|
||||
message->header.instance = instance;
|
||||
message->header.lte_time.frame = itti_desc.lte_time.frame;
|
||||
message->header.lte_time.slot = itti_desc.lte_time.slot;
|
||||
message_id = message->header.messageId;
|
||||
message->ittiMsgHeader.destinationTaskId = task_id;
|
||||
message->ittiMsgHeader.instance = instance;
|
||||
message->ittiMsgHeader.lte_time.frame = itti_desc.lte_time.frame;
|
||||
message->ittiMsgHeader.lte_time.slot = itti_desc.lte_time.slot;
|
||||
message_id = message->ittiMsgHeader.messageId;
|
||||
DevCheck(message_id < itti_desc.messages_id_max, itti_desc.messages_id_max, message_id, 0);
|
||||
|
||||
priority = itti_get_message_priority (message_id);
|
||||
@@ -255,7 +262,7 @@ int itti_send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *me
|
||||
message_number = itti_increment_message_number ();
|
||||
|
||||
itti_dump_queue_message (message_number, message, itti_desc.messages_info[message_id].name,
|
||||
MESSAGE_SIZE(message_id));
|
||||
sizeof(MessageHeader) + message->ittiMsgHeader.ittiMsgSize);
|
||||
|
||||
if (task_id != TASK_UNKNOWN)
|
||||
{
|
||||
@@ -521,8 +528,8 @@ void itti_poll_msg(task_id_t task_id, MessageDef **received_msg) {
|
||||
itti_desc.tasks[task_id].message_in_queue--;
|
||||
|
||||
ITTI_DEBUG(
|
||||
"Receiver queue[(%u:%s)] got new message %s, number %lu\n",
|
||||
task_id, itti_get_task_name(task_id), itti_desc.messages_info[temp->msg->header.messageId].name, temp->message_number);
|
||||
"Receiver queue[(%u:%s)] got new message %s, number %lu\n",
|
||||
task_id, itti_get_task_name(task_id), itti_desc.messages_info[temp->msg->ittiMsgHeader.messageId].name, temp->message_number);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,10 +48,13 @@
|
||||
#include "intertask_interface_conf.h"
|
||||
#include "intertask_interface_types.h"
|
||||
|
||||
#define ITTI_MSG_NAME(mSGpTR) itti_get_message_name((mSGpTR)->header.messageId)
|
||||
#define ITTI_MSG_ORIGIN_NAME(mSGpTR) itti_get_task_name((mSGpTR)->header.originTaskId)
|
||||
#define ITTI_MSG_DESTINATION_NAME(mSGpTR) itti_get_task_name((mSGpTR)->header.destinationTaskId)
|
||||
#define ITTI_MSG_INSTANCE(mSGpTR) (mSGpTR)->header.instance
|
||||
#define ITTI_MSG_ID(mSGpTR) ((mSGpTR)->ittiMsgHeader.messageId)
|
||||
#define ITTI_MSG_ORIGIN_ID(mSGpTR) ((mSGpTR)->ittiMsgHeader.originTaskId)
|
||||
#define ITTI_MSG_DESTINATION_ID(mSGpTR) ((mSGpTR)->ittiMsgHeader.destinationTaskId)
|
||||
#define ITTI_MSG_INSTANCE(mSGpTR) ((mSGpTR)->ittiMsgHeader.instance)
|
||||
#define ITTI_MSG_NAME(mSGpTR) itti_get_message_name(ITTI_MSG_ID(mSGpTR))
|
||||
#define ITTI_MSG_ORIGIN_NAME(mSGpTR) itti_get_task_name(ITTI_MSG_ORIGIN_ID(mSGpTR))
|
||||
#define ITTI_MSG_DESTINATION_NAME(mSGpTR) itti_get_task_name(ITTI_MSG_DESTINATION_ID(mSGpTR))
|
||||
|
||||
/* Make the message number platform specific */
|
||||
typedef unsigned long message_number_t;
|
||||
@@ -190,8 +193,19 @@ const char *itti_get_task_name(task_id_t task_id);
|
||||
* @returns NULL in case of failure or newly allocated mesage ref
|
||||
**/
|
||||
inline MessageDef *itti_alloc_new_message(
|
||||
task_id_t origin_task_id,
|
||||
MessagesIds message_id);
|
||||
task_id_t origin_task_id,
|
||||
MessagesIds message_id);
|
||||
|
||||
/** \brief Alloc and memset(0) a new itti message.
|
||||
* \param origin_task_id Task ID of the sending task
|
||||
* \param message_id Message ID
|
||||
* \param size size of the payload to send
|
||||
* @returns NULL in case of failure or newly allocated mesage ref
|
||||
**/
|
||||
inline MessageDef *itti_alloc_new_message_sized(
|
||||
task_id_t origin_task_id,
|
||||
MessagesIds message_id,
|
||||
MessageHeaderSize size);
|
||||
|
||||
/** \brief handle signals and wait for all threads to join when the process complete.
|
||||
* This function should be called from the main thread after having created all ITTI tasks.
|
||||
|
||||
@@ -65,6 +65,11 @@ extern int itti_debug;
|
||||
#define ITTI_ERROR(x, args...) do { fprintf(stdout, "[ITTI][E]"x, ##args); } \
|
||||
while(0)
|
||||
|
||||
/* Message sent is an intertask dump type */
|
||||
#define ITTI_DUMP_MESSAGE_TYPE 0x1
|
||||
#define ITTI_STATISTIC_MESSAGE_TYPE 0x2
|
||||
#define ITTI_DUMP_XML_DEFINITION 0x3
|
||||
|
||||
typedef struct itti_queue_item_s {
|
||||
STAILQ_ENTRY(itti_queue_item_s) entry;
|
||||
void *data;
|
||||
@@ -102,11 +107,6 @@ typedef struct itti_desc_s {
|
||||
itti_client_desc_t itti_clients[ITTI_DUMP_MAX_CON];
|
||||
} itti_desc_t;
|
||||
|
||||
/* Message sent is an intertask dump type */
|
||||
#define ITTI_DUMP_MESSAGE_TYPE 0x1
|
||||
#define ITTI_STATISTIC_MESSAGE_TYPE 0x2
|
||||
#define ITTI_DUMP_XML_DEFINITION 0x3
|
||||
|
||||
typedef struct {
|
||||
/* The size of this structure */
|
||||
uint32_t message_size;
|
||||
@@ -222,13 +222,62 @@ static int itti_dump_send_xml_definition(const int sd, const char *message_defin
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int itti_enqueue_message(itti_queue_item_t *new, uint32_t message_size,
|
||||
uint32_t message_type)
|
||||
{
|
||||
itti_queue_item_t *head = NULL;
|
||||
|
||||
DevAssert(new != NULL);
|
||||
|
||||
/* Lock the queue mutex for writing to insert the new element */
|
||||
pthread_mutex_lock(&itti_queue.queue_mutex);
|
||||
|
||||
/* We reached the maximum size for the queue of messages -> remove the head */
|
||||
if (itti_queue.queue_size + message_size > ITTI_QUEUE_SIZE_MAX) {
|
||||
head = STAILQ_FIRST(&itti_queue.itti_message_queue);
|
||||
/* Remove the head */
|
||||
STAILQ_REMOVE_HEAD(&itti_queue.itti_message_queue, entry);
|
||||
} else {
|
||||
itti_queue.queue_size += message_size;
|
||||
}
|
||||
/* Insert the packet at tail */
|
||||
STAILQ_INSERT_TAIL(&itti_queue.itti_message_queue, new, entry);
|
||||
itti_queue.itti_queue_last = new;
|
||||
|
||||
if (dump_file != NULL)
|
||||
{
|
||||
itti_socket_header_t header;
|
||||
|
||||
header.message_size = message_size + sizeof(itti_dump_message_t);
|
||||
header.message_type = message_type;
|
||||
|
||||
fwrite (&header, sizeof(itti_socket_header_t), 1, dump_file);
|
||||
fwrite (&new->message_number, sizeof(new->message_number), 1, dump_file);
|
||||
fwrite (new->message_name, sizeof(new->message_name), 1, dump_file);
|
||||
fwrite (new->data, new->data_size, 1, dump_file);
|
||||
}
|
||||
|
||||
/* Release the mutex */
|
||||
pthread_mutex_unlock(&itti_queue.queue_mutex);
|
||||
|
||||
/* No need to have the mutex locked to free data as at this point the message
|
||||
* is no more in the list.
|
||||
*/
|
||||
if (head) {
|
||||
free(head->data);
|
||||
free(head);
|
||||
head = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int itti_dump_queue_message(message_number_t message_number,
|
||||
MessageDef *message_p,
|
||||
const char *message_name,
|
||||
const uint32_t message_size)
|
||||
{
|
||||
itti_queue_item_t *new;
|
||||
itti_queue_item_t *head = NULL;
|
||||
size_t message_name_length;
|
||||
int i;
|
||||
|
||||
@@ -251,7 +300,7 @@ int itti_dump_queue_message(message_number_t message_number,
|
||||
return -1;
|
||||
}
|
||||
memcpy(new->data, message_p, message_size);
|
||||
new->data_size = message_size;
|
||||
new->data_size = message_size;
|
||||
new->message_number = message_number;
|
||||
|
||||
message_name_length = strlen(message_name) + 1;
|
||||
@@ -259,36 +308,7 @@ int itti_dump_queue_message(message_number_t message_number,
|
||||
SIGNAL_NAME_LENGTH, 0);
|
||||
memcpy(new->message_name, message_name, message_name_length);
|
||||
|
||||
/* Lock the queue mutex for writing to insert the new element */
|
||||
pthread_mutex_lock(&itti_queue.queue_mutex);
|
||||
|
||||
/* We reached the maximum size for the queue of messages -> remove the head */
|
||||
if (itti_queue.queue_size + message_size > ITTI_QUEUE_SIZE_MAX) {
|
||||
head = STAILQ_FIRST(&itti_queue.itti_message_queue);
|
||||
/* Remove the head */
|
||||
STAILQ_REMOVE_HEAD(&itti_queue.itti_message_queue, entry);
|
||||
} else {
|
||||
itti_queue.queue_size += message_size;
|
||||
}
|
||||
/* Insert the packet at tail */
|
||||
STAILQ_INSERT_TAIL(&itti_queue.itti_message_queue, new, entry);
|
||||
itti_queue.itti_queue_last = new;
|
||||
|
||||
if (dump_file != NULL)
|
||||
{
|
||||
itti_socket_header_t header;
|
||||
|
||||
header.message_size = sizeof(itti_dump_message_t) + message_size;
|
||||
header.message_type = ITTI_DUMP_MESSAGE_TYPE;
|
||||
|
||||
fwrite (&header, sizeof(itti_socket_header_t), 1, dump_file);
|
||||
fwrite (&new->message_number, sizeof(new->message_number), 1, dump_file);
|
||||
fwrite (new->message_name, sizeof(new->message_name), 1, dump_file);
|
||||
fwrite (new->data, new->data_size, 1, dump_file);
|
||||
}
|
||||
|
||||
/* Release the mutex */
|
||||
pthread_mutex_unlock(&itti_queue.queue_mutex);
|
||||
itti_enqueue_message(new, message_size, ITTI_DUMP_MESSAGE_TYPE);
|
||||
|
||||
for (i = 0; i < ITTI_DUMP_MAX_CON; i++) {
|
||||
if (pthread_mutex_trylock(&itti_queue.itti_clients[i].client_lock) == 0) {
|
||||
@@ -301,15 +321,6 @@ int itti_dump_queue_message(message_number_t message_number,
|
||||
itti_dump_send_message(itti_queue.itti_clients[i].sd, new);
|
||||
}
|
||||
|
||||
/* No need to have the mutex locked to free data as at this point the message
|
||||
* is no more in the list.
|
||||
*/
|
||||
if (head) {
|
||||
free(head->data);
|
||||
free(head);
|
||||
head = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,10 @@
|
||||
int itti_dump_queue_message(message_number_t message_number, MessageDef *message_p, const char *message_name,
|
||||
const uint32_t message_size);
|
||||
|
||||
int itti_dump_queue_generic_string_message(message_number_t message_number,
|
||||
char *string_message,
|
||||
const uint32_t string_message_length);
|
||||
|
||||
int itti_dump_init(const char * const messages_definition_xml, const char * const dump_file_name);
|
||||
|
||||
void itti_dump_exit(void);
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
/* Defines to extract task ID fields */
|
||||
#define TASK_GET_THREAD_ID(tASKiD) (itti_desc.tasks_info[tASKiD].thread)
|
||||
/* Extract the instance from a message */
|
||||
#define ITTI_MESSAGE_GET_INSTANCE(mESSAGE) ((mESSAGE)->header.instance)
|
||||
#define ITTI_MESSAGE_GET_INSTANCE(mESSAGE) ((mESSAGE)->ittiMsgHeader.instance)
|
||||
|
||||
#include <messages_types.h>
|
||||
|
||||
@@ -140,7 +140,7 @@ typedef struct MessageHeader_s
|
||||
task_id_t destinationTaskId; /**< ID of the destination task */
|
||||
instance_t instance; /**< Task instance for virtualization */
|
||||
|
||||
MessageHeaderSize size; /**< Message size (not including header size) */
|
||||
MessageHeaderSize ittiMsgSize; /**< Message size (not including header size) */
|
||||
|
||||
itti_lte_time_t lte_time; /**< Reference LTE time */
|
||||
} MessageHeader;
|
||||
@@ -150,7 +150,7 @@ typedef struct MessageHeader_s
|
||||
*/
|
||||
typedef struct MessageDef_s
|
||||
{
|
||||
MessageHeader header; /**< Message header */
|
||||
MessageHeader ittiMsgHeader; /**< Message header */
|
||||
msg_t msg; /**< Union of payloads as defined in x_messages_def.h headers */
|
||||
} MessageDef;
|
||||
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
MESSAGE_DEF(TERMINATE_MESSAGE, MESSAGE_PRIORITY_MAX, struct {}, terminate_message)
|
||||
/* Test message used for debug */
|
||||
MESSAGE_DEF(MESSAGE_TEST, MESSAGE_PRIORITY_MAX, struct {}, message_test)
|
||||
|
||||
/* Test message used for debug */
|
||||
MESSAGE_DEF(GENERIC_LOG, MESSAGE_PRIORITY_MAX, char, generic_log)
|
||||
|
||||
@@ -208,3 +208,11 @@ int buffer_has_enouch_data(buffer_t *buffer, uint32_t offset, uint32_t to_get)
|
||||
offset, to_get, buffer->size_bytes);
|
||||
return underflow;
|
||||
}
|
||||
|
||||
void *buffer_at_offset(buffer_t *buffer, uint32_t offset)
|
||||
{
|
||||
// if (buffer_has_enouch_data(buffer, 0, offset) != 0) {
|
||||
// return NULL;
|
||||
// }
|
||||
return &buffer->data[offset / 8];
|
||||
}
|
||||
|
||||
@@ -40,4 +40,6 @@ int buffer_new_from_data(buffer_t **buffer, uint8_t *data, const uint32_t length
|
||||
|
||||
int buffer_has_enouch_data(buffer_t *buffer, uint32_t offset, uint32_t to_get);
|
||||
|
||||
void *buffer_at_offset(buffer_t *buffer, uint32_t offset);
|
||||
|
||||
#endif /* BUFFERS_H_ */
|
||||
|
||||
@@ -19,9 +19,7 @@ types_t *type_new(enum type_e type)
|
||||
{
|
||||
types_t *new_p;
|
||||
|
||||
new_p = malloc(sizeof(types_t));
|
||||
|
||||
memset(new_p, 0, sizeof(types_t));
|
||||
new_p = calloc(1, sizeof(types_t));
|
||||
|
||||
new_p->type = type;
|
||||
|
||||
|
||||
@@ -785,12 +785,17 @@ static int xml_parse_doc(xmlDocPtr doc) {
|
||||
|
||||
/* Locate the message id field */
|
||||
CHECK_FCT(locate_type("MessagesIds", head, &messages_id_enum));
|
||||
|
||||
/* Locate the header part of a message */
|
||||
CHECK_FCT(locate_type("ittiMsgHeader", head, &message_header_type));
|
||||
/* Locate the origin task id field */
|
||||
CHECK_FCT(locate_type("originTaskId", head, &origin_task_id_type));
|
||||
CHECK_FCT(locate_type("originTaskId", message_header_type, &origin_task_id_type));
|
||||
/* Locate the destination task id field */
|
||||
CHECK_FCT(locate_type("destinationTaskId", head, &destination_task_id_type));
|
||||
CHECK_FCT(locate_type("destinationTaskId", message_header_type, &destination_task_id_type));
|
||||
/* Locate the instance field */
|
||||
CHECK_FCT(locate_type("instance", head, &instance_type));
|
||||
CHECK_FCT(locate_type("instance", message_header_type, &instance_type));
|
||||
/* Locate the message size field */
|
||||
CHECK_FCT(locate_type("ittiMsgSize", message_header_type, &message_size_type));
|
||||
|
||||
// root->type_hr_display(root, 0);
|
||||
|
||||
@@ -810,8 +815,28 @@ static int xml_parse_doc(xmlDocPtr doc) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int dissect_signal_header(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_cb,
|
||||
gpointer cb_user_data)
|
||||
{
|
||||
if (message_header_type == NULL) {
|
||||
g_error("No messages format definition provided");
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
if (buffer == NULL) {
|
||||
g_error("Failed buffer is NULL");
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
message_header_type->type_dissect_from_buffer(
|
||||
message_header_type, ui_set_signal_text_cb, cb_user_data,
|
||||
buffer, 0, 0, INDENT_START);
|
||||
|
||||
return RC_OK;
|
||||
}
|
||||
|
||||
int dissect_signal(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_cb,
|
||||
gpointer user_data)
|
||||
gpointer cb_user_data)
|
||||
{
|
||||
if (root == NULL) {
|
||||
g_error("No messages format definition provided");
|
||||
@@ -823,7 +848,7 @@ int dissect_signal(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
root->type_dissect_from_buffer(root, ui_set_signal_text_cb, user_data,
|
||||
root->type_dissect_from_buffer(root, ui_set_signal_text_cb, cb_user_data,
|
||||
buffer, 0, 0, INDENT_START);
|
||||
|
||||
return RC_OK;
|
||||
|
||||
@@ -13,4 +13,7 @@ int xml_parse_buffer(const char *xml_buffer, const int size);
|
||||
int dissect_signal(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_cb,
|
||||
gpointer user_data);
|
||||
|
||||
int dissect_signal_header(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_cb,
|
||||
gpointer cb_user_data);
|
||||
|
||||
#endif /* XML_PARSE_H_ */
|
||||
|
||||
@@ -17,6 +17,8 @@ types_t *lte_time_slot_type = NULL;
|
||||
types_t *origin_task_id_type = NULL;
|
||||
types_t *destination_task_id_type = NULL;
|
||||
types_t *instance_type = NULL;
|
||||
types_t *message_header_type = NULL;
|
||||
types_t *message_size_type = NULL;
|
||||
|
||||
int locate_root(const char *root_name, types_t *head, types_t **root_elm) {
|
||||
types_t *next_type;
|
||||
@@ -77,6 +79,37 @@ int locate_type(const char *type_name, types_t *head, types_t **type) {
|
||||
return (next_type == NULL) ? RC_FAIL : RC_OK;
|
||||
}
|
||||
|
||||
uint32_t get_message_header_type_size(void)
|
||||
{
|
||||
/* Typedef */
|
||||
if (message_header_type->child != NULL) {
|
||||
/* Struct */
|
||||
if (message_header_type->child->child != NULL) {
|
||||
return message_header_type->child->child->size;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t get_message_size(buffer_t *buffer)
|
||||
{
|
||||
uint32_t value = 0;
|
||||
|
||||
if (message_size_type != NULL)
|
||||
{
|
||||
types_t *temp = message_size_type;
|
||||
|
||||
while (temp->size == -1) {
|
||||
temp = temp->child;
|
||||
}
|
||||
|
||||
/* Fetch instance value */
|
||||
buffer_fetch_bits (buffer, message_size_type->offset, temp->size, &value);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
uint32_t get_lte_frame(buffer_t *buffer) {
|
||||
uint32_t value = 0;
|
||||
|
||||
|
||||
@@ -8,11 +8,17 @@ extern types_t *lte_time_slot_type;
|
||||
extern types_t *origin_task_id_type;
|
||||
extern types_t *destination_task_id_type;
|
||||
extern types_t *instance_type;
|
||||
extern types_t *message_header_type;
|
||||
extern types_t *message_size_type;
|
||||
|
||||
int locate_root(const char *root_name, types_t *head, types_t **root);
|
||||
|
||||
int locate_type(const char *type_name, types_t *head, types_t **type);
|
||||
|
||||
uint32_t get_message_header_type_size(void);
|
||||
|
||||
uint32_t get_message_size(buffer_t *buffer);
|
||||
|
||||
uint32_t get_lte_frame(buffer_t *buffer);
|
||||
|
||||
uint32_t get_lte_slot(buffer_t *buffer);
|
||||
|
||||
@@ -127,17 +127,40 @@ gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel
|
||||
GValue buffer_store = G_VALUE_INIT;
|
||||
gpointer buffer;
|
||||
|
||||
gtk_tree_model_get_value (model, &iter, COL_BUFFER, &buffer_store);
|
||||
GValue message_id_store = G_VALUE_INIT;
|
||||
guint message_id;
|
||||
|
||||
gtk_tree_model_get_value (model, &iter, COL_BUFFER, &buffer_store);
|
||||
buffer = g_value_get_pointer (&buffer_store);
|
||||
|
||||
gtk_tree_model_get_value (model, &iter, COL_MESSAGE_ID, &message_id_store);
|
||||
message_id = g_value_get_uint(&message_id_store);
|
||||
|
||||
if (!path_currently_selected)
|
||||
{
|
||||
/* Clear the view */
|
||||
CHECK_FCT_DO(ui_signal_dissect_clear_view(text_view), return FALSE);
|
||||
|
||||
/* Dissect the signal */
|
||||
CHECK_FCT_DO(dissect_signal((buffer_t*)buffer, ui_signal_set_text, text_view), return FALSE);
|
||||
if (strcmp(message_id_to_string(message_id), "GENERIC_LOG") == 0) {
|
||||
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);
|
||||
|
||||
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\n",
|
||||
message_header_type_size, data_size);
|
||||
|
||||
ui_signal_set_text(text_view, "\n", 1);
|
||||
ui_signal_set_text(text_view, data, data_size);
|
||||
} else {
|
||||
/* Dissect the signal */
|
||||
CHECK_FCT_DO(dissect_signal((buffer_t*)buffer, ui_signal_set_text, text_view), return FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
Reference in New Issue
Block a user