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