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
This commit is contained in:
winckel
2013-12-04 18:05:46 +00:00
parent c8fa1f9553
commit b91ab12102
3 changed files with 39 additions and 5 deletions
@@ -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);