Use MAC address documentation range in filter examples
[metze/wireshark/wip.git] / epan / dissectors / packet-fmp.c
1 /* packet-fmp.c
2  * Routines for fmp dissection
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23 #include "config.h"
24
25 #include <epan/packet.h>
26 #include <epan/prefs.h>
27 #include "packet-fmp.h"
28 #include "packet-rpc.h"
29
30 void proto_register_fmp(void);
31 void proto_reg_handoff_fmp(void);
32
33 static int hf_fmp_procedure = -1;
34 static int hf_fmp_fsID = -1;
35 static int hf_fmp_fsBlkSz = -1;
36 static int hf_fmp_sessionHandle = -1;
37 static int hf_fmp_fmpFHandle = -1;
38 static int hf_fmp_msgNum = -1;
39 static int hf_fmp_fileSize = -1;
40 static int hf_fmp_cookie = -1;
41 static int hf_fmp_firstLogBlk = -1;
42 static int hf_fmp_numBlksReq = -1;
43
44 static int proto_fmp = -1;
45 static int hf_fmp_hostID = -1;
46 static int hf_fmp_status = -1;
47 static int hf_fmp_btime = -1;
48 static int hf_fmp_time_sec = -1;
49 static int hf_fmp_time_nsec = -1;
50 static int hf_fmp_notifyPort = -1;
51 static int hf_fmp_minBlks = -1;
52 static int hf_fmp_eof = -1;
53 static int hf_fmp_path = -1;
54 static int hf_fmp_plugInID = -1;
55 static int hf_fmp_plugInBuf = -1;
56 static int hf_fmp_nfsFHandle = -1;
57 static int hf_fmp_extentList_len = -1;
58 static int hf_fmp_extent_state = -1;
59 static int hf_fmp_numBlks = -1;
60 static int hf_fmp_volID = -1;
61 static int hf_fmp_startOffset = -1;
62 static int hf_fmp_volHandle = -1;
63 static int hf_fmp_devSignature = -1;
64 static int hf_fmp_dskSigEnt_val = -1;
65 static int hf_fmp_mount_path = -1;
66 static int hf_fmp_sig_offset = -1;
67 static int hf_fmp_os_major = -1;
68 static int hf_fmp_os_minor = -1;
69 static int hf_fmp_os_name = -1;
70 static int hf_fmp_os_patch = -1;
71 static int hf_fmp_os_build = -1;
72 static int hf_fmp_server_version_string = -1;
73 static int hf_fmp_description = -1;
74 static int hf_fmp_nfsv3Attr_type = -1;
75 static int hf_fmp_nfsv3Attr_mode = -1;
76 static int hf_fmp_nfsv3Attr_nlink = -1;
77 static int hf_fmp_nfsv3Attr_uid = -1;
78 static int hf_fmp_nfsv3Attr_gid = -1;
79 static int hf_fmp_nfsv3Attr_used = -1;
80 static int hf_fmp_nfsv3Attr_rdev = -1;
81 static int hf_fmp_nfsv3Attr_fsid = -1;
82 static int hf_fmp_nfsv3Attr_fileid = -1;
83 static int hf_fmp_cmd = -1;
84 static int hf_fmp_topVolumeId = -1;
85 static int hf_fmp_cursor = -1;
86 static int hf_fmp_offset64 = -1;
87 static int hf_fmp_start_offset64 = -1;
88 static int hf_fmp_slice_size = -1;
89 static int hf_fmp_volume = -1;
90 static int hf_fmp_stripeSize = -1;
91 static int hf_fmp_firstLogBlk64 =-1;
92 static int hf_fmp_native_protocol = -1;
93 static int hf_fmp_encoding_mode = -1;
94 static int hf_fmp_capability = -1;
95 static int hf_fmp_devSerial_query_cmd = -1;
96 static int hf_fmp_volume_desc = -1;
97 static int hf_fmp_disk_identifier = -1;
98 static int hf_fmp_volume_mgmt_type = -1;
99 static int hf_fmp_notify_protocol = -1;
100 static int hf_fmp_client_error_number = -1;
101 /* Generated from convert_proto_tree_add_text.pl */
102 static int hf_fmp_cap = -1;
103 static int hf_fmp_cap_revoke_handle_list = -1;
104 static int hf_fmp_length_of_volume_list = -1;
105 static int hf_fmp_cap_unc_names = -1;
106 static int hf_fmp_length_of_list = -1;
107 static int hf_fmp_sigoffset = -1;
108 static int hf_fmp_uid = -1;
109 static int hf_fmp_fid = -1;
110 static int hf_fmp_fsid = -1;
111 static int hf_fmp_tid = -1;
112 static int hf_fmp_cifsport = -1;
113 static int hf_fmp_blockindex = -1;
114 static int hf_fmp_number_of_disk = -1;
115 static int hf_fmp_cap_cifsv2 = -1;
116 static int hf_fmp_mtime = -1;
117 static int hf_fmp_atime = -1;
118 static int hf_fmp_ctime = -1;
119 static int hf_fmp_heartbeat_interval = -1;
120 static int hf_fmp_volindex = -1;
121
122 static gint ett_fmp = -1;
123 static gint ett_fmp_timeval = -1;
124 static gint ett_fmp_extList = -1;
125 static gint ett_fmp_ext = -1;
126 static gint ett_fmp_fileHandle = -1;
127 static gint ett_capabilities = -1;
128 static gint ett_HierVolumeDescription = -1;
129 static gint ett_attrs = -1;
130
131 static const value_string fmp_encoding_mode_vals[] = {
132     {FMP_ASCII, "ASCII"},
133     {FMP_UTF8, "UTF8"},
134     {FMP_UNICODE1, "UNICODE"},
135     {0,NULL}
136 };
137
138 static gboolean fmp_fhandle_reqrep_matching = FALSE;
139
140 static int
141 dissect_fmp_genString(tvbuff_t *tvb, int offset, proto_tree *tree)
142 {
143     proto_tree_add_item(tree, hf_fmp_encoding_mode, tvb, offset, 4, ENC_BIG_ENDIAN);
144     offset += 4;
145
146     if (try_val_to_str(tvb_get_ntohl(tvb, offset), fmp_encoding_mode_vals) == NULL)
147         return offset;
148
149     offset = dissect_rpc_string(tvb, tree, hf_fmp_path,
150                                 offset, NULL);
151
152     return offset;
153 }
154
155 static int
156 get_fileHandleSrc_size(tvbuff_t *tvb, int offset)
157 {
158     int            length;
159     nativeProtocol np;
160
161     np = (nativeProtocol)tvb_get_ntohl(tvb, offset);
162
163     switch (np) {
164     case FMP_PATH:
165         length =  4 + FMP_MAX_PATH_LEN;
166         break;
167     case FMP_NFS:
168         length =  8 + tvb_get_ntohl(tvb, offset + 4);
169         break;
170     case FMP_CIFS:
171         length =  10;
172         break;
173     case FMP_FMP:
174         length =  8 + tvb_get_ntohl(tvb, offset + 4);
175         break;
176     case FMP_FS_ONLY:
177         length =  8;
178         break;
179     case FMP_SHARE:
180         /* FALLTHROUGH */
181     case FMP_MOUNT:
182         length =  8 + FMP_MAX_PATH_LEN;
183         break;
184     default:
185         length =  4;
186         break;
187     }
188
189     return length;
190 }
191
192 static int
193 dissect_fmp_fileHandleSrc(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
194                           proto_tree *tree)
195 {
196     nativeProtocol      np;
197
198     proto_tree *fileHandleTree;
199     int         length;
200
201     length = get_fileHandleSrc_size(tvb, offset);
202
203     fileHandleTree = proto_tree_add_subtree(tree, tvb, offset, length,
204                                           ett_fmp_fileHandle, NULL, "Source File Handle");
205
206     np = (nativeProtocol)tvb_get_ntohl(tvb, offset);
207     proto_tree_add_item(fileHandleTree, hf_fmp_native_protocol, tvb, offset, 4, ENC_BIG_ENDIAN);
208     offset += 4;
209
210     switch (np) {
211     case FMP_PATH:
212         offset = dissect_rpc_string(tvb, fileHandleTree,
213                                     hf_fmp_mount_path, offset, NULL);
214         break;
215
216     case FMP_NFS:
217         offset = dissect_rpc_data(tvb, fileHandleTree,
218                                   hf_fmp_nfsFHandle, offset);
219         break;
220
221     case FMP_CIFS:
222         proto_tree_add_item(fileHandleTree, hf_fmp_fid, tvb, offset, 2, ENC_BIG_ENDIAN);
223         offset += 2;
224
225         proto_tree_add_item(fileHandleTree, hf_fmp_tid, tvb, offset, 2, ENC_BIG_ENDIAN);
226         offset += 2;
227
228         proto_tree_add_item(fileHandleTree, hf_fmp_uid, tvb, offset, 2, ENC_BIG_ENDIAN);
229         offset += 2;
230         break;
231
232     case FMP_FMP:
233         offset = dissect_rpc_string(tvb, fileHandleTree,
234                                     hf_fmp_fmpFHandle, offset, NULL);
235         break;
236
237     case FMP_FS_ONLY:
238         proto_tree_add_item(fileHandleTree, hf_fmp_fsid, tvb, offset, 4, ENC_BIG_ENDIAN);
239         offset += 4;
240         break;
241
242     case FMP_SHARE:
243         offset = dissect_fmp_genString(tvb, offset, fileHandleTree);
244         break;
245
246     case FMP_MOUNT:
247         offset = dissect_fmp_genString(tvb, offset, fileHandleTree);
248         break;
249
250     case FMP_CIFSV2:
251         proto_tree_add_item(fileHandleTree, hf_fmp_fid, tvb, offset, 2, ENC_BIG_ENDIAN);
252         offset += 2;
253
254         proto_tree_add_item(fileHandleTree, hf_fmp_tid, tvb, offset, 2, ENC_BIG_ENDIAN);
255         offset += 2;
256
257         proto_tree_add_item(fileHandleTree, hf_fmp_uid, tvb, offset, 2, ENC_BIG_ENDIAN);
258         offset += 2;
259
260         proto_tree_add_item(fileHandleTree, hf_fmp_cifsport, tvb, offset, 2, ENC_BIG_ENDIAN);
261         offset += 2;
262         break;
263     case FMP_UNC:
264         offset = dissect_fmp_genString(tvb, offset, fileHandleTree);
265         break;
266
267     default:
268         break;
269     }
270
271     return offset;
272 }
273
274 static int
275 dissect_fmp_extentState(tvbuff_t *tvb, int offset, proto_tree *tree)
276 {
277     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_extent_state,
278                                 offset);
279
280     return offset;
281 }
282
283 static int
284 dissect_fmp_extent(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint32 ext_num)
285 {
286     proto_tree *extTree;
287
288     extTree = proto_tree_add_subtree_format(tree, tvb, offset, 20 ,
289                                   ett_fmp_ext, NULL, "Extent (%u)", (guint32) ext_num);
290
291     offset = dissect_rpc_uint32(tvb,  extTree, hf_fmp_firstLogBlk,
292                                 offset);
293     offset = dissect_rpc_uint32(tvb, extTree, hf_fmp_numBlks,
294                                 offset);
295     offset = dissect_rpc_uint32(tvb, extTree, hf_fmp_volID, offset);
296     offset = dissect_rpc_uint32(tvb, extTree, hf_fmp_startOffset,
297                                 offset);
298     offset = dissect_fmp_extentState(tvb, offset, extTree);
299
300     return offset;
301 }
302
303 static int
304 dissect_fmp_extentList(tvbuff_t *tvb, int offset, packet_info *pinfo,
305                        proto_tree *tree)
306 {
307     guint32     numExtents;
308     guint32     totalLength;
309     proto_tree *extListTree;
310     guint32     i;
311
312     numExtents = tvb_get_ntohl(tvb, offset);
313     totalLength = 4 + (20 * numExtents);
314
315     extListTree =  proto_tree_add_subtree(tree, tvb, offset, totalLength,
316                                        ett_fmp_extList, NULL, "Extent List");
317
318     offset = dissect_rpc_uint32(tvb, extListTree,
319                                 hf_fmp_extentList_len, offset);
320
321     for (i = 0; i < numExtents; i++) {
322         offset = dissect_fmp_extent(tvb, offset, pinfo, extListTree, i+1);
323     }
324
325     return offset;
326 }
327
328
329 static int
330 dissect_fmp_extentListEx(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
331                          proto_tree *tree)
332 {
333     guint32     numExtents;
334     proto_tree *extListTree;
335     guint32     i;
336
337     numExtents = tvb_get_ntohl(tvb, offset);
338
339     offset += 4;
340
341     for (i = 0; i < numExtents; i++) {
342         extListTree =  proto_tree_add_subtree(tree, tvb, offset, 28,
343                                            ett_fmp_extList, NULL, "Extent List");
344
345         offset = dissect_rpc_uint64(tvb,extListTree , hf_fmp_firstLogBlk64,  offset);
346
347         offset = dissect_rpc_uint32(tvb,extListTree , hf_fmp_numBlksReq,
348                                     offset);
349
350         offset = dissect_rpc_uint32(tvb,extListTree , hf_fmp_volID, offset);
351
352         offset = dissect_rpc_uint64(tvb,extListTree , hf_fmp_start_offset64, offset);
353
354         offset = dissect_fmp_extentState(tvb, offset, extListTree);
355
356     }
357
358     return offset;
359 }
360
361
362 static int
363 dissect_plugInID(tvbuff_t *tvb, int offset, proto_tree *tree)
364 {
365     if (!tree) {
366         return offset;
367     }
368
369     proto_tree_add_item(tree, hf_fmp_plugInID, tvb, offset, FMP_PLUG_IN_ID_SZ,
370                         ENC_NA);
371     return offset;
372 }
373
374 static int
375 dissect_fmp_flushCmd(tvbuff_t *tvb, int offset,  proto_tree *tree)
376 {
377     guint32 cmd;
378     char    msg[MAX_MSG_SIZE];
379     guint32 bitValue;
380     int     i;
381
382     if (tree) {
383         cmd = tvb_get_ntohl(tvb, offset);
384
385         /* Initialize the message for an empty string */
386         msg[0] = '\0';
387
388         for (i = 0; cmd != 0 && i < 32; i++) {
389
390             bitValue = 1 << i;
391
392             if (cmd & bitValue) {
393                 switch (bitValue) {
394                 case FMP_COMMIT_SPECIFIED:
395                     g_strlcat(msg, "COMMIT_SPECIFIED", MAX_MSG_SIZE);
396                     break;
397                 case FMP_RELEASE_SPECIFIED:
398                     g_strlcat(msg, "RELEASE_SPECIFIED", MAX_MSG_SIZE);
399                     break;
400                 case FMP_RELEASE_ALL:
401                     g_strlcat(msg, "RELEASE_ALL", MAX_MSG_SIZE);
402                     break;
403                 case FMP_CLOSE_FILE:
404                     g_strlcat(msg, "CLOSE_FILE", MAX_MSG_SIZE);
405                     break;
406                 case FMP_UPDATE_TIME:
407                     g_strlcat(msg, "UPDATE_TIME", MAX_MSG_SIZE);
408                     break;
409                 case FMP_ACCESS_TIME:
410                     g_strlcat(msg, "ACCESS_TIME", MAX_MSG_SIZE);
411                     break;
412                 default:
413                     g_strlcat(msg, "UNKNOWN", MAX_MSG_SIZE);
414                     break;
415                 }
416
417                 /* clear the bit that we processed */
418                 cmd &= ~bitValue;
419
420                 /* add a "bitwise inclusive OR" symbol between cmds */
421                 if (cmd) {
422                     g_strlcat(msg, " | ", MAX_MSG_SIZE);
423                 }
424             }
425         }
426
427         if (strlen(msg) == 0) {
428             g_strlcpy(msg, "No command specified", MAX_MSG_SIZE);
429         }
430
431         proto_tree_add_uint_format_value(tree, hf_fmp_cmd, tvb, offset, 4, cmd, "%s", msg);
432     }
433     offset += 4;
434     return offset;
435 }
436
437 static int
438 dissect_InterpretVolMgtStuff(tvbuff_t *tvb, int offset, proto_tree *tree)
439 {
440     int length, numdisks, i, j;
441
442     numdisks = tvb_get_ntohl(tvb, offset);
443     proto_tree_add_item(tree, hf_fmp_number_of_disk, tvb, offset, 4, ENC_BIG_ENDIAN);
444     offset += 4;
445
446     for (i=0; i<numdisks; i++) {
447         offset = dissect_rpc_uint64(tvb, tree, hf_fmp_sig_offset,  offset);
448         length = tvb_get_ntohl(tvb, offset);
449         proto_tree_add_item(tree, hf_fmp_length_of_list, tvb, offset, 4, ENC_BIG_ENDIAN);
450         offset += 4;
451
452         for (j=0; j<length; j++) {
453             proto_tree_add_item(tree, hf_fmp_sigoffset, tvb, offset, 4, ENC_BIG_ENDIAN);
454             offset += 4;
455             offset = dissect_rpc_string(tvb, tree, hf_fmp_dskSigEnt_val,
456                                         offset, NULL);
457
458         }
459         offset = dissect_rpc_uint32(tvb, tree, hf_fmp_volID, offset);
460
461     }
462     return offset;
463
464
465 }
466
467 static int
468 dissect_fmp_capability(tvbuff_t *tvb, int offset, proto_tree *tree)
469 {
470     proto_tree_add_item(tree, hf_fmp_capability, tvb, offset, 4, ENC_BIG_ENDIAN);
471     return offset+4;
472 }
473
474 static int
475 dissect_fmp_timeval(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
476                     proto_tree *tree, int hf_time, int hf_time_sec,
477                     int hf_time_nsec)
478 {
479     if (tree) {
480         nstime_t ts;
481
482         proto_item* time_item;
483         proto_tree* time_tree;
484
485         ts.secs = tvb_get_ntohl(tvb, offset+0);
486         ts.nsecs = tvb_get_ntohl(tvb, offset+4);
487
488         time_item = proto_tree_add_time(tree, hf_time, tvb, offset, 8, &ts);
489         time_tree = proto_item_add_subtree(time_item, ett_fmp_timeval);
490
491         proto_tree_add_uint(time_tree, hf_time_sec, tvb, offset, 4,
492                             (guint32) ts.secs);
493         proto_tree_add_uint(time_tree, hf_time_nsec, tvb, offset+4, 4,
494                             ts.nsecs);
495     }
496     offset += 8;
497     return offset;
498 }
499
500 static int
501 dissect_fmp_heartBeatIntv(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
502                           proto_tree *tree)
503 {
504     proto_tree_add_item(tree, hf_fmp_heartbeat_interval, tvb, offset, 8, ENC_BIG_ENDIAN);
505     offset += 8;
506     return offset;
507 }
508
509 static int
510 dissect_fmp_status(tvbuff_t *tvb, int offset, proto_tree *tree, int *rval)
511 {
512     fmpStat status;
513
514     status = (fmpStat)tvb_get_ntohl(tvb, offset);
515
516     switch (status) {
517     case FMP_OK:
518         *rval = 0;
519         break;
520     case FMP_IOERROR:
521         *rval = 1;
522         break;
523     case FMP_NOMEM:
524         *rval = 1;
525         break;
526     case FMP_NOACCESS:
527         *rval = 1;
528         break;
529     case FMP_INVALIDARG:
530
531         *rval = 1;
532         break;
533     case FMP_FSFULL:
534         *rval = 0;
535         break;
536     case FMP_QUEUE_FULL:
537     case FMP_NOTIFY_ERROR:
538     case FMP_WRITER_LOST_BLK:
539     case FMP_WRONG_MSG_NUM:
540     case FMP_SESSION_LOST:
541     case FMP_REQUEST_CANCELLED:
542         *rval = 1;
543         break;
544     case FMP_HOT_SESSION:
545         *rval = 0;
546         break;
547     case FMP_COLD_SESSION:
548         *rval = 0;
549         break;
550     case FMP_CLIENT_TERMINATED:
551         *rval = 0;
552         break;
553     case FMP_REQUEST_QUEUED:
554         *rval = 0;
555         break;
556     case FMP_FALL_BACK:
557         *rval = 0;
558         break;
559     case FMP_WRITER_ZEROED_BLK:
560         *rval = 0;
561         break;
562     case FMP_WRONG_HANDLE:
563         *rval = 0;
564         break;
565     case FMP_DUPLICATE_OPEN:
566         *rval = 1;
567         break;
568     case FMP_PLUGIN_NOFUNC:
569         *rval = 1;
570         break;
571     default:
572         *rval = 1;
573         break;
574     }
575     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_status , offset);
576     return offset;
577 }
578
579 static int
580 dissect_fmp_devSerial(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
581                       proto_tree *tree)
582 {
583     proto_tree_add_item(tree, hf_fmp_devSerial_query_cmd, tvb, offset, 4, ENC_BIG_ENDIAN);
584     offset += 4;
585
586     proto_tree_add_item(tree, hf_fmp_sigoffset, tvb, offset, 4, ENC_BIG_ENDIAN);
587     offset += 4;
588
589     offset = dissect_rpc_string(tvb, tree, hf_fmp_devSignature,
590                                 offset, NULL);
591     return offset;
592 }
593
594 static int
595 dissect_fmp_VolumeDescription(tvbuff_t *tvb, int offset, proto_tree * tree)
596 {
597     int                    i,length;
598     proto_tree            *Hietree;
599     proto_item            *ti;
600     fmpVolumeType          volumeType;
601     fmpDiskIdentifierType  diskIdentifierType;
602
603     volumeType = (fmpVolumeType)tvb_get_ntohl(tvb, offset);
604     ti = proto_tree_add_item(tree, hf_fmp_volume_desc, tvb, offset, 4, ENC_BIG_ENDIAN);
605     Hietree = proto_item_add_subtree(ti, ett_HierVolumeDescription);
606     offset += 4;
607
608     switch (volumeType) {
609
610     case FMP_VOLUME_DISK:
611         offset = dissect_rpc_uint32(tvb, Hietree, hf_fmp_volID, offset);
612         offset += 8; /* blockIndex64 */
613         diskIdentifierType = (fmpDiskIdentifierType)tvb_get_ntohl(tvb, offset);
614         proto_tree_add_item(Hietree, hf_fmp_disk_identifier, tvb, offset, 4, ENC_BIG_ENDIAN);
615         offset += 4;
616
617         switch (diskIdentifierType) {
618         case FMP_DISK_IDENTIFIER_SIGNATURE:
619             offset = dissect_rpc_uint64(tvb, Hietree, hf_fmp_sig_offset,  offset);
620             length = tvb_get_ntohl(tvb, offset);
621             proto_tree_add_item(Hietree, hf_fmp_length_of_list, tvb, offset, 4, ENC_BIG_ENDIAN);
622             offset += 4;
623
624             for (i=0; i<length; i++) {
625                 proto_tree_add_item(Hietree, hf_fmp_sigoffset, tvb, offset, 4, ENC_BIG_ENDIAN);
626                 offset += 4;
627                 offset = dissect_rpc_string(tvb, Hietree, hf_fmp_dskSigEnt_val,  offset, NULL);
628
629
630             }
631             break;
632
633         case FMP_DISK_IDENTIFIER_SERIAL:
634             dissect_fmp_devSerial(tvb, offset, NULL, Hietree);
635             break;
636         }
637
638         break;
639     case FMP_VOLUME_SLICE:
640         offset = dissect_rpc_uint32(tvb, Hietree, hf_fmp_volID, offset);
641
642         offset = dissect_rpc_uint64(tvb, Hietree, hf_fmp_offset64, offset);
643
644         offset = dissect_rpc_uint64(tvb, Hietree, hf_fmp_slice_size, offset);
645
646         offset = dissect_rpc_uint32(tvb, Hietree, hf_fmp_volume, offset);
647
648         break;
649
650     case FMP_VOLUME_STRIPE:
651         offset = dissect_rpc_uint32(tvb, Hietree, hf_fmp_volID, offset);
652
653         offset = dissect_rpc_uint64(tvb, Hietree, hf_fmp_stripeSize, offset);
654         length = tvb_get_ntohl(tvb, offset);
655         proto_tree_add_item(Hietree, hf_fmp_length_of_list, tvb, offset, 4, ENC_BIG_ENDIAN);
656         offset += 4;
657
658         for (i=0; i<length; i++) {
659             offset = dissect_rpc_uint32(tvb, Hietree, hf_fmp_volume, offset); /* FIXME: Size or length not know */
660
661         }
662         break;
663
664     case FMP_VOLUME_META:
665         offset = dissect_rpc_uint32(tvb, Hietree, hf_fmp_volID, offset);
666
667         length = tvb_get_ntohl(tvb, offset);
668         proto_tree_add_item(Hietree, hf_fmp_length_of_list, tvb, offset, 4, ENC_BIG_ENDIAN);
669         offset += 4;
670         for (i=0; i<length; i++) {
671             offset = dissect_rpc_uint32(tvb, Hietree, hf_fmp_volume, offset); /* FIXME: Size or length not know */
672         }
673         break;
674     default:
675         break;
676     }
677     return offset;
678 }
679
680
681 static int
682 dissect_fmp_Hiervolume(tvbuff_t *tvb, int offset, proto_tree * tree)
683 {
684
685     int vollength;
686
687     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_topVolumeId, offset);
688     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_cursor, offset);
689     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_cookie, offset);
690
691     /* hierarchical description of volume.  Each volume describes a
692        piece of the entire hierarchy and is guarenteed to only refer to
693        volumes that have already been described by the data structure up
694        to this point in time.  In some extreme cases, the number of
695        volumes and their descriptions may be to large to fit in a single
696        RPC reply.  In this case, the application may send getVolumeInfo
697        requests for the specific topVolumeId -- specifying the number of
698        volumes already recieved by the client, and the cookie.  The
699        server is then responsible for sending another message containing
700        additional volumes.  These RPCs exchanges may continue multiple
701        times, until the client has fetched the entire hierarchical
702        volume description.  If the volume hierarchy changes duing a
703        multiple RPC sequence, the server will return an
704        FMP_VOLUME_CHANGED error, and the client must discard all
705        information already received and restart the request with
706        FMP_Mount.
707     */
708
709     vollength = tvb_get_ntohl(tvb, offset);
710     proto_tree_add_item(tree, hf_fmp_length_of_volume_list, tvb, offset, 4, ENC_BIG_ENDIAN);
711     offset += 4;
712     while (vollength) {
713         offset =  dissect_fmp_VolumeDescription(tvb, offset, tree);
714         vollength--;
715     }
716
717     return offset;
718
719 }
720
721
722
723 static int
724 dissect_fmp_vmInfo(tvbuff_t *tvb, int offset, packet_info *pinfo,
725                    proto_tree *tree)
726 {
727     int     vmType;
728     guint32 phyVolList_len;
729
730     vmType = tvb_get_ntohl(tvb, offset);
731     proto_tree_add_item(tree, hf_fmp_volume_mgmt_type, tvb, offset, 4, ENC_BIG_ENDIAN);
732
733     switch (vmType) {
734     case FMP_SERVER_BASED:
735         /*
736          * Need to finish
737          */
738         phyVolList_len = tvb_get_ntohl(tvb, offset);
739         offset += 4;
740
741         /*
742          * Loop through and print all of the devInfo
743          * structures.
744          */
745         while (phyVolList_len) {
746             offset = dissect_fmp_devSerial(tvb, offset, pinfo, tree);
747             proto_tree_add_item(tree, hf_fmp_volindex, tvb, offset, 4, ENC_BIG_ENDIAN);
748             offset += 4;
749             phyVolList_len--;
750         }
751         break;
752
753     case FMP_THIRD_PARTY:
754         offset = dissect_rpc_string(tvb, tree, hf_fmp_volHandle,
755                                     offset, NULL);
756         break;
757
758     case FMP_CLIENT_BASED_DART:
759         offset = dissect_rpc_string(tvb,  tree, hf_fmp_volHandle,
760                                     offset, NULL);
761         break;
762
763     case FMP_CLIENT_BASED_SIMPLE:
764         /*
765          * Decoding simpleVolInfo
766          */
767         offset = dissect_fmp_devSerial(tvb, offset, pinfo, tree);
768
769         proto_tree_add_item(tree, hf_fmp_blockindex, tvb, offset, 4, ENC_BIG_ENDIAN);
770         offset += 4;
771         break;
772
773     case FMP_DISK_SIGNATURE:
774         offset = dissect_InterpretVolMgtStuff(tvb, offset, tree);
775         break;
776
777     case FMP_HIERARCHICAL_VOLUME:
778         dissect_fmp_Hiervolume(tvb, offset, tree);
779         break;
780
781     default:
782         break;
783     }
784
785     return offset;
786 }
787
788 static int
789 dissect_fmp_notifyProtocol(tvbuff_t *tvb, int offset, proto_tree *tree)
790 {
791     proto_tree_add_item(tree, hf_fmp_notify_protocol, tvb, offset, 4, ENC_BIG_ENDIAN);
792     return (offset+4);
793 }
794
795
796 static int
797 dissect_fmp_capabilities(tvbuff_t *tvb, int offset, proto_tree *tree)
798 {
799     static const int *capabilities[] = {
800         &hf_fmp_cap_revoke_handle_list,
801         &hf_fmp_cap_unc_names,
802         &hf_fmp_cap_cifsv2,
803         NULL
804     };
805
806     proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_fmp_cap, ett_capabilities,
807                         capabilities, ENC_BIG_ENDIAN, BMT_NO_APPEND);
808     return (offset+4);
809 }
810
811 static int
812 dissect_fmp_cerrInfo(tvbuff_t *tvb, int offset, proto_tree *tree)
813 {
814     int            rval;
815
816     proto_tree_add_item(tree, hf_fmp_client_error_number, tvb, offset, 4, ENC_BIG_ENDIAN);
817     offset += 4;
818
819     offset = dissect_fmp_status(tvb, offset,tree, &rval);
820
821     return offset;
822 }
823
824 static int
825 dissect_fmp_attrs(tvbuff_t *tvb, int offset, proto_tree *tree)
826 {
827     proto_tree *attrsTree;
828
829     attrsTree =  proto_tree_add_subtree(tree, tvb, offset, 84,
830                                      ett_attrs, NULL, "Attribute: ");
831     offset = dissect_rpc_uint32(tvb, attrsTree, hf_fmp_nfsv3Attr_type, offset);
832     offset = dissect_rpc_uint32(tvb, attrsTree, hf_fmp_nfsv3Attr_mode, offset);
833     offset = dissect_rpc_uint32(tvb, attrsTree, hf_fmp_nfsv3Attr_nlink, offset);
834     offset = dissect_rpc_uint32(tvb, attrsTree, hf_fmp_nfsv3Attr_uid, offset);
835     offset = dissect_rpc_uint32(tvb, attrsTree, hf_fmp_nfsv3Attr_gid, offset);
836     offset = dissect_rpc_uint64(tvb, attrsTree, hf_fmp_fileSize, offset);
837     /* Here hf_fmp_fileSize is used in
838      * place of size
839      */
840     offset = dissect_rpc_uint64(tvb, attrsTree, hf_fmp_nfsv3Attr_used,   offset);
841     offset = dissect_rpc_uint64(tvb, attrsTree, hf_fmp_nfsv3Attr_rdev,   offset);
842     offset = dissect_rpc_uint64(tvb, attrsTree, hf_fmp_nfsv3Attr_fsid,   offset);
843     offset = dissect_rpc_uint64(tvb, attrsTree, hf_fmp_nfsv3Attr_fileid, offset);
844     proto_tree_add_item(tree, hf_fmp_atime, tvb, offset, 8, ENC_BIG_ENDIAN);
845     offset +=8;
846     proto_tree_add_item(tree, hf_fmp_mtime, tvb, offset, 8, ENC_BIG_ENDIAN);
847     offset +=8;
848     proto_tree_add_item(tree, hf_fmp_ctime, tvb, offset, 8, ENC_BIG_ENDIAN);
849     offset +=8;
850     return offset;
851 }
852
853
854
855 static int
856 dissect_FMP_SessionCreate_request(tvbuff_t *tvb, packet_info *pinfo,
857                                   proto_tree *tree, void* data _U_)
858 {
859     int offset = 0;
860     offset = dissect_rpc_string(tvb, tree, hf_fmp_hostID,
861                                 offset, NULL);
862     offset = dissect_fmp_timeval(tvb, offset, pinfo, tree, hf_fmp_btime,
863                                  hf_fmp_time_sec, hf_fmp_time_nsec);
864     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_notifyPort,
865                                 offset);
866     return offset;
867 }
868
869 static int
870 dissect_FMP_SessionCreate_reply(tvbuff_t *tvb, packet_info *pinfo,
871                                 proto_tree *tree, void* data _U_)
872 {
873     int rval;
874     int offset = 0;
875
876     offset = dissect_fmp_status(tvb, offset,tree, &rval);
877     if (rval == 0) {
878         offset = dissect_rpc_data(tvb, tree,
879                                   hf_fmp_sessionHandle, offset);
880         offset = dissect_rpc_string(tvb,  tree, hf_fmp_hostID,
881                                     offset, NULL);
882         offset = dissect_fmp_timeval(tvb, offset, pinfo, tree,
883                                      hf_fmp_btime, hf_fmp_time_sec,
884                                      hf_fmp_time_nsec);
885         offset = dissect_fmp_heartBeatIntv(tvb, offset, pinfo, tree);
886     }
887
888     return offset;
889 }
890
891 static int
892 dissect_FMP_HeartBeat_request(tvbuff_t *tvb, packet_info *pinfo _U_,
893                               proto_tree *tree, void* data _U_)
894 {
895     return dissect_rpc_data(tvb, tree, hf_fmp_sessionHandle, 0);
896 }
897
898 static int
899 dissect_FMP_HeartBeat_reply(tvbuff_t *tvb, packet_info *pinfo _U_,
900                             proto_tree *tree, void* data _U_)
901 {
902     int rval;
903
904     return dissect_fmp_status(tvb, 0, tree, &rval);
905 }
906
907 static int
908 dissect_FMP_Mount_request(tvbuff_t *tvb, packet_info *pinfo,
909                           proto_tree *tree, void* data _U_)
910 {
911     int offset = 0;
912     offset = dissect_rpc_data(tvb,  tree, hf_fmp_sessionHandle,
913                               offset);
914     offset = dissect_fmp_capability(tvb, offset, tree);
915     offset = dissect_fmp_fileHandleSrc(tvb, offset, pinfo, tree);
916     return offset;
917 }
918
919 static int
920 dissect_FMP_Mount_reply(tvbuff_t *tvb, packet_info *pinfo,
921                         proto_tree *tree, void* data _U_)
922 {
923     int rval;
924     int offset = 0;
925
926     offset = dissect_fmp_status(tvb, offset,tree, &rval);
927     if (rval == 0) {
928         offset = dissect_rpc_uint32(tvb, tree, hf_fmp_fsID,
929                                     offset);
930         offset = dissect_rpc_uint32(tvb, tree, hf_fmp_fsBlkSz,
931                                     offset);
932         offset = dissect_fmp_vmInfo(tvb, offset, pinfo, tree);
933     }
934
935     return offset;
936 }
937
938 static int
939 dissect_FMP_Open_request(tvbuff_t *tvb, packet_info *pinfo,
940                          proto_tree *tree, void* data _U_)
941 {
942     int offset = 0;
943     offset = dissect_rpc_data(tvb, tree, hf_fmp_sessionHandle,
944                               offset);
945     offset = dissect_fmp_fileHandleSrc(tvb, offset, pinfo, tree);
946     return offset;
947 }
948
949 static int
950 dissect_FMP_Open_reply(tvbuff_t *tvb, packet_info *pinfo _U_,
951                        proto_tree *tree, void* data _U_)
952 {
953     int rval;
954     int offset = 0;
955
956     offset = dissect_fmp_status(tvb, offset,tree, &rval);
957     if (rval == 0) {
958         offset = dissect_rpc_data(tvb, tree, hf_fmp_fmpFHandle,
959                                   offset);
960         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_msgNum,
961                                     offset);
962         offset = dissect_rpc_uint64(tvb, tree, hf_fmp_fileSize,
963                                     offset);
964
965         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_fsID,
966                                     offset);
967     }
968     return offset;
969 }
970
971 static int
972 dissect_FMP_Close_request(tvbuff_t *tvb, packet_info *pinfo _U_,
973                           proto_tree *tree, void* data _U_)
974 {
975     int offset = 0;
976
977     offset = dissect_rpc_data(tvb, tree, hf_fmp_fmpFHandle, offset);
978     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_msgNum, offset);
979     return offset;
980 }
981
982 static int
983 dissect_FMP_Close_reply(tvbuff_t *tvb, packet_info *pinfo _U_,
984                         proto_tree *tree, void* data _U_)
985 {
986     int rval;
987     int offset = 0;
988
989     offset = dissect_fmp_status(tvb, offset,tree, &rval);
990     if (rval == 0) {
991         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_msgNum,
992                                     offset);
993     }
994
995     return offset;
996 }
997
998 static int
999 dissect_FMP_OpenGetMap_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1000 {
1001     int offset = 0;
1002     offset = dissect_rpc_data(tvb, tree, hf_fmp_sessionHandle,
1003                               offset);
1004
1005     offset = dissect_fmp_fileHandleSrc(tvb, offset, pinfo, tree);
1006     offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_firstLogBlk,
1007                                 offset);
1008     offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_numBlksReq,
1009                                 offset);
1010     offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_minBlks, offset);
1011     return offset;
1012 }
1013
1014 static int
1015 dissect_FMP_OpenGetMap_reply(tvbuff_t *tvb, packet_info *pinfo,
1016                              proto_tree *tree, void* data _U_)
1017 {
1018     int rval;
1019     int offset = 0;
1020
1021     offset = dissect_fmp_status(tvb, offset,tree, &rval);
1022     if (rval == 0) {
1023         offset = dissect_rpc_data(tvb, tree, hf_fmp_fmpFHandle,
1024                                   offset);
1025         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_msgNum,
1026                                     offset);
1027         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_cookie,
1028                                     offset);
1029         offset = dissect_rpc_uint64(tvb, tree, hf_fmp_fileSize,
1030                                     offset);
1031         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_fsID,
1032                                     offset);
1033         offset = dissect_fmp_extentList(tvb, offset, pinfo, tree);
1034     }
1035
1036     return offset;
1037 }
1038
1039 static int
1040 dissect_FMP_OpenAllocSpace_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1041 {
1042     int offset = 0;
1043     offset = dissect_rpc_data(tvb, tree, hf_fmp_sessionHandle, offset);
1044     offset = dissect_fmp_fileHandleSrc(tvb, offset, pinfo, tree);
1045     offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_firstLogBlk, offset);
1046     offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_numBlksReq, offset);
1047     offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_minBlks, offset);
1048     return offset;
1049 }
1050
1051 static int
1052 dissect_FMP_OpenAllocSpace_reply(tvbuff_t *tvb, packet_info *pinfo,
1053                                  proto_tree *tree, void* data _U_)
1054 {
1055     int rval;
1056     int offset = 0;
1057
1058     offset = dissect_fmp_status(tvb, offset,tree, &rval);
1059     if (rval == 0) {
1060         offset = dissect_rpc_data(tvb, tree, hf_fmp_fmpFHandle,
1061                                   offset);
1062         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_msgNum,
1063                                     offset);
1064         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_cookie,
1065                                     offset);
1066         offset = dissect_rpc_uint64(tvb,  tree, hf_fmp_fileSize,
1067                                     offset);
1068         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_fsID,
1069                                     offset);
1070         offset = dissect_fmp_extentList(tvb, offset, pinfo, tree);
1071     }
1072     return offset;
1073 }
1074
1075 static int
1076 dissect_FMP_GetMap_request(tvbuff_t *tvb, packet_info *pinfo _U_,
1077                            proto_tree *tree, void* data _U_)
1078 {
1079     int offset = 0;
1080     offset = dissect_rpc_data(tvb, tree, hf_fmp_fmpFHandle, offset);
1081     offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_msgNum, offset);
1082     offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_firstLogBlk,
1083                                 offset);
1084     offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_numBlksReq,
1085                                 offset);
1086     offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_minBlks, offset);
1087     return offset;
1088 }
1089
1090 static int
1091 dissect_FMP_GetMap_reply(tvbuff_t *tvb, packet_info *pinfo,
1092                          proto_tree *tree, void* data _U_)
1093 {
1094     int rval;
1095     int offset = 0;
1096
1097     offset = dissect_fmp_status(tvb, offset,tree, &rval);
1098     if (rval == 0) {
1099         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_msgNum,
1100                                     offset);
1101         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_cookie,
1102                                     offset);
1103         offset = dissect_rpc_uint64(tvb, tree, hf_fmp_fileSize,
1104                                     offset);
1105         offset = dissect_fmp_extentList(tvb, offset, pinfo, tree);
1106     }
1107
1108     return offset;
1109 }
1110
1111 static int
1112 dissect_FMP_AllocSpace_request(tvbuff_t *tvb, packet_info *pinfo _U_,
1113                                proto_tree *tree, void* data _U_)
1114 {
1115     int offset = 0;
1116     offset = dissect_rpc_data(tvb,  tree, hf_fmp_fmpFHandle, offset);
1117     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_msgNum, offset);
1118     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_firstLogBlk,
1119                                 offset);
1120     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_numBlksReq,
1121                                 offset);
1122     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_minBlks, offset);
1123     return offset;
1124 }
1125
1126 static int
1127 dissect_FMP_AllocSpace_reply(tvbuff_t *tvb, packet_info *pinfo,
1128                              proto_tree *tree, void* data _U_)
1129 {
1130     int rval;
1131     int offset = 0;
1132
1133     offset = dissect_fmp_status(tvb, offset,tree, &rval);
1134     if (rval == 0) {
1135         offset = dissect_rpc_uint32(tvb, tree, hf_fmp_msgNum,
1136                                     offset);
1137         offset = dissect_rpc_uint32(tvb, tree, hf_fmp_cookie,
1138                                     offset);
1139         offset = dissect_rpc_uint64(tvb, tree, hf_fmp_fileSize,
1140                                     offset);
1141         offset = dissect_fmp_extentList(tvb, offset, pinfo, tree);
1142     }
1143
1144     return offset;
1145 }
1146
1147 static int
1148 dissect_FMP_Flush_request(tvbuff_t *tvb, packet_info *pinfo,
1149                           proto_tree *tree, void* data _U_)
1150 {
1151     int offset = 0;
1152     offset = dissect_rpc_data(tvb, tree, hf_fmp_fmpFHandle, offset);
1153     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_msgNum, offset);
1154     offset = dissect_fmp_flushCmd(tvb, offset, tree);
1155     offset = dissect_rpc_uint64(tvb,tree, hf_fmp_eof, offset);
1156     offset = dissect_fmp_extentList(tvb, offset, pinfo, tree);
1157     return offset;
1158 }
1159
1160 static int
1161 dissect_FMP_Flush_reply(tvbuff_t *tvb, packet_info *pinfo _U_,
1162                         proto_tree *tree, void* data _U_)
1163 {
1164     int rval;
1165     int offset = 0;
1166
1167     offset = dissect_fmp_status(tvb, offset,tree, &rval);
1168     if (rval == 0) {
1169         offset = dissect_rpc_uint32(tvb, tree, hf_fmp_msgNum,
1170                                     offset);
1171     }
1172     return offset;
1173 }
1174
1175 static int
1176 dissect_FMP_CancelReq_request(tvbuff_t *tvb, packet_info *pinfo _U_,
1177                               proto_tree *tree, void* data _U_)
1178 {
1179     int offset = 0;
1180     offset = dissect_rpc_data(tvb, tree, hf_fmp_fmpFHandle, offset);
1181     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_msgNum, offset);
1182     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_cookie, offset);
1183     return offset;
1184 }
1185
1186 static int
1187 dissect_FMP_CancelReq_reply(tvbuff_t *tvb, packet_info *pinfo _U_,
1188                             proto_tree *tree, void* data _U_)
1189 {
1190     int rval;
1191     int offset = 0;
1192
1193     offset = dissect_fmp_status(tvb, offset,tree, &rval);
1194     if (rval == 0) {
1195         offset = dissect_rpc_uint32(tvb, tree, hf_fmp_msgNum,
1196                                     offset);
1197     }
1198     return offset;
1199 }
1200
1201 static int
1202 dissect_FMP_PlugIn_request(tvbuff_t *tvb, packet_info *pinfo _U_,
1203                            proto_tree *tree, void* data _U_)
1204 {
1205     int offset = 0;
1206     offset = dissect_plugInID(tvb, offset, tree);
1207     offset = dissect_rpc_data(tvb, tree, hf_fmp_plugInBuf, offset);
1208     return offset;
1209 }
1210
1211 static int
1212 dissect_FMP_PlugIn_reply(tvbuff_t *tvb, packet_info *pinfo _U_,
1213                          proto_tree *tree, void* data _U_)
1214 {
1215     int rval;
1216     int offset = 0;
1217
1218     offset = dissect_fmp_status(tvb, offset,tree, &rval);
1219     if (rval == 0) {
1220         offset = dissect_rpc_data(tvb,  tree, hf_fmp_plugInBuf,
1221                                   offset);
1222     }
1223     return offset;
1224 }
1225
1226 static int
1227 dissect_FMP_SessionTerminate_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
1228 {
1229     return dissect_rpc_data(tvb,  tree, hf_fmp_sessionHandle, 0);
1230 }
1231
1232 static int
1233 dissect_FMP_SessionTerminate_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
1234 {
1235     int rval;
1236
1237     return dissect_fmp_status(tvb, 0,tree, &rval);
1238 }
1239
1240 static int
1241 dissect_FMP_SessionCreateEx_request(tvbuff_t *tvb, packet_info *pinfo,  proto_tree *tree, void* data _U_)
1242 {
1243     int offset = 0;
1244
1245     offset = dissect_rpc_string(tvb, tree, hf_fmp_hostID,
1246                                 offset, NULL);
1247     offset = dissect_fmp_timeval(tvb, offset, pinfo ,tree, hf_fmp_btime,
1248                                  hf_fmp_time_sec, hf_fmp_time_nsec);
1249     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_notifyPort,
1250                                 offset);
1251     offset = dissect_fmp_notifyProtocol(tvb, offset, tree);
1252
1253     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_os_major,
1254                                 offset);
1255     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_os_minor,
1256                                 offset);
1257
1258     offset = dissect_rpc_string(tvb, tree, hf_fmp_os_name,
1259                                 offset, NULL);
1260
1261     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_os_patch,
1262                                 offset);
1263
1264     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_os_build,
1265                                 offset);
1266
1267     offset = dissect_fmp_capabilities(tvb, offset, tree);
1268
1269     return offset;
1270 }
1271
1272
1273 static int
1274 dissect_FMP_SessionCreateEx_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1275 {
1276     int rval;
1277     int offset = 0;
1278
1279     offset = dissect_fmp_status(tvb, offset, tree, &rval);
1280     if (rval == 0) {
1281         offset = dissect_rpc_data(tvb, tree,
1282                                   hf_fmp_sessionHandle, offset);
1283         offset = dissect_rpc_string(tvb,  tree, hf_fmp_hostID,
1284                                     offset, NULL);
1285         offset = dissect_fmp_timeval(tvb, offset, pinfo ,tree,
1286                                      hf_fmp_btime, hf_fmp_time_sec,
1287                                      hf_fmp_time_nsec);
1288         offset = dissect_fmp_heartBeatIntv(tvb, offset, pinfo , tree);
1289
1290         offset = dissect_rpc_uint32(tvb, tree, hf_fmp_os_major,
1291                                     offset);
1292
1293         offset = dissect_rpc_uint32(tvb, tree, hf_fmp_os_minor,
1294                                     offset);
1295
1296         offset = dissect_rpc_string(tvb, tree, hf_fmp_server_version_string,
1297                                     offset, NULL);
1298
1299         offset = dissect_rpc_uint32(tvb, tree, hf_fmp_os_patch,
1300                                     offset);
1301
1302         offset = dissect_rpc_uint32(tvb, tree, hf_fmp_os_build,
1303                                     offset);
1304
1305         offset = dissect_fmp_capabilities(tvb, offset, tree);
1306     }
1307
1308     return offset;
1309 }
1310
1311
1312 static int
1313 dissect_FMP_ReportClientError_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
1314 {
1315     int offset = 0;
1316     offset = dissect_rpc_string(tvb, tree, hf_fmp_description,
1317                                 offset, NULL);
1318
1319     offset = dissect_fmp_cerrInfo(tvb, offset, tree);
1320     return offset;
1321 }
1322
1323 static int
1324 dissect_FMP_ReportClientError_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
1325 {
1326     int rval;
1327     int offset = 0;
1328     offset = dissect_fmp_status(tvb, offset,tree, &rval);
1329
1330     return offset;
1331 }
1332
1333 static int
1334 dissect_FMP_GetAttr_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
1335 {
1336     int offset = 0;
1337     offset = dissect_rpc_data(tvb, tree, hf_fmp_fmpFHandle, offset);
1338
1339     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_msgNum, offset);
1340
1341     return offset;
1342 }
1343
1344
1345 static int
1346 dissect_FMP_GetAttr_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
1347 {
1348     int rval;
1349     int offset = 0;
1350     offset = dissect_fmp_status(tvb, offset,tree, &rval);
1351     if (rval == 0) {
1352         offset = dissect_rpc_uint32(tvb, tree, hf_fmp_msgNum, offset);
1353
1354         offset = dissect_fmp_attrs(tvb, offset, tree);
1355     }
1356
1357     return offset;
1358 }
1359
1360 static int
1361 dissect_FMP_OpenGetAttr_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1362 {
1363     int offset = 0;
1364
1365     offset = dissect_rpc_data(tvb,  tree, hf_fmp_sessionHandle,
1366                               offset);
1367
1368     offset = dissect_fmp_fileHandleSrc(tvb, offset, pinfo, tree);
1369
1370     return offset;
1371 }
1372
1373
1374 static int
1375 dissect_FMP_OpenGetAttr_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
1376 {
1377     int rval;
1378     int offset = 0;
1379
1380     offset = dissect_fmp_status(tvb, offset, tree, &rval);
1381
1382     if (rval == 0) {
1383         offset = dissect_rpc_data(tvb, tree, hf_fmp_fmpFHandle, offset);
1384         offset = dissect_rpc_uint32(tvb, tree, hf_fmp_msgNum, offset);
1385         offset = dissect_rpc_uint64(tvb, tree, hf_fmp_fileSize, offset);
1386         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_fsID, offset);
1387         offset = dissect_fmp_attrs(tvb, offset, tree);
1388     }
1389
1390
1391     return offset;
1392 }
1393
1394
1395 static int
1396 dissect_FMP_FlushGetAttr_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1397 {
1398     int offset = 0;
1399
1400     offset = dissect_fmp_fileHandleSrc(tvb, offset, pinfo, tree);
1401     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_msgNum, offset);
1402     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_cmd, offset);
1403     offset = dissect_rpc_uint64(tvb,tree, hf_fmp_eof, offset);
1404
1405     proto_tree_add_item(tree, hf_fmp_mtime, tvb, offset, 8, ENC_BIG_ENDIAN);
1406     offset += 8;
1407     offset = dissect_fmp_extentList(tvb, offset, pinfo, tree);
1408
1409     return offset;
1410 }
1411
1412
1413 static int
1414 dissect_FMP_FlushGetAttr_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
1415 {
1416     int rval;
1417     int offset = 0;
1418
1419     offset = dissect_fmp_status(tvb, offset,tree, &rval);
1420     if (rval == 0) {
1421         offset = dissect_rpc_uint32(tvb, tree, hf_fmp_msgNum, offset);
1422
1423         offset = dissect_fmp_attrs(tvb, offset, tree);
1424     }
1425
1426     return offset;
1427 }
1428
1429
1430 static int
1431 dissect_FMP_GetVolumeInfo_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
1432 {
1433     int offset = 0;
1434     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_topVolumeId, offset);
1435     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_cursor, offset);
1436     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_cookie, offset);
1437     return offset;
1438 }
1439
1440
1441
1442 static int
1443 dissect_FMP_GetVolumeInfo_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
1444 {
1445     int rval;
1446     int offset = 0;
1447
1448     offset = dissect_fmp_status(tvb, offset,tree, &rval);
1449     if (rval == 0) {
1450         /* FIXME: I don't know size of this volumes */
1451         offset = dissect_fmp_Hiervolume(tvb,offset, tree);
1452     }
1453     return offset;
1454
1455 }
1456
1457 static int
1458 dissect_FMP_OpenGetMapEx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1459 {
1460     int offset = 0;
1461     offset = dissect_rpc_data(tvb, tree, hf_fmp_sessionHandle,
1462                               offset);
1463     offset = dissect_fmp_fileHandleSrc(tvb, offset, pinfo, tree);
1464     offset = dissect_rpc_uint64(tvb, tree, hf_fmp_firstLogBlk64,  offset);
1465     offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_numBlksReq,
1466                                 offset);
1467     offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_minBlks, offset);
1468     return offset;
1469 }
1470
1471
1472 static int
1473 dissect_FMP_OpenGetMapEx_reply(tvbuff_t *tvb, packet_info *pinfo _U_,
1474                                proto_tree *tree, void* data _U_)
1475 {
1476     int rval;
1477     int offset = 0;
1478     offset = dissect_fmp_status(tvb, offset,tree, &rval);
1479     if (rval == 0) {
1480         offset = dissect_rpc_data(tvb, tree, hf_fmp_fmpFHandle,
1481                                   offset);
1482         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_msgNum,
1483                                     offset);
1484         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_cookie,
1485                                     offset);
1486         offset = dissect_rpc_uint64(tvb, tree, hf_fmp_fileSize,
1487                                     offset);
1488         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_fsID,
1489                                     offset);
1490         offset = dissect_fmp_extentListEx(tvb, offset, pinfo, tree);
1491     }
1492
1493     return offset;
1494 }
1495
1496
1497 static int
1498 dissect_FMP_OpenAllocSpaceEx_request(tvbuff_t *tvb,
1499                                      packet_info *pinfo, proto_tree *tree, void* data _U_)
1500 {
1501     int offset = 0;
1502     offset = dissect_rpc_data(tvb , tree, hf_fmp_sessionHandle,
1503                               offset);
1504     offset = dissect_fmp_fileHandleSrc(tvb, offset, pinfo, tree);
1505     offset = dissect_rpc_uint64(tvb, tree, hf_fmp_firstLogBlk64,  offset);
1506     offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_numBlksReq,
1507                                 offset);
1508     offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_minBlks, offset);
1509     return offset;
1510 }
1511
1512
1513 static int
1514 dissect_FMP_OpenAllocSpaceEx_reply(tvbuff_t *tvb, packet_info *pinfo,
1515                                    proto_tree *tree, void* data _U_)
1516 {
1517     int rval;
1518     int offset = 0;
1519
1520     offset = dissect_fmp_status(tvb, offset,tree, &rval);
1521     if (rval == 0) {
1522         offset = dissect_rpc_data(tvb, tree, hf_fmp_fmpFHandle,
1523                                   offset);
1524         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_msgNum,
1525                                     offset);
1526         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_cookie,
1527                                     offset);
1528         offset = dissect_rpc_uint64(tvb,  tree, hf_fmp_fileSize,
1529                                     offset);
1530         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_fsID,
1531                                     offset);
1532         offset = dissect_fmp_extentListEx(tvb, offset, pinfo, tree);
1533     }
1534     return offset;
1535 }
1536
1537 static int
1538 dissect_FMP_GetMapEx_request(tvbuff_t *tvb, packet_info *pinfo _U_,
1539                              proto_tree *tree, void* data _U_)
1540 {
1541     int offset = 0;
1542     offset = dissect_rpc_data(tvb, tree, hf_fmp_fmpFHandle, offset);
1543     offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_msgNum, offset);
1544     offset = dissect_rpc_uint64(tvb, tree, hf_fmp_firstLogBlk64,  offset);
1545     offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_numBlksReq,
1546                                 offset);
1547     offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_minBlks, offset);
1548     return offset;
1549 }
1550
1551
1552 static int
1553 dissect_FMP_GetMapEx_reply(tvbuff_t *tvb, packet_info *pinfo,
1554                            proto_tree *tree, void* data _U_)
1555 {
1556     int rval;
1557     int offset = 0;
1558
1559     offset = dissect_fmp_status(tvb, offset,tree, &rval);
1560     if (rval == 0) {
1561         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_msgNum,
1562                                     offset);
1563         offset = dissect_rpc_uint32(tvb,  tree, hf_fmp_cookie,
1564                                     offset);
1565         offset = dissect_rpc_uint64(tvb, tree, hf_fmp_fileSize,
1566                                     offset);
1567         offset = dissect_fmp_extentListEx(tvb, offset, pinfo, tree);
1568     }
1569
1570     return offset;
1571 }
1572
1573
1574 static int
1575 dissect_FMP_AllocSpaceEx_request(tvbuff_t *tvb, packet_info *pinfo _U_,
1576                                  proto_tree *tree, void* data _U_)
1577 {
1578     int offset = 0;
1579     offset = dissect_rpc_data(tvb,  tree, hf_fmp_fmpFHandle, offset);
1580     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_msgNum, offset);
1581     offset = dissect_rpc_uint64(tvb, tree, hf_fmp_firstLogBlk64,  offset);
1582     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_numBlksReq,
1583                                 offset);
1584     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_minBlks, offset);
1585     return offset;
1586 }
1587
1588
1589 static int
1590 dissect_FMP_AllocSpaceEx_reply(tvbuff_t *tvb, packet_info *pinfo,
1591                                proto_tree *tree, void* data _U_)
1592 {
1593     int rval;
1594     int offset = 0;
1595
1596     offset = dissect_fmp_status(tvb, offset,tree, &rval);
1597     if (rval == 0) {
1598         offset = dissect_rpc_uint32(tvb, tree, hf_fmp_msgNum,
1599                                     offset);
1600         offset = dissect_rpc_uint32(tvb, tree, hf_fmp_cookie,
1601                                     offset);
1602         offset = dissect_rpc_uint64(tvb, tree, hf_fmp_fileSize,
1603                                     offset);
1604         offset = dissect_fmp_extentListEx(tvb, offset, pinfo, tree);
1605     }
1606
1607     return offset;
1608 }
1609
1610 static int
1611 dissect_FMP_FlushEx_request(tvbuff_t *tvb, packet_info *pinfo,
1612                             proto_tree *tree, void* data _U_)
1613 {
1614     int offset = 0;
1615     offset = dissect_rpc_data(tvb, tree, hf_fmp_fmpFHandle, offset);
1616     offset = dissect_rpc_uint32(tvb, tree, hf_fmp_msgNum, offset);
1617     offset = dissect_fmp_flushCmd(tvb, offset, tree);
1618     offset = dissect_rpc_uint64(tvb,tree, hf_fmp_eof, offset);
1619     offset = dissect_fmp_extentListEx(tvb, offset, pinfo, tree);
1620     return offset;
1621 }
1622
1623 static int
1624 dissect_FMP_FlushEx_reply(tvbuff_t *tvb, packet_info *pinfo _U_,
1625                           proto_tree *tree, void* data _U_)
1626 {
1627     int rval;
1628     int offset = 0;
1629
1630     offset = dissect_fmp_status(tvb, offset,tree, &rval);
1631     if (rval == 0) {
1632         offset = dissect_rpc_uint32(tvb, tree, hf_fmp_msgNum,
1633                                     offset);
1634     }
1635     return offset;
1636 }
1637 /*
1638  * proc number, "proc name", dissect_request, dissect_reply
1639  */
1640 static const vsff fmp3_proc[] = {
1641     { 0,
1642       "NULL",
1643       dissect_rpc_void,
1644       dissect_rpc_void, },
1645
1646     { 1,
1647       "SessionCreate",
1648       dissect_FMP_SessionCreate_request,
1649       dissect_FMP_SessionCreate_reply },
1650
1651     { 2,
1652       "HeartBeat",
1653       dissect_FMP_HeartBeat_request,
1654       dissect_FMP_HeartBeat_reply },
1655
1656     { 3,
1657       "Mount",
1658       dissect_FMP_Mount_request,
1659       dissect_FMP_Mount_reply },
1660
1661     { 4,
1662       "Open",
1663       dissect_FMP_Open_request,
1664       dissect_FMP_Open_reply },
1665
1666     { 5,
1667       "Close",
1668       dissect_FMP_Close_request,
1669       dissect_FMP_Close_reply },
1670
1671     { 6,
1672       "OpenGetMap",
1673       dissect_FMP_OpenGetMap_request,
1674       dissect_FMP_OpenGetMap_reply },
1675
1676     { 7,
1677       "OpenAllocSpace",
1678       dissect_FMP_OpenAllocSpace_request,
1679       dissect_FMP_OpenAllocSpace_reply },
1680
1681     { 8,
1682       "GetMap",
1683       dissect_FMP_GetMap_request,
1684       dissect_FMP_GetMap_reply },
1685
1686     { 9,
1687       "AllocSpace",
1688       dissect_FMP_AllocSpace_request,
1689       dissect_FMP_AllocSpace_reply },
1690
1691     { 10,
1692       "Flush",
1693       dissect_FMP_Flush_request,
1694       dissect_FMP_Flush_reply },
1695
1696     { 11,
1697       "CancelReq",
1698       dissect_FMP_CancelReq_request,
1699       dissect_FMP_CancelReq_reply },
1700
1701     { 12,
1702       "PlugIn",
1703       dissect_FMP_PlugIn_request,
1704       dissect_FMP_PlugIn_reply },
1705
1706     { 13,
1707       "SessionTerminate",
1708       dissect_FMP_SessionTerminate_request,
1709       dissect_FMP_SessionTerminate_reply },
1710
1711     { 14,
1712       "SessionCreateEx",
1713       dissect_FMP_SessionCreateEx_request,
1714       dissect_FMP_SessionCreateEx_reply },
1715
1716     { 15,
1717       "ReportClientError",
1718       dissect_FMP_ReportClientError_request,
1719       dissect_FMP_ReportClientError_reply },
1720
1721     { 16           ,
1722       "Get Attribute",
1723       dissect_FMP_GetAttr_request,
1724       dissect_FMP_GetAttr_reply },
1725
1726     { 17               ,
1727       "Open Get Attribute",
1728       dissect_FMP_OpenGetAttr_request,
1729       dissect_FMP_OpenGetAttr_reply },
1730
1731     { 18               ,
1732       "Flush Get Attribute",
1733       dissect_FMP_FlushGetAttr_request,
1734       dissect_FMP_FlushGetAttr_reply },
1735
1736     { 19               ,
1737       "OpenGetMapEx",
1738       dissect_FMP_OpenGetMapEx_request,
1739       dissect_FMP_OpenGetMapEx_reply },
1740
1741     { 20               ,
1742       "OpenAllocSpaceEx",
1743       dissect_FMP_OpenAllocSpaceEx_request,
1744       dissect_FMP_OpenAllocSpaceEx_reply },
1745
1746     { 21               ,
1747       "GetMapEx",
1748       dissect_FMP_GetMapEx_request,
1749       dissect_FMP_GetMapEx_reply },
1750
1751     { 22               ,
1752       "AllocSpaceEx",
1753       dissect_FMP_AllocSpaceEx_request,
1754       dissect_FMP_AllocSpaceEx_reply },
1755
1756     { 23               ,
1757       "FMP_FlushEx",
1758       dissect_FMP_FlushEx_request,
1759       dissect_FMP_FlushEx_reply },
1760 #if 0
1761
1762     { 24               ,
1763       "FlushGetAttrEx",
1764       dissect_FMP_FlushGetAttrEx_request,
1765       dissect_FMP_FlushGetAttrEx_reply },
1766
1767 #endif
1768
1769     { 25               ,
1770       "GetVolumeInfo",
1771       dissect_FMP_GetVolumeInfo_request,
1772       dissect_FMP_GetVolumeInfo_reply },
1773
1774
1775     {0 , NULL , NULL , NULL }
1776
1777 };
1778
1779
1780 static const rpc_prog_vers_info fmp_vers_info[] = {
1781     { FMP_VERSION_3, fmp3_proc, &hf_fmp_procedure }
1782 };
1783
1784
1785 static const value_string fmp_proc_vals[] = {
1786     {  0, "NULL" },
1787     {  1, "SessionCreate" },
1788     {  2, "HeartBeat" },
1789     {  3, "Mount" },
1790     {  4, "Open" },
1791     {  5, "Close" },
1792     {  6, "OpenGetMap" },
1793     {  7, "OpenAllocSpace" },
1794     {  8, "GetMap" },
1795     {  9, "AllocSpace " },
1796     { 10, "Flush" },
1797     { 11, "CancelReq" },
1798     { 12, "PlugIn" },
1799     { 13, "SessionTerminate" },
1800     { 14, "SessionCreateEx" },
1801     { 15, "ReportClientError" },
1802     { 16, "GetAttr " },
1803     { 17, "OpenGetAttr" },
1804     { 18, "FlushGetAttr"},
1805     { 19, "OpenGetMapEx"},
1806     { 20, "OpenAllocSpaceEx"},
1807     { 21, "GetMapEx"},
1808     { 22, "AllocSpaceEx"},
1809     { 23, "FlushEx"},
1810     { 24, "FlushGetAttrEx"},
1811     { 25, "GetVolumeInfo"},
1812     { 0,NULL }
1813 };
1814
1815
1816 static const value_string fmp_status_vals[] = {
1817     {  0, "OK"},
1818     {  5, "IOERROR"},
1819     { 12, "NOMEM"},
1820     { 13, "NOACCESS"},
1821     { 22, "INVALIDARG"},
1822     { 28, "FSFULL"},
1823     { 79, "QUEUE_FULL"},
1824     {500, "WRONG_MSG_NUM"},
1825     {501, "SESSION_LOST"},
1826     {502, "HOT_SESSION"},
1827     {503, "COLD_SESSION"},
1828     {504, "CLIENT_TERMINATED"},
1829     {505, "WRITER_LOST_BLK"},
1830     {506, "FMP_REQUEST_QUEUED"},
1831     {507, "FMP_FALL_BACK"},
1832     {508, "REQUEST_CANCELLED"},
1833     {509, "WRITER_ZEROED_BLK"},
1834     {510, "NOTIFY_ERROR"},
1835     {511, "FMP_WRONG_HANDLE"},
1836     {512, "DUPLICATE_OPEN"},
1837     {600, "PLUGIN_NOFUNC"},
1838     {0,NULL}
1839 };
1840
1841
1842 static const value_string fmp_extentState_vals[] = {
1843     {0,"VALID_DATA"},
1844     {1,"INVALID_DATA"},
1845     {2,"NONE_DATA"},
1846     {0,NULL}
1847 };
1848
1849 static const value_string fmp_native_protocol_vals[] = {
1850     {FMP_PATH, "PATH"},
1851     {FMP_NFS, "NFS"},
1852     {FMP_CIFS, "CIFS"},
1853     {FMP_FMP, "FMP"},
1854     {FMP_FS_ONLY, "FS_ONLY"},
1855     {FMP_SHARE, "SHARE"},
1856     {FMP_MOUNT, "MOUNT"},
1857     {FMP_CIFSV2, "CIFSV2"},
1858     {FMP_UNC,"UNC"},
1859     {0,NULL}
1860 };
1861
1862 static const value_string fmp_volume_mgmt_capability_vals[] = {
1863     {FMP_SERVER_BASED, "SERVER_BASED"},
1864     {FMP_THIRD_PARTY, "THIRD_PARTY"},
1865     {FMP_CLIENT_BASED_DART, "CLIENT_BASED_DART"},
1866     {FMP_CLIENT_BASED_SIMPLE, "CLIENT_BASED_SIMPLE"},
1867     {FMP_HIERARCHICAL_VOLUME, "FMP_HIERARCHICAL_VOLUME"},
1868     {0,NULL}
1869 };
1870
1871 static const value_string fmp_query_cmd_vals[] = {
1872     {FMP_SCSI_INQUIRY, "SCSI_INQUIRY"},
1873     {FMP_DART_STAMP, "DART_STAMP"},
1874     {0,NULL}
1875 };
1876
1877 static const value_string fmp_volume_desc_vals[] = {
1878     {FMP_VOLUME_DISK, "DISK"},
1879     {FMP_VOLUME_SLICE, "SLICE"},
1880     {FMP_VOLUME_STRIPE, "STRIPE"},
1881     {FMP_VOLUME_META, "META"},
1882     {FMP_VOLUME_SLICE, "SLICE"},
1883     {FMP_VOLUME_SLICE, "SLICE"},
1884     {0,NULL}
1885 };
1886
1887 static const value_string fmp_disk_identifier_vals[] = {
1888     {FMP_DISK_IDENTIFIER_SIGNATURE, "SIGNATURE"},
1889     {FMP_DISK_IDENTIFIER_SERIAL, "SERIAL"},
1890     {0,NULL}
1891 };
1892
1893 static const value_string fmp_notify_protocol_vals[] = {
1894     {FMP_TCP, "TCP"},
1895     {FMP_UDP, "UDP"},
1896     {0,NULL}
1897 };
1898
1899 static const value_string fmp_volume_mgmt_type_vals[] = {
1900     {FMP_SERVER_BASED, "SERVER_BASED"},
1901     {FMP_THIRD_PARTY, "THIRD_PARTY"},
1902     {FMP_CLIENT_BASED_DART, "CLIENT_BASED_DART"},
1903     {FMP_CLIENT_BASED_SIMPLE, "CLIENT_BASED_SIMPLE"},
1904     {FMP_DISK_SIGNATURE, "DISK_SIGNATURE"},
1905     {FMP_HIERARCHICAL_VOLUME, "HIERARCHICAL_VOLUME"},
1906     {0,NULL}
1907 };
1908
1909 static const value_string fmp_client_error_number_vals[] = {
1910     {FMP_CE_GENERIC, "FMP_CE_GENERIC"},
1911     {FMP_CE_DISK_ERROR, "FMP_CE_DISK_ERROR"},
1912     {0,NULL}
1913 };
1914
1915 void
1916 proto_register_fmp(void)
1917 {
1918     static hf_register_info hf[] = {
1919         { &hf_fmp_procedure,
1920           { "Procedure", "fmp.procedure",
1921             FT_UINT32, BASE_DEC, VALS(fmp_proc_vals),
1922             0, NULL, HFILL }},        /* New addition */
1923
1924         { &hf_fmp_hostID,
1925           { "Host ID", "fmp.hostID",
1926             FT_STRING, BASE_NONE, NULL, 0,
1927             NULL, HFILL }},
1928
1929         { &hf_fmp_btime,
1930           { "Boot Time", "fmp.btime",
1931             FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0,
1932             "Machine Boot Time", HFILL }},
1933
1934         { &hf_fmp_time_sec,
1935           { "seconds", "fmp.btime.sec",
1936             FT_UINT32, BASE_DEC, NULL, 0,
1937             NULL, HFILL }},
1938
1939         { &hf_fmp_time_nsec,
1940           { "nanoseconds", "fmp.btime.nsec",
1941             FT_UINT32, BASE_DEC, NULL, 0,
1942             NULL, HFILL }},
1943
1944         { &hf_fmp_notifyPort,
1945           { "Notify Port", "fmp.notifyPort",
1946             FT_UINT32, BASE_DEC, NULL, 0,
1947             NULL, HFILL }},
1948
1949         { &hf_fmp_sessionHandle,
1950           { "Session Handle", "fmp.sessHandle",
1951             FT_BYTES, BASE_NONE, NULL, 0,
1952             NULL, HFILL }},
1953
1954         { &hf_fmp_fmpFHandle,
1955           { "FMP File Handle", "fmp.fmpFHandle",
1956             FT_BYTES, BASE_NONE, NULL, 0,
1957             NULL,
1958
1959                 HFILL }},
1960         { &hf_fmp_nfsFHandle,
1961           { "NFS File Handle", "fmp.nfsFHandle",
1962             FT_BYTES, BASE_NONE, NULL, 0,
1963             NULL, HFILL }},
1964
1965         { &hf_fmp_fsID,
1966           { "File System ID", "fmp.fsID",
1967             FT_UINT32, BASE_HEX, NULL, 0,
1968             NULL, HFILL }},
1969
1970         { &hf_fmp_status,
1971           { "Status", "fmp.status",
1972             FT_UINT32, BASE_DEC, VALS(fmp_status_vals), 0,
1973             "Reply Status", HFILL }},
1974
1975         { &hf_fmp_fsBlkSz,
1976           { "File System Block Size", "fmp.fsBlkSz",
1977             FT_UINT32, BASE_DEC, NULL, 0,
1978             NULL, HFILL }},
1979
1980         { &hf_fmp_volHandle,
1981           { "Volume Handle", "fmp.volHandle",
1982             FT_STRING, BASE_NONE, NULL, 0,
1983             NULL, HFILL }},
1984
1985         { &hf_fmp_dskSigEnt_val,
1986           { "Celerra Signature", "fmp.dsi.ds.dsList.dskSigLst_val.dse.dskSigEnt_val",
1987             FT_STRING, BASE_NONE, NULL, 0,
1988             NULL, HFILL }},
1989
1990         { &hf_fmp_devSignature,
1991           { "Signature DATA", "fmp.devSig",
1992             FT_STRING, BASE_NONE, NULL, 0,
1993             NULL, HFILL }},
1994
1995         { &hf_fmp_mount_path,
1996           { "Native Protocol: PATH", "fmp.mount_path",
1997             FT_STRING, BASE_NONE, NULL, 0,
1998             "Absolute path from the root on the server side", HFILL }},
1999
2000         { &hf_fmp_sig_offset,
2001           { "Sig Offset", "fmp.dsi.ds.sig_offset",
2002             FT_UINT64, BASE_DEC, NULL, 0,
2003             NULL, HFILL }},
2004
2005         { &hf_fmp_numBlksReq,
2006           { "Extent Length", "fmp.numBlksReq",
2007             FT_UINT32, BASE_DEC, NULL, 0,
2008             NULL, HFILL }},
2009
2010         { &hf_fmp_minBlks,
2011           { "Minimum Blocks to Grant", "fmp.minBlks",
2012             FT_UINT32, BASE_DEC, NULL, 0,
2013             NULL, HFILL }},
2014
2015         { &hf_fmp_msgNum,
2016           { "Message Number", "fmp.msgNum",
2017             FT_UINT32, BASE_DEC, NULL, 0,
2018             NULL, HFILL }},
2019
2020         { &hf_fmp_cookie,
2021           { "Cookie", "fmp.cookie",
2022             FT_UINT32, BASE_HEX, NULL, 0,
2023             "Cookie for FMP_REQUEST_QUEUED Resp", HFILL }},
2024
2025         { &hf_fmp_fileSize,
2026           { "File Size", "fmp.fileSize",
2027             FT_UINT64, BASE_DEC, NULL, 0,
2028             NULL, HFILL }},
2029
2030         { &hf_fmp_extentList_len,
2031           { "Extent List Length", "fmp.extentList_len",
2032             FT_UINT32, BASE_DEC, NULL, 0,
2033             NULL, HFILL }},
2034
2035         { &hf_fmp_extent_state,
2036           { "Extent State", "fmp.extentState",
2037             FT_UINT32,BASE_DEC, VALS(fmp_extentState_vals), 0,
2038             NULL, HFILL }},
2039
2040         { &hf_fmp_firstLogBlk,
2041           { "First Logical File Block", "fmp.firstLogBlk",
2042             FT_UINT32, BASE_DEC, NULL, 0,
2043             NULL, HFILL }},
2044
2045         { &hf_fmp_numBlks,
2046           { "Number of Blocks", "fmp.numBlks",
2047             FT_UINT32, BASE_DEC, NULL, 0,
2048             NULL, HFILL }},
2049
2050         { &hf_fmp_volID,
2051           { "Volume ID inside DART", "fmp.volID",
2052             FT_UINT32, BASE_HEX, NULL, 0,
2053             NULL, HFILL }},
2054
2055         { &hf_fmp_startOffset,
2056           { "Start Offset", "fmp.startOffset",
2057             FT_UINT32, BASE_DEC, NULL, 0,
2058             NULL, HFILL }},
2059
2060         { &hf_fmp_start_offset64,
2061           { "Start offset", "fmp.start_offset64",
2062             FT_UINT64, BASE_DEC, NULL, 0,
2063             "Start Offset of extentEx", HFILL }},
2064
2065         { &hf_fmp_eof,
2066           { "EOF", "fmp.eof",
2067             FT_UINT64, BASE_DEC, NULL, 0,
2068             "End Of File", HFILL }},
2069
2070         { &hf_fmp_plugInID,
2071           { "Plug In Cmd ID", "fmp.plugInID",
2072             FT_BYTES, BASE_NONE, NULL, 0,
2073             NULL, HFILL }},
2074
2075         { &hf_fmp_plugInBuf,
2076           { "Plug In Args", "fmp.plugIn",
2077             FT_BYTES, BASE_NONE, NULL, 0,
2078             NULL, HFILL }},
2079
2080         { &hf_fmp_os_major,
2081           { "OS Major", "fmp.os_major",
2082             FT_UINT32, BASE_DEC, NULL, 0,
2083             NULL, HFILL }},
2084
2085         { &hf_fmp_os_minor,
2086           { "OS Minor", "fmp.os_minor",
2087             FT_UINT32, BASE_DEC, NULL, 0,
2088             NULL, HFILL }},
2089
2090         { &hf_fmp_os_name,
2091           { "OS Name", "fmp.os_name",
2092             FT_STRING, BASE_NONE, NULL, 0,
2093             NULL, HFILL }},
2094
2095         { &hf_fmp_path,
2096           { "Mount Path", "fmp.Path",
2097             FT_STRING, BASE_NONE, NULL, 0,
2098             NULL, HFILL }},
2099
2100         { &hf_fmp_os_patch,
2101           { "OS Path", "fmp.os_patch",
2102             FT_UINT32, BASE_DEC, NULL, 0,
2103             NULL, HFILL }},
2104
2105         { &hf_fmp_os_build,
2106           { "OS Build", "fmp.os_build",
2107             FT_UINT32, BASE_DEC, NULL, 0,
2108             NULL, HFILL }},
2109
2110         { &hf_fmp_server_version_string,
2111           { "Server Version String", "fmp.server_version_string",
2112             FT_STRING, BASE_NONE, NULL, 0,
2113             NULL, HFILL }},
2114
2115         { &hf_fmp_description,
2116           { "Error Description", "fmp.description",
2117             FT_STRING, BASE_NONE, NULL, 0,
2118             "Client Error Description", HFILL }},
2119
2120         { &hf_fmp_nfsv3Attr_type,
2121           { "Type", "fmp.nfsv3Attr_type",
2122             FT_UINT32, BASE_DEC, NULL, 0,
2123             "NFSV3 Attr Type", HFILL }},
2124
2125         { &hf_fmp_nfsv3Attr_mode,
2126           { "Mode", "fmp.nfsv3Attr_mod",
2127             FT_UINT32, BASE_DEC, NULL, 0,
2128             NULL, HFILL }},
2129
2130         { &hf_fmp_nfsv3Attr_nlink,
2131           { "nlink", "fmp.nfsv3Attr_nlink",
2132             FT_UINT32, BASE_DEC, NULL, 0,
2133             NULL, HFILL }},
2134
2135         { &hf_fmp_nfsv3Attr_uid,
2136           { "uid", "fmp.nfsv3Attr_uid",
2137             FT_UINT32, BASE_DEC, NULL, 0,
2138             NULL, HFILL }},
2139
2140         { &hf_fmp_nfsv3Attr_gid,
2141           { "gid", "fmp.nfsv3Attr_gid",
2142             FT_UINT32, BASE_DEC, NULL, 0,
2143             NULL, HFILL }},
2144
2145         /* for nfsv3Attr_size use hf_fmp_fileSize */
2146         { &hf_fmp_nfsv3Attr_used,
2147           { "Used", "fmp.nfsv3Attr_used",
2148             FT_UINT64, BASE_DEC, NULL, 0,
2149             NULL, HFILL }},
2150
2151         { &hf_fmp_nfsv3Attr_rdev,
2152           { "rdev", "fmp.nfsv3Attr_rdev",
2153             FT_UINT64, BASE_DEC, NULL, 0,
2154             NULL, HFILL }},
2155
2156         { &hf_fmp_nfsv3Attr_fsid,
2157           { "fsid", "fmp.nfsv3Attr_fsid",
2158             FT_UINT64, BASE_DEC, NULL, 0,
2159             NULL, HFILL }},
2160
2161         { &hf_fmp_nfsv3Attr_fileid,
2162           { "File ID", "fmp.nfsv3Attr_fileid",
2163             FT_UINT64, BASE_DEC, NULL, 0,
2164             NULL, HFILL }},
2165
2166         { &hf_fmp_cmd,
2167           { "Command", "fmp.cmd",
2168             FT_UINT32, BASE_DEC, NULL, 0,
2169             NULL, HFILL }},
2170
2171         { &hf_fmp_topVolumeId,
2172           { "Top Volume ID", "fmp.topVolumeId",
2173             FT_UINT32, BASE_HEX, NULL, 0,
2174             NULL, HFILL }},
2175
2176         { &hf_fmp_cursor,
2177           { "number of volumes", "fmp.cursor",
2178             FT_UINT32, BASE_DEC, NULL, 0,
2179             NULL, HFILL }},
2180
2181         { &hf_fmp_offset64,
2182           { "offset", "fmp.offset64",
2183             FT_UINT64, BASE_DEC, NULL, 0,
2184             NULL, HFILL }},
2185
2186         { &hf_fmp_slice_size,
2187           { "size of the slice", "fmp.slice_size",
2188             FT_UINT64, BASE_DEC, NULL, 0,
2189             NULL, HFILL }},
2190
2191         { &hf_fmp_volume,
2192           { "Volume ID's", "fmp.volume",
2193             FT_UINT32, BASE_HEX, NULL, 0,
2194             NULL, HFILL }},
2195
2196         { &hf_fmp_stripeSize,
2197           { "size of the stripe", "fmp.stripeSize",
2198             FT_UINT64, BASE_DEC, NULL, 0,
2199             NULL, HFILL }},
2200
2201         { &hf_fmp_firstLogBlk64,
2202           { "First Logical Block", "fmp.firstLogBlk64",
2203             FT_UINT64, BASE_DEC, NULL, 0,
2204             NULL, HFILL }},
2205
2206         { &hf_fmp_native_protocol,
2207           { "Native Protocol", "fmp.native_protocol",
2208             FT_UINT32, BASE_DEC, VALS(fmp_native_protocol_vals), 0,
2209             NULL, HFILL }},
2210
2211         { &hf_fmp_encoding_mode,
2212           { "Encoding Mode", "fmp.encoding_mode",
2213             FT_UINT32, BASE_DEC, VALS(fmp_encoding_mode_vals), 0,
2214             NULL, HFILL }},
2215
2216         { &hf_fmp_capability,
2217           { "Volume Mgmt Capability", "fmp.capability",
2218             FT_UINT32, BASE_DEC, VALS(fmp_volume_mgmt_capability_vals), 0,
2219             NULL, HFILL }},
2220
2221         { &hf_fmp_devSerial_query_cmd,
2222           { "Query Command", "fmp.devSerial.query_cmd",
2223             FT_UINT32, BASE_DEC, VALS(fmp_query_cmd_vals), 0,
2224             NULL, HFILL }},
2225
2226         { &hf_fmp_volume_desc,
2227           { "VOLUME", "fmp.volume_desc",
2228             FT_UINT32, BASE_DEC, VALS(fmp_volume_desc_vals), 0,
2229             NULL, HFILL }},
2230
2231         { &hf_fmp_disk_identifier,
2232           { "DISK IDENTIFIER", "fmp.disk_identifier",
2233             FT_UINT32, BASE_DEC, VALS(fmp_disk_identifier_vals), 0,
2234             NULL, HFILL }},
2235
2236         { &hf_fmp_volume_mgmt_type,
2237           { "Volume Mgmt Type", "fmp.volume_mgmt_type",
2238             FT_UINT32, BASE_DEC, VALS(fmp_volume_mgmt_type_vals), 0,
2239             NULL, HFILL }},
2240
2241         { &hf_fmp_notify_protocol,
2242           { "Protocol", "fmp.notify_protocol",
2243             FT_UINT32, BASE_DEC, VALS(fmp_notify_protocol_vals), 0,
2244             NULL, HFILL }},
2245
2246         { &hf_fmp_client_error_number,
2247           { "CLIENT Error Number", "fmp.client_error_number",
2248             FT_UINT32, BASE_DEC, VALS(fmp_client_error_number_vals), 0,
2249             NULL, HFILL }},
2250
2251       /* Generated from convert_proto_tree_add_text.pl */
2252       { &hf_fmp_fid, { "fid", "fmp.fid", FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2253       { &hf_fmp_tid, { "tid", "fmp.tid", FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2254       { &hf_fmp_uid, { "uid", "fmp.uid", FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2255       { &hf_fmp_fsid, { "FsID", "fmp.fsid", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2256       { &hf_fmp_cifsport, { "cifsPort", "fmp.cifsport", FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2257       { &hf_fmp_number_of_disk, { "Number of Disk", "fmp.number_of_disk", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2258       { &hf_fmp_length_of_list, { "Length of List", "fmp.length_of_list", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2259       { &hf_fmp_sigoffset, { "sigOffset", "fmp.sigoffset", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2260       { &hf_fmp_length_of_volume_list, { "Length of volume List", "fmp.length_of_volume_list", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2261       { &hf_fmp_blockindex, { "blockIndex", "fmp.blockindex", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2262       { &hf_fmp_cap, { "Capabilities", "fmp.cap", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2263       { &hf_fmp_cap_revoke_handle_list, { "CAP_REVOKE_HANDLE_LIST", "fmp.cap.revoke_handle_list", FT_BOOLEAN, 32, TFS(&tfs_yes_no), FMP_CAP_REVOKE_HANDLE_LIST, NULL, HFILL }},
2264       { &hf_fmp_cap_unc_names, { "CAP_UNC_NAMES", "fmp.cap.unc_names", FT_BOOLEAN, 32, TFS(&tfs_yes_no), FMP_CAP_UNC_NAMES, NULL, HFILL }},
2265       { &hf_fmp_cap_cifsv2, { "CAP_CIFSV2", "fmp.cap.cifsv2", FT_BOOLEAN, 32, TFS(&tfs_yes_no), FMP_CAP_CIFSV2, NULL, HFILL }},
2266       { &hf_fmp_mtime, { "mtime", "fmp.mtime", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2267       { &hf_fmp_atime, { "atime", "fmp.atime", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2268       { &hf_fmp_ctime, { "ctime", "fmp.ctime", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2269       { &hf_fmp_heartbeat_interval, { "Heartbeat interval", "fmp.heartbeat_interval", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2270       { &hf_fmp_volindex, { "volIndex", "fmp.volindex", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2271     };
2272
2273     static gint *ett[] = {
2274         &ett_fmp,
2275         &ett_fmp_timeval,
2276         &ett_fmp_extList,
2277         &ett_fmp_ext,
2278         &ett_fmp_fileHandle,
2279         &ett_capabilities,
2280         &ett_HierVolumeDescription,
2281         &ett_attrs
2282     };
2283
2284     module_t *fmp_module;
2285     proto_fmp = proto_register_protocol("File Mapping Protocol", "FMP", "fmp");
2286
2287     proto_register_field_array(proto_fmp, hf, array_length(hf));
2288     proto_register_subtree_array(ett, array_length(ett));
2289
2290     fmp_module=prefs_register_protocol(proto_fmp, NULL);
2291
2292     prefs_register_bool_preference(fmp_module, "fhandle_find_both_reqrep",
2293                                    "Fhandle filters finds both request/response",
2294                                    "With this option display filters for fmp fhandle a RPC call,"
2295                                    " even if the actual fhandle is only present in one of the packets",
2296                                    &fmp_fhandle_reqrep_matching);
2297
2298 }
2299
2300 void
2301 proto_reg_handoff_fmp(void)
2302 {
2303     /* Register the protocol as RPC */
2304     rpc_init_prog(proto_fmp, FMP_PROGRAM, ett_fmp,
2305                   G_N_ELEMENTS(fmp_vers_info), fmp_vers_info);
2306 }
2307
2308 /*
2309  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
2310  *
2311  * Local variables:
2312  * c-basic-offset: 4
2313  * tab-width: 8
2314  * indent-tabs-mode: nil
2315  * End:
2316  *
2317  * vi: set shiftwidth=4 tabstop=8 expandtab:
2318  * :indentSize=4:tabSize=8:noTabs=true:
2319  */