name change
[metze/wireshark/wip.git] / epan / dissectors / packet-ncp2222.inc
1 #define FAKE_TREE_IS_VISIBLE    1
2 /* fake that the tree is visible so that proto.c will not try to
3  "fake" generation of finfo values/nodes.
4   Thus this means netware dissector is slower than it has to, but it wont crash.
5   once the dissector is refactored to avoid calling fvalue_ functions directly this faking of whether the tree is visible or not can be removed.
6 */
7
8
9 /* packet-ncp2222.inc
10  *
11  * Routines for NetWare Core Protocol. This C code gets #include'd
12  * into packet-ncp2222.c, which is generated from ncp2222.py. It's
13  * #include'd instead of being in a separate compilation unit so
14  * that all the data tables in packet-ncp2222.c can remain static.
15  *
16  * Gilbert Ramirez <gram@alumni.rice.edu>
17  * Modified to decode NDS packets by Greg Morris <gmorris@novell.com>
18  *
19  * Portions Copyright (c) Gilbert Ramirez 2000-2002
20  * Portions Copyright (c) Novell, Inc. 2000-2003
21  *
22  * $Id$
23  *
24  * Wireshark - Network traffic analyzer
25  * By Gerald Combs <gerald@wireshark.org>
26  * Copyright 2000 Gerald Combs
27  *
28  * This program is free software; you can redistribute it and/or
29  * modify it under the terms of the GNU General Public License
30  * as published by the Free Software Foundation; either version 2
31  * of the License, or (at your option) any later version.
32  * 
33  * This program is distributed in the hope that it will be useful,
34  * but WITHOUT ANY WARRANTY; without even the implied warranty of
35  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
36  * GNU General Public License for more details.
37  * 
38  * You should have received a copy of the GNU General Public License
39  * along with this program; if not, write to the Free Software
40  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
41  */
42
43 #define NCP_PACKET_INIT_COUNT   200
44 #define PROTO_LENGTH_UNTIL_END -1
45
46 gboolean        nds_defragment = TRUE;
47 gboolean        nds_echo_eid = TRUE;
48 gboolean        ncp_echo_err = TRUE;
49 gboolean        ncp_echo_conn = TRUE;
50 gboolean        ncp_echo_server = TRUE;
51 gboolean        ncp_echo_file = TRUE;
52
53 extern dissector_handle_t nds_data_handle;
54 typedef struct {
55         guint32         nds_frag_verb;
56         guint32         nds_frag_version;
57         guint32         nds_frag_flags;
58         guint32         nds_length;
59         guint32         nds_frag;
60         gboolean        nds_fragmented;
61 } frag_info;        
62
63 frag_info           frags[100];
64 char    mv_resolve_name_string[128];
65
66 const fragment_items nds_frag_items = {
67         &ett_nds_segment,
68         &ett_nds_segments,
69         &hf_nds_segments,
70         &hf_nds_segment,
71         &hf_nds_segment_overlap,
72         &hf_nds_segment_overlap_conflict,
73         &hf_nds_segment_multiple_tails,
74         &hf_nds_segment_too_long_segment,
75         &hf_nds_segment_error,
76         NULL,
77         "segments"
78 };
79
80 #define NDS_TAG_NO_SUCH_ENTRY           0x00000000
81 #define NDS_TAG_LOCAL_ENTRY             0x00000001
82 #define NDS_TAG_REMOTE_ENTRY            0x00000002
83 #define NDS_TAG_ALIAS_ENTRY             0x00000003
84 #define NDS_TAG_REFERRAL_INFORMATION    0x00000004
85 #define NDS_TAG_ENTRY_AND_REFERRALS     0x00000006
86
87 static const value_string zensearchenum[] = {
88     { 0, "[Root]" },
89     { 1, "Object Container" },
90     { 2, "Associated Container" },
91     { 3, "Selected Container" },
92     {0, NULL }
93 };
94
95 static const value_string nds_tags[] = {
96         { NDS_TAG_NO_SUCH_ENTRY,        "No Such Entry" },
97         { NDS_TAG_LOCAL_ENTRY,          "Local Entry" },
98         { NDS_TAG_REMOTE_ENTRY,         "Remote Entry" },
99         { NDS_TAG_ALIAS_ENTRY,          "Alias Entry" },
100         { NDS_TAG_REFERRAL_INFORMATION, "Referral Information" },
101         { NDS_TAG_ENTRY_AND_REFERRALS,  "Entry and Referrals" },
102         { 0,    NULL }
103 };
104
105 static const value_string nds_info_type[] = {
106         { 0x00000000, "Attribute Names Only / " },
107         { 0x00000001, "Attribute Name & Value / " },
108         { 0x00000002, "Effective Privileges / " },
109         { 0x00000003, "Value Information / " },
110         { 0x00000004, "Abbreviated Value / " },
111         { 0,    NULL }
112 };
113
114 static const value_string nds_kind_of_changes[] = {
115         { 0x00000000, "Add Attribute" },
116         { 0x00000001, "Remove Attribute" },
117         { 0x00000002, "Add Value" },
118         { 0x00000003, "Remove Value" },
119         { 0x00000004, "Add Additional Value" },
120         { 0x00000005, "Overwrite Value" },
121         { 0x00000006, "Clear Attribute" },
122         { 0x00000007, "Clear Value" },
123         { 0,    NULL }
124 };
125
126 static const value_string es_type[] = {
127         { 0x00000000, "No type is specified" },
128         { 0x00000001, "Unicode string" },
129         { 0x00000002, "Partial name" },
130         { 0x00000003, "Referrals" },
131         { 0x00000004, "Tuned name" },
132         { 0x00000005, "GUID attribute" },
133         { 0x00000006, "Local entry ID" },
134         { 0x00000007, "Number of defined entry specifiers" },
135         { 0,    NULL }
136 };
137
138 static const value_string ncp_rights_vals[] = {
139   { 0x00, "No Rights"},
140   { 0x01, "Read"},
141   { 0x02, "Write"},
142   { 0x03, "Read, Write"},
143   { 0x04, "Deny Read"},
144   { 0x05, "Read, Deny Read"},
145   { 0x06, "Write, Deny Read"},
146   { 0x07, "Read, Write, Deny Read"},
147   { 0x08, "Deny Write"},
148   { 0x09, "Read, Deny Write"},
149   { 0x0a, "Write, Deny Write"},
150   { 0x0b, "Read, Write, Deny Write"},
151   { 0x0c, "Deny Read, Deny Write"},
152   { 0x0d, "Read, Deny Read, Deny Write"},
153   { 0x0e, "Write, Deny Read, Deny Write"},
154   { 0x0f, "Read, Write, Deny Read, Deny Write"},
155   { 0x10, "Compatibility"},
156   { 0x11, "Read, Compatibility"},
157   { 0x12, "Write, Compatibility"},
158   { 0x13, "Read, Write, Compatibility"},
159   { 0x14, "Deny Read, Compatibility"},
160   { 0x15, "Read, Deny Read, Compatibility"},
161   { 0x16, "Write, Deny Read, Compatibility"},
162   { 0x17, "Read, Write, Deny Read, Compatibility"},
163   { 0x18, "Deny Write, Compatibility"},
164   { 0x19, "Read, Deny Write, Compatibility"},
165   { 0x1a, "Write, Deny Write, Compatibility"},
166   { 0x1b, "Read, Write, Deny Write, Compatibility"},
167   { 0x1c, "Deny Read, Deny Write, Compatibility"},
168   { 0x1d, "Read, Deny Read, Deny Write, Compatibility"},
169   { 0x1e, "Write, Deny Read, Deny Write, Compatibility"},
170   { 0x1f, "Read, Write, Deny Read, Deny Write, Compatibility"},
171   { 0x40, "File Write Through"},
172   { 0x41, "Read, File Write Through"},
173   { 0x42, "Write, File Write Through"},
174   { 0x43, "Read, Write, File Write Through"},
175   { 0x44, "Deny Read, File Write Through"},
176   { 0x45, "Read, Deny Read, File Write Through"},
177   { 0x46, "Write, Deny Read, File Write Through"},
178   { 0x47, "Read, Write, Deny Read, File Write Through"},
179   { 0x48, "Deny Write, File Write Through"},
180   { 0x49, "Read, Deny Write, File Write Through"},
181   { 0x4a, "Write, Deny Write, File Write Through"},
182   { 0x4b, "Read, Write, Deny Write, File Write Through"},
183   { 0x4c, "Deny Read, Deny Write, File Write Through"},
184   { 0x4d, "Read, Deny Read, Deny Write, File Write Through"},
185   { 0x4e, "Write, Deny Read, Deny Write, File Write Through"},
186   { 0x4f, "Read, Write, Deny Read, Deny Write, File Write Through"},
187   { 0x50, "Compatibility, File Write Through"},
188   { 0x51, "Read, Compatibility, File Write Through"},
189   { 0x52, "Write, Compatibility, File Write Through"},
190   { 0x53, "Read, Write, Compatibility, File Write Through"},
191   { 0x54, "Deny Read, Compatibility, File Write Through"},
192   { 0x55, "Read, Deny Read, Compatibility, File Write Through"},
193   { 0x56, "Write, Deny Read, Compatibility, File Write Through"},
194   { 0x57, "Read, Write, Deny Read, Compatibility, File Write Through"},
195   { 0x58, "Deny Write, Compatibility, File Write Through"},
196   { 0x59, "Read, Deny Write, Compatibility, File Write Through"},
197   { 0x5a, "Write, Deny Write, Compatibility, File Write Through"},
198   { 0x5b, "Read, Write, Deny Write, Compatibility, File Write Through"},
199   { 0x5c, "Deny Read, Deny Write, Compatibility, File Write Through"},
200   { 0x5d, "Read, Deny Read, Deny Write, Compatibility, File Write Through"},
201   { 0x5e, "Write, Deny Read, Deny Write, Compatibility, File Write Through"},
202   { 0x5f, "Read, Write, Deny Read, Deny Write, Compatibility, File Write Through"},
203   { 0,    NULL }
204 };
205
206 static const value_string open_create_mode_vals[] = {
207     { 0x01, "Open"},
208     { 0x02, "Replace"},
209     { 0x03, "Open, Replace"},
210     { 0x08, "Create"},
211     { 0x09, "Open, Create"},
212     { 0x0a, "Replace, Create"},
213     { 0x0b, "Open, Replace, Create"},
214     { 0x20, "64-bit"},
215     { 0x21, "Open, 64-bit"},
216     { 0x22, "Replace, 64-bit"},
217     { 0x23, "Open, Replace, 64-bit"},
218     { 0x28, "Create, 64-bit"},
219     { 0x29, "Open, Create, 64-bit"},
220     { 0x2a, "Replace, Create, 64-bit"},
221     { 0x2b, "Open, Replace, Create, 64-bit"},
222     { 0x40, "Read Only"},
223     { 0x41, "Open, Read Only"},
224     { 0x42, "Replace, Read Only"},
225     { 0x43, "Open, Replace, Read Only"},
226     { 0x48, "Create, Read Only"},
227     { 0x49, "Open, Create, Read Only"},
228     { 0x4a, "Replace, Create, Read Only"},
229     { 0x4b, "Open, Replace, Create, Read Only"},
230     { 0x60, "64-bit, Read Only"},
231     { 0x61, "Open, 64-bit, Read Only"},
232     { 0x62, "Replace, 64-bit, Read Only"},
233     { 0x63, "Open, Replace, 64-bit, Read Only"},
234     { 0x68, "Create, 64-bit, Read Only"},
235     { 0x69, "Open, Create, 64-bit, Read Only"},
236     { 0x6a, "Replace, Create, 64-bit, Read Only"},
237     { 0x6b, "Open, Replace, Create, 64-bit, Read Only"},
238     { 0x80, "Op-Lock"},
239     { 0x81, "Open, Op-Lock"},
240     { 0x82, "Replace, Op-Lock"},
241     { 0x83, "Open, Replace, Op-Lock"},
242     { 0x88, "Create, Op-Lock"},
243     { 0x89, "Open, Create, Op-Lock"},
244     { 0x8a, "Replace, Create, Op-Lock"},
245     { 0x8b, "Open, Replace, Create, Op-Lock"},
246     { 0xa0, "64-bit, Op-Lock"},
247     { 0xa1, "Open, 64-bit, Op-Lock"},
248     { 0xa2, "Replace, 64-bit, Op-Lock"},
249     { 0xa3, "Open, Replace, 64-bit, Op-Lock"},
250     { 0xa8, "Create, 64-bit, Op-Lock"},
251     { 0xa9, "Open, Create, 64-bit, Op-Lock"},
252     { 0xaa, "Replace, Create, 64-bit, Op-Lock"},
253     { 0xab, "Open, Replace, Create, 64-bit, Op-Lock"},
254     { 0xc0, "Read Only, Op-Lock"},
255     { 0xc1, "Open, Read Only, Op-Lock"},
256     { 0xc2, "Replace, Read Only, Op-Lock"},
257     { 0xc3, "Open, Replace, Read Only, Op-Lock"},
258     { 0xc8, "Create, Read Only, Op-Lock"},
259     { 0xc9, "Open, Create, Read Only, Op-Lock"},
260     { 0xca, "Replace, Create, Read Only, Op-Lock"},
261     { 0xcb, "Open, Replace, Create, Read Only, Op-Lock"},
262     { 0xe0, "64-bit, Read Only, Op-Lock"},
263     { 0xe1, "Open, 64-bit, Read Only, Op-Lock"},
264     { 0xe2, "Replace, 64-bit, Read Only, Op-Lock"},
265     { 0xe3, "Open, Replace, 64-bit, Read Only, Op-Lock"},
266     { 0xe8, "Create, 64-bit, Read Only, Op-Lock"},
267     { 0xe9, "Open, Create, 64-bit, Read Only, Op-Lock"},
268     { 0xea, "Replace, Create, 64-bit, Read Only, Op-Lock"},
269     { 0xeb, "Open, Replace, Create, 64-bit, Read Only, Op-Lock"},
270     { 0,    NULL }
271 };
272
273 static const value_string open_create_action_vals[] = {
274     { 0x01, "Opened"},
275     { 0x02, "Created"},
276     { 0x03, "Opened, Created"},
277     { 0x04, "Replaced"},
278     { 0x05, "Opened, Replaced"},
279     { 0x06, "Created, Replaced"},
280     { 0x07, "Opened, Created, Replaced"},
281     { 0x08, "Compressed"},
282     { 0x09, "Opened, Compressed"},
283     { 0x0a, "Created, Compressed"},
284     { 0x0b, "Opened, Created, Compressed"},
285     { 0x0c, "Replaced, Compressed"},
286     { 0x0d, "Opened, Replaced, Compressed"},
287     { 0x0e, "Created, Replaced, Compressed"},
288     { 0x0f, "Opened, Created, Replaced, Compressed"},
289     { 0x80, "Read Only"},
290     { 0x81, "Opened, Read Only"},
291     { 0x82, "Created, Read Only"},
292     { 0x83, "Opened, Created, Read Only"},
293     { 0x84, "Replaced, Read Only"},
294     { 0x85, "Opened, Replaced, Read Only"},
295     { 0x86, "Created, Replaced, Read Only"},
296     { 0x87, "Opened, Created, Replaced, Read Only"},
297     { 0x88, "Compressed, Read Only"},
298     { 0x89, "Opened, Compressed, Read Only"},
299     { 0x8a, "Created, Compressed, Read Only"},
300     { 0x8b, "Opened, Created, Compressed, Read Only"},
301     { 0x8c, "Replaced, Compressed, Read Only"},
302     { 0x8d, "Opened, Replaced, Compressed, Read Only"},
303     { 0x8e, "Created, Replaced, Compressed, Read Only"},
304     { 0x8f, "Opened, Created, Replaced, Compressed, Read Only"},
305     { 0,    NULL }
306 };
307
308 static const value_string access_rights_vals[] = {
309     { 0x0000, "No Rights"},
310         { 0x0001, "Read"},
311     { 0x0002, "Write"},
312     { 0x0003, "Read, Write"},
313     { 0x0004, "Open"},
314         { 0x0005, "Read, Open"},
315     { 0x0006, "Write, Open"},
316     { 0x0007, "Read, Write, Open"},
317     { 0x0008, "Create"},
318         { 0x0009, "Read, Create"},
319     { 0x000a, "Write, Create"},
320     { 0x000b, "Read, Write, Create"},
321     { 0x000c, "Open, Create"},
322         { 0x000d, "Read, Open, Create"},
323     { 0x000e, "Write, Open, Create"},
324     { 0x000f, "Read, Write, Open, Create"},
325     { 0x0010, "Delete"},
326         { 0x0011, "Read, Delete"},
327     { 0x0012, "Write, Delete"},
328     { 0x0013, "Read, Write, Delete"},
329     { 0x0014, "Open, Delete"},
330         { 0x0015, "Read, Open, Delete"},
331     { 0x0016, "Write, Open, Delete"},
332     { 0x0017, "Read, Write, Open, Delete"},
333     { 0x0018, "Create, Delete"},
334         { 0x0019, "Read, Create, Delete"},
335     { 0x001a, "Write, Create, Delete"},
336     { 0x001b, "Read, Write, Create, Delete"},
337     { 0x001c, "Open, Create, Delete"},
338         { 0x001d, "Read, Open, Create, Delete"},
339     { 0x001e, "Write, Open, Create, Delete"},
340     { 0x001f, "Read, Write, Open, Create, Delete"},
341     { 0x0020, "Parental"},
342         { 0x0021, "Read, Parental"},
343     { 0x0022, "Write, Parental"},
344     { 0x0023, "Read, Write, Parental"},
345     { 0x0024, "Open, Parental"},
346         { 0x0025, "Read, Open, Parental"},
347     { 0x0026, "Write, Open, Parental"},
348     { 0x0027, "Read, Write, Open, Parental"},
349     { 0x0028, "Create, Parental"},
350         { 0x0029, "Read, Create, Parental"},
351     { 0x002a, "Write, Create, Parental"},
352     { 0x002b, "Read, Write, Create, Parental"},
353     { 0x002c, "Open, Create, Parental"},
354         { 0x002d, "Read, Open, Create, Parental"},
355     { 0x002e, "Write, Open, Create, Parental"},
356     { 0x002f, "Read, Write, Open, Create, Parental"},
357     { 0x0030, "Delete, Parental"},
358         { 0x0031, "Read, Delete, Parental"},
359     { 0x0032, "Write, Delete, Parental"},
360     { 0x0033, "Read, Write, Delete, Parental"},
361     { 0x0034, "Open, Delete, Parental"},
362         { 0x0035, "Read, Open, Delete, Parental"},
363     { 0x0036, "Write, Open, Delete, Parental"},
364     { 0x0037, "Read, Write, Open, Delete, Parental"},
365     { 0x0038, "Create, Delete, Parental"},
366         { 0x0039, "Read, Create, Delete, Parental"},
367     { 0x003a, "Write, Create, Delete, Parental"},
368     { 0x003b, "Read, Write, Create, Delete, Parental"},
369     { 0x003c, "Open, Create, Delete, Parental"},
370         { 0x003d, "Read, Open, Create, Delete, Parental"},
371     { 0x003e, "Write, Open, Create, Delete, Parental"},
372     { 0x003f, "Read, Write, Open, Create, Delete, Parental"},
373     { 0x0040, "Search"},
374         { 0x0041, "Read, Search"},
375     { 0x0042, "Write, Search"},
376     { 0x0043, "Read, Write, Search"},
377     { 0x0044, "Open, Search"},
378         { 0x0045, "Read, Open, Search"},
379     { 0x0046, "Write, Open, Search"},
380     { 0x0047, "Read, Write, Open, Search"},
381     { 0x0048, "Create, Search"},
382         { 0x0049, "Read, Create, Search"},
383     { 0x004a, "Write, Create, Search"},
384     { 0x004b, "Read, Write, Create, Search"},
385     { 0x004c, "Open, Create, Search"},
386         { 0x004d, "Read, Open, Create, Search"},
387     { 0x004e, "Write, Open, Create, Search"},
388     { 0x004f, "Read, Write, Open, Create, Search"},
389     { 0x0050, "Delete, Search"},
390         { 0x0051, "Read, Delete, Search"},
391     { 0x0052, "Write, Delete, Search"},
392     { 0x0053, "Read, Write, Delete, Search"},
393     { 0x0054, "Open, Delete, Search"},
394         { 0x0055, "Read, Open, Delete, Search"},
395     { 0x0056, "Write, Open, Delete, Search"},
396     { 0x0057, "Read, Write, Open, Delete, Search"},
397     { 0x0058, "Create, Delete, Search"},
398         { 0x0059, "Read, Create, Delete, Search"},
399     { 0x005a, "Write, Create, Delete, Search"},
400     { 0x005b, "Read, Write, Create, Delete, Search"},
401     { 0x005c, "Open, Create, Delete, Search"},
402         { 0x005d, "Read, Open, Create, Delete, Search"},
403     { 0x005e, "Write, Open, Create, Delete, Search"},
404     { 0x005f, "Read, Write, Open, Create, Delete, Search"},
405     { 0x0060, "Parental, Search"},
406         { 0x0061, "Read, Parental, Search"},
407     { 0x0062, "Write, Parental, Search"},
408     { 0x0063, "Read, Write, Parental, Search"},
409     { 0x0064, "Open, Parental, Search"},
410         { 0x0065, "Read, Open, Parental, Search"},
411     { 0x0066, "Write, Open, Parental, Search"},
412     { 0x0067, "Read, Write, Open, Parental, Search"},
413     { 0x0068, "Create, Parental, Search"},
414         { 0x0069, "Read, Create, Parental, Search"},
415     { 0x006a, "Write, Create, Parental, Search"},
416     { 0x006b, "Read, Write, Create, Parental, Search"},
417     { 0x006c, "Open, Create, Parental, Search"},
418         { 0x006d, "Read, Open, Create, Parental, Search"},
419     { 0x006e, "Write, Open, Create, Parental, Search"},
420     { 0x006f, "Read, Write, Open, Create, Parental, Search"},
421     { 0x0070, "Delete, Parental, Search"},
422         { 0x0071, "Read, Delete, Parental, Search"},
423     { 0x0072, "Write, Delete, Parental, Search"},
424     { 0x0073, "Read, Write, Delete, Parental, Search"},
425     { 0x0074, "Open, Delete, Parental, Search"},
426         { 0x0075, "Read, Open, Delete, Parental, Search"},
427     { 0x0076, "Write, Open, Delete, Parental, Search"},
428     { 0x0077, "Read, Write, Open, Delete, Parental, Search"},
429     { 0x0078, "Create, Delete, Parental, Search"},
430         { 0x0079, "Read, Create, Delete, Parental, Search"},
431     { 0x007a, "Write, Create, Delete, Parental, Search"},
432     { 0x007b, "Read, Write, Create, Delete, Parental, Search"},
433     { 0x007c, "Open, Create, Delete, Parental, Search"},
434         { 0x007d, "Read, Open, Create, Delete, Parental, Search"},
435     { 0x007e, "Write, Open, Create, Delete, Parental, Search"},
436     { 0x007f, "Read, Write, Open, Create, Delete, Parental, Search"},
437     { 0x0080, "Modify"},
438         { 0x0081, "Read, Modify"},
439     { 0x0082, "Write, Modify"},
440     { 0x0083, "Read, Write, Modify"},
441     { 0x0084, "Open, Modify"},
442         { 0x0085, "Read, Open, Modify"},
443     { 0x0086, "Write, Open, Modify"},
444     { 0x0087, "Read, Write, Open, Modify"},
445     { 0x0088, "Create, Modify"},
446         { 0x0089, "Read, Create, Modify"},
447     { 0x008a, "Write, Create, Modify"},
448     { 0x008b, "Read, Write, Create, Modify"},
449     { 0x008c, "Open, Create, Modify"},
450         { 0x008d, "Read, Open, Create, Modify"},
451     { 0x008e, "Write, Open, Create, Modify"},
452     { 0x008f, "Read, Write, Open, Create, Modify"},
453     { 0x0090, "Delete, Modify"},
454         { 0x0091, "Read, Delete, Modify"},
455     { 0x0092, "Write, Delete, Modify"},
456     { 0x0093, "Read, Write, Delete, Modify"},
457     { 0x0094, "Open, Delete, Modify"},
458         { 0x0095, "Read, Open, Delete, Modify"},
459     { 0x0096, "Write, Open, Delete, Modify"},
460     { 0x0097, "Read, Write, Open, Delete, Modify"},
461     { 0x0098, "Create, Delete, Modify"},
462         { 0x0099, "Read, Create, Delete, Modify"},
463     { 0x009a, "Write, Create, Delete, Modify"},
464     { 0x009b, "Read, Write, Create, Delete, Modify"},
465     { 0x009c, "Open, Create, Delete, Modify"},
466         { 0x009d, "Read, Open, Create, Delete, Modify"},
467     { 0x009e, "Write, Open, Create, Delete, Modify"},
468     { 0x009f, "Read, Write, Open, Create, Delete, Modify"},
469     { 0x00a0, "Parental, Modify"},
470         { 0x00a1, "Read, Parental, Modify"},
471     { 0x00a2, "Write, Parental, Modify"},
472     { 0x00a3, "Read, Write, Parental, Modify"},
473     { 0x00a4, "Open, Parental, Modify"},
474         { 0x00a5, "Read, Open, Parental, Modify"},
475     { 0x00a6, "Write, Open, Parental, Modify"},
476     { 0x00a7, "Read, Write, Open, Parental, Modify"},
477     { 0x00a8, "Create, Parental, Modify"},
478         { 0x00a9, "Read, Create, Parental, Modify"},
479     { 0x00aa, "Write, Create, Parental, Modify"},
480     { 0x00ab, "Read, Write, Create, Parental, Modify"},
481     { 0x00ac, "Open, Create, Parental, Modify"},
482         { 0x00ad, "Read, Open, Create, Parental, Modify"},
483     { 0x00ae, "Write, Open, Create, Parental, Modify"},
484     { 0x00af, "Read, Write, Open, Create, Parental, Modify"},
485     { 0x00b0, "Delete, Parental, Modify"},
486         { 0x00b1, "Read, Delete, Parental, Modify"},
487     { 0x00b2, "Write, Delete, Parental, Modify"},
488     { 0x00b3, "Read, Write, Delete, Parental, Modify"},
489     { 0x00b4, "Open, Delete, Parental, Modify"},
490         { 0x00b5, "Read, Open, Delete, Parental, Modify"},
491     { 0x00b6, "Write, Open, Delete, Parental, Modify"},
492     { 0x00b7, "Read, Write, Open, Delete, Parental, Modify"},
493     { 0x00b8, "Create, Delete, Parental, Modify"},
494         { 0x00b9, "Read, Create, Delete, Parental, Modify"},
495     { 0x00ba, "Write, Create, Delete, Parental, Modify"},
496     { 0x00bb, "Read, Write, Create, Delete, Parental, Modify"},
497     { 0x00bc, "Open, Create, Delete, Parental, Modify"},
498         { 0x00bd, "Read, Open, Create, Delete, Parental, Modify"},
499     { 0x00be, "Write, Open, Create, Delete, Parental, Modify"},
500     { 0x00bf, "Read, Write, Open, Create, Delete, Parental, Modify"},
501     { 0x00c0, "Search, Modify"},
502         { 0x00c1, "Read, Search, Modify"},
503     { 0x00c2, "Write, Search, Modify"},
504     { 0x00c3, "Read, Write, Search, Modify"},
505     { 0x00c4, "Open, Search, Modify"},
506         { 0x00c5, "Read, Open, Search, Modify"},
507     { 0x00c6, "Write, Open, Search, Modify"},
508     { 0x00c7, "Read, Write, Open, Search, Modify"},
509     { 0x00c8, "Create, Search, Modify"},
510         { 0x00c9, "Read, Create, Search, Modify"},
511     { 0x00ca, "Write, Create, Search, Modify"},
512     { 0x00cb, "Read, Write, Create, Search, Modify"},
513     { 0x00cc, "Open, Create, Search, Modify"},
514         { 0x00cd, "Read, Open, Create, Search, Modify"},
515     { 0x00ce, "Write, Open, Create, Search, Modify"},
516     { 0x00cf, "Read, Write, Open, Create, Search, Modify"},
517     { 0x00d0, "Delete, Search, Modify"},
518         { 0x00d1, "Read, Delete, Search, Modify"},
519     { 0x00d2, "Write, Delete, Search, Modify"},
520     { 0x00d3, "Read, Write, Delete, Search, Modify"},
521     { 0x00d4, "Open, Delete, Search, Modify"},
522         { 0x00d5, "Read, Open, Delete, Search, Modify"},
523     { 0x00d6, "Write, Open, Delete, Search, Modify"},
524     { 0x00d7, "Read, Write, Open, Delete, Search, Modify"},
525     { 0x00d8, "Create, Delete, Search, Modify"},
526         { 0x00d9, "Read, Create, Delete, Search, Modify"},
527     { 0x00da, "Write, Create, Delete, Search, Modify"},
528     { 0x00db, "Read, Write, Create, Delete, Search, Modify"},
529     { 0x00dc, "Open, Create, Delete, Search, Modify"},
530         { 0x00dd, "Read, Open, Create, Delete, Search, Modify"},
531     { 0x00de, "Write, Open, Create, Delete, Search, Modify"},
532     { 0x00df, "Read, Write, Open, Create, Delete, Search, Modify"},
533     { 0x00e0, "Parental, Search, Modify"},
534         { 0x00e1, "Read, Parental, Search, Modify"},
535     { 0x00e2, "Write, Parental, Search, Modify"},
536     { 0x00e3, "Read, Write, Parental, Search, Modify"},
537     { 0x00e4, "Open, Parental, Search, Modify"},
538         { 0x00e5, "Read, Open, Parental, Search, Modify"},
539     { 0x00e6, "Write, Open, Parental, Search, Modify"},
540     { 0x00e7, "Read, Write, Open, Parental, Search, Modify"},
541     { 0x00e8, "Create, Parental, Search, Modify"},
542         { 0x00e9, "Read, Create, Parental, Search, Modify"},
543     { 0x00ea, "Write, Create, Parental, Search, Modify"},
544     { 0x00eb, "Read, Write, Create, Parental, Search, Modify"},
545     { 0x00ec, "Open, Create, Parental, Search, Modify"},
546         { 0x00ed, "Read, Open, Create, Parental, Search, Modify"},
547     { 0x00ee, "Write, Open, Create, Parental, Search, Modify"},
548     { 0x00ef, "Read, Write, Open, Create, Parental, Search, Modify"},
549     { 0x00f0, "Delete, Parental, Search, Modify"},
550         { 0x00f1, "Read, Delete, Parental, Search, Modify"},
551     { 0x00f2, "Write, Delete, Parental, Search, Modify"},
552     { 0x00f3, "Read, Write, Delete, Parental, Search, Modify"},
553     { 0x00f4, "Open, Delete, Parental, Search, Modify"},
554         { 0x00f5, "Read, Open, Delete, Parental, Search, Modify"},
555     { 0x00f6, "Write, Open, Delete, Parental, Search, Modify"},
556     { 0x00f7, "Read, Write, Open, Delete, Parental, Search, Modify"},
557     { 0x00f8, "Create, Delete, Parental, Search, Modify"},
558         { 0x00f9, "Read, Create, Delete, Parental, Search, Modify"},
559     { 0x00fa, "Write, Create, Delete, Parental, Search, Modify"},
560     { 0x00fb, "Read, Write, Create, Delete, Parental, Search, Modify"},
561     { 0x00fc, "Open, Create, Delete, Parental, Search, Modify"},
562         { 0x00fd, "Read, Open, Create, Delete, Parental, Search, Modify"},
563     { 0x00fe, "Write, Open, Create, Delete, Parental, Search, Modify"},
564     { 0x00ff, "Read, Write, Open, Create, Delete, Parental, Search, Modify"},
565     { 0x0100, "Supervisor"},
566         { 0x0101, "Read, Supervisor"},
567     { 0x0102, "Write, Supervisor"},
568     { 0x0103, "Read, Write, Supervisor"},
569     { 0x0104, "Open, Supervisor"},
570         { 0x0105, "Read, Open, Supervisor"},
571     { 0x0106, "Write, Open, Supervisor"},
572     { 0x0107, "Read, Write, Open, Supervisor"},
573     { 0x0108, "Create, Supervisor"},
574         { 0x0109, "Read, Create, Supervisor"},
575     { 0x010a, "Write, Create, Supervisor"},
576     { 0x010b, "Read, Write, Create, Supervisor"},
577     { 0x010c, "Open, Create, Supervisor"},
578         { 0x010d, "Read, Open, Create, Supervisor"},
579     { 0x010e, "Write, Open, Create, Supervisor"},
580     { 0x010f, "Read, Write, Open, Create, Supervisor"},
581     { 0x0110, "Delete, Supervisor"},
582         { 0x0111, "Read, Delete, Supervisor"},
583     { 0x0112, "Write, Delete, Supervisor"},
584     { 0x0113, "Read, Write, Delete, Supervisor"},
585     { 0x0114, "Open, Delete, Supervisor"},
586         { 0x0115, "Read, Open, Delete, Supervisor"},
587     { 0x0116, "Write, Open, Delete, Supervisor"},
588     { 0x0117, "Read, Write, Open, Delete, Supervisor"},
589     { 0x0118, "Create, Delete, Supervisor"},
590         { 0x0119, "Read, Create, Delete, Supervisor"},
591     { 0x011a, "Write, Create, Delete, Supervisor"},
592     { 0x011b, "Read, Write, Create, Delete, Supervisor"},
593     { 0x011c, "Open, Create, Delete, Supervisor"},
594         { 0x011d, "Read, Open, Create, Delete, Supervisor"},
595     { 0x011e, "Write, Open, Create, Delete, Supervisor"},
596     { 0x011f, "Read, Write, Open, Create, Delete, Supervisor"},
597     { 0x0120, "Parental, Supervisor"},
598         { 0x0121, "Read, Parental, Supervisor"},
599     { 0x0122, "Write, Parental, Supervisor"},
600     { 0x0123, "Read, Write, Parental, Supervisor"},
601     { 0x0124, "Open, Parental, Supervisor"},
602         { 0x0125, "Read, Open, Parental, Supervisor"},
603     { 0x0126, "Write, Open, Parental, Supervisor"},
604     { 0x0127, "Read, Write, Open, Parental, Supervisor"},
605     { 0x0128, "Create, Parental, Supervisor"},
606         { 0x0129, "Read, Create, Parental, Supervisor"},
607     { 0x012a, "Write, Create, Parental, Supervisor"},
608     { 0x012b, "Read, Write, Create, Parental, Supervisor"},
609     { 0x012c, "Open, Create, Parental, Supervisor"},
610         { 0x012d, "Read, Open, Create, Parental, Supervisor"},
611     { 0x012e, "Write, Open, Create, Parental, Supervisor"},
612     { 0x012f, "Read, Write, Open, Create, Parental, Supervisor"},
613     { 0x0130, "Delete, Parental, Supervisor"},
614         { 0x0131, "Read, Delete, Parental, Supervisor"},
615     { 0x0132, "Write, Delete, Parental, Supervisor"},
616     { 0x0133, "Read, Write, Delete, Parental, Supervisor"},
617     { 0x0134, "Open, Delete, Parental, Supervisor"},
618         { 0x0135, "Read, Open, Delete, Parental, Supervisor"},
619     { 0x0136, "Write, Open, Delete, Parental, Supervisor"},
620     { 0x0137, "Read, Write, Open, Delete, Parental, Supervisor"},
621     { 0x0138, "Create, Delete, Parental, Supervisor"},
622         { 0x0139, "Read, Create, Delete, Parental, Supervisor"},
623     { 0x013a, "Write, Create, Delete, Parental, Supervisor"},
624     { 0x013b, "Read, Write, Create, Delete, Parental, Supervisor"},
625     { 0x013c, "Open, Create, Delete, Parental, Supervisor"},
626         { 0x013d, "Read, Open, Create, Delete, Parental, Supervisor"},
627     { 0x013e, "Write, Open, Create, Delete, Parental, Supervisor"},
628     { 0x013f, "Read, Write, Open, Create, Delete, Parental, Supervisor"},
629     { 0x0140, "Search, Supervisor"},
630         { 0x0141, "Read, Search, Supervisor"},
631     { 0x0142, "Write, Search, Supervisor"},
632     { 0x0143, "Read, Write, Search, Supervisor"},
633     { 0x0144, "Open, Search, Supervisor"},
634         { 0x0145, "Read, Open, Search, Supervisor"},
635     { 0x0146, "Write, Open, Search, Supervisor"},
636     { 0x0147, "Read, Write, Open, Search, Supervisor"},
637     { 0x0148, "Create, Search, Supervisor"},
638         { 0x0149, "Read, Create, Search, Supervisor"},
639     { 0x014a, "Write, Create, Search, Supervisor"},
640     { 0x014b, "Read, Write, Create, Search, Supervisor"},
641     { 0x014c, "Open, Create, Search, Supervisor"},
642         { 0x014d, "Read, Open, Create, Search, Supervisor"},
643     { 0x014e, "Write, Open, Create, Search, Supervisor"},
644     { 0x014f, "Read, Write, Open, Create, Search, Supervisor"},
645     { 0x0150, "Delete, Search, Supervisor"},
646         { 0x0151, "Read, Delete, Search, Supervisor"},
647     { 0x0152, "Write, Delete, Search, Supervisor"},
648     { 0x0153, "Read, Write, Delete, Search, Supervisor"},
649     { 0x0154, "Open, Delete, Search, Supervisor"},
650         { 0x0155, "Read, Open, Delete, Search, Supervisor"},
651     { 0x0156, "Write, Open, Delete, Search, Supervisor"},
652     { 0x0157, "Read, Write, Open, Delete, Search, Supervisor"},
653     { 0x0158, "Create, Delete, Search, Supervisor"},
654         { 0x0159, "Read, Create, Delete, Search, Supervisor"},
655     { 0x015a, "Write, Create, Delete, Search, Supervisor"},
656     { 0x015b, "Read, Write, Create, Delete, Search, Supervisor"},
657     { 0x015c, "Open, Create, Delete, Search, Supervisor"},
658         { 0x015d, "Read, Open, Create, Delete, Search, Supervisor"},
659     { 0x015e, "Write, Open, Create, Delete, Search, Supervisor"},
660     { 0x015f, "Read, Write, Open, Create, Delete, Search, Supervisor"},
661     { 0x0160, "Parental, Search, Supervisor"},
662         { 0x0161, "Read, Parental, Search, Supervisor"},
663     { 0x0162, "Write, Parental, Search, Supervisor"},
664     { 0x0163, "Read, Write, Parental, Search, Supervisor"},
665     { 0x0164, "Open, Parental, Search, Supervisor"},
666         { 0x0165, "Read, Open, Parental, Search, Supervisor"},
667     { 0x0166, "Write, Open, Parental, Search, Supervisor"},
668     { 0x0167, "Read, Write, Open, Parental, Search, Supervisor"},
669     { 0x0168, "Create, Parental, Search, Supervisor"},
670         { 0x0169, "Read, Create, Parental, Search, Supervisor"},
671     { 0x016a, "Write, Create, Parental, Search, Supervisor"},
672     { 0x016b, "Read, Write, Create, Parental, Search, Supervisor"},
673     { 0x016c, "Open, Create, Parental, Search, Supervisor"},
674         { 0x016d, "Read, Open, Create, Parental, Search, Supervisor"},
675     { 0x016e, "Write, Open, Create, Parental, Search, Supervisor"},
676     { 0x016f, "Read, Write, Open, Create, Parental, Search, Supervisor"},
677     { 0x0170, "Delete, Parental, Search, Supervisor"},
678         { 0x0171, "Read, Delete, Parental, Search, Supervisor"},
679     { 0x0172, "Write, Delete, Parental, Search, Supervisor"},
680     { 0x0173, "Read, Write, Delete, Parental, Search, Supervisor"},
681     { 0x0174, "Open, Delete, Parental, Search, Supervisor"},
682         { 0x0175, "Read, Open, Delete, Parental, Search, Supervisor"},
683     { 0x0176, "Write, Open, Delete, Parental, Search, Supervisor"},
684     { 0x0177, "Read, Write, Open, Delete, Parental, Search, Supervisor"},
685     { 0x0178, "Create, Delete, Parental, Search, Supervisor"},
686         { 0x0179, "Read, Create, Delete, Parental, Search, Supervisor"},
687     { 0x017a, "Write, Create, Delete, Parental, Search, Supervisor"},
688     { 0x017b, "Read, Write, Create, Delete, Parental, Search, Supervisor"},
689     { 0x017c, "Open, Create, Delete, Parental, Search, Supervisor"},
690         { 0x017d, "Read, Open, Create, Delete, Parental, Search, Supervisor"},
691     { 0x017e, "Write, Open, Create, Delete, Parental, Search, Supervisor"},
692     { 0x017f, "Read, Write, Open, Create, Delete, Parental, Search, Supervisor"},
693     { 0x0180, "Modify, Supervisor"},
694         { 0x0181, "Read, Modify, Supervisor"},
695     { 0x0182, "Write, Modify, Supervisor"},
696     { 0x0183, "Read, Write, Modify, Supervisor"},
697     { 0x0184, "Open, Modify, Supervisor"},
698         { 0x0185, "Read, Open, Modify, Supervisor"},
699     { 0x0186, "Write, Open, Modify, Supervisor"},
700     { 0x0187, "Read, Write, Open, Modify, Supervisor"},
701     { 0x0188, "Create, Modify, Supervisor"},
702         { 0x0189, "Read, Create, Modify, Supervisor"},
703     { 0x018a, "Write, Create, Modify, Supervisor"},
704     { 0x018b, "Read, Write, Create, Modify, Supervisor"},
705     { 0x018c, "Open, Create, Modify, Supervisor"},
706         { 0x018d, "Read, Open, Create, Modify, Supervisor"},
707     { 0x018e, "Write, Open, Create, Modify, Supervisor"},
708     { 0x018f, "Read, Write, Open, Create, Modify, Supervisor"},
709     { 0x0190, "Delete, Modify, Supervisor"},
710         { 0x0191, "Read, Delete, Modify, Supervisor"},
711     { 0x0192, "Write, Delete, Modify, Supervisor"},
712     { 0x0193, "Read, Write, Delete, Modify, Supervisor"},
713     { 0x0194, "Open, Delete, Modify, Supervisor"},
714         { 0x0195, "Read, Open, Delete, Modify, Supervisor"},
715     { 0x0196, "Write, Open, Delete, Modify, Supervisor"},
716     { 0x0197, "Read, Write, Open, Delete, Modify, Supervisor"},
717     { 0x0198, "Create, Delete, Modify, Supervisor"},
718         { 0x0199, "Read, Create, Delete, Modify, Supervisor"},
719     { 0x019a, "Write, Create, Delete, Modify, Supervisor"},
720     { 0x019b, "Read, Write, Create, Delete, Modify, Supervisor"},
721     { 0x019c, "Open, Create, Delete, Modify, Supervisor"},
722         { 0x019d, "Read, Open, Create, Delete, Modify, Supervisor"},
723     { 0x019e, "Write, Open, Create, Delete, Modify, Supervisor"},
724     { 0x019f, "Read, Write, Open, Create, Delete, Modify, Supervisor"},
725     { 0x01a0, "Parental, Modify, Supervisor"},
726         { 0x01a1, "Read, Parental, Modify, Supervisor"},
727     { 0x01a2, "Write, Parental, Modify, Supervisor"},
728     { 0x01a3, "Read, Write, Parental, Modify, Supervisor"},
729     { 0x01a4, "Open, Parental, Modify, Supervisor"},
730         { 0x01a5, "Read, Open, Parental, Modify, Supervisor"},
731     { 0x01a6, "Write, Open, Parental, Modify, Supervisor"},
732     { 0x01a7, "Read, Write, Open, Parental, Modify, Supervisor"},
733     { 0x01a8, "Create, Parental, Modify, Supervisor"},
734         { 0x01a9, "Read, Create, Parental, Modify, Supervisor"},
735     { 0x01aa, "Write, Create, Parental, Modify, Supervisor"},
736     { 0x01ab, "Read, Write, Create, Parental, Modify, Supervisor"},
737     { 0x01ac, "Open, Create, Parental, Modify, Supervisor"},
738         { 0x01ad, "Read, Open, Create, Parental, Modify, Supervisor"},
739     { 0x01ae, "Write, Open, Create, Parental, Modify, Supervisor"},
740     { 0x01af, "Read, Write, Open, Create, Parental, Modify, Supervisor"},
741     { 0x01b0, "Delete, Parental, Modify, Supervisor"},
742         { 0x01b1, "Read, Delete, Parental, Modify, Supervisor"},
743     { 0x01b2, "Write, Delete, Parental, Modify, Supervisor"},
744     { 0x01b3, "Read, Write, Delete, Parental, Modify, Supervisor"},
745     { 0x01b4, "Open, Delete, Parental, Modify, Supervisor"},
746         { 0x01b5, "Read, Open, Delete, Parental, Modify, Supervisor"},
747     { 0x01b6, "Write, Open, Delete, Parental, Modify, Supervisor"},
748     { 0x01b7, "Read, Write, Open, Delete, Parental, Modify, Supervisor"},
749     { 0x01b8, "Create, Delete, Parental, Modify, Supervisor"},
750         { 0x01b9, "Read, Create, Delete, Parental, Modify, Supervisor"},
751     { 0x01ba, "Write, Create, Delete, Parental, Modify, Supervisor"},
752     { 0x01bb, "Read, Write, Create, Delete, Parental, Modify, Supervisor"},
753     { 0x01bc, "Open, Create, Delete, Parental, Modify, Supervisor"},
754         { 0x01bd, "Read, Open, Create, Delete, Parental, Modify, Supervisor"},
755     { 0x01be, "Write, Open, Create, Delete, Parental, Modify, Supervisor"},
756     { 0x01bf, "Read, Write, Open, Create, Delete, Parental, Modify, Supervisor"},
757     { 0x01c0, "Search, Modify, Supervisor"},
758         { 0x01c1, "Read, Search, Modify, Supervisor"},
759     { 0x01c2, "Write, Search, Modify, Supervisor"},
760     { 0x01c3, "Read, Write, Search, Modify, Supervisor"},
761     { 0x01c4, "Open, Search, Modify, Supervisor"},
762         { 0x01c5, "Read, Open, Search, Modify, Supervisor"},
763     { 0x01c6, "Write, Open, Search, Modify, Supervisor"},
764     { 0x01c7, "Read, Write, Open, Search, Modify, Supervisor"},
765     { 0x01c8, "Create, Search, Modify, Supervisor"},
766         { 0x01c9, "Read, Create, Search, Modify, Supervisor"},
767     { 0x01ca, "Write, Create, Search, Modify, Supervisor"},
768     { 0x01cb, "Read, Write, Create, Search, Modify, Supervisor"},
769     { 0x01cc, "Open, Create, Search, Modify, Supervisor"},
770         { 0x01cd, "Read, Open, Create, Search, Modify, Supervisor"},
771     { 0x01ce, "Write, Open, Create, Search, Modify, Supervisor"},
772     { 0x01cf, "Read, Write, Open, Create, Search, Modify, Supervisor"},
773     { 0x01d0, "Delete, Search, Modify, Supervisor"},
774         { 0x01d1, "Read, Delete, Search, Modify, Supervisor"},
775     { 0x01d2, "Write, Delete, Search, Modify, Supervisor"},
776     { 0x01d3, "Read, Write, Delete, Search, Modify, Supervisor"},
777     { 0x01d4, "Open, Delete, Search, Modify, Supervisor"},
778         { 0x01d5, "Read, Open, Delete, Search, Modify, Supervisor"},
779     { 0x01d6, "Write, Open, Delete, Search, Modify, Supervisor"},
780     { 0x01d7, "Read, Write, Open, Delete, Search, Modify, Supervisor"},
781     { 0x01d8, "Create, Delete, Search, Modify, Supervisor"},
782         { 0x01d9, "Read, Create, Delete, Search, Modify, Supervisor"},
783     { 0x01da, "Write, Create, Delete, Search, Modify, Supervisor"},
784     { 0x01db, "Read, Write, Create, Delete, Search, Modify, Supervisor"},
785     { 0x01dc, "Open, Create, Delete, Search, Modify, Supervisor"},
786         { 0x01dd, "Read, Open, Create, Delete, Search, Modify, Supervisor"},
787     { 0x01de, "Write, Open, Create, Delete, Search, Modify, Supervisor"},
788     { 0x01df, "Read, Write, Open, Create, Delete, Search, Modify, Supervisor"},
789     { 0x01e0, "Parental, Search, Modify, Supervisor"},
790         { 0x01e1, "Read, Parental, Search, Modify, Supervisor"},
791     { 0x01e2, "Write, Parental, Search, Modify, Supervisor"},
792     { 0x01e3, "Read, Write, Parental, Search, Modify, Supervisor"},
793     { 0x01e4, "Open, Parental, Search, Modify, Supervisor"},
794         { 0x01e5, "Read, Open, Parental, Search, Modify, Supervisor"},
795     { 0x01e6, "Write, Open, Parental, Search, Modify, Supervisor"},
796     { 0x01e7, "Read, Write, Open, Parental, Search, Modify, Supervisor"},
797     { 0x01e8, "Create, Parental, Search, Modify, Supervisor"},
798         { 0x01e9, "Read, Create, Parental, Search, Modify, Supervisor"},
799     { 0x01ea, "Write, Create, Parental, Search, Modify, Supervisor"},
800     { 0x01eb, "Read, Write, Create, Parental, Search, Modify, Supervisor"},
801     { 0x01ec, "Open, Create, Parental, Search, Modify, Supervisor"},
802         { 0x01ed, "Read, Open, Create, Parental, Search, Modify, Supervisor"},
803     { 0x01ee, "Write, Open, Create, Parental, Search, Modify, Supervisor"},
804     { 0x01ef, "Read, Write, Open, Create, Parental, Search, Modify, Supervisor"},
805     { 0x01f0, "Delete, Parental, Search, Modify, Supervisor"},
806         { 0x01f1, "Read, Delete, Parental, Search, Modify, Supervisor"},
807     { 0x01f2, "Write, Delete, Parental, Search, Modify, Supervisor"},
808     { 0x01f3, "Read, Write, Delete, Parental, Search, Modify, Supervisor"},
809     { 0x01f4, "Open, Delete, Parental, Search, Modify, Supervisor"},
810         { 0x01f5, "Read, Open, Delete, Parental, Search, Modify, Supervisor"},
811     { 0x01f6, "Write, Open, Delete, Parental, Search, Modify, Supervisor"},
812     { 0x01f7, "Read, Write, Open, Delete, Parental, Search, Modify, Supervisor"},
813     { 0x01f8, "Create, Delete, Parental, Search, Modify, Supervisor"},
814         { 0x01f9, "Read, Create, Delete, Parental, Search, Modify, Supervisor"},
815     { 0x01fa, "Write, Create, Delete, Parental, Search, Modify, Supervisor"},
816     { 0x01fb, "Read, Write, Create, Delete, Parental, Search, Modify, Supervisor"},
817     { 0x01fc, "Open, Create, Delete, Parental, Search, Modify, Supervisor"},
818         { 0x01fd, "Read, Open, Create, Delete, Parental, Search, Modify, Supervisor"},
819     { 0x01fe, "Write, Open, Create, Delete, Parental, Search, Modify, Supervisor"},
820     { 0x01ff, "Read, Write, Open, Create, Delete, Parental, Search, Modify, Supervisor"},
821     { 0,    NULL }
822 };
823
824 #define NDS_PTYPE_IPX           0x00000000
825 #define NDS_PTYPE_IP            0x00000001
826 #define NDS_PTYPE_SDLC          0x00000002
827 #define NDS_PTYPE_TR_ON_ETH     0x00000003
828 #define NDS_PTYPE_OSI           0x00000004
829 #define NDS_PTYPE_APPLETALK     0x00000005
830 #define NDS_PTYPE_NETBEUI       0x00000006
831 #define NDS_PTYPE_SOCKETADDRESS 0x00000007
832 #define NDS_PTYPE_UDP           0x00000008
833 #define NDS_PTYPE_TCP           0x00000009
834 #define NDS_PTYPE_UDPv6         0x0000000a
835 #define NDS_PTYPE_TCPv6         0x0000000b
836 #define NDS_PTYPE_INTERNAL      0x0000000c
837 #define NDS_PTYPE_URL           0x0000000d
838
839 static const value_string nds_protocol_type[] = {
840         { NDS_PTYPE_IPX,           "(IPX Protocol)" },
841         { NDS_PTYPE_IP,            "(IP Protocol)" },
842         { NDS_PTYPE_SDLC,          "(SDLC Protocol)" },
843         { NDS_PTYPE_TR_ON_ETH,     "(TokenRing on Ethernet Protocol)" },
844         { NDS_PTYPE_OSI,           "(OSI Protocol)" },
845         { NDS_PTYPE_APPLETALK,     "(AppleTalk Protocol)" },
846         { NDS_PTYPE_NETBEUI,       "(NetBEUI Protocol)" },
847         { NDS_PTYPE_SOCKETADDRESS, "(Socket Address Protocol)" },
848         { NDS_PTYPE_UDP,           "(UDP Protocol)" },
849         { NDS_PTYPE_TCP,           "(TCP Protocol)" },
850         { NDS_PTYPE_UDPv6,         "(UDP v6 Protocol)" },
851         { NDS_PTYPE_TCPv6,         "(TCP v6 Protocol)" },
852         { NDS_PTYPE_INTERNAL,      "(Internal Protocol)" },
853         { NDS_PTYPE_URL,           "(URL Protocol)" },
854         { 0,    NULL }
855 };
856
857
858 static const value_string nds_syntax[] = {
859         { 0x00000000, "Unknown Syntax" },
860         { 0x00000001, "Distinguished Name" },
861         { 0x00000002, "Case Sensitive Unicode String" },
862         { 0x00000003, "Non Case Sensitive Unicode String" },
863         { 0x00000004, "Printable String" },
864         { 0x00000005, "Numeric String" },
865         { 0x00000006, "Case Insensitive List" },
866         { 0x00000007, "Boolean" },
867         { 0x00000008, "Signed Integer" },
868         { 0x00000009, "Binary String" },
869         { 0x0000000a, "Telephone Number" },
870         { 0x0000000b, "Fax Number" },
871         { 0x0000000c, "Network Address" },
872         { 0x0000000d, "Binary String List" },
873         { 0x0000000e, "Email Address" },
874         { 0x0000000f, "File System Path" },
875         { 0x00000010, "Replica Pointer" },
876         { 0x00000011, "Object ACL" },
877         { 0x00000012, "Postal Address" },
878         { 0x00000013, "Time Stamp" },
879         { 0x00000014, "Class Name" },
880         { 0x00000015, "Stream" },
881         { 0x00000016, "Counter" },
882         { 0x00000017, "Back Link" },
883         { 0x00000018, "Time" },
884         { 0x00000019, "Typed Name" },
885         { 0x0000001a, "Hold" },
886         { 0x0000001b, "Interval" },
887         { 0,    NULL }
888 };
889
890 static const value_string name_space_type[] = {
891         { 0x00000000, "DOS Name Space" },
892         { 0x00000001, "MAC Name Space" },
893         { 0x00000002, "NFS Name Space" },
894         { 0x00000003, "FTAM Name Space" },
895         { 0x00000004, "OS/2, Long Name Space" },
896         { 0,    NULL }
897 };
898
899                               
900 static const value_string nds_replica_state[] = {
901         { 0x0000, "On" },
902         { 0x0001, "New" },
903         { 0x0002, "Dying" },
904         { 0x0003, "Locked" },
905         { 0x0004, "Create Master State 0" },
906         { 0x0005, "Create Master State 1" },
907         { 0x0006, "Transition On" },
908         { 0x0007, "Dead Replica" },
909         { 0x0008, "Begin Add" },
910         { 0x000b, "Master Start" },
911         { 0x000c, "Master Done" },
912         { 0x0017, "Federated" },
913         { 0x0030, "Split State 0" },
914         { 0x0031, "Split State 1" },
915         { 0x0040, "Join State 0" },
916         { 0x0041, "Join State 1" },
917         { 0x0042, "Join State 2" },
918         { 0x0050, "Move Subtree State 0" },
919         { 0x0051, "Move Subtree State 1" },
920         { 0,    NULL }
921 };
922
923 static const value_string nds_replica_type[] = {
924         { 0x0000, "Master" },
925         { 0x0001, "Secondary" },
926         { 0x0002, "Read Only" },
927         { 0x0003, "Sub Ref" },
928         { 0,    NULL }
929 };
930
931 static const value_string class_def_type[] = {
932         { 0x0000, "Return Class Name" },
933         { 0x0001, "Return Class Name, Flag, and Definition" },
934         { 0x0002, "Return Class Name, Flag, Definition, and Super Class" },
935         { 0x0003, "Return Class Name, Flag, and ASN.1 identifier" },
936         { 0x0004, "Return Class Name, Flag, Definition, Super Class, and ACL" },
937         { 0x0005, "Return Class Name, Flag, Creation Timestamp, Modification Timestamp, Definition, and ACL" },
938         { 0,    NULL }
939 };
940
941 static const value_string nds_search_scope[] = {
942         { 0x0000, "Examine the base object only" },
943         { 0x0001, "Search the immediate subordinates of the base object" },
944         { 0x0002, "Search the base object and all its subordinates" },
945         { 0x0003, "Search the base objects and all objects in its partition (Implemented in NDS 8)" },
946         { 0,    NULL }
947 };
948
949 static const value_string nds_reply_errors[] = {
950         { 0xffffffff, "(-1) Insufficient Space" },
951         { 0xffffff89, "(-119) Buffer too Small" },
952         { 0xffffff88, "(-120) RR Volume Flag Not Set" },
953         { 0xffffff87, "(-121) No Items Found" },
954         { 0xffffff86, "(-122) Connection Already Temporary" },
955         { 0xffffff85, "(-123) Connection Already Logged In" },
956         { 0xffffff84, "(-124) Connection Not Authenticated" },
957         { 0xffffff83, "(-125) Connection Not Logged In" },
958         { 0xffffff82, "(-126) NCP Boundary Check Failed" },
959         { 0xffffff81, "(-127) Lock Waiting" },
960         { 0xffffff80, "(-128) Lock Fail" },
961         { 0xffffff7f, "(-129) Out of Handles" },
962         { 0xffffff7e, "(-130) No Open Privilege" },
963         { 0xffffff7d, "(-131) Hard IO Error" },
964         { 0xffffff7c, "(-132) No Create Privilege" },
965         { 0xffffff7b, "(-133) No Create Delete Privilege" },
966         { 0xffffff7a, "(-134) Create Duplicate When Read Only" },
967         { 0xffffff79, "(-135) Create File with Invalid Name" },
968         { 0xffffff78, "(-136) Invalid File Handle" },
969         { 0xffffff77, "(-137) No Search Privilege"   },
970         { 0xffffff76, "(-138) No Delete Privilege" },
971         { 0xffffff75, "(-139) No Rename Privilege" },
972         { 0xffffff74, "(-140) No Set Privilege" },
973         { 0xffffff73, "(-141) Some File in Use" },
974         { 0xffffff72, "(-142) All File in Use" },
975         { 0xffffff71, "(-143) Some Read Only" },
976         { 0xffffff70, "(-144) All Read Only" },
977         { 0xffffff6f, "(-145) Some names Exist" },
978         { 0xffffff6e, "(-146) All Names Exist" },
979         { 0xffffff6d, "(-147) No Read Privilege" },
980         { 0xffffff6c, "(-148) No Write Privilege" },
981         { 0xffffff6b, "(-149) File Detached" },
982         { 0xffffff6a, "(-150) No Alloc Space/Target Not a Subdirectory/Insuffficient Memory" },
983         { 0xffffff69, "(-151) No Spool Space" },
984         { 0xffffff68, "(-152) Invalid Volume" },
985         { 0xffffff67, "(-153) Directory Full" },
986         { 0xffffff66, "(-154) Rename Across Volume" },
987         { 0xffffff65, "(-155) Bad Directory Handle" },
988         { 0xffffff64, "(-156) Invalid Path/No Such Extension" },
989         { 0xffffff63, "(-157) No Directory Handles" },
990         { 0xffffff62, "(-158) Bad File Name" },
991         { 0xffffff61, "(-159) Directory Active" },
992         { 0xffffff60, "(-160) Directory Not Empty" },
993         { 0xffffff5f, "(-161) Directory IO Error" },
994         { 0xffffff5e, "(-162) IO Locked" },
995         { 0xffffff5d, "(-163) Transaction Restarted" },
996         { 0xffffff5c, "(-164) Rename Directory Invalid" },
997         { 0xffffff5b, "(-165) Invalid Open/Create Mode" },
998         { 0xffffff5a, "(-166) Already in Use" },
999         { 0xffffff59, "(-167) Invalid Resource Tag" },
1000         { 0xffffff58, "(-168) Access Denied" },
1001         { 0xffffff44, "(-188) Login Signing Required" },
1002         { 0xffffff43, "(-189) Login Encryption Required" },
1003         { 0xffffff42, "(-190) Invalid Data Stream" },
1004         { 0xffffff41, "(-191) Invalid Name Space" },
1005         { 0xffffff40, "(-192) No Accounting Privileges" },
1006         { 0xffffff3f, "(-193) No Account Balance" },
1007         { 0xffffff3e, "(-194) Credit Limit Exceeded" },
1008         { 0xffffff3d, "(-195) Too Many Holds" },
1009         { 0xffffff3c, "(-196) Accounting Disabled" },
1010         { 0xffffff3b, "(-197) Intruder Login Lockout" },
1011         { 0xffffff3a, "(-198) No Console Rights" },
1012         { 0xffffff30, "(-208) Queue IO Failure" },
1013         { 0xffffff2f, "(-209) No Queue" },
1014         { 0xffffff2e, "(-210) No Queue Server" },
1015         { 0xffffff2d, "(-211) No Queue Rights" },
1016         { 0xffffff2c, "(-212) Queue Full" },
1017         { 0xffffff2b, "(-213) No Queue Job" },
1018         { 0xffffff2a, "(-214) No Queue Job Rights/Unencrypted Not Allowed" },
1019         { 0xffffff29, "(-215) Queue In Service/Duplicate Password" },
1020         { 0xffffff28, "(-216) Queue Not Active/Password Too Short" },
1021         { 0xffffff27, "(-217) Queue Station Not Server/Maximum Logins Exceeded" },
1022         { 0xffffff26, "(-218) Queue Halted/Bad Login Time" },
1023         { 0xffffff25, "(-219) Queue Maximum Servers/Node Address Violation" },
1024         { 0xffffff24, "(-220) Login Account Expired" },
1025         { 0xffffff22, "(-222) Bad Password" },
1026         { 0xffffff21, "(-223) Password Expired" },
1027         { 0xffffff20, "(-224) No Login Connection Available" },
1028         { 0xffffff18, "(-232) Write to Group Property" },
1029         { 0xffffff17, "(-233) Member Already Exists" },
1030         { 0xffffff16, "(-234) No Such Member" },
1031         { 0xffffff15, "(-235) Property Not Group" },
1032         { 0xffffff14, "(-236) No Such Value Set" },
1033         { 0xffffff13, "(-237) Property Already Exists" },
1034         { 0xffffff12, "(-238) Object Already Exists" },
1035         { 0xffffff11, "(-239) Illegal Name" },
1036         { 0xffffff10, "(-240) Illegal Wildcard" },
1037         { 0xffffff0f, "(-241) Bindery Security" },
1038         { 0xffffff0e, "(-242) No Object Read Rights" },
1039         { 0xffffff0d, "(-243) No Object Rename Rights" },
1040         { 0xffffff0c, "(-244) No Object Delete Rights" },
1041         { 0xffffff0b, "(-245) No Object Create Rights" },
1042         { 0xffffff0a, "(-246) No Property Delete Rights" },
1043         { 0xffffff09, "(-247) No Property Create Rigths" },
1044         { 0xffffff08, "(-248) No Property Write Rights" },
1045         { 0xffffff07, "(-249) No Propery Read Rights" },
1046         { 0xffffff06, "(-250) Temp Remap" },
1047         { 0xffffff05, "(-251) Unknown Request/No Such Property" },
1048         { 0xffffff04, "(-252) Message Queue Full/Target Already Has Message/No Such Object" },
1049         { 0xffffff03, "(-253) Bad Station Number" },
1050         { 0xffffff02, "(-254) Bindery Locked/Directory Locked/Spool Delete/Trustee not Found/Timeout" },
1051         { 0xffffff01, "(-255) Hard Failure" },
1052         { 0xfffffed3, "(-301) Not Enough Memory" },
1053         { 0xfffffed2, "(-302) Bad Key" },
1054         { 0xfffffed1, "(-303) Bad Context" },
1055         { 0xfffffed0, "(-304) Buffer Full" },
1056         { 0xfffffecf, "(-305) List Empty" },
1057         { 0xfffffece, "(-306) Bad Syntax"   },
1058         { 0xfffffecd, "(-307) Buffer Empty" },
1059         { 0xfffffecc, "(-308) Bad Verb" },
1060         { 0xfffffecb, "(-309) Expected Identifier" },
1061         { 0xfffffeca, "(-310) Expected Equals" },
1062         { 0xfffffec9, "(-311) Attribute Type Expected" },
1063         { 0xfffffec8, "(-312) Attribute Type Not Expected" },
1064         { 0xfffffec7, "(-313) Filter Tree Empty" },
1065         { 0xfffffec6, "(-314) Invalid Object Name" },
1066         { 0xfffffec5, "(-315) Expected RDN Delimiter" },
1067         { 0xfffffec4, "(-316) Too Many Tokens" },
1068         { 0xfffffec3, "(-317) Inconsistent MultiAVA" },
1069         { 0xfffffec2, "(-318) Country Name Too Long" },
1070         { 0xfffffec1, "(-319) Internal Error" },
1071         { 0xfffffec0, "(-320) Can't Add Root" },
1072         { 0xfffffebf, "(-321) Unable to Attach" },
1073         { 0xfffffebe, "(-322) Invalid Iteration Handle" },
1074         { 0xfffffebd, "(-323) Buffer Zero Length" },
1075         { 0xfffffebc, "(-324) Invalid Replica Type" },
1076         { 0xfffffebb, "(-325) Invalid Attribute Syntax" },
1077         { 0xfffffeba, "(-326) Invalid Filter Syntax" },
1078         { 0xfffffeb8, "(-328) Unicode Error during Context Creation" },
1079         { 0xfffffeb7, "(-329) Invalid Union Tag" },
1080         { 0xfffffeb6, "(-330) Invalid Server Response" },
1081         { 0xfffffeb5, "(-331) Null Pointer" },
1082         { 0xfffffeb4, "(-332) No Server Found" },
1083         { 0xfffffeb3, "(-333) No Connection" },
1084         { 0xfffffeb2, "(-334) RDN Too Long" },
1085         { 0xfffffeb1, "(-335) Duplicate Type" },
1086         { 0xfffffeb0, "(-336) Data Store Failure" },
1087         { 0xfffffeaf, "(-337) Not Logged In" },
1088         { 0xfffffeae, "(-338) Invalid Password Characters" },
1089         { 0xfffffead, "(-339) Failed Server Authentication" },
1090         { 0xfffffeac, "(-340) Transport Failed" },
1091         { 0xfffffeab, "(-341) No Such Syntax" },
1092         { 0xfffffeaa, "(-342) Invalid DS Name" },
1093         { 0xfffffea9, "(-343) Attribute Name Too Long" },
1094         { 0xfffffea8, "(-344) Invalid TDS" },
1095         { 0xfffffea7, "(-345) Invalid DS Version" },
1096         { 0xfffffea6, "(-346) Unicode Translation" },
1097         { 0xfffffea5, "(-347) Schema Name Too Long" },
1098         { 0xfffffea4, "(-348) Unicode File Not Found" },
1099         { 0xfffffea3, "(-349) Unicode Already Loaded" },
1100         { 0xfffffea2, "(-350) Not Context Owner" },
1101         { 0xfffffea1, "(-351) Attempt to Authenticate" },
1102         { 0xfffffea0, "(-352) No Writable Replicas" },
1103         { 0xfffffe9f, "(-353) DN Too Long" },
1104         { 0xfffffe9e, "(-354) Rename Not Allowed" },
1105         { 0xfffffe9d, "(-355) Not NDS for NT" },
1106         { 0xfffffe9c, "(-356) NDS for NT - No Domain" },
1107         { 0xfffffe9b, "(-357) NDS for NT - Sync Disabled" },
1108         { 0xfffffe9a, "(-358) Iterator Invalid Handle" },
1109         { 0xfffffe99, "(-359) Iterator Invalid Position" },
1110         { 0xfffffe98, "(-360) Iterator Invalid Search Data" },
1111         { 0xfffffe97, "(-361) Iterator Invalid Scope" },
1112         { 0xfffffda7, "(-601) No Such Entry" },
1113         { 0xfffffda6, "(-602) No Such Value" },
1114         { 0xfffffda5, "(-603) No Such Attribute" },
1115         { 0xfffffda4, "(-604) No Such Class" },
1116         { 0xfffffda3, "(-605) No Such Partition" },
1117         { 0xfffffda2, "(-606) Entry Already Exists" },
1118         { 0xfffffda1, "(-607) Not Effective Class" },
1119         { 0xfffffda0, "(-608) Illegal Attribute" },
1120         { 0xfffffd9f, "(-609) Missing Mandatory" },
1121         { 0xfffffd9e, "(-610) Illegal DS Name" },
1122         { 0xfffffd9d, "(-611) Illegal Containment" },
1123         { 0xfffffd9c, "(-612) Can't Have Multiple Values" },
1124         { 0xfffffd9b, "(-613) Syntax Violation" },
1125         { 0xfffffd9a, "(-614) Duplicate Value" },
1126         { 0xfffffd99, "(-615) Attribute Already Exists" },
1127         { 0xfffffd98, "(-616) Maximum Entries Exist" },
1128         { 0xfffffd97, "(-617) Database Format" },
1129         { 0xfffffd96, "(-618) Inconsistent Database" },
1130         { 0xfffffd95, "(-619) Invalid Comparison" },
1131         { 0xfffffd94, "(-620) Comparison Failed" },
1132         { 0xfffffd93, "(-621) Transaction Tracking Disabled" },
1133         { 0xfffffd92, "(-622) Invalid Transport" },
1134         { 0xfffffd91, "(-623) Syntax Invalid in Name" },
1135         { 0xfffffd90, "(-624) Replica Already Exists" },
1136         { 0xfffffd8f, "(-625) Transport Failure" },
1137         { 0xfffffd8e, "(-626) All Referrals Failed" },
1138         { 0xfffffd8d, "(-627) Can't Remove Naming Value" },
1139         { 0xfffffd8c, "(-628) Object Class Violation" },
1140         { 0xfffffd8b, "(-629) Entry is Not Leaf" },
1141         { 0xfffffd8a, "(-630) Different Tree" },
1142         { 0xfffffd89, "(-631) Illegal Replica Type" },
1143         { 0xfffffd88, "(-632) System Failure" },
1144         { 0xfffffd87, "(-633) Invalid Entry for Root" },
1145         { 0xfffffd86, "(-634) No Referrals" },
1146         { 0xfffffd85, "(-635) Remote Failure" },
1147         { 0xfffffd84, "(-636) Unreachable Server" },
1148         { 0xfffffd83, "(-637) Previous Move in Progress" },
1149         { 0xfffffd82, "(-638) No Character Mapping" },
1150         { 0xfffffd81, "(-639) Incomplete Authentication" },
1151         { 0xfffffd80, "(-640) Invalid Certificate" },
1152         { 0xfffffd7f, "(-641) Invalid Request" },
1153         { 0xfffffd7e, "(-642) Invalid Iteration" },
1154         { 0xfffffd7d, "(-643) Schema is Non-removable" },
1155         { 0xfffffd7c, "(-644) Schema is in Use" },
1156         { 0xfffffd7b, "(-645) Class Already Exists" },
1157         { 0xfffffd7a, "(-646) Bad Naming Attributes" },
1158         { 0xfffffd79, "(-647) Not Root Partition" },
1159         { 0xfffffd78, "(-648) Insufficient Stack" },
1160         { 0xfffffd77, "(-649) Insufficient Buffer" },
1161         { 0xfffffd76, "(-650) Ambiguous Containment" },
1162         { 0xfffffd75, "(-651) Ambiguous Naming" },
1163         { 0xfffffd74, "(-652) Duplicate Mandatory" },
1164         { 0xfffffd73, "(-653) Duplicate Optional" },
1165         { 0xfffffd72, "(-654) Partition Busy" },
1166         { 0xfffffd71, "(-655) Multiple Replicas" },
1167         { 0xfffffd70, "(-656) Crucial Replica" },
1168         { 0xfffffd6f, "(-657) Schema Sync in Progress" },
1169         { 0xfffffd6e, "(-658) Skulk in Progress" },
1170         { 0xfffffd6d, "(-659) Time Not Synchronized" },
1171         { 0xfffffd6c, "(-660) Record in Use" },
1172         { 0xfffffd6b, "(-661) DS Volume Not Mounted" },
1173         { 0xfffffd6a, "(-662) DS Volume IO Failure" },
1174         { 0xfffffd69, "(-663) DS Locked" },
1175         { 0xfffffd68, "(-664) Old Epoch" },
1176         { 0xfffffd67, "(-665) New Epoch" },
1177         { 0xfffffd66, "(-666) Incompatible DS Version" },
1178         { 0xfffffd65, "(-667) Partition Root" },
1179         { 0xfffffd64, "(-668) Entry Not Container" },
1180         { 0xfffffd63, "(-669) Failed Authentication" },
1181         { 0xfffffd62, "(-670) Invalid Context" },
1182         { 0xfffffd61, "(-671) No Such Parent" },
1183         { 0xfffffd60, "(-672) No Access" },
1184         { 0xfffffd5f, "(-673) Replica Not On" },
1185         { 0xfffffd5e, "(-674) Invalid Name Service" },
1186         { 0xfffffd5d, "(-675) Invalid Task" },
1187         { 0xfffffd5c, "(-676) Invalide Connection Handle" },
1188         { 0xfffffd5b, "(-677) Invalid Identity" },
1189         { 0xfffffd5a, "(-678) Duplicate ACL" },
1190         { 0xfffffd59, "(-679) Partition Already Exists" },
1191         { 0xfffffd58, "(-680) Transport Modified" },
1192         { 0xfffffd57, "(-681) Alias of an Alias" },
1193         { 0xfffffd56, "(-682) Auditing Failed" },
1194         { 0xfffffd55, "(-683) Invalid API Version" },
1195         { 0xfffffd54, "(-684) Secure NCP Violation" },
1196         { 0xfffffd53, "(-685) Move in Progress" },
1197         { 0xfffffd52, "(-686) Not a Leaf Partition" },
1198         { 0xfffffd51, "(-687) Cannot Abort" },
1199         { 0xfffffd50, "(-688) Cache Overflow" },
1200         { 0xfffffd4f, "(-689) Invalid Subordinate Count" },
1201         { 0xfffffd4e, "(-690) Invalid RDN" },
1202         { 0xfffffd4d, "(-691) Modification Time Not Current" },
1203         { 0xfffffd4c, "(-692) Incorrect Base Class" },
1204         { 0xfffffd4b, "(-693) Missing Reference" },
1205         { 0xfffffd4a, "(-694) Lost Entry" },
1206         { 0xfffffd49, "(-695) Agent Already Registered" },
1207         { 0xfffffd48, "(-696) DS Loader Busy" },
1208         { 0xfffffd47, "(-697) DS Cannot Reload" },
1209         { 0xfffffd46, "(-698) Replica in Skulk" },
1210         { 0xfffffd45, "(-699) Fatal" },
1211         { 0xfffffd44, "(-700) Obsolete API" },
1212         { 0xfffffd43, "(-701) Synchronization Disabled" },
1213         { 0xfffffd42, "(-702) Invalid Parameter" },
1214         { 0xfffffd41, "(-703) Duplicate Template" },
1215         { 0xfffffd40, "(-704) No Master Replica" },
1216         { 0xfffffd3f, "(-705) Duplicate Containment" },
1217         { 0xfffffd3e, "(-706) Not a Sibling" },
1218         { 0xfffffd3d, "(-707) Invalid Signature" },
1219         { 0xfffffd3c, "(-708) Invalid Response" },
1220         { 0xfffffd3b, "(-709) Insufficient Sockets" },
1221         { 0xfffffd3a, "(-710) Database Read Fail" },
1222         { 0xfffffd39, "(-711) Invalid Code Page" },
1223         { 0xfffffd38, "(-712) Invalid Escape Character" },
1224         { 0xfffffd37, "(-713) Invalide Delimiters" },
1225         { 0xfffffd36, "(-714) Not Implemented" },
1226         { 0xfffffd35, "(-715) Checksum Failure" },
1227         { 0xfffffd34, "(-716) Checksumming Not Supported" },
1228         { 0xfffffd33, "(-717) CRC Failure" },
1229         { 0xfffffd32, "(-718) Invalid Entry Handle" },
1230         { 0xfffffd31, "(-719) Invalid Value Handle" },
1231         { 0xfffffd30, "(-720) Connection Denied" },
1232         { 0xfffffd2f, "(-721) No Such Federation Link" },
1233         { 0xfffffd2e, "(-722) Operetational Schema Mismatch" },
1234         { 0xfffffd2d, "(-723) Stream Not Found" },
1235         { 0xfffffd2c, "(-724) DClient Unavailable" },
1236         { 0xfffffd2b, "(-725) MASV No Access" },
1237         { 0xfffffd2a, "(-726) MASV Invalid Request" },
1238         { 0xfffffd29, "(-727) MASV Failure" },
1239         { 0xfffffd28, "(-728) MASV Already Exists" },
1240         { 0xfffffd27, "(-729) MASV Not Found" },
1241         { 0xfffffd26, "(-730) MASV Bad Range" },
1242         { 0xfffffd25, "(-731) Value Data" },
1243         { 0xfffffd24, "(-732) Database Locked" },
1244         { 0xfffffd21, "(-735) Nothing to Abort" },
1245         { 0xfffffd20, "(-736) End of Stream" },
1246         { 0xfffffd1f, "(-737) No Such Template" },
1247         { 0xfffffd1e, "(-738) SAS Locked" },
1248         { 0xfffffd1d, "(-739) Invalid SAS Version" },
1249         { 0xfffffd1c, "(-740) SAS Already Registered" },
1250         { 0xfffffd1b, "(-741) Name Type Not Supported" },
1251         { 0xfffffd1a, "(-742) Wrong DS Version" },
1252         { 0xfffffd19, "(-743) Invalid Control Function" },
1253         { 0xfffffd18, "(-744) Invalid Control State" },
1254         { 0xfffffd17, "(-745) Cache in Use" },
1255         { 0xfffffd16, "(-746) Zero Creation Time" },
1256         { 0xfffffd15, "(-747) Would Block" },
1257         { 0xfffffd14, "(-748) Connection Timeout" },
1258         { 0xfffffd13, "(-749) Too Many Referrals" },
1259         { 0xfffffd12, "(-750) Operation Cancelled" },
1260         { 0xfffffd11, "(-751) Unknown Target" },
1261         { 0xfffffd10, "(-752) GUID Failure" },
1262         { 0xfffffd0f, "(-753) Incompatible OS" },
1263         { 0xfffffd0e, "(-754) Callback Cancel" },
1264         { 0xfffffd0d, "(-755) Invalid Synchronization Data" },
1265         { 0xfffffd0c, "(-756) Stream Exists" },
1266         { 0xfffffd0b, "(-757) Auxiliary Has Containment" },
1267         { 0xfffffd0a, "(-758) Auxiliary Not Container" },
1268         { 0xfffffd09, "(-759) Auxiliary Not Effective" },
1269         { 0xfffffd08, "(-760) Auxiliary On Alias" },
1270         { 0xfffffd07, "(-761) Have Seen State" },
1271         { 0xfffffd06, "(-762) Verb Locked" },
1272         { 0xfffffd05, "(-763) Verb Exceeds Table Length" },
1273         { 0xfffffd04, "(-764) BOF Hit" },
1274         { 0xfffffd03, "(-765) EOF Hit" },
1275         { 0xfffffd02, "(-766) Incompatible Replica Version" },
1276         { 0xfffffd01, "(-767) Query Timeout" },
1277         { 0xfffffd00, "(-768) Query Maximum Count" },
1278         { 0xfffffcff, "(-769) Duplicate Naming" },
1279         { 0xfffffcfe, "(-770) No Transaction Active" },
1280         { 0xfffffcfd, "(-771) Transaction Active" },
1281         { 0xfffffcfc, "(-772) Illegal Transaction Operation" },
1282         { 0xfffffcfb, "(-773) Iterator Syntax" },
1283         { 0xfffffcfa, "(-774) Repairing DIB" },
1284         { 0xfffffcf9, "(-775) Invalid OID Format" },
1285         { 0xfffffcf8, "(-776) Attempted to perform an NDS operation, and the DS agent on this server is closing" },
1286         { 0xfffffcf7, "(-777) Attempted to modify an object's attribute that is not stored on the sparse replica" },
1287         { 0xfffffcf6, "(-778) VpVector and VpvUser which must be correlated, are out of sync" },
1288         { 0xfffffcf5, "(-779) Error Cannot Go Remote" },
1289         { 0xfffffcf4, "(-780) Request not Supported" },
1290         { 0xfffffcf3, "(-781) Entry Not Local" },
1291         { 0xfffffcf2, "(-782) Root Unreachable" },
1292         { 0xfffffcf1, "(-783) VRDIM Not Initialized" },
1293         { 0xfffffcf0, "(-784) Wait Timeout" },
1294         { 0xfffffcef, "(-785) DIB Error" },
1295         { 0xfffffcee, "(-786) DIB IO Failure" },
1296         { 0xfffffced, "(-787) Illegal Schema Attribute" },
1297         { 0xfffffcec, "(-788) Error Schema Partition" },
1298         { 0xfffffceb, "(-789) Invalid Template" },
1299         { 0xfffffcea, "(-790) Error Opening File" },
1300         { 0xfffffce9, "(-791) Error Direct Opening File" },
1301         { 0xfffffce8, "(-792) Error Creating File" },
1302         { 0xfffffce7, "(-793) Error Direct Creating File" },
1303         { 0xfffffce6, "(-794) Error Reading File" },
1304         { 0xfffffce5, "(-795) Error Direct Reading File" },
1305         { 0xfffffce4, "(-796) Error Writing File" },
1306         { 0xfffffce3, "(-797) Error Direct Writing File" },
1307         { 0xfffffce2, "(-798) Error Positioning in File" },
1308         { 0xfffffce1, "(-799) Error Getting File Size" },
1309         { 0xffffe88f, "(-6001) Error Truncating File" },
1310         { 0xffffe88e, "(-6002) Error Parsing File Name" },
1311         { 0xffffe88d, "(-6003) Error Closing File" },
1312         { 0xffffe88c, "(-6004) Error Getting File Info" },
1313         { 0xffffe88b, "(-6005) Error Expanding File" },
1314         { 0xffffe88a, "(-6006) Error Getting Free Blocks" },
1315         { 0xffffe889, "(-6007) Error Checking File Existence" },
1316         { 0xffffe888, "(-6008) Error Deleting File" },
1317         { 0xffffe887, "(-6009) Error Renaming File" },
1318         { 0xffffe886, "(-6010) Error Initializing IO System" },
1319         { 0xffffe885, "(-6011) Error Flushing File" },
1320         { 0xffffe884, "(-6012) Error Setting Up for Read" },
1321         { 0xffffe883, "(-6013) Error Setting up for Write" },
1322         { 0xffffe882, "(-6014) Error Old View" },
1323         { 0xffffe881, "(-6015) Server in Skulk" },
1324         { 0xffffe880, "(-6016) Error Returning Partial Results" },
1325         { 0xffffe87f, "(-6017) No Such Schema" },
1326         { 0xffffe87e, "(-6018) Serial Number Mismatch" },
1327         { 0xffffe87d, "(-6019) Bad Referal Database Serial Number" },
1328         { 0xffffe87c, "(-6020) Bad Referal Serial Number" },
1329         { 0xffffe87b, "(-6021) Invalid File Sequence" },
1330         { 0xffffe87a, "(-6022) Error Referal Trans Gap" },
1331         { 0xffffe879, "(-6023) Bad Referal File Number" },
1332         { 0xffffe878, "(-6024) Referal File Not Found" },
1333         { 0xffffe877, "(-6025) Error Backup Active" },
1334         { 0xffffe876, "(-6026) Referal Device Full" },
1335         { 0xffffe875, "(-6027) Unsupported Version" },
1336         { 0xffffe874, "(-6028) Error Must Wait Checkpoint" },
1337         { 0xffffe873, "(-6029) Attribute Maintenance in Progress" },
1338         { 0xffffe872, "(-6030) Error Abort Transaction" },
1339         { 0xffff0000, "Ok" },
1340         { 0x0000, "Ok" },
1341         { 0,    NULL }
1342 };
1343
1344
1345 static void
1346 process_ptvc_record(ptvcursor_t *ptvc, const ptvc_record *rec,
1347                 int *req_cond_results, gboolean really_decode,
1348                 const ncp_record *ncp_rec);
1349
1350 /* NCP packets come in request/reply pairs. The request packets tell the type
1351  * of NCP request and give a sequence ID. The response, unfortunately, only
1352  * identifies itself via the sequence ID; you have to know what type of NCP
1353  * request the request packet contained in order to successfully parse the NCP
1354  * response. A global method for doing this does not exist in ethereal yet
1355  * (NFS also requires it), so for now the NCP section will keep its own hash
1356  * table keeping track of NCP packet types.
1357  *
1358  * We construct a conversation specified by the client and server
1359  * addresses and the connection number; the key representing the unique
1360  * NCP request then is composed of the pointer to the conversation
1361  * structure, cast to a "guint" (which may throw away the upper 32
1362  * bits of the pointer on a P64 platform, but the low-order 32 bits
1363  * are more likely to differ between conversations than the upper 32 bits),
1364  * and the sequence number.
1365  *
1366  * The value stored in the hash table is the ncp_req_hash_value pointer. This
1367  * struct tells us the NCP type and gives the ncp2222_record pointer, if
1368  * ncp_type == 0x2222.
1369  */
1370 typedef struct {
1371         conversation_t  *conversation;
1372         guint8          nw_sequence;
1373 } ncp_req_hash_key;
1374
1375
1376 typedef struct {
1377         guint32         nw_eid;
1378 } ncp_req_eid_hash_key;
1379
1380 typedef struct {
1381         ncp_req_eid_hash_key    *nds_eid;
1382         char                        object_name[256];
1383         char                    *object_class;
1384 } ncp_req_eid_hash_value;
1385
1386 static GHashTable *ncp_req_hash = NULL;
1387 static GHashTable *ncp_req_eid_hash = NULL;
1388 static GMemChunk *ncp_req_eid_hash_keys = NULL;
1389 static GMemChunk *ncp_req_eid_hash_values = NULL;
1390 static GMemChunk *ncp_req_hash_keys = NULL;
1391 static GMemChunk *ncp_req_hash_values = NULL;
1392
1393 /* Hash Functions */
1394 static gint
1395 ncp_equal(gconstpointer v, gconstpointer v2)
1396 {
1397         const ncp_req_hash_key  *val1 = (const ncp_req_hash_key*)v;
1398         const ncp_req_hash_key  *val2 = (const ncp_req_hash_key*)v2;
1399
1400         if (val1->conversation == val2->conversation &&
1401             val1->nw_sequence  == val2->nw_sequence ) {
1402                 return 1;
1403         }
1404         return 0;
1405 }
1406
1407 static gint
1408 ncp_eid_equal(gconstpointer v, gconstpointer v2)
1409 {
1410         const ncp_req_eid_hash_key      *val1 = (const ncp_req_eid_hash_key*)v;
1411         const ncp_req_eid_hash_key      *val2 = (const ncp_req_eid_hash_key*)v2;
1412
1413         if (val1->nw_eid == val2->nw_eid ) {
1414                 return 1;
1415         }
1416         return 0;
1417 }
1418
1419 static guint
1420 ncp_hash(gconstpointer v)
1421 {
1422         const ncp_req_hash_key  *ncp_key = (const ncp_req_hash_key*)v;
1423         return GPOINTER_TO_UINT(ncp_key->conversation) + ncp_key->nw_sequence;
1424 }
1425
1426 static guint
1427 ncp_eid_hash(gconstpointer v)
1428 {
1429         const ncp_req_eid_hash_key      *ncp_eid_key = (const ncp_req_eid_hash_key*)v;
1430         return GPOINTER_TO_UINT(ncp_eid_key->nw_eid);
1431 }
1432
1433 /* Frees memory used by the ncp_req_hash_value's */
1434 static void
1435 ncp_req_hash_cleanup(gpointer key _U_, gpointer value, gpointer user_data _U_)
1436 {
1437         ncp_req_hash_value      *request_value = (ncp_req_hash_value*) value;
1438
1439         if (request_value->req_cond_results) {
1440                 g_free(request_value->req_cond_results);
1441         }
1442 }
1443
1444 /* Frees memory used by the ncp_req_hash_value's */
1445 static void
1446 ncp_req_eid_hash_cleanup(gpointer key _U_, gpointer value, gpointer user_data _U_)
1447 {
1448         ncp_req_eid_hash_value  *request_eid_value = (ncp_req_eid_hash_value*) value;
1449
1450         if (request_eid_value->object_class) {
1451                 g_free(request_eid_value->object_name);
1452         }
1453 }
1454
1455 /* Initializes the hash table and the mem_chunk area each time a new
1456  * file is loaded or re-loaded in ethereal */
1457 static void
1458 ncp_init_protocol(void)
1459 {
1460         /* fragment */
1461         fragment_table_init(&nds_fragment_table);
1462         reassembled_table_init(&nds_reassembled_table);
1463         
1464         if (ncp_req_hash) {
1465                 g_hash_table_foreach(ncp_req_hash, ncp_req_hash_cleanup, NULL);
1466                 g_hash_table_destroy(ncp_req_hash);
1467         }
1468         if (ncp_req_eid_hash) {
1469                 g_hash_table_foreach(ncp_req_eid_hash, ncp_req_eid_hash_cleanup, NULL);
1470                 g_hash_table_destroy(ncp_req_eid_hash);
1471         }
1472         if (ncp_req_hash_keys)
1473                 g_mem_chunk_destroy(ncp_req_hash_keys);
1474         if (ncp_req_hash_values)
1475                 g_mem_chunk_destroy(ncp_req_hash_values);
1476         if (ncp_req_eid_hash_keys)
1477                 g_mem_chunk_destroy(ncp_req_eid_hash_keys);
1478         if (ncp_req_eid_hash_values)
1479                 g_mem_chunk_destroy(ncp_req_eid_hash_values);
1480
1481         ncp_req_hash = g_hash_table_new(ncp_hash, ncp_equal);
1482         ncp_req_eid_hash = g_hash_table_new(ncp_eid_hash, ncp_eid_equal);
1483         ncp_req_hash_keys = g_mem_chunk_new("ncp_req_hash_keys",
1484                         sizeof(ncp_req_hash_key),
1485                         NCP_PACKET_INIT_COUNT * sizeof(ncp_req_hash_key),
1486                         G_ALLOC_ONLY);
1487         ncp_req_hash_values = g_mem_chunk_new("ncp_req_hash_values",
1488                         sizeof(ncp_req_hash_value),
1489                         NCP_PACKET_INIT_COUNT * sizeof(ncp_req_hash_value),
1490                         G_ALLOC_ONLY);
1491         ncp_req_eid_hash_keys = g_mem_chunk_new("ncp_req_eid_hash_keys",
1492                         sizeof(ncp_req_eid_hash_key),
1493                         NCP_PACKET_INIT_COUNT * sizeof(ncp_req_eid_hash_key),
1494                         G_ALLOC_ONLY);
1495         ncp_req_eid_hash_values = g_mem_chunk_new("ncp_req_eid_hash_values",
1496                         sizeof(ncp_req_eid_hash_value),
1497                         NCP_PACKET_INIT_COUNT * sizeof(ncp_req_eid_hash_value),
1498                         G_ALLOC_ONLY);
1499 }
1500
1501 /* After the sequential run, we don't need the ncp_request hash and keys
1502  * anymore; the lookups have already been done and the vital info
1503  * saved in the reply-packets' private_data in the frame_data struct. */
1504 static void
1505 ncp_postseq_cleanup(void)
1506 {
1507         if (ncp_req_hash) {
1508                 /* Destroy the hash, but don't clean up request_condition data. */
1509                 /*g_hash_table_destroy(ncp_req_hash);
1510                 ncp_req_hash = NULL;*/
1511         }
1512         if (ncp_req_hash_keys) {
1513                 /*g_mem_chunk_destroy(ncp_req_hash_keys);
1514                 ncp_req_hash_keys = NULL;*/
1515         }
1516         /* Don't free the ncp_req_hash_values or EID_hash_table, as they're
1517          * needed during random-access processing of the proto_tree.*/
1518 }
1519
1520 static ncp_req_hash_value*
1521 ncp_hash_insert(conversation_t *conversation, guint8 nw_sequence,
1522                 const ncp_record *ncp_rec)
1523 {
1524         ncp_req_hash_key                *request_key;
1525         ncp_req_hash_value              *request_value;
1526
1527         /* Now remember the request, so we can find it if we later
1528            a reply to it. */
1529         request_key = g_mem_chunk_alloc(ncp_req_hash_keys);
1530         request_key->conversation = conversation;
1531         request_key->nw_sequence = nw_sequence;
1532
1533         request_value = g_mem_chunk_alloc(ncp_req_hash_values);
1534         request_value->ncp_rec = ncp_rec;
1535         request_value->req_cond_results = NULL;
1536         request_value->req_nds_flags = 0;
1537         request_value->nds_request_verb = 0;
1538         request_value->nds_version = 0;
1539         strcpy(request_value->object_name, " ");
1540         request_value->nds_frag = TRUE;
1541         
1542         g_hash_table_insert(ncp_req_hash, request_key, request_value);
1543
1544         return request_value;
1545 }
1546
1547 static ncp_req_eid_hash_value*
1548 ncp_eid_hash_insert(guint32 nw_eid)
1549 {
1550         ncp_req_eid_hash_key            *request_eid_key;
1551         ncp_req_eid_hash_value          *request_eid_value;
1552
1553         /* Now remember the request, so we can find it if we later
1554            a reply to it. */
1555         request_eid_key = g_mem_chunk_alloc(ncp_req_eid_hash_keys);
1556         request_eid_key->nw_eid = nw_eid;
1557
1558         request_eid_value = g_mem_chunk_alloc(ncp_req_eid_hash_values);
1559         strcpy(request_eid_value->object_name, " ");
1560         request_eid_value->object_class = NULL;
1561         
1562         g_hash_table_insert(ncp_req_eid_hash, request_eid_key, request_eid_value);
1563
1564         return request_eid_value;
1565 }
1566
1567 /* Returns the ncp_rec*, or NULL if not found. */
1568 static ncp_req_hash_value*
1569 ncp_hash_lookup(conversation_t *conversation, guint8 nw_sequence)
1570 {
1571         ncp_req_hash_key                request_key;
1572
1573         request_key.conversation = conversation;
1574         request_key.nw_sequence = nw_sequence;
1575
1576         return g_hash_table_lookup(ncp_req_hash, &request_key);
1577 }
1578
1579 /* Returns the value_rec* for needed EID, or NULL if not found. */
1580 static ncp_req_eid_hash_value*
1581 ncp_eid_hash_lookup(conversation_t *conversation _U_, guint32 nw_eid)
1582 {
1583         ncp_req_eid_hash_key            request_eid_key;
1584
1585         request_eid_key.nw_eid = nw_eid;
1586
1587         return g_hash_table_lookup(ncp_req_eid_hash, &request_eid_key);
1588 }
1589
1590 /* Does NCP func require a subfunction code? */
1591 static gboolean
1592 ncp_requires_subfunc(guint8 func)
1593 {
1594         const guint8 *ncp_func_requirement = ncp_func_requires_subfunc;
1595
1596         while (*ncp_func_requirement != 0) {
1597                 if (*ncp_func_requirement == func) {
1598                         return TRUE;
1599                 }
1600                 ncp_func_requirement++;
1601         }
1602         return FALSE;
1603 }
1604
1605 /* Does the NCP func have a length parameter? */
1606 static gboolean
1607 ncp_has_length_parameter(guint8 func)
1608 {
1609         const guint8 *ncp_func_requirement = ncp_func_has_no_length_parameter;
1610
1611         while (*ncp_func_requirement != 0) {
1612                 if (*ncp_func_requirement == func) {
1613                         return FALSE;
1614                 }
1615                 ncp_func_requirement++;
1616         }
1617         return TRUE;
1618 }
1619                 
1620
1621 /* Return a ncp_record* based on func and possibly subfunc */
1622 static const ncp_record *
1623 ncp_record_find(guint8 func, guint8 subfunc)
1624 {
1625         const ncp_record *ncp_rec = ncp_packets;
1626
1627         while(ncp_rec->func != 0 || ncp_rec->subfunc != 0 ||
1628                 ncp_rec->name != NULL ) {
1629                 if (ncp_rec->func == func) {
1630                         if (ncp_rec->has_subfunc) {
1631                                 if (ncp_rec->subfunc == subfunc) {
1632                                         return ncp_rec;
1633                                 }
1634                         }
1635                         else {
1636                                 return ncp_rec;
1637                         }
1638                 }
1639                 ncp_rec++;
1640         }
1641         return NULL;
1642 }
1643
1644
1645 /* Given a proto_item*, assume it contains an integer value
1646  * and return a guint from it. */
1647 static guint
1648 get_finfo_value_integer(field_info *finfo)
1649 {
1650         /* XXX the fvalue functions are no longer safe to call directly
1651            since we sometimes fake the entries to speed things up.
1652            this dissector should not call fvalue_ functions directly.
1653         */
1654         if(!finfo->value.ftype->get_value_integer){
1655                 return 0;
1656         }
1657         return fvalue_get_integer(&finfo->value);
1658 }
1659 static guint
1660 get_item_value(proto_item *item)
1661 {
1662         return get_finfo_value_integer(PITEM_FINFO(item));
1663 }
1664
1665
1666 static guint
1667 get_finfo_length(field_info *finfo)
1668 {
1669         return fvalue_length(&finfo->value);
1670 }
1671
1672
1673 static char *
1674 get_finfo_value_string(field_info *finfo)
1675 {
1676         return fvalue_get(&finfo->value);
1677 }
1678 #if 0
1679 static char *
1680 get_item_string(proto_item *item)
1681 {
1682         return get_finfo_value_string(PITEM_FINFO(item));
1683 }
1684 #endif
1685
1686 static const char *
1687 get_item_name(proto_item *item)
1688 {
1689         return PITEM_FINFO(item)->hfinfo->name;
1690 }
1691
1692
1693 typedef proto_item* (*padd_func_t)(ptvcursor_t*, const ptvc_record*);
1694
1695 /*
1696  * XXX - are these just DOS-format dates and times?
1697  *
1698  * Should we put code to understand various date and time formats (UNIX,
1699  * DOS, SMB weird mutant UNIX, NT, Mac, etc. into libethereal, and have
1700  * the "display" member of an HF_ABSOLUTE_TIME field specify whether
1701  * it's DOS date/DOS time, DOS time/DOS date, NT time, UNIX time_t,
1702  * UNIX "struct timeval", NFSv3/NFSv4 seconds/nanoseconds, Mac, etc.?
1703  *
1704  * What about hijacking the "bitmask" field to specify the precision of
1705  * the time stamp, or putting a combination of precision and format
1706  * into the "display" member?
1707  *
1708  * What about relative times?  Should they have units (seconds, milliseconds,
1709  * microseconds, nanoseconds, etc.), precision, and format in there?
1710  */
1711 typedef struct {
1712         guint   year;
1713         guint   month;
1714         guint   day;
1715 } nw_date_t;
1716
1717 typedef struct {
1718         guint   hour;
1719         guint   minute;
1720         guint   second;
1721 } nw_time_t;
1722
1723 typedef struct {
1724         char   buffer[1024];
1725 } nw_uni_t;
1726
1727 #define VTYPE_NONE              0       /* no value */
1728 #define VTYPE_UINT8             1
1729 #define VTYPE_UINT16            2
1730 #define VTYPE_UINT32            3
1731 #define VTYPE_STRING            4
1732 #define VTYPE_BITFIELD          5
1733 #define VTYPE_MULTIVALUE_UINT32 6
1734 #define VTYPE_BYTES             7
1735 #define VTYPE_BOOLEAN           8
1736
1737 #define MVTYPE_ATTR_REQUEST             1
1738 #define MVTYPE_ATTR_REPLY               2
1739 #define MVTYPE_ATTR_REQUEST2            3       
1740 #define MVTYPE_READ_CLASS_REQ           4
1741 #define MVTYPE_READ_REPLICAS            5
1742 #define MVTYPE_MODIFY_ATTR_REQUEST      6
1743 #define MVTYPE_ADDR_REFERRAL_REQUEST    7
1744 #define MVTYPE_ADDR_REFERRAL_REPLY      8
1745 #define MVTYPE_LOC_ADDR_REFERRAL_REPLY  9
1746 #define MVTYPE_PROC_ENTRY_SPECIFIERS    10
1747 #define MVTYPE_PRINT_TIMESTAMP          11
1748 #define MVTYPE_LIST_PARTITIONS          12
1749 #define MVTYPE_CLASS_NAMES              13
1750 #define MVTYPE_MODIFY_CLASS             14
1751 #define MVTYPE_ADD_ATTR_REQUEST         15
1752
1753 typedef struct {
1754         guint8          vtype;
1755         guint32         vvalue;
1756         char*           vstring;
1757         const char*     vdesc;
1758         guint32         vlength;
1759         guint32         voffset;
1760         guint32         hfname;
1761         const char*     bit1;
1762         guint32         bit1hfname;
1763         const char*     bit2;
1764         guint32         bit2hfname;
1765         const char*     bit3;
1766         guint32         bit3hfname;
1767         const char*     bit4;
1768         guint32         bit4hfname;
1769         const char*     bit5;
1770         guint32         bit5hfname;
1771         const char*     bit6;
1772         guint32         bit6hfname;
1773         const char*     bit7;
1774         guint32         bit7hfname;
1775         const char*     bit8;
1776         guint32         bit8hfname;
1777         const char*     bit9;
1778         guint32         bit9hfname;
1779         const char*     bit10;
1780         guint32         bit10hfname;
1781         const char*     bit11;
1782         guint32         bit11hfname;
1783         const char*     bit12;
1784         guint32         bit12hfname;
1785         const char*     bit13;
1786         guint32         bit13hfname;
1787         const char*     bit14;
1788         guint32         bit14hfname;
1789         const char*     bit15;
1790         guint32         bit15hfname;
1791         const char*     bit16;
1792         guint32         bit16hfname;
1793         guint8          mvtype;
1794         guint32         vflags;
1795         guint32         nds_version;
1796 } nds_val;        
1797         
1798
1799 /* Given an integer, fill in a nw_date_t struct. */
1800 static void
1801 uint_to_nwdate(guint data, nw_date_t *nwdate)
1802 {
1803         nwdate->day   =  data & 0x001f;
1804         nwdate->month = (data & 0x01e0) >> 5;
1805         nwdate->year  = ((data & 0xfe00) >> 9) + 1980;
1806 }
1807
1808 /* Given an integer, fill in a nw_time_t struct. */
1809 static void
1810 uint_to_nwtime(guint data, nw_time_t *nwtime)
1811 {
1812         /* 2-second resolution */
1813         nwtime->second = (data & 0x001f) * 2;
1814         nwtime->minute = ((data & 0x07e0) >> 5);
1815         nwtime->hour   = ((data & 0xf800) >> 11);
1816 }
1817
1818 static proto_item*
1819 padd_normal(ptvcursor_t *ptvc, const ptvc_record *rec)
1820 {
1821         return 
1822         ptvcursor_add(ptvc, *rec->hf_ptr,
1823                 rec->length, rec->endianness);
1824 }
1825
1826 static proto_item*
1827 padd_date(ptvcursor_t *ptvc, const ptvc_record *rec)
1828 {
1829         proto_item      *item;
1830         nw_date_t       nw_date;
1831         gint            offset;
1832
1833         offset = ptvcursor_current_offset(ptvc);
1834
1835         item = ptvcursor_add(ptvc, *rec->hf_ptr,
1836                 rec->length, rec->endianness);
1837
1838         uint_to_nwdate(get_item_value(item), &nw_date);
1839         
1840         proto_item_set_text(item, "%s", get_item_name(item)); 
1841         proto_item_append_text(item, ": %04u/%02u/%02u",
1842                         nw_date.year, nw_date.month, nw_date.day);
1843         return item;
1844 }
1845
1846 static proto_item*
1847 padd_time(ptvcursor_t *ptvc, const ptvc_record *rec)
1848 {
1849         proto_item      *item;
1850         nw_time_t       nw_time;
1851         gint            offset;
1852
1853         offset = ptvcursor_current_offset(ptvc);
1854
1855         item = ptvcursor_add(ptvc, *rec->hf_ptr,
1856                 rec->length, rec->endianness);
1857
1858         uint_to_nwtime(get_item_value(item), &nw_time);
1859         
1860         proto_item_set_text(item, "%s", get_item_name(item)); 
1861         proto_item_append_text(item, ": %02u:%02u:%02u",
1862                         nw_time.hour, nw_time.minute, nw_time.second);
1863         return item;
1864 }
1865
1866
1867 /* Convert a string from little-endian unicode to ascii.  At the moment we
1868    fake it by taking every odd byte.  )-:  The caller must free the
1869    result returned. */
1870 static proto_item*
1871 padd_uni(ptvcursor_t *ptvc, const ptvc_record *rec)
1872 {
1873         proto_item      *item;
1874         nw_uni_t        nw_uni;
1875         guint            offset;
1876         
1877         strcpy(nw_uni.buffer, "");
1878         offset = ptvcursor_current_offset(ptvc);
1879
1880         item = ptvcursor_add(ptvc, *rec->hf_ptr,
1881                 rec->length, rec->endianness);
1882
1883         proto_item_set_text(item, "%s", get_item_name(item)); 
1884         proto_item_append_text(item, " %s",
1885                         nw_uni.buffer);
1886                                 
1887         return item;
1888
1889
1890 /* Add a value for a ptvc_record, and process the sub-ptvc_record
1891  * that it points to. */
1892 static void
1893 process_bitfield_sub_ptvc_record(ptvcursor_t *ptvc, const ptvc_record *rec,
1894                 gboolean really_decode)
1895 {
1896         proto_item              *item;
1897         proto_tree              *sub_tree;
1898         const ptvc_record       *sub_rec;
1899         int                     current_offset;
1900         gint                    ett;
1901         ptvcursor_t             *sub_ptvc;
1902
1903         if (really_decode) {
1904                 /* Save the current offset */
1905                 current_offset = ptvcursor_current_offset(ptvc);
1906
1907                 /* Add the item */
1908                 item = ptvcursor_add(ptvc, *rec->hf_ptr, rec->length,
1909                                 rec->endianness);
1910
1911                 ett = *rec->sub_ptvc_rec->ett;
1912
1913                 /* Make a new protocol sub-tree */
1914                 sub_tree = proto_item_add_subtree(item, ett);
1915
1916                 /* Make a new ptvcursor */
1917                 sub_ptvc = ptvcursor_new(sub_tree, ptvcursor_tvbuff(ptvc),
1918                                 current_offset);
1919
1920                 /* Use it */
1921                 sub_rec = rec->sub_ptvc_rec->ptvc_rec;
1922                 while(sub_rec->hf_ptr != NULL) {
1923                         DISSECTOR_ASSERT(!sub_rec->sub_ptvc_rec);
1924                         ptvcursor_add_no_advance(sub_ptvc, *sub_rec->hf_ptr,
1925                                         sub_rec->length, sub_rec->endianness);
1926                         sub_rec++;
1927                 }
1928
1929                 /* Free it. */
1930                 ptvcursor_free(sub_ptvc);
1931         }
1932         else {
1933                 DISSECTOR_ASSERT(rec->length > 0 &&
1934                    proto_registrar_get_nth(*rec->hf_ptr)->type != FT_UINT_STRING);
1935                 ptvcursor_advance(ptvc, rec->length);
1936         }
1937 }
1938
1939 /* Process a sub-ptvc_record that points to a "struct" ptvc_record. */
1940 static void
1941 process_struct_sub_ptvc_record(ptvcursor_t *ptvc, const ptvc_record *rec,
1942                 int *req_cond_results, gboolean really_decode,
1943                 const ncp_record *ncp_rec)
1944 {
1945         const ptvc_record       *sub_rec;
1946         gint                    ett;
1947         proto_tree              *old_tree=NULL, *new_tree;
1948         proto_item              *item=NULL;
1949         gint                    offset=0;
1950
1951         /* Create a sub-proto_tree? */
1952         if (rec->sub_ptvc_rec->descr) {
1953                 ett = *rec->sub_ptvc_rec->ett;
1954                 old_tree = ptvcursor_tree(ptvc);
1955                 offset = ptvcursor_current_offset(ptvc);
1956                 item = proto_tree_add_text(old_tree, ptvcursor_tvbuff(ptvc),
1957                                 offset, PROTO_LENGTH_UNTIL_END,
1958                                 rec->sub_ptvc_rec->descr);
1959                 new_tree = proto_item_add_subtree(item, ett);
1960                 ptvcursor_set_tree(ptvc, new_tree);
1961         }
1962
1963         /* Get the ptvc_record for the struct and call our caller
1964          * to process it. */
1965         sub_rec = rec->sub_ptvc_rec->ptvc_rec;
1966         process_ptvc_record(ptvc, sub_rec, req_cond_results, really_decode, ncp_rec);
1967
1968         /* Re-set the tree */
1969         if (rec->sub_ptvc_rec->descr) {
1970                 if (ptvcursor_current_offset(ptvc) <= offset)
1971                         THROW(ReportedBoundsError);
1972
1973                 proto_item_set_len(item, ptvcursor_current_offset(ptvc) - offset);
1974                 ptvcursor_set_tree(ptvc, old_tree);
1975         }
1976 }
1977
1978 /* Run through the table of ptvc_record's and add info to the tree. This
1979  * is the work-horse of process_ptvc_record(). */
1980 static void
1981 _process_ptvc_record(ptvcursor_t *ptvc, const ptvc_record *rec,
1982                 int *req_cond_results, gboolean really_decode,
1983                 const ncp_record *ncp_rec)
1984 {
1985         proto_item      *item;
1986         guint           i, repeat_count;
1987         padd_func_t     func = NULL;
1988
1989         if (rec->sub_ptvc_rec) {
1990                 /* Repeat this? */
1991                 if (rec->repeat_index == NO_REPEAT) {
1992                         if (rec->hf_ptr == PTVC_STRUCT) {
1993                                 process_struct_sub_ptvc_record(ptvc, rec,
1994                                                 req_cond_results, really_decode,
1995                                                 ncp_rec);
1996                         }
1997                         else {
1998                                 process_bitfield_sub_ptvc_record(ptvc, rec,
1999                                                 really_decode);
2000                         }
2001                 }
2002                 else {
2003                         repeat_count = repeat_vars[rec->repeat_index];
2004                         for (i = 0; i < repeat_count; i++ ) {
2005                                 if (rec->hf_ptr == PTVC_STRUCT) {
2006                                         process_struct_sub_ptvc_record(ptvc, rec,
2007                                                 req_cond_results, really_decode,
2008                                                 ncp_rec);
2009                                 }
2010                                 else {
2011                                         process_bitfield_sub_ptvc_record(ptvc, rec,
2012                                                         really_decode);
2013                                 }
2014                         }
2015                 }
2016         }
2017         else {
2018                 /* If we can't repeat this field, we might use it
2019                  * to set a 'var'. */
2020                 if (rec->repeat_index == NO_REPEAT) {
2021                         if (really_decode) {
2022                                 /* Handle any special formatting. */
2023                                 switch(rec->special_fmt) {
2024                                         case NCP_FMT_NONE:
2025                                                 func = padd_normal;
2026                                                 break;
2027                                         case NCP_FMT_NW_DATE:
2028                                                 func = padd_date;
2029                                                 break;
2030                                         case NCP_FMT_NW_TIME:
2031                                                 func = padd_time;
2032                                                 break;
2033                                         case NCP_FMT_UNICODE:
2034                                                 func = padd_uni;
2035                                                 break;        
2036                                         default:
2037                                                 DISSECTOR_ASSERT_NOT_REACHED();
2038                                 }
2039                                 item = func(ptvc, rec);
2040
2041                                 /* Set the value as a 'var' ? */
2042                                 if (rec->var_index != NO_VAR) {
2043                                         repeat_vars[rec->var_index] = get_item_value(item);
2044                                 }
2045                         }
2046                         else {
2047                                 /* If we don't decode the field, we
2048                                  * better not use the value to set a var.
2049                                  * Actually, we could, as long as we don't
2050                                  * *use* that var; for now keep this assert in
2051                                  * place. */
2052                                 DISSECTOR_ASSERT(rec->var_index == NO_VAR);
2053
2054                                 /* This had better not be variable-length,
2055                                  * either. */
2056                                 DISSECTOR_ASSERT(rec->length > 0 &&
2057                                    proto_registrar_get_nth(*rec->hf_ptr)->type != FT_UINT_STRING);
2058                                 ptvcursor_advance(ptvc, rec->length);
2059                         }
2060                 }
2061                 else {
2062                         /* We do repeat this field. */
2063                         repeat_count = repeat_vars[rec->repeat_index];
2064                         if (really_decode) {
2065                                 /* Handle any special formatting. */
2066                                 switch(rec->special_fmt) {
2067                                         case NCP_FMT_NONE:
2068                                                 func = padd_normal;
2069                                                 break;
2070                                         case NCP_FMT_NW_DATE:
2071                                                 func = padd_date;
2072                                                 break;
2073                                         case NCP_FMT_NW_TIME:
2074                                                 func = padd_time;
2075                                                 break;
2076                                         case NCP_FMT_UNICODE:
2077                                                 func = padd_uni;
2078                                                 break;        
2079                                         default:
2080                                                 DISSECTOR_ASSERT_NOT_REACHED();
2081                                 }
2082                                 for (i = 0; i < repeat_count; i++ ) {
2083                                         func(ptvc, rec);
2084                                 }
2085                         }
2086                         else {
2087                                 for (i = 0; i < repeat_count; i++ ) {
2088                                         DISSECTOR_ASSERT(rec->length > 0 &&
2089                                            proto_registrar_get_nth(*rec->hf_ptr)->type != FT_UINT_STRING);
2090                                         ptvcursor_advance(ptvc, rec->length);
2091                                 }
2092                         }
2093                 }
2094         }
2095 }
2096
2097 /* Run through the table of ptvc_record's and add info to the tree.
2098  * Honor a request condition result. */
2099 static void
2100 process_ptvc_record(ptvcursor_t *ptvc, const ptvc_record *rec,
2101                 int *req_cond_results, gboolean really_decode,
2102                 const ncp_record *ncp_rec)
2103 {
2104         gboolean decode;
2105
2106         while(rec->hf_ptr != NULL) {
2107                 decode = really_decode;
2108                 /* If we're supposed to decode, check the request condition
2109                  * results to see if we should override this and *not* decode. */
2110                 if (decode && req_cond_results) {
2111                         if (rec->req_cond_index != NO_REQ_COND) {
2112                                 if (req_cond_results[rec->req_cond_index] == FALSE) {
2113                                         decode = FALSE;
2114                                 }
2115                         }
2116                 }
2117                 if (decode || ncp_rec->req_cond_size_type == REQ_COND_SIZE_CONSTANT) {
2118                         _process_ptvc_record(ptvc, rec, req_cond_results, decode, ncp_rec);
2119                 }
2120                 rec++;
2121         }
2122 }
2123
2124
2125
2126 /* Clear the repeat_vars array. */
2127 static void
2128 clear_repeat_vars(void)
2129 {
2130         guint i;
2131
2132         for (i = 0 ; i < NUM_REPEAT_VARS; i++ ) {
2133                 repeat_vars[i] = 0;
2134         }
2135 }
2136
2137
2138 /* Given an error_equivalency table and a completion code, return
2139  * the string representing the error. */
2140 static const char*
2141 ncp_error_string(const error_equivalency *errors, guint8 completion_code)
2142 {
2143
2144         while (errors->ncp_error_index != -1) {
2145                 if (errors->error_in_packet == completion_code) {
2146                         return ncp_errors[errors->ncp_error_index];
2147                 }
2148                 errors++;
2149         }
2150
2151         return "Unknown Error Code";
2152 }
2153
2154 static const ncp_record ncp1111_request =
2155         { 0xf1, 0x00, NO_SUBFUNC, "Create Connection Service", NCP_GROUP_CONNECTION,
2156                 NULL, NULL, ncp_0x2_errors, NULL, NO_REQ_COND_SIZE, NULL };
2157
2158 static const ncp_record ncp5555_request =
2159         { 0xf5, 0x00, NO_SUBFUNC, "Destroy Connection Service", NCP_GROUP_CONNECTION,
2160                 NULL, NULL, ncp_0x2_errors, NULL, NO_REQ_COND_SIZE, NULL };
2161
2162 static const ncp_record ncpbbbb_request =
2163         { 0xfb, 0x00, NO_SUBFUNC, "Server Broadcast Message", NCP_GROUP_CONNECTION,
2164                 NULL, NULL, ncp_0x2_errors, NULL, NO_REQ_COND_SIZE, NULL };                
2165
2166 static const ncp_record ncplip_echo =
2167         { 0xfa, 0x00, NO_SUBFUNC, "LIP Echo Packet", NCP_GROUP_CONNECTION,
2168                 NULL, NULL, ncp_0x2_errors, NULL, NO_REQ_COND_SIZE, NULL };
2169
2170 /* Wrapper around proto_tree_free() */
2171 static void free_proto_tree(void *tree)
2172 {
2173         if (tree) {
2174                 proto_tree_free((proto_tree*) tree);
2175         }
2176 }
2177
2178 static guint32
2179 align_4(tvbuff_t *tvb, guint32 aoffset)
2180 {
2181        if(tvb_length_remaining(tvb, aoffset) > 4 )
2182        {
2183                 return (aoffset%4);
2184        }
2185        return 0;
2186 }
2187        
2188 static void
2189 get_string(tvbuff_t* tvb, guint offset, guint str_length, char *dest_buf)
2190 {
2191         guint32 i;
2192         guint16 c_char;
2193         guint32 length_remaining = 0;
2194
2195         length_remaining = tvb_length_remaining(tvb, offset);
2196         if(str_length > length_remaining || str_length > 1024)  
2197         {
2198                 THROW(ReportedBoundsError);
2199         }
2200         dest_buf[0] = '\0';        
2201         if(str_length == 0)
2202         {
2203                 return;
2204         }
2205         for ( i = 0; i < str_length; i++ )
2206         {
2207                 c_char = tvb_get_guint8(tvb, offset );
2208                 if (c_char<0x20 || c_char>0x7e)
2209                 {
2210                         if (c_char != 0x00)
2211                         { 
2212                                 c_char = '.';
2213                                 dest_buf[i] = c_char & 0xff;
2214                         }
2215                         else
2216                         {
2217                                 i--;
2218                                 str_length--;
2219                         }
2220                 }
2221                 else
2222                 {
2223                         dest_buf[i] = c_char & 0xff;
2224                 }
2225                 offset++;
2226                 length_remaining--;
2227                 
2228                 if(length_remaining==1)
2229                 {
2230                         dest_buf[i+1] = '\0';
2231                         return;
2232                 }        
2233         }
2234         dest_buf[i] = '\0';
2235         return;
2236 }
2237
2238 static void
2239 uni_to_string(char * data, guint32 str_length, char *dest_buf)
2240 {
2241         guint32 i;
2242         guint16 c_char;
2243         guint32 length_remaining = 0;
2244
2245         length_remaining = str_length;
2246         dest_buf[0] = '\0';        
2247         if(str_length == 0)
2248         {
2249                 return;
2250         }
2251         for ( i = 0; i < str_length; i++ )
2252         {
2253                 c_char = data[i];
2254                 if (c_char<0x20 || c_char>0x7e)
2255                 {
2256                         if (c_char != 0x00)
2257                         { 
2258                                 c_char = '.';
2259                                 dest_buf[i] = c_char & 0xff;
2260                         }
2261                         else
2262                         {
2263                                 i--;
2264                                 str_length--;
2265                         }
2266                 }
2267                 else
2268                 {
2269                         dest_buf[i] = c_char & 0xff;
2270                 }
2271                 length_remaining--;
2272                 
2273                 if(length_remaining==0)
2274                 {
2275                         dest_buf[i+1] = '\0';
2276                         return;
2277                 }        
2278         }
2279         dest_buf[i] = '\0';
2280         return;
2281 }
2282
2283 /*************************************
2284 * Return based on % format in request
2285 * %d = integer in decimal format = 0
2286 * %x = integer in hex format = 1
2287 * %s = string = 2
2288 **************************************/  
2289 static int
2290 get_info_type(const gchar* check_string)
2291 {
2292         guint length;
2293         guint i;
2294         char char_val;
2295         
2296         length =  strlen(check_string);
2297         
2298         for (i = 0 ; i < length-1 ; i++ ) {
2299                 char_val = check_string[i+1];
2300                 if (check_string[i] == 0x25 && check_string[i+1] == 0x64) {   /* %d Digits*/
2301                         return 0;
2302                 } 
2303                 if ( check_string[i] == 0x78 && check_string[i+1] == 0x25 && check_string[i+2] == 0x73) {  /* x%s Bytes*/
2304                         return 1;
2305                 }
2306         }
2307         return 2; /* Normal String */
2308 }                
2309
2310 static void
2311 process_bitfield(proto_tree *ncp_tree, tvbuff_t *tvb, nds_val *values)
2312 {
2313         gchar                   flags_str[512];
2314         const gchar             *sep;
2315         proto_item              *tinew;
2316         proto_tree              *flags_tree;
2317         guint32                 i;
2318         guint32                 bvalue = 0;
2319
2320         bvalue = 0x00000001;
2321         flags_str[0]='\0';
2322         sep="";
2323         for (i = 0 ; i < (values->vlength*8); i++ ) {
2324                 if (values->vvalue & bvalue) 
2325                 {
2326                         strcat(flags_str, sep);
2327                         switch(bvalue){
2328                                 case 0x00000001:
2329                                         strcat(flags_str, values->bit1);
2330                                         break;
2331                                 case 0x00000002:        
2332                                         strcat(flags_str, values->bit2);
2333                                         break;
2334                                 case 0x00000004:        
2335                                         strcat(flags_str, values->bit3);
2336                                         break;
2337                                 case 0x00000008:        
2338                                         strcat(flags_str, values->bit4);
2339                                         break;
2340                                 case 0x00000010:        
2341                                         strcat(flags_str, values->bit5);
2342                                         break;
2343                                 case 0x00000020:        
2344                                         strcat(flags_str, values->bit6);
2345                                         break;
2346                                 case 0x00000040:        
2347                                         strcat(flags_str, values->bit7);
2348                                         break;
2349                                 case 0x00000080:        
2350                                         strcat(flags_str, values->bit8);
2351                                         break;
2352                                 case 0x00000100:        
2353                                         strcat(flags_str, values->bit9);
2354                                         break;
2355                                 case 0x00000200:        
2356                                         strcat(flags_str, values->bit10);
2357                                         break;
2358                                 case 0x00000400:        
2359                                         strcat(flags_str, values->bit11);
2360                                         break;
2361                                 case 0x00000800:        
2362                                         strcat(flags_str, values->bit12);
2363                                         break;
2364                                 case 0x00001000:        
2365                                         strcat(flags_str, values->bit13);
2366                                         break;
2367                                 case 0x00002000:        
2368                                         strcat(flags_str, values->bit14);
2369                                         break;
2370                                 case 0x00004000:        
2371                                         strcat(flags_str, values->bit15);
2372                                         break;
2373                                 case 0x00008000:        
2374                                         strcat(flags_str, values->bit16);
2375                                         break;
2376                                 default:
2377                                         break;
2378                         }                
2379                         sep = ", ";
2380                 }
2381                 bvalue = bvalue*2;
2382         }
2383         if(values->vlength==4)
2384         {
2385                 tinew = proto_tree_add_uint_format(ncp_tree, values->hfname,
2386                         tvb, values->voffset, values->vlength, values->vvalue, "%s 0x%08x",
2387                         values->vdesc, values->vvalue);
2388         }
2389         else
2390         {                
2391                 tinew = proto_tree_add_uint_format(ncp_tree, values->hfname,
2392                         tvb, values->voffset, values->vlength, values->vvalue, "%s 0x%04x",
2393                         values->vdesc, values->vvalue);
2394         }
2395         if (flags_str[0] != '\0')
2396                 proto_item_append_text(tinew, " - (%s)", flags_str);
2397                                                         
2398         flags_tree = proto_item_add_subtree(tinew, ett_nds);
2399                                                 
2400         bvalue = 0x00000001;
2401                 
2402         for (i = 0 ; i < (values->vlength*8); i++ ) {
2403                 if (values->vvalue & bvalue) 
2404                 {
2405                         switch(bvalue)
2406                         {
2407                                 case 0x00000001:
2408                                         proto_tree_add_item(flags_tree, values->bit1hfname, tvb, values->voffset, values->vlength, TRUE);
2409                                         break;
2410                                 case 0x00000002:
2411                                         proto_tree_add_item(flags_tree, values->bit2hfname, tvb, values->voffset, values->vlength, TRUE);
2412                                         break;
2413                                 case 0x00000004:
2414                                         proto_tree_add_item(flags_tree, values->bit3hfname, tvb, values->voffset, values->vlength, TRUE);
2415                                         break;
2416                                 case 0x00000008:
2417                                         proto_tree_add_item(flags_tree, values->bit4hfname, tvb, values->voffset, values->vlength, TRUE);
2418                                         break;
2419                                 case 0x00000010:
2420                                         proto_tree_add_item(flags_tree, values->bit5hfname, tvb, values->voffset, values->vlength, TRUE);
2421                                         break;
2422                                 case 0x00000020:
2423                                         proto_tree_add_item(flags_tree, values->bit6hfname, tvb, values->voffset, values->vlength, TRUE);
2424                                         break;
2425                                 case 0x00000040:
2426                                         proto_tree_add_item(flags_tree, values->bit7hfname, tvb, values->voffset, values->vlength, TRUE);
2427                                         break;
2428                                 case 0x00000080:
2429                                         proto_tree_add_item(flags_tree, values->bit8hfname, tvb, values->voffset, values->vlength, TRUE);
2430                                         break;
2431                                 case 0x00000100:
2432                                         proto_tree_add_item(flags_tree, values->bit9hfname, tvb, values->voffset, values->vlength, TRUE);
2433                                         break;
2434                                 case 0x00000200:
2435                                         proto_tree_add_item(flags_tree, values->bit10hfname, tvb, values->voffset, values->vlength, TRUE);
2436                                         break;
2437                                 case 0x00000400:
2438                                         proto_tree_add_item(flags_tree, values->bit11hfname, tvb, values->voffset, values->vlength, TRUE);
2439                                         break;
2440                                 case 0x00000800:
2441                                         proto_tree_add_item(flags_tree, values->bit12hfname, tvb, values->voffset, values->vlength, TRUE);
2442                                         break;
2443                                 case 0x00001000:
2444                                         proto_tree_add_item(flags_tree, values->bit13hfname, tvb, values->voffset, values->vlength, TRUE);
2445                                         break;
2446                                 case 0x00002000:
2447                                         proto_tree_add_item(flags_tree, values->bit14hfname, tvb, values->voffset, values->vlength, TRUE);
2448                                         break;
2449                                 case 0x00004000:
2450                                         proto_tree_add_item(flags_tree, values->bit15hfname, tvb, values->voffset, values->vlength, TRUE);
2451                                         break;
2452                                 case 0x00008000:
2453                                         proto_tree_add_item(flags_tree, values->bit16hfname, tvb, values->voffset, values->vlength, TRUE);
2454                                         break;
2455                                 default:
2456                                         break;
2457                         }
2458                 }
2459                 bvalue = bvalue*2;
2460         }
2461 }
2462
2463 /* NCP data from python code can't be accessed directly. Parse the ncp tree and find the items
2464  * and their associated values. Store results in passed buffer.
2465  */
2466 static void
2467 build_expert_data(proto_tree *ncp_tree, char *hf_name, char *buffer, int repeat_lookup)
2468 {
2469         proto_tree              *tree_pointer;
2470         proto_tree              *tree_loc;
2471     char            temp_buffer[256]="\0";
2472        
2473     tree_loc = ncp_tree->first_child;
2474         for (tree_pointer=tree_loc; tree_pointer!=NULL; tree_pointer=tree_pointer->next)
2475         {
2476                 if (strcmp(tree_pointer->finfo->hfinfo->abbrev, hf_name)==0)
2477                 {
2478                         switch (tree_pointer->finfo->hfinfo->type)
2479                         {
2480             case 3:                             /* uint8 */
2481             case 4:                             /* uint16 */
2482                 g_snprintf(buffer, get_finfo_length(tree_pointer->finfo)*4, "%d", get_finfo_value_integer(tree_pointer->finfo));
2483                                 break;
2484
2485             case 6:             /* uint32 */
2486                 g_snprintf(buffer, get_finfo_length(tree_pointer->finfo)*4, "%08x", get_finfo_value_integer(tree_pointer->finfo));
2487                                 break;
2488             case 17:
2489                         case 19:                        /* string */
2490                         uni_to_string(get_finfo_value_string(tree_pointer->finfo), get_finfo_length(tree_pointer->finfo), buffer);
2491                 if (repeat_lookup > 0) {
2492                     if (strlen(temp_buffer) + strlen(buffer) < 250) {
2493                         strcat(temp_buffer, buffer);
2494                         repeat_lookup--;
2495                         if (repeat_lookup == 0) {
2496                             strcpy(buffer, temp_buffer);
2497                             break;
2498                         }
2499                         else
2500                         {
2501                             strcat(temp_buffer, "/");
2502                             break;
2503                         }
2504                     }
2505                     else
2506                     {
2507                         return;
2508                     }
2509                 }
2510                 else
2511                 {
2512                     break;
2513                 }
2514             case 21:             /* Bytes */
2515                 g_snprintf(buffer, (get_finfo_length(tree_pointer->finfo))*4, "%s", bytes_to_str(get_finfo_value_string(tree_pointer->finfo), get_finfo_length(tree_pointer->finfo)));
2516                 break;
2517                         default:                        /* Dont currently handle. Only need string, integers, and bytes */
2518                                 buffer = "Unsupported Expert Type\0";
2519                                 return;
2520                         }                               
2521             if (repeat_lookup ==0) {
2522                 break;
2523             }
2524                 }
2525         }
2526     if (strlen(buffer)==0) {
2527         buffer = "No Value\0";
2528     }
2529     return;
2530 }
2531
2532 /* Some NCP data may be desirable to echo to the expert table.
2533  * But to extract we must have visability to the tree
2534  * This means that to extract the data we can only perform
2535  * this code path on the first dissection or a redissect.
2536  *
2537  * Should the dissector store this info in memory so that 
2538  * the data can be reported wihout a complete redissection?
2539  */
2540 static void
2541 trap_for_expert_event(proto_tree *ncp_tree, packet_info *pinfo, const ncp_record *ncp_rec, int request_reply)
2542 {   
2543     if (ncp_rec == NULL)
2544         return;
2545
2546     /* Request == 0, Reply == 1 */
2547     if (request_reply==0) {
2548         if (ncp_echo_file) {
2549             /* The following allows for Update file handle rights echoed to expert tap. */
2550             if (ncp_rec->func == 66) { 
2551                 char p_filehandle[15]="\0";
2552
2553                 build_expert_data(ncp_tree, "ncp.file_handle", p_filehandle, 0);
2554
2555                 expert_add_info_format(pinfo, NULL, PI_REQUEST_CODE, PI_CHAT, "Close file handle %s", p_filehandle);
2556             }
2557             /* The following allows for oplock level 1 file opens echoed to expert tap. */
2558             if ((ncp_rec->func == 89 || ncp_rec->func == 87) && (ncp_rec->subfunc == 1 || ncp_rec->subfunc == 30 || ncp_rec->subfunc == 32 || ncp_rec->subfunc == 33)) { 
2559                 char oaction[2]="\0";
2560                 char p_filename[256]="\0";
2561                 char p_rights[2]="\0";
2562                 char p_path_count[2]="\0";
2563
2564                 build_expert_data(ncp_tree, "ncp.open_create_mode", oaction, 0);
2565                 build_expert_data(ncp_tree, "ncp.desired_access_rights", p_rights, 0);
2566                 build_expert_data(ncp_tree, "ncp.path_count", p_path_count, 0);
2567
2568                 if (ncp_rec->func == 87) {
2569                     build_expert_data(ncp_tree, "ncp.path", p_filename, atoi(p_path_count));
2570                 }
2571                 else
2572                 {
2573                     build_expert_data(ncp_tree, "ncp.path16", p_filename, atoi(p_path_count));
2574                 }
2575
2576                 expert_add_info_format(pinfo, NULL, PI_REQUEST_CODE, PI_CHAT, "%s: %s, Rights:(%s)", match_strval((atoi(oaction) & 0xeb), open_create_mode_vals), p_filename, match_strval((atoi(p_rights) & 0x5f), ncp_rights_vals));
2577             }
2578             /* The following allows for oplock ack's and level 2 request echoed to expert tap. */
2579             if (ncp_rec->func == 87 && ncp_rec->subfunc == 34) {
2580                 char cc_function[2]="\0";
2581                 char p_filehandle[15]="\0";
2582
2583                 build_expert_data(ncp_tree, "ncp.cc_file_handle", p_filehandle, 0);
2584                 build_expert_data(ncp_tree, "ncp.cc_function", cc_function, 0);
2585
2586                 expert_add_info_format(pinfo, NULL, PI_REQUEST_CODE, PI_CHAT, "Op-lock on handle %s - %s", p_filehandle, match_strval(atoi(cc_function), ncp_cc_function_vals));
2587             }
2588             /* The following allows for Update file handle rights echoed to expert tap. */
2589             if (ncp_rec->func == 87 && ncp_rec->subfunc == 44) { 
2590                 char p_rights[20]="\0";
2591                 char n_rights[20]="\0";
2592                 char p_filehandle[15]="\0";
2593
2594                 build_expert_data(ncp_tree, "ncp.file_handle", p_filehandle, 0);
2595                 build_expert_data(ncp_tree, "ncp.access_rights_mask_word", p_rights, 0);
2596                 build_expert_data(ncp_tree, "ncp.new_access_rights_mask", n_rights, 0);
2597                 expert_add_info_format(pinfo, NULL, PI_REQUEST_CODE, PI_CHAT, "Change handle %s rights from:(%s) to:(%s)", p_filehandle, match_strval((atoi(p_rights) & 0x1ff), access_rights_vals), match_strval((atoi(n_rights) & 0x1ff), access_rights_vals));
2598             }
2599         }
2600     }
2601     else
2602     {
2603
2604         if (ncp_echo_file) { /* Echo File System Data */
2605             /* The following allows for oplock level 1 file opens echoed to expert tap. */
2606             if ((ncp_rec->func == 89 || ncp_rec->func == 87) && (ncp_rec->subfunc == 32 || ncp_rec->subfunc == 1)) { 
2607                 char oaction[2]="\0";
2608                 char oplockflg[2]="\0";
2609                 char p_filehandle[15]="\0";
2610
2611                 build_expert_data(ncp_tree, "ncp.open_create_action", oaction, 0);
2612                 build_expert_data(ncp_tree, "ncp.file_handle", p_filehandle, 0);
2613
2614                 if (ncp_rec->subfunc == 1) {
2615                     expert_add_info_format(pinfo, NULL, PI_RESPONSE_CODE, PI_CHAT, "%s - File handle %s", match_strval((atoi(oaction) & 0x8f), open_create_action_vals), p_filehandle);
2616                 }
2617                 else
2618                 {
2619                     build_expert_data(ncp_tree, "ncp.o_c_ret_flags", oplockflg, 0);
2620                     expert_add_info_format(pinfo, NULL, PI_RESPONSE_CODE, PI_CHAT, "%s - File handle %s, %s", match_strval((atoi(oaction) & 0x8f), open_create_action_vals), p_filehandle, match_strval(atoi(oplockflg), ncp_o_c_ret_flags_vals));
2621                 }
2622             }
2623             /* The following allows for Update file handle rights echoed to expert tap. */
2624             if (ncp_rec->func == 87 && ncp_rec->subfunc == 44) { 
2625                 char p_rights[20]="\0";
2626                 char p_filehandle[15]="\0";
2627
2628                 build_expert_data(ncp_tree, "ncp.file_handle", p_filehandle, 0);
2629                 build_expert_data(ncp_tree, "ncp.effective_rights", p_rights, 0);
2630                 expert_add_info_format(pinfo, NULL, PI_RESPONSE_CODE, PI_CHAT, "Handle %s effective rights:(%s)", p_filehandle, match_strval((atoi(p_rights) & 0x1ff), access_rights_vals));
2631             }
2632         }
2633         /* The following allows for specific NCP server info to be echoed to the expert tap. */
2634         if (ncp_rec->func == 23 && ncp_rec->subfunc == 17 && ncp_echo_server) {
2635             char fsname[50]="\0";
2636             char p_maj_ver[3]="\0";
2637             char p_min_ver[3]="\0";
2638             char p_rev[3]="\0";
2639             char p_lang[3]="\0";
2640
2641             /* Get Server name and version info */
2642             build_expert_data(ncp_tree, "ncp.server_name", fsname, 0);
2643             build_expert_data(ncp_tree, "ncp.product_major_version", p_maj_ver, 0);
2644             build_expert_data(ncp_tree, "ncp.product_minor_version", p_min_ver, 0);
2645             build_expert_data(ncp_tree, "ncp.product_revision_version", p_rev, 0);
2646             build_expert_data(ncp_tree, "ncp.os_language_id", p_lang, 0);
2647             expert_add_info_format(pinfo, NULL, PI_RESPONSE_CODE, PI_CHAT, "Server %s, version %s.%s, support pack %s, language %s", fsname, 
2648                                    p_maj_ver, p_min_ver, p_rev, p_lang);
2649         }
2650     }
2651 }
2652
2653
2654 static void
2655 print_nds_values(proto_tree *vtree, tvbuff_t *tvb, guint32 syntax_type, nds_val *vvalues)
2656 {
2657         guint32         value1 = 0;
2658         guint32         value2 = 0;
2659         guint32         value3 = 0;
2660         guint32         value4 = 0;
2661         guint32         value5 = 0;
2662         guint32         voffset = 0, oldvoffset;
2663         guint32         icounter;
2664         guint32         number_of_values = 0;
2665         guint32         number_of_items = 0;
2666         guint32         r;
2667         proto_item      *vitem;
2668         proto_tree      *nvtree;
2669         proto_item      *aditem;
2670         proto_tree      *adtree;
2671         const char      *valuestr = NULL;
2672         guint16         rtype = 0;
2673         guint16         rstate = 0;
2674         guint16         rnum = 0;
2675         guint16         revent = 0;
2676         gint            length_remaining;
2677
2678         voffset = vvalues->voffset;
2679         if(tvb_get_guint8(tvb, voffset) == 0x00)
2680         {
2681                 voffset = voffset+2;
2682         }                
2683         
2684         number_of_values = tvb_get_letohl(tvb, voffset);
2685         
2686         vitem = proto_tree_add_uint_format(vtree, hf_nds_uint32value, tvb, voffset,
2687                 4, number_of_values, "Number of Values: %u", number_of_values);
2688         
2689         nvtree = proto_item_add_subtree(vitem, ett_nds);
2690         
2691         oldvoffset = voffset;
2692         voffset = voffset + 4; 
2693         
2694         for (icounter = 1 ; icounter <= number_of_values; icounter++ )
2695         {                      
2696                 if (oldvoffset >= voffset) {
2697                         proto_tree_add_text(nvtree, tvb, 0, 0, "[ Invalid offset: %u ]", voffset);
2698                         THROW(ReportedBoundsError);
2699                 }
2700                 oldvoffset = voffset;
2701                 switch(syntax_type)
2702                 {       
2703                        case 0x00000006:        /* Case Insensitive List */
2704                        case 0x0000000d:        /* Binary String List */
2705                        case 0x00000012:        /* Postal Address */
2706                                voffset += align_4(tvb, voffset);
2707                                voffset = voffset+4;         
2708                                number_of_items = tvb_get_letohl(tvb, voffset);
2709                                voffset = voffset+4;
2710                                for (r=1; r<=number_of_items; r++)
2711                                {
2712                                        value1 = tvb_get_letohl(tvb, voffset);
2713                                        voffset = voffset + 4;
2714                                        get_string(tvb, voffset, value1, vvalues->vstring);
2715                                        proto_tree_add_string(nvtree, hf_value_string, tvb, voffset, 
2716                                            value1, vvalues->vstring);
2717                                        voffset = voffset + value1;    
2718                                        voffset += align_4(tvb, voffset);
2719                                }            
2720                                break;
2721                        case 0x00000007:        /* Boolean */
2722                                value1 = tvb_get_letohl(tvb, voffset); /* length of field */
2723                                if (value1==0)
2724                                {
2725                                        vvalues->vstring = "False";
2726                                }
2727                                else
2728                                {
2729                                        vvalues->vstring = "True";
2730                                }
2731                                tvb_ensure_bytes_exist(tvb, voffset, value1);
2732                                proto_tree_add_string(nvtree, hf_value_string, tvb, voffset, 
2733                                            value1, vvalues->vstring);
2734                                voffset=voffset+8;
2735                                break;
2736                        case 0x00000009:        /* Binary String */
2737                                value1 = tvb_get_letohl(tvb, voffset); /* length of field */
2738                                length_remaining = tvb_length_remaining(tvb, voffset);
2739                                if(length_remaining == -1 || value1 > (guint32) length_remaining)
2740                                {
2741                                         break;
2742                                }
2743                                voffset += 4;
2744                                tvb_ensure_bytes_exist(tvb, voffset, value1);
2745                                proto_tree_add_bytes(nvtree, hf_value_bytes, tvb, voffset, value1, tvb_get_ptr(tvb, voffset, value1));
2746                                voffset += value1;
2747                                voffset += (value1%2);
2748                                break;
2749                        case 0x00000015:        /* Stream */
2750                            value1 = tvb_get_letohl(tvb, voffset); /* length of field */
2751                            length_remaining = tvb_length_remaining(tvb, voffset);
2752                            if(length_remaining == -1 || value1 > (guint32) length_remaining)
2753                            {
2754                                     break;
2755                            }
2756                            proto_tree_add_text(nvtree, tvb, voffset, 4, "No value, Open stream file for data.");
2757                            voffset += 4;
2758                            voffset += value1;
2759                            voffset += (value1%2);
2760                            break;
2761                        case 0x00000008:        /* Signed Integer */
2762                        case 0x00000016:        /* Counter */
2763                        case 0x00000018:        /* Time */
2764                        case 0x0000001b:        /* Interval */
2765                                value1 = tvb_get_letohl(tvb, voffset); /* length of field */
2766                                voffset = voffset+4;
2767                                value2 = tvb_get_letohl(tvb, voffset); /* Value */
2768                                tvb_ensure_bytes_exist(tvb, voffset, value1);
2769                                if (strcmp(vvalues->vstring, "zendmSearchType")==0) {
2770                                    proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
2771                                             value1, value2, "Value (%d) = %s", value2, match_strval(value2, zensearchenum));
2772                                }
2773                                else
2774                                {
2775                                    proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
2776                                             value1, value2, "Value %d", value2);
2777                                }
2778                                voffset = voffset+4;
2779                                break;
2780                        case 0x0000000b:        /* Fax Number */
2781                                value1 = tvb_get_letohl(tvb, voffset); /* length of field */
2782                                voffset = voffset+4;
2783                                get_string(tvb, voffset, value1, vvalues->vstring);
2784                                proto_tree_add_string(nvtree, hf_value_string, tvb, voffset, 
2785                                         value1, vvalues->vstring);
2786                                voffset = voffset + value1;
2787                                voffset += align_4(tvb, voffset);
2788                                break;
2789                        case 0x0000000c:        /* Network Address */
2790                                value1 = tvb_get_letohl(tvb, voffset); /* length of field */
2791                                voffset = voffset + 4;
2792                                value2 = tvb_get_letohl(tvb, voffset); /* type of Protocol */
2793                                valuestr = match_strval(value2, nds_protocol_type);
2794                                if (valuestr == NULL)
2795                                { 
2796                                                valuestr="(Undefined Protocol)";
2797                                }
2798                                tvb_ensure_bytes_exist(tvb, voffset, value1);
2799                                proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
2800                                    value1, value2, valuestr, value2);
2801                                voffset = voffset+4;
2802                                value3 = tvb_get_letohl(tvb, voffset); /* length of address */
2803                                voffset = voffset+4;
2804                                switch (value2)
2805                                { 
2806                                         case NDS_PTYPE_IPX:
2807                                                 proto_tree_add_item(nvtree, hf_nds_net, tvb, voffset, 4, FALSE);
2808                                                 proto_tree_add_item(nvtree, hf_nds_node, tvb, voffset+4, 6, FALSE);
2809                                                 proto_tree_add_item(nvtree, hf_nds_socket, tvb, voffset+10, 2, FALSE);
2810                                                 break;
2811                                         case NDS_PTYPE_IP:
2812                                                 proto_tree_add_item(nvtree, hf_nds_port, tvb, voffset, 2, FALSE);
2813                                                 proto_tree_add_item(nvtree, hf_add_ref_ip, tvb, voffset+2, 4, FALSE);
2814                                                 break;
2815                                         case NDS_PTYPE_UDP:
2816                                                 proto_tree_add_item(nvtree, hf_nds_port, tvb, voffset, 2, FALSE);
2817                                                 proto_tree_add_item(nvtree, hf_add_ref_udp, tvb, voffset+2, 4, FALSE);
2818                                                 break;
2819                                         case NDS_PTYPE_TCP:
2820                                                 proto_tree_add_item(nvtree, hf_nds_port, tvb, voffset, 2, FALSE);
2821                                                 proto_tree_add_item(nvtree, hf_add_ref_tcp, tvb, voffset+2, 4, FALSE);
2822                                                 break;
2823                                         case NDS_PTYPE_URL:
2824                                                 get_string(tvb, voffset, value3, vvalues->vstring);
2825                                                 proto_tree_add_string(nvtree, hf_value_string, tvb, voffset, 
2826                                                         value3, vvalues->vstring);
2827                                                 break;
2828                                         default:
2829                                                 break;
2830                                }
2831                                voffset = voffset + value3;
2832                                voffset += align_4(tvb, voffset);
2833                                break;
2834                        case 0x0000000f:        /* File System Path */
2835                                value1 = tvb_get_letohl(tvb, voffset); /* length of field */
2836                                voffset = voffset + 4;
2837                                value2 = tvb_get_letohl(tvb, voffset); /* Name Space */
2838                                valuestr = match_strval(value2, name_space_type);
2839                                if (valuestr == NULL)
2840                                {
2841                                         valuestr = "Unknown Name Space";
2842                                }
2843                                proto_tree_add_string(nvtree, hf_value_string, tvb, voffset, 
2844                                         4, valuestr);
2845                                voffset = voffset+4;
2846                                value3 = tvb_get_letohl(tvb, voffset); /* Length of Volume name */
2847                                voffset = voffset+4;
2848                                get_string(tvb, voffset, value3, vvalues->vstring);
2849                                proto_tree_add_string(nvtree, hf_value_string, tvb, voffset, 
2850                                         value3, vvalues->vstring);
2851                                voffset = voffset+value3;
2852                                voffset += align_4(tvb, voffset);
2853                                value4 = tvb_get_letohl(tvb, voffset); /* Length of Path name */
2854                                voffset = voffset+4;
2855                                get_string(tvb, voffset, value4, vvalues->vstring);
2856                                proto_tree_add_string(nvtree, hf_value_string, tvb, voffset, 
2857                                         value4, vvalues->vstring);
2858                                voffset = voffset+value4;
2859                                voffset += align_4(tvb, voffset);
2860                                break;
2861                        case 0x00000010:        /* Replica Pointer */
2862                                value1 = tvb_get_letohl(tvb, voffset); /* length of field */
2863                                voffset = voffset + 4;
2864                                value2 = tvb_get_letohl(tvb, voffset); /* Length of Server name */
2865                                voffset = voffset+4;
2866                                get_string(tvb, voffset, value2, vvalues->vstring);
2867                                proto_tree_add_string(nvtree, hf_value_string, tvb, voffset, 
2868                                         value2, vvalues->vstring);
2869                                voffset = voffset+value2;
2870                                voffset += align_4(tvb, voffset);
2871                                rtype = tvb_get_letohs(tvb, voffset); /* replica type */
2872                                valuestr = match_strval(rtype, nds_replica_type);
2873                                if (valuestr == NULL)
2874                                { 
2875                                         valuestr="(Unknown Replica Type)";
2876                                }
2877                                proto_tree_add_string(nvtree, hf_replica_type, tvb, voffset,
2878                                         2, valuestr);
2879                                voffset = voffset+2; 
2880                                rstate = tvb_get_letohs(tvb, voffset); /* replica state */
2881                                valuestr = match_strval(rstate, nds_replica_state);
2882                                if (valuestr == NULL)
2883                                { 
2884                                         valuestr="(Unknown Replica State)";
2885                                }
2886                                proto_tree_add_string(nvtree, hf_replica_state, tvb, voffset,
2887                                         2, valuestr);
2888                                voffset = voffset+2;
2889                                value3 = tvb_get_letohl(tvb, voffset); /* Replica number */
2890                                proto_tree_add_uint_format(nvtree, hf_replica_number, tvb, voffset, 
2891                                         4, value3, "Replica Number %d", value3);
2892                                voffset = voffset+4;
2893                                if(vvalues->nds_version == 0xfe)
2894                                {
2895                                         voffset += 4;
2896                                }
2897                                number_of_items = tvb_get_letohl(tvb, voffset);  /* Number of Addresses */
2898                                aditem = proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
2899                                         4, number_of_items, "Number of Addresses: %u", number_of_items);
2900         
2901                                adtree = proto_item_add_subtree(aditem, ett_nds);
2902                                voffset = voffset+4;
2903                                for (r=1; r <= number_of_items; r++)
2904                                {
2905                                         voffset += align_4(tvb, voffset);
2906                                         value4 = tvb_get_letohl(tvb, voffset); /* type of Protocol */
2907                                         valuestr = match_strval(value4, nds_protocol_type);
2908                                         if (valuestr == NULL)
2909                                         { 
2910                                                valuestr="(Undefined Protocol)";
2911                                         }
2912                                         proto_tree_add_uint_format(adtree, hf_nds_uint32value, tvb, voffset,
2913                                                 4, value4, valuestr, value4);
2914                                         voffset = voffset+4;
2915                                         value5 = tvb_get_letohl(tvb, voffset); /* length of address */
2916                                         voffset = voffset+4;
2917                                         switch (value4)
2918                                         { 
2919                                                 case NDS_PTYPE_IPX:
2920                                                         proto_tree_add_item(adtree, hf_nds_net, tvb, voffset, 4, FALSE);
2921                                                         proto_tree_add_item(adtree, hf_nds_node, tvb, voffset+4, 6, FALSE);
2922                                                         proto_tree_add_item(adtree, hf_nds_socket, tvb, voffset+10, 2, FALSE);
2923                                                         break;
2924                                                 case NDS_PTYPE_IP:
2925                                                         proto_tree_add_item(adtree, hf_nds_port, tvb, voffset, 2, FALSE);
2926                                                         proto_tree_add_item(adtree, hf_add_ref_ip, tvb, voffset+2, 4, FALSE);
2927                                                         break;
2928                                                 case NDS_PTYPE_UDP:
2929                                                         proto_tree_add_item(adtree, hf_nds_port, tvb, voffset, 2, FALSE);
2930                                                         proto_tree_add_item(adtree, hf_add_ref_udp, tvb, voffset+2, 4, FALSE);
2931                                                         break;
2932                                                 case NDS_PTYPE_TCP:
2933                                                         proto_tree_add_item(adtree, hf_nds_port, tvb, voffset, 2, FALSE);
2934                                                         proto_tree_add_item(adtree, hf_add_ref_tcp, tvb, voffset+2, 4, FALSE);
2935                                                         break;
2936                                                 case NDS_PTYPE_URL:
2937                                                         get_string(tvb, voffset, value5, vvalues->vstring);
2938                                                         proto_tree_add_string(adtree, hf_value_string, tvb, voffset, 
2939                                                                 value5, vvalues->vstring);
2940                                                         break;
2941                                                 default:
2942                                                         break;
2943                                         }
2944                                         voffset = voffset + value5;
2945                                }            
2946                                voffset += align_4(tvb, voffset);
2947                                break;
2948                        case 0x00000011:        /* Object ACL */
2949                                value1 = tvb_get_letohl(tvb, voffset); /* Length of Field */
2950                                voffset = voffset + 4;
2951                                value2 = tvb_get_letohl(tvb, voffset);
2952                                voffset = voffset + 4;
2953                                get_string(tvb, voffset, value2, vvalues->vstring); /* Unicode String */
2954                                proto_tree_add_string(nvtree, hf_value_string, tvb, voffset, 
2955                                    value2, vvalues->vstring);
2956                                voffset = voffset + value2;    
2957                                voffset += align_4(tvb, voffset);
2958                                value3 = tvb_get_letohl(tvb, voffset);
2959                                voffset = voffset + 4;
2960                                get_string(tvb, voffset, value3, vvalues->vstring); /* Unicode Subject Name */
2961                                proto_tree_add_string(nvtree, hf_value_string, tvb, voffset, 
2962                                    value3, vvalues->vstring);
2963                                voffset = voffset + value3;    
2964                                voffset += align_4(tvb, voffset);
2965                                value4 = tvb_get_letohl(tvb, voffset);         /* Privileges */
2966                                proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
2967                                         4, value4, "Privileges %8x", value4);
2968                                voffset = voffset+4;
2969                                voffset += align_4(tvb, voffset);
2970                                break;
2971                        case 0x00000013:        /* Time Stamp */
2972                                value1 = tvb_get_letohl(tvb, voffset);         /* Seconds */
2973                                proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
2974                                         4, value1, "Lenght of Record: %d", value1);
2975                                voffset = voffset+4;
2976                                value2 = tvb_get_letohl(tvb, voffset);
2977                                proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
2978                                         4, value2, "Seconds: %d", value2);
2979                                voffset = voffset + 4;
2980                                rnum = tvb_get_letohs(tvb, voffset); /* replica number */
2981                                proto_tree_add_uint_format(nvtree, hf_nds_rnum, tvb, voffset,
2982                                         2, rnum, "Replica Number: %d", rnum);
2983                                voffset = voffset+2;
2984                                revent = tvb_get_letohs(tvb, voffset); /* Event */
2985                                proto_tree_add_uint_format(nvtree, hf_nds_revent, tvb, voffset,
2986                                         2, revent, "Event: %d", revent);
2987                                voffset = voffset+2;
2988                                voffset += align_4(tvb, voffset);
2989                                break;
2990                        case 0x00000017:        /* Back Link */
2991                                value1 = tvb_get_letohl(tvb, voffset);         /* Length */
2992                                proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
2993                                         4, value1, "Length of Record %08x", value1);
2994                                voffset = voffset+4;
2995                                value2 = tvb_get_letohl(tvb, voffset);         /* Remote ID */
2996                                proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
2997                                         4, value2, "Remote ID %08x", value2);
2998                                voffset = voffset+4;
2999                                value3 = tvb_get_letohl(tvb, voffset);         /* Length of string */
3000                                voffset = voffset+4;
3001                                get_string(tvb, voffset, value3, vvalues->vstring);
3002                                proto_tree_add_string_format(nvtree, hf_value_string, tvb, voffset, 
3003                                         value3, vvalues->vstring,
3004                                         "Server Distinguished Name - %s", vvalues->vstring);
3005                                voffset = voffset+value3;
3006                                voffset += align_4(tvb, voffset);
3007                                break;
3008                        case 0x00000019:        /* Typed Name */
3009                                value1 = tvb_get_letohl(tvb, voffset);         /* Length */
3010                                proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
3011                                         4, value1, "Length of Record %08x", value1);
3012                                voffset = voffset+4;
3013                                value2 = tvb_get_letohl(tvb, voffset);         /* Level */
3014                                proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
3015                                         4, value2, "Level %d", value2);
3016                                voffset = voffset+4;
3017                                value3 = tvb_get_letohl(tvb, voffset);         /* Interval */
3018                                proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
3019                                         4, value3, "Interval %d", value3);
3020                                voffset = voffset+4;
3021                                value4 = tvb_get_letohl(tvb, voffset);         /* Distinguished Name */
3022                                voffset = voffset+4;
3023                                get_string(tvb, voffset, value4, vvalues->vstring);
3024                                proto_tree_add_string_format(nvtree, hf_value_string, tvb, voffset, 
3025                                         value4, vvalues->vstring,
3026                                         "Distinguished Name - %s", vvalues->vstring);
3027                                voffset = voffset+value4;
3028                                voffset += align_4(tvb, voffset);
3029                                break;
3030                        case 0x0000001a:        /* Hold */
3031                                value1 = tvb_get_letohl(tvb, voffset);         /* Length */
3032                                proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
3033                                         4, value1, "Length of Record %08x", value1);
3034                                voffset = voffset+4;
3035                                value2 = tvb_get_letohl(tvb, voffset);         /* Amount */
3036                                proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
3037                                         4, value2, "Amount %d", value2);
3038                                voffset = voffset+4;
3039                                value3 = tvb_get_letohl(tvb, voffset);         /* Subject */
3040                                voffset = voffset+4;
3041                                get_string(tvb, voffset, value3, vvalues->vstring);
3042                                proto_tree_add_string_format(nvtree, hf_value_string, tvb, voffset, 
3043                                         value3, vvalues->vstring,
3044                                         "Subject - %s", vvalues->vstring);
3045                                voffset = voffset+value3;
3046                                voffset += align_4(tvb, voffset);
3047                                break;
3048                        case 0x00000001:        /* Distinguished Name */
3049                        case 0x00000002:        /* Case Sensitive Unicode String */
3050                        case 0x00000003:        /* Non Case Sensitive Unicode String */
3051                        case 0x00000004:        /* Printable String */
3052                        case 0x00000005:        /* Numeric String */
3053                        case 0x0000000a:        /* Telephone Number */
3054                        case 0x0000000e:        /* Email Address */
3055                        case 0x00000014:        /* Class Name */
3056                        default:
3057                                value1 = tvb_get_letohl(tvb, voffset);
3058                                voffset = voffset + 4;
3059                                if (strcmp(vvalues->vstring, "zendmSearchOrder")==0) {
3060                                    get_string(tvb, voffset, value1, vvalues->vstring);
3061                                    if (strcmp(vvalues->vstring, "012")==0) {
3062                                        vvalues->vstring = "Value (012) = Object, Group, Container";
3063                                    }
3064                                    if (strcmp(vvalues->vstring, "021")==0) {
3065                                        vvalues->vstring = "Value (021) = Object, Container, Group";
3066                                    }
3067                                    if (strcmp(vvalues->vstring, "102")==0) {
3068                                        vvalues->vstring = "Value (102) = Group, Object, Container";
3069                                    }
3070                                    if (strcmp(vvalues->vstring, "120")==0) {
3071                                        vvalues->vstring = "Value (120) = Group, Container, Object";
3072                                    }
3073                                    if (strcmp(vvalues->vstring, "201")==0) {
3074                                        vvalues->vstring = "Value (201) = Container, Object, Group";
3075                                    }
3076                                    if (strcmp(vvalues->vstring, "210")==0) {
3077                                        vvalues->vstring = "Value (210) = Container, Group, Object";
3078                                    }
3079                                }
3080                                else
3081                                {
3082                                    get_string(tvb, voffset, value1, vvalues->vstring);
3083                                }
3084                                proto_tree_add_string(nvtree, hf_value_string, tvb, voffset, 
3085                                    value1, vvalues->vstring);
3086                                voffset = voffset + value1;    
3087                                voffset += align_4(tvb, voffset);
3088                                break;
3089                 }
3090                 voffset += align_4(tvb, voffset);
3091         }
3092         vvalues->voffset=voffset;                           
3093 return;
3094 }      
3095
3096 static guint32
3097 print_es_type(proto_tree *estree, tvbuff_t *tvb, nds_val *values, guint32 vtype, guint32 ioffset)
3098
3099         guint32         value1;
3100         guint32         value2;
3101         guint32         value3;
3102         guint32         value4;
3103         guint32         value5;
3104         guint32         number_of_referrals;
3105         guint32         r;
3106         guint32         i;
3107         guint16         replica_num;
3108         guint16         event_num;
3109         nw_uni_t        mval_buf;
3110         proto_tree      *nestree;
3111         proto_item      *nesitem;
3112         proto_tree      *atree;
3113         proto_item      *aitem;
3114         const char      *vstring="";
3115               
3116         strcpy(mval_buf.buffer, "");
3117
3118         switch (vtype)
3119         {
3120                 case 0: /* No Specifier Type */
3121                         value1 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3122                         proto_tree_add_item(estree, hf_es_value, tvb, ioffset, 
3123                                 4, value1);
3124                         ioffset = ioffset + 4;
3125                         break;
3126                 case 1: /* Unicode String */
3127                         value1 = tvb_get_letohl(tvb, ioffset);   /* Delimeter Set */
3128                         ioffset = ioffset + 4;        
3129                         get_string(tvb, ioffset, value1, mval_buf.buffer);
3130                         values->vstring = mval_buf.buffer;
3131                         proto_tree_add_string_format(estree, hf_mv_string, tvb, ioffset, 
3132                                 value1, values->vstring, "Delimeter ->%s", values->vstring);
3133                         ioffset=ioffset + value1;
3134                         ioffset += align_4(tvb, ioffset);
3135                         value2 = tvb_get_letohl(tvb, ioffset);
3136                         ioffset = ioffset + 4;        
3137                         get_string(tvb, ioffset, value2, mval_buf.buffer);
3138                         values->vstring = mval_buf.buffer;
3139                         proto_tree_add_string(estree, hf_mv_string, tvb, ioffset, 
3140                                 value2, values->vstring);
3141                         values->voffset=ioffset + value2;
3142                         ioffset = values->voffset;
3143                         ioffset += align_4(tvb, ioffset);
3144                         break;
3145                 case 2: /* Based */
3146                         value1 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3147                         vstring = match_strval(value1, es_type);
3148                         if (vstring == NULL)
3149                         {
3150                                 vstring = "No ES Type Found";
3151                         }        
3152                         nesitem = proto_tree_add_string_format(estree, hf_es_type, tvb, ioffset, 
3153                                 4, vstring, "Base Context Type - %s", vstring);
3154                         nestree = proto_item_add_subtree(nesitem, ett_nds);
3155                         ioffset = ioffset + 4;
3156                         switch (value1)
3157                         {
3158                                 case 0: /* No Specifier Type */
3159                                         value2 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3160                                         proto_tree_add_item(nestree, hf_es_value, tvb, ioffset, 
3161                                                 4, value2);
3162                                         ioffset = ioffset + 4;
3163                                         break;
3164                                 case 1: /* Unicode String */
3165                                         value2 = tvb_get_letohl(tvb, ioffset);   /* Delimeter Set */
3166                                         ioffset = ioffset + 4;        
3167                                         get_string(tvb, ioffset, value2, mval_buf.buffer);
3168                                         values->vstring = mval_buf.buffer;
3169                                         proto_tree_add_string_format(nestree, hf_mv_string, tvb, ioffset, 
3170                                                 value2, values->vstring, "Delimeter ->%s", values->vstring);
3171                                         ioffset=ioffset + value2;
3172                                         ioffset += align_4(tvb, ioffset);
3173                                         value3 = tvb_get_letohl(tvb, ioffset);
3174                                         ioffset = ioffset + 4;        
3175                                         get_string(tvb, ioffset, value3, mval_buf.buffer);
3176                                         values->vstring = mval_buf.buffer;
3177                                         proto_tree_add_string(nestree, hf_mv_string, tvb, ioffset, 
3178                                                 value3, values->vstring);
3179                                         values->voffset=ioffset + value3;
3180                                         ioffset = values->voffset;
3181                                         ioffset += align_4(tvb, ioffset);
3182                                         break;
3183                                 case 2: /* Based */
3184                                         break;
3185                                 case 3: /* Hinted */
3186                                         break;
3187                                 case 4: /* Tuned */
3188                                         value2 = tvb_get_letohl(tvb, ioffset);   /* Count */
3189                                         proto_tree_add_item(nestree, hf_es_rdn_count, tvb, ioffset, 
3190                                                 4, value2);
3191                                         ioffset = ioffset + 4;
3192                                         for (r = 1 ; r <= value2; r++ )
3193                                         {
3194                                                 value3 = tvb_get_letohl(tvb, ioffset);   /* Seconds */
3195                                                 proto_tree_add_item(nestree, hf_es_seconds, tvb, ioffset, 
3196                                                         4, value3);
3197                                                 ioffset = ioffset + 4;
3198                                                 replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
3199                                                 proto_tree_add_item(nestree, hf_nds_replica_num, tvb, ioffset, 
3200                                                         2, replica_num);
3201                                                 ioffset = ioffset + 2;
3202                                                 event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
3203                                                 proto_tree_add_item(nestree, hf_nds_event_num, tvb, ioffset, 
3204                                                         2, event_num);
3205                                                 ioffset = ioffset + 2;
3206                                         }        
3207                                         value4 = tvb_get_letohl(tvb, ioffset);   /* Delimeter Set */
3208                                         ioffset = ioffset + 4;        
3209                                         get_string(tvb, ioffset, value4, mval_buf.buffer);
3210                                         values->vstring = mval_buf.buffer;
3211                                         proto_tree_add_string(nestree, hf_mv_string, tvb, ioffset, 
3212                                                 value4, values->vstring);
3213                                         ioffset=ioffset + value4;
3214                                         ioffset += align_4(tvb, ioffset);
3215                                         value5 = tvb_get_letohl(tvb, ioffset);   /* RDN */
3216                                         ioffset = ioffset + 4;        
3217                                         get_string(tvb, ioffset, value5, mval_buf.buffer);
3218                                         values->vstring = mval_buf.buffer;
3219                                         proto_tree_add_string(nestree, hf_rdn_string, tvb, ioffset, 
3220                                                 value5, values->vstring);
3221                                         ioffset=ioffset + value5;
3222                                         ioffset += align_4(tvb, ioffset);
3223                                         break;
3224                                 case 5: /* GUID */
3225                                 case 6: /* ID32 */
3226                                 case 7: /* Count */
3227                                 default:
3228                                         value1 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3229                                         proto_tree_add_item(estree, hf_es_value, tvb, ioffset, 
3230                                                 4, value1);
3231                                         ioffset = ioffset + 4;
3232                                         break;
3233                          }
3234                         value1 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3235                         vstring = match_strval(value1, es_type);
3236                         if (vstring == NULL)
3237                         {
3238                                 vstring = "No ES Type Found";
3239                         }        
3240                         nesitem = proto_tree_add_string_format(estree, hf_es_type, tvb, ioffset, 
3241                                 4, vstring, "Object Name Type - %s", vstring);
3242                         nestree = proto_item_add_subtree(nesitem, ett_nds);
3243                         ioffset = ioffset + 4;
3244                         switch (value1)
3245                         {
3246                                 case 0: /* No Specifier Type */
3247                                         value2 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3248                                         proto_tree_add_item(estree, hf_es_value, tvb, ioffset, 
3249                                                 4, value2);
3250                                         ioffset = ioffset + 4;
3251                                         break;
3252                                 case 1: /* Unicode String */
3253                                         value2 = tvb_get_letohl(tvb, ioffset);   /* Delimeter Set */
3254                                         ioffset = ioffset + 4;        
3255                                         get_string(tvb, ioffset, value2, mval_buf.buffer);
3256                                         values->vstring = mval_buf.buffer;
3257                                         proto_tree_add_string_format(estree, hf_mv_string, tvb, ioffset, 
3258                                                 value2, values->vstring, "Delimeter ->%s", values->vstring);
3259                                         ioffset=ioffset + value2;
3260                                         ioffset += align_4(tvb, ioffset);
3261                                         value3 = tvb_get_letohl(tvb, ioffset);
3262                                         ioffset = ioffset + 4;        
3263                                         get_string(tvb, ioffset, value3, mval_buf.buffer);
3264                                         values->vstring = mval_buf.buffer;
3265                                         proto_tree_add_string(estree, hf_mv_string, tvb, ioffset, 
3266                                                 value3, values->vstring);
3267                                         values->voffset=ioffset + value3;
3268                                         ioffset = values->voffset;
3269                                         ioffset += align_4(tvb, ioffset);
3270                                         break;
3271                                 case 2: /* Based */
3272                                         break;
3273                                 case 3: /* Hinted */
3274                                         break;
3275                                 case 4: /* Tuned */
3276                                         value2 = tvb_get_letohl(tvb, ioffset);   /* Count */
3277                                         proto_tree_add_item(estree, hf_es_rdn_count, tvb, ioffset, 
3278                                                 4, value2);
3279                                         ioffset = ioffset + 4;
3280                                         for (r = 1 ; r <= value2; r++ )
3281                                         {
3282                                                 value3 = tvb_get_letohl(tvb, ioffset);   /* Seconds */
3283                                                 proto_tree_add_item(estree, hf_es_seconds, tvb, ioffset, 
3284                                                         4, value3);
3285                                                 ioffset = ioffset + 4;
3286                                                 replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
3287                                                 proto_tree_add_item(estree, hf_nds_replica_num, tvb, ioffset, 
3288                                                         2, replica_num);
3289                                                 ioffset = ioffset + 2;
3290                                                 event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
3291                                                 proto_tree_add_item(estree, hf_nds_event_num, tvb, ioffset, 
3292                                                         2, event_num);
3293                                                 ioffset = ioffset + 2;
3294                                         }        
3295                                         value4 = tvb_get_letohl(tvb, ioffset);   /* Delimeter Set */
3296                                         ioffset = ioffset + 4;        
3297                                         get_string(tvb, ioffset, value4, mval_buf.buffer);
3298                                         values->vstring = mval_buf.buffer;
3299                                         proto_tree_add_string(estree, hf_mv_string, tvb, ioffset, 
3300                                                 value4, values->vstring);
3301                                         ioffset=ioffset + value4;
3302                                         ioffset += align_4(tvb, ioffset);
3303                                         value5 = tvb_get_letohl(tvb, ioffset);   /* RDN */
3304                                         ioffset = ioffset + 4;        
3305                                         get_string(tvb, ioffset, value5, mval_buf.buffer);
3306                                         values->vstring = mval_buf.buffer;
3307                                         proto_tree_add_string(estree, hf_rdn_string, tvb, ioffset, 
3308                                                 value5, values->vstring);
3309                                         ioffset=ioffset + value5;
3310                                         ioffset += align_4(tvb, ioffset);
3311                                         break;
3312                                 case 5: /* GUID */
3313                                 case 6: /* ID32 */
3314                                 case 7: /* Count */
3315                                 default:
3316                                         value1 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3317                                         proto_tree_add_item(estree, hf_es_value, tvb, ioffset, 
3318                                                 4, value1);
3319                                         ioffset = ioffset + 4;
3320                                         break;
3321                          }
3322                         break;
3323                 case 3: /* Hinted */
3324                         number_of_referrals = tvb_get_letohl(tvb, ioffset);
3325                         
3326                         for (r = 1 ; r <= number_of_referrals; r++ )
3327                         {
3328                                 aitem = proto_tree_add_uint_format(estree, hf_referral_record, tvb, 6, 0,
3329                                 r, "NDS Referral Record #%u", r);
3330                                 atree = proto_item_add_subtree(aitem, ett_nds);
3331                                 
3332                                 value1 = tvb_get_letohl(tvb, ioffset);
3333                                 
3334                                 proto_tree_add_uint_format(atree, hf_referral_addcount, tvb, ioffset, 4,
3335                                         value1, "Number of Addresses in Referral - %d", value1);
3336                                      
3337                                 ioffset = ioffset + 4;
3338                                 for (i = 1 ; i <= value1; i++ ) 
3339                                 {
3340                                         value2 = tvb_get_letohl(tvb, ioffset);
3341                                         values->vstring =(char *)match_strval(value2, nds_protocol_type);
3342                                         if (values->vstring == NULL)
3343                                         { 
3344                                                values->vstring="(Undefined Protocol)";
3345                                         }
3346                                         proto_tree_add_uint_format(atree, hf_nds_uint32value, tvb, ioffset,
3347                                         4, value2, vstring, value2);
3348                                         ioffset = ioffset+4;
3349                                         value3 = tvb_get_letohl(tvb, ioffset);
3350                                         ioffset = ioffset+4;
3351                                         switch (value2)
3352                                         { 
3353                                                 case NDS_PTYPE_IPX:
3354                                                         proto_tree_add_item(atree, hf_nds_net, tvb, ioffset, 4, FALSE);
3355                                                         proto_tree_add_item(atree, hf_nds_node, tvb, ioffset+4, 6, FALSE);
3356                                                         proto_tree_add_item(atree, hf_nds_socket, tvb, ioffset+10, 2, FALSE);
3357                                                         break;
3358                                                 case NDS_PTYPE_IP:
3359                                                         proto_tree_add_item(atree, hf_nds_port, tvb, ioffset, 2, FALSE);
3360                                                         proto_tree_add_item(atree, hf_add_ref_ip, tvb, ioffset+2, 4, FALSE);
3361                                                         break;
3362                                                 case NDS_PTYPE_UDP:
3363                                                         proto_tree_add_item(atree, hf_nds_port, tvb, ioffset, 2, FALSE);
3364                                                         proto_tree_add_item(atree, hf_add_ref_udp, tvb, ioffset+2, 4, FALSE);
3365                                                         break;
3366                                                 case NDS_PTYPE_TCP:
3367                                                         proto_tree_add_item(atree, hf_nds_port, tvb, ioffset, 2, FALSE);
3368                                                         proto_tree_add_item(atree, hf_add_ref_tcp, tvb, ioffset+2, 4, FALSE);
3369                                                         break;
3370                                                 case NDS_PTYPE_URL:
3371                                                         get_string(tvb, ioffset, value3, values->vstring);
3372                                                         proto_tree_add_string(atree, hf_value_string, tvb, ioffset, 
3373                                                                 value3, values->vstring);
3374                                                         break;
3375                                                 default:
3376                                                         break;
3377                                         }
3378                                         ioffset = ioffset + value3;    
3379                                         ioffset += align_4(tvb, ioffset);
3380                                 }
3381                 
3382                         }
3383                         value1 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3384                         vstring = match_strval(value1, es_type);
3385                         if (vstring == NULL)
3386                         {
3387                                 vstring = "No ES Type Found";
3388                         }        
3389                         nesitem = proto_tree_add_string_format(estree, hf_es_type, tvb, ioffset, 
3390                                 4, vstring, "Object Name Type - %s", vstring);
3391                         nestree = proto_item_add_subtree(nesitem, ett_nds);
3392                         ioffset = ioffset + 4;
3393                         switch (value1)
3394                         {
3395                                 case 0: /* No Specifier Type */
3396                                         value2 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3397                                         proto_tree_add_item(estree, hf_es_value, tvb, ioffset, 
3398                                                 4, value2);
3399                                         ioffset = ioffset + 4;
3400                                         break;
3401                                 case 1: /* Unicode String */
3402                                         value2 = tvb_get_letohl(tvb, ioffset);   /* Delimeter Set */
3403                                         ioffset = ioffset + 4;        
3404                                         get_string(tvb, ioffset, value2, mval_buf.buffer);
3405                                         values->vstring = mval_buf.buffer;
3406                                         proto_tree_add_string_format(estree, hf_mv_string, tvb, ioffset, 
3407                                                 value2, values->vstring, "Delimeter ->%s", values->vstring);
3408                                         ioffset=ioffset + value2;
3409                                         ioffset += align_4(tvb, ioffset);
3410                                         value3 = tvb_get_letohl(tvb, ioffset);
3411                                         ioffset = ioffset + 4;        
3412                                         get_string(tvb, ioffset, value3, mval_buf.buffer);
3413                                         values->vstring = mval_buf.buffer;
3414                                         proto_tree_add_string(estree, hf_mv_string, tvb, ioffset, 
3415                                                 value3, values->vstring);
3416                                         values->voffset=ioffset + value3;
3417                                         ioffset = values->voffset;
3418                                         ioffset += align_4(tvb, ioffset);
3419                                         break;
3420                                 case 2: /* Based */
3421                                         break;
3422                                 case 3: /* Hinted */
3423                                         break;
3424                                 case 4: /* Tuned */
3425                                         value2 = tvb_get_letohl(tvb, ioffset);   /* Count */
3426                                         proto_tree_add_item(estree, hf_es_rdn_count, tvb, ioffset, 
3427                                                 4, value2);
3428                                         ioffset = ioffset + 4;
3429                                         for (r = 1 ; r <= value2; r++ )
3430                                         {
3431                                                 value3 = tvb_get_letohl(tvb, ioffset);   /* Seconds */
3432                                                 proto_tree_add_item(estree, hf_es_seconds, tvb, ioffset, 
3433                                                         4, value3);
3434                                                 ioffset = ioffset + 4;
3435                                                 replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
3436                                                 proto_tree_add_item(estree, hf_nds_replica_num, tvb, ioffset, 
3437                                                         2, replica_num);
3438                                                 ioffset = ioffset + 2;
3439                                                 event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
3440                                                 proto_tree_add_item(estree, hf_nds_event_num, tvb, ioffset, 
3441                                                         2, event_num);
3442                                                 ioffset = ioffset + 2;
3443                                         }        
3444                                         value4 = tvb_get_letohl(tvb, ioffset);   /* Delimeter Set */
3445                                         ioffset = ioffset + 4;        
3446                                         get_string(tvb, ioffset, value4, mval_buf.buffer);
3447                                         values->vstring = mval_buf.buffer;
3448                                         proto_tree_add_string(estree, hf_mv_string, tvb, ioffset, 
3449                                                 value4, values->vstring);
3450                                         ioffset=ioffset + value4;
3451                                         ioffset += align_4(tvb, ioffset);
3452                                         value5 = tvb_get_letohl(tvb, ioffset);   /* RDN */
3453                                         ioffset = ioffset + 4;        
3454                                         get_string(tvb, ioffset, value5, mval_buf.buffer);
3455                                         values->vstring = mval_buf.buffer;
3456                                         proto_tree_add_string(estree, hf_rdn_string, tvb, ioffset, 
3457                                                 value5, values->vstring);
3458                                         ioffset=ioffset + value5;
3459                                         ioffset += align_4(tvb, ioffset);
3460                                         break;
3461                                 case 5: /* GUID */
3462                                 case 6: /* ID32 */
3463                                 case 7: /* Count */
3464                                 default:
3465                                         value1 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3466                                         proto_tree_add_item(estree, hf_es_value, tvb, ioffset, 
3467                                                 4, value1);
3468                                         ioffset = ioffset + 4;
3469                                         break;
3470                          }
3471                         break;
3472                 case 4: /* Tuned */
3473                         value1 = tvb_get_letohl(tvb, ioffset);   /* Count */
3474                         proto_tree_add_item(estree, hf_es_rdn_count, tvb, ioffset, 
3475                                 4, value1);
3476                         ioffset = ioffset + 4;
3477                         for (r = 1 ; r <= value1; r++ )
3478                         {
3479                                 value2 = tvb_get_letohl(tvb, ioffset);   /* Seconds */
3480                                 proto_tree_add_item(estree, hf_es_seconds, tvb, ioffset, 
3481                                         4, value2);
3482                                 ioffset = ioffset + 4;
3483                                 replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
3484                                 proto_tree_add_item(estree, hf_nds_replica_num, tvb, ioffset, 
3485                                         2, replica_num);
3486                                 ioffset = ioffset + 2;
3487                                 event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
3488                                 proto_tree_add_item(estree, hf_nds_event_num, tvb, ioffset, 
3489                                         2, event_num);
3490                                 ioffset = ioffset + 2;
3491                         }        
3492                         value3 = tvb_get_letohl(tvb, ioffset);   /* Delimeter Set */
3493                         ioffset = ioffset + 4;        
3494                         get_string(tvb, ioffset, value3, mval_buf.buffer);
3495                         values->vstring = mval_buf.buffer;
3496                         proto_tree_add_string(estree, hf_mv_string, tvb, ioffset, 
3497                                 value3, values->vstring);
3498                         ioffset=ioffset + value3;
3499                         ioffset += align_4(tvb, ioffset);
3500                         value4 = tvb_get_letohl(tvb, ioffset);   /* RDN */
3501                         ioffset = ioffset + 4;        
3502                         get_string(tvb, ioffset, value4, mval_buf.buffer);
3503                         values->vstring = mval_buf.buffer;
3504                         proto_tree_add_string(estree, hf_rdn_string, tvb, ioffset, 
3505                                 value4, values->vstring);
3506                         ioffset=ioffset + value4;
3507                         ioffset += align_4(tvb, ioffset);
3508                         break;
3509                 case 5: /* GUID */
3510                 case 6: /* ID32 */
3511                 case 7: /* Count */
3512                 default:
3513                         value1 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3514                         proto_tree_add_item(estree, hf_es_value, tvb, ioffset, 
3515                                 4, value1);
3516                         ioffset = ioffset + 4;
3517                         break;
3518          }
3519         return ioffset;
3520 }   
3521
3522 static void
3523 process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, nds_val *values)
3524 {
3525         guint32         i;
3526         guint32         r;
3527         guint32         ioffset = 0, oldioffset;
3528         guint32         value1 = 0;
3529         guint32         value2 = 0;
3530         guint8          value3 = 0;
3531         guint32         value4 = 0;
3532         gint            value5 = 0;
3533         guint32         value6 = 0;
3534         guint32         value7 = 0;
3535         const char      *valuestr = "";
3536         proto_tree      *ntree;
3537         proto_tree      *atree;
3538         proto_item      *nitem;
3539         proto_item      *aitem;
3540         guint32         number_of_referrals = 0;
3541         nw_uni_t        mval_buf;
3542         proto_tree      *estree;
3543         proto_item      *esitem;
3544         guint16         replica_num = 0;
3545         guint16         event_num = 0;
3546         guint32         bvalue=0;
3547         nds_val         temp_values;
3548         proto_tree      *sub1tree;
3549         proto_item      *sub1item;
3550         proto_tree      *sub2tree;
3551         proto_item      *sub2item;
3552         gint            length_remaining;
3553                
3554         strcpy(mval_buf.buffer, "");
3555         strcpy(mv_resolve_name_string, "");
3556         
3557         if(values->mvtype != MVTYPE_LIST_PARTITIONS)
3558         {
3559                 nitem = proto_tree_add_uint_format(ncp_tree, values->hfname, tvb, values->voffset+ioffset,
3560                         values->vlength, values->vvalue, values->vdesc, values->vvalue);
3561         }
3562         else
3563         {
3564                 nitem = proto_tree_add_string_format(ncp_tree, values->hfname, tvb, values->voffset+ioffset,
3565                         values->vlength, values->vdesc, "%s", values->vdesc);
3566         }                
3567         ioffset = (values->voffset+4);
3568         
3569         ntree = proto_item_add_subtree(nitem, ett_nds);
3570
3571         switch (values->mvtype)
3572         {
3573                 case MVTYPE_ATTR_REQUEST:       /* Attribute Request */
3574                         for (i = 1 ; i <= values->vvalue; i++ )
3575                         {
3576                                 ioffset += align_4(tvb, ioffset);
3577                                 value1 = tvb_get_letohl(tvb, ioffset);
3578                                 ioffset = ioffset + 4;
3579                                 get_string(tvb, ioffset, value1, mval_buf.buffer);
3580                                 values->vstring = mval_buf.buffer;                                
3581                                 proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset, 
3582                                         value1, values->vstring);
3583                                 ioffset = ioffset + value1;        
3584                         }
3585                         break;
3586
3587                 case MVTYPE_ATTR_REPLY:         /* Attribute Reply */
3588                         switch(values->vflags)
3589                         {
3590                                 case 0:
3591                                         for (i = 1 ; i <= values->vvalue; i++ )
3592                                         {
3593                                                 ioffset += align_4(tvb, ioffset);
3594                                                 value1 = tvb_get_letohl(tvb, ioffset);
3595                                                 ioffset = ioffset + 4;
3596                                                 get_string(tvb, ioffset, value1, mval_buf.buffer);
3597                                                 values->vstring = mval_buf.buffer;                                
3598                                                 proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset, 
3599                                                         value1, values->vstring);
3600                                                 ioffset = ioffset + value1;        
3601                                         }
3602                                         break;
3603                                 case 1:
3604                                         for (i = 1 ; i <= values->vvalue; i++ )
3605                                         {
3606                                                 value1 = tvb_get_letohl(tvb, ioffset);
3607                                                 values->vstring = (char *)match_strval(value1, nds_syntax);
3608                                                 if (values->vstring == NULL)
3609                                                 {
3610                                                         values->vstring = "No Syntax Found";
3611                                                 }        
3612                                                 proto_tree_add_string(ntree, hf_nds_syntax, tvb, ioffset, 
3613                                                 4, values->vstring);
3614                                                 ioffset = ioffset + 4;
3615                                                 value2 = tvb_get_letohl(tvb, ioffset);
3616                                                 ioffset = ioffset + 4;        
3617                                                 get_string(tvb, ioffset, value2, mval_buf.buffer);
3618                                                 values->vstring = mval_buf.buffer;
3619                                                 proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset, 
3620                                                         value2, values->vstring);        
3621                                                 ioffset += value2;
3622                                                 ioffset += align_4(tvb, ioffset);
3623                                                 values->voffset = ioffset; 
3624         
3625                                                 print_nds_values(ntree, tvb, value1, values);        
3626                                                 ioffset = values->voffset;
3627                                         }
3628                                         break;                
3629                                 case 2:
3630                                         for (i = 1 ; i <= values->vvalue; i++ )
3631                                         {
3632                                                 value1 = tvb_get_letohl(tvb, ioffset);
3633                                                 values->vstring = (char *)match_strval(value1, nds_syntax);
3634                                                 if (values->vstring == NULL)
3635                                                 {
3636                                                         values->vstring = "No Syntax Found";
3637                                                 }        
3638                                                 proto_tree_add_string(ntree, hf_nds_syntax, tvb, ioffset, 
3639                                                 4, values->vstring);
3640                                                 ioffset = ioffset + 4;
3641                                                 value2 = tvb_get_letohl(tvb, ioffset);
3642                                                 ioffset = ioffset + 4;        
3643                                                 get_string(tvb, ioffset, value2, mval_buf.buffer);
3644                                                 values->vstring = mval_buf.buffer;
3645                                                 proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset, 
3646                                                         value2, values->vstring);
3647                                                 values->voffset=ioffset + value2;
3648                                                 ioffset += value2;
3649                                                 ioffset += align_4(tvb, ioffset);
3650                                                 value3 = tvb_get_letohl(tvb, ioffset);
3651                                                 
3652                                                 proto_tree_add_uint_format(ntree, hf_nds_uint32value, tvb, ioffset, 4,
3653                                                         value1, "Number of Values - %d", value1);
3654                                                      
3655                                                 ioffset = ioffset + 4;
3656                                                 for (r = 1 ; r <= value3; r++ ) 
3657                                                 {
3658                                                         ioffset += 4;   /* Length = 4 */
3659                                                         value4 = tvb_get_letohl(tvb, ioffset);
3660                                                         tvb_ensure_bytes_exist(tvb, ioffset, values->vlength);
3661                                                         proto_tree_add_uint(ntree, hf_nds_privileges, tvb, ioffset,
3662                                                         values->vlength, value4);
3663                                                         ioffset = ioffset+4;
3664                                                 }
3665                                         }
3666                                         break;        
3667                                 case 3:
3668                                         for (i = 1 ; i <= values->vvalue; i++ )
3669                                         {
3670                                                 value1 = tvb_get_letohl(tvb, ioffset);
3671                                                 values->vstring = (char *)match_strval(value1, nds_syntax);
3672                                                 if (values->vstring == NULL)
3673                                                 {
3674                                                         values->vstring = "No Syntax Found";
3675                                                 }        
3676                                                 proto_tree_add_string(ntree, hf_nds_syntax, tvb, ioffset, 
3677                                                 4, values->vstring);
3678                                                 ioffset = ioffset + 4;
3679                                                 value2 = tvb_get_letohl(tvb, ioffset);
3680                                                 ioffset = ioffset + 4;        
3681                                                 get_string(tvb, ioffset, value2, mval_buf.buffer);
3682                                                 values->vstring = mval_buf.buffer;
3683                                                 proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset, 
3684                                                         value2, values->vstring);
3685                                                 ioffset = ioffset + value2;
3686                                                 ioffset += align_4(tvb, ioffset);
3687                                                 value3 = tvb_get_letohl(tvb, ioffset);
3688                                                 
3689                                                 aitem = proto_tree_add_uint_format(ntree, hf_nds_uint32value, tvb, ioffset, 4,
3690                                                         value3, "Number of Values - %d", value3);
3691         
3692                                                 atree = proto_item_add_subtree(aitem, ett_nds);
3693                                                      
3694                                                 ioffset = ioffset + 4;
3695                                                 for (r = 1 ; r <= value3; r++ ) 
3696                                                 {
3697                                                         ioffset += align_4(tvb, ioffset);
3698                                                         temp_values.vvalue = tvb_get_letohl(tvb, ioffset);
3699                                                         temp_values.vlength = 2;
3700                                                         temp_values.hfname = hf_nds_vflags;
3701                                                         temp_values.voffset = ioffset;
3702                                                         temp_values.vdesc = "Value Flags";
3703                                                         temp_values.bit1 = "Naming";
3704                                                         temp_values.bit1hfname = hf_bit1vflags;
3705                                                         temp_values.bit2 = "Base Class";
3706                                                         temp_values.bit2hfname = hf_bit2vflags;
3707                                                         temp_values.bit3 = "Present";
3708                                                         temp_values.bit3hfname = hf_bit3vflags;
3709                                                         temp_values.bit4 = "Value Damaged";
3710                                                         temp_values.bit4hfname = hf_bit4vflags;
3711                                                         temp_values.bit5 = "Not Defined";
3712                                                         temp_values.bit5hfname = hf_bit5vflags;
3713                                                         temp_values.bit6 = "Not Defined";
3714                                                         temp_values.bit6hfname = hf_bit6vflags;
3715                                                         temp_values.bit7 = "Not Defined";
3716                                                         temp_values.bit7hfname = hf_bit7vflags;
3717                                                         temp_values.bit8 = "Not Defined";
3718                                                         temp_values.bit8hfname = hf_bit8vflags;
3719                                                         temp_values.bit9 = "Not Defined";
3720                                                         temp_values.bit9hfname = hf_bit9vflags;
3721                                                         temp_values.bit10 = "Not Defined";
3722                                                         temp_values.bit10hfname = hf_bit10vflags;
3723                                                         temp_values.bit11 = "Not Defined";
3724                                                         temp_values.bit11hfname = hf_bit11vflags;
3725                                                         temp_values.bit12 = "Not Defined";
3726                                                         temp_values.bit12hfname = hf_bit12vflags;
3727                                                         temp_values.bit13 = "Not Defined";
3728                                                         temp_values.bit13hfname = hf_bit13vflags;
3729                                                         temp_values.bit14 = "Not Defined";
3730                                                         temp_values.bit14hfname = hf_bit14vflags;
3731                                                         temp_values.bit15 = "Not Defined";
3732                                                         temp_values.bit15hfname = hf_bit15vflags;
3733                                                         temp_values.bit16 = "Not Defined";
3734                                                         temp_values.bit16hfname = hf_bit16vflags;
3735                                                         process_bitfield(atree, tvb, &temp_values);
3736                                                         ioffset = ioffset + 4;        
3737                                                         value4 = tvb_get_letohl(tvb, ioffset);
3738                                                         proto_tree_add_uint_format(atree, hf_es_seconds, tvb, ioffset,
3739                                                                 4, value4, "Seconds %d", value4);
3740                                                         ioffset = ioffset + 4;        
3741                                                         replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
3742                                                         proto_tree_add_item(atree, hf_nds_replica_num, tvb, ioffset, 
3743                                                                 2, replica_num);
3744                                                         ioffset = ioffset + 2;
3745                                                         event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
3746                                                         proto_tree_add_item(atree, hf_nds_event_num, tvb, ioffset, 
3747                                                                 2, event_num);
3748                                                         ioffset = ioffset + 2;
3749                                                         value5 = tvb_get_letohl(tvb, ioffset); /* length of field */
3750                                                         if(value5 > tvb_length_remaining(tvb, ioffset))
3751                                                         {
3752                                                                  break;
3753                                                         }
3754                                                         ioffset += 4;
3755                                                         tvb_ensure_bytes_exist(tvb, ioffset, value5);
3756                                                         proto_tree_add_bytes(atree, hf_value_bytes, tvb, ioffset, value5, tvb_get_ptr(tvb, ioffset, value5));
3757                                                         ioffset += value5;
3758                                                         ioffset += (value5%2);
3759                                                 }
3760                                         }
3761                                         break;
3762                                 case 4:
3763                                         for (i = 1 ; i <= values->vvalue; i++ )
3764                                         {
3765                                                 value1 = tvb_get_letohl(tvb, ioffset);
3766                                                 values->vstring = (char *)match_strval(value1, nds_syntax);
3767                                                 if (values->vstring == NULL)
3768                                                 {
3769                                                         values->vstring = "No Syntax Found";
3770                                                 }        
3771                                                 proto_tree_add_string(ntree, hf_nds_syntax, tvb, ioffset, 
3772                                                 4, values->vstring);
3773                                                 ioffset = ioffset + 4;
3774                                                 value2 = tvb_get_letohl(tvb, ioffset);
3775                                                 ioffset = ioffset + 4;        
3776                                                 get_string(tvb, ioffset, value2, mval_buf.buffer);
3777                                                 values->vstring = mval_buf.buffer;
3778                                                 proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset, 
3779                                                         value2, values->vstring);
3780                                                 ioffset = ioffset + value2;
3781                                                 value3 = tvb_get_letohl(tvb, ioffset);
3782                                                 
3783                                                 proto_tree_add_uint_format(ntree, hf_nds_uint32value, tvb, ioffset, 4,
3784                                                         value3, "Number of Values - %d", value3);
3785                                                      
3786                                                 ioffset = ioffset + 4;
3787                                                 for (r = 1 ; r <= value3; r++ ) 
3788                                                 {
3789                                                         ioffset += align_4(tvb, ioffset);
3790                                                         temp_values.vvalue = tvb_get_letohl(tvb, ioffset);
3791                                                         temp_values.vlength = 2;
3792                                                         temp_values.hfname = hf_nds_vflags;
3793                                                         temp_values.voffset = ioffset;
3794                                                         temp_values.vdesc = "Value Flags";
3795                                                         temp_values.bit1 = "Naming";
3796                                                         temp_values.bit1hfname = hf_bit1vflags;
3797                                                         temp_values.bit2 = "Base Class";
3798                                                         temp_values.bit2hfname = hf_bit2vflags;
3799                                                         temp_values.bit3 = "Present";
3800                                                         temp_values.bit3hfname = hf_bit3vflags;
3801                                                         temp_values.bit4 = "Value Damaged";
3802                                                         temp_values.bit4hfname = hf_bit4vflags;
3803                                                         temp_values.bit5 = "Not Defined";
3804                                                         temp_values.bit5hfname = hf_bit5vflags;
3805                                                         temp_values.bit6 = "Not Defined";
3806                                                         temp_values.bit6hfname = hf_bit6vflags;
3807                                                         temp_values.bit7 = "Not Defined";
3808                                                         temp_values.bit7hfname = hf_bit7vflags;
3809                                                         temp_values.bit8 = "Not Defined";
3810                                                         temp_values.bit8hfname = hf_bit8vflags;
3811                                                         temp_values.bit9 = "Not Defined";
3812                                                         temp_values.bit9hfname = hf_bit9vflags;
3813                                                         temp_values.bit10 = "Not Defined";
3814                                                         temp_values.bit10hfname = hf_bit10vflags;
3815                                                         temp_values.bit11 = "Not Defined";
3816                                                         temp_values.bit11hfname = hf_bit11vflags;
3817                                                         temp_values.bit12 = "Not Defined";
3818                                                         temp_values.bit12hfname = hf_bit12vflags;
3819                                                         temp_values.bit13 = "Not Defined";
3820                                                         temp_values.bit13hfname = hf_bit13vflags;
3821                                                         temp_values.bit14 = "Not Defined";
3822                                                         temp_values.bit14hfname = hf_bit14vflags;
3823                                                         temp_values.bit15 = "Not Defined";
3824                                                         temp_values.bit15hfname = hf_bit15vflags;
3825                                                         temp_values.bit16 = "Not Defined";
3826                                                         temp_values.bit16hfname = hf_bit16vflags;
3827                                                         process_bitfield(ntree, tvb, &temp_values);
3828                                                         ioffset = ioffset + 4;        
3829                                                         value1 = tvb_get_letohl(tvb, ioffset);
3830                                                         proto_tree_add_uint_format(ntree, hf_es_seconds, tvb, ioffset,
3831                                                                 4, value1, "Seconds %d", value1);
3832                                                         ioffset = ioffset + 4;        
3833                                                         replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
3834                                                         proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset, 
3835                                                                 2, replica_num);
3836                                                         ioffset = ioffset + 2;
3837                                                         event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
3838                                                         proto_tree_add_item(ntree, hf_nds_event_num, tvb, ioffset, 
3839                                                                 2, event_num);
3840                                                         ioffset = ioffset + 2;
3841                                                         value1 = tvb_get_letohl(tvb, ioffset);   
3842                                                         proto_tree_add_uint(ntree, hf_nds_value_len, tvb, ioffset,
3843                                                                 4, value1);
3844                                                         ioffset = ioffset + 4;        
3845                                                 }
3846                                         }
3847                                         break;
3848                                 default:
3849                                         break;
3850                         }
3851                         break;
3852
3853                 case MVTYPE_ATTR_REQUEST2:      /* Attribute Request */
3854                         oldioffset = 0;
3855                         for (i = 1 ; i <= values->vvalue; i++ )
3856                         {
3857                                 if (oldioffset >= ioffset) {
3858                                         proto_tree_add_text(ntree, tvb, 0, 0, "[ Invalid offset: %u ]", ioffset);
3859                                         THROW(ReportedBoundsError);
3860                                 }
3861                                 oldioffset = ioffset;
3862                                 ioffset += align_4(tvb, ioffset);
3863                                 value1 = tvb_get_letohl(tvb, ioffset);
3864                                 proto_tree_add_uint_format(ntree, hf_nds_uint32value, tvb, ioffset,
3865                                         4, value1, "Value %d", value1);
3866                                 ioffset = ioffset + value1;        
3867                         }
3868                         break;
3869
3870                 case MVTYPE_ADD_ATTR_REQUEST:   /* Add Attribute Request */
3871                         for (i = 1 ; i <= values->vvalue; i++ )
3872                         {
3873                                 value1 = tvb_get_letohl(tvb, ioffset);
3874                                 ioffset = ioffset + 4;
3875                                 get_string(tvb, ioffset, value1, mval_buf.buffer);
3876                                 values->vstring = mval_buf.buffer;                                
3877                                 proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset, 
3878                                         value1, values->vstring);
3879                                 ioffset = ioffset + value1;        
3880                                 ioffset += align_4(tvb, ioffset);
3881                                 values->voffset = ioffset;
3882                                 print_nds_values(ntree, tvb, 9, values);        
3883                                 ioffset = values->voffset;
3884                         }
3885                         break;
3886                         
3887                 case MVTYPE_READ_CLASS_REQ:     /* Read Class Request */
3888                         for (i = 1 ; i <= values->vvalue; i++ )
3889                         {
3890                                 ioffset += align_4(tvb, ioffset);
3891                                 value1 = tvb_get_letohl(tvb, ioffset);
3892                                 ioffset = ioffset + 4;
3893                                 get_string(tvb, ioffset, value1, mval_buf.buffer);
3894                                 values->vstring = mval_buf.buffer;                                
3895                                 proto_tree_add_string(ntree, hf_nds_base, tvb, ioffset, 
3896                                         value1, values->vstring);
3897                                 values->mvtype = MVTYPE_ATTR_REQUEST;        
3898                                 ioffset = ioffset + value1;        
3899                         }
3900                         break;
3901
3902                 case MVTYPE_READ_REPLICAS:      /* Read Replicas */
3903                         for (i = 1 ; i <= values->vvalue; i++ )
3904                         {
3905                                                 
3906                                 bvalue = 0x00000001;
3907                 
3908                                 for (r = 0 ; r < 9; r++ ) 
3909                                 {
3910                 
3911                                         if (values->vflags & bvalue) 
3912                                         {
3913                                                 switch(bvalue)
3914                                                 {
3915                                                         case 0x00000001:                /*p3values.bit1 = "Output Flags"*/
3916                                                                 temp_values.vvalue = tvb_get_letohl(tvb, ioffset);
3917                                                                 temp_values.vlength = 2;
3918                                                                 temp_values.hfname = hf_nds_rflags;
3919                                                                 temp_values.voffset = ioffset;
3920                                                                 temp_values.vdesc = "Output Flags";
3921                                                                 temp_values.bit1 = values->bit1;
3922                                                                 temp_values.bit1hfname = hf_bit1outflags;
3923                                                                 temp_values.bit2 = values->bit2;
3924                                                                 temp_values.bit2hfname = hf_bit2outflags;
3925                                                                 temp_values.bit3 = values->bit3;
3926                                                                 temp_values.bit3hfname = hf_bit3outflags;
3927                                                                 temp_values.bit4 = values->bit4;
3928                                                                 temp_values.bit4hfname = hf_bit4outflags;
3929                                                                 temp_values.bit5 = values->bit5;
3930                                                                 temp_values.bit5hfname = hf_bit5outflags;
3931                                                                 temp_values.bit6 = values->bit6;
3932                                                                 temp_values.bit6hfname = hf_bit6outflags;
3933                                                                 temp_values.bit7 = values->bit7;
3934                                                                 temp_values.bit7hfname = hf_bit7outflags;
3935                                                                 temp_values.bit8 = values->bit8;
3936                                                                 temp_values.bit8hfname = hf_bit8outflags;
3937                                                                 temp_values.bit9 = values->bit9;
3938                                                                 temp_values.bit9hfname = hf_bit9outflags;
3939                                                                 temp_values.bit10 = "Not Defined";
3940                                                                 temp_values.bit10hfname = hf_bit10outflags;
3941                                                                 temp_values.bit11 = "Not Defined";
3942                                                                 temp_values.bit11hfname = hf_bit11outflags;
3943                                                                 temp_values.bit12 = "Not Defined";
3944                                                                 temp_values.bit12hfname = hf_bit12outflags;
3945                                                                 temp_values.bit13 = "Not Defined";
3946                                                                 temp_values.bit13hfname = hf_bit13outflags;
3947                                                                 temp_values.bit14 = "Not Defined";
3948                                                                 temp_values.bit14hfname = hf_bit14outflags;
3949                                                                 temp_values.bit15 = "Not Defined";
3950                                                                 temp_values.bit15hfname = hf_bit15outflags;
3951                                                                 temp_values.bit16 = "Not Defined";
3952                                                                 temp_values.bit16hfname = hf_bit16outflags;
3953                                                                 process_bitfield(ntree, tvb, &temp_values);
3954                                                                 ioffset = ioffset + 4;        
3955                                                                 break;
3956                                                         case 0x00000002:                /*p3values.bit2 = "Entry ID"*/
3957                                                                 value1 = tvb_get_letohl(tvb, ioffset);
3958                                                                 proto_tree_add_uint_format(ntree, hf_nds_eid, tvb, ioffset,
3959                                                                         4, value1, "Entry ID %08x", value1);
3960                                                                 ioffset = ioffset + 4;        
3961                                                                 break;
3962                                                         case 0x00000004:                /*p3values.bit3 = "Replica State"*/
3963                                                                 value1 = tvb_get_letohl(tvb, ioffset);
3964                                                                 temp_values.vstring = (char *)match_strval(value1, nds_replica_state);
3965                                                                 if (temp_values.vstring == NULL)
3966                                                                 {
3967                                                                         temp_values.vstring = "No Replica State Found";
3968                                                                 }        
3969                                                                 proto_tree_add_string(ntree, hf_replica_state, tvb, ioffset, 
3970                                                                 4, temp_values.vstring);
3971                                                                 ioffset = ioffset + 4;
3972                                                                 break;
3973                                                         case 0x0000008:                 /*p3values.bit4 = "Modification Timestamp"*/
3974                                                                 value1 = tvb_get_letohl(tvb, ioffset);
3975                                                                 proto_tree_add_uint_format(ntree, hf_es_seconds, tvb, ioffset,
3976                                                                         4, value1, "Seconds %d", value1);
3977                                                                 ioffset = ioffset + 4;        
3978                                                                 replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
3979                                                                 proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset, 
3980                                                                         2, replica_num);
3981                                                                 ioffset = ioffset + 2;
3982                                                                 event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
3983                                                                 proto_tree_add_item(ntree, hf_nds_event_num, tvb, ioffset, 
3984                                                                         2, event_num);
3985                                                                 ioffset = ioffset + 2;
3986                                                                 break;
3987                                                         case 0x00000010:                /*p3values.bit5 = "Purge Time"*/
3988                                                                 value1 = tvb_get_letohl(tvb, ioffset);
3989                                                                 proto_tree_add_uint_format(ntree, hf_nds_purge, tvb, ioffset,
3990                                                                         4, value1, "Purge Time %d", value1);
3991                                                                 ioffset = ioffset + 4;        
3992                                                                 break;
3993                                                         case 0x00000020:                /*p3values.bit6 = "Local Partition ID"*/
3994                                                                 value1 = tvb_get_letohl(tvb, ioffset);
3995                                                                 proto_tree_add_uint_format(ntree, hf_nds_local_partition, tvb, ioffset,
3996                                                                         4, value1, "Local Partition ID %08x", value1);
3997                                                                 ioffset = ioffset + 4;        
3998                                                                 break;
3999                                                         case 0x00000040:                /*p3values.bit7 = "Distinguished Name"*/
4000                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4001                                                                 ioffset = ioffset + 4;
4002                                                                 get_string(tvb, ioffset, value1, mval_buf.buffer);
4003                                                                 temp_values.vstring = mval_buf.buffer;                                
4004                                                                 proto_tree_add_string(ntree, hf_nds_name, tvb, ioffset, 
4005                                                                         value1, temp_values.vstring);
4006                                                                 ioffset = ioffset + value1;        
4007                                                                 break;
4008                                                         case 0x00000080:                /*p3values.bit8 = "Replica Type & State"*/
4009                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4010                                                                 value2 = value1 & 0x00ff;
4011                                                                 temp_values.vstring = (char *)match_strval(value2, nds_replica_type);
4012                                                                 if (temp_values.vstring == NULL)
4013                                                                 {
4014                                                                         temp_values.vstring = "No Replica Type Found";
4015                                                                 }        
4016                                                                 proto_tree_add_string(ntree, hf_replica_type, tvb, ioffset, 
4017                                                                 4, temp_values.vstring);
4018                                                                 value3 = value1 & 0xff00;
4019                                                                 temp_values.vstring = (char *)match_strval(value3, nds_replica_state);
4020                                                                 if (temp_values.vstring == NULL)
4021                                                                 {
4022                                                                         temp_values.vstring = "No Replica State Found";
4023                                                                 }        
4024                                                                 proto_tree_add_string(ntree, hf_replica_state, tvb, ioffset, 
4025                                                                 4, temp_values.vstring);
4026                                                                 ioffset = ioffset + 4;
4027                                                                 break;
4028                                                         case 0x00000100:                /*p3values.bit9 = "Partition Busy"*/
4029                                                                 value1 = tvb_get_letohs(tvb, ioffset);
4030                                                                 proto_tree_add_boolean(ntree, hf_partition_busy, tvb, ioffset, 4, value1);
4031                                                                 ioffset += 4;
4032                                                                 break;
4033                                                         default:
4034                                                                 break;
4035                                                         
4036                                                 }
4037                                         }
4038                                         bvalue = bvalue*2;
4039                                         ioffset += align_4(tvb, ioffset);
4040                                         if(tvb_length_remaining(tvb, ioffset) < 4 )
4041                                         {
4042                                                 break;
4043                                         }
4044                                 }                
4045                                 if(tvb_length_remaining(tvb, ioffset) < 4 )
4046                                 {
4047                                         break;
4048                                 }
4049                         }
4050                         break;
4051
4052                 case MVTYPE_MODIFY_ATTR_REQUEST: /* Modify Attribute Request */
4053                         for (i = 0 ; i < values->vvalue; i++ ) 
4054                         {
4055                                ioffset += align_4(tvb, ioffset);
4056                                value1 = tvb_get_letohl(tvb, ioffset);
4057                                valuestr = match_strval(value1, nds_kind_of_changes);
4058                                if (valuestr == NULL)
4059                                { 
4060                                                valuestr="(Kind Change Not Found)";
4061                                }
4062                                tvb_ensure_bytes_exist(tvb, ioffset, values->vlength);
4063                                proto_tree_add_uint_format(ntree, hf_nds_uint32value, tvb, ioffset,
4064                                values->vlength, value1, valuestr, value1);
4065                                ioffset = ioffset+4;
4066                                value2 = tvb_get_letohl(tvb, ioffset);
4067                                ioffset = ioffset + 4;
4068                                get_string(tvb, ioffset, value2, mval_buf.buffer);   /* Name of Attribute */
4069                                temp_values.vstring = mval_buf.buffer;                                
4070                                proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset, 
4071                                        value2, temp_values.vstring);
4072                                ioffset = ioffset + value2;
4073                                ioffset += align_4(tvb, ioffset);
4074                                if(value1 != 1 && value1 != 6)
4075                                {
4076                                        values->voffset = ioffset;
4077                                        print_nds_values(ntree, tvb, 9, values);        
4078                                        ioffset = values->voffset;
4079                                }
4080                         }
4081                         break;
4082
4083                 case MVTYPE_ADDR_REFERRAL_REQUEST: /* Address Referral Request */
4084                         for (i = 0 ; i < values->vvalue; i++ ) 
4085                         {
4086         
4087                                value1 = tvb_get_letohl(tvb, ioffset);
4088                                valuestr = match_strval(value1, nds_protocol_type);
4089                                if (valuestr == NULL)
4090                                { 
4091                                                valuestr="(Undefined Protocol)";
4092                                }
4093                                tvb_ensure_bytes_exist(tvb, ioffset, values->vlength);
4094                                proto_tree_add_uint_format(ntree, hf_nds_uint32value, tvb, ioffset,
4095                                values->vlength, value1, valuestr, value1);
4096                                ioffset = ioffset+4;
4097                         }
4098                         break;
4099
4100                 case MVTYPE_ADDR_REFERRAL_REPLY: /* Address Referral Reply */
4101                         number_of_referrals = values->vvalue;
4102                         
4103                         for (r = 1 ; r <= number_of_referrals; r++ )
4104                         {
4105                                 aitem = proto_tree_add_uint_format(ntree, hf_referral_record, tvb, 6, 0,
4106                                 r, "NDS Referral Record #%u", r);
4107                                 atree = proto_item_add_subtree(aitem, ett_nds);
4108                                 
4109                                 value1 = tvb_get_letohl(tvb, ioffset);
4110                                 
4111                                 proto_tree_add_uint_format(atree, hf_referral_addcount, tvb, ioffset, 4,
4112                                         value1, "Number of Addresses in Referral - %d", value1);
4113                                      
4114                                 ioffset = ioffset + 4;
4115                                 for (i = 1 ; i <= value1; i++ ) 
4116                                 {
4117                                         value2 = tvb_get_letohl(tvb, ioffset);
4118                                         valuestr = match_strval(value2, nds_protocol_type);
4119                                         if (valuestr == NULL)
4120                                         { 
4121                                                valuestr="(Undefined Protocol)";
4122                                         }
4123                                         tvb_ensure_bytes_exist(tvb, ioffset, values->vlength);
4124                                         proto_tree_add_uint_format(atree, hf_nds_uint32value, tvb, ioffset,
4125                                         values->vlength, value2, valuestr, value2);
4126                                         ioffset = ioffset+4;
4127                                         value3 = tvb_get_letohl(tvb, ioffset);
4128                                         ioffset = ioffset+4;
4129                                         switch (value2)
4130                                         { 
4131                                                 case NDS_PTYPE_IPX:
4132                                                         proto_tree_add_item(atree, hf_nds_net, tvb, ioffset, 4, FALSE);
4133                                                         proto_tree_add_item(atree, hf_nds_node, tvb, ioffset+4, 6, FALSE);
4134                                                         proto_tree_add_item(atree, hf_nds_socket, tvb, ioffset+10, 2, FALSE);
4135                                                         break;
4136                                                 case NDS_PTYPE_IP:
4137                                                         proto_tree_add_item(atree, hf_nds_port, tvb, ioffset, 2, FALSE);
4138                                                         proto_tree_add_item(atree, hf_add_ref_ip, tvb, ioffset+2, 4, FALSE);
4139                                                         break;
4140                                                 case NDS_PTYPE_UDP:
4141                                                         proto_tree_add_item(atree, hf_nds_port, tvb, ioffset, 2, FALSE);
4142                                                         proto_tree_add_item(atree, hf_add_ref_udp, tvb, ioffset+2, 4, FALSE);
4143                                                         break;
4144                                                 case NDS_PTYPE_TCP:
4145                                                         proto_tree_add_item(atree, hf_nds_port, tvb, ioffset, 2, FALSE);
4146                                                         proto_tree_add_item(atree, hf_add_ref_tcp, tvb, ioffset+2, 4, FALSE);
4147                                                         break;
4148                                                 case NDS_PTYPE_URL:
4149                                                         get_string(tvb, ioffset, value3, values->vstring);
4150                                                         proto_tree_add_string(atree, hf_value_string, tvb, ioffset, 
4151                                                                 value3, values->vstring);
4152                                                         break;
4153                                                 default:
4154                                                         break;
4155                                         }
4156                                         ioffset = ioffset + value3;    
4157                                         ioffset += align_4(tvb, ioffset);
4158                                 }
4159                 
4160                         }
4161                         break;
4162
4163                 case MVTYPE_LOC_ADDR_REFERRAL_REPLY: /* Local Address Referral Reply */
4164                         number_of_referrals = values->vvalue;
4165
4166                         for (r = 1 ; r <= number_of_referrals; r++ )
4167                         {
4168                                 aitem = proto_tree_add_uint_format(ntree, hf_referral_record, tvb, 6, 0,
4169                                 r, "NDS Referral Record #%u", r);
4170                                 atree = proto_item_add_subtree(aitem, ett_nds);
4171                                 
4172                                 value2 = tvb_get_letohl(tvb, ioffset);
4173                                 valuestr = match_strval(value2, nds_protocol_type);
4174                                 if (valuestr == NULL)
4175                                 { 
4176                                         valuestr="(Undefined Protocol)";
4177                                 }
4178                                 tvb_ensure_bytes_exist(tvb, ioffset, values->vlength);
4179                                 proto_tree_add_uint_format(atree, hf_nds_uint32value, tvb, ioffset,
4180                                 values->vlength, value2, valuestr, value2);
4181                                 ioffset = ioffset+4;
4182                                 value3 = tvb_get_letohl(tvb, ioffset);
4183                                 ioffset = ioffset+4;
4184                                 
4185                                 switch (value2)
4186                                 { 
4187                                         case NDS_PTYPE_IPX:
4188                                                 proto_tree_add_item(atree, hf_nds_net, tvb, ioffset, 4, FALSE);
4189                                                 proto_tree_add_item(atree, hf_nds_node, tvb, ioffset+4, 6, FALSE);
4190                                                 proto_tree_add_item(atree, hf_nds_socket, tvb, ioffset+10, 2, FALSE);
4191                                                 break;
4192                                         case NDS_PTYPE_IP:
4193                                                 proto_tree_add_item(atree, hf_nds_port, tvb, ioffset, 2, FALSE);
4194                                                 proto_tree_add_item(atree, hf_add_ref_ip, tvb, ioffset+2, 4, FALSE);
4195                                                 break;
4196                                         case NDS_PTYPE_UDP:
4197                                                 proto_tree_add_item(atree, hf_nds_port, tvb, ioffset, 2, FALSE);
4198                                                 proto_tree_add_item(atree, hf_add_ref_udp, tvb, ioffset+2, 4, FALSE);
4199                                                 break;
4200                                         case NDS_PTYPE_TCP:
4201                                                 proto_tree_add_item(atree, hf_nds_port, tvb, ioffset, 2, FALSE);
4202                                                 proto_tree_add_item(atree, hf_add_ref_tcp, tvb, ioffset+2, 4, FALSE);
4203                                                 break;
4204                                         case NDS_PTYPE_URL:
4205                                                 get_string(tvb, ioffset, value3, values->vstring);
4206                                                 proto_tree_add_string(atree, hf_value_string, tvb, ioffset, 
4207                                                       value3, values->vstring);
4208                                                 break;
4209                                         default:
4210                                                 break;
4211                                 }
4212                                 ioffset = ioffset + value3;    
4213                                 ioffset += align_4(tvb, ioffset);
4214                         }
4215                         break;
4216
4217                 case MVTYPE_PROC_ENTRY_SPECIFIERS: /* Process Entry Specifiers */
4218                         value2 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
4219                         values->vstring = (char *)match_strval(value2, es_type);
4220                         if (values->vstring == NULL)
4221                         {
4222                                 values->vstring = "No ES Type Found";
4223                         }        
4224                         esitem = proto_tree_add_string_format(ntree, hf_es_type, tvb, ioffset, 
4225                                 4, values->vstring, "Output Entry Specifier - %s", values->vstring);
4226                         estree = proto_item_add_subtree(esitem, ett_nds);
4227                         ioffset = ioffset + 4;
4228                         ioffset = print_es_type(estree, tvb, values, value2, ioffset);
4229                         value3 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
4230                         values->vstring = (char *)match_strval(value3, es_type);
4231                         if (values->vstring == NULL)
4232                         {
4233                                 values->vstring = "No ES Type Found";
4234                         }        
4235                         esitem = proto_tree_add_string_format(ntree, hf_es_type, tvb, ioffset, 
4236                                 4, values->vstring, "Input Entry Specifier - %s", values->vstring);
4237                         estree = proto_item_add_subtree(esitem, ett_nds);
4238                         ioffset = ioffset + 4;
4239                         ioffset = print_es_type(estree, tvb, values, value3, ioffset);
4240                         /* values.vstring is being overwritten. So store the resolve name to a global value */
4241                         strcpy(mv_resolve_name_string, values->vstring);
4242                         value4 = tvb_get_letohl(tvb, ioffset);
4243                         aitem = proto_tree_add_uint_format(ntree, hf_referral_record, tvb, ioffset, 4,
4244                                 value4, "Referral Protocols - %d", value4);
4245                         atree = proto_item_add_subtree(aitem, ett_nds);
4246                         ioffset += 4;               
4247                         for (i = 0 ; i < value4; i++ ) 
4248                         {
4249                                value5 = tvb_get_letohl(tvb, ioffset);
4250                                valuestr = match_strval(value5, nds_protocol_type);
4251                                if (valuestr == NULL)
4252                                { 
4253                                                valuestr="(Undefined Protocol)";
4254                                }
4255                                proto_tree_add_string_format(atree, hf_value_string, tvb, ioffset,
4256                                4, valuestr, "Protocol -> %s", valuestr);
4257                                ioffset = ioffset+4;
4258                         }
4259                         value6 = tvb_get_letohl(tvb, ioffset);
4260                         aitem = proto_tree_add_uint_format(ntree, hf_referral_record, tvb, ioffset, 4,
4261                                 value6, "Tree Walking Protocols - %d", value6);
4262                         atree = proto_item_add_subtree(aitem, ett_nds);
4263                         ioffset += 4;               
4264                         for (i = 0 ; i < value6; i++ ) 
4265                         {
4266                                value7 = tvb_get_letohl(tvb, ioffset);
4267                                valuestr = match_strval(value7, nds_protocol_type);
4268                                if (valuestr == NULL)
4269                                { 
4270                                                valuestr="(Undefined Protocol)";
4271                                }
4272                                proto_tree_add_string_format(atree, hf_value_string, tvb, ioffset,
4273                                4, valuestr, "Protocol -> %s", valuestr);
4274                                ioffset = ioffset+4;
4275                         }
4276                         break;
4277
4278                 case MVTYPE_PRINT_TIMESTAMP:    /* Print Timestamp */
4279                         replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
4280                         proto_tree_add_item(ncp_tree, hf_nds_replica_num, tvb, ioffset, 
4281                                 2, replica_num);
4282                         ioffset = ioffset + 2;
4283                         event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
4284                         proto_tree_add_item(ncp_tree, hf_nds_event_num, tvb, ioffset, 
4285                                 2, event_num);
4286                         ioffset = ioffset + 2;
4287                         /* fall through */
4288
4289                 case MVTYPE_LIST_PARTITIONS:    /* List Partitions */
4290                         number_of_referrals = values->vvalue;
4291                         /* A bad packet could put us in a tight loop so trap for anything
4292                          * over 256 referals. 
4293                          */
4294                         if (number_of_referrals > 256) {
4295                             proto_tree_add_text(ntree, tvb, 0, 0, "[ Bad referal at offset: %u ]", ioffset);
4296                             THROW(ReportedBoundsError);
4297                             break;
4298                         }
4299                         for (i = 0; i < number_of_referrals; i++)
4300                         {        
4301                                 bvalue = 0x00000001;
4302                 
4303                                 for (r = 0 ; r < 32; r++ ) 
4304                                 {
4305                                         oldioffset = ioffset;
4306                                         if (values->vflags & bvalue) 
4307                                         {
4308                                                 switch(bvalue)
4309                                                 {
4310                                                         case 0x00000001:                /* Information Flags */
4311                                                                 temp_values.vvalue = tvb_get_letohs(tvb, ioffset);
4312                                                                 temp_values.vtype = VTYPE_BITFIELD;
4313                                                                 temp_values.vstring = mval_buf.buffer;
4314                                                                 temp_values.vdesc = "Information Flags (low) Byte:";
4315                                                                 temp_values.vlength = 2;
4316                                                                 temp_values.hfname= hf_nds_rflags;
4317                                                                 temp_values.voffset = ioffset;
4318                                                                 temp_values.bit1 = "Output Flags";
4319                                                                 temp_values.bit1hfname = hf_bit1infoflagsl;
4320                                                                 temp_values.bit2 = "Entry ID";
4321                                                                 temp_values.bit2hfname = hf_bit2infoflagsl;
4322                                                                 temp_values.bit3 = "Entry Flags";
4323                                                                 temp_values.bit3hfname = hf_bit3infoflagsl;
4324                                                                 temp_values.bit4 = "Subordinate Count";
4325                                                                 temp_values.bit4hfname = hf_bit4infoflagsl;
4326                                                                 temp_values.bit5 = "Modification Time";
4327                                                                 temp_values.bit5hfname = hf_bit5infoflagsl;
4328                                                                 temp_values.bit6 = "Modification Timestamp";
4329                                                                 temp_values.bit6hfname = hf_bit6infoflagsl;
4330                                                                 temp_values.bit7 = "Creation Timestamp";
4331                                                                 temp_values.bit7hfname = hf_bit7infoflagsl;
4332                                                                 temp_values.bit8 = "Partition Root ID";
4333                                                                 temp_values.bit8hfname = hf_bit8infoflagsl;
4334                                                                 temp_values.bit9 = "Parent ID";
4335                                                                 temp_values.bit9hfname = hf_bit9infoflagsl;
4336                                                                 temp_values.bit10 = "Revision Count";
4337                                                                 temp_values.bit10hfname = hf_bit10infoflagsl;
4338                                                                 temp_values.bit11 = "Replica Type";
4339                                                                 temp_values.bit11hfname = hf_bit11infoflagsl;
4340                                                                 temp_values.bit12 = "Base Class";
4341                                                                 temp_values.bit12hfname = hf_bit12infoflagsl;
4342                                                                 temp_values.bit13 = "Relative Distinguished Name";
4343                                                                 temp_values.bit13hfname = hf_bit13infoflagsl;
4344                                                                 temp_values.bit14 = "Distinguished Name";
4345                                                                 temp_values.bit14hfname = hf_bit14infoflagsl;
4346                                                                 temp_values.bit15 = "Root Distinguished Name";
4347                                                                 temp_values.bit15hfname = hf_bit15infoflagsl;
4348                                                                 temp_values.bit16 = "Parent Distinguished Name";
4349                                                                 temp_values.bit16hfname = hf_bit16infoflagsl;
4350                                                                 process_bitfield(ntree, tvb, &temp_values);
4351                                                                 ioffset = ioffset+2;
4352                                                                 temp_values.vvalue = tvb_get_letohs(tvb, ioffset);
4353                                                                 temp_values.vtype = VTYPE_BITFIELD;
4354                                                                 temp_values.vstring = mval_buf.buffer;
4355                                                                 temp_values.vdesc = "Information Flags (high) Byte:";
4356                                                                 temp_values.vlength = 2;
4357                                                                 temp_values.hfname= hf_nds_rflags;
4358                                                                 temp_values.voffset = ioffset;
4359                                                                 temp_values.bit1 = "Purge Time";
4360                                                                 temp_values.bit1hfname = hf_bit1infoflagsh;
4361                                                                 temp_values.bit2 = "Dereference Base Class";
4362                                                                 temp_values.bit2hfname = hf_bit2infoflagsh;
4363                                                                 temp_values.bit3 = "Not Defined";
4364                                                                 temp_values.bit3hfname = hf_bit3infoflagsh;
4365                                                                 temp_values.bit4 = "Not Defined";
4366                                                                 temp_values.bit4hfname = hf_bit4infoflagsh;
4367                                                                 temp_values.bit5 = "Not Defined";
4368                                                                 temp_values.bit5hfname = hf_bit5infoflagsh;
4369                                                                 temp_values.bit6 = "Not Defined";
4370                                                                 temp_values.bit6hfname = hf_bit6infoflagsh;
4371                                                                 temp_values.bit7 = "Not Defined";
4372                                                                 temp_values.bit7hfname = hf_bit7infoflagsh;
4373                                                                 temp_values.bit8 = "Not Defined";
4374                                                                 temp_values.bit8hfname = hf_bit8infoflagsh;
4375                                                                 temp_values.bit9 = "Not Defined";
4376                                                                 temp_values.bit9hfname = hf_bit9infoflagsh;
4377                                                                 temp_values.bit10 = "Not Defined";
4378                                                                 temp_values.bit10hfname = hf_bit10infoflagsh;
4379                                                                 temp_values.bit11 = "Not Defined";
4380                                                                 temp_values.bit11hfname = hf_bit11infoflagsh;
4381                                                                 temp_values.bit12 = "Not Defined";
4382                                                                 temp_values.bit12hfname = hf_bit12infoflagsh;
4383                                                                 temp_values.bit13 = "Not Defined";
4384                                                                 temp_values.bit13hfname = hf_bit13infoflagsh;
4385                                                                 temp_values.bit14 = "Not Defined";
4386                                                                 temp_values.bit14hfname = hf_bit14infoflagsh;
4387                                                                 temp_values.bit15 = "Not Defined";
4388                                                                 temp_values.bit15hfname = hf_bit15infoflagsh;
4389                                                                 temp_values.bit16 = "Not Defined";
4390                                                                 temp_values.bit16hfname = hf_bit16infoflagsh;
4391                                                                 process_bitfield(ntree, tvb, &temp_values);
4392                                                                 ioffset = ioffset+2;
4393                                                                 break;
4394                                                         case 0x00000002:                /* Entry ID */
4395                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4396                                                                 proto_tree_add_uint_format(ntree, hf_nds_eid, tvb, ioffset,
4397                                                                         4, value1, "Entry ID %08x", value1);
4398                                                                 ioffset = ioffset + 4;        
4399                                                                 break;
4400                                                         case 0x00000004:                /* Entry Flags */
4401                                                                 temp_values.vvalue = tvb_get_letohl(tvb, ioffset);
4402                                                                 temp_values.vtype = VTYPE_BITFIELD;
4403                                                                 temp_values.vstring = mval_buf.buffer;
4404                                                                 temp_values.vdesc = "Entry Flags:";
4405                                                                 temp_values.vlength = 2;
4406                                                                 temp_values.hfname= hf_nds_eflags;
4407                                                                 temp_values.voffset = ioffset;
4408                                                                 temp_values.bit1 = "Alias Entry";
4409                                                                 temp_values.bit1hfname = hf_bit1eflags;
4410                                                                 temp_values.bit2 = "Partition Root";
4411                                                                 temp_values.bit2hfname = hf_bit2eflags;
4412                                                                 temp_values.bit3 = "Container Entry";
4413                                                                 temp_values.bit3hfname = hf_bit3eflags;
4414                                                                 temp_values.bit4 = "Container Alias";
4415                                                                 temp_values.bit4hfname = hf_bit4eflags;
4416                                                                 temp_values.bit5 = "Matches List Filter";
4417                                                                 temp_values.bit5hfname = hf_bit5eflags;
4418                                                                 temp_values.bit6 = "Reference Entry";
4419                                                                 temp_values.bit6hfname = hf_bit6eflags;
4420                                                                 temp_values.bit7 = "40x Reference Entry";
4421                                                                 temp_values.bit7hfname = hf_bit7eflags;
4422                                                                 temp_values.bit8 = "Back Linked";
4423                                                                 temp_values.bit8hfname = hf_bit8eflags;
4424                                                                 temp_values.bit9 = "New Entry";
4425                                                                 temp_values.bit9hfname = hf_bit9eflags;
4426                                                                 temp_values.bit10 = "Temporary Reference";
4427                                                                 temp_values.bit10hfname = hf_bit10eflags;
4428                                                                 temp_values.bit11 = "Audited";
4429                                                                 temp_values.bit11hfname = hf_bit11eflags;
4430                                                                 temp_values.bit12 = "Entry Not Present";
4431                                                                 temp_values.bit12hfname = hf_bit12eflags;
4432                                                                 temp_values.bit13 = "Entry Verify CTS";
4433                                                                 temp_values.bit13hfname = hf_bit13eflags;
4434                                                                 temp_values.bit14 = "Entry Damaged";
4435                                                                 temp_values.bit14hfname = hf_bit14eflags;
4436                                                                 temp_values.bit15 = "Not Defined";
4437                                                                 temp_values.bit15hfname = hf_bit15eflags;
4438                                                                 temp_values.bit16 = "Not Defined";
4439                                                                 temp_values.bit16hfname = hf_bit16eflags;
4440                                                                 process_bitfield(ntree, tvb, &temp_values);
4441                                                                 ioffset = ioffset+4;
4442                                                                 break;
4443                                                         case 0x0000008:                 /* Subordinate Count */
4444                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4445                                                                 proto_tree_add_uint_format(ntree, hf_sub_count, tvb, ioffset,
4446                                                                         4, value1, "Subordinate Count %d", value1);
4447                                                                 ioffset = ioffset + 4;        
4448                                                                 break;
4449                                                         case 0x0000010:                 /* Modification Time */
4450                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4451                                                                 proto_tree_add_uint_format(ntree, hf_es_seconds, tvb, ioffset,
4452                                                                         4, value1, "Modification Time in Seconds %d", value1);
4453                                                                 ioffset = ioffset + 4;        
4454                                                                 break;
4455                                                         case 0x0000020:                 /* Modification Timestamp */
4456                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4457                                                                 proto_tree_add_uint_format(ntree, hf_es_seconds, tvb, ioffset,
4458                                                                         4, value1, "Modification Timestamp Seconds %d", value1);
4459                                                                 ioffset = ioffset + 4;        
4460                                                                 replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
4461                                                                 proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset, 
4462                                                                         2, replica_num);
4463                                                                 ioffset = ioffset + 2;
4464                                                                 event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
4465                                                                 proto_tree_add_item(ntree, hf_nds_event_num, tvb, ioffset, 
4466                                                                         2, event_num);
4467                                                                 ioffset = ioffset + 2;
4468                                                                 break;
4469                                                         case 0x0000040:                 /* Creation Timestamp */
4470                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4471                                                                 proto_tree_add_uint_format(ntree, hf_es_seconds, tvb, ioffset,
4472                                                                         4, value1, "Creation Timestamp Seconds %d", value1);
4473                                                                 ioffset = ioffset + 4;        
4474                                                                 replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
4475                                                                 proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset, 
4476                                                                         2, replica_num);
4477                                                                 ioffset = ioffset + 2;
4478                                                                 event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
4479                                                                 proto_tree_add_item(ntree, hf_nds_event_num, tvb, ioffset, 
4480                                                                         2, event_num);
4481                                                                 ioffset = ioffset + 2;
4482                                                                 break;
4483                                                         case 0x00000080:                /* Partition Root ID */
4484                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4485                                                                 proto_tree_add_uint_format(ntree, hf_nds_partition_root_id, tvb, ioffset,
4486                                                                         4, value1, "Partition Root ID %08x", value1);
4487                                                                 ioffset = ioffset + 4;        
4488                                                                 break;
4489                                                         case 0x00000100:                /* Parent ID */
4490                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4491                                                                 proto_tree_add_uint_format(ntree, hf_nds_parent, tvb, ioffset,
4492                                                                         4, value1, "Parent ID %08x", value1);
4493                                                                 ioffset = ioffset + 4;        
4494                                                                 break;
4495                                                         case 0x00000200:                /* Revision Count */
4496                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4497                                                                 proto_tree_add_uint_format(ntree, hf_nds_revision, tvb, ioffset,
4498                                                                         4, value1, "Revision Count %d", value1);
4499                                                                 ioffset = ioffset + 4;        
4500                                                                 break;
4501                                                         case 0x00000400:                /* Replica Type & State */
4502                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4503                                                                 value2 = value1 & 0x00ff;
4504                                                                 temp_values.vstring = (char *)match_strval(value2, nds_replica_type);
4505                                                                 if (temp_values.vstring == NULL)
4506                                                                 {
4507                                                                         temp_values.vstring = "No Replica Type Found";
4508                                                                 }        
4509                                                                 proto_tree_add_string(ntree, hf_replica_type, tvb, ioffset, 
4510                                                                 4, temp_values.vstring);
4511                                                                 value3 = value1 & 0xff00;
4512                                                                 temp_values.vstring = (char *)match_strval(value3, nds_replica_state);
4513                                                                 if (temp_values.vstring == NULL)
4514                                                                 {
4515                                                                         temp_values.vstring = "No Replica State Found";
4516                                                                 }        
4517                                                                 proto_tree_add_string(ntree, hf_replica_state, tvb, ioffset, 
4518                                                                 4, temp_values.vstring);
4519                                                                 ioffset = ioffset + 4;
4520                                                                 break;
4521                                                         case 0x00000800:                /* Base Class */
4522                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4523                                                                 ioffset = ioffset + 4;
4524                                                                 get_string(tvb, ioffset, value1, mval_buf.buffer);
4525                                                                 temp_values.vstring = mval_buf.buffer;                                
4526                                                                 proto_tree_add_string(ntree, hf_nds_base, tvb, ioffset, 
4527                                                                         value1, temp_values.vstring);
4528                                                                 ioffset = ioffset + value1;        
4529                                                                 break;
4530                                                         case 0x00001000:                /* Relative Distinguished Name */
4531                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4532                                                                 ioffset = ioffset + 4;
4533                                                                 get_string(tvb, ioffset, value1, mval_buf.buffer);
4534                                                                 temp_values.vstring = mval_buf.buffer;
4535                                                                 proto_tree_add_string(ntree, hf_nds_relative_dn, tvb, ioffset, 
4536                                                                         value1, temp_values.vstring);
4537                                                                 ioffset = ioffset + value1;        
4538                                                                 break;
4539                                                         case 0x00002000:                /* Distinguished Name */
4540                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4541                                                                 ioffset = ioffset + 4;
4542                                                                 get_string(tvb, ioffset, value1, mval_buf.buffer);
4543                                                                 temp_values.vstring = mval_buf.buffer;                                
4544                                                                 proto_tree_add_string(ntree, hf_nds_name, tvb, ioffset, 
4545                                                                         value1, temp_values.vstring);
4546                                                                 ioffset = ioffset + value1;        
4547                                                                 break;
4548                                                         case 0x00004000:                /* Root Distinguished Name */
4549                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4550                                                                 ioffset = ioffset + 4;
4551                                                                 get_string(tvb, ioffset, value1, mval_buf.buffer);
4552                                                                 temp_values.vstring = mval_buf.buffer;                                
4553                                                                 proto_tree_add_string(ntree, hf_nds_name, tvb, ioffset, 
4554                                                                         value1, temp_values.vstring);
4555                                                                 ioffset = ioffset + value1;        
4556                                                                 break;
4557                                                         case 0x00008000:                /* Parent Distinguished Name */
4558                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4559                                                                 ioffset = ioffset + 4;
4560                                                                 get_string(tvb, ioffset, value1, mval_buf.buffer);
4561                                                                 temp_values.vstring = mval_buf.buffer;                                
4562                                                                 proto_tree_add_string(ntree, hf_nds_name, tvb, ioffset, 
4563                                                                         value1, temp_values.vstring);
4564                                                                 ioffset = ioffset + value1;        
4565                                                                 break;
4566                                                         case 0x00010000:                /* Purge Time */
4567                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4568                                                                 proto_tree_add_uint_format(ntree, hf_nds_purge, tvb, ioffset,
4569                                                                         4, value1, "Purge Time %d", value1);
4570                                                                 ioffset = ioffset + 4;        
4571                                                                 break;
4572                                                         case 0x00020000:                /* Dereference Base Class */
4573                                                                 value1 = tvb_get_letohl(tvb, ioffset);
4574                                                                 ioffset = ioffset + 4;
4575                                                                 get_string(tvb, ioffset, value1, mval_buf.buffer);
4576                                                                 temp_values.vstring = mval_buf.buffer;                                
4577                                                                 proto_tree_add_string(ntree, hf_deref_base, tvb, ioffset, 
4578                                                                         value1, temp_values.vstring);
4579                                                                 ioffset = ioffset + value1;        
4580                                                                 break;
4581                                                         default:
4582                                                                 break;
4583                                                         
4584                                                 }
4585                                                 ioffset += align_4(tvb, ioffset);
4586                                         }
4587                                         bvalue = bvalue*2;
4588                                         /* We could loop forever so check to see if bvalue has wrapped to 0.
4589                                          * if so then just abort loop.
4590                                          */
4591                                         if (bvalue==0) {
4592                                                break;
4593                                         }
4594                                         if(tvb_length_remaining(tvb, ioffset) < 4 )
4595                                         {
4596                                                 break;
4597                                         }
4598                                 }        
4599                                 if(tvb_length_remaining(tvb, ioffset) < 4 )
4600                                 {
4601                                         break;
4602                                 }
4603                         }
4604                         break;                
4605
4606                 case MVTYPE_CLASS_NAMES:        /* Class Names */
4607                         number_of_referrals = values->vvalue;
4608                         for (i = 0; i < number_of_referrals; i++)
4609                         {        
4610                                 ioffset += align_4(tvb, ioffset);
4611                                 value1 = tvb_get_letohl(tvb, ioffset);
4612                                 ioffset = ioffset + 4;
4613                                 get_string(tvb, ioffset, value1, mval_buf.buffer);
4614                                 temp_values.vstring = mval_buf.buffer;                                
4615                                 sub1item = proto_tree_add_string(ntree, hf_nds_base_class, tvb, ioffset, 
4616                                         value1, temp_values.vstring);
4617                                 sub1tree = proto_item_add_subtree(sub1item, ett_nds);
4618                                 ioffset = ioffset + value1;        
4619                                 ioffset += align_4(tvb, ioffset);
4620                                 if(values->vflags != 0)
4621                                 {
4622                                         temp_values.vvalue = tvb_get_letohl(tvb, ioffset);
4623                                         temp_values.vtype = VTYPE_BITFIELD;
4624                                         temp_values.vstring = mval_buf.buffer;
4625                                         temp_values.vdesc = "Class Flags:";
4626                                         temp_values.vlength = 2;
4627                                         temp_values.hfname= hf_nds_cflags;
4628                                         temp_values.voffset = ioffset;
4629                                         temp_values.bit1 = "Ambiguous Containment";
4630                                         temp_values.bit1hfname = hf_bit1cflags;
4631                                         temp_values.bit2 = "Ambiguous Naming";
4632                                         temp_values.bit2hfname = hf_bit2cflags;
4633                                         temp_values.bit3 = "Class Definition Cannot be Removed";
4634                                         temp_values.bit3hfname = hf_bit3cflags;
4635                                         temp_values.bit4 = "Effective Class";
4636                                         temp_values.bit4hfname = hf_bit4cflags;
4637                                         temp_values.bit5 = "Container Class";
4638                                         temp_values.bit5hfname = hf_bit5cflags;
4639                                         temp_values.bit6 = "Not Defined";
4640                                         temp_values.bit6hfname = hf_bit6cflags;
4641                                         temp_values.bit7 = "Not Defined";
4642                                         temp_values.bit7hfname = hf_bit7cflags;
4643                                         temp_values.bit8 = "Not Defined";
4644                                         temp_values.bit8hfname = hf_bit8cflags;
4645                                         temp_values.bit9 = "Not Defined";
4646                                         temp_values.bit9hfname = hf_bit9cflags;
4647                                         temp_values.bit10 = "Not Defined";
4648                                         temp_values.bit10hfname = hf_bit10cflags;
4649                                         temp_values.bit11 = "Not Defined";
4650                                         temp_values.bit11hfname = hf_bit11cflags;
4651                                         temp_values.bit12 = "Not Defined";
4652                                         temp_values.bit12hfname = hf_bit12cflags;
4653                                         temp_values.bit13 = "Not Defined";
4654                                         temp_values.bit13hfname = hf_bit13cflags;
4655                                         temp_values.bit14 = "Not Defined";
4656                                         temp_values.bit14hfname = hf_bit14cflags;
4657                                         temp_values.bit15 = "Not Defined";
4658                                         temp_values.bit15hfname = hf_bit15cflags;
4659                                         temp_values.bit16 = "Not Defined";
4660                                         temp_values.bit16hfname = hf_bit16cflags;
4661                                         process_bitfield(sub1tree, tvb, &temp_values);
4662                                         ioffset = ioffset+4;
4663                                         if(values->vflags != 5)
4664                                         {
4665                                                 value1 = tvb_get_letohl(tvb, ioffset); /* length of field */
4666                                                 length_remaining = tvb_length_remaining(tvb, ioffset);
4667                                                 if(length_remaining == -1 || value1 > (guint32) length_remaining)
4668                                                 {
4669                                                          break;
4670                                                 }
4671                                                 ioffset += 4;
4672                                                 tvb_ensure_bytes_exist(tvb, ioffset, value1);
4673                                                 proto_tree_add_bytes(sub1tree, hf_nds_asn1, tvb, ioffset, value1, tvb_get_ptr(tvb, ioffset, value1));
4674                                                 ioffset += value1;
4675                                                 ioffset += (value1%2);
4676                                         }
4677                                         if(values->vflags == 1 || values->vflags == 2 || values->vflags == 4)
4678                                         {
4679                                                 value1 = tvb_get_letohl(tvb, ioffset);  /* Super Classes */
4680                                                 sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_purge, tvb, ioffset,
4681                                                         4, value1, "Super Classes %d", value1);
4682                                                 sub2tree = proto_item_add_subtree(sub2item, ett_nds);
4683                                                 ioffset = ioffset + 4;        
4684                                                 for (r = 0; r < value1; r++)
4685                                                 {
4686                                                         value2 = tvb_get_letohl(tvb, ioffset);
4687                                                         ioffset = ioffset + 4;
4688                                                         get_string(tvb, ioffset, value2, mval_buf.buffer);
4689                                                         temp_values.vstring = mval_buf.buffer;                                
4690                                                         proto_tree_add_string(sub2tree, hf_nds_super, tvb, ioffset, 
4691                                                                 value2, temp_values.vstring);
4692                                                         ioffset = ioffset + value2;        
4693                                                         ioffset += align_4(tvb, ioffset);
4694                                                 }        
4695                                                 value1 = tvb_get_letohl(tvb, ioffset);  /* Containment Classes */
4696                                                 sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_purge, tvb, ioffset,
4697                                                         4, value1, "Containment Classes %d", value1);
4698                                                 sub2tree = proto_item_add_subtree(sub2item, ett_nds);
4699                                                 ioffset = ioffset + 4;        
4700                                                 for (r = 0; r < value1; r++)
4701                                                 {
4702                                                         value2 = tvb_get_letohl(tvb, ioffset);
4703                                                         ioffset = ioffset + 4;
4704                                                         get_string(tvb, ioffset, value2, mval_buf.buffer);
4705                                                         temp_values.vstring = mval_buf.buffer;                                
4706                                                         proto_tree_add_string(sub2tree, hf_nds_base_class, tvb, ioffset, 
4707                                                                 value2, temp_values.vstring);
4708                                                         ioffset = ioffset + value2;        
4709                                                         ioffset += align_4(tvb, ioffset);
4710                                                 }        
4711                                                 value1 = tvb_get_letohl(tvb, ioffset);  /* Naming Attributes */
4712                                                 sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_purge, tvb, ioffset,
4713                                                         4, value1, "Naming Attributes %d", value1);
4714                                                 sub2tree = proto_item_add_subtree(sub2item, ett_nds);
4715                                                 ioffset = ioffset + 4;        
4716                                                 for (r = 0; r < value1; r++)
4717                                                 {
4718                                                         value2 = tvb_get_letohl(tvb, ioffset);
4719                                                         ioffset = ioffset + 4;
4720                                                         get_string(tvb, ioffset, value2, mval_buf.buffer);
4721                                                         temp_values.vstring = mval_buf.buffer;                                
4722                                                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset, 
4723                                                                 value2, temp_values.vstring);
4724                                                         ioffset = ioffset + value2;        
4725                                                         ioffset += align_4(tvb, ioffset);
4726                                                 }        
4727                                                 value1 = tvb_get_letohl(tvb, ioffset);  /* Mandatory Attributes */
4728                                                 sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_purge, tvb, ioffset,
4729                                                         4, value1, "Mandatory Attributes %d", value1);
4730                                                 sub2tree = proto_item_add_subtree(sub2item, ett_nds);
4731                                                 ioffset = ioffset + 4;        
4732                                                 for (r = 0; r < value1; r++)
4733                                                 {
4734                                                         value2 = tvb_get_letohl(tvb, ioffset);
4735                                                         ioffset = ioffset + 4;
4736                                                         get_string(tvb, ioffset, value2, mval_buf.buffer);
4737                                                         temp_values.vstring = mval_buf.buffer;                                
4738                                                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset, 
4739                                                                 value2, temp_values.vstring);
4740                                                         ioffset = ioffset + value2;        
4741                                                         ioffset += align_4(tvb, ioffset);
4742                                                 }        
4743                                                 value1 = tvb_get_letohl(tvb, ioffset);  /* Optional Attributes */
4744                                                 sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_purge, tvb, ioffset,
4745                                                         4, value1, "Optional Attributes %d", value1);
4746                                                 sub2tree = proto_item_add_subtree(sub2item, ett_nds);
4747                                                 ioffset = ioffset + 4;        
4748                                                 for (r = 0; r < value1; r++)
4749                                                 {
4750                                                         ioffset += align_4(tvb, ioffset);
4751                                                         value2 = tvb_get_letohl(tvb, ioffset);
4752                                                         ioffset = ioffset + 4;
4753                                                         get_string(tvb, ioffset, value2, mval_buf.buffer);
4754                                                         temp_values.vstring = mval_buf.buffer;                                
4755                                                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset, 
4756                                                                 value2, temp_values.vstring);
4757                                                         ioffset = ioffset + value2;        
4758                                                         if(tvb_length_remaining(tvb, ioffset) < 4 )
4759                                                         {
4760                                                                 break;
4761                                                         }
4762                                                 }        
4763                                         }
4764                                         /*if(values->vflags == 2 || values->vflags == 4)*/   /* Class Definitions of Super Classes */
4765                                         if(values->vflags == 4)   /* Class Definitions of Super Classes */
4766                                         {
4767                                                 value1 = tvb_get_letohl(tvb, ioffset);  /* Containment Classes */
4768                                                 sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_purge, tvb, ioffset,
4769                                                         4, value1, "Containment Classes %d", value1);
4770                                                 sub2tree = proto_item_add_subtree(sub2item, ett_nds);
4771                                                 ioffset = ioffset + 4;        
4772                                                 for (r = 0; r < value1; r++)
4773                                                 {
4774                                                         value2 = tvb_get_letohl(tvb, ioffset);
4775                                                         ioffset = ioffset + 4;
4776                                                         get_string(tvb, ioffset, value2, mval_buf.buffer);
4777                                                         temp_values.vstring = mval_buf.buffer;                                
4778                                                         proto_tree_add_string(sub2tree, hf_nds_base_class, tvb, ioffset, 
4779                                                                 value2, temp_values.vstring);
4780                                                         ioffset = ioffset + value2;        
4781                                                         ioffset += align_4(tvb, ioffset);
4782                                                 }        
4783                                                 value1 = tvb_get_letohl(tvb, ioffset);  /* Naming Attributes */
4784                                                 sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_purge, tvb, ioffset,
4785                                                         4, value1, "Naming Attributes %d", value1);
4786                                                 sub2tree = proto_item_add_subtree(sub2item, ett_nds);
4787                                                 ioffset = ioffset + 4;        
4788                                                 for (r = 0; r < value1; r++)
4789                                                 {
4790                                                         value2 = tvb_get_letohl(tvb, ioffset);
4791                                                         ioffset = ioffset + 4;
4792                                                         get_string(tvb, ioffset, value2, mval_buf.buffer);
4793                                                         temp_values.vstring = mval_buf.buffer;                                
4794                                                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset, 
4795                                                                 value2, temp_values.vstring);
4796                                                         ioffset = ioffset + value2;        
4797                                                         ioffset += align_4(tvb, ioffset);
4798                                                 }        
4799                                                 value1 = tvb_get_letohl(tvb, ioffset);  /* Mandatory Attributes */
4800                                                 sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_purge, tvb, ioffset,
4801                                                         4, value1, "Mandatory Attributes %d", value1);
4802                                                 sub2tree = proto_item_add_subtree(sub2item, ett_nds);
4803                                                 ioffset = ioffset + 4;        
4804                                                 for (r = 0; r < value1; r++)
4805                                                 {
4806                                                         value2 = tvb_get_letohl(tvb, ioffset);
4807                                                         ioffset = ioffset + 4;
4808                                                         get_string(tvb, ioffset, value2, mval_buf.buffer);
4809                                                         temp_values.vstring = mval_buf.buffer;                                
4810                                                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset, 
4811                                                                 value2, temp_values.vstring);
4812                                                         ioffset = ioffset + value2;        
4813                                                         ioffset += align_4(tvb, ioffset);
4814                                                 }        
4815                                                 value1 = tvb_get_letohl(tvb, ioffset);  /* Optional Attributes */
4816                                                 sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_purge, tvb, ioffset,
4817                                                         4, value1, "Optional Attributes %d", value1);
4818                                                 sub2tree = proto_item_add_subtree(sub2item, ett_nds);
4819                                                 ioffset = ioffset + 4;        
4820                                                 for (r = 0; r < value1; r++)
4821                                                 {
4822                                                         value2 = tvb_get_letohl(tvb, ioffset);
4823                                                         ioffset = ioffset + 4;
4824                                                         get_string(tvb, ioffset, value2, mval_buf.buffer);
4825                                                         temp_values.vstring = mval_buf.buffer;                                
4826                                                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset, 
4827                                                                 value2, temp_values.vstring);
4828                                                         ioffset = ioffset + value2;        
4829                                                         ioffset += align_4(tvb, ioffset);
4830                                                 }        
4831                                                 value1 = tvb_get_letohl(tvb, ioffset);    /* Default ACL */
4832                                                 proto_tree_add_uint_format(sub1tree, hf_nds_eid, tvb, ioffset,
4833                                                         4, value1, "Default ACL %08x", value1);
4834                                                 ioffset = ioffset + 4;        
4835                                                 if(tvb_length_remaining(tvb, ioffset) < 4 )
4836                                                 {
4837                                                         break;
4838                                                 }
4839                                         }
4840                                         if(values->vflags == 5)   /* Base Class Definitions */
4841                                         {
4842                                                 value1 = tvb_get_letohl(tvb, ioffset);         /* Creation Timestamp */
4843                                                 proto_tree_add_uint_format(sub1tree, hf_es_seconds, tvb, ioffset,
4844                                                         4, value1, "Creation Timestamp Seconds %d", value1);
4845                                                 ioffset = ioffset + 4;        
4846                                                 replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
4847                                                 proto_tree_add_item(sub1tree, hf_nds_replica_num, tvb, ioffset, 
4848                                                         2, replica_num);
4849                                                 ioffset = ioffset + 2;
4850                                                 event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
4851                                                 proto_tree_add_item(sub1tree, hf_nds_event_num, tvb, ioffset, 
4852                                                         2, event_num);
4853                                                 ioffset = ioffset + 2;
4854                                                 value1 = tvb_get_letohl(tvb, ioffset);          /* Modification Timestamp */
4855                                                 proto_tree_add_uint_format(sub1tree, hf_es_seconds, tvb, ioffset,
4856                                                         4, value1, "Modification Timestamp Seconds %d", value1);
4857                                                 ioffset = ioffset + 4;        
4858                                                 replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
4859                                                 proto_tree_add_item(sub1tree, hf_nds_replica_num, tvb, ioffset, 
4860                                                         2, replica_num);
4861                                                 ioffset = ioffset + 2;
4862                                                 event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
4863                                                 proto_tree_add_item(sub1tree, hf_nds_event_num, tvb, ioffset, 
4864                                                         2, event_num);
4865                                                 ioffset = ioffset + 2;
4866                                                 /* Class Definition */
4867                                                 value1 = tvb_get_letohl(tvb, ioffset);  /* Super Classes */
4868                                                 sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_purge, tvb, ioffset,
4869                                                         4, value1, "Super Classes %d", value1);
4870                                                 sub2tree = proto_item_add_subtree(sub2item, ett_nds);
4871                                                 ioffset = ioffset + 4;        
4872                                                 for (r = 0; r < value1; r++)
4873                                                 {
4874                                                         value2 = tvb_get_letohl(tvb, ioffset);
4875                                                         ioffset = ioffset + 4;
4876                                                         get_string(tvb, ioffset, value2, mval_buf.buffer);
4877                                                         temp_values.vstring = mval_buf.buffer;                                
4878                                                         proto_tree_add_string(sub2tree, hf_nds_super, tvb, ioffset, 
4879                                                                 value2, temp_values.vstring);
4880                                                         ioffset = ioffset + value2;        
4881                                                         ioffset += align_4(tvb, ioffset);
4882                                                 }        
4883                                                 value1 = tvb_get_letohl(tvb, ioffset);  /* Containment Classes */
4884                                                 sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_purge, tvb, ioffset,
4885                                                         4, value1, "Containment Classes %d", value1);
4886                                                 sub2tree = proto_item_add_subtree(sub2item, ett_nds);
4887                                                 ioffset = ioffset + 4;        
4888                                                 for (r = 0; r < value1; r++)
4889                                                 {
4890                                                         value2 = tvb_get_letohl(tvb, ioffset);
4891                                                         ioffset = ioffset + 4;
4892                                                         get_string(tvb, ioffset, value2, mval_buf.buffer);
4893                                                         temp_values.vstring = mval_buf.buffer;                                
4894                                                         proto_tree_add_string(sub2tree, hf_nds_base_class, tvb, ioffset, 
4895                                                                 value2, temp_values.vstring);
4896                                                         ioffset = ioffset + value2;        
4897                                                         ioffset += align_4(tvb, ioffset);
4898                                                 }        
4899                                                 value1 = tvb_get_letohl(tvb, ioffset);  /* Naming Attributes */
4900                                                 sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_purge, tvb, ioffset,
4901                                                         4, value1, "Naming Attributes %d", value1);
4902                                                 sub2tree = proto_item_add_subtree(sub2item, ett_nds);
4903                                                 ioffset = ioffset + 4;        
4904                                                 for (r = 0; r < value1; r++)
4905                                                 {
4906                                                         value2 = tvb_get_letohl(tvb, ioffset);
4907                                                         ioffset = ioffset + 4;
4908                                                         get_string(tvb, ioffset, value2, mval_buf.buffer);
4909                                                         temp_values.vstring = mval_buf.buffer;                                
4910                                                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset, 
4911                                                                 value2, temp_values.vstring);
4912                                                         ioffset = ioffset + value2;        
4913                                                         ioffset += align_4(tvb, ioffset);
4914                                                 }        
4915                                                 value1 = tvb_get_letohl(tvb, ioffset);  /* Mandatory Attributes */
4916                                                 sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_purge, tvb, ioffset,
4917                                                         4, value1, "Mandatory Attributes %d", value1);
4918                                                 sub2tree = proto_item_add_subtree(sub2item, ett_nds);
4919                                                 ioffset = ioffset + 4;        
4920                                                 for (r = 0; r < value1; r++)
4921                                                 {
4922                                                         value2 = tvb_get_letohl(tvb, ioffset);
4923                                                         ioffset = ioffset + 4;
4924                                                         get_string(tvb, ioffset, value2, mval_buf.buffer);
4925                                                         temp_values.vstring = mval_buf.buffer;                                
4926                                                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset, 
4927                                                                 value2, temp_values.vstring);
4928                                                         ioffset = ioffset + value2;        
4929                                                         ioffset += align_4(tvb, ioffset);
4930                                                 }        
4931                                                 value1 = tvb_get_letohl(tvb, ioffset);  /* Optional Attributes */
4932                                                 sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_purge, tvb, ioffset,
4933                                                         4, value1, "Optional Attributes %d", value1);
4934                                                 sub2tree = proto_item_add_subtree(sub2item, ett_nds);
4935                                                 ioffset = ioffset + 4;        
4936                                                 for (r = 0; r < value1; r++)
4937                                                 {
4938                                                         value2 = tvb_get_letohl(tvb, ioffset);
4939                                                         ioffset = ioffset + 4;
4940                                                         get_string(tvb, ioffset, value2, mval_buf.buffer);
4941                                                         temp_values.vstring = mval_buf.buffer;                                
4942                                                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset, 
4943                                                                 value2, temp_values.vstring);
4944                                                         ioffset = ioffset + value2;        
4945                                                         ioffset += align_4(tvb, ioffset);
4946                                                 }        
4947                                                 value1 = tvb_get_letohl(tvb, ioffset);    /* Default ACL */
4948                                                 proto_tree_add_uint_format(sub1tree, hf_nds_eid, tvb, ioffset,
4949                                                         4, value1, "Default ACL %08x", value1);
4950                                                 ioffset = ioffset + 4;        
4951                                                 if(tvb_length_remaining(tvb, ioffset) < 4 )
4952                                                 {
4953                                                         break;
4954                                                 }
4955                                         }
4956                                 }                                        
4957                         }
4958                         break;                
4959
4960                 case MVTYPE_MODIFY_CLASS:       /* Modify Class */
4961                         for (i = 1 ; i <= values->vvalue; i++ )   /* Attribute Names to add*/
4962                         {
4963                                 ioffset += align_4(tvb, ioffset);
4964                                 value1 = tvb_get_letohl(tvb, ioffset);
4965                                 ioffset = ioffset + 4;
4966                                 get_string(tvb, ioffset, value1, mval_buf.buffer);
4967                                 values->vstring = mval_buf.buffer;                                
4968                                 proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset, 
4969                                         value1, values->vstring);
4970                                 ioffset = ioffset + value1;        
4971                         }
4972                         if(tvb_length_remaining(tvb, ioffset) < 4 )
4973                         {
4974                                 break;
4975                         }
4976                         ioffset += align_4(tvb, ioffset);
4977                         value1 = tvb_get_letohl(tvb, ioffset);    
4978                         proto_tree_add_uint_format(ntree, hf_nds_att_del, tvb, ioffset,
4979                                 4, value1, "Attribute Names to Delete %d", value1);
4980                         ioffset = ioffset + 4;        
4981                         for (i = 1 ; i <= value1; i++ )   /* Attribute Names to delete*/
4982                         {
4983                                 ioffset += align_4(tvb, ioffset);
4984                                 value2 = tvb_get_letohl(tvb, ioffset);
4985                                 ioffset = ioffset + 4;
4986                                 get_string(tvb, ioffset, value2, mval_buf.buffer);
4987                                 values->vstring = mval_buf.buffer;                                
4988                                 proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset, 
4989                                         value2, values->vstring);
4990                                 ioffset = ioffset + value2;        
4991                         }
4992                         if(tvb_length_remaining(tvb, ioffset) < 4 )
4993                         {
4994                                 break;
4995                         }
4996                         ioffset += align_4(tvb, ioffset);
4997                         value1 = tvb_get_letohl(tvb, ioffset);    
4998                         proto_tree_add_uint_format(ntree, hf_nds_acl_add, tvb, ioffset,
4999                                 4, value1, "ACL Templates to Add %d", value1);
5000                         ioffset = ioffset + 4;        
5001                         for (i = 1 ; i <= value1; i++ )   /* ACL templates to add*/
5002                         {
5003                                 ioffset += align_4(tvb, ioffset);
5004                                 value2 = tvb_get_letohl(tvb, ioffset);  /* Attribute Name */
5005                                 ioffset = ioffset + 4;
5006                                 get_string(tvb, ioffset, value2, mval_buf.buffer);
5007                                 values->vstring = mval_buf.buffer;                                
5008                                 proto_tree_add_string(ntree, hf_nds_attribute_dn, tvb, ioffset, 
5009                                         value2, values->vstring);
5010                                 ioffset = ioffset + value2;        
5011                                 ioffset += align_4(tvb, ioffset);
5012                                 value2 = tvb_get_letohl(tvb, ioffset);  /* DN of Trustee */
5013                                 ioffset = ioffset + 4;
5014                                 get_string(tvb, ioffset, value2, mval_buf.buffer);
5015                                 values->vstring = mval_buf.buffer;                                
5016                                 proto_tree_add_string(ntree, hf_nds_trustee_dn, tvb, ioffset, 
5017                                         value2, values->vstring);
5018                                 ioffset = ioffset + value2;        
5019                                 ioffset += align_4(tvb, ioffset);
5020                                 value1 = tvb_get_letohl(tvb, ioffset);    
5021                                 proto_tree_add_uint_format(ntree, hf_nds_privileges, tvb, ioffset,
5022                                         4, value1, "Priviledges 0x%08x", value1);
5023                                 ioffset = ioffset + 4;        
5024                         }
5025                         if(tvb_length_remaining(tvb, ioffset) < 4 )
5026                         {
5027                                 break;
5028                         }
5029                         ioffset += align_4(tvb, ioffset);
5030                         value1 = tvb_get_letohl(tvb, ioffset);    
5031                         proto_tree_add_uint_format(ntree, hf_nds_acl_del, tvb, ioffset,
5032                                 4, value1, "ACL Templates to Delete %d", value1);
5033                         ioffset = ioffset + 4;        
5034                         for (i = 1 ; i <= value1; i++ )   /* ACL templates to delete*/
5035                         {
5036                                 ioffset += align_4(tvb, ioffset);
5037                                 value2 = tvb_get_letohl(tvb, ioffset);  /* Attribute Name */
5038                                 ioffset = ioffset + 4;
5039                                 get_string(tvb, ioffset, value2, mval_buf.buffer);
5040                                 values->vstring = mval_buf.buffer;                                
5041                                 proto_tree_add_string(ntree, hf_nds_attribute_dn, tvb, ioffset, 
5042                                         value2, values->vstring);
5043                                 ioffset = ioffset + value2;        
5044                                 ioffset += align_4(tvb, ioffset);
5045                                 value2 = tvb_get_letohl(tvb, ioffset);  /* DN of Trustee */
5046                                 ioffset = ioffset + 4;
5047                                 get_string(tvb, ioffset, value2, mval_buf.buffer);
5048                                 values->vstring = mval_buf.buffer;                                
5049                                 proto_tree_add_string(ntree, hf_nds_trustee_dn, tvb, ioffset, 
5050                                         value2, values->vstring);
5051                                 ioffset = ioffset + value2;        
5052                                 ioffset += align_4(tvb, ioffset);
5053                                 value1 = tvb_get_letohl(tvb, ioffset);  /* Priviledges */  
5054                                 proto_tree_add_uint_format(ntree, hf_nds_privileges, tvb, ioffset,
5055                                         4, value1, "Priviledges 0x%08x", value1);
5056                                 ioffset = ioffset + 4;        
5057                         }
5058                         break;
5059                 default:        
5060                         break;
5061         }
5062 }
5063
5064 /*
5065  * Defrag logic 
5066  *
5067  * NDS fragment not being set to 0xffffffff indicates we are inside or at the 
5068  * beginning of a fragment. But when the end of the fragment 
5069  * is encounterd the flag is set to 0xffffffff. So we must mark what the
5070  * frame number is of the end fragment so that we will be
5071  * able to redissect if the user clicks on the packet
5072  * or resorts/filters the trace. 
5073  *
5074  * Once we are certain that we are in a fragment sequence
5075  * then we can just process each fragment in this conversation
5076  * until we reach the fragment == 0xffffffff packet. 
5077  *
5078  * We will be able to easily determine if a conversation is a fragment
5079  * with the exception of the last packet in the fragment. So remember
5080  * the last fragment packet number.
5081  *
5082  * Also the NDS dissection requires the values of NDS Verb, Version, and Flags.
5083  * Without this values being remembered from the first request packet then 
5084  * we will be unable to dissect the reply packet. For this reason we remember
5085  * these values on the first fragment and then populate the values in the final
5086  * fragment. We only do this on the first dissection.
5087  */         
5088 void
5089 nds_defrag(tvbuff_t *tvb, packet_info *pinfo, guint32 nw_connection, guint8 sequence, guint16 type, proto_tree *tree, struct novell_tap *ncp_tap)
5090 {
5091     int                 i, frag_count=0;
5092     guint                       len=0;
5093     guint32             tid = 1;
5094     tvbuff_t            *frag_tvb = NULL;
5095     fragment_data       *fd_head;
5096     ncp_req_hash_value  *request_value = NULL;
5097     conversation_t      *conversation;
5098     guint32             nds_frag;
5099     
5100     for (i = 0; i < 99; i++) {
5101         if (!frags[i].nds_fragmented)
5102         {
5103                 frags[i].nds_frag = 0xfffffff0;
5104         }
5105     }
5106     /* Check to see if defragmentation is enabeled in the dissector */
5107     if (!nds_defragment) {
5108         dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
5109         return;
5110     }
5111     /* Has this already been dissected? */
5112     if (!pinfo->fd->flags.visited) {
5113         /* Find the conversation whence the request would have come. */
5114         conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
5115                     PT_NCP, nw_connection, nw_connection, 0);
5116         if (conversation != NULL) {
5117                 /* find the record telling us the request made that caused
5118                    this reply */
5119                 request_value = ncp_hash_lookup(conversation, sequence);
5120                 if (!request_value) {
5121                         dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
5122                         return;
5123                 }
5124                 p_add_proto_data(pinfo->fd, proto_ncp, (void*) request_value);
5125         }
5126         /* else... we haven't seen an NCP Request for that conversation and sequence. */
5127         else
5128         {
5129                 dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
5130                 return;
5131         }
5132     }
5133     else {
5134         request_value = p_get_proto_data(pinfo->fd, proto_ncp);
5135         if (!request_value) {
5136                 dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
5137                 return;
5138         }
5139     }
5140     /* Validate that this is an NDS packet */
5141     /* If this isn't an NDS packet then just return */
5142     if (!request_value->ncp_rec ||
5143          request_value->ncp_rec->func!=104 || request_value->ncp_rec->subfunc!=2) {
5144         dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
5145         return;
5146     }
5147     /* Get the fragment flag */
5148     nds_frag = tvb_get_letohl(tvb, 12);
5149     
5150     /* Now we need to find if this is a new fragment or already one defined. */
5151     /* We currently limit the maximum number of simultaneous fragments to 100. */
5152     for (i=0; i<100; i++)
5153     {
5154         if (frags[i].nds_frag == nds_frag || frags[i].nds_frag == 0xfffffff0)
5155         {
5156                 if (frags[i].nds_frag == 0xfffffff0)
5157                 {
5158                         frags[i].nds_length = 0;
5159                         frags[i].nds_frag = nds_frag;
5160                         frags[i].nds_fragmented = TRUE;
5161                 }
5162                 break;
5163         }
5164     }
5165     if (i > 99)
5166         return;
5167
5168     frag_count = i;
5169     
5170     /* is this the end of an existing fragment or just another reply */
5171     if (nds_frag == 0xffffffff && request_value->nds_frag_num == 0xffffffff)
5172     {
5173                 dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
5174                 return;
5175     } 
5176     
5177     /* Now we process the fragments */
5178     if (request_value->nds_frag || (request_value->nds_end_frag == pinfo->fd->num)) 
5179     {
5180         /* Check to see of this is a fragment. If so then mark as a fragment. */
5181         if (frags[frag_count].nds_frag==0xffffffff) {
5182                 request_value->nds_frag = FALSE;
5183                 /* nds_length of 0 means start of fragment */
5184                 frags[frag_count].nds_length = 0;
5185         }
5186         else
5187         {
5188                 if (frags[frag_count].nds_length == 0)
5189                 {
5190                         frags[frag_count].nds_length = tvb_get_letohl(tvb, 0);
5191                 }
5192         }
5193         /*   
5194          * Fragment
5195          *
5196          */
5197         tid = (pinfo->srcport+pinfo->destport);
5198         len = tvb_reported_length(tvb);
5199         if (len > 0 && tvb_bytes_exist(tvb, 0, len))
5200         {
5201             if (frags[frag_count].nds_length > len)
5202             {
5203                 /* This is the first fragment so remember the verb, version, and flags. */
5204                 frags[frag_count].nds_frag_verb = request_value->nds_request_verb;
5205                 frags[frag_count].nds_frag_version = request_value->nds_version;
5206                 frags[frag_count].nds_frag_flags = request_value->req_nds_flags;
5207                 fd_head = fragment_add_seq_next(tvb, 0, pinfo, tid, nds_fragment_table, nds_reassembled_table, len, request_value->nds_frag);
5208                 frags[frag_count].nds_length = 1;
5209             }
5210             else
5211             {
5212                 /* Subsequent fragments should be offset by 16 since we do not need */
5213                 /* the additional fragment handle and size fields in our composite data */
5214                 fd_head = fragment_add_seq_next(tvb, 16, pinfo, tid, nds_fragment_table, nds_reassembled_table, len-16, request_value->nds_frag);
5215             } 
5216             if (fd_head != NULL) 
5217             {
5218                 /* Is this the last fragment? nds_frag will indicate */
5219                 if (fd_head->next != NULL && !request_value->nds_frag) 
5220                 {
5221                     frag_tvb = tvb_new_real_data(fd_head->data,
5222                         fd_head->len, fd_head->len);
5223                     tvb_set_child_real_data_tvbuff(tvb,
5224                         frag_tvb);
5225                     add_new_data_source(pinfo,
5226                         frag_tvb,
5227                         "Reassembled NDS");
5228                     /* Show all fragments. */
5229                     if (tree) 
5230                     {
5231                         proto_item *frag_tree_item;
5232                         show_fragment_seq_tree(fd_head,
5233                             &nds_frag_items,
5234                             tree, pinfo,
5235                             frag_tvb, &frag_tree_item);
5236                         tid++;
5237                     }
5238                     
5239                     if (!pinfo->fd->flags.visited) 
5240                     {
5241                          /* Now we need to find the original fragment number. */
5242                          /* Get the fragment flag */
5243                          nds_frag = tvb_get_letohl(frag_tvb, 12);
5244                          for (i=0; i<100; i++)
5245                          {
5246                              if (frags[i].nds_frag == nds_frag)
5247                              {
5248                                      break;
5249                              }
5250                          }
5251                          if (i > 99)
5252                              return;
5253                          if (frags[i].nds_frag == 0xffffffff)
5254                          {
5255                                  /* Error can't find fragment */
5256                                  /*DISSECTOR_ASSERT(0);*/
5257                          }
5258                          frag_count = i;
5259                         /* Remember this fragment information so we can dissect.
5260                          * Only do this on the first dissection. After the first 
5261                          * dissection we will just read the memory values. 
5262                          */
5263                         request_value->nds_end_frag = pinfo->fd->num;
5264                         request_value->nds_request_verb = frags[frag_count].nds_frag_verb;
5265                         request_value->nds_version = frags[frag_count].nds_frag_version;
5266                         request_value->req_nds_flags = frags[frag_count].nds_frag_flags;
5267                     }
5268
5269                 } 
5270                 else 
5271                 {
5272                     /* This is either a beggining or middle fragment on second dissection */
5273                     frag_tvb = tvb_new_subset(tvb, 0, -1, -1);
5274                     if (check_col(pinfo->cinfo, COL_INFO))
5275                     {
5276                       if (request_value->nds_frag)
5277                       {
5278                         col_add_fstr(pinfo->cinfo, COL_INFO, "[NDS Fragment %08x]", frags[frag_count].nds_frag);
5279                       }
5280                     }
5281                 }
5282             }
5283             else 
5284             {
5285                 /* Fragment from first pass of dissection */
5286                 if (check_col(pinfo->cinfo, COL_INFO))
5287                 {
5288                   if (request_value->nds_frag)
5289                   {
5290                      col_add_fstr(pinfo->cinfo, COL_INFO, "[NDS Fragment %08x]", frags[frag_count].nds_frag);
5291                   }
5292                 }
5293                 frag_tvb = NULL;
5294             }
5295         }
5296         else 
5297         {
5298             /*
5299              * There are no bytes so Dissect this
5300              */
5301             frag_tvb = tvb_new_subset(tvb, 0, -1, -1);
5302         }
5303         if (frag_tvb == NULL)
5304         {
5305             /* This is a fragment packet */
5306                 frag_tvb = tvb_new_subset (tvb, 0, -1, -1);
5307                 nds_data_handle = find_dissector("data");
5308                 call_dissector(nds_data_handle, frag_tvb, pinfo, tree);
5309         }
5310         else
5311         {
5312             /* This is the end fragment so dissect */
5313             if (!request_value->nds_frag) {
5314                 frags[frag_count].nds_length = 0;
5315                 dissect_ncp_reply(frag_tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
5316             }
5317         }
5318     }
5319     else
5320     {
5321         /* This is not any fragment packet */
5322         frags[frag_count].nds_length = 0;
5323         request_value->nds_frag = FALSE;
5324         dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
5325     }
5326 }
5327
5328 void
5329 dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
5330                 guint32 nw_connection, guint8 sequence,
5331                 guint16 type, proto_tree *volatile ncp_tree)
5332 {
5333         guint8                  func, subfunc = 0;
5334         gboolean                requires_subfunc = FALSE;
5335         gboolean                has_length = FALSE;
5336         ncp_req_hash_value      *volatile request_value = NULL;
5337         const ncp_record        *volatile ncp_rec = NULL;
5338         conversation_t          *conversation;
5339         ptvcursor_t             *volatile ptvc = NULL;
5340         proto_tree              *temp_tree = NULL;
5341         volatile gboolean       run_req_cond = FALSE;
5342         volatile gboolean       run_info_str = FALSE;
5343         guint32                 length_remaining;
5344         guint32                 testvar;
5345         unsigned long           except_code;
5346         const char              *message;
5347
5348         func = tvb_get_guint8(tvb, 6);
5349
5350         /* Determine which ncp_record to use. */
5351         switch (type) {
5352                 case NCP_ALLOCATE_SLOT:
5353                         length_remaining = tvb_length_remaining(tvb, 4);
5354                         if (length_remaining > 4)
5355                         { 
5356                                 testvar = tvb_get_ntohl(tvb, 4);
5357                                 if( testvar == 0x4c495020)
5358                                 {
5359                                         ncp_rec = &ncplip_echo;
5360                                 }
5361                                 else
5362                                 {
5363                                                 ncp_rec = &ncp1111_request;
5364                                     if (ncp_echo_conn) {
5365                                         expert_add_info_format(pinfo, NULL, PI_RESPONSE_CODE, PI_CHAT, "Connection Request");
5366                                     }
5367                                 }        
5368                         }        
5369                         else
5370                         {
5371                                         ncp_rec = &ncp1111_request;
5372                             if (ncp_echo_conn) {
5373                                 expert_add_info_format(pinfo, NULL, PI_RESPONSE_CODE, PI_CHAT, "Connection Request");
5374                             }
5375                         }        
5376                         break;
5377                 case NCP_SERVICE_REQUEST:
5378                         requires_subfunc = ncp_requires_subfunc(func);
5379                         has_length = ncp_has_length_parameter(func);
5380                         if (requires_subfunc) {
5381                                 if (has_length) {
5382                                         subfunc = tvb_get_guint8(tvb, 9);
5383                                 }
5384                                 else {
5385                                         subfunc = tvb_get_guint8(tvb, 7);
5386                                 }
5387                         }
5388                         ncp_rec = ncp_record_find(func, subfunc);
5389                         break;
5390                 case NCP_DEALLOCATE_SLOT:
5391                         ncp_rec = &ncp5555_request;
5392             if (ncp_echo_conn) {
5393                 expert_add_info_format(pinfo, NULL, PI_RESPONSE_CODE, PI_CHAT, "Destroy Connection %d Request", nw_connection);
5394             }
5395                         break;
5396                 case NCP_BROADCAST_SLOT:
5397                         ncp_rec = &ncpbbbb_request;
5398                         break;
5399                 case NCP_LIP_ECHO:
5400                         ncp_rec = &ncplip_echo;
5401                         break;        
5402                 default:
5403                         ncp_rec = NULL;
5404                         break;
5405         }
5406
5407         /* Fill in the INFO column. */
5408         if (check_col(pinfo->cinfo, COL_INFO)) {
5409                 if (ncp_rec) {
5410                         col_add_fstr(pinfo->cinfo, COL_INFO, "C %s", ncp_rec->name);
5411                         if (ncp_rec->req_info_str) {
5412                                 /* We want to add more stuff to the Info
5413                                    column. */
5414                                 run_info_str = TRUE;
5415                         }
5416                 }
5417                 else {
5418                         if (requires_subfunc) {
5419                                 col_add_fstr(pinfo->cinfo, COL_INFO,
5420                                         "C Unknown Function %u %u (0x%02X/0x%02x)",
5421                                         func, subfunc, func, subfunc);
5422                         }
5423                         else {
5424                                 col_add_fstr(pinfo->cinfo, COL_INFO,
5425                                         "C Unknown Function %u (0x%02x)",
5426                                         func, func);
5427                         }
5428                 }
5429         }
5430         if (!pinfo->fd->flags.visited) {
5431                 /* This is the first time we've looked at this packet.
5432                    Keep track of the address and connection whence the request
5433                    came, and the address and connection to which the request
5434                    is being sent, so that we can match up calls with replies.
5435                    (We don't include the sequence number, as we may want
5436                    to have all packets over the same connection treated
5437                    as being part of a single conversation so that we can
5438                    let the user select that conversation to be displayed.) */
5439                 conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
5440                     PT_NCP, nw_connection, nw_connection, 0);
5441
5442                 if (conversation == NULL) {
5443                         /* It's not part of any conversation - create a new one. */
5444                         conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst,
5445                             PT_NCP, nw_connection, nw_connection, 0);
5446                 }
5447                 request_value = ncp_hash_insert(conversation, sequence, ncp_rec);
5448                 request_value->req_frame_num = pinfo->fd->num;
5449                 request_value->req_frame_time=pinfo->fd->abs_ts;
5450
5451                 /* If this is the first time we're examining the packet,
5452                  * check to see if this NCP type uses a "request condition".
5453                  * If so, we have to build a proto_tree because request conditions
5454                  * use display filters to work, and without a proto_tree,
5455                  * display filters can't possibly work. */
5456                 if (ncp_rec) {
5457                         if (ncp_rec->req_cond_indexes) {
5458                                 run_req_cond = TRUE;
5459                         }
5460                 }
5461         }
5462
5463         /* If we have to handle a request condition, or have to
5464            add to the Info column, we need to construct a protocol
5465            tree.  If we already have a proto_tree, then wonderful.
5466            If we don't, we need to build one. */
5467         if ((run_info_str || run_req_cond) && !ncp_tree) {
5468                 proto_item *ti;
5469
5470                 temp_tree = proto_tree_create_root();
5471                 proto_tree_set_visible(temp_tree, FALSE);
5472                 ti = proto_tree_add_item(temp_tree, proto_ncp, tvb, 0, -1, FALSE);
5473                 ncp_tree = proto_item_add_subtree(ti, ett_ncp);
5474         }
5475
5476         if (ncp_tree) {
5477                 /* If the dissection throws an exception, be sure to free
5478                  * the temporary proto_tree that was created. Because of the
5479                  * way the CLEANUP_PUSH macro works, we can't put it in an 'if'
5480                  * block; it has to be in the same scope as the terminating
5481                  * CLEANUP_POP or CLEANUP_POP_AND_ALLOC. So, we always
5482                  * call CLEANUP_POP and friends, but the value of temp_tree is
5483                  * NULL if no cleanup is needed, and non-null if cleanup is needed. */
5484                 CLEANUP_PUSH(free_proto_tree, temp_tree);
5485
5486 #ifdef FAKE_TREE_IS_VISIBLE
5487                 PTREE_DATA(ncp_tree)->visible=1;
5488 #endif
5489
5490                 /* Before the dissection, if we're saving data for a request
5491                  * condition, we have to prime the proto tree using the
5492                  * dfilter information */
5493                 if (run_req_cond) {
5494                         const int       *needed;
5495                         dfilter_t       *dfilter;
5496
5497                         needed = ncp_rec->req_cond_indexes;
5498
5499                         while (*needed != -1) {
5500                                 dfilter = req_conds[*needed].dfilter;
5501                                 /* Prime the proto_tree with "interesting fields". */
5502                                 dfilter_prime_proto_tree(dfilter, ncp_tree);
5503                                 needed++;
5504                         }
5505                 }
5506
5507                 /* Before the dissection, if we need a field for the info_str,
5508                  * prime the tree. */
5509                 if (run_info_str) {
5510                         proto_tree_prime_hfid(ncp_tree, *ncp_rec->req_info_str->hf_ptr);
5511                 }
5512
5513                 switch (type) {
5514                         case NCP_BROADCAST_SLOT:
5515                                 ; /* nothing */
5516                                 break;
5517
5518                         case NCP_SERVICE_REQUEST:
5519                                 proto_tree_add_uint_format(ncp_tree, hf_ncp_func, tvb, 6, 1,
5520                                         func, "Function: %u (0x%02X), %s",
5521                                         func, func, ncp_rec ? ncp_rec->name : "Unknown");
5522                                 break;
5523
5524                         default:
5525                                 ; /* nothing */
5526                                 break;
5527                 }
5528
5529                 if (requires_subfunc) {
5530                         if (has_length) {
5531                                 proto_tree_add_item(ncp_tree, hf_ncp_length, tvb, 7,
5532                                         2, FALSE);
5533                                 proto_tree_add_uint_format(ncp_tree, hf_ncp_subfunc, tvb, 9, 1,
5534                                         subfunc, "SubFunction: %u (0x%02x)",
5535                                         subfunc, subfunc);
5536                                 ptvc = ptvcursor_new(ncp_tree, tvb, 10);
5537                         }
5538                         else {
5539                                 proto_tree_add_uint_format(ncp_tree, hf_ncp_subfunc, tvb, 7, 1,
5540                                         subfunc, "SubFunction: %u (0x%02x)",
5541                                         subfunc, subfunc);
5542                                 ptvc = ptvcursor_new(ncp_tree, tvb, 8);
5543                         }
5544                 }
5545                 else {
5546                         ptvc = ptvcursor_new(ncp_tree, tvb, 7);
5547                 }
5548
5549                 /* The group is not part of the packet, but it's useful
5550                  * information to display anyway. Put it in the tree for filtering and tap use*/
5551                 if (ncp_rec) {
5552                 proto_tree_add_uint_format(ncp_tree, hf_ncp_group, tvb, 0, 0, ncp_rec->group, "Group: %s", ncp_groups[ncp_rec->group]);
5553                 }
5554
5555                 except_code = 0;
5556                 message = NULL;
5557                 if (ncp_rec && ncp_rec->request_ptvc) {
5558                         clear_repeat_vars();
5559                         /*
5560                          * We need to remember the results even if we
5561                          * throw an exception dissecting this request,
5562                          * so that we can properly dissect the reply.
5563                          * We catch any exceptions thrown when
5564                          * dissecting the request, and re-throw them
5565                          * after saving the results of any conditional
5566                          * tests.
5567                          */
5568                         TRY {
5569                                 process_ptvc_record(ptvc, ncp_rec->request_ptvc, NULL, TRUE, ncp_rec);
5570                         } CATCH_ALL {
5571                                 except_code = EXCEPT_CODE;
5572                                 message = GET_MESSAGE;
5573                         }
5574                         ENDTRY;
5575                 }
5576                 ptvcursor_free(ptvc);
5577                 /* SecretStore packets are dessected in packet-ncp-sss.c */
5578                 if (func == 0x5c && ncp_tree) {
5579                         dissect_sss_request(tvb, pinfo, ncp_tree, request_value);
5580                 }
5581                 /* NMAS packets are dessected in packet-ncp-nmas.c */
5582                 if (func == 0x5e && ncp_tree) {
5583                         dissect_nmas_request(tvb, pinfo, ncp_tree, request_value);
5584                 }
5585
5586                 /* Now that the dissection is done, do we need to run
5587                  * some display filters on the resulting tree in order
5588                  * to save results for "request conditions" ? */
5589                 if (run_req_cond) {
5590                         const int       *needed;
5591                         gboolean        *results;
5592                         dfilter_t       *dfilter;
5593
5594                         results = g_new0(gboolean, NUM_REQ_CONDS);
5595                         needed = ncp_rec->req_cond_indexes;
5596
5597                         while (*needed != -1) {
5598                                 /* ncp_tree is not a root proto_tree, but
5599                                  * dfilters will still work on it. */
5600                                 dfilter = req_conds[*needed].dfilter;
5601                                 results[*needed] = dfilter_apply(dfilter, ncp_tree);
5602                                 needed++;
5603                         }
5604
5605                         /* Save the results so the reply packet dissection
5606                          * get to them. */
5607                         request_value->req_cond_results = results;
5608                 }
5609                 /* Construct the info string if necessary */
5610                 if (run_info_str) {
5611                         GPtrArray *parray;
5612                         char*   byte_string;
5613                         char    non_uni_string[1024];
5614                         int i, len;
5615                         field_info *finfo;
5616                         int info_type;
5617                         
5618                         if (!request_value)
5619                         {
5620                                 conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
5621                                     PT_NCP, nw_connection, nw_connection, 0);
5622                                 if (conversation != NULL) {
5623                                         /* find the record telling us the request made that caused
5624                                         this reply */
5625                                         request_value = ncp_hash_lookup(conversation, sequence);
5626                                 }
5627                                 if (!conversation || !request_value)
5628                                 {
5629                                         return;
5630                                 }
5631                         }
5632                         
5633                         parray = proto_get_finfo_ptr_array(ncp_tree,
5634                                 *ncp_rec->req_info_str->hf_ptr);
5635                         len = g_ptr_array_len(parray);
5636                         
5637                         if (len > 0) {
5638                         
5639                                 col_set_str(pinfo->cinfo, COL_INFO, "C ");
5640
5641                                 finfo = g_ptr_array_index(parray, 0);
5642
5643                                 info_type = get_info_type((const gchar*) ncp_rec->req_info_str->first_string);
5644                                                             
5645                                 if (info_type != 0) {    /* Is this  a string or not? */
5646                                        
5647                                         if (info_type == 1) {   /* Is this bytes? */
5648                                                 byte_string = bytes_to_str(get_finfo_value_string(finfo), get_finfo_length(finfo));
5649                                                 col_append_fstr(pinfo->cinfo, COL_INFO,
5650                                                         (const gchar*) ncp_rec->req_info_str->first_string,
5651                                                         byte_string);
5652                                         }
5653                                         else
5654                                         {
5655                                                 if (info_type == 2) {   /* Is this a String? */
5656                                                         uni_to_string(get_finfo_value_string(finfo), get_finfo_length(finfo), non_uni_string);
5657                                                         col_append_fstr(pinfo->cinfo, COL_INFO,
5658                                                                 (const gchar*) ncp_rec->req_info_str->first_string,
5659                                                                 non_uni_string);
5660                                                 }
5661                                                 else
5662                                                 {
5663                                                         col_append_fstr(pinfo->cinfo, COL_INFO,
5664                                                                 (const gchar*) ncp_rec->req_info_str->first_string,
5665                                                                 get_finfo_value_string(finfo));
5666                                                 }
5667                                         }
5668                                 }
5669                                 else
5670                                 {
5671                                         col_append_fstr(pinfo->cinfo, COL_INFO,
5672                                                 (const gchar*) ncp_rec->req_info_str->first_string,
5673                                                 get_finfo_value_integer(finfo));
5674                                 }
5675                         }
5676                         if (len > 1) {
5677                                 for (i = 1; i < len; i++) {
5678                                         non_uni_string[0]='\0';
5679                                         finfo = g_ptr_array_index(parray, i);
5680                                         info_type = get_info_type((const gchar*) ncp_rec->req_info_str->repeat_string);
5681                                                                     
5682                                         if (info_type != 0) {    /* Is this  a string or not? */
5683                                               if (info_type == 1) 
5684                                               {   /* Is this bytes? */
5685                                                 byte_string = bytes_to_str(get_finfo_value_string(finfo), get_finfo_length(finfo));
5686                                                 col_append_fstr(pinfo->cinfo, COL_INFO,
5687                                                         (const gchar*) ncp_rec->req_info_str->repeat_string,
5688                                                         byte_string);
5689                                               }
5690                                               else
5691                                               {
5692                                                         if (info_type == 2) {   /* Is this a String? */
5693                                                                 uni_to_string(get_finfo_value_string(finfo), get_finfo_length(finfo), non_uni_string);
5694                                                                 col_append_fstr(pinfo->cinfo, COL_INFO,
5695                                                                         (const gchar*) ncp_rec->req_info_str->repeat_string,
5696                                                                         non_uni_string);
5697                                                         }
5698                                                         else
5699                                                         {
5700                                                                 col_append_fstr(pinfo->cinfo, COL_INFO,
5701                                                                         (const gchar*) ncp_rec->req_info_str->repeat_string,
5702                                                                         get_finfo_value_string(finfo));
5703                                                         }
5704                                               }
5705                                         }
5706                                         else
5707                                         {
5708                                                 col_append_fstr(pinfo->cinfo, COL_INFO,
5709                                                         (const gchar*) ncp_rec->req_info_str->repeat_string,
5710                                                         get_finfo_value_integer(finfo));
5711                                         }
5712                                 }
5713                         }
5714                 }
5715
5716         /* Check to see if we need to report to the expert table */
5717         trap_for_expert_event(ncp_tree, pinfo, ncp_rec, 0);
5718                 /* Free the temporary proto_tree */
5719                 CLEANUP_CALL_AND_POP;
5720
5721                 /* Re-throw any exception. */
5722                 if (except_code != 0)
5723                         THROW_MESSAGE(except_code, message);
5724         }
5725 }
5726
5727 static void
5728 dissect_nds_ping_reply(tvbuff_t *tvb, packet_info *pinfo _U_,
5729         proto_tree *ncp_tree, ncp_req_hash_value *request_value)
5730 {
5731         nw_uni_t                        reply_buffer;
5732         guint8                          ping_version;
5733         guint32                         nds_string_len;
5734         guint32                         nds_offset;
5735         guint32                         bvalue;
5736         guint32                         nds_flags;
5737         nds_val                         pvalues[9];
5738         int                             i;
5739
5740         strcpy(reply_buffer.buffer, "");
5741
5742         ping_version = tvb_get_guint8(tvb, 8);
5743         proto_tree_add_item(ncp_tree, hf_ping_version, tvb, 8, 1, TRUE);
5744         if (ping_version == 9) {
5745                 nds_string_len = tvb_get_ntohl(tvb, 9);
5746                 nds_offset = nds_string_len+16;
5747                 tvb_ensure_bytes_exist(tvb, 16, nds_string_len);
5748                 proto_tree_add_item(ncp_tree, hf_nds_tree_name, tvb, 16, nds_string_len, FALSE);
5749                 proto_tree_add_item(ncp_tree, hf_nds_reply_depth, tvb, nds_offset, 4, FALSE);
5750                 proto_tree_add_item(ncp_tree, hf_nds_reply_rev, tvb, (nds_offset+4), 4, FALSE);
5751                 proto_tree_add_item(ncp_tree, hf_nds_reply_flags, tvb, (nds_offset+8), 4, TRUE);
5752         }
5753         else {
5754                 nds_offset = 12;
5755                 nds_flags = request_value->req_nds_flags;
5756                 bvalue = 0x00000001;
5757                                                 
5758                 for (i = 0 ; i < 32; i++ ) {
5759                         if (nds_flags & bvalue) 
5760                         {
5761                                 switch(bvalue)
5762                                 {
5763                                         case 0x00000001:   /* Supported Fields */
5764                                                 pvalues[0].vvalue = tvb_get_letohs(tvb, nds_offset);
5765                                                 pvalues[0].vtype = VTYPE_BITFIELD;
5766                                                 pvalues[0].vstring = "";
5767                                                 pvalues[0].vdesc = "Ping (low) Supported Fields:";
5768                                                 pvalues[0].vlength = 2;
5769                                                 pvalues[0].hfname= hf_nds_rflags;
5770                                                 pvalues[0].voffset = nds_offset;
5771                                                 pvalues[0].bit1 = "Supported Fields";
5772                                                 pvalues[0].bit1hfname = hf_bit1pingflags1;
5773                                                 pvalues[0].bit2 = "Depth";
5774                                                 pvalues[0].bit2hfname = hf_bit2pingflags1;
5775                                                 pvalues[0].bit3 = "Revision";
5776                                                 pvalues[0].bit3hfname = hf_bit3pingflags1;
5777                                                 pvalues[0].bit4 = "Flags";
5778                                                 pvalues[0].bit4hfname = hf_bit4pingflags1;
5779                                                 pvalues[0].bit5 = "Verification Flags";
5780                                                 pvalues[0].bit5hfname = hf_bit5pingflags1;
5781                                                 pvalues[0].bit6 = "Letter Version";
5782                                                 pvalues[0].bit6hfname = hf_bit6pingflags1;
5783                                                 pvalues[0].bit7 = "OS Version";
5784                                                 pvalues[0].bit7hfname = hf_bit7pingflags1;
5785                                                 pvalues[0].bit8 = "License Flags";
5786                                                 pvalues[0].bit8hfname = hf_bit8pingflags1;
5787                                                 pvalues[0].bit9 = "DS Time";
5788                                                 pvalues[0].bit9hfname = hf_bit9pingflags1;
5789                                                 pvalues[0].bit10 = "Not Defined";
5790                                                 pvalues[0].bit10hfname = hf_bit10pingflags1;
5791                                                 pvalues[0].bit11 = "Not Defined";
5792                                                 pvalues[0].bit11hfname = hf_bit11pingflags1;
5793                                                 pvalues[0].bit12 = "Not Defined";
5794                                                 pvalues[0].bit12hfname = hf_bit12pingflags1;
5795                                                 pvalues[0].bit13 = "Not Defined";
5796                                                 pvalues[0].bit13hfname = hf_bit13pingflags1;
5797                                                 pvalues[0].bit14 = "Not Defined";
5798                                                 pvalues[0].bit14hfname = hf_bit14pingflags1;
5799                                                 pvalues[0].bit15 = "Not Defined";
5800                                                 pvalues[0].bit15hfname = hf_bit15pingflags1;
5801                                                 pvalues[0].bit16 = "Not Defined";
5802                                                 pvalues[0].bit16hfname = hf_bit16pingflags1;
5803                                                                         
5804                                                 process_bitfield(ncp_tree, tvb, &pvalues[0]);
5805                                                 nds_offset += 2;
5806                                                                         
5807                                                 pvalues[0].vvalue = tvb_get_letohs(tvb, nds_offset);
5808                                                 pvalues[0].vtype = VTYPE_BITFIELD;
5809                                                 pvalues[0].vstring = "";
5810                                                 pvalues[0].vdesc = "Ping (high) Supported Fields:";
5811                                                 pvalues[0].vlength = 2;
5812                                                 pvalues[0].hfname= hf_nds_rflags;
5813                                                 pvalues[0].voffset = nds_offset;
5814                                                 pvalues[0].bit1 = "Sap Name";
5815                                                 pvalues[0].bit1hfname = hf_bit1pingflags2;
5816                                                 pvalues[0].bit2 = "Tree Name";
5817                                                 pvalues[0].bit2hfname = hf_bit2pingflags2;
5818                                                 pvalues[0].bit3 = "OS Name";
5819                                                 pvalues[0].bit3hfname = hf_bit3pingflags2;
5820                                                 pvalues[0].bit4 = "Hardware Name";
5821                                                 pvalues[0].bit4hfname = hf_bit4pingflags2;
5822                                                 pvalues[0].bit5 = "Vendor Name";
5823                                                 pvalues[0].bit5hfname = hf_bit5pingflags2;
5824                                                 pvalues[0].bit6 = "Not Defined";
5825                                                 pvalues[0].bit6hfname = hf_bit6pingflags2;
5826                                                 pvalues[0].bit7 = "Not Defined";
5827                                                 pvalues[0].bit7hfname = hf_bit7pingflags2;
5828                                                 pvalues[0].bit8 = "Not Defined";
5829                                                 pvalues[0].bit8hfname = hf_bit8pingflags2;
5830                                                 pvalues[0].bit9 = "Not Defined";
5831                                                 pvalues[0].bit9hfname = hf_bit9pingflags2;
5832                                                 pvalues[0].bit10 = "Not Defined";
5833                                                 pvalues[0].bit10hfname = hf_bit10pingflags2;
5834                                                 pvalues[0].bit11 = "Not Defined";
5835                                                 pvalues[0].bit11hfname = hf_bit11pingflags2;
5836                                                 pvalues[0].bit12 = "Not Defined";
5837                                                 pvalues[0].bit12hfname = hf_bit12pingflags2;
5838                                                 pvalues[0].bit13 = "Not Defined";
5839                                                 pvalues[0].bit13hfname = hf_bit13pingflags2;
5840                                                 pvalues[0].bit14 = "Not Defined";
5841                                                 pvalues[0].bit14hfname = hf_bit14pingflags2;
5842                                                 pvalues[0].bit15 = "Not Defined";
5843                                                 pvalues[0].bit15hfname = hf_bit15pingflags2;
5844                                                 pvalues[0].bit16 = "Not Defined";
5845                                                 pvalues[0].bit16hfname = hf_bit16pingflags2;
5846                                                                         
5847                                                 process_bitfield(ncp_tree, tvb, &pvalues[0]);
5848                                                 nds_offset += 2;
5849                                                 break;
5850                                         case 0x00000002:
5851                                                 proto_tree_add_item(ncp_tree, hf_nds_reply_depth, tvb, nds_offset, 4, TRUE);
5852                                                 nds_offset += 4;
5853                                                 break;
5854                                         case 0x00000004:
5855                                                 proto_tree_add_item(ncp_tree, hf_nds_reply_rev, tvb, nds_offset, 4, TRUE);
5856                                                 nds_offset += 4;
5857                                                 break;
5858                                         case 0x00000008:
5859                                                 pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
5860                                                 pvalues[0].vtype = VTYPE_BITFIELD;
5861                                                 pvalues[0].vstring = "";
5862                                                 pvalues[0].vdesc = "Ping Flags:";
5863                                                 pvalues[0].vlength = 4;
5864                                                 pvalues[0].hfname= hf_nds_rflags;
5865                                                 pvalues[0].voffset = nds_offset;
5866                                                 pvalues[0].bit1 = "Root Most Master Replica";
5867                                                 pvalues[0].bit1hfname = hf_bit1pingpflags1;
5868                                                 pvalues[0].bit2 = "Time Synchronized";
5869                                                 pvalues[0].bit2hfname = hf_bit2pingpflags1;
5870                                                 pvalues[0].bit3 = "Not Defined";
5871                                                 pvalues[0].bit3hfname = hf_bit3pingpflags1;
5872                                                 pvalues[0].bit4 = "Not Defined";
5873                                                 pvalues[0].bit4hfname = hf_bit4pingpflags1;
5874                                                 pvalues[0].bit5 = "Not Defined";
5875                                                 pvalues[0].bit5hfname = hf_bit5pingpflags1;
5876                                                 pvalues[0].bit6 = "Not Defined";
5877                                                 pvalues[0].bit6hfname = hf_bit6pingpflags1;
5878                                                 pvalues[0].bit7 = "Not Defined";
5879                                                 pvalues[0].bit7hfname = hf_bit7pingpflags1;
5880                                                 pvalues[0].bit8 = "Not Defined";
5881                                                 pvalues[0].bit8hfname = hf_bit8pingpflags1;
5882                                                 pvalues[0].bit9 = "Not Defined";
5883                                                 pvalues[0].bit9hfname = hf_bit9pingpflags1;
5884                                                 pvalues[0].bit10 = "Not Defined";
5885                                                 pvalues[0].bit10hfname = hf_bit10pingpflags1;
5886                                                 pvalues[0].bit11 = "Not Defined";
5887                                                 pvalues[0].bit11hfname = hf_bit11pingpflags1;
5888                                                 pvalues[0].bit12 = "Not Defined";
5889                                                 pvalues[0].bit12hfname = hf_bit12pingpflags1;
5890                                                 pvalues[0].bit13 = "Not Defined";
5891                                                 pvalues[0].bit13hfname = hf_bit13pingpflags1;
5892                                                 pvalues[0].bit14 = "Not Defined";
5893                                                 pvalues[0].bit14hfname = hf_bit14pingpflags1;
5894                                                 pvalues[0].bit15 = "Not Defined";
5895                                                 pvalues[0].bit15hfname = hf_bit15pingpflags1;
5896                                                 pvalues[0].bit16 = "Not Defined";
5897                                                 pvalues[0].bit16hfname = hf_bit16pingpflags1;
5898                                                                         
5899                                                 process_bitfield(ncp_tree, tvb, &pvalues[0]);
5900                                                 nds_offset += 4;
5901                                                 break;
5902                                         case 0x00000010:
5903                                                 pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
5904                                                 pvalues[0].vtype = VTYPE_BITFIELD;
5905                                                 pvalues[0].vstring = "";
5906                                                 pvalues[0].vdesc = "Verification Flags:";
5907                                                 pvalues[0].vlength = 4;
5908                                                 pvalues[0].hfname= hf_nds_rflags;
5909                                                 pvalues[0].voffset = nds_offset;
5910                                                 pvalues[0].bit1 = "Checksum";
5911                                                 pvalues[0].bit1hfname = hf_bit1pingvflags1;
5912                                                 pvalues[0].bit2 = "CRC32";
5913                                                 pvalues[0].bit2hfname = hf_bit2pingvflags1;
5914                                                 pvalues[0].bit3 = "Not Defined";
5915                                                 pvalues[0].bit3hfname = hf_bit3pingvflags1;
5916                                                 pvalues[0].bit4 = "Not Defined";
5917                                                 pvalues[0].bit4hfname = hf_bit4pingvflags1;
5918                                                 pvalues[0].bit5 = "Not Defined";
5919                                                 pvalues[0].bit5hfname = hf_bit5pingvflags1;
5920                                                 pvalues[0].bit6 = "Not Defined";
5921                                                 pvalues[0].bit6hfname = hf_bit6pingvflags1;
5922                                                 pvalues[0].bit7 = "Not Defined";
5923                                                 pvalues[0].bit7hfname = hf_bit7pingvflags1;
5924                                                 pvalues[0].bit8 = "Not Defined";
5925                                                 pvalues[0].bit8hfname = hf_bit8pingvflags1;
5926                                                 pvalues[0].bit9 = "Not Defined";
5927                                                 pvalues[0].bit9hfname = hf_bit9pingvflags1;
5928                                                 pvalues[0].bit10 = "Not Defined";
5929                                                 pvalues[0].bit10hfname = hf_bit10pingvflags1;
5930                                                 pvalues[0].bit11 = "Not Defined";
5931                                                 pvalues[0].bit11hfname = hf_bit11pingvflags1;
5932                                                 pvalues[0].bit12 = "Not Defined";
5933                                                 pvalues[0].bit12hfname = hf_bit12pingvflags1;
5934                                                 pvalues[0].bit13 = "Not Defined";
5935                                                 pvalues[0].bit13hfname = hf_bit13pingvflags1;
5936                                                 pvalues[0].bit14 = "Not Defined";
5937                                                 pvalues[0].bit14hfname = hf_bit14pingvflags1;
5938                                                 pvalues[0].bit15 = "Not Defined";
5939                                                 pvalues[0].bit15hfname = hf_bit15pingvflags1;
5940                                                 pvalues[0].bit16 = "Not Defined";
5941                                                 pvalues[0].bit16hfname = hf_bit16pingvflags1;
5942                                                                         
5943                                                 process_bitfield(ncp_tree, tvb, &pvalues[0]);
5944                                                 nds_offset += 4;
5945                                                 break;
5946                                         case 0x00000020:
5947                                                 proto_tree_add_item(ncp_tree, hf_nds_letter_ver, tvb, nds_offset, 4, TRUE);
5948                                                 nds_offset += 4;
5949                                                 break;
5950                                         case 0x00000040:
5951                                                 proto_tree_add_item(ncp_tree, hf_nds_os_ver, tvb, nds_offset, 4, TRUE);
5952                                                 nds_offset += 4;
5953                                                 break;
5954                                         case 0x00000080:
5955                                                 proto_tree_add_item(ncp_tree, hf_nds_lic_flags, tvb, nds_offset, 4, TRUE);
5956                                                 nds_offset += 4;
5957                                                 break;
5958                                         case 0x00000100:
5959                                                 proto_tree_add_item(ncp_tree, hf_nds_ds_time, tvb, nds_offset, 4, TRUE);
5960                                                 nds_offset += 4;
5961                                                 break;
5962                                         case 0x00010000:
5963                                                 nds_string_len = tvb_get_letohl(tvb, nds_offset);
5964                                                 nds_offset += 4;
5965                                                 get_string(tvb, nds_offset, nds_string_len, reply_buffer.buffer);
5966                                                 tvb_ensure_bytes_exist(tvb, nds_offset, nds_string_len);
5967                                                 proto_tree_add_text(ncp_tree, tvb, nds_offset, nds_string_len, "SAP Name: %s", reply_buffer.buffer);
5968                                                 nds_offset += nds_string_len;
5969                                                 nds_offset += align_4(tvb, nds_offset);
5970                                                 nds_offset += 2;
5971                                                 break;
5972                                         case 0x00020000:
5973                                                 nds_string_len = tvb_get_letohl(tvb, nds_offset);
5974                                                 nds_offset += 4;
5975                                                 get_string(tvb, nds_offset, nds_string_len, reply_buffer.buffer);
5976                                                 tvb_ensure_bytes_exist(tvb, nds_offset, nds_string_len);
5977                                                 proto_tree_add_text(ncp_tree, tvb, nds_offset, nds_string_len, "NDS Tree Name: %s", reply_buffer.buffer);
5978                                                 nds_offset += nds_string_len;
5979                                                 nds_offset += align_4(tvb, nds_offset);
5980                                                 break;
5981                                         case 0x00040000:
5982                                                 nds_string_len = tvb_get_letohl(tvb, nds_offset);
5983                                                 nds_offset += 4;
5984                                                 get_string(tvb, nds_offset, nds_string_len, reply_buffer.buffer);
5985                                                 tvb_ensure_bytes_exist(tvb, nds_offset, nds_string_len);
5986                                                 proto_tree_add_text(ncp_tree, tvb, nds_offset, nds_string_len, "OS Name: %s", reply_buffer.buffer);
5987                                                 nds_offset += nds_string_len;
5988                                                 nds_offset += align_4(tvb, nds_offset);
5989                                                 break;
5990                                         case 0x00080000:
5991                                                 nds_string_len = tvb_get_letohl(tvb, nds_offset);
5992                                                 nds_offset += 4;
5993                                                 get_string(tvb, nds_offset, nds_string_len, reply_buffer.buffer);
5994                                                 tvb_ensure_bytes_exist(tvb, nds_offset, nds_string_len);
5995                                                 proto_tree_add_text(ncp_tree, tvb, nds_offset, nds_string_len, "Hardware Name: %s", reply_buffer.buffer);
5996                                                 nds_offset += nds_string_len;
5997                                                 nds_offset += align_4(tvb, nds_offset);
5998                                                 break;
5999                                         case 0x00100000:
6000                                                 nds_string_len = tvb_get_letohl(tvb, nds_offset);
6001                                                 nds_offset += 4;
6002                                                 get_string(tvb, nds_offset, nds_string_len, reply_buffer.buffer);
6003                                                 tvb_ensure_bytes_exist(tvb, nds_offset, nds_string_len);
6004                                                 proto_tree_add_text(ncp_tree, tvb, nds_offset, nds_string_len, "Vendor Name: %s", reply_buffer.buffer);
6005                                                 nds_offset += nds_string_len;
6006                                                 nds_offset += align_4(tvb, nds_offset);
6007                                                 break;
6008                                         case 0x00000200:
6009                                                 /* Not Defined */
6010                                         case 0x00000400:
6011                                                 /* Not Defined */
6012                                         case 0x00000800:
6013                                                 /* Not Defined */
6014                                         case 0x00001000:
6015                                                 /* Not Defined */
6016                                         case 0x00002000:
6017                                                 /* Not Defined */
6018                                         case 0x00004000:
6019                                                 /* Not Defined */
6020                                         case 0x00008000:
6021                                                 /* Not Defined */
6022                                         case 0x00200000:
6023                                                 /* Not Defined */
6024                                         case 0x00400000:
6025                                                 /* Not Defined */
6026                                         case 0x00800000:
6027                                                 /* Not Defined */
6028                                         case 0x01000000:
6029                                                 /* Not Defined */
6030                                         case 0x02000000:
6031                                                 /* Not Defined */
6032                                         case 0x04000000:
6033                                                 /* Not Defined */
6034                                         case 0x08000000:
6035                                                 /* Not Defined */
6036                                         case 0x10000000:
6037                                                 /* Not Defined */
6038                                         case 0x20000000:
6039                                                 /* Not Defined */
6040                                         case 0x40000000:
6041                                                 /* Not Defined */
6042                                         case 0x80000000:
6043                                                 /* Not Defined */
6044                                         default:
6045                                                 break;
6046                                 }
6047                         }
6048                         bvalue = bvalue*2;
6049                 }
6050         }
6051 }
6052
6053 static void
6054 dissect_nds_reply(tvbuff_t *tvb, packet_info *pinfo,
6055         proto_tree *ncp_tree, guint32 nds_error_code,
6056         const char *nds_error_string, ncp_req_hash_value *request_value,
6057         conversation_t *conversation)
6058 {
6059         guint32                         nds_offset;
6060         guint32                         nds_reply_buffer;
6061         guint32                         nds_frag;
6062         const char                      *verb_string;
6063         nds_val                         pvalues[9];
6064         char                            string_buffer[9][1024];
6065         gboolean                        resolve_eid=FALSE;
6066         guint32                         global_eid=0;
6067         gboolean                        add_eid = FALSE;
6068         char                            global_object_name[256];
6069         ncp_req_eid_hash_value          *request_eid_value = NULL;
6070         int                             i;
6071
6072         strcpy(global_object_name, "");
6073
6074         nds_offset = 8;
6075                                         
6076         nds_reply_buffer = tvb_get_letohl(tvb, nds_offset);
6077         proto_tree_add_uint(ncp_tree, hf_ncp_fragment_size, tvb, nds_offset,
6078                 4, nds_reply_buffer);
6079         nds_offset += 4;
6080         nds_frag = tvb_get_letohl(tvb, nds_offset);        
6081         proto_tree_add_uint(ncp_tree, hf_ncp_fragment_handle, tvb, nds_offset,
6082                 4, nds_frag);
6083         nds_offset += 4;        
6084         /*
6085          * Is the possibly-reassembled reply large enough to have a completion
6086          * code?  (We can't check the fragment size as this might just be the
6087          * last fragment.)
6088          */
6089         if (tvb_reported_length_remaining(tvb, nds_offset) >= 4)
6090         {                        
6091                 /* Yes - process the completion code. */
6092                 expert_item = proto_tree_add_uint_format(ncp_tree, hf_nds_reply_error, tvb, nds_offset,
6093                         4, nds_error_code, "NDS Completion Code: 0x%08x, %s",
6094                         nds_error_code, nds_error_string);
6095
6096                 if (nds_error_code != 0 && ncp_echo_err) {
6097                         expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "NDS Error: 0x%08x %s", nds_error_code, nds_error_string);
6098                 }
6099         }
6100         if (request_value && nds_error_code == 0x00000000)
6101         {
6102                 nds_offset = 20;
6103                 for (i = 0; i < 9; i++) {
6104                         pvalues[i].vtype = 0;
6105                         pvalues[i].vvalue = 0;
6106                         pvalues[i].vlength = 0;
6107                         pvalues[i].voffset = 0;
6108                         pvalues[i].hfname = 0;
6109                         pvalues[i].vdesc = "";
6110                         string_buffer[i][0] = '\0';
6111                         pvalues[i].vstring = string_buffer[i];
6112                         pvalues[i].mvtype = 0;
6113                 }
6114                 verb_string = val_to_str(request_value->nds_request_verb,
6115                     ncp_nds_verb_vals, "Continuation Fragment");
6116                 switch (request_value->nds_request_verb)
6117                 {
6118                         case 0x01:
6119                                 if(request_value->nds_version < 2)
6120                                 { 
6121                                         pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
6122                                         pvalues[0].vstring = (char *)match_strval(pvalues[0].vvalue, nds_tags);
6123                                         if(pvalues[0].vstring == NULL)
6124                                         {
6125                                                 pvalues[0].vstring = "No Tags Set";
6126                                         }
6127                                         pvalues[0].vtype = VTYPE_STRING;
6128                                         pvalues[0].vdesc = "Tag: %s";
6129                                         pvalues[0].vlength = 4;
6130                                         pvalues[0].voffset = nds_offset;
6131                                         pvalues[0].hfname = hf_nds_tag_string;
6132                                         nds_offset = nds_offset+pvalues[0].vlength;
6133                                         switch(pvalues[0].vvalue)
6134                                         {
6135                                                 case NDS_TAG_NO_SUCH_ENTRY:
6136                                                         break;
6137                                                 case NDS_TAG_LOCAL_ENTRY:
6138                                                         pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
6139                                                         pvalues[1].vtype = VTYPE_UINT32;
6140                                                         pvalues[1].vdesc = "Entry ID: 0x%08x";
6141                                                         add_eid = TRUE;
6142                                                         resolve_eid = TRUE;
6143                                                         strcpy(global_object_name, request_value->object_name);
6144                                                         global_eid = pvalues[1].vvalue;
6145                                                         pvalues[1].vlength = 4;
6146                                                         pvalues[1].voffset = nds_offset;
6147                                                         pvalues[1].hfname = hf_nds_eid;
6148                                                         nds_offset = nds_offset+pvalues[1].vlength;
6149                                                         pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
6150                                                         pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
6151                                                         pvalues[2].vdesc = "Referral Records: %u";
6152                                                         pvalues[2].vlength = 4;
6153                                                         pvalues[2].voffset = nds_offset;
6154                                                         pvalues[2].hfname = hf_nds_referrals;
6155                                                         pvalues[2].mvtype = MVTYPE_LOC_ADDR_REFERRAL_REPLY;
6156                                                         break;
6157                                                 case NDS_TAG_REMOTE_ENTRY:
6158                                                         nds_offset += 4;   /* GUINT32 reserved field */
6159                                                         pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
6160                                                         pvalues[1].vtype = VTYPE_UINT32;
6161                                                         pvalues[1].vdesc = "Entry ID: 0x%08x";
6162                                                         add_eid = TRUE;
6163                                                         resolve_eid = TRUE;
6164                                                         global_eid = pvalues[1].vvalue;
6165                                                         strcpy(global_object_name, request_value->object_name);
6166                                                         pvalues[1].vlength = 4;
6167                                                         pvalues[1].voffset = nds_offset;
6168                                                         pvalues[1].hfname = hf_nds_eid;
6169                                                         nds_offset = nds_offset+pvalues[1].vlength;
6170                                                         pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
6171                                                         pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
6172                                                         pvalues[2].vdesc = "Referral Records: %u";
6173                                                         pvalues[2].vlength = 4;
6174                                                         pvalues[2].voffset = nds_offset;
6175                                                         pvalues[2].hfname = hf_nds_referrals;
6176                                                         pvalues[2].mvtype = MVTYPE_LOC_ADDR_REFERRAL_REPLY;
6177                                                         break;
6178                                                 case NDS_TAG_ALIAS_ENTRY:
6179                                                         pvalues[1].vtype = VTYPE_STRING;
6180                                                         pvalues[1].vdesc = "Alias Name: %s";
6181                                                         pvalues[1].mvtype = MVTYPE_ATTR_REQUEST;
6182                                                         pvalues[1].vvalue = 0;
6183                                                         pvalues[1].vlength = 256;
6184                                                         pvalues[1].vlength = tvb_get_letohl(tvb, nds_offset);
6185                                                         if (pvalues[1].vlength == 0x00)
6186                                                         {
6187                                                                 pvalues[1].vtype = VTYPE_NONE;
6188                                                                 break;
6189                                                         }
6190                                                         pvalues[1].voffset = nds_offset+4;
6191                                                         nds_offset += 4;
6192                                                         get_string(tvb, pvalues[1].voffset, pvalues[1].vlength, pvalues[1].vstring);
6193                                                         nds_offset += pvalues[1].vlength;
6194                                                         nds_offset += align_4(tvb, nds_offset);
6195                                                         pvalues[1].hfname= hf_nds_name;
6196                                                         break;
6197                                                 case NDS_TAG_REFERRAL_INFORMATION:
6198                                                         pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
6199                                                         pvalues[1].vtype = VTYPE_UINT32;
6200                                                         pvalues[1].vdesc = "Distance Object is From Root: 0x%08x";
6201                                                         pvalues[1].vlength = 4;
6202                                                         pvalues[1].voffset = nds_offset;
6203                                                         pvalues[1].hfname = hf_nds_eid;
6204                                                         nds_offset = nds_offset+pvalues[1].vlength;
6205                                                         pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
6206                                                         pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
6207                                                         pvalues[2].vdesc = "Referral Records: %u";
6208                                                         pvalues[2].vlength = 4;
6209                                                         pvalues[2].voffset = nds_offset;
6210                                                         pvalues[2].hfname = hf_nds_depth;
6211                                                         pvalues[2].mvtype = MVTYPE_ADDR_REFERRAL_REPLY;
6212                                                         break;
6213                                                 case NDS_TAG_ENTRY_AND_REFERRALS:
6214                                                         pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
6215                                                         pvalues[1].vtype = VTYPE_UINT32;
6216                                                         pvalues[1].vdesc = "Result Flags: 0x%08x";
6217                                                         pvalues[1].vlength = 4;
6218                                                         pvalues[1].voffset = nds_offset;
6219                                                         pvalues[1].hfname = hf_nds_result_flags;
6220                                                         nds_offset = nds_offset+pvalues[1].vlength;
6221                                                         pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
6222                                                         pvalues[2].vtype = VTYPE_UINT32;
6223                                                         pvalues[2].vdesc = "Entry ID: 0x%08x";
6224                                                         add_eid = TRUE;
6225                                                         resolve_eid = TRUE;
6226                                                         global_eid = pvalues[2].vvalue;
6227                                                         strcpy(global_object_name, request_value->object_name);
6228                                                         pvalues[2].vlength = 4;
6229                                                         pvalues[2].voffset = nds_offset;
6230                                                         pvalues[2].hfname = hf_nds_eid;
6231                                                         nds_offset = nds_offset+pvalues[2].vlength;
6232                                                         pvalues[3].vvalue = tvb_get_letohl(tvb, nds_offset);
6233                                                         pvalues[3].vtype = VTYPE_MULTIVALUE_UINT32;
6234                                                         pvalues[3].vdesc = "Referral Records: %u";
6235                                                         pvalues[3].vlength = 4;
6236                                                         pvalues[3].voffset = nds_offset;
6237                                                         pvalues[3].mvtype = MVTYPE_ADDR_REFERRAL_REPLY;
6238                                                         pvalues[3].hfname = hf_nds_referrals;
6239                                                         break;
6240                                                 default:
6241                                                         break;
6242                                         }
6243                                 }
6244                                 else
6245                                 {
6246                                         pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
6247                                         pvalues[0].vtype = VTYPE_UINT32;
6248                                         pvalues[0].vdesc = "CRC: 0x%08x";
6249                                         pvalues[0].vlength = 4;
6250                                         pvalues[0].voffset = nds_offset;
6251                                         pvalues[0].hfname = hf_nds_crc;
6252                                         nds_offset = nds_offset+pvalues[0].vlength;
6253                                         pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
6254                                         pvalues[1].vstring = (char *)match_strval(pvalues[1].vvalue, nds_tags);
6255                                         if(pvalues[1].vstring == NULL)
6256                                         {
6257                                                 pvalues[1].vstring = "No Tags Set";
6258                                         }
6259                                         pvalues[1].vtype = VTYPE_STRING;
6260                                         pvalues[1].vdesc = "Tag: %s";
6261                                         pvalues[1].vlength = 4;
6262                                         pvalues[1].voffset = nds_offset;
6263                                         nds_offset = nds_offset+pvalues[1].vlength;
6264                                         pvalues[1].hfname = hf_nds_tag_string;
6265                                         switch(pvalues[1].vvalue)
6266                                         {
6267                                                 case NDS_TAG_NO_SUCH_ENTRY:
6268                                                         break;
6269                                                 case NDS_TAG_LOCAL_ENTRY:
6270                                                         pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
6271                                                         pvalues[2].vtype = VTYPE_UINT32;
6272                                                         pvalues[2].vdesc = "Entry ID: 0x%08x";
6273                                                         add_eid = TRUE;
6274                                                         resolve_eid = TRUE;
6275                                                         global_eid = pvalues[2].vvalue;
6276                                                         strcpy(global_object_name, request_value->object_name);
6277                                                         pvalues[2].vlength = 4;
6278                                                         pvalues[2].voffset = nds_offset;
6279                                                         pvalues[2].hfname = hf_nds_eid;
6280                                                         nds_offset = nds_offset+pvalues[2].vlength;
6281                                                         pvalues[3].vvalue = tvb_get_letohl(tvb, nds_offset);
6282                                                         pvalues[3].vtype = VTYPE_MULTIVALUE_UINT32;
6283                                                         pvalues[3].vdesc = "Referral Records: %u";
6284                                                         pvalues[3].vlength = 4;
6285                                                         pvalues[3].voffset = nds_offset;
6286                                                         pvalues[3].hfname = hf_nds_referrals;
6287                                                         pvalues[3].mvtype = MVTYPE_LOC_ADDR_REFERRAL_REPLY;
6288                                                         break;
6289                                                 case NDS_TAG_REMOTE_ENTRY:
6290                                                         nds_offset += 4;   /* GUINT32 reserved field */
6291                                                         pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
6292                                                         add_eid = TRUE;
6293                                                         resolve_eid = TRUE;
6294                                                         global_eid = pvalues[2].vvalue;
6295                                                         strcpy(global_object_name, request_value->object_name);
6296                                                         pvalues[2].vtype = VTYPE_UINT32;
6297                                                         pvalues[2].vdesc = "Entry ID: 0x%08x";
6298                                                         pvalues[2].vlength = 4;
6299                                                         pvalues[2].voffset = nds_offset;
6300                                                         pvalues[2].hfname = hf_nds_eid;
6301                                                         nds_offset = nds_offset+pvalues[2].vlength;
6302                                                         pvalues[3].vvalue = tvb_get_letohl(tvb, nds_offset);
6303                                                         pvalues[3].vtype = VTYPE_MULTIVALUE_UINT32;
6304                                                         pvalues[3].vdesc = "Referral Records: %u";
6305                                                         pvalues[3].vlength = 4;
6306                                                         pvalues[3].voffset = nds_offset;
6307                                                         pvalues[3].hfname = hf_nds_referrals;
6308                                                         pvalues[3].mvtype = MVTYPE_LOC_ADDR_REFERRAL_REPLY;
6309                                                         break;
6310                                                 case NDS_TAG_ALIAS_ENTRY:
6311                                                         pvalues[2].vtype = VTYPE_STRING;
6312                                                         pvalues[2].vdesc = "Alias Name: %s";
6313                                                         pvalues[2].mvtype = MVTYPE_ATTR_REQUEST;
6314                                                         pvalues[2].vvalue = 0;
6315                                                         pvalues[2].vlength = 256;
6316                                                         pvalues[2].vlength = tvb_get_letohl(tvb, nds_offset);
6317                                                         if (pvalues[2].vlength == 0x00)
6318                                                         {
6319                                                                 pvalues[2].vtype = VTYPE_NONE;
6320                                                                 break;
6321                                                         }
6322                                                         pvalues[2].voffset = nds_offset+4;
6323                                                         nds_offset += 4;
6324                                                         get_string(tvb, pvalues[2].voffset, pvalues[2].vlength, pvalues[2].vstring);
6325                                                         nds_offset += pvalues[2].vlength;
6326                                                         nds_offset += align_4(tvb, nds_offset);
6327                                                         pvalues[2].hfname= hf_nds_name;
6328                                                         break;
6329                                                 case NDS_TAG_REFERRAL_INFORMATION:
6330                                                         pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
6331                                                         pvalues[2].vtype = VTYPE_UINT32;
6332                                                         pvalues[2].vdesc = "Distance Object is From Root: 0x%08x";
6333                                                         pvalues[2].vlength = 4;
6334                                                         pvalues[2].voffset = nds_offset;
6335                                                         pvalues[2].hfname = hf_nds_eid;
6336                                                         nds_offset = nds_offset+pvalues[2].vlength;
6337                                                         pvalues[3].vvalue = tvb_get_letohl(tvb, nds_offset);
6338                                                         pvalues[3].vtype = VTYPE_MULTIVALUE_UINT32;
6339                                                         pvalues[3].vdesc = "Referral Records: %u";
6340                                                         pvalues[3].vlength = 4;
6341                                                         pvalues[3].voffset = nds_offset;
6342                                                         pvalues[3].hfname = hf_nds_depth;
6343                                                         pvalues[3].mvtype = MVTYPE_ADDR_REFERRAL_REPLY;
6344                                                         break;
6345                                                 case NDS_TAG_ENTRY_AND_REFERRALS:
6346                                                         pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
6347                                                         pvalues[2].vtype = VTYPE_UINT32;
6348                                                         pvalues[2].vdesc = "Result Flags: 0x%08x";
6349                                                         pvalues[2].vlength = 4;
6350                                                         pvalues[2].voffset = nds_offset;
6351                                                         pvalues[2].hfname = hf_nds_result_flags;
6352                                                         nds_offset = nds_offset+pvalues[2].vlength;
6353                                                         pvalues[3].vvalue = tvb_get_letohl(tvb, nds_offset);
6354                                                         pvalues[3].vtype = VTYPE_UINT32;
6355                                                         pvalues[3].vdesc = "Entry ID: 0x%08x";
6356                                                         add_eid = TRUE;
6357                                                         resolve_eid = TRUE;
6358                                                         strcpy(global_object_name, request_value->object_name);
6359                                                         global_eid = pvalues[3].vvalue;
6360                                                         pvalues[3].vlength = 4;
6361                                                         pvalues[3].voffset = nds_offset;
6362                                                         pvalues[3].hfname = hf_nds_eid;
6363                                                         nds_offset = nds_offset+pvalues[3].vlength;
6364                                                         pvalues[4].vvalue = tvb_get_letohl(tvb, nds_offset);
6365                                                         pvalues[4].vtype = VTYPE_MULTIVALUE_UINT32;
6366                                                         pvalues[4].vdesc = "Referral Records: %u";
6367                                                         pvalues[4].vlength = 4;
6368                                                         pvalues[4].voffset = nds_offset;
6369                                                         pvalues[4].mvtype = MVTYPE_ADDR_REFERRAL_REPLY;
6370                                                         pvalues[4].hfname = hf_nds_referrals;
6371                                                         break;
6372                                                 default:
6373                                                         break;
6374                                         }
6375                                                                 
6376                                 }
6377                                 break;
6378                         case 0x02:    
6379                                 if(request_value->nds_version != 0x000000fe)
6380                                 { 
6381                                         pvalues[0].vvalue = 1;
6382                                         pvalues[0].vtype = VTYPE_MULTIVALUE_UINT32;
6383                                         pvalues[0].vdesc = "Entry Information";
6384                                         pvalues[0].vlength = 0;
6385                                         pvalues[0].voffset = nds_offset-4;
6386                                         pvalues[0].hfname = hf_nds_name;
6387                                         pvalues[0].mvtype = MVTYPE_LIST_PARTITIONS;
6388                                         pvalues[0].vflags = request_value->req_nds_flags;
6389                                 }
6390                                 else
6391                                 {
6392                                         pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
6393                                         pvalues[0].vtype = VTYPE_UINT32;
6394                                         pvalues[0].vdesc = "CRC: 0x%08x";
6395                                         pvalues[0].vlength = 4;
6396                                         pvalues[0].voffset = nds_offset;
6397                                         pvalues[0].hfname = hf_nds_crc;
6398                                         nds_offset = nds_offset+pvalues[0].vlength;
6399                                         pvalues[1].vvalue = 1;
6400                                         pvalues[1].vtype = VTYPE_MULTIVALUE_UINT32;
6401                                         pvalues[1].vdesc = "Entry Information";
6402                                         pvalues[1].vlength = 0;
6403                                         pvalues[1].voffset = nds_offset-4;
6404                                         pvalues[1].hfname = hf_nds_name;
6405                                         pvalues[1].mvtype = MVTYPE_LIST_PARTITIONS;
6406                                         pvalues[1].vflags = request_value->req_nds_flags;
6407                                 }
6408                                 break;
6409                         case 0x03:    
6410                                 if(request_value->nds_version != 0x000000fe)
6411                                 { 
6412                                         pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
6413                                         pvalues[0].vtype = VTYPE_UINT32;
6414                                         pvalues[0].vdesc = "Iteration Handle: 0x%08x";
6415                                         pvalues[0].vlength = 4;
6416                                         pvalues[0].voffset = nds_offset;
6417                                         pvalues[0].hfname = hf_nds_iteration;
6418                                         nds_offset = nds_offset+pvalues[0].vlength;
6419                                         pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
6420                                         pvalues[1].vstring = (char *)match_strval(pvalues[1].vvalue, nds_info_type);
6421                                         if(pvalues[1].vstring == NULL)
6422                                         {
6423                                                 pvalues[1].vstring = "No Info Type Set";
6424                                         }
6425                                         pvalues[1].vtype = VTYPE_STRING;
6426                                         pvalues[1].vdesc = "Info Type: %s";
6427                                         pvalues[1].vlength = 4;
6428                                         pvalues[1].voffset = nds_offset;
6429                                         pvalues[1].hfname = hf_nds_info_type;
6430                                         nds_offset = nds_offset+pvalues[1].vlength;
6431                                         pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
6432                                         pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
6433                                         pvalues[2].vdesc = "Number of Attributes: %u";
6434                                         pvalues[2].vlength = 4;
6435                                         pvalues[2].voffset = nds_offset;
6436                                         pvalues[2].hfname = hf_nds_attr;
6437                                         pvalues[2].mvtype = MVTYPE_ATTR_REPLY;
6438                                         pvalues[2].vflags = request_value->req_nds_flags;
6439                                         pvalues[2].nds_version = request_value->nds_version;
6440                                 }
6441                                 else
6442                                 {
6443                                         pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
6444                                         pvalues[0].vtype = VTYPE_UINT32;
6445                                         pvalues[0].vdesc = "CRC: 0x%08x";
6446                                         pvalues[0].vlength = 4;
6447                                         pvalues[0].voffset = nds_offset;
6448                                         pvalues[0].hfname = hf_nds_crc;
6449                                         nds_offset = nds_offset+pvalues[0].vlength;
6450                                         pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
6451                                         pvalues[1].vtype = VTYPE_UINT32;
6452                                         pvalues[1].vdesc = "Iteration Handle: 0x%08x";
6453                                         pvalues[1].vlength = 4;
6454                                         pvalues[1].voffset = nds_offset;
6455                                         pvalues[1].hfname = hf_nds_iteration;
6456                                         nds_offset = nds_offset+pvalues[1].vlength;
6457                                         pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
6458                                         pvalues[2].vstring = (char *)match_strval(pvalues[2].vvalue, nds_info_type);
6459                                         if(pvalues[2].vstring == NULL)
6460                                         {
6461                                                 pvalues[2].vstring = "No Info Type Set";
6462                                         }
6463                                         pvalues[2].vtype = VTYPE_STRING;
6464                                         pvalues[2].vdesc = "Info Type: %s";
6465                                         pvalues[2].vlength = 4;
6466                                         pvalues[2].voffset = nds_offset;
6467                                         pvalues[2].hfname = hf_nds_info_type;
6468                                         nds_offset = nds_offset+pvalues[2].vlength;
6469                                         pvalues[3].vvalue = tvb_get_letohl(tvb, nds_offset);
6470                                         pvalues[3].vtype = VTYPE_MULTIVALUE_UINT32;
6471                                         pvalues[3].vdesc = "Number of Attributes: %u";
6472                                         pvalues[3].vlength = 4;
6473                                         pvalues[3].voffset = nds_offset;
6474                                         pvalues[3].hfname = hf_nds_attr;
6475                                         pvalues[3].mvtype = MVTYPE_ATTR_REPLY;
6476                                         pvalues[3].vflags = request_value->req_nds_flags;
6477                                         pvalues[3].nds_version = request_value->nds_version;
6478                                 }
6479                                 break;
6480                         case 0x04:    
6481                                 pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
6482                                 if (pvalues[0].vvalue == 0x00000000)
6483                                 {
6484                                         pvalues[0].vstring = "Did Not Match";
6485                                 }        
6486                                 else
6487                                 {
6488                                         pvalues[0].vstring = "Matched";
6489                                 }
6490                                 pvalues[0].vtype = VTYPE_STRING;
6491                                 pvalues[0].vdesc = "Compare Values Returned - %s";
6492                                 pvalues[0].vlength = 4;
6493                                 pvalues[0].voffset = nds_offset;
6494                                 pvalues[0].mvtype = 0;
6495                                 pvalues[0].hfname= hf_nds_compare_results;
6496                                 nds_offset += pvalues[0].vlength;
6497                                 break;
6498                         case 0x05:    
6499                                 pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
6500                                 pvalues[0].vtype = VTYPE_UINT32;
6501                                 pvalues[0].vdesc = "Iteration Handle: 0x%08x";
6502                                 pvalues[0].vlength = 4;
6503                                 pvalues[0].voffset = nds_offset;
6504                                 pvalues[0].hfname = hf_nds_iteration;
6505                                 nds_offset = nds_offset+pvalues[0].vlength;
6506                                 pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
6507                                 pvalues[1].vtype = VTYPE_MULTIVALUE_UINT32;
6508                                 pvalues[1].vdesc = "Entry Information";
6509                                 pvalues[1].vlength = 0;
6510                                 pvalues[1].voffset = nds_offset;
6511                                 pvalues[1].hfname = hf_nds_name;
6512                                 pvalues[1].mvtype = MVTYPE_LIST_PARTITIONS;
6513                                 pvalues[1].vflags = request_value->req_nds_flags;
6514                                 break;
6515                         case 0x06:    
6516                                 break;
6517                         case 0x07:    
6518                                 break;
6519                         case 0x08:    
6520                                 break;
6521                         case 0x09:    
6522                                 break;
6523                         case 0x0a:    
6524                                 break;
6525                         case 0x0b:    
6526                                 break;
6527                         case 0x0c:    
6528                                 break;
6529                         case 0x0d:    
6530                                 break;
6531                         case 0x0e:    
6532                                 break;
6533                         case 0x0f:    
6534                                 pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
6535                                 pvalues[0].vtype = VTYPE_UINT32;
6536                                 pvalues[0].vdesc = "Iteration Handle: 0x%08x";
6537                                 pvalues[0].vlength = 4;
6538                                 pvalues[0].voffset = nds_offset;
6539                                 pvalues[0].hfname = hf_nds_iteration;
6540                                 nds_offset = nds_offset+pvalues[0].vlength;
6541                                 pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
6542                                 pvalues[1].vstring = (char *)match_strval(pvalues[1].vvalue, class_def_type);
6543                                 if(pvalues[1].vstring == NULL)
6544                                 {
6545                                         pvalues[1].vstring = "No Class Definition Type Set";
6546                                 }
6547                                 pvalues[1].vtype = VTYPE_STRING;
6548                                 pvalues[1].vdesc = "Class Definition Type: %s";
6549                                 pvalues[1].vlength = 4;
6550                                 pvalues[1].voffset = nds_offset;
6551                                 pvalues[1].mvtype = 0;
6552                                 pvalues[1].hfname= hf_nds_class_def_type;
6553                                 nds_offset = nds_offset + pvalues[1].vlength;
6554                                 pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);;
6555                                 pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
6556                                 pvalues[2].vdesc = "Class Definitions %u";
6557                                 pvalues[2].vlength = 0;
6558                                 pvalues[2].voffset = nds_offset;
6559                                 pvalues[2].hfname = hf_nds_classes;
6560                                 pvalues[2].mvtype = MVTYPE_CLASS_NAMES;
6561                                 pvalues[2].vflags = request_value->req_nds_flags;
6562                                 break;
6563                         case 0x10:    
6564                                 break;
6565                         case 0x11:    
6566                                 break;
6567                         case 0x12:    
6568                                 pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
6569                                 pvalues[0].vtype = VTYPE_UINT32;
6570                                 pvalues[0].vdesc = "Iteration Handle: 0x%08x";
6571                                 pvalues[0].vlength = 4;
6572                                 pvalues[0].voffset = nds_offset;
6573                                 pvalues[0].hfname = hf_nds_iteration;
6574                                 nds_offset = nds_offset+pvalues[0].vlength;
6575                                 pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
6576                                 pvalues[1].vtype = VTYPE_MULTIVALUE_UINT32;
6577                                 pvalues[1].vdesc = "Classes: %u";
6578                                 pvalues[1].vlength = 4;
6579                                 pvalues[1].voffset = nds_offset;
6580                                 pvalues[1].mvtype = MVTYPE_READ_CLASS_REQ;
6581                                 pvalues[1].hfname= hf_nds_classes;
6582                                 break;
6583                         case 0x13:    
6584                                 pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
6585                                 pvalues[0].vtype = VTYPE_UINT32;
6586                                 pvalues[0].vdesc = "Privileges: 0x%08x";
6587                                 pvalues[0].vlength = 4;
6588                                 pvalues[0].voffset = nds_offset;
6589                                 pvalues[0].hfname = hf_nds_privileges;
6590                                 nds_offset = nds_offset+pvalues[0].vlength;
6591                                 break;
6592                         case 0x14:    
6593                                 break;
6594                         case 0x15:    
6595                                 break;
6596                         case 0x16:    
6597                                 pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
6598                                 pvalues[0].vtype = VTYPE_UINT32;
6599                                 pvalues[0].vdesc = "Iteration Handle: 0x%08x";
6600                                 pvalues[0].vlength = 4;
6601                                 pvalues[0].voffset = nds_offset;
6602                                 pvalues[0].hfname = hf_nds_iteration;
6603                                 nds_offset = nds_offset+pvalues[0].vlength;
6604                                 pvalues[1].vtype = VTYPE_STRING;
6605                                 pvalues[1].vdesc = "Server Distinguished Name: %s";
6606                                 pvalues[1].mvtype = MVTYPE_ATTR_REQUEST;
6607                                 pvalues[1].vvalue = 0;
6608                                 pvalues[1].vlength = 256;
6609                                 pvalues[1].vlength = tvb_get_letohl(tvb, nds_offset);
6610                                 if (pvalues[1].vlength == 0x00)
6611                                 {
6612                                         pvalues[1].vtype = VTYPE_NONE;
6613                                         break;
6614                                 }
6615                                 pvalues[1].voffset = nds_offset+4;
6616                                 nds_offset += 4;
6617                                 get_string(tvb, pvalues[1].voffset, pvalues[1].vlength, pvalues[1].vstring);
6618                                 nds_offset += pvalues[1].vlength;
6619                                 nds_offset += align_4(tvb, nds_offset);
6620                                 pvalues[1].hfname= hf_nds_name;
6621                                 nds_offset += align_4(tvb, nds_offset);
6622                                 pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
6623                                 pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
6624                                 pvalues[2].vdesc = "Replicas: %u";
6625                                 pvalues[2].vlength = 4;
6626                                 pvalues[2].voffset = nds_offset;
6627                                 pvalues[2].hfname = hf_nds_replicas;
6628                                 pvalues[2].mvtype = MVTYPE_READ_REPLICAS;
6629                                 pvalues[2].bit1 = "Output Flags";
6630                                 pvalues[2].bit2 = "Entry ID";
6631                                 pvalues[2].bit3 = "Replica State";
6632                                 pvalues[2].bit4 = "Modification Timestamp";
6633                                 pvalues[2].bit5 = "Purge Time";
6634                                 pvalues[2].bit6 = "Local Partition ID";
6635                                 pvalues[2].bit7 = "Distinguished Name";
6636                                 pvalues[2].bit8 = "Replica Type";
6637                                 pvalues[2].bit9 = "Partition Busy";
6638                                 pvalues[2].vflags = request_value->req_nds_flags;
6639                                 break;
6640                         case 0x17:    
6641                                 break;
6642                         case 0x18:    
6643                                 break;
6644                         case 0x19:    
6645                                 break;
6646                         case 0x1a:    
6647                                 break;
6648                         case 0x1b:    
6649                                 pvalues[0].vvalue = tvb_get_ntohl(tvb, nds_offset);
6650                                 pvalues[0].vtype = VTYPE_UINT32;
6651                                 pvalues[0].vdesc = "File Handle: 0x%08x";
6652                                 pvalues[0].vlength = 4;
6653                                 pvalues[0].voffset = nds_offset;
6654                                 pvalues[0].hfname = hf_nds_file_handle;
6655                                 nds_offset = nds_offset+pvalues[0].vlength;
6656                                 pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
6657                                 pvalues[1].vtype = VTYPE_UINT32;
6658                                 pvalues[1].vdesc = "File Size: %u";
6659                                 pvalues[1].vlength = 4;
6660                                 pvalues[1].voffset = nds_offset;
6661                                 pvalues[1].hfname = hf_nds_file_size;
6662                                 nds_offset = nds_offset+pvalues[1].vlength;
6663                                 break;
6664                         case 0x1c:    
6665                                 break;
6666                         case 0x1d:    
6667                                 break;
6668                         case 0x1e:    
6669                                 break;
6670                         case 0x1f:    
6671                                 break;
6672                         case 0x20:    
6673                                 break;
6674                         case 0x21:    
6675                                 break;
6676                         case 0x22:    
6677                                 break;
6678                         case 0x23:    
6679                                 break;
6680                         case 0x24:    
6681                                 break;
6682                         case 0x25:    
6683                                 break;
6684                         case 0x26:    
6685                                 break;
6686                         case 0x27:    
6687                                 break;
6688                         case 0x28:    
6689                                 break;
6690                         case 0x29:    
6691                                 break;                  
6692                         case 0x2a:    
6693                                 break;
6694                         case 0x2b:    
6695                                 break;
6696                         case 0x2c:    
6697                                 break;
6698                         case 0x2d:    
6699                                 break;
6700                         case 0x2e:    
6701                                 break;
6702                         case 0x2f:    
6703                                 break;
6704                         case 0x30:
6705                                 break;
6706                         case 0x31:
6707                                 break;
6708                         case 0x32:    
6709                                 break;
6710                         case 0x33:    
6711                                 break;
6712                         case 0x34:    
6713                                 break;
6714                         case 0x35:    
6715                                 if(request_value->nds_version != 0x000000fe)
6716                                 { 
6717                                         pvalues[0].vtype = VTYPE_STRING;
6718                                         pvalues[0].vdesc = "Distinguished Name: %s";
6719                                         pvalues[0].mvtype = MVTYPE_ATTR_REQUEST;
6720                                         pvalues[0].vvalue = 0;
6721                                         pvalues[0].vlength = 256;
6722                                         pvalues[0].vlength = tvb_get_letohl(tvb, nds_offset);
6723                                         if (pvalues[0].vlength == 0x00)
6724                                         {
6725                                                 pvalues[0].vtype = VTYPE_NONE;
6726                                                 break;
6727                                         }
6728                                         pvalues[0].voffset = nds_offset+4;
6729                                         nds_offset += 4;
6730                                         get_string(tvb, pvalues[0].voffset, pvalues[0].vlength, pvalues[0].vstring);
6731                                         nds_offset += pvalues[0].vlength;
6732                                         nds_offset += align_4(tvb, nds_offset);
6733                                         pvalues[0].hfname= hf_nds_name;
6734                                         pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
6735                                         pvalues[1].vtype = VTYPE_MULTIVALUE_UINT32;
6736                                         pvalues[1].vdesc = "Referral Records: %u";
6737                                         pvalues[1].vlength = 4;
6738                                         pvalues[1].voffset = nds_offset;
6739                                         pvalues[1].hfname = hf_nds_referrals;
6740                                         pvalues[1].mvtype = MVTYPE_LOC_ADDR_REFERRAL_REPLY;
6741                                 }
6742                                 else
6743                                 {
6744                                         pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
6745                                         pvalues[0].vtype = VTYPE_UINT32;
6746                                         pvalues[0].vdesc = "Iteration Handle: 0x%08x";
6747                                         pvalues[0].vlength = 4;
6748                                         pvalues[0].voffset = nds_offset;
6749                                         pvalues[0].hfname = hf_nds_iteration;
6750                                         nds_offset = nds_offset+pvalues[0].vlength;
6751                                         pvalues[1].vtype = VTYPE_STRING;
6752                                         pvalues[1].vdesc = "Distinguished Name: %s";
6753                                         pvalues[1].mvtype = MVTYPE_ATTR_REQUEST;
6754                                         pvalues[1].vvalue = 0;
6755                                         pvalues[1].vlength = 256;
6756                                         pvalues[1].vlength = tvb_get_letohl(tvb, nds_offset);
6757                                         if (pvalues[1].vlength == 0x00)
6758                                         {
6759                                                 pvalues[1].vtype = VTYPE_NONE;
6760                                                 break;
6761                                         }
6762                                         pvalues[1].voffset = nds_offset+4;
6763                                         nds_offset += 4;
6764                                         get_string(tvb, pvalues[1].voffset, pvalues[1].vlength, pvalues[1].vstring);
6765                                         nds_offset += pvalues[1].vlength;
6766                                         nds_offset += align_4(tvb, nds_offset);
6767                                         pvalues[1].hfname= hf_nds_name;
6768                                         pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
6769                                         pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
6770                                         pvalues[2].vdesc = "Referral Records: %u";
6771                                         pvalues[2].vlength = 4;
6772                                         pvalues[2].voffset = nds_offset;
6773                                         pvalues[2].hfname = hf_nds_referrals;
6774                                         pvalues[2].mvtype = MVTYPE_LOC_ADDR_REFERRAL_REPLY;
6775                                 }        
6776                                 break;
6777                         case 0x36:    
6778                                 break;
6779                         case 0x37:    
6780                                 break;
6781                         case 0x38:    
6782                                 break;
6783                         case 0x39:    
6784                                 break;
6785                         case 0x3a:    
6786                                 break;
6787                         case 0x3b:    
6788                                 break;
6789                         case 0x3c:    
6790                                 break;
6791                         case 0x3d:    
6792                                 break;
6793                         case 0x3e:    
6794                                 break;
6795                         case 0x3f:    
6796                                 break;
6797                         case 0x40:    
6798                                 break;
6799                         case 0x41:              
6800                                 break;
6801                         case 0x42:    
6802                                 break;
6803                         case 0x43:    
6804                                 break;
6805                         case 0x44:    
6806                                 break;
6807                         case 0x45:    
6808                                 break;
6809                         case 0x46:    
6810                                 break;
6811                         case 0x47:    
6812                                 break;
6813                         case 0x48:    
6814                                 break;
6815                         case 0x49:    
6816                                 break;
6817                         case 0x4a:    
6818                                 break;
6819                         case 0x4b:    
6820                                 break;
6821                         case 0x4c:    
6822                                 break;
6823                         case 0x4d:    
6824                                 break;
6825                         default:
6826                                 break;
6827                         }
6828                         if(request_value->nds_request_verb != 0)
6829                         {
6830                                 proto_tree_add_uint_format(ncp_tree,
6831                                     hf_ncp_nds_verb, tvb, 6, 0,
6832                                     request_value->nds_request_verb,
6833                                     "NDS Verb: %d, %s",
6834                                     request_value->nds_request_verb, verb_string);
6835                         }
6836                         /* NDS Entry ID's (EID) is identified in the reply
6837                          * packet of an NDS resolve name. We need to store
6838                          * this EID and its associated name into our hash
6839                          * so that we can resolve the name for other NDS
6840                          * requests. */
6841                         if (!pinfo->fd->flags.visited) {
6842                                 if(add_eid)
6843                                 {
6844                                         request_eid_value = ncp_eid_hash_lookup(conversation, global_eid);
6845                                         if (!request_eid_value) {
6846                                                 request_eid_value = ncp_eid_hash_insert(global_eid);
6847                                                 strcpy(request_eid_value->object_name, global_object_name);
6848                                         }
6849                                 }
6850                         }
6851                         /* Echo EID data to expert Chat window */
6852                         if (add_eid && nds_echo_eid) {
6853                             expert_add_info_format(pinfo, NULL,
6854                                 PI_RESPONSE_CODE, PI_CHAT,
6855                                 "EID (%08x) = %s", global_eid, global_object_name);
6856                         }
6857                         /* For NDS requests with just an EID, resolve name
6858                          * from hash table. */
6859                         if(resolve_eid)
6860                         {
6861                                 request_eid_value = ncp_eid_hash_lookup(conversation, global_eid);
6862                                 if (request_eid_value) {
6863                                         strcpy(global_object_name, request_eid_value->object_name);
6864                                         proto_tree_add_string_format(ncp_tree,
6865                                             hf_nds_name, tvb, 6, 0,
6866                                             global_object_name,
6867                                             "NDS Name for EID - %s",
6868                                             global_object_name);
6869                                 }
6870                         }        
6871                         for (i = 0; i < 9; i++) {
6872                                 switch (pvalues[i].vtype) {
6873
6874                                 case VTYPE_NONE: /* no value */
6875                                         break;
6876
6877                                 case VTYPE_UINT8:
6878                                         proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
6879                                             pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %u",
6880                                             pvalues[i].vtype);
6881                                         break;
6882
6883                                 case VTYPE_UINT16:
6884                                         proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
6885                                             pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %u",
6886                                             pvalues[i].vtype);
6887                                         break;
6888
6889                                 case VTYPE_UINT32:
6890                                         proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
6891                                             pvalues[i].vlength, pvalues[i].vvalue, pvalues[i].vdesc,
6892                                             pvalues[i].vvalue);
6893                                         break;
6894
6895                                 case VTYPE_STRING:
6896                                         proto_tree_add_string_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset, 
6897                                             pvalues[i].vlength, pvalues[i].vstring, pvalues[i].vdesc,
6898                                             pvalues[i].vstring);
6899                                         break;
6900
6901                                 case VTYPE_BITFIELD:
6902                                         process_bitfield(ncp_tree, tvb, &pvalues[i]);
6903                                         break;
6904
6905                                 case VTYPE_MULTIVALUE_UINT32:
6906                                         process_multivalues(ncp_tree, tvb, &pvalues[i]);
6907                                         break;
6908
6909                                 default:
6910                                         proto_tree_add_uint_format(ncp_tree, hf_nds_p1type, tvb, pvalues[i].voffset,
6911                                             pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %u",
6912                                             pvalues[i].vtype);
6913                                         break;
6914                                 }
6915                 }
6916         }
6917 }
6918
6919 void
6920 dissect_ncp_reply(tvbuff_t *tvb, packet_info *pinfo,
6921         guint32 nw_connection, guint8 sequence, guint16 type,
6922         proto_tree *ncp_tree, struct novell_tap *ncp_tap)
6923 {
6924         conversation_t                  *conversation = NULL;
6925         ncp_req_hash_value              *request_value = NULL;
6926         const ncp_record                *ncp_rec = NULL;
6927         int                             *req_cond_results;
6928         guint8                          completion_code=0;
6929         ptvcursor_t                     *ptvc = NULL;
6930         const char                      *error_string;
6931         guint32                         nds_offset = 0;
6932         guint32                         nds_error_code = 0;
6933         guint32                         nds_reply_buffer = 0;
6934         const char                      *nds_error_string = NULL;
6935         guint32                         nds_frag=0;
6936         
6937 #ifdef FAKE_TREE_IS_VISIBLE
6938         if (ncp_tree) {
6939                 PTREE_DATA(ncp_tree)->visible=1;
6940         }
6941 #endif
6942
6943         if (!pinfo->fd->flags.visited) {
6944                 /* Find the conversation whence the request would have come. */
6945                 conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
6946                             PT_NCP, nw_connection, nw_connection, 0);
6947                 if (conversation != NULL) {
6948                         /* find the record telling us the request made that caused
6949                            this reply */
6950                         request_value = ncp_hash_lookup(conversation, sequence);
6951                         if (request_value) {
6952                                 ncp_rec = request_value->ncp_rec;
6953                         }
6954                         p_add_proto_data(pinfo->fd, proto_ncp, (void*) request_value);
6955                 }
6956                 /* else... we haven't seen an NCP Request for that conversation
6957                    and sequence.
6958                    Create Service request packets do not contain nw_connection.
6959                    The initial value is set to 65535 or 0. The reply packet has the
6960                    valid connection. So, we can't find the request packet in
6961                    our conversation list. To trap for this we can just perform
6962                    the search again with 65535 to see if we can locate the
6963                    proper request packet. */
6964                 else {
6965                         conversation = find_conversation(pinfo->fd->num,
6966                             &pinfo->src, &pinfo->dst, PT_NCP, 65535, 65535, 0);
6967                         if (conversation != NULL) {
6968                                 /* find the record telling us the request made
6969                                    that caused this reply */
6970                                 request_value = ncp_hash_lookup(conversation,
6971                                     sequence);
6972                                 if (request_value) {
6973                                         ncp_rec = request_value->ncp_rec;
6974                                 }
6975                                 p_add_proto_data(pinfo->fd, proto_ncp,
6976                                     (void*) request_value);
6977                         }
6978             else {
6979                 conversation = find_conversation(pinfo->fd->num,
6980                     &pinfo->src, &pinfo->dst, PT_NCP, 0, 0, 0);
6981                 if (conversation != NULL) {
6982                     /* find the record telling us the request made
6983                        that caused this reply */
6984                     request_value = ncp_hash_lookup(conversation,
6985                         sequence);
6986                     if (request_value) {
6987                         ncp_rec = request_value->ncp_rec;
6988                     }
6989                     p_add_proto_data(pinfo->fd, proto_ncp,
6990                         (void*) request_value);
6991                 }
6992                 /* else... we haven't seen an NCP Request for that
6993                    conversation and sequence. */
6994             }
6995                 }
6996         }
6997         else {
6998                 request_value = p_get_proto_data(pinfo->fd, proto_ncp);
6999                 if (request_value) {
7000                         ncp_rec = request_value->ncp_rec;
7001                 }
7002         }
7003
7004         /*
7005          * Tap the packet before the dissectors are called so we
7006          * still get the tap listener called even if there is an
7007          * exception.
7008          */
7009         tap_queue_packet(ncp_tap->stat, pinfo, request_value);
7010
7011         if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
7012                 if (ncp_rec && ncp_rec->func==0x68 &&
7013                     (ncp_rec->subfunc==0x02 || ncp_rec->subfunc==0x01)) {
7014                         col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDS");
7015                 }
7016         }
7017
7018         /* A completion code of 0 always means OK. Non-zero means failure,
7019          * but each non-zero value has a different meaning. And the same value
7020          * can have different meanings, depending on the ncp.func (and ncp.subfunc)
7021          * value. */
7022         completion_code = tvb_get_guint8(tvb, 6);
7023         if (completion_code == 0) {
7024                 if(type == NCP_POSITIVE_ACK)
7025                 {
7026                         error_string = "Server Busy, Request Being Processed";
7027                 }
7028                 else
7029                 {                
7030                         error_string = "OK";
7031                 }        
7032         } else {
7033                 if (ncp_rec && ncp_rec->errors) {
7034                         error_string = ncp_error_string(ncp_rec->errors, completion_code);
7035                 }
7036                 else {
7037                         error_string = "Original Request Packet not Found";
7038                 }
7039         }
7040         if (type == NCP_SERVICE_REPLY && ncp_rec && ncp_rec->func==0x68 &&
7041             ncp_rec->subfunc==0x02)
7042         {
7043                 nds_offset = 8;
7044                 nds_reply_buffer = tvb_get_letohl(tvb, nds_offset);
7045                 nds_offset += 4;        
7046                 nds_frag = tvb_get_letohl(tvb, nds_offset);        
7047                 nds_offset += 4;
7048                 /*
7049                  * Is the possibly-reassembled reply large enough to have
7050                  * a completion code?  (We can't check the fragment size
7051                  * as this might just be the last fragment.)
7052                  */
7053                 if (tvb_reported_length_remaining(tvb, nds_offset) >= 4)
7054                 {
7055                         /* Yes - process the completion code. */
7056                         nds_error_code = tvb_get_letohl(tvb, nds_offset);
7057                         nds_error_string = match_strval(nds_error_code, nds_reply_errors);
7058                         if (nds_error_string == NULL)
7059                         {
7060                                 nds_error_string = "NDS Error - No Definition Found";
7061                         }
7062                 }
7063         }
7064         if (check_col(pinfo->cinfo, COL_INFO)) {
7065                 col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s",
7066                     type == NCP_SERVICE_REPLY ? "R" : "ACK",
7067                     nds_error_string ? nds_error_string : error_string);
7068         }
7069
7070         if (ncp_tree) {
7071
7072                 if (request_value) {
7073                         nstime_t ns;
7074
7075                         proto_tree_add_uint(ncp_tree, hf_ncp_req_frame_num, tvb, 0, 0,
7076                                 request_value->req_frame_num);
7077                         nstime_delta(&ns, &pinfo->fd->abs_ts, &request_value->req_frame_time);
7078                         proto_tree_add_time(ncp_tree, hf_ncp_req_frame_time, tvb, 0, 0, &ns);
7079                 }
7080         
7081                 /* Put the func (and maybe subfunc) from the request packet
7082                  * in the proto tree, but hidden. That way filters on ncp.func
7083                  * or ncp.subfunc will find both the requests and the replies.
7084                  */
7085                 if (ncp_rec) {
7086                         proto_tree_add_uint_format(ncp_tree, hf_ncp_func, tvb, 6, 0,
7087                                 ncp_rec->func, "Function: %u (0x%02X), %s",
7088                                 ncp_rec->func, ncp_rec->func, ncp_rec->name);
7089                         if (ncp_requires_subfunc(ncp_rec->func)) {
7090                                 proto_tree_add_uint_format(ncp_tree, hf_ncp_subfunc, tvb, 6, 0,
7091                                         ncp_rec->subfunc, "SubFunction: %u (0x%02x)",
7092                                         ncp_rec->subfunc, ncp_rec->subfunc);
7093                         }
7094                 }
7095         }
7096
7097         expert_item = proto_tree_add_uint_format(ncp_tree, hf_ncp_completion_code, tvb, 6, 1,
7098                 completion_code, "Completion Code: %d (0x89%02x), %s",
7099                 completion_code, completion_code, error_string);
7100         if ((completion_code != 0 || type == NCP_POSITIVE_ACK) && ncp_echo_err) {
7101                 expert_add_info_format(pinfo, expert_item,
7102                     PI_RESPONSE_CODE, PI_ERROR,
7103                     "Error: %d (0x89%02x) %s", completion_code,
7104                     completion_code, error_string);
7105         }
7106
7107         if (ncp_tree) {
7108                 proto_tree_add_item(ncp_tree, hf_ncp_connection_status, tvb,
7109                     7, 1, FALSE);
7110         }
7111         /*
7112          * Unless this is a successful reply, that's all there
7113          * is to parse.
7114          */
7115         if (type != NCP_SERVICE_REPLY || completion_code != 0)
7116                 return;
7117
7118         if (ncp_rec) {
7119                 /* Dissect SSS Reply packets */
7120                 if (ncp_rec->func == 0x5c && request_value)
7121                 {
7122                         dissect_sss_reply(tvb, pinfo, ncp_tree, ncp_rec->subfunc, request_value);
7123                 } 
7124                 /* Dissect NMAS Reply packets */
7125                 if (ncp_rec->func == 0x5e && request_value)
7126                 {
7127                         dissect_nmas_reply(tvb, pinfo, ncp_tree, ncp_rec->func, ncp_rec->subfunc, request_value);
7128                 }
7129                 /* Dissect NDS Ping packets */
7130                 if (ncp_rec->func == 0x68 && ncp_rec->subfunc == 0x01)
7131                 {
7132                         dissect_nds_ping_reply(tvb, pinfo, ncp_tree,
7133                             request_value);
7134                 }
7135                 /* Dissect NDS Reply packets */
7136                 if (ncp_rec->func == 0x68 && ncp_rec->subfunc == 0x02) 
7137                 {
7138                         dissect_nds_reply(tvb, pinfo, ncp_tree, nds_error_code,
7139                             nds_error_string, request_value, conversation);
7140                 }
7141                 /* Echo expert data for connection request/reply */
7142                 /*if (ncp_rec->func == 241 && ncp_echo_conn) {
7143                     expert_add_info_format(pinfo, NULL, PI_RESPONSE_CODE, PI_CHAT, "Connection %d Established", nw_connection);
7144                 } */
7145                 if (ncp_rec->func == 245 && ncp_echo_conn) {
7146                     expert_add_info_format(pinfo, NULL, PI_RESPONSE_CODE, PI_CHAT, "Connection Destroyed");
7147                 }
7148                 if (ncp_rec->reply_ptvc) {
7149                         /* If we're not building a protocol tree, quit;
7150                          * "process_ptvc_record()" assumes we're building
7151                          * a protocol tree, and we don't support putting
7152                          * stuff in the Info column in replies, and no
7153                          * state information is currently updated for
7154                          * replies by "process_ptvc_record()", so we
7155                          * can't, and don't have a reason to, dissect
7156                          * any further if we're not building a protocol
7157                          * tree. */
7158                         if (!ncp_tree)
7159                                 return;
7160
7161                         /* If a non-zero completion code was found, it is
7162                          * legal to not have any fields, even if the packet
7163                          * type is defined as having fields.
7164                          *
7165                          * XXX - we already know that the completion code
7166                          * is 0, as we checked it above.  Is there any
7167                          * reason why we'd want to do a full dissection
7168                          * if the completion code isn't 0? */
7169                         if (completion_code != 0 && tvb_length(tvb) == 8) {
7170                                 return;
7171                         }
7172
7173                         /* Any request condition results? */
7174                         if (request_value) {
7175                                 req_cond_results = request_value->req_cond_results;
7176                         }
7177                         else {
7178                                 req_cond_results = NULL;
7179                         }
7180                         clear_repeat_vars();
7181                         ptvc = ptvcursor_new(ncp_tree, tvb, 8);
7182                         process_ptvc_record(ptvc, ncp_rec->reply_ptvc,
7183                                 req_cond_results, TRUE, ncp_rec);
7184                         ptvcursor_free(ptvc);
7185                 }
7186                 /* Check to see if we need to report to the expert table */
7187                 trap_for_expert_event(ncp_tree, pinfo, ncp_rec, 1);
7188         } else {
7189                 if (tvb_length(tvb) > 8) {
7190                         expert_item = proto_tree_add_text(ncp_tree, tvb, 8, -1,
7191                             "No request record found. Parsing is impossible.");
7192                         if (ncp_echo_err) {
7193                             expert_add_info_format(pinfo, expert_item, PI_SEQUENCE, PI_NOTE, "No request record found.");
7194                         }
7195                 }
7196         }
7197 }
7198
7199 void
7200 dissect_nds_request(tvbuff_t *tvb, packet_info *pinfo,
7201                 guint32 nw_connection, guint8 sequence,
7202                 guint16 type, proto_tree *ncp_tree)
7203 {
7204         guint8                  func, subfunc = 0;
7205         ncp_req_hash_value      *request_value = NULL;
7206         ncp_req_eid_hash_value  *request_eid_value = NULL;
7207         const ncp_record        *ncp_rec = NULL;          
7208         conversation_t          *conversation;
7209         ptvcursor_t             *ptvc = NULL;
7210         proto_tree              *temp_tree = NULL;
7211         gboolean                run_req_cond = FALSE;
7212         gboolean                run_info_str = FALSE;
7213         guint8                  nds_verb = 0;
7214         const char              *verb_string = "";
7215         guint32                 nds_frag = 0;
7216         gboolean                added_arrow;
7217         nds_val                 pvalues[9];
7218         char                    string_buffer[9][1024];
7219         guint8                  nds_version = 0;
7220         guint32                 foffset = 0;
7221         nw_uni_t                req_buffer;
7222         char                    global_object_name[256];
7223         guint32                 global_eid=0;
7224         gboolean                resolve_eid=FALSE;
7225         guint32                 global_flags=0;
7226         int                     i;
7227
7228         for (i = 0; i < 9; i++) {
7229                 pvalues[i].vtype = 0;
7230                 pvalues[i].vvalue = 0;
7231                 pvalues[i].vlength = 0;
7232                 pvalues[i].voffset = 0;
7233                 pvalues[i].hfname = 0;
7234                 pvalues[i].vdesc = "";
7235                 string_buffer[i][0] = '\0';
7236                 pvalues[i].vstring = string_buffer[i];
7237                 pvalues[i].mvtype = 0;
7238                 pvalues[i].vflags = 0;
7239         }
7240         
7241         strcpy(req_buffer.buffer, "");
7242         strcpy(global_object_name, "");
7243         
7244         func = tvb_get_guint8(tvb, 6);
7245         subfunc = tvb_get_guint8(tvb, 7);
7246         
7247         ncp_rec = ncp_record_find(func, subfunc);
7248
7249         /* Check to see if this is a fragment packet */
7250         nds_frag = tvb_get_letohl(tvb, 8);
7251         
7252         /* Get NDS Verb */
7253         if (nds_frag == 0xffffffff) {
7254                 /* First fragment or only fragment. */
7255                 nds_verb = tvb_get_guint8(tvb, 24);
7256                 if (nds_verb == 0xfe) 
7257                 {
7258                         nds_version = nds_verb;
7259                         nds_verb = tvb_get_guint8(tvb, 32);
7260                         foffset = 36;
7261                 }
7262                 else
7263                 {
7264                         nds_version = 0;
7265                         foffset = 28;
7266                 }
7267                 if (type == NCP_SERVICE_REQUEST) {
7268                         proto_tree_add_item(ncp_tree, hf_nds_buffer_size, tvb, foffset,
7269                                             4, TRUE);
7270                 }
7271                 foffset = foffset+4;        
7272                 verb_string = val_to_str(nds_verb, ncp_nds_verb_vals,
7273                     "Continuation Fragment");
7274                 switch(nds_verb) {
7275                 
7276                         case 0x01:
7277                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7278                                 nds_version = pvalues[0].vvalue;
7279                                 pvalues[0].vtype = VTYPE_UINT32;
7280                                 pvalues[0].vdesc = "Version: %u";
7281                                 pvalues[0].vlength = 4;
7282                                 pvalues[0].hfname = hf_nds_ver;
7283                                 pvalues[0].voffset = foffset;
7284                                 foffset = foffset+pvalues[0].vlength;
7285                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7286                                 pvalues[1].vtype = VTYPE_BITFIELD;
7287                                 pvalues[1].vdesc = "Flags:";
7288                                 pvalues[1].vlength = 2;
7289                                 pvalues[1].hfname= hf_nds_nflags;
7290                                 pvalues[1].voffset = foffset;
7291                                 pvalues[1].bit1 = "Entry ID";
7292                                 pvalues[1].bit1hfname = hf_bit1nflags;
7293                                 pvalues[1].bit2 = "Readable";
7294                                 pvalues[1].bit2hfname = hf_bit2nflags;
7295                                 pvalues[1].bit3 = "Writeable";
7296                                 pvalues[1].bit3hfname = hf_bit3nflags;
7297                                 pvalues[1].bit4 = "Master";
7298                                 pvalues[1].bit4hfname = hf_bit4nflags;
7299                                 pvalues[1].bit5 = "Create ID";
7300                                 pvalues[1].bit5hfname = hf_bit5nflags;
7301                                 pvalues[1].bit6 = "Walk Tree";
7302                                 pvalues[1].bit6hfname = hf_bit6nflags;
7303                                 pvalues[1].bit7 = "Dereference Alias";
7304                                 pvalues[1].bit7hfname = hf_bit7nflags;
7305                                 pvalues[1].bit8 = "Not Defined";
7306                                 pvalues[1].bit8hfname = hf_bit8nflags;
7307                                 pvalues[1].bit9 = "Not Defined";
7308                                 pvalues[1].bit9hfname = hf_bit9nflags;
7309                                 pvalues[1].bit10 = "Not Defined";
7310                                 pvalues[1].bit10hfname = hf_bit10nflags;
7311                                 pvalues[1].bit11= "Not Defined";
7312                                 pvalues[1].bit11hfname = hf_bit11nflags;
7313                                 pvalues[1].bit12 = "Not Defined";
7314                                 pvalues[1].bit12hfname = hf_bit12nflags;
7315                                 pvalues[1].bit13 = "Not Defined";
7316                                 pvalues[1].bit13hfname = hf_bit13nflags;
7317                                 pvalues[1].bit14 = "Prefer Referrals";
7318                                 pvalues[1].bit14hfname = hf_bit14nflags;
7319                                 pvalues[1].bit15 = "Prefer Only Referrals";
7320                                 pvalues[1].bit15hfname = hf_bit15nflags;
7321                                 pvalues[1].bit16 = "Not Defined";
7322                                 pvalues[1].bit16hfname = hf_bit16nflags;
7323                                 foffset = foffset+4;
7324                                 if (pvalues[0].vvalue == 0 || pvalues[0].vvalue == 1)
7325                                 {
7326                                         pvalues[2].vtype = VTYPE_UINT32;
7327                                         pvalues[2].vdesc = "Scope: %u";
7328                                         pvalues[2].vlength = 4;
7329                                         pvalues[2].voffset = foffset;
7330                                         pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7331                                         pvalues[2].hfname= hf_nds_scope;
7332                                         foffset = foffset+pvalues[2].vlength;
7333                                         pvalues[3].vtype = VTYPE_STRING;
7334                                         pvalues[3].vdesc = "Name: %s";
7335                                         pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
7336                                         pvalues[3].vvalue = 0;
7337                                         pvalues[3].vlength = 256;
7338                                         pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
7339                                         if (pvalues[3].vlength == 0x00)
7340                                         {
7341                                                 pvalues[3].vtype = VTYPE_NONE;
7342                                                 break;
7343                                         }
7344                                         pvalues[3].voffset = foffset+4;
7345                                         foffset = foffset + 4;
7346                                         get_string(tvb, pvalues[3].voffset, pvalues[3].vlength, req_buffer.buffer);
7347                                         pvalues[3].vstring = req_buffer.buffer;
7348                                         strcpy(global_object_name, req_buffer.buffer);
7349                                         pvalues[3].hfname= hf_nds_name;
7350                                         foffset = foffset+pvalues[3].vlength;
7351                                         foffset += align_4(tvb, foffset);
7352                                         pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
7353                                         pvalues[4].vtype = VTYPE_MULTIVALUE_UINT32;
7354                                         pvalues[4].vdesc = "Communications Transports: %u";
7355                                         pvalues[4].vlength = 4;
7356                                         pvalues[4].hfname= hf_nds_comm_trans;
7357                                         pvalues[4].voffset = foffset;
7358                                         pvalues[4].mvtype = MVTYPE_ADDR_REFERRAL_REQUEST;
7359                                         foffset = foffset + (pvalues[4].vvalue * 4) + 4;
7360                                         pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
7361                                         pvalues[5].vtype = VTYPE_MULTIVALUE_UINT32;
7362                                         pvalues[5].vdesc = "Tree Walker Transport Type: %u";
7363                                         pvalues[5].vlength = 4;
7364                                         pvalues[5].mvtype = MVTYPE_ADDR_REFERRAL_REQUEST;
7365                                         pvalues[5].hfname= hf_nds_tree_trans;
7366                                         pvalues[5].voffset = foffset;
7367                                 }
7368                                 else
7369                                 {
7370                                         pvalues[2].vtype = VTYPE_UINT32;
7371                                         pvalues[2].vdesc = "Minimum DS Version: %u";
7372                                         pvalues[2].vlength = 4;
7373                                         pvalues[2].voffset = foffset;
7374                                         pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7375                                         pvalues[2].hfname= hf_min_nds_ver;
7376                                         foffset = foffset+pvalues[2].vlength;
7377                                         pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
7378                                         pvalues[3].vtype = VTYPE_MULTIVALUE_UINT32;
7379                                         pvalues[3].vdesc = "Number of Versions to Include: %u";
7380                                         pvalues[3].vlength = 4;
7381                                         pvalues[3].mvtype = MVTYPE_ATTR_REQUEST2;
7382                                         pvalues[3].voffset = foffset;
7383                                         pvalues[3].hfname= hf_nds_ver_include;
7384                                         foffset += (pvalues[3].vvalue * 4) + 4;
7385                                         pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
7386                                         pvalues[4].vtype = VTYPE_MULTIVALUE_UINT32;
7387                                         pvalues[4].vdesc = "Number of Versions to Exclude: %u";
7388                                         pvalues[4].vlength = 4;
7389                                         pvalues[4].mvtype = MVTYPE_ATTR_REQUEST2;
7390                                         pvalues[4].hfname= hf_nds_ver_exclude;
7391                                         pvalues[4].voffset = foffset;
7392                                         foffset += 4;
7393                                         pvalues[5].vtype = VTYPE_UINT32;
7394                                         pvalues[5].vdesc = "DN Output Type: %u";
7395                                         pvalues[5].vlength = 4;
7396                                         pvalues[5].voffset = foffset;
7397                                         pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
7398                                         pvalues[5].hfname= hf_nds_dn_output_type;
7399                                         foffset = foffset+pvalues[5].vlength;
7400                                         pvalues[6].vtype = VTYPE_UINT32;
7401                                         pvalues[6].vdesc = "Nested Output Type: %u";
7402                                         pvalues[6].vlength = 4;
7403                                         pvalues[6].voffset = foffset;
7404                                         pvalues[6].vvalue = tvb_get_letohl(tvb, foffset);
7405                                         pvalues[6].hfname= hf_nds_nested_output_type;
7406                                         foffset = foffset+pvalues[6].vlength;
7407                                         pvalues[7].vtype = VTYPE_STRING;
7408                                         pvalues[7].vdesc = "Output Delimiter: %s";
7409                                         pvalues[7].mvtype = MVTYPE_ATTR_REQUEST;
7410                                         pvalues[7].vvalue = 0;
7411                                         pvalues[7].vlength = 256;
7412                                         pvalues[7].vlength = tvb_get_letohl(tvb, foffset);
7413                                         pvalues[7].voffset = foffset+4;
7414                                         foffset = foffset + 4;
7415                                         get_string(tvb, pvalues[7].voffset, pvalues[7].vlength, req_buffer.buffer);
7416                                         pvalues[7].vstring = req_buffer.buffer;
7417                                         pvalues[7].hfname= hf_nds_output_delimiter;
7418                                         foffset = foffset+pvalues[7].vlength;
7419                                         foffset += align_4(tvb, foffset);
7420                                         pvalues[8].vvalue = tvb_get_letohl(tvb, foffset);
7421                                         pvalues[8].vtype = VTYPE_MULTIVALUE_UINT32;
7422                                         pvalues[8].vdesc = "Size of Entry Specifier: %u";
7423                                         pvalues[8].vlength = 4;
7424                                         pvalues[8].mvtype = MVTYPE_PROC_ENTRY_SPECIFIERS;
7425                                         pvalues[8].hfname= hf_nds_output_entry_specifier;
7426                                         pvalues[8].voffset = foffset;
7427                                 }
7428                                 break;
7429                         case 0x02:    
7430                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7431                                 pvalues[0].vtype = VTYPE_UINT32;
7432                                 pvalues[0].vdesc = "Version: %u";
7433                                 pvalues[0].vlength = 4;
7434                                 pvalues[0].voffset = foffset;
7435                                 pvalues[0].hfname= hf_nds_ver;
7436                                 foffset = foffset+pvalues[0].vlength;
7437                                 switch(pvalues[0].vvalue)
7438                                 {
7439                                         case 0:
7440                                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7441                                                 pvalues[1].vtype = VTYPE_UINT32;
7442                                                 pvalues[1].vdesc = "Entry ID: 0x%08x";
7443                                                 pvalues[1].vlength = 4;
7444                                                 resolve_eid = TRUE;
7445                                                 global_eid = pvalues[1].vvalue;
7446                                                 pvalues[1].voffset = foffset;
7447                                                 pvalues[1].hfname = hf_nds_eid;
7448                                                 foffset = foffset+pvalues[1].vlength;
7449                                                 break;
7450                                         case 1:
7451                                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7452                                                 pvalues[1].vtype = VTYPE_BITFIELD;
7453                                                 pvalues[1].vdesc = "Request Flags:";
7454                                                 pvalues[1].vlength = 2;
7455                                                 pvalues[1].hfname= hf_nds_rflags;
7456                                                 pvalues[1].voffset = foffset;
7457                                                 pvalues[1].bit1 = "Typeless";
7458                                                 pvalues[1].bit1hfname = hf_bit1rflags;
7459                                                 pvalues[1].bit2 = "Slashed";
7460                                                 pvalues[1].bit2hfname = hf_bit2rflags;
7461                                                 pvalues[1].bit3 = "Dotted";
7462                                                 pvalues[1].bit3hfname = hf_bit3rflags;
7463                                                 pvalues[1].bit4 = "Tuned";
7464                                                 pvalues[1].bit4hfname = hf_bit4rflags;
7465                                                 pvalues[1].bit5 = "Not Defined";
7466                                                 pvalues[1].bit5hfname = hf_bit5rflags;
7467                                                 pvalues[1].bit6 = "Not Defined";
7468                                                 pvalues[1].bit6hfname = hf_bit6rflags;
7469                                                 pvalues[1].bit7 = "Not Defined";
7470                                                 pvalues[1].bit7hfname = hf_bit7rflags;
7471                                                 pvalues[1].bit8 = "Not Defined";
7472                                                 pvalues[1].bit8hfname = hf_bit8rflags;
7473                                                 pvalues[1].bit9 = "Not Defined";
7474                                                 pvalues[1].bit9hfname = hf_bit9rflags;
7475                                                 pvalues[1].bit10 = "Not Defined";
7476                                                 pvalues[1].bit10hfname = hf_bit10rflags;
7477                                                 pvalues[1].bit11 = "Not Defined";
7478                                                 pvalues[1].bit11hfname = hf_bit11rflags;
7479                                                 pvalues[1].bit12 = "Not Defined";
7480                                                 pvalues[1].bit12hfname = hf_bit12rflags;
7481                                                 pvalues[1].bit13 = "Not Defined";
7482                                                 pvalues[1].bit13hfname = hf_bit13rflags;
7483                                                 pvalues[1].bit14 = "Not Defined";
7484                                                 pvalues[1].bit14hfname = hf_bit14rflags;
7485                                                 pvalues[1].bit15 = "Not Defined";
7486                                                 pvalues[1].bit15hfname = hf_bit15rflags;
7487                                                 pvalues[1].bit16 = "Not Defined";
7488                                                 pvalues[1].bit16hfname = hf_bit16rflags;
7489                                                 if((pvalues[1].vvalue&&0xf000) == 0xc000)
7490                                                 {
7491                                                         pvalues[2].vtype = VTYPE_STRING;
7492                                                         pvalues[2].vdesc = "Name Type: %s";
7493                                                         pvalues[2].vstring = "Partial";
7494                                                         pvalues[2].mvtype = 0;
7495                                                         pvalues[2].vvalue = 0;
7496                                                         pvalues[2].vlength = 0;
7497                                                         pvalues[2].voffset = 0;
7498                                                         pvalues[2].hfname= hf_nds_name_type;
7499                                                 }
7500                                                 else
7501                                                 {
7502                                                         pvalues[2].vtype = VTYPE_STRING;
7503                                                         pvalues[2].vdesc = "Name Type: %s";
7504                                                         pvalues[2].vstring = "Full";
7505                                                         pvalues[2].vvalue = 0;
7506                                                         pvalues[2].mvtype = 0;
7507                                                         pvalues[2].vlength = 0;
7508                                                         pvalues[2].voffset = 0;
7509                                                         pvalues[2].hfname= hf_nds_name_type;
7510                                                 }
7511                                                 foffset = foffset+4;
7512                                                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
7513                                                 pvalues[3].vtype = VTYPE_UINT32;
7514                                                 pvalues[3].vdesc = "Entry ID: 0x%08x";
7515                                                 pvalues[3].vlength = 4;
7516                                                 pvalues[3].voffset = foffset;
7517                                                 resolve_eid = TRUE;
7518                                                 global_eid = pvalues[3].vvalue;
7519                                                 pvalues[3].hfname = hf_nds_eid;
7520                                                 foffset = foffset+pvalues[3].vlength;
7521                                                 break;
7522                                         case 2:
7523                                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7524                                                 pvalues[1].vtype = VTYPE_BITFIELD;
7525                                                 pvalues[1].vdesc = "Request Flags:";
7526                                                 pvalues[1].vlength = 2;
7527                                                 pvalues[1].hfname= hf_nds_rflags;
7528                                                 pvalues[1].voffset = foffset;
7529                                                 pvalues[1].bit1 = "Typeless";
7530                                                 pvalues[1].bit1hfname = hf_bit1rflags;
7531                                                 pvalues[1].bit2 = "Slashed";
7532                                                 pvalues[1].bit2hfname = hf_bit2rflags;
7533                                                 pvalues[1].bit3 = "Dotted";
7534                                                 pvalues[1].bit3hfname = hf_bit3rflags;
7535                                                 pvalues[1].bit4 = "Tuned";
7536                                                 pvalues[1].bit4hfname = hf_bit4rflags;
7537                                                 pvalues[1].bit5 = "Not Defined";
7538                                                 pvalues[1].bit5hfname = hf_bit5rflags;
7539                                                 pvalues[1].bit6 = "Not Defined";
7540                                                 pvalues[1].bit6hfname = hf_bit6rflags;
7541                                                 pvalues[1].bit7 = "Not Defined";
7542                                                 pvalues[1].bit7hfname = hf_bit7rflags;
7543                                                 pvalues[1].bit8 = "Not Defined";
7544                                                 pvalues[1].bit8hfname = hf_bit8rflags;
7545                                                 pvalues[1].bit9 = "Not Defined";
7546                                                 pvalues[1].bit9hfname = hf_bit9rflags;
7547                                                 pvalues[1].bit10 = "Not Defined";
7548                                                 pvalues[1].bit10hfname = hf_bit10rflags;
7549                                                 pvalues[1].bit11 = "Not Defined";
7550                                                 pvalues[1].bit11hfname = hf_bit11rflags;
7551                                                 pvalues[1].bit12 = "Not Defined";
7552                                                 pvalues[1].bit12hfname = hf_bit12rflags;
7553                                                 pvalues[1].bit13 = "Not Defined";
7554                                                 pvalues[1].bit13hfname = hf_bit13rflags;
7555                                                 pvalues[1].bit14 = "Not Defined";
7556                                                 pvalues[1].bit14hfname = hf_bit14rflags;
7557                                                 pvalues[1].bit15 = "Not Defined";
7558                                                 pvalues[1].bit15hfname = hf_bit15rflags;
7559                                                 pvalues[1].bit16 = "Not Defined";
7560                                                 pvalues[1].bit16hfname = hf_bit16rflags;
7561                                                 if((pvalues[1].vvalue&&0xf000) == 0xc000)
7562                                                 {
7563                                                         pvalues[2].vtype = VTYPE_STRING;
7564                                                         pvalues[2].vdesc = "Name Type: %s";
7565                                                         pvalues[2].vstring = "Return Partion Name";
7566                                                         pvalues[2].vvalue = 0;
7567                                                         pvalues[2].vlength = 4;
7568                                                         pvalues[2].voffset = pvalues[1].voffset;
7569                                                         pvalues[2].mvtype = 0;
7570                                                         pvalues[2].hfname= hf_nds_name_type;
7571                                                 }
7572                                                 else
7573                                                 {
7574                                                         pvalues[2].vtype = VTYPE_STRING;
7575                                                         pvalues[2].vdesc = "Name Type: %s";
7576                                                         pvalues[2].vstring = "Return Full Name";
7577                                                         pvalues[2].vvalue = 0;
7578                                                         pvalues[2].vlength = 4;
7579                                                         pvalues[2].mvtype = 0;
7580                                                         pvalues[2].voffset = pvalues[1].voffset;
7581                                                         pvalues[2].hfname= hf_nds_name_type;
7582                                                 }
7583                                                 foffset = foffset+4;
7584                                                 pvalues[3].vvalue = tvb_get_letohs(tvb, foffset);
7585                                                 global_flags = tvb_get_letohl(tvb, foffset);
7586                                                 pvalues[3].vtype = VTYPE_BITFIELD;
7587                                                 pvalues[3].vdesc = "Information Flags (low) Byte:";
7588                                                 pvalues[3].vlength = 2;
7589                                                 pvalues[3].hfname= hf_nds_rflags;
7590                                                 pvalues[3].voffset = foffset;
7591                                                 pvalues[3].bit1 = "Output Flags";
7592                                                 pvalues[3].bit1hfname = hf_bit1infoflagsl;
7593                                                 pvalues[3].bit2 = "Entry ID";
7594                                                 pvalues[3].bit2hfname = hf_bit2infoflagsl;
7595                                                 pvalues[3].bit3 = "Entry Flags";
7596                                                 pvalues[3].bit3hfname = hf_bit3infoflagsl;
7597                                                 pvalues[3].bit4 = "Subordinate Count";
7598                                                 pvalues[3].bit4hfname = hf_bit4infoflagsl;
7599                                                 pvalues[3].bit5 = "Modification Time";
7600                                                 pvalues[3].bit5hfname = hf_bit5infoflagsl;
7601                                                 pvalues[3].bit6 = "Modification Timestamp";
7602                                                 pvalues[3].bit6hfname = hf_bit6infoflagsl;
7603                                                 pvalues[3].bit7 = "Creation Timestamp";
7604                                                 pvalues[3].bit7hfname = hf_bit7infoflagsl;
7605                                                 pvalues[3].bit8 = "Partition Root ID";
7606                                                 pvalues[3].bit8hfname = hf_bit8infoflagsl;
7607                                                 pvalues[3].bit9 = "Parent ID";
7608                                                 pvalues[3].bit9hfname = hf_bit9infoflagsl;
7609                                                 pvalues[3].bit10 = "Revision Count";
7610                                                 pvalues[3].bit10hfname = hf_bit10infoflagsl;
7611                                                 pvalues[3].bit11 = "Replica Type";
7612                                                 pvalues[3].bit11hfname = hf_bit11infoflagsl;
7613                                                 pvalues[3].bit12 = "Base Class";
7614                                                 pvalues[3].bit12hfname = hf_bit12infoflagsl;
7615                                                 pvalues[3].bit13 = "Relative Distinguished Name";
7616                                                 pvalues[3].bit13hfname = hf_bit13infoflagsl;
7617                                                 pvalues[3].bit14 = "Distinguished Name";
7618                                                 pvalues[3].bit14hfname = hf_bit14infoflagsl;
7619                                                 pvalues[3].bit15 = "Root Distinguished Name";
7620                                                 pvalues[3].bit15hfname = hf_bit15infoflagsl;
7621                                                 pvalues[3].bit16 = "Parent Distinguished Name";
7622                                                 pvalues[3].bit16hfname = hf_bit16infoflagsl;
7623                                                 foffset = foffset+2;
7624                                                 pvalues[4].vvalue = tvb_get_letohs(tvb, foffset);
7625                                                 pvalues[4].vtype = VTYPE_BITFIELD;
7626                                                 pvalues[4].vdesc = "Information Flags (high) Byte:";
7627                                                 pvalues[4].vlength = 2;
7628                                                 pvalues[4].hfname= hf_nds_rflags;
7629                                                 pvalues[4].voffset = foffset;
7630                                                 pvalues[4].bit1 = "Purge Time";
7631                                                 pvalues[4].bit1hfname = hf_bit1infoflagsh;
7632                                                 pvalues[4].bit2 = "Dereference Base Class";
7633                                                 pvalues[4].bit2hfname = hf_bit2infoflagsh;
7634                                                 pvalues[4].bit3 = "Not Defined";
7635                                                 pvalues[4].bit3hfname = hf_bit3infoflagsh;
7636                                                 pvalues[4].bit4 = "Not Defined";
7637                                                 pvalues[4].bit4hfname = hf_bit4infoflagsh;
7638                                                 pvalues[4].bit5 = "Not Defined";
7639                                                 pvalues[4].bit5hfname = hf_bit5infoflagsh;
7640                                                 pvalues[4].bit6 = "Not Defined";
7641                                                 pvalues[4].bit6hfname = hf_bit6infoflagsh;
7642                                                 pvalues[4].bit7 = "Not Defined";
7643                                                 pvalues[4].bit7hfname = hf_bit7infoflagsh;
7644                                                 pvalues[4].bit8 = "Not Defined";
7645                                                 pvalues[4].bit8hfname = hf_bit8infoflagsh;
7646                                                 pvalues[4].bit9 = "Not Defined";
7647                                                 pvalues[4].bit9hfname = hf_bit9infoflagsh;
7648                                                 pvalues[4].bit10 = "Not Defined";
7649                                                 pvalues[4].bit10hfname = hf_bit10infoflagsh;
7650                                                 pvalues[4].bit11 = "Not Defined";
7651                                                 pvalues[4].bit11hfname = hf_bit11infoflagsh;
7652                                                 pvalues[4].bit12 = "Not Defined";
7653                                                 pvalues[4].bit12hfname = hf_bit12infoflagsh;
7654                                                 pvalues[4].bit13 = "Not Defined";
7655                                                 pvalues[4].bit13hfname = hf_bit13infoflagsh;
7656                                                 pvalues[4].bit14 = "Not Defined";
7657                                                 pvalues[4].bit14hfname = hf_bit14infoflagsh;
7658                                                 pvalues[4].bit15 = "Not Defined";
7659                                                 pvalues[4].bit15hfname = hf_bit15infoflagsh;
7660                                                 pvalues[4].bit16 = "Not Defined";
7661                                                 pvalues[4].bit16hfname = hf_bit16infoflagsh;
7662                                                 foffset = foffset+2;
7663                                                 pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
7664                                                 pvalues[5].vtype = VTYPE_UINT32;
7665                                                 pvalues[5].vdesc = "Entry ID: 0x%08x";
7666                                                 pvalues[5].vlength = 4;
7667                                                 pvalues[5].voffset = foffset;
7668                                                 resolve_eid = TRUE;
7669                                                 global_eid = pvalues[5].vvalue;
7670                                                 pvalues[5].hfname = hf_nds_eid;
7671                                                 foffset = foffset+pvalues[5].vlength;
7672                                                 break;
7673                                         default:
7674                                                 break;
7675                                 }
7676                                 
7677                                 break;
7678                         case 0x03:    
7679                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7680                                 pvalues[0].vtype = VTYPE_UINT32;
7681                                 pvalues[0].vdesc = "Version: %u";
7682                                 pvalues[0].vlength = 4;
7683                                 pvalues[0].voffset = foffset;
7684                                 pvalues[0].hfname= hf_nds_ver;
7685                                 foffset = foffset+pvalues[0].vlength;
7686                                 if(pvalues[0].vvalue == 0)
7687                                 {
7688                                         pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7689                                         pvalues[1].vtype = VTYPE_UINT32;
7690                                         pvalues[1].vdesc = "Iteration Handle: 0x%08x";
7691                                         pvalues[1].vlength = 4;
7692                                         pvalues[1].voffset = foffset;
7693                                         pvalues[1].hfname= hf_nds_iteration;
7694                                         foffset = foffset+pvalues[1].vlength;
7695                                         pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7696                                         pvalues[2].vtype = VTYPE_UINT32;
7697                                         pvalues[2].vdesc = "Entry ID: 0x%08x";
7698                                         pvalues[2].vlength = 4;
7699                                         resolve_eid = TRUE;
7700                                         global_eid = pvalues[2].vvalue;
7701                                         pvalues[2].voffset = foffset;
7702                                         pvalues[2].hfname= hf_nds_eid;
7703                                         foffset = foffset+pvalues[2].vlength;
7704                                         pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
7705                                         pvalues[3].vstring = (char *)match_strval(pvalues[3].vvalue, nds_info_type);
7706                                         global_flags = pvalues[3].vvalue;
7707                                         if(pvalues[3].vstring == NULL)
7708                                         {
7709                                                 pvalues[3].vstring = "No Info Type Set";
7710                                         }
7711                                         pvalues[3].vtype = VTYPE_STRING;
7712                                         pvalues[3].vdesc = "Info Type: %s";
7713                                         pvalues[3].vlength = 4;
7714                                         pvalues[3].voffset = foffset;
7715                                         pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
7716                                         pvalues[3].hfname= hf_nds_info_type;
7717                                         foffset = foffset + pvalues[3].vlength;
7718                                         pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
7719                                         pvalues[4].vtype = VTYPE_UINT32;
7720                                         pvalues[4].vdesc = "All Attributes: %u";
7721                                         pvalues[4].vlength = 4;
7722                                         pvalues[4].voffset = foffset;
7723                                         pvalues[4].hfname= hf_nds_all_attr;
7724                                         foffset = foffset+pvalues[4].vlength;
7725                                         pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
7726                                         pvalues[5].vtype = VTYPE_MULTIVALUE_UINT32;
7727                                         pvalues[5].vdesc = "Attributes: %u";
7728                                         pvalues[5].vlength = 4;
7729                                         pvalues[5].voffset = foffset;
7730                                         pvalues[5].mvtype = MVTYPE_ATTR_REQUEST;
7731                                         pvalues[5].hfname= hf_nds_attr;
7732                                 }
7733                                 else
7734                                 {
7735                                         pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7736                                         pvalues[1].vtype = VTYPE_UINT32;
7737                                         pvalues[1].vdesc = "Request Flags: 0x%08x";
7738                                         pvalues[1].vlength = 4;
7739                                         pvalues[1].voffset = foffset;
7740                                         pvalues[1].hfname= hf_nds_req_flags;
7741                                         foffset = foffset+pvalues[1].vlength;
7742                                         pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7743                                         pvalues[2].vtype = VTYPE_UINT32;
7744                                         pvalues[2].vdesc = "Iteration Handle: 0x%08x";
7745                                         pvalues[2].vlength = 4;
7746                                         pvalues[2].voffset = foffset;
7747                                         pvalues[2].hfname= hf_nds_iteration;
7748                                         foffset = foffset+pvalues[2].vlength;
7749                                         pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
7750                                         pvalues[3].vtype = VTYPE_UINT32;
7751                                         pvalues[3].vdesc = "Entry ID: 0x%08x";
7752                                         pvalues[3].vlength = 4;
7753                                         resolve_eid = TRUE;
7754                                         global_eid = pvalues[3].vvalue;
7755                                         pvalues[3].voffset = foffset;
7756                                         pvalues[3].hfname= hf_nds_eid;
7757                                         foffset = foffset+pvalues[3].vlength;
7758                                         pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
7759                                         pvalues[4].vstring = (char *)match_strval(pvalues[4].vvalue, nds_info_type);
7760                                         global_flags = pvalues[4].vvalue;
7761                                         if(pvalues[4].vstring == NULL)
7762                                         {
7763                                                 pvalues[4].vstring = "No Info Type Set";
7764                                         }
7765                                         pvalues[4].vtype = VTYPE_STRING;
7766                                         pvalues[4].vdesc = "Info Type: %s";
7767                                         pvalues[4].vlength = 4;
7768                                         pvalues[4].voffset = foffset;
7769                                         pvalues[4].hfname= hf_nds_info_type;
7770                                         pvalues[4].mvtype = MVTYPE_ATTR_REQUEST;
7771                                         foffset = foffset+pvalues[4].vlength;
7772                                         pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
7773                                         pvalues[5].vtype = VTYPE_UINT32;
7774                                         pvalues[5].vdesc = "All Attributes: %u";
7775                                         pvalues[5].vlength = 4;
7776                                         pvalues[5].voffset = foffset;
7777                                         pvalues[5].hfname= hf_nds_all_attr;
7778                                         foffset = foffset+pvalues[5].vlength;
7779                                         pvalues[6].vvalue = tvb_get_letohl(tvb, foffset);
7780                                         pvalues[6].vtype = VTYPE_MULTIVALUE_UINT32;
7781                                         pvalues[6].vdesc = "Attributes: %u";
7782                                         pvalues[6].vlength = 4;
7783                                         pvalues[6].voffset = foffset;
7784                                         pvalues[6].mvtype = MVTYPE_ATTR_REQUEST;
7785                                         pvalues[6].hfname= hf_nds_attr;
7786                                 }
7787                                 break;
7788                         case 0x04:    
7789                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7790                                 pvalues[0].vtype = VTYPE_UINT32;
7791                                 pvalues[0].vdesc = "Version: %u";
7792                                 pvalues[0].vlength = 4;
7793                                 pvalues[0].voffset = foffset;
7794                                 pvalues[0].hfname= hf_nds_ver;
7795                                 foffset = foffset+pvalues[0].vlength;
7796                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7797                                 pvalues[1].vtype = VTYPE_UINT32;
7798                                 pvalues[1].vdesc = "Entry ID: 0x%08x";
7799                                 pvalues[1].vlength = 4;
7800                                 resolve_eid = TRUE;
7801                                 global_eid = pvalues[1].vvalue;
7802                                 pvalues[1].voffset = foffset;
7803                                 pvalues[1].hfname = hf_nds_eid;
7804                                 foffset = foffset+pvalues[1].vlength;
7805                                 foffset += 4;       /* Attribute Count = 1 */
7806                                 pvalues[2].vtype = VTYPE_STRING;
7807                                 pvalues[2].vdesc = "Attribute Name Being Compared: %s";
7808                                 pvalues[2].mvtype = MVTYPE_ATTR_REQUEST;
7809                                 pvalues[2].vvalue = 0;
7810                                 pvalues[2].vlength = 256;
7811                                 pvalues[2].vlength = tvb_get_letohl(tvb, foffset);
7812                                 if (pvalues[2].vlength == 0x00)
7813                                 {
7814                                         pvalues[2].vtype = VTYPE_NONE;
7815                                         break;
7816                                 }
7817                                 pvalues[2].voffset = foffset+4;
7818                                 foffset = foffset + 4;
7819                                 get_string(tvb, pvalues[2].voffset, pvalues[2].vlength, req_buffer.buffer);
7820                                 pvalues[2].vstring = req_buffer.buffer;
7821                                 strcpy(global_object_name, req_buffer.buffer);
7822                                 pvalues[2].hfname= hf_nds_name;
7823                                 foffset = foffset+pvalues[2].vlength;
7824                                 foffset += align_4(tvb, foffset);
7825                                 foffset += 4;       /* Attribute Value Count = 1 */
7826                                 /***************
7827                                  * Need Trace file to test. Will have to create a 
7828                                  * new mvtype to call print_nds_values.
7829                                  ***************/
7830                                 break;
7831                         case 0x05:    
7832                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7833                                 pvalues[0].vtype = VTYPE_UINT32;
7834                                 pvalues[0].vdesc = "Version: %u";
7835                                 pvalues[0].vlength = 4;
7836                                 pvalues[0].voffset = foffset;
7837                                 pvalues[0].hfname= hf_nds_ver;
7838                                 foffset = foffset+pvalues[0].vlength;
7839                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7840                                 pvalues[1].vtype = VTYPE_BITFIELD;
7841                                 pvalues[1].vdesc = "Request Flags:";
7842                                 pvalues[1].vlength = 2;
7843                                 pvalues[1].hfname= hf_nds_rflags;
7844                                 pvalues[1].voffset = foffset;
7845                                 pvalues[1].bit1 = "List Typeless";
7846                                 pvalues[1].bit1hfname = hf_bit1lflags;
7847                                 pvalues[1].bit2 = "List Containers";
7848                                 pvalues[1].bit2hfname = hf_bit2lflags;
7849                                 pvalues[1].bit3 = "List Slashed";
7850                                 pvalues[1].bit3hfname = hf_bit3lflags;
7851                                 pvalues[1].bit4 = "List Dotted";
7852                                 pvalues[1].bit4hfname = hf_bit4lflags;
7853                                 pvalues[1].bit5 = "Dereference Alias";
7854                                 pvalues[1].bit5hfname = hf_bit5lflags;
7855                                 pvalues[1].bit6 = "List All Containers";
7856                                 pvalues[1].bit6hfname = hf_bit6lflags;
7857                                 pvalues[1].bit7 = "List Obsolete";
7858                                 pvalues[1].bit7hfname = hf_bit7lflags;
7859                                 pvalues[1].bit8 = "List Tuned Output";
7860                                 pvalues[1].bit8hfname = hf_bit8lflags;
7861                                 pvalues[1].bit9 = "List External Reference";
7862                                 pvalues[1].bit9hfname = hf_bit9lflags;
7863                                 pvalues[1].bit10 = "Not Defined";
7864                                 pvalues[1].bit10hfname = hf_bit10lflags;
7865                                 pvalues[1].bit11 = "Not Defined";
7866                                 pvalues[1].bit11hfname = hf_bit11lflags;
7867                                 pvalues[1].bit12 = "Not Defined";
7868                                 pvalues[1].bit12hfname = hf_bit12lflags;
7869                                 pvalues[1].bit13 = "Not Defined";
7870                                 pvalues[1].bit13hfname = hf_bit13lflags;
7871                                 pvalues[1].bit14 = "Not Defined";
7872                                 pvalues[1].bit14hfname = hf_bit14lflags;
7873                                 pvalues[1].bit15 = "Not Defined";
7874                                 pvalues[1].bit15hfname = hf_bit15lflags;
7875                                 pvalues[1].bit16 = "Not Defined";
7876                                 pvalues[1].bit16hfname = hf_bit16lflags;
7877                                 foffset = foffset+pvalues[1].vlength;
7878                                 foffset += 2;
7879                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7880                                 pvalues[2].vtype = VTYPE_UINT32;
7881                                 pvalues[2].vdesc = "Iteration Handle: 0x%08x";
7882                                 pvalues[2].vlength = 4;
7883                                 pvalues[2].voffset = foffset;
7884                                 pvalues[2].hfname= hf_nds_iteration;
7885                                 foffset = foffset+pvalues[2].vlength;
7886                                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
7887                                 pvalues[3].vtype = VTYPE_UINT32;
7888                                 pvalues[3].vdesc = "Parent ID: 0x%08x";
7889                                 pvalues[3].vlength = 4;
7890                                 pvalues[3].voffset = foffset;
7891                                 pvalues[3].hfname= hf_nds_parent;
7892                                 foffset = foffset+pvalues[3].vlength;
7893                                 pvalues[4].vvalue = tvb_get_letohs(tvb, foffset);
7894                                 global_flags = tvb_get_letohl(tvb, foffset);
7895                                 pvalues[4].vtype = VTYPE_BITFIELD;
7896                                 pvalues[4].vdesc = "Information Flags (low) Byte:";
7897                                 pvalues[4].vlength = 2;
7898                                 pvalues[4].hfname= hf_nds_rflags;
7899                                 pvalues[4].voffset = foffset;
7900                                 pvalues[4].bit1 = "Output Flags";
7901                                 pvalues[4].bit1hfname = hf_bit1infoflagsl;
7902                                 pvalues[4].bit2 = "Entry ID";
7903                                 pvalues[4].bit2hfname = hf_bit2infoflagsl;
7904                                 pvalues[4].bit3 = "Entry Flags";
7905                                 pvalues[4].bit3hfname = hf_bit3infoflagsl;
7906                                 pvalues[4].bit4 = "Subordinate Count";
7907                                 pvalues[4].bit4hfname = hf_bit4infoflagsl;
7908                                 pvalues[4].bit5 = "Modification Time";
7909                                 pvalues[4].bit5hfname = hf_bit5infoflagsl;
7910                                 pvalues[4].bit6 = "Modification Timestamp";
7911                                 pvalues[4].bit6hfname = hf_bit6infoflagsl;
7912                                 pvalues[4].bit7 = "Creation Timestamp";
7913                                 pvalues[4].bit7hfname = hf_bit7infoflagsl;
7914                                 pvalues[4].bit8 = "Partition Root ID";
7915                                 pvalues[4].bit8hfname = hf_bit8infoflagsl;
7916                                 pvalues[4].bit9 = "Parent ID";
7917                                 pvalues[4].bit9hfname = hf_bit9infoflagsl;
7918                                 pvalues[4].bit10 = "Revision Count";
7919                                 pvalues[4].bit10hfname = hf_bit10infoflagsl;
7920                                 pvalues[4].bit11 = "Replica Type";
7921                                 pvalues[4].bit11hfname = hf_bit11infoflagsl;
7922                                 pvalues[4].bit12 = "Base Class";
7923                                 pvalues[4].bit12hfname = hf_bit12infoflagsl;
7924                                 pvalues[4].bit13 = "Relative Distinguished Name";
7925                                 pvalues[4].bit13hfname = hf_bit13infoflagsl;
7926                                 pvalues[4].bit14 = "Distinguished Name";
7927                                 pvalues[4].bit14hfname = hf_bit14infoflagsl;
7928                                 pvalues[4].bit15 = "Root Distinguished Name";
7929                                 pvalues[4].bit15hfname = hf_bit15infoflagsl;
7930                                 pvalues[4].bit16 = "Parent Distinguished Name";
7931                                 pvalues[4].bit16hfname = hf_bit16infoflagsl;
7932                                 foffset = foffset+2;
7933                                 pvalues[5].vvalue = tvb_get_letohs(tvb, foffset);
7934                                 pvalues[5].vtype = VTYPE_BITFIELD;
7935                                 pvalues[5].vdesc = "Information Flags (high) Byte:";
7936                                 pvalues[5].vlength = 2;
7937                                 pvalues[5].hfname= hf_nds_rflags;
7938                                 pvalues[5].voffset = foffset;
7939                                 pvalues[5].bit1 = "Purge Time";
7940                                 pvalues[5].bit1hfname = hf_bit1infoflagsh;
7941                                 pvalues[5].bit2 = "Dereference Base Class";
7942                                 pvalues[5].bit2hfname = hf_bit2infoflagsh;
7943                                 pvalues[5].bit3 = "Not Defined";
7944                                 pvalues[5].bit3hfname = hf_bit3infoflagsh;
7945                                 pvalues[5].bit4 = "Not Defined";
7946                                 pvalues[5].bit4hfname = hf_bit4infoflagsh;
7947                                 pvalues[5].bit5 = "Not Defined";
7948                                 pvalues[5].bit5hfname = hf_bit5infoflagsh;
7949                                 pvalues[5].bit6 = "Not Defined";
7950                                 pvalues[5].bit6hfname = hf_bit6infoflagsh;
7951                                 pvalues[5].bit7 = "Not Defined";
7952                                 pvalues[5].bit7hfname = hf_bit7infoflagsh;
7953                                 pvalues[5].bit8 = "Not Defined";
7954                                 pvalues[5].bit8hfname = hf_bit8infoflagsh;
7955                                 pvalues[5].bit9 = "Not Defined";
7956                                 pvalues[5].bit9hfname = hf_bit9infoflagsh;
7957                                 pvalues[5].bit10 = "Not Defined";
7958                                 pvalues[5].bit10hfname = hf_bit10infoflagsh;
7959                                 pvalues[5].bit11 = "Not Defined";
7960                                 pvalues[5].bit11hfname = hf_bit11infoflagsh;
7961                                 pvalues[5].bit12 = "Not Defined";
7962                                 pvalues[5].bit12hfname = hf_bit12infoflagsh;
7963                                 pvalues[5].bit13 = "Not Defined";
7964                                 pvalues[5].bit13hfname = hf_bit13infoflagsh;
7965                                 pvalues[5].bit14 = "Not Defined";
7966                                 pvalues[5].bit14hfname = hf_bit14infoflagsh;
7967                                 pvalues[5].bit15 = "Not Defined";
7968                                 pvalues[5].bit15hfname = hf_bit15infoflagsh;
7969                                 pvalues[5].bit16 = "Not Defined";
7970                                 pvalues[5].bit16hfname = hf_bit16infoflagsh;
7971                                 foffset = foffset+2;
7972                                 pvalues[6].vtype = VTYPE_STRING;
7973                                 pvalues[6].vdesc = "Name Filter: %s";
7974                                 pvalues[6].mvtype = MVTYPE_ATTR_REQUEST;
7975                                 pvalues[6].vvalue = 0;
7976                                 pvalues[6].vlength = 256;
7977                                 pvalues[6].vlength = tvb_get_letohl(tvb, foffset);
7978                                 pvalues[6].voffset = foffset+4;
7979                                 foffset = foffset + 4;
7980                                 get_string(tvb, pvalues[6].voffset, pvalues[6].vlength, pvalues[6].vstring);
7981                                 pvalues[6].hfname= hf_nds_name_filter;
7982                                 foffset = foffset+pvalues[6].vlength;
7983                                 if(pvalues[0].vvalue == 0)
7984                                 {
7985                                         break;
7986                                 }        
7987                                 foffset += align_4(tvb, foffset);
7988                                 pvalues[7].vtype = VTYPE_STRING;
7989                                 pvalues[7].vdesc = "Class Filter: %s";
7990                                 pvalues[7].mvtype = MVTYPE_ATTR_REQUEST;
7991                                 pvalues[7].vvalue = 0;
7992                                 pvalues[7].vlength = 256;
7993                                 pvalues[7].vlength = tvb_get_letohl(tvb, foffset);
7994                                 pvalues[7].voffset = foffset+4;
7995                                 foffset = foffset + 4;
7996                                 get_string(tvb, pvalues[7].voffset, pvalues[7].vlength, pvalues[7].vstring);
7997                                 pvalues[7].hfname= hf_nds_class_filter;
7998                                 foffset = foffset+pvalues[7].vlength;
7999                                 if(pvalues[0].vvalue == 1)
8000                                 {
8001                                         break;
8002                                 }        
8003                                 foffset += align_4(tvb, foffset);
8004                                 pvalues[8].vvalue = tvb_get_letohl(tvb, foffset);
8005                                 pvalues[8].vtype = VTYPE_MULTIVALUE_UINT32;
8006                                 pvalues[8].vdesc = "Seconds: %u";
8007                                 pvalues[8].vlength = 4;
8008                                 pvalues[8].mvtype = MVTYPE_PRINT_TIMESTAMP;
8009                                 pvalues[8].hfname= hf_nds_time_filter;
8010                                 pvalues[8].voffset = foffset;
8011                                 break;
8012                         case 0x06:    
8013                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8014                                 pvalues[0].vstring = "";
8015                                 pvalues[0].vtype = VTYPE_UINT32;
8016                                 pvalues[0].vdesc = "Version: %u";
8017                                 pvalues[0].vlength = 4;
8018                                 pvalues[0].voffset = foffset;
8019                                 pvalues[0].hfname= hf_nds_ver;
8020                                 foffset = foffset+pvalues[0].vlength;
8021                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
8022                                 pvalues[1].vtype = VTYPE_UINT32;
8023                                 pvalues[1].vstring = "";
8024                                 pvalues[1].vdesc = "Request Flags: 0x%08x"; 
8025                                 pvalues[1].vlength = 4;
8026                                 pvalues[1].hfname= hf_nds_rflags;
8027                                 pvalues[1].voffset = foffset;
8028                                 foffset = foffset+4;
8029                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
8030                                 pvalues[2].vtype = VTYPE_UINT32;
8031                                 pvalues[2].vdesc = "Iteration Handle: 0x%08x";
8032                                 pvalues[2].vlength = 4;
8033                                 pvalues[2].voffset = foffset;
8034                                 pvalues[2].hfname= hf_nds_iteration;
8035                                 foffset = foffset+pvalues[2].vlength;
8036                                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
8037                                 pvalues[3].vstring = "";
8038                                 pvalues[3].vtype = VTYPE_UINT32;
8039                                 pvalues[3].vdesc = "Base Entry ID: 0x%08x";
8040                                 pvalues[3].vlength = 4;
8041                                 resolve_eid = FALSE;
8042                                 global_eid = pvalues[3].vvalue;
8043                                 pvalues[3].voffset = foffset;
8044                                 pvalues[3].hfname= hf_nds_eid;
8045                                 foffset = foffset+pvalues[3].vlength;
8046                                 pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
8047                                 pvalues[4].vstring = (char *)match_strval(pvalues[4].vvalue, nds_search_scope);
8048                                 if(pvalues[4].vstring == NULL)
8049                                 {
8050                                         pvalues[4].vstring = "No Search Scope Defined";
8051                                 }
8052                                 pvalues[4].vtype = VTYPE_STRING;
8053                                 pvalues[4].vdesc = "Replica Type: %s";
8054                                 pvalues[4].vlength = 4;
8055                                 pvalues[4].voffset = foffset;
8056                                 pvalues[4].mvtype = 0;
8057                                 pvalues[4].hfname= hf_nds_search_scope;
8058                                 foffset = foffset + pvalues[4].vlength;
8059                                 pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
8060                                 pvalues[5].vtype = VTYPE_UINT32;
8061                                 pvalues[5].vdesc = "Number of Objects to Search: 0x%08x";
8062                                 pvalues[5].vlength = 4;
8063                                 pvalues[5].voffset = foffset;
8064                                 pvalues[5].hfname= hf_nds_num_objects;
8065                                 foffset = foffset+pvalues[5].vlength;
8066                                 pvalues[6].vvalue = tvb_get_letohl(tvb, foffset);
8067                                 pvalues[6].vtype = VTYPE_BITFIELD;
8068                                 pvalues[6].vdesc = "Information Types:";
8069                                 pvalues[6].vlength = 2;
8070                                 pvalues[6].hfname= hf_nds_nflags;
8071                                 pvalues[6].voffset = foffset;
8072                                 pvalues[6].bit1 = "Names";
8073                                 pvalues[6].bit1hfname = hf_bit1siflags;
8074                                 pvalues[6].bit2 = "Names and Values";
8075                                 pvalues[6].bit2hfname = hf_bit2siflags;
8076                                 pvalues[6].bit3 = "Effective Privileges";
8077                                 pvalues[6].bit3hfname = hf_bit3siflags;
8078                                 pvalues[6].bit4 = "Value Info";
8079                                 pvalues[6].bit4hfname = hf_bit4siflags;
8080                                 pvalues[6].bit5 = "Abbreviated Value";
8081                                 pvalues[6].bit5hfname = hf_bit5siflags;
8082                                 pvalues[6].bit6 = "Not Defined";
8083                                 pvalues[6].bit6hfname = hf_bit6siflags;
8084                                 pvalues[6].bit7 = "Not Defined";
8085                                 pvalues[6].bit7hfname = hf_bit7siflags;
8086                                 pvalues[6].bit8 = "Not Defined";
8087                                 pvalues[6].bit8hfname = hf_bit8siflags;
8088                                 pvalues[6].bit9 = "Expanded Class";
8089                                 pvalues[6].bit9hfname = hf_bit9siflags;
8090                                 pvalues[6].bit10 = "Not Defined";
8091                                 pvalues[6].bit10hfname = hf_bit10siflags;
8092                                 pvalues[6].bit11= "Not Defined";
8093                                 pvalues[6].bit11hfname = hf_bit11siflags;
8094                                 pvalues[6].bit12 = "Not Defined";
8095                                 pvalues[6].bit12hfname = hf_bit12siflags;
8096                                 pvalues[6].bit13 = "Not Defined";
8097                                 pvalues[6].bit13hfname = hf_bit13siflags;
8098                                 pvalues[6].bit14 = "Not Defined";
8099                                 pvalues[6].bit14hfname = hf_bit14siflags;
8100                                 pvalues[6].bit15 = "Not Defined";
8101                                 pvalues[6].bit15hfname = hf_bit15siflags;
8102                                 pvalues[6].bit16 = "Not Defined";
8103                                 pvalues[6].bit16hfname = hf_bit16siflags;
8104                                 foffset = foffset+4;
8105                                 if(pvalues[0].vvalue != 2)
8106                                 {
8107                                         pvalues[7].vvalue = tvb_get_letohs(tvb, foffset);
8108                                         global_flags = tvb_get_letohl(tvb, foffset);
8109                                         pvalues[7].vtype = VTYPE_BITFIELD;
8110                                         pvalues[7].vdesc = "Information Flags (low) Byte:";
8111                                         pvalues[7].vlength = 2;
8112                                         pvalues[7].hfname= hf_nds_rflags;
8113                                         pvalues[7].voffset = foffset;
8114                                         pvalues[7].bit1 = "Output Flags";
8115                                         pvalues[7].bit1hfname = hf_bit1infoflagsl;
8116                                         pvalues[7].bit2 = "Entry ID";
8117                                         pvalues[7].bit2hfname = hf_bit2infoflagsl;
8118                                         pvalues[7].bit3 = "Entry Flags";
8119                                         pvalues[7].bit3hfname = hf_bit3infoflagsl;
8120                                         pvalues[7].bit4 = "Subordinate Count";
8121                                         pvalues[7].bit4hfname = hf_bit4infoflagsl;
8122                                         pvalues[7].bit5 = "Modification Time";
8123                                         pvalues[7].bit5hfname = hf_bit5infoflagsl;
8124                                         pvalues[7].bit6 = "Modification Timestamp";
8125                                         pvalues[7].bit6hfname = hf_bit6infoflagsl;
8126                                         pvalues[7].bit7 = "Creation Timestamp";
8127                                         pvalues[7].bit7hfname = hf_bit7infoflagsl;
8128                                         pvalues[7].bit8 = "Partition Root ID";
8129                                         pvalues[7].bit8hfname = hf_bit8infoflagsl;
8130                                         pvalues[7].bit9 = "Parent ID";
8131                                         pvalues[7].bit9hfname = hf_bit9infoflagsl;
8132                                         pvalues[7].bit10 = "Revision Count";
8133                                         pvalues[7].bit10hfname = hf_bit10infoflagsl;
8134                                         pvalues[7].bit11 = "Replica Type";
8135                                         pvalues[7].bit11hfname = hf_bit11infoflagsl;
8136                                         pvalues[7].bit12 = "Base Class";
8137                                         pvalues[7].bit12hfname = hf_bit12infoflagsl;
8138                                         pvalues[7].bit13 = "Relative Distinguished Name";
8139                                         pvalues[7].bit13hfname = hf_bit13infoflagsl;
8140                                         pvalues[7].bit14 = "Distinguished Name";
8141                                         pvalues[7].bit14hfname = hf_bit14infoflagsl;
8142                                         pvalues[7].bit15 = "Root Distinguished Name";
8143                                         pvalues[7].bit15hfname = hf_bit15infoflagsl;
8144                                         pvalues[7].bit16 = "Parent Distinguished Name";
8145                                         pvalues[7].bit16hfname = hf_bit16infoflagsl;
8146                                         foffset = foffset+2;
8147                                         pvalues[8].vvalue = tvb_get_letohs(tvb, foffset);
8148                                         pvalues[8].vtype = VTYPE_BITFIELD;
8149                                         pvalues[8].vdesc = "Information Flags (high) Byte:";
8150                                         pvalues[8].vlength = 2;
8151                                         pvalues[8].hfname= hf_nds_rflags;
8152                                         pvalues[8].voffset = foffset;
8153                                         pvalues[8].bit1 = "Purge Time";
8154                                         pvalues[8].bit1hfname = hf_bit1infoflagsh;
8155                                         pvalues[8].bit2 = "Dereference Base Class";
8156                                         pvalues[8].bit2hfname = hf_bit2infoflagsh;
8157                                         pvalues[8].bit3 = "Not Defined";
8158                                         pvalues[8].bit3hfname = hf_bit3infoflagsh;
8159                                         pvalues[8].bit4 = "Not Defined";
8160                                         pvalues[8].bit4hfname = hf_bit4infoflagsh;
8161                                         pvalues[8].bit5 = "Not Defined";
8162                                         pvalues[8].bit5hfname = hf_bit5infoflagsh;
8163                                         pvalues[8].bit6 = "Not Defined";
8164                                         pvalues[8].bit6hfname = hf_bit6infoflagsh;
8165                                         pvalues[8].bit7 = "Not Defined";
8166                                         pvalues[8].bit7hfname = hf_bit7infoflagsh;
8167                                         pvalues[8].bit8 = "Not Defined";
8168                                         pvalues[8].bit8hfname = hf_bit8infoflagsh;
8169                                         pvalues[8].bit9 = "Not Defined";
8170                                         pvalues[8].bit9hfname = hf_bit9infoflagsh;
8171                                         pvalues[8].bit10 = "Not Defined";
8172                                         pvalues[8].bit10hfname = hf_bit10infoflagsh;
8173                                         pvalues[8].bit11 = "Not Defined";
8174                                         pvalues[8].bit11hfname = hf_bit11infoflagsh;
8175                                         pvalues[8].bit12 = "Not Defined";
8176                                         pvalues[8].bit12hfname = hf_bit12infoflagsh;
8177                                         pvalues[8].bit13 = "Not Defined";
8178                                         pvalues[8].bit13hfname = hf_bit13infoflagsh;
8179                                         pvalues[8].bit14 = "Not Defined";
8180                                         pvalues[8].bit14hfname = hf_bit14infoflagsh;
8181                                         pvalues[8].bit15 = "Not Defined";
8182                                         pvalues[8].bit15hfname = hf_bit15infoflagsh;
8183                                         pvalues[8].bit16 = "Not Defined";
8184                                         pvalues[8].bit16hfname = hf_bit16infoflagsh;
8185                                         foffset = foffset+2;
8186                                 }
8187                                 break;
8188                         case 0x07:    
8189                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8190                                 pvalues[0].vstring = "";
8191                                 pvalues[0].vtype = VTYPE_UINT32;
8192                                 pvalues[0].vdesc = "Version: %u";
8193                                 pvalues[0].vlength = 4;
8194                                 pvalues[0].voffset = foffset;
8195                                 pvalues[0].hfname= hf_nds_ver;
8196                                 foffset = foffset+pvalues[0].vlength;
8197                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
8198                                 pvalues[1].vtype = VTYPE_UINT32;
8199                                 pvalues[1].vstring = "";
8200                                 pvalues[1].vdesc = "Request Flags: 0x%08x"; 
8201                                 pvalues[1].vlength = 4;
8202                                 pvalues[1].hfname= hf_nds_rflags;
8203                                 pvalues[1].voffset = foffset;
8204                                 foffset = foffset+4;
8205                                 if(pvalues[0].vvalue == 0)
8206                                 {
8207                                         pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
8208                                         pvalues[2].vstring = "";
8209                                         pvalues[2].vtype = VTYPE_UINT32;
8210                                         pvalues[2].vdesc = "Parent Entry ID: 0x%08x";
8211                                         pvalues[2].vlength = 4;
8212                                         resolve_eid = FALSE;
8213                                         global_eid = pvalues[2].vvalue;
8214                                         pvalues[2].voffset = foffset;
8215                                         pvalues[2].hfname= hf_nds_eid;
8216                                         foffset = foffset+pvalues[2].vlength;
8217                                         pvalues[3].vtype = VTYPE_STRING;
8218                                         pvalues[3].vdesc = "Relative Distinguished Name: %s";
8219                                         pvalues[3].vstring = "";
8220                                         pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
8221                                         pvalues[3].vvalue = 0;
8222                                         pvalues[3].vlength = 256;
8223                                         pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
8224                                         if (pvalues[3].vlength == 0x00)
8225                                         {
8226                                                 pvalues[3].vtype = VTYPE_NONE;
8227                                                 break;
8228                                         }
8229                                         pvalues[3].voffset = foffset+4;
8230                                         foffset = foffset + 4;
8231                                         get_string(tvb, pvalues[3].voffset, pvalues[3].vlength, req_buffer.buffer);
8232                                         pvalues[3].vstring = req_buffer.buffer;
8233                                         strcpy(global_object_name, req_buffer.buffer);
8234                                         pvalues[3].hfname= hf_nds_relative_dn;
8235                                         foffset = foffset+pvalues[3].vlength;
8236                                         foffset += align_4(tvb, foffset);
8237                                         pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
8238                                         pvalues[4].vtype = VTYPE_MULTIVALUE_UINT32;
8239                                         pvalues[4].vstring = "";
8240                                         pvalues[4].vdesc = "Attributes: %u";
8241                                         pvalues[4].vlength = 4;
8242                                         pvalues[4].voffset = foffset;
8243                                         pvalues[4].mvtype = MVTYPE_ADD_ATTR_REQUEST;
8244                                         pvalues[4].hfname= hf_nds_attr;
8245                                 }
8246                                 else
8247                                 {
8248                                         pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
8249                                         pvalues[2].vstring = "";
8250                                         pvalues[2].vtype = VTYPE_UINT32;
8251                                         pvalues[2].vdesc = "Iteration Handle: 0x%08x";
8252                                         pvalues[2].vlength = 4;
8253                                         pvalues[2].voffset = foffset;
8254                                         pvalues[2].hfname= hf_nds_iteration;
8255                                         foffset = foffset+pvalues[2].vlength;
8256                                         pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
8257                                         pvalues[3].vstring = "";
8258                                         pvalues[3].vtype = VTYPE_UINT32;
8259                                         pvalues[3].vdesc = "Parent Entry ID: 0x%08x";
8260                                         pvalues[3].vlength = 4;
8261                                         resolve_eid = FALSE;
8262                                         global_eid = pvalues[3].vvalue;
8263                                         pvalues[3].voffset = foffset;
8264                                         pvalues[3].hfname= hf_nds_eid;
8265                                         foffset = foffset+pvalues[3].vlength;
8266                                         pvalues[4].vtype = VTYPE_STRING;
8267                                         pvalues[4].vdesc = "Relative Distinguished Name: %s";
8268                                         pvalues[4].vstring = "";
8269                                         pvalues[4].mvtype = MVTYPE_ATTR_REQUEST;
8270                                         pvalues[4].vvalue = 0;
8271                                         pvalues[4].vlength = 256;
8272                                         pvalues[4].vlength = tvb_get_letohl(tvb, foffset);
8273                                         if (pvalues[4].vlength == 0x00)
8274                                         {
8275                                                 pvalues[4].vtype = VTYPE_NONE;
8276                                                 break;
8277                                         }
8278                                         pvalues[4].voffset = foffset+4;
8279                                         foffset = foffset + 4;
8280                                         get_string(tvb, pvalues[4].voffset, pvalues[4].vlength, req_buffer.buffer);
8281                                         pvalues[4].vstring = req_buffer.buffer;
8282                                         strcpy(global_object_name, req_buffer.buffer);
8283                                         pvalues[4].hfname= hf_nds_relative_dn;
8284                                         foffset = foffset+pvalues[4].vlength;
8285                                         foffset += align_4(tvb, foffset);
8286                                         pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
8287                                         pvalues[5].vtype = VTYPE_MULTIVALUE_UINT32;
8288                                         pvalues[5].vstring = "";
8289                                         pvalues[5].vdesc = "Attributes: %u";
8290                                         pvalues[5].vlength = 4;
8291                                         pvalues[5].voffset = foffset;
8292                                         pvalues[5].mvtype = MVTYPE_ADD_ATTR_REQUEST;
8293                                         pvalues[5].hfname= hf_nds_attr;
8294                                 }
8295                                 break;
8296                         case 0x08:    
8297                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8298                                 pvalues[0].vtype = VTYPE_UINT32;
8299                                 pvalues[0].vdesc = "Version: %u";
8300                                 pvalues[0].vlength = 4;
8301                                 pvalues[0].voffset = foffset;
8302                                 pvalues[0].hfname= hf_nds_ver;
8303                                 foffset = foffset+pvalues[0].vlength;
8304                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
8305                                 pvalues[1].vtype = VTYPE_UINT32;
8306                                 pvalues[1].vdesc = "Entry ID: 0x%08x";
8307                                 pvalues[1].vlength = 4;
8308                                 resolve_eid = TRUE;
8309                                 global_eid = pvalues[1].vvalue;
8310                                 pvalues[1].voffset = foffset;
8311                                 pvalues[1].hfname= hf_nds_eid;
8312                                 foffset = foffset+pvalues[1].vlength;
8313                                 break;
8314                         case 0x09:    
8315                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8316                                 pvalues[0].vtype = VTYPE_UINT32;
8317                                 pvalues[0].vdesc = "Version: %u";
8318                                 pvalues[0].vlength = 4;
8319                                 pvalues[0].voffset = foffset;
8320                                 pvalues[0].hfname= hf_nds_ver;
8321                                 foffset = foffset+pvalues[0].vlength;
8322                                 if(pvalues[0].vvalue == 0)
8323                                 {
8324                                         pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
8325                                         pvalues[1].vtype = VTYPE_UINT32;
8326                                         pvalues[1].vstring = "";
8327                                         pvalues[1].vdesc = "Iteration Handle: 0x%08x";  /* always 0 */
8328                                         pvalues[1].vlength = 4;
8329                                         pvalues[1].hfname= hf_nds_iteration;
8330                                         pvalues[1].voffset = foffset;
8331                                         foffset = foffset+4;
8332                                         pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
8333                                         pvalues[2].vstring = "";
8334                                         pvalues[2].vtype = VTYPE_UINT32;
8335                                         pvalues[2].vdesc = "Entry ID: 0x%08x";
8336                                         pvalues[2].vlength = 4;
8337                                         pvalues[2].voffset = foffset;
8338                                         resolve_eid = TRUE;
8339                                         global_eid = pvalues[2].vvalue;
8340                                         pvalues[2].hfname = hf_nds_eid;
8341                                         foffset = foffset+pvalues[2].vlength;
8342                                         pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
8343                                         pvalues[3].vtype = VTYPE_MULTIVALUE_UINT32;
8344                                         pvalues[3].vstring = "";
8345                                         pvalues[3].vdesc = "Number of Attributes to Change %u";
8346                                         pvalues[3].vlength = 4;
8347                                         pvalues[3].mvtype = MVTYPE_MODIFY_ATTR_REQUEST;
8348                                         pvalues[3].hfname= hf_nds_number_of_changes;
8349                                         pvalues[3].voffset = foffset;
8350                                 }
8351                                 else
8352                                 {
8353                                         pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
8354                                         pvalues[1].vtype = VTYPE_UINT32;
8355                                         pvalues[1].vstring = "";
8356                                         pvalues[1].vdesc = "Request Flags: 0x%08x";  /* always 0 */
8357                                         pvalues[1].vlength = 4;
8358                                         pvalues[1].hfname= hf_nds_rflags;
8359                                         pvalues[1].voffset = foffset;
8360                                         foffset = foffset+4;
8361                                         pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
8362                                         pvalues[2].vtype = VTYPE_UINT32;
8363                                         pvalues[2].vstring = "";
8364                                         pvalues[2].vdesc = "Iteration Handle: 0x%08x";  /* always 0 */
8365                                         pvalues[2].vlength = 4;
8366                                         pvalues[2].hfname= hf_nds_iteration;
8367                                         pvalues[2].voffset = foffset;
8368                                         foffset = foffset+4;
8369                                         pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
8370                                         pvalues[3].vstring = "";
8371                                         pvalues[3].vtype = VTYPE_UINT32;
8372                                         pvalues[3].vdesc = "Entry ID: 0x%08x";
8373                                         pvalues[3].vlength = 4;
8374                                         pvalues[3].voffset = foffset;
8375                                         resolve_eid = TRUE;
8376                                         global_eid = pvalues[3].vvalue;
8377                                         pvalues[3].hfname = hf_nds_eid;
8378                                         foffset = foffset+pvalues[3].vlength;
8379                                         pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
8380                                         pvalues[4].vtype = VTYPE_MULTIVALUE_UINT32;
8381                                         pvalues[4].vstring = "";
8382                                         pvalues[4].vdesc = "Number of Attributes to Change %u";
8383                                         pvalues[4].vlength = 4;
8384                                         pvalues[4].mvtype = MVTYPE_MODIFY_ATTR_REQUEST;
8385                                         pvalues[4].hfname= hf_nds_number_of_changes;
8386                                         pvalues[4].voffset = foffset;
8387                                 }
8388                                 break;
8389                         case 0x0a:    
8390                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8391                                 pvalues[0].vtype = VTYPE_UINT32;
8392                                 pvalues[0].vdesc = "Version: %u";
8393                                 pvalues[0].vlength = 4;
8394                                 pvalues[0].voffset = foffset;
8395                                 pvalues[0].hfname= hf_nds_ver;
8396                                 foffset = foffset+pvalues[0].vlength;
8397                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
8398                                 pvalues[1].vtype = VTYPE_UINT32;
8399                                 pvalues[1].vdesc = "Entry ID: 0x%08x";
8400                                 pvalues[1].vlength = 4;
8401                                 resolve_eid = TRUE;
8402                                 global_eid = pvalues[1].vvalue;
8403                                 pvalues[1].voffset = foffset;
8404                                 pvalues[1].hfname = hf_nds_eid;
8405                                 foffset = foffset+pvalues[1].vlength;
8406                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
8407                                 pvalues[2].vtype = VTYPE_BOOLEAN;
8408                                 pvalues[2].vdesc = "Keep Original RDN: %s";
8409                                 pvalues[2].vlength = 4;
8410                                 pvalues[2].voffset = foffset;
8411                                 pvalues[2].mvtype = 0;
8412                                 pvalues[2].hfname= hf_nds_keep;
8413                                 foffset = foffset+4;
8414                                 foffset += align_4(tvb, foffset);
8415                                 pvalues[3].vtype = VTYPE_STRING;
8416                                 pvalues[3].vdesc = "New RDN: %s";
8417                                 pvalues[3].mvtype = 0;
8418                                 pvalues[3].vvalue = 0;
8419                                 pvalues[3].vlength = 256;
8420                                 pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
8421                                 pvalues[3].voffset = foffset+4;
8422                                 foffset = foffset + 4;
8423                                 get_string(tvb, pvalues[3].voffset, pvalues[3].vlength, pvalues[3].vstring);
8424                                 pvalues[3].hfname= hf_nds_new_rdn;
8425                                 foffset = foffset+pvalues[3].vlength;
8426                                 break;
8427                         case 0x0b:    
8428                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8429                                 pvalues[0].vtype = VTYPE_UINT32;
8430                                 pvalues[0].vdesc = "Version: %u";
8431                                 pvalues[0].vlength = 4;
8432                                 pvalues[0].voffset = foffset;
8433                                 pvalues[0].hfname= hf_nds_ver;
8434                                 foffset = foffset+pvalues[0].vlength;
8435                                 pvalues[1].vvalue = tvb_get_letohs(tvb, foffset);
8436                                 global_flags = tvb_get_letohl(tvb, foffset);
8437                                 pvalues[1].vtype = VTYPE_BITFIELD;
8438                                 pvalues[1].vdesc = "Attribute Constraints:";
8439                                 pvalues[1].vlength = 2;
8440                                 pvalues[1].hfname= hf_nds_acflags;
8441                                 pvalues[1].voffset = foffset;
8442                                 pvalues[1].bit1 = "Single Valued";
8443                                 pvalues[1].bit1hfname = hf_bit1acflags;
8444                                 pvalues[1].bit2 = "Sized";
8445                                 pvalues[1].bit2hfname = hf_bit2acflags;
8446                                 pvalues[1].bit3 = "Non-Removable";
8447                                 pvalues[1].bit3hfname = hf_bit3acflags;
8448                                 pvalues[1].bit4 = "Read Only";
8449                                 pvalues[1].bit4hfname = hf_bit4acflags;
8450                                 pvalues[1].bit5 = "Hidden";
8451                                 pvalues[1].bit5hfname = hf_bit5acflags;
8452                                 pvalues[1].bit6 = "String";
8453                                 pvalues[1].bit6hfname = hf_bit6acflags;
8454                                 pvalues[1].bit7 = "Synchronize Immediate";
8455                                 pvalues[1].bit7hfname = hf_bit7acflags;
8456                                 pvalues[1].bit8 = "Public Read";
8457                                 pvalues[1].bit8hfname = hf_bit8acflags;
8458                                 pvalues[1].bit9 = "Server Read";
8459                                 pvalues[1].bit9hfname = hf_bit9acflags;
8460                                 pvalues[1].bit10 = "Write Managed";
8461                                 pvalues[1].bit10hfname = hf_bit10acflags;
8462                                 pvalues[1].bit11 = "Per Replica";
8463                                 pvalues[1].bit11hfname = hf_bit11acflags;
8464                                 pvalues[1].bit12 = "Never Schedule Synchronization";
8465                                 pvalues[1].bit12hfname = hf_bit12acflags;
8466                                 pvalues[1].bit13 = "Operational";
8467                                 pvalues[1].bit13hfname = hf_bit13acflags;
8468                                 pvalues[1].bit14 = "Not Defined";
8469                                 pvalues[1].bit14hfname = hf_bit14acflags;
8470                                 pvalues[1].bit15 = "Not Defined";
8471                                 pvalues[1].bit15hfname = hf_bit15acflags;
8472                                 pvalues[1].bit16 = "Not Defined";
8473                                 pvalues[1].bit16hfname = hf_bit16acflags;
8474                                 foffset = foffset+4;
8475                                 pvalues[2].vtype = VTYPE_STRING;
8476                                 pvalues[2].vdesc = "Attribute Name: %s";
8477                                 pvalues[2].mvtype = MVTYPE_ATTR_REQUEST;
8478                                 pvalues[2].vvalue = 0;
8479                                 pvalues[2].vlength = 256;
8480                                 pvalues[2].vlength = tvb_get_letohl(tvb, foffset);
8481                                 if (pvalues[2].vlength == 0x00)
8482                                 {
8483                                         pvalues[2].vtype = VTYPE_NONE;
8484                                         break;
8485                                 }
8486                                 pvalues[2].voffset = foffset+4;
8487                                 foffset = foffset + 4;
8488                                 get_string(tvb, pvalues[2].voffset, pvalues[2].vlength, req_buffer.buffer);
8489                                 pvalues[2].vstring = req_buffer.buffer;
8490                                 strcpy(global_object_name, req_buffer.buffer);
8491                                 pvalues[2].hfname= hf_nds_name;
8492                                 foffset = foffset+pvalues[2].vlength;
8493                                 foffset += align_4(tvb, foffset);
8494                                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
8495                                 pvalues[3].vstring = (char *)match_strval(pvalues[3].vvalue, nds_syntax);
8496                                 if(pvalues[3].vstring == NULL)
8497                                 {
8498                                         pvalues[3].vstring = "No Syntax Found";
8499                                 }
8500                                 pvalues[3].vtype = VTYPE_STRING;
8501                                 pvalues[3].vdesc = "Syntax: %s";
8502                                 pvalues[3].vlength = 4;
8503                                 pvalues[3].voffset = foffset;
8504                                 pvalues[3].hfname= hf_nds_syntax;
8505                                 pvalues[3].mvtype = 0;
8506                                 foffset = foffset+pvalues[3].vlength;
8507                                 pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
8508                                 pvalues[4].vtype = VTYPE_UINT32;
8509                                 pvalues[4].vdesc = "Lower Limit Value %u";
8510                                 pvalues[4].vlength = 4;
8511                                 pvalues[4].voffset = foffset;
8512                                 pvalues[4].hfname = hf_nds_lower;
8513                                 foffset += 4;
8514                                 pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
8515                                 pvalues[5].vtype = VTYPE_UINT32;
8516                                 pvalues[5].vdesc = "Upper Limit Value %u";
8517                                 pvalues[5].vlength = 4;
8518                                 pvalues[5].voffset = foffset;
8519                                 pvalues[5].hfname = hf_nds_upper;
8520                                 foffset += 4;
8521                                 pvalues[6].vvalue = tvb_get_letohl(tvb, foffset); /* Length of bytes field */
8522                                 foffset += 4;
8523                                 pvalues[6].vtype = VTYPE_BYTES;
8524                                 pvalues[6].vdesc = "ASN.1 ID";
8525                                 pvalues[6].vlength = pvalues[6].vvalue;
8526                                 pvalues[6].voffset = foffset;
8527                                 pvalues[6].hfname = hf_nds_asn1;
8528                                 break;
8529                         case 0x0c:    
8530                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8531                                 break;
8532                         case 0x0d:    
8533                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8534                                 pvalues[0].vtype = VTYPE_UINT32;
8535                                 pvalues[0].vdesc = "Version: %u";
8536                                 pvalues[0].vlength = 4;
8537                                 pvalues[0].voffset = foffset;
8538                                 pvalues[0].hfname= hf_nds_ver;
8539                                 foffset = foffset+pvalues[0].vlength;
8540                                 pvalues[1].vtype = VTYPE_STRING;
8541                                 pvalues[1].vdesc = "Attribute Name: %s";
8542                                 pvalues[1].mvtype = MVTYPE_ATTR_REQUEST;
8543                                 pvalues[1].vvalue = 0;
8544                                 pvalues[1].vlength = 256;
8545                                 pvalues[1].vlength = tvb_get_letohl(tvb, foffset);
8546                                 if (pvalues[1].vlength == 0x00)
8547                                 {
8548                                         pvalues[1].vtype = VTYPE_NONE;
8549                                         break;
8550                                 }
8551                                 pvalues[1].voffset = foffset+4;
8552                                 foffset = foffset + 4;
8553                                 get_string(tvb, pvalues[1].voffset, pvalues[1].vlength, req_buffer.buffer);
8554                                 pvalues[1].vstring = req_buffer.buffer;
8555                                 strcpy(global_object_name, req_buffer.buffer);
8556                                 pvalues[1].hfname= hf_nds_attribute_dn;
8557                                 break;
8558                         case 0x0e:    
8559                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8560                                 break;
8561                         case 0x0f:    
8562                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8563                                 pvalues[0].vtype = VTYPE_UINT32;
8564                                 pvalues[0].vdesc = "Version: %u";
8565                                 pvalues[0].vlength = 4;
8566                                 pvalues[0].voffset = foffset;
8567                                 pvalues[0].hfname= hf_nds_ver;
8568                                 foffset = foffset+pvalues[0].vlength;
8569                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
8570                                 pvalues[1].vtype = VTYPE_UINT32;
8571                                 pvalues[1].vdesc = "Iteration Handle: 0x%08x";
8572                                 pvalues[1].vlength = 4;
8573                                 pvalues[1].voffset = foffset;
8574                                 pvalues[1].hfname= hf_nds_iteration;
8575                                 foffset = foffset+pvalues[1].vlength;
8576                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
8577                                 global_flags = pvalues[2].vvalue;
8578                                 pvalues[2].vstring = (char *)match_strval(pvalues[2].vvalue, class_def_type);
8579                                 if(pvalues[2].vstring == NULL)
8580                                 {
8581                                         pvalues[2].vstring = "No Class Definition Type Set";
8582                                 }
8583                                 pvalues[2].vtype = VTYPE_STRING;
8584                                 pvalues[2].vdesc = "Class Definition Type: %s";
8585                                 pvalues[2].vlength = 4;
8586                                 pvalues[2].voffset = foffset;
8587                                 pvalues[2].mvtype = 0;
8588                                 pvalues[2].hfname= hf_nds_class_def_type;
8589                                 foffset = foffset + pvalues[2].vlength;
8590                                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
8591                                 if (pvalues[3].vvalue == 0x00000000)
8592                                 {
8593                                         pvalues[3].vstring = "Do Not Return All Classes";
8594                                         pvalues[3].mvtype = 0;
8595                                 }        
8596                                 else
8597                                 {
8598                                         pvalues[3].vstring = "Return All Classes";
8599                                         pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
8600                                 }
8601                                 pvalues[3].vtype = VTYPE_STRING;
8602                                 pvalues[3].vdesc = "%s";
8603                                 pvalues[3].vlength = 4;
8604                                 pvalues[3].voffset = foffset;
8605                                 pvalues[3].hfname= hf_nds_return_all_classes;
8606                                 foffset = foffset + pvalues[3].vlength;
8607                                 foffset += align_4(tvb, foffset);
8608                                 pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
8609                                 pvalues[4].vtype = VTYPE_MULTIVALUE_UINT32;
8610                                 pvalues[4].vdesc = "Classes: %d";
8611                                 pvalues[4].vlength = 4;
8612                                 pvalues[4].voffset = foffset;
8613                                 pvalues[4].mvtype = MVTYPE_READ_CLASS_REQ;
8614                                 pvalues[4].hfname= hf_nds_classes;
8615                                 break;
8616                         case 0x10:    
8617                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8618                                 pvalues[0].vtype = VTYPE_UINT32;
8619                                 pvalues[0].vdesc = "Version: %u";
8620                                 pvalues[0].vlength = 4;
8621                                 pvalues[0].voffset = foffset;
8622                                 pvalues[0].hfname= hf_nds_ver;
8623                                 foffset = foffset+pvalues[0].vlength;
8624                                 pvalues[1].vtype = VTYPE_STRING;
8625                                 pvalues[1].vdesc = "Class Name: %s";
8626                                 pvalues[1].mvtype = MVTYPE_ATTR_REQUEST;
8627                                 pvalues[1].vvalue = 0;
8628                                 pvalues[1].vlength = 256;
8629                                 pvalues[1].vlength = tvb_get_letohl(tvb, foffset);
8630                                 if (pvalues[1].vlength == 0x00)
8631                                 {
8632                                         pvalues[1].vtype = VTYPE_NONE;
8633                                         break;
8634                                 }
8635                                 pvalues[1].voffset = foffset+4;
8636                                 foffset = foffset + 4;
8637                                 get_string(tvb, pvalues[1].voffset, pvalues[1].vlength, req_buffer.buffer);
8638                                 pvalues[1].vstring = req_buffer.buffer;
8639                                 strcpy(global_object_name, req_buffer.buffer);
8640                                 pvalues[1].hfname= hf_nds_base_class;
8641                                 foffset = foffset+pvalues[1].vlength;
8642                                 foffset += align_4(tvb, foffset);
8643                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
8644                                 pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
8645                                 pvalues[2].vdesc = "Number of Attributes to Add: %u";
8646                                 pvalues[2].vlength = 4;
8647                                 pvalues[2].voffset = foffset;
8648                                 pvalues[2].mvtype = MVTYPE_MODIFY_CLASS;
8649                                 pvalues[2].hfname= hf_nds_att_add;
8650                                 break;
8651                         case 0x11:    
8652                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8653                                 pvalues[0].vtype = VTYPE_UINT32;
8654                                 pvalues[0].vdesc = "Version: %u";
8655                                 pvalues[0].vlength = 4;
8656                                 pvalues[0].voffset = foffset;
8657                                 pvalues[0].hfname= hf_nds_ver;
8658                                 foffset = foffset+pvalues[0].vlength;
8659                                 pvalues[1].vtype = VTYPE_STRING;
8660                                 pvalues[1].vdesc = "Class Name: %s";
8661                                 pvalues[1].mvtype = MVTYPE_ATTR_REQUEST;
8662                                 pvalues[1].vvalue = 0;
8663                                 pvalues[1].vlength = 256;
8664                                 pvalues[1].vlength = tvb_get_letohl(tvb, foffset);
8665                                 if (pvalues[1].vlength == 0x00)
8666                                 {
8667                                         pvalues[1].vtype = VTYPE_NONE;
8668                                         break;
8669                                 }
8670                                 pvalues[1].voffset = foffset+4;
8671                                 foffset = foffset + 4;
8672                                 get_string(tvb, pvalues[1].voffset, pvalues[1].vlength, req_buffer.buffer);
8673                                 pvalues[1].vstring = req_buffer.buffer;
8674                                 strcpy(global_object_name, req_buffer.buffer);
8675                                 pvalues[1].hfname= hf_nds_base;
8676                                 break;
8677                         case 0x12:    
8678                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8679                                 pvalues[0].vtype = VTYPE_UINT32;
8680                                 pvalues[0].vdesc = "Version: %u";
8681                                 pvalues[0].vlength = 4;
8682                                 pvalues[0].voffset = foffset;
8683                                 pvalues[0].hfname= hf_nds_ver;
8684                                 foffset = foffset+pvalues[0].vlength;
8685                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
8686                                 pvalues[1].vtype = VTYPE_UINT32;
8687                                 pvalues[1].vdesc = "Iteration Handle: 0x%08x";
8688                                 pvalues[1].vlength = 4;
8689                                 pvalues[1].voffset = foffset;
8690                                 pvalues[1].hfname= hf_nds_iteration;
8691                                 foffset = foffset+pvalues[1].vlength;
8692                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
8693                                 pvalues[2].vtype = VTYPE_UINT32;
8694                                 pvalues[2].vdesc = "Entry ID: 0x%08x";
8695                                 pvalues[2].vlength = 4;
8696                                 resolve_eid = TRUE;
8697                                 global_eid = pvalues[2].vvalue;
8698                                 pvalues[2].voffset = foffset;
8699                                 pvalues[2].hfname= hf_nds_eid;
8700                                 foffset = foffset+pvalues[2].vlength;
8701                                 break;
8702                         case 0x13:    
8703                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8704                                 pvalues[0].vtype = VTYPE_UINT32;
8705                                 pvalues[0].vdesc = "Version: %u";
8706                                 pvalues[0].vlength = 4;
8707                                 pvalues[0].voffset = foffset;
8708                                 pvalues[0].hfname= hf_nds_ver;
8709                                 foffset = foffset+pvalues[0].vlength;
8710                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
8711                                 pvalues[1].vtype = VTYPE_UINT32;
8712                                 pvalues[1].vdesc = "Entry ID: 0x%08x";
8713                                 pvalues[1].vlength = 4;
8714                                 resolve_eid = TRUE;
8715                                 global_eid = pvalues[1].vvalue;
8716                                 pvalues[1].voffset = foffset;
8717                                 pvalues[1].hfname= hf_nds_eid;
8718                                 foffset = foffset+pvalues[1].vlength;
8719                                 pvalues[2].vtype = VTYPE_STRING;
8720                                 pvalues[2].vdesc = "Trustee Name: %s";
8721                                 pvalues[2].mvtype = MVTYPE_ATTR_REQUEST;
8722                                 pvalues[2].vvalue = 0;
8723                                 pvalues[2].vlength = 256;
8724                                 pvalues[2].vlength = tvb_get_letohl(tvb, foffset);
8725                                 if (pvalues[2].vlength == 0x00)
8726                                 {
8727                                         pvalues[2].vtype = VTYPE_NONE;
8728                                         break;
8729                                 }
8730                                 pvalues[2].voffset = foffset+4;
8731                                 foffset = foffset + 4;
8732                                 get_string(tvb, pvalues[2].voffset, pvalues[2].vlength, req_buffer.buffer);
8733                                 pvalues[2].vstring = req_buffer.buffer;
8734                                 pvalues[2].hfname= hf_nds_name;
8735                                 foffset = foffset+pvalues[2].vlength;
8736                                 foffset += align_4(tvb, foffset);
8737                                 pvalues[3].vtype = VTYPE_STRING;
8738                                 pvalues[3].vdesc = "Attribute to be Checked: %s";
8739                                 pvalues[3].mvtype = 0;
8740                                 pvalues[3].vvalue = 0;
8741                                 pvalues[3].vlength = 256;
8742                                 pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
8743                                 if (pvalues[3].vlength == 0x00)
8744                                 {
8745                                         pvalues[3].vtype = VTYPE_NONE;
8746                                         break;
8747                                 }
8748                                 pvalues[3].voffset = foffset+4;
8749                                 foffset = foffset + 4;
8750                                 get_string(tvb, pvalues[3].voffset, pvalues[3].vlength, pvalues[3].vstring);
8751                                 pvalues[3].hfname= hf_nds_name;
8752                                 foffset = foffset+pvalues[3].vlength;
8753                                 foffset += align_4(tvb, foffset);
8754                                 if(pvalues[0].vvalue != 0)
8755                                 {
8756                                         pvalues[4].vtype = VTYPE_STRING;
8757                                         pvalues[4].vdesc = "Security Equivalence: %s";
8758                                         pvalues[4].mvtype = MVTYPE_ATTR_REQUEST;
8759                                         pvalues[4].vvalue = 0;
8760                                         pvalues[4].vlength = 256;
8761                                         pvalues[4].vlength = tvb_get_letohl(tvb, foffset);
8762                                         if (pvalues[4].vlength == 0x00)
8763                                         {
8764                                                 pvalues[4].vtype = VTYPE_NONE;
8765                                                 break;
8766                                         }
8767                                         pvalues[4].voffset = foffset+4;
8768                                         foffset = foffset + 4;
8769                                         get_string(tvb, pvalues[4].voffset, pvalues[4].vlength, pvalues[4].vstring);
8770                                         pvalues[4].hfname= hf_nds_name;
8771                                         foffset = foffset+pvalues[4].vlength;
8772                                         foffset += align_4(tvb, foffset);
8773                                 }
8774                                 break;
8775                         case 0x14:    
8776                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8777                                 break;
8778                         case 0x15:    
8779                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8780                                 break;
8781                         case 0x16:    
8782                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8783                                 pvalues[0].vtype = VTYPE_UINT32;
8784                                 pvalues[0].vdesc = "Version: %u";
8785                                 pvalues[0].vlength = 4;
8786                                 pvalues[0].voffset = foffset;
8787                                 pvalues[0].hfname= hf_nds_ver;
8788                                 foffset = foffset+pvalues[0].vlength;
8789                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
8790                                 pvalues[1].vtype = VTYPE_BITFIELD;
8791                                 pvalues[1].vdesc = "Request Flags:";
8792                                 pvalues[1].vlength = 2;
8793                                 pvalues[1].hfname= hf_nds_rflags;
8794                                 pvalues[1].voffset = foffset;
8795                                 pvalues[1].bit1 = "Typeless";
8796                                 pvalues[1].bit1hfname = hf_nds_bit1;
8797                                 pvalues[1].bit2 = "All Containers";
8798                                 pvalues[1].bit2hfname = hf_nds_bit2;
8799                                 pvalues[1].bit3 = "Slashed";
8800                                 pvalues[1].bit3hfname = hf_nds_bit3;
8801                                 pvalues[1].bit4 = "Dotted";
8802                                 pvalues[1].bit4hfname = hf_nds_bit4;
8803                                 pvalues[1].bit5 = "Tuned";
8804                                 pvalues[1].bit5hfname = hf_nds_bit5;
8805                                 pvalues[1].bit6 = "Not Defined";
8806                                 pvalues[1].bit6hfname = hf_nds_bit6;
8807                                 pvalues[1].bit7 = "Not Defined";
8808                                 pvalues[1].bit7hfname = hf_nds_bit7;
8809                                 pvalues[1].bit8 = "Not Defined";
8810                                 pvalues[1].bit8hfname = hf_nds_bit8;
8811                                 pvalues[1].bit9 = "Not Defined";
8812                                 pvalues[1].bit9hfname = hf_nds_bit9;
8813                                 pvalues[1].bit10 = "Not Defined";
8814                                 pvalues[1].bit10hfname = hf_nds_bit10;
8815                                 pvalues[1].bit11 = "Not Defined";
8816                                 pvalues[1].bit11hfname = hf_nds_bit11;
8817                                 pvalues[1].bit12 = "Not Defined";
8818                                 pvalues[1].bit12hfname = hf_nds_bit12;
8819                                 pvalues[1].bit13 = "Not Defined";
8820                                 pvalues[1].bit13hfname = hf_nds_bit13;
8821                                 pvalues[1].bit14 = "Not Defined";
8822                                 pvalues[1].bit14hfname = hf_nds_bit14;
8823                                 pvalues[1].bit15 = "Not Defined";
8824                                 pvalues[1].bit15hfname = hf_nds_bit15;
8825                                 pvalues[1].bit16 = "Not Defined";
8826                                 pvalues[1].bit16hfname = hf_nds_bit16;
8827                                 foffset = foffset+pvalues[1].vlength;
8828                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
8829                                 pvalues[2].vtype = VTYPE_UINT32;
8830                                 pvalues[2].vdesc = "Iteration Handle: 0x%08x";
8831                                 pvalues[2].vlength = 4;
8832                                 pvalues[2].voffset = foffset;
8833                                 pvalues[2].hfname= hf_nds_iteration;
8834                                 foffset = foffset+pvalues[2].vlength;
8835                                 if(pvalues[0].vvalue == 0)
8836                                 {
8837                                         global_flags = 0x000000c0;
8838                                         break;
8839                                 }
8840                                 pvalues[3].vvalue = tvb_get_letohs(tvb, foffset);
8841                                 pvalues[3].vtype = VTYPE_BITFIELD;
8842                                 pvalues[3].vdesc = "Information Flags (low) Byte:";
8843                                 pvalues[3].vlength = 2;
8844                                 pvalues[3].hfname= hf_nds_rflags;
8845                                 pvalues[3].voffset = foffset;
8846                                 pvalues[3].bit1 = "Output Flags";
8847                                 pvalues[3].bit1hfname = hf_bit1l1flagsl;
8848                                 pvalues[3].bit2 = "Entry ID";
8849                                 pvalues[3].bit2hfname = hf_bit2l1flagsl;
8850                                 pvalues[3].bit3 = "Replica State";
8851                                 pvalues[3].bit3hfname = hf_bit3l1flagsl;
8852                                 pvalues[3].bit4 = "Modification Timestamp";
8853                                 pvalues[3].bit4hfname = hf_bit4l1flagsl;
8854                                 pvalues[3].bit5 = "Purge Time";
8855                                 pvalues[3].bit5hfname = hf_bit5l1flagsl;
8856                                 pvalues[3].bit6 = "Local Partition ID";
8857                                 pvalues[3].bit6hfname = hf_bit6l1flagsl;
8858                                 pvalues[3].bit7 = "Distinguished Name";
8859                                 pvalues[3].bit7hfname = hf_bit7l1flagsl;
8860                                 pvalues[3].bit8 = "Replica Type";
8861                                 pvalues[3].bit8hfname = hf_bit8l1flagsl;
8862                                 pvalues[3].bit9 = "Partition Busy";
8863                                 pvalues[3].bit9hfname = hf_bit9l1flagsl;
8864                                 pvalues[3].bit10 = "Not Defined";
8865                                 pvalues[3].bit10hfname = hf_bit10l1flagsl;
8866                                 pvalues[3].bit11 = "Not Defined";
8867                                 pvalues[3].bit11hfname = hf_bit11l1flagsl;
8868                                 pvalues[3].bit12 = "Not Defined";
8869                                 pvalues[3].bit12hfname = hf_bit12l1flagsl;
8870                                 pvalues[3].bit13 = "Not Defined";
8871                                 pvalues[3].bit13hfname = hf_bit13l1flagsl;
8872                                 pvalues[3].bit14 = "Not Defined";
8873                                 pvalues[3].bit14hfname = hf_bit14l1flagsl;
8874                                 pvalues[3].bit15 = "Not Defined";
8875                                 pvalues[3].bit15hfname = hf_bit15l1flagsl;
8876                                 pvalues[3].bit16 = "Not Defined";
8877                                 pvalues[3].bit16hfname = hf_bit16l1flagsl;
8878                                 global_flags = pvalues[3].vvalue;
8879                                 foffset = foffset+2;
8880                                 pvalues[4].vvalue = tvb_get_letohs(tvb, foffset);
8881                                 pvalues[4].vtype = VTYPE_BITFIELD;
8882                                 pvalues[4].vdesc = "Information Flags (high) Byte:";
8883                                 pvalues[4].vlength = 2;
8884                                 pvalues[4].hfname= hf_nds_rflags;
8885                                 pvalues[4].voffset = foffset;
8886                                 pvalues[4].bit1 = "Not Defined";
8887                                 pvalues[4].bit1hfname = hf_bit1l1flagsl;
8888                                 pvalues[4].bit2 = "Not Defined";
8889                                 pvalues[4].bit2hfname = hf_bit2l1flagsl;
8890                                 pvalues[4].bit3 = "Not Defined";
8891                                 pvalues[4].bit3hfname = hf_bit3l1flagsl;
8892                                 pvalues[4].bit4 = "Not Defined";
8893                                 pvalues[4].bit4hfname = hf_bit4l1flagsl;
8894                                 pvalues[4].bit5 = "Not Defined";
8895                                 pvalues[4].bit5hfname = hf_bit5l1flagsl;
8896                                 pvalues[4].bit6 = "Not Defined";
8897                                 pvalues[4].bit6hfname = hf_bit6l1flagsl;
8898                                 pvalues[4].bit7 = "Not Defined";
8899                                 pvalues[4].bit7hfname = hf_bit7l1flagsl;
8900                                 pvalues[4].bit8 = "Not Defined";
8901                                 pvalues[4].bit8hfname = hf_bit8l1flagsl;
8902                                 pvalues[4].bit9 = "Not Defined";
8903                                 pvalues[4].bit9hfname = hf_bit9l1flagsl;
8904                                 pvalues[4].bit10 = "Not Defined";
8905                                 pvalues[4].bit10hfname = hf_bit10l1flagsl;
8906                                 pvalues[4].bit11 = "Not Defined";
8907                                 pvalues[4].bit11hfname = hf_bit11l1flagsl;
8908                                 pvalues[4].bit12 = "Not Defined";
8909                                 pvalues[4].bit12hfname = hf_bit12l1flagsl;
8910                                 pvalues[4].bit13 = "Not Defined";
8911                                 pvalues[4].bit13hfname = hf_bit13l1flagsl;
8912                                 pvalues[4].bit14 = "Not Defined";
8913                                 pvalues[4].bit14hfname = hf_bit14l1flagsl;
8914                                 pvalues[4].bit15 = "Not Defined";
8915                                 pvalues[4].bit15hfname = hf_bit15l1flagsl;
8916                                 pvalues[4].bit16 = "Not Defined";
8917                                 pvalues[4].bit16hfname = hf_bit16l1flagsl;
8918                                 foffset = foffset+2;
8919                                 if(pvalues[0].vvalue == 1)
8920                                 {
8921                                         break;
8922                                 }
8923                                 pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
8924                                 pvalues[5].vtype = VTYPE_UINT32;
8925                                 pvalues[5].vdesc = "Partition Root ID: 0x%08x";
8926                                 pvalues[5].vlength = 4;
8927                                 pvalues[5].voffset = foffset;
8928                                 pvalues[5].hfname= hf_nds_partition_root_id;
8929                                 foffset = foffset+pvalues[5].vlength;
8930                                 break;
8931                         case 0x17:    
8932                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8933                                 nds_version = pvalues[0].vvalue;
8934                                 pvalues[0].vtype = VTYPE_UINT32;
8935                                 pvalues[0].vdesc = "Version: %u";
8936                                 pvalues[0].vlength = 4;
8937                                 pvalues[0].hfname = hf_nds_ver;
8938                                 pvalues[0].voffset = foffset;
8939                                 foffset = foffset+pvalues[0].vlength;
8940                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
8941                                 nds_version = pvalues[1].vvalue;
8942                                 pvalues[1].vtype = VTYPE_UINT32;
8943                                 pvalues[1].vdesc = "Flags: 0x%08x";
8944                                 pvalues[1].vlength = 4;
8945                                 pvalues[1].hfname = hf_nds_req_flags;
8946                                 pvalues[1].voffset = foffset;
8947                                 foffset = foffset+pvalues[1].vlength;
8948                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
8949                                 pvalues[2].vtype = VTYPE_UINT32;
8950                                 pvalues[2].vdesc = "New Partition Root ID: 0x%08x";
8951                                 pvalues[2].vlength = 4;
8952                                 pvalues[2].voffset = foffset;
8953                                 pvalues[2].hfname= hf_nds_new_part_id;
8954                                 foffset = foffset+pvalues[2].vlength;
8955                                 break;
8956                         case 0x18:    
8957                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8958                                 nds_version = pvalues[0].vvalue;
8959                                 pvalues[0].vtype = VTYPE_UINT32;
8960                                 pvalues[0].vdesc = "Version: %u";
8961                                 pvalues[0].vlength = 4;
8962                                 pvalues[0].hfname = hf_nds_ver;
8963                                 pvalues[0].voffset = foffset;
8964                                 foffset = foffset+pvalues[0].vlength;
8965                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
8966                                 nds_version = pvalues[1].vvalue;
8967                                 pvalues[1].vtype = VTYPE_UINT32;
8968                                 pvalues[1].vdesc = "Flags: 0x%08x";
8969                                 pvalues[1].vlength = 4;
8970                                 pvalues[1].hfname = hf_nds_req_flags;
8971                                 pvalues[1].voffset = foffset;
8972                                 foffset = foffset+pvalues[1].vlength;
8973                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
8974                                 pvalues[2].vtype = VTYPE_UINT32;
8975                                 pvalues[2].vdesc = "Child Partition Root ID: 0x%08x";
8976                                 pvalues[2].vlength = 4;
8977                                 pvalues[2].voffset = foffset;
8978                                 pvalues[2].hfname= hf_nds_child_part_id;
8979                                 foffset = foffset+pvalues[2].vlength;
8980                                 break;
8981                         case 0x19:    
8982                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8983                                 nds_version = pvalues[0].vvalue;
8984                                 pvalues[0].vtype = VTYPE_UINT32;
8985                                 pvalues[0].vdesc = "Version: %u";
8986                                 pvalues[0].vlength = 4;
8987                                 pvalues[0].hfname = hf_nds_ver;
8988                                 pvalues[0].voffset = foffset;
8989                                 foffset = foffset+pvalues[0].vlength;
8990                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
8991                                 nds_version = pvalues[1].vvalue;
8992                                 pvalues[1].vtype = VTYPE_UINT32;
8993                                 pvalues[1].vdesc = "Flags: 0x%08x";
8994                                 pvalues[1].vlength = 4;
8995                                 pvalues[1].hfname = hf_nds_req_flags;
8996                                 pvalues[1].voffset = foffset;
8997                                 foffset = foffset+pvalues[1].vlength;
8998                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
8999                                 pvalues[2].vtype = VTYPE_UINT32;
9000                                 pvalues[2].vdesc = "Master Partition Root ID: 0x%08x";
9001                                 pvalues[2].vlength = 4;
9002                                 pvalues[2].voffset = foffset;
9003                                 pvalues[2].hfname= hf_nds_master_part_id;
9004                                 foffset = foffset+pvalues[2].vlength;
9005                                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
9006                                 pvalues[3].vstring = (char *)match_strval(pvalues[3].vvalue, nds_replica_type);
9007                                 if(pvalues[3].vstring == NULL)
9008                                 {
9009                                         pvalues[3].vstring = "No Replica Type Found";
9010                                 }
9011                                 pvalues[3].vtype = VTYPE_STRING;
9012                                 pvalues[3].vdesc = "Replica Type: %s";
9013                                 pvalues[3].vlength = 4;
9014                                 pvalues[3].voffset = foffset;
9015                                 pvalues[3].mvtype = 0;
9016                                 pvalues[3].hfname= hf_replica_type;
9017                                 foffset = foffset + pvalues[3].vlength;
9018                                 pvalues[4].vtype = VTYPE_STRING;
9019                                 pvalues[4].vdesc = "Target Server Name: %s";
9020                                 pvalues[4].mvtype = 0;
9021                                 pvalues[4].vvalue = 0;
9022                                 pvalues[4].vlength = 256;
9023                                 pvalues[4].vlength = tvb_get_letohl(tvb, foffset);
9024                                 if (pvalues[4].vlength == 0x00)
9025                                 {
9026                                         pvalues[4].vtype = VTYPE_NONE;
9027                                         break;
9028                                 }
9029                                 pvalues[4].voffset = foffset+4;
9030                                 foffset = foffset + 4;
9031                                 get_string(tvb, pvalues[4].voffset, pvalues[4].vlength, pvalues[4].vstring);
9032                                 pvalues[4].hfname= hf_nds_target_name;
9033                                 break;
9034                         case 0x1a:    
9035                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9036                                 break;
9037                         case 0x1b:    
9038                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
9039                                 nds_version = pvalues[0].vvalue;
9040                                 pvalues[0].vtype = VTYPE_UINT32;
9041                                 pvalues[0].vdesc = "Version: %u";
9042                                 pvalues[0].vlength = 4;
9043                                 pvalues[0].hfname = hf_nds_ver;
9044                                 pvalues[0].voffset = foffset;
9045                                 foffset = foffset+pvalues[0].vlength;
9046                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
9047                                 nds_version = pvalues[1].vvalue;
9048                                 pvalues[1].vtype = VTYPE_UINT32;
9049                                 pvalues[1].vdesc = "Streams Flags: 0x%08x";
9050                                 pvalues[1].vlength = 4;
9051                                 pvalues[1].hfname = hf_nds_stream_flags;
9052                                 pvalues[1].voffset = foffset;
9053                                 foffset = foffset+pvalues[1].vlength;
9054                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
9055                                 pvalues[2].vtype = VTYPE_UINT32;
9056                                 pvalues[2].vdesc = "Entry ID: 0x%08x";
9057                                 pvalues[2].vlength = 4;
9058                                 resolve_eid = TRUE;
9059                                 global_eid = pvalues[2].vvalue;
9060                                 pvalues[2].voffset = foffset;
9061                                 pvalues[2].hfname= hf_nds_eid;
9062                                 foffset = foffset+pvalues[2].vlength;
9063                                 pvalues[3].vtype = VTYPE_STRING;
9064                                 pvalues[3].vdesc = "Stream Name: %s";
9065                                 pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
9066                                 pvalues[3].vvalue = 0;
9067                                 pvalues[3].vlength = 256;
9068                                 pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
9069                                 if (pvalues[3].vlength == 0x00)
9070                                 {
9071                                         pvalues[3].vtype = VTYPE_NONE;
9072                                         break;
9073                                 }
9074                                 pvalues[3].voffset = foffset+4;
9075                                 foffset += 4;
9076                                 get_string(tvb, pvalues[3].voffset, pvalues[3].vlength, pvalues[3].vstring);
9077                                 foffset += pvalues[3].vlength;
9078                                 foffset += align_4(tvb, foffset);
9079                                 pvalues[3].hfname= hf_nds_stream_name;
9080                                 break;
9081                         case 0x1c:    
9082                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9083                                 break;
9084                         case 0x1d:    
9085                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9086                                 break;
9087                         case 0x1e:    
9088                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9089                                 break;
9090                         case 0x1f:    
9091                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9092                                 break;
9093                         case 0x20:    
9094                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9095                                 break;
9096                         case 0x21:    
9097                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9098                                 break;
9099                         case 0x22:    
9100                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9101                                 break;
9102                         case 0x23:    
9103                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9104                                 break;
9105                         case 0x24:    
9106                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9107                                 break;
9108                         case 0x25:    
9109                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9110                                 break;
9111                         case 0x26:    
9112                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
9113                                 nds_version = pvalues[0].vvalue;
9114                                 pvalues[0].vtype = VTYPE_UINT32;
9115                                 pvalues[0].vdesc = "Version: %u";
9116                                 pvalues[0].vlength = 4;
9117                                 pvalues[0].hfname = hf_nds_ver;
9118                                 pvalues[0].voffset = foffset;
9119                                 foffset = foffset+pvalues[0].vlength;
9120                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
9121                                 nds_version = pvalues[1].vvalue;
9122                                 pvalues[1].vtype = VTYPE_UINT32;
9123                                 pvalues[1].vdesc = "Flags: 0x%08x";
9124                                 pvalues[1].vlength = 4;
9125                                 pvalues[1].hfname = hf_nds_req_flags;
9126                                 pvalues[1].voffset = foffset;
9127                                 foffset = foffset+pvalues[1].vlength;
9128                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
9129                                 pvalues[2].vtype = VTYPE_UINT32;
9130                                 pvalues[2].vdesc = "Time Delay in Seconds: %u";
9131                                 pvalues[2].vlength = 4;
9132                                 pvalues[2].voffset = foffset;
9133                                 pvalues[2].hfname= hf_nds_time_delay;
9134                                 foffset = foffset+pvalues[2].vlength;
9135                                 if(pvalues[0].vvalue == 0)
9136                                 {
9137                                         pvalues[3].vtype = VTYPE_STRING;
9138                                         pvalues[3].vdesc = "Root Most Object Name: %s";
9139                                         pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
9140                                         pvalues[3].vvalue = 0;
9141                                         pvalues[3].vlength = 256;
9142                                         pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
9143                                         if (pvalues[3].vlength == 0x00)
9144                                         {
9145                                                 pvalues[3].vtype = VTYPE_NONE;
9146                                                 break;
9147                                         }
9148                                         pvalues[3].voffset = foffset+4;
9149                                         foffset += 4;
9150                                         get_string(tvb, pvalues[3].voffset, pvalues[3].vlength, pvalues[3].vstring);
9151                                         foffset += pvalues[3].vlength;
9152                                         foffset += align_4(tvb, foffset);
9153                                         pvalues[3].hfname= hf_nds_root_name;
9154                                 }
9155                                 else
9156                                 {
9157                                         pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
9158                                         pvalues[3].vtype = VTYPE_UINT32;
9159                                         pvalues[3].vdesc = "Entry ID: 0x%08x";
9160                                         pvalues[3].vlength = 4;
9161                                         resolve_eid = TRUE;
9162                                         global_eid = pvalues[3].vvalue;
9163                                         pvalues[3].voffset = foffset;
9164                                         pvalues[3].hfname= hf_nds_eid;
9165                                         foffset = foffset+pvalues[3].vlength;
9166                                         resolve_eid = TRUE;
9167                                         global_eid = pvalues[3].vvalue;
9168                                 }
9169                                 break;
9170                         case 0x27:    
9171                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9172                                 break;
9173                         case 0x28:    
9174                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9175                                 break;
9176                         case 0x29:    
9177                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9178                                 break;
9179                         case 0x2a:    
9180                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9181                                 break;
9182                         case 0x2b:    
9183                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9184                                 break;
9185                         case 0x2c:    
9186                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9187                                 break;
9188                         case 0x2d:    
9189                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9190                                 break;
9191                         case 0x2e:    
9192                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9193                                 break;
9194                         case 0x2f:    
9195                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9196                                 break;
9197                         case 0x30:
9198                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9199                                 break;
9200                         case 0x31:
9201                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9202                                 break;
9203                         case 0x32:    
9204                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9205                                 break;
9206                         case 0x33:    
9207                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9208                                 break;
9209                         case 0x34:    
9210                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9211                                 break;
9212                         case 0x35:    
9213                                 pvalues[0].vvalue = 0;
9214                                 break;
9215                         case 0x36:    
9216                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9217                                 break;
9218                         case 0x37:    
9219                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9220                                 break;
9221                         case 0x38:    
9222                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9223                                 break;
9224                         case 0x39:    
9225                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
9226                                 pvalues[0].vtype = VTYPE_UINT32;
9227                                 pvalues[0].vdesc = "Version: %u";
9228                                 pvalues[0].vlength = 4;
9229                                 pvalues[0].voffset = foffset;
9230                                 pvalues[0].hfname= hf_nds_ver;
9231                                 foffset = foffset+pvalues[0].vlength;
9232                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
9233                                 pvalues[1].vtype = VTYPE_UINT32;
9234                                 pvalues[1].vdesc = "Entry ID: 0x%08x";
9235                                 pvalues[1].vlength = 4;
9236                                 resolve_eid = TRUE;
9237                                 global_eid = pvalues[1].vvalue;
9238                                 pvalues[1].voffset = foffset;
9239                                 pvalues[1].hfname= hf_nds_eid;
9240                                 foffset = foffset+pvalues[1].vlength;
9241                                 break;
9242                         case 0x3a:    
9243                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
9244                                 pvalues[0].vtype = VTYPE_UINT32;
9245                                 pvalues[0].vdesc = "Reply Buffer Size: %u";
9246                                 pvalues[0].vlength = 4;
9247                                 pvalues[0].voffset = foffset;
9248                                 pvalues[0].hfname= hf_nds_buffer_size;
9249                                 foffset = foffset+pvalues[0].vlength;
9250                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
9251                                 pvalues[1].vtype = VTYPE_UINT32;
9252                                 pvalues[1].vdesc = "Version: %u";
9253                                 pvalues[1].vlength = 4;
9254                                 pvalues[1].voffset = foffset;
9255                                 pvalues[1].hfname= hf_nds_ver;
9256                                 foffset = foffset+pvalues[1].vlength;
9257                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
9258                                 pvalues[2].vtype = VTYPE_UINT32;
9259                                 pvalues[2].vdesc = "Entry ID: 0x%08x";
9260                                 pvalues[2].vlength = 4;
9261                                 resolve_eid = TRUE;
9262                                 global_eid = pvalues[2].vvalue;
9263                                 pvalues[2].voffset = foffset;
9264                                 pvalues[2].hfname= hf_nds_eid;
9265                                 foffset = foffset+pvalues[2].vlength;
9266                                 break;
9267                         case 0x3b:    
9268                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
9269                                 pvalues[0].vtype = VTYPE_UINT32;
9270                                 pvalues[0].vdesc = "Version: %u";
9271                                 pvalues[0].vlength = 4;
9272                                 pvalues[0].voffset = foffset;
9273                                 pvalues[0].hfname= hf_nds_ver;
9274                                 foffset = foffset+pvalues[0].vlength;
9275                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
9276                                 pvalues[1].vtype = VTYPE_UINT32;
9277                                 pvalues[1].vdesc = "Entry ID: 0x%08x";
9278                                 pvalues[1].vlength = 4;
9279                                 resolve_eid = TRUE;
9280                                 global_eid = pvalues[1].vvalue;
9281                                 pvalues[1].voffset = foffset;
9282                                 pvalues[1].hfname= hf_nds_eid;
9283                                 foffset = foffset+pvalues[1].vlength;
9284                                 break;
9285                         case 0x3c:    
9286                                 break;
9287                         case 0x3d:    
9288                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9289                                 break;
9290                         case 0x3e:    
9291                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9292                                 break;
9293                         case 0x3f:    
9294                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9295                                 break;
9296                         case 0x40:    
9297                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9298                                 break;
9299                         case 0x41:    
9300                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9301                                 break;
9302                         case 0x42:    
9303                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9304                                 break;
9305                         case 0x43:    
9306                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9307                                 break;
9308                         case 0x44:    
9309                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9310                                 break;
9311                         case 0x45:    
9312                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9313                                 break;
9314                         case 0x46:    
9315                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9316                                 break;
9317                         case 0x47:    
9318                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9319                                 break;
9320                         case 0x48:    
9321                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9322                                 break;
9323                         case 0x49:    
9324                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9325                                 break;
9326                         case 0x4a:    
9327                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9328                                 break;
9329                         case 0x4b:    
9330                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9331                                 break;
9332                         case 0x4c:    
9333                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9334                                 break;
9335                         case 0x4d:    
9336                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9337                                 break;
9338                         default:
9339                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
9340                 }
9341         }
9342         /* Fill in the INFO column. */
9343         if (check_col(pinfo->cinfo, COL_INFO)) {
9344                 if (ncp_rec) {
9345                         col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDS");
9346                         if (nds_frag != 0xffffffff) {
9347                                 col_add_fstr(pinfo->cinfo, COL_INFO, "C Continue NDS Fragment %08x", nds_frag);
9348                         }
9349                         else {
9350                                 col_add_fstr(pinfo->cinfo, COL_INFO, "C NDS %s", verb_string);
9351                         }
9352                         run_info_str = TRUE;
9353                 }
9354                 else {
9355                         col_add_fstr(pinfo->cinfo, COL_INFO,
9356                                 "C Unknown Function %d (0x%02x)",
9357                                 func, func);
9358                 }
9359                         
9360         }
9361         /* Keep track of the address and connection whence the request
9362            came, and the address and connection to which the request
9363            is being sent, so that we can match up calls with replies.
9364            (We don't include the sequence number, as we may want
9365            to have all packets over the same connection treated
9366            as being part of a single conversation so that we can
9367            let the user select that conversation to be displayed.) */
9368
9369         conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
9370                     PT_NCP, nw_connection, nw_connection, 0);
9371         if (conversation == NULL) {
9372                 /* It's not part of any conversation - create a new one. */
9373                 conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst,
9374                     PT_NCP, nw_connection, nw_connection, 0);
9375         }
9376                 
9377         if (!pinfo->fd->flags.visited) {
9378                 request_value = ncp_hash_insert(conversation, sequence, ncp_rec);
9379                 request_value->req_frame_num = pinfo->fd->num;
9380                 request_value->req_frame_time=pinfo->fd->abs_ts;
9381
9382                 /* If this is the first time we're examining the packet,
9383                  * check to see if this NCP type uses a "request condition".
9384                  * If so, we have to build a proto_tree because request conditions
9385                  * use display filters to work, and without a proto_tree,
9386                  * display filters can't possibly work. If we already have
9387                  * a proto_tree, then wonderful. If we don't, we need to build
9388                  * one. */
9389                 if (ncp_rec && !ncp_tree) {
9390                         run_req_cond = TRUE;
9391                 }
9392                 /* Keep track of the Fragment number in the request for defrag logic */
9393                 request_value->nds_frag_num = nds_frag;
9394         }
9395                 
9396         /* If we have to handle a request condition, or have to
9397            add to the Info column, we need to construct a protocol
9398            tree.  If we already have a proto_tree, then wonderful.
9399            If we don't, we need to build one. */
9400         if ((run_info_str || run_req_cond) && !ncp_tree) {
9401                 proto_item *ti;
9402                                        
9403                 temp_tree = proto_tree_create_root();
9404                 proto_tree_set_visible(temp_tree, FALSE);
9405                 ti = proto_tree_add_item(temp_tree, proto_ncp, tvb, 0, -1, FALSE);
9406                 ncp_tree = proto_item_add_subtree(ti, ett_ncp);
9407         }
9408
9409         if (ncp_tree) {
9410                 /* If the dissection throws an exception, be sure to free
9411                  * the temporary proto_tree that was created. Because of the
9412                  * way the CLEANUP_PUSH macro works, we can't put it in an 'if'
9413                  * block; it has to be in the same scope as the terminating
9414                  * CLEANUP_POP or CLEANUP_POP_AND_ALLOC. So, we always
9415                  * call CLEANUP_POP and friends, but the value of temp_tree is
9416                  * NULL if no cleanup is needed, and non-null if cleanup is needed. 
9417                  */
9418                 CLEANUP_PUSH(free_proto_tree, temp_tree);
9419                
9420 #ifdef FAKE_TREE_IS_VISIBLE
9421                 PTREE_DATA(ncp_tree)->visible=1;
9422 #endif
9423
9424                 request_value = ncp_hash_lookup(conversation, sequence);
9425                 switch (type) {
9426                         case NCP_BROADCAST_SLOT:
9427                                 ; /* nothing */
9428                                 break;
9429                 
9430                         case NCP_SERVICE_REQUEST:
9431                         
9432                                 ptvc = ptvcursor_new(ncp_tree, tvb, 7);
9433                                 if (ncp_rec && ncp_rec->request_ptvc)
9434                                 {
9435                                         clear_repeat_vars();
9436                                         process_ptvc_record(ptvc, ncp_rec->request_ptvc, NULL, TRUE, ncp_rec);
9437                                 }
9438                                 proto_tree_add_uint_format(ncp_tree, hf_ncp_func, tvb, 6, 1,
9439                                         func, "Function: %d (0x%02X), %s",
9440                                         func, func, ncp_rec ? ncp_rec->name : "Unknown");
9441                                                 
9442                                 proto_tree_add_uint_format(ncp_tree, hf_ncp_subfunc, tvb, 7, 1,
9443                                         subfunc, "SubFunction: %d (0x%02x)",
9444                                         subfunc, subfunc);
9445                                                 
9446                                 proto_tree_add_uint(ncp_tree, hf_ncp_fragment_handle, tvb, 8, 4,
9447                                         nds_frag);
9448                                                 
9449                                 if (nds_frag == 0xffffffff) {
9450                                         
9451                                         proto_tree_add_item(ncp_tree, hf_ncp_fragment_size, tvb, 12, 4, TRUE);
9452                                                 
9453                                         proto_tree_add_item(ncp_tree, hf_ncp_message_size, tvb, 16, 4, TRUE);
9454                                         
9455                                         proto_tree_add_item(ncp_tree, hf_ncp_nds_flag, tvb, 20, 4, FALSE);
9456                                         
9457                                         proto_tree_add_uint_format(ncp_tree, hf_ncp_nds_verb, tvb, 24, 4,
9458                                                 nds_verb, "NDS Verb: %d, (0x%02x), %s",
9459                                                 nds_verb, nds_verb, verb_string);
9460                                         added_arrow = FALSE;
9461                                         for (i = 0; i < 9; i++) {
9462                                                 switch (pvalues[i].vtype) {
9463
9464                                                 case VTYPE_NONE: /* no value */
9465                                                         break;
9466
9467                                                 case VTYPE_UINT8:
9468                                                         proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
9469                                                             pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %d",
9470                                                             pvalues[i].vtype);
9471                                                         break;
9472
9473                                                 case VTYPE_UINT16:
9474                                                         proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
9475                                                             pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %d",
9476                                                             pvalues[i].vtype);
9477                                                         break;
9478
9479                                                 case VTYPE_UINT32:
9480                                                         proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
9481                                                             pvalues[i].vlength, pvalues[i].vvalue, pvalues[i].vdesc,
9482                                                             pvalues[i].vvalue);
9483                                                         break;
9484
9485                                                 case VTYPE_STRING:
9486                                                         proto_tree_add_string_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset, 
9487                                                             pvalues[i].vlength, pvalues[i].vstring, pvalues[i].vdesc, pvalues[i].vstring);
9488                                                         if (pvalues[i].mvtype == MVTYPE_ATTR_REQUEST) {
9489                                                                 /*
9490                                                                  * The "vstring" value is set to the input ES type
9491                                                                  * for MVTYPE_PROC_ENTRY_SPECIFIERS,
9492                                                                  * to add string to columninfo
9493                                                                  */
9494                                                                 if (check_col(pinfo->cinfo, COL_INFO)) {
9495                                                                         if (!added_arrow) {
9496                                                                                 col_append_str(pinfo->cinfo, COL_INFO, " -> ");
9497                                                                                 added_arrow = TRUE;
9498                                                                         }
9499                                                                         col_append_str(pinfo->cinfo, COL_INFO, pvalues[i].vstring);
9500                                                                 }
9501                                                         }
9502                                                         break;
9503
9504                                                 case VTYPE_BITFIELD:
9505                                                         process_bitfield(ncp_tree, tvb, &pvalues[i]);
9506                                                         break;
9507
9508                                                 case VTYPE_MULTIVALUE_UINT32:
9509                                                         process_multivalues(ncp_tree, tvb, &pvalues[i]);
9510                                                         if (pvalues[i].mvtype == MVTYPE_PROC_ENTRY_SPECIFIERS) {
9511                                                                 /*
9512                                                                  * The "vstring" value is set to the input ES type
9513                                                                  * by "process_multivalues()".
9514                                                                  */
9515                                                                 strcpy(global_object_name, mv_resolve_name_string);
9516                                                         }
9517                                                         if (pvalues[i].mvtype == MVTYPE_ATTR_REQUEST || pvalues[i].mvtype == MVTYPE_PROC_ENTRY_SPECIFIERS) {
9518                                                                 /*
9519                                                                  * The "vstring" value is set to the input ES type
9520                                                                  * for MVTYPE_PROC_ENTRY_SPECIFIERS,
9521                                                                  * and the last string for MVTYPE_ATTR_REQUEST,
9522                                                                  * by "process_multivalues()".
9523                                                                  */
9524                                                                 if (check_col(pinfo->cinfo, COL_INFO)) {
9525                                                                         col_append_str(pinfo->cinfo, COL_INFO, pvalues[i].vstring);
9526                                                                         if (!added_arrow) {
9527                                                                                 col_append_str(pinfo->cinfo, COL_INFO, " -> ");
9528                                                                                 added_arrow = TRUE;
9529                                                                         }
9530                                                                         col_append_str(pinfo->cinfo, COL_INFO, mv_resolve_name_string);
9531                                                                 }
9532                                                         }
9533                                                         break;
9534
9535                                                 case VTYPE_BYTES:
9536                                                         proto_tree_add_bytes(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
9537                                                             pvalues[i].vlength, tvb_get_ptr(tvb, pvalues[i].voffset, pvalues[i].vvalue));
9538                                                         break;
9539
9540                                                 case VTYPE_BOOLEAN:
9541                                                         proto_tree_add_item(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset, pvalues[i].vlength, TRUE);
9542                                                         break;
9543
9544                                                 default:
9545                                                         proto_tree_add_uint_format(ncp_tree, hf_nds_p1type, tvb, pvalues[i].voffset,
9546                                                             pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %u",
9547                                                             pvalues[i].vtype);
9548                                                         break;
9549                                                 }
9550                                                 /* For NDS requests with just an EID, resolve name from hash table. */
9551                                         }
9552                                         request_eid_value = ncp_eid_hash_lookup(conversation, global_eid);
9553                                         if(resolve_eid) {
9554                                                 if (request_eid_value) {
9555                                                         strcpy(global_object_name, request_eid_value->object_name);
9556                                                         if (check_col(pinfo->cinfo, COL_INFO)) 
9557                                                         {
9558                                                                 col_append_str(pinfo->cinfo, COL_INFO, ", Object Name - ");
9559                                                                 col_append_str(pinfo->cinfo, COL_INFO, global_object_name);
9560                                                         }
9561                                                 }        
9562                                         }
9563                                         if (request_value)
9564                                         {
9565                                                 request_value->nds_request_verb = nds_verb;
9566                                                 request_value->nds_version = nds_version;
9567                                                 strcpy(request_value->object_name, global_object_name);
9568                                                 request_value->req_nds_flags = global_flags;
9569                                         }
9570                                 }
9571                                 break;
9572                
9573                         default:
9574                                 ; /* nothing */
9575                                 break;
9576                 }
9577                 ptvcursor_free(ptvc);
9578                
9579                 /* Free the temporary proto_tree */
9580                 CLEANUP_CALL_AND_POP;
9581         }        
9582 }
9583
9584 /*
9585  * XXX - this duplicates stuff in "dissect_ncp_request()"; could
9586  * "dissect_ncp_request()" not just call "dissect_ping_req()" if
9587  * the operation is an NCP ping, and "dissect_ping_req()" just dissect
9588  * ping portion?
9589  */
9590 void
9591 dissect_ping_req(tvbuff_t *tvb, packet_info *pinfo,
9592                 guint32 nw_connection, guint8 sequence,
9593                 guint16 type, proto_tree *ncp_tree)
9594 {
9595         guint8                  func, subfunc = 0;
9596         ncp_req_hash_value      *request_value = NULL;
9597         const ncp_record        *ncp_rec = NULL;          
9598         conversation_t          *conversation;
9599         ptvcursor_t             *ptvc = NULL;
9600         proto_tree              *temp_tree = NULL;
9601         gint                    length_remaining = 0;
9602         guint32                 nds_flags;
9603         guint32                 ping_version;
9604         nds_val                 pvalue;
9605         char                    string_buffer[1024];
9606         
9607 #ifdef FAKE_TREE_IS_VISIBLE
9608     if (ncp_tree) {
9609         PTREE_DATA(ncp_tree)->visible=1;
9610     }
9611 #endif
9612
9613         pvalue.vvalue = 0;
9614         pvalue.vlength = 0;
9615         pvalue.voffset = 0;
9616         pvalue.hfname = 0;
9617         pvalue.vdesc = "";
9618         string_buffer[0] = '\0';
9619         pvalue.vstring = string_buffer;
9620         pvalue.mvtype = 0;
9621         
9622         func = tvb_get_guint8(tvb, 6);
9623         subfunc = tvb_get_guint8(tvb, 7);
9624         
9625         ncp_rec = ncp_record_find(func, subfunc);
9626
9627         /* Fill in the INFO column. */
9628         if (check_col(pinfo->cinfo, COL_INFO)) 
9629         {
9630                 if (ncp_rec) 
9631                 {
9632                         
9633                         col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDS");
9634                         col_add_fstr(pinfo->cinfo, COL_INFO, "C Ping for NDS");
9635                 }
9636                 
9637         }
9638         if (!pinfo->fd->flags.visited) 
9639         {
9640         
9641                 /* This is the first time we've looked at this packet.
9642                 Keep track of the address and connection whence the request
9643                 came, and the address and connection to which the request
9644                 is being sent, so that we can match up calls with replies.
9645                 (We don't include the sequence number, as we may want
9646                 to have all packets over the same connection treated
9647                 as being part of a single conversation so that we can
9648                 let the user select that conversation to be displayed.) */
9649                 
9650                 conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
9651                     PT_NCP, nw_connection, nw_connection, 0);
9652         
9653                 if (conversation == NULL) 
9654                 {
9655                         /* It's not part of any conversation - create a new one. */
9656                         conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst,
9657                             PT_NCP, nw_connection, nw_connection, 0);
9658                 }
9659                 
9660                 request_value = ncp_hash_insert(conversation, sequence, ncp_rec);
9661                 request_value->req_frame_num = pinfo->fd->num;
9662                     request_value->req_frame_time=pinfo->fd->abs_ts;
9663         
9664                 /* If this is the first time we're examining the packet,
9665                  * check to see if this NCP type uses a "request condition".
9666                  * If so, we have to build a proto_tree because request conditions
9667                  * use display filters to work, and without a proto_tree,
9668                  * display filters can't possibly work. If we already have
9669                  * a proto_tree, then wonderful. If we don't, we need to build
9670                  * one. */
9671                 if (ncp_rec && !ncp_tree) {
9672                         proto_item *ti;
9673                                
9674                         temp_tree = proto_tree_create_root();
9675                         proto_tree_set_visible(temp_tree, FALSE);
9676                         ti = proto_tree_add_item(temp_tree, proto_ncp, tvb, 0, -1, FALSE);
9677                         ncp_tree = proto_item_add_subtree(ti, ett_ncp);
9678                 }
9679         }
9680         
9681         if (ncp_tree) {
9682                 /* If the dissection throws an exception, be sure to free
9683                  * the temporary proto_tree that was created. Because of the
9684                  * way the CLEANUP_PUSH macro works, we can't put it in an 'if'
9685                  * block; it has to be in the same scope as the terminating
9686                  * CLEANUP_POP or CLEANUP_POP_AND_ALLOC. So, we always
9687                  * call CLEANUP_POP and friends, but the value of temp_tree is
9688                  * NULL if no cleanup is needed, and non-null if cleanup is needed. 
9689                  */
9690                 CLEANUP_PUSH(free_proto_tree, temp_tree);
9691
9692         switch (type) {
9693
9694                 case NCP_BROADCAST_SLOT:
9695                         ; /* nothing */
9696                         break;
9697         
9698                 case NCP_SERVICE_REQUEST:
9699                         proto_tree_add_uint_format(ncp_tree, hf_ncp_func, tvb, 6, 1,
9700                                 func, "Function: %u (0x%02X), %s",
9701                                 func, func, ncp_rec ? ncp_rec->name : "Unknown");
9702                                         
9703                         proto_tree_add_uint_format(ncp_tree, hf_ncp_subfunc, tvb, 7, 1,
9704                                 subfunc, "SubFunction: %u (0x%02x)",
9705                                 subfunc, subfunc);
9706
9707                         length_remaining = tvb_reported_length_remaining(tvb, 8);
9708
9709                         if (length_remaining >= 8) {
9710                                 ping_version = tvb_get_letohl(tvb, 8);
9711                                 proto_tree_add_uint(ncp_tree, hf_nds_ping_version, tvb, 8,
9712                                     4, ping_version);
9713                                 nds_flags = tvb_get_letohl(tvb, 12);
9714                                 if (request_value){
9715                     request_value->nds_request_verb = 0xf0;
9716                     request_value->req_nds_flags = nds_flags;
9717                 }
9718                     proto_tree_add_uint_hidden(ncp_tree, hf_ncp_nds_verb, tvb, 0, 0,
9719                         240);
9720
9721                                 
9722                                 pvalue.vvalue = tvb_get_letohs(tvb, 12);
9723                                 pvalue.vtype = VTYPE_BITFIELD;
9724                                 pvalue.vstring = "";
9725                                 pvalue.vdesc = "Ping (low) Request Flags:";
9726                                 pvalue.vlength = 2;
9727                                 pvalue.hfname= hf_nds_rflags;
9728                                 pvalue.voffset = 12;
9729                                 pvalue.bit1 = "Supported Fields";
9730                                 pvalue.bit1hfname = hf_bit1pingflags1;
9731                                 pvalue.bit2 = "Depth";
9732                                 pvalue.bit2hfname = hf_bit2pingflags1;
9733                                 pvalue.bit3 = "Revision";
9734                                 pvalue.bit3hfname = hf_bit3pingflags1;
9735                                 pvalue.bit4 = "Flags";
9736                                 pvalue.bit4hfname = hf_bit4pingflags1;
9737                                 pvalue.bit5 = "Verification Flags";
9738                                 pvalue.bit5hfname = hf_bit5pingflags1;
9739                                 pvalue.bit6 = "Letter Version";
9740                                 pvalue.bit6hfname = hf_bit6pingflags1;
9741                                 pvalue.bit7 = "OS Version";
9742                                 pvalue.bit7hfname = hf_bit7pingflags1;
9743                                 pvalue.bit8 = "License Flags";
9744                                 pvalue.bit8hfname = hf_bit8pingflags1;
9745                                 pvalue.bit9 = "DS Time";
9746                                 pvalue.bit9hfname = hf_bit9pingflags1;
9747                                 pvalue.bit10 = "Not Defined";
9748                                 pvalue.bit10hfname = hf_bit10pingflags1;
9749                                 pvalue.bit11 = "Not Defined";
9750                                 pvalue.bit11hfname = hf_bit11pingflags1;
9751                                 pvalue.bit12 = "Not Defined";
9752                                 pvalue.bit12hfname = hf_bit12pingflags1;
9753                                 pvalue.bit13 = "Not Defined";
9754                                 pvalue.bit13hfname = hf_bit13pingflags1;
9755                                 pvalue.bit14 = "Not Defined";
9756                                 pvalue.bit14hfname = hf_bit14pingflags1;
9757                                 pvalue.bit15 = "Not Defined";
9758                                 pvalue.bit15hfname = hf_bit15pingflags1;
9759                                 pvalue.bit16 = "Not Defined";
9760                                 pvalue.bit16hfname = hf_bit16pingflags1;
9761                                 
9762                                 process_bitfield(ncp_tree, tvb, &pvalue);
9763                                 
9764                                 pvalue.vvalue = tvb_get_letohs(tvb, 14);
9765                                 pvalue.vtype = VTYPE_BITFIELD;
9766                                 pvalue.vstring = "";
9767                                 pvalue.vdesc = "Ping (high) Request Flags:";
9768                                 pvalue.vlength = 2;
9769                                 pvalue.hfname= hf_nds_rflags;
9770                                 pvalue.voffset = 14;
9771                                 pvalue.bit1 = "Sap Name";
9772                                 pvalue.bit1hfname = hf_bit1pingflags2;
9773                                 pvalue.bit2 = "Tree Name";
9774                                 pvalue.bit2hfname = hf_bit2pingflags2;
9775                                 pvalue.bit3 = "OS Name";
9776                                 pvalue.bit3hfname = hf_bit3pingflags2;
9777                                 pvalue.bit4 = "Hardware Name";
9778                                 pvalue.bit4hfname = hf_bit4pingflags2;
9779                                 pvalue.bit5 = "Vendor Name";
9780                                 pvalue.bit5hfname = hf_bit5pingflags2;
9781                                 pvalue.bit6 = "Not Defined";
9782                                 pvalue.bit6hfname = hf_bit6pingflags2;
9783                                 pvalue.bit7 = "Not Defined";
9784                                 pvalue.bit7hfname = hf_bit7pingflags2;
9785                                 pvalue.bit8 = "Not Defined";
9786                                 pvalue.bit8hfname = hf_bit8pingflags2;
9787                                 pvalue.bit9 = "Not Defined";
9788                                 pvalue.bit9hfname = hf_bit9pingflags2;
9789                                 pvalue.bit10 = "Not Defined";
9790                                 pvalue.bit10hfname = hf_bit10pingflags2;
9791                                 pvalue.bit11 = "Not Defined";
9792                                 pvalue.bit11hfname = hf_bit11pingflags2;
9793                                 pvalue.bit12 = "Not Defined";
9794                                 pvalue.bit12hfname = hf_bit12pingflags2;
9795                                 pvalue.bit13 = "Not Defined";
9796                                 pvalue.bit13hfname = hf_bit13pingflags2;
9797                                 pvalue.bit14 = "Not Defined";
9798                                 pvalue.bit14hfname = hf_bit14pingflags2;
9799                                 pvalue.bit15 = "Not Defined";
9800                                 pvalue.bit15hfname = hf_bit15pingflags2;
9801                                 pvalue.bit16 = "Not Defined";
9802                                 pvalue.bit16hfname = hf_bit16pingflags2;
9803                                 
9804                                 process_bitfield(ncp_tree, tvb, &pvalue);
9805                         }
9806                         break;
9807        
9808                 default:
9809                         ; /* nothing */
9810                         break;
9811                 }
9812                 ptvc = ptvcursor_new(ncp_tree, tvb, 7);
9813                 if (ncp_rec && ncp_rec->request_ptvc) {
9814                         clear_repeat_vars();
9815                         process_ptvc_record(ptvc, ncp_rec->request_ptvc, NULL, TRUE, ncp_rec);
9816                 }
9817                 ptvcursor_free(ptvc);
9818
9819                 /* Free the temporary proto_tree */
9820                 CLEANUP_CALL_AND_POP;
9821         }
9822 }