- itti_analyzer v0.2:

* Moved all GUI calls to main thread
	* Refine socket interface
	* Added origin/destination task id on message display list

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4258 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
Cedric Roux
2013-10-22 13:42:39 +00:00
parent 3dc3d6ae45
commit ecf07e3805
22 changed files with 890 additions and 420 deletions
@@ -6,9 +6,15 @@
#include "rc.h"
#include "types.h"
#include "enum_type.h"
#include "locate_root.h"
#include "xml_parse.h"
int locate_root(const char *root_name, types_t *head, types_t **root) {
types_t *messages_id_enum = NULL;
types_t *origin_task_id_type = NULL;
types_t *destination_task_id_type = NULL;
int locate_root(const char *root_name, types_t *head, types_t **root_elm) {
types_t *next_type;
/* The root element is for example : MessageDef.
@@ -22,7 +28,7 @@ int locate_root(const char *root_name, types_t *head, types_t **root) {
g_warning("Empty list detected");
return -1;
}
if (!root) {
if (!root_elm) {
g_warning("NULL root reference");
return -1;
}
@@ -35,7 +41,7 @@ int locate_root(const char *root_name, types_t *head, types_t **root) {
break;
}
}
*root = next_type;
*root_elm = next_type;
return (next_type == NULL) ? -2 : 0;
}
@@ -46,7 +52,7 @@ int locate_type(const char *type_name, types_t *head, types_t **type) {
* This element is the entry for other sub-types.
*/
if (!type_name) {
g_warning("FATAL: no root element name provided");
g_warning("FATAL: no element name provided");
return RC_BAD_PARAM;
}
if (!head) {
@@ -69,16 +75,46 @@ int locate_type(const char *type_name, types_t *head, types_t **type) {
int get_message_id(types_t *head, buffer_t *buffer, uint32_t *message_id) {
uint32_t value;
types_t *type_message_id;
if (!head || !message_id || !buffer)
return RC_BAD_PARAM;
CHECK_FCT(locate_type("messageId", head, &type_message_id));
g_assert(message_id != NULL);
g_assert(buffer != NULL);
/* MessageId is an offset from start of buffer */
value = buffer_get_uint32_t (buffer, type_message_id->offset);
value = buffer_get_uint32_t(buffer, messages_id_enum->offset);
*message_id = value;
return RC_OK;
}
char *get_origin_task_id(buffer_t *buffer) {
char *origin_task_id = "UNKNOWN";
uint32_t origin_task_id_value;
/* Fetch task id value */
if (buffer_fetch_bits(buffer, origin_task_id_type->offset,
origin_task_id_type->child->size, &origin_task_id_value) == RC_OK) {
origin_task_id = enum_type_get_name_from_value(origin_task_id_type->child,
origin_task_id_value);
}
return origin_task_id;
}
char *get_destination_task_id(buffer_t *buffer) {
char *destination_task_id = "UNKNOWN";
uint32_t destination_task_id_value;
/* Fetch task id value */
if (buffer_fetch_bits(buffer, destination_task_id_type->offset,
destination_task_id_type->child->size, &destination_task_id_value) == RC_OK) {
destination_task_id = enum_type_get_name_from_value(destination_task_id_type->child,
destination_task_id_value);
}
return destination_task_id;
}
char *message_id_to_string(uint32_t message_id)
{
return enum_type_get_name_from_value(messages_id_enum, message_id);
}
@@ -1,10 +1,20 @@
#ifndef LOCATE_ROOT_H_
#define LOCATE_ROOT_H_
extern types_t *messages_id_enum;
extern types_t *origin_task_id_type;
extern types_t *destination_task_id_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);
int get_message_id(types_t *head, buffer_t *buffer, uint32_t *message_id);
char *message_id_to_string(uint32_t message_id);
char *get_origin_task_id(buffer_t *buffer);
char *get_destination_task_id(buffer_t *buffer);
#endif /* LOCATE_ROOT_H_ */