add new function dissect_dcerpc_uuid_t and let dissect_ndr_uuid_t call it

svn path=/trunk/; revision=13006
This commit is contained in:
Ulf Lamping 2005-01-12 21:20:50 +00:00
parent 24c519ca86
commit aa139758f9
4 changed files with 60 additions and 78 deletions

View File

@ -192,10 +192,7 @@ dissect_ndr_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, guint8 *drep,
int hfindex, e_uuid_t *pdata)
{
e_uuid_t uuid;
dcerpc_info *di;
char uuid_str[DCERPC_UUID_STR_LEN];
int uuid_str_len;
di=pinfo->private_data;
if(di->conformant_run){
@ -207,31 +204,8 @@ dissect_ndr_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
if (offset % 4) {
offset += 4 - (offset % 4);
}
dcerpc_tvb_get_uuid (tvb, offset, drep, &uuid);
if (tree) {
/*
* XXX - look up the UUID to see if it's registered, and use
* the name of the protocol? Unfortunately, we need the version
* as well.
*/
uuid_str_len = snprintf(uuid_str, DCERPC_UUID_STR_LEN,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
uuid.Data1, uuid.Data2, uuid.Data3,
uuid.Data4[0], uuid.Data4[1],
uuid.Data4[2], uuid.Data4[3],
uuid.Data4[4], uuid.Data4[5],
uuid.Data4[6], uuid.Data4[7]);
if (uuid_str_len >= DCERPC_UUID_STR_LEN)
memset(uuid_str, 0, DCERPC_UUID_STR_LEN);
proto_tree_add_string_format (tree, hfindex, tvb, offset, 16,
uuid_str, "%s: %s",
proto_registrar_get_name(hfindex),
uuid_str);
}
if (pdata) {
*pdata = uuid;
}
return offset + 16;
return dissect_dcerpc_uuid_t (tvb, offset, pinfo,
tree, drep, hfindex, pdata);
}
/*

View File

@ -1088,6 +1088,60 @@ dissect_dcerpc_double(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_,
}
int
dissect_dcerpc_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, char *drep,
int hfindex, e_uuid_t *pdata)
{
e_uuid_t uuid;
header_field_info* hfi;
#if 0
gchar *uuid_name;
#endif
dcerpc_tvb_get_uuid (tvb, offset, drep, &uuid);
if (tree) {
/* get name of protocol field to prepend it later */
hfi = proto_registrar_get_nth(hfindex);
#if 0
/* XXX - get the name won't work correct, as we don't know the version of this uuid (if it has one) */
/* look for a registered uuid name */
uuid_name = dcerpc_get_uuid_name(&uuid, 0);
if (uuid_name) {
/* we know the name of this uuid */
proto_tree_add_string_format (tree, hfindex, tvb, offset, 16, "",
"%s: %s (%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
hfi->name, uuid_name,
uuid.Data1, uuid.Data2, uuid.Data3,
uuid.Data4[0], uuid.Data4[1],
uuid.Data4[2], uuid.Data4[3],
uuid.Data4[4], uuid.Data4[5],
uuid.Data4[6], uuid.Data4[7]);
} else {
#endif
/* we don't know the name of this uuid */
proto_tree_add_string_format (tree, hfindex, tvb, offset, 16, "",
"%s: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
hfi->name,
uuid.Data1, uuid.Data2, uuid.Data3,
uuid.Data4[0], uuid.Data4[1],
uuid.Data4[2], uuid.Data4[3],
uuid.Data4[4], uuid.Data4[5],
uuid.Data4[6], uuid.Data4[7]);
#if 0
}
#endif
}
if (pdata) {
*pdata = uuid;
}
return offset + 16;
}
/*
* a couple simpler things
*/

View File

@ -135,6 +135,10 @@ int dissect_dcerpc_double (tvbuff_t *tvb, gint offset, packet_info *pinfo,
int dissect_dcerpc_time_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, guint8 *drep,
int hfindex, guint32 *pdata);
int dissect_dcerpc_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, char *drep,
int hfindex, e_uuid_t *pdata);
/*
* NDR routines for subdissectors.
*/

View File

@ -670,56 +670,6 @@ gchar* dcom_uuid_to_str(e_uuid_t *uuid) {
}
#if 0
/* currently unused (do not remove) */
int
dissect_dcerpc_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, char *drep,
int hfindex, e_uuid_t *pdata)
{
e_uuid_t uuid;
gchar *uuid_name;
header_field_info* hfi;
dcerpc_tvb_get_uuid (tvb, offset, drep, &uuid);
if (tree) {
/* get name of protocol field to prepend it later */
hfi = proto_registrar_get_nth(hfindex);
/* look for a registered uuid name */
uuid_name = dcerpc_get_uuid_name(&uuid, 0);
if (uuid_name) {
/* we know the name of this uuid */
proto_tree_add_string_format (tree, hfindex, tvb, offset, 16, "",
"%s: %s (%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
hfi->name, uuid_name,
uuid.Data1, uuid.Data2, uuid.Data3,
uuid.Data4[0], uuid.Data4[1],
uuid.Data4[2], uuid.Data4[3],
uuid.Data4[4], uuid.Data4[5],
uuid.Data4[6], uuid.Data4[7]);
} else {
/* we don't know the name of this uuid */
proto_tree_add_string_format (tree, hfindex, tvb, offset, 16, "",
"%s: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
hfi->name,
uuid.Data1, uuid.Data2, uuid.Data3,
uuid.Data4[0], uuid.Data4[1],
uuid.Data4[2], uuid.Data4[3],
uuid.Data4[4], uuid.Data4[5],
uuid.Data4[6], uuid.Data4[7]);
}
}
if (pdata) {
*pdata = uuid;
}
return offset + 16;
}
#endif
/* dissect 64bits integer with alignment of 8 bytes (use this for VT_I8 type only) */
int
dissect_dcom_I8(tvbuff_t *tvb, gint offset, packet_info *pinfo,