diff options
author | Nathan Neulinger <nneul@umr.edu> | 2002-02-08 22:36:21 +0000 |
---|---|---|
committer | Nathan Neulinger <nneul@umr.edu> | 2002-02-08 22:36:21 +0000 |
commit | 089a32b1ebc6cb890ba274378d3330da9bb3c964 (patch) | |
tree | 3c6925d3cc18d72d50a1ffbb0a740331f6f8155c /packet-afs-macros.h | |
parent | 2f3a001d65c1fba9b57d0626dfa907e8f53d759f (diff) | |
download | wireshark-089a32b1ebc6cb890ba274378d3330da9bb3c964.tar.gz wireshark-089a32b1ebc6cb890ba274378d3330da9bb3c964.tar.bz2 wireshark-089a32b1ebc6cb890ba274378d3330da9bb3c964.zip |
rename some macros, start getting rid of redundant macros, add more vldb dissection
svn path=/trunk/; revision=4711
Diffstat (limited to 'packet-afs-macros.h')
-rw-r--r-- | packet-afs-macros.h | 145 |
1 files changed, 72 insertions, 73 deletions
diff --git a/packet-afs-macros.h b/packet-afs-macros.h index d93558fd27..52fa87dbe1 100644 --- a/packet-afs-macros.h +++ b/packet-afs-macros.h @@ -8,7 +8,7 @@ * Portions based on information/specs retrieved from the OpenAFS sources at * www.openafs.org, Copyright IBM. * - * $Id: packet-afs-macros.h,v 1.16 2002/02/03 20:48:07 guy Exp $ + * $Id: packet-afs-macros.h,v 1.17 2002/02/08 22:36:21 nneul Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -66,6 +66,28 @@ tvb_get_letohl(tvb, offset));\ offset += 4; +/* Output a simple rx array */ +#define OUT_RXArray8(func) \ + { \ + unsigned int j,i; \ + j = tvb_get_guint8(tvb, offset); \ + offset += 1; \ + for (i=0; i<j; i++) { \ + func; \ + } \ + } + +/* Output a simple rx array */ +#define OUT_RXArray32(func) \ + { \ + unsigned int j,i; \ + j = tvb_get_ntohl(tvb, offset); \ + offset += sizeof(guint32); \ + for (i=0; i<j; i++) { \ + func; \ + } \ + } + /* Output a UNIX seconds/microseconds timestamp, after converting to an nstime_t */ #define OUT_TIMESTAMP(field) \ @@ -85,6 +107,38 @@ offset += 4; \ } +/* Output a rx style string, up to a maximum length first + 4 bytes - length, then char data */ +#define OUT_RXString(field) \ + { int i,len; \ + char *tmp; \ + i = tvb_get_ntohl(tvb, offset); \ + offset += 4; \ + len = ((i+4-1)/4)*4; \ + tmp = g_malloc(i+1); \ + memcpy(tmp, tvb_get_ptr(tvb,offset,i), i); \ + tmp[i] = '\0'; \ + proto_tree_add_string(tree, field, tvb, offset-4, len+4, \ + (void *)tmp); \ + g_free(tmp); \ + offset += len; \ + } + +/* Output a fixed length vectorized string (each char is a 32 bit int) */ +#define OUT_RXStringV(field, length) \ + { char tmp[length+1]; \ + int i,soff; \ + soff = offset;\ + for (i=0; i<length; i++)\ + {\ + tmp[i] = (char) tvb_get_ntohl(tvb, offset);\ + offset += sizeof(guint32);\ + }\ + tmp[length] = '\0';\ + proto_tree_add_string(tree, field, tvb, soff, length*sizeof(guint32), tmp);\ + } + + /* Output a callback */ #define OUT_FS_AFSCallBack() \ { proto_tree *save, *ti; \ @@ -109,7 +163,6 @@ tree = save; \ } - /* Output a File ID */ #define OUT_FS_AFSFid(label) \ { proto_tree *save, *ti; \ @@ -249,59 +302,23 @@ /* Output a AFSCBFids */ #define OUT_FS_AFSCBFids() \ - { \ - guint32 j,i; \ - j = tvb_get_ntohl(tvb, offset); \ - offset += 4; \ - for (i=0; i<j; i++) { \ - OUT_FS_AFSFid("Target"); \ - } \ - } + OUT_RXArray32(OUT_FS_AFSFid("Target")); /* Output a ViceIds */ #define OUT_FS_ViceIds() \ - { \ - unsigned int j,i; \ - j = tvb_get_guint8(tvb,offset); \ - offset += 1; \ - for (i=0; i<j; i++) { \ - OUT_UINT(hf_afs_fs_viceid); \ - } \ - } + OUT_RXArray8(OUT_UINT(hf_afs_fs_viceid)); /* Output a IPAddrs */ #define OUT_FS_IPAddrs() \ - { \ - unsigned int j,i; \ - j = tvb_get_guint8(tvb, offset); \ - offset += 1; \ - for (i=0; i<j; i++) { \ - OUT_IP(hf_afs_fs_ipaddr); \ - } \ - } + OUT_RXArray8(OUT_IP(hf_afs_fs_ipaddr)); /* Output a AFSCBs */ #define OUT_FS_AFSCBs() \ - { \ - guint32 j,i; \ - j = tvb_get_ntohl(tvb,offset); \ - offset += 4; \ - for (i=0; i<j; i++) { \ - OUT_FS_AFSCallBack(); \ - } \ - } - + OUT_RXArray32(OUT_FS_AFSCallBack()); /* Output a AFSBulkStats */ #define OUT_FS_AFSBulkStats() \ - { \ - guint32 j,i; \ - j = tvb_get_ntohl(tvb,offset); \ - offset += 4; \ - for (i=0; i<j; i++) { \ - OUT_FS_AFSFetchStatus("Status"); \ - } \ - } + OUT_RXArray32(OUT_FS_AFSFetchStatus("Status")); /* Output a AFSFetchVolumeStatus */ #define OUT_FS_AFSFetchVolumeStatus() @@ -319,7 +336,7 @@ #define OUT_FS_VolumeInfo() /* Output an AFS Token - might just be bytes though */ -#define OUT_FS_AFSTOKEN() VECOUT(hf_afs_fs_token, 1024) +#define OUT_FS_AFSTOKEN() OUT_RXStringV(hf_afs_fs_token, 1024) /* Output a AFS acl */ #define ACLOUT(who, positive, acl, bytes) \ @@ -353,6 +370,17 @@ tree = save; \ } +/* Output a UUID */ +#define OUT_UUID(x) \ + OUT_BYTES(x, 11*sizeof(guint32)); +#define SKIP_UUID() \ + SKIP(11*sizeof(guint32)); + + +/* Output a bulkaddr */ +#define OUT_VLDB_BulkAddr() \ + OUT_RXArray32(OUT_IP(hf_afs_vldb_serverip)); + /* output a bozo_key */ #define OUT_BOS_KEY() \ OUT_BYTES(hf_afs_bos_key, 8); @@ -445,36 +473,7 @@ proto_tree_add_item(tree, field, tvb, offset, bytes, FALSE);\ offset += bytes; -/* Output a rx style string, up to a maximum length first - 4 bytes - length, then char data */ -#define OUT_STRING(field) \ - { int i,len; \ - char *tmp; \ - i = tvb_get_ntohl(tvb, offset); \ - offset += 4; \ - len = ((i+4-1)/4)*4; \ - tmp = g_malloc(i+1); \ - memcpy(tmp, tvb_get_ptr(tvb,offset,i), i); \ - tmp[i] = '\0'; \ - proto_tree_add_string(tree, field, tvb, offset-4, len+4, \ - (void *)tmp); \ - g_free(tmp); \ - offset += len; \ - } -/* Output a fixed length vectorized string (each char is a 32 bit int) */ -#define VECOUT(field, length) \ - { char tmp[length+1]; \ - int i,soff; \ - soff = offset;\ - for (i=0; i<length; i++)\ - {\ - tmp[i] = (char) tvb_get_ntohl(tvb, offset);\ - offset += sizeof(guint32);\ - }\ - tmp[length] = '\0';\ - proto_tree_add_string(tree, field, tvb, soff, length*sizeof(guint32), tmp);\ - } /* Skip the opcode */ #define SKIP_OPCODE() \ |