Commit b91ab121 authored by winckel's avatar winckel

Changed the way some fields are located (children rather than next).

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4598 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent c8fa1f95
......@@ -825,13 +825,13 @@ static int xml_parse_doc(xmlDocPtr doc) {
CHECK_FCT(locate_type("ittiMsg", xml_head, &message_type));
/* Locate the origin task id field */
CHECK_FCT(locate_type("originTaskId", message_header_type, &origin_task_id_type));
CHECK_FCT(locate_type_children("originTaskId", message_header_type->child->child, &origin_task_id_type));
/* Locate the destination task id field */
CHECK_FCT(locate_type("destinationTaskId", message_header_type, &destination_task_id_type));
CHECK_FCT(locate_type_children("destinationTaskId", message_header_type->child->child, &destination_task_id_type));
/* Locate the instance field */
CHECK_FCT(locate_type("instance", message_header_type, &instance_type));
CHECK_FCT(locate_type_children("instance", message_header_type->child->child, &instance_type));
/* Locate the message size field */
CHECK_FCT(locate_type("ittiMsgSize", message_header_type, &message_size_type));
CHECK_FCT(locate_type_children("ittiMsgSize", message_header_type->child->child, &message_size_type));
// root->type_hr_display(root, 0);
......
......@@ -84,13 +84,45 @@ int locate_type(const char *type_name, types_t *head, types_t **type) {
}
next_counter ++;
}
g_info("locate_type: %s %d", type_name, next_counter);
g_info("locate_type: %s %d %p", type_name, next_counter, next_type);
if (type)
*type = next_type;
return (next_type == NULL) ? RC_FAIL : RC_OK;
}
int locate_type_children(const char *type_name, types_t *head, types_t **type) {
types_t *found_type = NULL;
int i;
/* The root element is for example : MessageDef.
* This element is the entry for other sub-types.
*/
if (!type_name) {
g_warning("FATAL: no element name provided");
return RC_BAD_PARAM;
}
if (!head) {
g_warning("Empty list detected");
return RC_BAD_PARAM;
}
for (i = 0; i < head->nb_members; i++) {
if (head->members_child[i]->name == NULL)
continue;
if (strcmp (type_name, head->members_child[i]->name) == 0) {
/* Matching reference */
found_type = head->members_child[i];
break;
}
}
g_info("locate_type: %s %d %p", type_name, i, found_type);
if (type)
*type = found_type;
return (found_type == NULL) ? RC_FAIL : RC_OK;
}
uint32_t get_message_header_type_size(void)
{
/* Typedef */
......
......@@ -16,6 +16,8 @@ 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 locate_type_children(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);
......
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