From 7db8eea5c68284a468924639eecc2ca8959225d0 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 19 Mar 2006 20:45:45 +0000 Subject: Make the GUIDs in various data structures e_guid_t's rather than arrays of 16 bytes. Use "sizeof" for the size of e_guid_t's, and use structure assignment to copy GUID values. Make functions such as append_h225ras_call() and new_h225ras_call() take pointers to e_guid_t's as arguments. Define GUID_LEN in epan/guid-utils.h and use it as the length of a GUID in a packet. (Note that "sizeof e_guid_t" is not guaranteed to be 16, although it is guaranteed to be the size of an e_guid_t.) When constructing a display filter that matches a GUID, use guid_to_str() to construct the string for the GUID. svn path=/trunk/; revision=17676 --- asn1/h225/h225.cnf | 4 ++-- asn1/h225/packet-h225-template.c | 10 +++++----- asn1/h225/packet-h225-template.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'asn1') diff --git a/asn1/h225/h225.cnf b/asn1/h225/h225.cnf index 8d952da369..784dc92a03 100644 --- a/asn1/h225/h225.cnf +++ b/asn1/h225/h225.cnf @@ -449,8 +449,8 @@ ReleaseCompleteReason VAL_PTR = &value #.FN_BODY CallIdentifier/guid tvbuff_t *guid_tvb; - offset = dissect_per_octet_string(tvb,offset,pinfo,tree,hf_index,16,16,&guid_tvb); - tvb_memcpy(guid_tvb,h225_pi->guid,0,tvb_length(guid_tvb)); + offset = dissect_per_octet_string(tvb,offset,pinfo,tree,hf_index,GUID_LEN,GUID_LEN,&guid_tvb); + tvb_memcpy(guid_tvb,(guint8 *)&h225_pi->guid,0,GUID_LEN); #.END #---------------------------------------------------------------------------------------- #.FN_PARS RequestSeqNum VAL_PTR = &(h225_pi->requestSeqNum) diff --git a/asn1/h225/packet-h225-template.c b/asn1/h225/packet-h225-template.c index 194320ee76..f9a342f554 100644 --- a/asn1/h225/packet-h225-template.c +++ b/asn1/h225/packet-h225-template.c @@ -378,7 +378,7 @@ static void reset_h225_packet_info(h225_packet_info *pi) pi->msg_tag = -1; pi->reason = -1; pi->requestSeqNum = 0; - memset(pi->guid,0,16); + memset(&pi->guid,0,sizeof pi->guid); pi->is_duplicate = FALSE; pi->request_available = FALSE; pi->is_faststart = FALSE; @@ -477,7 +477,7 @@ static void ras_call_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre and last request occured more than 1800 seconds ago, we decide that we have a new request */ /* Append new ras call to list */ - h225ras_call = append_h225ras_call(h225ras_call, pinfo, pi->guid, msg_category); + h225ras_call = append_h225ras_call(h225ras_call, pinfo, &pi->guid, msg_category); } else { /* No, so it's a duplicate request. Mark it as such. */ @@ -490,7 +490,7 @@ static void ras_call_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre } while (h225ras_call != NULL ); } else { - h225ras_call = new_h225ras_call(&h225ras_call_key, pinfo, pi->guid, msg_category); + h225ras_call = new_h225ras_call(&h225ras_call_key, pinfo, &pi->guid, msg_category); } /* add link to response frame, if available */ @@ -531,8 +531,8 @@ static void ras_call_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre /* if this is an ACF, ARJ or DCF, DRJ, give guid to tap and make it filterable */ if (msg_category == 3 || msg_category == 5) { - memcpy(pi->guid, h225ras_call->guid,16); - proto_tree_add_guid_hidden(tree, hf_h225_guid, tvb, 0, 16, pi->guid); + pi->guid = h225ras_call->guid; + proto_tree_add_guid_hidden(tree, hf_h225_guid, tvb, 0, GUID_LEN, &pi->guid); } if (h225ras_call->rsp_num == 0) { diff --git a/asn1/h225/packet-h225-template.h b/asn1/h225/packet-h225-template.h index a456ce7b69..e2387c5ae5 100644 --- a/asn1/h225/packet-h225-template.h +++ b/asn1/h225/packet-h225-template.h @@ -55,7 +55,7 @@ typedef struct _h225_packet_info { gint msg_tag; /* message tag*/ gint reason; /* reason tag, if available */ guint requestSeqNum; /* request sequence number of ras-message, if available */ - guint8 guid[16]; /* globally unique call id */ + e_guid_t guid; /* globally unique call id */ gboolean is_duplicate; /* true, if this is a repeated message */ gboolean request_available; /* true, if response matches to a request */ nstime_t delta_time; /* this is the RAS response time delay */ -- cgit v1.2.3