Fix various Visual C++ analysis warnings.
[metze/wireshark/wip.git] / epan / dissectors / packet-afs.c
1 /* packet-afs.c
2  * Routines for AFS packet dissection
3  * Copyright 1999, Nathan Neulinger <nneul@umr.edu>
4  * Based on routines from tcpdump patches by
5  *   Ken Hornstein <kenh@cmf.nrl.navy.mil>
6  * Portions based on information retrieved from the RX definitions
7  *   in Arla, the free AFS client at http://www.stacken.kth.se/project/arla/
8  * Portions based on information/specs retrieved from the OpenAFS sources at
9  *   www.openafs.org, Copyright IBM.
10  *
11  * $Id$
12  *
13  * Wireshark - Network traffic analyzer
14  * By Gerald Combs <gerald@wireshark.org>
15  * Copyright 1998 Gerald Combs
16  *
17  * Copied from packet-tftp.c
18  *
19  * This program is free software; you can redistribute it and/or
20  * modify it under the terms of the GNU General Public License
21  * as published by the Free Software Foundation; either version 2
22  * of the License, or (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program; if not, write to the Free Software
31  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
32  */
33
34 #ifdef HAVE_CONFIG_H
35 # include "config.h"
36 #endif
37
38 #include <stdio.h>
39
40 #include <string.h>
41 #include <glib.h>
42 #include <epan/packet.h>
43 #include <epan/conversation.h>
44 #include <epan/addr_resolv.h>
45 #include <epan/emem.h>
46 #include <epan/strutil.h>
47
48 #include "packet-rx.h"
49 #include "packet-afs.h"
50
51 static int proto_afs = -1;
52 static int hf_afs_fs = -1;
53 static int hf_afs_cb = -1;
54 static int hf_afs_prot = -1;
55 static int hf_afs_vldb = -1;
56 static int hf_afs_kauth = -1;
57 static int hf_afs_vol = -1;
58 static int hf_afs_error = -1;
59 static int hf_afs_bos = -1;
60 static int hf_afs_update = -1;
61 static int hf_afs_rmtsys = -1;
62 static int hf_afs_ubik = -1;
63 static int hf_afs_backup = -1;
64
65 static int hf_afs_fs_opcode = -1;
66 static int hf_afs_cb_opcode = -1;
67 static int hf_afs_prot_opcode = -1;
68 static int hf_afs_vldb_opcode = -1;
69 static int hf_afs_kauth_opcode = -1;
70 static int hf_afs_vol_opcode = -1;
71 static int hf_afs_error_opcode = -1;
72 static int hf_afs_bos_opcode = -1;
73 static int hf_afs_update_opcode = -1;
74 static int hf_afs_rmtsys_opcode = -1;
75 static int hf_afs_ubik_opcode = -1;
76 static int hf_afs_backup_opcode = -1;
77
78 static int hf_afs_fs_fid_volume = -1;
79 static int hf_afs_fs_fid_vnode = -1;
80 static int hf_afs_fs_fid_uniqifier = -1;
81 static int hf_afs_fs_offset = -1;
82 static int hf_afs_fs_length = -1;
83 static int hf_afs_fs_flength = -1;
84 static int hf_afs_fs_offset64 = -1;
85 static int hf_afs_fs_length64 = -1;
86 static int hf_afs_fs_flength64 = -1;
87 static int hf_afs_fs_errcode = -1;
88 static int hf_afs_fs_data = -1;
89 static int hf_afs_fs_name = -1;
90 static int hf_afs_fs_oldname = -1;
91 static int hf_afs_fs_newname = -1;
92 static int hf_afs_fs_symlink_name = -1;
93 static int hf_afs_fs_symlink_content = -1;
94 static int hf_afs_fs_volid = -1;
95 static int hf_afs_fs_volname = -1;
96 static int hf_afs_fs_timestamp = -1;
97 static int hf_afs_fs_offlinemsg = -1;
98 static int hf_afs_fs_motd = -1;
99 static int hf_afs_fs_xstats_version = -1;
100 static int hf_afs_fs_xstats_timestamp = -1;
101 static int hf_afs_fs_xstats_clientversion = -1;
102 static int hf_afs_fs_xstats_collnumber = -1;
103 static int hf_afs_fs_cps_spare1 = -1;
104 static int hf_afs_fs_cps_spare2 = -1;
105 static int hf_afs_fs_cps_spare3 = -1;
106 static int hf_afs_fs_vicelocktype = -1;
107 static int hf_afs_fs_viceid = -1;
108 static int hf_afs_fs_ipaddr = -1;
109 static int hf_afs_fs_token = -1;
110
111 static int hf_afs_fs_status_anonymousaccess = -1;
112 static int hf_afs_fs_status_author = -1;
113 static int hf_afs_fs_status_calleraccess = -1;
114 static int hf_afs_fs_status_clientmodtime = -1;
115 static int hf_afs_fs_status_dataversion = -1;
116 static int hf_afs_fs_status_dataversionhigh = -1;
117 static int hf_afs_fs_status_filetype = -1;
118 static int hf_afs_fs_status_group = -1;
119 static int hf_afs_fs_status_interfaceversion = -1;
120 static int hf_afs_fs_status_length = -1;
121 static int hf_afs_fs_status_linkcount = -1;
122 static int hf_afs_fs_status_mask = -1;
123 static int hf_afs_fs_status_mask_fsync = -1;
124 static int hf_afs_fs_status_mask_setgroup = -1;
125 static int hf_afs_fs_status_mask_setmode = -1;
126 static int hf_afs_fs_status_mask_setmodtime = -1;
127 static int hf_afs_fs_status_mask_setowner = -1;
128 static int hf_afs_fs_status_mask_setsegsize = -1;
129 static int hf_afs_fs_status_mode = -1;
130 static int hf_afs_fs_status_owner = -1;
131 static int hf_afs_fs_status_parentunique = -1;
132 static int hf_afs_fs_status_parentvnode = -1;
133 static int hf_afs_fs_status_segsize = -1;
134 static int hf_afs_fs_status_servermodtime = -1;
135 static int hf_afs_fs_status_spare2 = -1;
136 static int hf_afs_fs_status_spare3 = -1;
137 static int hf_afs_fs_status_spare4 = -1;
138 static int hf_afs_fs_status_synccounter = -1;
139
140 static int hf_afs_fs_volsync_spare1 = -1;
141 static int hf_afs_fs_volsync_spare2 = -1;
142 static int hf_afs_fs_volsync_spare3 = -1;
143 static int hf_afs_fs_volsync_spare4 = -1;
144 static int hf_afs_fs_volsync_spare5 = -1;
145 static int hf_afs_fs_volsync_spare6 = -1;
146
147 static int hf_afs_fs_acl_datasize = -1;
148 static int hf_afs_fs_acl_count_negative = -1;
149 static int hf_afs_fs_acl_count_positive = -1;
150 static int hf_afs_fs_acl_entity = -1;
151 static int hf_afs_fs_acl_r = -1;
152 static int hf_afs_fs_acl_l = -1;
153 static int hf_afs_fs_acl_i = -1;
154 static int hf_afs_fs_acl_d = -1;
155 static int hf_afs_fs_acl_w = -1;
156 static int hf_afs_fs_acl_k = -1;
157 static int hf_afs_fs_acl_a = -1;
158
159 static int hf_afs_fs_callback_version = -1;
160 static int hf_afs_fs_callback_expires = -1;
161 static int hf_afs_fs_callback_type = -1;
162
163 static int hf_afs_bos_errcode = -1;
164 static int hf_afs_bos_type = -1;
165 static int hf_afs_bos_instance = -1;
166 static int hf_afs_bos_status = -1;
167 static int hf_afs_bos_statusdesc = -1;
168 static int hf_afs_bos_num = -1;
169 static int hf_afs_bos_size = -1;
170 static int hf_afs_bos_flags = -1;
171 static int hf_afs_bos_date = -1;
172 static int hf_afs_bos_content = -1;
173 static int hf_afs_bos_user = -1;
174 static int hf_afs_bos_key = -1;
175 static int hf_afs_bos_path = -1;
176 static int hf_afs_bos_file = -1;
177 static int hf_afs_bos_cmd = -1;
178 static int hf_afs_bos_error = -1;
179 static int hf_afs_bos_spare1 = -1;
180 static int hf_afs_bos_spare2 = -1;
181 static int hf_afs_bos_spare3 = -1;
182 static int hf_afs_bos_parm = -1;
183 static int hf_afs_bos_kvno = -1;
184 static int hf_afs_bos_cell = -1;
185 static int hf_afs_bos_host = -1;
186 static int hf_afs_bos_newtime = -1;
187 static int hf_afs_bos_baktime = -1;
188 static int hf_afs_bos_oldtime = -1;
189 static int hf_afs_bos_data = -1;
190 static int hf_afs_bos_keymodtime = -1;
191 static int hf_afs_bos_keychecksum = -1;
192 static int hf_afs_bos_keyspare2 = -1;
193
194 static int hf_afs_vldb_errcode = -1;
195 static int hf_afs_vldb_name = -1;
196 static int hf_afs_vldb_id = -1;
197 static int hf_afs_vldb_type = -1;
198 static int hf_afs_vldb_bump = -1;
199 static int hf_afs_vldb_index = -1;
200 static int hf_afs_vldb_nextindex = -1;
201 static int hf_afs_vldb_count = -1;
202 static int hf_afs_vldb_numservers = -1;
203 static int hf_afs_vldb_server = -1;
204 static int hf_afs_vldb_serveruuid = -1;
205 static int hf_afs_vldb_serveruniq = -1;
206 static int hf_afs_vldb_serverflags = -1;
207 static int hf_afs_vldb_serverip = -1;
208 static int hf_afs_vldb_partition = -1;
209 static int hf_afs_vldb_rovol = -1;
210 static int hf_afs_vldb_rwvol = -1;
211 static int hf_afs_vldb_bkvol = -1;
212 static int hf_afs_vldb_clonevol = -1;
213 static int hf_afs_vldb_flags = -1;
214 static int hf_afs_vldb_flags_rwexists = -1;
215 static int hf_afs_vldb_flags_roexists = -1;
216 static int hf_afs_vldb_flags_bkexists = -1;
217 static int hf_afs_vldb_flags_dfsfileset = -1;
218
219 static int hf_afs_vldb_spare1 = -1;
220 static int hf_afs_vldb_spare2 = -1;
221 static int hf_afs_vldb_spare3 = -1;
222 static int hf_afs_vldb_spare4 = -1;
223 static int hf_afs_vldb_spare5 = -1;
224 static int hf_afs_vldb_spare6 = -1;
225 static int hf_afs_vldb_spare7 = -1;
226 static int hf_afs_vldb_spare8 = -1;
227 static int hf_afs_vldb_spare9 = -1;
228
229 static int hf_afs_kauth_errcode = -1;
230 static int hf_afs_kauth_princ = -1;
231 static int hf_afs_kauth_realm = -1;
232 static int hf_afs_kauth_domain = -1;
233 static int hf_afs_kauth_kvno = -1;
234 static int hf_afs_kauth_name = -1;
235 static int hf_afs_kauth_data = -1;
236
237 static int hf_afs_vol_errcode = -1;
238 static int hf_afs_vol_count = -1;
239 static int hf_afs_vol_id = -1;
240 static int hf_afs_vol_name = -1;
241
242 static int hf_afs_cb_errcode = -1;
243 static int hf_afs_cb_callback_version = -1;
244 static int hf_afs_cb_callback_type = -1;
245 static int hf_afs_cb_callback_expires = -1;
246 static int hf_afs_cb_fid_volume = -1;
247 static int hf_afs_cb_fid_vnode = -1;
248 static int hf_afs_cb_fid_uniqifier = -1;
249
250 static int hf_afs_prot_errcode = -1;
251 static int hf_afs_prot_name = -1;
252 static int hf_afs_prot_id = -1;
253 static int hf_afs_prot_count = -1;
254 static int hf_afs_prot_oldid = -1;
255 static int hf_afs_prot_newid = -1;
256 static int hf_afs_prot_pos = -1;
257 static int hf_afs_prot_flag = -1;
258 static int hf_afs_prot_uid = -1;
259 static int hf_afs_prot_gid = -1;
260 static int hf_afs_prot_maxuid = -1;
261 static int hf_afs_prot_maxgid = -1;
262
263 static int hf_afs_backup_errcode = -1;
264
265 static int hf_afs_ubik_errcode = -1;
266 static int hf_afs_ubik_version_epoch = -1;
267 static int hf_afs_ubik_version_counter = -1;
268 static int hf_afs_ubik_votestart = -1;
269 static int hf_afs_ubik_state = -1;
270 static int hf_afs_ubik_site = -1;
271 static int hf_afs_ubik_interface = -1;
272 static int hf_afs_ubik_file = -1;
273 static int hf_afs_ubik_pos = -1;
274 static int hf_afs_ubik_length = -1;
275 static int hf_afs_ubik_locktype = -1;
276 static int hf_afs_ubik_voteend = -1;
277 static int hf_afs_ubik_votetype = -1;
278
279 static int hf_afs_ubik_now = -1;
280 static int hf_afs_ubik_lastyestime = -1;
281 static int hf_afs_ubik_lastyeshost = -1;
282 static int hf_afs_ubik_lastyesstate = -1;
283 static int hf_afs_ubik_lastyesclaim = -1;
284 static int hf_afs_ubik_lowesthost = -1;
285 static int hf_afs_ubik_lowesttime = -1;
286 static int hf_afs_ubik_synchost = -1;
287 static int hf_afs_ubik_synctime = -1;
288 static int hf_afs_ubik_amsyncsite = -1;
289 static int hf_afs_ubik_syncsiteuntil = -1;
290 static int hf_afs_ubik_nservers = -1;
291 static int hf_afs_ubik_lockedpages = -1;
292 static int hf_afs_ubik_writelockedpages = -1;
293 static int hf_afs_ubik_activewrite = -1;
294 static int hf_afs_ubik_tidcounter = -1;
295 static int hf_afs_ubik_anyreadlocks = -1;
296 static int hf_afs_ubik_anywritelocks = -1;
297 static int hf_afs_ubik_recoverystate = -1;
298 static int hf_afs_ubik_currenttrans = -1;
299 static int hf_afs_ubik_writetrans = -1;
300 static int hf_afs_ubik_epochtime = -1;
301 static int hf_afs_ubik_isclone = -1;
302 static int hf_afs_ubik_addr = -1;
303 static int hf_afs_ubik_lastvotetime = -1;
304 static int hf_afs_ubik_lastbeaconsent = -1;
305 static int hf_afs_ubik_lastvote = -1;
306 static int hf_afs_ubik_currentdb = -1;
307 static int hf_afs_ubik_beaconsincedown = -1;
308 static int hf_afs_ubik_up = -1;
309 static int hf_afs_repframe = -1;
310 static int hf_afs_reqframe = -1;
311 static int hf_afs_time = -1;
312
313 static gint ett_afs = -1;
314 static gint ett_afs_op = -1;
315 static gint ett_afs_acl = -1;
316 static gint ett_afs_fid = -1;
317 static gint ett_afs_callback = -1;
318 static gint ett_afs_ubikver = -1;
319 static gint ett_afs_status = -1;
320 static gint ett_afs_status_mask = -1;
321 static gint ett_afs_volsync = -1;
322 static gint ett_afs_volumeinfo = -1;
323 static gint ett_afs_vicestat = -1;
324 static gint ett_afs_vldb_flags = -1;
325
326 /*
327  * Macros for helper dissection routines
328  *
329  * The macros are here to save on coding. They assume that
330  * the current offset is in 'offset', and that the offset
331  * should be incremented after performing the macro's operation.
332  */
333
334
335 /* Output a unsigned integer, stored into field 'field'
336    Assumes it is in network byte order, converts to host before using */
337 #define OUT_UINT(field) \
338         proto_tree_add_uint(tree, field, tvb, offset, 4, tvb_get_ntohl(tvb, offset)); \
339         offset += 4;
340
341 /* Output a unsigned integer, stored into field 'field'
342    Assumes it is in network byte order, converts to host before using */
343 #define OUT_INT(field) \
344         proto_tree_add_int(tree, field, tvb, offset, 4, tvb_get_ntohl(tvb, offset)); \
345         offset += 4;
346
347 /* Output a unsigned integer, stored into field 'field'
348    Assumes it is in network byte order, converts to host before using */
349 #define OUT_UINT64(field) \
350         proto_tree_add_item(tree, field, tvb, offset, 8, FALSE); \
351         offset += 8;
352
353 /* Output a unsigned integer, stored into field 'field'
354    Assumes it is in network byte order, converts to host before using */
355 #define OUT_INT64(field) \
356         proto_tree_add_item(tree, field, tvb, offset, 8, FALSE); \
357         offset += 8;
358
359 /* Output a unsigned integer, stored into field 'field'
360    Assumes it is in network byte order, converts to host before using,
361    Note - does not increment offset, so can be used repeatedly for bitfields */
362 #define DISP_UINT(field) \
363         proto_tree_add_uint(tree,field,tvb,offset,4,tvb_get_ntohl(tvb, offset));
364
365 /* Output an IPv4 address, stored into field 'field' */
366 #define OUT_IP(field) \
367         proto_tree_add_ipv4(tree,field,tvb,offset,4,\
368                 tvb_get_letohl(tvb, offset));\
369         offset += 4;
370
371 /* Output a simple rx array */
372 #define OUT_RXArray8(func) \
373         { \
374                 unsigned int j,i; \
375                 j = tvb_get_guint8(tvb, offset); \
376                 offset += 1; \
377                 for (i=0; i<j; i++) { \
378                         func; \
379                 } \
380         }
381
382 /* Output a simple rx array */
383 #define OUT_RXArray32(func) \
384         { \
385                 unsigned int j,i; \
386                 j = tvb_get_ntohl(tvb, offset); \
387                 offset += 4; \
388                 for (i=0; i<j; i++) { \
389                         func; \
390                 } \
391         }
392
393 /* Output a UNIX seconds/microseconds timestamp, after converting to an
394    nstime_t */
395 #define OUT_TIMESTAMP(field) \
396         { nstime_t ts; \
397         ts.secs = tvb_get_ntohl(tvb, offset); \
398         ts.nsecs = tvb_get_ntohl(tvb, offset+4)*1000; \
399         proto_tree_add_time(tree,field, tvb,offset,2*4,&ts); \
400         offset += 8; \
401         }
402
403 /* Output a seconds-only time value, after converting to an nstime_t;
404    this can be an absolute time as a UNIX time-since-epoch, or a
405    relative time in seconds */
406 #define OUT_TIMESECS(field) \
407         { nstime_t ts; \
408         ts.secs = tvb_get_ntohl(tvb, offset); \
409         ts.nsecs = 0; \
410         proto_tree_add_time(tree,field, tvb,offset,4,&ts); \
411         offset += 4; \
412         }
413
414 /* Output a rx style string, up to a maximum length first
415    4 bytes - length, then char data */
416 #define OUT_RXString(field) \
417         {       guint32 i_orxs,len_orxs; \
418                 i_orxs = tvb_get_ntohl(tvb, offset); \
419                 len_orxs = ((i_orxs+4-1)/4)*4 + 4; \
420                 proto_tree_add_item(tree, field, tvb, offset-4, len_orxs, \
421                 FALSE); \
422                 offset += len_orxs; \
423         }
424
425 /* Output a fixed length vectorized string (each char is a 32 bit int) */
426 #define OUT_RXStringV(field, length) \
427         {       char tmp_orxsv[length+1]; \
428                 int i_orxsv,soff_orxsv; \
429                 soff_orxsv = offset;\
430                 for (i_orxsv=0; i_orxsv<length; i_orxsv++)\
431                 {\
432                         tmp_orxsv[i_orxsv] = (char) tvb_get_ntohl(tvb, offset);\
433                         offset += 4;\
434                 }\
435                 tmp_orxsv[length] = '\0';\
436                 proto_tree_add_string(tree, field, tvb, soff_orxsv, length*4, tmp_orxsv);\
437         }
438
439
440 /* Output a callback */
441 #define OUT_FS_AFSCallBack() \
442         {       proto_tree *save, *ti; \
443                 ti = proto_tree_add_text(tree, tvb, offset, 3*4, "Callback"); \
444                 save = tree; \
445                 tree = proto_item_add_subtree(ti, ett_afs_callback); \
446                 OUT_UINT(hf_afs_fs_callback_version); \
447                 OUT_TIMESECS(hf_afs_fs_callback_expires); \
448                 OUT_UINT(hf_afs_fs_callback_type); \
449                 tree = save; \
450         }
451
452 /* Output a callback */
453 #define OUT_CB_AFSCallBack() \
454         {       proto_tree *save, *ti; \
455                 ti = proto_tree_add_text(tree, tvb, offset, 3*4, "Callback"); \
456                 save = tree; \
457                 tree = proto_item_add_subtree(ti, ett_afs_callback); \
458                 OUT_UINT(hf_afs_cb_callback_version); \
459                 OUT_TIMESECS(hf_afs_cb_callback_expires); \
460                 OUT_UINT(hf_afs_cb_callback_type); \
461                 tree = save; \
462         }
463
464 /* Output a File ID */
465 #define OUT_FS_AFSFid(label) \
466         {       proto_tree *save, *ti; \
467                 ti = proto_tree_add_text(tree, tvb, offset, 3*4, \
468                         "FileID (%s)", label); \
469                 save = tree; \
470                 tree = proto_item_add_subtree(ti, ett_afs_fid); \
471                 OUT_UINT(hf_afs_fs_fid_volume); \
472                 OUT_UINT(hf_afs_fs_fid_vnode); \
473                 OUT_UINT(hf_afs_fs_fid_uniqifier); \
474                 tree = save; \
475         }
476
477 /* Output a Status mask */
478 #define OUT_FS_STATUSMASK() \
479         {       proto_tree *save_ofsm, *ti_ofsm; \
480                 guint32 mask_ofsm; \
481                 mask_ofsm = tvb_get_ntohl(tvb, offset); \
482                 ti_ofsm = proto_tree_add_uint(tree, hf_afs_fs_status_mask, tvb, offset, \
483                         4, mask_ofsm); \
484                 save_ofsm = tree; \
485                 tree = proto_item_add_subtree(ti_ofsm, ett_afs_status_mask); \
486                 proto_tree_add_boolean(tree, hf_afs_fs_status_mask_setmodtime, \
487                         tvb,offset,4, mask_ofsm); \
488                 proto_tree_add_boolean(tree, hf_afs_fs_status_mask_setowner, \
489                         tvb,offset,4, mask_ofsm); \
490                 proto_tree_add_boolean(tree, hf_afs_fs_status_mask_setgroup, \
491                         tvb,offset,4, mask_ofsm); \
492                 proto_tree_add_boolean(tree, hf_afs_fs_status_mask_setmode, \
493                         tvb,offset,4, mask_ofsm); \
494                 proto_tree_add_boolean(tree, hf_afs_fs_status_mask_setsegsize, \
495                         tvb,offset,4, mask_ofsm); \
496                 proto_tree_add_boolean(tree, hf_afs_fs_status_mask_fsync, \
497                         tvb,offset,4, mask_ofsm); \
498                 offset += 4; \
499                 tree = save_ofsm; \
500         }
501
502 /* Output vldb flags */
503 #define OUT_VLDB_Flags() \
504         {       proto_tree *save, *ti; \
505                 guint32 flags; \
506                 flags = tvb_get_ntohl(tvb, offset); \
507                 ti = proto_tree_add_uint(tree, hf_afs_vldb_flags, tvb, offset, \
508                         4, flags); \
509                 save = tree; \
510                 tree = proto_item_add_subtree(ti, ett_afs_vldb_flags); \
511                 proto_tree_add_boolean(tree, hf_afs_vldb_flags_rwexists, \
512                         tvb,offset,4, flags); \
513                 proto_tree_add_boolean(tree, hf_afs_vldb_flags_roexists, \
514                         tvb,offset,4, flags); \
515                 proto_tree_add_boolean(tree, hf_afs_vldb_flags_bkexists, \
516                         tvb,offset,4, flags); \
517                 proto_tree_add_boolean(tree, hf_afs_vldb_flags_dfsfileset, \
518                         tvb,offset,4, flags); \
519                 offset += 4; \
520                 tree = save; \
521         }
522
523
524
525 /* Output a File ID */
526 #define OUT_CB_AFSFid(label) \
527         {       proto_tree *save, *ti; \
528                 ti = proto_tree_add_text(tree, tvb, offset, 3*4, \
529                         "FileID (%s)", label); \
530                 save = tree; \
531                 tree = proto_item_add_subtree(ti, ett_afs_fid); \
532                 OUT_UINT(hf_afs_cb_fid_volume); \
533                 OUT_UINT(hf_afs_cb_fid_vnode); \
534                 OUT_UINT(hf_afs_cb_fid_uniqifier); \
535                 tree = save; \
536         }
537
538 /* Output a StoreStatus */
539 #define OUT_FS_AFSStoreStatus(label) \
540         {       proto_tree *save, *ti; \
541                 ti = proto_tree_add_text(tree, tvb, offset, 6*4, \
542                         label); \
543                 save = tree; \
544                 tree = proto_item_add_subtree(ti, ett_afs_status); \
545                 OUT_FS_STATUSMASK(); \
546                 OUT_TIMESECS(hf_afs_fs_status_clientmodtime); \
547                 OUT_UINT(hf_afs_fs_status_owner); \
548                 OUT_UINT(hf_afs_fs_status_group); \
549                 OUT_UINT(hf_afs_fs_status_mode); \
550                 OUT_UINT(hf_afs_fs_status_segsize); \
551                 tree = save; \
552         }
553
554 /* Output a FetchStatus */
555 #define OUT_FS_AFSFetchStatus(label) \
556         {       proto_tree *save, *ti; \
557                 ti = proto_tree_add_text(tree, tvb, offset, 21*4, \
558                         label); \
559                 save = tree; \
560                 tree = proto_item_add_subtree(ti, ett_afs_status); \
561                 OUT_UINT(hf_afs_fs_status_interfaceversion); \
562                 OUT_UINT(hf_afs_fs_status_filetype); \
563                 OUT_UINT(hf_afs_fs_status_linkcount); \
564                 OUT_UINT(hf_afs_fs_status_length); \
565                 OUT_UINT(hf_afs_fs_status_dataversion); \
566                 OUT_UINT(hf_afs_fs_status_author); \
567                 OUT_UINT(hf_afs_fs_status_owner); \
568                 OUT_UINT(hf_afs_fs_status_calleraccess); \
569                 OUT_UINT(hf_afs_fs_status_anonymousaccess); \
570                 OUT_UINT(hf_afs_fs_status_mode); \
571                 OUT_UINT(hf_afs_fs_status_parentvnode); \
572                 OUT_UINT(hf_afs_fs_status_parentunique); \
573                 OUT_UINT(hf_afs_fs_status_segsize); \
574                 OUT_TIMESECS(hf_afs_fs_status_clientmodtime); \
575                 OUT_TIMESECS(hf_afs_fs_status_servermodtime); \
576                 OUT_UINT(hf_afs_fs_status_group); \
577                 OUT_UINT(hf_afs_fs_status_synccounter); \
578                 OUT_UINT(hf_afs_fs_status_dataversionhigh); \
579                 OUT_UINT(hf_afs_fs_status_spare2); \
580                 OUT_UINT(hf_afs_fs_status_spare3); \
581                 OUT_UINT(hf_afs_fs_status_spare4); \
582                 tree = save; \
583         }
584
585 /* Output a VolSync */
586 #define OUT_FS_AFSVolSync() \
587         {       proto_tree *save, *ti; \
588                 ti = proto_tree_add_text(tree, tvb, offset, 6*4, \
589                         "VolSync"); \
590                 save = tree; \
591                 tree = proto_item_add_subtree(ti, ett_afs_volsync); \
592                 OUT_TIMESECS(hf_afs_fs_volsync_spare1); \
593                 OUT_UINT(hf_afs_fs_volsync_spare2); \
594                 OUT_UINT(hf_afs_fs_volsync_spare3); \
595                 OUT_UINT(hf_afs_fs_volsync_spare4); \
596                 OUT_UINT(hf_afs_fs_volsync_spare5); \
597                 OUT_UINT(hf_afs_fs_volsync_spare6); \
598                 tree = save; \
599         }
600
601 /* Output a AFSCBFids */
602 #define OUT_FS_AFSCBFids() \
603         OUT_RXArray32(OUT_FS_AFSFid("Target"));
604
605 /* Output a ViceIds */
606 #define OUT_FS_ViceIds() \
607         OUT_RXArray8(OUT_UINT(hf_afs_fs_viceid));
608
609 /* Output a IPAddrs */
610 #define OUT_FS_IPAddrs() \
611         OUT_RXArray8(OUT_IP(hf_afs_fs_ipaddr));
612
613 /* Output a AFSCBs */
614 #define OUT_FS_AFSCBs() \
615         OUT_RXArray32(OUT_FS_AFSCallBack());
616
617 /* Output a AFSBulkStats */
618 #define OUT_FS_AFSBulkStats() \
619         OUT_RXArray32(OUT_FS_AFSFetchStatus("Status"));
620
621 /* Output a AFSFetchVolumeStatus */
622 #define OUT_FS_AFSFetchVolumeStatus()
623
624 /* Output a AFSStoreVolumeStatus */
625 #define OUT_FS_AFSStoreVolumeStatus()
626
627 /* Output a ViceStatistics structure */
628 #define OUT_FS_ViceStatistics()
629
630 /* Output a AFS_CollData structure */
631 #define OUT_FS_AFS_CollData()
632
633 /* Output a VolumeInfo structure */
634 #define OUT_FS_VolumeInfo()
635
636 /* Output an AFS Token - might just be bytes though */
637 #define OUT_FS_AFSTOKEN() OUT_RXStringV(hf_afs_fs_token, 1024)
638
639 /* Output a AFS acl */
640 #define ACLOUT(who, positive, acl, bytes) \
641         {       proto_tree *save, *ti; \
642                 int tmpoffset; \
643                 int acllen; \
644                 char tmp[10]; \
645                 tmp[0] = 0; \
646                 if ( acl & PRSFS_READ ) g_strlcat(tmp, "r", 10);        \
647                 if ( acl & PRSFS_LOOKUP ) g_strlcat(tmp, "l", 10);      \
648                 if ( acl & PRSFS_INSERT ) g_strlcat(tmp, "i", 10);      \
649                 if ( acl & PRSFS_DELETE ) g_strlcat(tmp, "d", 10);      \
650                 if ( acl & PRSFS_WRITE ) g_strlcat(tmp, "w", 10);       \
651                 if ( acl & PRSFS_LOCK ) g_strlcat(tmp, "k", 10);        \
652                 if ( acl & PRSFS_ADMINISTER ) g_strlcat(tmp, "a", 10);  \
653                 ti = proto_tree_add_text(tree, tvb, offset, bytes, \
654                         "ACL:  %s %s%s", \
655                         who, tmp, positive ? "" : " (negative)"); \
656                 save = tree; \
657                 tree = proto_item_add_subtree(ti, ett_afs_acl); \
658                 proto_tree_add_string(tree,hf_afs_fs_acl_entity, tvb,offset,(int)strlen(who), who);\
659                 tmpoffset = offset + (int)strlen(who) + 1; \
660                 acllen = bytes - (int)strlen(who) - 1; \
661                 proto_tree_add_boolean(tree,hf_afs_fs_acl_r, tvb,tmpoffset,acllen,acl);\
662                 proto_tree_add_boolean(tree,hf_afs_fs_acl_l, tvb,tmpoffset,acllen,acl);\
663                 proto_tree_add_boolean(tree,hf_afs_fs_acl_i, tvb,tmpoffset,acllen,acl);\
664                 proto_tree_add_boolean(tree,hf_afs_fs_acl_d, tvb,tmpoffset,acllen,acl);\
665                 proto_tree_add_boolean(tree,hf_afs_fs_acl_w, tvb,tmpoffset,acllen,acl);\
666                 proto_tree_add_boolean(tree,hf_afs_fs_acl_k, tvb,tmpoffset,acllen,acl);\
667                 proto_tree_add_boolean(tree,hf_afs_fs_acl_a, tvb,tmpoffset,acllen,acl);\
668                 tree = save; \
669         }
670
671 /* Output a UUID */
672 #define OUT_UUID(x) \
673         OUT_BYTES(x, 11*4);
674 #define SKIP_UUID() \
675         SKIP(11*4);
676
677
678 /* Output a bulkaddr */
679 #define OUT_VLDB_BulkAddr() \
680         OUT_RXArray32(OUT_IP(hf_afs_vldb_serverip));
681
682 /* output a bozo_key */
683 #define OUT_BOS_KEY() \
684         OUT_BYTES(hf_afs_bos_key, 8);
685
686 /* output a bozo_key */
687 #define OUT_BOS_KEYINFO() \
688         OUT_TIMESTAMP(hf_afs_bos_keymodtime); \
689         OUT_UINT(hf_afs_bos_keychecksum); \
690         OUT_UINT(hf_afs_bos_keyspare2);
691
692 /* output a bozo_netKTime */
693 #define OUT_BOS_TIME() \
694         SKIP(4); SKIP(2); SKIP(2); SKIP(2); SKIP(2);
695
696 /* output a bozo_status */
697 #define OUT_BOS_STATUS() \
698         SKIP(10 * 4);
699
700 /* output a ubik interface addr array */
701 #define OUT_UBIK_InterfaceAddrs() \
702     { \
703         unsigned int i,j,seen_null=0; \
704         for (i=0; i<255; i++) { \
705                 j = tvb_get_ntohl(tvb, offset); \
706                 if ( j != 0 ) { \
707                         OUT_IP(hf_afs_ubik_interface); \
708                         seen_null = 0; \
709                 } else { \
710                         if ( ! seen_null ) { \
711                         proto_tree_add_text(tree, tvb, offset, \
712                                 tvb_length_remaining(tvb, offset), \
713                                 "Null Interface Addresses"); \
714                                 seen_null = 1; \
715                         } \
716                         offset += 4; \
717                 }\
718         } \
719     }
720
721 #define OUT_UBIK_DebugOld() \
722         { \
723                 OUT_TIMESECS(hf_afs_ubik_now); \
724                 OUT_TIMESECS(hf_afs_ubik_lastyestime); \
725                 OUT_IP(hf_afs_ubik_lastyeshost); \
726                 OUT_UINT(hf_afs_ubik_lastyesstate); \
727                 OUT_TIMESECS(hf_afs_ubik_lastyesclaim); \
728                 OUT_IP(hf_afs_ubik_lowesthost); \
729                 OUT_TIMESECS(hf_afs_ubik_lowesttime); \
730                 OUT_IP(hf_afs_ubik_synchost); \
731                 OUT_TIMESECS(hf_afs_ubik_synctime); \
732                 OUT_UBIKVERSION("Sync Version"); \
733                 OUT_UBIKVERSION("Sync TID"); \
734                 OUT_UINT(hf_afs_ubik_amsyncsite); \
735                 OUT_TIMESECS(hf_afs_ubik_syncsiteuntil); \
736                 OUT_UINT(hf_afs_ubik_nservers); \
737                 OUT_UINT(hf_afs_ubik_lockedpages); \
738                 OUT_UINT(hf_afs_ubik_writelockedpages); \
739                 OUT_UBIKVERSION("Local Version"); \
740                 OUT_UINT(hf_afs_ubik_activewrite); \
741                 OUT_UINT(hf_afs_ubik_tidcounter); \
742                 OUT_UINT(hf_afs_ubik_anyreadlocks); \
743                 OUT_UINT(hf_afs_ubik_anywritelocks); \
744                 OUT_UINT(hf_afs_ubik_recoverystate); \
745                 OUT_UINT(hf_afs_ubik_currenttrans); \
746                 OUT_UINT(hf_afs_ubik_writetrans); \
747                 OUT_TIMESECS(hf_afs_ubik_epochtime); \
748         }
749
750 #define OUT_UBIK_SDebugOld() \
751         { \
752                 OUT_IP(hf_afs_ubik_addr); \
753                 OUT_TIMESECS(hf_afs_ubik_lastvotetime); \
754                 OUT_TIMESECS(hf_afs_ubik_lastbeaconsent); \
755                 OUT_UINT(hf_afs_ubik_lastvote); \
756                 OUT_UBIKVERSION("Remote Version"); \
757                 OUT_UINT(hf_afs_ubik_currentdb); \
758                 OUT_UINT(hf_afs_ubik_beaconsincedown); \
759                 OUT_UINT(hf_afs_ubik_up); \
760         }
761
762 /* Skip a certain number of bytes */
763 #define SKIP(bytes) \
764         offset += bytes;
765
766 /* Raw data - to end of frame */
767 #define OUT_BYTES_ALL(field) OUT_BYTES(field, tvb_length_remaining(tvb,offset))
768
769 /* Raw data */
770 #define OUT_BYTES(field, bytes) \
771         proto_tree_add_item(tree, field, tvb, offset, bytes, FALSE);\
772         offset += bytes;
773
774
775
776 /* Skip the opcode */
777 #define SKIP_OPCODE() \
778         { \
779                 SKIP(4); \
780         }
781
782 /* Output a UBIK version code */
783 #define OUT_UBIKVERSION(label) \
784         {       proto_tree *save, *ti; \
785                 unsigned int epoch,counter; \
786                 nstime_t ts; \
787                 epoch = tvb_get_ntohl(tvb, offset); \
788                 offset += 4; \
789                 counter = tvb_get_ntohl(tvb, offset); \
790                 offset += 4; \
791                 ts.secs = epoch; \
792                 ts.nsecs = 0; \
793                 ti = proto_tree_add_text(tree, tvb, offset-8, 8, \
794                         "UBIK Version (%s): %u.%u", label, epoch, counter ); \
795                 save = tree; \
796                 tree = proto_item_add_subtree(ti, ett_afs_ubikver); \
797                 if ( epoch != 0 ) \
798                 proto_tree_add_time(tree,hf_afs_ubik_version_epoch, tvb,offset-8, \
799                         4,&ts); \
800                 else \
801                         proto_tree_add_text(tree, tvb, offset-8, \
802                         4,"Epoch: 0"); \
803                 proto_tree_add_uint(tree,hf_afs_ubik_version_counter, tvb,offset-4, \
804                         4,counter); \
805                 tree = save; \
806         }
807
808 /* Output a kauth getticket request */
809 #define OUT_KAUTH_GetTicket() \
810         { \
811                 int len = 0; \
812                 OUT_UINT(hf_afs_kauth_kvno); \
813                 OUT_RXString(hf_afs_kauth_domain); \
814                 len = tvb_get_ntohl(tvb, offset); \
815                 offset += 4; \
816                 OUT_BYTES(hf_afs_kauth_data, len); \
817                 OUT_RXString(hf_afs_kauth_princ); \
818                 OUT_RXString(hf_afs_kauth_realm); \
819         }
820
821 #define GETSTR (tvb_format_text(tvb,offset,tvb_length_remaining(tvb,offset)))
822
823 #define VALID_OPCODE(opcode) ((opcode >= OPCODE_LOW && opcode <= OPCODE_HIGH) || \
824                 (opcode >= VOTE_LOW && opcode <= VOTE_HIGH) || \
825                 (opcode >= DISK_LOW && opcode <= DISK_HIGH))
826
827 static const value_string fs_req[] = {
828         { 130,          "fetch-data" },
829         { 131,          "fetch-acl" },
830         { 132,          "fetch-status" },
831         { 133,          "store-data" },
832         { 134,          "store-acl" },
833         { 135,          "store-status" },
834         { 136,          "remove-file" },
835         { 137,          "create-file" },
836         { 138,          "rename" },
837         { 139,          "symlink" },
838         { 140,          "link" },
839         { 141,          "makedir" },
840         { 142,          "rmdir" },
841         { 143,          "old-set-lock" },
842         { 144,          "old-extend-lock" },
843         { 145,          "old-release-lock" },
844         { 146,          "get-stats" },
845         { 147,          "give-up-callbacks" },
846         { 148,          "get-volume-info" },
847         { 149,          "get-volume-status" },
848         { 150,          "set-volume-status" },
849         { 151,          "get-root-volume" },
850         { 152,          "check-token" },
851         { 153,          "get-time" },
852         { 154,          "nget-volume-info" },
853         { 155,          "bulk-status" },
854         { 156,          "set-lock" },
855         { 157,          "extend-lock" },
856         { 158,          "release-lock" },
857         { 159,          "xstats-version" },
858         { 160,          "get-xstats" },
859         { 161,          "dfs-lookup" },
860         { 162,          "dfs-flushcps" },
861         { 163,          "dfs-symlink" },
862         { 220,          "residency" },
863         { 65536,        "inline-bulk-status" },
864         { 65537,        "fetch-data-64" },
865         { 65538,        "store-data-64" },
866         { 65539,        "give-up-all-callbacks" },
867         { 65540,        "get-capabilities" },
868         { 0,            NULL },
869 };
870 static value_string_ext fs_req_ext = VALUE_STRING_EXT_INIT(fs_req);
871
872 static const value_string cb_req[] = {
873         { 204,          "callback" },
874         { 205,          "init-callback-state" },
875         { 206,          "probe" },
876         { 207,          "get-lock" },
877         { 208,          "get-ce" },
878         { 209,          "xstats-version" },
879         { 210,          "get-xstats" },
880         { 211,          "init-callback-state2" },
881         { 212,          "who-are-you" },
882         { 213,          "init-callback-state3" },
883         { 214,          "probeuuid" },
884         { 215,          "get-server-prefs" },
885         { 216,          "get-cellservdb" },
886         { 217,          "get-local-cell" },
887         { 218,          "get-cache-config" },
888         { 65536,        "get-ce-64" },
889         { 65537,        "get-cell-by-num" },
890         { 65538,        "get-capabilities" },
891         { 0,            NULL },
892 };
893 static value_string_ext cb_req_ext = VALUE_STRING_EXT_INIT(cb_req);
894
895 static const value_string prot_req[] = {
896         { 500,          "new-user" },
897         { 501,          "where-is-it" },
898         { 502,          "dump-entry" },
899         { 503,          "add-to-group" },
900         { 504,          "name-to-id" },
901         { 505,          "id-to-name" },
902         { 506,          "delete" },
903         { 507,          "remove-from-group" },
904         { 508,          "get-cps" },
905         { 509,          "new-entry" },
906         { 510,          "list-max" },
907         { 511,          "set-max" },
908         { 512,          "list-entry" },
909         { 513,          "change-entry" },
910         { 514,          "list-elements" },
911         { 515,          "is-member-of" },
912         { 516,          "set-fld-sentry" },
913         { 517,          "list-owned" },
914         { 518,          "get-cps2" },
915         { 519,          "get-host-cps" },
916         { 520,          "update-entry" },
917         { 521,          "list-entries" },
918         { 0,            NULL },
919 };
920 static value_string_ext prot_req_ext = VALUE_STRING_EXT_INIT(prot_req);
921
922 static const value_string vldb_req[] = {
923         { 501,          "create-entry" },
924         { 502,          "delete-entry" },
925         { 503,          "get-entry-by-id" },
926         { 504,          "get-entry-by-name" },
927         { 505,          "get-new-volume-id" },
928         { 506,          "replace-entry" },
929         { 507,          "update-entry" },
930         { 508,          "set-lock" },
931         { 509,          "release-lock" },
932         { 510,          "list-entry" },
933         { 511,          "list-attributes" },
934         { 512,          "linked-list" },
935         { 513,          "get-stats" },
936         { 514,          "probe" },
937         { 515,          "get-addrs" },
938         { 516,          "change-addr" },
939         { 517,          "create-entry-n" },
940         { 518,          "get-entry-by-id-n" },
941         { 519,          "get-entry-by-name-n" },
942         { 520,          "replace-entry-n" },
943         { 521,          "list-entry-n" },
944         { 522,          "list-attrib-n" },
945         { 523,          "linked-list-n" },
946         { 524,          "update-entry-by-name" },
947         { 525,          "create-entry-u" },
948         { 526,          "get-entry-by-id-u" },
949         { 527,          "get-entry-by-name-u" },
950         { 528,          "replace-entry-u" },
951         { 529,          "list-entry-u" },
952         { 530,          "list-attrib-u" },
953         { 531,          "linked-list-u" },
954         { 532,          "regaddr" },
955         { 533,          "get-addrs-u" },
956         { 534,          "list-attrib-n2" },
957         { 0,            NULL },
958 };
959 static value_string_ext vldb_req_ext = VALUE_STRING_EXT_INIT(vldb_req);
960
961 static const value_string kauth_req[] = {
962         { 1,            "auth-old" },
963         { 2,            "change-pw" },
964         { 3,            "get-ticket-old" },
965         { 4,            "set-pw" },
966         { 5,            "set-fields" },
967         { 6,            "create-user" },
968         { 7,            "delete-user" },
969         { 8,            "get-entry" },
970         { 9,            "list-entry" },
971         { 10,           "get-stats" },
972         { 11,           "debug" },
973         { 12,           "get-pw" },
974         { 13,           "get-random-key" },
975         { 14,           "unlock" },
976         { 15,           "lock-status" },
977         { 21,           "authenticate" },
978         { 22,           "authenticate-v2" },
979         { 23,           "get-ticket" },
980         { 0,            NULL },
981 };
982 static value_string_ext kauth_req_ext = VALUE_STRING_EXT_INIT(kauth_req);
983
984 static const value_string vol_req[] = {
985         { 100,          "create-volume" },
986         { 101,          "delete-volume" },
987         { 102,          "restore" },
988         { 103,          "forward" },
989         { 104,          "end-trans" },
990         { 105,          "clone" },
991         { 106,          "set-flags" },
992         { 107,          "get-flags" },
993         { 108,          "trans-create" },
994         { 109,          "dump" },
995         { 110,          "get-nth-volume" },
996         { 111,          "set-forwarding" },
997         { 112,          "get-name" },
998         { 113,          "get-status" },
999         { 114,          "sig-restore" },
1000         { 115,          "list-partitions" },
1001         { 116,          "list-volumes" },
1002         { 117,          "set-id-types" },
1003         { 118,          "monitor" },
1004         { 119,          "partition-info" },
1005         { 120,          "reclone" },
1006         { 121,          "list-one-volume" },
1007         { 122,          "nuke" },
1008         { 123,          "set-date" },
1009         { 124,          "x-list-volumes" },
1010         { 125,          "x-list-one-volume" },
1011         { 126,          "set-info" },
1012         { 127,          "x-list-partitions" },
1013         { 128,          "forward-multiple" },
1014         { 65536,        "convert-ro" },
1015         { 65537,        "getsize" },
1016         { 0,            NULL },
1017 };
1018 static value_string_ext vol_req_ext = VALUE_STRING_EXT_INIT(vol_req);
1019
1020 static const value_string bos_req[] = {
1021         { 80,           "create-bnode" },
1022         { 81,           "delete-bnode" },
1023         { 82,           "set-status" },
1024         { 83,           "get-status" },
1025         { 84,           "enumerate-instance" },
1026         { 85,           "get-instance-info" },
1027         { 86,           "get-instance-parm" },
1028         { 87,           "add-superuser" },
1029         { 88,           "delete-superuser" },
1030         { 89,           "list-superusers" },
1031         { 90,           "list-keys" },
1032         { 91,           "add-key" },
1033         { 92,           "delete-key" },
1034         { 93,           "set-cell-name" },
1035         { 94,           "get-cell-name" },
1036         { 95,           "get-cell-host" },
1037         { 96,           "add-cell-host" },
1038         { 97,           "delete-cell-host" },
1039         { 98,           "set-t-status" },
1040         { 99,           "shutdown-all" },
1041         { 100,          "restart-all" },
1042         { 101,          "startup-all" },
1043         { 102,          "set-noauth-flag" },
1044         { 103,          "re-bozo" },
1045         { 104,          "restart" },
1046         { 105,          "install" },
1047         { 106,          "uninstall" },
1048         { 107,          "get-dates" },
1049         { 108,          "exec" },
1050         { 109,          "prune" },
1051         { 110,          "set-restart-time" },
1052         { 111,          "get-restart-time" },
1053         { 112,          "get-log" },
1054         { 113,          "wait-all" },
1055         { 114,          "get-instance-strings" },
1056         { 115,          "get-restricted" },
1057         { 116,          "set restricted" },
1058         { 0,            NULL },
1059 };
1060 static value_string_ext bos_req_ext = VALUE_STRING_EXT_INIT(bos_req);
1061
1062 static const value_string update_req[] = {
1063         { 1,            "fetch-file" },
1064         { 2,            "fetch-info" },
1065         { 0,            NULL },
1066 };
1067 static value_string_ext update_req_ext = VALUE_STRING_EXT_INIT(update_req);
1068
1069 static const value_string rmtsys_req[] = {
1070         { 1,            "setpag" },
1071         { 2,            "pioctl" },
1072         { 0,            NULL },
1073 };
1074 static value_string_ext rmtsys_req_ext = VALUE_STRING_EXT_INIT(rmtsys_req);
1075
1076 static const value_string backup_req[] = {
1077         { 100,          "perform-dump" },
1078         { 101,          "perform-restore" },
1079         { 102,          "check-dump" },
1080         { 103,          "abort-dump" },
1081         { 104,          "wait-for-dump" },
1082         { 105,          "end-dump" },
1083         { 106,          "get-tm-info" },
1084         { 107,          "label-tape" },
1085         { 108,          "scan-nodes" },
1086         { 109,          "read-label" },
1087         { 110,          "scan-dumps" },
1088         { 111,          "get-tc-info" },
1089         { 112,          "save-database" },
1090         { 113,          "restore-database" },
1091         { 114,          "get-status" },
1092         { 115,          "request-abort" },
1093         { 116,          "end-status" },
1094         { 117,          "scan-status" },
1095         { 118,          "delete-dump" },
1096         { 0,            NULL },
1097 };
1098 static value_string_ext backup_req_ext = VALUE_STRING_EXT_INIT(backup_req);
1099
1100 static const value_string ubik_req[] = {
1101         { 10000,        "vote-beacon" },
1102         { 10001,        "vote-debug-old" },
1103         { 10002,        "vote-sdebug-old" },
1104         { 10003,        "vote-getsyncsite" },
1105         { 10004,        "vote-debug" },
1106         { 10005,        "vote-sdebug" },
1107         { 10006,        "vote-xdebug" },
1108         { 10007,        "vote-xsdebug" },
1109         { 20000,        "disk-begin" },
1110         { 20001,        "disk-commit" },
1111         { 20002,        "disk-lock" },
1112         { 20003,        "disk-write" },
1113         { 20004,        "disk-getversion" },
1114         { 20005,        "disk-getfile" },
1115         { 20006,        "disk-sendfile" },
1116         { 20007,        "disk-abort" },
1117         { 20008,        "disk-releaselocks" },
1118         { 20009,        "disk-truncate" },
1119         { 20010,        "disk-probe" },
1120         { 20011,        "disk-writev" },
1121         { 20012,        "disk-interfaceaddr" },
1122         { 20013,        "disk-setversion" },
1123         { 0,            NULL },
1124 };
1125 static value_string_ext ubik_req_ext = VALUE_STRING_EXT_INIT(ubik_req);
1126
1127 static const value_string cb_types[] = {
1128         { CB_TYPE_EXCLUSIVE, "exclusive" },
1129         { CB_TYPE_SHARED, "shared" },
1130         { CB_TYPE_DROPPED, "dropped" },
1131         { 0, NULL },
1132 };
1133
1134 static const value_string afs_errors[] = {
1135         /* KAUTH Errors */
1136         { 180480, "Database Inconsistent"},
1137         { 180481, "Exists"},
1138         { 180482, "IO"},
1139         { 180483, "Create Failed"},
1140         { 180484, "noent"},
1141         { 180485, "Empty"},
1142         { 180486, "Bad Name"},
1143         { 180487, "Bad Index"},
1144         { 180488, "No auth"},
1145         { 180489, "Answer too long"},
1146         { 180490, "Bad Request"},
1147         { 180491, "Old Interface"},
1148         { 180492, "Bad Argument"},
1149         { 180493, "Bad Command"},
1150         { 180494, "No keys"},
1151         { 180495, "Read PW"},
1152         { 180496, "Bad key"},
1153         { 180497, "Ubik Init"},
1154         { 180498, "Ubik Call"},
1155         { 180499, "Bad Protocol"},
1156         { 180500, "No cells"},
1157         { 180501, "No cell"},
1158         { 180502, "Too many ubiks"},
1159         { 180503, "Too many keys"},
1160         { 180504, "Bad ticket"},
1161         { 180505, "Unknown Key"},
1162         { 180506, "Key Cache Invalid"},
1163         { 180507, "Bad Server"},
1164         { 180508, "Bad User"},
1165         { 180509, "Bad CPW"},
1166         { 180510, "Bad Create"},
1167         { 180511, "No ticket"},
1168         { 180512, "Assoc user"},
1169         { 180513, "Not special"},
1170         { 180514, "Clock skew too great"},
1171         { 180515, "No recursion"},
1172         { 180516, "RX failed"},
1173         { 180517, "Null password"},
1174         { 180518, "Internal error"},
1175         { 180519, "Password expired"},
1176         { 180520, "Reused"},
1177         { 180521, "Too soon"},
1178         { 180522, "Locked"},
1179
1180         /* PT Errors */
1181         { 267264, "Exists"},
1182         { 267265, "ID Exists"},
1183         { 267266, "No IDs"},
1184         { 267267, "DB Failed"},
1185         { 267268, "No such entry"},
1186         { 267269, "Permission denied"},
1187         { 267270, "Not group"},
1188         { 267271, "Not user"},
1189         { 267272, "Bad name"},
1190         { 267273, "Bad argument"},
1191         { 267274, "No more"},
1192         { 267275, "Bad DB"},
1193         { 267276, "Group empty"},
1194         { 267277, "Inconsistent"},
1195         { 267278, "DB Address"},
1196         { 267279, "Too many"},
1197         { 267280, "No memory"},
1198
1199         /* VOL Errors */
1200         { 363520, "ID Exists"},
1201         { 363521, "IO Error"},
1202         { 363522, "Name Exists"},
1203         { 363523, "Create Failed"},
1204         { 363524, "Entry Not Found"},
1205         { 363525, "Empty"},
1206         { 363526, "Entry Deleted"},
1207         { 363527, "Bad Name"},
1208         { 363528, "Bad Index"},
1209         { 363529, "Bad Volume Type"},
1210         { 363530, "Bad Partition"},
1211         { 363531, "Bad Server"},
1212         { 363532, "Bad Replicate Server"},
1213         { 363533, "No Replicate Server"},
1214         { 363534, "Duplicate Replicate Server"},
1215         { 363535, "ReadWrite Volume Not Found"},
1216         { 363536, "Bad Reference Count"},
1217         { 363537, "Size Exceeded"},
1218         { 363538, "Bad Entry"},
1219         { 363539, "Bad Volume ID Bump"},
1220         { 363540, "Already has edit"},
1221         { 363541, "Entry Locked"},
1222         { 363542, "Bad Volume Operation"},
1223         { 363543, "Bad Rel Lock Type"},
1224         { 363544, "Rerelease"},
1225         { 363545, "Bad Server"},
1226         { 363546, "Permission Denied"},
1227         { 363547, "Out of Memory"},
1228
1229         /* Volume server errors */
1230         { 1492325120, "Release error"},
1231         { 1492325121, "No op"},
1232         { 1492325122, "Read dump error"},
1233         { 1492325123, "Dump error"},
1234         { 1492325124, "Attach error"},
1235         { 1492325125, "Illegal partition"},
1236         { 1492325126, "Detach error"},
1237         { 1492325127, "Bad access"},
1238         { 1492325128, "VLDB error"},
1239         { 1492325129, "Bad Name"},
1240         { 1492325130, "Volume moved"},
1241         { 1492325131, "Bad operation"},
1242         { 1492325132, "Bad release"},
1243         { 1492325133, "Volume busy"},
1244         { 1492325134, "No memory"},
1245         { 1492325135, "No volume"},
1246         { 1492325136, "Multiple RW volumes"},
1247         { 1492325137, "Failed operation"},
1248
1249         /* add more of these errors to decode the errcode responses */
1250         { 0, NULL },
1251 };
1252 static value_string_ext afs_errors_ext = VALUE_STRING_EXT_INIT(afs_errors);
1253
1254 static const value_string port_types[] = {
1255         { AFS_PORT_FS,     "File Server" },
1256         { AFS_PORT_CB,     "Callback Server" },
1257         { AFS_PORT_PROT,   "Protection Server" },
1258         { AFS_PORT_VLDB,   "Volume Location Database Server" },
1259         { AFS_PORT_KAUTH,  "Kerberos Authentication Server" },
1260         { AFS_PORT_VOL,    "Volume Server" },
1261         { AFS_PORT_ERROR,  "Error Server" },
1262         { AFS_PORT_BOS,    "BOS Server" },
1263         { AFS_PORT_UPDATE, "Update? Server" },
1264         { AFS_PORT_RMTSYS, "Rmtsys? Server" },
1265         { AFS_PORT_BACKUP, "Backup Server" },
1266         { 0, NULL }
1267 };
1268 static value_string_ext port_types_ext = VALUE_STRING_EXT_INIT(port_types);
1269
1270 static const value_string port_types_short[] = {
1271         { AFS_PORT_FS,     "FS" },
1272         { AFS_PORT_CB,     "CB" },
1273         { AFS_PORT_PROT,   "PROT" },
1274         { AFS_PORT_VLDB,   "VLDB" },
1275         { AFS_PORT_KAUTH,  "KAUTH" },
1276         { AFS_PORT_VOL,    "VOL" },
1277         { AFS_PORT_ERROR,  "ERR" },
1278         { AFS_PORT_BOS,    "BOS" },
1279         { AFS_PORT_UPDATE, "UPD" },
1280         { AFS_PORT_RMTSYS, "RMT" },
1281         { AFS_PORT_BACKUP, "BKUP" },
1282         { 0, NULL }
1283 };
1284 static value_string_ext port_types_short_ext = VALUE_STRING_EXT_INIT(port_types_short);
1285
1286 static const value_string ubik_lock_types[] = {
1287         { 1,            "read" },
1288         { 2,            "write" },
1289         { 3,            "wait" },
1290         { 0,            NULL },
1291 };
1292
1293 static const value_string xstat_collections[] = {
1294         { 0,            "call counting & info" },
1295         { 1,            "performance info" },
1296         { 2,            "full performance info" },
1297         { 0,            NULL },
1298 };
1299
1300 static const value_string vice_lock_types[] = {
1301         { 0,            "read" },
1302         { 1,            "write" },
1303         { 2,            "extend" },
1304         { 3,            "release" },
1305         { 0,            NULL },
1306 };
1307
1308 static const value_string volume_types[] = {
1309         { 0,            "read-write" },
1310         { 1,            "read-only" },
1311         { 2,            "backup" },
1312         { 0xffffffff, "any" },
1313         { 0,            NULL },
1314 };
1315
1316 struct afs_request_key {
1317   guint32 conversation, epoch, cid, callnumber;
1318   guint16 service;
1319 };
1320
1321 struct afs_request_val {
1322   guint32 opcode;
1323   guint req_num;
1324   guint rep_num;
1325   nstime_t req_time;
1326 };
1327
1328 static GHashTable *afs_request_hash = NULL;
1329
1330
1331 /*
1332  * Dissector prototypes
1333  */
1334 static int dissect_acl(tvbuff_t *tvb, struct rxinfo *rxinfo,
1335         proto_tree *tree, int offset);
1336 static void dissect_fs_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
1337         proto_tree *tree, int offset, int opcode);
1338 static void dissect_fs_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
1339         proto_tree *tree, int offset, int opcode);
1340 static void dissect_bos_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
1341         proto_tree *tree, int offset, int opcode);
1342 static void dissect_bos_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
1343         proto_tree *tree, int offset, int opcode);
1344 static void dissect_vol_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
1345         proto_tree *tree, int offset, int opcode);
1346 static void dissect_vol_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
1347         proto_tree *tree, int offset, int opcode);
1348 static void dissect_kauth_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
1349         proto_tree *tree, int offset, int opcode);
1350 static void dissect_kauth_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
1351         proto_tree *tree, int offset, int opcode);
1352 static void dissect_cb_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
1353         proto_tree *tree, int offset, int opcode);
1354 static void dissect_cb_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
1355         proto_tree *tree, int offset, int opcode);
1356 static void dissect_prot_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
1357         proto_tree *tree, int offset, int opcode);
1358 static void dissect_prot_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
1359         proto_tree *tree, int offset, int opcode);
1360 static void dissect_vldb_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
1361         proto_tree *tree, int offset, int opcode);
1362 static void dissect_vldb_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
1363         proto_tree *tree, int offset, int opcode);
1364 static void dissect_ubik_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
1365         proto_tree *tree, int offset, int opcode);
1366 static void dissect_ubik_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
1367         proto_tree *tree, int offset, int opcode);
1368 static void dissect_backup_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
1369         proto_tree *tree, int offset, int opcode);
1370 static void dissect_backup_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
1371         proto_tree *tree, int offset, int opcode);
1372
1373 /*
1374  * Hash Functions
1375  */
1376 static gint
1377 afs_equal(gconstpointer v, gconstpointer w)
1378 {
1379         const struct afs_request_key *v1 = (const struct afs_request_key *)v;
1380         const struct afs_request_key *v2 = (const struct afs_request_key *)w;
1381
1382         if (v1 -> conversation == v2 -> conversation &&
1383             v1 -> epoch == v2 -> epoch &&
1384             v1 -> cid == v2 -> cid &&
1385             v1 -> callnumber == v2 -> callnumber ) {
1386
1387                 return 1;
1388         }
1389
1390         return 0;
1391 }
1392
1393 static guint
1394 afs_hash (gconstpointer v)
1395 {
1396         const struct afs_request_key *key = (const struct afs_request_key *)v;
1397         guint val;
1398
1399         val = key -> conversation + key -> epoch + key -> cid + key -> callnumber;
1400
1401         return val;
1402 }
1403
1404 /*
1405  * Protocol initialization
1406  */
1407 static void
1408 afs_init_protocol(void)
1409 {
1410         if (afs_request_hash)
1411                 g_hash_table_destroy(afs_request_hash);
1412
1413         afs_request_hash = g_hash_table_new(afs_hash, afs_equal);
1414 }
1415
1416
1417
1418 /*
1419  * Dissection routines
1420  */
1421
1422 static void
1423 dissect_afs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1424 {
1425         struct rxinfo *rxinfo = pinfo->private_data;
1426         int reply = 0;
1427         conversation_t *conversation;
1428         struct afs_request_key request_key, *new_request_key;
1429         struct afs_request_val *request_val=NULL;
1430         proto_tree      *afs_tree, *afs_op_tree, *ti;
1431         proto_item              *hidden_item;
1432         int port, node, typenode, opcode;
1433         value_string_ext *vals_ext;
1434         int offset = 0;
1435         nstime_t delta_ts;
1436
1437         void (*dissector)(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode);
1438
1439
1440         col_set_str(pinfo->cinfo, COL_PROTOCOL, "AFS (RX)");
1441         col_clear(pinfo->cinfo, COL_INFO);
1442
1443         reply = (rxinfo->flags & RX_CLIENT_INITIATED) == 0;
1444         port = ((reply == 0) ? pinfo->destport : pinfo->srcport );
1445
1446         /*
1447          * Find out what conversation this packet is part of.
1448          * XXX - this should really be done by the transport-layer protocol,
1449          * although for connectionless transports, we may not want to do that
1450          * unless we know some higher-level protocol will want it - or we
1451          * may want to do it, so you can say e.g. "show only the packets in
1452          * this UDP 'connection'".
1453          *
1454          * Note that we don't have to worry about the direction this packet
1455          * was going - the conversation code handles that for us, treating
1456          * packets from A:X to B:Y as being part of the same conversation as
1457          * packets from B:Y to A:X.
1458          */
1459         conversation = find_or_create_conversation(pinfo);
1460
1461         request_key.conversation = conversation->index;
1462         request_key.service = rxinfo->serviceid;
1463         request_key.epoch = rxinfo->epoch;
1464         request_key.cid = rxinfo->cid;
1465         request_key.callnumber = rxinfo->callnumber;
1466
1467         request_val = (struct afs_request_val *) g_hash_table_lookup(
1468                 afs_request_hash, &request_key);
1469
1470         /* only allocate a new hash element when it's a request */
1471         opcode = 0;
1472         if(!pinfo->fd->flags.visited){
1473                 if ( !request_val && !reply) {
1474                         new_request_key = se_alloc(sizeof(struct afs_request_key));
1475                         *new_request_key = request_key;
1476
1477                         request_val = se_alloc(sizeof(struct afs_request_val));
1478                         request_val -> opcode = tvb_get_ntohl(tvb, offset);
1479                         request_val -> req_num = pinfo->fd->num;
1480                         request_val -> rep_num = 0;
1481                         request_val -> req_time = pinfo->fd->abs_ts;
1482
1483                         g_hash_table_insert(afs_request_hash, new_request_key,
1484                                 request_val);
1485                 }
1486                 if( request_val && reply ) {
1487                         request_val -> rep_num = pinfo->fd->num;
1488                 }
1489         }
1490
1491         if ( request_val ) {
1492                 opcode = request_val->opcode;
1493         }
1494
1495
1496         node = 0;
1497         typenode = 0;
1498         vals_ext = NULL;
1499         dissector = NULL;
1500         switch (port) {
1501                 case AFS_PORT_FS:
1502                         typenode = hf_afs_fs;
1503                         node = hf_afs_fs_opcode;
1504                         vals_ext = &fs_req_ext;
1505                         dissector = reply ? dissect_fs_reply : dissect_fs_request;
1506                         break;
1507                 case AFS_PORT_CB:
1508                         typenode = hf_afs_cb;
1509                         node = hf_afs_cb_opcode;
1510                         vals_ext = &cb_req_ext;
1511                         dissector = reply ? dissect_cb_reply : dissect_cb_request;
1512                         break;
1513                 case AFS_PORT_PROT:
1514                         typenode = hf_afs_prot;
1515                         node = hf_afs_prot_opcode;
1516                         vals_ext = &prot_req_ext;
1517                         dissector = reply ? dissect_prot_reply : dissect_prot_request;
1518                         break;
1519                 case AFS_PORT_VLDB:
1520                         typenode = hf_afs_vldb;
1521                         node = hf_afs_vldb_opcode;
1522                         vals_ext = &vldb_req_ext;
1523                         dissector = reply ? dissect_vldb_reply : dissect_vldb_request;
1524                         break;
1525                 case AFS_PORT_KAUTH:
1526                         typenode = hf_afs_kauth;
1527                         node = hf_afs_kauth_opcode;
1528                         vals_ext = &kauth_req_ext;
1529                         dissector = reply ? dissect_kauth_reply : dissect_kauth_request;
1530                         break;
1531                 case AFS_PORT_VOL:
1532                         typenode = hf_afs_vol;
1533                         node = hf_afs_vol_opcode;
1534                         vals_ext = &vol_req_ext;
1535                         dissector = reply ? dissect_vol_reply : dissect_vol_request;
1536                         break;
1537                 case AFS_PORT_ERROR:
1538                         typenode = hf_afs_error;
1539                         node = hf_afs_error_opcode;
1540                         /* dissector = reply ? dissect_error_reply : dissect_error_request; */
1541                         break;
1542                 case AFS_PORT_BOS:
1543                         typenode = hf_afs_bos;
1544                         node = hf_afs_bos_opcode;
1545                         vals_ext = &bos_req_ext;
1546                         dissector = reply ? dissect_bos_reply : dissect_bos_request;
1547                         break;
1548                 case AFS_PORT_UPDATE:
1549                         typenode = hf_afs_update;
1550                         node = hf_afs_update_opcode;
1551                         vals_ext = &update_req_ext;
1552                         /* dissector = reply ? dissect_update_reply : dissect_update_request; */
1553                         break;
1554                 case AFS_PORT_RMTSYS:
1555                         typenode = hf_afs_rmtsys;
1556                         node = hf_afs_rmtsys_opcode;
1557                         vals_ext = &rmtsys_req_ext;
1558                         /* dissector = reply ? dissect_rmtsys_reply : dissect_rmtsys_request; */
1559                         break;
1560                 case AFS_PORT_BACKUP:
1561                         typenode = hf_afs_backup;
1562                         node = hf_afs_backup_opcode;
1563                         vals_ext = &backup_req_ext;
1564                         dissector = reply ? dissect_backup_reply : dissect_backup_request;
1565                         break;
1566         }
1567
1568         if ( (opcode >= VOTE_LOW && opcode <= VOTE_HIGH) ||
1569                 (opcode >= DISK_LOW && opcode <= DISK_HIGH) ) {
1570                 typenode = hf_afs_ubik;
1571                 node = hf_afs_ubik_opcode;
1572                 vals_ext = &ubik_req_ext;
1573                 dissector = reply ? dissect_ubik_reply : dissect_ubik_request;
1574         }
1575
1576
1577         if ( VALID_OPCODE(opcode) ) {
1578                 if ( vals_ext ) {
1579                         col_add_fstr(pinfo->cinfo, COL_INFO, "%s%s %s: %s (%d)",
1580                                 typenode == hf_afs_ubik ? "UBIK-" : "",
1581                                 val_to_str_ext(port, &port_types_short_ext, "Unknown(%d)"),
1582                                 reply ? "Reply" : "Request",
1583                                 val_to_str_ext(opcode, vals_ext, "Unknown(%d)"), opcode);
1584                 } else {
1585                         col_add_fstr(pinfo->cinfo, COL_INFO, "%s%s %s: Unknown(%d)",
1586                                 typenode == hf_afs_ubik ? "UBIK-" : "",
1587                                 val_to_str_ext(port, &port_types_short_ext, "Unknown(%d)"),
1588                                 reply ? "Reply" : "Request",
1589                                 opcode);
1590                 }
1591         } else {
1592                 col_add_fstr(pinfo->cinfo, COL_INFO, "Encrypted %s %s",
1593                         val_to_str_ext(port, &port_types_short_ext, "Unknown(%d)"),
1594                         reply ? "Reply" : "Request"
1595                         );
1596         }
1597
1598         if (tree) {
1599                 ti = proto_tree_add_item(tree, proto_afs, tvb, offset, -1,
1600                                 FALSE);
1601                 afs_tree = proto_item_add_subtree(ti, ett_afs);
1602
1603                 proto_tree_add_text(afs_tree, tvb, 0, 0,
1604                         "Service: %s%s%s %s",
1605                         VALID_OPCODE(opcode) ? "" : "Encrypted ",
1606                         typenode == hf_afs_ubik ? "UBIK - " : "",
1607                         val_to_str_ext(port, &port_types_ext, "Unknown(%d)"),
1608                         reply ? "Reply" : "Request");
1609
1610                 if( request_val && !reply && request_val->rep_num) {
1611                         proto_tree_add_uint_format(afs_tree, hf_afs_repframe,
1612                             tvb, 0, 0, request_val->rep_num,
1613                             "The reply to this request is in frame %u",
1614                             request_val->rep_num);
1615                 }
1616                 if( request_val && reply && request_val->rep_num) {
1617                         proto_tree_add_uint_format(afs_tree, hf_afs_reqframe,
1618                             tvb, 0, 0, request_val->req_num,
1619                             "This is a reply to a request in frame %u",
1620                             request_val->req_num);
1621                         nstime_delta(&delta_ts, &pinfo->fd->abs_ts, &request_val->req_time);
1622                         proto_tree_add_time(afs_tree, hf_afs_time, tvb, offset, 0,
1623                                 &delta_ts);
1624                 }
1625
1626
1627                 if ( VALID_OPCODE(opcode) ) {
1628                         /* until we do cache, can't handle replies */
1629                         ti = NULL;
1630                         if ( !reply && node != 0 ) {
1631                                 if ( rxinfo->seq == 1 )
1632                                 {
1633                                         ti = proto_tree_add_uint(afs_tree,
1634                                                 node, tvb, offset, 4, opcode);
1635                                 } else {
1636                                         ti = proto_tree_add_uint(afs_tree,
1637                                                 node, tvb, 0, 0, opcode);
1638                                 }
1639                         } else if ( reply && node != 0 ) {
1640                                 /* the opcode isn't in this packet */
1641                                 ti = proto_tree_add_uint(afs_tree,
1642                                         node, tvb, 0, 0, opcode);
1643                         } else {
1644                                 ti = proto_tree_add_text(afs_tree, tvb,
1645                                         0, 0, "Operation: Unknown");
1646                         }
1647
1648                         /* Add the subtree for this particular service */
1649                         afs_op_tree = proto_item_add_subtree(ti, ett_afs_op);
1650
1651
1652                         if ( typenode != 0 ) {
1653                                 /* indicate the type of request */
1654                                 hidden_item = proto_tree_add_boolean(afs_tree, typenode, tvb, offset, 0, 1);
1655                                 PROTO_ITEM_SET_HIDDEN(hidden_item);
1656                         }
1657
1658                         /* Process the packet according to what service it is */
1659                         if ( dissector ) {
1660                                 (*dissector)(tvb, rxinfo, afs_op_tree, offset, opcode);
1661                         }
1662                 }
1663         }
1664
1665         /* if it's the last packet, and it's a reply, remove opcode
1666                 from hash */
1667         /* ignoring for now, I'm not sure how the chunk deallocation works */
1668         if ( rxinfo->flags & RX_LAST_PACKET && reply ){
1669
1670         }
1671 }
1672
1673
1674 /*
1675  * Here is a helper routine for adding an AFS acl to the proto tree
1676  * This is to be used with FS packets only
1677  *
1678  * An AFS ACL is a string that has the following format:
1679  *
1680  * <positive> <negative>
1681  * <uid1> <aclbits1>
1682  * ....
1683  *
1684  * "positive" and "negative" are integers which contain the number of
1685  * positive and negative ACL's in the string.  The uid/aclbits pair are
1686  * ASCII strings containing the UID/PTS record and and a ascii number
1687  * representing a logical OR of all the ACL permission bits
1688  */
1689 /*
1690  * XXX - FIXME:
1691  *
1692  *      sscanf is probably quite dangerous if we run outside the packet.
1693  *
1694  *      "GETSTR" doesn't guarantee that the resulting string is
1695  *      null-terminated.
1696  *
1697  * Should this just scan the string itself, rather than using "sscanf()"?
1698  */
1699 static int
1700 dissect_acl(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset)
1701 {
1702         int old_offset;
1703         gint32 bytes;
1704         int i, n, pos, neg, acl;
1705         char user[128] = "[Unknown]"; /* Be sure to adjust sscanf()s below if length is changed... */
1706
1707         old_offset = offset;
1708         bytes = tvb_get_ntohl(tvb, offset);
1709         OUT_UINT(hf_afs_fs_acl_datasize);
1710
1711
1712         if (sscanf(GETSTR, "%d %n", &pos, &n) != 1) {
1713                 /* does not matter what we return, if this fails,
1714                  * we cant dissect anything else in the packet either.
1715                  */
1716                 return offset;
1717         }
1718         proto_tree_add_uint(tree, hf_afs_fs_acl_count_positive, tvb,
1719                 offset, n, pos);
1720         offset += n;
1721
1722
1723         if (sscanf(GETSTR, "%d %n", &neg, &n) != 1) {
1724                 return offset;
1725         }
1726         proto_tree_add_uint(tree, hf_afs_fs_acl_count_negative, tvb,
1727                 offset, n, neg);
1728         offset += n;
1729
1730         /*
1731          * This wacky order preserves the order used by the "fs" command
1732          */
1733         for (i = 0; i < pos; i++) {
1734                 if (sscanf(GETSTR, "%127s %d %n", user, &acl, &n) != 2) {
1735                         return offset;
1736                 }
1737                 ACLOUT(user,1,acl,n);
1738                 offset += n;
1739         }
1740         for (i = 0; i < neg; i++) {
1741                 if (sscanf(GETSTR, "%127s %d %n", user, &acl, &n) != 2) {
1742                         return offset;
1743                 }
1744                 ACLOUT(user,0,acl,n);
1745                 offset += n;
1746                 if (offset >= old_offset+bytes ) {
1747                         return offset;
1748                 }
1749         }
1750
1751         return offset;
1752 }
1753
1754 /*
1755  * Here are the helper dissection routines
1756  */
1757
1758 static void
1759 dissect_fs_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
1760 {
1761         if ( rxinfo->type == RX_PACKET_TYPE_DATA )
1762         {
1763                 switch ( opcode )
1764                 {
1765                         case 130: /* fetch data */
1766                                 /* only on first packet */
1767                                 if ( rxinfo->seq == 1 )
1768                                 {
1769                                         OUT_FS_AFSFetchStatus("Status");
1770                                         OUT_FS_AFSCallBack();
1771                                         OUT_FS_AFSVolSync();
1772                                 }
1773                                 OUT_BYTES_ALL(hf_afs_fs_data);
1774                                 break;
1775                         case 131: /* fetch acl */
1776                                 offset = dissect_acl(tvb, rxinfo, tree, offset);
1777                                 OUT_FS_AFSFetchStatus("Status");
1778                                 OUT_FS_AFSVolSync();
1779                                 break;
1780                         case 132: /* Fetch status */
1781                                 OUT_FS_AFSFetchStatus("Status");
1782                                 OUT_FS_AFSCallBack();
1783                                 OUT_FS_AFSVolSync();
1784                                 break;
1785                         case 133: /* Store data */
1786                         case 134: /* Store ACL */
1787                         case 135: /* Store status */
1788                         case 136: /* Remove file */
1789                                 OUT_FS_AFSFetchStatus("Status");
1790                                 OUT_FS_AFSVolSync();
1791                                 break;
1792                         case 137: /* create file */
1793                         case 141: /* make dir */
1794                         case 161: /* lookup */
1795                         case 163: /* dfs symlink */
1796                                 OUT_FS_AFSFid((opcode == 137)? "New File" : ((opcode == 141)? "New Directory" : "File"));
1797                                 OUT_FS_AFSFetchStatus("File Status");
1798                                 OUT_FS_AFSFetchStatus("Directory Status");
1799                                 OUT_FS_AFSCallBack();
1800                                 OUT_FS_AFSVolSync();
1801                                 break;
1802                         case 138: /* rename */
1803                                 OUT_FS_AFSFetchStatus("Old Directory Status");
1804                                 OUT_FS_AFSFetchStatus("New Directory Status");
1805                                 OUT_FS_AFSVolSync();
1806                                 break;
1807                         case 139: /* symlink */
1808                                 OUT_FS_AFSFid("Symlink");
1809                         case 140: /* link */
1810                                 OUT_FS_AFSFetchStatus("Symlink Status");
1811                         case 142: /* rmdir */
1812                                 OUT_FS_AFSFetchStatus("Directory Status");
1813                                 OUT_FS_AFSVolSync();
1814                                 break;
1815                         case 143: /* old set lock */
1816                         case 144: /* old extend lock */
1817                         case 145: /* old release lock */
1818                         case 147: /* give up callbacks */
1819                         case 150: /* set volume status */
1820                         case 152: /* check token */
1821                                 /* nothing returned */
1822                                 break;
1823                         case 146: /* get statistics */
1824                                 OUT_FS_ViceStatistics();
1825                                 break;
1826                         case 148: /* get volume info */
1827                         case 154: /* n-get-volume-info */
1828                                 OUT_FS_VolumeInfo();
1829                                 break;
1830                         case 149: /* get volume status */
1831                                 OUT_FS_AFSFetchVolumeStatus();
1832                                 OUT_RXString(hf_afs_fs_volname);
1833                                 OUT_RXString(hf_afs_fs_offlinemsg);
1834                                 OUT_RXString(hf_afs_fs_motd);
1835                                 break;
1836                         case 151: /* root volume */
1837                                 OUT_RXString(hf_afs_fs_volname);
1838                                 break;
1839                         case 153: /* get time */
1840                                 OUT_TIMESTAMP(hf_afs_fs_timestamp);
1841                                 break;
1842                         case 155: /* bulk status */
1843                                 OUT_FS_AFSBulkStats();
1844                                 SKIP(4);
1845                                 OUT_FS_AFSCBs();
1846                                 OUT_FS_AFSVolSync();
1847                                 break;
1848                         case 156: /* set lock */
1849                         case 157: /* extend lock */
1850                         case 158: /* release lock */
1851                                 OUT_FS_AFSVolSync();
1852                                 break;
1853                         case 159: /* x-stats-version */
1854                                 OUT_UINT(hf_afs_fs_xstats_version);
1855                                 break;
1856                         case 160: /* get xstats */
1857                                 OUT_UINT(hf_afs_fs_xstats_version);
1858                                 OUT_TIMESECS(hf_afs_fs_xstats_timestamp);
1859                                 OUT_FS_AFS_CollData();
1860                                 break;
1861                         case 162: /* flush cps */
1862                                 OUT_UINT(hf_afs_fs_cps_spare2);
1863                                 OUT_UINT(hf_afs_fs_cps_spare3);
1864                                 break;
1865                 }
1866         }
1867         else if ( rxinfo->type == RX_PACKET_TYPE_ABORT )
1868         {
1869                 OUT_UINT(hf_afs_fs_errcode);
1870         }
1871 }
1872
1873 static void
1874 dissect_fs_request(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
1875 {
1876         /* skip the opcode if this is the first packet in the stream */
1877         if ( rxinfo->seq == 1 )
1878         {
1879                 offset += 4;  /* skip the opcode */
1880         }
1881
1882         switch ( opcode )
1883         {
1884                 case 130: /* Fetch data */
1885                         OUT_FS_AFSFid("Source");
1886                         OUT_UINT(hf_afs_fs_offset);
1887                         OUT_UINT(hf_afs_fs_length);
1888                         break;
1889                 case 131: /* Fetch ACL */
1890                         OUT_FS_AFSFid("Target");
1891                         break;
1892                 case 132: /* Fetch Status */
1893                         OUT_FS_AFSFid("Target");
1894                         break;
1895                 case 133: /* Store Data */
1896                         if ( rxinfo->seq == 1 )
1897                         {
1898                                 OUT_FS_AFSFid("Destination");
1899                                 OUT_FS_AFSStoreStatus("Status");
1900                                 OUT_UINT(hf_afs_fs_offset);
1901                                 OUT_UINT(hf_afs_fs_length);
1902                                 OUT_UINT(hf_afs_fs_flength);
1903                         }
1904                         OUT_BYTES_ALL(hf_afs_fs_data);
1905                         break;
1906                 case 134: /* Store ACL */
1907                         OUT_FS_AFSFid("Target");
1908                         offset = dissect_acl(tvb, rxinfo, tree, offset);
1909                         break;
1910                 case 135: /* Store Status */
1911                         OUT_FS_AFSFid("Target");
1912                         OUT_FS_AFSStoreStatus("Status");
1913                         break;
1914                 case 136: /* Remove File */
1915                         OUT_FS_AFSFid("Remove File");
1916                         OUT_RXString(hf_afs_fs_name);
1917                         break;
1918                 case 137: /* Create File */
1919                         OUT_FS_AFSFid("Target");
1920                         OUT_RXString(hf_afs_fs_name);
1921                         OUT_FS_AFSStoreStatus("Status");
1922                         break;
1923                 case 138: /* Rename file */
1924                         OUT_FS_AFSFid("Old");
1925                         OUT_RXString(hf_afs_fs_oldname);
1926                         OUT_FS_AFSFid("New");
1927                         OUT_RXString(hf_afs_fs_newname);
1928                         break;
1929                 case 139: /* Symlink */
1930                         OUT_FS_AFSFid("File");
1931                         OUT_RXString(hf_afs_fs_symlink_name);
1932                         OUT_RXString(hf_afs_fs_symlink_content);
1933                         OUT_FS_AFSStoreStatus("Status");
1934                         break;
1935                 case 140: /* Link */
1936                         OUT_FS_AFSFid("Link To (New File)");
1937                         OUT_RXString(hf_afs_fs_name);
1938                         OUT_FS_AFSFid("Link From (Old File)");
1939                         break;
1940                 case 141: /* Make dir */
1941                         OUT_FS_AFSFid("Target");
1942                         OUT_RXString(hf_afs_fs_name);
1943                         OUT_FS_AFSStoreStatus("Status");
1944                         break;
1945                 case 142: /* Remove dir */
1946                         OUT_FS_AFSFid("Target");
1947                         OUT_RXString(hf_afs_fs_name);
1948                         break;
1949                 case 143: /* Old Set Lock */
1950                         OUT_FS_AFSFid("Target");
1951                         OUT_UINT(hf_afs_fs_vicelocktype);
1952                         OUT_FS_AFSVolSync();
1953                         break;
1954                 case 144: /* Old Extend Lock */
1955                         OUT_FS_AFSFid("Target");
1956                         OUT_FS_AFSVolSync();
1957                         break;
1958                 case 145: /* Old Release Lock */
1959                         OUT_FS_AFSFid("Target");
1960                         OUT_FS_AFSVolSync();
1961                         break;
1962                 case 146: /* Get statistics */
1963                         /* no params */
1964                         break;
1965                 case 147: /* Give up callbacks */
1966                         OUT_FS_AFSCBFids();
1967                         OUT_FS_AFSCBs();
1968                         break;
1969                 case 148: /* Get vol info */
1970                         OUT_RXString(hf_afs_fs_volname);
1971                         break;
1972                 case 149: /* Get vol stats */
1973                         OUT_UINT(hf_afs_fs_volid);
1974                         break;
1975                 case 150: /* Set vol stats */
1976                         OUT_UINT(hf_afs_fs_volid);
1977                         OUT_FS_AFSStoreVolumeStatus();
1978                         OUT_RXString(hf_afs_fs_volname);
1979                         OUT_RXString(hf_afs_fs_offlinemsg);
1980                         OUT_RXString(hf_afs_fs_motd);
1981                         break;
1982                 case 151: /* get root volume */
1983                         /* no params */
1984                         break;
1985                 case 152: /* check token */
1986                         OUT_UINT(hf_afs_fs_viceid);
1987                         OUT_FS_AFSTOKEN();
1988                         break;
1989                 case 153: /* get time */
1990                         /* no params */
1991                         break;
1992                 case 154: /* new get vol info */
1993                         OUT_RXString(hf_afs_fs_volname);
1994                         break;
1995                 case 155: /* bulk stat */
1996                         OUT_FS_AFSCBFids();
1997                         break;
1998                 case 156: /* Set Lock */
1999                         OUT_FS_AFSFid("Target");
2000                         OUT_UINT(hf_afs_fs_vicelocktype);
2001                         break;
2002                 case 157: /* Extend Lock */
2003                         OUT_FS_AFSFid("Target");
2004                         break;
2005                 case 158: /* Release Lock */
2006                         OUT_FS_AFSFid("Target");
2007                         break;
2008                 case 159: /* xstats version */
2009                         /* no params */
2010                         break;
2011                 case 160: /* get xstats */
2012                         OUT_UINT(hf_afs_fs_xstats_clientversion);
2013                         OUT_UINT(hf_afs_fs_xstats_collnumber);
2014                         break;
2015                 case 161: /* lookup */
2016                         OUT_FS_AFSFid("Target");
2017                         OUT_RXString(hf_afs_fs_name);
2018                         break;
2019                 case 162: /* flush cps */
2020                         OUT_FS_ViceIds();
2021                         OUT_FS_IPAddrs();
2022                         OUT_UINT(hf_afs_fs_cps_spare1);
2023                         break;
2024                 case 163: /* dfs symlink */
2025                         OUT_FS_AFSFid("Target");
2026                         OUT_RXString(hf_afs_fs_symlink_name);
2027                         OUT_RXString(hf_afs_fs_symlink_content);
2028                         OUT_FS_AFSStoreStatus("Symlink Status");
2029                         break;
2030                 case 220: /* residencycmd */
2031                         OUT_FS_AFSFid("Target");
2032                         /* need residency inputs here */
2033                         break;
2034                 case 65536: /* inline bulk status */
2035                         OUT_FS_AFSCBFids();
2036                         break;
2037                 case 65537: /* fetch-data-64 */
2038                         OUT_FS_AFSFid("Target");
2039                         OUT_INT64(hf_afs_fs_offset64);
2040                         OUT_INT64(hf_afs_fs_length64);
2041                         /* need more here */
2042                         break;
2043                 case 65538: /* store-data-64 */
2044                         OUT_FS_AFSFid("Target");
2045                         OUT_FS_AFSStoreStatus("Status");
2046                         OUT_INT64(hf_afs_fs_offset64);
2047                         OUT_INT64(hf_afs_fs_length64);
2048                         OUT_INT64(hf_afs_fs_flength64);
2049                         /* need residency inputs here */
2050                         break;
2051                 case 65539: /* give up all cbs */
2052                         break;
2053                 case 65540: /* get capabilities */
2054                         break;
2055         }
2056 }
2057
2058 /*
2059  * BOS Helpers
2060  */
2061 static void
2062 dissect_bos_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
2063 {
2064         if ( rxinfo->type == RX_PACKET_TYPE_DATA )
2065         {
2066                 switch ( opcode )
2067                 {
2068                         case 80: /* create bnode */
2069                                 /* no output */
2070                                 break;
2071                         case 81: /* delete bnode */
2072                                 /* no output */
2073                                 break;
2074                         case 82: /* set status */
2075                                 /* no output */
2076                                 break;
2077                         case 83: /* get status */
2078                                 OUT_INT(hf_afs_bos_status);
2079                                 OUT_RXString(hf_afs_bos_statusdesc);
2080                                 break;
2081                         case 84: /* enumerate instance */
2082                                 OUT_RXString(hf_afs_bos_instance);
2083                                 break;
2084                         case 85: /* get instance info */
2085                                 OUT_RXString(hf_afs_bos_type);
2086                                 OUT_BOS_STATUS();
2087                                 break;
2088                         case 86: /* get instance parm */
2089                                 OUT_RXString(hf_afs_bos_parm);
2090                                 break;
2091                         case 87: /* add siperuser */
2092                                 /* no output */
2093                                 break;
2094                         case 88: /* delete superuser */
2095                                 /* no output */
2096                                 break;
2097                         case 89: /* list superusers */
2098                                 OUT_RXString(hf_afs_bos_user);
2099                                 break;
2100                         case 90: /* list keys */
2101                                 OUT_UINT(hf_afs_bos_kvno);
2102                                 OUT_BOS_KEY();
2103                                 OUT_BOS_KEYINFO();
2104                                 break;
2105                         case 91: /* add key */
2106                                 /* no output */
2107                                 break;
2108                         case 92: /* delete key */
2109                                 /* no output */
2110                                 break;
2111                         case 93: /* set cell name */
2112                                 /* no output */
2113                                 break;
2114                         case 94: /* get cell name */
2115                                 OUT_RXString(hf_afs_bos_cell);
2116                                 break;
2117                         case 95: /* get cell host */
2118                                 OUT_RXString(hf_afs_bos_host);
2119                                 break;
2120                         case 96: /* add cell host */
2121                                 /* no output */
2122                                 break;
2123                         case 97: /* delete cell host */
2124                                 /* no output */
2125                                 break;
2126                         case 98: /* set tstatus */
2127                                 /* no output */
2128                                 break;
2129                         case 99: /* shutdown all */
2130                                 /* no output */
2131                                 break;
2132                         case 100: /* restart all */
2133                                 /* no output */
2134                                 break;
2135                         case 101: /* startup all */
2136                                 /* no output */
2137                                 break;
2138                         case 102: /* set noauth flag */
2139                                 /* no output */
2140                                 break;
2141                         case 103: /* rebozo */
2142                                 /* no output */
2143                                 break;
2144                         case 104: /* restart */
2145                                 /* no output */
2146                                 break;
2147                         case 105: /* install */
2148                                 /* no output */
2149                                 break;
2150                         case 106: /* uninstall */
2151                                 /* no output */
2152                                 break;
2153                         case 107: /* get dates */
2154                                 OUT_TIMESECS(hf_afs_bos_newtime);
2155                                 OUT_TIMESECS(hf_afs_bos_baktime);
2156                                 OUT_TIMESECS(hf_afs_bos_oldtime);
2157                                 break;
2158                         case 108: /* exec */
2159                                 /* no output */
2160                                 break;
2161                         case 109: /* prune */
2162                                 /* no output */
2163                                 break;
2164                         case 110: /* set restart time */
2165                                 /* no output */
2166                                 break;
2167                         case 111: /* get restart time */
2168                                 OUT_BOS_TIME();
2169                                 break;
2170                         case 112: /* get log */
2171                                 /* need to make this dump a big string somehow */
2172                                 OUT_BYTES_ALL(hf_afs_bos_data);
2173                                 break;
2174                         case 113: /* wait all */
2175                                 /* no output */
2176                                 break;
2177                         case 114: /* get instance strings */
2178                                 OUT_RXString(hf_afs_bos_error);
2179                                 OUT_RXString(hf_afs_bos_spare1);
2180                                 OUT_RXString(hf_afs_bos_spare2);
2181                                 OUT_RXString(hf_afs_bos_spare3);
2182                                 break;
2183                 }
2184         }
2185         else if ( rxinfo->type == RX_PACKET_TYPE_ABORT )
2186         {
2187                 OUT_UINT(hf_afs_bos_errcode);
2188         }
2189 }
2190
2191 static void
2192 dissect_bos_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode)
2193 {
2194         offset += 4;  /* skip the opcode */
2195
2196         switch ( opcode )
2197         {
2198                 case 80: /* create b node */
2199                         OUT_RXString(hf_afs_bos_type);
2200                         OUT_RXString(hf_afs_bos_instance);
2201                         OUT_RXString(hf_afs_bos_parm);
2202                         OUT_RXString(hf_afs_bos_parm);
2203                         OUT_RXString(hf_afs_bos_parm);
2204                         OUT_RXString(hf_afs_bos_parm);
2205                         OUT_RXString(hf_afs_bos_parm);
2206                         OUT_RXString(hf_afs_bos_parm);
2207                         break;
2208                 case 81: /* delete b node */
2209                         OUT_RXString(hf_afs_bos_instance);
2210                         break;
2211                 case 82: /* set status */
2212                         OUT_RXString(hf_afs_bos_instance);
2213                         OUT_INT(hf_afs_bos_status);
2214                         break;
2215                 case 83: /* get status */
2216                         OUT_RXString(hf_afs_bos_instance);
2217                         break;
2218                 case 84: /* enumerate instance */
2219                         OUT_UINT(hf_afs_bos_num);
2220                         break;
2221                 case 85: /* get instance info */
2222                         OUT_RXString(hf_afs_bos_instance);
2223                         break;
2224                 case 86: /* get instance parm */
2225                         OUT_RXString(hf_afs_bos_instance);
2226                         OUT_UINT(hf_afs_bos_num);
2227                         break;
2228                 case 87: /* add super user */
2229                         OUT_RXString(hf_afs_bos_user);
2230                         break;
2231                 case 88: /* delete super user */
2232                         OUT_RXString(hf_afs_bos_user);
2233                         break;
2234                 case 89: /* list super users */
2235                         OUT_UINT(hf_afs_bos_num);
2236                         break;
2237                 case 90: /* list keys */
2238                         OUT_UINT(hf_afs_bos_num);
2239                         break;
2240                 case 91: /* add key */
2241                         OUT_UINT(hf_afs_bos_num);
2242                         OUT_BOS_KEY();
2243                         break;
2244                 case 92: /* delete key */
2245                         OUT_UINT(hf_afs_bos_num);
2246                         break;
2247                 case 93: /* set cell name */
2248                         OUT_RXString(hf_afs_bos_content);
2249                         break;
2250                 case 95: /* set cell host */
2251                         OUT_UINT(hf_afs_bos_num);
2252                         break;
2253                 case 96: /* add cell host */
2254                         OUT_RXString(hf_afs_bos_content);
2255                         break;
2256                 case 97: /* delete cell host */
2257                         OUT_RXString(hf_afs_bos_content);
2258                         break;
2259                 case 98: /* set t status */
2260                         OUT_RXString(hf_afs_bos_content);
2261                         OUT_INT(hf_afs_bos_status);
2262                         break;
2263                 case 99: /* shutdown all */
2264                         /* no params */
2265                         break;
2266                 case 100: /* restart all */
2267                         /* no params */
2268                         break;
2269                 case 101: /* startup all */
2270                         /* no params */
2271                         break;
2272                 case 102: /* set no-auth flag */
2273                         OUT_UINT(hf_afs_bos_flags);
2274                         break;
2275                 case 103: /* re-bozo? */
2276                         /* no params */
2277                         break;
2278                 case 104: /* restart */
2279                         OUT_RXString(hf_afs_bos_instance);
2280                         break;
2281                 case 105: /* install */
2282                         OUT_RXString(hf_afs_bos_path);
2283                         OUT_UINT(hf_afs_bos_size);
2284                         OUT_UINT(hf_afs_bos_flags);
2285                         OUT_UINT(hf_afs_bos_date);
2286                         break;
2287                 case 106: /* uninstall */
2288                         OUT_RXString(hf_afs_bos_path);
2289                         break;
2290                 case 107: /* get dates */
2291                         OUT_RXString(hf_afs_bos_path);
2292                         break;
2293                 case 108: /* exec */
2294                         OUT_RXString(hf_afs_bos_cmd);
2295                         break;
2296                 case 109: /* prune */
2297                         OUT_UINT(hf_afs_bos_flags);
2298                         break;
2299                 case 110: /* set restart time */
2300                         OUT_UINT(hf_afs_bos_num);
2301                         OUT_BOS_TIME();
2302                         break;
2303                 case 111: /* get restart time */
2304                         OUT_UINT(hf_afs_bos_num);
2305                         break;
2306                 case 112: /* get log */
2307                         OUT_RXString(hf_afs_bos_file);
2308                         break;
2309                 case 113: /* wait all */
2310                         /* no params */
2311                         break;
2312                 case 114: /* get instance strings */
2313                         OUT_RXString(hf_afs_bos_content);
2314                         break;
2315         }
2316 }
2317
2318 /*
2319  * VOL Helpers
2320  */
2321 static void
2322 dissect_vol_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
2323 {
2324         if ( rxinfo->type == RX_PACKET_TYPE_DATA )
2325         {
2326                 switch ( opcode )
2327                 {
2328                         case 121:
2329                                 /* should loop here maybe */
2330                                 OUT_UINT(hf_afs_vol_count);
2331                                 OUT_RXStringV(hf_afs_vol_name, 32); /* not sure on  */
2332                                 break;
2333                 }
2334         }
2335         else if ( rxinfo->type == RX_PACKET_TYPE_ABORT )
2336         {
2337                 OUT_UINT(hf_afs_vol_errcode);
2338         }
2339 }
2340
2341 static void
2342 dissect_vol_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode)
2343 {
2344         offset += 4;  /* skip the opcode */
2345
2346         switch ( opcode )
2347         {
2348                 case 121: /* list one vol */
2349                         OUT_UINT(hf_afs_vol_count);
2350                         OUT_UINT(hf_afs_vol_id);
2351                         break;
2352         }
2353 }
2354
2355 /*
2356  * KAUTH Helpers
2357  */
2358 static void
2359 dissect_kauth_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
2360 {
2361         if ( rxinfo->type == RX_PACKET_TYPE_DATA )
2362         {
2363                 switch ( opcode )
2364                 {
2365                 }
2366         }
2367         else if ( rxinfo->type == RX_PACKET_TYPE_ABORT )
2368         {
2369                 OUT_UINT(hf_afs_kauth_errcode);
2370         }
2371 }
2372
2373 static void
2374 dissect_kauth_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode)
2375 {
2376         offset += 4;  /* skip the opcode */
2377
2378         switch ( opcode )
2379         {
2380                 case 1: /* authenticate old */
2381                 case 21: /* authenticate */
2382                 case 22: /* authenticate v2 */
2383                 case 2: /* change pw */
2384                 case 5: /* set fields */
2385                 case 6: /* create user */
2386                 case 7: /* delete user */
2387                 case 8: /* get entry */
2388                 case 14: /* unlock */
2389                 case 15: /* lock status */
2390                         OUT_RXString(hf_afs_kauth_princ);
2391                         OUT_RXString(hf_afs_kauth_realm);
2392                         OUT_BYTES_ALL(hf_afs_kauth_data);
2393                         break;
2394                 case 3: /* getticket-old */
2395                 case 23: /* getticket */
2396                         OUT_KAUTH_GetTicket();
2397                         break;
2398                 case 4: /* set pass */
2399                         OUT_RXString(hf_afs_kauth_princ);
2400                         OUT_RXString(hf_afs_kauth_realm);
2401                         OUT_UINT(hf_afs_kauth_kvno);
2402                         break;
2403                 case 12: /* get pass */
2404                         OUT_RXString(hf_afs_kauth_name);
2405                         break;
2406         }
2407 }
2408
2409 /*
2410  * CB Helpers
2411  */
2412 static void
2413 dissect_cb_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
2414 {
2415         if ( rxinfo->type == RX_PACKET_TYPE_DATA )
2416         {
2417                 switch ( opcode )
2418                 {
2419                 }
2420         }
2421         else if ( rxinfo->type == RX_PACKET_TYPE_ABORT )
2422         {
2423                 OUT_UINT(hf_afs_cb_errcode);
2424         }
2425 }
2426
2427 static void
2428 dissect_cb_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode)
2429 {
2430         offset += 4;  /* skip the opcode */
2431
2432         switch ( opcode )
2433         {
2434                 case 204: /* callback */
2435                 {
2436                         unsigned int i,j;
2437
2438                         j = tvb_get_ntohl(tvb, offset);
2439                         offset += 4;
2440
2441                         for (i=0; i<j; i++)
2442                         {
2443                                 OUT_CB_AFSFid("Target");
2444                         }
2445
2446                         j = tvb_get_ntohl(tvb, offset);
2447                         offset += 4;
2448                         for (i=0; i<j; i++)
2449                         {
2450                                 OUT_CB_AFSCallBack();
2451                         }
2452                 }
2453         }
2454 }
2455
2456 /*
2457  * PROT Helpers
2458  */
2459 static void
2460 dissect_prot_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
2461 {
2462         if ( rxinfo->type == RX_PACKET_TYPE_DATA )
2463         {
2464                 switch ( opcode )
2465                 {
2466                         case 504: /* name to id */
2467                                 {
2468                                         unsigned int i, j;
2469
2470                                         j = tvb_get_ntohl(tvb, offset);
2471                                         OUT_UINT(hf_afs_prot_count);
2472
2473                                         for (i=0; i<j; i++)
2474                                         {
2475                                                 OUT_UINT(hf_afs_prot_id);
2476                                         }
2477                                 }
2478                                 break;
2479                         case 505: /* id to name */
2480                                 {
2481                                         unsigned int i, j;
2482
2483                                         j = tvb_get_ntohl(tvb, offset);
2484                                         OUT_UINT(hf_afs_prot_count);
2485
2486                                         for (i=0; i<j; i++)
2487                                         {
2488                                                 OUT_RXStringV(hf_afs_prot_name, PRNAMEMAX);
2489                                         }
2490                                 }
2491                                 break;
2492                         case 508: /* get cps */
2493                         case 514: /* list elements */
2494                         case 517: /* list owned */
2495                         case 518: /* get cps2 */
2496                         case 519: /* get host cps */
2497                                 {
2498                                         unsigned int i, j;
2499
2500                                         j = tvb_get_ntohl(tvb, offset);
2501                                         OUT_UINT(hf_afs_prot_count);
2502
2503                                         for (i=0; i<j; i++)
2504                                         {
2505                                                 OUT_UINT(hf_afs_prot_id);
2506                                         }
2507                                 }
2508                                 break;
2509                         case 510: /* list max */
2510                                 OUT_UINT(hf_afs_prot_maxuid);
2511                                 OUT_UINT(hf_afs_prot_maxgid);
2512                                 break;
2513                 }
2514         }
2515         else if ( rxinfo->type == RX_PACKET_TYPE_ABORT )
2516         {
2517                 OUT_UINT(hf_afs_prot_errcode);
2518         }
2519 }
2520
2521 static void
2522 dissect_prot_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode)
2523 {
2524         offset += 4;  /* skip the opcode */
2525
2526         switch ( opcode )
2527         {
2528                 case 500: /* new user */
2529                         OUT_RXString(hf_afs_prot_name);
2530                         OUT_UINT(hf_afs_prot_id);
2531                         OUT_UINT(hf_afs_prot_oldid);
2532                         break;
2533                 case 501: /* where is it */
2534                 case 506: /* delete */
2535                 case 508: /* get cps */
2536                 case 512: /* list entry */
2537                 case 514: /* list elements */
2538                 case 517: /* list owned */
2539                 case 519: /* get host cps */
2540                         OUT_UINT(hf_afs_prot_id);
2541                         break;
2542                 case 502: /* dump entry */
2543                         OUT_UINT(hf_afs_prot_pos);
2544                         break;
2545                 case 503: /* add to group */
2546                 case 507: /* remove from group */
2547                 case 515: /* is a member of? */
2548                         OUT_UINT(hf_afs_prot_uid);
2549                         OUT_UINT(hf_afs_prot_gid);
2550                         break;
2551                 case 504: /* name to id */
2552                         {
2553                                 unsigned int i, j;
2554
2555                                 j = tvb_get_ntohl(tvb, offset);
2556                                 OUT_UINT(hf_afs_prot_count);
2557
2558                                 for (i=0; i<j; i++)
2559                                 {
2560                                         OUT_RXStringV(hf_afs_prot_name,PRNAMEMAX);
2561                                 }
2562                         }
2563                         break;
2564                 case 505: /* id to name */
2565                         {
2566                                 unsigned int i, j;
2567
2568                                 j = tvb_get_ntohl(tvb, offset);
2569                                 OUT_UINT(hf_afs_prot_count);
2570
2571                                 for (i=0; i<j; i++)
2572                                 {
2573                                         OUT_UINT(hf_afs_prot_id);
2574                                 }
2575                         }
2576                         break;
2577                 case 509: /* new entry */
2578                         OUT_RXString(hf_afs_prot_name);
2579                         OUT_UINT(hf_afs_prot_flag);
2580                         OUT_UINT(hf_afs_prot_oldid);
2581                         break;
2582                 case 511: /* set max */
2583                         OUT_UINT(hf_afs_prot_id);
2584                         OUT_UINT(hf_afs_prot_flag);
2585                         break;
2586                 case 513: /* change entry */
2587                         OUT_UINT(hf_afs_prot_id);
2588                         OUT_RXString(hf_afs_prot_name);
2589                         OUT_UINT(hf_afs_prot_oldid);
2590                         OUT_UINT(hf_afs_prot_newid);
2591                         break;
2592                 case 520: /* update entry */
2593                         OUT_UINT(hf_afs_prot_id);
2594                         OUT_RXString(hf_afs_prot_name);
2595                         break;
2596         }
2597 }
2598
2599 /*
2600  * VLDB Helpers
2601  */
2602 static void
2603 dissect_vldb_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
2604 {
2605         if ( rxinfo->type == RX_PACKET_TYPE_DATA )
2606         {
2607                 switch ( opcode )
2608                 {
2609                         case 510: /* list entry */
2610                                 OUT_UINT(hf_afs_vldb_count);
2611                                 OUT_UINT(hf_afs_vldb_nextindex);
2612                                 break;
2613                         case 503: /* get entry by id */
2614                         case 504: /* get entry by name */
2615                                 {
2616                                         int nservers,i,j;
2617                                         OUT_RXStringV(hf_afs_vldb_name, VLNAMEMAX);
2618                                         SKIP(4);
2619                                         nservers = tvb_get_ntohl(tvb, offset);
2620                                         OUT_UINT(hf_afs_vldb_numservers);
2621                                         for (i=0; i<8; i++)
2622                                         {
2623                                                 if ( i<nservers )
2624                                                 {
2625                                                         OUT_IP(hf_afs_vldb_server);
2626                                                 }
2627                                                 else
2628                                                 {
2629                                                         SKIP(4);
2630                                                 }
2631                                         }
2632                                         for (i=0; i<8; i++)
2633                                         {
2634                                                 char *part;
2635                                                 j = tvb_get_ntohl(tvb, offset);
2636                                                 part=ep_strdup("/vicepa");
2637                                                 if ( i<nservers && j<=25 )
2638                                                 {
2639                                                         part[6] = 'a' + (char) j;
2640                                                         proto_tree_add_string(tree, hf_afs_vldb_partition, tvb,
2641                                                                 offset, 4, part);
2642                                                 }
2643                                                 SKIP(4);
2644                                         }
2645                                         SKIP(8 * 4);
2646                                         OUT_UINT(hf_afs_vldb_rwvol);
2647                                         OUT_UINT(hf_afs_vldb_rovol);
2648                                         OUT_UINT(hf_afs_vldb_bkvol);
2649                                         OUT_UINT(hf_afs_vldb_clonevol);
2650                                         OUT_VLDB_Flags();
2651                                 }
2652                                 break;
2653                         case 505: /* get new volume id */
2654                                 OUT_UINT(hf_afs_vldb_id);
2655                                 break;
2656                         case 521: /* list entry */
2657                         case 529: /* list entry U */
2658                                 OUT_UINT(hf_afs_vldb_count);
2659                                 OUT_UINT(hf_afs_vldb_nextindex);
2660                                 break;
2661                         case 518: /* get entry by id n */
2662                         case 519: /* get entry by name N */
2663                                 {
2664                                         int nservers,i,j;
2665                                         OUT_RXStringV(hf_afs_vldb_name, VLNAMEMAX);
2666                                         nservers = tvb_get_ntohl(tvb, offset);
2667                                         OUT_UINT(hf_afs_vldb_numservers);
2668                                         for (i=0; i<13; i++)
2669                                         {
2670                                                 if ( i<nservers )
2671                                                 {
2672                                                         OUT_IP(hf_afs_vldb_server);
2673                                                 }
2674                                                 else
2675                                                 {
2676                                                         SKIP(4);
2677                                                 }
2678                                         }
2679                                         for (i=0; i<13; i++)
2680                                         {
2681                                                 char *part;
2682                                                 j = tvb_get_ntohl(tvb, offset);
2683                                                 part=ep_strdup("/vicepa");
2684                                                 if ( i<nservers && j<=25 )
2685                                                 {
2686                                                         part[6] = 'a' + (char) j;
2687                                                         proto_tree_add_string(tree, hf_afs_vldb_partition, tvb,
2688                                                                 offset, 4, part);
2689                                                 }
2690                                                 SKIP(4);
2691                                         }
2692                                         SKIP(13 * 4);
2693                                         OUT_UINT(hf_afs_vldb_rwvol);
2694                                         OUT_UINT(hf_afs_vldb_rovol);
2695                                         OUT_UINT(hf_afs_vldb_bkvol);
2696                                 }
2697                                 break;
2698                         case 526: /* get entry by id u */
2699                         case 527: /* get entry by name u */
2700                                 {
2701                                         int nservers,i,j;
2702                                         OUT_RXStringV(hf_afs_vldb_name, VLNAMEMAX);
2703                                         nservers = tvb_get_ntohl(tvb, offset);
2704                                         OUT_UINT(hf_afs_vldb_numservers);
2705                                         for (i=0; i<13; i++)
2706                                         {
2707                                                 if ( i<nservers )
2708                                                 {
2709                                                         OUT_UUID(hf_afs_vldb_serveruuid);
2710                                                 }
2711                                                 else
2712                                                 {
2713                                                         SKIP_UUID();
2714                                                 }
2715                                         }
2716                                         for (i=0; i<13; i++)
2717                                         {
2718                                                 if ( i<nservers )
2719                                                 {
2720                                                         OUT_UINT(hf_afs_vldb_serveruniq);
2721                                                 }
2722                                                 else
2723                                                 {
2724                                                         SKIP(4);
2725                                                 }
2726                                         }
2727                                         for (i=0; i<13; i++)
2728                                         {
2729                                                 char *part;
2730                                                 j = tvb_get_ntohl(tvb, offset);
2731                                                 part=ep_strdup("/vicepa");
2732                                                 if ( i<nservers && j<=25 )
2733                                                 {
2734                                                         part[6] = 'a' + (char) j;
2735                                                         proto_tree_add_string(tree, hf_afs_vldb_partition, tvb,
2736                                                                 offset, 4, part);
2737                                                 }
2738                                                 SKIP(4);
2739                                         }
2740                                         for (i=0; i<13; i++)
2741                                         {
2742                                                 if ( i<nservers )
2743                                                 {
2744                                                         OUT_UINT(hf_afs_vldb_serverflags);
2745                                                 }
2746                                                 else
2747                                                 {
2748                                                         SKIP(4);
2749                                                 }
2750                                         }
2751                                         OUT_UINT(hf_afs_vldb_rwvol);
2752                                         OUT_UINT(hf_afs_vldb_rovol);
2753                                         OUT_UINT(hf_afs_vldb_bkvol);
2754                                         OUT_UINT(hf_afs_vldb_clonevol);
2755                                         OUT_UINT(hf_afs_vldb_flags);
2756                                         OUT_UINT(hf_afs_vldb_spare1);
2757                                         OUT_UINT(hf_afs_vldb_spare2);
2758                                         OUT_UINT(hf_afs_vldb_spare3);
2759                                         OUT_UINT(hf_afs_vldb_spare4);
2760                                         OUT_UINT(hf_afs_vldb_spare5);
2761                                         OUT_UINT(hf_afs_vldb_spare6);
2762                                         OUT_UINT(hf_afs_vldb_spare7);
2763                                         OUT_UINT(hf_afs_vldb_spare8);
2764                                         OUT_UINT(hf_afs_vldb_spare9);
2765                                 }
2766                                 break;
2767                 }
2768         }
2769         else if ( rxinfo->type == RX_PACKET_TYPE_ABORT )
2770         {
2771                 OUT_UINT(hf_afs_vldb_errcode);
2772         }
2773 }
2774
2775 static void
2776 dissect_vldb_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode)
2777 {
2778         offset += 4;  /* skip the opcode */
2779
2780         switch ( opcode )
2781         {
2782                 case 501: /* create new volume */
2783                 case 517: /* create entry N */
2784                         OUT_RXStringV(hf_afs_vldb_name, VLNAMEMAX);
2785                         break;
2786                 case 502: /* delete entry */
2787                 case 503: /* get entry by id */
2788                 case 507: /* update entry */
2789                 case 508: /* set lock */
2790                 case 509: /* release lock */
2791                 case 518: /* get entry by id */
2792                         OUT_UINT(hf_afs_vldb_id);
2793                         OUT_UINT(hf_afs_vldb_type);
2794                         break;
2795                 case 504: /* get entry by name */
2796                 case 519: /* get entry by name N */
2797                 case 524: /* update entry by name */
2798                 case 527: /* get entry by name U */
2799                         OUT_RXString(hf_afs_vldb_name);
2800                         break;
2801                 case 505: /* get new vol id */
2802                         OUT_UINT(hf_afs_vldb_bump);
2803                         break;
2804                 case 506: /* replace entry */
2805                 case 520: /* replace entry N */
2806                         OUT_UINT(hf_afs_vldb_id);
2807                         OUT_UINT(hf_afs_vldb_type);
2808                         OUT_RXStringV(hf_afs_vldb_name, VLNAMEMAX);
2809                         break;
2810                 case 510: /* list entry */
2811                 case 521: /* list entry N */
2812                         OUT_UINT(hf_afs_vldb_index);
2813                         break;
2814                 case 532: /* regaddr */
2815                         OUT_UUID(hf_afs_vldb_serveruuid);
2816                         OUT_UINT(hf_afs_vldb_spare1);
2817                         OUT_VLDB_BulkAddr();
2818                         break;
2819         }
2820 }
2821
2822 /*
2823  * UBIK Helpers
2824  */
2825 static void
2826 dissect_ubik_reply(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode)
2827 {
2828         switch ( opcode )
2829         {
2830                 case 10000: /* vote-beacon */
2831                         break;
2832                 case 10001: /* vote-debug-old */
2833                         OUT_UBIK_DebugOld();
2834                         break;
2835                 case 10002: /* vote-sdebug-old */
2836                         OUT_UBIK_SDebugOld();
2837                         break;
2838                 case 10003: /* vote-get syncsite */
2839                         break;
2840                 case 10004: /* vote-debug */
2841                         OUT_UBIK_DebugOld();
2842                         OUT_UBIK_InterfaceAddrs();
2843                         break;
2844                 case 10005: /* vote-sdebug */
2845                         OUT_UBIK_SDebugOld();
2846                         OUT_UBIK_InterfaceAddrs();
2847                         break;
2848                 case 10006: /* vote-xdebug */
2849                         OUT_UBIK_DebugOld();
2850                         OUT_UBIK_InterfaceAddrs();
2851                         OUT_UINT(hf_afs_ubik_isclone);
2852                         break;
2853                 case 10007: /* vote-xsdebug */
2854                         OUT_UBIK_SDebugOld();
2855                         OUT_UBIK_InterfaceAddrs();
2856                         OUT_UINT(hf_afs_ubik_isclone);
2857                         break;
2858                 case 20000: /* disk-begin */
2859                         break;
2860                 case 20004: /* get version */
2861                         OUT_UBIKVERSION("DB Version");
2862                         break;
2863                 case 20010: /* disk-probe */
2864                         break;
2865                 case 20012: /* disk-interfaceaddr */
2866                         OUT_UBIK_InterfaceAddrs();
2867                         break;
2868         }
2869 }
2870
2871 static void
2872 dissect_ubik_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode)
2873 {
2874         offset += 4;  /* skip the opcode */
2875
2876         switch ( opcode )
2877         {
2878                 case 10000: /* vote-beacon */
2879                         OUT_UINT(hf_afs_ubik_state);
2880                         OUT_TIMESECS(hf_afs_ubik_votestart);
2881                         OUT_UBIKVERSION("DB Version");
2882                         OUT_UBIKVERSION("TID");
2883                         break;
2884                 case 10001: /* vote-debug-old */
2885                         break;
2886                 case 10002: /* vote-sdebug-old */
2887                         OUT_UINT(hf_afs_ubik_site);
2888                         break;
2889                 case 10003: /* vote-get sync site */
2890                         OUT_IP(hf_afs_ubik_site);
2891                         break;
2892                 case 10004: /* vote-debug */
2893                 case 10005: /* vote-sdebug */
2894                         OUT_IP(hf_afs_ubik_site);
2895                         break;
2896                 case 20000: /* disk-begin */
2897                         OUT_UBIKVERSION("TID");
2898                         break;
2899                 case 20001: /* disk-commit */
2900                         OUT_UBIKVERSION("TID");
2901                         break;
2902                 case 20002: /* disk-lock */
2903                         OUT_UBIKVERSION("TID");
2904                         OUT_UINT(hf_afs_ubik_file);
2905                         OUT_UINT(hf_afs_ubik_pos);
2906                         OUT_UINT(hf_afs_ubik_length);
2907                         OUT_UINT(hf_afs_ubik_locktype);
2908                         break;
2909                 case 20003: /* disk-write */
2910                         OUT_UBIKVERSION("TID");
2911                         OUT_UINT(hf_afs_ubik_file);
2912                         OUT_UINT(hf_afs_ubik_pos);
2913                         break;
2914                 case 20004: /* disk-get version */
2915                         break;
2916                 case 20005: /* disk-get file */
2917                         OUT_UINT(hf_afs_ubik_file);
2918                         break;
2919                 case 20006: /* disk-send file */
2920                         OUT_UINT(hf_afs_ubik_file);
2921                         OUT_UINT(hf_afs_ubik_length);
2922                         OUT_UBIKVERSION("DB Version");
2923                         break;
2924                 case 20007: /* disk-abort */
2925                 case 20008: /* disk-release locks */
2926                 case 20010: /* disk-probe */
2927                         break;
2928                 case 20009: /* disk-truncate */
2929                         OUT_UBIKVERSION("TID");
2930                         OUT_UINT(hf_afs_ubik_file);
2931                         OUT_UINT(hf_afs_ubik_length);
2932                         break;
2933                 case 20011: /* disk-writev */
2934                         OUT_UBIKVERSION("TID");
2935                         break;
2936                 case 20012: /* disk-interfaceaddr */
2937                         OUT_UBIK_InterfaceAddrs();
2938                         break;
2939                 case 20013: /* disk-set version */
2940                         OUT_UBIKVERSION("TID");
2941                         OUT_UBIKVERSION("Old DB Version");
2942                         OUT_UBIKVERSION("New DB Version");
2943                         break;
2944         }
2945 }
2946
2947 /*
2948  * BACKUP Helpers
2949  */
2950 static void
2951 dissect_backup_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
2952 {
2953         if ( rxinfo->type == RX_PACKET_TYPE_DATA )
2954         {
2955                 switch ( opcode )
2956                 {
2957                 }
2958         }
2959         else if ( rxinfo->type == RX_PACKET_TYPE_ABORT )
2960         {
2961                 OUT_UINT(hf_afs_backup_errcode);
2962         }
2963 }
2964
2965 static void
2966 dissect_backup_request(tvbuff_t *tvb _U_, struct rxinfo *rxinfo _U_, proto_tree *tree _U_, int offset, int opcode)
2967 {
2968         offset += 4;  /* skip the opcode */
2969
2970         switch ( opcode )
2971         {
2972         }
2973 }
2974
2975 /*
2976  * Registration code for registering the protocol and fields
2977  */
2978
2979 void
2980 proto_register_afs(void)
2981 {
2982         static hf_register_info hf[] = {
2983         { &hf_afs_fs, { "File Server", "afs.fs",
2984                 FT_BOOLEAN, BASE_NONE, 0, 0x0, NULL, HFILL }},
2985         { &hf_afs_cb, { "Callback", "afs.cb",
2986                 FT_BOOLEAN, BASE_NONE, 0, 0x0, NULL, HFILL }},
2987         { &hf_afs_prot, { "Protection", "afs.prot",
2988                 FT_BOOLEAN, BASE_NONE, 0, 0x0, "Protection Server", HFILL }},
2989         { &hf_afs_vldb, { "VLDB", "afs.vldb",
2990                 FT_BOOLEAN, BASE_NONE, 0, 0x0, "Volume Location Database Server", HFILL }},
2991         { &hf_afs_kauth, { "KAuth", "afs.kauth",
2992                 FT_BOOLEAN, BASE_NONE, 0, 0x0, "Kerberos Auth Server", HFILL }},
2993         { &hf_afs_vol, { "Volume Server", "afs.vol",
2994                 FT_BOOLEAN, BASE_NONE, 0, 0x0, NULL, HFILL }},
2995         { &hf_afs_error, { "Error", "afs.error",
2996                 FT_BOOLEAN, BASE_NONE, 0, 0x0, NULL, HFILL }},
2997         { &hf_afs_bos, { "BOS", "afs.bos",
2998                 FT_BOOLEAN, BASE_NONE, 0, 0x0, "Basic Oversee Server", HFILL }},
2999         { &hf_afs_update, { "Update", "afs.update",
3000                 FT_BOOLEAN, BASE_NONE, 0, 0x0, "Update Server", HFILL }},
3001         { &hf_afs_rmtsys, { "Rmtsys", "afs.rmtsys",
3002                 FT_BOOLEAN, BASE_NONE, 0, 0x0, NULL, HFILL }},
3003         { &hf_afs_ubik, { "Ubik", "afs.ubik",
3004                 FT_BOOLEAN, BASE_NONE, 0, 0x0, NULL, HFILL }},
3005         { &hf_afs_backup, { "Backup", "afs.backup",
3006                 FT_BOOLEAN, BASE_NONE, 0, 0x0, "Backup Server", HFILL }},
3007
3008         { &hf_afs_fs_opcode, { "Operation", "afs.fs.opcode",
3009                 FT_UINT32, BASE_DEC|BASE_EXT_STRING,
3010                 &fs_req_ext, 0, NULL, HFILL }},
3011         { &hf_afs_cb_opcode, { "Operation", "afs.cb.opcode",
3012                 FT_UINT32, BASE_DEC|BASE_EXT_STRING,
3013                 &cb_req_ext, 0, NULL, HFILL }},
3014         { &hf_afs_prot_opcode, { "Operation", "afs.prot.opcode",
3015                 FT_UINT32, BASE_DEC|BASE_EXT_STRING,
3016                 &prot_req_ext, 0, NULL, HFILL }},
3017         { &hf_afs_vldb_opcode, { "Operation", "afs.vldb.opcode",
3018                 FT_UINT32, BASE_DEC|BASE_EXT_STRING,
3019                 &vldb_req_ext, 0, NULL, HFILL }},
3020         { &hf_afs_kauth_opcode, { "Operation", "afs.kauth.opcode",
3021                 FT_UINT32, BASE_DEC|BASE_EXT_STRING,
3022                 &kauth_req_ext, 0, NULL, HFILL }},
3023         { &hf_afs_vol_opcode, { "Operation", "afs.vol.opcode",
3024                 FT_UINT32, BASE_DEC|BASE_EXT_STRING,
3025                 &vol_req_ext, 0, NULL, HFILL }},
3026         { &hf_afs_bos_opcode, { "Operation", "afs.bos.opcode",
3027                 FT_UINT32, BASE_DEC|BASE_EXT_STRING,
3028                 &bos_req_ext, 0, NULL, HFILL }},
3029         { &hf_afs_update_opcode, { "Operation", "afs.update.opcode",
3030                 FT_UINT32, BASE_DEC|BASE_EXT_STRING,
3031                 &update_req_ext, 0, NULL, HFILL }},
3032         { &hf_afs_rmtsys_opcode, { "Operation", "afs.rmtsys.opcode",
3033                 FT_UINT32, BASE_DEC|BASE_EXT_STRING,
3034                 &rmtsys_req_ext, 0, NULL, HFILL }},
3035
3036         { &hf_afs_error_opcode, { "Operation", "afs.error.opcode",
3037                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3038         { &hf_afs_backup_opcode, { "Operation", "afs.backup.opcode",
3039                 FT_UINT32, BASE_DEC|BASE_EXT_STRING,
3040                 &backup_req_ext, 0, NULL, HFILL }},
3041         { &hf_afs_ubik_opcode, { "Operation", "afs.ubik.opcode",
3042                 FT_UINT32, BASE_DEC|BASE_EXT_STRING,
3043                 &ubik_req_ext, 0, NULL, HFILL }},
3044
3045
3046 /* File Server Fields */
3047         { &hf_afs_fs_fid_volume, { "FileID (Volume)", "afs.fs.fid.volume",
3048                 FT_UINT32, BASE_DEC, 0, 0, "File ID (Volume)", HFILL }},
3049         { &hf_afs_fs_fid_vnode, { "FileID (VNode)", "afs.fs.fid.vnode",
3050                 FT_UINT32, BASE_DEC, 0, 0, "File ID (VNode)", HFILL }},
3051         { &hf_afs_fs_fid_uniqifier, { "FileID (Uniqifier)", "afs.fs.fid.uniq",
3052                 FT_UINT32, BASE_DEC, 0, 0, "File ID (Uniqifier)", HFILL }},
3053         { &hf_afs_fs_offset, { "Offset", "afs.fs.offset",
3054                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3055         { &hf_afs_fs_length, { "Length", "afs.fs.length",
3056                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3057         { &hf_afs_fs_flength, { "FLength", "afs.fs.flength",
3058                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3059         { &hf_afs_fs_offset64, { "Offset64", "afs.fs.offset64",
3060                 FT_UINT64, BASE_DEC, 0, 0, NULL, HFILL }},
3061         { &hf_afs_fs_length64, { "Length64", "afs.fs.length64",
3062                 FT_UINT64, BASE_DEC, 0, 0, NULL, HFILL }},
3063         { &hf_afs_fs_flength64, { "FLength64", "afs.fs.flength64",
3064                 FT_UINT64, BASE_DEC, 0, 0, NULL, HFILL }},
3065         { &hf_afs_fs_errcode, { "Error Code", "afs.fs.errcode",
3066                 FT_UINT32, BASE_DEC|BASE_EXT_STRING, &afs_errors_ext, 0, NULL, HFILL }},
3067         { &hf_afs_fs_data, { "Data", "afs.fs.data",
3068                 FT_BYTES, BASE_NONE, 0, 0, NULL, HFILL }},
3069         { &hf_afs_fs_token, { "Token", "afs.fs.token",
3070                 FT_BYTES, BASE_NONE, 0, 0, NULL, HFILL }},
3071         { &hf_afs_fs_oldname, { "Old Name", "afs.fs.oldname",
3072                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3073         { &hf_afs_fs_newname, { "New Name", "afs.fs.newname",
3074                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3075         { &hf_afs_fs_name, { "Name", "afs.fs.name",
3076                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3077         { &hf_afs_fs_symlink_name, { "Symlink Name", "afs.fs.symlink.name",
3078                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3079         { &hf_afs_fs_symlink_content, { "Symlink Content", "afs.fs.symlink.content",
3080                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3081         { &hf_afs_fs_volid, { "Volume ID", "afs.fs.volid",
3082                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3083         { &hf_afs_fs_volname, { "Volume Name", "afs.fs.volname",
3084                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3085         { &hf_afs_fs_timestamp, { "Timestamp", "afs.fs.timestamp",
3086                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3087         { &hf_afs_fs_offlinemsg, { "Offline Message", "afs.fs.offlinemsg",
3088                 FT_STRING, BASE_NONE, 0, 0, "Volume Name", HFILL }},
3089         { &hf_afs_fs_motd, { "Message of the Day", "afs.fs.motd",
3090                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3091         { &hf_afs_fs_xstats_version, { "XStats Version", "afs.fs.xstats.version",
3092                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3093         { &hf_afs_fs_xstats_clientversion, { "Client Version", "afs.fs.xstats.clientversion",
3094                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3095         { &hf_afs_fs_xstats_collnumber, { "Collection Number", "afs.fs.xstats.collnumber",
3096                 FT_UINT32, BASE_DEC, VALS(xstat_collections), 0, NULL, HFILL }},
3097         { &hf_afs_fs_xstats_timestamp, { "XStats Timestamp", "afs.fs.xstats.timestamp",
3098                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3099         { &hf_afs_fs_cps_spare1, { "CPS Spare1", "afs.fs.cps.spare1",
3100                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3101         { &hf_afs_fs_cps_spare2, { "CPS Spare2", "afs.fs.cps.spare2",
3102                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3103         { &hf_afs_fs_cps_spare3, { "CPS Spare3", "afs.fs.cps.spare3",
3104                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3105         { &hf_afs_fs_vicelocktype, { "Vice Lock Type", "afs.fs.vicelocktype",
3106                 FT_UINT32, BASE_DEC, VALS(vice_lock_types), 0, NULL, HFILL }},
3107 /* XXX - is this an IP address? */
3108         { &hf_afs_fs_viceid, { "Vice ID", "afs.fs.viceid",
3109                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3110         { &hf_afs_fs_ipaddr, { "IP Addr", "afs.fs.ipaddr",
3111                 FT_IPv4, BASE_NONE, 0, 0, NULL, HFILL }},
3112
3113         { &hf_afs_fs_status_mask, { "Mask", "afs.fs.status.mask",
3114                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3115         { &hf_afs_fs_status_mask_setmodtime, { "Set Modification Time", "afs.fs.status.mask.setmodtime",
3116                 FT_BOOLEAN, 32, 0, 0x00000001, NULL, HFILL }},
3117         { &hf_afs_fs_status_mask_setowner, { "Set Owner", "afs.fs.status.mask.setowner",
3118                 FT_BOOLEAN, 32, 0, 0x00000002, NULL, HFILL }},
3119         { &hf_afs_fs_status_mask_setgroup, { "Set Group", "afs.fs.status.mask.setgroup",
3120                 FT_BOOLEAN, 32, 0, 0x00000004, NULL, HFILL }},
3121         { &hf_afs_fs_status_mask_setmode, { "Set Mode", "afs.fs.status.mask.setmode",
3122                 FT_BOOLEAN, 32, 0, 0x00000008, NULL, HFILL }},
3123         { &hf_afs_fs_status_mask_setsegsize, { "Set Segment Size", "afs.fs.status.mask.setsegsize",
3124                 FT_BOOLEAN, 32, 0, 0x00000010, NULL, HFILL }},
3125         { &hf_afs_fs_status_mask_fsync, { "FSync", "afs.fs.status.mask.fsync",
3126                 FT_BOOLEAN, 32, 0, 0x00000400, NULL, HFILL }},
3127
3128         { &hf_afs_fs_status_clientmodtime, { "Client Modification Time", "afs.fs.status.clientmodtime",
3129                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3130         { &hf_afs_fs_status_servermodtime, { "Server Modification Time", "afs.fs.status.servermodtime",
3131                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3132         { &hf_afs_fs_status_owner, { "Owner", "afs.fs.status.owner",
3133                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3134         { &hf_afs_fs_status_group, { "Group", "afs.fs.status.group",
3135                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3136         { &hf_afs_fs_status_mode, { "Unix Mode", "afs.fs.status.mode",
3137                 FT_UINT32, BASE_OCT, 0, 0, NULL, HFILL }},
3138         { &hf_afs_fs_status_segsize, { "Segment Size", "afs.fs.status.segsize",
3139                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3140         { &hf_afs_fs_status_interfaceversion, { "Interface Version", "afs.fs.status.interfaceversion",
3141                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3142         { &hf_afs_fs_status_filetype, { "File Type", "afs.fs.status.filetype",
3143                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3144         { &hf_afs_fs_status_author, { "Author", "afs.fs.status.author",
3145                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3146         { &hf_afs_fs_status_calleraccess, { "Caller Access", "afs.fs.status.calleraccess",
3147                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3148         { &hf_afs_fs_status_anonymousaccess, { "Anonymous Access", "afs.fs.status.anonymousaccess",
3149                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3150         { &hf_afs_fs_status_parentvnode, { "Parent VNode", "afs.fs.status.parentvnode",
3151                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3152         { &hf_afs_fs_status_parentunique, { "Parent Unique", "afs.fs.status.parentunique",
3153                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3154         { &hf_afs_fs_status_dataversion, { "Data Version", "afs.fs.status.dataversion",
3155                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3156         { &hf_afs_fs_status_dataversionhigh, { "Data Version (High)", "afs.fs.status.dataversionhigh",
3157                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3158         { &hf_afs_fs_status_linkcount, { "Link Count", "afs.fs.status.linkcount",
3159                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3160         { &hf_afs_fs_status_spare2, { "Spare 2", "afs.fs.status.spare2",
3161                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3162         { &hf_afs_fs_status_spare3, { "Spare 3", "afs.fs.status.spare3",
3163                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3164         { &hf_afs_fs_status_spare4, { "Spare 4", "afs.fs.status.spare4",
3165                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3166         { &hf_afs_fs_status_synccounter, { "Sync Counter", "afs.fs.status.synccounter",
3167                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3168         { &hf_afs_fs_status_length, { "Length", "afs.fs.status.length",
3169                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3170
3171
3172         { &hf_afs_fs_volsync_spare1, { "Volume Creation Timestamp", "afs.fs.volsync.spare1",
3173                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3174         { &hf_afs_fs_volsync_spare2, { "Spare 2", "afs.fs.volsync.spare2",
3175                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3176         { &hf_afs_fs_volsync_spare3, { "Spare 3", "afs.fs.volsync.spare3",
3177                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3178         { &hf_afs_fs_volsync_spare4, { "Spare 4", "afs.fs.volsync.spare4",
3179                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3180         { &hf_afs_fs_volsync_spare5, { "Spare 5", "afs.fs.volsync.spare5",
3181                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3182         { &hf_afs_fs_volsync_spare6, { "Spare 6", "afs.fs.volsync.spare6",
3183                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3184
3185
3186         { &hf_afs_fs_acl_count_positive, {
3187         "ACL Count (Positive)", "afs.fs.acl.count.positive",
3188                 FT_UINT32, BASE_DEC, 0, 0, "Number of Positive ACLs", HFILL }},
3189         { &hf_afs_fs_acl_count_negative, {
3190         "ACL Count (Negative)", "afs.fs.acl.count.negative",
3191                 FT_UINT32, BASE_DEC, 0, 0, "Number of Negative ACLs", HFILL }},
3192         { &hf_afs_fs_acl_datasize, {
3193         "ACL Size", "afs.fs.acl.datasize",
3194                 FT_UINT32, BASE_DEC, 0, 0, "ACL Data Size", HFILL }},
3195         { &hf_afs_fs_acl_entity, {
3196         "Entity (User/Group)", "afs.fs.acl.entity",
3197                 FT_STRING, BASE_NONE, 0, 0, "ACL Entity (User/Group)", HFILL }},
3198         { &hf_afs_fs_acl_r, {
3199         "_R_ead", "afs.fs.acl.r",
3200                 FT_BOOLEAN, 8, 0, PRSFS_READ, "Read", HFILL }},
3201         { &hf_afs_fs_acl_l, {
3202         "_L_ookup", "afs.fs.acl.l",
3203                 FT_BOOLEAN, 8, 0, PRSFS_LOOKUP, "Lookup", HFILL }},
3204         { &hf_afs_fs_acl_i, {
3205         "_I_nsert", "afs.fs.acl.i",
3206                 FT_BOOLEAN, 8, 0, PRSFS_INSERT, "Insert", HFILL }},
3207         { &hf_afs_fs_acl_d, { "_D_elete", "afs.fs.acl.d",
3208                 FT_BOOLEAN, 8, 0, PRSFS_DELETE, "Delete", HFILL }},
3209         { &hf_afs_fs_acl_w, { "_W_rite", "afs.fs.acl.w",
3210                 FT_BOOLEAN, 8, 0, PRSFS_WRITE, "Write", HFILL }},
3211         { &hf_afs_fs_acl_k, { "_L_ock", "afs.fs.acl.k",
3212                 FT_BOOLEAN, 8, 0, PRSFS_LOCK, "Lock", HFILL }},
3213         { &hf_afs_fs_acl_a, { "_A_dminister", "afs.fs.acl.a",
3214                 FT_BOOLEAN, 8, 0, PRSFS_ADMINISTER, "Administer", HFILL }},
3215
3216         { &hf_afs_fs_callback_version, { "Version", "afs.fs.callback.version",
3217                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3218         { &hf_afs_fs_callback_expires, { "Expires", "afs.fs.callback.expires",
3219                 FT_RELATIVE_TIME, BASE_NONE, 0, 0, NULL, HFILL }},
3220         { &hf_afs_fs_callback_type, { "Type", "afs.fs.callback.type",
3221                 FT_UINT32, BASE_DEC, VALS(cb_types), 0, NULL, HFILL }},
3222
3223 /* BOS Server Fields */
3224         { &hf_afs_bos_errcode, { "Error Code", "afs.bos.errcode",
3225                 FT_UINT32, BASE_DEC|BASE_EXT_STRING, &afs_errors_ext, 0, NULL, HFILL }},
3226         { &hf_afs_bos_type, { "Type", "afs.bos.type",
3227                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3228         { &hf_afs_bos_content, { "Content", "afs.bos.content",
3229                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3230         { &hf_afs_bos_data, { "Data", "afs.bos.data",
3231                 FT_BYTES, BASE_NONE, 0, 0, NULL, HFILL }},
3232         { &hf_afs_bos_path, { "Path", "afs.bos.path",
3233                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3234         { &hf_afs_bos_parm, { "Parm", "afs.bos.parm",
3235                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3236         { &hf_afs_bos_error, { "Error", "afs.bos.error",
3237                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3238         { &hf_afs_bos_spare1, { "Spare1", "afs.bos.spare1",
3239                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3240         { &hf_afs_bos_spare2, { "Spare2", "afs.bos.spare2",
3241                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3242         { &hf_afs_bos_spare3, { "Spare3", "afs.bos.spare3",
3243                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3244         { &hf_afs_bos_file, { "File", "afs.bos.file",
3245                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3246         { &hf_afs_bos_cmd, { "Command", "afs.bos.cmd",
3247                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3248         { &hf_afs_bos_key, { "Key", "afs.bos.key",
3249                 FT_BYTES, BASE_NONE, 0, 0, NULL, HFILL }},
3250         { &hf_afs_bos_user, { "User", "afs.bos.user",
3251                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3252         { &hf_afs_bos_instance, { "Instance", "afs.bos.instance",
3253                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3254         { &hf_afs_bos_status, { "Status", "afs.bos.status",
3255                 FT_INT32, BASE_DEC, 0, 0, NULL, HFILL }},
3256         { &hf_afs_bos_statusdesc, { "Status Description", "afs.bos.statusdesc",
3257                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3258         { &hf_afs_bos_num, { "Number", "afs.bos.number",
3259                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3260         { &hf_afs_bos_size, { "Size", "afs.bos.size",
3261                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3262         { &hf_afs_bos_flags, { "Flags", "afs.bos.flags",
3263                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3264         { &hf_afs_bos_date, { "Date", "afs.bos.date",
3265                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3266         { &hf_afs_bos_kvno, { "Key Version Number", "afs.bos.kvno",
3267                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3268         { &hf_afs_bos_cell, { "Cell", "afs.bos.cell",
3269                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3270         { &hf_afs_bos_host, { "Host", "afs.bos.host",
3271                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3272         { &hf_afs_bos_newtime, { "New Time", "afs.bos.newtime",
3273                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3274         { &hf_afs_bos_baktime, { "Backup Time", "afs.bos.baktime",
3275                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3276         { &hf_afs_bos_oldtime, { "Old Time", "afs.bos.oldtime",
3277                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3278         { &hf_afs_bos_keymodtime, { "Key Modification Time", "afs.bos.keymodtime",
3279                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3280         { &hf_afs_bos_keychecksum, { "Key Checksum", "afs.bos.keychecksum",
3281                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3282         { &hf_afs_bos_keyspare2, { "Key Spare 2", "afs.bos.keyspare2",
3283                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3284
3285
3286 /* KAUTH Server Fields */
3287         { &hf_afs_kauth_errcode, { "Error Code", "afs.kauth.errcode",
3288                 FT_UINT32, BASE_DEC|BASE_EXT_STRING, &afs_errors_ext, 0, NULL, HFILL }},
3289         { &hf_afs_kauth_princ, { "Principal", "afs.kauth.princ",
3290                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3291         { &hf_afs_kauth_realm, { "Realm", "afs.kauth.realm",
3292                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3293         { &hf_afs_kauth_domain, { "Domain", "afs.kauth.domain",
3294                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3295         { &hf_afs_kauth_name, { "Name", "afs.kauth.name",
3296                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3297         { &hf_afs_kauth_data, { "Data", "afs.kauth.data",
3298                 FT_BYTES, BASE_NONE, 0, 0, NULL, HFILL }},
3299         { &hf_afs_kauth_kvno, { "Key Version Number", "afs.kauth.kvno",
3300                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3301
3302 /* VOL Server Fields */
3303         { &hf_afs_vol_errcode, { "Error Code", "afs.vol.errcode",
3304                 FT_UINT32, BASE_DEC|BASE_EXT_STRING, &afs_errors_ext, 0, NULL, HFILL }},
3305         { &hf_afs_vol_id, { "Volume ID", "afs.vol.id",
3306                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3307         { &hf_afs_vol_count, { "Volume Count", "afs.vol.count",
3308                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3309         { &hf_afs_vol_name, { "Volume Name", "afs.vol.name",
3310                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3311
3312 /* VLDB Server Fields */
3313         { &hf_afs_vldb_errcode, { "Error Code", "afs.vldb.errcode",
3314                 FT_UINT32, BASE_DEC|BASE_EXT_STRING, &afs_errors_ext, 0, NULL, HFILL }},
3315         { &hf_afs_vldb_type, { "Volume Type", "afs.vldb.type",
3316                 FT_UINT32, BASE_HEX, VALS(volume_types), 0, NULL, HFILL }},
3317         { &hf_afs_vldb_id, { "Volume ID", "afs.vldb.id",
3318                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3319         { &hf_afs_vldb_bump, { "Bumped Volume ID", "afs.vldb.bump",
3320                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3321         { &hf_afs_vldb_index, { "Volume Index", "afs.vldb.index",
3322                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3323         { &hf_afs_vldb_count, { "Volume Count", "afs.vldb.count",
3324                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3325         { &hf_afs_vldb_numservers, { "Number of Servers", "afs.vldb.numservers",
3326                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3327         { &hf_afs_vldb_nextindex, { "Next Volume Index", "afs.vldb.nextindex",
3328                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3329         { &hf_afs_vldb_rovol, { "Read-Only Volume ID", "afs.vldb.rovol",
3330                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3331         { &hf_afs_vldb_rwvol, { "Read-Write Volume ID", "afs.vldb.rwvol",
3332                 FT_UINT32, BASE_DEC, 0, 0, "Read-Only Volume ID", HFILL }},
3333         { &hf_afs_vldb_bkvol, { "Backup Volume ID", "afs.vldb.bkvol",
3334                 FT_UINT32, BASE_DEC, 0, 0, "Read-Only Volume ID", HFILL }},
3335         { &hf_afs_vldb_clonevol, { "Clone Volume ID", "afs.vldb.clonevol",
3336                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3337         { &hf_afs_vldb_name, { "Volume Name", "afs.vldb.name",
3338                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3339         { &hf_afs_vldb_partition, { "Partition", "afs.vldb.partition",
3340                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3341         { &hf_afs_vldb_server, { "Server", "afs.vldb.server",
3342                 FT_IPv4, BASE_NONE, 0, 0, NULL, HFILL }},
3343         { &hf_afs_vldb_serveruuid, { "Server UUID", "afs.vldb.serveruuid",
3344                 FT_BYTES, BASE_NONE, 0, 0, NULL, HFILL }},
3345         { &hf_afs_vldb_serveruniq, { "Server Unique Address", "afs.vldb.serveruniq",
3346                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3347         { &hf_afs_vldb_serverflags, { "Server Flags", "afs.vldb.serverflags",
3348                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3349         { &hf_afs_vldb_serverip, { "Server IP", "afs.vldb.serverip",
3350                 FT_IPv4, BASE_NONE, 0, 0, NULL, HFILL }},
3351         { &hf_afs_vldb_flags, { "Flags", "afs.vldb.flags",
3352                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3353
3354         { &hf_afs_vldb_flags_rwexists, { "Read/Write Exists", "afs.vldb.flags.rwexists",
3355                 FT_BOOLEAN, 32, 0, 0x1000, NULL, HFILL }},
3356         { &hf_afs_vldb_flags_roexists, { "Read-Only Exists", "afs.vldb.flags.roexists",
3357                 FT_BOOLEAN, 32, 0, 0x2000, NULL, HFILL }},
3358         { &hf_afs_vldb_flags_bkexists, { "Backup Exists", "afs.vldb.flags.bkexists",
3359                 FT_BOOLEAN, 32, 0, 0x4000, NULL, HFILL }},
3360         { &hf_afs_vldb_flags_dfsfileset, { "DFS Fileset", "afs.vldb.flags.dfsfileset",
3361                 FT_BOOLEAN, 32, 0, 0x8000, NULL, HFILL }},
3362
3363         { &hf_afs_vldb_spare1, { "Spare 1", "afs.vldb.spare1",
3364                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3365         { &hf_afs_vldb_spare2, { "Spare 2", "afs.vldb.spare2",
3366                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3367         { &hf_afs_vldb_spare3, { "Spare 3", "afs.vldb.spare3",
3368                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3369         { &hf_afs_vldb_spare4, { "Spare 4", "afs.vldb.spare4",
3370                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3371         { &hf_afs_vldb_spare5, { "Spare 5", "afs.vldb.spare5",
3372                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3373         { &hf_afs_vldb_spare6, { "Spare 6", "afs.vldb.spare6",
3374                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3375         { &hf_afs_vldb_spare7, { "Spare 7", "afs.vldb.spare7",
3376                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3377         { &hf_afs_vldb_spare8, { "Spare 8", "afs.vldb.spare8",
3378                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3379         { &hf_afs_vldb_spare9, { "Spare 9", "afs.vldb.spare9",
3380                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3381
3382 /* BACKUP Server Fields */
3383         { &hf_afs_backup_errcode, { "Error Code", "afs.backup.errcode",
3384                 FT_UINT32, BASE_DEC|BASE_EXT_STRING, &afs_errors_ext, 0, NULL, HFILL }},
3385
3386 /* CB Server Fields */
3387         { &hf_afs_cb_errcode, { "Error Code", "afs.cb.errcode",
3388                 FT_UINT32, BASE_DEC|BASE_EXT_STRING, &afs_errors_ext, 0, NULL, HFILL }},
3389         { &hf_afs_cb_callback_version, { "Version", "afs.cb.callback.version",
3390                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3391         { &hf_afs_cb_callback_expires, { "Expires", "afs.cb.callback.expires",
3392                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3393         { &hf_afs_cb_callback_type, { "Type", "afs.cb.callback.type",
3394                 FT_UINT32, BASE_DEC, VALS(cb_types), 0, NULL, HFILL }},
3395         { &hf_afs_cb_fid_volume, { "FileID (Volume)", "afs.cb.fid.volume",
3396                 FT_UINT32, BASE_DEC, 0, 0, "File ID (Volume)", HFILL }},
3397         { &hf_afs_cb_fid_vnode, { "FileID (VNode)", "afs.cb.fid.vnode",
3398                 FT_UINT32, BASE_DEC, 0, 0, "File ID (VNode)", HFILL }},
3399         { &hf_afs_cb_fid_uniqifier, { "FileID (Uniqifier)", "afs.cb.fid.uniq",
3400                 FT_UINT32, BASE_DEC, 0, 0, "File ID (Uniqifier)", HFILL }},
3401
3402 /* PROT Server Fields */
3403         { &hf_afs_prot_errcode, { "Error Code", "afs.prot.errcode",
3404                 FT_UINT32, BASE_DEC|BASE_EXT_STRING, &afs_errors_ext, 0, NULL, HFILL }},
3405         { &hf_afs_prot_name, { "Name", "afs.prot.name",
3406                 FT_STRING, BASE_NONE, 0, 0, NULL, HFILL }},
3407         { &hf_afs_prot_id, { "ID", "afs.prot.id",
3408                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3409         { &hf_afs_prot_oldid, { "Old ID", "afs.prot.oldid",
3410                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3411         { &hf_afs_prot_newid, { "New ID", "afs.prot.newid",
3412                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3413         { &hf_afs_prot_gid, { "Group ID", "afs.prot.gid",
3414                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3415         { &hf_afs_prot_uid, { "User ID", "afs.prot.uid",
3416                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3417         { &hf_afs_prot_count, { "Count", "afs.prot.count",
3418                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3419         { &hf_afs_prot_maxgid, { "Maximum Group ID", "afs.prot.maxgid",
3420                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3421         { &hf_afs_prot_maxuid, { "Maximum User ID", "afs.prot.maxuid",
3422                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3423         { &hf_afs_prot_pos, { "Position", "afs.prot.pos",
3424                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3425         { &hf_afs_prot_flag, { "Flag", "afs.prot.flag",
3426                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3427
3428 /* UBIK Fields */
3429         { &hf_afs_ubik_errcode, { "Error Code", "afs.ubik.errcode",
3430                 FT_UINT32, BASE_DEC|BASE_EXT_STRING, &afs_errors_ext, 0, NULL, HFILL }},
3431         { &hf_afs_ubik_state, { "State", "afs.ubik.state",
3432                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3433         { &hf_afs_ubik_version_epoch, { "Epoch", "afs.ubik.version.epoch",
3434                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3435         { &hf_afs_ubik_version_counter, { "Counter", "afs.ubik.version.counter",
3436                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3437         { &hf_afs_ubik_votestart, { "Vote Started", "afs.ubik.votestart",
3438                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3439         { &hf_afs_ubik_voteend, { "Vote Ends", "afs.ubik.voteend",
3440                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3441         { &hf_afs_ubik_file, { "File", "afs.ubik.file",
3442                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3443         { &hf_afs_ubik_pos, { "Position", "afs.ubik.position",
3444                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3445         { &hf_afs_ubik_length, { "Length", "afs.ubik.length",
3446                 FT_UINT32, BASE_DEC, 0, 0, NULL, HFILL }},
3447         { &hf_afs_ubik_locktype, { "Lock Type", "afs.ubik.locktype",
3448                 FT_UINT32, BASE_DEC, VALS(ubik_lock_types), 0, NULL, HFILL }},
3449         { &hf_afs_ubik_votetype, { "Vote Type", "afs.ubik.votetype",
3450                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3451         { &hf_afs_ubik_site, { "Site", "afs.ubik.site",
3452                 FT_IPv4, BASE_NONE, 0, 0, NULL, HFILL }},
3453         { &hf_afs_ubik_interface, { "Interface Address", "afs.ubik.interface",
3454                 FT_IPv4, BASE_NONE, 0, 0, NULL, HFILL }},
3455
3456         { &hf_afs_ubik_now, { "Now", "afs.ubik.now",
3457                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3458         { &hf_afs_ubik_lastyestime, { "Last Yes Time", "afs.ubik.lastyesttime",
3459                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3460         { &hf_afs_ubik_lastyeshost, { "Last Yes Host", "afs.ubik.lastyeshost",
3461                 FT_IPv4, BASE_NONE, 0, 0, NULL, HFILL }},
3462         { &hf_afs_ubik_lastyesstate, { "Last Yes State", "afs.ubik.lastyesstate",
3463                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3464         { &hf_afs_ubik_lastyesclaim, { "Last Yes Claim", "afs.ubik.lastyesclaim",
3465                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3466         { &hf_afs_ubik_lowesthost, { "Lowest Host", "afs.ubik.lowesthost",
3467                 FT_IPv4, BASE_NONE, 0, 0, NULL, HFILL }},
3468         { &hf_afs_ubik_lowesttime, { "Lowest Time", "afs.ubik.lowesttime",
3469                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3470         { &hf_afs_ubik_synchost, { "Sync Host", "afs.ubik.synchost",
3471                 FT_IPv4, BASE_NONE, 0, 0, NULL, HFILL }},
3472         { &hf_afs_ubik_addr, { "Address", "afs.ubik.addr",
3473                 FT_IPv4, BASE_NONE, 0, 0, NULL, HFILL }},
3474         { &hf_afs_ubik_synctime, { "Sync Time", "afs.ubik.synctime",
3475                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3476         { &hf_afs_ubik_lastvotetime, { "Last Vote Time", "afs.ubik.lastvotetime",
3477                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3478         { &hf_afs_ubik_lastbeaconsent, { "Last Beacon Sent", "afs.ubik.lastbeaconsent",
3479                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3480         { &hf_afs_ubik_lastvote, { "Last Vote", "afs.ubik.lastvote",
3481                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3482         { &hf_afs_ubik_currentdb, { "Current DB", "afs.ubik.currentdb",
3483                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3484         { &hf_afs_ubik_up, { "Up", "afs.ubik.up",
3485                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3486         { &hf_afs_ubik_beaconsincedown, { "Beacon Since Down", "afs.ubik.beaconsincedown",
3487                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3488         { &hf_afs_ubik_amsyncsite, { "Am Sync Site", "afs.ubik.amsyncsite",
3489                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3490         { &hf_afs_ubik_syncsiteuntil, { "Sync Site Until", "afs.ubik.syncsiteuntil",
3491                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3492         { &hf_afs_ubik_nservers, { "Number of Servers", "afs.ubik.nservers",
3493                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3494         { &hf_afs_ubik_lockedpages, { "Locked Pages", "afs.ubik.lockedpages",
3495                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3496         { &hf_afs_ubik_writelockedpages, { "Write Locked Pages", "afs.ubik.writelockedpages",
3497                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3498         { &hf_afs_ubik_activewrite, { "Active Write", "afs.ubik.activewrite",
3499                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3500         { &hf_afs_ubik_tidcounter, { "TID Counter", "afs.ubik.tidcounter",
3501                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3502         { &hf_afs_ubik_anyreadlocks, { "Any Read Locks", "afs.ubik.anyreadlocks",
3503                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3504         { &hf_afs_ubik_anywritelocks, { "Any Write Locks", "afs.ubik.anywritelocks",
3505                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3506         { &hf_afs_ubik_recoverystate, { "Recovery State", "afs.ubik.recoverystate",
3507                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3508         { &hf_afs_ubik_currenttrans, { "Current Transaction", "afs.ubik.currenttran",
3509                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3510         { &hf_afs_ubik_writetrans, { "Write Transaction", "afs.ubik.writetran",
3511                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3512         { &hf_afs_ubik_epochtime, { "Epoch Time", "afs.ubik.epochtime",
3513                 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, 0, 0, NULL, HFILL }},
3514         { &hf_afs_ubik_isclone, { "Is Clone", "afs.ubik.isclone",
3515                 FT_UINT32, BASE_HEX, 0, 0, NULL, HFILL }},
3516         { &hf_afs_reqframe, { "Request Frame", "afs.reqframe",
3517                 FT_FRAMENUM, BASE_NONE, NULL, 0, NULL, HFILL }},
3518         { &hf_afs_repframe, { "Reply Frame", "afs.repframe",
3519                 FT_FRAMENUM, BASE_NONE, NULL, 0, NULL, HFILL }},
3520         { &hf_afs_time, { "Time from request", "afs.time",
3521                 FT_RELATIVE_TIME, BASE_NONE, NULL, 0, "Time between Request and Reply for AFS calls", HFILL }},
3522         };
3523         static gint *ett[] = {
3524                 &ett_afs,
3525                 &ett_afs_op,
3526                 &ett_afs_acl,
3527                 &ett_afs_fid,
3528                 &ett_afs_callback,
3529                 &ett_afs_ubikver,
3530                 &ett_afs_status,
3531                 &ett_afs_status_mask,
3532                 &ett_afs_volsync,
3533                 &ett_afs_volumeinfo,
3534                 &ett_afs_vicestat,
3535                 &ett_afs_vldb_flags,
3536         };
3537
3538         proto_afs = proto_register_protocol("Andrew File System (AFS)",
3539             "AFS (RX)", "afs");
3540         proto_register_field_array(proto_afs, hf, array_length(hf));
3541         proto_register_subtree_array(ett, array_length(ett));
3542         register_init_routine(&afs_init_protocol);
3543
3544         register_dissector("afs", dissect_afs, proto_afs);
3545 }