static int dissect_dtpt_guid(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex) { guint32 guid_length; guid_length = tvb_get_letohl(tvb, offset); if (tree) { e_guid_t guid; proto_item *dtpt_guid_item = NULL; proto_tree *dtpt_guid_tree = NULL; const gchar *guid_name = NULL; if (guid_length) { tvb_get_guid(tvb, offset+4, &guid, ENC_LITTLE_ENDIAN); } else { memset(&guid, 0, sizeof(guid)); } dtpt_guid_item = proto_tree_add_guid(tree, hfindex, tvb, offset, 4 + guid_length, &guid); if (dtpt_guid_item) { guid_name = guids_get_guid_name(&guid); if (guid_name != NULL) proto_item_set_text(dtpt_guid_item, "%s: %s (%s)", proto_registrar_get_name(hfindex), guid_name, guid_to_str(&guid)); dtpt_guid_tree = proto_item_add_subtree(dtpt_guid_item, ett_dtpt_guid); } if (dtpt_guid_tree) { proto_item *dtpt_guid_data_item = NULL; proto_tree_add_uint(dtpt_guid_tree, hf_dtpt_guid_length, tvb, offset, 4, guid_length); if (guid_length) { dtpt_guid_data_item = proto_tree_add_guid(dtpt_guid_tree, hf_dtpt_guid_data, tvb, offset+4, guid_length, &guid); if (guid_name != NULL && dtpt_guid_data_item != NULL) { proto_item_set_text(dtpt_guid_data_item, "%s: %s (%s)", proto_registrar_get_name(hf_dtpt_guid_data), guid_name, guid_to_str(&guid)); } } } } offset+=4; offset+=guid_length; return offset; }
/* Tries to match a guid against its name. Returns the associated string ptr on a match. Formats uuid number and returns the resulting string, if name is unknown. (derived from val_to_str) */ const gchar * guids_resolve_guid_to_str(e_guid_t *guid) { const gchar *name; name=guids_get_guid_name(guid); if(name){ return name; } return ep_strdup_printf("%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", guid->data1, guid->data2, guid->data3, guid->data4[0], guid->data4[1], guid->data4[2], guid->data4[3], guid->data4[4], guid->data4[5], guid->data4[6], guid->data4[7]); }