From Lars Ruoff (who also contributed the previous change; my apologies
[obnox/wireshark/wip.git] / packet-afs-macros.h
index 52fa87dbe182f7dde2d41bd31ced6a7ec902f8ed..2c06a39ce119e47eb6897927e8ddbee3fc6475c7 100644 (file)
@@ -6,9 +6,9 @@
  * Portions based on information retrieved from the RX definitions
  *   in Arla, the free AFS client at http://www.stacken.kth.se/project/arla/
  * Portions based on information/specs retrieved from the OpenAFS sources at
- *   www.openafs.org, Copyright IBM. 
+ *   www.openafs.org, Copyright IBM.
  *
- * $Id: packet-afs-macros.h,v 1.17 2002/02/08 22:36:21 nneul Exp $
+ * $Id: packet-afs-macros.h,v 1.23 2004/01/19 18:36:32 jmayer Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
 #define OUT_INT(field) \
        proto_tree_add_int(tree, field, tvb, offset, sizeof(gint32), tvb_get_ntohl(tvb, offset)); \
        offset += 4;
-       
+
 /* Output a unsigned integer, stored into field 'field'
-   Assumes it is in network byte order, converts to host before using, 
+   Assumes it is in network byte order, converts to host before using,
    Note - does not increment offset, so can be used repeatedly for bitfields */
 #define DISP_UINT(field) \
-       proto_tree_add_uint(tree,field,tvb,offset,sizeof(guint32),tvb_get_ntohl(tvb, offset)); 
+       proto_tree_add_uint(tree,field,tvb,offset,sizeof(guint32),tvb_get_ntohl(tvb, offset));
 
 /* Output an IPv4 address, stored into field 'field' */
 #define OUT_IP(field) \
        offset += 8; \
        }
 
-/* Output a UNIX seconds-only timestamp, after converting to an nstime_t */
-#define OUT_DATE(field) \
+/* Output a seconds-only time value, after converting to an nstime_t;
+   this can be an absolute time as a UNIX time-since-epoch, or a
+   relative time in seconds */
+#define OUT_TIMESECS(field) \
        { nstime_t ts; \
        ts.secs = tvb_get_ntohl(tvb, offset); \
        ts.nsecs = 0; \
        offset += 4; \
        }
 
-/* Output a rx style string, up to a maximum length first 
+/* Output a rx style string, up to a maximum length first
    4 bytes - length, then char data */
 #define OUT_RXString(field) \
-       {       int i,len; \
+       {       guint32 i,len; \
                char *tmp; \
+               const guint8 *p; \
                i = tvb_get_ntohl(tvb, offset); \
                offset += 4; \
+               p = tvb_get_ptr(tvb,offset,i); \
                len = ((i+4-1)/4)*4; \
                tmp = g_malloc(i+1); \
-               memcpy(tmp, tvb_get_ptr(tvb,offset,i), i); \
+               memcpy(tmp, p, i); \
                tmp[i] = '\0'; \
                proto_tree_add_string(tree, field, tvb, offset-4, len+4, \
                (void *)tmp); \
                save = tree; \
                tree = proto_item_add_subtree(ti, ett_afs_callback); \
                OUT_UINT(hf_afs_fs_callback_version); \
-               OUT_DATE(hf_afs_fs_callback_expires); \
+               OUT_TIMESECS(hf_afs_fs_callback_expires); \
                OUT_UINT(hf_afs_fs_callback_type); \
                tree = save; \
        }
                save = tree; \
                tree = proto_item_add_subtree(ti, ett_afs_callback); \
                OUT_UINT(hf_afs_cb_callback_version); \
-               OUT_DATE(hf_afs_cb_callback_expires); \
+               OUT_TIMESECS(hf_afs_cb_callback_expires); \
                OUT_UINT(hf_afs_cb_callback_type); \
                tree = save; \
        }
                        sizeof(guint32), mask); \
                save = tree; \
                tree = proto_item_add_subtree(ti, ett_afs_status_mask); \
-               proto_tree_add_uint(tree, hf_afs_fs_status_mask_setmodtime, \
+               proto_tree_add_boolean(tree, hf_afs_fs_status_mask_setmodtime, \
                        tvb,offset,sizeof(guint32), mask); \
-               proto_tree_add_uint(tree, hf_afs_fs_status_mask_setowner, \
+               proto_tree_add_boolean(tree, hf_afs_fs_status_mask_setowner, \
                        tvb,offset,sizeof(guint32), mask); \
-               proto_tree_add_uint(tree, hf_afs_fs_status_mask_setgroup, \
+               proto_tree_add_boolean(tree, hf_afs_fs_status_mask_setgroup, \
                        tvb,offset,sizeof(guint32), mask); \
-               proto_tree_add_uint(tree, hf_afs_fs_status_mask_setmode, \
+               proto_tree_add_boolean(tree, hf_afs_fs_status_mask_setmode, \
                        tvb,offset,sizeof(guint32), mask); \
-               proto_tree_add_uint(tree, hf_afs_fs_status_mask_setsegsize, \
+               proto_tree_add_boolean(tree, hf_afs_fs_status_mask_setsegsize, \
                        tvb,offset,sizeof(guint32), mask); \
-               proto_tree_add_uint(tree, hf_afs_fs_status_mask_fsync, \
+               proto_tree_add_boolean(tree, hf_afs_fs_status_mask_fsync, \
                        tvb,offset,sizeof(guint32), mask); \
                offset += 4; \
                tree = save; \
                        sizeof(guint32), flags); \
                save = tree; \
                tree = proto_item_add_subtree(ti, ett_afs_vldb_flags); \
-               proto_tree_add_uint(tree, hf_afs_vldb_flags_rwexists, \
+               proto_tree_add_boolean(tree, hf_afs_vldb_flags_rwexists, \
                        tvb,offset,sizeof(guint32), flags); \
-               proto_tree_add_uint(tree, hf_afs_vldb_flags_roexists, \
+               proto_tree_add_boolean(tree, hf_afs_vldb_flags_roexists, \
                        tvb,offset,sizeof(guint32), flags); \
-               proto_tree_add_uint(tree, hf_afs_vldb_flags_bkexists, \
+               proto_tree_add_boolean(tree, hf_afs_vldb_flags_bkexists, \
                        tvb,offset,sizeof(guint32), flags); \
-               proto_tree_add_uint(tree, hf_afs_vldb_flags_dfsfileset, \
+               proto_tree_add_boolean(tree, hf_afs_vldb_flags_dfsfileset, \
                        tvb,offset,sizeof(guint32), flags); \
                offset += 4; \
                tree = save; \
                OUT_UINT(hf_afs_cb_fid_uniqifier); \
                tree = save; \
        }
-       
+
 /* Output a StoreStatus */
 #define OUT_FS_AFSStoreStatus(label) \
        {       proto_tree *save, *ti; \
                save = tree; \
                tree = proto_item_add_subtree(ti, ett_afs_status); \
                OUT_FS_STATUSMASK(); \
-               OUT_DATE(hf_afs_fs_status_clientmodtime); \
+               OUT_TIMESECS(hf_afs_fs_status_clientmodtime); \
                OUT_UINT(hf_afs_fs_status_owner); \
                OUT_UINT(hf_afs_fs_status_group); \
                OUT_UINT(hf_afs_fs_status_mode); \
                OUT_UINT(hf_afs_fs_status_parentvnode); \
                OUT_UINT(hf_afs_fs_status_parentunique); \
                OUT_UINT(hf_afs_fs_status_segsize); \
-               OUT_DATE(hf_afs_fs_status_clientmodtime); \
-               OUT_DATE(hf_afs_fs_status_servermodtime); \
+               OUT_TIMESECS(hf_afs_fs_status_clientmodtime); \
+               OUT_TIMESECS(hf_afs_fs_status_servermodtime); \
                OUT_UINT(hf_afs_fs_status_group); \
                OUT_UINT(hf_afs_fs_status_synccounter); \
                OUT_UINT(hf_afs_fs_status_dataversionhigh); \
                        "VolSync"); \
                save = tree; \
                tree = proto_item_add_subtree(ti, ett_afs_volsync); \
-               OUT_DATE(hf_afs_fs_volsync_spare1); \
+               OUT_TIMESECS(hf_afs_fs_volsync_spare1); \
                OUT_UINT(hf_afs_fs_volsync_spare2); \
                OUT_UINT(hf_afs_fs_volsync_spare3); \
                OUT_UINT(hf_afs_fs_volsync_spare4); \
                proto_tree_add_string(tree,hf_afs_fs_acl_entity, tvb,offset,strlen(who), who);\
                tmpoffset = offset + strlen(who) + 1; \
                acllen = bytes - strlen(who) - 1; \
-               proto_tree_add_uint(tree,hf_afs_fs_acl_r, tvb,tmpoffset,acllen,acl);\
-               proto_tree_add_uint(tree,hf_afs_fs_acl_l, tvb,tmpoffset,acllen,acl);\
-               proto_tree_add_uint(tree,hf_afs_fs_acl_i, tvb,tmpoffset,acllen,acl);\
-               proto_tree_add_uint(tree,hf_afs_fs_acl_d, tvb,tmpoffset,acllen,acl);\
-               proto_tree_add_uint(tree,hf_afs_fs_acl_w, tvb,tmpoffset,acllen,acl);\
-               proto_tree_add_uint(tree,hf_afs_fs_acl_k, tvb,tmpoffset,acllen,acl);\
-               proto_tree_add_uint(tree,hf_afs_fs_acl_a, tvb,tmpoffset,acllen,acl);\
+               proto_tree_add_boolean(tree,hf_afs_fs_acl_r, tvb,tmpoffset,acllen,acl);\
+               proto_tree_add_boolean(tree,hf_afs_fs_acl_l, tvb,tmpoffset,acllen,acl);\
+               proto_tree_add_boolean(tree,hf_afs_fs_acl_i, tvb,tmpoffset,acllen,acl);\
+               proto_tree_add_boolean(tree,hf_afs_fs_acl_d, tvb,tmpoffset,acllen,acl);\
+               proto_tree_add_boolean(tree,hf_afs_fs_acl_w, tvb,tmpoffset,acllen,acl);\
+               proto_tree_add_boolean(tree,hf_afs_fs_acl_k, tvb,tmpoffset,acllen,acl);\
+               proto_tree_add_boolean(tree,hf_afs_fs_acl_a, tvb,tmpoffset,acllen,acl);\
                tree = save; \
        }
 
 
 #define OUT_UBIK_DebugOld() \
        { \
-               OUT_DATE(hf_afs_ubik_now); \
-               OUT_DATE(hf_afs_ubik_lastyestime); \
+               OUT_TIMESECS(hf_afs_ubik_now); \
+               OUT_TIMESECS(hf_afs_ubik_lastyestime); \
                OUT_IP(hf_afs_ubik_lastyeshost); \
                OUT_UINT(hf_afs_ubik_lastyesstate); \
-               OUT_DATE(hf_afs_ubik_lastyesclaim); \
+               OUT_TIMESECS(hf_afs_ubik_lastyesclaim); \
                OUT_IP(hf_afs_ubik_lowesthost); \
-               OUT_DATE(hf_afs_ubik_lowesttime); \
+               OUT_TIMESECS(hf_afs_ubik_lowesttime); \
                OUT_IP(hf_afs_ubik_synchost); \
-               OUT_DATE(hf_afs_ubik_synctime); \
+               OUT_TIMESECS(hf_afs_ubik_synctime); \
                OUT_UBIKVERSION("Sync Version"); \
                OUT_UBIKVERSION("Sync TID"); \
                OUT_UINT(hf_afs_ubik_amsyncsite); \
-               OUT_DATE(hf_afs_ubik_syncsiteuntil); \
+               OUT_TIMESECS(hf_afs_ubik_syncsiteuntil); \
                OUT_UINT(hf_afs_ubik_nservers); \
                OUT_UINT(hf_afs_ubik_lockedpages); \
                OUT_UINT(hf_afs_ubik_writelockedpages); \
                OUT_UINT(hf_afs_ubik_recoverystate); \
                OUT_UINT(hf_afs_ubik_currenttrans); \
                OUT_UINT(hf_afs_ubik_writetrans); \
-               OUT_DATE(hf_afs_ubik_epochtime); \
+               OUT_TIMESECS(hf_afs_ubik_epochtime); \
        }
 
 #define OUT_UBIK_SDebugOld() \
        { \
                OUT_IP(hf_afs_ubik_addr); \
-               OUT_DATE(hf_afs_ubik_lastvotetime); \
-               OUT_DATE(hf_afs_ubik_lastbeaconsent); \
+               OUT_TIMESECS(hf_afs_ubik_lastvotetime); \
+               OUT_TIMESECS(hf_afs_ubik_lastbeaconsent); \
                OUT_UINT(hf_afs_ubik_lastvote); \
                OUT_UBIKVERSION("Remote Version"); \
                OUT_UINT(hf_afs_ubik_currentdb); \
 /* Skip a certain number of bytes */
 #define SKIP(bytes) \
        offset += bytes;
-       
+
 /* Raw data - to end of frame */
 #define OUT_BYTES_ALL(field) OUT_BYTES(field, tvb_length_remaining(tvb,offset))
 
                        sizeof(guint32),counter); \
                tree = save; \
        }
+
+/* Output a kauth getticket request */
+#define OUT_KAUTH_GetTicket() \
+       { \
+               int len = 0; \
+               OUT_UINT(hf_afs_kauth_kvno); \
+               OUT_RXString(hf_afs_kauth_domain); \
+               len = tvb_get_ntohl(tvb, offset); \
+               offset += 4; \
+               OUT_BYTES(hf_afs_kauth_data, len); \
+               OUT_RXString(hf_afs_kauth_princ); \
+               OUT_RXString(hf_afs_kauth_realm); \
+       }
+