HACK: 2nd try to match RowsetProperties
[wireshark-wip.git] / epan / dissectors / packet-ncp2222.inc
blob3f8630268f3ca02c5b5524fa9b4b2cc76b29f146
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 */
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
41  */
43 #define PROTO_LENGTH_UNTIL_END -1
45 gboolean    nds_defragment  = TRUE;
46 gboolean    nds_echo_eid    = TRUE;
47 gboolean    ncp_echo_err    = TRUE;
48 gboolean    ncp_echo_conn   = FALSE;
49 gboolean    ncp_echo_server = TRUE;
50 gboolean    ncp_echo_file   = FALSE;
51 gboolean    ncp_newstyle    = TRUE;
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_frag_prot_flags;
59     guint32     nds_length;
60     guint32     nds_frag;
61     gboolean    nds_fragmented;
62     guint8      sequence;
63 } frag_info;
65 static frag_info           frags[100];
66 static char    mv_resolve_name_string[128];
68 static const fragment_items nds_frag_items = {
69     &ett_nds_segment,
70     &ett_nds_segments,
71     &hf_nds_segments,
72     &hf_nds_segment,
73     &hf_nds_segment_overlap,
74     &hf_nds_segment_overlap_conflict,
75     &hf_nds_segment_multiple_tails,
76     &hf_nds_segment_too_long_segment,
77     &hf_nds_segment_error,
78     &hf_nds_segment_count,
79     NULL,
80     &hf_nds_reassembled_length,
81     /* Reassembled data field */
82     NULL,
83     "segments"
86 /* Table for reassembly of fragments. */
87 static reassembly_table nds_reassembly_table;
89 #define NDS_TAG_NO_SUCH_ENTRY           0x00000000
90 #define NDS_TAG_LOCAL_ENTRY             0x00000001
91 #define NDS_TAG_REMOTE_ENTRY            0x00000002
92 #define NDS_TAG_ALIAS_ENTRY             0x00000003
93 #define NDS_TAG_REFERRAL_INFORMATION    0x00000004
94 #define NDS_TAG_ENTRY_AND_REFERRALS     0x00000006
96 /* Search objects */
97 #define NDS_SEARCH_ENTRY                         0
98 #define NDS_SEARCH_SUBORDINATES                  1
99 #define NDS_SEARCH_SUBTREE                       2
100 #define NDS_SEARCH_PARTITION                     3
102 /* Search Referral Types */
103 #define NDS_ALIAS_REFERRAL                       0
104 #define NDS_PARTITION_REFERRAL                   1
106 /* Search Filter Types */
107 #define NDS_SEARCH_ITEM                          0
108 #define NDS_SEARCH_OR                            1
109 #define NDS_SEARCH_AND                           2
110 #define NDS_SEARCH_NOT                           3
112 /* Search Operators */
113 #define NDS_SEARCH_EQUAL                         7
114 #define NDS_SEARCH_GREATER_OR_EQUAL              8
115 #define NDS_SEARCH_LESS_OR_EQUAL                 9
116 #define NDS_SEARCH_APPROX                       10
117 #define NDS_SEARCH_PRESENT                      15
118 #define NDS_SEARCH_RDN                          16
119 #define NDS_SEARCH_BASE_CLASS                   17
120 #define NDS_SEARCH_MODIFICATION_GE              18  /* Deprecated, use DS_SEARCH_ENTRY_MTS_GE */
121 #define NDS_SEARCH_VALUE_TIME_GE                19  /* Deprecated, use DS_SEARCH_VALUE_MTS_GE */
122 #define NDS_SEARCH_REFERENCES                   20
123 #define NDS_SEARCH_DN_IN_VALUE                  21
124 #define NDS_SEARCH_SCHEMA_IN_VALUE              22
125 #define NDS_SEARCH_ENTRY_FLAGS                  23
126 #define NDS_SEARCH_ENTRY_HAS_FLAG               24
127 #define NDS_SEARCH_VALUE_FLAGS                  25
128 #define NDS_SEARCH_VALUE_HAS_FLAG               26
129 #define NDS_SEARCH_ATTR_FLAGS                   27
130 #define NDS_SEARCH_ATTR_HAS_FLAG                28
131 #define NDS_SEARCH_EID                          29
133 #define NDS_SEARCH_ENTRY_MTS_GE                 18
134 #define NDS_SEARCH_ENTRY_MTS_G                  30
135 #define NDS_SEARCH_ENTRY_MTS_LE                 31
136 #define NDS_SEARCH_ENTRY_MTS_L                  32
137 #define NDS_SEARCH_ENTRY_MTS_EQ                 33
138 #define NDS_SEARCH_ENTRY_MTS_EQ_APPROX          34
139 #define NDS_SEARCH_VALUE_MTS_GE                 19
140 #define NDS_SEARCH_VALUE_MTS_G                  35
141 #define NDS_SEARCH_VALUE_MTS_LE                 36
142 #define NDS_SEARCH_VALUE_MTS_L                  37
143 #define NDS_SEARCH_VALUE_MTS_EQ                 38
144 #define NDS_SEARCH_VALUE_MTS_EQ_APPROX          39
146 #define NDS_SEARCH_ENTRY_CTS_GE                 40
147 #define NDS_SEARCH_ENTRY_CTS_G                  41
148 #define NDS_SEARCH_ENTRY_CTS_LE                 42
149 #define NDS_SEARCH_ENTRY_CTS_L                  43
150 #define NDS_SEARCH_ENTRY_CTS_EQ                 44
151 #define NDS_SEARCH_ENTRY_CTS_EQ_APPROX          45
152 #define NDS_SEARCH_VALUE_CTS_GE                 46
153 #define NDS_SEARCH_VALUE_CTS_G                  47
154 #define NDS_SEARCH_VALUE_CTS_LE                 48
155 #define NDS_SEARCH_VALUE_CTS_L                  49
156 #define NDS_SEARCH_VALUE_CTS_EQ                 50
157 #define NDS_SEARCH_VALUE_CTS_EQ_APPROX          51
158 #define NDS_SEARCH_EXTENSIBLE                   52
159 #define NDS_SEARCH_ENTRY_SUBCOUNT_GE            53
160 #define NDS_SEARCH_ENTRY_SUBCOUNT_G             54
161 #define NDS_SEARCH_ENTRY_SUBCOUNT_LE            55
162 #define NDS_SEARCH_ENTRY_SUBCOUNT_L             56
163 #define NDS_SEARCH_ENTRY_SUBCOUNT_EQ            57
165 #define DCS_OPS                         0x10000000L
166 #define DCS_MOD_GE_WITH_ATTR            DCS_OPS + NDS_SEARCH_MODIFICATION_GE
167 #define DCS_VALUE_GE_WITH_ATTR          DCS_OPS + NDS_SEARCH_VALUE_TIME_GE
168 #define DCS_MASK                        ~DCS_OPS
170 /* Iterator verbs */
171 #define IT_CLEAR                                 1
172 #define IT_COPY                                  2
173 #define IT_COUNT                                 3
174 #define IT_CREATE                                4
175 #define IT_CURRENT                               5
176 #define IT_DESTROY                               6
177 #define IT_DONE                                  7
178 #define IT_FIRST                                 8
179 #define IT_GETPOSITION                           9
180 #define IT_LAST                                 10
181 #define IT_NEXT                                 11
182 #define IT_PREV                                 12
183 #define IT_POSITION                             13
184 #define IT_POSITION_IT                          14
185 #define IT_SETINDEX                             15
186 #define IT_SETFILTER                            16
187 #define IT_SKIP                                 17
188 #define IT_TYPEDOWN                             18
189 #define IT_ATFIRST                              19
190 #define IT_ATEOF                                20
191 #define IT_GETINDEX                             21
192 #define IT_ISPOSITIONABLE                       22
193 #define IT_ATBOF                                23
194 #define IT_ATLAST                               24
196 /* Iteration information flags */
197 #define DSI_OUTPUT_FIELDS               0x00000001U
198 #define DSI_ENTRY_ID                    0x00000002U
199 #define DSI_ENTRY_FLAGS                 0x00000004U
200 #define DSI_SUBORDINATE_COUNT           0x00000008U
201 #define DSI_MODIFICATION_TIME           0x00000010U
202 #define DSI_MODIFICATION_TIMESTAMP      0x00000020U
203 #define DSI_CREATION_TIMESTAMP          0x00000040U
204 #define DSI_PARTITION_ROOT_ID           0x00000080U
205 #define DSI_PARENT_ID                   0x00000100U
206 #define DSI_REVISION_COUNT              0x00000200U
207 #define DSI_REPLICA_TYPE                0x00000400U
208 #define DSI_BASE_CLASS                  0x00000800U
209 #define DSI_ENTRY_RDN                   0x00001000U
210 #define DSI_ENTRY_DN                    0x00002000U
211 #define DSI_PARTITION_ROOT_DN           0x00004000U
212 #define DSI_PARENT_DN                   0x00008000U
213 #define DSI_PURGE_TIME                  0x00010000U
214 #define DSI_DEREFERENCED_BASE_CLASS     0x00020000
215 #define DSI_REPLICA_NUMBER              0x00040000
216 #define DSI_REPLICA_STATE               0x00080000
217 #define DSI_FEDERATION_BOUNDARY         0x00100000
218 #define DSI_SCHEMA_BOUNDARY             0x00200000
219 #define DSI_FEDERATION_BOUNDARY_ID      0x00400000
220 #define DSI_SCHEMA_BOUNDARY_ID          0x00800000
221 #define DSI_CUR_SUBCOUNT                0x01000000
222 #define DSI_LOCAL_ENTRY_FLAGS           0x02000000
224 static const value_string zensearchenum[] = {
225     { 0, "[Root]" },
226     { 1, "Object Container" },
227     { 2, "Associated Container" },
228     { 3, "Selected Container" },
229     {0, NULL }
232 static const value_string itersearchenum[] = {
233     { NDS_SEARCH_ITEM, "Search Item" },
234     { NDS_SEARCH_OR, "OR" },
235     { NDS_SEARCH_AND, "AND" },
236     { NDS_SEARCH_NOT, "NOT" },
237     { NDS_SEARCH_EQUAL, "Equals" },
238     { NDS_SEARCH_GREATER_OR_EQUAL, "Greater or Equals" },
239     { NDS_SEARCH_LESS_OR_EQUAL, "Less or Equals" },
240     { NDS_SEARCH_APPROX, "Approximately" },
241     { NDS_SEARCH_PRESENT, "Present" },
242     { NDS_SEARCH_RDN, "Relative Distinguished Name" },
243     { NDS_SEARCH_BASE_CLASS, "Base Class" },
244     { NDS_SEARCH_MODIFICATION_GE, "Modification Greater or Equal" },
245     { NDS_SEARCH_VALUE_TIME_GE, "Time Value Greater or Equal" },
246     { NDS_SEARCH_REFERENCES, "References" },
247     { NDS_SEARCH_DN_IN_VALUE, "Designated Name in Value" },
248     { NDS_SEARCH_SCHEMA_IN_VALUE, "Schema in Value" },
249     { NDS_SEARCH_ENTRY_FLAGS, "Entry Flags" },
250     { NDS_SEARCH_ENTRY_HAS_FLAG, "Entry has Flags" },
251     { NDS_SEARCH_VALUE_FLAGS, "Value Flags" },
252     { NDS_SEARCH_VALUE_HAS_FLAG, "Value has Flags" },
253     { NDS_SEARCH_ATTR_FLAGS, "Attribute Flags" },
254     { NDS_SEARCH_ATTR_HAS_FLAG, "Attribute has Flags" },
255     { NDS_SEARCH_EID, "Entry ID" },
256     { NDS_SEARCH_ENTRY_MTS_GE, "Entry Modification Timestamp Greater or Equal" },
257     { NDS_SEARCH_ENTRY_MTS_G, "Entry Modification Timestamp Greater" },
258     { NDS_SEARCH_ENTRY_MTS_LE, "Entry Modification Timestamp Less or Equals" },
259     { NDS_SEARCH_ENTRY_MTS_L, "Entry Modification Timestamp Less" },
260     { NDS_SEARCH_ENTRY_MTS_EQ, "Entry Modification Timestamp Equals" },
261     { NDS_SEARCH_ENTRY_MTS_EQ_APPROX, "Entry Modification Timestamp Equals Approximately" },
262     { NDS_SEARCH_VALUE_MTS_GE, "Value Modification Timestamp Greater or Equal" },
263     { NDS_SEARCH_VALUE_MTS_G, "Value Modification Timestamp Greater" },
264     { NDS_SEARCH_VALUE_MTS_LE, "Value Modification Timestamp Less or Equals" },
265     { NDS_SEARCH_VALUE_MTS_L, "Value Modification Timestamp Less" },
266     { NDS_SEARCH_VALUE_MTS_EQ, "Value Modification Timestamp Equals" },
267     { NDS_SEARCH_VALUE_MTS_EQ_APPROX, "Value Modification Timestamp Equals Approximately" },
268     { NDS_SEARCH_ENTRY_CTS_GE, "Entry Creation Timestamp Greater or Equals" },
269     { NDS_SEARCH_ENTRY_CTS_G, "Entry Creation Timestamp Greater" },
270     { NDS_SEARCH_ENTRY_CTS_LE, "Entry Creation Timestamp Less or Equals" },
271     { NDS_SEARCH_ENTRY_CTS_L, "Entry Creation Timestamp Less" },
272     { NDS_SEARCH_ENTRY_CTS_EQ, "Entry Creation Timestamp Equals" },
273     { NDS_SEARCH_ENTRY_CTS_EQ_APPROX, "Entry Creation Timestamp Equals Approximately" },
274     { NDS_SEARCH_VALUE_CTS_GE, "Value Creation Timestamp Greater or Equals" },
275     { NDS_SEARCH_VALUE_CTS_G, "Value Creation Timestamp Greater" },
276     { NDS_SEARCH_VALUE_CTS_LE, "Value Creation Timestamp Less or Equals" },
277     { NDS_SEARCH_VALUE_CTS_L, "Value Creation Timestamp Less" },
278     { NDS_SEARCH_VALUE_CTS_EQ, "Value Creation Timestamp Equals" },
279     { NDS_SEARCH_VALUE_CTS_EQ_APPROX, "Value Creation Timestamp Equals Approximately" },
280     { NDS_SEARCH_EXTENSIBLE, "Extensible" },
281     { NDS_SEARCH_ENTRY_SUBCOUNT_GE, "Entry SubCount Greater or Equals" },
282     { NDS_SEARCH_ENTRY_SUBCOUNT_G, "Entry SubCount Greater" },
283     { NDS_SEARCH_ENTRY_SUBCOUNT_LE, "Entry SubCount Less or Equals" },
284     { NDS_SEARCH_ENTRY_SUBCOUNT_L, "Entry SubCount Less" },
285     { NDS_SEARCH_ENTRY_SUBCOUNT_EQ, "Entry SubCount Equals" },
286     {0, NULL }
289 static const value_string iterator_subverbs[] = {
290     { IT_CLEAR, "Clear" },
291     { IT_COPY, "Copy" },
292     { IT_COUNT, "Count" },
293     { IT_CREATE, "Create" },
294     { IT_CURRENT, "Current" },
295     { IT_DESTROY, "Destroy" },
296     { IT_DONE, "Done" },
297     { IT_FIRST, "First" },
298     { IT_GETPOSITION, "Get Position" },
299     { IT_LAST, "Last" },
300     { IT_NEXT, "Next" },
301     { IT_PREV, "Previous" },
302     { IT_POSITION, "Position" },
303     { IT_POSITION_IT, "Position Iterator" },
304     { IT_SETINDEX, "Set Index" },
305     { IT_SETFILTER, "Set Filter" },
306     { IT_SKIP, "Skip" },
307     { IT_TYPEDOWN, "Type Down" },
308     { IT_ATFIRST, "At First" },
309     { IT_ATEOF, "At End of File" },
310     { IT_GETINDEX, "Get Index" },
311     { IT_ISPOSITIONABLE, "Is Positionable" },
312     { IT_ATBOF, "At Beginning of File" },
313     { IT_ATLAST, "At Last" },
314     { 0, NULL }
318 static const value_string nds_tuned_tags[] = {
319     { 0, "RDN Hint" },
320     { 1, "RDN History" },
321     {0, NULL }
324 static const value_string nds_scope_vals[] = {
325     { 0, "Search Scope: 0x0000 - Examine base object only" },
326     { 1, "Search Scope: 0x0001 - Search the immediate subordinates of the base object" },
327     { 2, "Search Scope: 0x0002 - Search the base object and all of its subordinates" },
328     { 3, "Search Scope: 0x0003 - Search the base objects and all objects in its partition (NDS version 8 or higher)" },
329     {0, NULL }
332 static const value_string nds_tuned_item_tags[] = {
333     { 0, "Single Item" },
334     { 1, "Multiple Items" },
335     {0, NULL }
338 static const value_string nds_tags[] = {
339     { NDS_TAG_NO_SUCH_ENTRY,        "No Such Entry" },
340     { NDS_TAG_LOCAL_ENTRY,          "Local Entry" },
341     { NDS_TAG_REMOTE_ENTRY,         "Remote Entry" },
342     { NDS_TAG_ALIAS_ENTRY,          "Alias Entry" },
343     { NDS_TAG_REFERRAL_INFORMATION, "Referral Information" },
344     { NDS_TAG_ENTRY_AND_REFERRALS,  "Entry and Referrals" },
345     { 0, NULL }
348 static const value_string nds_info_type[] = {
349     { 0x00000000, "Attribute Names Only / " },
350     { 0x00000001, "Attribute Name & Value / " },
351     { 0x00000002, "Effective Privileges / " },
352     { 0x00000003, "Value Information / " },
353     { 0x00000004, "Abbreviated Value / " },
354     { 0, NULL }
357 static const value_string nds_kind_of_changes[] = {
358     { 0x00000000, "Add Attribute" },
359     { 0x00000001, "Remove Attribute" },
360     { 0x00000002, "Add Value" },
361     { 0x00000003, "Remove Value" },
362     { 0x00000004, "Add Additional Value" },
363     { 0x00000005, "Overwrite Value" },
364     { 0x00000006, "Clear Attribute" },
365     { 0x00000007, "Clear Value" },
366     { 0, NULL }
369 static const value_string es_type[] = {
370     { 0x00000000, "No type is specified" },
371     { 0x00000001, "Unicode string" },
372     { 0x00000002, "Partial name" },
373     { 0x00000003, "Referrals" },
374     { 0x00000004, "Tuned name" },
375     { 0x00000005, "GUID attribute" },
376     { 0x00000006, "Local entry ID" },
377     { 0x00000007, "Number of defined entry specifiers" },
378     { 0, NULL }
381 static const value_string ncp_rights_vals[] = {
382     { 0x00, "No Rights"},
383     { 0x01, "Read"},
384     { 0x02, "Write"},
385     { 0x03, "Read, Write"},
386     { 0x04, "Deny Read"},
387     { 0x05, "Read, Deny Read"},
388     { 0x06, "Write, Deny Read"},
389     { 0x07, "Read, Write, Deny Read"},
390     { 0x08, "Deny Write"},
391     { 0x09, "Read, Deny Write"},
392     { 0x0a, "Write, Deny Write"},
393     { 0x0b, "Read, Write, Deny Write"},
394     { 0x0c, "Deny Read, Deny Write"},
395     { 0x0d, "Read, Deny Read, Deny Write"},
396     { 0x0e, "Write, Deny Read, Deny Write"},
397     { 0x0f, "Read, Write, Deny Read, Deny Write"},
398     { 0x10, "Compatibility"},
399     { 0x11, "Read, Compatibility"},
400     { 0x12, "Write, Compatibility"},
401     { 0x13, "Read, Write, Compatibility"},
402     { 0x14, "Deny Read, Compatibility"},
403     { 0x15, "Read, Deny Read, Compatibility"},
404     { 0x16, "Write, Deny Read, Compatibility"},
405     { 0x17, "Read, Write, Deny Read, Compatibility"},
406     { 0x18, "Deny Write, Compatibility"},
407     { 0x19, "Read, Deny Write, Compatibility"},
408     { 0x1a, "Write, Deny Write, Compatibility"},
409     { 0x1b, "Read, Write, Deny Write, Compatibility"},
410     { 0x1c, "Deny Read, Deny Write, Compatibility"},
411     { 0x1d, "Read, Deny Read, Deny Write, Compatibility"},
412     { 0x1e, "Write, Deny Read, Deny Write, Compatibility"},
413     { 0x1f, "Read, Write, Deny Read, Deny Write, Compatibility"},
414     { 0x40, "File Write Through"},
415     { 0x41, "Read, File Write Through"},
416     { 0x42, "Write, File Write Through"},
417     { 0x43, "Read, Write, File Write Through"},
418     { 0x44, "Deny Read, File Write Through"},
419     { 0x45, "Read, Deny Read, File Write Through"},
420     { 0x46, "Write, Deny Read, File Write Through"},
421     { 0x47, "Read, Write, Deny Read, File Write Through"},
422     { 0x48, "Deny Write, File Write Through"},
423     { 0x49, "Read, Deny Write, File Write Through"},
424     { 0x4a, "Write, Deny Write, File Write Through"},
425     { 0x4b, "Read, Write, Deny Write, File Write Through"},
426     { 0x4c, "Deny Read, Deny Write, File Write Through"},
427     { 0x4d, "Read, Deny Read, Deny Write, File Write Through"},
428     { 0x4e, "Write, Deny Read, Deny Write, File Write Through"},
429     { 0x4f, "Read, Write, Deny Read, Deny Write, File Write Through"},
430     { 0x50, "Compatibility, File Write Through"},
431     { 0x51, "Read, Compatibility, File Write Through"},
432     { 0x52, "Write, Compatibility, File Write Through"},
433     { 0x53, "Read, Write, Compatibility, File Write Through"},
434     { 0x54, "Deny Read, Compatibility, File Write Through"},
435     { 0x55, "Read, Deny Read, Compatibility, File Write Through"},
436     { 0x56, "Write, Deny Read, Compatibility, File Write Through"},
437     { 0x57, "Read, Write, Deny Read, Compatibility, File Write Through"},
438     { 0x58, "Deny Write, Compatibility, File Write Through"},
439     { 0x59, "Read, Deny Write, Compatibility, File Write Through"},
440     { 0x5a, "Write, Deny Write, Compatibility, File Write Through"},
441     { 0x5b, "Read, Write, Deny Write, Compatibility, File Write Through"},
442     { 0x5c, "Deny Read, Deny Write, Compatibility, File Write Through"},
443     { 0x5d, "Read, Deny Read, Deny Write, Compatibility, File Write Through"},
444     { 0x5e, "Write, Deny Read, Deny Write, Compatibility, File Write Through"},
445     { 0x5f, "Read, Write, Deny Read, Deny Write, Compatibility, File Write Through"},
446     { 0,    NULL }
449 static const value_string open_create_mode_vals[] = {
450     { 0x01, "Open"},
451     { 0x02, "Replace"},
452     { 0x03, "Open, Replace"},
453     { 0x08, "Create"},
454     { 0x09, "Open, Create"},
455     { 0x0a, "Replace, Create"},
456     { 0x0b, "Open, Replace, Create"},
457     { 0x20, "64-bit"},
458     { 0x21, "Open, 64-bit"},
459     { 0x22, "Replace, 64-bit"},
460     { 0x23, "Open, Replace, 64-bit"},
461     { 0x28, "Create, 64-bit"},
462     { 0x29, "Open, Create, 64-bit"},
463     { 0x2a, "Replace, Create, 64-bit"},
464     { 0x2b, "Open, Replace, Create, 64-bit"},
465     { 0x40, "Read Only"},
466     { 0x41, "Open, Read Only"},
467     { 0x42, "Replace, Read Only"},
468     { 0x43, "Open, Replace, Read Only"},
469     { 0x48, "Create, Read Only"},
470     { 0x49, "Open, Create, Read Only"},
471     { 0x4a, "Replace, Create, Read Only"},
472     { 0x4b, "Open, Replace, Create, Read Only"},
473     { 0x60, "64-bit, Read Only"},
474     { 0x61, "Open, 64-bit, Read Only"},
475     { 0x62, "Replace, 64-bit, Read Only"},
476     { 0x63, "Open, Replace, 64-bit, Read Only"},
477     { 0x68, "Create, 64-bit, Read Only"},
478     { 0x69, "Open, Create, 64-bit, Read Only"},
479     { 0x6a, "Replace, Create, 64-bit, Read Only"},
480     { 0x6b, "Open, Replace, Create, 64-bit, Read Only"},
481     { 0x80, "Op-Lock"},
482     { 0x81, "Open, Op-Lock"},
483     { 0x82, "Replace, Op-Lock"},
484     { 0x83, "Open, Replace, Op-Lock"},
485     { 0x88, "Create, Op-Lock"},
486     { 0x89, "Open, Create, Op-Lock"},
487     { 0x8a, "Replace, Create, Op-Lock"},
488     { 0x8b, "Open, Replace, Create, Op-Lock"},
489     { 0xa0, "64-bit, Op-Lock"},
490     { 0xa1, "Open, 64-bit, Op-Lock"},
491     { 0xa2, "Replace, 64-bit, Op-Lock"},
492     { 0xa3, "Open, Replace, 64-bit, Op-Lock"},
493     { 0xa8, "Create, 64-bit, Op-Lock"},
494     { 0xa9, "Open, Create, 64-bit, Op-Lock"},
495     { 0xaa, "Replace, Create, 64-bit, Op-Lock"},
496     { 0xab, "Open, Replace, Create, 64-bit, Op-Lock"},
497     { 0xc0, "Read Only, Op-Lock"},
498     { 0xc1, "Open, Read Only, Op-Lock"},
499     { 0xc2, "Replace, Read Only, Op-Lock"},
500     { 0xc3, "Open, Replace, Read Only, Op-Lock"},
501     { 0xc8, "Create, Read Only, Op-Lock"},
502     { 0xc9, "Open, Create, Read Only, Op-Lock"},
503     { 0xca, "Replace, Create, Read Only, Op-Lock"},
504     { 0xcb, "Open, Replace, Create, Read Only, Op-Lock"},
505     { 0xe0, "64-bit, Read Only, Op-Lock"},
506     { 0xe1, "Open, 64-bit, Read Only, Op-Lock"},
507     { 0xe2, "Replace, 64-bit, Read Only, Op-Lock"},
508     { 0xe3, "Open, Replace, 64-bit, Read Only, Op-Lock"},
509     { 0xe8, "Create, 64-bit, Read Only, Op-Lock"},
510     { 0xe9, "Open, Create, 64-bit, Read Only, Op-Lock"},
511     { 0xea, "Replace, Create, 64-bit, Read Only, Op-Lock"},
512     { 0xeb, "Open, Replace, Create, 64-bit, Read Only, Op-Lock"},
513     { 0,    NULL }
516 static const value_string open_create_action_vals[] = {
517     { 0x01, "Opened"},
518     { 0x02, "Created"},
519     { 0x03, "Opened, Created"},
520     { 0x04, "Replaced"},
521     { 0x05, "Opened, Replaced"},
522     { 0x06, "Created, Replaced"},
523     { 0x07, "Opened, Created, Replaced"},
524     { 0x08, "Compressed"},
525     { 0x09, "Opened, Compressed"},
526     { 0x0a, "Created, Compressed"},
527     { 0x0b, "Opened, Created, Compressed"},
528     { 0x0c, "Replaced, Compressed"},
529     { 0x0d, "Opened, Replaced, Compressed"},
530     { 0x0e, "Created, Replaced, Compressed"},
531     { 0x0f, "Opened, Created, Replaced, Compressed"},
532     { 0x80, "Read Only"},
533     { 0x81, "Opened, Read Only"},
534     { 0x82, "Created, Read Only"},
535     { 0x83, "Opened, Created, Read Only"},
536     { 0x84, "Replaced, Read Only"},
537     { 0x85, "Opened, Replaced, Read Only"},
538     { 0x86, "Created, Replaced, Read Only"},
539     { 0x87, "Opened, Created, Replaced, Read Only"},
540     { 0x88, "Compressed, Read Only"},
541     { 0x89, "Opened, Compressed, Read Only"},
542     { 0x8a, "Created, Compressed, Read Only"},
543     { 0x8b, "Opened, Created, Compressed, Read Only"},
544     { 0x8c, "Replaced, Compressed, Read Only"},
545     { 0x8d, "Opened, Replaced, Compressed, Read Only"},
546     { 0x8e, "Created, Replaced, Compressed, Read Only"},
547     { 0x8f, "Opened, Created, Replaced, Compressed, Read Only"},
548     { 0,    NULL }
551 static const value_string access_rights_vals[] = {
552     { 0x0000, "No Rights"},
553     { 0x0001, "Read"},
554     { 0x0002, "Write"},
555     { 0x0003, "Read, Write"},
556     { 0x0004, "Open"},
557     { 0x0005, "Read, Open"},
558     { 0x0006, "Write, Open"},
559     { 0x0007, "Read, Write, Open"},
560     { 0x0008, "Create"},
561     { 0x0009, "Read, Create"},
562     { 0x000a, "Write, Create"},
563     { 0x000b, "Read, Write, Create"},
564     { 0x000c, "Open, Create"},
565     { 0x000d, "Read, Open, Create"},
566     { 0x000e, "Write, Open, Create"},
567     { 0x000f, "Read, Write, Open, Create"},
568     { 0x0010, "Delete"},
569     { 0x0011, "Read, Delete"},
570     { 0x0012, "Write, Delete"},
571     { 0x0013, "Read, Write, Delete"},
572     { 0x0014, "Open, Delete"},
573     { 0x0015, "Read, Open, Delete"},
574     { 0x0016, "Write, Open, Delete"},
575     { 0x0017, "Read, Write, Open, Delete"},
576     { 0x0018, "Create, Delete"},
577     { 0x0019, "Read, Create, Delete"},
578     { 0x001a, "Write, Create, Delete"},
579     { 0x001b, "Read, Write, Create, Delete"},
580     { 0x001c, "Open, Create, Delete"},
581     { 0x001d, "Read, Open, Create, Delete"},
582     { 0x001e, "Write, Open, Create, Delete"},
583     { 0x001f, "Read, Write, Open, Create, Delete"},
584     { 0x0020, "Parental"},
585     { 0x0021, "Read, Parental"},
586     { 0x0022, "Write, Parental"},
587     { 0x0023, "Read, Write, Parental"},
588     { 0x0024, "Open, Parental"},
589     { 0x0025, "Read, Open, Parental"},
590     { 0x0026, "Write, Open, Parental"},
591     { 0x0027, "Read, Write, Open, Parental"},
592     { 0x0028, "Create, Parental"},
593     { 0x0029, "Read, Create, Parental"},
594     { 0x002a, "Write, Create, Parental"},
595     { 0x002b, "Read, Write, Create, Parental"},
596     { 0x002c, "Open, Create, Parental"},
597     { 0x002d, "Read, Open, Create, Parental"},
598     { 0x002e, "Write, Open, Create, Parental"},
599     { 0x002f, "Read, Write, Open, Create, Parental"},
600     { 0x0030, "Delete, Parental"},
601     { 0x0031, "Read, Delete, Parental"},
602     { 0x0032, "Write, Delete, Parental"},
603     { 0x0033, "Read, Write, Delete, Parental"},
604     { 0x0034, "Open, Delete, Parental"},
605     { 0x0035, "Read, Open, Delete, Parental"},
606     { 0x0036, "Write, Open, Delete, Parental"},
607     { 0x0037, "Read, Write, Open, Delete, Parental"},
608     { 0x0038, "Create, Delete, Parental"},
609     { 0x0039, "Read, Create, Delete, Parental"},
610     { 0x003a, "Write, Create, Delete, Parental"},
611     { 0x003b, "Read, Write, Create, Delete, Parental"},
612     { 0x003c, "Open, Create, Delete, Parental"},
613     { 0x003d, "Read, Open, Create, Delete, Parental"},
614     { 0x003e, "Write, Open, Create, Delete, Parental"},
615     { 0x003f, "Read, Write, Open, Create, Delete, Parental"},
616     { 0x0040, "Search"},
617     { 0x0041, "Read, Search"},
618     { 0x0042, "Write, Search"},
619     { 0x0043, "Read, Write, Search"},
620     { 0x0044, "Open, Search"},
621     { 0x0045, "Read, Open, Search"},
622     { 0x0046, "Write, Open, Search"},
623     { 0x0047, "Read, Write, Open, Search"},
624     { 0x0048, "Create, Search"},
625     { 0x0049, "Read, Create, Search"},
626     { 0x004a, "Write, Create, Search"},
627     { 0x004b, "Read, Write, Create, Search"},
628     { 0x004c, "Open, Create, Search"},
629     { 0x004d, "Read, Open, Create, Search"},
630     { 0x004e, "Write, Open, Create, Search"},
631     { 0x004f, "Read, Write, Open, Create, Search"},
632     { 0x0050, "Delete, Search"},
633     { 0x0051, "Read, Delete, Search"},
634     { 0x0052, "Write, Delete, Search"},
635     { 0x0053, "Read, Write, Delete, Search"},
636     { 0x0054, "Open, Delete, Search"},
637     { 0x0055, "Read, Open, Delete, Search"},
638     { 0x0056, "Write, Open, Delete, Search"},
639     { 0x0057, "Read, Write, Open, Delete, Search"},
640     { 0x0058, "Create, Delete, Search"},
641     { 0x0059, "Read, Create, Delete, Search"},
642     { 0x005a, "Write, Create, Delete, Search"},
643     { 0x005b, "Read, Write, Create, Delete, Search"},
644     { 0x005c, "Open, Create, Delete, Search"},
645     { 0x005d, "Read, Open, Create, Delete, Search"},
646     { 0x005e, "Write, Open, Create, Delete, Search"},
647     { 0x005f, "Read, Write, Open, Create, Delete, Search"},
648     { 0x0060, "Parental, Search"},
649     { 0x0061, "Read, Parental, Search"},
650     { 0x0062, "Write, Parental, Search"},
651     { 0x0063, "Read, Write, Parental, Search"},
652     { 0x0064, "Open, Parental, Search"},
653     { 0x0065, "Read, Open, Parental, Search"},
654     { 0x0066, "Write, Open, Parental, Search"},
655     { 0x0067, "Read, Write, Open, Parental, Search"},
656     { 0x0068, "Create, Parental, Search"},
657     { 0x0069, "Read, Create, Parental, Search"},
658     { 0x006a, "Write, Create, Parental, Search"},
659     { 0x006b, "Read, Write, Create, Parental, Search"},
660     { 0x006c, "Open, Create, Parental, Search"},
661     { 0x006d, "Read, Open, Create, Parental, Search"},
662     { 0x006e, "Write, Open, Create, Parental, Search"},
663     { 0x006f, "Read, Write, Open, Create, Parental, Search"},
664     { 0x0070, "Delete, Parental, Search"},
665     { 0x0071, "Read, Delete, Parental, Search"},
666     { 0x0072, "Write, Delete, Parental, Search"},
667     { 0x0073, "Read, Write, Delete, Parental, Search"},
668     { 0x0074, "Open, Delete, Parental, Search"},
669     { 0x0075, "Read, Open, Delete, Parental, Search"},
670     { 0x0076, "Write, Open, Delete, Parental, Search"},
671     { 0x0077, "Read, Write, Open, Delete, Parental, Search"},
672     { 0x0078, "Create, Delete, Parental, Search"},
673     { 0x0079, "Read, Create, Delete, Parental, Search"},
674     { 0x007a, "Write, Create, Delete, Parental, Search"},
675     { 0x007b, "Read, Write, Create, Delete, Parental, Search"},
676     { 0x007c, "Open, Create, Delete, Parental, Search"},
677     { 0x007d, "Read, Open, Create, Delete, Parental, Search"},
678     { 0x007e, "Write, Open, Create, Delete, Parental, Search"},
679     { 0x007f, "Read, Write, Open, Create, Delete, Parental, Search"},
680     { 0x0080, "Modify"},
681     { 0x0081, "Read, Modify"},
682     { 0x0082, "Write, Modify"},
683     { 0x0083, "Read, Write, Modify"},
684     { 0x0084, "Open, Modify"},
685     { 0x0085, "Read, Open, Modify"},
686     { 0x0086, "Write, Open, Modify"},
687     { 0x0087, "Read, Write, Open, Modify"},
688     { 0x0088, "Create, Modify"},
689     { 0x0089, "Read, Create, Modify"},
690     { 0x008a, "Write, Create, Modify"},
691     { 0x008b, "Read, Write, Create, Modify"},
692     { 0x008c, "Open, Create, Modify"},
693     { 0x008d, "Read, Open, Create, Modify"},
694     { 0x008e, "Write, Open, Create, Modify"},
695     { 0x008f, "Read, Write, Open, Create, Modify"},
696     { 0x0090, "Delete, Modify"},
697     { 0x0091, "Read, Delete, Modify"},
698     { 0x0092, "Write, Delete, Modify"},
699     { 0x0093, "Read, Write, Delete, Modify"},
700     { 0x0094, "Open, Delete, Modify"},
701     { 0x0095, "Read, Open, Delete, Modify"},
702     { 0x0096, "Write, Open, Delete, Modify"},
703     { 0x0097, "Read, Write, Open, Delete, Modify"},
704     { 0x0098, "Create, Delete, Modify"},
705     { 0x0099, "Read, Create, Delete, Modify"},
706     { 0x009a, "Write, Create, Delete, Modify"},
707     { 0x009b, "Read, Write, Create, Delete, Modify"},
708     { 0x009c, "Open, Create, Delete, Modify"},
709     { 0x009d, "Read, Open, Create, Delete, Modify"},
710     { 0x009e, "Write, Open, Create, Delete, Modify"},
711     { 0x009f, "Read, Write, Open, Create, Delete, Modify"},
712     { 0x00a0, "Parental, Modify"},
713     { 0x00a1, "Read, Parental, Modify"},
714     { 0x00a2, "Write, Parental, Modify"},
715     { 0x00a3, "Read, Write, Parental, Modify"},
716     { 0x00a4, "Open, Parental, Modify"},
717     { 0x00a5, "Read, Open, Parental, Modify"},
718     { 0x00a6, "Write, Open, Parental, Modify"},
719     { 0x00a7, "Read, Write, Open, Parental, Modify"},
720     { 0x00a8, "Create, Parental, Modify"},
721     { 0x00a9, "Read, Create, Parental, Modify"},
722     { 0x00aa, "Write, Create, Parental, Modify"},
723     { 0x00ab, "Read, Write, Create, Parental, Modify"},
724     { 0x00ac, "Open, Create, Parental, Modify"},
725     { 0x00ad, "Read, Open, Create, Parental, Modify"},
726     { 0x00ae, "Write, Open, Create, Parental, Modify"},
727     { 0x00af, "Read, Write, Open, Create, Parental, Modify"},
728     { 0x00b0, "Delete, Parental, Modify"},
729     { 0x00b1, "Read, Delete, Parental, Modify"},
730     { 0x00b2, "Write, Delete, Parental, Modify"},
731     { 0x00b3, "Read, Write, Delete, Parental, Modify"},
732     { 0x00b4, "Open, Delete, Parental, Modify"},
733     { 0x00b5, "Read, Open, Delete, Parental, Modify"},
734     { 0x00b6, "Write, Open, Delete, Parental, Modify"},
735     { 0x00b7, "Read, Write, Open, Delete, Parental, Modify"},
736     { 0x00b8, "Create, Delete, Parental, Modify"},
737     { 0x00b9, "Read, Create, Delete, Parental, Modify"},
738     { 0x00ba, "Write, Create, Delete, Parental, Modify"},
739     { 0x00bb, "Read, Write, Create, Delete, Parental, Modify"},
740     { 0x00bc, "Open, Create, Delete, Parental, Modify"},
741     { 0x00bd, "Read, Open, Create, Delete, Parental, Modify"},
742     { 0x00be, "Write, Open, Create, Delete, Parental, Modify"},
743     { 0x00bf, "Read, Write, Open, Create, Delete, Parental, Modify"},
744     { 0x00c0, "Search, Modify"},
745     { 0x00c1, "Read, Search, Modify"},
746     { 0x00c2, "Write, Search, Modify"},
747     { 0x00c3, "Read, Write, Search, Modify"},
748     { 0x00c4, "Open, Search, Modify"},
749     { 0x00c5, "Read, Open, Search, Modify"},
750     { 0x00c6, "Write, Open, Search, Modify"},
751     { 0x00c7, "Read, Write, Open, Search, Modify"},
752     { 0x00c8, "Create, Search, Modify"},
753     { 0x00c9, "Read, Create, Search, Modify"},
754     { 0x00ca, "Write, Create, Search, Modify"},
755     { 0x00cb, "Read, Write, Create, Search, Modify"},
756     { 0x00cc, "Open, Create, Search, Modify"},
757     { 0x00cd, "Read, Open, Create, Search, Modify"},
758     { 0x00ce, "Write, Open, Create, Search, Modify"},
759     { 0x00cf, "Read, Write, Open, Create, Search, Modify"},
760     { 0x00d0, "Delete, Search, Modify"},
761     { 0x00d1, "Read, Delete, Search, Modify"},
762     { 0x00d2, "Write, Delete, Search, Modify"},
763     { 0x00d3, "Read, Write, Delete, Search, Modify"},
764     { 0x00d4, "Open, Delete, Search, Modify"},
765     { 0x00d5, "Read, Open, Delete, Search, Modify"},
766     { 0x00d6, "Write, Open, Delete, Search, Modify"},
767     { 0x00d7, "Read, Write, Open, Delete, Search, Modify"},
768     { 0x00d8, "Create, Delete, Search, Modify"},
769     { 0x00d9, "Read, Create, Delete, Search, Modify"},
770     { 0x00da, "Write, Create, Delete, Search, Modify"},
771     { 0x00db, "Read, Write, Create, Delete, Search, Modify"},
772     { 0x00dc, "Open, Create, Delete, Search, Modify"},
773     { 0x00dd, "Read, Open, Create, Delete, Search, Modify"},
774     { 0x00de, "Write, Open, Create, Delete, Search, Modify"},
775     { 0x00df, "Read, Write, Open, Create, Delete, Search, Modify"},
776     { 0x00e0, "Parental, Search, Modify"},
777     { 0x00e1, "Read, Parental, Search, Modify"},
778     { 0x00e2, "Write, Parental, Search, Modify"},
779     { 0x00e3, "Read, Write, Parental, Search, Modify"},
780     { 0x00e4, "Open, Parental, Search, Modify"},
781     { 0x00e5, "Read, Open, Parental, Search, Modify"},
782     { 0x00e6, "Write, Open, Parental, Search, Modify"},
783     { 0x00e7, "Read, Write, Open, Parental, Search, Modify"},
784     { 0x00e8, "Create, Parental, Search, Modify"},
785     { 0x00e9, "Read, Create, Parental, Search, Modify"},
786     { 0x00ea, "Write, Create, Parental, Search, Modify"},
787     { 0x00eb, "Read, Write, Create, Parental, Search, Modify"},
788     { 0x00ec, "Open, Create, Parental, Search, Modify"},
789     { 0x00ed, "Read, Open, Create, Parental, Search, Modify"},
790     { 0x00ee, "Write, Open, Create, Parental, Search, Modify"},
791     { 0x00ef, "Read, Write, Open, Create, Parental, Search, Modify"},
792     { 0x00f0, "Delete, Parental, Search, Modify"},
793     { 0x00f1, "Read, Delete, Parental, Search, Modify"},
794     { 0x00f2, "Write, Delete, Parental, Search, Modify"},
795     { 0x00f3, "Read, Write, Delete, Parental, Search, Modify"},
796     { 0x00f4, "Open, Delete, Parental, Search, Modify"},
797     { 0x00f5, "Read, Open, Delete, Parental, Search, Modify"},
798     { 0x00f6, "Write, Open, Delete, Parental, Search, Modify"},
799     { 0x00f7, "Read, Write, Open, Delete, Parental, Search, Modify"},
800     { 0x00f8, "Create, Delete, Parental, Search, Modify"},
801     { 0x00f9, "Read, Create, Delete, Parental, Search, Modify"},
802     { 0x00fa, "Write, Create, Delete, Parental, Search, Modify"},
803     { 0x00fb, "Read, Write, Create, Delete, Parental, Search, Modify"},
804     { 0x00fc, "Open, Create, Delete, Parental, Search, Modify"},
805     { 0x00fd, "Read, Open, Create, Delete, Parental, Search, Modify"},
806     { 0x00fe, "Write, Open, Create, Delete, Parental, Search, Modify"},
807     { 0x00ff, "Read, Write, Open, Create, Delete, Parental, Search, Modify"},
808     { 0x0100, "Supervisor"},
809     { 0x0101, "Read, Supervisor"},
810     { 0x0102, "Write, Supervisor"},
811     { 0x0103, "Read, Write, Supervisor"},
812     { 0x0104, "Open, Supervisor"},
813     { 0x0105, "Read, Open, Supervisor"},
814     { 0x0106, "Write, Open, Supervisor"},
815     { 0x0107, "Read, Write, Open, Supervisor"},
816     { 0x0108, "Create, Supervisor"},
817     { 0x0109, "Read, Create, Supervisor"},
818     { 0x010a, "Write, Create, Supervisor"},
819     { 0x010b, "Read, Write, Create, Supervisor"},
820     { 0x010c, "Open, Create, Supervisor"},
821     { 0x010d, "Read, Open, Create, Supervisor"},
822     { 0x010e, "Write, Open, Create, Supervisor"},
823     { 0x010f, "Read, Write, Open, Create, Supervisor"},
824     { 0x0110, "Delete, Supervisor"},
825     { 0x0111, "Read, Delete, Supervisor"},
826     { 0x0112, "Write, Delete, Supervisor"},
827     { 0x0113, "Read, Write, Delete, Supervisor"},
828     { 0x0114, "Open, Delete, Supervisor"},
829     { 0x0115, "Read, Open, Delete, Supervisor"},
830     { 0x0116, "Write, Open, Delete, Supervisor"},
831     { 0x0117, "Read, Write, Open, Delete, Supervisor"},
832     { 0x0118, "Create, Delete, Supervisor"},
833     { 0x0119, "Read, Create, Delete, Supervisor"},
834     { 0x011a, "Write, Create, Delete, Supervisor"},
835     { 0x011b, "Read, Write, Create, Delete, Supervisor"},
836     { 0x011c, "Open, Create, Delete, Supervisor"},
837     { 0x011d, "Read, Open, Create, Delete, Supervisor"},
838     { 0x011e, "Write, Open, Create, Delete, Supervisor"},
839     { 0x011f, "Read, Write, Open, Create, Delete, Supervisor"},
840     { 0x0120, "Parental, Supervisor"},
841     { 0x0121, "Read, Parental, Supervisor"},
842     { 0x0122, "Write, Parental, Supervisor"},
843     { 0x0123, "Read, Write, Parental, Supervisor"},
844     { 0x0124, "Open, Parental, Supervisor"},
845     { 0x0125, "Read, Open, Parental, Supervisor"},
846     { 0x0126, "Write, Open, Parental, Supervisor"},
847     { 0x0127, "Read, Write, Open, Parental, Supervisor"},
848     { 0x0128, "Create, Parental, Supervisor"},
849     { 0x0129, "Read, Create, Parental, Supervisor"},
850     { 0x012a, "Write, Create, Parental, Supervisor"},
851     { 0x012b, "Read, Write, Create, Parental, Supervisor"},
852     { 0x012c, "Open, Create, Parental, Supervisor"},
853     { 0x012d, "Read, Open, Create, Parental, Supervisor"},
854     { 0x012e, "Write, Open, Create, Parental, Supervisor"},
855     { 0x012f, "Read, Write, Open, Create, Parental, Supervisor"},
856     { 0x0130, "Delete, Parental, Supervisor"},
857     { 0x0131, "Read, Delete, Parental, Supervisor"},
858     { 0x0132, "Write, Delete, Parental, Supervisor"},
859     { 0x0133, "Read, Write, Delete, Parental, Supervisor"},
860     { 0x0134, "Open, Delete, Parental, Supervisor"},
861     { 0x0135, "Read, Open, Delete, Parental, Supervisor"},
862     { 0x0136, "Write, Open, Delete, Parental, Supervisor"},
863     { 0x0137, "Read, Write, Open, Delete, Parental, Supervisor"},
864     { 0x0138, "Create, Delete, Parental, Supervisor"},
865     { 0x0139, "Read, Create, Delete, Parental, Supervisor"},
866     { 0x013a, "Write, Create, Delete, Parental, Supervisor"},
867     { 0x013b, "Read, Write, Create, Delete, Parental, Supervisor"},
868     { 0x013c, "Open, Create, Delete, Parental, Supervisor"},
869     { 0x013d, "Read, Open, Create, Delete, Parental, Supervisor"},
870     { 0x013e, "Write, Open, Create, Delete, Parental, Supervisor"},
871     { 0x013f, "Read, Write, Open, Create, Delete, Parental, Supervisor"},
872     { 0x0140, "Search, Supervisor"},
873     { 0x0141, "Read, Search, Supervisor"},
874     { 0x0142, "Write, Search, Supervisor"},
875     { 0x0143, "Read, Write, Search, Supervisor"},
876     { 0x0144, "Open, Search, Supervisor"},
877     { 0x0145, "Read, Open, Search, Supervisor"},
878     { 0x0146, "Write, Open, Search, Supervisor"},
879     { 0x0147, "Read, Write, Open, Search, Supervisor"},
880     { 0x0148, "Create, Search, Supervisor"},
881     { 0x0149, "Read, Create, Search, Supervisor"},
882     { 0x014a, "Write, Create, Search, Supervisor"},
883     { 0x014b, "Read, Write, Create, Search, Supervisor"},
884     { 0x014c, "Open, Create, Search, Supervisor"},
885     { 0x014d, "Read, Open, Create, Search, Supervisor"},
886     { 0x014e, "Write, Open, Create, Search, Supervisor"},
887     { 0x014f, "Read, Write, Open, Create, Search, Supervisor"},
888     { 0x0150, "Delete, Search, Supervisor"},
889     { 0x0151, "Read, Delete, Search, Supervisor"},
890     { 0x0152, "Write, Delete, Search, Supervisor"},
891     { 0x0153, "Read, Write, Delete, Search, Supervisor"},
892     { 0x0154, "Open, Delete, Search, Supervisor"},
893     { 0x0155, "Read, Open, Delete, Search, Supervisor"},
894     { 0x0156, "Write, Open, Delete, Search, Supervisor"},
895     { 0x0157, "Read, Write, Open, Delete, Search, Supervisor"},
896     { 0x0158, "Create, Delete, Search, Supervisor"},
897     { 0x0159, "Read, Create, Delete, Search, Supervisor"},
898     { 0x015a, "Write, Create, Delete, Search, Supervisor"},
899     { 0x015b, "Read, Write, Create, Delete, Search, Supervisor"},
900     { 0x015c, "Open, Create, Delete, Search, Supervisor"},
901     { 0x015d, "Read, Open, Create, Delete, Search, Supervisor"},
902     { 0x015e, "Write, Open, Create, Delete, Search, Supervisor"},
903     { 0x015f, "Read, Write, Open, Create, Delete, Search, Supervisor"},
904     { 0x0160, "Parental, Search, Supervisor"},
905     { 0x0161, "Read, Parental, Search, Supervisor"},
906     { 0x0162, "Write, Parental, Search, Supervisor"},
907     { 0x0163, "Read, Write, Parental, Search, Supervisor"},
908     { 0x0164, "Open, Parental, Search, Supervisor"},
909     { 0x0165, "Read, Open, Parental, Search, Supervisor"},
910     { 0x0166, "Write, Open, Parental, Search, Supervisor"},
911     { 0x0167, "Read, Write, Open, Parental, Search, Supervisor"},
912     { 0x0168, "Create, Parental, Search, Supervisor"},
913     { 0x0169, "Read, Create, Parental, Search, Supervisor"},
914     { 0x016a, "Write, Create, Parental, Search, Supervisor"},
915     { 0x016b, "Read, Write, Create, Parental, Search, Supervisor"},
916     { 0x016c, "Open, Create, Parental, Search, Supervisor"},
917     { 0x016d, "Read, Open, Create, Parental, Search, Supervisor"},
918     { 0x016e, "Write, Open, Create, Parental, Search, Supervisor"},
919     { 0x016f, "Read, Write, Open, Create, Parental, Search, Supervisor"},
920     { 0x0170, "Delete, Parental, Search, Supervisor"},
921     { 0x0171, "Read, Delete, Parental, Search, Supervisor"},
922     { 0x0172, "Write, Delete, Parental, Search, Supervisor"},
923     { 0x0173, "Read, Write, Delete, Parental, Search, Supervisor"},
924     { 0x0174, "Open, Delete, Parental, Search, Supervisor"},
925     { 0x0175, "Read, Open, Delete, Parental, Search, Supervisor"},
926     { 0x0176, "Write, Open, Delete, Parental, Search, Supervisor"},
927     { 0x0177, "Read, Write, Open, Delete, Parental, Search, Supervisor"},
928     { 0x0178, "Create, Delete, Parental, Search, Supervisor"},
929     { 0x0179, "Read, Create, Delete, Parental, Search, Supervisor"},
930     { 0x017a, "Write, Create, Delete, Parental, Search, Supervisor"},
931     { 0x017b, "Read, Write, Create, Delete, Parental, Search, Supervisor"},
932     { 0x017c, "Open, Create, Delete, Parental, Search, Supervisor"},
933     { 0x017d, "Read, Open, Create, Delete, Parental, Search, Supervisor"},
934     { 0x017e, "Write, Open, Create, Delete, Parental, Search, Supervisor"},
935     { 0x017f, "Read, Write, Open, Create, Delete, Parental, Search, Supervisor"},
936     { 0x0180, "Modify, Supervisor"},
937     { 0x0181, "Read, Modify, Supervisor"},
938     { 0x0182, "Write, Modify, Supervisor"},
939     { 0x0183, "Read, Write, Modify, Supervisor"},
940     { 0x0184, "Open, Modify, Supervisor"},
941     { 0x0185, "Read, Open, Modify, Supervisor"},
942     { 0x0186, "Write, Open, Modify, Supervisor"},
943     { 0x0187, "Read, Write, Open, Modify, Supervisor"},
944     { 0x0188, "Create, Modify, Supervisor"},
945     { 0x0189, "Read, Create, Modify, Supervisor"},
946     { 0x018a, "Write, Create, Modify, Supervisor"},
947     { 0x018b, "Read, Write, Create, Modify, Supervisor"},
948     { 0x018c, "Open, Create, Modify, Supervisor"},
949     { 0x018d, "Read, Open, Create, Modify, Supervisor"},
950     { 0x018e, "Write, Open, Create, Modify, Supervisor"},
951     { 0x018f, "Read, Write, Open, Create, Modify, Supervisor"},
952     { 0x0190, "Delete, Modify, Supervisor"},
953     { 0x0191, "Read, Delete, Modify, Supervisor"},
954     { 0x0192, "Write, Delete, Modify, Supervisor"},
955     { 0x0193, "Read, Write, Delete, Modify, Supervisor"},
956     { 0x0194, "Open, Delete, Modify, Supervisor"},
957     { 0x0195, "Read, Open, Delete, Modify, Supervisor"},
958     { 0x0196, "Write, Open, Delete, Modify, Supervisor"},
959     { 0x0197, "Read, Write, Open, Delete, Modify, Supervisor"},
960     { 0x0198, "Create, Delete, Modify, Supervisor"},
961     { 0x0199, "Read, Create, Delete, Modify, Supervisor"},
962     { 0x019a, "Write, Create, Delete, Modify, Supervisor"},
963     { 0x019b, "Read, Write, Create, Delete, Modify, Supervisor"},
964     { 0x019c, "Open, Create, Delete, Modify, Supervisor"},
965     { 0x019d, "Read, Open, Create, Delete, Modify, Supervisor"},
966     { 0x019e, "Write, Open, Create, Delete, Modify, Supervisor"},
967     { 0x019f, "Read, Write, Open, Create, Delete, Modify, Supervisor"},
968     { 0x01a0, "Parental, Modify, Supervisor"},
969     { 0x01a1, "Read, Parental, Modify, Supervisor"},
970     { 0x01a2, "Write, Parental, Modify, Supervisor"},
971     { 0x01a3, "Read, Write, Parental, Modify, Supervisor"},
972     { 0x01a4, "Open, Parental, Modify, Supervisor"},
973     { 0x01a5, "Read, Open, Parental, Modify, Supervisor"},
974     { 0x01a6, "Write, Open, Parental, Modify, Supervisor"},
975     { 0x01a7, "Read, Write, Open, Parental, Modify, Supervisor"},
976     { 0x01a8, "Create, Parental, Modify, Supervisor"},
977     { 0x01a9, "Read, Create, Parental, Modify, Supervisor"},
978     { 0x01aa, "Write, Create, Parental, Modify, Supervisor"},
979     { 0x01ab, "Read, Write, Create, Parental, Modify, Supervisor"},
980     { 0x01ac, "Open, Create, Parental, Modify, Supervisor"},
981     { 0x01ad, "Read, Open, Create, Parental, Modify, Supervisor"},
982     { 0x01ae, "Write, Open, Create, Parental, Modify, Supervisor"},
983     { 0x01af, "Read, Write, Open, Create, Parental, Modify, Supervisor"},
984     { 0x01b0, "Delete, Parental, Modify, Supervisor"},
985     { 0x01b1, "Read, Delete, Parental, Modify, Supervisor"},
986     { 0x01b2, "Write, Delete, Parental, Modify, Supervisor"},
987     { 0x01b3, "Read, Write, Delete, Parental, Modify, Supervisor"},
988     { 0x01b4, "Open, Delete, Parental, Modify, Supervisor"},
989     { 0x01b5, "Read, Open, Delete, Parental, Modify, Supervisor"},
990     { 0x01b6, "Write, Open, Delete, Parental, Modify, Supervisor"},
991     { 0x01b7, "Read, Write, Open, Delete, Parental, Modify, Supervisor"},
992     { 0x01b8, "Create, Delete, Parental, Modify, Supervisor"},
993     { 0x01b9, "Read, Create, Delete, Parental, Modify, Supervisor"},
994     { 0x01ba, "Write, Create, Delete, Parental, Modify, Supervisor"},
995     { 0x01bb, "Read, Write, Create, Delete, Parental, Modify, Supervisor"},
996     { 0x01bc, "Open, Create, Delete, Parental, Modify, Supervisor"},
997     { 0x01bd, "Read, Open, Create, Delete, Parental, Modify, Supervisor"},
998     { 0x01be, "Write, Open, Create, Delete, Parental, Modify, Supervisor"},
999     { 0x01bf, "Read, Write, Open, Create, Delete, Parental, Modify, Supervisor"},
1000     { 0x01c0, "Search, Modify, Supervisor"},
1001     { 0x01c1, "Read, Search, Modify, Supervisor"},
1002     { 0x01c2, "Write, Search, Modify, Supervisor"},
1003     { 0x01c3, "Read, Write, Search, Modify, Supervisor"},
1004     { 0x01c4, "Open, Search, Modify, Supervisor"},
1005     { 0x01c5, "Read, Open, Search, Modify, Supervisor"},
1006     { 0x01c6, "Write, Open, Search, Modify, Supervisor"},
1007     { 0x01c7, "Read, Write, Open, Search, Modify, Supervisor"},
1008     { 0x01c8, "Create, Search, Modify, Supervisor"},
1009     { 0x01c9, "Read, Create, Search, Modify, Supervisor"},
1010     { 0x01ca, "Write, Create, Search, Modify, Supervisor"},
1011     { 0x01cb, "Read, Write, Create, Search, Modify, Supervisor"},
1012     { 0x01cc, "Open, Create, Search, Modify, Supervisor"},
1013     { 0x01cd, "Read, Open, Create, Search, Modify, Supervisor"},
1014     { 0x01ce, "Write, Open, Create, Search, Modify, Supervisor"},
1015     { 0x01cf, "Read, Write, Open, Create, Search, Modify, Supervisor"},
1016     { 0x01d0, "Delete, Search, Modify, Supervisor"},
1017     { 0x01d1, "Read, Delete, Search, Modify, Supervisor"},
1018     { 0x01d2, "Write, Delete, Search, Modify, Supervisor"},
1019     { 0x01d3, "Read, Write, Delete, Search, Modify, Supervisor"},
1020     { 0x01d4, "Open, Delete, Search, Modify, Supervisor"},
1021     { 0x01d5, "Read, Open, Delete, Search, Modify, Supervisor"},
1022     { 0x01d6, "Write, Open, Delete, Search, Modify, Supervisor"},
1023     { 0x01d7, "Read, Write, Open, Delete, Search, Modify, Supervisor"},
1024     { 0x01d8, "Create, Delete, Search, Modify, Supervisor"},
1025     { 0x01d9, "Read, Create, Delete, Search, Modify, Supervisor"},
1026     { 0x01da, "Write, Create, Delete, Search, Modify, Supervisor"},
1027     { 0x01db, "Read, Write, Create, Delete, Search, Modify, Supervisor"},
1028     { 0x01dc, "Open, Create, Delete, Search, Modify, Supervisor"},
1029     { 0x01dd, "Read, Open, Create, Delete, Search, Modify, Supervisor"},
1030     { 0x01de, "Write, Open, Create, Delete, Search, Modify, Supervisor"},
1031     { 0x01df, "Read, Write, Open, Create, Delete, Search, Modify, Supervisor"},
1032     { 0x01e0, "Parental, Search, Modify, Supervisor"},
1033     { 0x01e1, "Read, Parental, Search, Modify, Supervisor"},
1034     { 0x01e2, "Write, Parental, Search, Modify, Supervisor"},
1035     { 0x01e3, "Read, Write, Parental, Search, Modify, Supervisor"},
1036     { 0x01e4, "Open, Parental, Search, Modify, Supervisor"},
1037     { 0x01e5, "Read, Open, Parental, Search, Modify, Supervisor"},
1038     { 0x01e6, "Write, Open, Parental, Search, Modify, Supervisor"},
1039     { 0x01e7, "Read, Write, Open, Parental, Search, Modify, Supervisor"},
1040     { 0x01e8, "Create, Parental, Search, Modify, Supervisor"},
1041     { 0x01e9, "Read, Create, Parental, Search, Modify, Supervisor"},
1042     { 0x01ea, "Write, Create, Parental, Search, Modify, Supervisor"},
1043     { 0x01eb, "Read, Write, Create, Parental, Search, Modify, Supervisor"},
1044     { 0x01ec, "Open, Create, Parental, Search, Modify, Supervisor"},
1045     { 0x01ed, "Read, Open, Create, Parental, Search, Modify, Supervisor"},
1046     { 0x01ee, "Write, Open, Create, Parental, Search, Modify, Supervisor"},
1047     { 0x01ef, "Read, Write, Open, Create, Parental, Search, Modify, Supervisor"},
1048     { 0x01f0, "Delete, Parental, Search, Modify, Supervisor"},
1049     { 0x01f1, "Read, Delete, Parental, Search, Modify, Supervisor"},
1050     { 0x01f2, "Write, Delete, Parental, Search, Modify, Supervisor"},
1051     { 0x01f3, "Read, Write, Delete, Parental, Search, Modify, Supervisor"},
1052     { 0x01f4, "Open, Delete, Parental, Search, Modify, Supervisor"},
1053     { 0x01f5, "Read, Open, Delete, Parental, Search, Modify, Supervisor"},
1054     { 0x01f6, "Write, Open, Delete, Parental, Search, Modify, Supervisor"},
1055     { 0x01f7, "Read, Write, Open, Delete, Parental, Search, Modify, Supervisor"},
1056     { 0x01f8, "Create, Delete, Parental, Search, Modify, Supervisor"},
1057     { 0x01f9, "Read, Create, Delete, Parental, Search, Modify, Supervisor"},
1058     { 0x01fa, "Write, Create, Delete, Parental, Search, Modify, Supervisor"},
1059     { 0x01fb, "Read, Write, Create, Delete, Parental, Search, Modify, Supervisor"},
1060     { 0x01fc, "Open, Create, Delete, Parental, Search, Modify, Supervisor"},
1061     { 0x01fd, "Read, Open, Create, Delete, Parental, Search, Modify, Supervisor"},
1062     { 0x01fe, "Write, Open, Create, Delete, Parental, Search, Modify, Supervisor"},
1063     { 0x01ff, "Read, Write, Open, Create, Delete, Parental, Search, Modify, Supervisor"},
1064     { 0,    NULL }
1068 static const value_string nds_reply_errors[] = {
1069     { 0xffffffff, "(-1) Insufficient Space" },
1070     { 0xffffff89, "(-119) Buffer too Small" },
1071     { 0xffffff88, "(-120) RR Volume Flag Not Set" },
1072     { 0xffffff87, "(-121) No Items Found" },
1073     { 0xffffff86, "(-122) Connection Already Temporary" },
1074     { 0xffffff85, "(-123) Connection Already Logged In" },
1075     { 0xffffff84, "(-124) Connection Not Authenticated" },
1076     { 0xffffff83, "(-125) Connection Not Logged In" },
1077     { 0xffffff82, "(-126) NCP Boundary Check Failed" },
1078     { 0xffffff81, "(-127) Lock Waiting" },
1079     { 0xffffff80, "(-128) Lock Fail" },
1080     { 0xffffff7f, "(-129) Out of Handles" },
1081     { 0xffffff7e, "(-130) No Open Privilege" },
1082     { 0xffffff7d, "(-131) Hard IO Error" },
1083     { 0xffffff7c, "(-132) No Create Privilege" },
1084     { 0xffffff7b, "(-133) No Create Delete Privilege" },
1085     { 0xffffff7a, "(-134) Create Duplicate When Read Only" },
1086     { 0xffffff79, "(-135) Create File with Invalid Name" },
1087     { 0xffffff78, "(-136) Invalid File Handle" },
1088     { 0xffffff77, "(-137) No Search Privilege"   },
1089     { 0xffffff76, "(-138) No Delete Privilege" },
1090     { 0xffffff75, "(-139) No Rename Privilege" },
1091     { 0xffffff74, "(-140) No Set Privilege" },
1092     { 0xffffff73, "(-141) Some File in Use" },
1093     { 0xffffff72, "(-142) All File in Use" },
1094     { 0xffffff71, "(-143) Some Read Only" },
1095     { 0xffffff70, "(-144) All Read Only" },
1096     { 0xffffff6f, "(-145) Some names Exist" },
1097     { 0xffffff6e, "(-146) All Names Exist" },
1098     { 0xffffff6d, "(-147) No Read Privilege" },
1099     { 0xffffff6c, "(-148) No Write Privilege" },
1100     { 0xffffff6b, "(-149) File Detached" },
1101     { 0xffffff6a, "(-150) No Alloc Space/Target Not a Subdirectory/Insuffficient Memory" },
1102     { 0xffffff69, "(-151) No Spool Space" },
1103     { 0xffffff68, "(-152) Invalid Volume" },
1104     { 0xffffff67, "(-153) Directory Full" },
1105     { 0xffffff66, "(-154) Rename Across Volume" },
1106     { 0xffffff65, "(-155) Bad Directory Handle" },
1107     { 0xffffff64, "(-156) Invalid Path/No Such Extension" },
1108     { 0xffffff63, "(-157) No Directory Handles" },
1109     { 0xffffff62, "(-158) Bad File Name" },
1110     { 0xffffff61, "(-159) Directory Active" },
1111     { 0xffffff60, "(-160) Directory Not Empty" },
1112     { 0xffffff5f, "(-161) Directory IO Error" },
1113     { 0xffffff5e, "(-162) IO Locked" },
1114     { 0xffffff5d, "(-163) Transaction Restarted" },
1115     { 0xffffff5c, "(-164) Rename Directory Invalid" },
1116     { 0xffffff5b, "(-165) Invalid Open/Create Mode" },
1117     { 0xffffff5a, "(-166) Already in Use" },
1118     { 0xffffff59, "(-167) Invalid Resource Tag" },
1119     { 0xffffff58, "(-168) Access Denied" },
1120     { 0xffffff44, "(-188) Login Signing Required" },
1121     { 0xffffff43, "(-189) Login Encryption Required" },
1122     { 0xffffff42, "(-190) Invalid Data Stream" },
1123     { 0xffffff41, "(-191) Invalid Name Space" },
1124     { 0xffffff40, "(-192) No Accounting Privileges" },
1125     { 0xffffff3f, "(-193) No Account Balance" },
1126     { 0xffffff3e, "(-194) Credit Limit Exceeded" },
1127     { 0xffffff3d, "(-195) Too Many Holds" },
1128     { 0xffffff3c, "(-196) Accounting Disabled" },
1129     { 0xffffff3b, "(-197) Intruder Login Lockout" },
1130     { 0xffffff3a, "(-198) No Console Rights" },
1131     { 0xffffff30, "(-208) Queue IO Failure" },
1132     { 0xffffff2f, "(-209) No Queue" },
1133     { 0xffffff2e, "(-210) No Queue Server" },
1134     { 0xffffff2d, "(-211) No Queue Rights" },
1135     { 0xffffff2c, "(-212) Queue Full" },
1136     { 0xffffff2b, "(-213) No Queue Job" },
1137     { 0xffffff2a, "(-214) No Queue Job Rights/Unencrypted Not Allowed" },
1138     { 0xffffff29, "(-215) Queue In Service/Duplicate Password" },
1139     { 0xffffff28, "(-216) Queue Not Active/Password Too Short" },
1140     { 0xffffff27, "(-217) Queue Station Not Server/Maximum Logins Exceeded" },
1141     { 0xffffff26, "(-218) Queue Halted/Bad Login Time" },
1142     { 0xffffff25, "(-219) Queue Maximum Servers/Node Address Violation" },
1143     { 0xffffff24, "(-220) Login Account Expired" },
1144     { 0xffffff22, "(-222) Bad Password" },
1145     { 0xffffff21, "(-223) Password Expired" },
1146     { 0xffffff20, "(-224) No Login Connection Available" },
1147     { 0xffffff18, "(-232) Write to Group Property" },
1148     { 0xffffff17, "(-233) Member Already Exists" },
1149     { 0xffffff16, "(-234) No Such Member" },
1150     { 0xffffff15, "(-235) Property Not Group" },
1151     { 0xffffff14, "(-236) No Such Value Set" },
1152     { 0xffffff13, "(-237) Property Already Exists" },
1153     { 0xffffff12, "(-238) Object Already Exists" },
1154     { 0xffffff11, "(-239) Illegal Name" },
1155     { 0xffffff10, "(-240) Illegal Wildcard" },
1156     { 0xffffff0f, "(-241) Bindery Security" },
1157     { 0xffffff0e, "(-242) No Object Read Rights" },
1158     { 0xffffff0d, "(-243) No Object Rename Rights" },
1159     { 0xffffff0c, "(-244) No Object Delete Rights" },
1160     { 0xffffff0b, "(-245) No Object Create Rights" },
1161     { 0xffffff0a, "(-246) No Property Delete Rights" },
1162     { 0xffffff09, "(-247) No Property Create Rigths" },
1163     { 0xffffff08, "(-248) No Property Write Rights" },
1164     { 0xffffff07, "(-249) No Propery Read Rights" },
1165     { 0xffffff06, "(-250) Temp Remap" },
1166     { 0xffffff05, "(-251) Unknown Request/No Such Property" },
1167     { 0xffffff04, "(-252) Message Queue Full/Target Already Has Message/No Such Object" },
1168     { 0xffffff03, "(-253) Bad Station Number" },
1169     { 0xffffff02, "(-254) Bindery Locked/Directory Locked/Spool Delete/Trustee not Found/Timeout" },
1170     { 0xffffff01, "(-255) Hard Failure" },
1171     { 0xfffffed3, "(-301) Not Enough Memory" },
1172     { 0xfffffed2, "(-302) Bad Key" },
1173     { 0xfffffed1, "(-303) Bad Context" },
1174     { 0xfffffed0, "(-304) Buffer Full" },
1175     { 0xfffffecf, "(-305) List Empty" },
1176     { 0xfffffece, "(-306) Bad Syntax"   },
1177     { 0xfffffecd, "(-307) Buffer Empty" },
1178     { 0xfffffecc, "(-308) Bad Verb" },
1179     { 0xfffffecb, "(-309) Expected Identifier" },
1180     { 0xfffffeca, "(-310) Expected Equals" },
1181     { 0xfffffec9, "(-311) Attribute Type Expected" },
1182     { 0xfffffec8, "(-312) Attribute Type Not Expected" },
1183     { 0xfffffec7, "(-313) Filter Tree Empty" },
1184     { 0xfffffec6, "(-314) Invalid Object Name" },
1185     { 0xfffffec5, "(-315) Expected RDN Delimiter" },
1186     { 0xfffffec4, "(-316) Too Many Tokens" },
1187     { 0xfffffec3, "(-317) Inconsistent MultiAVA" },
1188     { 0xfffffec2, "(-318) Country Name Too Long" },
1189     { 0xfffffec1, "(-319) Internal Error" },
1190     { 0xfffffec0, "(-320) Can't Add Root" },
1191     { 0xfffffebf, "(-321) Unable to Attach" },
1192     { 0xfffffebe, "(-322) Invalid Iteration Handle" },
1193     { 0xfffffebd, "(-323) Buffer Zero Length" },
1194     { 0xfffffebc, "(-324) Invalid Replica Type" },
1195     { 0xfffffebb, "(-325) Invalid Attribute Syntax" },
1196     { 0xfffffeba, "(-326) Invalid Filter Syntax" },
1197     { 0xfffffeb8, "(-328) Unicode Error during Context Creation" },
1198     { 0xfffffeb7, "(-329) Invalid Union Tag" },
1199     { 0xfffffeb6, "(-330) Invalid Server Response" },
1200     { 0xfffffeb5, "(-331) Null Pointer" },
1201     { 0xfffffeb4, "(-332) No Server Found" },
1202     { 0xfffffeb3, "(-333) No Connection" },
1203     { 0xfffffeb2, "(-334) RDN Too Long" },
1204     { 0xfffffeb1, "(-335) Duplicate Type" },
1205     { 0xfffffeb0, "(-336) Data Store Failure" },
1206     { 0xfffffeaf, "(-337) Not Logged In" },
1207     { 0xfffffeae, "(-338) Invalid Password Characters" },
1208     { 0xfffffead, "(-339) Failed Server Authentication" },
1209     { 0xfffffeac, "(-340) Transport Failed" },
1210     { 0xfffffeab, "(-341) No Such Syntax" },
1211     { 0xfffffeaa, "(-342) Invalid DS Name" },
1212     { 0xfffffea9, "(-343) Attribute Name Too Long" },
1213     { 0xfffffea8, "(-344) Invalid TDS" },
1214     { 0xfffffea7, "(-345) Invalid DS Version" },
1215     { 0xfffffea6, "(-346) Unicode Translation" },
1216     { 0xfffffea5, "(-347) Schema Name Too Long" },
1217     { 0xfffffea4, "(-348) Unicode File Not Found" },
1218     { 0xfffffea3, "(-349) Unicode Already Loaded" },
1219     { 0xfffffea2, "(-350) Not Context Owner" },
1220     { 0xfffffea1, "(-351) Attempt to Authenticate" },
1221     { 0xfffffea0, "(-352) No Writable Replicas" },
1222     { 0xfffffe9f, "(-353) DN Too Long" },
1223     { 0xfffffe9e, "(-354) Rename Not Allowed" },
1224     { 0xfffffe9d, "(-355) Not NDS for NT" },
1225     { 0xfffffe9c, "(-356) NDS for NT - No Domain" },
1226     { 0xfffffe9b, "(-357) NDS for NT - Sync Disabled" },
1227     { 0xfffffe9a, "(-358) Iterator Invalid Handle" },
1228     { 0xfffffe99, "(-359) Iterator Invalid Position" },
1229     { 0xfffffe98, "(-360) Iterator Invalid Search Data" },
1230     { 0xfffffe97, "(-361) Iterator Invalid Scope" },
1231     { 0xfffffda7, "(-601) No Such Entry" },
1232     { 0xfffffda6, "(-602) No Such Value" },
1233     { 0xfffffda5, "(-603) No Such Attribute" },
1234     { 0xfffffda4, "(-604) No Such Class" },
1235     { 0xfffffda3, "(-605) No Such Partition" },
1236     { 0xfffffda2, "(-606) Entry Already Exists" },
1237     { 0xfffffda1, "(-607) Not Effective Class" },
1238     { 0xfffffda0, "(-608) Illegal Attribute" },
1239     { 0xfffffd9f, "(-609) Missing Mandatory" },
1240     { 0xfffffd9e, "(-610) Illegal DS Name" },
1241     { 0xfffffd9d, "(-611) Illegal Containment" },
1242     { 0xfffffd9c, "(-612) Can't Have Multiple Values" },
1243     { 0xfffffd9b, "(-613) Syntax Violation" },
1244     { 0xfffffd9a, "(-614) Duplicate Value" },
1245     { 0xfffffd99, "(-615) Attribute Already Exists" },
1246     { 0xfffffd98, "(-616) Maximum Entries Exist" },
1247     { 0xfffffd97, "(-617) Database Format" },
1248     { 0xfffffd96, "(-618) Inconsistent Database" },
1249     { 0xfffffd95, "(-619) Invalid Comparison" },
1250     { 0xfffffd94, "(-620) Comparison Failed" },
1251     { 0xfffffd93, "(-621) Transaction Tracking Disabled" },
1252     { 0xfffffd92, "(-622) Invalid Transport" },
1253     { 0xfffffd91, "(-623) Syntax Invalid in Name" },
1254     { 0xfffffd90, "(-624) Replica Already Exists" },
1255     { 0xfffffd8f, "(-625) Transport Failure" },
1256     { 0xfffffd8e, "(-626) All Referrals Failed" },
1257     { 0xfffffd8d, "(-627) Can't Remove Naming Value" },
1258     { 0xfffffd8c, "(-628) Object Class Violation" },
1259     { 0xfffffd8b, "(-629) Entry is Not Leaf" },
1260     { 0xfffffd8a, "(-630) Different Tree" },
1261     { 0xfffffd89, "(-631) Illegal Replica Type" },
1262     { 0xfffffd88, "(-632) System Failure" },
1263     { 0xfffffd87, "(-633) Invalid Entry for Root" },
1264     { 0xfffffd86, "(-634) No Referrals" },
1265     { 0xfffffd85, "(-635) Remote Failure" },
1266     { 0xfffffd84, "(-636) Unreachable Server" },
1267     { 0xfffffd83, "(-637) Previous Move in Progress" },
1268     { 0xfffffd82, "(-638) No Character Mapping" },
1269     { 0xfffffd81, "(-639) Incomplete Authentication" },
1270     { 0xfffffd80, "(-640) Invalid Certificate" },
1271     { 0xfffffd7f, "(-641) Invalid Request" },
1272     { 0xfffffd7e, "(-642) Invalid Iteration" },
1273     { 0xfffffd7d, "(-643) Schema is Non-removable" },
1274     { 0xfffffd7c, "(-644) Schema is in Use" },
1275     { 0xfffffd7b, "(-645) Class Already Exists" },
1276     { 0xfffffd7a, "(-646) Bad Naming Attributes" },
1277     { 0xfffffd79, "(-647) Not Root Partition" },
1278     { 0xfffffd78, "(-648) Insufficient Stack" },
1279     { 0xfffffd77, "(-649) Insufficient Buffer" },
1280     { 0xfffffd76, "(-650) Ambiguous Containment" },
1281     { 0xfffffd75, "(-651) Ambiguous Naming" },
1282     { 0xfffffd74, "(-652) Duplicate Mandatory" },
1283     { 0xfffffd73, "(-653) Duplicate Optional" },
1284     { 0xfffffd72, "(-654) Partition Busy" },
1285     { 0xfffffd71, "(-655) Multiple Replicas" },
1286     { 0xfffffd70, "(-656) Crucial Replica" },
1287     { 0xfffffd6f, "(-657) Schema Sync in Progress" },
1288     { 0xfffffd6e, "(-658) Skulk in Progress" },
1289     { 0xfffffd6d, "(-659) Time Not Synchronized" },
1290     { 0xfffffd6c, "(-660) Record in Use" },
1291     { 0xfffffd6b, "(-661) DS Volume Not Mounted" },
1292     { 0xfffffd6a, "(-662) DS Volume IO Failure" },
1293     { 0xfffffd69, "(-663) DS Locked" },
1294     { 0xfffffd68, "(-664) Old Epoch" },
1295     { 0xfffffd67, "(-665) New Epoch" },
1296     { 0xfffffd66, "(-666) Incompatible DS Version" },
1297     { 0xfffffd65, "(-667) Partition Root" },
1298     { 0xfffffd64, "(-668) Entry Not Container" },
1299     { 0xfffffd63, "(-669) Failed Authentication" },
1300     { 0xfffffd62, "(-670) Invalid Context" },
1301     { 0xfffffd61, "(-671) No Such Parent" },
1302     { 0xfffffd60, "(-672) No Access" },
1303     { 0xfffffd5f, "(-673) Replica Not On" },
1304     { 0xfffffd5e, "(-674) Invalid Name Service" },
1305     { 0xfffffd5d, "(-675) Invalid Task" },
1306     { 0xfffffd5c, "(-676) Invalide Connection Handle" },
1307     { 0xfffffd5b, "(-677) Invalid Identity" },
1308     { 0xfffffd5a, "(-678) Duplicate ACL" },
1309     { 0xfffffd59, "(-679) Partition Already Exists" },
1310     { 0xfffffd58, "(-680) Transport Modified" },
1311     { 0xfffffd57, "(-681) Alias of an Alias" },
1312     { 0xfffffd56, "(-682) Auditing Failed" },
1313     { 0xfffffd55, "(-683) Invalid API Version" },
1314     { 0xfffffd54, "(-684) Secure NCP Violation" },
1315     { 0xfffffd53, "(-685) Move in Progress" },
1316     { 0xfffffd52, "(-686) Not a Leaf Partition" },
1317     { 0xfffffd51, "(-687) Cannot Abort" },
1318     { 0xfffffd50, "(-688) Cache Overflow" },
1319     { 0xfffffd4f, "(-689) Invalid Subordinate Count" },
1320     { 0xfffffd4e, "(-690) Invalid RDN" },
1321     { 0xfffffd4d, "(-691) Modification Time Not Current" },
1322     { 0xfffffd4c, "(-692) Incorrect Base Class" },
1323     { 0xfffffd4b, "(-693) Missing Reference" },
1324     { 0xfffffd4a, "(-694) Lost Entry" },
1325     { 0xfffffd49, "(-695) Agent Already Registered" },
1326     { 0xfffffd48, "(-696) DS Loader Busy" },
1327     { 0xfffffd47, "(-697) DS Cannot Reload" },
1328     { 0xfffffd46, "(-698) Replica in Skulk" },
1329     { 0xfffffd45, "(-699) Fatal" },
1330     { 0xfffffd44, "(-700) Obsolete API" },
1331     { 0xfffffd43, "(-701) Synchronization Disabled" },
1332     { 0xfffffd42, "(-702) Invalid Parameter" },
1333     { 0xfffffd41, "(-703) Duplicate Template" },
1334     { 0xfffffd40, "(-704) No Master Replica" },
1335     { 0xfffffd3f, "(-705) Duplicate Containment" },
1336     { 0xfffffd3e, "(-706) Not a Sibling" },
1337     { 0xfffffd3d, "(-707) Invalid Signature" },
1338     { 0xfffffd3c, "(-708) Invalid Response" },
1339     { 0xfffffd3b, "(-709) Insufficient Sockets" },
1340     { 0xfffffd3a, "(-710) Database Read Fail" },
1341     { 0xfffffd39, "(-711) Invalid Code Page" },
1342     { 0xfffffd38, "(-712) Invalid Escape Character" },
1343     { 0xfffffd37, "(-713) Invalide Delimiters" },
1344     { 0xfffffd36, "(-714) Not Implemented" },
1345     { 0xfffffd35, "(-715) Checksum Failure" },
1346     { 0xfffffd34, "(-716) Checksumming Not Supported" },
1347     { 0xfffffd33, "(-717) CRC Failure" },
1348     { 0xfffffd32, "(-718) Invalid Entry Handle" },
1349     { 0xfffffd31, "(-719) Invalid Value Handle" },
1350     { 0xfffffd30, "(-720) Connection Denied" },
1351     { 0xfffffd2f, "(-721) No Such Federation Link" },
1352     { 0xfffffd2e, "(-722) Operetational Schema Mismatch" },
1353     { 0xfffffd2d, "(-723) Stream Not Found" },
1354     { 0xfffffd2c, "(-724) DClient Unavailable" },
1355     { 0xfffffd2b, "(-725) MASV No Access" },
1356     { 0xfffffd2a, "(-726) MASV Invalid Request" },
1357     { 0xfffffd29, "(-727) MASV Failure" },
1358     { 0xfffffd28, "(-728) MASV Already Exists" },
1359     { 0xfffffd27, "(-729) MASV Not Found" },
1360     { 0xfffffd26, "(-730) MASV Bad Range" },
1361     { 0xfffffd25, "(-731) Value Data" },
1362     { 0xfffffd24, "(-732) Database Locked" },
1363     { 0xfffffd21, "(-735) Nothing to Abort" },
1364     { 0xfffffd20, "(-736) End of Stream" },
1365     { 0xfffffd1f, "(-737) No Such Template" },
1366     { 0xfffffd1e, "(-738) SAS Locked" },
1367     { 0xfffffd1d, "(-739) Invalid SAS Version" },
1368     { 0xfffffd1c, "(-740) SAS Already Registered" },
1369     { 0xfffffd1b, "(-741) Name Type Not Supported" },
1370     { 0xfffffd1a, "(-742) Wrong DS Version" },
1371     { 0xfffffd19, "(-743) Invalid Control Function" },
1372     { 0xfffffd18, "(-744) Invalid Control State" },
1373     { 0xfffffd17, "(-745) Cache in Use" },
1374     { 0xfffffd16, "(-746) Zero Creation Time" },
1375     { 0xfffffd15, "(-747) Would Block" },
1376     { 0xfffffd14, "(-748) Connection Timeout" },
1377     { 0xfffffd13, "(-749) Too Many Referrals" },
1378     { 0xfffffd12, "(-750) Operation Cancelled" },
1379     { 0xfffffd11, "(-751) Unknown Target" },
1380     { 0xfffffd10, "(-752) GUID Failure" },
1381     { 0xfffffd0f, "(-753) Incompatible OS" },
1382     { 0xfffffd0e, "(-754) Callback Cancel" },
1383     { 0xfffffd0d, "(-755) Invalid Synchronization Data" },
1384     { 0xfffffd0c, "(-756) Stream Exists" },
1385     { 0xfffffd0b, "(-757) Auxiliary Has Containment" },
1386     { 0xfffffd0a, "(-758) Auxiliary Not Container" },
1387     { 0xfffffd09, "(-759) Auxiliary Not Effective" },
1388     { 0xfffffd08, "(-760) Auxiliary On Alias" },
1389     { 0xfffffd07, "(-761) Have Seen State" },
1390     { 0xfffffd06, "(-762) Verb Locked" },
1391     { 0xfffffd05, "(-763) Verb Exceeds Table Length" },
1392     { 0xfffffd04, "(-764) BOF Hit" },
1393     { 0xfffffd03, "(-765) EOF Hit" },
1394     { 0xfffffd02, "(-766) Incompatible Replica Version" },
1395     { 0xfffffd01, "(-767) Query Timeout" },
1396     { 0xfffffd00, "(-768) Query Maximum Count" },
1397     { 0xfffffcff, "(-769) Duplicate Naming" },
1398     { 0xfffffcfe, "(-770) No Transaction Active" },
1399     { 0xfffffcfd, "(-771) Transaction Active" },
1400     { 0xfffffcfc, "(-772) Illegal Transaction Operation" },
1401     { 0xfffffcfb, "(-773) Iterator Syntax" },
1402     { 0xfffffcfa, "(-774) Repairing DIB" },
1403     { 0xfffffcf9, "(-775) Invalid OID Format" },
1404     { 0xfffffcf8, "(-776) Attempted to perform an NDS operation, and the DS agent on this server is closing" },
1405     { 0xfffffcf7, "(-777) Attempted to modify an object's attribute that is not stored on the sparse replica" },
1406     { 0xfffffcf6, "(-778) VpVector and VpvUser which must be correlated, are out of sync" },
1407     { 0xfffffcf5, "(-779) Error Cannot Go Remote" },
1408     { 0xfffffcf4, "(-780) Request not Supported" },
1409     { 0xfffffcf3, "(-781) Entry Not Local" },
1410     { 0xfffffcf2, "(-782) Root Unreachable" },
1411     { 0xfffffcf1, "(-783) VRDIM Not Initialized" },
1412     { 0xfffffcf0, "(-784) Wait Timeout" },
1413     { 0xfffffcef, "(-785) DIB Error" },
1414     { 0xfffffcee, "(-786) DIB IO Failure" },
1415     { 0xfffffced, "(-787) Illegal Schema Attribute" },
1416     { 0xfffffcec, "(-788) Error Schema Partition" },
1417     { 0xfffffceb, "(-789) Invalid Template" },
1418     { 0xfffffcea, "(-790) Error Opening File" },
1419     { 0xfffffce9, "(-791) Error Direct Opening File" },
1420     { 0xfffffce8, "(-792) Error Creating File" },
1421     { 0xfffffce7, "(-793) Error Direct Creating File" },
1422     { 0xfffffce6, "(-794) Error Reading File" },
1423     { 0xfffffce5, "(-795) Error Direct Reading File" },
1424     { 0xfffffce4, "(-796) Error Writing File" },
1425     { 0xfffffce3, "(-797) Error Direct Writing File" },
1426     { 0xfffffce2, "(-798) Error Positioning in File" },
1427     { 0xfffffce1, "(-799) Error Getting File Size" },
1428     { 0xffffe88f, "(-6001) Error Truncating File" },
1429     { 0xffffe88e, "(-6002) Error Parsing File Name" },
1430     { 0xffffe88d, "(-6003) Error Closing File" },
1431     { 0xffffe88c, "(-6004) Error Getting File Info" },
1432     { 0xffffe88b, "(-6005) Error Expanding File" },
1433     { 0xffffe88a, "(-6006) Error Getting Free Blocks" },
1434     { 0xffffe889, "(-6007) Error Checking File Existence" },
1435     { 0xffffe888, "(-6008) Error Deleting File" },
1436     { 0xffffe887, "(-6009) Error Renaming File" },
1437     { 0xffffe886, "(-6010) Error Initializing IO System" },
1438     { 0xffffe885, "(-6011) Error Flushing File" },
1439     { 0xffffe884, "(-6012) Error Setting Up for Read" },
1440     { 0xffffe883, "(-6013) Error Setting up for Write" },
1441     { 0xffffe882, "(-6014) Error Old View" },
1442     { 0xffffe881, "(-6015) Server in Skulk" },
1443     { 0xffffe880, "(-6016) Error Returning Partial Results" },
1444     { 0xffffe87f, "(-6017) No Such Schema" },
1445     { 0xffffe87e, "(-6018) Serial Number Mismatch" },
1446     { 0xffffe87d, "(-6019) Bad Referal Database Serial Number" },
1447     { 0xffffe87c, "(-6020) Bad Referal Serial Number" },
1448     { 0xffffe87b, "(-6021) Invalid File Sequence" },
1449     { 0xffffe87a, "(-6022) Error Referal Trans Gap" },
1450     { 0xffffe879, "(-6023) Bad Referal File Number" },
1451     { 0xffffe878, "(-6024) Referal File Not Found" },
1452     { 0xffffe877, "(-6025) Error Backup Active" },
1453     { 0xffffe876, "(-6026) Referal Device Full" },
1454     { 0xffffe875, "(-6027) Unsupported Version" },
1455     { 0xffffe874, "(-6028) Error Must Wait Checkpoint" },
1456     { 0xffffe873, "(-6029) Attribute Maintenance in Progress" },
1457     { 0xffffe872, "(-6030) Error Abort Transaction" },
1458     { 0xffff0000, "Ok" },
1459     { 0x0000, "Ok" },
1460     { 0, NULL }
1463 #define NDS_PTYPE_IPX           0x00000000
1464 #define NDS_PTYPE_IP            0x00000001
1465 #define NDS_PTYPE_SDLC          0x00000002
1466 #define NDS_PTYPE_TR_ON_ETH     0x00000003
1467 #define NDS_PTYPE_OSI           0x00000004
1468 #define NDS_PTYPE_APPLETALK     0x00000005
1469 #define NDS_PTYPE_NETBEUI       0x00000006
1470 #define NDS_PTYPE_SOCKETADDRESS 0x00000007
1471 #define NDS_PTYPE_UDP           0x00000008
1472 #define NDS_PTYPE_TCP           0x00000009
1473 #define NDS_PTYPE_UDPv6         0x0000000a
1474 #define NDS_PTYPE_TCPv6         0x0000000b
1475 #define NDS_PTYPE_INTERNAL      0x0000000c
1476 #define NDS_PTYPE_URL           0x0000000d
1477 #define NDS_PTYPE_DNS           0x0000000e
1478 #define NDS_PTYPE_CNT           0x0000000f
1480 static const value_string nds_protocol_type[] = {
1481     { NDS_PTYPE_IPX,           "(IPX Protocol)" },
1482     { NDS_PTYPE_IP,            "(IP Protocol)" },
1483     { NDS_PTYPE_SDLC,          "(SDLC Protocol)" },
1484     { NDS_PTYPE_TR_ON_ETH,     "(TokenRing on Ethernet Protocol)" },
1485     { NDS_PTYPE_OSI,           "(OSI Protocol)" },
1486     { NDS_PTYPE_APPLETALK,     "(AppleTalk Protocol)" },
1487     { NDS_PTYPE_NETBEUI,       "(NetBEUI Protocol)" },
1488     { NDS_PTYPE_SOCKETADDRESS, "(Socket Address Protocol)" },
1489     { NDS_PTYPE_UDP,           "(UDP Protocol)" },
1490     { NDS_PTYPE_TCP,           "(TCP Protocol)" },
1491     { NDS_PTYPE_UDPv6,         "(UDP v6 Protocol)" },
1492     { NDS_PTYPE_TCPv6,         "(TCP v6 Protocol)" },
1493     { NDS_PTYPE_INTERNAL,      "(Internal Protocol)" },
1494     { NDS_PTYPE_URL,           "(URL Protocol)" },
1495     { NDS_PTYPE_DNS,           "(DNS Protocol)" },
1496     { NDS_PTYPE_CNT,           "(Number of protocol types defined)" },
1497     { 0, NULL }
1501 static const value_string nds_syntax[] = {
1502     { 0x00000000, "Unknown Syntax" },
1503     { 0x00000001, "Distinguished Name" },
1504     { 0x00000002, "Case Sensitive Unicode String" },
1505     { 0x00000003, "Non Case Sensitive Unicode String" },
1506     { 0x00000004, "Printable String" },
1507     { 0x00000005, "Numeric String" },
1508     { 0x00000006, "Case Insensitive List" },
1509     { 0x00000007, "Boolean" },
1510     { 0x00000008, "Signed Integer" },
1511     { 0x00000009, "Binary String" },
1512     { 0x0000000a, "Telephone Number" },
1513     { 0x0000000b, "Fax Number" },
1514     { 0x0000000c, "Network Address" },
1515     { 0x0000000d, "Binary String List" },
1516     { 0x0000000e, "Email Address" },
1517     { 0x0000000f, "File System Path" },
1518     { 0x00000010, "Replica Pointer" },
1519     { 0x00000011, "Object ACL" },
1520     { 0x00000012, "Postal Address" },
1521     { 0x00000013, "Time Stamp" },
1522     { 0x00000014, "Class Name" },
1523     { 0x00000015, "Stream" },
1524     { 0x00000016, "Counter" },
1525     { 0x00000017, "Back Link" },
1526     { 0x00000018, "Time" },
1527     { 0x00000019, "Typed Name" },
1528     { 0x0000001a, "Hold" },
1529     { 0x0000001b, "Interval" },
1530     { 0, NULL }
1533 static const value_string name_space_type[] = {
1534     { 0x00000000, "DOS Name Space" },
1535     { 0x00000001, "MAC Name Space" },
1536     { 0x00000002, "NFS Name Space" },
1537     { 0x00000003, "FTAM Name Space" },
1538     { 0x00000004, "OS/2, Long Name Space" },
1539     { 0, NULL }
1543 static const value_string nds_replica_state[] = {
1544     { 0x0000, "On" },
1545     { 0x0001, "New" },
1546     { 0x0002, "Dying" },
1547     { 0x0003, "Locked" },
1548     { 0x0004, "Create Master State 0" },
1549     { 0x0005, "Create Master State 1" },
1550     { 0x0006, "Transition On" },
1551     { 0x0007, "Dead Replica" },
1552     { 0x0008, "Begin Add" },
1553     { 0x000b, "Master Start" },
1554     { 0x000c, "Master Done" },
1555     { 0x0017, "Federated" },
1556     { 0x0030, "Split State 0" },
1557     { 0x0031, "Split State 1" },
1558     { 0x0040, "Join State 0" },
1559     { 0x0041, "Join State 1" },
1560     { 0x0042, "Join State 2" },
1561     { 0x0050, "Move Subtree State 0" },
1562     { 0x0051, "Move Subtree State 1" },
1563     { 0, NULL }
1566 static const value_string nds_replica_type[] = {
1567     { 0x0000, "Master" },
1568     { 0x0001, "Secondary" },
1569     { 0x0002, "Read Only" },
1570     { 0x0003, "Sub Ref" },
1571     { 0, NULL }
1574 static const value_string class_def_type[] = {
1575     { 0x0000, "Return Class Name" },
1576     { 0x0001, "Return Class Name, Flag, and Definition" },
1577     { 0x0002, "Return Class Name, Flag, Definition, and Super Class" },
1578     { 0x0003, "Return Class Name, Flag, and ASN.1 identifier" },
1579     { 0x0004, "Return Class Name, Flag, Definition, Super Class, and ACL" },
1580     { 0x0005, "Return Class Name, Flag, Creation Timestamp, Modification Timestamp, Definition, and ACL" },
1581     { 0, NULL }
1584 static const value_string nds_search_scope[] = {
1585     { 0x0000, "Examine the base object only" },
1586     { 0x0001, "Search the immediate subordinates of the base object" },
1587     { 0x0002, "Search the base object and all its subordinates" },
1588     { 0x0003, "Search the base objects and all objects in its partition (Implemented in NDS 8)" },
1589     { 0, NULL }
1592 static const value_string nds_verb2b_flag_vals[] = {
1593     { 0, "Request Flags (0x0000) - Retain old object name" },
1594     { 1, "Request Flags (0x0001) - Delete old object name" },
1595     { 0,  NULL }
1598 static const value_string serv_type_vals[] = {
1599     { 0, "NetWare" },
1600     { 1, "OES" },
1601     { 0,  NULL }
1604 static const value_string kernel_type_vals[] = {
1605     { 0, "NetWare" },
1606     { 1, "Linux" },
1607     { 0,  NULL }
1610 static void
1611 process_ptvc_record(ptvcursor_t *ptvc, const ptvc_record *rec,
1612                     gboolean *req_cond_results, gboolean really_decode,
1613                     const ncp_record *ncp_rec);
1615 /* NCP packets come in request/reply pairs. The request packets tell the type
1616  * of NCP request and give a sequence ID. The response, unfortunately, only
1617  * identifies itself via the sequence ID; you have to know what type of NCP
1618  * request the request packet contained in order to successfully parse the NCP
1619  * response. A global method for doing this does not exist in wireshark yet
1620  * (NFS also requires it), so for now the NCP section will keep its own hash
1621  * table keeping track of NCP packet types.
1623  * We construct a conversation specified by the client and server
1624  * addresses and the connection number; the key representing the unique
1625  * NCP request then is composed of the pointer to the conversation
1626  * structure, cast to a "guint" (which may throw away the upper 32
1627  * bits of the pointer on a P64 platform, but the low-order 32 bits
1628  * are more likely to differ between conversations than the upper 32 bits),
1629  * and the sequence number.
1631  * The value stored in the hash table is the ncp_req_hash_value pointer. This
1632  * struct tells us the NCP type and gives the ncp2222_record pointer, if
1633  * ncp_type == 0x2222.
1634  */
1635 typedef struct {
1636     conversation_t  *conversation;
1637     guint32           nw_sequence_long;
1638 } ncp_req_hash_key;
1641 typedef struct {
1642     guint32          nw_eid;
1643 } ncp_req_eid_hash_key;
1645 typedef struct {
1646     ncp_req_eid_hash_key    *nds_eid;
1647     char                    object_name[256];
1648 } ncp_req_eid_hash_value;
1650 static GHashTable *ncp_req_hash = NULL;
1651 static GHashTable *ncp_req_eid_hash = NULL;
1653 /* Hash Functions */
1654 static gboolean
1655 ncp_equal(gconstpointer v, gconstpointer v2)
1657     const ncp_req_hash_key *val1 = (const ncp_req_hash_key*)v;
1658     const ncp_req_hash_key *val2 = (const ncp_req_hash_key*)v2;
1660     if (val1->conversation == val2->conversation &&
1661         val1->nw_sequence_long  == val2->nw_sequence_long ) {
1662         return TRUE;
1663     }
1664     return FALSE;
1667 static gboolean
1668 ncp_eid_equal(gconstpointer v, gconstpointer v2)
1670     const ncp_req_eid_hash_key *val1 = (const ncp_req_eid_hash_key*)v;
1671     const ncp_req_eid_hash_key *val2 = (const ncp_req_eid_hash_key*)v2;
1673     if (val1->nw_eid == val2->nw_eid ) {
1674         return TRUE;
1675     }
1676     return FALSE;
1679 static guint
1680 ncp_hash(gconstpointer v)
1682     const ncp_req_hash_key *ncp_key = (const ncp_req_hash_key*)v;
1683     return GPOINTER_TO_UINT(ncp_key->conversation) + ncp_key->nw_sequence_long;
1686 static guint
1687 ncp_eid_hash(gconstpointer v)
1689     const ncp_req_eid_hash_key *ncp_eid_key = (const ncp_req_eid_hash_key*)v;
1690     return GPOINTER_TO_UINT(ncp_eid_key->nw_eid);
1693 /* Initializes the hash table and the mem_chunk area each time a new
1694  * file is loaded or re-loaded in wireshark */
1695 static void
1696 ncp_init_protocol(void)
1698     int i;
1700     /* fragment */
1701     reassembly_table_init(&nds_reassembly_table,
1702                           &addresses_reassembly_table_functions);
1704     for (i = 0; i < 99; i++) {
1705         frags[i].nds_frag = 0xfffffff0;
1706     }
1708     if (ncp_req_hash) {
1709         g_hash_table_destroy(ncp_req_hash);
1710     }
1711     if (ncp_req_eid_hash) {
1712         g_hash_table_destroy(ncp_req_eid_hash);
1713     }
1715     ncp_req_hash = g_hash_table_new(ncp_hash, ncp_equal);
1716     ncp_req_eid_hash = g_hash_table_new(ncp_eid_hash, ncp_eid_equal);
1719 /* After the sequential run, we don't need the ncp_request hash and keys
1720  * anymore; the lookups have already been done and the vital info
1721  * saved in the reply-packets' private_data in the frame_data struct. */
1722 static void
1723 ncp_postseq_cleanup(void)
1725 #if 0 /* XXX: ?? */
1726     if (ncp_req_hash) {
1727         /* Destroy the hash, but don't clean up request_condition data. */
1728         g_hash_table_destroy(ncp_req_hash);
1729         ncp_req_hash = NULL;
1730     }
1731 #endif
1732     /* Don't free the ncp_req_hash_values or EID_hash_table, as they're
1733      * needed during random-access processing of the proto_tree.*/
1736 /* NCP sequence numbers are from 0 - 255. After reaching 255 the 
1737  * sequence number wraps back to 0. Change nw_sequence to nw_sequence_long
1738  * and use upper bits to make sequence numbers unique. This way
1739  * future attempts to locate initiating packet will succeed. 
1740  */
1741 static ncp_req_hash_value*
1742 ncp_hash_insert(conversation_t *conversation, guint8 nw_sequence,
1743                 const ncp_record *ncp_rec, guint32 pkt_num)
1745     ncp_req_hash_key    *request_key;
1746     ncp_req_hash_value  *request_value;
1748     /* Now remember the request, so we can find it if we later
1749        a reply to it. */
1750     request_key = se_new(ncp_req_hash_key);
1751     request_key->conversation = conversation;
1752         /* Make sequence number unique */
1753     request_key->nw_sequence_long = (0x10000 + ((pkt_num/255)<<16)) | nw_sequence;
1755     request_value = se_new(ncp_req_hash_value);
1756     request_value->ncp_rec = ncp_rec;
1757     request_value->req_cond_results = NULL;
1758     request_value->req_nds_flags = 0;
1759     request_value->nds_request_verb = 0;
1760     request_value->nds_version = 0;
1761     g_strlcpy(request_value->object_name, " ", 256);
1762     request_value->nds_frag = TRUE;
1764     g_hash_table_insert(ncp_req_hash, request_key, request_value);
1766     return request_value;
1769 static ncp_req_eid_hash_value*
1770 ncp_eid_hash_insert(guint32 nw_eid)
1772     ncp_req_eid_hash_key    *request_eid_key;
1773     ncp_req_eid_hash_value  *request_eid_value;
1775     /* Now remember the request, so we can find it if we later
1776        a reply to it. */
1777     request_eid_key = se_new(ncp_req_eid_hash_key);
1778     request_eid_key->nw_eid = nw_eid;
1780     request_eid_value = se_new(ncp_req_eid_hash_value);
1781     g_strlcpy(request_eid_value->object_name, " ", 256);
1783     g_hash_table_insert(ncp_req_eid_hash, request_eid_key, request_eid_value);
1785     return request_eid_value;
1788 /* Returns the ncp_rec*, or NULL if not found. */
1789 static ncp_req_hash_value*
1790 ncp_hash_lookup(conversation_t *conversation, guint8 nw_sequence, guint32 pkt_num)
1792     ncp_req_hash_key  request_key;
1793         ncp_req_hash_value *temp_value;
1795     request_key.conversation = conversation;
1796         /* Find unique sequence number */
1797     request_key.nw_sequence_long = (0x10000+((pkt_num/255)<<16)) | nw_sequence;
1799         /* Since masking of sequence number utilizes the packet number as
1800          * part of it's algorythm it is possible for a packet to sit right
1801          * on the boundary and fail. (depending on number of packets in trace)
1802          * Loop through all the previous sequence numbers in the hash to see
1803          * if the original request packet can be found.
1804          */
1805         temp_value = (ncp_req_hash_value *)g_hash_table_lookup(ncp_req_hash, &request_key);
1806         while(!temp_value)
1807         {
1808        request_key.nw_sequence_long = request_key.nw_sequence_long-0x10000;
1809            if((request_key.nw_sequence_long & 0xffff0000) == 0){
1810                 break;
1811            }  
1812        temp_value = (ncp_req_hash_value *)g_hash_table_lookup(ncp_req_hash, &request_key);
1813         }
1814         
1815     return temp_value;
1818 /* Returns the value_rec* for needed EID, or NULL if not found. */
1819 static ncp_req_eid_hash_value*
1820 ncp_eid_hash_lookup(conversation_t *conversation _U_, guint32 nw_eid)
1822     ncp_req_eid_hash_key  request_eid_key;
1824     request_eid_key.nw_eid = nw_eid;
1826     return (ncp_req_eid_hash_value *)g_hash_table_lookup(ncp_req_eid_hash, &request_eid_key);
1829 /* Does NCP func require a subfunction code? */
1830 static gboolean
1831 ncp_requires_subfunc(guint8 func)
1833     const guint8 *ncp_func_requirement = ncp_func_requires_subfunc;
1835     while (*ncp_func_requirement != 0) {
1836         if (*ncp_func_requirement == func) {
1837             return TRUE;
1838         }
1839         ncp_func_requirement++;
1840     }
1841     return FALSE;
1844 /* Does the NCP func have a length parameter? */
1845 static gboolean
1846 ncp_has_length_parameter(guint8 func)
1848     const guint8 *ncp_func_requirement = ncp_func_has_no_length_parameter;
1850     while (*ncp_func_requirement != 0) {
1851         if (*ncp_func_requirement == func) {
1852             return FALSE;
1853         }
1854         ncp_func_requirement++;
1855     }
1856     return TRUE;
1860 /* Return a ncp_record* based on func and possibly subfunc */
1861 static const ncp_record *
1862 ncp_record_find(guint8 func, guint8 subfunc)
1864     const ncp_record *ncp_rec = ncp_packets;
1866     while(ncp_rec->func != 0 || ncp_rec->subfunc != 0 ||
1867           ncp_rec->name != NULL ) {
1868         if (ncp_rec->func == func) {
1869             if (ncp_rec->has_subfunc) {
1870                 if (ncp_rec->subfunc == subfunc) {
1871                     return ncp_rec;
1872                 }
1873             }
1874             else {
1875                 return ncp_rec;
1876             }
1877         }
1878         ncp_rec++;
1879     }
1880     return NULL;
1884 /* Given a proto_item*, assume it contains an integer value
1885  * and return a guint from it. */
1886 static guint
1887 get_finfo_value_integer(field_info *finfo)
1889     /* XXX the fvalue functions are no longer safe to call directly
1890        since we sometimes fake the entries to speed things up.
1891        this dissector should not call fvalue_ functions directly.
1892     */
1893     if(!finfo->value.ftype->get_value_uinteger){
1894         return 0;
1895     }
1896     return fvalue_get_uinteger(&finfo->value);
1898 static guint
1899 get_item_value(proto_item *item)
1901     return get_finfo_value_integer(PITEM_FINFO(item));
1905 static guint
1906 get_finfo_length(field_info *finfo)
1908     return fvalue_length(&finfo->value);
1912 static char *
1913 get_finfo_value_string(field_info *finfo)
1915     return (char *)fvalue_get(&finfo->value);
1917 #if 0
1918 static char *
1919 get_item_string(proto_item *item)
1921     return get_finfo_value_string(PITEM_FINFO(item));
1923 #endif
1925 static const char *
1926 get_item_name(proto_item *item)
1928     return PITEM_FINFO(item)->hfinfo->name;
1932 typedef proto_item* (*padd_func_t)(ptvcursor_t*, const ptvc_record*);
1935  * XXX - are these just DOS-format dates and times?
1937  * Should we put code to understand various date and time formats (UNIX,
1938  * DOS, SMB weird mutant UNIX, NT, Mac, etc. into libwireshark, and have
1939  * the "display" member of an HF_ABSOLUTE_TIME field specify whether
1940  * it's DOS date/DOS time, DOS time/DOS date, NT time, UNIX time_t,
1941  * UNIX "struct timeval", NFSv3/NFSv4 seconds/nanoseconds, Mac, etc.?
1943  * What about hijacking the "bitmask" field to specify the precision of
1944  * the time stamp, or putting a combination of precision and format
1945  * into the "display" member?
1947  * What about relative times?  Should they have units (seconds, milliseconds,
1948  * microseconds, nanoseconds, etc.), precision, and format in there?
1949  */
1950 typedef struct {
1951     guint       year;
1952     guint       month;
1953     guint       day;
1954 } nw_date_t;
1956 typedef struct {
1957     guint       hour;
1958     guint       minute;
1959     guint       second;
1960 } nw_time_t;
1962 #define NW_UNI_MAX 1024
1964 #define VTYPE_NONE                       0  /* no value */
1965 #define VTYPE_UINT8                      1
1966 #define VTYPE_UINT16                     2
1967 #define VTYPE_UINT32                     3
1968 #define VTYPE_STRING                     4
1969 #define VTYPE_BITFIELD                   5
1970 #define VTYPE_MULTIVALUE_UINT32          6
1971 #define VTYPE_BYTES                      7
1972 #define VTYPE_BOOLEAN                    8
1973 #define VTYPE_ITEM                       9
1975 #define MVTYPE_ATTR_REQUEST              1
1976 #define MVTYPE_ATTR_REPLY                2
1977 #define MVTYPE_ATTR_REQUEST2             3
1978 #define MVTYPE_READ_CLASS_REQ            4
1979 #define MVTYPE_READ_REPLICAS             5
1980 #define MVTYPE_MODIFY_ATTR_REQUEST       6
1981 #define MVTYPE_ADDR_REFERRAL_REQUEST     7
1982 #define MVTYPE_ADDR_REFERRAL_REPLY       8
1983 #define MVTYPE_LOC_ADDR_REFERRAL_REPLY   9
1984 #define MVTYPE_PROC_ENTRY_SPECIFIERS    10
1985 #define MVTYPE_PRINT_TIMESTAMP          11
1986 #define MVTYPE_LIST_PARTITIONS          12
1987 #define MVTYPE_CLASS_NAMES              13
1988 #define MVTYPE_MODIFY_CLASS             14
1989 #define MVTYPE_ADD_ATTR_REQUEST         15
1990 #define MVTYPE_PROCESS_TAGS             16
1991 #define MVTYPE_PROCESS_ITERATOR         17
1993 typedef struct {
1994     guint8          vtype;
1995     guint32         vvalue;
1996     const char*     vstring;
1997     const char*     vdesc;
1998     guint32         vlength;
1999     guint32         voffset;
2000     guint32         hfname;
2001     const char*     bit1;
2002     guint32         bit1hfname;
2003     const char*     bit2;
2004     guint32         bit2hfname;
2005     const char*     bit3;
2006     guint32         bit3hfname;
2007     const char*     bit4;
2008     guint32         bit4hfname;
2009     const char*     bit5;
2010     guint32         bit5hfname;
2011     const char*     bit6;
2012     guint32         bit6hfname;
2013     const char*     bit7;
2014     guint32         bit7hfname;
2015     const char*     bit8;
2016     guint32         bit8hfname;
2017     const char*     bit9;
2018     guint32         bit9hfname;
2019     const char*     bit10;
2020     guint32         bit10hfname;
2021     const char*     bit11;
2022     guint32         bit11hfname;
2023     const char*     bit12;
2024     guint32         bit12hfname;
2025     const char*     bit13;
2026     guint32         bit13hfname;
2027     const char*     bit14;
2028     guint32         bit14hfname;
2029     const char*     bit15;
2030     guint32         bit15hfname;
2031     const char*     bit16;
2032     guint32         bit16hfname;
2033     guint8          mvtype;
2034     guint32         vflags;
2035     guint32         nds_version;
2036     guint32         pflags; /* NDS Protocol Flags */
2037 } nds_val;
2040 /* Given an integer, fill in a nw_date_t struct. */
2041 static void
2042 uint_to_nwdate(guint data, nw_date_t *nwdate)
2044     nwdate->day   =  data & 0x001f;
2045     nwdate->month = (data & 0x01e0) >> 5;
2046     nwdate->year  = ((data & 0xfe00) >> 9) + 1980;
2049 /* Given an integer, fill in a nw_time_t struct. */
2050 static void
2051 uint_to_nwtime(guint data, nw_time_t *nwtime)
2053     /* 2-second resolution */
2054     nwtime->second = (data & 0x001f) * 2;
2055     nwtime->minute = ((data & 0x07e0) >> 5);
2056     nwtime->hour   = ((data & 0xf800) >> 11);
2059 static proto_item*
2060 padd_normal(ptvcursor_t *ptvc, const ptvc_record *rec)
2062     return
2063         ptvcursor_add(ptvc, *rec->hf_ptr,
2064                       rec->length,
2065                       rec->endianness ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
2068 static proto_item*
2069 padd_date(ptvcursor_t *ptvc, const ptvc_record *rec)
2071     proto_item  *item;
2072     nw_date_t   nw_date;
2074     item = ptvcursor_add(ptvc, *rec->hf_ptr,
2075                          rec->length,
2076                          rec->endianness ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
2078     if (item) {
2079         uint_to_nwdate(get_item_value(item), &nw_date);
2081         proto_item_set_text(item, "%s", get_item_name(item));
2082         proto_item_append_text(item, ": %04u/%02u/%02u",
2083                                nw_date.year, nw_date.month, nw_date.day);
2084     }
2085     return item;
2088 static proto_item*
2089 padd_time(ptvcursor_t *ptvc, const ptvc_record *rec)
2091     proto_item  *item;
2092     nw_time_t   nw_time;
2094     item = ptvcursor_add(ptvc, *rec->hf_ptr,
2095                          rec->length,
2096                          rec->endianness ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
2098     if (item) {
2099         uint_to_nwtime(get_item_value(item), &nw_time);
2101         proto_item_set_text(item, "%s", get_item_name(item));
2102         proto_item_append_text(item, ": %02u:%02u:%02u",
2103                                nw_time.hour, nw_time.minute, nw_time.second);
2104     }
2105     return item;
2109 /* Convert a string from little-endian unicode to ascii.  At the moment we
2110    fake it by taking every odd byte.  )-:  The caller must free the
2111    result returned. */
2112 /* XXX This prints the proto_item name, but not its value. */
2113 static proto_item*
2114 padd_uni(ptvcursor_t *ptvc, const ptvc_record *rec)
2116     proto_item      *item;
2117     /* nw_uni_t        nw_uni; */
2119     /* nw_uni.buffer[0] = '\0'; */
2121     item = ptvcursor_add(ptvc, *rec->hf_ptr,
2122                          rec->length,
2123                          rec->endianness ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
2125     if (item) {
2126         proto_item_set_text(item, "%s", get_item_name(item));
2127         /* proto_item_append_text(item, " %s",
2128            nw_uni.buffer); */
2129     }
2131     return item;
2134 /* Add a value for a ptvc_record, and process the sub-ptvc_record
2135  * that it points to. */
2136 static void
2137 process_bitfield_sub_ptvc_record(ptvcursor_t *ptvc, const ptvc_record *rec,
2138                                  gboolean really_decode)
2140     proto_item          *item;
2141     proto_tree          *sub_tree;
2142     const ptvc_record   *sub_rec;
2143     int                 current_offset;
2144     gint                ett;
2145     ptvcursor_t         *sub_ptvc;
2147     if (really_decode) {
2148         /* Save the current offset */
2149         current_offset = ptvcursor_current_offset(ptvc);
2151         /* Add the item */
2152         item = ptvcursor_add(ptvc, *rec->hf_ptr, rec->length,
2153                              rec->endianness ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
2155         ett = *rec->sub_ptvc_rec->ett;
2157         /* Make a new protocol sub-tree */
2158         sub_tree = proto_item_add_subtree(item, ett);
2160         /* Make a new ptvcursor */
2161         sub_ptvc = ptvcursor_new(sub_tree, ptvcursor_tvbuff(ptvc),
2162                                  current_offset);
2164         /* Use it */
2165         sub_rec = rec->sub_ptvc_rec->ptvc_rec;
2166         while(sub_rec->hf_ptr != NULL) {
2167             DISSECTOR_ASSERT(!sub_rec->sub_ptvc_rec);
2168             ptvcursor_add_no_advance(sub_ptvc, *sub_rec->hf_ptr,
2169                                      sub_rec->length,
2170                                      sub_rec->endianness ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
2171             sub_rec++;
2172         }
2174         /* Free it. */
2175         ptvcursor_free(sub_ptvc);
2176     }
2177     else {
2178         DISSECTOR_ASSERT(rec->length > 0 &&
2179                          proto_registrar_get_nth(*rec->hf_ptr)->type != FT_UINT_STRING);
2180         ptvcursor_advance(ptvc, rec->length);
2181     }
2184 /* Process a sub-ptvc_record that points to a "struct" ptvc_record. */
2185 static void
2186 process_struct_sub_ptvc_record(ptvcursor_t *ptvc, const ptvc_record *rec,
2187                                gboolean *req_cond_results, gboolean really_decode,
2188                                const ncp_record *ncp_rec)
2190     const ptvc_record   *sub_rec;
2191     gint                ett;
2192     proto_tree          *old_tree=NULL, *new_tree;
2193     proto_item          *item=NULL;
2194     gint                offset=0;
2196     /* Create a sub-proto_tree? */
2197     if (rec->sub_ptvc_rec->descr) {
2198         ett = *rec->sub_ptvc_rec->ett;
2199         old_tree = ptvcursor_tree(ptvc);
2200         offset = ptvcursor_current_offset(ptvc);
2201         item = proto_tree_add_text(old_tree, ptvcursor_tvbuff(ptvc),
2202                                    offset, PROTO_LENGTH_UNTIL_END, "%s",
2203                                    rec->sub_ptvc_rec->descr);
2204         new_tree = proto_item_add_subtree(item, ett);
2205         ptvcursor_set_tree(ptvc, new_tree);
2206     }
2208     /* Get the ptvc_record for the struct and call our caller
2209      * to process it. */
2210     sub_rec = rec->sub_ptvc_rec->ptvc_rec;
2211     process_ptvc_record(ptvc, sub_rec, req_cond_results, really_decode, ncp_rec);
2213     /* Re-set the tree */
2214     if (rec->sub_ptvc_rec->descr) {
2215         if (ptvcursor_current_offset(ptvc) <= offset)
2216             THROW(ReportedBoundsError);
2218         proto_item_set_len(item, ptvcursor_current_offset(ptvc) - offset);
2219         ptvcursor_set_tree(ptvc, old_tree);
2220     }
2223 /* Run through the table of ptvc_record's and add info to the tree. This
2224  * is the work-horse of process_ptvc_record(). */
2225 static void
2226 _process_ptvc_record(ptvcursor_t *ptvc, const ptvc_record *rec,
2227                      gboolean *req_cond_results, gboolean really_decode,
2228                      const ncp_record *ncp_rec)
2230     proto_item  *item;
2231     guint       i, repeat_count;
2232     padd_func_t func = NULL;
2234     if (rec->sub_ptvc_rec) {
2235         /* Repeat this? */
2236         if (rec->repeat_index >= NO_REPEAT) {
2237             if (rec->hf_ptr == PTVC_STRUCT) {
2238                 process_struct_sub_ptvc_record(ptvc, rec,
2239                                                req_cond_results, really_decode,
2240                                                ncp_rec);
2241             }
2242             else {
2243                 process_bitfield_sub_ptvc_record(ptvc, rec,
2244                                                  really_decode);
2245             }
2246         }
2247         else {
2248             repeat_count = repeat_vars[rec->repeat_index];
2249             for (i = 0; i < repeat_count; i++ ) {
2250                 if (rec->hf_ptr == PTVC_STRUCT) {
2251                     process_struct_sub_ptvc_record(ptvc, rec,
2252                                                    req_cond_results, really_decode,
2253                                                    ncp_rec);
2254                 }
2255                 else {
2256                     process_bitfield_sub_ptvc_record(ptvc, rec,
2257                                                      really_decode);
2258                 }
2259             }
2260         }
2261     }
2262     else {
2263         /* If we can't repeat this field, we might use it
2264          * to set a 'var'. */
2265         if (rec->repeat_index == NO_REPEAT) {
2266             if (really_decode) {
2267                 /* Handle any special formatting. */
2268                 switch(rec->special_fmt) {
2269                 case NCP_FMT_NONE:
2270                     func = padd_normal;
2271                     break;
2272                 case NCP_FMT_NW_DATE:
2273                     func = padd_date;
2274                     break;
2275                 case NCP_FMT_NW_TIME:
2276                     func = padd_time;
2277                     break;
2278                 case NCP_FMT_UNICODE:
2279                     func = padd_uni;
2280                     break;
2281                 default:
2282                     DISSECTOR_ASSERT_NOT_REACHED();
2283                 }
2284                 item = func(ptvc, rec);
2286                 /* Set the value as a 'var' ? */
2287                 if (rec->var_index != NO_VAR) {
2288                     repeat_vars[rec->var_index] = get_item_value(item);
2289                 }
2290             }
2291             else {
2292                 /* If we don't decode the field, we
2293                  * better not use the value to set a var.
2294                  * Actually, we could, as long as we don't
2295                  * *use* that var; for now keep this assert in
2296                  * place. */
2297                 DISSECTOR_ASSERT(rec->var_index == NO_VAR);
2299                 /* This had better not be variable-length,
2300                  * either. */
2301                 DISSECTOR_ASSERT(rec->length > 0 &&
2302                                  proto_registrar_get_nth(*rec->hf_ptr)->type != FT_UINT_STRING);
2303                 ptvcursor_advance(ptvc, rec->length);
2304             }
2305         }
2306         else {
2307             /* We do repeat this field. */
2308             repeat_count = repeat_vars[rec->repeat_index];
2309             if (really_decode) {
2310                 /* Handle any special formatting. */
2311                 switch(rec->special_fmt) {
2312                 case NCP_FMT_NONE:
2313                     func = padd_normal;
2314                     break;
2315                 case NCP_FMT_NW_DATE:
2316                     func = padd_date;
2317                     break;
2318                 case NCP_FMT_NW_TIME:
2319                     func = padd_time;
2320                     break;
2321                 case NCP_FMT_UNICODE:
2322                     func = padd_uni;
2323                     break;
2324                 default:
2325                     DISSECTOR_ASSERT_NOT_REACHED();
2326                 }
2327                 for (i = 0; i < repeat_count; i++ ) {
2328                     func(ptvc, rec);
2329                 }
2330             }
2331             else {
2332                 for (i = 0; i < repeat_count; i++ ) {
2333                     DISSECTOR_ASSERT(rec->length > 0 &&
2334                                      proto_registrar_get_nth(*rec->hf_ptr)->type != FT_UINT_STRING);
2335                     ptvcursor_advance(ptvc, rec->length);
2336                 }
2337             }
2338         }
2339     }
2342 /* Run through the table of ptvc_record's and add info to the tree.
2343  * Honor a request condition result. */
2344 static void
2345 process_ptvc_record(ptvcursor_t *ptvc, const ptvc_record *rec,
2346                     gboolean *req_cond_results, gboolean really_decode,
2347                     const ncp_record *ncp_rec)
2349     gboolean decode;
2351     while(rec->hf_ptr != NULL) {
2352         decode = really_decode;
2353         /* If we're supposed to decode, check the request condition
2354          * results to see if we should override this and *not* decode. */
2355         if (decode && req_cond_results) {
2356             if (rec->req_cond_index != NO_REQ_COND) {
2357                 if (req_cond_results[rec->req_cond_index] == FALSE) {
2358                     decode = FALSE;
2359                 }
2360             }
2361         }
2362         if (decode || ncp_rec->req_cond_size_type == REQ_COND_SIZE_CONSTANT) {
2363             _process_ptvc_record(ptvc, rec, req_cond_results, decode, ncp_rec);
2364         }
2365         rec++;
2366     }
2371 /* Clear the repeat_vars array. */
2372 static void
2373 clear_repeat_vars(void)
2375     guint i;
2377     for (i = 0 ; i < NUM_REPEAT_VARS; i++ ) {
2378         repeat_vars[i] = 0;
2379     }
2383 /* Given an error_equivalency table and a completion code, return
2384  * the string representing the error. */
2385 static const char*
2386 ncp_error_string(const error_equivalency *errors, guint8 completion_code)
2389     while (errors->ncp_error_index != -1) {
2390         if (errors->error_in_packet == completion_code) {
2391             return ncp_errors[errors->ncp_error_index];
2392         }
2393         errors++;
2394     }
2396     return "Unknown Error Code";
2399 static const ncp_record ncp1111_request =
2400 { 0x1, 0x00, NO_SUBFUNC, "Create Connection Service", NCP_GROUP_CONNECTION,
2401   NULL, NULL, ncp_0x2_errors, NULL, NO_REQ_COND_SIZE, NULL };
2403 static const ncp_record ncp5555_request =
2404 { 0x5, 0x00, NO_SUBFUNC, "Destroy Connection Service", NCP_GROUP_CONNECTION,
2405   NULL, NULL, ncp_0x2_errors, NULL, NO_REQ_COND_SIZE, NULL };
2407 static const ncp_record ncpbbbb_request =
2408 { 0xb, 0x00, NO_SUBFUNC, "Server Broadcast Message", NCP_GROUP_CONNECTION,
2409   NULL, NULL, ncp_0x2_errors, NULL, NO_REQ_COND_SIZE, NULL };
2411 static const ncp_record ncplip_echo =
2412 { 0x1f, 0x00, NO_SUBFUNC, "LIP Echo Packet", NCP_GROUP_CONNECTION,
2413   NULL, NULL, ncp_0x2_errors, NULL, NO_REQ_COND_SIZE, NULL };
2415 /* Wrapper around proto_tree_free() */
2416 static void free_proto_tree(void *tree)
2418     if (tree) {
2419         proto_tree_free((proto_tree*) tree);
2420     }
2423 static guint32
2424 align_4(tvbuff_t *tvb, guint32 aoffset)
2426     if(tvb_length_remaining(tvb, aoffset) > 4 )
2427     {
2428         return (aoffset%4);
2429     }
2430     return 0;
2433 static const char *
2434 get_string(tvbuff_t* tvb, guint offset, guint str_length)
2436     char *dest_buf;
2437     gint i;
2438     guint16 c_char;
2439     gint length_remaining = 0;
2440     gint max_length = (str_length < NW_UNI_MAX) ? str_length : NW_UNI_MAX;
2442     length_remaining = tvb_length_remaining(tvb, offset);
2443     if((gint)str_length > length_remaining)
2444     {
2445         THROW(ReportedBoundsError);
2446     }
2448     if(str_length == 0)
2449     {
2450         return "";
2451     }
2453     dest_buf = (char *)ep_alloc(max_length + 1);
2454     dest_buf[0] = '\0';
2456     for ( i = 0; i < (gint)str_length; i++ )
2457     {
2458         c_char = tvb_get_guint8(tvb, offset );
2459         if (c_char<0x20 || c_char>0x7e)
2460         {
2461             if (c_char != 0x00)
2462             {
2463                 c_char = '.';
2464                 dest_buf[i] = c_char & 0xff;
2465             }
2466             else
2467             {
2468                 i--;
2469                 str_length--;
2470             }
2471         }
2472         else
2473         {
2474             dest_buf[i] = c_char & 0xff;
2475         }
2476         offset++;
2477         length_remaining--;
2479         if(length_remaining==1)
2480         {
2481             dest_buf[i+1] = '\0';
2482             return dest_buf;
2483         }
2484         if (i >= 1023) { /* Don't process beyond the size of our variable */
2485             break;       /* If string is too long just return the first 1K. */
2486         }
2487     }
2488     if (i < 0) {
2489         i = 0;
2490     }
2491     dest_buf[i] = '\0';
2492     return dest_buf;
2495 static void
2496 uni_to_string(char * data, guint32 str_length, char *dest_buf)
2498     gint i;
2499     guint16 c_char;
2500     gint length_remaining = 0;
2502     length_remaining = str_length;
2503     dest_buf[0] = '\0';
2504     if(str_length == 0)
2505     {
2506         return;
2507     }
2508     for ( i = 0; i < (gint) str_length; i++ )
2509     {
2510         c_char = data[i];
2511         if (c_char<0x20 || c_char>0x7e)
2512         {
2513             if (c_char != 0x00)
2514             {
2515                 c_char = '.';
2516                 dest_buf[i] = c_char & 0xff;
2517             }
2518             else
2519             {
2520                 i--;
2521                 str_length--;
2522             }
2523         }
2524         else
2525         {
2526             dest_buf[i] = c_char & 0xff;
2527         }
2528         length_remaining--;
2530         if(length_remaining==0)
2531         {
2532             dest_buf[i+1] = '\0';
2533             return;
2534         }
2535     }
2536     if (i < 0) {
2537         i = 0;
2538     }
2539     dest_buf[i] = '\0';
2540     return;
2543 /*************************************
2544  * Return based on % format in request
2545  * %d = integer in decimal format = 0
2546  * %x = integer in hex format = 1
2547  * %s = string = 2
2548  **************************************/
2549 static int
2550 get_info_type(const gchar* check_string)
2552     guint length;
2553     guint i;
2555     length =  (guint) strlen(check_string);
2557     for (i = 0 ; i < length-1 ; i++ ) {
2558         if (check_string[i] == 0x25 && check_string[i+1] == 0x64) {   /* %d Digits*/
2559             return 0;
2560         }
2561         if ( check_string[i] == 0x78 && check_string[i+1] == 0x25 && check_string[i+2] == 0x73) {  /* x%s Bytes*/
2562             return 1;
2563         }
2564     }
2565     return 2; /* Normal String */
2568 static void
2569 process_bitfield(proto_tree *ncp_tree, tvbuff_t *tvb, nds_val *values)
2571     gchar        flags_str[512];
2572     const gchar *sep;
2573     proto_item  *tinew;
2574     proto_tree  *flags_tree;
2575     guint32      i;
2576     guint32      bvalue = 0;
2578     bvalue = 0x00000001;
2579     flags_str[0]='\0';
2580     sep="";
2581     for (i = 0 ; i < (values->vlength*8); i++ ) {
2582         if (values->vvalue & bvalue)
2583         {
2584             g_strlcat(flags_str, sep, 512);
2585             switch(bvalue){
2586             case 0x00000001:
2587                 g_strlcat(flags_str, values->bit1, 512);
2588                 break;
2589             case 0x00000002:
2590                 g_strlcat(flags_str, values->bit2, 512);
2591                 break;
2592             case 0x00000004:
2593                 g_strlcat(flags_str, values->bit3, 512);
2594                 break;
2595             case 0x00000008:
2596                 g_strlcat(flags_str, values->bit4, 512);
2597                 break;
2598             case 0x00000010:
2599                 g_strlcat(flags_str, values->bit5, 512);
2600                 break;
2601             case 0x00000020:
2602                 g_strlcat(flags_str, values->bit6, 512);
2603                 break;
2604             case 0x00000040:
2605                 g_strlcat(flags_str, values->bit7, 512);
2606                 break;
2607             case 0x00000080:
2608                 g_strlcat(flags_str, values->bit8, 512);
2609                 break;
2610             case 0x00000100:
2611                 g_strlcat(flags_str, values->bit9, 512);
2612                 break;
2613             case 0x00000200:
2614                 g_strlcat(flags_str, values->bit10, 512);
2615                 break;
2616             case 0x00000400:
2617                 g_strlcat(flags_str, values->bit11, 512);
2618                 break;
2619             case 0x00000800:
2620                 g_strlcat(flags_str, values->bit12, 512);
2621                 break;
2622             case 0x00001000:
2623                 g_strlcat(flags_str, values->bit13, 512);
2624                 break;
2625             case 0x00002000:
2626                 g_strlcat(flags_str, values->bit14, 512);
2627                 break;
2628             case 0x00004000:
2629                 g_strlcat(flags_str, values->bit15, 512);
2630                 break;
2631             case 0x00008000:
2632                 g_strlcat(flags_str, values->bit16, 512);
2633                 break;
2634             default:
2635                 break;
2636             }
2637             sep = ", ";
2638         }
2639         bvalue = bvalue*2;
2640     }
2641     if(values->vlength==4)
2642     {
2643         tinew = proto_tree_add_uint_format(ncp_tree, values->hfname,
2644                                            tvb, values->voffset, values->vlength, values->vvalue, "%s 0x%08x",
2645                                            values->vdesc, values->vvalue);
2646     }
2647     else
2648     {
2649         tinew = proto_tree_add_uint_format(ncp_tree, values->hfname,
2650                                            tvb, values->voffset, values->vlength, values->vvalue, "%s 0x%04x",
2651                                            values->vdesc, values->vvalue);
2652     }
2653     if (flags_str[0] != '\0')
2654         proto_item_append_text(tinew, " - (%s)", flags_str);
2656     flags_tree = proto_item_add_subtree(tinew, ett_nds);
2658     bvalue = 0x00000001;
2660     for (i = 0 ; i < (values->vlength*8); i++ ) {
2661         if (values->vvalue & bvalue)
2662         {
2663             switch(bvalue)
2664             {
2665             case 0x00000001:
2666                 proto_tree_add_item(flags_tree, values->bit1hfname, tvb, values->voffset, values->vlength, TRUE);
2667                 break;
2668             case 0x00000002:
2669                 proto_tree_add_item(flags_tree, values->bit2hfname, tvb, values->voffset, values->vlength, TRUE);
2670                 break;
2671             case 0x00000004:
2672                 proto_tree_add_item(flags_tree, values->bit3hfname, tvb, values->voffset, values->vlength, TRUE);
2673                 break;
2674             case 0x00000008:
2675                 proto_tree_add_item(flags_tree, values->bit4hfname, tvb, values->voffset, values->vlength, TRUE);
2676                 break;
2677             case 0x00000010:
2678                 proto_tree_add_item(flags_tree, values->bit5hfname, tvb, values->voffset, values->vlength, TRUE);
2679                 break;
2680             case 0x00000020:
2681                 proto_tree_add_item(flags_tree, values->bit6hfname, tvb, values->voffset, values->vlength, TRUE);
2682                 break;
2683             case 0x00000040:
2684                 proto_tree_add_item(flags_tree, values->bit7hfname, tvb, values->voffset, values->vlength, TRUE);
2685                 break;
2686             case 0x00000080:
2687                 proto_tree_add_item(flags_tree, values->bit8hfname, tvb, values->voffset, values->vlength, TRUE);
2688                 break;
2689             case 0x00000100:
2690                 proto_tree_add_item(flags_tree, values->bit9hfname, tvb, values->voffset, values->vlength, TRUE);
2691                 break;
2692             case 0x00000200:
2693                 proto_tree_add_item(flags_tree, values->bit10hfname, tvb, values->voffset, values->vlength, TRUE);
2694                 break;
2695             case 0x00000400:
2696                 proto_tree_add_item(flags_tree, values->bit11hfname, tvb, values->voffset, values->vlength, TRUE);
2697                 break;
2698             case 0x00000800:
2699                 proto_tree_add_item(flags_tree, values->bit12hfname, tvb, values->voffset, values->vlength, TRUE);
2700                 break;
2701             case 0x00001000:
2702                 proto_tree_add_item(flags_tree, values->bit13hfname, tvb, values->voffset, values->vlength, TRUE);
2703                 break;
2704             case 0x00002000:
2705                 proto_tree_add_item(flags_tree, values->bit14hfname, tvb, values->voffset, values->vlength, TRUE);
2706                 break;
2707             case 0x00004000:
2708                 proto_tree_add_item(flags_tree, values->bit15hfname, tvb, values->voffset, values->vlength, TRUE);
2709                 break;
2710             case 0x00008000:
2711                 proto_tree_add_item(flags_tree, values->bit16hfname, tvb, values->voffset, values->vlength, TRUE);
2712                 break;
2713             default:
2714                 break;
2715             }
2716         }
2717         bvalue = bvalue*2;
2718     }
2721 /* NCP data from python code can't be accessed directly. Parse the ncp tree and find the items
2722  * and their associated values. Store results in passed buffer.
2723  */
2724 static void
2725 build_expert_data(proto_tree *ncp_tree, const char *hf_name, char *buffer,
2726                   size_t buffer_size, int repeat_lookup,
2727                   gboolean search_structs)
2729     proto_tree     *tree_pointer;
2730     proto_tree     *tree_loc;
2731     proto_tree     *struct_tree_pointer = NULL;
2732     char            temp_buffer[256]="\0";
2733     gboolean        in_struct=FALSE;
2735     tree_loc = ncp_tree->first_child;
2736     for (tree_pointer=tree_loc; tree_pointer!=NULL; tree_pointer=tree_pointer->next)
2737     {
2738         /* We currently only go one structure deep in our search for values */
2739         if (tree_pointer->first_child && !in_struct && search_structs) {
2740             struct_tree_pointer = tree_pointer;
2741             tree_pointer = tree_pointer->first_child;
2742             in_struct=TRUE;
2743         }
2744         if (strcmp(PTREE_FINFO(tree_pointer)->hfinfo->abbrev, hf_name)==0)
2745         {
2746             switch (PTREE_FINFO(tree_pointer)->hfinfo->type)
2747             {
2748             case 3:                /* uint8 */
2749             case 4:                /* uint16 */
2750                 g_snprintf(buffer, (gulong) buffer_size, "%u", get_finfo_value_integer(PTREE_FINFO(tree_pointer)));
2751                 break;
2753             case 6:             /* uint32 */
2754                 g_snprintf(buffer, (gulong) buffer_size, "%08x", get_finfo_value_integer(PTREE_FINFO(tree_pointer)));
2755                 break;
2756             case 17:
2757             case 18:
2758             case 19:
2759             case 20:            /* string */
2760                 /* XXX: Should we verify: buffer_size is as large as value returned by get_finfo_length(...)  ???      */
2761                 uni_to_string(get_finfo_value_string(PTREE_FINFO(tree_pointer)), get_finfo_length(PTREE_FINFO(tree_pointer)), buffer);
2762                 if (repeat_lookup > 0) {
2763                     if (strlen(temp_buffer) + strlen(buffer) < 250) {
2764                         g_strlcat(temp_buffer, buffer, 256);
2765                         repeat_lookup--;
2766                         if (repeat_lookup == 0) {
2767                             g_strlcpy(buffer, temp_buffer, buffer_size);
2768                             break;
2769                         }
2770                         else
2771                         {
2772                             g_strlcat(temp_buffer, "/", 256);
2773                             break;
2774                         }
2775                     }
2776                     else
2777                     {
2778                         return;
2779                     }
2780                 }
2781                 else
2782                 {
2783                     break;
2784                 }
2785             case 21:
2786             case 22:             /* Bytes */
2787                 g_snprintf(buffer, (gulong) buffer_size, "%s", bytes_to_str(get_finfo_value_string(PTREE_FINFO(tree_pointer)), get_finfo_length(PTREE_FINFO(tree_pointer))));
2788                 break;
2789             default:             /* Dont currently handle. Only need string, integers, and bytes */
2790                 g_snprintf(buffer, (gulong) buffer_size, "Unsupported Expert Type");
2791                 return;
2792             }
2793             if (repeat_lookup ==0) {
2794                 break;
2795             }
2796         }
2797         if (tree_pointer->next==NULL && in_struct && search_structs) {
2798                 tree_pointer = struct_tree_pointer;
2799                 in_struct=FALSE;
2800         }
2801     }
2802     if (strlen(buffer)==0) {
2803         g_snprintf(buffer, (gulong) buffer_size, "No Value");
2804     }
2805     return;
2808 /* Some NCP data may be desirable to echo to the expert table.
2809  * But to extract we must have visability to the tree
2810  * This means that to extract the data we can only perform
2811  * this code path on the first dissection or a redissect.
2813  * Should the dissector store this info in memory so that
2814  * the data can be reported wihout a complete redissection?
2815  */
2816 static void
2817 trap_for_expert_event(proto_tree *ncp_tree, packet_info *pinfo, const ncp_record *ncp_rec, int request_reply)
2819     if (ncp_rec == NULL)
2820         return;
2821     /* Request == 0, Reply == 1 */
2822     if (request_reply==0) {
2823         if (ncp_echo_file) {
2824             /* The following allows for Update file handle rights echoed to expert tap. */
2825             if (ncp_rec->func == 66) {
2826                 char p_filehandle[15]="\0";
2828                 build_expert_data(ncp_tree, "ncp.file_handle", p_filehandle,
2829                                   sizeof p_filehandle, 0, FALSE);
2831                 expert_add_info_format(pinfo, NULL, &ei_ncp_file_handle, "Close file handle %s", p_filehandle);
2832             }
2833             /* The following allows for oplock level 1 file opens echoed to expert tap. */
2834             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)) {
2835                 char oaction[3]="\0";
2836                 char p_filename[256]="\0";
2837                 char p_rights[3]="\0";
2838                 char p_path_count[3]="\0";
2840                 build_expert_data(ncp_tree, "ncp.open_create_mode", oaction,
2841                                   sizeof oaction, 0, FALSE);
2842                 build_expert_data(ncp_tree, "ncp.desired_access_rights",
2843                                   p_rights, sizeof p_rights, 0, FALSE);
2844                 build_expert_data(ncp_tree, "ncp.path_count", p_path_count,
2845                                   sizeof p_path_count, 0, FALSE);
2847                 if (ncp_rec->func == 87) {
2848                     build_expert_data(ncp_tree, "ncp.path", p_filename,
2849                                       sizeof p_filename,  atoi(p_path_count),
2850                                       FALSE);
2851                 }
2852                 else
2853                 {
2854                     build_expert_data(ncp_tree, "ncp.path16", p_filename,
2855                                       sizeof p_filename,  atoi(p_path_count),
2856                                       FALSE);
2857                 }
2859                 expert_add_info_format(pinfo, NULL, &ei_ncp_file_rights,
2860                                        val_to_str((guint32)(strtoul(oaction, NULL, 16) & 0xeb), open_create_mode_vals, "Unknown: %d"),
2861                                        p_filename,
2862                                        val_to_str((atoi(p_rights) & 0x5f), ncp_rights_vals, "Unknown: %d"));
2863             }
2864             /* The following allows for oplock ack's and level 2 request echoed to expert tap. */
2865             if (ncp_rec->func == 87 && ncp_rec->subfunc == 34) {
2866                 char cc_function[3]="\0";
2867                 char p_filehandle[15]="\0";
2869                 build_expert_data(ncp_tree, "ncp.cc_file_handle",
2870                                   p_filehandle, sizeof p_filehandle, 0, FALSE);
2871                 build_expert_data(ncp_tree, "ncp.cc_function",
2872                                   cc_function, sizeof cc_function, 0, FALSE);
2874                 expert_add_info_format(pinfo, NULL, &ei_ncp_op_lock_handle, "Op-lock on handle %s - %s", p_filehandle,
2875                                        val_to_str(atoi(cc_function), ncp_cc_function_vals, "Unknown: %d"));
2876             }
2877             /* The following allows for Update file handle rights echoed to expert tap. */
2878             if (ncp_rec->func == 87 && ncp_rec->subfunc == 44) {
2879                 char p_rights[20]="\0";
2880                 char n_rights[20]="\0";
2881                 char p_filehandle[15]="\0";
2883                 build_expert_data(ncp_tree, "ncp.file_handle",
2884                                   p_filehandle, sizeof p_filehandle, 0, FALSE);
2885                 build_expert_data(ncp_tree, "ncp.access_rights_mask_word",
2886                                   p_rights, sizeof p_rights, 0, FALSE);
2887                 build_expert_data(ncp_tree, "ncp.new_access_rights_mask",
2888                                   n_rights, sizeof n_rights, 0, FALSE);
2889                 expert_add_info_format(pinfo, NULL, &ei_ncp_file_rights_change, "Change handle %s rights from:(%s) to:(%s)",
2890                                        p_filehandle,
2891                                        val_to_str((atoi(p_rights) & 0x1ff), access_rights_vals, "Unknown: %d"),
2892                                        val_to_str((atoi(n_rights) & 0x1ff), access_rights_vals, "Unknown: %d"));
2893             }
2894         }
2895     }
2896     else
2897     {
2899         if (ncp_echo_file) { /* Echo File System Data */
2900             /* The following allows for oplock level 1 file opens echoed to expert tap. */
2901             if ((ncp_rec->func == 89 || ncp_rec->func == 87) && (ncp_rec->subfunc == 32 || ncp_rec->subfunc == 1)) {
2902                 char oaction[3]="\0";
2903                 char oplockflg[3]="\0";
2904                 char p_filehandle[15]="\0";
2906                 build_expert_data(ncp_tree, "ncp.open_create_action",
2907                                   oaction, sizeof oaction, 0, FALSE);
2908                 build_expert_data(ncp_tree, "ncp.file_handle",
2909                                   p_filehandle, sizeof p_filehandle, 0, FALSE);
2911                 if (ncp_rec->subfunc == 1) {
2912                     expert_add_info_format(pinfo, NULL, &ei_ncp_file_handle, "%s - File handle %s",
2913                                            val_to_str((atoi(oaction) & 0x8f), open_create_action_vals, "Unknown: %d"),
2914                                            p_filehandle);
2915                 }
2916                 else
2917                 {
2918                     build_expert_data(ncp_tree, "ncp.o_c_ret_flags",
2919                                       oplockflg, sizeof oplockflg, 0, FALSE);
2920                     expert_add_info_format(pinfo, NULL, &ei_ncp_file_handle, "%s - File handle %s, %s",
2921                                            val_to_str((atoi(oaction) & 0x8f), open_create_action_vals, "Unknown: %d"),
2922                                            p_filehandle,
2923                                            val_to_str(atoi(oplockflg), ncp_o_c_ret_flags_vals, "Unknown: %d"));
2924                 }
2925             }
2926             /* The following allows for Update file handle rights echoed to expert tap. */
2927             if (ncp_rec->func == 87 && ncp_rec->subfunc == 44) {
2928                 char p_rights[20]="\0";
2929                 char p_filehandle[15]="\0";
2931                 build_expert_data(ncp_tree, "ncp.file_handle",
2932                                   p_filehandle, sizeof p_filehandle, 0, FALSE);
2933                 build_expert_data(ncp_tree, "ncp.effective_rights",
2934                                   p_rights, sizeof p_rights, 0, FALSE);
2935                 expert_add_info_format(pinfo, NULL, &ei_ncp_effective_rights, "Handle %s effective rights:(%s)", p_filehandle,
2936                                        val_to_str((atoi(p_rights) & 0x1ff), access_rights_vals, "Unknown: %d"));
2937             }
2938         }
2939         /* The following allows for specific NCP server info to be echoed to the expert tap. */
2940         if (ncp_rec->func == 23 && ncp_rec->subfunc == 17 && ncp_echo_server) {
2941             char fsname[50]="\0";
2942             char p_maj_ver[3]="\0";
2943             char p_min_ver[3]="\0";
2944             char p_rev[3]="\0";
2945             char p_lang[3]="\0";
2946                         char p_serv_type[3]="\0";
2947                         char p_kernel[3]="\0";
2949             /* Get Server name and version info */
2950             build_expert_data(ncp_tree, "ncp.server_name",
2951                               fsname, sizeof fsname, 0, FALSE);
2952             build_expert_data(ncp_tree, "ncp.product_major_version",
2953                               p_maj_ver, sizeof p_maj_ver, 0, FALSE);
2954             build_expert_data(ncp_tree, "ncp.product_minor_version",
2955                               p_min_ver, sizeof p_min_ver, 0, FALSE);
2956             build_expert_data(ncp_tree, "ncp.product_revision_version",
2957                               p_rev, sizeof p_rev, 0, FALSE);
2958             build_expert_data(ncp_tree, "ncp.os_language_id",
2959                               p_lang, sizeof p_lang, 0, FALSE);
2960             build_expert_data(ncp_tree, "ncp.oes_server",
2961                               p_serv_type, sizeof p_serv_type, 0, FALSE);
2962             build_expert_data(ncp_tree, "ncp.oeslinux_or_netware",
2963                               p_kernel, sizeof p_kernel, 0, FALSE);
2965             expert_add_info_format(pinfo, NULL, &ei_ncp_server, "Server %s, version %s.%s, support pack %s, language %s, server type %s, kernel %s", fsname,
2966                                    p_maj_ver, p_min_ver, p_rev, p_lang, val_to_str((atoi(p_serv_type) & 0x01), serv_type_vals, "Unknown: %d"), val_to_str((atoi(p_kernel) & 0x01), kernel_type_vals, "Unknown: %d") );
2967         }
2968     }
2972 static void
2973 print_nds_values(proto_tree *vtree, tvbuff_t *tvb, guint32 syntax_type, nds_val *vvalues)
2975     guint32         value1 = 0;
2976     guint32         value2 = 0;
2977     guint32         value3 = 0;
2978     guint32         value4 = 0;
2979     guint32         value5 = 0;
2980     guint32         voffset = 0, oldvoffset;
2981     guint32         icounter;
2982     guint32         number_of_values = 0;
2983     guint32         number_of_items = 0;
2984     guint32         r;
2985     proto_item      *vitem;
2986     proto_tree      *nvtree;
2987     proto_item      *aditem;
2988     proto_tree      *adtree;
2989     const char      *valuestr = NULL;
2990     guint16         rtype = 0;
2991     guint16         rstate = 0;
2992     guint16         rnum = 0;
2993     guint16         revent = 0;
2994     gint            length_remaining;
2995     nstime_t        ns;
2996     gboolean        entry_rights = FALSE;
2997     nds_val         temp_values;
2999     voffset = vvalues->voffset;
3000 #if 0
3001     if(tvb_get_guint8(tvb, voffset) == 0x00)
3002     {
3003         voffset = voffset+2;
3004     }
3005 #endif
3007     number_of_values = tvb_get_letohl(tvb, voffset);
3009     vitem = proto_tree_add_uint_format(vtree, hf_nds_uint32value, tvb, voffset,
3010                                        4, number_of_values, "Number of Values: %u", number_of_values);
3012     nvtree = proto_item_add_subtree(vitem, ett_nds);
3014     oldvoffset = voffset;
3015     voffset = voffset + 4;
3017     for (icounter = 1 ; icounter <= number_of_values; icounter++ )
3018     {
3019         if (oldvoffset >= voffset) {
3020             proto_tree_add_text(nvtree, tvb, 0, 0, "[ Invalid offset: %u ]", voffset);
3021             THROW(ReportedBoundsError);
3022         }
3023         oldvoffset = voffset;
3024         switch(syntax_type)
3025         {
3026         case 0x00000006:        /* Case Insensitive List */
3027         case 0x00000012:        /* Postal Address */
3028             voffset += align_4(tvb, voffset);
3029             voffset = voffset+4;
3030             number_of_items = tvb_get_letohl(tvb, voffset);
3031             voffset = voffset+4;
3032             for (r=1; r<=number_of_items; r++)
3033             {
3034                 value1 = tvb_get_letohl(tvb, voffset);
3035                 voffset = voffset + 4;
3036                 vvalues->vstring = get_string(tvb, voffset, value1);
3037                 proto_tree_add_string(nvtree, hf_value_string, tvb, voffset,
3038                                       value1, vvalues->vstring);
3039                 voffset = voffset + value1;
3040                 voffset += align_4(tvb, voffset);
3041             }
3042             break;
3043         case 0x00000007:        /* Boolean */
3044             voffset+=4;                            /* this is always just a parameter count of 1, so ignore */
3045             value1 = tvb_get_guint8(tvb, voffset); /* Boolean value */
3046             if (value1==0)
3047             {
3048                 vvalues->vstring = "False";
3049             }
3050             else
3051             {
3052                 vvalues->vstring = "True";
3053             }
3054             tvb_ensure_bytes_exist(tvb, voffset, 1);
3055             proto_tree_add_string(nvtree, hf_value_string, tvb, voffset,
3056                                   1, vvalues->vstring);
3057             voffset=voffset+1;
3058             voffset += align_4(tvb, voffset);
3059             break;
3060         case 0x00000009:        /* Binary String */
3061             value1 = tvb_get_letohl(tvb, voffset); /* length of field */
3062             length_remaining = tvb_length_remaining(tvb, voffset);
3063             if(length_remaining == -1 || value1 > (guint32) length_remaining)
3064             {
3065                 break;
3066             }
3067             voffset += 4;
3068             tvb_ensure_bytes_exist(tvb, voffset, value1);
3069             proto_tree_add_bytes(nvtree, hf_value_bytes, tvb, voffset, value1, tvb_get_ptr(tvb, voffset, value1));
3070             voffset += value1;
3071             voffset += (value1%2);
3072             break;
3073         case 0x0000000d:        /* Binary String List */
3074             value1 = tvb_get_letohl(tvb, voffset); /* Overall length of field list */
3075             length_remaining = tvb_length_remaining(tvb, voffset);
3076             if(length_remaining == -1 || value1 > (guint32) length_remaining)
3077             {
3078                 break;
3079             }
3080             voffset += 4;
3081             tvb_ensure_bytes_exist(tvb, voffset, value1);
3082             number_of_items = tvb_get_letohl(tvb, voffset);
3083             voffset = voffset+4;
3084             for (r=1; r<=number_of_items; r++)
3085             {
3086                 value1 = tvb_get_letohl(tvb, voffset); /* length of field */
3087                 length_remaining = tvb_length_remaining(tvb, voffset);
3088                 if(length_remaining == -1 || value1 > (guint32) length_remaining)
3089                 {
3090                     break;
3091                 }
3092                 voffset += 4;
3093                 tvb_ensure_bytes_exist(tvb, voffset, value1);
3094                 proto_tree_add_bytes(nvtree, hf_value_bytes, tvb, voffset, value1, tvb_get_ptr(tvb, voffset, value1));
3095                 voffset += value1;
3096                 voffset += (value1%2);
3097             }
3098             break;
3099         case 0x00000015:        /* Stream */
3100             value1 = tvb_get_letohl(tvb, voffset); /* length of field */
3101             length_remaining = tvb_length_remaining(tvb, voffset);
3102             if(length_remaining == -1 || value1 > (guint32) length_remaining)
3103             {
3104                 break;
3105             }
3106             proto_tree_add_text(nvtree, tvb, voffset, 4, "No value, Open stream file for data.");
3107             voffset += 4;
3108             voffset += value1;
3109             voffset += (value1%2);
3110             break;
3111         case 0x00000008:        /* Signed Integer */
3112         case 0x00000016:        /* Counter */
3113         case 0x0000001b:        /* Interval */
3114             value1 = tvb_get_letohl(tvb, voffset); /* length of field */
3115             voffset = voffset+4;
3116             value2 = tvb_get_letohl(tvb, voffset); /* Value */
3117             tvb_ensure_bytes_exist(tvb, voffset, value1);
3118             if (strcmp(vvalues->vstring, "zendmSearchType")==0) {
3119                 proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
3120                                            value1, value2,
3121                                            "Value (%d) = %s", value2,
3122                                            val_to_str(value2, zensearchenum, "Unknown: %d"));
3123             }
3124             else
3125             {
3126                 proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
3127                                            value1, value2, "Value %d", value2);
3128             }
3129             voffset = voffset+4;
3130             break;
3131         case 0x0000000b:        /* Fax Number */
3132             value1 = tvb_get_letohl(tvb, voffset); /* length of field */
3133             voffset = voffset+4;
3134             vvalues->vstring = get_string(tvb, voffset, value1);
3135             proto_tree_add_string(nvtree, hf_value_string, tvb, voffset,
3136                                   value1, vvalues->vstring);
3137             voffset = voffset + value1;
3138             voffset += align_4(tvb, voffset);
3139             break;
3140         case 0x0000000c:        /* Network Address */
3141             value1 = tvb_get_letohl(tvb, voffset); /* length of field */
3142             voffset = voffset + 4;
3143             value2 = tvb_get_letohl(tvb, voffset); /* type of Protocol */
3144             valuestr = val_to_str_const(value2, nds_protocol_type, "(Undefined Protocol)");
3145             tvb_ensure_bytes_exist(tvb, voffset, value1);
3146             proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
3147                                        value1, value2, valuestr, value2);
3148             voffset = voffset+4;
3149             value3 = tvb_get_letohl(tvb, voffset); /* length of address */
3150             voffset = voffset+4;
3151             switch (value2)
3152             {
3153             case NDS_PTYPE_IPX:
3154                 proto_tree_add_item(nvtree, hf_nds_net, tvb, voffset, 4, FALSE);
3155                 proto_tree_add_item(nvtree, hf_nds_node, tvb, voffset+4, 6, FALSE);
3156                 proto_tree_add_item(nvtree, hf_nds_socket, tvb, voffset+10, 2, FALSE);
3157                 break;
3158             case NDS_PTYPE_IP:
3159                 if (value3 > 4) {
3160                     proto_tree_add_item(nvtree, hf_nds_port, tvb, voffset, 2, FALSE);
3161                     voffset += 2;
3162                 }
3163                 proto_tree_add_item(nvtree, hf_add_ref_ip, tvb, voffset, 4, FALSE);
3164                 break;
3165             case NDS_PTYPE_UDP:
3166                 if (value3 > 4) {
3167                     proto_tree_add_item(nvtree, hf_nds_port, tvb, voffset, 2, FALSE);
3168                     voffset += 2;
3169                 }
3170                 proto_tree_add_item(nvtree, hf_add_ref_udp, tvb, voffset, 4, FALSE);
3171                 break;
3172             case NDS_PTYPE_TCP:
3173                 proto_tree_add_item(nvtree, hf_nds_port, tvb, voffset, 2, FALSE);
3174                 proto_tree_add_item(nvtree, hf_add_ref_tcp, tvb, voffset+2, 4, FALSE);
3175                 break;
3176             case NDS_PTYPE_URL:
3177             case NDS_PTYPE_DNS:
3178                 vvalues->vstring = get_string(tvb, voffset, value3);
3179                 proto_tree_add_string(nvtree, hf_value_string, tvb, voffset,
3180                                       value3, vvalues->vstring);
3181                 break;
3182             default:
3183                 break;
3184             }
3185             voffset = voffset + value3;
3186             voffset += align_4(tvb, voffset);
3187             break;
3188         case 0x0000000f:        /* File System Path */
3189             value1 = tvb_get_letohl(tvb, voffset); /* length of field */
3190             voffset = voffset + 4;
3191             value2 = tvb_get_letohl(tvb, voffset); /* Name Space */
3192             valuestr = val_to_str_const(value2, name_space_type, "Unknown Name Space");
3193             proto_tree_add_string(nvtree, hf_value_string, tvb, voffset,
3194                                   4, valuestr);
3195             voffset = voffset+4;
3196             value3 = tvb_get_letohl(tvb, voffset); /* Length of Volume name */
3197             voffset = voffset+4;
3198             vvalues->vstring = get_string(tvb, voffset, value3);
3199             proto_tree_add_string(nvtree, hf_value_string, tvb, voffset,
3200                                   value3, vvalues->vstring);
3201             voffset = voffset+value3;
3202             voffset += align_4(tvb, voffset);
3203             value4 = tvb_get_letohl(tvb, voffset); /* Length of Path name */
3204             voffset = voffset+4;
3205             vvalues->vstring = get_string(tvb, voffset, value4);
3206             proto_tree_add_string(nvtree, hf_value_string, tvb, voffset,
3207                                   value4, vvalues->vstring);
3208             voffset = voffset+value4;
3209             voffset += align_4(tvb, voffset);
3210             break;
3211         case 0x00000010:        /* Replica Pointer */
3212             value1 = tvb_get_letohl(tvb, voffset); /* length of field */
3213             voffset = voffset + 4;
3214             value2 = tvb_get_letohl(tvb, voffset); /* Length of Server name */
3215             voffset = voffset+4;
3216             vvalues->vstring = get_string(tvb, voffset, value2);
3217             proto_tree_add_string(nvtree, hf_value_string, tvb, voffset,
3218                                   value2, vvalues->vstring);
3219             voffset = voffset+value2;
3220             voffset += align_4(tvb, voffset);
3221             rtype = tvb_get_letohs(tvb, voffset); /* replica type */
3222             valuestr = val_to_str_const(rtype, nds_replica_type, "(Unknown Replica Type)");
3223             proto_tree_add_string(nvtree, hf_replica_type, tvb, voffset,
3224                                   2, valuestr);
3225             voffset = voffset+2;
3226             rstate = tvb_get_letohs(tvb, voffset); /* replica state */
3227             valuestr = val_to_str_const(rstate, nds_replica_state, "(Unknown Replica State)");
3228             proto_tree_add_string(nvtree, hf_replica_state, tvb, voffset,
3229                                   2, valuestr);
3230             voffset = voffset+2;
3231             value3 = tvb_get_letohl(tvb, voffset); /* Replica number */
3232             proto_tree_add_uint_format(nvtree, hf_replica_number, tvb, voffset,
3233                                        4, value3, "Replica Number %d", value3);
3234             voffset = voffset+4;
3235             if((vvalues->pflags & 0x8000) | (vvalues->pflags & 0x4000))
3236             {
3237                 /* If this request flag is set then this is a server. Server structures
3238                  * include the RootID as part of the replica data. */
3239                 proto_tree_add_item(nvtree, hf_nds_partition_root_id, tvb, voffset, 4, FALSE);
3240                 voffset += 4;
3241             }
3242             number_of_items = tvb_get_letohl(tvb, voffset);  /* Number of Addresses */
3243             aditem = proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
3244                                                 4, number_of_items, "Number of Addresses: %u", number_of_items);
3246             adtree = proto_item_add_subtree(aditem, ett_nds);
3247             voffset = voffset+4;
3248             for (r=1; r <= number_of_items; r++)
3249             {
3250                 /* Trap for end of packet */
3251                 if(tvb_length_remaining(tvb, voffset)<12)
3252                 {
3253                     THROW(ReportedBoundsError);
3254                 }
3255                 voffset += align_4(tvb, voffset);
3256                 value4 = tvb_get_letohl(tvb, voffset); /* type of Protocol */
3257                 valuestr = val_to_str_const(value4, nds_protocol_type, "(Undefined Protocol)");
3258                 proto_tree_add_uint_format(adtree, hf_nds_uint32value, tvb, voffset,
3259                                            4, value4, valuestr, value4);
3260                 voffset = voffset+4;
3261                 value5 = tvb_get_letohl(tvb, voffset); /* length of address */
3262                 voffset = voffset+4;
3263                 switch (value4)
3264                 {
3265                 case NDS_PTYPE_IPX:
3266                     proto_tree_add_item(adtree, hf_nds_net, tvb, voffset, 4, FALSE);
3267                     proto_tree_add_item(adtree, hf_nds_node, tvb, voffset+4, 6, FALSE);
3268                     proto_tree_add_item(adtree, hf_nds_socket, tvb, voffset+10, 2, FALSE);
3269                     break;
3270                 case NDS_PTYPE_IP:
3271                     proto_tree_add_item(adtree, hf_nds_port, tvb, voffset, 2, FALSE);
3272                     proto_tree_add_item(adtree, hf_add_ref_ip, tvb, voffset+2, 4, FALSE);
3273                     break;
3274                 case NDS_PTYPE_UDP:
3275                     proto_tree_add_item(adtree, hf_nds_port, tvb, voffset, 2, FALSE);
3276                     proto_tree_add_item(adtree, hf_add_ref_udp, tvb, voffset+2, 4, FALSE);
3277                     break;
3278                 case NDS_PTYPE_TCP:
3279                     proto_tree_add_item(adtree, hf_nds_port, tvb, voffset, 2, FALSE);
3280                     proto_tree_add_item(adtree, hf_add_ref_tcp, tvb, voffset+2, 4, FALSE);
3281                     break;
3282                 case NDS_PTYPE_URL:
3283                 case NDS_PTYPE_DNS:
3284                     vvalues->vstring = get_string(tvb, voffset, value5);
3285                     proto_tree_add_string(adtree, hf_value_string, tvb, voffset,
3286                                           value5, vvalues->vstring);
3287                     break;
3288                 default:
3289                     break;
3290                 }
3291                 voffset = voffset + value5;
3292             }
3293             voffset += align_4(tvb, voffset);
3294             break;
3295         case 0x00000011:        /* Object ACL */
3296             value1 = tvb_get_letohl(tvb, voffset); /* Length of Field */
3297             voffset = voffset + 4;
3298             value2 = tvb_get_letohl(tvb, voffset);
3299             voffset = voffset + 4;
3300             vvalues->vstring = get_string(tvb, voffset, value2); /* Unicode String */
3301             proto_tree_add_string(nvtree, hf_value_string, tvb, voffset,
3302                                   value2, vvalues->vstring);
3303             if (strcmp(vvalues->vstring, "[Entry Rights]")) {
3304                 entry_rights=TRUE;
3305             }
3306             else
3307             {
3308                 entry_rights=FALSE;
3309             }
3310             voffset = voffset + value2;
3311             voffset += align_4(tvb, voffset);
3312             value3 = tvb_get_letohl(tvb, voffset);
3313             voffset = voffset + 4;
3314             vvalues->vstring = get_string(tvb, voffset, value3); /* Unicode Subject Name */
3315             proto_tree_add_string(nvtree, hf_value_string, tvb, voffset,
3316                                   value3, vvalues->vstring);
3317             voffset = voffset + value3;
3318             voffset += align_4(tvb, voffset);
3319             temp_values.vvalue = tvb_get_letohl(tvb, voffset); /* Entry or Attribute Privileges */
3320             temp_values.vlength = 2;
3321             temp_values.hfname = hf_nds_vflags;
3322             temp_values.voffset = voffset;
3323             temp_values.vdesc = "Privileges";
3324             if (entry_rights) {
3325                 /* if Entries then use these bits */
3326                 temp_values.bit1 = "Compare Attributes";
3327                 temp_values.bit1hfname = hf_nds_compare_attributes;
3328                 temp_values.bit2 = "Read Attribute";
3329                 temp_values.bit2hfname = hf_nds_read_attribute;
3330                 temp_values.bit3 = "Write, Add, Delete Attribute";
3331                 temp_values.bit3hfname = hf_nds_write_add_delete_attribute;
3332                 temp_values.bit4 = "Add/Delete Self";
3333                 temp_values.bit4hfname = hf_nds_add_delete_self;
3334                 temp_values.bit5 = "Attribute Privilege Not Defined";
3335                 temp_values.bit5hfname = hf_nds_privilege_not_defined;
3336                 temp_values.bit6 = "Supervisor";
3337                 temp_values.bit6hfname = hf_nds_supervisor;
3338                 temp_values.bit7 = "Inheritance Control";
3339                 temp_values.bit7hfname = hf_nds_inheritance_control;
3340                 temp_values.bit8 = "Not Defined";
3341                 temp_values.bit8hfname = hf_bit8vflags;
3342                 temp_values.bit9 = "Not Defined";
3343                 temp_values.bit9hfname = hf_bit9vflags;
3344                 temp_values.bit10 = "Not Defined";
3345                 temp_values.bit10hfname = hf_bit10vflags;
3346                 temp_values.bit11 = "Not Defined";
3347                 temp_values.bit11hfname = hf_bit11vflags;
3348                 temp_values.bit12 = "Not Defined";
3349                 temp_values.bit12hfname = hf_bit12vflags;
3350                 temp_values.bit13 = "Not Defined";
3351                 temp_values.bit13hfname = hf_bit13vflags;
3352                 temp_values.bit14 = "Not Defined";
3353                 temp_values.bit14hfname = hf_bit14vflags;
3354                 temp_values.bit15 = "Not Defined";
3355                 temp_values.bit15hfname = hf_bit15vflags;
3356                 temp_values.bit16 = "Not Defined";
3357                 temp_values.bit16hfname = hf_bit16vflags;
3358             }
3359             else
3360             {
3361                 /* if attribute rights then do these bits */
3362                 temp_values.bit1 = "Browse";
3363                 temp_values.bit1hfname = hf_nds_browse_entry;
3364                 temp_values.bit2 = "Add";
3365                 temp_values.bit2hfname = hf_nds_add_entry;
3366                 temp_values.bit3 = "Delete";
3367                 temp_values.bit3hfname = hf_nds_delete_entry;
3368                 temp_values.bit4 = "Rename";
3369                 temp_values.bit4hfname = hf_nds_rename_entry;
3370                 temp_values.bit5 = "Supervisor";
3371                 temp_values.bit5hfname = hf_nds_supervisor_entry;
3372                 temp_values.bit6 = "Entry Privilege Not Defined";
3373                 temp_values.bit6hfname = hf_nds_entry_privilege_not_defined;
3374                 temp_values.bit7 = "Inheritance Control";
3375                 temp_values.bit7hfname = hf_nds_inheritance_control;
3376                 temp_values.bit8 = "Not Defined";
3377                 temp_values.bit8hfname = hf_bit8vflags;
3378                 temp_values.bit9 = "Not Defined";
3379                 temp_values.bit9hfname = hf_bit9vflags;
3380                 temp_values.bit10 = "Not Defined";
3381                 temp_values.bit10hfname = hf_bit10vflags;
3382                 temp_values.bit11 = "Not Defined";
3383                 temp_values.bit11hfname = hf_bit11vflags;
3384                 temp_values.bit12 = "Not Defined";
3385                 temp_values.bit12hfname = hf_bit12vflags;
3386                 temp_values.bit13 = "Not Defined";
3387                 temp_values.bit13hfname = hf_bit13vflags;
3388                 temp_values.bit14 = "Not Defined";
3389                 temp_values.bit14hfname = hf_bit14vflags;
3390                 temp_values.bit15 = "Not Defined";
3391                 temp_values.bit15hfname = hf_bit15vflags;
3392                 temp_values.bit16 = "Not Defined";
3393                 temp_values.bit16hfname = hf_bit16vflags;
3394             }
3395             process_bitfield(nvtree, tvb, &temp_values);
3396             voffset = voffset+4;
3397             voffset += align_4(tvb, voffset);
3398             break;
3399         case 0x00000013:        /* Time Stamp */
3400             value1 = tvb_get_letohl(tvb, voffset);         /* Seconds */
3401             proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
3402                                        4, value1, "Length of Record: %u", value1);
3403             voffset = voffset+4;
3404             ns.secs = tvb_get_letohl(tvb, voffset);
3405             ns.nsecs = 0;
3406             proto_tree_add_time_format(nvtree, hf_nds_ds_time, tvb, voffset, 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
3407             voffset = voffset + 4;
3408             rnum = tvb_get_letohs(tvb, voffset); /* replica number */
3409             proto_tree_add_uint_format(nvtree, hf_nds_rnum, tvb, voffset,
3410                                        2, rnum, "Replica Number: %d", rnum);
3411             voffset = voffset+2;
3412             revent = tvb_get_letohs(tvb, voffset); /* Event */
3413             proto_tree_add_uint_format(nvtree, hf_nds_revent, tvb, voffset,
3414                                        2, revent, "Event: %d", revent);
3415             voffset = voffset+2;
3416             voffset += align_4(tvb, voffset);
3417             break;
3418         case 0x00000017:        /* Back Link */
3419             value1 = tvb_get_letohl(tvb, voffset);         /* Length */
3420             proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
3421                                        4, value1, "Length of Record %08x", value1);
3422             voffset = voffset+4;
3423             value2 = tvb_get_letohl(tvb, voffset);         /* Remote ID */
3424             proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
3425                                        4, value2, "Remote ID %08x", value2);
3426             voffset = voffset+4;
3427             value3 = tvb_get_letohl(tvb, voffset);         /* Length of string */
3428             voffset = voffset+4;
3429             vvalues->vstring = get_string(tvb, voffset, value3);
3430             proto_tree_add_string_format(nvtree, hf_value_string, tvb, voffset,
3431                                          value3, vvalues->vstring,
3432                                          "Server Distinguished Name - %s", vvalues->vstring);
3433             voffset = voffset+value3;
3434             voffset += align_4(tvb, voffset);
3435             break;
3436         case 0x00000018:        /* Time */
3437             voffset += 4; /* This is the length of the time data no need to decode, always 4 bytes */
3438             ns.secs = tvb_get_letohl(tvb, voffset);
3439             ns.nsecs = 0;
3440             proto_tree_add_time_format(nvtree, hf_nds_ds_time, tvb, voffset, 4, &ns, "Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
3441             voffset = voffset + 4;
3442             break;
3443         case 0x00000019:        /* Typed Name */
3444             value1 = tvb_get_letohl(tvb, voffset);         /* Length */
3445             proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
3446                                        4, value1, "Length of Record %08x", value1);
3447             voffset = voffset+4;
3448             value2 = tvb_get_letohl(tvb, voffset);         /* Level */
3449             proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
3450                                        4, value2, "Level %d", value2);
3451             voffset = voffset+4;
3452             value3 = tvb_get_letohl(tvb, voffset);         /* Interval */
3453             proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
3454                                        4, value3, "Interval %d", value3);
3455             voffset = voffset+4;
3456             value4 = tvb_get_letohl(tvb, voffset);         /* Distinguished Name */
3457             voffset = voffset+4;
3458             vvalues->vstring = get_string(tvb, voffset, value4);
3459             proto_tree_add_string_format(nvtree, hf_value_string, tvb, voffset,
3460                                          value4, vvalues->vstring,
3461                                          "Distinguished Name - %s", vvalues->vstring);
3462             voffset = voffset+value4;
3463             voffset += align_4(tvb, voffset);
3464             break;
3465         case 0x0000001a:        /* Hold */
3466             value1 = tvb_get_letohl(tvb, voffset);         /* Length */
3467             proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
3468                                        4, value1, "Length of Record %08x", value1);
3469             voffset = voffset+4;
3470             value2 = tvb_get_letohl(tvb, voffset);         /* Amount */
3471             proto_tree_add_uint_format(nvtree, hf_nds_uint32value, tvb, voffset,
3472                                        4, value2, "Amount %d", value2);
3473             voffset = voffset+4;
3474             value3 = tvb_get_letohl(tvb, voffset);         /* Subject */
3475             voffset = voffset+4;
3476             vvalues->vstring = get_string(tvb, voffset, value3);
3477             proto_tree_add_string_format(nvtree, hf_value_string, tvb, voffset,
3478                                          value3, vvalues->vstring,
3479                                          "Subject - %s", vvalues->vstring);
3480             voffset = voffset+value3;
3481             voffset += align_4(tvb, voffset);
3482             break;
3483         case 0x00000001:        /* Distinguished Name */
3484         case 0x00000002:        /* Case Sensitive Unicode String */
3485         case 0x00000003:        /* Non Case Sensitive Unicode String */
3486         case 0x00000004:        /* Printable String */
3487         case 0x00000005:        /* Numeric String */
3488         case 0x0000000a:        /* Telephone Number */
3489         case 0x0000000e:        /* Email Address */
3490         case 0x00000014:        /* Class Name */
3491         default:
3492             value1 = tvb_get_letohl(tvb, voffset);
3493             voffset = voffset + 4;
3494             if (strcmp(vvalues->vstring, "zendmSearchOrder")==0) {
3495                 vvalues->vstring = get_string(tvb, voffset, value1);
3496                 if (strcmp(vvalues->vstring, "0")==0) {
3497                     vvalues->vstring = "Value (0) = Object";
3498                 }
3499                 else if (strcmp(vvalues->vstring, "1")==0) {
3500                     vvalues->vstring = "Value (1) = Group";
3501                 }
3502                 else if (strcmp(vvalues->vstring, "2")==0) {
3503                     vvalues->vstring = "Value (2) = Container";
3504                 }
3505                 else if (strcmp(vvalues->vstring, "01")==0) {
3506                     vvalues->vstring = "Value (01) = Object, Group";
3507                 }
3508                 else if (strcmp(vvalues->vstring, "02")==0) {
3509                     vvalues->vstring = "Value (02) = Object, Container";
3510                 }
3511                 else if (strcmp(vvalues->vstring, "10")==0) {
3512                     vvalues->vstring = "Value (10) = Group, Object";
3513                 }
3514                 else if (strcmp(vvalues->vstring, "12")==0) {
3515                     vvalues->vstring = "Value (12) = Group, Container";
3516                 }
3517                 else if (strcmp(vvalues->vstring, "20")==0) {
3518                     vvalues->vstring = "Value (20) = Container, Object";
3519                 }
3520                 else if (strcmp(vvalues->vstring, "21")==0) {
3521                     vvalues->vstring = "Value (21) = Container, Group";
3522                 }
3523                 else if (strcmp(vvalues->vstring, "012")==0) {
3524                     vvalues->vstring = "Value (012) = Object, Group, Container";
3525                 }
3526                 else if (strcmp(vvalues->vstring, "021")==0) {
3527                     vvalues->vstring = "Value (021) = Object, Container, Group";
3528                 }
3529                 else if (strcmp(vvalues->vstring, "102")==0) {
3530                     vvalues->vstring = "Value (102) = Group, Object, Container";
3531                 }
3532                 else if (strcmp(vvalues->vstring, "120")==0) {
3533                     vvalues->vstring = "Value (120) = Group, Container, Object";
3534                 }
3535                 else if (strcmp(vvalues->vstring, "201")==0) {
3536                     vvalues->vstring = "Value (201) = Container, Object, Group";
3537                 }
3538                 else if (strcmp(vvalues->vstring, "210")==0) {
3539                     vvalues->vstring = "Value (210) = Container, Group, Object";
3540                 }
3541             }
3542             else
3543             {
3544                 vvalues->vstring = get_string(tvb, voffset, value1);
3545             }
3546             proto_tree_add_string(nvtree, hf_value_string, tvb, voffset,
3547                                   value1, vvalues->vstring);
3548             voffset = voffset + value1;
3549             voffset += align_4(tvb, voffset);
3550             break;
3551         }
3552         voffset += align_4(tvb, voffset);
3553     }
3554     vvalues->voffset=voffset;
3555     return;
3558 static guint32
3559 print_es_type(proto_tree *estree, tvbuff_t *tvb, nds_val *values, guint32 vtype, guint32 ioffset)
3561     guint32         value1;
3562     guint32         value2;
3563     guint32         value3;
3564     guint32         value4;
3565     guint32         value5;
3566     guint32         number_of_referrals;
3567     guint32         r;
3568     guint32         i;
3569     guint16         replica_num;
3570     guint16         event_num;
3571     proto_tree      *nestree;
3572     proto_item      *nesitem;
3573     proto_tree      *sub1tree;
3574     proto_item      *sub1item;
3575     proto_tree      *sub2tree;
3576     proto_item      *sub2item;
3577     const char      *vstring="";
3578     nstime_t        ns;
3580     switch (vtype)
3581     {
3582     case 0: /* No Specifier Type */
3583         value1 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3584         proto_tree_add_item(estree, hf_es_value, tvb, ioffset,
3585                             4, value1);
3586         ioffset = ioffset + 4;
3587         break;
3588     case 1: /* Unicode String */
3589         value1 = tvb_get_letohl(tvb, ioffset);   /* Delimiter Set */
3590         ioffset = ioffset + 4;
3591         values->vstring = get_string(tvb, ioffset, value1);
3592         proto_tree_add_string_format(estree, hf_mv_string, tvb, ioffset,
3593                                      value1, values->vstring, "Delimiter ->%s", values->vstring);
3594         ioffset=ioffset + value1;
3595         ioffset += align_4(tvb, ioffset);
3596         value2 = tvb_get_letohl(tvb, ioffset);
3597         ioffset = ioffset + 4;
3598         values->vstring = get_string(tvb, ioffset, value2);
3599         proto_tree_add_string(estree, hf_mv_string, tvb, ioffset,
3600                               value2, values->vstring);
3601         values->voffset=ioffset + value2;
3602         ioffset = values->voffset;
3603         ioffset += align_4(tvb, ioffset);
3604         break;
3605     case 2: /* Based */
3606         value1 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3607         vstring = val_to_str_const(value1, es_type, "No ES Type Found");
3608         nesitem = proto_tree_add_string_format(estree, hf_es_type, tvb, ioffset,
3609                                                4, vstring, "Base Context Type - %s", vstring);
3610         nestree = proto_item_add_subtree(nesitem, ett_nds);
3611         ioffset = ioffset + 4;
3612         switch (value1)
3613         {
3614         case 0: /* No Specifier Type */
3615             value2 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3616             proto_tree_add_item(nestree, hf_es_value, tvb, ioffset,
3617                                 4, value2);
3618             ioffset = ioffset + 4;
3619             break;
3620         case 1: /* Unicode String */
3621             value2 = tvb_get_letohl(tvb, ioffset);   /* Delimiter Set */
3622             ioffset = ioffset + 4;
3623             values->vstring = get_string(tvb, ioffset, value2);
3624             proto_tree_add_string_format(nestree, hf_mv_string, tvb, ioffset,
3625                                          value2, values->vstring, "Delimiter ->%s", values->vstring);
3626             ioffset=ioffset + value2;
3627             ioffset += align_4(tvb, ioffset);
3628             value3 = tvb_get_letohl(tvb, ioffset);
3629             ioffset = ioffset + 4;
3630             values->vstring = get_string(tvb, ioffset, value3);
3631             proto_tree_add_string(nestree, hf_mv_string, tvb, ioffset,
3632                                   value3, values->vstring);
3633             values->voffset=ioffset + value3;
3634             ioffset = values->voffset;
3635             ioffset += align_4(tvb, ioffset);
3636             break;
3637         case 2: /* Based */
3638             break;
3639         case 3: /* Hinted */
3640             break;
3641         case 4: /* Tuned */
3642             value2 = tvb_get_letohl(tvb, ioffset);   /* Count */
3643             proto_tree_add_item(nestree, hf_es_rdn_count, tvb, ioffset,
3644                                 4, value2);
3645             ioffset = ioffset + 4;
3646             for (r = 1 ; r <= value2; r++ )
3647             {
3648                 ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
3649                 ns.nsecs = 0;
3650                 proto_tree_add_time_format(nestree, hf_es_seconds, tvb, ioffset,
3651                                            4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
3652                 ioffset = ioffset + 4;
3653                 replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
3654                 proto_tree_add_item(nestree, hf_nds_replica_num, tvb, ioffset,
3655                                     2, replica_num);
3656                 ioffset = ioffset + 2;
3657                 event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
3658                 proto_tree_add_item(nestree, hf_nds_event_num, tvb, ioffset,
3659                                     2, event_num);
3660                 ioffset = ioffset + 2;
3661             }
3662             value4 = tvb_get_letohl(tvb, ioffset);   /* Delimiter Set */
3663             ioffset = ioffset + 4;
3664             values->vstring = get_string(tvb, ioffset, value4);
3665             proto_tree_add_string(nestree, hf_mv_string, tvb, ioffset,
3666                                   value4, values->vstring);
3667             ioffset=ioffset + value4;
3668             ioffset += align_4(tvb, ioffset);
3669             value5 = tvb_get_letohl(tvb, ioffset);   /* RDN */
3670             ioffset = ioffset + 4;
3671             values->vstring = get_string(tvb, ioffset, value5);
3672             proto_tree_add_string(nestree, hf_rdn_string, tvb, ioffset,
3673                                   value5, values->vstring);
3674             ioffset=ioffset + value5;
3675             ioffset += align_4(tvb, ioffset);
3676             break;
3677         case 5: /* GUID */
3678         case 6: /* ID32 */
3679         case 7: /* Count */
3680         default:
3681             value1 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3682             /* XXX: nestree rather than estree ?? */
3683             proto_tree_add_item(estree, hf_es_value, tvb, ioffset,
3684                                 4, value1);
3685             ioffset = ioffset + 4;
3686             break;
3687         }
3688         value1 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3689         vstring = val_to_str_const(value1, es_type, "No ES Type Found");
3690         nesitem = proto_tree_add_string_format(estree, hf_es_type, tvb, ioffset,
3691                                                4, vstring, "Object Name Type - %s", vstring);
3692         nestree = proto_item_add_subtree(nesitem, ett_nds);
3693         ioffset = ioffset + 4;
3694         switch (value1)
3695         {
3696         case 0: /* No Specifier Type */
3697             value2 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3698             proto_tree_add_item(nestree, hf_es_value, tvb, ioffset,
3699                                 4, value2);
3700             ioffset = ioffset + 4;
3701             break;
3702         case 1: /* Unicode String */
3703             value2 = tvb_get_letohl(tvb, ioffset);   /* Delimiter Set */
3704             ioffset = ioffset + 4;
3705             values->vstring = get_string(tvb, ioffset, value2);
3706             proto_tree_add_string_format(nestree, hf_mv_string, tvb, ioffset,
3707                                          value2, values->vstring, "Delimiter ->%s", values->vstring);
3708             ioffset=ioffset + value2;
3709             ioffset += align_4(tvb, ioffset);
3710             value3 = tvb_get_letohl(tvb, ioffset);
3711             ioffset = ioffset + 4;
3712             values->vstring = get_string(tvb, ioffset, value3);
3713             proto_tree_add_string(nestree, hf_mv_string, tvb, ioffset,
3714                                   value3, values->vstring);
3715             values->voffset=ioffset + value3;
3716             ioffset = values->voffset;
3717             ioffset += align_4(tvb, ioffset);
3718             break;
3719         case 2: /* Based */
3720             break;
3721         case 3: /* Hinted */
3722             break;
3723         case 4: /* Tuned */
3724             value2 = tvb_get_letohl(tvb, ioffset);   /* Count */
3725             proto_tree_add_item(nestree, hf_es_rdn_count, tvb, ioffset,
3726                                 4, value2);
3727             ioffset = ioffset + 4;
3728             for (r = 1 ; r <= value2; r++ )
3729             {
3730                 ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
3731                 ns.nsecs = 0;
3732                 proto_tree_add_time_format(nestree, hf_es_seconds, tvb, ioffset,
3733                                            4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
3734                 ioffset = ioffset + 4;
3735                 replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
3736                 proto_tree_add_item(nestree, hf_nds_replica_num, tvb, ioffset,
3737                                     2, replica_num);
3738                 ioffset = ioffset + 2;
3739                 event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
3740                 proto_tree_add_item(nestree, hf_nds_event_num, tvb, ioffset,
3741                                     2, event_num);
3742                 ioffset = ioffset + 2;
3743             }
3744             value4 = tvb_get_letohl(tvb, ioffset);   /* Delimiter Set */
3745             ioffset = ioffset + 4;
3746             values->vstring = get_string(tvb, ioffset, value4);
3747             proto_tree_add_string(nestree, hf_mv_string, tvb, ioffset,
3748                                   value4, values->vstring);
3749             ioffset=ioffset + value4;
3750             ioffset += align_4(tvb, ioffset);
3751             value5 = tvb_get_letohl(tvb, ioffset);   /* RDN */
3752             ioffset = ioffset + 4;
3753             values->vstring = get_string(tvb, ioffset, value5);
3754             proto_tree_add_string(nestree, hf_rdn_string, tvb, ioffset,
3755                                   value5, values->vstring);
3756             ioffset=ioffset + value5;
3757             ioffset += align_4(tvb, ioffset);
3758             break;
3759         case 5: /* GUID */
3760         case 6: /* ID32 */
3761         case 7: /* Count */
3762         default:
3763             value1 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3764             /* XXX: nestree rather than estree ?? */
3765             proto_tree_add_item(estree, hf_es_value, tvb, ioffset,
3766                                 4, value1);
3767             ioffset = ioffset + 4;
3768             break;
3769         }
3770         break;
3771     case 3: /* Hinted */
3772         number_of_referrals = tvb_get_letohl(tvb, ioffset);
3774         for (r = 1 ; r <= number_of_referrals; r++ )
3775         {
3776             sub1item = proto_tree_add_uint_format(estree, hf_referral_record, tvb, 6, 0,
3777                                                   r, "NDS Referral Record #%u", r);
3778             sub1tree = proto_item_add_subtree(sub1item, ett_nds);
3780             value1 = tvb_get_letohl(tvb, ioffset);
3782             proto_tree_add_uint_format(sub1tree, hf_referral_addcount, tvb, ioffset, 4,
3783                                        value1, "Number of Addresses in Referral - %u", value1);
3785             ioffset = ioffset + 4;
3786             for (i = 1 ; i <= value1; i++ )
3787             {
3788                 value2 = tvb_get_letohl(tvb, ioffset);
3789                 values->vstring = val_to_str_const(value2, nds_protocol_type, "(Undefined Protocol)");
3790                 proto_tree_add_uint_format(sub1tree, hf_nds_uint32value, tvb, ioffset,
3791                                            4, value2, vstring, value2);
3792                 ioffset = ioffset+4;
3793                 value3 = tvb_get_letohl(tvb, ioffset);
3794                 ioffset = ioffset+4;
3795                 switch (value2)
3796                 {
3797                 case NDS_PTYPE_IPX:
3798                     proto_tree_add_item(sub1tree, hf_nds_net, tvb, ioffset, 4, FALSE);
3799                     proto_tree_add_item(sub1tree, hf_nds_node, tvb, ioffset+4, 6, FALSE);
3800                     proto_tree_add_item(sub1tree, hf_nds_socket, tvb, ioffset+10, 2, FALSE);
3801                     break;
3802                 case NDS_PTYPE_IP:
3803                     proto_tree_add_item(sub1tree, hf_nds_port, tvb, ioffset, 2, FALSE);
3804                     proto_tree_add_item(sub1tree, hf_add_ref_ip, tvb, ioffset+2, 4, FALSE);
3805                     break;
3806                 case NDS_PTYPE_UDP:
3807                     proto_tree_add_item(sub1tree, hf_nds_port, tvb, ioffset, 2, FALSE);
3808                     proto_tree_add_item(sub1tree, hf_add_ref_udp, tvb, ioffset+2, 4, FALSE);
3809                     break;
3810                 case NDS_PTYPE_TCP:
3811                     proto_tree_add_item(sub1tree, hf_nds_port, tvb, ioffset, 2, FALSE);
3812                     proto_tree_add_item(sub1tree, hf_add_ref_tcp, tvb, ioffset+2, 4, FALSE);
3813                     break;
3814                 case NDS_PTYPE_URL:
3815                 case NDS_PTYPE_DNS:
3816                     values->vstring = get_string(tvb, ioffset, value3);
3817                     proto_tree_add_string(sub1tree, hf_value_string, tvb, ioffset,
3818                                           value3, values->vstring);
3819                     break;
3820                 default:
3821                     break;
3822                 }
3823                 ioffset = ioffset + value3;
3824                 ioffset += align_4(tvb, ioffset);
3825             }
3827         }
3828         value1 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3829         vstring = val_to_str_const(value1, es_type, "No ES Type Found");
3830         nesitem = proto_tree_add_string_format(estree, hf_es_type, tvb, ioffset,
3831                                                4, vstring, "Object Name Type - %s", vstring);
3832         nestree = proto_item_add_subtree(nesitem, ett_nds);
3833         ioffset = ioffset + 4;
3834         switch (value1)
3835         {
3836         case 0: /* No Specifier Type */
3837             value2 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3838             proto_tree_add_item(nestree, hf_es_value, tvb, ioffset,
3839                                 4, value2);
3840             ioffset = ioffset + 4;
3841             break;
3842         case 1: /* Unicode String */
3843             value2 = tvb_get_letohl(tvb, ioffset);   /* Delimiter Set */
3844             ioffset = ioffset + 4;
3845             values->vstring = get_string(tvb, ioffset, value2);
3846             proto_tree_add_string_format(nestree, hf_mv_string, tvb, ioffset,
3847                                          value2, values->vstring, "Delimiter ->%s", values->vstring);
3848             ioffset=ioffset + value2;
3849             ioffset += align_4(tvb, ioffset);
3850             value3 = tvb_get_letohl(tvb, ioffset);
3851             ioffset = ioffset + 4;
3852             values->vstring = get_string(tvb, ioffset, value3);
3853             proto_tree_add_string(nestree, hf_mv_string, tvb, ioffset,
3854                                   value3, values->vstring);
3855             values->voffset=ioffset + value3;
3856             ioffset = values->voffset;
3857             ioffset += align_4(tvb, ioffset);
3858             break;
3859         case 2: /* Based */
3860             break;
3861         case 3: /* Hinted */
3862             break;
3863         case 4: /* Tuned */
3864             value2 = tvb_get_letohl(tvb, ioffset);   /* Count */
3865             proto_tree_add_item(nestree, hf_es_rdn_count, tvb, ioffset,
3866                                 4, value2);
3867             ioffset = ioffset + 4;
3868             for (r = 1 ; r <= value2; r++ )
3869             {
3870                 ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
3871                 ns.nsecs = 0;
3872                 proto_tree_add_time_format(nestree, hf_es_seconds, tvb, ioffset,
3873                                            4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
3874                 ioffset = ioffset + 4;
3875                 replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
3876                 proto_tree_add_item(nestree, hf_nds_replica_num, tvb, ioffset,
3877                                     2, replica_num);
3878                 ioffset = ioffset + 2;
3879                 event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
3880                 proto_tree_add_item(nestree, hf_nds_event_num, tvb, ioffset,
3881                                     2, event_num);
3882                 ioffset = ioffset + 2;
3883             }
3884             value4 = tvb_get_letohl(tvb, ioffset);   /* Delimiter Set */
3885             ioffset = ioffset + 4;
3886             values->vstring = get_string(tvb, ioffset, value4);
3887             proto_tree_add_string(nestree, hf_mv_string, tvb, ioffset,
3888                                   value4, values->vstring);
3889             ioffset=ioffset + value4;
3890             ioffset += align_4(tvb, ioffset);
3891             value5 = tvb_get_letohl(tvb, ioffset);   /* RDN */
3892             ioffset = ioffset + 4;
3893             values->vstring = get_string(tvb, ioffset, value5);
3894             proto_tree_add_string(nestree, hf_rdn_string, tvb, ioffset,
3895                                   value5, values->vstring);
3896             ioffset=ioffset + value5;
3897             ioffset += align_4(tvb, ioffset);
3898             break;
3899         case 5: /* GUID */
3900         case 6: /* ID32 */
3901         case 7: /* Count */
3902         default:
3903             value1 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3904             /* XXX: nestree rather than estree ?? */
3905             proto_tree_add_item(estree, hf_es_value, tvb, ioffset,
3906                                 4, value1);
3907             ioffset = ioffset + 4;
3908             break;
3909         }
3910         break;
3911     case 4: /* Tuned */
3912         value1 = tvb_get_letohl(tvb, ioffset);
3913         sub1item = proto_tree_add_uint_format(estree, hf_es_rdn_count, tvb, ioffset,
3914                                               4, value1, "Number of RDN Items %u", value1);
3915         sub1tree = proto_item_add_subtree(sub1item, ett_nds);
3916         ioffset = ioffset + 4;
3917         for (r = 1 ; r <= value1; r++ )
3918         {
3919             sub2item = proto_tree_add_text(sub1tree, tvb, ioffset, 0, "Item %u", r);
3920             sub2tree = proto_item_add_subtree(sub2item, ett_nds);
3922             ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
3923             ns.nsecs = 0;
3924             proto_tree_add_time_format(sub2tree, hf_es_seconds, tvb, ioffset,
3925                                        4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
3926             ioffset = ioffset + 4;
3927             replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
3928             proto_tree_add_item(sub2tree, hf_nds_replica_num, tvb, ioffset,
3929                                 2, replica_num);
3930             ioffset = ioffset + 2;
3931             event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
3932             proto_tree_add_item(sub2tree, hf_nds_event_num, tvb, ioffset,
3933                                 2, event_num);
3934             ioffset = ioffset + 2;
3935         }
3936         value3 = tvb_get_letohl(tvb, ioffset);   /* Delimiter Set */
3937         ioffset = ioffset + 4;
3938         values->vstring = get_string(tvb, ioffset, value3);
3939         proto_tree_add_string(sub1tree, hf_mv_string, tvb, ioffset,
3940                               value3, values->vstring);
3941         ioffset=ioffset + value3;
3942         ioffset += align_4(tvb, ioffset);
3943         value4 = tvb_get_letohl(tvb, ioffset);   /* RDN */
3944         ioffset = ioffset + 4;
3945         values->vstring = get_string(tvb, ioffset, value4);
3946         proto_tree_add_string(sub1tree, hf_rdn_string, tvb, ioffset,
3947                               value4, values->vstring);
3948         ioffset=ioffset + value4;
3949         ioffset += align_4(tvb, ioffset);
3950         break;
3951     case 5: /* GUID */
3952     case 6: /* ID32 */
3953     case 7: /* Count */
3954     default:
3955         value1 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
3956         proto_tree_add_item(estree, hf_es_value, tvb, ioffset,
3957                             4, value1);
3958         ioffset = ioffset + 4;
3959         break;
3960     }
3961     return ioffset;
3965 static void process_set_filter(proto_tree* , tvbuff_t*, packet_info*, nds_val*);
3967 static void
3968 process_search_expression(proto_tree *it_tree, tvbuff_t *tvb, nds_val *values)
3970     guint32     search_tag, ioffset;
3971     const char *search_string;
3973     ioffset = values->voffset;
3974     search_tag = tvb_get_letohl(tvb, ioffset); /* Get next search operation tag */
3975     search_string = val_to_str_const(search_tag, itersearchenum, "(No Search Operation Type Found!)");
3976     proto_tree_add_uint_format(it_tree, hf_iter_search, tvb, ioffset, 4,
3977                                search_tag, "Search Operation Type: %d, (0x%04x), %s",
3978                                search_tag, search_tag, search_string);
3979     ioffset += 4;
3980     switch (search_tag)
3981     {
3982     case NDS_SEARCH_EQUAL:
3983     case NDS_SEARCH_GREATER_OR_EQUAL:
3984     case NDS_SEARCH_LESS_OR_EQUAL:
3985     case NDS_SEARCH_APPROX:
3986     case NDS_SEARCH_ATTR_FLAGS:
3987     case NDS_SEARCH_ATTR_HAS_FLAG:
3988         /* start of DCWPutAttribute */
3989         values->vvalue = tvb_get_letohl(tvb, ioffset);
3990         ioffset = ioffset + 4;
3991         values->vstring = get_string(tvb, ioffset, values->vvalue);
3992         proto_tree_add_string(it_tree, hf_mv_string, tvb, ioffset,
3993                               values->vvalue, values->vstring);
3994         ioffset += values->vvalue;
3995         /* end of DCWPutAttribute */
3997         ioffset += align_4(tvb, ioffset);
3999         /* start of DCWPutValue */
4000         values->vvalue = tvb_get_letohl(tvb, ioffset);
4001         values->vstring = val_to_str_const(values->vvalue, nds_syntax, "No Syntax Found");
4002         proto_tree_add_string(it_tree, hf_nds_syntax, tvb, ioffset,
4003                                   4, values->vstring);
4004         ioffset = ioffset + 4;
4005         values->vvalue = tvb_get_letohl(tvb, ioffset);
4006         ioffset = ioffset + 4;
4007         values->vstring = get_string(tvb, ioffset, values->vvalue);
4008         proto_tree_add_string(it_tree, hf_mv_string, tvb, ioffset,
4009                               values->vvalue, values->vstring);
4010         ioffset += values->vvalue;
4011         /* end of DCWPutValue */
4013         break;
4014     case NDS_SEARCH_PRESENT:
4015         /* start of DCWPutAttribute */
4016         values->vvalue = tvb_get_letohl(tvb, ioffset);
4017         ioffset = ioffset + 4;
4018         values->vstring = get_string(tvb, ioffset, values->vvalue);
4019         proto_tree_add_string(it_tree, hf_mv_string, tvb, ioffset,
4020                               values->vvalue, values->vstring);
4021         ioffset = ioffset + values->vvalue;
4022         /* end of DCWPutAttribute */
4023         break;
4025     case NDS_SEARCH_RDN:
4026         /* print the relative distinguished name. This includes context info... */
4027 #if 0
4028         if (err = DCWPutRDN(context, cur, limit, item->data))
4029             return err;
4030 #endif
4032         values->vvalue = tvb_get_letohl(tvb, ioffset);
4033         ioffset = ioffset + 4;
4034         values->vstring = get_string(tvb, ioffset, values->vvalue);
4035         proto_tree_add_string(it_tree, hf_mv_string, tvb, ioffset,
4036                               values->vvalue, values->vstring);
4037         ioffset += values->vvalue;
4038         break;
4039     case NDS_SEARCH_BASE_CLASS:
4040     case NDS_SEARCH_ENTRY_FLAGS:
4041     case NDS_SEARCH_ENTRY_HAS_FLAG:
4042     case NDS_SEARCH_VALUE_FLAGS:
4043     case NDS_SEARCH_VALUE_HAS_FLAG:
4044         /* start of DCWPutValue */
4045 #if 0
4046         values->vvalue = tvb_get_letohl(tvb, ioffset);
4047         values->vstring = val_to_str_const(values->vvalue, nds_syntax, "No Syntax Found");
4048         proto_tree_add_string(it_tree, hf_nds_syntax, tvb, ioffset,
4049                               4, values->vstring);
4050         ioffset = ioffset + 4;
4051 #endif
4052         values->vvalue = tvb_get_letohl(tvb, ioffset);
4053         ioffset = ioffset + 4;
4054         values->vstring = get_string(tvb, ioffset, values->vvalue);
4055         proto_tree_add_string(it_tree, hf_mv_string, tvb, ioffset,
4056                               values->vvalue, values->vstring);
4057         ioffset += values->vvalue;
4058         /* end of DCWPutValue */
4059         break;
4060     case DCS_VALUE_GE_WITH_ATTR:        /* Deprecated, use DS_SEARCH_VALUE_MTS_GE */
4061     case NDS_SEARCH_VALUE_MTS_GE:
4062     case NDS_SEARCH_VALUE_MTS_G:
4063     case NDS_SEARCH_VALUE_MTS_LE:
4064     case NDS_SEARCH_VALUE_MTS_L:
4065     case NDS_SEARCH_VALUE_MTS_EQ:
4066     case NDS_SEARCH_VALUE_MTS_EQ_APPROX:
4067     case NDS_SEARCH_VALUE_CTS_GE:
4068     case NDS_SEARCH_VALUE_CTS_G:
4069     case NDS_SEARCH_VALUE_CTS_LE:
4070     case NDS_SEARCH_VALUE_CTS_L:
4071     case NDS_SEARCH_VALUE_CTS_EQ:
4072     case NDS_SEARCH_VALUE_CTS_EQ_APPROX:
4073         /* start of DCWPutAttribute */
4074         values->vvalue = tvb_get_letohl(tvb, ioffset);
4075         ioffset = ioffset + 4;
4076         values->vstring = get_string(tvb, ioffset, values->vvalue);
4077         proto_tree_add_string(it_tree, hf_mv_string, tvb, ioffset,
4078                               values->vvalue, values->vstring);
4079         ioffset += values->vvalue;
4080         /* end of DCWPutAttribute */
4082         ioffset += align_4(tvb, ioffset);
4084         /* start of DCWPutValue */
4085         values->vvalue = tvb_get_letohl(tvb, ioffset);
4086         values->vstring = val_to_str_const(values->vvalue, nds_syntax, "No Syntax Found");
4087         proto_tree_add_string(it_tree, hf_nds_syntax, tvb, ioffset,
4088                               4, values->vstring);
4089         ioffset = ioffset + 4;
4090         values->vvalue = tvb_get_letohl(tvb, ioffset);
4091         ioffset = ioffset + 4;
4092         values->vstring = get_string(tvb, ioffset, values->vvalue);
4093         proto_tree_add_string(it_tree, hf_mv_string, tvb, ioffset,
4094                               values->vvalue, values->vstring);
4095         ioffset += values->vvalue;
4096         /* end of DCWPutValue */
4097         break;
4098     case DCS_MOD_GE_WITH_ATTR:        /* Deprecated, use DS_SEARCH_ENTRY_MTS */
4099     case NDS_SEARCH_ENTRY_MTS_GE:
4100     case NDS_SEARCH_ENTRY_MTS_G:
4101     case NDS_SEARCH_ENTRY_MTS_LE:
4102     case NDS_SEARCH_ENTRY_MTS_L:
4103     case NDS_SEARCH_ENTRY_MTS_EQ:
4104     case NDS_SEARCH_ENTRY_MTS_EQ_APPROX:
4105     case NDS_SEARCH_ENTRY_CTS_GE:
4106     case NDS_SEARCH_ENTRY_CTS_G:
4107     case NDS_SEARCH_ENTRY_CTS_LE:
4108     case NDS_SEARCH_ENTRY_CTS_L:
4109     case NDS_SEARCH_ENTRY_CTS_EQ:
4110     case NDS_SEARCH_ENTRY_CTS_EQ_APPROX:
4111         /* start of DCWPutAttribute */
4112         values->vvalue = tvb_get_letohl(tvb, ioffset);
4113         ioffset = ioffset + 4;
4114         values->vstring = get_string(tvb, ioffset, values->vvalue);
4115         proto_tree_add_string(it_tree, hf_mv_string, tvb, ioffset,
4116                               values->vvalue, values->vstring);
4117         ioffset += values->vvalue;
4118         /* end of DCWPutAttribute */
4120         ioffset += align_4(tvb, ioffset);
4122         /* start of DCWPutValue */
4123         values->vvalue = tvb_get_letohl(tvb, ioffset);
4124         values->vstring = val_to_str_const(values->vvalue, nds_syntax, "No Syntax Found");
4125         proto_tree_add_string(it_tree, hf_nds_syntax, tvb, ioffset,
4126                               4, values->vstring);
4127         ioffset = ioffset + 4;
4128         values->vvalue = tvb_get_letohl(tvb, ioffset);
4129         ioffset = ioffset + 4;
4130         values->vstring = get_string(tvb, ioffset, values->vvalue);
4131         proto_tree_add_string(it_tree, hf_mv_string, tvb, ioffset,
4132                               values->vvalue, values->vstring);
4133         ioffset += values->vvalue;
4134         /* end of DCWPutValue */
4136         break;
4137     case NDS_SEARCH_EID:
4138     case NDS_SEARCH_ENTRY_SUBCOUNT_GE:
4139     case NDS_SEARCH_ENTRY_SUBCOUNT_G:
4140     case NDS_SEARCH_ENTRY_SUBCOUNT_LE:
4141     case NDS_SEARCH_ENTRY_SUBCOUNT_L:
4142     case NDS_SEARCH_ENTRY_SUBCOUNT_EQ:
4143         /* start of DCWPutValue */
4144         values->vvalue = tvb_get_letohl(tvb, ioffset);
4145         values->vstring = val_to_str_const(values->vvalue, nds_syntax, "No Syntax Found");
4146         proto_tree_add_string(it_tree, hf_nds_syntax, tvb, ioffset,
4147                               4, values->vstring);
4148         ioffset = ioffset + 4;
4149         values->vvalue = tvb_get_letohl(tvb, ioffset);
4150         ioffset = ioffset + 4;
4151         values->vstring = get_string(tvb, ioffset, values->vvalue);
4152         proto_tree_add_string(it_tree, hf_mv_string, tvb, ioffset,
4153                               values->vvalue, values->vstring);
4154         ioffset += values->vvalue;
4155         /* end of DCWPutValue */
4157         break;
4159     default: /* Unknown Iteration search Item type */
4160         if (tvb_length_remaining(tvb, ioffset) < 4) {
4161                 THROW(ReportedBoundsError);
4162         }
4163         break;
4164     }
4165     ioffset += align_4(tvb, ioffset);
4166     values->voffset = ioffset;
4167     return;
4170 static void
4171 process_search_subexpression(proto_tree *it_tree, tvbuff_t *tvb, packet_info *pinfo, nds_val *values)
4173     proto_tree  *it_subtree, *it_subtree1;
4174     proto_item  *it_subitem, *it_subitem1;
4175     guint32     i, ioffset, number_of_items;
4177     ioffset = values->voffset;
4178     if (values->vvalue != NDS_SEARCH_NOT) {
4179         number_of_items = tvb_get_letohl(tvb, ioffset);
4180         it_subitem = proto_tree_add_item(it_tree, hf_this_count, tvb, ioffset, 4, TRUE);
4181         it_subtree = proto_item_add_subtree(it_subitem, ett_nds);
4182         ioffset += 4;
4183         for (i = 0; i < number_of_items; i++)
4184         {
4185             it_subitem1 = proto_tree_add_text(it_subtree, tvb, ioffset, -1, "Item #: %u", i+1);
4186             it_subtree1 = proto_item_add_subtree(it_subitem1, ett_nds);
4188             values->voffset = ioffset;
4189             process_set_filter(it_subtree1, tvb, pinfo, values);
4190             ioffset = values->voffset;
4192             if (tvb_length_remaining(tvb, ioffset) < 4) {
4193                 THROW(ReportedBoundsError);
4194                 break;
4195             }
4197         }
4198     }
4199     values->voffset = ioffset;
4200     return;
4203 static void
4204 process_search_match(proto_tree *it_tree, tvbuff_t *tvb, nds_val *values)
4206     guint32     ioffset;
4208     ioffset = values->voffset;
4210     values->vvalue = tvb_get_letohl(tvb, ioffset);
4211     ioffset += 4;
4212     proto_tree_add_item(it_tree, hf_nds_oid, tvb, ioffset, values->vvalue, TRUE);
4213     ioffset += values->vvalue;
4215     ioffset += align_4(tvb, ioffset);
4217     proto_tree_add_item(it_tree, hf_iter_ans, tvb, ioffset, 4, TRUE);
4218     ioffset += 4;
4220     ioffset += align_4(tvb, ioffset);
4222     /* start of DCWPutAttribute */
4223     values->vvalue = tvb_get_letohl(tvb, ioffset);
4224     ioffset = ioffset + 4;
4225     values->vstring = get_string(tvb, ioffset, values->vvalue);
4226     proto_tree_add_string(it_tree, hf_mv_string, tvb, ioffset,
4227             values->vvalue, values->vstring);
4228     ioffset = ioffset + values->vvalue;
4229     /* end of DCWPutAttribute */
4231     ioffset += align_4(tvb, ioffset);
4233     /* start of DCWPutValue */
4234     values->vvalue = tvb_get_letohl(tvb, ioffset);
4235     values->vstring = val_to_str_const(values->vvalue, nds_syntax, "No Syntax Found");
4236     proto_tree_add_string(it_tree, hf_nds_syntax, tvb, ioffset,
4237     4, values->vstring);
4238     ioffset = ioffset + 4;
4239     values->vvalue = tvb_get_letohl(tvb, ioffset);
4240     ioffset = ioffset + 4;
4241     values->vstring = get_string(tvb, ioffset, values->vvalue);
4242     proto_tree_add_string(it_tree, hf_mv_string, tvb, ioffset,
4243                           values->vvalue, values->vstring);
4244     ioffset += values->vvalue;
4245     /* end of DCWPutValue */
4247     ioffset += align_4(tvb, ioffset);
4249     values->voffset = ioffset;
4250     return;
4253 static void
4254 process_set_filter(proto_tree *it_tree, tvbuff_t *tvb, packet_info *pinfo, nds_val *values)
4256     guint32     search_tag, ioffset = values->voffset;
4257     const char *search_string;
4259     search_tag = tvb_get_letohl(tvb, ioffset);
4260     search_string = val_to_str_const(search_tag, itersearchenum, "(No Search Tag Found)");
4261     proto_tree_add_uint_format(it_tree, hf_iter_search, tvb, ioffset, 4,
4262         search_tag, "Type of Search: Tag = %d, (0x%04x), %s",
4263         search_tag, search_tag, search_string);
4264     ioffset += 4;
4265     values->voffset = ioffset;
4267     switch (search_tag)
4268     {
4269     case NDS_SEARCH_ITEM:
4270         /* DCWPutSearchExp */
4271         process_search_expression(it_tree, tvb, values);
4272         break;
4274     case NDS_SEARCH_EXTENSIBLE:
4275 #if 0
4276         err = DCWPutSearchExtMatch(context, syncFormat, cur, limit, sexp->u.extMatch);
4277 #endif
4278         process_search_match(it_tree, tvb, values);
4279         break;
4281     case NDS_SEARCH_OR:
4282     case NDS_SEARCH_AND:
4283     case NDS_SEARCH_NOT:
4284         /* DCWPutSearchSubExp = process_search_subexpression */
4285         process_search_subexpression(it_tree, tvb, pinfo, values);
4286         break;
4287     default: /* Unknown Iteration search type */
4288         if (tvb_length_remaining(tvb, ioffset) < 4) {
4289             THROW(ReportedBoundsError);
4290         }
4291         break;
4292     }
4293     ioffset = values->voffset;
4294     return;
4297 static void
4298 process_entry_info(proto_tree *it_tree, tvbuff_t *tvb, nds_val *values)
4300     guint32     iter_flags, ioffset = values->voffset;
4301     guint16     replica_num, event_num;
4302     nstime_t    ns;
4304     values->vstring = NULL;
4305     ioffset += align_4(tvb, ioffset);
4306     iter_flags = tvb_get_letohl(tvb, ioffset);
4309     if (iter_flags & DSI_OUTPUT_FIELDS) { /* Output Flags */
4310         values->vvalue = tvb_get_letohs(tvb, ioffset);
4311         values->vdesc = "Return Information Flags (low) Byte:";
4312         values->vlength = 2;
4313         values->hfname = hf_nds_rflags;
4314         values->voffset = ioffset;
4315         values->bit1 = "Output Flags";
4316         values->bit1hfname = hf_bit1infoflagsl;
4317         values->bit2 = "Entry ID";
4318         values->bit2hfname = hf_bit2infoflagsl;
4319         values->bit3 = "Entry Flags";
4320         values->bit3hfname = hf_bit3infoflagsl;
4321         values->bit4 = "Subordinate Count";
4322         values->bit4hfname = hf_bit4infoflagsl;
4323         values->bit5 = "Modification Time";
4324         values->bit5hfname = hf_bit5infoflagsl;
4325         values->bit6 = "Modification Timestamp";
4326         values->bit6hfname = hf_bit6infoflagsl;
4327         values->bit7 = "Creation Timestamp";
4328         values->bit7hfname = hf_bit7infoflagsl;
4329         values->bit8 = "Partition Root ID";
4330         values->bit8hfname = hf_bit8infoflagsl;
4331         values->bit9 = "Parent ID";
4332         values->bit9hfname = hf_bit9infoflagsl;
4333         values->bit10 = "Revision Count";
4334         values->bit10hfname = hf_bit10infoflagsl;
4335         values->bit11 = "Replica Type";
4336         values->bit11hfname = hf_bit11infoflagsl;
4337         values->bit12 = "Base Class";
4338         values->bit12hfname = hf_bit12infoflagsl;
4339         values->bit13 = "Relative Distinguished Name";
4340         values->bit13hfname = hf_bit13infoflagsl;
4341         values->bit14 = "Distinguished Name";
4342         values->bit14hfname = hf_bit14infoflagsl;
4343         values->bit15 = "Root Distinguished Name";
4344         values->bit15hfname = hf_bit15infoflagsl;
4345         values->bit16 = "Parent Distinguished Name";
4346         values->bit16hfname = hf_bit16infoflagsl;
4347         process_bitfield(it_tree, tvb, values);
4348         ioffset = ioffset+2;
4350         values->vvalue = tvb_get_letohs(tvb, ioffset);
4351         values->vtype = VTYPE_BITFIELD;
4352         values->vdesc = "Return Information Flags (high) Byte:";
4353         values->vlength = 2;
4354         values->hfname= hf_nds_rflags;
4355         values->voffset = ioffset;
4356         values->bit1 = "Purge Time";
4357         values->bit1hfname = hf_bit1infoflagsh;
4358         values->bit2 = "Dereference Base Class";
4359         values->bit2hfname = hf_bit2infoflagsh;
4360         values->bit3 = "Replica Number";
4361         values->bit3hfname = hf_bit3infoflagsh;
4362         values->bit4 = "Replica State";
4363         values->bit4hfname = hf_bit4infoflagsh;
4364         values->bit5 = "Federation Boundary";
4365         values->bit5hfname = hf_bit5infoflagsh;
4366         values->bit6 = "Schema Boundary";
4367         values->bit6hfname = hf_bit6infoflagsh;
4368         values->bit7 = "Federation Boundary ID";
4369         values->bit7hfname = hf_bit7infoflagsh;
4370         values->bit8 = "Schema Boundary ID";
4371         values->bit8hfname = hf_bit8infoflagsh;
4372         values->bit9 = "Current Subcount";
4373         values->bit9hfname = hf_bit9infoflagsh;
4374         values->bit10 = "Local Entry Flags";
4375         values->bit10hfname = hf_bit10infoflagsh;
4376         values->bit11 = "Not Defined";
4377         values->bit11hfname = hf_bit11infoflagsh;
4378         values->bit12 = "Not Defined";
4379         values->bit12hfname = hf_bit12infoflagsh;
4380         values->bit13 = "Not Defined";
4381         values->bit13hfname = hf_bit13infoflagsh;
4382         values->bit14 = "Not Defined";
4383         values->bit14hfname = hf_bit14infoflagsh;
4384         values->bit15 = "Not Defined";
4385         values->bit15hfname = hf_bit15infoflagsh;
4386         values->bit16 = "Not Defined";
4387         values->bit16hfname = hf_bit16infoflagsh;
4388         process_bitfield(it_tree, tvb, values);
4389         ioffset = ioffset+2;
4390     }
4391     if (iter_flags & DSI_ENTRY_ID) { /* Entry ID */
4392         values->vvalue = tvb_get_letohl(tvb, ioffset);
4393         proto_tree_add_uint_format(it_tree, hf_nds_eid, tvb, ioffset,
4394                 4, values->vvalue, "Entry ID 0x%08x", values->vvalue);
4395         ioffset = ioffset + 4;
4396     }
4397     if (iter_flags & DSI_ENTRY_FLAGS) { /* Entry Flags */
4398         values->vvalue = tvb_get_letohl(tvb, ioffset);
4399         values->vtype = VTYPE_BITFIELD;
4400         values->vdesc = "Entry Flags:";
4401         values->vlength = 2;
4402         values->hfname= hf_nds_eflags;
4403         values->voffset = ioffset;
4404         values->bit1 = "Alias Entry";
4405         values->bit1hfname = hf_bit1eflags;
4406         values->bit2 = "Partition Root";
4407         values->bit2hfname = hf_bit2eflags;
4408         values->bit3 = "Container Entry";
4409         values->bit3hfname = hf_bit3eflags;
4410         values->bit4 = "Container Alias";
4411         values->bit4hfname = hf_bit4eflags;
4412         values->bit5 = "Matches List Filter";
4413         values->bit5hfname = hf_bit5eflags;
4414         values->bit6 = "Reference Entry";
4415         values->bit6hfname = hf_bit6eflags;
4416         values->bit7 = "40x Reference Entry";
4417         values->bit7hfname = hf_bit7eflags;
4418         values->bit8 = "Back Linked";
4419         values->bit8hfname = hf_bit8eflags;
4420         values->bit9 = "New Entry";
4421         values->bit9hfname = hf_bit9eflags;
4422         values->bit10 = "Temporary Reference";
4423         values->bit10hfname = hf_bit10eflags;
4424         values->bit11 = "Audited";
4425         values->bit11hfname = hf_bit11eflags;
4426         values->bit12 = "Entry Not Present";
4427         values->bit12hfname = hf_bit12eflags;
4428         values->bit13 = "Entry Verify CTS";
4429         values->bit13hfname = hf_bit13eflags;
4430         values->bit14 = "Entry Damaged";
4431         values->bit14hfname = hf_bit14eflags;
4432         values->bit15 = "Not Defined";
4433         values->bit15hfname = hf_bit15eflags;
4434         values->bit16 = "Not Defined";
4435         values->bit16hfname = hf_bit16eflags;
4436         process_bitfield(it_tree, tvb, values);
4437         ioffset = ioffset+4;
4438     }
4439     if (iter_flags & DSI_SUBORDINATE_COUNT) { /* Subordinate Count */
4440         proto_tree_add_item(it_tree, hf_sub_count, tvb, ioffset, 4, TRUE);
4441         ioffset += 4;
4442     }
4443     if (iter_flags & DSI_MODIFICATION_TIME) { /* Modification Time */
4444         ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
4445         ns.nsecs = 0;
4446         proto_tree_add_time_format(it_tree, hf_es_seconds, tvb, ioffset,
4447                 4, &ns, "Modification Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
4448         ioffset = ioffset + 4;
4449     }
4450     if (iter_flags & DSI_MODIFICATION_TIMESTAMP) { /* Modification Timestamp */
4451         ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
4452         ns.nsecs = 0;
4453         proto_tree_add_time_format(it_tree, hf_es_seconds, tvb, ioffset,
4454                 4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
4455         ioffset = ioffset + 4;
4456         replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
4457         proto_tree_add_item(it_tree, hf_nds_replica_num, tvb, ioffset,
4458                 2, replica_num);
4459         ioffset = ioffset + 2;
4460         event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
4461         proto_tree_add_item(it_tree, hf_nds_event_num, tvb, ioffset,
4462                 2, event_num);
4463         ioffset = ioffset + 2;
4464     }
4465     if (iter_flags & DSI_CREATION_TIMESTAMP) { /* Creation Timestamp */
4466         ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
4467         ns.nsecs = 0;
4468         proto_tree_add_time_format(it_tree, hf_es_seconds, tvb, ioffset,
4469                 4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
4470         ioffset = ioffset + 4;
4471         replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
4472         proto_tree_add_item(it_tree, hf_nds_replica_num, tvb, ioffset,
4473                 2, replica_num);
4474         ioffset = ioffset + 2;
4475         event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
4476         proto_tree_add_item(it_tree, hf_nds_event_num, tvb, ioffset,
4477                 2, event_num);
4478         ioffset = ioffset + 2;
4479     }
4480     if (iter_flags & DSI_PARTITION_ROOT_ID) { /* Partition Root ID */
4481         values->vvalue = tvb_get_letohl(tvb, ioffset);
4482         proto_tree_add_uint_format(it_tree, hf_nds_local_partition, tvb, ioffset,
4483                 4, values->vvalue, "Partition Root ID %08x", values->vvalue);
4484         ioffset = ioffset + 4;
4485     }
4486     if (iter_flags & DSI_PARENT_ID) { /* Parent ID */
4487         values->vvalue = tvb_get_letohl(tvb, ioffset);
4488         proto_tree_add_uint_format(it_tree, hf_nds_local_partition, tvb, ioffset,
4489                 4, values->vvalue, "Parent ID %08x", values->vvalue);
4490         ioffset = ioffset + 4;
4491     }
4492     if (iter_flags & DSI_REVISION_COUNT) { /* Revision Count */
4493         values->vvalue = tvb_get_letohl(tvb, ioffset);
4494         proto_tree_add_uint_format(it_tree, hf_nds_local_partition, tvb, ioffset,
4495                 4, values->vvalue, "Revision count %08x", values->vvalue);
4496         ioffset = ioffset + 4;
4497     }
4498     if (iter_flags & DSI_REPLICA_TYPE) { /* Replica Type */
4499         values->vvalue = tvb_get_letohl(tvb, ioffset) & 0x00ff;
4500         values->vstring = val_to_str_const(values->vvalue, nds_replica_type, "No Replica Type Found");
4501         proto_tree_add_string(it_tree, hf_replica_type, tvb, ioffset,
4502         4, values->vstring);
4503         values->vvalue = tvb_get_letohl(tvb, ioffset) & 0xff00;
4504         values->vstring = val_to_str_const(values->vvalue, nds_replica_state, "No Replica State Found");
4505         proto_tree_add_string(it_tree, hf_replica_state, tvb, ioffset,
4506         4, values->vstring);
4507         ioffset = ioffset + 4;
4508     }
4509     if (iter_flags & DSI_BASE_CLASS) { /* Base Class */
4510         values->vvalue = tvb_get_letohl(tvb, ioffset);         /* Length of string */
4511         ioffset = ioffset+4;
4512         values->vstring = get_string(tvb, ioffset, values->vvalue);
4513         proto_tree_add_string_format(it_tree, hf_value_string, tvb, ioffset,
4514                 values->vvalue, values->vstring,
4515                 "Base Class: - %s", values->vstring);
4516         ioffset = ioffset+values->vvalue;
4517         ioffset += align_4(tvb, ioffset);
4518     }
4519     if (iter_flags & DSI_ENTRY_RDN) { /* Relative Distiguished Name */
4520         values->vvalue = tvb_get_letohl(tvb, ioffset);         /* Length of string */
4521         ioffset = ioffset+4;
4522         values->vstring = get_string(tvb, ioffset, values->vvalue);
4523         proto_tree_add_string_format(it_tree, hf_value_string, tvb, ioffset,
4524                  values->vvalue, values->vstring,
4525                  "Relative Distinguished Name - %s", values->vstring);
4526         ioffset = ioffset+values->vvalue;
4527         ioffset += align_4(tvb, ioffset);
4528     }
4529     if (iter_flags & DSI_ENTRY_DN) { /* Distinguished Name */
4530         values->vvalue = tvb_get_letohl(tvb, ioffset);         /* Length of string */
4531         ioffset = ioffset+4;
4532         values->vstring = get_string(tvb, ioffset, values->vvalue);
4533         proto_tree_add_string_format(it_tree, hf_value_string, tvb, ioffset,
4534                  values->vvalue, values->vstring,
4535                  "Distinguished Name - %s", values->vstring);
4536         ioffset = ioffset+values->vvalue;
4537         ioffset += align_4(tvb, ioffset);
4538     }
4539     if (iter_flags & DSI_PARTITION_ROOT_DN) { /* Root Distinguished Name */
4540         values->vvalue = tvb_get_letohl(tvb, ioffset);         /* Length of string */
4541         ioffset = ioffset+4;
4542         values->vstring = get_string(tvb, ioffset, values->vvalue);
4543         proto_tree_add_string_format(it_tree, hf_value_string, tvb, ioffset,
4544                  values->vvalue, values->vstring,
4545                  "Root Distinguished Name - %s", values->vstring);
4546         ioffset = ioffset+values->vvalue;
4547         ioffset += align_4(tvb, ioffset);
4548     }
4549     if (iter_flags & DSI_PARENT_DN) { /* Parent Distinguished Name */
4550         values->vvalue = tvb_get_letohl(tvb, ioffset);         /* Length of string */
4551         ioffset = ioffset+4;
4552         values->vstring = get_string(tvb, ioffset, values->vvalue);
4553         proto_tree_add_string_format(it_tree, hf_value_string, tvb, ioffset,
4554                  values->vvalue, values->vstring,
4555                  "Parent Distinguished Name - %s", values->vstring);
4556         ioffset = ioffset+values->vvalue;
4557         ioffset += align_4(tvb, ioffset);
4558     }
4559     if (iter_flags & DSI_PURGE_TIME) { /* Purge Time */
4560         ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
4561         ns.nsecs = 0;
4562         proto_tree_add_time(it_tree, hf_nds_purge, tvb, ioffset, 4, &ns);
4563         ioffset = ioffset + 4;
4564     }
4565     if (iter_flags & DSI_DEREFERENCED_BASE_CLASS) { /* Dereference Base Class */
4566         values->vvalue = tvb_get_letohl(tvb, ioffset);
4567         ioffset = ioffset + 4;
4568         values->vstring = get_string(tvb, ioffset, values->vvalue);
4569         proto_tree_add_string(it_tree, hf_deref_base, tvb, ioffset,
4570                 values->vvalue, values->vstring);
4571         ioffset = ioffset + values->vvalue;
4572     }
4573     if (iter_flags & DSI_REPLICA_NUMBER) { /* Replica Number */
4574         values->vvalue = tvb_get_letohl(tvb, ioffset); /* Replica number */
4575         proto_tree_add_uint_format(it_tree, hf_replica_number, tvb, ioffset,
4576                  4, values->vvalue, "Replica Number %d", values->vvalue);
4577         ioffset = ioffset+4;
4578     }
4579     if (iter_flags & DSI_REPLICA_STATE) { /* Replica State */
4580         values->vvalue = tvb_get_letohl(tvb, ioffset) & 0xff00;
4581         values->vstring = val_to_str_const(values->vvalue, nds_replica_state, "No Replica State Found");
4582         proto_tree_add_string(it_tree, hf_replica_state, tvb, ioffset,
4583         4, values->vstring);
4584         ioffset = ioffset + 2;
4585     }
4586     if (iter_flags & DSI_FEDERATION_BOUNDARY) { /* Federation Boundary */
4587         values->vvalue = tvb_get_letohl(tvb, ioffset);
4588         proto_tree_add_uint_format(it_tree, hf_nds_uint32value, tvb, ioffset,
4589                 4, values->vvalue, "Federation Boundary %d", values->vvalue);
4590         ioffset = ioffset+4;
4591     }
4592     if (iter_flags & DSI_SCHEMA_BOUNDARY) { /* Schema Boundary */
4593         values->vvalue = tvb_get_letohl(tvb, ioffset);
4594         proto_tree_add_uint_format(it_tree, hf_nds_uint32value, tvb, ioffset,
4595                 4, values->vvalue, "Schema Boundary %d", values->vvalue);
4596         ioffset = ioffset+4;
4597     }
4598     if (iter_flags & DSI_FEDERATION_BOUNDARY_ID) { /* Federation Boundary ID */
4599         values->vvalue = tvb_get_letohl(tvb, ioffset);
4600         proto_tree_add_uint_format(it_tree, hf_nds_uint32value, tvb, ioffset,
4601                 4, values->vvalue, "Federation Boundary ID %d", values->vvalue);
4602         ioffset = ioffset+4;
4603     }
4604     if (iter_flags & DSI_SCHEMA_BOUNDARY_ID) { /* Schema Boundary ID*/
4605         values->vvalue = tvb_get_letohl(tvb, ioffset);
4606         proto_tree_add_uint_format(it_tree, hf_nds_uint32value, tvb, ioffset,
4607                 4, values->vvalue, "Schema Boundary ID %d", values->vvalue);
4608         ioffset = ioffset+4;
4609     }
4610     if (iter_flags & DSI_CUR_SUBCOUNT) { /* Current Subcount */
4611         values->vvalue = tvb_get_letohl(tvb, ioffset);
4612         proto_tree_add_uint_format(it_tree, hf_nds_uint32value, tvb, ioffset,
4613                 4, values->vvalue, "Current Subcount %d", values->vvalue);
4614         ioffset = ioffset+4;
4615     }
4616     if (iter_flags & DSI_LOCAL_ENTRY_FLAGS) { /* Local Entry Flags */
4617         values->vvalue = tvb_get_letohl(tvb, ioffset);
4618         values->vtype = VTYPE_BITFIELD;
4619         values->vdesc = "Local Entry Flags:";
4620         values->vlength = 2;
4621         values->hfname= hf_nds_eflags;
4622         values->voffset = ioffset;
4623         values->bit1 = "Alias Entry";
4624         values->bit1hfname = hf_bit1eflags;
4625         values->bit2 = "Partition Root";
4626         values->bit2hfname = hf_bit2eflags;
4627         values->bit3 = "Container Entry";
4628         values->bit3hfname = hf_bit3eflags;
4629         values->bit4 = "Container Alias";
4630         values->bit4hfname = hf_bit4eflags;
4631         values->bit5 = "Matches List Filter";
4632         values->bit5hfname = hf_bit5eflags;
4633         values->bit6 = "Reference Entry";
4634         values->bit6hfname = hf_bit6eflags;
4635         values->bit7 = "40x Reference Entry";
4636         values->bit7hfname = hf_bit7eflags;
4637         values->bit8 = "Back Linked";
4638         values->bit8hfname = hf_bit8eflags;
4639         values->bit9 = "New Entry";
4640         values->bit9hfname = hf_bit9eflags;
4641         values->bit10 = "Temporary Reference";
4642         values->bit10hfname = hf_bit10eflags;
4643         values->bit11 = "Audited";
4644         values->bit11hfname = hf_bit11eflags;
4645         values->bit12 = "Entry Not Present";
4646         values->bit12hfname = hf_bit12eflags;
4647         values->bit13 = "Entry Verify CTS";
4648         values->bit13hfname = hf_bit13eflags;
4649         values->bit14 = "Entry Damaged";
4650         values->bit14hfname = hf_bit14eflags;
4651         values->bit15 = "Not Defined";
4652         values->bit15hfname = hf_bit15eflags;
4653         values->bit16 = "Not Defined";
4654         values->bit16hfname = hf_bit16eflags;
4655         process_bitfield(it_tree, tvb, values);
4656         ioffset = ioffset+4;
4657     }
4658     values->voffset = ioffset;
4659     return;
4662 static void
4663 dissect_nds_iterator(proto_tree *it_tree, tvbuff_t *tvb, packet_info *pinfo, guint32 it_verb, guint32 request_flags, guint32 ioffset, gboolean request_reply)
4665     guint32     rcode, i, number_of_items, number_to_get;
4666     const char  *error_string, *verb_string;
4667     nds_val     values;
4668     proto_tree  *it_subtree, *it_subtree1;
4669     proto_item  *it_subitem, *it_subitem1;
4670     proto_item  *expert_item;
4672     values.vtype = 0;
4673     values.vvalue = 0;
4674     values.vlength = 0;
4675     values.voffset = 0;
4676     values.hfname = 0;
4677     values.vdesc = "";
4678     values.vstring = NULL;
4679     values.mvtype = 0;
4680     values.vflags = 0;
4683     while (TRUE) {
4684         verb_string = val_to_str_const(it_verb, iterator_subverbs, "(No Iteration Verb Found)");
4685         it_subitem = proto_tree_add_uint_format(it_tree, hf_ncp_nds_iterverb, tvb, ioffset-4, 4,
4686             it_verb, "Iterator Verb: %d, (0x%04x), %s",
4687             it_verb, it_verb, verb_string);
4689         it_subtree = proto_item_add_subtree(it_subitem, ett_nds);
4691         if (request_reply) { /* Request packets */
4692             switch (it_verb) {
4693             case IT_ATFIRST:
4694             case IT_ATEOF:
4695             case IT_ATLAST:
4696             case IT_ATBOF:
4697             case IT_CLEAR:
4698             case IT_COPY:
4699                 break;
4700             case IT_COUNT:
4701                 proto_tree_add_item(it_subtree, hf_timelimit, tvb, ioffset, 4, TRUE);
4702                 ioffset += 4;
4703                 proto_tree_add_item(it_subtree, hf_max_entries, tvb, ioffset, 4, TRUE);
4704                 ioffset += 4;
4705                 proto_tree_add_item(it_subtree, hf_move_position, tvb, ioffset, 4, TRUE);
4706                 ioffset += 4;
4707                 break;
4708             case IT_CREATE:
4709             case IT_CURRENT:
4710             case IT_DESTROY:
4711             case IT_DONE:
4712                 break;
4713             case IT_FIRST:
4714                 proto_tree_add_item(it_subtree, hf_timelimit, tvb, ioffset, 4, TRUE);
4715                 ioffset += 4;
4716                 break;
4717             case IT_GETPOSITION:
4718             case IT_ISPOSITIONABLE:
4719                 break;
4720             case IT_LAST:
4721                 proto_tree_add_item(it_subtree, hf_timelimit, tvb, ioffset, 4, TRUE);
4722                 ioffset += 4;
4723                 break;
4724             case IT_NEXT:
4725             case IT_PREV:
4726                 proto_tree_add_item(it_subtree, hf_timelimit, tvb, ioffset, 4, TRUE);
4727                 ioffset += 4;
4728                 proto_tree_add_item(it_subtree, hf_num_to_get, tvb, ioffset, 4, TRUE);
4729                 ioffset += 4;
4730                 break;
4731             case IT_POSITION:
4732                 proto_tree_add_item(it_subtree, hf_iter_position, tvb, ioffset, 4, TRUE);
4733                 ioffset += 4;
4734                 proto_tree_add_item(it_subtree, hf_timelimit, tvb, ioffset, 4, TRUE);
4735                 ioffset += 4;
4736                 break;
4737             case IT_POSITION_IT:
4738                 proto_tree_add_item(it_subtree, hf_iter_other, tvb, ioffset, 4, TRUE);
4739                 ioffset += 4;
4740                 break;
4741             case IT_SETINDEX:
4742                 proto_tree_add_item(it_subtree, hf_nds_number_of_items, tvb, ioffset, 4, TRUE);
4743                 number_of_items = tvb_get_letohl(tvb, ioffset);
4744                 ioffset += 4;
4745                 for (i=0; i < number_of_items; i++) {
4746                     /* Process the attribute tag */
4747 #if 0
4748                     values.vvalue = tvb_get_letohl(tvb, ioffset);
4749                     values.vstring = val_to_str_const(values.vvalue, nds_tags, "No Tags Set");
4750                     proto_tree_add_string(it_subtree, hf_nds_tag_string, tvb, ioffset, 4, values.vstring);
4751 #endif
4752                     proto_tree_add_item(it_subtree, hf_iter_index, tvb, ioffset, 4, TRUE);
4753                     ioffset = ioffset + 4;
4755                     /* start of DCWPutAttribute */
4756 #if 0
4757                     values.vvalue = tvb_get_letohl(tvb, ioffset);
4758                     ioffset = ioffset + 4;
4759                     values.vstring = get_string(tvb, ioffset, values.vvalue);
4760                     proto_tree_add_string(it_subtree, hf_mv_string, tvb, ioffset,
4761                             values.vvalue, values.vstring);
4762                     ioffset = ioffset + values.vvalue;
4763 #endif
4764                     /* end of DCWPutAttribute */
4766 #if 0
4767                     ioffset += align_4(tvb, ioffset);
4768 #endif
4769                     if (tvb_length_remaining(tvb, ioffset) < 4) {
4770                         THROW(ReportedBoundsError);
4771                         return;
4772                     }
4773                 }
4774                 break;
4775             case IT_SETFILTER:
4777                 values.voffset = ioffset;
4779                 /* DCWPutSearchExp  = process_set_filter() */
4780                 process_set_filter(it_subtree, tvb, pinfo, &values);
4782                 ioffset = values.voffset;
4783                 ioffset += align_4(tvb, ioffset);
4784                 break;
4785             case IT_SKIP:
4786                 proto_tree_add_item(it_subtree, hf_timelimit, tvb, ioffset, 4, TRUE);
4787                 ioffset += 4;
4788                 proto_tree_add_item(it_subtree, hf_num_to_skip, tvb, ioffset, 4, TRUE);
4789                 ioffset += 4;
4790                 break;
4791             case IT_TYPEDOWN:
4792                 proto_tree_add_item(it_subtree, hf_num_to_get, tvb, ioffset, 4, TRUE);
4793                 number_to_get = tvb_get_letohl(tvb, ioffset);
4794                 ioffset += 4;
4795                 if (number_to_get == 0) {
4796                     values.vvalue = tvb_get_letohl(tvb, ioffset);
4797                     values.vstring = val_to_str_const(values.vvalue, nds_tags, "No Tags Set");
4798                     proto_tree_add_string(it_tree, hf_nds_tag_string, tvb, ioffset, 4, values.vstring);
4799                     ioffset = ioffset + 4;
4801                 }
4802                 values.vvalue = tvb_get_letohl(tvb, ioffset);
4803                 ioffset = ioffset + 4;
4804                 values.vstring = get_string(tvb, ioffset, values.vvalue);
4805                 proto_tree_add_string(it_subtree, hf_mv_string, tvb, ioffset,
4806                         values.vvalue, values.vstring);
4807                 ioffset = ioffset + values.vvalue;
4808                 ioffset += align_4(tvb, ioffset);
4809                 break;
4810             default:
4811                 if (tvb_length_remaining(tvb, ioffset) < 4) {
4812                     THROW(ReportedBoundsError);
4813                 }
4814                 return;
4815             }
4816         }
4817         else    /* Reply Packets */
4818         {                                           /* All replies include a completion code first */
4819             rcode = tvb_get_letohl(tvb, ioffset);
4820             error_string = val_to_str_const(rcode, nds_reply_errors, "Unknown Interation Verb Completion Code");
4821             expert_item = proto_tree_add_uint_format(it_subtree, hf_iter_verb_completion_code, tvb, ioffset,
4822                     4, rcode, "Completion Code: 0x%08x, %s",
4823                     rcode, error_string );
4825             if (rcode != 0 && ncp_echo_err) {
4826                 expert_add_info_format(pinfo, expert_item, &ei_iter_verb_completion_code, "Iteration Verb Error: 0x%08x %s", rcode, error_string);
4827             }
4828             ioffset += 4;
4830             switch (it_verb) {
4831             case IT_ATFIRST:
4832             case IT_ATEOF:
4833             case IT_ATLAST:
4834             case IT_ATBOF:
4835                 proto_tree_add_item(it_subtree, hf_iter_ans, tvb, ioffset, 4, TRUE);
4836                 ioffset += 4;
4837                 break;
4838             case IT_CLEAR:
4839                 break;
4840             case IT_COPY:
4841                 proto_tree_add_item(it_subtree, hf_iter_copy, tvb, ioffset, 4, TRUE);
4842                 ioffset += 4;
4843                 break;
4844             case IT_COUNT:
4845                 proto_tree_add_item(it_subtree, hf_this_count, tvb, ioffset, 4, TRUE);
4846                 ioffset += 4;
4847                 break;
4848             case IT_CREATE:
4849                 proto_tree_add_item(it_subtree, hf_nds_iterator, tvb, ioffset, 4, TRUE);
4850                 ioffset += 4;
4851                 break;
4852             case IT_CURRENT:
4853             case IT_NEXT:
4854             case IT_PREV:
4855             case IT_FIRST:
4856             case IT_LAST:
4857                 values.vvalue = tvb_get_letohl(tvb, ioffset);
4858                 values.vstring = val_to_str_const(values.vvalue, nds_info_type, "No Info Type Set");
4859                 proto_tree_add_string(it_subtree, hf_nds_info_type, tvb, ioffset, 4, values.vstring);
4860                 ioffset = ioffset + 4;
4861                 proto_tree_add_item(it_subtree, hf_data_size, tvb, ioffset, 4, TRUE);
4862                 ioffset += 4;
4863                 number_of_items = tvb_get_letohl(tvb, ioffset);
4864                 proto_tree_add_item(it_subtree, hf_this_count, tvb, ioffset, 4, TRUE);
4865                 ioffset += 4;
4866                 for (i = 0; i < number_of_items; i++)
4867                 {
4868                     it_subitem1 = proto_tree_add_text(it_subtree, tvb, ioffset, -1, "Item #: %u", i+1);
4869                     it_subtree1 = proto_item_add_subtree(it_subitem1, ett_nds);
4871                     ioffset += align_4(tvb, ioffset);
4873                     /* Start WGetAndBufferEntryInfo = process_entry_info() */
4874                     values.voffset = ioffset;
4875                     values.vflags = request_flags;
4876                     process_entry_info(it_subtree1, tvb, &values);
4877                     ioffset = values.voffset;
4878                     /* End WGetAndBufferEntryInfo */
4880                     ioffset += align_4(tvb, ioffset);
4882                     /* WGetReadBuffer - This seems to be a count and then size field (2 * guint32) */
4883                     /* For now we will just skip this offset. NEED TO ADD LOGIC TO HANDLE */
4884                     ioffset += 8;
4886                     if (tvb_length_remaining(tvb, ioffset) < 4) {
4887                         break;
4888                     }
4889                 }
4890                 break;
4891             case IT_DESTROY:
4892             case IT_DONE:
4893                 break;
4894             case IT_GETPOSITION:
4895                 proto_tree_add_item(it_subtree, hf_iter_position, tvb, ioffset, 4, TRUE);
4896                 ioffset += 4;
4897                 break;
4898             case IT_ISPOSITIONABLE:
4899                 proto_tree_add_item(it_subtree, hf_positionable, tvb, ioffset, 4, TRUE);
4900                 ioffset += 4;
4901                 break;
4902             case IT_POSITION:
4903             case IT_POSITION_IT:
4904             case IT_SETFILTER:
4905             case IT_TYPEDOWN:
4906                 break;
4907             case IT_SETINDEX:
4908                 proto_tree_add_item(it_subtree, hf_iter_index, tvb, ioffset, 4, TRUE);
4909                 ioffset += 4;
4910                 break;
4911             case IT_SKIP:
4912                 proto_tree_add_item(it_subtree, hf_num_skipped, tvb, ioffset, 4, TRUE);
4913                 ioffset += 4;
4914                 break;
4915             default:
4916                 if (tvb_length_remaining(tvb, ioffset) < 4) {
4917                     THROW(ReportedBoundsError);
4918                 }
4919                 return;
4920             }
4921         }
4922         it_verb = tvb_get_letohl(tvb, ioffset);
4923         ioffset += 4;
4924         if (it_verb == IT_DONE || tvb_length_remaining(tvb, ioffset) < 4) {
4925             verb_string = val_to_str_const(it_verb, iterator_subverbs, "Internal error processing NDS iteration verbs");
4926             proto_tree_add_uint_format(it_tree, hf_ncp_nds_iterverb, tvb, ioffset-4, 4,
4927                 it_verb, "Iterator Verb: %d, (0x%04x), %s",
4928                 it_verb, it_verb, verb_string);
4929             break;
4930         }
4931     }
4932     return;
4936 static void
4937 process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds_val *values)
4939     guint32         i;
4940     guint32         r;
4941     guint32         ioffset = 0, oldioffset;
4942     guint32         value1 = 0;
4943     guint32         value2 = 0;
4944     guint8          value3 = 0;
4945     guint32         value4 = 0;
4946     gint            value5 = 0;
4947     guint32         value6 = 0;
4948     guint32         value7 = 0;
4949     const char      *valuestr = "";
4950     proto_tree      *ntree;
4951     proto_tree      *atree;
4952     proto_item      *nitem;
4953     proto_item      *aitem;
4954     guint32         number_of_referrals = 0;
4955     proto_tree      *estree;
4956     proto_item      *esitem;
4957     guint16         replica_num = 0;
4958     guint16         event_num = 0;
4959     guint32         bvalue=0;
4960     nds_val         temp_values;
4961     proto_tree      *sub1tree;
4962     proto_item      *sub1item;
4963     proto_tree      *sub2tree;
4964     proto_item      *sub2item;
4965     gint            length_remaining;
4966     nstime_t        ns;
4968     mv_resolve_name_string[0] = '\0';
4969     values->vstring = "";
4971     /* Is the value passed a string or UINT32? */
4972     if(values->mvtype != MVTYPE_LIST_PARTITIONS && values->mvtype != MVTYPE_PROCESS_TAGS)
4973     {
4974         nitem = proto_tree_add_uint_format(ncp_tree, values->hfname, tvb, values->voffset+ioffset,
4975                                            values->vlength, values->vvalue, values->vdesc, values->vvalue);
4976     }
4977     else
4978     {
4979         nitem = proto_tree_add_string_format(ncp_tree, values->hfname, tvb, values->voffset+ioffset,
4980                                              values->vlength, values->vdesc, "%s", values->vdesc);
4981     }
4982     ioffset = (values->voffset+4);
4984     ntree = proto_item_add_subtree(nitem, ett_nds);
4986     switch (values->mvtype)
4987     {
4988     case MVTYPE_ATTR_REQUEST:   /* Attribute Request */
4989         for (i = 1 ; i <= values->vvalue; i++ )
4990         {
4991             ioffset += align_4(tvb, ioffset);
4992             value1 = tvb_get_letohl(tvb, ioffset);
4993             ioffset = ioffset + 4;
4994             values->vstring = get_string(tvb, ioffset, value1);
4995             proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset,
4996                                   value1, values->vstring);
4997             ioffset = ioffset + value1;
4998         }
4999         break;
5001     case MVTYPE_ATTR_REPLY:     /* Attribute Reply */
5002         switch(values->vflags)
5003         {
5004         case 0:
5005             for (i = 1 ; i <= values->vvalue; i++ )
5006             {
5007                 ioffset += align_4(tvb, ioffset);
5008                 value1 = tvb_get_letohl(tvb, ioffset);
5009                 ioffset = ioffset + 4;
5010                 values->vstring = get_string(tvb, ioffset, value1);
5011                 proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset,
5012                                       value1, values->vstring);
5013                 ioffset = ioffset + value1;
5014             }
5015             break;
5016         case 1:
5017             for (i = 1 ; i <= values->vvalue; i++ )
5018             {
5019                 value1 = tvb_get_letohl(tvb, ioffset);
5020                 values->vstring = val_to_str_const(value1, nds_syntax, "No Syntax Found");
5021                 proto_tree_add_string(ntree, hf_nds_syntax, tvb, ioffset,
5022                                       4, values->vstring);
5023                 ioffset = ioffset + 4;
5024                 value2 = tvb_get_letohl(tvb, ioffset);
5025                 ioffset = ioffset + 4;
5026                 values->vstring = get_string(tvb, ioffset, value2);
5027                 proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset,
5028                                       value2, values->vstring);
5029                 ioffset += value2;
5030                 ioffset += align_4(tvb, ioffset);
5031                 values->voffset = ioffset;
5033                 print_nds_values(ntree, tvb, value1, values);
5034                 ioffset = values->voffset;
5035             }
5036             break;
5037         case 2:
5038             for (i = 1 ; i <= values->vvalue; i++ )
5039             {
5040                 value1 = tvb_get_letohl(tvb, ioffset);
5041                 values->vstring = val_to_str_const(value1, nds_syntax, "No Syntax Found");
5042                 proto_tree_add_string(ntree, hf_nds_syntax, tvb, ioffset,
5043                                       4, values->vstring);
5044                 ioffset = ioffset + 4;
5045                 value2 = tvb_get_letohl(tvb, ioffset);
5046                 ioffset = ioffset + 4;
5047                 values->vstring = get_string(tvb, ioffset, value2);
5048                 proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset,
5049                                       value2, values->vstring);
5050                 values->voffset=ioffset + value2;
5051                 ioffset += value2;
5052                 ioffset += align_4(tvb, ioffset);
5053                 value3 = tvb_get_letohl(tvb, ioffset);
5055                 proto_tree_add_uint_format(ntree, hf_nds_uint32value, tvb, ioffset, 4,
5056                                            value3, "Number of Values - %u", value3);
5058                 ioffset = ioffset + 4;
5059                 for (r = 1 ; r <= value3; r++ )
5060                 {
5061                     ioffset += 4;   /* Length = 4 */
5062                     value4 = tvb_get_letohl(tvb, ioffset);
5063                     tvb_ensure_bytes_exist(tvb, ioffset, values->vlength);
5064                     proto_tree_add_uint(ntree, hf_nds_privileges, tvb, ioffset,
5065                                         values->vlength, value4);
5067                     ioffset = ioffset+4;
5068                 }
5069             }
5070             break;
5071         case 3:
5072             for (i = 1 ; i <= values->vvalue; i++ )
5073             {
5074                 value1 = tvb_get_letohl(tvb, ioffset);
5075                 values->vstring = val_to_str_const(value1, nds_syntax, "No Syntax Found");
5076                 proto_tree_add_string(ntree, hf_nds_syntax, tvb, ioffset,
5077                                       4, values->vstring);
5078                 ioffset = ioffset + 4;
5079                 value2 = tvb_get_letohl(tvb, ioffset);
5080                 ioffset = ioffset + 4;
5081                 values->vstring = get_string(tvb, ioffset, value2);
5082                 proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset,
5083                                       value2, values->vstring);
5084                 ioffset = ioffset + value2;
5085                 ioffset += align_4(tvb, ioffset);
5086                 value3 = tvb_get_letohl(tvb, ioffset);
5088                 aitem = proto_tree_add_uint_format(ntree, hf_nds_uint32value, tvb, ioffset, 4,
5089                                                    value3, "Number of Values - %u", value3);
5091                 atree = proto_item_add_subtree(aitem, ett_nds);
5093                 ioffset = ioffset + 4;
5094                 for (r = 1 ; r <= value3; r++ )
5095                 {
5096                     ioffset += align_4(tvb, ioffset);
5097                     temp_values.vvalue = tvb_get_letohl(tvb, ioffset);
5098                     temp_values.vlength = 2;
5099                     temp_values.hfname = hf_nds_vflags;
5100                     temp_values.voffset = ioffset;
5101                     temp_values.vdesc = "Value Flags";
5102                     temp_values.bit1 = "Naming";
5103                     temp_values.bit1hfname = hf_bit1vflags;
5104                     temp_values.bit2 = "Base Class";
5105                     temp_values.bit2hfname = hf_bit2vflags;
5106                     temp_values.bit3 = "Present";
5107                     temp_values.bit3hfname = hf_bit3vflags;
5108                     temp_values.bit4 = "Value Damaged";
5109                     temp_values.bit4hfname = hf_bit4vflags;
5110                     temp_values.bit5 = "Not Defined";
5111                     temp_values.bit5hfname = hf_bit5vflags;
5112                     temp_values.bit6 = "Not Defined";
5113                     temp_values.bit6hfname = hf_bit6vflags;
5114                     temp_values.bit7 = "Not Defined";
5115                     temp_values.bit7hfname = hf_bit7vflags;
5116                     temp_values.bit8 = "Not Defined";
5117                     temp_values.bit8hfname = hf_bit8vflags;
5118                     temp_values.bit9 = "Not Defined";
5119                     temp_values.bit9hfname = hf_bit9vflags;
5120                     temp_values.bit10 = "Not Defined";
5121                     temp_values.bit10hfname = hf_bit10vflags;
5122                     temp_values.bit11 = "Not Defined";
5123                     temp_values.bit11hfname = hf_bit11vflags;
5124                     temp_values.bit12 = "Not Defined";
5125                     temp_values.bit12hfname = hf_bit12vflags;
5126                     temp_values.bit13 = "Not Defined";
5127                     temp_values.bit13hfname = hf_bit13vflags;
5128                     temp_values.bit14 = "Not Defined";
5129                     temp_values.bit14hfname = hf_bit14vflags;
5130                     temp_values.bit15 = "Not Defined";
5131                     temp_values.bit15hfname = hf_bit15vflags;
5132                     temp_values.bit16 = "Not Defined";
5133                     temp_values.bit16hfname = hf_bit16vflags;
5134                     process_bitfield(atree, tvb, &temp_values);
5135                     ioffset = ioffset + 4;
5136                     ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
5137                     ns.nsecs = 0;
5138                     proto_tree_add_time_format(atree, hf_es_seconds, tvb, ioffset,
5139                                                4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
5140                     ioffset = ioffset + 4;
5141                     replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
5142                     proto_tree_add_item(atree, hf_nds_replica_num, tvb, ioffset,
5143                                         2, replica_num);
5144                     ioffset = ioffset + 2;
5145                     event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
5146                     proto_tree_add_item(atree, hf_nds_event_num, tvb, ioffset,
5147                                         2, event_num);
5148                     ioffset = ioffset + 2;
5149                     value5 = tvb_get_letohl(tvb, ioffset); /* length of field */
5150                     if(value5 > tvb_length_remaining(tvb, ioffset))
5151                     {
5152                         break;
5153                     }
5154                     ioffset += 4;
5155                     tvb_ensure_bytes_exist(tvb, ioffset, value5);
5156                     proto_tree_add_bytes(atree, hf_value_bytes, tvb, ioffset, value5, tvb_get_ptr(tvb, ioffset, value5));
5157                     ioffset += value5;
5158                     ioffset += (value5%2);
5159                 }
5160             }
5161             break;
5162         case 4:
5163             for (i = 1 ; i <= values->vvalue; i++ )
5164             {
5165                 value1 = tvb_get_letohl(tvb, ioffset);
5166                 values->vstring = val_to_str_const(value1, nds_syntax, "No Syntax Found");
5167                 proto_tree_add_string(ntree, hf_nds_syntax, tvb, ioffset,
5168                                       4, values->vstring);
5169                 ioffset = ioffset + 4;
5170                 value2 = tvb_get_letohl(tvb, ioffset);
5171                 ioffset = ioffset + 4;
5172                 values->vstring = get_string(tvb, ioffset, value2);
5173                 proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset,
5174                                       value2, values->vstring);
5175                 ioffset = ioffset + value2;
5176                 value3 = tvb_get_letohl(tvb, ioffset);
5178                 proto_tree_add_uint_format(ntree, hf_nds_uint32value, tvb, ioffset, 4,
5179                                            value3, "Number of Values - %u", value3);
5181                 ioffset = ioffset + 4;
5182                 for (r = 1 ; r <= value3; r++ )
5183                 {
5184                     ioffset += align_4(tvb, ioffset);
5185                     temp_values.vvalue = tvb_get_letohl(tvb, ioffset);
5186                     temp_values.vlength = 2;
5187                     temp_values.hfname = hf_nds_vflags;
5188                     temp_values.voffset = ioffset;
5189                     temp_values.vdesc = "Value Flags";
5190                     temp_values.bit1 = "Naming";
5191                     temp_values.bit1hfname = hf_bit1vflags;
5192                     temp_values.bit2 = "Base Class";
5193                     temp_values.bit2hfname = hf_bit2vflags;
5194                     temp_values.bit3 = "Present";
5195                     temp_values.bit3hfname = hf_bit3vflags;
5196                     temp_values.bit4 = "Value Damaged";
5197                     temp_values.bit4hfname = hf_bit4vflags;
5198                     temp_values.bit5 = "Not Defined";
5199                     temp_values.bit5hfname = hf_bit5vflags;
5200                     temp_values.bit6 = "Not Defined";
5201                     temp_values.bit6hfname = hf_bit6vflags;
5202                     temp_values.bit7 = "Not Defined";
5203                     temp_values.bit7hfname = hf_bit7vflags;
5204                     temp_values.bit8 = "Not Defined";
5205                     temp_values.bit8hfname = hf_bit8vflags;
5206                     temp_values.bit9 = "Not Defined";
5207                     temp_values.bit9hfname = hf_bit9vflags;
5208                     temp_values.bit10 = "Not Defined";
5209                     temp_values.bit10hfname = hf_bit10vflags;
5210                     temp_values.bit11 = "Not Defined";
5211                     temp_values.bit11hfname = hf_bit11vflags;
5212                     temp_values.bit12 = "Not Defined";
5213                     temp_values.bit12hfname = hf_bit12vflags;
5214                     temp_values.bit13 = "Not Defined";
5215                     temp_values.bit13hfname = hf_bit13vflags;
5216                     temp_values.bit14 = "Not Defined";
5217                     temp_values.bit14hfname = hf_bit14vflags;
5218                     temp_values.bit15 = "Not Defined";
5219                     temp_values.bit15hfname = hf_bit15vflags;
5220                     temp_values.bit16 = "Not Defined";
5221                     temp_values.bit16hfname = hf_bit16vflags;
5222                     process_bitfield(ntree, tvb, &temp_values);
5223                     ioffset = ioffset + 4;
5224                     ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
5225                     ns.nsecs = 0;
5226                     proto_tree_add_time_format(ntree, hf_es_seconds, tvb, ioffset,
5227                                                4, &ns, "Creation Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
5228                     ioffset = ioffset + 4;
5229                     replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
5230                     proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset,
5231                                         2, replica_num);
5232                     ioffset = ioffset + 2;
5233                     event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
5234                     proto_tree_add_item(ntree, hf_nds_event_num, tvb, ioffset,
5235                                         2, event_num);
5236                     ioffset = ioffset + 2;
5237                     value1 = tvb_get_letohl(tvb, ioffset);
5238                     proto_tree_add_uint(ntree, hf_nds_value_len, tvb, ioffset,
5239                                         4, value1);
5240                     ioffset = ioffset + 4;
5241                 }
5242             }
5243             break;
5244         default:
5245             break;
5246         }
5247         break;
5249     case MVTYPE_ATTR_REQUEST2:    /* Attribute Request */
5250         oldioffset = 0;
5251         for (i = 1 ; i <= values->vvalue; i++ )
5252         {
5253             if (oldioffset >= ioffset) {
5254                 proto_tree_add_text(ntree, tvb, 0, 0, "[ Invalid offset: %u ]", ioffset);
5255                 THROW(ReportedBoundsError);
5256             }
5257             oldioffset = ioffset;
5258             ioffset += align_4(tvb, ioffset);
5259             value1 = tvb_get_letohl(tvb, ioffset);
5260             proto_tree_add_uint_format(ntree, hf_nds_uint32value, tvb, ioffset,
5261                                        4, value1, "Value %d", value1);
5262             ioffset = ioffset + value1;
5263         }
5264         break;
5266     case MVTYPE_ADD_ATTR_REQUEST: /* Add Attribute Request */
5267         for (i = 1 ; i <= values->vvalue; i++ )
5268         {
5269             value1 = tvb_get_letohl(tvb, ioffset);
5270             ioffset = ioffset + 4;
5271             values->vstring = get_string(tvb, ioffset, value1);
5272             proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset,
5273                                   value1, values->vstring);
5274             ioffset = ioffset + value1;
5275             ioffset += align_4(tvb, ioffset);
5276             values->voffset = ioffset;
5277             print_nds_values(ntree, tvb, 9, values);
5278             ioffset = values->voffset;
5279         }
5280         break;
5282     case MVTYPE_READ_CLASS_REQ:   /* Read Class Request */
5283         for (i = 1 ; i <= values->vvalue; i++ )
5284         {
5285             ioffset += align_4(tvb, ioffset);
5286             value1 = tvb_get_letohl(tvb, ioffset);
5287             ioffset = ioffset + 4;
5288             values->vstring = get_string(tvb, ioffset, value1);
5289             proto_tree_add_string(ntree, hf_nds_base, tvb, ioffset,
5290                                   value1, values->vstring);
5291             values->mvtype = MVTYPE_ATTR_REQUEST;
5292             ioffset = ioffset + value1;
5293         }
5294         break;
5296     case MVTYPE_READ_REPLICAS:    /* Read Replicas */
5297         for (i = 1 ; i <= values->vvalue; i++ )
5298         {
5299             bvalue = 0x00000001;
5301             for (r = 0 ; r < 9; r++ )
5302             {
5303                 if (values->vflags & bvalue)
5304                 {
5305                     switch(bvalue)
5306                     {
5307                     case 0x00000001:                /*p3values.bit1 = "Output Flags"*/
5308                         temp_values.vvalue = tvb_get_letohl(tvb, ioffset);
5309                         temp_values.vlength = 2;
5310                         temp_values.hfname = hf_nds_rflags;
5311                         temp_values.voffset = ioffset;
5312                         temp_values.vdesc = "Output Flags";
5313                         temp_values.bit1 = values->bit1;
5314                         temp_values.bit1hfname = hf_bit1outflags;
5315                         temp_values.bit2 = values->bit2;
5316                         temp_values.bit2hfname = hf_bit2outflags;
5317                         temp_values.bit3 = values->bit3;
5318                         temp_values.bit3hfname = hf_bit3outflags;
5319                         temp_values.bit4 = values->bit4;
5320                         temp_values.bit4hfname = hf_bit4outflags;
5321                         temp_values.bit5 = values->bit5;
5322                         temp_values.bit5hfname = hf_bit5outflags;
5323                         temp_values.bit6 = values->bit6;
5324                         temp_values.bit6hfname = hf_bit6outflags;
5325                         temp_values.bit7 = values->bit7;
5326                         temp_values.bit7hfname = hf_bit7outflags;
5327                         temp_values.bit8 = values->bit8;
5328                         temp_values.bit8hfname = hf_bit8outflags;
5329                         temp_values.bit9 = values->bit9;
5330                         temp_values.bit9hfname = hf_bit9outflags;
5331                         temp_values.bit10 = "Not Defined";
5332                         temp_values.bit10hfname = hf_bit10outflags;
5333                         temp_values.bit11 = "Not Defined";
5334                         temp_values.bit11hfname = hf_bit11outflags;
5335                         temp_values.bit12 = "Not Defined";
5336                         temp_values.bit12hfname = hf_bit12outflags;
5337                         temp_values.bit13 = "Not Defined";
5338                         temp_values.bit13hfname = hf_bit13outflags;
5339                         temp_values.bit14 = "Not Defined";
5340                         temp_values.bit14hfname = hf_bit14outflags;
5341                         temp_values.bit15 = "Not Defined";
5342                         temp_values.bit15hfname = hf_bit15outflags;
5343                         temp_values.bit16 = "Not Defined";
5344                         temp_values.bit16hfname = hf_bit16outflags;
5345                         process_bitfield(ntree, tvb, &temp_values);
5346                         ioffset = ioffset + 4;
5347                         break;
5348                     case 0x00000002:                /*p3values.bit2 = "Entry ID"*/
5349                         value1 = tvb_get_letohl(tvb, ioffset);
5350                         proto_tree_add_uint_format(ntree, hf_nds_eid, tvb, ioffset,
5351                                                    4, value1, "Entry ID %08x", value1);
5352                         ioffset = ioffset + 4;
5353                         break;
5354                     case 0x00000004:                /*p3values.bit3 = "Replica State"*/
5355                         value1 = tvb_get_letohl(tvb, ioffset);
5356                         temp_values.vstring = val_to_str_const(value1, nds_replica_state, "No Replica State Found");
5357                         proto_tree_add_string(ntree, hf_replica_state, tvb, ioffset,
5358                                               4, temp_values.vstring);
5359                         ioffset = ioffset + 4;
5360                         break;
5361                     case 0x0000008:                 /*p3values.bit4 = "Modification Timestamp"*/
5362                         ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
5363                         ns.nsecs = 0;
5364                         proto_tree_add_time_format(ntree, hf_es_seconds, tvb, ioffset,
5365                                                    4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
5366                         ioffset = ioffset + 4;
5367                         replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
5368                         proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset,
5369                                             2, replica_num);
5370                         ioffset = ioffset + 2;
5371                         event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
5372                         proto_tree_add_item(ntree, hf_nds_event_num, tvb, ioffset,
5373                                             2, event_num);
5374                         ioffset = ioffset + 2;
5375                         break;
5376                     case 0x00000010:                /*p3values.bit5 = "Purge Time"*/
5377                         ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
5378                         ns.nsecs = 0;
5379                         proto_tree_add_time(ntree, hf_nds_purge, tvb, ioffset, 4, &ns);
5380                         ioffset = ioffset + 4;
5381                         break;
5382                     case 0x00000020:                /*p3values.bit6 = "Local Partition ID"*/
5383                         value1 = tvb_get_letohl(tvb, ioffset);
5384                         proto_tree_add_uint_format(ntree, hf_nds_local_partition, tvb, ioffset,
5385                                                    4, value1, "Local Partition ID %08x", value1);
5386                         ioffset = ioffset + 4;
5387                         break;
5388                     case 0x00000040:                /*p3values.bit7 = "Distinguished Name"*/
5389                         value1 = tvb_get_letohl(tvb, ioffset);
5390                         ioffset = ioffset + 4;
5391                         temp_values.vstring = get_string(tvb, ioffset, value1);
5392                         proto_tree_add_string(ntree, hf_nds_name, tvb, ioffset,
5393                                               value1, temp_values.vstring);
5394                         ioffset = ioffset + value1;
5395                         break;
5396                     case 0x00000080:                /*p3values.bit8 = "Replica Type & State"*/
5397                         value1 = tvb_get_letohl(tvb, ioffset);
5398                         value2 = value1 & 0x00ff;
5399                         temp_values.vstring = val_to_str_const(value2, nds_replica_type, "No Replica Type Found");
5400                         proto_tree_add_string(ntree, hf_replica_type, tvb, ioffset,
5401                                               4, temp_values.vstring);
5402                         value3 = value1 & 0xff00;
5403                         temp_values.vstring = val_to_str_const(value3, nds_replica_state, "No Replica State Found");
5404                         proto_tree_add_string(ntree, hf_replica_state, tvb, ioffset,
5405                                               4, temp_values.vstring);
5406                         ioffset = ioffset + 4;
5407                         break;
5408                     case 0x00000100:                /*p3values.bit9 = "Partition Busy"*/
5409                         value1 = tvb_get_letohs(tvb, ioffset);
5410                         proto_tree_add_boolean(ntree, hf_partition_busy, tvb, ioffset, 4, value1);
5411                         ioffset += 4;
5412                         break;
5413                     default:
5414                         break;
5415                     }
5416                 }
5417                 bvalue = bvalue*2;
5418                 ioffset += align_4(tvb, ioffset);
5419                 if(tvb_length_remaining(tvb, ioffset) < 4 )
5420                 {
5421                     break;
5422                 }
5423             }
5424             if(tvb_length_remaining(tvb, ioffset) < 4 )
5425             {
5426                 break;
5427             }
5428         }
5429         break;
5431     case MVTYPE_MODIFY_ATTR_REQUEST: /* Modify Attribute Request */
5432         for (i = 0 ; i < values->vvalue; i++ )
5433         {
5434             ioffset += align_4(tvb, ioffset);
5435             value1 = tvb_get_letohl(tvb, ioffset);
5436             valuestr = val_to_str_const(value1, nds_kind_of_changes, "(Kind Change Not Found)");
5437             tvb_ensure_bytes_exist(tvb, ioffset, values->vlength);
5438             proto_tree_add_uint_format(ntree, hf_nds_uint32value, tvb, ioffset,
5439                                        values->vlength, value1, valuestr, value1);
5440             ioffset = ioffset+4;
5441             value2 = tvb_get_letohl(tvb, ioffset);
5442             ioffset = ioffset + 4;
5443             temp_values.vstring = get_string(tvb, ioffset, value2);   /* Name of Attribute */
5444             proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset,
5445                                   value2, temp_values.vstring);
5446             ioffset = ioffset + value2;
5447             ioffset += align_4(tvb, ioffset);
5448             if(value1 != 1 && value1 != 6)
5449             {
5450                 values->voffset = ioffset;
5451                 /* XX: Is values.vstring set properly at this point ?? */
5452                 print_nds_values(ntree, tvb, 9, values);
5453                 ioffset = values->voffset;
5454             }
5455         }
5456         break;
5458     case MVTYPE_ADDR_REFERRAL_REQUEST: /* Address Referral Request */
5459         for (i = 0 ; i < values->vvalue; i++ )
5460         {
5461             value1 = tvb_get_letohl(tvb, ioffset);
5462             valuestr = val_to_str_const(value1, nds_protocol_type, "(Undefined Protocol)");
5463             tvb_ensure_bytes_exist(tvb, ioffset, values->vlength);
5464             proto_tree_add_uint_format(ntree, hf_nds_uint32value, tvb, ioffset,
5465                                        values->vlength, value1, valuestr, value1);
5466             ioffset = ioffset+4;
5467         }
5468         break;
5470     case MVTYPE_ADDR_REFERRAL_REPLY: /* Address Referral Reply */
5471         number_of_referrals = values->vvalue;
5473         for (r = 1 ; r <= number_of_referrals; r++ )
5474         {
5475             aitem = proto_tree_add_uint_format(ntree, hf_referral_record, tvb, 6, 0,
5476                                                r, "NDS Referral Record #%u", r);
5477             atree = proto_item_add_subtree(aitem, ett_nds);
5479             value1 = tvb_get_letohl(tvb, ioffset);
5481             proto_tree_add_uint_format(atree, hf_referral_addcount, tvb, ioffset, 4,
5482                                        value1, "Number of Addresses in Referral - %u", value1);
5484             ioffset = ioffset + 4;
5485             for (i = 1 ; i <= value1; i++ )
5486             {
5487                 value2 = tvb_get_letohl(tvb, ioffset);
5488                 valuestr = val_to_str_const(value2, nds_protocol_type, "(Undefined Protocol)");
5489                 tvb_ensure_bytes_exist(tvb, ioffset, values->vlength);
5490                 proto_tree_add_uint_format(atree, hf_nds_uint32value, tvb, ioffset,
5491                                            values->vlength, value2, valuestr, value2);
5492                 ioffset = ioffset+4;
5493                 value3 = tvb_get_letohl(tvb, ioffset);
5494                 ioffset = ioffset+4;
5495                 switch (value2)
5496                 {
5497                 case NDS_PTYPE_IPX:
5498                     proto_tree_add_item(atree, hf_nds_net, tvb, ioffset, 4, FALSE);
5499                     proto_tree_add_item(atree, hf_nds_node, tvb, ioffset+4, 6, FALSE);
5500                     proto_tree_add_item(atree, hf_nds_socket, tvb, ioffset+10, 2, FALSE);
5501                     break;
5502                 case NDS_PTYPE_IP:
5503                     proto_tree_add_item(atree, hf_nds_port, tvb, ioffset, 2, FALSE);
5504                     proto_tree_add_item(atree, hf_add_ref_ip, tvb, ioffset+2, 4, FALSE);
5505                     break;
5506                 case NDS_PTYPE_UDP:
5507                     proto_tree_add_item(atree, hf_nds_port, tvb, ioffset, 2, FALSE);
5508                     proto_tree_add_item(atree, hf_add_ref_udp, tvb, ioffset+2, 4, FALSE);
5509                     break;
5510                 case NDS_PTYPE_TCP:
5511                     proto_tree_add_item(atree, hf_nds_port, tvb, ioffset, 2, FALSE);
5512                     proto_tree_add_item(atree, hf_add_ref_tcp, tvb, ioffset+2, 4, FALSE);
5513                     break;
5514                 case NDS_PTYPE_URL:
5515                 case NDS_PTYPE_DNS:
5516                     values->vstring = get_string(tvb, ioffset, value3);
5517                     proto_tree_add_string(atree, hf_value_string, tvb, ioffset,
5518                                           value3, values->vstring);
5519                     break;
5520                 default:
5521                     break;
5522                 }
5523                 ioffset = ioffset + value3;
5524                 ioffset += align_4(tvb, ioffset);
5525             }
5527         }
5528         break;
5530     case MVTYPE_LOC_ADDR_REFERRAL_REPLY: /* Local Address Referral Reply */
5531         number_of_referrals = values->vvalue;
5533         for (r = 1 ; r <= number_of_referrals; r++ )
5534         {
5535             aitem = proto_tree_add_uint_format(ntree, hf_referral_record, tvb, 6, 0,
5536                                                r, "NDS Referral Record #%u", r);
5537             atree = proto_item_add_subtree(aitem, ett_nds);
5539             value2 = tvb_get_letohl(tvb, ioffset);
5540             valuestr = val_to_str_const(value2, nds_protocol_type, "(Undefined Protocol)");
5541             tvb_ensure_bytes_exist(tvb, ioffset, values->vlength);
5542             proto_tree_add_uint_format(atree, hf_nds_uint32value, tvb, ioffset,
5543                                        values->vlength, value2, valuestr, value2);
5544             ioffset = ioffset+4;
5545             value3 = tvb_get_letohl(tvb, ioffset);
5546             ioffset = ioffset+4;
5548             switch (value2)
5549             {
5550             case NDS_PTYPE_IPX:
5551                 proto_tree_add_item(atree, hf_nds_net, tvb, ioffset, 4, FALSE);
5552                 proto_tree_add_item(atree, hf_nds_node, tvb, ioffset+4, 6, FALSE);
5553                 proto_tree_add_item(atree, hf_nds_socket, tvb, ioffset+10, 2, FALSE);
5554                 break;
5555             case NDS_PTYPE_IP:
5556                 proto_tree_add_item(atree, hf_nds_port, tvb, ioffset, 2, FALSE);
5557                 proto_tree_add_item(atree, hf_add_ref_ip, tvb, ioffset+2, 4, FALSE);
5558                 break;
5559             case NDS_PTYPE_UDP:
5560                 proto_tree_add_item(atree, hf_nds_port, tvb, ioffset, 2, FALSE);
5561                 proto_tree_add_item(atree, hf_add_ref_udp, tvb, ioffset+2, 4, FALSE);
5562                 break;
5563             case NDS_PTYPE_TCP:
5564                 proto_tree_add_item(atree, hf_nds_port, tvb, ioffset, 2, FALSE);
5565                 proto_tree_add_item(atree, hf_add_ref_tcp, tvb, ioffset+2, 4, FALSE);
5566                 break;
5567             case NDS_PTYPE_URL:
5568             case NDS_PTYPE_DNS:
5569                 values->vstring = get_string(tvb, ioffset, value3);
5570                 proto_tree_add_string(atree, hf_value_string, tvb, ioffset,
5571                                       value3, values->vstring);
5572                 break;
5573             default:
5574                 break;
5575             }
5576             ioffset = ioffset + value3;
5577             ioffset += align_4(tvb, ioffset);
5578         }
5579         break;
5581     case MVTYPE_PROC_ENTRY_SPECIFIERS: /* Process Entry Specifiers */
5582         value2 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
5583         values->vstring = val_to_str_const(value2, es_type, "No ES Type Found");
5584         esitem = proto_tree_add_string_format(ntree, hf_es_type, tvb, ioffset,
5585                                               4, values->vstring, "Output Entry Specifier - %s", values->vstring);
5586         estree = proto_item_add_subtree(esitem, ett_nds);
5587         ioffset = ioffset + 4;
5588         ioffset = print_es_type(estree, tvb, values, value2, ioffset);
5589         value3 = tvb_get_letohl(tvb, ioffset);   /* ES Type */
5590         values->vstring = val_to_str_const(value3, es_type, "No ES Type Found");
5591         esitem = proto_tree_add_string_format(ntree, hf_es_type, tvb, ioffset,
5592                                               4, values->vstring, "Input Entry Specifier - %s", values->vstring);
5593         estree = proto_item_add_subtree(esitem, ett_nds);
5594         ioffset = ioffset + 4;
5595         ioffset = print_es_type(estree, tvb, values, value3, ioffset);
5596         /* values.vstring is being overwritten. So store the resolve name to a global value */
5597         g_strlcpy(mv_resolve_name_string, values->vstring, 128);
5598         value4 = tvb_get_letohl(tvb, ioffset);
5599         aitem = proto_tree_add_uint_format(ntree, hf_referral_record, tvb, ioffset, 4,
5600                                            value4, "Referral Protocols - %u", value4);
5601         atree = proto_item_add_subtree(aitem, ett_nds);
5602         ioffset += 4;
5603         for (i = 0 ; i < value4; i++ )
5604         {
5605             value5 = tvb_get_letohl(tvb, ioffset);
5606             valuestr = val_to_str_const(value5, nds_protocol_type, "(Undefined Protocol)");
5607             proto_tree_add_string_format(atree, hf_value_string, tvb, ioffset,
5608                                          4, valuestr, "Protocol -> %s", valuestr);
5609             ioffset = ioffset+4;
5610         }
5611         value6 = tvb_get_letohl(tvb, ioffset);
5612         aitem = proto_tree_add_uint_format(ntree, hf_referral_record, tvb, ioffset, 4,
5613                                            value6, "Tree Walking Protocols - %u", value6);
5614         atree = proto_item_add_subtree(aitem, ett_nds);
5615         ioffset += 4;
5616         for (i = 0 ; i < value6; i++ )
5617         {
5618             value7 = tvb_get_letohl(tvb, ioffset);
5619             valuestr = val_to_str_const(value7, nds_protocol_type, "(Undefined Protocol)");
5620             proto_tree_add_string_format(atree, hf_value_string, tvb, ioffset,
5621                                          4, valuestr, "Protocol -> %s", valuestr);
5622             ioffset = ioffset+4;
5623         }
5624         values->vstring = " ";
5625         break;
5627     case MVTYPE_PRINT_TIMESTAMP:  /* Print Timestamp */
5628         replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
5629         proto_tree_add_item(ncp_tree, hf_nds_replica_num, tvb, ioffset,
5630                             2, replica_num);
5631         ioffset = ioffset + 2;
5632         event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
5633         proto_tree_add_item(ncp_tree, hf_nds_event_num, tvb, ioffset,
5634                             2, event_num);
5635         ioffset = ioffset + 2;
5636         /* fall through */
5638     case MVTYPE_LIST_PARTITIONS:  /* List Partitions */
5639         number_of_referrals = values->vvalue;
5640         /* A bad packet could put us in a tight loop so trap for anything
5641          * over 256 referrals.
5642          */
5643         if (number_of_referrals > 256) {
5644             proto_tree_add_text(ntree, tvb, 0, 0, "[ Bad referal at offset: %u ]", ioffset);
5645             THROW(ReportedBoundsError);
5646             break;
5647         }
5648         for (i = 0; i < number_of_referrals; i++)
5649         {
5650             bvalue = 0x00000001;
5652             for (r = 0 ; r < 32; r++ )
5653             {
5654                 oldioffset = ioffset;
5655                 if (values->vflags & bvalue)
5656                 {
5657                     switch(bvalue)
5658                     {
5659                     case 0x00000001:                /* Information Flags */
5660                         temp_values.vvalue = tvb_get_letohs(tvb, ioffset);
5661                         temp_values.vtype = VTYPE_BITFIELD;
5662                         temp_values.vdesc = "Information Flags (low) Byte:";
5663                         temp_values.vlength = 2;
5664                         temp_values.hfname= hf_nds_rflags;
5665                         temp_values.voffset = ioffset;
5666                         temp_values.bit1 = "Output Flags";
5667                         temp_values.bit1hfname = hf_bit1infoflagsl;
5668                         temp_values.bit2 = "Entry ID";
5669                         temp_values.bit2hfname = hf_bit2infoflagsl;
5670                         temp_values.bit3 = "Entry Flags";
5671                         temp_values.bit3hfname = hf_bit3infoflagsl;
5672                         temp_values.bit4 = "Subordinate Count";
5673                         temp_values.bit4hfname = hf_bit4infoflagsl;
5674                         temp_values.bit5 = "Modification Time";
5675                         temp_values.bit5hfname = hf_bit5infoflagsl;
5676                         temp_values.bit6 = "Modification Timestamp";
5677                         temp_values.bit6hfname = hf_bit6infoflagsl;
5678                         temp_values.bit7 = "Creation Timestamp";
5679                         temp_values.bit7hfname = hf_bit7infoflagsl;
5680                         temp_values.bit8 = "Partition Root ID";
5681                         temp_values.bit8hfname = hf_bit8infoflagsl;
5682                         temp_values.bit9 = "Parent ID";
5683                         temp_values.bit9hfname = hf_bit9infoflagsl;
5684                         temp_values.bit10 = "Revision Count";
5685                         temp_values.bit10hfname = hf_bit10infoflagsl;
5686                         temp_values.bit11 = "Replica Type";
5687                         temp_values.bit11hfname = hf_bit11infoflagsl;
5688                         temp_values.bit12 = "Base Class";
5689                         temp_values.bit12hfname = hf_bit12infoflagsl;
5690                         temp_values.bit13 = "Relative Distinguished Name";
5691                         temp_values.bit13hfname = hf_bit13infoflagsl;
5692                         temp_values.bit14 = "Distinguished Name";
5693                         temp_values.bit14hfname = hf_bit14infoflagsl;
5694                         temp_values.bit15 = "Root Distinguished Name";
5695                         temp_values.bit15hfname = hf_bit15infoflagsl;
5696                         temp_values.bit16 = "Parent Distinguished Name";
5697                         temp_values.bit16hfname = hf_bit16infoflagsl;
5698                         process_bitfield(ntree, tvb, &temp_values);
5699                         ioffset = ioffset+2;
5700                         temp_values.vvalue = tvb_get_letohs(tvb, ioffset);
5701                         temp_values.vtype = VTYPE_BITFIELD;
5702                         temp_values.vdesc = "Information Flags (high) Byte:";
5703                         temp_values.vlength = 2;
5704                         temp_values.hfname= hf_nds_rflags;
5705                         temp_values.voffset = ioffset;
5706                         temp_values.bit1 = "Purge Time";
5707                         temp_values.bit1hfname = hf_bit1infoflagsh;
5708                         temp_values.bit2 = "Dereference Base Class";
5709                         temp_values.bit2hfname = hf_bit2infoflagsh;
5710                         temp_values.bit3 = "Not Defined";
5711                         temp_values.bit3hfname = hf_bit3infoflagsh;
5712                         temp_values.bit4 = "Not Defined";
5713                         temp_values.bit4hfname = hf_bit4infoflagsh;
5714                         temp_values.bit5 = "Not Defined";
5715                         temp_values.bit5hfname = hf_bit5infoflagsh;
5716                         temp_values.bit6 = "Not Defined";
5717                         temp_values.bit6hfname = hf_bit6infoflagsh;
5718                         temp_values.bit7 = "Not Defined";
5719                         temp_values.bit7hfname = hf_bit7infoflagsh;
5720                         temp_values.bit8 = "Not Defined";
5721                         temp_values.bit8hfname = hf_bit8infoflagsh;
5722                         temp_values.bit9 = "Not Defined";
5723                         temp_values.bit9hfname = hf_bit9infoflagsh;
5724                         temp_values.bit10 = "Not Defined";
5725                         temp_values.bit10hfname = hf_bit10infoflagsh;
5726                         temp_values.bit11 = "Not Defined";
5727                         temp_values.bit11hfname = hf_bit11infoflagsh;
5728                         temp_values.bit12 = "Not Defined";
5729                         temp_values.bit12hfname = hf_bit12infoflagsh;
5730                         temp_values.bit13 = "Not Defined";
5731                         temp_values.bit13hfname = hf_bit13infoflagsh;
5732                         temp_values.bit14 = "Not Defined";
5733                         temp_values.bit14hfname = hf_bit14infoflagsh;
5734                         temp_values.bit15 = "Not Defined";
5735                         temp_values.bit15hfname = hf_bit15infoflagsh;
5736                         temp_values.bit16 = "Not Defined";
5737                         temp_values.bit16hfname = hf_bit16infoflagsh;
5738                         process_bitfield(ntree, tvb, &temp_values);
5739                         ioffset = ioffset+2;
5740                         break;
5741                     case 0x00000002:                /* Entry ID */
5742                         value1 = tvb_get_letohl(tvb, ioffset);
5743                         proto_tree_add_uint_format(ntree, hf_nds_eid, tvb, ioffset,
5744                                                    4, value1, "Entry ID %08x", value1);
5745                         ioffset = ioffset + 4;
5746                         break;
5747                     case 0x00000004:                /* Entry Flags */
5748                         temp_values.vvalue = tvb_get_letohl(tvb, ioffset);
5749                         temp_values.vtype = VTYPE_BITFIELD;
5750                         temp_values.vdesc = "Entry Flags:";
5751                         temp_values.vlength = 2;
5752                         temp_values.hfname= hf_nds_eflags;
5753                         temp_values.voffset = ioffset;
5754                         temp_values.bit1 = "Alias Entry";
5755                         temp_values.bit1hfname = hf_bit1eflags;
5756                         temp_values.bit2 = "Partition Root";
5757                         temp_values.bit2hfname = hf_bit2eflags;
5758                         temp_values.bit3 = "Container Entry";
5759                         temp_values.bit3hfname = hf_bit3eflags;
5760                         temp_values.bit4 = "Container Alias";
5761                         temp_values.bit4hfname = hf_bit4eflags;
5762                         temp_values.bit5 = "Matches List Filter";
5763                         temp_values.bit5hfname = hf_bit5eflags;
5764                         temp_values.bit6 = "Reference Entry";
5765                         temp_values.bit6hfname = hf_bit6eflags;
5766                         temp_values.bit7 = "40x Reference Entry";
5767                         temp_values.bit7hfname = hf_bit7eflags;
5768                         temp_values.bit8 = "Back Linked";
5769                         temp_values.bit8hfname = hf_bit8eflags;
5770                         temp_values.bit9 = "New Entry";
5771                         temp_values.bit9hfname = hf_bit9eflags;
5772                         temp_values.bit10 = "Temporary Reference";
5773                         temp_values.bit10hfname = hf_bit10eflags;
5774                         temp_values.bit11 = "Audited";
5775                         temp_values.bit11hfname = hf_bit11eflags;
5776                         temp_values.bit12 = "Entry Not Present";
5777                         temp_values.bit12hfname = hf_bit12eflags;
5778                         temp_values.bit13 = "Entry Verify CTS";
5779                         temp_values.bit13hfname = hf_bit13eflags;
5780                         temp_values.bit14 = "Entry Damaged";
5781                         temp_values.bit14hfname = hf_bit14eflags;
5782                         temp_values.bit15 = "Not Defined";
5783                         temp_values.bit15hfname = hf_bit15eflags;
5784                         temp_values.bit16 = "Not Defined";
5785                         temp_values.bit16hfname = hf_bit16eflags;
5786                         process_bitfield(ntree, tvb, &temp_values);
5787                         ioffset = ioffset+4;
5788                         break;
5789                     case 0x0000008:                 /* Subordinate Count */
5790                         value1 = tvb_get_letohl(tvb, ioffset);
5791                         proto_tree_add_uint_format(ntree, hf_sub_count, tvb, ioffset,
5792                                                    4, value1, "Subordinate Count %u", value1);
5793                         ioffset = ioffset + 4;
5794                         break;
5795                     case 0x0000010:                 /* Modification Time */
5796                         ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
5797                         ns.nsecs = 0;
5798                         proto_tree_add_time_format(ntree, hf_es_seconds, tvb, ioffset,
5799                                                    4, &ns, "Modification Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
5800                         ioffset = ioffset + 4;
5801                         break;
5802                     case 0x0000020:                 /* Modification Timestamp */
5803                         ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
5804                         ns.nsecs = 0;
5805                         proto_tree_add_time_format(ntree, hf_es_seconds, tvb, ioffset,
5806                                                    4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
5807                         ioffset = ioffset + 4;
5808                         replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
5809                         proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset,
5810                                             2, replica_num);
5811                         ioffset = ioffset + 2;
5812                         event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
5813                         proto_tree_add_item(ntree, hf_nds_event_num, tvb, ioffset,
5814                                             2, event_num);
5815                         ioffset = ioffset + 2;
5816                         break;
5817                     case 0x0000040:                 /* Creation Timestamp */
5818                         ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
5819                         ns.nsecs = 0;
5820                         proto_tree_add_time_format(ntree, hf_es_seconds, tvb, ioffset,
5821                                                    4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
5822                         ioffset = ioffset + 4;
5823                         replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
5824                         proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset,
5825                                             2, replica_num);
5826                         ioffset = ioffset + 2;
5827                         event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
5828                         proto_tree_add_item(ntree, hf_nds_event_num, tvb, ioffset,
5829                                             2, event_num);
5830                         ioffset = ioffset + 2;
5831                         break;
5832                     case 0x00000080:                /* Partition Root ID */
5833                         value1 = tvb_get_letohl(tvb, ioffset);
5834                         proto_tree_add_uint_format(ntree, hf_nds_partition_root_id, tvb, ioffset,
5835                                                    4, value1, "Partition Root ID %08x", value1);
5836                         ioffset = ioffset + 4;
5837                         break;
5838                     case 0x00000100:                /* Parent ID */
5839                         value1 = tvb_get_letohl(tvb, ioffset);
5840                         proto_tree_add_uint_format(ntree, hf_nds_parent, tvb, ioffset,
5841                                                    4, value1, "Parent ID %08x", value1);
5842                         ioffset = ioffset + 4;
5843                         break;
5844                     case 0x00000200:                /* Revision Count */
5845                         value1 = tvb_get_letohl(tvb, ioffset);
5846                         proto_tree_add_uint_format(ntree, hf_nds_revision, tvb, ioffset,
5847                                                    4, value1, "Revision Count %u", value1);
5848                         ioffset = ioffset + 4;
5849                         break;
5850                     case 0x00000400:                /* Replica Type & State */
5851                         value1 = tvb_get_letohl(tvb, ioffset);
5852                         value2 = value1 & 0x00ff;
5853                         temp_values.vstring = val_to_str_const(value2, nds_replica_type, "No Replica Type Found");
5854                         proto_tree_add_string(ntree, hf_replica_type, tvb, ioffset,
5855                                               4, temp_values.vstring);
5856                         value3 = value1 & 0xff00;
5857                         temp_values.vstring = val_to_str_const(value3, nds_replica_state, "No Replica State Found");
5858                         proto_tree_add_string(ntree, hf_replica_state, tvb, ioffset,
5859                                               4, temp_values.vstring);
5860                         ioffset = ioffset + 4;
5861                         break;
5862                     case 0x00000800:                /* Base Class */
5863                         value1 = tvb_get_letohl(tvb, ioffset);
5864                         ioffset = ioffset + 4;
5865                         temp_values.vstring = get_string(tvb, ioffset, value1);
5866                         proto_tree_add_string(ntree, hf_nds_base, tvb, ioffset,
5867                                               value1, temp_values.vstring);
5868                         ioffset = ioffset + value1;
5869                         break;
5870                     case 0x00001000:                /* Relative Distinguished Name */
5871                         value1 = tvb_get_letohl(tvb, ioffset);
5872                         ioffset = ioffset + 4;
5873                         temp_values.vstring = get_string(tvb, ioffset, value1);
5874                         proto_tree_add_string(ntree, hf_nds_relative_dn, tvb, ioffset,
5875                                               value1, temp_values.vstring);
5876                         ioffset = ioffset + value1;
5877                         break;
5878                     case 0x00002000:                /* Distinguished Name */
5879                         value1 = tvb_get_letohl(tvb, ioffset);
5880                         ioffset = ioffset + 4;
5881                         temp_values.vstring = get_string(tvb, ioffset, value1);
5882                         proto_tree_add_string(ntree, hf_nds_name, tvb, ioffset,
5883                                               value1, temp_values.vstring);
5884                         ioffset = ioffset + value1;
5885                         break;
5886                     case 0x00004000:                /* Root Distinguished Name */
5887                         value1 = tvb_get_letohl(tvb, ioffset);
5888                         ioffset = ioffset + 4;
5889                         temp_values.vstring = get_string(tvb, ioffset, value1);
5890                         proto_tree_add_string(ntree, hf_nds_name, tvb, ioffset,
5891                                               value1, temp_values.vstring);
5892                         ioffset = ioffset + value1;
5893                         break;
5894                     case 0x00008000:                /* Parent Distinguished Name */
5895                         value1 = tvb_get_letohl(tvb, ioffset);
5896                         ioffset = ioffset + 4;
5897                         temp_values.vstring = get_string(tvb, ioffset, value1);
5898                         proto_tree_add_string(ntree, hf_nds_name, tvb, ioffset,
5899                                               value1, temp_values.vstring);
5900                         ioffset = ioffset + value1;
5901                         break;
5902                     case 0x00010000:                /* Purge Time */
5903                         ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
5904                         ns.nsecs = 0;
5905                         proto_tree_add_time_format(ntree, hf_es_seconds, tvb, ioffset,
5906                                                    4, &ns, "Purge Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
5907                         ioffset = ioffset + 4;
5908                         break;
5909                     case 0x00020000:                /* Dereference Base Class */
5910                         value1 = tvb_get_letohl(tvb, ioffset);
5911                         ioffset = ioffset + 4;
5912                         temp_values.vstring = get_string(tvb, ioffset, value1);
5913                         proto_tree_add_string(ntree, hf_deref_base, tvb, ioffset,
5914                                               value1, temp_values.vstring);
5915                         ioffset = ioffset + value1;
5916                         break;
5917                     default:
5918                         break;
5920                     }
5921                     ioffset += align_4(tvb, ioffset);
5922                 }
5923                 bvalue = bvalue*2;
5924                 /* We could loop forever so check to see if bvalue has wrapped to 0.
5925                  * if so then just abort loop.
5926                  */
5927                 if (bvalue==0) {
5928                     break;
5929                 }
5930                 if(tvb_length_remaining(tvb, ioffset) < 4 )
5931                 {
5932                     break;
5933                 }
5934             }
5935             if(tvb_length_remaining(tvb, ioffset) < 4 )
5936             {
5937                 break;
5938             }
5939         }
5940         break;
5942     case MVTYPE_CLASS_NAMES:      /* Class Names */
5943         number_of_referrals = values->vvalue;
5944         for (i = 0; i < number_of_referrals; i++)
5945         {
5946             ioffset += align_4(tvb, ioffset);
5947             value1 = tvb_get_letohl(tvb, ioffset);
5948             ioffset = ioffset + 4;
5949             temp_values.vstring = get_string(tvb, ioffset, value1);
5950             sub1item = proto_tree_add_string(ntree, hf_nds_base_class, tvb, ioffset,
5951                                              value1, temp_values.vstring);
5952             sub1tree = proto_item_add_subtree(sub1item, ett_nds);
5953             ioffset = ioffset + value1;
5954             ioffset += align_4(tvb, ioffset);
5955             if(values->vflags != 0)
5956             {
5957                 temp_values.vvalue = tvb_get_letohl(tvb, ioffset);
5958                 temp_values.vtype = VTYPE_BITFIELD;
5959                 temp_values.vdesc = "Class Flags:";
5960                 temp_values.vlength = 2;
5961                 temp_values.hfname= hf_nds_cflags;
5962                 temp_values.voffset = ioffset;
5963                 temp_values.bit1 = "Container";
5964                 temp_values.bit1hfname = hf_bit1cflags;
5965                 temp_values.bit2 = "Effective";
5966                 temp_values.bit2hfname = hf_bit2cflags;
5967                 temp_values.bit3 = "Class Definition Cannot be Removed";
5968                 temp_values.bit3hfname = hf_bit3cflags;
5969                 temp_values.bit4 = "Ambiguous Naming";
5970                 temp_values.bit4hfname = hf_bit4cflags;
5971                 temp_values.bit5 = "Ambiguous Containment";
5972                 temp_values.bit5hfname = hf_bit5cflags;
5973                 temp_values.bit6 = "Auxiliary";
5974                 temp_values.bit6hfname = hf_bit6cflags;
5975                 temp_values.bit7 = "Operational";
5976                 temp_values.bit7hfname = hf_bit7cflags;
5977                 temp_values.bit8 = "Sparse Required";
5978                 temp_values.bit8hfname = hf_bit8cflags;
5979                 temp_values.bit9 = "Sparse Operational";
5980                 temp_values.bit9hfname = hf_bit9cflags;
5981                 temp_values.bit10 = "Not Defined";
5982                 temp_values.bit10hfname = hf_bit10cflags;
5983                 temp_values.bit11 = "Not Defined";
5984                 temp_values.bit11hfname = hf_bit11cflags;
5985                 temp_values.bit12 = "Not Defined";
5986                 temp_values.bit12hfname = hf_bit12cflags;
5987                 temp_values.bit13 = "Not Defined";
5988                 temp_values.bit13hfname = hf_bit13cflags;
5989                 temp_values.bit14 = "Not Defined";
5990                 temp_values.bit14hfname = hf_bit14cflags;
5991                 temp_values.bit15 = "Not Defined";
5992                 temp_values.bit15hfname = hf_bit15cflags;
5993                 temp_values.bit16 = "Not Defined";
5994                 temp_values.bit16hfname = hf_bit16cflags;
5995                 process_bitfield(sub1tree, tvb, &temp_values);
5996                 ioffset = ioffset+4;
5997                 if(values->vflags != 5)
5998                 {
5999                     value1 = tvb_get_letohl(tvb, ioffset); /* length of field */
6000                     length_remaining = tvb_length_remaining(tvb, ioffset);
6001                     if(length_remaining == -1 || value1 > (guint32) length_remaining)
6002                     {
6003                         break;
6004                     }
6005                     ioffset += 4;
6006                     tvb_ensure_bytes_exist(tvb, ioffset, value1);
6007                     proto_tree_add_bytes(sub1tree, hf_nds_asn1, tvb, ioffset, value1, tvb_get_ptr(tvb, ioffset, value1));
6008                     ioffset += value1;
6009                     ioffset += (value1%2);
6010                 }
6011                 if(values->vflags == 1 || values->vflags == 2 || values->vflags == 4)
6012                 {
6013                     value1 = tvb_get_letohl(tvb, ioffset);  /* Super Classes */
6014                     sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_number_of_items, tvb, ioffset,
6015                                                           4, value1, "Super Classes %u", value1);
6016                     sub2tree = proto_item_add_subtree(sub2item, ett_nds);
6017                     ioffset = ioffset + 4;
6018                     for (r = 0; r < value1; r++)
6019                     {
6020                         value2 = tvb_get_letohl(tvb, ioffset);
6021                         ioffset = ioffset + 4;
6022                         temp_values.vstring = get_string(tvb, ioffset, value2);
6023                         proto_tree_add_string(sub2tree, hf_nds_super, tvb, ioffset,
6024                                               value2, temp_values.vstring);
6025                         ioffset = ioffset + value2;
6026                         ioffset += align_4(tvb, ioffset);
6027                     }
6028                     value1 = tvb_get_letohl(tvb, ioffset);  /* Containment Classes */
6029                     sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_number_of_items, tvb, ioffset,
6030                                                           4, value1, "Containment Classes %u", value1);
6031                     sub2tree = proto_item_add_subtree(sub2item, ett_nds);
6032                     ioffset = ioffset + 4;
6033                     for (r = 0; r < value1; r++)
6034                     {
6035                         value2 = tvb_get_letohl(tvb, ioffset);
6036                         ioffset = ioffset + 4;
6037                         temp_values.vstring = get_string(tvb, ioffset, value2);
6038                         proto_tree_add_string(sub2tree, hf_nds_base_class, tvb, ioffset,
6039                                               value2, temp_values.vstring);
6040                         ioffset = ioffset + value2;
6041                         ioffset += align_4(tvb, ioffset);
6042                     }
6043                     value1 = tvb_get_letohl(tvb, ioffset);  /* Naming Attributes */
6044                     sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_number_of_items, tvb, ioffset,
6045                                                           4, value1, "Naming Attributes %u", value1);
6046                     sub2tree = proto_item_add_subtree(sub2item, ett_nds);
6047                     ioffset = ioffset + 4;
6048                     for (r = 0; r < value1; r++)
6049                     {
6050                         value2 = tvb_get_letohl(tvb, ioffset);
6051                         ioffset = ioffset + 4;
6052                         temp_values.vstring = get_string(tvb, ioffset, value2);
6053                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset,
6054                                               value2, temp_values.vstring);
6055                         ioffset = ioffset + value2;
6056                         ioffset += align_4(tvb, ioffset);
6057                     }
6058                     value1 = tvb_get_letohl(tvb, ioffset);  /* Mandatory Attributes */
6059                     sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_number_of_items, tvb, ioffset,
6060                                                           4, value1, "Mandatory Attributes %u", value1);
6061                     sub2tree = proto_item_add_subtree(sub2item, ett_nds);
6062                     ioffset = ioffset + 4;
6063                     for (r = 0; r < value1; r++)
6064                     {
6065                         value2 = tvb_get_letohl(tvb, ioffset);
6066                         ioffset = ioffset + 4;
6067                         temp_values.vstring = get_string(tvb, ioffset, value2);
6068                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset,
6069                                               value2, temp_values.vstring);
6070                         ioffset = ioffset + value2;
6071                         ioffset += align_4(tvb, ioffset);
6072                     }
6073                     value1 = tvb_get_letohl(tvb, ioffset);  /* Optional Attributes */
6074                     sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_number_of_items, tvb, ioffset,
6075                                                           4, value1, "Optional Attributes %u", value1);
6076                     sub2tree = proto_item_add_subtree(sub2item, ett_nds);
6077                     ioffset = ioffset + 4;
6078                     for (r = 0; r < value1; r++)
6079                     {
6080                         ioffset += align_4(tvb, ioffset);
6081                         value2 = tvb_get_letohl(tvb, ioffset);
6082                         ioffset = ioffset + 4;
6083                         temp_values.vstring = get_string(tvb, ioffset, value2);
6084                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset,
6085                                               value2, temp_values.vstring);
6086                         ioffset = ioffset + value2;
6087                         if(tvb_length_remaining(tvb, ioffset) < 4 )
6088                         {
6089                             break;
6090                         }
6091                     }
6092                 }
6093 #if 0
6094                 if(values->vflags == 2 || values->vflags == 4)   /* Class Definitions of Super Classes */
6095 #endif
6096                 if(values->vflags == 4)   /* Class Definitions of Super Classes */
6097                 {
6098                     value1 = tvb_get_letohl(tvb, ioffset);  /* Containment Classes */
6099                     sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_number_of_items, tvb, ioffset,
6100                                                           4, value1, "Containment Classes %u", value1);
6101                     sub2tree = proto_item_add_subtree(sub2item, ett_nds);
6102                     ioffset = ioffset + 4;
6103                     for (r = 0; r < value1; r++)
6104                     {
6105                         value2 = tvb_get_letohl(tvb, ioffset);
6106                         ioffset = ioffset + 4;
6107                         temp_values.vstring = get_string(tvb, ioffset, value2);
6108                         proto_tree_add_string(sub2tree, hf_nds_base_class, tvb, ioffset,
6109                                               value2, temp_values.vstring);
6110                         ioffset = ioffset + value2;
6111                         ioffset += align_4(tvb, ioffset);
6112                     }
6113                     value1 = tvb_get_letohl(tvb, ioffset);  /* Naming Attributes */
6114                     sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_number_of_items, tvb, ioffset,
6115                                                           4, value1, "Naming Attributes %u", value1);
6116                     sub2tree = proto_item_add_subtree(sub2item, ett_nds);
6117                     ioffset = ioffset + 4;
6118                     for (r = 0; r < value1; r++)
6119                     {
6120                         value2 = tvb_get_letohl(tvb, ioffset);
6121                         ioffset = ioffset + 4;
6122                         temp_values.vstring = get_string(tvb, ioffset, value2);
6123                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset,
6124                                               value2, temp_values.vstring);
6125                         ioffset = ioffset + value2;
6126                         ioffset += align_4(tvb, ioffset);
6127                     }
6128                     value1 = tvb_get_letohl(tvb, ioffset);  /* Mandatory Attributes */
6129                     sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_number_of_items, tvb, ioffset,
6130                                                           4, value1, "Mandatory Attributes %u", value1);
6131                     sub2tree = proto_item_add_subtree(sub2item, ett_nds);
6132                     ioffset = ioffset + 4;
6133                     for (r = 0; r < value1; r++)
6134                     {
6135                         value2 = tvb_get_letohl(tvb, ioffset);
6136                         ioffset = ioffset + 4;
6137                         temp_values.vstring = get_string(tvb, ioffset, value2);
6138                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset,
6139                                               value2, temp_values.vstring);
6140                         ioffset = ioffset + value2;
6141                         ioffset += align_4(tvb, ioffset);
6142                     }
6143                     value1 = tvb_get_letohl(tvb, ioffset);  /* Optional Attributes */
6144                     sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_number_of_items, tvb, ioffset,
6145                                                           4, value1, "Optional Attributes %u", value1);
6146                     sub2tree = proto_item_add_subtree(sub2item, ett_nds);
6147                     ioffset = ioffset + 4;
6148                     for (r = 0; r < value1; r++)
6149                     {
6150                         value2 = tvb_get_letohl(tvb, ioffset);
6151                         ioffset = ioffset + 4;
6152                         temp_values.vstring = get_string(tvb, ioffset, value2);
6153                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset,
6154                                               value2, temp_values.vstring);
6155                         ioffset = ioffset + value2;
6156                         ioffset += align_4(tvb, ioffset);
6157                     }
6158                     value1 = tvb_get_letohl(tvb, ioffset);    /* Default ACL */
6159                     proto_tree_add_uint_format(sub1tree, hf_nds_eid, tvb, ioffset,
6160                                                4, value1, "Default ACL %08x", value1);
6161                     ioffset = ioffset + 4;
6162                     if(tvb_length_remaining(tvb, ioffset) < 4 )
6163                     {
6164                         break;
6165                     }
6166                 }
6167                 if(values->vflags == 5)   /* Base Class Definitions */
6168                 {
6169                     ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
6170                     ns.nsecs = 0;
6171                     proto_tree_add_time_format(sub1tree, hf_es_seconds, tvb, ioffset,
6172                                                4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
6173                     ioffset = ioffset + 4;
6174                     replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
6175                     proto_tree_add_item(sub1tree, hf_nds_replica_num, tvb, ioffset,
6176                                         2, replica_num);
6177                     ioffset = ioffset + 2;
6178                     event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
6179                     proto_tree_add_item(sub1tree, hf_nds_event_num, tvb, ioffset,
6180                                         2, event_num);
6181                     ioffset = ioffset + 2;
6182                     ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
6183                     ns.nsecs = 0;
6184                     proto_tree_add_time_format(sub1tree, hf_es_seconds, tvb, ioffset,
6185                                                4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
6186                     ioffset = ioffset + 4;
6187                     replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
6188                     proto_tree_add_item(sub1tree, hf_nds_replica_num, tvb, ioffset,
6189                                         2, replica_num);
6190                     ioffset = ioffset + 2;
6191                     event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
6192                     proto_tree_add_item(sub1tree, hf_nds_event_num, tvb, ioffset,
6193                                         2, event_num);
6194                     ioffset = ioffset + 2;
6195                     /* Class Definition */
6196                     value1 = tvb_get_letohl(tvb, ioffset);  /* Super Classes */
6197                     sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_number_of_items, tvb, ioffset,
6198                                                           4, value1, "Super Classes %u", value1);
6199                     sub2tree = proto_item_add_subtree(sub2item, ett_nds);
6200                     ioffset = ioffset + 4;
6201                     for (r = 0; r < value1; r++)
6202                     {
6203                         value2 = tvb_get_letohl(tvb, ioffset);
6204                         ioffset = ioffset + 4;
6205                         temp_values.vstring = get_string(tvb, ioffset, value2);
6206                         proto_tree_add_string(sub2tree, hf_nds_super, tvb, ioffset,
6207                                               value2, temp_values.vstring);
6208                         ioffset = ioffset + value2;
6209                         ioffset += align_4(tvb, ioffset);
6210                     }
6211                     value1 = tvb_get_letohl(tvb, ioffset);  /* Containment Classes */
6212                     sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_number_of_items, tvb, ioffset,
6213                                                           4, value1, "Containment Classes %u", value1);
6214                     sub2tree = proto_item_add_subtree(sub2item, ett_nds);
6215                     ioffset = ioffset + 4;
6216                     for (r = 0; r < value1; r++)
6217                     {
6218                         value2 = tvb_get_letohl(tvb, ioffset);
6219                         ioffset = ioffset + 4;
6220                         temp_values.vstring = get_string(tvb, ioffset, value2);
6221                         proto_tree_add_string(sub2tree, hf_nds_base_class, tvb, ioffset,
6222                                               value2, temp_values.vstring);
6223                         ioffset = ioffset + value2;
6224                         ioffset += align_4(tvb, ioffset);
6225                     }
6226                     value1 = tvb_get_letohl(tvb, ioffset);  /* Naming Attributes */
6227                     sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_number_of_items, tvb, ioffset,
6228                                                           4, value1, "Naming Attributes %u", value1);
6229                     sub2tree = proto_item_add_subtree(sub2item, ett_nds);
6230                     ioffset = ioffset + 4;
6231                     for (r = 0; r < value1; r++)
6232                     {
6233                         value2 = tvb_get_letohl(tvb, ioffset);
6234                         ioffset = ioffset + 4;
6235                         temp_values.vstring = get_string(tvb, ioffset, value2);
6236                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset,
6237                                               value2, temp_values.vstring);
6238                         ioffset = ioffset + value2;
6239                         ioffset += align_4(tvb, ioffset);
6240                     }
6241                     value1 = tvb_get_letohl(tvb, ioffset);  /* Mandatory Attributes */
6242                     sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_number_of_items, tvb, ioffset,
6243                                                           4, value1, "Mandatory Attributes %u", value1);
6244                     sub2tree = proto_item_add_subtree(sub2item, ett_nds);
6245                     ioffset = ioffset + 4;
6246                     for (r = 0; r < value1; r++)
6247                     {
6248                         value2 = tvb_get_letohl(tvb, ioffset);
6249                         ioffset = ioffset + 4;
6250                         temp_values.vstring = get_string(tvb, ioffset, value2);
6251                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset,
6252                                               value2, temp_values.vstring);
6253                         ioffset = ioffset + value2;
6254                         ioffset += align_4(tvb, ioffset);
6255                     }
6256                     value1 = tvb_get_letohl(tvb, ioffset);  /* Optional Attributes */
6257                     sub2item = proto_tree_add_uint_format(sub1tree, hf_nds_number_of_items, tvb, ioffset,
6258                                                           4, value1, "Optional Attributes %u", value1);
6259                     sub2tree = proto_item_add_subtree(sub2item, ett_nds);
6260                     ioffset = ioffset + 4;
6261                     for (r = 0; r < value1; r++)
6262                     {
6263                         value2 = tvb_get_letohl(tvb, ioffset);
6264                         ioffset = ioffset + 4;
6265                         temp_values.vstring = get_string(tvb, ioffset, value2);
6266                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset,
6267                                               value2, temp_values.vstring);
6268                         ioffset = ioffset + value2;
6269                         ioffset += align_4(tvb, ioffset);
6270                     }
6271                     value1 = tvb_get_letohl(tvb, ioffset);    /* Default ACL */
6272                     proto_tree_add_uint_format(sub1tree, hf_nds_eid, tvb, ioffset,
6273                                                4, value1, "Default ACL %08x", value1);
6274                     ioffset = ioffset + 4;
6275                     if(tvb_length_remaining(tvb, ioffset) < 4 )
6276                     {
6277                         break;
6278                     }
6279                 }
6280             }
6281         }
6282         break;
6284     case MVTYPE_MODIFY_CLASS:     /* Modify Class */
6285         for (i = 1 ; i <= values->vvalue; i++ )   /* Attribute Names to add*/
6286         {
6287             ioffset += align_4(tvb, ioffset);
6288             value1 = tvb_get_letohl(tvb, ioffset);
6289             ioffset = ioffset + 4;
6290             values->vstring = get_string(tvb, ioffset, value1);
6291             proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset,
6292                                   value1, values->vstring);
6293             ioffset = ioffset + value1;
6294         }
6295         if(tvb_length_remaining(tvb, ioffset) < 4 )
6296         {
6297             break;
6298         }
6299         ioffset += align_4(tvb, ioffset);
6300         value1 = tvb_get_letohl(tvb, ioffset);
6301         proto_tree_add_uint_format(ntree, hf_nds_att_del, tvb, ioffset,
6302                                    4, value1, "Attribute Names to Delete %u", value1);
6303         ioffset = ioffset + 4;
6304         for (i = 1 ; i <= value1; i++ )   /* Attribute Names to delete*/
6305         {
6306             ioffset += align_4(tvb, ioffset);
6307             value2 = tvb_get_letohl(tvb, ioffset);
6308             ioffset = ioffset + 4;
6309             values->vstring = get_string(tvb, ioffset, value2);
6310             proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset,
6311                                   value2, values->vstring);
6312             ioffset = ioffset + value2;
6313         }
6314         if(tvb_length_remaining(tvb, ioffset) < 4 )
6315         {
6316             break;
6317         }
6318         ioffset += align_4(tvb, ioffset);
6319         value1 = tvb_get_letohl(tvb, ioffset);
6320         proto_tree_add_uint_format(ntree, hf_nds_acl_add, tvb, ioffset,
6321                                    4, value1, "ACL Templates to Add %u", value1);
6322         ioffset = ioffset + 4;
6323         for (i = 1 ; i <= value1; i++ )   /* ACL templates to add*/
6324         {
6325             ioffset += align_4(tvb, ioffset);
6326             value2 = tvb_get_letohl(tvb, ioffset);  /* Attribute Name */
6327             ioffset = ioffset + 4;
6328             values->vstring = get_string(tvb, ioffset, value2);
6329             proto_tree_add_string(ntree, hf_nds_attribute_dn, tvb, ioffset,
6330                                   value2, values->vstring);
6331             ioffset = ioffset + value2;
6332             ioffset += align_4(tvb, ioffset);
6333             value2 = tvb_get_letohl(tvb, ioffset);  /* DN of Trustee */
6334             ioffset = ioffset + 4;
6335             values->vstring = get_string(tvb, ioffset, value2);
6336             proto_tree_add_string(ntree, hf_nds_trustee_dn, tvb, ioffset,
6337                                   value2, values->vstring);
6338             ioffset = ioffset + value2;
6339             ioffset += align_4(tvb, ioffset);
6340             value1 = tvb_get_letohl(tvb, ioffset);
6341             proto_tree_add_uint_format(ntree, hf_nds_privileges, tvb, ioffset,
6342                                        4, value1, "Privileges 0x%08x", value1);
6343             ioffset = ioffset + 4;
6344         }
6345         if(tvb_length_remaining(tvb, ioffset) < 4 )
6346         {
6347             break;
6348         }
6349         ioffset += align_4(tvb, ioffset);
6350         value1 = tvb_get_letohl(tvb, ioffset);
6351         proto_tree_add_uint_format(ntree, hf_nds_acl_del, tvb, ioffset,
6352                                    4, value1, "ACL Templates to Delete %u", value1);
6353         ioffset = ioffset + 4;
6354         for (i = 1 ; i <= value1; i++ )   /* ACL templates to delete*/
6355         {
6356             ioffset += align_4(tvb, ioffset);
6357             value2 = tvb_get_letohl(tvb, ioffset);  /* Attribute Name */
6358             ioffset = ioffset + 4;
6359             values->vstring = get_string(tvb, ioffset, value2);
6360             proto_tree_add_string(ntree, hf_nds_attribute_dn, tvb, ioffset,
6361                                   value2, values->vstring);
6362             ioffset = ioffset + value2;
6363             ioffset += align_4(tvb, ioffset);
6364             value2 = tvb_get_letohl(tvb, ioffset);  /* DN of Trustee */
6365             ioffset = ioffset + 4;
6366             values->vstring = get_string(tvb, ioffset, value2);
6367             proto_tree_add_string(ntree, hf_nds_trustee_dn, tvb, ioffset,
6368                                   value2, values->vstring);
6369             ioffset = ioffset + value2;
6370             ioffset += align_4(tvb, ioffset);
6371             value1 = tvb_get_letohl(tvb, ioffset);  /* Privileges */
6372             proto_tree_add_uint_format(ntree, hf_nds_privileges, tvb, ioffset,
6373                                        4, value1, "Privileges 0x%08x", value1);
6374             ioffset = ioffset + 4;
6375         }
6376         break;
6378     case MVTYPE_PROCESS_TAGS: /* Process tags and paths depending on name type returned. */
6379         switch (values->vflags) {
6381         case 8:  /* Tuned Name */
6382             proto_tree_add_item(ntree, hf_nds_tune_mark, tvb, ioffset, 2, FALSE);
6383             ioffset += 2;
6384             value1 = tvb_get_letohs(tvb, ioffset);
6385             valuestr = val_to_str_const(value1, nds_tuned_tags, "(Undefined Tuned Name Tag)");
6386             proto_tree_add_string_format(ntree, hf_value_string, tvb, ioffset,
6387                                          2, valuestr, "Tuned Name Tag -> %s", valuestr);
6388             ioffset += 2;
6389             ioffset += align_4(tvb, ioffset);
6390             if (value1 == 0) { /* RDN Hint - really just returns the dist name + timestamp info */
6391                 value2 = tvb_get_letohl(tvb, ioffset);  /* Distinguished Name Len, String[len]*/
6392                 ioffset = ioffset + 4;
6393                 values->vstring = get_string(tvb, ioffset, value2);
6394                 proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset,
6395                                       value2, values->vstring);
6396                 ioffset += value2;
6397                 ioffset += align_4(tvb, ioffset);
6398                 ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
6399                 ns.nsecs = 0;
6400                 proto_tree_add_time_format(ntree, hf_es_seconds, tvb, ioffset,
6401                                            4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
6402                 ioffset += 4;
6403                 replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
6404                 proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset,
6405                                     2, replica_num);
6406                 ioffset = ioffset + 2;
6407                 event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
6408                 proto_tree_add_item(ntree, hf_nds_event_num, tvb, ioffset,
6409                                     2, event_num);
6410                 ioffset = ioffset + 2;
6411             }
6412             else /* Process the full RDN history including ancestors */
6413             {
6414                 value1 = tvb_get_letohl(tvb, ioffset);
6415                 sub1item = proto_tree_add_uint_format(ntree, hf_nds_acl_del, tvb, ioffset,
6416                                                       4, value1, "Number of RDN Items %u", value1);
6417                 sub1tree = proto_item_add_subtree(sub1item, ett_nds);
6418                 ioffset = ioffset + 4;
6419                 for (i=1; i <= value1; i++) {
6420                     sub2item = proto_tree_add_text(sub1tree, tvb, ioffset, 0, "Item %u", i);
6421                     sub2tree = proto_item_add_subtree(sub2item, ett_nds);
6422                     ioffset += align_4(tvb, ioffset);
6424                     value5 = tvb_get_letohl(tvb, ioffset);
6425                     valuestr = val_to_str_const(value5, nds_tuned_item_tags, "(Undefined Tuned Name Tag)");
6426                     if (value5 == 0) { /* Items are timestamp + Distinguished name (0 value == one entry)*/
6427                         proto_tree_add_string_format(sub2tree, hf_value_string, tvb, ioffset,
6428                                                      4, valuestr, "Item Tag -> %s", valuestr);
6429                         ioffset += 4;
6430                         ns.secs = tvb_get_letohl(tvb, ioffset);   /* Seconds */
6431                         ns.nsecs = 0;
6432                         proto_tree_add_time_format(sub2tree, hf_es_seconds, tvb, ioffset,
6433                                                    4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE));
6434                         ioffset += 4;
6435                         replica_num = tvb_get_letohs(tvb, ioffset);   /* Replica */
6436                         proto_tree_add_item(sub2tree, hf_nds_replica_num, tvb, ioffset,
6437                                             2, replica_num);
6438                         ioffset = ioffset + 2;
6439                         event_num = tvb_get_letohs(tvb, ioffset);   /* Event */
6440                         proto_tree_add_item(sub2tree, hf_nds_event_num, tvb, ioffset,
6441                                             2, event_num);
6442                         ioffset = ioffset + 2;
6443                         value2 = tvb_get_letohl(tvb, ioffset);  /* Distinguished Name Len, String[len]*/
6444                         ioffset = ioffset + 4;
6445                         values->vstring = get_string(tvb, ioffset, value2);
6446                         proto_tree_add_string(sub2tree, hf_mv_string, tvb, ioffset,
6447                                               value2, values->vstring);
6448                         ioffset += value2;
6449                     }
6450                     /* XXX: What if "multiple items" ?                 */
6451                     /*      What if "Undefined ... " ?                 */
6452                     /*      For now: we'll just keep on walking...     */
6453                     /*      Presumably we'll get a ReportedBoundsError */
6454                     /*       pretty quickly.                           */
6455                     else   /* Undefined or "multiple items" ... */
6456                     {
6457                         ioffset += 4;
6458                     }
6459                 } /* for */
6460             } /* else */
6461             values->voffset=ioffset;
6462             break;
6463         default: /* All other name types are just a string */
6464             values->vstring = get_string(tvb, ioffset, values->vlength);
6465             proto_tree_add_string(ntree, hf_mv_string, tvb, ioffset,
6466                                   values->vlength, values->vstring);
6467             values->voffset=ioffset + values->vlength;
6468             ioffset = values->voffset;
6469             ioffset += align_4(tvb, ioffset);
6470             break;
6471         } /* switch (values->vflags) */
6472         break;
6474     case MVTYPE_PROCESS_ITERATOR: /* Process Iterator subverbs. */
6475         temp_values.vvalue = tvb_get_letohl(tvb, ioffset);
6477         temp_values.vstring = val_to_str_const(temp_values.vvalue, nds_info_type, "No Info Type Set");
6478         /*g_strdup(value)*/
6479         proto_tree_add_string(ntree, hf_nds_info_type, tvb, ioffset, 4, temp_values.vstring);
6480         ioffset = ioffset + 4;
6481         temp_values.vvalue = tvb_get_letohs(tvb, ioffset);
6482         value5 = tvb_get_letohl(tvb, ioffset);
6483         temp_values.vdesc = "Information Flags (low) Byte:";
6484         temp_values.vlength = 2;
6485         temp_values.hfname = hf_nds_rflags;
6486         temp_values.voffset = ioffset;
6487         temp_values.bit1 = "Output Flags";
6488         temp_values.bit1hfname = hf_bit1infoflagsl;
6489         temp_values.bit2 = "Entry ID";
6490         temp_values.bit2hfname = hf_bit2infoflagsl;
6491         temp_values.bit3 = "Entry Flags";
6492         temp_values.bit3hfname = hf_bit3infoflagsl;
6493         temp_values.bit4 = "Subordinate Count";
6494         temp_values.bit4hfname = hf_bit4infoflagsl;
6495         temp_values.bit5 = "Modification Time";
6496         temp_values.bit5hfname = hf_bit5infoflagsl;
6497         temp_values.bit6 = "Modification Timestamp";
6498         temp_values.bit6hfname = hf_bit6infoflagsl;
6499         temp_values.bit7 = "Creation Timestamp";
6500         temp_values.bit7hfname = hf_bit7infoflagsl;
6501         temp_values.bit8 = "Partition Root ID";
6502         temp_values.bit8hfname = hf_bit8infoflagsl;
6503         temp_values.bit9 = "Parent ID";
6504         temp_values.bit9hfname = hf_bit9infoflagsl;
6505         temp_values.bit10 = "Revision Count";
6506         temp_values.bit10hfname = hf_bit10infoflagsl;
6507         temp_values.bit11 = "Replica Type";
6508         temp_values.bit11hfname = hf_bit11infoflagsl;
6509         temp_values.bit12 = "Base Class";
6510         temp_values.bit12hfname = hf_bit12infoflagsl;
6511         temp_values.bit13 = "Relative Distinguished Name";
6512         temp_values.bit13hfname = hf_bit13infoflagsl;
6513         temp_values.bit14 = "Distinguished Name";
6514         temp_values.bit14hfname = hf_bit14infoflagsl;
6515         temp_values.bit15 = "Root Distinguished Name";
6516         temp_values.bit15hfname = hf_bit15infoflagsl;
6517         temp_values.bit16 = "Parent Distinguished Name";
6518         temp_values.bit16hfname = hf_bit16infoflagsl;
6519         process_bitfield(ntree, tvb, &temp_values);
6520         ioffset = ioffset+2;
6521         temp_values.vvalue = tvb_get_letohs(tvb, ioffset);
6522         temp_values.vtype = VTYPE_BITFIELD;
6523         temp_values.vdesc = "Information Flags (high) Byte:";
6524         temp_values.vlength = 2;
6525         temp_values.hfname= hf_nds_rflags;
6526         temp_values.voffset = ioffset;
6527         temp_values.bit1 = "Purge Time";
6528         temp_values.bit1hfname = hf_bit1infoflagsh;
6529         temp_values.bit2 = "Dereference Base Class";
6530         temp_values.bit2hfname = hf_bit2infoflagsh;
6531         temp_values.bit3 = "Replica Number";
6532         temp_values.bit3hfname = hf_bit3infoflagsh;
6533         temp_values.bit4 = "Replica State";
6534         temp_values.bit4hfname = hf_bit4infoflagsh;
6535         temp_values.bit5 = "Federation Boundary";
6536         temp_values.bit5hfname = hf_bit5infoflagsh;
6537         temp_values.bit6 = "Schema Boundary";
6538         temp_values.bit6hfname = hf_bit6infoflagsh;
6539         temp_values.bit7 = "Federation Boundary ID";
6540         temp_values.bit7hfname = hf_bit7infoflagsh;
6541         temp_values.bit8 = "Schema Boundary ID";
6542         temp_values.bit8hfname = hf_bit8infoflagsh;
6543         temp_values.bit9 = "Current Subcount";
6544         temp_values.bit9hfname = hf_bit9infoflagsh;
6545         temp_values.bit10 = "Local Entry Flags";
6546         temp_values.bit10hfname = hf_bit10infoflagsh;
6547         temp_values.bit11 = "Not Defined";
6548         temp_values.bit11hfname = hf_bit11infoflagsh;
6549         temp_values.bit12 = "Not Defined";
6550         temp_values.bit12hfname = hf_bit12infoflagsh;
6551         temp_values.bit13 = "Not Defined";
6552         temp_values.bit13hfname = hf_bit13infoflagsh;
6553         temp_values.bit14 = "Not Defined";
6554         temp_values.bit14hfname = hf_bit14infoflagsh;
6555         temp_values.bit15 = "Not Defined";
6556         temp_values.bit15hfname = hf_bit15infoflagsh;
6557         temp_values.bit16 = "Not Defined";
6558         temp_values.bit16hfname = hf_bit16infoflagsh;
6559         ioffset = ioffset+2;
6560         process_bitfield(ntree, tvb, &temp_values);
6561         ioffset += 4;
6562         proto_tree_add_item(ntree, hf_nds_time_filter, tvb, ioffset, 4, FALSE);
6563         ioffset += 4;
6564         proto_tree_add_item(ntree, hf_nds_all_attr, tvb, ioffset, 4, FALSE);
6565         ioffset += 4;
6566         value2 = tvb_get_letohl(tvb, ioffset);
6567         sub1item = proto_tree_add_uint_format(ntree, hf_nds_number_of_items, tvb, ioffset,
6568                                               4, value2, "Number of Attributes %u", value2);
6569         sub1tree = proto_item_add_subtree(sub1item, ett_nds);
6570         ioffset += 4;
6571         for (i=1; i<=value2; i++) {
6572             sub2item = proto_tree_add_text(sub1tree, tvb, ioffset, 0, "Attribute %u", i);
6573             sub2tree = proto_item_add_subtree(sub2item, ett_nds);
6574             ioffset += align_4(tvb, ioffset);
6575             value3 = tvb_get_letohl(tvb, ioffset);  /* Attribute Name */
6576             ioffset = ioffset + 4;
6577             values->vstring = get_string(tvb, ioffset, value3);
6578             proto_tree_add_string(sub2tree, hf_nds_attribute_dn, tvb, ioffset,
6579                                   value3, values->vstring);
6580             ioffset = ioffset + value3;
6582             if(tvb_length_remaining(tvb, ioffset) < 4 )
6583             {
6584                 break;
6585             }
6586         }
6587         ioffset += align_4(tvb, ioffset);
6588         value4 = tvb_get_letohl(tvb, ioffset);
6589         values->vstring = val_to_str_const(value4, iterator_subverbs, "(No Iteration Verb Found)");
6590         ioffset += 4;
6591         dissect_nds_iterator(ntree, tvb, pinfo, value4, value5, ioffset, TRUE);
6593         values->vstring = ep_strdup_printf("(%s)", values->vstring);
6594         break;
6596     default:
6597         break;
6598     }
6601 static void
6602 dissect_ncp_89_6_request(tvbuff_t *tvb, proto_tree *volatile ncp_tree, guint32 offset)
6604     guint32 string_len, datatype, count, i;
6606     datatype = tvb_get_letohl(tvb, offset);
6607     proto_tree_add_item(ncp_tree, hf_ncp_data_type_flag, tvb, offset, 1, TRUE);
6608     offset += 1;
6609     proto_tree_add_item(ncp_tree, hf_ncp_reserved5, tvb, offset, 5, TRUE);
6610     offset += 5;
6611     count = tvb_get_guint8(tvb, offset);
6612     proto_tree_add_item(ncp_tree, hf_ncp_path_count, tvb, offset, 1, TRUE);
6613     offset += 1;
6614     for (i=0; i < count; i++) {
6615         if (datatype == 0) {
6616             string_len = (tvb_get_guint8(tvb, offset))+1;
6617             proto_tree_add_item(ncp_tree, hf_ncp_directory_path, tvb, offset+1, string_len-1, TRUE);
6618         }
6619         else
6620         {
6621             string_len = (tvb_get_letohs(tvb, offset))+2;
6622             proto_tree_add_item(ncp_tree, hf_ncp_directory_path, tvb, offset+2, string_len-2, TRUE);
6623         }
6624         offset += string_len;
6625         if(tvb_length_remaining(tvb, offset) < 4 )
6626         {
6627             break;
6628         }
6629     }
6633 static void
6634 dissect_ncp_123_11_reply(tvbuff_t *tvb, proto_tree *volatile ncp_tree, ncp_req_hash_value *request_value)
6636     int string_len, loffset;
6638     loffset = 76;
6639     if (request_value->length == 7) {
6640         /* Undocumented, if request value length is 7 then the reply is offset by 8 bytes.
6641          * Unknown what these 8 bytes represent */
6642         loffset += 8;
6643     }
6644     string_len = tvb_get_guint8(tvb, loffset);
6645     proto_tree_add_item(ncp_tree, hf_ncp_file_name_12, tvb, loffset+1, string_len, TRUE);
6646     loffset += string_len+1;
6647     string_len = tvb_get_guint8(tvb, loffset);
6648     proto_tree_add_item(ncp_tree, hf_ncp_name12, tvb, loffset+1, string_len, TRUE);
6649     loffset += string_len+1;
6650     string_len = tvb_get_guint8(tvb, loffset);
6651     proto_tree_add_item(ncp_tree, hf_ncp_copyright, tvb, loffset+1, string_len, TRUE);
6654 static void
6655 dissect_ncp_123_17_reply(tvbuff_t *tvb, proto_tree *volatile ncp_tree)
6657     proto_tree              *atree;
6658     proto_item              *aitem;
6659     guint32 loffset, number_of_items, addr_type;
6660     guint16 x;
6662     number_of_items = tvb_get_letohl(tvb, 36);
6663     proto_tree_add_item(ncp_tree, hf_ncp_items_in_packet, tvb, 36, 4, TRUE);
6664     loffset = 40;
6665     for (x = 1; x <= number_of_items; x++)
6666     {
6667         aitem = proto_tree_add_text(ncp_tree, tvb, loffset, -1, "Network Address - %u", x);
6668         atree = proto_item_add_subtree(aitem, ett_ncp);
6670         addr_type = tvb_get_guint8(tvb, loffset);
6671         proto_tree_add_item(atree, hf_ncp_transport_type, tvb, loffset, 1, TRUE);
6672         /* The address type is one byte of a 4 byte value. The next 4 bytes are
6673          * the length of the address. Since we already know the length based upon
6674          * the type of address, we can skip this value. So set the offset accourdingly */
6675         loffset += 8;
6677         switch (addr_type)
6678         {
6679         case 1:
6680             proto_tree_add_item(atree, hf_nds_net, tvb, loffset, 4, FALSE);
6681             proto_tree_add_item(atree, hf_nds_node, tvb, loffset+4, 6, FALSE);
6682             proto_tree_add_item(atree, hf_nds_socket, tvb, loffset+10, 2, FALSE);
6683             loffset += 12;
6684             break;
6685         case 5:
6686             proto_tree_add_item(atree, hf_nds_port, tvb, loffset, 2, FALSE);
6687             proto_tree_add_item(atree, hf_add_ref_udp, tvb, loffset+2, 4, FALSE);
6688             loffset += 6;
6689             break;
6690         case 6:
6691             proto_tree_add_item(atree, hf_nds_port, tvb, loffset, 2, FALSE);
6692             proto_tree_add_item(atree, hf_add_ref_tcp, tvb, loffset+2, 4, FALSE);
6693             loffset += 6;
6694             break;
6695         default:
6696             proto_tree_add_text(atree, tvb, loffset, -1, "Unknown Address Type");
6697             /* unknown type so read the length field and then
6698              * just skip the record and move on to the next */
6699             loffset += tvb_get_letohl(tvb, loffset - 4);
6700             break;
6701         }
6702         proto_item_set_end(aitem, tvb, loffset);
6703         if(tvb_length_remaining(tvb, loffset) < 4 )
6704         {
6705             break;
6706         }
6707     }
6710 static void
6711 dissect_ncp_23_26_reply(tvbuff_t *tvb, proto_tree *volatile ncp_tree)
6713     /* For an IP-only server, the 4-byte IP address is placed into the 4-byte NetworkAddress
6714      * field of the NetworkAddressStruct, while the NetworkNodeAddress and NetworkSocket
6715      * fields are left blank. */
6716     if (tvb_get_letohl(tvb, 12)==0) {
6717         /* IP Address */
6718         proto_tree_add_item(ncp_tree, hf_ncp_ip_address, tvb, 8, 4, FALSE);
6719     }
6720     else
6721     {
6722         /* IPX Address */
6723         proto_tree_add_item(ncp_tree, hf_nds_net, tvb, 8, 4, FALSE);
6724         proto_tree_add_item(ncp_tree, hf_nds_node, tvb, 12, 6, FALSE);
6725         proto_tree_add_item(ncp_tree, hf_nds_socket, tvb, 18, 2, FALSE);
6726     }
6727     proto_tree_add_item(ncp_tree, hf_ncp_connection_type, tvb, 20, 1, TRUE);
6730 static void
6731 dissect_ncp_8x20reply(tvbuff_t *tvb, proto_tree *volatile ncp_tree,
6732                       const ncp_record *ncp_rec, ncp_req_hash_value *request_value)
6734     guint16             x;
6735     guint32             loffset, number_of_items, str_length;
6736     ptvcursor_t         *ptvc = NULL;
6737     proto_tree          *atree, *btree;
6738     proto_item          *aitem, *bitem;
6740     aitem = proto_tree_add_text(ncp_tree, tvb, 8, 9, "Search Sequence:");
6741     atree = proto_item_add_subtree(aitem, ett_ncp);
6743     proto_tree_add_item(atree, hf_ncp_volume_number, tvb, 8, 1, TRUE);
6744     proto_tree_add_item(atree, hf_ncp_directory_entry_number, tvb, 9, 4, TRUE);
6745     proto_tree_add_item(atree, hf_ncp_sequence_number, tvb, 13, 4, TRUE);
6747     proto_tree_add_item(ncp_tree, hf_ncp_more_flag, tvb, 17, 1, TRUE);
6748     number_of_items = tvb_get_letohs(tvb, 18);
6749     proto_tree_add_item(ncp_tree, hf_ncp_info_count, tvb, 18, 2, TRUE);
6750     loffset = 20;
6751     for (x = 1; x <= number_of_items; x++ )
6752     {
6753         aitem = proto_tree_add_text(ncp_tree, tvb, loffset, -1, "Information Item %u", x);
6754         atree = proto_item_add_subtree(aitem, ett_ncp);
6755         /* Data Stream Space Allocated */
6756         if (request_value->req_mask & 0x0002) {
6757             proto_tree_add_item(atree, hf_ncp_data_stream_space_alloc, tvb, loffset, 4, TRUE);
6758             loffset += 4;
6759         }
6760         else
6761         {
6762             if ((request_value->req_mask_ext & 0x8000)==FALSE) {
6763                 loffset += 4;
6764             }
6765         }
6766         /* Attributes */
6767         if (request_value->req_mask & 0x0004) {
6768             bitem = proto_tree_add_text(atree, tvb, loffset, -1, "Attributes");
6769             btree = proto_item_add_subtree(bitem, ett_ncp);
6770             ptvc = ptvcursor_new(btree, tvb, loffset);
6771             process_ptvc_record(ptvc, ptvc_struct_attributes_struct,
6772                     NULL, TRUE, ncp_rec);
6773             ptvcursor_free(ptvc);
6774             loffset += 6;
6775             proto_item_set_end(bitem, tvb, loffset);
6776         }
6777         else
6778         {
6779             if ((request_value->req_mask_ext & 0x8000)==FALSE) {
6780                 loffset += 6;
6781             }
6782         }
6783         /* Data Stream Size */
6784         if (request_value->req_mask & 0x0008) {
6785             bitem = proto_tree_add_text(atree, tvb, loffset, -1, "Data Stream Size");
6786             btree = proto_item_add_subtree(bitem, ett_ncp);
6787             proto_tree_add_item(btree, hf_ncp_data_stream_size, tvb, loffset, 4, TRUE);
6788             loffset += 4;
6789             proto_item_set_end(bitem, tvb, loffset);
6790         }
6791         else
6792         {
6793             if ((request_value->req_mask_ext & 0x8000)==FALSE) {
6794                 loffset += 4;
6795             }
6796         }
6797         /* Total Stream Size */
6798         if (request_value->req_mask & 0x0010) {
6799             bitem = proto_tree_add_text(atree, tvb, loffset, -1, "Total Stream Size");
6800             btree = proto_item_add_subtree(bitem, ett_ncp);
6801             proto_tree_add_item(btree, hf_ncp_ttl_ds_disk_space_alloc, tvb, loffset, 4, TRUE);
6802             proto_tree_add_item(btree, hf_ncp_number_of_data_streams, tvb, loffset+4, 2, TRUE);
6803             loffset += 6;
6804             proto_item_set_end(bitem, tvb, loffset);
6805         }
6806         else
6807         {
6808             if ((request_value->req_mask_ext & 0x8000)==FALSE) {
6809                 loffset += 6;
6810             }
6811         }
6812         /* Extended Attributes new style location*/
6813         if (request_value->req_mask & 0x0020 && ncp_newstyle) {
6814             bitem = proto_tree_add_text(atree, tvb, loffset, -1, "Extended Attributes");
6815             btree = proto_item_add_subtree(bitem, ett_ncp);
6816             ptvc = ptvcursor_new(btree, tvb, loffset);
6817             process_ptvc_record(ptvc, ptvc_struct_ea_info_struct,
6818                     NULL, TRUE, ncp_rec);
6819             ptvcursor_free(ptvc);
6820             loffset += 12;
6821             proto_item_set_end(bitem, tvb, loffset);
6822         }
6823         else
6824         {
6825             if ((request_value->req_mask_ext & 0x8000)==FALSE && ncp_newstyle) {
6826                 loffset += 12;
6827             }
6828         }
6829         /* Creation Information old style location */
6830         if (request_value->req_mask & 0x0100 && !ncp_newstyle) {
6831             bitem = proto_tree_add_text(atree, tvb, loffset, -1, "Creation");
6832             btree = proto_item_add_subtree(bitem, ett_ncp);
6833             ptvc = ptvcursor_new(btree, tvb, loffset);
6834             process_ptvc_record(ptvc, ptvc_struct_creation_info_struct,
6835                     NULL, TRUE, ncp_rec);
6836             ptvcursor_free(ptvc);
6837             loffset += 8;
6838             proto_item_set_end(bitem, tvb, loffset);
6839         }
6840         else
6841         {
6842             if ((request_value->req_mask_ext & 0x8000)==FALSE && !ncp_newstyle) {
6843                 loffset += 8;
6844             }
6845         }
6846         /* Modification Information */
6847         if (request_value->req_mask & 0x0080) {
6848             bitem = proto_tree_add_text(atree, tvb, loffset, -1, "Modification");
6849             btree = proto_item_add_subtree(bitem, ett_ncp);
6850             ptvc = ptvcursor_new(btree, tvb, loffset);
6851             process_ptvc_record(ptvc, ptvc_struct_modify_info_struct,
6852                     NULL, TRUE, ncp_rec);
6853             ptvcursor_free(ptvc);
6854             loffset += 10;
6855             proto_item_set_end(bitem, tvb, loffset);
6856         }
6857         else
6858         {
6859             if ((request_value->req_mask_ext & 0x8000)==FALSE) {
6860                 loffset += 10;
6861             }
6862         }
6863         /* Creation Information new style location */
6864         if (request_value->req_mask & 0x0100 && ncp_newstyle) {
6865             bitem = proto_tree_add_text(atree, tvb, loffset, -1, "Creation");
6866             btree = proto_item_add_subtree(bitem, ett_ncp);
6867             ptvc = ptvcursor_new(btree, tvb, loffset);
6868             process_ptvc_record(ptvc, ptvc_struct_creation_info_struct,
6869                     NULL, TRUE, ncp_rec);
6870             ptvcursor_free(ptvc);
6871             loffset += 8;
6872             proto_item_set_end(bitem, tvb, loffset);
6873         }
6874         else
6875         {
6876             if ((request_value->req_mask_ext & 0x8000)==FALSE && ncp_newstyle) {
6877                 loffset += 8;
6878             }
6879         }
6880         /* Archive Information */
6881         if (request_value->req_mask & 0x0040) {
6882             bitem = proto_tree_add_text(atree, tvb, loffset, -1, "Archive");
6883             btree = proto_item_add_subtree(bitem, ett_ncp);
6884             ptvc = ptvcursor_new(btree, tvb, loffset);
6885             process_ptvc_record(ptvc, ptvc_struct_archive_info_struct,
6886                     NULL, TRUE, ncp_rec);
6887             ptvcursor_free(ptvc);
6888             loffset += 8;
6889             proto_item_set_end(bitem, tvb, loffset);
6890         }
6891         else
6892         {
6893             if ((request_value->req_mask_ext & 0x8000)==FALSE) {
6894                 loffset += 8;
6895             }
6896         }
6897         /* Rights Information */
6898         if (request_value->req_mask & 0x0800) {
6899             ptvc = ptvcursor_new(atree, tvb, loffset);
6900             process_ptvc_record(ptvc, ptvc_struct_rights_info_struct,
6901                     NULL, TRUE, ncp_rec);
6902             ptvcursor_free(ptvc);
6903             loffset += 2;
6904         }
6905         else
6906         {
6907             if ((request_value->req_mask_ext & 0x8000)==FALSE) {
6908                 loffset += 2;
6909             }
6910         }
6911         /* Directory Entry */
6912         if (request_value->req_mask & 0x0400) {
6913             bitem = proto_tree_add_text(atree, tvb, loffset, -1, "Directory Entry");
6914             btree = proto_item_add_subtree(bitem, ett_ncp);
6915             ptvc = ptvcursor_new(btree, tvb, loffset);
6916             process_ptvc_record(ptvc, ptvc_struct_dir_entry_struct,
6917                     NULL, TRUE, ncp_rec);
6918             ptvcursor_free(ptvc);
6919             loffset += 12;
6920             proto_item_set_end(bitem, tvb, loffset);
6921         }
6922         else
6923         {
6924             if ((request_value->req_mask_ext & 0x8000)==FALSE) {
6925                 loffset += 12;
6926             }
6927         }
6928         /* Extended Attributes oldstyle location*/
6929         if (request_value->req_mask & 0x0020 && !ncp_newstyle) {
6930             bitem = proto_tree_add_text(atree, tvb, loffset, -1, "Extended Attributes");
6931             btree = proto_item_add_subtree(bitem, ett_ncp);
6932             ptvc = ptvcursor_new(btree, tvb, loffset);
6933             process_ptvc_record(ptvc, ptvc_struct_ea_info_struct,
6934                     NULL, TRUE, ncp_rec);
6935             ptvcursor_free(ptvc);
6936             loffset += 12;
6937             proto_item_set_end(bitem, tvb, loffset);
6938         }
6939         else
6940         {
6941             if ((request_value->req_mask_ext & 0x8000)==FALSE && !ncp_newstyle) {
6942                 loffset += 12;
6943             }
6944         }
6945         /* Name Space Information */
6946         if (request_value->req_mask & 0x0200) {
6947             proto_tree_add_item(atree, hf_ncp_creator_name_space_number, tvb, loffset, 1, TRUE);
6948             loffset += 4;
6949         }
6950         else
6951         {
6952             if ((request_value->req_mask_ext & 0x8000)==FALSE) {
6953                 loffset += 4;
6954             }
6955         }
6956         if (request_value->req_mask & 0x1000) {
6957             proto_tree_add_item(atree, hf_ncp_curr_ref_id, tvb, loffset, 2, TRUE);
6958             loffset += 2;
6959         }
6960         if (request_value->req_mask & 0x2000) {
6961             proto_tree_add_item(atree, hf_ncp_attr_def_32, tvb, loffset, 1, TRUE);
6962             loffset += 4;
6963         }
6964         if (request_value->req_mask & 0x4000) {
6965             bitem = proto_tree_add_text(atree, tvb, loffset, -1, "Actual");
6966             btree = proto_item_add_subtree(bitem, ett_ncp);
6967             proto_tree_add_item(btree, hf_ncp_data_stream_num_long, tvb, loffset, 4, TRUE);
6968             proto_tree_add_item(btree, hf_ncp_data_stream_fat_blks, tvb, loffset+4, 4, TRUE);
6969             loffset += 8;
6970             proto_item_set_end(bitem, tvb, loffset);
6971         }
6972         if (request_value->req_mask & 0x8000) {
6973             bitem = proto_tree_add_text(atree, tvb, loffset, -1, "Logical");
6974             btree = proto_item_add_subtree(bitem, ett_ncp);
6975             proto_tree_add_item(btree, hf_ncp_data_stream_num_long, tvb, loffset, 4, TRUE);
6976             proto_tree_add_item(btree, hf_ncp_data_stream_size, tvb, loffset+4, 4, TRUE);
6977             loffset += 8;
6978             proto_item_set_end(bitem, tvb, loffset);
6979         }
6980         if (request_value->req_mask_ext & 0x0001 && ncp_newstyle) {
6981             proto_tree_add_item(atree, hf_ncp_sec_rel_to_y2k, tvb, loffset, 4, TRUE);
6982             loffset += 4;
6983         }
6984         if (request_value->req_mask_ext & 0x0002 && ncp_newstyle) {
6985             bitem = proto_tree_add_text(atree, tvb, loffset, -1, "DOS Name");
6986             btree = proto_item_add_subtree(bitem, ett_ncp);
6987             if (ncp_rec->func == 0x57) {
6988                 str_length = tvb_get_guint8(tvb, loffset);
6989                 loffset += 1;
6990             }
6991             else
6992             {
6993                 str_length = tvb_get_letohs(tvb, loffset);
6994                 loffset += 2;
6995             }
6996             proto_tree_add_item(btree, hf_ncp_file_name_12, tvb, loffset, str_length, FALSE);
6997             loffset += str_length;
6998             proto_item_set_end(bitem, tvb, loffset);
6999         }
7000         if (request_value->req_mask_ext & 0x0004 && ncp_newstyle) {
7001             ptvc = ptvcursor_new(atree, tvb, loffset);
7002             process_ptvc_record(ptvc, ptvc_struct_flush_time_struct,
7003                     NULL, TRUE, ncp_rec);
7004             ptvcursor_free(ptvc);
7005             loffset += 4;
7006         }
7007         if (request_value->req_mask_ext & 0x0008 && ncp_newstyle) {
7008             proto_tree_add_item(atree, hf_ncp_parent_base_id, tvb, loffset, 4, TRUE);
7009             loffset += 4;
7010         }
7011         if (request_value->req_mask_ext & 0x0010 && ncp_newstyle) {
7012             proto_tree_add_item(atree, hf_ncp_mac_finder_info, tvb, loffset, 32, TRUE);
7013             loffset += 32;
7014         }
7015         if (request_value->req_mask_ext & 0x0020 && ncp_newstyle) {
7016             proto_tree_add_item(atree, hf_ncp_sibling_count, tvb, loffset, 4, TRUE);
7017             loffset += 4;
7018         }
7019         if (request_value->req_mask_ext & 0x0040 && ncp_newstyle) {
7020             proto_tree_add_item(atree, hf_ncp_effective_rights, tvb, loffset, 1, TRUE);
7021             loffset += 4;
7022         }
7023         if (request_value->req_mask_ext & 0x0080 && ncp_newstyle) {
7024             bitem = proto_tree_add_text(atree, tvb, loffset, -1, "Mac Date");
7025             btree = proto_item_add_subtree(bitem, ett_ncp);
7026             ptvc = ptvcursor_new(btree, tvb, loffset);
7027             process_ptvc_record(ptvc, ptvc_struct_mac_time_struct,
7028                     NULL, TRUE, ncp_rec);
7029             ptvcursor_free(ptvc);
7030             loffset += 8;
7031             proto_item_set_end(bitem, tvb, loffset);
7032         }
7033         if (request_value->req_mask_ext & 0x0100 && ncp_newstyle) {
7034             ptvc = ptvcursor_new(atree, tvb, loffset);
7035             process_ptvc_record(ptvc, ptvc_struct_last_access_time_struct,
7036                     NULL, TRUE, ncp_rec);
7037             ptvcursor_free(ptvc);
7038             loffset += 2;
7039         }
7040         if (request_value->req_mask_ext & 0x0400 && ncp_newstyle) {
7041             proto_tree_add_item(atree, hf_ncp_f_size_64bit, tvb, loffset, 8, TRUE);
7042             loffset += 8;
7043         }
7044         /* We always return the file name */
7045         if (ncp_rec->func == 0x57) {
7046             str_length = tvb_get_guint8(tvb, loffset);
7047             loffset += 1;
7048         }
7049         else
7050         {
7051             str_length = tvb_get_letohs(tvb, loffset);
7052             loffset += 2;
7053         }
7054         proto_tree_add_item(atree, hf_ncp_file_name_12, tvb, loffset, str_length, FALSE);
7055         loffset += str_length;
7057         proto_item_set_end(aitem, tvb, loffset);
7059         if(tvb_length_remaining(tvb, loffset) < 4 )
7060         {
7061                 break;
7062         }
7063     }
7066 static void
7067 dissect_ncp_123_62_reply(tvbuff_t *tvb, proto_tree *volatile ncp_tree)
7069     char value_format[2]="\0";
7070     char param_string[256]="\0";
7072     build_expert_data(ncp_tree, "ncp.set_cmd_type",
7073                       value_format, sizeof value_format, 0, FALSE);
7074     build_expert_data(ncp_tree, "ncp.set_cmd_name",
7075                       param_string, sizeof param_string, 0, FALSE);
7076     switch (atoi(value_format)) {
7077     case 0:   /* { 0x00, "Numeric Value" }, */
7078     case 2:   /* { 0x02, "Ticks Value" },   */
7079     case 4:   /* { 0x04, "Time Value" },    */
7080     case 6:   /* { 0x06, "Trigger Value" }, */
7081     case 7:   /* { 0x07, "Numeric Value" }, */
7082         proto_tree_add_item(ncp_tree, hf_srvr_param_number, tvb, 37+(gint)strlen(param_string), 4, TRUE);
7083         break;
7084     case 1:   /* { 0x01, "Boolean Value" }, */
7085         proto_tree_add_item(ncp_tree, hf_srvr_param_boolean, tvb, 37+(gint)strlen(param_string), 1, TRUE);
7086         break;
7087     case 5:   /* { 0x05, "String Value" },  */
7088         proto_tree_add_item(ncp_tree, hf_srvr_param_string, tvb, 37+(gint)strlen(param_string), -1, TRUE);
7089         break;
7090     default:
7091         break;
7092     }
7096  * Defrag logic
7098  * NDS fragment not being set to 0xffffffff indicates we are inside or at the
7099  * beginning of a fragment. But when the end of the fragment
7100  * is encounterd the flag is set to 0xffffffff. So we must mark what the
7101  * frame number is of the end fragment so that we will be
7102  * able to redissect if the user clicks on the packet
7103  * or resorts/filters the trace.
7105  * Once we are certain that we are in a fragment sequence
7106  * then we can just process each fragment in this conversation
7107  * until we reach the fragment == 0xffffffff packet.
7109  * We will be able to easily determine if a conversation is a fragment
7110  * with the exception of the last packet in the fragment. So remember
7111  * the last fragment packet number.
7113  * Also the NDS dissection requires the values of NDS Verb, Version, and Flags.
7114  * Without these values being remembered from the first request packet then
7115  * we will be unable to dissect the reply packet. For this reason we remember
7116  * these values on the first fragment and then populate the values in the final
7117  * fragment. We only do this on the first dissection.
7118  */
7119 void
7120 nds_defrag(tvbuff_t *tvb, packet_info *pinfo, guint32 nw_connection, guint8 sequence, guint16 type, proto_tree *tree, struct novell_tap *ncp_tap)
7122     int                 i, frag_count=0;
7123     guint               len=0;
7124     guint32             tid = 1;
7125     tvbuff_t            *frag_tvb = NULL;
7126     fragment_head       *fd_head;
7127     ncp_req_hash_value  *request_value = NULL;
7128     conversation_t      *conversation;
7129     guint32             nds_frag;
7131     for (i = 0; i < 99; i++) {
7132         if (!frags[i].nds_fragmented)
7133         {
7134             frags[i].nds_frag = 0xfffffff0;
7135         }
7136     }
7137     /* Check to see if defragmentation is enabeled in the dissector */
7138     if (!nds_defragment) {
7139         dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
7140         return;
7141     }
7142     /* Has this already been dissected? */
7143     if (!pinfo->fd->flags.visited) {
7144         /* Find the conversation whence the request would have come. */
7145         conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
7146                                          PT_NCP, nw_connection, nw_connection, 0);
7147         if (conversation != NULL) {
7148             /* find the record telling us the request made that caused
7149                this reply */
7150             request_value = ncp_hash_lookup(conversation, sequence, pinfo->fd->num);
7151             if (!request_value) {
7152                 dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
7153                 return;
7154             }
7155             p_add_proto_data(pinfo->fd, proto_ncp, 0, (void*) request_value);
7156         }
7157         /* else... we haven't seen an NCP Request for that conversation and sequence. */
7158         else
7159             {
7160                 dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
7161                 return;
7162             }
7163     }
7164     else {
7165         request_value = (ncp_req_hash_value *)p_get_proto_data(pinfo->fd, proto_ncp, 0);
7166         if (!request_value) {
7167                 dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
7168                 return;
7169         }
7170     }
7171     /* Validate that this is an NDS packet */
7172     /* If this isn't an NDS packet then just return */
7173     if (!request_value->ncp_rec ||
7174         request_value->ncp_rec->func!=104 || request_value->ncp_rec->subfunc!=2) {
7175         dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
7176         return;
7177     }
7178     /* Check to see if there is at least enough packet info to get the fragment flag */
7179     if (tvb_reported_length_remaining(tvb, 12) < 4) {
7180         dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
7181         return;
7182     }
7183     /* Get the fragment flag */
7184     nds_frag = tvb_get_letohl(tvb, 12);
7186     /* Now we need to find if this is a new fragment or already one defined. */
7187     /* We currently limit the maximum number of simultaneous fragments to 100. */
7188     for (i=0; i<100; i++)
7189     {
7190         if (frags[i].nds_frag == nds_frag || frags[i].nds_frag == 0xfffffff0)
7191         {
7192             if (frags[i].nds_frag == 0xfffffff0)
7193                 {
7194                     frags[i].nds_length = 0;
7195                     frags[i].nds_frag = nds_frag;
7196                     frags[i].nds_fragmented = TRUE;
7197                     frags[i].sequence = 0;
7198                 }
7199             break;
7200         }
7201     }
7202     if (i > 99)
7203         return;
7205     frag_count = i;
7207     /* is this the end of an existing fragment or just another reply */
7208     if (nds_frag == 0xffffffff && request_value->nds_frag_num == 0xffffffff)
7209     {
7210         dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
7211         return;
7212     }
7214     /* Now we process the fragments */
7215     if (request_value->nds_frag || (request_value->nds_end_frag == pinfo->fd->num))
7216     {
7217         /* Check to see of this is a fragment. If so then mark as a fragment. */
7218         if (frags[frag_count].nds_frag==0xffffffff) {
7219             request_value->nds_frag = FALSE;
7220             /* nds_length of 0 means start of fragment */
7221             frags[frag_count].nds_length = 0;
7222         }
7223         else
7224         {
7225             if (frags[frag_count].nds_length == 0)
7226             {
7227                 frags[frag_count].nds_length = tvb_get_letohl(tvb, 0);
7228             }
7229         }
7230         /*
7231          * Fragment
7232          *
7233          */
7234         tid = (pinfo->srcport+pinfo->destport);
7235         len = tvb_reported_length(tvb);
7236         if (len > 0 && tvb_bytes_exist(tvb, 0, len))
7237         {
7238             if (frags[frag_count].nds_length > len)
7239             {
7240                 /* This is the first fragment so remember the verb, version, and flags. */
7241                 frags[frag_count].nds_frag_verb = request_value->nds_request_verb;
7242                 frags[frag_count].nds_frag_version = request_value->nds_version;
7243                 frags[frag_count].nds_frag_flags = request_value->req_nds_flags;
7244                 frags[frag_count].nds_frag_prot_flags = request_value->req_nds_prot_flags;
7245                 fd_head = fragment_add_seq_next(&nds_reassembly_table, tvb, 0, pinfo, tid, NULL, len, request_value->nds_frag);
7246                 frags[frag_count].sequence = sequence;
7247                 frags[frag_count].nds_length = 1;
7248             }
7249             else
7250             {
7251                 /* Subsequent fragments should be offset by 16 since we do not need */
7252                 /* the additional fragment handle and size fields in our composite data */
7253                 /* Also do not add retransmitted packets, just mark and return */
7254                 if (!pinfo->fd->flags.visited)
7255                 {
7256                     if (sequence != frags[frag_count].sequence) {
7257                         fd_head = fragment_add_seq_next(&nds_reassembly_table, tvb, 16, pinfo, tid, NULL, len-16, request_value->nds_frag);
7258                         frags[frag_count].sequence = sequence;
7259                     }
7260                     else
7261                     {
7262                         col_add_fstr(pinfo->cinfo, COL_INFO, "[Retransmitted NDS Fragment 0x%08x]", frags[frag_count].nds_frag);
7263                         return;
7264                     }
7265                 }
7266                 else
7267                 {
7268                     fd_head = fragment_add_seq_next(&nds_reassembly_table, tvb, 16, pinfo, tid, NULL, len-16, request_value->nds_frag);
7269                     frags[frag_count].sequence = sequence;
7270                 }
7271             }
7272             if (fd_head != NULL)
7273             {
7274                 /* Is this the last fragment? nds_frag will indicate */
7275                 if (fd_head->next != NULL && !request_value->nds_frag)
7276                 {
7277                     frag_tvb = tvb_new_chain(tvb, fd_head->tvb_data);
7278                     add_new_data_source(pinfo,
7279                                         frag_tvb,
7280                                         "Reassembled NDS");
7281                     /* Show all fragments. */
7282                     if (tree)
7283                     {
7284                         proto_item *frag_tree_item;
7285                         show_fragment_seq_tree(fd_head,
7286                                                &nds_frag_items,
7287                                                tree, pinfo,
7288                                                frag_tvb, &frag_tree_item);
7289                         tid++;
7290                     }
7292                     if (!pinfo->fd->flags.visited)
7293                     {
7294                         /* Now we need to find the original fragment number. */
7295                         /* Get the fragment flag */
7296                         nds_frag = tvb_get_letohl(frag_tvb, 12);
7297                         for (i=0; i<100; i++)
7298                         {
7299                             if (frags[i].nds_frag == nds_frag)
7300                             {
7301                                 break;
7302                             }
7303                         }
7304                         if (i > 99)
7305                             return;
7306                         if (frags[i].nds_frag == 0xffffffff)
7307                         {
7308                             /* Error can't find fragment */
7309                             /*DISSECTOR_ASSERT(0);*/
7310                         }
7311                         frag_count = i;
7312                         /* Remember this fragment information so we can dissect.
7313                          * Only do this on the first dissection. After the first
7314                          * dissection we will just read the memory values.
7315                          */
7316                         request_value->nds_end_frag = pinfo->fd->num;
7317                         request_value->nds_request_verb = frags[frag_count].nds_frag_verb;
7318                         request_value->nds_version = frags[frag_count].nds_frag_version;
7319                         request_value->req_nds_flags = frags[frag_count].nds_frag_flags;
7320                         request_value->req_nds_prot_flags = frags[frag_count].nds_frag_prot_flags;
7321                     }
7323                 }
7324                 else
7325                 {
7326                     /* This is either a beggining or middle fragment on second dissection */
7327                     frag_tvb = tvb_new_subset(tvb, 0, -1, -1);
7328                     if (request_value->nds_frag)
7329                     {
7330                       col_add_fstr(pinfo->cinfo, COL_INFO, "[NDS Fragment 0x%08x]", frags[frag_count].nds_frag);
7331                     }
7332                 }
7333             }
7334             else
7335             {
7336                 /* Fragment from first pass of dissection */
7337                 if (request_value->nds_frag)
7338                 {
7339                    col_add_fstr(pinfo->cinfo, COL_INFO, "[NDS Fragment 0x%08x]", frags[frag_count].nds_frag);
7340                 }
7342                 frag_tvb = NULL;
7343             }
7344         }
7345         else
7346         {
7347             /*
7348              * There are no bytes so Dissect this
7349              */
7350             frag_tvb = tvb_new_subset(tvb, 0, -1, -1);
7351         }
7352         if (frag_tvb == NULL)
7353         {
7354             /* This is a fragment packet */
7355             frag_tvb = tvb_new_subset (tvb, 0, -1, -1);
7356             nds_data_handle = find_dissector("data");
7357             call_dissector(nds_data_handle, frag_tvb, pinfo, tree);
7358         }
7359         else
7360         {
7361             /* This is the end fragment so dissect */
7362             if (!request_value->nds_frag) {
7363                 frags[frag_count].nds_length = 0;
7364                 dissect_ncp_reply(frag_tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
7365             }
7366         }
7367     }
7368     else
7369     {
7370         /* This is not any fragment packet */
7371         request_value->nds_frag = FALSE;
7372         /* Trap for retransmitted end fragment */
7373         if (request_value->nds_end_frag < pinfo->fd->num) {
7374             col_add_fstr(pinfo->cinfo, COL_INFO, "[Retransmitted end of NDS Fragment 0x%08x, see packet #%d for details.]", request_value->nds_frag_num, request_value->nds_end_frag);
7375         }
7376         else
7377         {
7378             dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
7379         }
7380     }
7383 static gboolean ncp2222_dfilters_compiled = FALSE;
7385 static void
7386 ncp2222_compile_dfilters(void)
7388     int i;
7390     for (i = 0; i < NUM_REQ_CONDS; i++) {
7391         if (!dfilter_compile((const gchar*)req_conds[i].dfilter_text,
7392                              &req_conds[i].dfilter)) {
7393             g_message("NCP dissector failed to compile dfilter: %s\n",
7394                       req_conds[i].dfilter_text);
7395             g_assert_not_reached();
7396         }
7397     }
7400 void
7401 dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
7402                 guint32 nw_connection, guint8 sequence,
7403                 guint16 type, proto_tree *volatile ncp_tree)
7405     volatile guint8         func=0;
7406     volatile guint8         subfunc = 0;
7407     gboolean                requires_subfunc = FALSE;
7408     gboolean                has_length = FALSE;
7409     ncp_req_hash_value      *volatile request_value = NULL;
7410     const ncp_record        *volatile ncp_rec = NULL;
7411     conversation_t          *conversation;
7412     ptvcursor_t             *volatile ptvc = NULL;
7413     proto_tree              *temp_tree = NULL;
7414     volatile gboolean       run_req_cond = FALSE;
7415     volatile gboolean       run_info_str = FALSE;
7416     guint32                 length_remaining;
7417     guint32                 testvar;
7418     volatile unsigned long  exception_code;
7419     const char              *volatile message;
7422     /* We're dissecting an ncp2222 request; Compile the dfilters (if not yet done). */
7423     /* XXX: We do this here rather than at "post-registration" (as previouly done)  */
7424     /*      so compiling over 100 dfilters is done only if needed (thus avoiding    */
7425     /*      compiling the dfilters each time Wireshark is started.                  */
7426     if (! ncp2222_dfilters_compiled) {
7427         ncp2222_compile_dfilters();
7428         ncp2222_dfilters_compiled = TRUE;
7429     }
7431     /* Determine which ncp_record to use. */
7432     switch (type) {
7433     case NCP_ALLOCATE_SLOT:
7434         length_remaining = tvb_length_remaining(tvb, 4);
7435         if (length_remaining > 4)
7436         {
7437             testvar = tvb_get_ntohl(tvb, 4);
7438             if( testvar == 0x4c495020)
7439             {
7440                 ncp_rec = &ncplip_echo;
7441             }
7442             else
7443             {
7444                 ncp_rec = &ncp1111_request;
7445                 if (ncp_echo_conn) {
7446                     expert_add_info(pinfo, NULL, &ei_ncp_connection_request);
7447                 }
7448             }
7449         }
7450         else
7451         {
7452             ncp_rec = &ncp1111_request;
7453             if (ncp_echo_conn) {
7454                 expert_add_info(pinfo, NULL, &ei_ncp_connection_request);
7455             }
7456         }
7457         break;
7458     case NCP_SERVICE_REQUEST:
7459         func = tvb_get_guint8(tvb, 6);
7460         requires_subfunc = ncp_requires_subfunc(func);
7461         has_length = ncp_has_length_parameter(func);
7462         if (requires_subfunc) {
7463             if (has_length) {
7464                 subfunc = tvb_get_guint8(tvb, 9);
7465             }
7466             else {
7467                 subfunc = tvb_get_guint8(tvb, 7);
7468             }
7469         }
7470         ncp_rec = ncp_record_find(func, subfunc);
7471         break;
7472     case NCP_DEALLOCATE_SLOT:
7473         ncp_rec = &ncp5555_request;
7474         if (ncp_echo_conn) {
7475             expert_add_info_format(pinfo, NULL, &ei_ncp_destroy_connection, "Destroy Connection %u Request", nw_connection);
7476         }
7477         break;
7478     case NCP_BROADCAST_SLOT:
7479         ncp_rec = &ncpbbbb_request;
7480         break;
7481     case NCP_LIP_ECHO:
7482         ncp_rec = &ncplip_echo;
7483         break;
7484     default:
7485         ncp_rec = NULL;
7486         break;
7487     }
7489     /* Fill in the INFO column. */
7490     if (ncp_rec) {
7491         col_add_fstr(pinfo->cinfo, COL_INFO, "C %s", ncp_rec->name);
7492         if (ncp_rec->req_info_str) {
7493             /* We want to add more stuff to the Info
7494                 column. */
7495             run_info_str = TRUE;
7496         }
7497     }
7498     else {
7499         if (requires_subfunc) {
7500             col_add_fstr(pinfo->cinfo, COL_INFO,
7501                             "C Unknown Function %u %u (0x%02X/0x%02x)",
7502                             func, subfunc, func, subfunc);
7503             return;
7504         }
7505         else {
7506             col_add_fstr(pinfo->cinfo, COL_INFO,
7507                             "C Unknown Function %u (0x%02x)",
7508                             func, func);
7509             return;
7510         }
7511     }
7513     if (!pinfo->fd->flags.visited) {
7514         /* This is the first time we've looked at this packet.
7515            Keep track of the address and connection whence the request
7516            came, and the address and connection to which the request
7517            is being sent, so that we can match up calls with replies.
7518            (We don't include the sequence number, as we may want
7519            to have all packets over the same connection treated
7520            as being part of a single conversation so that we can
7521            let the user select that conversation to be displayed.) */
7522         conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
7523                                          PT_NCP, nw_connection, nw_connection, 0);
7525         if (conversation == NULL) {
7526             /* It's not part of any conversation - create a new one. */
7527             conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst,
7528                                             PT_NCP, nw_connection, nw_connection, 0);
7529         }
7530         request_value = ncp_hash_insert(conversation, sequence, ncp_rec, pinfo->fd->num);
7531         request_value->req_frame_num = pinfo->fd->num;
7532         request_value->req_frame_time = pinfo->fd->abs_ts;
7534         /* If this is the first time we're examining the packet,
7535          * check to see if this NCP type uses a "request condition".
7536          * If so, we have to build a proto_tree because request conditions
7537          * use display filters to work, and without a proto_tree,
7538          * display filters can't possibly work. */
7539         if (ncp_rec) {
7540             if (ncp_rec->req_cond_indexes) {
7541                 run_req_cond = TRUE;
7542             }
7543         }
7544     }
7546     /* If we have to handle a request condition, or have to
7547        add to the Info column, we need to construct a protocol
7548        tree.  If we already have a proto_tree, then wonderful.
7549        If we don't, we need to build one. */
7550     if ((run_info_str || run_req_cond) && !ncp_tree) {
7551         proto_item *ti;
7553         temp_tree = proto_tree_create_root(pinfo);
7554         proto_tree_set_visible(temp_tree, FALSE);
7555         ti = proto_tree_add_item(temp_tree, proto_ncp, tvb, 0, -1, FALSE);
7556         ncp_tree = proto_item_add_subtree(ti, ett_ncp);
7557     }
7559     if (ncp_tree) {
7560         /* If the dissection throws an exception, be sure to free
7561          * the temporary proto_tree that was created. Because of the
7562          * way the CLEANUP_PUSH macro works, we can't put it in an 'if'
7563          * block; it has to be in the same scope as the terminating
7564          * CLEANUP_POP or CLEANUP_POP_AND_ALLOC. So, we always
7565          * call CLEANUP_POP and friends, but the value of temp_tree is
7566          * NULL if no cleanup is needed, and non-null if cleanup is needed. */
7567         CLEANUP_PUSH_PFX(xx,free_proto_tree, temp_tree);
7569 #ifdef FAKE_TREE_IS_VISIBLE
7570         PTREE_DATA(ncp_tree)->visible=1;
7571 #endif
7573         /* Before the dissection, if we're saving data for a request
7574          * condition, we have to prime the proto tree using the
7575          * dfilter information */
7576         if (run_req_cond) {
7577             const int *needed;
7578             dfilter_t *dfilter;
7580             needed = ncp_rec->req_cond_indexes;
7582             while (*needed != -1) {
7583                 dfilter = req_conds[*needed].dfilter;
7584                 /* Prime the proto_tree with "interesting fields". */
7585                 dfilter_prime_proto_tree(dfilter, ncp_tree);
7586                 needed++;
7587             }
7588         }
7590         /* Before the dissection, if we need a field for the info_str,
7591          * prime the tree. */
7592         if (run_info_str) {
7593             proto_tree_prime_hfid(ncp_tree, *ncp_rec->req_info_str->hf_ptr);
7594         }
7596         switch (type) {
7597         case NCP_BROADCAST_SLOT:
7598             ; /* nothing */
7599             break;
7601         case NCP_SERVICE_REQUEST:
7602             proto_tree_add_uint_format(ncp_tree, hf_ncp_func, tvb, 6, 1,
7603                                        func, "Function: %u (0x%02X), %s",
7604                                        func, func, ncp_rec ? ncp_rec->name : "Unknown");
7605             break;
7607         default:
7608             ; /* nothing */
7609             break;
7610         }
7611         if (request_value) {
7612             request_value->length = 0;
7613         }
7614         if (requires_subfunc) {
7615             if (has_length) {
7616                 if (request_value && func==123) {
7617                     request_value->length = tvb_get_ntohs(tvb, 7);
7618                 }
7619                 proto_tree_add_item(ncp_tree, hf_ncp_length, tvb, 7,
7620                                     2, FALSE);
7621                 proto_tree_add_uint_format(ncp_tree, hf_ncp_subfunc, tvb, 9, 1,
7622                                            subfunc, "SubFunction: %u (0x%02x)",
7623                                            subfunc, subfunc);
7624                 ptvc = ptvcursor_new(ncp_tree, tvb, 10);
7625             }
7626             else {
7627                 proto_tree_add_uint_format(ncp_tree, hf_ncp_subfunc, tvb, 7, 1,
7628                                            subfunc, "SubFunction: %u (0x%02x)",
7629                                            subfunc, subfunc);
7630                 ptvc = ptvcursor_new(ncp_tree, tvb, 8);
7631             }
7632         }
7633         else {
7634             ptvc = ptvcursor_new(ncp_tree, tvb, 7);
7635         }
7637         /* The group is not part of the packet, but it's useful
7638          * information to display anyway. Put it in the tree for filtering and tap use*/
7639         if (ncp_rec) {
7640             proto_tree_add_uint_format(ncp_tree, hf_ncp_group, tvb, 0, 0, ncp_rec->group, "Group: %s", ncp_groups[ncp_rec->group]);
7641         }
7643         exception_code = 0;
7644         message = NULL;
7645         if (ncp_rec && ncp_rec->request_ptvc) {
7646             clear_repeat_vars();
7647             /*
7648              * We need to remember the results even if we
7649              * throw an exception dissecting this request,
7650              * so that we can properly dissect the reply.
7651              * We catch any exceptions thrown when
7652              * dissecting the request, and re-throw them
7653              * after saving the results of any conditional
7654              * tests.
7655              */
7656             TRY {
7657                 process_ptvc_record(ptvc, ncp_rec->request_ptvc, NULL, TRUE, ncp_rec);
7658             } CATCH_ALL {
7659                 exception_code = EXCEPT_CODE;
7660                 message = GET_MESSAGE;
7661             }
7662             ENDTRY;
7663         }
7664         ptvcursor_free(ptvc);
7666         /* Now that the dissection is done, do we need to run
7667          * some display filters on the resulting tree in order
7668          * to save results for "request conditions" ? */
7669         if (run_req_cond) {
7670             const int   *needed;
7671             gboolean    *results;
7672             dfilter_t   *dfilter;
7674             results = (gboolean *)se_alloc0(sizeof(gboolean)*NUM_REQ_CONDS);
7675             needed = ncp_rec->req_cond_indexes;
7677             while (*needed != -1) {
7678                 /* ncp_tree is not a root proto_tree, but
7679                  * dfilters will still work on it. */
7680                 dfilter = req_conds[*needed].dfilter;
7681                 results[*needed] = dfilter_apply(dfilter, ncp_tree);
7682                 needed++;
7683             }
7685             /* Save the results so the reply packet dissection
7686              * get to them. */
7687             request_value->req_cond_results = results;
7688         }
7689         /* Construct the info string if necessary */
7690         if (run_info_str) {
7691             GPtrArray *parray;
7692             char*   byte_string;
7693             char    non_uni_string[1024];
7694             int i, len;
7695             field_info *finfo;
7696             int info_type;
7698             if (!request_value)
7699             {
7700                 conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
7701                                                  PT_NCP, nw_connection, nw_connection, 0);
7702                 if (conversation != NULL) {
7703                     /* find the record telling us the request made that caused
7704                        this reply */
7705                     request_value = ncp_hash_lookup(conversation, sequence, pinfo->fd->num);
7706                 }
7707                 if (!conversation || !request_value)
7708                 {
7709                     return;
7710                 }
7711             }
7713             parray = proto_get_finfo_ptr_array(ncp_tree,
7714                                                *ncp_rec->req_info_str->hf_ptr);
7715             len = g_ptr_array_len(parray);
7717             if (len > 0) {
7719                 col_set_str(pinfo->cinfo, COL_INFO, "C ");
7721                 finfo = (field_info *)g_ptr_array_index(parray, 0);
7723                 info_type = get_info_type((const gchar*) ncp_rec->req_info_str->first_string);
7725                 if (info_type != 0) {    /* Is this  a string or not? */
7727                     if (info_type == 1) {   /* Is this bytes? */
7728                         byte_string = bytes_to_str(get_finfo_value_string(finfo), get_finfo_length(finfo));
7729                         col_append_fstr(pinfo->cinfo, COL_INFO,
7730                                         (const gchar*) ncp_rec->req_info_str->first_string,
7731                                         byte_string);
7732                     }
7733                     else
7734                     {
7735                         if (info_type == 2) {   /* Is this a String? */
7736                             uni_to_string(get_finfo_value_string(finfo), get_finfo_length(finfo), non_uni_string);
7737                             col_append_fstr(pinfo->cinfo, COL_INFO,
7738                                             (const gchar*) ncp_rec->req_info_str->first_string,
7739                                             non_uni_string);
7740                         }
7741                         else
7742                         {
7743                             col_append_fstr(pinfo->cinfo, COL_INFO,
7744                                             (const gchar*) ncp_rec->req_info_str->first_string,
7745                                             get_finfo_value_string(finfo));
7746                         }
7747                     }
7748                 }
7749                 else
7750                 {
7751                     col_append_fstr(pinfo->cinfo, COL_INFO,
7752                                     (const gchar*) ncp_rec->req_info_str->first_string,
7753                                     get_finfo_value_integer(finfo));
7754                 }
7755             }
7756             if (len > 1) {
7757                 for (i = 1; i < len; i++) {
7758                     non_uni_string[0]='\0';
7759                     finfo = (field_info *)g_ptr_array_index(parray, i);
7760                     info_type = get_info_type((const gchar*) ncp_rec->req_info_str->repeat_string);
7762                     if (info_type != 0) {    /* Is this  a string or not? */
7763                         if (info_type == 1)
7764                         {   /* Is this bytes? */
7765                             byte_string = bytes_to_str(get_finfo_value_string(finfo), get_finfo_length(finfo));
7766                             col_append_fstr(pinfo->cinfo, COL_INFO,
7767                                             (const gchar*) ncp_rec->req_info_str->repeat_string,
7768                                             byte_string);
7769                         }
7770                         else
7771                         {
7772                             if (info_type == 2) {   /* Is this a String? */
7773                                 uni_to_string(get_finfo_value_string(finfo), get_finfo_length(finfo), non_uni_string);
7774                                 col_append_fstr(pinfo->cinfo, COL_INFO,
7775                                                 (const gchar*) ncp_rec->req_info_str->repeat_string,
7776                                                 non_uni_string);
7777                             }
7778                             else
7779                             {
7780                                 col_append_fstr(pinfo->cinfo, COL_INFO,
7781                                                 (const gchar*) ncp_rec->req_info_str->repeat_string,
7782                                                 get_finfo_value_string(finfo));
7783                             }
7784                         }
7785                     }
7786                     else
7787                     {
7788                         col_append_fstr(pinfo->cinfo, COL_INFO,
7789                                         (const gchar*) ncp_rec->req_info_str->repeat_string,
7790                                         get_finfo_value_integer(finfo));
7791                     }
7792                 }
7793             }
7794         }
7795         if (!request_value)
7796         {
7797              conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
7798                                                  PT_NCP, nw_connection, nw_connection, 0);
7799              if (conversation != NULL) {
7800                  /* find the record telling us the request made that caused
7801                     this reply */
7802                  request_value = ncp_hash_lookup(conversation, sequence, pinfo->fd->num);
7803               }
7804         }
7805         /* SecretStore packets are dessected in packet-ncp-sss.c */
7806         if (func == 0x5c && ncp_tree) {
7807             dissect_sss_request(tvb, pinfo, ncp_tree, request_value);
7808         }
7809         /* NMAS packets are dessected in packet-ncp-nmas.c */
7810         if (func == 0x5e && ncp_tree) {
7811             dissect_nmas_request(tvb, pinfo, ncp_tree, request_value);
7812         }
7814         /* Store NCP request specific flags for manual dissection */
7815         if ((func == 0x57 || func == 0x59) && subfunc == 0x14 && ncp_tree && request_value) {
7816             char ret_info_string[16];
7817             char ret_info_string_ext[16];
7819             build_expert_data(ncp_tree, "ncp.ret_info_mask",
7820                               ret_info_string, sizeof ret_info_string, 0, FALSE);
7821             request_value->req_mask = (guint32) atoi(ret_info_string);
7822             build_expert_data(ncp_tree, "ncp.ext_info",
7823                               ret_info_string_ext, sizeof ret_info_string_ext,
7824                               0, FALSE);
7825             request_value->req_mask_ext = (guint32) atoi(ret_info_string_ext);
7826         }
7827         /* NCP function 89/6 passes either ASCII or UTF8 data */
7828         /* Decode manually since it is not possible to SREC the request */
7829         /* packets from the python code */
7830         if (func == 0x59 && subfunc == 0x6) {
7831             dissect_ncp_89_6_request(tvb, ncp_tree, 22);
7832         }
7833         /* Check to see if we need to report to the expert table */
7834         trap_for_expert_event(ncp_tree, pinfo, ncp_rec, 0);
7835         /* Free the temporary proto_tree */
7836         CLEANUP_CALL_AND_POP_PFX(xx);
7838         /* Re-throw any exception. */
7839         if (exception_code != 0)
7840             THROW_MESSAGE(exception_code, message);
7841     }
7844 static void
7845 dissect_nds_ping_reply(tvbuff_t *tvb, packet_info *pinfo _U_,
7846                        proto_tree *ncp_tree, ncp_req_hash_value *request_value)
7848     const char *reply_buffer;
7849     guint8     ping_version;
7850     guint32    nds_string_len;
7851     guint32    nds_offset;
7852     guint32    bvalue;
7853     guint32    nds_flags;
7854     nds_val    pvalues[9];
7855     int        i;
7856     nstime_t   ns;
7858     ping_version = tvb_get_guint8(tvb, 8);
7859     proto_tree_add_item(ncp_tree, hf_ping_version, tvb, 8, 1, TRUE);
7860     if (ping_version == 9) {
7861         nds_string_len = tvb_get_ntohl(tvb, 9);
7862         nds_offset = nds_string_len+16;
7863         tvb_ensure_bytes_exist(tvb, 16, nds_string_len);
7864         proto_tree_add_item(ncp_tree, hf_nds_tree_name, tvb, 16, nds_string_len, FALSE);
7865         proto_tree_add_item(ncp_tree, hf_nds_reply_depth, tvb, nds_offset, 4, FALSE);
7866         proto_tree_add_item(ncp_tree, hf_nds_reply_rev, tvb, (nds_offset+4), 4, FALSE);
7867         proto_tree_add_item(ncp_tree, hf_nds_reply_flags, tvb, (nds_offset+8), 4, TRUE);
7868     }
7869     else {
7870         nds_offset = 12;
7871         nds_flags = request_value->req_nds_flags;
7872         bvalue = 0x00000001;
7874         for (i = 0 ; i < 32; i++ ) {
7875             if (nds_flags & bvalue)
7876             {
7877                 switch(bvalue)
7878                 {
7879                 case 0x00000001:   /* Supported Fields */
7880                     pvalues[0].vvalue = tvb_get_letohs(tvb, nds_offset);
7881                     pvalues[0].vtype = VTYPE_BITFIELD;
7882                     pvalues[0].vstring = "";
7883                     pvalues[0].vdesc = "Ping (low) Flags:";
7884                     pvalues[0].vlength = 2;
7885                     pvalues[0].hfname= hf_nds_rflags;
7886                     pvalues[0].voffset = nds_offset;
7887                     pvalues[0].bit1 = "Supported Fields";
7888                     pvalues[0].bit1hfname = hf_bit1pingflags1;
7889                     pvalues[0].bit2 = "Depth";
7890                     pvalues[0].bit2hfname = hf_bit2pingflags1;
7891                     pvalues[0].bit3 = "Build Number";
7892                     pvalues[0].bit3hfname = hf_bit3pingflags1;
7893                     pvalues[0].bit4 = "Flags";
7894                     pvalues[0].bit4hfname = hf_bit4pingflags1;
7895                     pvalues[0].bit5 = "Verification Flags";
7896                     pvalues[0].bit5hfname = hf_bit5pingflags1;
7897                     pvalues[0].bit6 = "Letter Version";
7898                     pvalues[0].bit6hfname = hf_bit6pingflags1;
7899                     pvalues[0].bit7 = "OS Version";
7900                     pvalues[0].bit7hfname = hf_bit7pingflags1;
7901                     pvalues[0].bit8 = "License Flags";
7902                     pvalues[0].bit8hfname = hf_bit8pingflags1;
7903                     pvalues[0].bit9 = "DS Time";
7904                     pvalues[0].bit9hfname = hf_bit9pingflags1;
7905                     pvalues[0].bit10 = "Server Time";
7906                     pvalues[0].bit10hfname = hf_bit10pingflags1;
7907                     pvalues[0].bit11 = "Create Time";
7908                     pvalues[0].bit11hfname = hf_bit11pingflags1;
7909                     pvalues[0].bit12 = "Not Defined";
7910                     pvalues[0].bit12hfname = hf_bit12pingflags1;
7911                     pvalues[0].bit13 = "Not Defined";
7912                     pvalues[0].bit13hfname = hf_bit13pingflags1;
7913                     pvalues[0].bit14 = "Not Defined";
7914                     pvalues[0].bit14hfname = hf_bit14pingflags1;
7915                     pvalues[0].bit15 = "Not Defined";
7916                     pvalues[0].bit15hfname = hf_bit15pingflags1;
7917                     pvalues[0].bit16 = "Not Defined";
7918                     pvalues[0].bit16hfname = hf_bit16pingflags1;
7920                     process_bitfield(ncp_tree, tvb, &pvalues[0]);
7921                     nds_offset += 2;
7923                     pvalues[0].vvalue = tvb_get_letohs(tvb, nds_offset);
7924                     pvalues[0].vtype = VTYPE_BITFIELD;
7925                     pvalues[0].vstring = "";
7926                     pvalues[0].vdesc = "Ping (high) Flags:";
7927                     pvalues[0].vlength = 2;
7928                     pvalues[0].hfname= hf_nds_rflags;
7929                     pvalues[0].voffset = nds_offset;
7930                     pvalues[0].bit1 = "Sap Name";
7931                     pvalues[0].bit1hfname = hf_bit1pingflags2;
7932                     pvalues[0].bit2 = "Tree Name";
7933                     pvalues[0].bit2hfname = hf_bit2pingflags2;
7934                     pvalues[0].bit3 = "OS Name";
7935                     pvalues[0].bit3hfname = hf_bit3pingflags2;
7936                     pvalues[0].bit4 = "Hardware Name";
7937                     pvalues[0].bit4hfname = hf_bit4pingflags2;
7938                     pvalues[0].bit5 = "Vendor Name";
7939                     pvalues[0].bit5hfname = hf_bit5pingflags2;
7940                     pvalues[0].bit6 = "Not Defined";
7941                     pvalues[0].bit6hfname = hf_bit6pingflags2;
7942                     pvalues[0].bit7 = "Not Defined";
7943                     pvalues[0].bit7hfname = hf_bit7pingflags2;
7944                     pvalues[0].bit8 = "Not Defined";
7945                     pvalues[0].bit8hfname = hf_bit8pingflags2;
7946                     pvalues[0].bit9 = "Not Defined";
7947                     pvalues[0].bit9hfname = hf_bit9pingflags2;
7948                     pvalues[0].bit10 = "Not Defined";
7949                     pvalues[0].bit10hfname = hf_bit10pingflags2;
7950                     pvalues[0].bit11 = "Not Defined";
7951                     pvalues[0].bit11hfname = hf_bit11pingflags2;
7952                     pvalues[0].bit12 = "Not Defined";
7953                     pvalues[0].bit12hfname = hf_bit12pingflags2;
7954                     pvalues[0].bit13 = "Not Defined";
7955                     pvalues[0].bit13hfname = hf_bit13pingflags2;
7956                     pvalues[0].bit14 = "Not Defined";
7957                     pvalues[0].bit14hfname = hf_bit14pingflags2;
7958                     pvalues[0].bit15 = "Not Defined";
7959                     pvalues[0].bit15hfname = hf_bit15pingflags2;
7960                     pvalues[0].bit16 = "Not Defined";
7961                     pvalues[0].bit16hfname = hf_bit16pingflags2;
7963                     process_bitfield(ncp_tree, tvb, &pvalues[0]);
7964                     nds_offset += 2;
7965                     break;
7966                 case 0x00000002:
7967                     proto_tree_add_item(ncp_tree, hf_nds_reply_depth, tvb, nds_offset, 4, TRUE);
7968                     nds_offset += 4;
7969                     break;
7970                 case 0x00000004:
7971                     proto_tree_add_item(ncp_tree, hf_nds_reply_rev, tvb, nds_offset, 4, TRUE);
7972                     nds_offset += 4;
7973                     break;
7974                 case 0x00000008:
7975                     pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
7976                     pvalues[0].vtype = VTYPE_BITFIELD;
7977                     pvalues[0].vstring = "";
7978                     pvalues[0].vdesc = "Pong Data Flags:";
7979                     pvalues[0].vlength = 4;
7980                     pvalues[0].hfname= hf_nds_rflags;
7981                     pvalues[0].voffset = nds_offset;
7982                     pvalues[0].bit1 = "Root Most Master Replica";
7983                     pvalues[0].bit1hfname = hf_bit1pingpflags1;
7984                     pvalues[0].bit2 = "Time Synchronized?";
7985                     pvalues[0].bit2hfname = hf_bit2pingpflags1;
7986                     pvalues[0].bit3 = "Time Valid?";
7987                     pvalues[0].bit3hfname = hf_bit3pingpflags1;
7988                     pvalues[0].bit4 = "DS Time Synchronized?";
7989                     pvalues[0].bit4hfname = hf_bit4pingpflags1;
7990                     pvalues[0].bit5 = "Agent Has All Replicas?";
7991                     pvalues[0].bit5hfname = hf_bit5pingpflags1;
7992                     pvalues[0].bit6 = "Not Defined";
7993                     pvalues[0].bit6hfname = hf_bit6pingpflags1;
7994                     pvalues[0].bit7 = "Not Defined";
7995                     pvalues[0].bit7hfname = hf_bit7pingpflags1;
7996                     pvalues[0].bit8 = "Not Defined";
7997                     pvalues[0].bit8hfname = hf_bit8pingpflags1;
7998                     pvalues[0].bit9 = "Not Defined";
7999                     pvalues[0].bit9hfname = hf_bit9pingpflags1;
8000                     pvalues[0].bit10 = "Not Defined";
8001                     pvalues[0].bit10hfname = hf_bit10pingpflags1;
8002                     pvalues[0].bit11 = "Not Defined";
8003                     pvalues[0].bit11hfname = hf_bit11pingpflags1;
8004                     pvalues[0].bit12 = "Not Defined";
8005                     pvalues[0].bit12hfname = hf_bit12pingpflags1;
8006                     pvalues[0].bit13 = "Not Defined";
8007                     pvalues[0].bit13hfname = hf_bit13pingpflags1;
8008                     pvalues[0].bit14 = "Not Defined";
8009                     pvalues[0].bit14hfname = hf_bit14pingpflags1;
8010                     pvalues[0].bit15 = "Not Defined";
8011                     pvalues[0].bit15hfname = hf_bit15pingpflags1;
8012                     pvalues[0].bit16 = "Not Defined";
8013                     pvalues[0].bit16hfname = hf_bit16pingpflags1;
8015                     process_bitfield(ncp_tree, tvb, &pvalues[0]);
8016                     nds_offset += 4;
8017                     break;
8018                 case 0x00000010:
8019                     pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
8020                     pvalues[0].vtype = VTYPE_BITFIELD;
8021                     pvalues[0].vstring = "";
8022                     pvalues[0].vdesc = "Verification Flags:";
8023                     pvalues[0].vlength = 4;
8024                     pvalues[0].hfname= hf_nds_rflags;
8025                     pvalues[0].voffset = nds_offset;
8026                     pvalues[0].bit1 = "Checksum Verification";
8027                     pvalues[0].bit1hfname = hf_bit1pingvflags1;
8028                     pvalues[0].bit2 = "CRC32 Verification";
8029                     pvalues[0].bit2hfname = hf_bit2pingvflags1;
8030                     pvalues[0].bit3 = "Server Verification Enforced";
8031                     pvalues[0].bit3hfname = hf_bit3pingvflags1;
8032                     pvalues[0].bit4 = "Not Defined";
8033                     pvalues[0].bit4hfname = hf_bit4pingvflags1;
8034                     pvalues[0].bit5 = "Not Defined";
8035                     pvalues[0].bit5hfname = hf_bit5pingvflags1;
8036                     pvalues[0].bit6 = "Not Defined";
8037                     pvalues[0].bit6hfname = hf_bit6pingvflags1;
8038                     pvalues[0].bit7 = "Not Defined";
8039                     pvalues[0].bit7hfname = hf_bit7pingvflags1;
8040                     pvalues[0].bit8 = "Not Defined";
8041                     pvalues[0].bit8hfname = hf_bit8pingvflags1;
8042                     pvalues[0].bit9 = "Not Defined";
8043                     pvalues[0].bit9hfname = hf_bit9pingvflags1;
8044                     pvalues[0].bit10 = "Not Defined";
8045                     pvalues[0].bit10hfname = hf_bit10pingvflags1;
8046                     pvalues[0].bit11 = "Not Defined";
8047                     pvalues[0].bit11hfname = hf_bit11pingvflags1;
8048                     pvalues[0].bit12 = "Not Defined";
8049                     pvalues[0].bit12hfname = hf_bit12pingvflags1;
8050                     pvalues[0].bit13 = "Not Defined";
8051                     pvalues[0].bit13hfname = hf_bit13pingvflags1;
8052                     pvalues[0].bit14 = "Not Defined";
8053                     pvalues[0].bit14hfname = hf_bit14pingvflags1;
8054                     pvalues[0].bit15 = "Not Defined";
8055                     pvalues[0].bit15hfname = hf_bit15pingvflags1;
8056                     pvalues[0].bit16 = "Not Defined";
8057                     pvalues[0].bit16hfname = hf_bit16pingvflags1;
8059                     process_bitfield(ncp_tree, tvb, &pvalues[0]);
8060                     nds_offset += 4;
8061                     break;
8062                 case 0x00000020:
8063                     proto_tree_add_item(ncp_tree, hf_nds_letter_ver, tvb, nds_offset, 4, TRUE);
8064                     nds_offset += 4;
8065                     break;
8066                 case 0x00000040:
8067                     proto_tree_add_item(ncp_tree, hf_nds_os_majver, tvb, nds_offset, 4, TRUE);
8068                     nds_offset += 4;
8069                     proto_tree_add_item(ncp_tree, hf_nds_os_minver, tvb, nds_offset, 4, TRUE);
8070                     nds_offset += 4;
8071                     proto_tree_add_item(ncp_tree, hf_ncp_os_revision, tvb, nds_offset, 4, TRUE);
8072                     nds_offset += 4;
8073                     break;
8074                 case 0x00000100:
8075                     proto_tree_add_item(ncp_tree, hf_nds_lic_flags, tvb, nds_offset, 4, TRUE);
8076                     nds_offset += 4;
8077                     break;
8078                 case 0x00000200:
8079                     ns.secs = tvb_get_letohl(tvb, nds_offset);
8080                     ns.nsecs = 0;
8081                     proto_tree_add_time(ncp_tree, hf_nds_ds_time, tvb, nds_offset, 4, &ns);
8082                     nds_offset += 4;
8083                     break;
8084                 case 0x00000400:
8085                     ns.secs = tvb_get_letohl(tvb, nds_offset);
8086                     ns.nsecs = 0;
8087                     proto_tree_add_time(ncp_tree, hf_nds_svr_time, tvb, nds_offset, 4, &ns);
8088                     nds_offset += 4;
8089                     break;
8090                 case 0x00000800:
8091                     ns.secs = tvb_get_letohl(tvb, nds_offset);
8092                     ns.nsecs = 0;
8093                     proto_tree_add_time(ncp_tree, hf_nds_crt_time, tvb, nds_offset, 4, &ns);
8094                     nds_offset += 4;
8095                     break;
8096                 case 0x00010000:
8097                     if(tvb_get_guint8(tvb, nds_offset) == 0x00)
8098                     {
8099                         nds_offset += 2;
8100                     }
8101                     nds_string_len = tvb_get_letohl(tvb, nds_offset);
8102                     nds_offset += 4;
8103                     reply_buffer = get_string(tvb, nds_offset, nds_string_len);
8104                     tvb_ensure_bytes_exist(tvb, nds_offset, nds_string_len);
8105                     proto_tree_add_text(ncp_tree, tvb, nds_offset, nds_string_len, "SAP Name: %s", reply_buffer);
8106                     nds_offset += nds_string_len;
8107                     nds_offset += align_4(tvb, nds_offset);
8108                     break;
8109                 case 0x00020000:
8110                     if(tvb_get_guint8(tvb, nds_offset) == 0x00)
8111                     {
8112                         nds_offset += 2;
8113                     }
8114                     nds_string_len = tvb_get_letohl(tvb, nds_offset);
8115                     nds_offset += 4;
8116                     reply_buffer = get_string(tvb, nds_offset, nds_string_len);
8117                     tvb_ensure_bytes_exist(tvb, nds_offset, nds_string_len);
8118                     proto_tree_add_text(ncp_tree, tvb, nds_offset, nds_string_len, "NDS Tree Name: %s", reply_buffer);
8119                     nds_offset += nds_string_len;
8120                     nds_offset += align_4(tvb, nds_offset);
8121                     break;
8122                 case 0x00040000:
8123                     if(tvb_get_guint8(tvb, nds_offset) == 0x00)
8124                     {
8125                         nds_offset += 2;
8126                     }
8127                     nds_string_len = tvb_get_letohl(tvb, nds_offset);
8128                     nds_offset += 4;
8129                     reply_buffer = get_string(tvb, nds_offset, nds_string_len);
8130                     tvb_ensure_bytes_exist(tvb, nds_offset, nds_string_len);
8131                     proto_tree_add_text(ncp_tree, tvb, nds_offset, nds_string_len, "OS Name: %s", reply_buffer);
8132                     nds_offset += nds_string_len;
8133                     nds_offset += align_4(tvb, nds_offset);
8134                     break;
8135                 case 0x00080000:
8136                     if(tvb_get_guint8(tvb, nds_offset) == 0x00)
8137                     {
8138                         nds_offset += 2;
8139                     }
8140                     nds_string_len = tvb_get_letohl(tvb, nds_offset);
8141                     nds_offset += 4;
8142                     reply_buffer = get_string(tvb, nds_offset, nds_string_len);
8143                     tvb_ensure_bytes_exist(tvb, nds_offset, nds_string_len);
8144                     proto_tree_add_text(ncp_tree, tvb, nds_offset, nds_string_len, "Hardware Name: %s", reply_buffer);
8145                     nds_offset += nds_string_len;
8146                     nds_offset += align_4(tvb, nds_offset);
8147                     break;
8148                 case 0x00100000:
8149                     if(tvb_get_guint8(tvb, nds_offset) == 0x00)
8150                     {
8151                         nds_offset += 2;
8152                     }
8153                     nds_string_len = tvb_get_letohl(tvb, nds_offset);
8154                     nds_offset += 4;
8155                     reply_buffer = get_string(tvb, nds_offset, nds_string_len);
8156                     tvb_ensure_bytes_exist(tvb, nds_offset, nds_string_len);
8157                     proto_tree_add_text(ncp_tree, tvb, nds_offset, nds_string_len, "Vendor Name: %s", reply_buffer);
8158                     nds_offset += nds_string_len;
8159                     nds_offset += align_4(tvb, nds_offset);
8160                     break;
8161                 default:
8162                     break;
8163                 }
8164             }
8165             bvalue = bvalue*2;
8166         }
8167     }
8170 static void
8171 dissect_nds_reply(tvbuff_t *tvb, packet_info *pinfo,
8172                   proto_tree *ncp_tree, guint32 nds_error_code,
8173                   const char *nds_error_string, ncp_req_hash_value *request_value,
8174                   conversation_t *conversation)
8176     guint32                         nds_offset;
8177     guint32                         nds_reply_buffer;
8178     guint32                         nds_frag;
8179     proto_item                      *expert_item;
8180     const char                      *verb_string;
8181     nds_val                         pvalues[9];
8182     gboolean                        resolve_eid=FALSE;
8183     guint32                         global_eid=0;
8184     gboolean                        add_eid = FALSE;
8185     char                            global_object_name[256];
8186     ncp_req_eid_hash_value          *request_eid_value = NULL;
8187     int                             i;
8189     global_object_name[0] = '\0';
8191     nds_offset = 8;
8193     nds_reply_buffer = tvb_get_letohl(tvb, nds_offset);
8194     proto_tree_add_uint(ncp_tree, hf_ncp_fragment_size, tvb, nds_offset,
8195                         4, nds_reply_buffer);
8196     nds_offset += 4;
8197     nds_frag = tvb_get_letohl(tvb, nds_offset);
8198     proto_tree_add_uint(ncp_tree, hf_ncp_fragment_handle, tvb, nds_offset,
8199                         4, nds_frag);
8200     nds_offset += 4;
8201     /*
8202      * Is the possibly-reassembled reply large enough to have a completion
8203      * code?  (We can't check the fragment size as this might just be the
8204      * last fragment.)
8205      */
8206     if (tvb_reported_length_remaining(tvb, nds_offset) >= 4)
8207     {
8208         /* Yes - process the completion code. */
8209         expert_item = proto_tree_add_uint_format(ncp_tree, hf_nds_reply_error, tvb, nds_offset,
8210                                                  4, nds_error_code, "NDS Completion Code: 0x%08x, %s",
8211                                                  nds_error_code, nds_error_string);
8213         if (nds_error_code != 0 && ncp_echo_err) {
8214             expert_add_info_format(pinfo, expert_item, &ei_nds_reply_error, "NDS Error: 0x%08x %s", nds_error_code, nds_error_string);
8215         }
8216     }
8217     if (request_value && nds_error_code == 0x00000000)
8218     {
8219         nds_offset = 20;
8220         for (i = 0; i < 9; i++) {
8221             pvalues[i].vtype = 0;
8222             pvalues[i].vvalue = 0;
8223             pvalues[i].vlength = 0;
8224             pvalues[i].voffset = 0;
8225             pvalues[i].hfname = 0;
8226             pvalues[i].vdesc = "";
8227             pvalues[i].vstring = NULL;
8228             pvalues[i].mvtype = 0;
8229         }
8230         verb_string = val_to_str_const(request_value->nds_request_verb,
8231                                        ncp_nds_verb_vals, "Continuation Fragment");
8232         if(request_value->req_nds_prot_flags & 0x4000)
8233         {
8234             /* CRC is included in the NDS header so justify the offset */
8235             proto_tree_add_item(ncp_tree, hf_nds_crc, tvb, nds_offset, 4, TRUE);
8236             nds_offset += 4;
8237         }
8238         switch (request_value->nds_request_verb)
8239         {
8240         case 0x01:
8241             pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
8242             pvalues[0].vstring = val_to_str_const(pvalues[0].vvalue, nds_tags, "No Tags Set");
8243             pvalues[0].vtype = VTYPE_STRING;
8244             pvalues[0].vdesc = "Tag: %s";
8245             pvalues[0].vlength = 4;
8246             pvalues[0].voffset = nds_offset;
8247             pvalues[0].hfname = hf_nds_tag_string;
8248             nds_offset = nds_offset+pvalues[0].vlength;
8249             switch(pvalues[0].vvalue)
8250             {
8251             case NDS_TAG_NO_SUCH_ENTRY:
8252                 break;
8253             case NDS_TAG_LOCAL_ENTRY:
8254                 pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
8255                 pvalues[1].vtype = VTYPE_UINT32;
8256                 pvalues[1].vdesc = "Entry ID: 0x%08x";
8257                 add_eid = TRUE;
8258                 resolve_eid = TRUE;
8259                 g_strlcpy(global_object_name, request_value->object_name, 256);
8260                 global_eid = pvalues[1].vvalue;
8261                 pvalues[1].vlength = 4;
8262                 pvalues[1].voffset = nds_offset;
8263                 pvalues[1].hfname = hf_nds_eid;
8264                 nds_offset = nds_offset+pvalues[1].vlength;
8265                 pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
8266                 pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
8267                 pvalues[2].vdesc = "Referral Records: %u";
8268                 pvalues[2].vlength = 4;
8269                 pvalues[2].voffset = nds_offset;
8270                 pvalues[2].hfname = hf_nds_referrals;
8271                 pvalues[2].mvtype = MVTYPE_LOC_ADDR_REFERRAL_REPLY;
8272                 break;
8273             case NDS_TAG_REMOTE_ENTRY:
8274                 nds_offset += 4;   /* GUINT32 reserved field */
8275                 pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
8276                 pvalues[1].vtype = VTYPE_UINT32;
8277                 pvalues[1].vdesc = "Entry ID: 0x%08x";
8278                 pvalues[1].vlength = 4;
8279                 pvalues[1].voffset = nds_offset;
8280                 pvalues[1].hfname = hf_nds_eid;
8281                 nds_offset = nds_offset+pvalues[1].vlength;
8282                 pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
8283                 pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
8284                 pvalues[2].vdesc = "Referral Records: %u";
8285                 pvalues[2].vlength = 4;
8286                 pvalues[2].voffset = nds_offset;
8287                 pvalues[2].hfname = hf_nds_referrals;
8288                 pvalues[2].mvtype = MVTYPE_LOC_ADDR_REFERRAL_REPLY;
8289                 break;
8290             case NDS_TAG_ALIAS_ENTRY:
8291                 pvalues[1].vtype = VTYPE_STRING;
8292                 pvalues[1].vdesc = "Alias Name: %s";
8293                 pvalues[1].mvtype = MVTYPE_ATTR_REQUEST;
8294                 pvalues[1].vvalue = 0;
8295                 pvalues[1].vlength = 256;
8296                 pvalues[1].vlength = tvb_get_letohl(tvb, nds_offset);
8297                 if (pvalues[1].vlength == 0x00)
8298                 {
8299                     pvalues[1].vtype = VTYPE_NONE;
8300                     break;
8301                 }
8302                 pvalues[1].voffset = nds_offset+4;
8303                 nds_offset += 4;
8304                 pvalues[1].vstring = get_string(tvb, pvalues[1].voffset, pvalues[1].vlength);
8305                 nds_offset += pvalues[1].vlength;
8306                 nds_offset += align_4(tvb, nds_offset);
8307                 pvalues[1].hfname= hf_nds_name;
8308                 break;
8309             case NDS_TAG_REFERRAL_INFORMATION:
8310                 pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
8311                 pvalues[1].vtype = VTYPE_UINT32;
8312                 pvalues[1].vdesc = "Distance Object is From Root: 0x%08x";
8313                 pvalues[1].vlength = 4;
8314                 pvalues[1].voffset = nds_offset;
8315                 pvalues[1].hfname = hf_nds_eid;
8316                 nds_offset = nds_offset+pvalues[1].vlength;
8317                 pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
8318                 pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
8319                 pvalues[2].vdesc = "Referral Records: %u";
8320                 pvalues[2].vlength = 4;
8321                 pvalues[2].voffset = nds_offset;
8322                 pvalues[2].hfname = hf_nds_depth;
8323                 pvalues[2].mvtype = MVTYPE_ADDR_REFERRAL_REPLY;
8324                 break;
8325             case NDS_TAG_ENTRY_AND_REFERRALS:
8326                 pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
8327                 pvalues[1].vtype = VTYPE_UINT32;
8328                 pvalues[1].vdesc = "Result Flags: 0x%08x";
8329                 pvalues[1].vlength = 4;
8330                 pvalues[1].voffset = nds_offset;
8331                 pvalues[1].hfname = hf_nds_result_flags;
8332                 nds_offset = nds_offset+pvalues[1].vlength;
8333                 pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
8334                 pvalues[2].vtype = VTYPE_UINT32;
8335                 pvalues[2].vdesc = "Entry ID: 0x%08x";
8336                 add_eid = TRUE;
8337                 resolve_eid = TRUE;
8338                 global_eid = pvalues[2].vvalue;
8339                 g_strlcpy(global_object_name, request_value->object_name, 256);
8340                 pvalues[2].vlength = 4;
8341                 pvalues[2].voffset = nds_offset;
8342                 pvalues[2].hfname = hf_nds_eid;
8343                 nds_offset = nds_offset+pvalues[2].vlength;
8344                 pvalues[3].vvalue = tvb_get_letohl(tvb, nds_offset);
8345                 pvalues[3].vtype = VTYPE_MULTIVALUE_UINT32;
8346                 pvalues[3].vdesc = "Referral Records: %u";
8347                 pvalues[3].vlength = 4;
8348                 pvalues[3].voffset = nds_offset;
8349                 pvalues[3].mvtype = MVTYPE_ADDR_REFERRAL_REPLY;
8350                 pvalues[3].hfname = hf_nds_referrals;
8351                 break;
8352             default:
8353                 break;
8354             }
8355             break;
8356         case 0x02:
8357             nds_offset -= 4;
8358             pvalues[0].vvalue = 1;
8359             pvalues[0].vtype = VTYPE_MULTIVALUE_UINT32;
8360             pvalues[0].vdesc = "Entry Information";
8361             pvalues[0].vlength = 0;
8362             pvalues[0].voffset = nds_offset;
8363             pvalues[0].hfname = hf_nds_name;
8364             pvalues[0].mvtype = MVTYPE_LIST_PARTITIONS;
8365             pvalues[0].vflags = request_value->req_nds_flags;
8366             break;
8367         case 0x03:
8368             pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
8369             pvalues[0].vtype = VTYPE_UINT32;
8370             pvalues[0].vdesc = "Iteration Handle: 0x%08x";
8371             pvalues[0].vlength = 4;
8372             pvalues[0].voffset = nds_offset;
8373             pvalues[0].hfname = hf_nds_iteration;
8374             nds_offset = nds_offset+pvalues[0].vlength;
8375             pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
8376             pvalues[1].vstring = val_to_str_const(pvalues[1].vvalue, nds_info_type, "No Info Type Set");
8377             pvalues[1].vtype = VTYPE_STRING;
8378             pvalues[1].vdesc = "Info Type: %s";
8379             pvalues[1].vlength = 4;
8380             pvalues[1].voffset = nds_offset;
8381             pvalues[1].hfname = hf_nds_info_type;
8382             nds_offset = nds_offset+pvalues[1].vlength;
8383             pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
8384             pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
8385             pvalues[2].vdesc = "Number of Attributes: %u";
8386             pvalues[2].vlength = 4;
8387             pvalues[2].voffset = nds_offset;
8388             pvalues[2].hfname = hf_nds_attr;
8389             pvalues[2].mvtype = MVTYPE_ATTR_REPLY;
8390             pvalues[2].vflags = request_value->req_nds_flags;
8391             pvalues[2].nds_version = request_value->nds_version;
8392             pvalues[2].pflags = request_value->req_nds_prot_flags;
8393             break;
8394         case 0x04:
8395             pvalues[0].vvalue = tvb_get_guint8(tvb, nds_offset);
8396             if (pvalues[0].vvalue == 0)
8397             {
8398                 pvalues[0].vstring = "Did Not Match";
8399             }
8400             else
8401             {
8402                 pvalues[0].vstring = "Matched";
8403             }
8404             pvalues[0].vtype = VTYPE_STRING;
8405             pvalues[0].vdesc = "Compare Values Returned - %s";
8406             pvalues[0].vlength = 1;
8407             pvalues[0].voffset = nds_offset;
8408             pvalues[0].mvtype = 0;
8409             pvalues[0].hfname= hf_nds_compare_results;
8410             nds_offset += pvalues[0].vlength;
8411             break;
8412         case 0x05:
8413             pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
8414             pvalues[0].vtype = VTYPE_UINT32;
8415             pvalues[0].vdesc = "Iteration Handle: 0x%08x";
8416             pvalues[0].vlength = 4;
8417             pvalues[0].voffset = nds_offset;
8418             pvalues[0].hfname = hf_nds_iteration;
8419             nds_offset = nds_offset+pvalues[0].vlength;
8420             pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
8421             pvalues[1].vtype = VTYPE_MULTIVALUE_UINT32;
8422             pvalues[1].vdesc = "Entry Information";
8423             pvalues[1].vlength = 0;
8424             pvalues[1].voffset = nds_offset;
8425             pvalues[1].hfname = hf_nds_name;
8426             pvalues[1].mvtype = MVTYPE_LIST_PARTITIONS;
8427             pvalues[1].vflags = request_value->req_nds_flags;
8428             break;
8429         case 0x06:
8430             break;
8431         case 0x07:
8432             break;
8433         case 0x08:
8434             break;
8435         case 0x09:
8436             break;
8437         case 0x0a:
8438             break;
8439         case 0x0b:
8440             break;
8441         case 0x0c:
8442             break;
8443         case 0x0d:
8444             break;
8445         case 0x0e:
8446             break;
8447         case 0x0f:
8448             pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
8449             pvalues[0].vtype = VTYPE_UINT32;
8450             pvalues[0].vdesc = "Iteration Handle: 0x%08x";
8451             pvalues[0].vlength = 4;
8452             pvalues[0].voffset = nds_offset;
8453             pvalues[0].hfname = hf_nds_iteration;
8454             nds_offset = nds_offset+pvalues[0].vlength;
8455             pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
8456             pvalues[1].vstring = val_to_str_const(pvalues[1].vvalue, class_def_type,
8457                                                   "No Class Definition Type Set");
8458             pvalues[1].vtype = VTYPE_STRING;
8459             pvalues[1].vdesc = "Class Definition Type: %s";
8460             pvalues[1].vlength = 4;
8461             pvalues[1].voffset = nds_offset;
8462             pvalues[1].mvtype = 0;
8463             pvalues[1].hfname= hf_nds_class_def_type;
8464             nds_offset = nds_offset + pvalues[1].vlength;
8465             pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);;
8466             pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
8467             pvalues[2].vdesc = "Class Definitions %u";
8468             pvalues[2].vlength = 0;
8469             pvalues[2].voffset = nds_offset;
8470             pvalues[2].hfname = hf_nds_classes;
8471             pvalues[2].mvtype = MVTYPE_CLASS_NAMES;
8472             pvalues[2].vflags = request_value->req_nds_flags;
8473             break;
8474         case 0x10:
8475             break;
8476         case 0x11:
8477             break;
8478         case 0x12:
8479             pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
8480             pvalues[0].vtype = VTYPE_UINT32;
8481             pvalues[0].vdesc = "Iteration Handle: 0x%08x";
8482             pvalues[0].vlength = 4;
8483             pvalues[0].voffset = nds_offset;
8484             pvalues[0].hfname = hf_nds_iteration;
8485             nds_offset = nds_offset+pvalues[0].vlength;
8486             pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
8487             pvalues[1].vtype = VTYPE_MULTIVALUE_UINT32;
8488             pvalues[1].vdesc = "Classes: %u";
8489             pvalues[1].vlength = 4;
8490             pvalues[1].voffset = nds_offset;
8491             pvalues[1].mvtype = MVTYPE_READ_CLASS_REQ;
8492             pvalues[1].hfname= hf_nds_classes;
8493             break;
8494         case 0x13:
8495             pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
8496             pvalues[0].vtype = VTYPE_UINT32;
8497             pvalues[0].vdesc = "Privileges: 0x%08x";
8498             pvalues[0].vlength = 4;
8499             pvalues[0].voffset = nds_offset;
8500             pvalues[0].hfname = hf_nds_privileges;
8501             nds_offset = nds_offset+pvalues[0].vlength;
8502             break;
8503         case 0x14:
8504             break;
8505         case 0x15:
8506             break;
8507         case 0x16:
8508             pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
8509             pvalues[0].vtype = VTYPE_UINT32;
8510             pvalues[0].vdesc = "Iteration Handle: 0x%08x";
8511             pvalues[0].vlength = 4;
8512             pvalues[0].voffset = nds_offset;
8513             pvalues[0].hfname = hf_nds_iteration;
8514             nds_offset = nds_offset+pvalues[0].vlength;
8515             pvalues[1].vtype = VTYPE_STRING;
8516             pvalues[1].vdesc = "Server Distinguished Name: %s";
8517             pvalues[1].mvtype = MVTYPE_ATTR_REQUEST;
8518             pvalues[1].vvalue = 0;
8519             pvalues[1].vlength = 256;
8520             pvalues[1].vlength = tvb_get_letohl(tvb, nds_offset);
8521             if (pvalues[1].vlength == 0x00)
8522             {
8523                 pvalues[1].vtype = VTYPE_NONE;
8524                 break;
8525             }
8526             pvalues[1].voffset = nds_offset+4;
8527             nds_offset += 4;
8528             pvalues[1].vstring = get_string(tvb, pvalues[1].voffset, pvalues[1].vlength);
8529             nds_offset += pvalues[1].vlength;
8530             nds_offset += align_4(tvb, nds_offset);
8531             pvalues[1].hfname= hf_nds_name;
8532             nds_offset += align_4(tvb, nds_offset);
8533             pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
8534             pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
8535             pvalues[2].vdesc = "Replicas: %u";
8536             pvalues[2].vlength = 4;
8537             pvalues[2].voffset = nds_offset;
8538             pvalues[2].hfname = hf_nds_replicas;
8539             pvalues[2].mvtype = MVTYPE_READ_REPLICAS;
8540             pvalues[2].bit1 = "Output Flags";
8541             pvalues[2].bit2 = "Entry ID";
8542             pvalues[2].bit3 = "Replica State";
8543             pvalues[2].bit4 = "Modification Timestamp";
8544             pvalues[2].bit5 = "Purge Time";
8545             pvalues[2].bit6 = "Local Partition ID";
8546             pvalues[2].bit7 = "Distinguished Name";
8547             pvalues[2].bit8 = "Replica Type";
8548             pvalues[2].bit9 = "Partition Busy";
8549             pvalues[2].vflags = request_value->req_nds_flags;
8550             break;
8551         case 0x17:
8552             break;
8553         case 0x18:
8554             break;
8555         case 0x19:
8556             break;
8557         case 0x1a:
8558             break;
8559         case 0x1b:
8560             pvalues[0].vvalue = tvb_get_ntohl(tvb, nds_offset);
8561             pvalues[0].vtype = VTYPE_UINT32;
8562             pvalues[0].vdesc = "File Handle: 0x%08x";
8563             pvalues[0].vlength = 4;
8564             pvalues[0].voffset = nds_offset;
8565             pvalues[0].hfname = hf_nds_file_handle;
8566             nds_offset = nds_offset+pvalues[0].vlength;
8567             pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
8568             pvalues[1].vtype = VTYPE_UINT32;
8569             pvalues[1].vdesc = "File Size: %u";
8570             pvalues[1].vlength = 4;
8571             pvalues[1].voffset = nds_offset;
8572             pvalues[1].hfname = hf_nds_file_size;
8573             nds_offset = nds_offset+pvalues[1].vlength;
8574             break;
8575         case 0x1c:
8576             break;
8577         case 0x1d:
8578             break;
8579         case 0x1e:
8580             break;
8581         case 0x1f:
8582             break;
8583         case 0x20:
8584             break;
8585         case 0x21:
8586             break;
8587         case 0x22:
8588             break;
8589         case 0x23:
8590             break;
8591         case 0x24:
8592             break;
8593         case 0x25:
8594             break;
8595         case 0x26:
8596             break;
8597         case 0x27:
8598             break;
8599         case 0x28:
8600             break;
8601         case 0x29:
8602             break;
8603         case 0x2a:
8604             break;
8605         case 0x2b:
8606             break;
8607         case 0x2c:
8608             break;
8609         case 0x2d:
8610             break;
8611         case 0x2e:
8612             break;
8613         case 0x2f:
8614             break;
8615         case 0x30:
8616             break;
8617         case 0x31:
8618             break;
8619         case 0x32:
8620             break;
8621         case 0x33:
8622             break;
8623         case 0x34:
8624             break;
8625         case 0x35:
8626             pvalues[0].vtype = VTYPE_MULTIVALUE_UINT32;
8627             pvalues[0].vdesc = "Server Name";
8628             pvalues[0].mvtype = MVTYPE_PROCESS_TAGS;
8629             pvalues[0].vflags = request_value->req_nds_flags;
8630             pvalues[0].hfname = hf_nds_svr_dst_name;
8631             pvalues[0].vlength = tvb_get_letohl(tvb, nds_offset);
8632             if (pvalues[0].vlength == 0x00)
8633             {
8634                 pvalues[0].vtype = VTYPE_NONE;
8635                 break;
8636             }
8637             pvalues[0].voffset = nds_offset;
8638             nds_offset += pvalues[0].vlength + 4;
8639             nds_offset += align_4(tvb, nds_offset);
8640             pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
8641             pvalues[1].vtype = VTYPE_MULTIVALUE_UINT32;
8642             pvalues[1].vdesc = "Referral Records: %u";
8643             pvalues[1].vlength = 4;
8644             pvalues[1].voffset = nds_offset;
8645             pvalues[1].hfname = hf_nds_referrals;
8646             pvalues[1].mvtype = MVTYPE_LOC_ADDR_REFERRAL_REPLY;
8647             break;
8648         case 0x36:
8649             break;
8650         case 0x37:
8651             break;
8652         case 0x38:
8653             break;
8654         case 0x39:
8655             pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
8656             pvalues[1].vtype = VTYPE_UINT32;
8657             pvalues[1].vdesc = "Entry ID: 0x%08x";
8658             add_eid = TRUE;
8659             resolve_eid = TRUE;
8660             g_strlcpy(global_object_name, request_value->object_name, 256);
8661             global_eid = pvalues[1].vvalue;
8662             pvalues[1].vlength = 4;
8663             pvalues[1].voffset = nds_offset;
8664             pvalues[1].hfname = hf_nds_eid;
8665             nds_offset = nds_offset+pvalues[1].vlength;
8666             break;
8667         case 0x3a:
8668             break;
8669         case 0x3b:
8670             break;
8671         case 0x3c:
8672             break;
8673         case 0x3d:
8674             break;
8675         case 0x3e:
8676             break;
8677         case 0x3f:
8678             break;
8679         case 0x40:
8680             break;
8681         case 0x41:
8682             break;
8683         case 0x42:
8684             break;
8685         case 0x43:
8686             break;
8687         case 0x44:
8688             break;
8689         case 0x45:
8690             break;
8691         case 0x46:
8692             break;
8693         case 0x47:
8694             break;
8695         case 0x48:
8696             break;
8697         case 0x49:
8698             break;
8699         case 0x4a:
8700             break;
8701         case 0x4b:
8702             break;
8703         case 0x4c:
8704             break;
8705         case 0x4d:
8706             break;
8707         case 0x6e:
8708             pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
8709             pvalues[0].vtype = VTYPE_UINT32;
8710             pvalues[0].vdesc = "Iteration Handle: 0x%08x";
8711             pvalues[0].vlength = 4;
8712             pvalues[0].voffset = nds_offset;
8713             pvalues[0].hfname= hf_nds_iteration;
8714             nds_offset = nds_offset+pvalues[0].vlength;
8715             pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
8716             pvalues[1].vtype = VTYPE_NONE;
8717             pvalues[1].vdesc = "Iteration Completion Code: 0x%08x";
8718             pvalues[1].vlength = 4;
8719             pvalues[1].voffset = nds_offset;
8720             pvalues[1].hfname = hf_iter_completion_code;
8721             expert_item = proto_tree_add_uint_format(ncp_tree, pvalues[1].hfname, tvb, nds_offset,
8722                                                      4, pvalues[1].vvalue, "NDS Iteration Completion Code: 0x%08x, %s",
8723                                                      pvalues[1].vvalue, val_to_str(pvalues[1].vvalue, nds_reply_errors, "Unknown: %d"));
8725             if (pvalues[1].vvalue != 0 && ncp_echo_err) {
8726                 expert_add_info_format(pinfo, expert_item, &ei_nds_iteration, "NDS Iteration Error: 0x%08x %s",
8727                                        pvalues[1].vvalue, val_to_str(pvalues[1].vvalue, nds_reply_errors, "Unknown: %d"));
8728             }
8729             nds_offset = nds_offset+pvalues[1].vlength;
8730             pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
8731             pvalues[2].vtype = VTYPE_ITEM;
8732             pvalues[2].vlength = 4;
8733             pvalues[2].voffset = nds_offset;
8734             pvalues[2].mvtype = MVTYPE_PROCESS_ITERATOR;
8735             pvalues[2].hfname = hf_ncp_nds_iterverb;
8736             nds_offset = nds_offset + pvalues[2].vlength;
8737             break;
8738         default:
8739             break;
8740         }
8741         if(request_value->nds_request_verb != 0)
8742         {
8743             proto_tree_add_uint_format(ncp_tree,
8744                                        hf_ncp_nds_verb, tvb, 6, 0,
8745                                        request_value->nds_request_verb,
8746                                        "NDS Verb: %d, %s",
8747                                        request_value->nds_request_verb, verb_string);
8748         }
8749         /* NDS Entry ID's (EID) is identified in the reply
8750          * packet of an NDS resolve name. We need to store
8751          * this EID and its associated name into our hash
8752          * so that we can resolve the name for other NDS
8753          * requests. */
8754         if (!pinfo->fd->flags.visited) {
8755             if(add_eid)
8756             {
8757                 request_eid_value = ncp_eid_hash_lookup(conversation, global_eid);
8758                 if (!request_eid_value) {
8759                     request_eid_value = ncp_eid_hash_insert(global_eid);
8760                     g_strlcpy(request_eid_value->object_name, global_object_name, 256);
8761                 }
8762             }
8763         }
8764         /* Echo EID data to expert Chat window */
8765         if (add_eid && nds_echo_eid) {
8766             expert_add_info_format(pinfo, NULL, &ei_ncp_eid,
8767                                    "EID (%08x) = %s", global_eid, global_object_name);
8768         }
8769         /* For NDS requests with just an EID, resolve name
8770          * from hash table. */
8771         if(resolve_eid)
8772         {
8773             request_eid_value = ncp_eid_hash_lookup(conversation, global_eid);
8774             if (request_eid_value) {
8775                 g_strlcpy(global_object_name, request_eid_value->object_name, 256);
8776                 proto_tree_add_string_format(ncp_tree,
8777                                              hf_nds_name, tvb, 6, 0,
8778                                              global_object_name,
8779                                              "NDS Name for EID - %s",
8780                                              global_object_name);
8781             }
8782         }
8783         for (i = 0; i < 9; i++) {
8784             switch (pvalues[i].vtype) {
8786             case VTYPE_NONE: /* no value */
8787                 break;
8789             case VTYPE_ITEM:
8790                 if (pvalues[i].mvtype == MVTYPE_PROCESS_ITERATOR)
8791                 {
8792                     dissect_nds_iterator(ncp_tree, tvb, pinfo, pvalues[i].vvalue, 0, nds_offset, FALSE);
8793                 }
8794                 else
8795                 {
8796                     proto_tree_add_item(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
8797                                         pvalues[i].vlength, TRUE);
8798                 }
8799                 break;
8800             case VTYPE_UINT8:
8801                 proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
8802                                            pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %u",
8803                                            pvalues[i].vtype);
8804                 break;
8806             case VTYPE_UINT16:
8807                 proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
8808                                            pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %u",
8809                                            pvalues[i].vtype);
8810                 break;
8812             case VTYPE_UINT32:
8813                 proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
8814                                            pvalues[i].vlength, pvalues[i].vvalue, pvalues[i].vdesc,
8815                                            pvalues[i].vvalue);
8816                 break;
8818             case VTYPE_STRING:
8819                 proto_tree_add_string_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
8820                                              pvalues[i].vlength, pvalues[i].vstring, pvalues[i].vdesc,
8821                                              pvalues[i].vstring);
8822                 break;
8824             case VTYPE_BITFIELD:
8825                 process_bitfield(ncp_tree, tvb, &pvalues[i]);
8826                 break;
8828             case VTYPE_MULTIVALUE_UINT32:
8829                 process_multivalues(ncp_tree, tvb, pinfo, &pvalues[i]);
8830                 break;
8832             default:
8833                 proto_tree_add_uint_format(ncp_tree, hf_nds_p1type, tvb, pvalues[i].voffset,
8834                                            pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %u",
8835                                            pvalues[i].vtype);
8836                 break;
8837             }
8838         }
8839     }
8842 void
8843 dissect_ncp_reply(tvbuff_t *tvb, packet_info *pinfo,
8844                   guint32 nw_connection, guint8 sequence, guint16 type,
8845                   proto_tree *ncp_tree, struct novell_tap *ncp_tap)
8847     conversation_t      *conversation = NULL;
8848     ncp_req_hash_value  *request_value = NULL;
8849     const ncp_record    *ncp_rec = NULL;
8850     gboolean            *req_cond_results;
8851     guint8               completion_code=0;
8852     ptvcursor_t         *ptvc = NULL;
8853     const char          *error_string;
8854     guint32              nds_offset = 0;
8855     guint32              nds_error_code = 0;
8856     /*guint32              nds_reply_buffer = 0;*/
8857     const char          *nds_error_string = NULL;
8858     /*guint32              nds_frag=0;*/
8859     proto_item          *expert_item;
8860     guint8               conn_stat;
8863 #ifdef FAKE_TREE_IS_VISIBLE
8864     if (ncp_tree) {
8865         PTREE_DATA(ncp_tree)->visible=1;
8866     }
8867 #endif
8869     if (!pinfo->fd->flags.visited) {
8870         /* Find the conversation whence the request would have come. */
8871         conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
8872                                          PT_NCP, nw_connection, nw_connection, 0);
8873         if (conversation != NULL) {
8874             /* find the record telling us the request made that caused
8875                this reply */
8876             request_value = ncp_hash_lookup(conversation, sequence, pinfo->fd->num);
8877             if (request_value) {
8878                 ncp_rec = request_value->ncp_rec;
8879             }
8880             p_add_proto_data(pinfo->fd, proto_ncp, 0, (void*) request_value);
8881         }
8882         /* else... we haven't seen an NCP Request for that conversation
8883            and sequence.
8884            Create Service request packets do not contain nw_connection.
8885            The initial value is set to 65535 or 0. The reply packet has the
8886            valid connection. So, we can't find the request packet in
8887            our conversation list. To trap for this we can just perform
8888            the search again with 65535 to see if we can locate the
8889            proper request packet. */
8890         else {
8891             conversation = find_conversation(pinfo->fd->num,
8892                                              &pinfo->src, &pinfo->dst, PT_NCP, 65535, 65535, 0);
8893             if (conversation != NULL) {
8894                 /* find the record telling us the request made
8895                    that caused this reply */
8896                 request_value = ncp_hash_lookup(conversation,
8897                                                 sequence, pinfo->fd->num);
8898                 if (request_value) {
8899                     ncp_rec = request_value->ncp_rec;
8900                 }
8901                 p_add_proto_data(pinfo->fd, proto_ncp, 0,
8902                                  (void*) request_value);
8903             }
8904             else {
8905                 conversation = find_conversation(pinfo->fd->num,
8906                                                  &pinfo->src, &pinfo->dst, PT_NCP, 0, 0, 0);
8907                 if (conversation != NULL) {
8908                     /* find the record telling us the request made
8909                        that caused this reply */
8910                     request_value = ncp_hash_lookup(conversation,
8911                                                     sequence, pinfo->fd->num);
8912                     if (request_value) {
8913                         ncp_rec = request_value->ncp_rec;
8914                     }
8915                     p_add_proto_data(pinfo->fd, proto_ncp, 0,
8916                                      (void*) request_value);
8917                 }
8918                 /* else... we haven't seen an NCP Request for that
8919                    conversation and sequence. */
8920             }
8921         }
8922     }
8923     else {
8924         /*request_value = p_get_proto_data(pinfo->fd, proto_ncp);*/
8925         conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
8926                                          PT_NCP, nw_connection, nw_connection, 0);
8927         if (conversation != NULL) {
8929              request_value = ncp_hash_lookup(conversation,
8930                                sequence, pinfo->fd->num);
8931                 }
8932         if (request_value) {
8933             ncp_rec = request_value->ncp_rec;
8934         }
8935     }
8937     /*
8938      * Tap the packet before the dissectors are called so we
8939      * still get the tap listener called even if there is an
8940      * exception.
8941      */
8942     tap_queue_packet(ncp_tap->stat, pinfo, request_value);
8944     if (ncp_rec && ncp_rec->func==0x68 &&
8945         (ncp_rec->subfunc==0x02 || ncp_rec->subfunc==0x01)) {
8946         col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDS");
8947     }
8949     /* A completion code of 0 always means OK. Non-zero means failure,
8950      * but each non-zero value has a different meaning. And the same value
8951      * can have different meanings, depending on the ncp.func (and ncp.subfunc)
8952      * value. */
8953     completion_code = tvb_get_guint8(tvb, 6);
8954     if (completion_code == 0) {
8955         if(type == NCP_POSITIVE_ACK)
8956         {
8957             error_string = "Server Busy, Request Being Processed";
8958         }
8959         else
8960         {
8961             error_string = "OK";
8962         }
8963     } else {
8964         if (ncp_rec && ncp_rec->errors) {
8965             error_string = ncp_error_string(ncp_rec->errors, completion_code);
8966         }
8967         else {
8968             error_string = "Original Request Packet not Found";
8969         }
8970     }
8971     if (type == NCP_SERVICE_REPLY && ncp_rec && ncp_rec->func==0x68 &&
8972         ncp_rec->subfunc==0x02 && (tvb_reported_length_remaining(tvb, 8) >= 8))
8973     {
8974         nds_offset = 8;
8975         /*nds_reply_buffer = tvb_get_letohl(tvb, nds_offset);*/
8976         nds_offset += 4;
8977         /*nds_frag = tvb_get_letohl(tvb, nds_offset);*/
8978         nds_offset += 4;
8979         /*
8980          * Is the possibly-reassembled reply large enough to have
8981          * a completion code?  (We can't check the fragment size
8982          * as this might just be the last fragment.)
8983          */
8984         if (tvb_reported_length_remaining(tvb, nds_offset) >= 4)
8985         {
8986             /* Yes - process the completion code. */
8987             nds_error_code = tvb_get_letohl(tvb, nds_offset);
8988             nds_error_string = val_to_str_const(nds_error_code, nds_reply_errors, "NDS Error - No Definition Found");
8989         }
8990     }
8991     col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s",
8992                     type == NCP_SERVICE_REPLY ? "R" : "ACK",
8993                     nds_error_string ? nds_error_string : error_string);
8995     if (ncp_tree) {
8997         if (request_value) {
8998             nstime_t ns;
9000             proto_tree_add_uint(ncp_tree, hf_ncp_req_frame_num, tvb, 0, 0,
9001                                 request_value->req_frame_num);
9002             nstime_delta(&ns, &pinfo->fd->abs_ts, &request_value->req_frame_time);
9003             proto_tree_add_time(ncp_tree, hf_ncp_req_frame_time, tvb, 0, 0, &ns);
9004         }
9006         /* Put the func (and maybe subfunc) from the request packet
9007          * in the proto tree, but hidden. That way filters on ncp.func
9008          * or ncp.subfunc will find both the requests and the replies.
9009          */
9010         if (ncp_rec) {
9011             proto_tree_add_uint_format(ncp_tree, hf_ncp_func, tvb, 6, 0,
9012                                        ncp_rec->func, "Function: %u (0x%02X), %s",
9013                                        ncp_rec->func, ncp_rec->func, ncp_rec->name);
9014             if (ncp_requires_subfunc(ncp_rec->func)) {
9015                 proto_tree_add_uint_format(ncp_tree, hf_ncp_subfunc, tvb, 6, 0,
9016                                            ncp_rec->subfunc, "SubFunction: %u (0x%02x)",
9017                                            ncp_rec->subfunc, ncp_rec->subfunc);
9018             }
9019         }
9020     }
9022     expert_item = proto_tree_add_uint_format(ncp_tree, hf_ncp_completion_code, tvb, 6, 1,
9023                                              completion_code, "Completion Code: %d (0x89%02x), %s",
9024                                              completion_code, completion_code, error_string);
9025     if ((completion_code != 0 || type == NCP_POSITIVE_ACK) && ncp_echo_err) {
9026         expert_add_info_format(pinfo, expert_item, &ei_ncp_completion_code,
9027                                "Error: %d (0x89%02x) %s", completion_code,
9028                                completion_code, error_string);
9029     }
9031     conn_stat = tvb_get_guint8(tvb, 7);
9032     expert_item = proto_tree_add_item(ncp_tree, hf_ncp_connection_status, tvb,
9033                                       7, 1, FALSE);
9034     if (conn_stat != 0 && conn_stat != 0x40 ) {
9035         col_set_str(pinfo->cinfo, COL_INFO,
9036                     "Error: Bad Connection Status");
9037         if (ncp_echo_err) {
9038             expert_add_info(pinfo, expert_item, &ei_ncp_connection_status);
9039         }
9040         return;
9041     }
9042     /*
9043      * Unless this is a successful reply, that's all there
9044      * is to parse.
9045      */
9046     if (type != NCP_SERVICE_REPLY || completion_code != 0)
9047         return;
9049     if (ncp_rec) {
9050         /* Dissect SSS Reply packets */
9051         if (ncp_rec->func == 0x5c && request_value)
9052         {
9053             dissect_sss_reply(tvb, pinfo, ncp_tree, ncp_rec->subfunc, request_value);
9054         }
9055         /* Dissect NMAS Reply packets */
9056         if (ncp_rec->func == 0x5e && request_value)
9057         {
9058             dissect_nmas_reply(tvb, pinfo, ncp_tree, ncp_rec->func, ncp_rec->subfunc, request_value);
9059         }
9060         /* Dissect NDS Ping packets */
9061         if (ncp_rec->func == 0x68 && ncp_rec->subfunc == 0x01)
9062         {
9063             dissect_nds_ping_reply(tvb, pinfo, ncp_tree,
9064                                    request_value);
9065         }
9066         /* Dissect NDS Reply packets */
9067         if (ncp_rec->func == 0x68 && ncp_rec->subfunc == 0x02)
9068         {
9069             dissect_nds_reply(tvb, pinfo, ncp_tree, nds_error_code,
9070                               nds_error_string, request_value, conversation);
9071         }
9072         /* Due to lack of group repeat fields in reply structure, decode this ncp 87/20 reply manually here. */
9073         if ((ncp_rec->func == 0x57 || ncp_rec->func == 0x59) && ncp_rec->subfunc == 0x14) {
9074             dissect_ncp_8x20reply(tvb, ncp_tree, ncp_rec, request_value);
9075         }
9076         /* Process ncp 23/26 address records manually to format correctly. */
9077         if (ncp_rec->func == 0x17 && ncp_rec->subfunc == 0x1a) {
9078             dissect_ncp_23_26_reply(tvb, ncp_tree);
9079         }
9080         if (ncp_rec->func == 5 && ncp_echo_conn) {
9081             expert_add_info(pinfo, NULL, &ei_ncp_connection_destroyed);
9082         }
9083         if (ncp_rec->reply_ptvc) {
9084             /* If we're not building a protocol tree, quit;
9085              * "process_ptvc_record()" assumes we're building
9086              * a protocol tree, and we don't support putting
9087              * stuff in the Info column in replies, and no
9088              * state information is currently updated for
9089              * replies by "process_ptvc_record()", so we
9090              * can't, and don't have a reason to, dissect
9091              * any further if we're not building a protocol
9092              * tree. */
9093             if (!ncp_tree)
9094                 return;
9096             /* If a non-zero completion code was found, it is
9097              * legal to not have any fields, even if the packet
9098              * type is defined as having fields.
9099              *
9100              * XXX - we already know that the completion code
9101              * is 0, as we checked it above.  Is there any
9102              * reason why we'd want to do a full dissection
9103              * if the completion code isn't 0? */
9104             if (completion_code != 0 && tvb_length(tvb) == 8) {
9105                 return;
9106             }
9108             /* Any request condition results? */
9109             if (request_value) {
9110                 req_cond_results = request_value->req_cond_results;
9111             }
9112             else {
9113                 req_cond_results = NULL;
9114             }
9115             clear_repeat_vars();
9116             ptvc = ptvcursor_new(ncp_tree, tvb, 8);
9117             process_ptvc_record(ptvc, ncp_rec->reply_ptvc,
9118                                 req_cond_results, TRUE, ncp_rec);
9119             ptvcursor_free(ptvc);
9121             /* Echo the NDS EID and name for NCP 22,51 replies to expert tap */
9122             if (!pinfo->fd->flags.visited && ncp_rec->func == 0x16 && ncp_rec->subfunc == 0x33) {
9124                 char    eid_string[10];
9125                 char    global_object_name[256];
9127                 build_expert_data(ncp_tree, "ncp.directory_services_object_id",
9128                                   eid_string, sizeof eid_string,
9129                                   0, TRUE);
9130                 build_expert_data(ncp_tree, "ncp.volume_name_len",
9131                                   global_object_name, sizeof global_object_name,
9132                                   0, FALSE);
9134                 /* Echo EID data to expert Chat window */
9135                 if (nds_echo_eid) {
9136                     expert_add_info_format(pinfo, NULL, &ei_ncp_eid,
9137                                            "EID (%s) = %s", eid_string, global_object_name);
9138                 }
9139             }
9140             /* Process ncp 123/17 address records manually to format correctly. */
9141             if (ncp_rec->func == 0x7b && ncp_rec->subfunc == 0x11) {
9142                 dissect_ncp_123_17_reply(tvb, ncp_tree);
9143             }
9144             /* Process ncp 123/11 NLM names manually to format correctly. */
9145             if (ncp_rec->func == 0x7b && ncp_rec->subfunc == 0x0b && request_value) {
9146                 dissect_ncp_123_11_reply(tvb, ncp_tree, request_value);
9147             }
9148             /* Process ncp 123/62 server set parameter values manually to format correctly. */
9149             if (ncp_rec->func == 0x7b && ncp_rec->subfunc == 0x3e) {
9150                 dissect_ncp_123_62_reply(tvb, ncp_tree);
9151             }
9152         }
9153         /* Check to see if we need to report to the expert table */
9154         trap_for_expert_event(ncp_tree, pinfo, ncp_rec, 1);
9155     } else {
9156         if (tvb_length(tvb) > 8) {
9157             expert_item = proto_tree_add_text(ncp_tree, tvb, 8, -1,
9158                                               "No request record found. Parsing is impossible.");
9159             if (ncp_echo_err) {
9160                 expert_add_info(pinfo, expert_item, &ei_ncp_no_request_record_found);
9161             }
9162         }
9163     }
9166 void
9167 dissect_nds_request(tvbuff_t *tvb, packet_info *pinfo,
9168                     guint32 nw_connection, guint8 sequence,
9169                     guint16 type, proto_tree *ncp_tree)
9171     guint8                   func, subfunc = 0;
9172     ncp_req_hash_value      *request_value = NULL;
9173     ncp_req_eid_hash_value  *request_eid_value = NULL;
9174     const ncp_record        *ncp_rec = NULL;
9175     conversation_t          *conversation;
9176     ptvcursor_t             *ptvc = NULL;
9177     proto_tree              *temp_tree = NULL;
9178     gboolean                 run_req_cond = FALSE;
9179     gboolean                 run_info_str = FALSE;
9180     guint8                   nds_verb = 0;
9181     const char              *verb_string = "";
9182     guint32                  nds_frag = 0;
9183     gboolean                 added_arrow;
9184     nds_val                  pvalues[9], prot_flags[1];
9185     guint8                   nds_version = 0;
9186     guint32                  foffset = 0;
9187     char                     global_object_name[256];
9188     guint32                  global_eid=0;
9189     gboolean                 resolve_eid=FALSE;
9190     guint32                  global_flags=0, nds_prot_flags=0;
9191     int                      i;
9193     for (i = 0; i < 9; i++) {
9194         pvalues[i].vtype = 0;
9195         pvalues[i].vvalue = 0;
9196         pvalues[i].vlength = 0;
9197         pvalues[i].voffset = 0;
9198         pvalues[i].hfname = 0;
9199         pvalues[i].vdesc = "";
9200         pvalues[i].vstring = NULL;
9201         pvalues[i].mvtype = 0;
9202         pvalues[i].vflags = 0;
9203     }
9205     global_object_name[0] = '\0';
9207     func = tvb_get_guint8(tvb, 6);
9208     subfunc = tvb_get_guint8(tvb, 7);
9210     ncp_rec = ncp_record_find(func, subfunc);
9212     /* Check to see if this is a fragment packet */
9213     nds_frag = tvb_get_letohl(tvb, 8);
9215     /* Get NDS Verb */
9216     if (nds_frag == 0xffffffff) {
9217         /* First fragment or only fragment. */
9218         nds_verb = tvb_get_guint8(tvb, 24);
9219         if (nds_verb == 0xfe)
9220         {
9221             nds_version = nds_verb;
9222             nds_verb = tvb_get_guint8(tvb, 32);
9223             foffset = 36;
9224         }
9225         else
9226         {
9227             nds_version = 0;
9228             foffset = 28;
9229         }
9230         if (type == NCP_SERVICE_REQUEST) {
9231             proto_tree_add_item(ncp_tree, hf_nds_buffer_size, tvb, foffset,
9232                                 4, TRUE);
9233         }
9234         foffset = foffset+4;
9235         verb_string = val_to_str_const(nds_verb, ncp_nds_verb_vals,
9236                                        "Continuation Fragment");
9237         switch(nds_verb) {
9239         case 0x01:
9240             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
9241             pvalues[0].vtype = VTYPE_UINT32;
9242             pvalues[0].vdesc = "Version: %u";
9243             pvalues[0].vlength = 4;
9244             pvalues[0].hfname = hf_nds_ver;
9245             pvalues[0].voffset = foffset;
9246             foffset = foffset+pvalues[0].vlength;
9247             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
9248             pvalues[1].vtype = VTYPE_BITFIELD;
9249             pvalues[1].vdesc = "Flags:";
9250             pvalues[1].vlength = 2;
9251             pvalues[1].hfname= hf_nds_nflags;
9252             pvalues[1].voffset = foffset;
9253             pvalues[1].bit1 = "Entry ID";
9254             pvalues[1].bit1hfname = hf_bit1nflags;
9255             pvalues[1].bit2 = "Readable";
9256             pvalues[1].bit2hfname = hf_bit2nflags;
9257             pvalues[1].bit3 = "Writeable";
9258             pvalues[1].bit3hfname = hf_bit3nflags;
9259             pvalues[1].bit4 = "Master";
9260             pvalues[1].bit4hfname = hf_bit4nflags;
9261             pvalues[1].bit5 = "Create ID";
9262             pvalues[1].bit5hfname = hf_bit5nflags;
9263             pvalues[1].bit6 = "Walk Tree";
9264             pvalues[1].bit6hfname = hf_bit6nflags;
9265             pvalues[1].bit7 = "Dereference Alias";
9266             pvalues[1].bit7hfname = hf_bit7nflags;
9267             pvalues[1].bit8 = "Not Defined";
9268             pvalues[1].bit8hfname = hf_bit8nflags;
9269             pvalues[1].bit9 = "Not Defined";
9270             pvalues[1].bit9hfname = hf_bit9nflags;
9271             pvalues[1].bit10 = "Not Defined";
9272             pvalues[1].bit10hfname = hf_bit10nflags;
9273             pvalues[1].bit11= "Not Defined";
9274             pvalues[1].bit11hfname = hf_bit11nflags;
9275             pvalues[1].bit12 = "Not Defined";
9276             pvalues[1].bit12hfname = hf_bit12nflags;
9277             pvalues[1].bit13 = "Not Defined";
9278             pvalues[1].bit13hfname = hf_bit13nflags;
9279             pvalues[1].bit14 = "Prefer Referrals";
9280             pvalues[1].bit14hfname = hf_bit14nflags;
9281             pvalues[1].bit15 = "Prefer Only Referrals";
9282             pvalues[1].bit15hfname = hf_bit15nflags;
9283             pvalues[1].bit16 = "Not Defined";
9284             pvalues[1].bit16hfname = hf_bit16nflags;
9285             foffset = foffset+4;
9286             if (pvalues[0].vvalue == 0 || pvalues[0].vvalue == 1)
9287             {
9288                 pvalues[2].vtype = VTYPE_UINT32;
9289                 pvalues[2].vdesc = "Scope: %u";
9290                 pvalues[2].vlength = 4;
9291                 pvalues[2].voffset = foffset;
9292                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
9293                 pvalues[2].hfname= hf_nds_scope;
9294                 foffset = foffset+pvalues[2].vlength;
9295                 pvalues[3].vtype = VTYPE_STRING;
9296                 pvalues[3].vdesc = "Name: %s";
9297                 pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
9298                 pvalues[3].vvalue = 0;
9299                 pvalues[3].vlength = 256;
9300                 pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
9301                 if (pvalues[3].vlength == 0x00 || !tvb_bytes_exist(tvb, foffset, pvalues[3].vlength))
9302                 {
9303                     pvalues[3].vtype = VTYPE_NONE;
9304                     break;
9305                 }
9306                 pvalues[3].voffset = foffset+4;
9307                 foffset = foffset + 4;
9308                 pvalues[3].vstring = get_string(tvb, pvalues[3].voffset, pvalues[3].vlength);
9309                 g_strlcpy(global_object_name, pvalues[3].vstring, 256);
9310                 pvalues[3].hfname= hf_nds_name;
9311                 foffset = foffset+pvalues[3].vlength;
9312                 foffset += align_4(tvb, foffset);
9313                 pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
9314                 pvalues[4].vtype = VTYPE_MULTIVALUE_UINT32;
9315                 pvalues[4].vdesc = "Communications Transports: %u";
9316                 pvalues[4].vlength = 4;
9317                 pvalues[4].hfname= hf_nds_comm_trans;
9318                 pvalues[4].voffset = foffset;
9319                 pvalues[4].mvtype = MVTYPE_ADDR_REFERRAL_REQUEST;
9320                 foffset = foffset + (pvalues[4].vvalue * 4) + 4;
9321                 pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
9322                 pvalues[5].vtype = VTYPE_MULTIVALUE_UINT32;
9323                 pvalues[5].vdesc = "Tree Walker Transport Type: %u";
9324                 pvalues[5].vlength = 4;
9325                 pvalues[5].mvtype = MVTYPE_ADDR_REFERRAL_REQUEST;
9326                 pvalues[5].hfname= hf_nds_tree_trans;
9327                 pvalues[5].voffset = foffset;
9328             }
9329             else
9330             {
9331                 pvalues[2].vtype = VTYPE_UINT32;
9332                 pvalues[2].vdesc = "Minimum DS Version: %u";
9333                 pvalues[2].vlength = 4;
9334                 pvalues[2].voffset = foffset;
9335                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
9336                 pvalues[2].hfname= hf_min_nds_ver;
9337                 foffset = foffset+pvalues[2].vlength;
9338                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
9339                 pvalues[3].vtype = VTYPE_MULTIVALUE_UINT32;
9340                 pvalues[3].vdesc = "Number of Versions to Include: %u";
9341                 pvalues[3].vlength = 4;
9342                 pvalues[3].mvtype = MVTYPE_ATTR_REQUEST2;
9343                 pvalues[3].voffset = foffset;
9344                 pvalues[3].hfname= hf_nds_ver_include;
9345                 foffset += (pvalues[3].vvalue * 4) + 4;
9346                 pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
9347                 pvalues[4].vtype = VTYPE_MULTIVALUE_UINT32;
9348                 pvalues[4].vdesc = "Number of Versions to Exclude: %u";
9349                 pvalues[4].vlength = 4;
9350                 pvalues[4].mvtype = MVTYPE_ATTR_REQUEST2;
9351                 pvalues[4].hfname= hf_nds_ver_exclude;
9352                 pvalues[4].voffset = foffset;
9353                 foffset += 4;
9354                 pvalues[5].vtype = VTYPE_UINT32;
9355                 pvalues[5].vdesc = "DN Output Type: %u";
9356                 pvalues[5].vlength = 4;
9357                 pvalues[5].voffset = foffset;
9358                 pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
9359                 pvalues[5].hfname= hf_nds_dn_output_type;
9360                 foffset = foffset+pvalues[5].vlength;
9361                 pvalues[6].vtype = VTYPE_UINT32;
9362                 pvalues[6].vdesc = "Nested Output Type: %u";
9363                 pvalues[6].vlength = 4;
9364                 pvalues[6].voffset = foffset;
9365                 pvalues[6].vvalue = tvb_get_letohl(tvb, foffset);
9366                 pvalues[6].hfname= hf_nds_nested_output_type;
9367                 foffset = foffset+pvalues[6].vlength;
9368                 pvalues[7].vtype = VTYPE_STRING;
9369                 pvalues[7].vdesc = "Output Delimiter: %s";
9370                 pvalues[7].mvtype = MVTYPE_ATTR_REQUEST;
9371                 pvalues[7].vvalue = 0;
9372                 pvalues[7].vlength = 256;
9373                 pvalues[7].vlength = tvb_get_letohl(tvb, foffset);
9374                 pvalues[7].voffset = foffset+4;
9375                 foffset = foffset + 4;
9376                 pvalues[7].vstring = get_string(tvb, pvalues[7].voffset, pvalues[7].vlength);
9377                 pvalues[7].hfname= hf_nds_output_delimiter;
9378                 foffset = foffset+pvalues[7].vlength;
9379                 foffset += align_4(tvb, foffset);
9380                 pvalues[8].vvalue = tvb_get_letohl(tvb, foffset);
9381                 pvalues[8].vtype = VTYPE_MULTIVALUE_UINT32;
9382                 pvalues[8].vdesc = "Size of Entry Specifier: %u";
9383                 pvalues[8].vlength = 4;
9384                 pvalues[8].mvtype = MVTYPE_PROC_ENTRY_SPECIFIERS;
9385                 pvalues[8].hfname= hf_nds_output_entry_specifier;
9386                 pvalues[8].voffset = foffset;
9387             }
9388             break;
9389         case 0x02:
9390             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
9391             pvalues[0].vtype = VTYPE_UINT32;
9392             pvalues[0].vdesc = "Version: %u";
9393             pvalues[0].vlength = 4;
9394             pvalues[0].voffset = foffset;
9395             pvalues[0].hfname= hf_nds_ver;
9396             foffset = foffset+pvalues[0].vlength;
9397             switch(pvalues[0].vvalue)
9398             {
9399             case 0:
9400                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
9401                 pvalues[1].vtype = VTYPE_UINT32;
9402                 pvalues[1].vdesc = "Entry ID: 0x%08x";
9403                 pvalues[1].vlength = 4;
9404                 resolve_eid = TRUE;
9405                 global_eid = pvalues[1].vvalue;
9406                 pvalues[1].voffset = foffset;
9407                 pvalues[1].hfname = hf_nds_eid;
9408                 foffset = foffset+pvalues[1].vlength;
9409                 break;
9410             case 1:
9411                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
9412                 pvalues[1].vtype = VTYPE_BITFIELD;
9413                 pvalues[1].vdesc = "Request Flags:";
9414                 pvalues[1].vlength = 2;
9415                 pvalues[1].hfname= hf_nds_rflags;
9416                 pvalues[1].voffset = foffset;
9417                 pvalues[1].bit1 = "Typeless";
9418                 pvalues[1].bit1hfname = hf_bit1rflags;
9419                 pvalues[1].bit2 = "Slashed";
9420                 pvalues[1].bit2hfname = hf_bit2rflags;
9421                 pvalues[1].bit3 = "Dotted";
9422                 pvalues[1].bit3hfname = hf_bit3rflags;
9423                 pvalues[1].bit4 = "Tuned";
9424                 pvalues[1].bit4hfname = hf_bit4rflags;
9425                 pvalues[1].bit5 = "Not Defined";
9426                 pvalues[1].bit5hfname = hf_bit5rflags;
9427                 pvalues[1].bit6 = "Not Defined";
9428                 pvalues[1].bit6hfname = hf_bit6rflags;
9429                 pvalues[1].bit7 = "Not Defined";
9430                 pvalues[1].bit7hfname = hf_bit7rflags;
9431                 pvalues[1].bit8 = "Not Defined";
9432                 pvalues[1].bit8hfname = hf_bit8rflags;
9433                 pvalues[1].bit9 = "Not Defined";
9434                 pvalues[1].bit9hfname = hf_bit9rflags;
9435                 pvalues[1].bit10 = "Not Defined";
9436                 pvalues[1].bit10hfname = hf_bit10rflags;
9437                 pvalues[1].bit11 = "Not Defined";
9438                 pvalues[1].bit11hfname = hf_bit11rflags;
9439                 pvalues[1].bit12 = "Not Defined";
9440                 pvalues[1].bit12hfname = hf_bit12rflags;
9441                 pvalues[1].bit13 = "Not Defined";
9442                 pvalues[1].bit13hfname = hf_bit13rflags;
9443                 pvalues[1].bit14 = "Not Defined";
9444                 pvalues[1].bit14hfname = hf_bit14rflags;
9445                 pvalues[1].bit15 = "Not Defined";
9446                 pvalues[1].bit15hfname = hf_bit15rflags;
9447                 pvalues[1].bit16 = "Not Defined";
9448                 pvalues[1].bit16hfname = hf_bit16rflags;
9449                 if((pvalues[1].vvalue & 0xf000) == 0xc000)
9450                 {
9451                     pvalues[2].vtype = VTYPE_STRING;
9452                     pvalues[2].vdesc = "Name Type: %s";
9453                     pvalues[2].vstring = "Partial";
9454                     pvalues[2].mvtype = 0;
9455                     pvalues[2].vvalue = 0;
9456                     pvalues[2].vlength = 0;
9457                     pvalues[2].voffset = 0;
9458                     pvalues[2].hfname= hf_nds_name_type;
9459                 }
9460                 else
9461                 {
9462                     pvalues[2].vtype = VTYPE_STRING;
9463                     pvalues[2].vdesc = "Name Type: %s";
9464                     pvalues[2].vstring = "Full";
9465                     pvalues[2].vvalue = 0;
9466                     pvalues[2].mvtype = 0;
9467                     pvalues[2].vlength = 0;
9468                     pvalues[2].voffset = 0;
9469                     pvalues[2].hfname= hf_nds_name_type;
9470                 }
9471                 foffset = foffset+4;
9472                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
9473                 pvalues[3].vtype = VTYPE_UINT32;
9474                 pvalues[3].vdesc = "Entry ID: 0x%08x";
9475                 pvalues[3].vlength = 4;
9476                 pvalues[3].voffset = foffset;
9477                 resolve_eid = TRUE;
9478                 global_eid = pvalues[3].vvalue;
9479                 pvalues[3].hfname = hf_nds_eid;
9480                 foffset = foffset+pvalues[3].vlength;
9481                 break;
9482             case 2:
9483                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
9484                 pvalues[1].vtype = VTYPE_BITFIELD;
9485                 pvalues[1].vdesc = "Request Flags:";
9486                 pvalues[1].vlength = 2;
9487                 pvalues[1].hfname= hf_nds_rflags;
9488                 pvalues[1].voffset = foffset;
9489                 pvalues[1].bit1 = "Typeless";
9490                 pvalues[1].bit1hfname = hf_bit1rflags;
9491                 pvalues[1].bit2 = "Slashed";
9492                 pvalues[1].bit2hfname = hf_bit2rflags;
9493                 pvalues[1].bit3 = "Dotted";
9494                 pvalues[1].bit3hfname = hf_bit3rflags;
9495                 pvalues[1].bit4 = "Tuned";
9496                 pvalues[1].bit4hfname = hf_bit4rflags;
9497                 pvalues[1].bit5 = "Not Defined";
9498                 pvalues[1].bit5hfname = hf_bit5rflags;
9499                 pvalues[1].bit6 = "Not Defined";
9500                 pvalues[1].bit6hfname = hf_bit6rflags;
9501                 pvalues[1].bit7 = "Not Defined";
9502                 pvalues[1].bit7hfname = hf_bit7rflags;
9503                 pvalues[1].bit8 = "Not Defined";
9504                 pvalues[1].bit8hfname = hf_bit8rflags;
9505                 pvalues[1].bit9 = "Not Defined";
9506                 pvalues[1].bit9hfname = hf_bit9rflags;
9507                 pvalues[1].bit10 = "Not Defined";
9508                 pvalues[1].bit10hfname = hf_bit10rflags;
9509                 pvalues[1].bit11 = "Not Defined";
9510                 pvalues[1].bit11hfname = hf_bit11rflags;
9511                 pvalues[1].bit12 = "Not Defined";
9512                 pvalues[1].bit12hfname = hf_bit12rflags;
9513                 pvalues[1].bit13 = "Not Defined";
9514                 pvalues[1].bit13hfname = hf_bit13rflags;
9515                 pvalues[1].bit14 = "Not Defined";
9516                 pvalues[1].bit14hfname = hf_bit14rflags;
9517                 pvalues[1].bit15 = "Not Defined";
9518                 pvalues[1].bit15hfname = hf_bit15rflags;
9519                 pvalues[1].bit16 = "Not Defined";
9520                 pvalues[1].bit16hfname = hf_bit16rflags;
9521                 if((pvalues[1].vvalue & 0xf000) == 0xc000)
9522                 {
9523                     pvalues[2].vtype = VTYPE_STRING;
9524                     pvalues[2].vdesc = "Name Type: %s";
9525                     pvalues[2].vstring = "Return Partion Name";
9526                     pvalues[2].vvalue = 0;
9527                     pvalues[2].vlength = 4;
9528                     pvalues[2].voffset = pvalues[1].voffset;
9529                     pvalues[2].mvtype = 0;
9530                     pvalues[2].hfname= hf_nds_name_type;
9531                 }
9532                 else
9533                 {
9534                     pvalues[2].vtype = VTYPE_STRING;
9535                     pvalues[2].vdesc = "Name Type: %s";
9536                     pvalues[2].vstring = "Return Full Name";
9537                     pvalues[2].vvalue = 0;
9538                     pvalues[2].vlength = 4;
9539                     pvalues[2].mvtype = 0;
9540                     pvalues[2].voffset = pvalues[1].voffset;
9541                     pvalues[2].hfname= hf_nds_name_type;
9542                 }
9543                 foffset = foffset+4;
9544                 pvalues[3].vvalue = tvb_get_letohs(tvb, foffset);
9545                 global_flags = tvb_get_letohl(tvb, foffset);
9546                 pvalues[3].vtype = VTYPE_BITFIELD;
9547                 pvalues[3].vdesc = "Information Flags (low) Byte:";
9548                 pvalues[3].vlength = 2;
9549                 pvalues[3].hfname= hf_nds_rflags;
9550                 pvalues[3].voffset = foffset;
9551                 pvalues[3].bit1 = "Output Flags";
9552                 pvalues[3].bit1hfname = hf_bit1infoflagsl;
9553                 pvalues[3].bit2 = "Entry ID";
9554                 pvalues[3].bit2hfname = hf_bit2infoflagsl;
9555                 pvalues[3].bit3 = "Entry Flags";
9556                 pvalues[3].bit3hfname = hf_bit3infoflagsl;
9557                 pvalues[3].bit4 = "Subordinate Count";
9558                 pvalues[3].bit4hfname = hf_bit4infoflagsl;
9559                 pvalues[3].bit5 = "Modification Time";
9560                 pvalues[3].bit5hfname = hf_bit5infoflagsl;
9561                 pvalues[3].bit6 = "Modification Timestamp";
9562                 pvalues[3].bit6hfname = hf_bit6infoflagsl;
9563                 pvalues[3].bit7 = "Creation Timestamp";
9564                 pvalues[3].bit7hfname = hf_bit7infoflagsl;
9565                 pvalues[3].bit8 = "Partition Root ID";
9566                 pvalues[3].bit8hfname = hf_bit8infoflagsl;
9567                 pvalues[3].bit9 = "Parent ID";
9568                 pvalues[3].bit9hfname = hf_bit9infoflagsl;
9569                 pvalues[3].bit10 = "Revision Count";
9570                 pvalues[3].bit10hfname = hf_bit10infoflagsl;
9571                 pvalues[3].bit11 = "Replica Type";
9572                 pvalues[3].bit11hfname = hf_bit11infoflagsl;
9573                 pvalues[3].bit12 = "Base Class";
9574                 pvalues[3].bit12hfname = hf_bit12infoflagsl;
9575                 pvalues[3].bit13 = "Relative Distinguished Name";
9576                 pvalues[3].bit13hfname = hf_bit13infoflagsl;
9577                 pvalues[3].bit14 = "Distinguished Name";
9578                 pvalues[3].bit14hfname = hf_bit14infoflagsl;
9579                 pvalues[3].bit15 = "Root Distinguished Name";
9580                 pvalues[3].bit15hfname = hf_bit15infoflagsl;
9581                 pvalues[3].bit16 = "Parent Distinguished Name";
9582                 pvalues[3].bit16hfname = hf_bit16infoflagsl;
9583                 foffset = foffset+2;
9584                 pvalues[4].vvalue = tvb_get_letohs(tvb, foffset);
9585                 pvalues[4].vtype = VTYPE_BITFIELD;
9586                 pvalues[4].vdesc = "Information Flags (high) Byte:";
9587                 pvalues[4].vlength = 2;
9588                 pvalues[4].hfname= hf_nds_rflags;
9589                 pvalues[4].voffset = foffset;
9590                 pvalues[4].bit1 = "Purge Time";
9591                 pvalues[4].bit1hfname = hf_bit1infoflagsh;
9592                 pvalues[4].bit2 = "Dereference Base Class";
9593                 pvalues[4].bit2hfname = hf_bit2infoflagsh;
9594                 pvalues[4].bit3 = "Replica Number";
9595                 pvalues[4].bit3hfname = hf_bit3infoflagsh;
9596                 pvalues[4].bit4 = "Replica State";
9597                 pvalues[4].bit4hfname = hf_bit4infoflagsh;
9598                 pvalues[4].bit5 = "Federation Boundary";
9599                 pvalues[4].bit5hfname = hf_bit5infoflagsh;
9600                 pvalues[4].bit6 = "Schema Boundary";
9601                 pvalues[4].bit6hfname = hf_bit6infoflagsh;
9602                 pvalues[4].bit7 = "Federation Boundary ID";
9603                 pvalues[4].bit7hfname = hf_bit7infoflagsh;
9604                 pvalues[4].bit8 = "Schema Boundary ID";
9605                 pvalues[4].bit8hfname = hf_bit8infoflagsh;
9606                 pvalues[4].bit9 = "Current Subcount";
9607                 pvalues[4].bit9hfname = hf_bit9infoflagsh;
9608                 pvalues[4].bit10 = "Local Entry Flags";
9609                 pvalues[4].bit10hfname = hf_bit10infoflagsh;
9610                 pvalues[4].bit11 = "Not Defined";
9611                 pvalues[4].bit11hfname = hf_bit11infoflagsh;
9612                 pvalues[4].bit12 = "Not Defined";
9613                 pvalues[4].bit12hfname = hf_bit12infoflagsh;
9614                 pvalues[4].bit13 = "Not Defined";
9615                 pvalues[4].bit13hfname = hf_bit13infoflagsh;
9616                 pvalues[4].bit14 = "Not Defined";
9617                 pvalues[4].bit14hfname = hf_bit14infoflagsh;
9618                 pvalues[4].bit15 = "Not Defined";
9619                 pvalues[4].bit15hfname = hf_bit15infoflagsh;
9620                 pvalues[4].bit16 = "Not Defined";
9621                 pvalues[4].bit16hfname = hf_bit16infoflagsh;
9622                 foffset = foffset+2;
9623                 pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
9624                 pvalues[5].vtype = VTYPE_UINT32;
9625                 pvalues[5].vdesc = "Entry ID: 0x%08x";
9626                 pvalues[5].vlength = 4;
9627                 pvalues[5].voffset = foffset;
9628                 resolve_eid = TRUE;
9629                 global_eid = pvalues[5].vvalue;
9630                 pvalues[5].hfname = hf_nds_eid;
9631                 foffset = foffset+pvalues[5].vlength;
9632                 break;
9633             default:
9634                 break;
9635             }
9637             break;
9638         case 0x03:
9639             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
9640             pvalues[0].vtype = VTYPE_UINT32;
9641             pvalues[0].vdesc = "Version: %u";
9642             pvalues[0].vlength = 4;
9643             pvalues[0].voffset = foffset;
9644             pvalues[0].hfname= hf_nds_ver;
9645             foffset = foffset+pvalues[0].vlength;
9646             if(pvalues[0].vvalue == 0)
9647             {
9648                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
9649                 pvalues[1].vtype = VTYPE_UINT32;
9650                 pvalues[1].vdesc = "Iteration Handle: 0x%08x";
9651                 pvalues[1].vlength = 4;
9652                 pvalues[1].voffset = foffset;
9653                 pvalues[1].hfname= hf_nds_iteration;
9654                 foffset = foffset+pvalues[1].vlength;
9655                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
9656                 pvalues[2].vtype = VTYPE_UINT32;
9657                 pvalues[2].vdesc = "Entry ID: 0x%08x";
9658                 pvalues[2].vlength = 4;
9659                 resolve_eid = TRUE;
9660                 global_eid = pvalues[2].vvalue;
9661                 pvalues[2].voffset = foffset;
9662                 pvalues[2].hfname= hf_nds_eid;
9663                 foffset = foffset+pvalues[2].vlength;
9664                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
9665                 global_flags = pvalues[3].vvalue;
9666                 pvalues[3].vstring = val_to_str_const(pvalues[3].vvalue, nds_info_type, "No Info Type Set");
9667                 pvalues[3].vtype = VTYPE_STRING;
9668                 pvalues[3].vdesc = "Info Type: %s";
9669                 pvalues[3].vlength = 4;
9670                 pvalues[3].voffset = foffset;
9671                 pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
9672                 pvalues[3].hfname= hf_nds_info_type;
9673                 foffset = foffset + pvalues[3].vlength;
9674                 pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
9675                 pvalues[4].vtype = VTYPE_UINT32;
9676                 pvalues[4].vdesc = "All Attributes: %u";
9677                 pvalues[4].vlength = 4;
9678                 pvalues[4].voffset = foffset;
9679                 pvalues[4].hfname= hf_nds_all_attr;
9680                 foffset = foffset+pvalues[4].vlength;
9681                 pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
9682                 pvalues[5].vtype = VTYPE_MULTIVALUE_UINT32;
9683                 pvalues[5].vdesc = "Attributes: %u";
9684                 pvalues[5].vlength = 4;
9685                 pvalues[5].voffset = foffset;
9686                 pvalues[5].mvtype = MVTYPE_ATTR_REQUEST;
9687                 pvalues[5].hfname= hf_nds_attr;
9688             }
9689             else
9690             {
9691                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
9692                 pvalues[1].vtype = VTYPE_UINT32;
9693                 pvalues[1].vdesc = "Request Flags: 0x%08x";
9694                 pvalues[1].vlength = 4;
9695                 pvalues[1].voffset = foffset;
9696                 pvalues[1].hfname= hf_nds_req_flags;
9697                 foffset = foffset+pvalues[1].vlength;
9698                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
9699                 pvalues[2].vtype = VTYPE_UINT32;
9700                 pvalues[2].vdesc = "Iteration Handle: 0x%08x";
9701                 pvalues[2].vlength = 4;
9702                 pvalues[2].voffset = foffset;
9703                 pvalues[2].hfname= hf_nds_iteration;
9704                 foffset = foffset+pvalues[2].vlength;
9705                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
9706                 pvalues[3].vtype = VTYPE_UINT32;
9707                 pvalues[3].vdesc = "Entry ID: 0x%08x";
9708                 pvalues[3].vlength = 4;
9709                 resolve_eid = TRUE;
9710                 global_eid = pvalues[3].vvalue;
9711                 pvalues[3].voffset = foffset;
9712                 pvalues[3].hfname= hf_nds_eid;
9713                 foffset = foffset+pvalues[3].vlength;
9714                 pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
9715                 global_flags = pvalues[4].vvalue;
9716                 pvalues[4].vstring = val_to_str_const(pvalues[4].vvalue, nds_info_type, "No Info Type Set");
9717                 pvalues[4].vtype = VTYPE_STRING;
9718                 pvalues[4].vdesc = "Info Type: %s";
9719                 pvalues[4].vlength = 4;
9720                 pvalues[4].voffset = foffset;
9721                 pvalues[4].hfname= hf_nds_info_type;
9722                 pvalues[4].mvtype = MVTYPE_ATTR_REQUEST;
9723                 foffset = foffset+pvalues[4].vlength;
9724                 pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
9725                 pvalues[5].vtype = VTYPE_UINT32;
9726                 pvalues[5].vdesc = "All Attributes: %u";
9727                 pvalues[5].vlength = 4;
9728                 pvalues[5].voffset = foffset;
9729                 pvalues[5].hfname= hf_nds_all_attr;
9730                 foffset = foffset+pvalues[5].vlength;
9731                 pvalues[6].vvalue = tvb_get_letohl(tvb, foffset);
9732                 pvalues[6].vtype = VTYPE_MULTIVALUE_UINT32;
9733                 pvalues[6].vdesc = "Attributes: %u";
9734                 pvalues[6].vlength = 4;
9735                 pvalues[6].voffset = foffset;
9736                 pvalues[6].mvtype = MVTYPE_ATTR_REQUEST;
9737                 pvalues[6].hfname= hf_nds_attr;
9738             }
9739             break;
9740         case 0x04:
9741             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
9742             pvalues[0].vtype = VTYPE_UINT32;
9743             pvalues[0].vdesc = "Version: %u";
9744             pvalues[0].vlength = 4;
9745             pvalues[0].voffset = foffset;
9746             pvalues[0].hfname= hf_nds_ver;
9747             foffset = foffset+pvalues[0].vlength;
9748             if (pvalues[0].vvalue == 1) {
9749                 /* Version 1 specifies for this offset value to always be a value of 1*/
9750                 /* No need to display to user */
9751                 foffset += 4;
9752             }
9753             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
9754             pvalues[1].vtype = VTYPE_UINT32;
9755             pvalues[1].vdesc = "Entry ID: 0x%08x";
9756             pvalues[1].vlength = 4;
9757             resolve_eid = TRUE;
9758             global_eid = pvalues[1].vvalue;
9759             pvalues[1].voffset = foffset;
9760             pvalues[1].hfname = hf_nds_eid;
9761             foffset = foffset+pvalues[1].vlength;
9762             foffset += 4;       /* Attribute Count = 1 */
9763             pvalues[2].vtype = VTYPE_STRING;
9764             pvalues[2].vdesc = "Attribute Name Being Compared: %s";
9765             pvalues[2].mvtype = MVTYPE_ATTR_REQUEST;
9766             pvalues[2].vvalue = 0;
9767             pvalues[2].vlength = 256;
9768             pvalues[2].vlength = tvb_get_letohl(tvb, foffset);
9769             if (pvalues[2].vlength == 0x00 || !tvb_bytes_exist(tvb, foffset, pvalues[2].vlength))
9770             {
9771                 pvalues[2].vtype = VTYPE_NONE;
9772                 break;
9773             }
9774             pvalues[2].voffset = foffset+4;
9775             foffset = foffset + 4;
9776             pvalues[2].vstring = get_string(tvb, pvalues[2].voffset, pvalues[2].vlength);
9777             g_strlcpy(global_object_name, pvalues[2].vstring, 256);
9778             pvalues[2].hfname= hf_nds_name;
9779             foffset = foffset+pvalues[2].vlength;
9780             foffset += align_4(tvb, foffset);
9781             foffset += 4;       /* Attribute Value Count = 1 */
9782             pvalues[3].vtype = VTYPE_STRING;
9783             pvalues[3].vdesc = "Attribute Value: %s";
9784             pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
9785             pvalues[3].vvalue = 0;
9786             pvalues[3].vlength = 256;
9787             pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
9788             pvalues[3].voffset = foffset+4;
9789             foffset = foffset + 4;
9790             pvalues[3].vstring = get_string(tvb, pvalues[3].voffset, pvalues[3].vlength);
9791             pvalues[3].hfname= hf_value_string;
9792             foffset = foffset+pvalues[3].vlength;
9793             break;
9794         case 0x05:
9795             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
9796             pvalues[0].vtype = VTYPE_UINT32;
9797             pvalues[0].vdesc = "Version: %u";
9798             pvalues[0].vlength = 4;
9799             pvalues[0].voffset = foffset;
9800             pvalues[0].hfname= hf_nds_ver;
9801             foffset = foffset+pvalues[0].vlength;
9802             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
9803             pvalues[1].vtype = VTYPE_BITFIELD;
9804             pvalues[1].vdesc = "Request Flags:";
9805             pvalues[1].vlength = 2;
9806             pvalues[1].hfname= hf_nds_rflags;
9807             pvalues[1].voffset = foffset;
9808             pvalues[1].bit1 = "List Typeless";
9809             pvalues[1].bit1hfname = hf_bit1lflags;
9810             pvalues[1].bit2 = "List Containers";
9811             pvalues[1].bit2hfname = hf_bit2lflags;
9812             pvalues[1].bit3 = "List Slashed";
9813             pvalues[1].bit3hfname = hf_bit3lflags;
9814             pvalues[1].bit4 = "List Dotted";
9815             pvalues[1].bit4hfname = hf_bit4lflags;
9816             pvalues[1].bit5 = "Dereference Alias";
9817             pvalues[1].bit5hfname = hf_bit5lflags;
9818             pvalues[1].bit6 = "List All Containers";
9819             pvalues[1].bit6hfname = hf_bit6lflags;
9820             pvalues[1].bit7 = "List Obsolete";
9821             pvalues[1].bit7hfname = hf_bit7lflags;
9822             pvalues[1].bit8 = "List Tuned Output";
9823             pvalues[1].bit8hfname = hf_bit8lflags;
9824             pvalues[1].bit9 = "List External Reference";
9825             pvalues[1].bit9hfname = hf_bit9lflags;
9826             pvalues[1].bit10 = "Not Defined";
9827             pvalues[1].bit10hfname = hf_bit10lflags;
9828             pvalues[1].bit11 = "Not Defined";
9829             pvalues[1].bit11hfname = hf_bit11lflags;
9830             pvalues[1].bit12 = "Not Defined";
9831             pvalues[1].bit12hfname = hf_bit12lflags;
9832             pvalues[1].bit13 = "Not Defined";
9833             pvalues[1].bit13hfname = hf_bit13lflags;
9834             pvalues[1].bit14 = "Not Defined";
9835             pvalues[1].bit14hfname = hf_bit14lflags;
9836             pvalues[1].bit15 = "Not Defined";
9837             pvalues[1].bit15hfname = hf_bit15lflags;
9838             pvalues[1].bit16 = "Not Defined";
9839             pvalues[1].bit16hfname = hf_bit16lflags;
9840             foffset = foffset+pvalues[1].vlength;
9841             foffset += 2;
9842             pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
9843             pvalues[2].vtype = VTYPE_UINT32;
9844             pvalues[2].vdesc = "Iteration Handle: 0x%08x";
9845             pvalues[2].vlength = 4;
9846             pvalues[2].voffset = foffset;
9847             pvalues[2].hfname= hf_nds_iteration;
9848             foffset = foffset+pvalues[2].vlength;
9849             pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
9850             pvalues[3].vtype = VTYPE_UINT32;
9851             pvalues[3].vdesc = "Parent ID: 0x%08x";
9852             pvalues[3].vlength = 4;
9853             pvalues[3].voffset = foffset;
9854             pvalues[3].hfname= hf_nds_parent;
9855             foffset = foffset+pvalues[3].vlength;
9856             pvalues[4].vvalue = tvb_get_letohs(tvb, foffset);
9857             global_flags = tvb_get_letohl(tvb, foffset);
9858             pvalues[4].vtype = VTYPE_BITFIELD;
9859             pvalues[4].vdesc = "Information Flags (low) Byte:";
9860             pvalues[4].vlength = 2;
9861             pvalues[4].hfname= hf_nds_rflags;
9862             pvalues[4].voffset = foffset;
9863             pvalues[4].bit1 = "Output Flags";
9864             pvalues[4].bit1hfname = hf_bit1infoflagsl;
9865             pvalues[4].bit2 = "Entry ID";
9866             pvalues[4].bit2hfname = hf_bit2infoflagsl;
9867             pvalues[4].bit3 = "Entry Flags";
9868             pvalues[4].bit3hfname = hf_bit3infoflagsl;
9869             pvalues[4].bit4 = "Subordinate Count";
9870             pvalues[4].bit4hfname = hf_bit4infoflagsl;
9871             pvalues[4].bit5 = "Modification Time";
9872             pvalues[4].bit5hfname = hf_bit5infoflagsl;
9873             pvalues[4].bit6 = "Modification Timestamp";
9874             pvalues[4].bit6hfname = hf_bit6infoflagsl;
9875             pvalues[4].bit7 = "Creation Timestamp";
9876             pvalues[4].bit7hfname = hf_bit7infoflagsl;
9877             pvalues[4].bit8 = "Partition Root ID";
9878             pvalues[4].bit8hfname = hf_bit8infoflagsl;
9879             pvalues[4].bit9 = "Parent ID";
9880             pvalues[4].bit9hfname = hf_bit9infoflagsl;
9881             pvalues[4].bit10 = "Revision Count";
9882             pvalues[4].bit10hfname = hf_bit10infoflagsl;
9883             pvalues[4].bit11 = "Replica Type";
9884             pvalues[4].bit11hfname = hf_bit11infoflagsl;
9885             pvalues[4].bit12 = "Base Class";
9886             pvalues[4].bit12hfname = hf_bit12infoflagsl;
9887             pvalues[4].bit13 = "Relative Distinguished Name";
9888             pvalues[4].bit13hfname = hf_bit13infoflagsl;
9889             pvalues[4].bit14 = "Distinguished Name";
9890             pvalues[4].bit14hfname = hf_bit14infoflagsl;
9891             pvalues[4].bit15 = "Root Distinguished Name";
9892             pvalues[4].bit15hfname = hf_bit15infoflagsl;
9893             pvalues[4].bit16 = "Parent Distinguished Name";
9894             pvalues[4].bit16hfname = hf_bit16infoflagsl;
9895             foffset = foffset+2;
9896             pvalues[5].vvalue = tvb_get_letohs(tvb, foffset);
9897             pvalues[5].vtype = VTYPE_BITFIELD;
9898             pvalues[5].vdesc = "Information Flags (high) Byte:";
9899             pvalues[5].vlength = 2;
9900             pvalues[5].hfname= hf_nds_rflags;
9901             pvalues[5].voffset = foffset;
9902             pvalues[5].bit1 = "Purge Time";
9903             pvalues[5].bit1hfname = hf_bit1infoflagsh;
9904             pvalues[5].bit2 = "Dereference Base Class";
9905             pvalues[5].bit2hfname = hf_bit2infoflagsh;
9906             pvalues[5].bit3 = "Not Defined";
9907             pvalues[5].bit3hfname = hf_bit3infoflagsh;
9908             pvalues[5].bit4 = "Not Defined";
9909             pvalues[5].bit4hfname = hf_bit4infoflagsh;
9910             pvalues[5].bit5 = "Not Defined";
9911             pvalues[5].bit5hfname = hf_bit5infoflagsh;
9912             pvalues[5].bit6 = "Not Defined";
9913             pvalues[5].bit6hfname = hf_bit6infoflagsh;
9914             pvalues[5].bit7 = "Not Defined";
9915             pvalues[5].bit7hfname = hf_bit7infoflagsh;
9916             pvalues[5].bit8 = "Not Defined";
9917             pvalues[5].bit8hfname = hf_bit8infoflagsh;
9918             pvalues[5].bit9 = "Not Defined";
9919             pvalues[5].bit9hfname = hf_bit9infoflagsh;
9920             pvalues[5].bit10 = "Not Defined";
9921             pvalues[5].bit10hfname = hf_bit10infoflagsh;
9922             pvalues[5].bit11 = "Not Defined";
9923             pvalues[5].bit11hfname = hf_bit11infoflagsh;
9924             pvalues[5].bit12 = "Not Defined";
9925             pvalues[5].bit12hfname = hf_bit12infoflagsh;
9926             pvalues[5].bit13 = "Not Defined";
9927             pvalues[5].bit13hfname = hf_bit13infoflagsh;
9928             pvalues[5].bit14 = "Not Defined";
9929             pvalues[5].bit14hfname = hf_bit14infoflagsh;
9930             pvalues[5].bit15 = "Not Defined";
9931             pvalues[5].bit15hfname = hf_bit15infoflagsh;
9932             pvalues[5].bit16 = "Not Defined";
9933             pvalues[5].bit16hfname = hf_bit16infoflagsh;
9934             foffset = foffset+2;
9935             pvalues[6].vtype = VTYPE_STRING;
9936             pvalues[6].vdesc = "Name Filter: %s";
9937             pvalues[6].mvtype = MVTYPE_ATTR_REQUEST;
9938             pvalues[6].vvalue = 0;
9939             pvalues[6].vlength = 256;
9940             pvalues[6].vlength = tvb_get_letohl(tvb, foffset);
9941             pvalues[6].voffset = foffset+4;
9942             foffset = foffset + 4;
9943             pvalues[6].vstring = get_string(tvb, pvalues[6].voffset, pvalues[6].vlength);
9944             pvalues[6].hfname= hf_nds_name_filter;
9945             foffset = foffset+pvalues[6].vlength;
9946             if(pvalues[0].vvalue == 0)
9947             {
9948                 break;
9949             }
9950             foffset += align_4(tvb, foffset);
9951             pvalues[7].vtype = VTYPE_STRING;
9952             pvalues[7].vdesc = "Class Filter: %s";
9953             pvalues[7].mvtype = MVTYPE_ATTR_REQUEST;
9954             pvalues[7].vvalue = 0;
9955             pvalues[7].vlength = 256;
9956             pvalues[7].vlength = tvb_get_letohl(tvb, foffset);
9957             pvalues[7].voffset = foffset+4;
9958             foffset = foffset + 4;
9959             pvalues[7].vstring = get_string(tvb, pvalues[7].voffset, pvalues[7].vlength);
9960             pvalues[7].hfname= hf_nds_class_filter;
9961             foffset = foffset+pvalues[7].vlength;
9962             if(pvalues[0].vvalue == 1)
9963             {
9964                 break;
9965             }
9966             foffset += align_4(tvb, foffset);
9967             pvalues[8].vvalue = tvb_get_letohl(tvb, foffset);
9968             pvalues[8].vtype = VTYPE_MULTIVALUE_UINT32;
9969             pvalues[8].vdesc = "Seconds: %u";
9970             pvalues[8].vlength = 4;
9971             pvalues[8].mvtype = MVTYPE_PRINT_TIMESTAMP;
9972             pvalues[8].hfname= hf_nds_time_filter;
9973             pvalues[8].voffset = foffset;
9974             break;
9975         case 0x06:
9976             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
9977             pvalues[0].vstring = "";
9978             pvalues[0].vtype = VTYPE_UINT32;
9979             pvalues[0].vdesc = "Version: %u";
9980             pvalues[0].vlength = 4;
9981             pvalues[0].voffset = foffset;
9982             pvalues[0].hfname= hf_nds_ver;
9983             foffset = foffset+pvalues[0].vlength;
9984             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
9985             pvalues[1].vtype = VTYPE_UINT32;
9986             pvalues[1].vstring = "";
9987             pvalues[1].vdesc = "Request Flags: 0x%08x";
9988             pvalues[1].vlength = 4;
9989             pvalues[1].hfname= hf_nds_rflags;
9990             pvalues[1].voffset = foffset;
9991             foffset = foffset+4;
9992             pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
9993             pvalues[2].vtype = VTYPE_UINT32;
9994             pvalues[2].vdesc = "Iteration Handle: 0x%08x";
9995             pvalues[2].vlength = 4;
9996             pvalues[2].voffset = foffset;
9997             pvalues[2].hfname= hf_nds_iteration;
9998             foffset = foffset+pvalues[2].vlength;
9999             pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
10000             pvalues[3].vstring = "";
10001             pvalues[3].vtype = VTYPE_UINT32;
10002             pvalues[3].vdesc = "Base Entry ID: 0x%08x";
10003             pvalues[3].vlength = 4;
10004             resolve_eid = FALSE;
10005             global_eid = pvalues[3].vvalue;
10006             pvalues[3].voffset = foffset;
10007             pvalues[3].hfname= hf_nds_eid;
10008             foffset = foffset+pvalues[3].vlength;
10009             pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
10010             pvalues[4].vstring = val_to_str_const(pvalues[4].vvalue, nds_search_scope, "No Search Scope Defined");
10011             pvalues[4].vtype = VTYPE_STRING;
10012             pvalues[4].vdesc = "Replica Type: %s";
10013             pvalues[4].vlength = 4;
10014             pvalues[4].voffset = foffset;
10015             pvalues[4].mvtype = 0;
10016             pvalues[4].hfname= hf_nds_search_scope;
10017             foffset = foffset + pvalues[4].vlength;
10018             pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
10019             pvalues[5].vtype = VTYPE_UINT32;
10020             pvalues[5].vdesc = "Number of Objects to Search: 0x%08x";
10021             pvalues[5].vlength = 4;
10022             pvalues[5].voffset = foffset;
10023             pvalues[5].hfname= hf_nds_num_objects;
10024             foffset = foffset+pvalues[5].vlength;
10025             pvalues[6].vvalue = tvb_get_letohl(tvb, foffset);
10026             pvalues[6].vtype = VTYPE_BITFIELD;
10027             pvalues[6].vdesc = "Information Types:";
10028             pvalues[6].vlength = 2;
10029             pvalues[6].hfname= hf_nds_nflags;
10030             pvalues[6].voffset = foffset;
10031             pvalues[6].bit1 = "Names";
10032             pvalues[6].bit1hfname = hf_bit1siflags;
10033             pvalues[6].bit2 = "Names and Values";
10034             pvalues[6].bit2hfname = hf_bit2siflags;
10035             pvalues[6].bit3 = "Effective Privileges";
10036             pvalues[6].bit3hfname = hf_bit3siflags;
10037             pvalues[6].bit4 = "Value Info";
10038             pvalues[6].bit4hfname = hf_bit4siflags;
10039             pvalues[6].bit5 = "Abbreviated Value";
10040             pvalues[6].bit5hfname = hf_bit5siflags;
10041             pvalues[6].bit6 = "Not Defined";
10042             pvalues[6].bit6hfname = hf_bit6siflags;
10043             pvalues[6].bit7 = "Not Defined";
10044             pvalues[6].bit7hfname = hf_bit7siflags;
10045             pvalues[6].bit8 = "Not Defined";
10046             pvalues[6].bit8hfname = hf_bit8siflags;
10047             pvalues[6].bit9 = "Expanded Class";
10048             pvalues[6].bit9hfname = hf_bit9siflags;
10049             pvalues[6].bit10 = "Not Defined";
10050             pvalues[6].bit10hfname = hf_bit10siflags;
10051             pvalues[6].bit11= "Not Defined";
10052             pvalues[6].bit11hfname = hf_bit11siflags;
10053             pvalues[6].bit12 = "Not Defined";
10054             pvalues[6].bit12hfname = hf_bit12siflags;
10055             pvalues[6].bit13 = "Not Defined";
10056             pvalues[6].bit13hfname = hf_bit13siflags;
10057             pvalues[6].bit14 = "Not Defined";
10058             pvalues[6].bit14hfname = hf_bit14siflags;
10059             pvalues[6].bit15 = "Not Defined";
10060             pvalues[6].bit15hfname = hf_bit15siflags;
10061             pvalues[6].bit16 = "Not Defined";
10062             pvalues[6].bit16hfname = hf_bit16siflags;
10063             foffset = foffset+4;
10064             if(pvalues[0].vvalue != 2)
10065             {
10066                 pvalues[7].vvalue = tvb_get_letohs(tvb, foffset);
10067                 global_flags = tvb_get_letohl(tvb, foffset);
10068                 pvalues[7].vtype = VTYPE_BITFIELD;
10069                 pvalues[7].vdesc = "Information Flags (low) Byte:";
10070                 pvalues[7].vlength = 2;
10071                 pvalues[7].hfname= hf_nds_rflags;
10072                 pvalues[7].voffset = foffset;
10073                 pvalues[7].bit1 = "Output Flags";
10074                 pvalues[7].bit1hfname = hf_bit1infoflagsl;
10075                 pvalues[7].bit2 = "Entry ID";
10076                 pvalues[7].bit2hfname = hf_bit2infoflagsl;
10077                 pvalues[7].bit3 = "Entry Flags";
10078                 pvalues[7].bit3hfname = hf_bit3infoflagsl;
10079                 pvalues[7].bit4 = "Subordinate Count";
10080                 pvalues[7].bit4hfname = hf_bit4infoflagsl;
10081                 pvalues[7].bit5 = "Modification Time";
10082                 pvalues[7].bit5hfname = hf_bit5infoflagsl;
10083                 pvalues[7].bit6 = "Modification Timestamp";
10084                 pvalues[7].bit6hfname = hf_bit6infoflagsl;
10085                 pvalues[7].bit7 = "Creation Timestamp";
10086                 pvalues[7].bit7hfname = hf_bit7infoflagsl;
10087                 pvalues[7].bit8 = "Partition Root ID";
10088                 pvalues[7].bit8hfname = hf_bit8infoflagsl;
10089                 pvalues[7].bit9 = "Parent ID";
10090                 pvalues[7].bit9hfname = hf_bit9infoflagsl;
10091                 pvalues[7].bit10 = "Revision Count";
10092                 pvalues[7].bit10hfname = hf_bit10infoflagsl;
10093                 pvalues[7].bit11 = "Replica Type";
10094                 pvalues[7].bit11hfname = hf_bit11infoflagsl;
10095                 pvalues[7].bit12 = "Base Class";
10096                 pvalues[7].bit12hfname = hf_bit12infoflagsl;
10097                 pvalues[7].bit13 = "Relative Distinguished Name";
10098                 pvalues[7].bit13hfname = hf_bit13infoflagsl;
10099                 pvalues[7].bit14 = "Distinguished Name";
10100                 pvalues[7].bit14hfname = hf_bit14infoflagsl;
10101                 pvalues[7].bit15 = "Root Distinguished Name";
10102                 pvalues[7].bit15hfname = hf_bit15infoflagsl;
10103                 pvalues[7].bit16 = "Parent Distinguished Name";
10104                 pvalues[7].bit16hfname = hf_bit16infoflagsl;
10105                 foffset = foffset+2;
10106                 pvalues[8].vvalue = tvb_get_letohs(tvb, foffset);
10107                 pvalues[8].vtype = VTYPE_BITFIELD;
10108                 pvalues[8].vdesc = "Information Flags (high) Byte:";
10109                 pvalues[8].vlength = 2;
10110                 pvalues[8].hfname= hf_nds_rflags;
10111                 pvalues[8].voffset = foffset;
10112                 pvalues[8].bit1 = "Purge Time";
10113                 pvalues[8].bit1hfname = hf_bit1infoflagsh;
10114                 pvalues[8].bit2 = "Dereference Base Class";
10115                 pvalues[8].bit2hfname = hf_bit2infoflagsh;
10116                 pvalues[8].bit3 = "Not Defined";
10117                 pvalues[8].bit3hfname = hf_bit3infoflagsh;
10118                 pvalues[8].bit4 = "Not Defined";
10119                 pvalues[8].bit4hfname = hf_bit4infoflagsh;
10120                 pvalues[8].bit5 = "Not Defined";
10121                 pvalues[8].bit5hfname = hf_bit5infoflagsh;
10122                 pvalues[8].bit6 = "Not Defined";
10123                 pvalues[8].bit6hfname = hf_bit6infoflagsh;
10124                 pvalues[8].bit7 = "Not Defined";
10125                 pvalues[8].bit7hfname = hf_bit7infoflagsh;
10126                 pvalues[8].bit8 = "Not Defined";
10127                 pvalues[8].bit8hfname = hf_bit8infoflagsh;
10128                 pvalues[8].bit9 = "Not Defined";
10129                 pvalues[8].bit9hfname = hf_bit9infoflagsh;
10130                 pvalues[8].bit10 = "Not Defined";
10131                 pvalues[8].bit10hfname = hf_bit10infoflagsh;
10132                 pvalues[8].bit11 = "Not Defined";
10133                 pvalues[8].bit11hfname = hf_bit11infoflagsh;
10134                 pvalues[8].bit12 = "Not Defined";
10135                 pvalues[8].bit12hfname = hf_bit12infoflagsh;
10136                 pvalues[8].bit13 = "Not Defined";
10137                 pvalues[8].bit13hfname = hf_bit13infoflagsh;
10138                 pvalues[8].bit14 = "Not Defined";
10139                 pvalues[8].bit14hfname = hf_bit14infoflagsh;
10140                 pvalues[8].bit15 = "Not Defined";
10141                 pvalues[8].bit15hfname = hf_bit15infoflagsh;
10142                 pvalues[8].bit16 = "Not Defined";
10143                 pvalues[8].bit16hfname = hf_bit16infoflagsh;
10144                 foffset = foffset+2;
10145             }
10146             break;
10147         case 0x07:
10148             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
10149             pvalues[0].vstring = "";
10150             pvalues[0].vtype = VTYPE_UINT32;
10151             pvalues[0].vdesc = "Version: %u";
10152             pvalues[0].vlength = 4;
10153             pvalues[0].voffset = foffset;
10154             pvalues[0].hfname= hf_nds_ver;
10155             foffset = foffset+pvalues[0].vlength;
10156             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
10157             pvalues[1].vtype = VTYPE_UINT32;
10158             pvalues[1].vstring = "";
10159             pvalues[1].vdesc = "Request Flags: 0x%08x";
10160             pvalues[1].vlength = 4;
10161             pvalues[1].hfname= hf_nds_rflags;
10162             pvalues[1].voffset = foffset;
10163             foffset = foffset+4;
10164             if(pvalues[0].vvalue == 0)
10165             {
10166                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
10167                 pvalues[2].vstring = "";
10168                 pvalues[2].vtype = VTYPE_UINT32;
10169                 pvalues[2].vdesc = "Parent Entry ID: 0x%08x";
10170                 pvalues[2].vlength = 4;
10171                 resolve_eid = FALSE;
10172                 global_eid = pvalues[2].vvalue;
10173                 pvalues[2].voffset = foffset;
10174                 pvalues[2].hfname= hf_nds_eid;
10175                 foffset = foffset+pvalues[2].vlength;
10176                 pvalues[3].vtype = VTYPE_STRING;
10177                 pvalues[3].vdesc = "Relative Distinguished Name: %s";
10178                 pvalues[3].vstring = "";
10179                 pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
10180                 pvalues[3].vvalue = 0;
10181                 pvalues[3].vlength = 256;
10182                 pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
10183                 if (pvalues[3].vlength == 0x00 || !tvb_bytes_exist(tvb, foffset, pvalues[3].vlength))
10184                 {
10185                     pvalues[3].vtype = VTYPE_NONE;
10186                     break;
10187                 }
10188                 pvalues[3].voffset = foffset+4;
10189                 foffset = foffset + 4;
10190                 pvalues[3].vstring = get_string(tvb, pvalues[3].voffset, pvalues[3].vlength);
10191                 g_strlcpy(global_object_name, pvalues[3].vstring, 256);
10192                 pvalues[3].hfname= hf_nds_relative_dn;
10193                 foffset = foffset+pvalues[3].vlength;
10194                 foffset += align_4(tvb, foffset);
10195                 pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
10196                 pvalues[4].vtype = VTYPE_MULTIVALUE_UINT32;
10197                 pvalues[4].vstring = "";
10198                 pvalues[4].vdesc = "Attributes: %u";
10199                 pvalues[4].vlength = 4;
10200                 pvalues[4].voffset = foffset;
10201                 pvalues[4].mvtype = MVTYPE_ADD_ATTR_REQUEST;
10202                 pvalues[4].hfname= hf_nds_attr;
10203             }
10204             else
10205             {
10206                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
10207                 pvalues[2].vstring = "";
10208                 pvalues[2].vtype = VTYPE_UINT32;
10209                 pvalues[2].vdesc = "Iteration Handle: 0x%08x";
10210                 pvalues[2].vlength = 4;
10211                 pvalues[2].voffset = foffset;
10212                 pvalues[2].hfname= hf_nds_iteration;
10213                 foffset = foffset+pvalues[2].vlength;
10214                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
10215                 pvalues[3].vstring = "";
10216                 pvalues[3].vtype = VTYPE_UINT32;
10217                 pvalues[3].vdesc = "Parent Entry ID: 0x%08x";
10218                 pvalues[3].vlength = 4;
10219                 resolve_eid = FALSE;
10220                 global_eid = pvalues[3].vvalue;
10221                 pvalues[3].voffset = foffset;
10222                 pvalues[3].hfname= hf_nds_eid;
10223                 foffset = foffset+pvalues[3].vlength;
10224                 pvalues[4].vtype = VTYPE_STRING;
10225                 pvalues[4].vdesc = "Relative Distinguished Name: %s";
10226                 pvalues[4].vstring = "";
10227                 pvalues[4].mvtype = MVTYPE_ATTR_REQUEST;
10228                 pvalues[4].vvalue = 0;
10229                 pvalues[4].vlength = 256;
10230                 pvalues[4].vlength = tvb_get_letohl(tvb, foffset);
10231                 if (pvalues[4].vlength == 0x00 || !tvb_bytes_exist(tvb, foffset, pvalues[4].vlength))
10232                 {
10233                     pvalues[4].vtype = VTYPE_NONE;
10234                     break;
10235                 }
10236                 pvalues[4].voffset = foffset+4;
10237                 foffset = foffset + 4;
10238                 pvalues[4].vstring = get_string(tvb, pvalues[4].voffset, pvalues[4].vlength);
10239                 g_strlcpy(global_object_name, pvalues[4].vstring, 256);
10240                 pvalues[4].hfname= hf_nds_relative_dn;
10241                 foffset = foffset+pvalues[4].vlength;
10242                 foffset += align_4(tvb, foffset);
10243                 pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
10244                 pvalues[5].vtype = VTYPE_MULTIVALUE_UINT32;
10245                 pvalues[5].vstring = "";
10246                 pvalues[5].vdesc = "Attributes: %u";
10247                 pvalues[5].vlength = 4;
10248                 pvalues[5].voffset = foffset;
10249                 pvalues[5].mvtype = MVTYPE_ADD_ATTR_REQUEST;
10250                 pvalues[5].hfname= hf_nds_attr;
10251             }
10252             break;
10253         case 0x08:
10254             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
10255             pvalues[0].vtype = VTYPE_UINT32;
10256             pvalues[0].vdesc = "Version: %u";
10257             pvalues[0].vlength = 4;
10258             pvalues[0].voffset = foffset;
10259             pvalues[0].hfname= hf_nds_ver;
10260             foffset = foffset+pvalues[0].vlength;
10261             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
10262             pvalues[1].vtype = VTYPE_UINT32;
10263             pvalues[1].vdesc = "Entry ID: 0x%08x";
10264             pvalues[1].vlength = 4;
10265             resolve_eid = TRUE;
10266             global_eid = pvalues[1].vvalue;
10267             pvalues[1].voffset = foffset;
10268             pvalues[1].hfname= hf_nds_eid;
10269             foffset = foffset+pvalues[1].vlength;
10270             break;
10271         case 0x09:
10272             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
10273             pvalues[0].vtype = VTYPE_UINT32;
10274             pvalues[0].vdesc = "Version: %u";
10275             pvalues[0].vlength = 4;
10276             pvalues[0].voffset = foffset;
10277             pvalues[0].hfname= hf_nds_ver;
10278             foffset = foffset+pvalues[0].vlength;
10279             if(pvalues[0].vvalue == 0)
10280             {
10281                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
10282                 pvalues[1].vtype = VTYPE_UINT32;
10283                 pvalues[1].vstring = "";
10284                 pvalues[1].vdesc = "Iteration Handle: 0x%08x";  /* always 0 */
10285                 pvalues[1].vlength = 4;
10286                 pvalues[1].hfname= hf_nds_iteration;
10287                 pvalues[1].voffset = foffset;
10288                 foffset = foffset+4;
10289                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
10290                 pvalues[2].vstring = "";
10291                 pvalues[2].vtype = VTYPE_UINT32;
10292                 pvalues[2].vdesc = "Entry ID: 0x%08x";
10293                 pvalues[2].vlength = 4;
10294                 pvalues[2].voffset = foffset;
10295                 resolve_eid = TRUE;
10296                 global_eid = pvalues[2].vvalue;
10297                 pvalues[2].hfname = hf_nds_eid;
10298                 foffset = foffset+pvalues[2].vlength;
10299                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
10300                 pvalues[3].vtype = VTYPE_MULTIVALUE_UINT32;
10301                 pvalues[3].vstring = "";
10302                 pvalues[3].vdesc = "Number of Attributes to Change %u";
10303                 pvalues[3].vlength = 4;
10304                 pvalues[3].mvtype = MVTYPE_MODIFY_ATTR_REQUEST;
10305                 pvalues[3].hfname= hf_nds_number_of_changes;
10306                 pvalues[3].voffset = foffset;
10307             }
10308             else
10309             {
10310                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
10311                 pvalues[1].vtype = VTYPE_UINT32;
10312                 pvalues[1].vstring = "";
10313                 pvalues[1].vdesc = "Request Flags: 0x%08x";  /* always 0 */
10314                 pvalues[1].vlength = 4;
10315                 pvalues[1].hfname= hf_nds_rflags;
10316                 pvalues[1].voffset = foffset;
10317                 foffset = foffset+4;
10318                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
10319                 pvalues[2].vtype = VTYPE_UINT32;
10320                 pvalues[2].vstring = "";
10321                 pvalues[2].vdesc = "Iteration Handle: 0x%08x";  /* always 0 */
10322                 pvalues[2].vlength = 4;
10323                 pvalues[2].hfname= hf_nds_iteration;
10324                 pvalues[2].voffset = foffset;
10325                 foffset = foffset+4;
10326                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
10327                 pvalues[3].vstring = "";
10328                 pvalues[3].vtype = VTYPE_UINT32;
10329                 pvalues[3].vdesc = "Entry ID: 0x%08x";
10330                 pvalues[3].vlength = 4;
10331                 pvalues[3].voffset = foffset;
10332                 resolve_eid = TRUE;
10333                 global_eid = pvalues[3].vvalue;
10334                 pvalues[3].hfname = hf_nds_eid;
10335                 foffset = foffset+pvalues[3].vlength;
10336                 pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
10337                 pvalues[4].vtype = VTYPE_MULTIVALUE_UINT32;
10338                 pvalues[4].vstring = "";
10339                 pvalues[4].vdesc = "Number of Attributes to Change %u";
10340                 pvalues[4].vlength = 4;
10341                 pvalues[4].mvtype = MVTYPE_MODIFY_ATTR_REQUEST;
10342                 pvalues[4].hfname= hf_nds_number_of_changes;
10343                 pvalues[4].voffset = foffset;
10344             }
10345             break;
10346         case 0x0a:
10347             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
10348             pvalues[0].vtype = VTYPE_UINT32;
10349             pvalues[0].vdesc = "Version: %u";
10350             pvalues[0].vlength = 4;
10351             pvalues[0].voffset = foffset;
10352             pvalues[0].hfname= hf_nds_ver;
10353             foffset = foffset+pvalues[0].vlength;
10354             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
10355             pvalues[1].vtype = VTYPE_UINT32;
10356             pvalues[1].vdesc = "Entry ID: 0x%08x";
10357             pvalues[1].vlength = 4;
10358             resolve_eid = TRUE;
10359             global_eid = pvalues[1].vvalue;
10360             pvalues[1].voffset = foffset;
10361             pvalues[1].hfname = hf_nds_eid;
10362             foffset = foffset+pvalues[1].vlength;
10363             pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
10364             pvalues[2].vtype = VTYPE_BOOLEAN;
10365             pvalues[2].vdesc = "Keep Original RDN: %s";
10366             pvalues[2].vlength = 4;
10367             pvalues[2].voffset = foffset;
10368             pvalues[2].mvtype = 0;
10369             pvalues[2].hfname= hf_nds_keep;
10370             foffset = foffset+4;
10371             foffset += align_4(tvb, foffset);
10372             pvalues[3].vtype = VTYPE_STRING;
10373             pvalues[3].vdesc = "New RDN: %s";
10374             pvalues[3].mvtype = 0;
10375             pvalues[3].vvalue = 0;
10376             pvalues[3].vlength = 256;
10377             pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
10378             pvalues[3].voffset = foffset+4;
10379             foffset = foffset + 4;
10380             pvalues[3].vstring = get_string(tvb, pvalues[3].voffset, pvalues[3].vlength);
10381             pvalues[3].hfname= hf_nds_new_rdn;
10382             foffset = foffset+pvalues[3].vlength;
10383             break;
10384         case 0x0b:
10385             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
10386             pvalues[0].vtype = VTYPE_UINT32;
10387             pvalues[0].vdesc = "Version: %u";
10388             pvalues[0].vlength = 4;
10389             pvalues[0].voffset = foffset;
10390             pvalues[0].hfname= hf_nds_ver;
10391             foffset = foffset+pvalues[0].vlength;
10392             pvalues[1].vvalue = tvb_get_letohs(tvb, foffset);
10393             global_flags = tvb_get_letohl(tvb, foffset);
10394             pvalues[1].vtype = VTYPE_BITFIELD;
10395             pvalues[1].vdesc = "Attribute Constraints:";
10396             pvalues[1].vlength = 2;
10397             pvalues[1].hfname= hf_nds_acflags;
10398             pvalues[1].voffset = foffset;
10399             pvalues[1].bit1 = "Single Valued";
10400             pvalues[1].bit1hfname = hf_bit1acflags;
10401             pvalues[1].bit2 = "Sized";
10402             pvalues[1].bit2hfname = hf_bit2acflags;
10403             pvalues[1].bit3 = "Non-Removable";
10404             pvalues[1].bit3hfname = hf_bit3acflags;
10405             pvalues[1].bit4 = "Read Only";
10406             pvalues[1].bit4hfname = hf_bit4acflags;
10407             pvalues[1].bit5 = "Hidden";
10408             pvalues[1].bit5hfname = hf_bit5acflags;
10409             pvalues[1].bit6 = "String";
10410             pvalues[1].bit6hfname = hf_bit6acflags;
10411             pvalues[1].bit7 = "Synchronize Immediate";
10412             pvalues[1].bit7hfname = hf_bit7acflags;
10413             pvalues[1].bit8 = "Public Read";
10414             pvalues[1].bit8hfname = hf_bit8acflags;
10415             pvalues[1].bit9 = "Server Read";
10416             pvalues[1].bit9hfname = hf_bit9acflags;
10417             pvalues[1].bit10 = "Write Managed";
10418             pvalues[1].bit10hfname = hf_bit10acflags;
10419             pvalues[1].bit11 = "Per Replica";
10420             pvalues[1].bit11hfname = hf_bit11acflags;
10421             pvalues[1].bit12 = "Never Schedule Synchronization";
10422             pvalues[1].bit12hfname = hf_bit12acflags;
10423             pvalues[1].bit13 = "Operational";
10424             pvalues[1].bit13hfname = hf_bit13acflags;
10425             pvalues[1].bit14 = "Not Defined";
10426             pvalues[1].bit14hfname = hf_bit14acflags;
10427             pvalues[1].bit15 = "Not Defined";
10428             pvalues[1].bit15hfname = hf_bit15acflags;
10429             pvalues[1].bit16 = "Not Defined";
10430             pvalues[1].bit16hfname = hf_bit16acflags;
10431             foffset = foffset+4;
10432             pvalues[2].vtype = VTYPE_STRING;
10433             pvalues[2].vdesc = "Attribute Name: %s";
10434             pvalues[2].mvtype = MVTYPE_ATTR_REQUEST;
10435             pvalues[2].vvalue = 0;
10436             pvalues[2].vlength = 256;
10437             pvalues[2].vlength = tvb_get_letohl(tvb, foffset);
10438             if (pvalues[2].vlength == 0x00 || !tvb_bytes_exist(tvb, foffset, pvalues[2].vlength))
10439             {
10440                 pvalues[2].vtype = VTYPE_NONE;
10441                 break;
10442             }
10443             pvalues[2].voffset = foffset+4;
10444             foffset = foffset + 4;
10445             pvalues[2].vstring = get_string(tvb, pvalues[2].voffset, pvalues[2].vlength);
10446             g_strlcpy(global_object_name, pvalues[2].vstring, 256);
10447             pvalues[2].hfname= hf_nds_name;
10448             foffset = foffset+pvalues[2].vlength;
10449             foffset += align_4(tvb, foffset);
10450             pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
10451             pvalues[3].vstring = val_to_str_const(pvalues[3].vvalue, nds_syntax, "No Syntax Found");
10452             pvalues[3].vtype = VTYPE_STRING;
10453             pvalues[3].vdesc = "Syntax: %s";
10454             pvalues[3].vlength = 4;
10455             pvalues[3].voffset = foffset;
10456             pvalues[3].hfname= hf_nds_syntax;
10457             pvalues[3].mvtype = 0;
10458             foffset = foffset+pvalues[3].vlength;
10459             pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
10460             pvalues[4].vtype = VTYPE_UINT32;
10461             pvalues[4].vdesc = "Lower Limit Value %u";
10462             pvalues[4].vlength = 4;
10463             pvalues[4].voffset = foffset;
10464             pvalues[4].hfname = hf_nds_lower;
10465             foffset += 4;
10466             pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
10467             pvalues[5].vtype = VTYPE_UINT32;
10468             pvalues[5].vdesc = "Upper Limit Value %u";
10469             pvalues[5].vlength = 4;
10470             pvalues[5].voffset = foffset;
10471             pvalues[5].hfname = hf_nds_upper;
10472             foffset += 4;
10473             pvalues[6].vvalue = tvb_get_letohl(tvb, foffset); /* Length of bytes field */
10474             foffset += 4;
10475             pvalues[6].vtype = VTYPE_BYTES;
10476             pvalues[6].vdesc = "ASN.1 ID";
10477             pvalues[6].vlength = pvalues[6].vvalue;
10478             pvalues[6].voffset = foffset;
10479             pvalues[6].hfname = hf_nds_asn1;
10480             break;
10481         case 0x0c:
10482             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
10483             break;
10484         case 0x0d:
10485             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
10486             pvalues[0].vtype = VTYPE_UINT32;
10487             pvalues[0].vdesc = "Version: %u";
10488             pvalues[0].vlength = 4;
10489             pvalues[0].voffset = foffset;
10490             pvalues[0].hfname= hf_nds_ver;
10491             foffset = foffset+pvalues[0].vlength;
10492             pvalues[1].vtype = VTYPE_STRING;
10493             pvalues[1].vdesc = "Attribute Name: %s";
10494             pvalues[1].mvtype = MVTYPE_ATTR_REQUEST;
10495             pvalues[1].vvalue = 0;
10496             pvalues[1].vlength = 256;
10497             pvalues[1].vlength = tvb_get_letohl(tvb, foffset);
10498             if (pvalues[1].vlength == 0x00 || !tvb_bytes_exist(tvb, foffset, pvalues[1].vlength))
10499             {
10500                 pvalues[1].vtype = VTYPE_NONE;
10501                 break;
10502             }
10503             pvalues[1].voffset = foffset+4;
10504             foffset = foffset + 4;
10505             pvalues[1].vstring = get_string(tvb, pvalues[1].voffset, pvalues[1].vlength);
10506             g_strlcpy(global_object_name, pvalues[1].vstring, 256);
10507             pvalues[1].hfname= hf_nds_attribute_dn;
10508             break;
10509         case 0x0e:
10510             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
10511             break;
10512         case 0x0f:
10513             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
10514             pvalues[0].vtype = VTYPE_UINT32;
10515             pvalues[0].vdesc = "Version: %u";
10516             pvalues[0].vlength = 4;
10517             pvalues[0].voffset = foffset;
10518             pvalues[0].hfname= hf_nds_ver;
10519             foffset = foffset+pvalues[0].vlength;
10520             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
10521             pvalues[1].vtype = VTYPE_UINT32;
10522             pvalues[1].vdesc = "Iteration Handle: 0x%08x";
10523             pvalues[1].vlength = 4;
10524             pvalues[1].voffset = foffset;
10525             pvalues[1].hfname= hf_nds_iteration;
10526             foffset = foffset+pvalues[1].vlength;
10527             pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
10528             global_flags = pvalues[2].vvalue;
10529             pvalues[2].vstring = val_to_str_const(pvalues[2].vvalue, class_def_type, "No Class Definition Type Set");
10530             pvalues[2].vtype = VTYPE_STRING;
10531             pvalues[2].vdesc = "Class Definition Type: %s";
10532             pvalues[2].vlength = 4;
10533             pvalues[2].voffset = foffset;
10534             pvalues[2].mvtype = 0;
10535             pvalues[2].hfname= hf_nds_class_def_type;
10536             foffset = foffset + pvalues[2].vlength;
10537             pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
10538             if (pvalues[3].vvalue == 0x00000000)
10539             {
10540                 pvalues[3].vstring = "Do Not Return All Classes";
10541                 pvalues[3].mvtype = 0;
10542             }
10543             else
10544             {
10545                 pvalues[3].vstring = "Return All Classes";
10546                 pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
10547             }
10548             pvalues[3].vtype = VTYPE_STRING;
10549             pvalues[3].vdesc = "%s";
10550             pvalues[3].vlength = 4;
10551             pvalues[3].voffset = foffset;
10552             pvalues[3].hfname= hf_nds_return_all_classes;
10553             foffset = foffset + pvalues[3].vlength;
10554             foffset += align_4(tvb, foffset);
10555             pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
10556             pvalues[4].vtype = VTYPE_MULTIVALUE_UINT32;
10557             pvalues[4].vdesc = "Classes: %u";
10558             pvalues[4].vlength = 4;
10559             pvalues[4].voffset = foffset;
10560             pvalues[4].mvtype = MVTYPE_READ_CLASS_REQ;
10561             pvalues[4].hfname= hf_nds_classes;
10562             break;
10563         case 0x10:
10564             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
10565             pvalues[0].vtype = VTYPE_UINT32;
10566             pvalues[0].vdesc = "Version: %u";
10567             pvalues[0].vlength = 4;
10568             pvalues[0].voffset = foffset;
10569             pvalues[0].hfname= hf_nds_ver;
10570             foffset = foffset+pvalues[0].vlength;
10571             pvalues[1].vtype = VTYPE_STRING;
10572             pvalues[1].vdesc = "Class Name: %s";
10573             pvalues[1].mvtype = MVTYPE_ATTR_REQUEST;
10574             pvalues[1].vvalue = 0;
10575             pvalues[1].vlength = 256;
10576             pvalues[1].vlength = tvb_get_letohl(tvb, foffset);
10577             if (pvalues[1].vlength == 0x00 || !tvb_bytes_exist(tvb, foffset, pvalues[1].vlength))
10578             {
10579                 pvalues[1].vtype = VTYPE_NONE;
10580                 break;
10581             }
10582             pvalues[1].voffset = foffset+4;
10583             foffset = foffset + 4;
10584             pvalues[1].vstring = get_string(tvb, pvalues[1].voffset, pvalues[1].vlength);
10585             g_strlcpy(global_object_name, pvalues[1].vstring, 256);
10586             pvalues[1].hfname= hf_nds_base_class;
10587             foffset = foffset+pvalues[1].vlength;
10588             foffset += align_4(tvb, foffset);
10589             pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
10590             pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
10591             pvalues[2].vdesc = "Number of Attributes to Add: %u";
10592             pvalues[2].vlength = 4;
10593             pvalues[2].voffset = foffset;
10594             pvalues[2].mvtype = MVTYPE_MODIFY_CLASS;
10595             pvalues[2].hfname= hf_nds_att_add;
10596             break;
10597         case 0x11:
10598             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
10599             pvalues[0].vtype = VTYPE_UINT32;
10600             pvalues[0].vdesc = "Version: %u";
10601             pvalues[0].vlength = 4;
10602             pvalues[0].voffset = foffset;
10603             pvalues[0].hfname= hf_nds_ver;
10604             foffset = foffset+pvalues[0].vlength;
10605             pvalues[1].vtype = VTYPE_STRING;
10606             pvalues[1].vdesc = "Class Name: %s";
10607             pvalues[1].mvtype = MVTYPE_ATTR_REQUEST;
10608             pvalues[1].vvalue = 0;
10609             pvalues[1].vlength = 256;
10610             pvalues[1].vlength = tvb_get_letohl(tvb, foffset);
10611             if (pvalues[1].vlength == 0x00 || !tvb_bytes_exist(tvb, foffset, pvalues[1].vlength))
10612             {
10613                 pvalues[1].vtype = VTYPE_NONE;
10614                 break;
10615             }
10616             pvalues[1].voffset = foffset+4;
10617             foffset = foffset + 4;
10618             pvalues[1].vstring = get_string(tvb, pvalues[1].voffset, pvalues[1].vlength);
10619             g_strlcpy(global_object_name, pvalues[1].vstring, 256);
10620             pvalues[1].hfname= hf_nds_base;
10621             break;
10622         case 0x12:
10623             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
10624             pvalues[0].vtype = VTYPE_UINT32;
10625             pvalues[0].vdesc = "Version: %u";
10626             pvalues[0].vlength = 4;
10627             pvalues[0].voffset = foffset;
10628             pvalues[0].hfname= hf_nds_ver;
10629             foffset = foffset+pvalues[0].vlength;
10630             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
10631             pvalues[1].vtype = VTYPE_UINT32;
10632             pvalues[1].vdesc = "Iteration Handle: 0x%08x";
10633             pvalues[1].vlength = 4;
10634             pvalues[1].voffset = foffset;
10635             pvalues[1].hfname= hf_nds_iteration;
10636             foffset = foffset+pvalues[1].vlength;
10637             pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
10638             pvalues[2].vtype = VTYPE_UINT32;
10639             pvalues[2].vdesc = "Entry ID: 0x%08x";
10640             pvalues[2].vlength = 4;
10641             resolve_eid = TRUE;
10642             global_eid = pvalues[2].vvalue;
10643             pvalues[2].voffset = foffset;
10644             pvalues[2].hfname= hf_nds_eid;
10645             foffset = foffset+pvalues[2].vlength;
10646             break;
10647         case 0x13:
10648             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
10649             pvalues[0].vtype = VTYPE_UINT32;
10650             pvalues[0].vdesc = "Version: %u";
10651             pvalues[0].vlength = 4;
10652             pvalues[0].voffset = foffset;
10653             pvalues[0].hfname= hf_nds_ver;
10654             foffset = foffset+pvalues[0].vlength;
10655             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
10656             pvalues[1].vtype = VTYPE_UINT32;
10657             pvalues[1].vdesc = "Entry ID: 0x%08x";
10658             pvalues[1].vlength = 4;
10659             resolve_eid = TRUE;
10660             global_eid = pvalues[1].vvalue;
10661             pvalues[1].voffset = foffset;
10662             pvalues[1].hfname= hf_nds_eid;
10663             foffset = foffset+pvalues[1].vlength;
10664             pvalues[2].vtype = VTYPE_STRING;
10665             pvalues[2].vdesc = "Trustee Name: %s";
10666             pvalues[2].mvtype = MVTYPE_ATTR_REQUEST;
10667             pvalues[2].vvalue = 0;
10668             pvalues[2].vlength = 256;
10669             pvalues[2].vlength = tvb_get_letohl(tvb, foffset);
10670             if (pvalues[2].vlength == 0x00 || !tvb_bytes_exist(tvb, foffset, pvalues[2].vlength))
10671             {
10672                 pvalues[2].vtype = VTYPE_NONE;
10673                 break;
10674             }
10675             pvalues[2].voffset = foffset+4;
10676             foffset = foffset + 4;
10677             pvalues[2].vstring = get_string(tvb, pvalues[2].voffset, pvalues[2].vlength);
10678             pvalues[2].hfname= hf_nds_name;
10679             foffset = foffset+pvalues[2].vlength;
10680             foffset += align_4(tvb, foffset);
10681             pvalues[3].vtype = VTYPE_STRING;
10682             pvalues[3].vdesc = "Attribute to be Checked: %s";
10683             pvalues[3].mvtype = 0;
10684             pvalues[3].vvalue = 0;
10685             pvalues[3].vlength = 256;
10686             pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
10687             if (pvalues[3].vlength == 0x00 || !tvb_bytes_exist(tvb, foffset, pvalues[3].vlength))
10688             {
10689                 pvalues[3].vtype = VTYPE_NONE;
10690                 break;
10691             }
10692             pvalues[3].voffset = foffset+4;
10693             foffset = foffset + 4;
10694             pvalues[3].vstring = get_string(tvb, pvalues[3].voffset, pvalues[3].vlength);
10695             pvalues[3].hfname= hf_nds_name;
10696             foffset = foffset+pvalues[3].vlength;
10697             foffset += align_4(tvb, foffset);
10698             if(pvalues[0].vvalue != 0)
10699             {
10700                 pvalues[4].vtype = VTYPE_STRING;
10701                 pvalues[4].vdesc = "Security Equivalence: %s";
10702                 pvalues[4].mvtype = MVTYPE_ATTR_REQUEST;
10703                 pvalues[4].vvalue = 0;
10704                 pvalues[4].vlength = 256;
10705                 pvalues[4].vlength = tvb_get_letohl(tvb, foffset);
10706                 if (pvalues[4].vlength == 0x00 || !tvb_bytes_exist(tvb, foffset, pvalues[4].vlength))
10707                 {
10708                     pvalues[4].vtype = VTYPE_NONE;
10709                     break;
10710                 }
10711                 pvalues[4].voffset = foffset+4;
10712                 foffset = foffset + 4;
10713                 pvalues[4].vstring = get_string(tvb, pvalues[4].voffset, pvalues[4].vlength);
10714                 pvalues[4].hfname= hf_nds_name;
10715                 foffset = foffset+pvalues[4].vlength;
10716                 foffset += align_4(tvb, foffset);
10717             }
10718             break;
10719         case 0x14:
10720             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
10721             break;
10722         case 0x15:
10723             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
10724             break;
10725         case 0x16:
10726             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
10727             pvalues[0].vtype = VTYPE_UINT32;
10728             pvalues[0].vdesc = "Version: %u";
10729             pvalues[0].vlength = 4;
10730             pvalues[0].voffset = foffset;
10731             pvalues[0].hfname= hf_nds_ver;
10732             foffset = foffset+pvalues[0].vlength;
10733             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
10734             pvalues[1].vtype = VTYPE_BITFIELD;
10735             pvalues[1].vdesc = "Request Flags:";
10736             pvalues[1].vlength = 2;
10737             pvalues[1].hfname= hf_nds_rflags;
10738             pvalues[1].voffset = foffset;
10739             pvalues[1].bit1 = "Typeless";
10740             pvalues[1].bit1hfname = hf_nds_bit1;
10741             pvalues[1].bit2 = "All Containers";
10742             pvalues[1].bit2hfname = hf_nds_bit2;
10743             pvalues[1].bit3 = "Slashed";
10744             pvalues[1].bit3hfname = hf_nds_bit3;
10745             pvalues[1].bit4 = "Dotted";
10746             pvalues[1].bit4hfname = hf_nds_bit4;
10747             pvalues[1].bit5 = "Tuned";
10748             pvalues[1].bit5hfname = hf_nds_bit5;
10749             pvalues[1].bit6 = "Not Defined";
10750             pvalues[1].bit6hfname = hf_nds_bit6;
10751             pvalues[1].bit7 = "Not Defined";
10752             pvalues[1].bit7hfname = hf_nds_bit7;
10753             pvalues[1].bit8 = "Not Defined";
10754             pvalues[1].bit8hfname = hf_nds_bit8;
10755             pvalues[1].bit9 = "Not Defined";
10756             pvalues[1].bit9hfname = hf_nds_bit9;
10757             pvalues[1].bit10 = "Not Defined";
10758             pvalues[1].bit10hfname = hf_nds_bit10;
10759             pvalues[1].bit11 = "Not Defined";
10760             pvalues[1].bit11hfname = hf_nds_bit11;
10761             pvalues[1].bit12 = "Not Defined";
10762             pvalues[1].bit12hfname = hf_nds_bit12;
10763             pvalues[1].bit13 = "Not Defined";
10764             pvalues[1].bit13hfname = hf_nds_bit13;
10765             pvalues[1].bit14 = "Not Defined";
10766             pvalues[1].bit14hfname = hf_nds_bit14;
10767             pvalues[1].bit15 = "Not Defined";
10768             pvalues[1].bit15hfname = hf_nds_bit15;
10769             pvalues[1].bit16 = "Not Defined";
10770             pvalues[1].bit16hfname = hf_nds_bit16;
10771             foffset = foffset+pvalues[1].vlength;
10772             pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
10773             pvalues[2].vtype = VTYPE_UINT32;
10774             pvalues[2].vdesc = "Iteration Handle: 0x%08x";
10775             pvalues[2].vlength = 4;
10776             pvalues[2].voffset = foffset;
10777             pvalues[2].hfname= hf_nds_iteration;
10778             foffset = foffset+pvalues[2].vlength;
10779             if(pvalues[0].vvalue == 0)
10780             {
10781                 global_flags = 0x000000c0;
10782                 break;
10783             }
10784             pvalues[3].vvalue = tvb_get_letohs(tvb, foffset);
10785             pvalues[3].vtype = VTYPE_BITFIELD;
10786             pvalues[3].vdesc = "Information Flags (low) Byte:";
10787             pvalues[3].vlength = 2;
10788             pvalues[3].hfname= hf_nds_rflags;
10789             pvalues[3].voffset = foffset;
10790             pvalues[3].bit1 = "Output Flags";
10791             pvalues[3].bit1hfname = hf_bit1l1flagsl;
10792             pvalues[3].bit2 = "Entry ID";
10793             pvalues[3].bit2hfname = hf_bit2l1flagsl;
10794             pvalues[3].bit3 = "Replica State";
10795             pvalues[3].bit3hfname = hf_bit3l1flagsl;
10796             pvalues[3].bit4 = "Modification Timestamp";
10797             pvalues[3].bit4hfname = hf_bit4l1flagsl;
10798             pvalues[3].bit5 = "Purge Time";
10799             pvalues[3].bit5hfname = hf_bit5l1flagsl;
10800             pvalues[3].bit6 = "Local Partition ID";
10801             pvalues[3].bit6hfname = hf_bit6l1flagsl;
10802             pvalues[3].bit7 = "Distinguished Name";
10803             pvalues[3].bit7hfname = hf_bit7l1flagsl;
10804             pvalues[3].bit8 = "Replica Type";
10805             pvalues[3].bit8hfname = hf_bit8l1flagsl;
10806             pvalues[3].bit9 = "Partition Busy";
10807             pvalues[3].bit9hfname = hf_bit9l1flagsl;
10808             pvalues[3].bit10 = "Not Defined";
10809             pvalues[3].bit10hfname = hf_bit10l1flagsl;
10810             pvalues[3].bit11 = "Not Defined";
10811             pvalues[3].bit11hfname = hf_bit11l1flagsl;
10812             pvalues[3].bit12 = "Not Defined";
10813             pvalues[3].bit12hfname = hf_bit12l1flagsl;
10814             pvalues[3].bit13 = "Not Defined";
10815             pvalues[3].bit13hfname = hf_bit13l1flagsl;
10816             pvalues[3].bit14 = "Not Defined";
10817             pvalues[3].bit14hfname = hf_bit14l1flagsl;
10818             pvalues[3].bit15 = "Not Defined";
10819             pvalues[3].bit15hfname = hf_bit15l1flagsl;
10820             pvalues[3].bit16 = "Not Defined";
10821             pvalues[3].bit16hfname = hf_bit16l1flagsl;
10822             global_flags = pvalues[3].vvalue;
10823             foffset = foffset+2;
10824             pvalues[4].vvalue = tvb_get_letohs(tvb, foffset);
10825             pvalues[4].vtype = VTYPE_BITFIELD;
10826             pvalues[4].vdesc = "Information Flags (high) Byte:";
10827             pvalues[4].vlength = 2;
10828             pvalues[4].hfname= hf_nds_rflags;
10829             pvalues[4].voffset = foffset;
10830             pvalues[4].bit1 = "Not Defined";
10831             pvalues[4].bit1hfname = hf_bit1l1flagsh;
10832             pvalues[4].bit2 = "Not Defined";
10833             pvalues[4].bit2hfname = hf_bit2l1flagsh;
10834             pvalues[4].bit3 = "Not Defined";
10835             pvalues[4].bit3hfname = hf_bit3l1flagsh;
10836             pvalues[4].bit4 = "Not Defined";
10837             pvalues[4].bit4hfname = hf_bit4l1flagsh;
10838             pvalues[4].bit5 = "Not Defined";
10839             pvalues[4].bit5hfname = hf_bit5l1flagsh;
10840             pvalues[4].bit6 = "Not Defined";
10841             pvalues[4].bit6hfname = hf_bit6l1flagsh;
10842             pvalues[4].bit7 = "Not Defined";
10843             pvalues[4].bit7hfname = hf_bit7l1flagsh;
10844             pvalues[4].bit8 = "Not Defined";
10845             pvalues[4].bit8hfname = hf_bit8l1flagsh;
10846             pvalues[4].bit9 = "Not Defined";
10847             pvalues[4].bit9hfname = hf_bit9l1flagsh;
10848             pvalues[4].bit10 = "Not Defined";
10849             pvalues[4].bit10hfname = hf_bit10l1flagsh;
10850             pvalues[4].bit11 = "Not Defined";
10851             pvalues[4].bit11hfname = hf_bit11l1flagsh;
10852             pvalues[4].bit12 = "Not Defined";
10853             pvalues[4].bit12hfname = hf_bit12l1flagsh;
10854             pvalues[4].bit13 = "Not Defined";
10855             pvalues[4].bit13hfname = hf_bit13l1flagsh;
10856             pvalues[4].bit14 = "Not Defined";
10857             pvalues[4].bit14hfname = hf_bit14l1flagsh;
10858             pvalues[4].bit15 = "Not Defined";
10859             pvalues[4].bit15hfname = hf_bit15l1flagsh;
10860             pvalues[4].bit16 = "Not Defined";
10861             pvalues[4].bit16hfname = hf_bit16l1flagsh;
10862             foffset = foffset+2;
10863             if(pvalues[0].vvalue == 1)
10864             {
10865                 break;
10866             }
10867             pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
10868             pvalues[5].vtype = VTYPE_UINT32;
10869             pvalues[5].vdesc = "Partition Root ID: 0x%08x";
10870             pvalues[5].vlength = 4;
10871             pvalues[5].voffset = foffset;
10872             pvalues[5].hfname= hf_nds_partition_root_id;
10873             foffset = foffset+pvalues[5].vlength;
10874             break;
10875         case 0x17:
10876             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
10877             pvalues[0].vtype = VTYPE_UINT32;
10878             pvalues[0].vdesc = "Version: %u";
10879             pvalues[0].vlength = 4;
10880             pvalues[0].hfname = hf_nds_ver;
10881             pvalues[0].voffset = foffset;
10882             foffset = foffset+pvalues[0].vlength;
10883             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
10884             pvalues[1].vtype = VTYPE_UINT32;
10885             pvalues[1].vdesc = "Flags: 0x%08x";
10886             pvalues[1].vlength = 4;
10887             pvalues[1].hfname = hf_nds_req_flags;
10888             pvalues[1].voffset = foffset;
10889             foffset = foffset+pvalues[1].vlength;
10890             pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
10891             pvalues[2].vtype = VTYPE_UINT32;
10892             pvalues[2].vdesc = "New Partition Root ID: 0x%08x";
10893             pvalues[2].vlength = 4;
10894             pvalues[2].voffset = foffset;
10895             pvalues[2].hfname= hf_nds_new_part_id;
10896             foffset = foffset+pvalues[2].vlength;
10897             break;
10898         case 0x18:
10899             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
10900             pvalues[0].vtype = VTYPE_UINT32;
10901             pvalues[0].vdesc = "Version: %u";
10902             pvalues[0].vlength = 4;
10903             pvalues[0].hfname = hf_nds_ver;
10904             pvalues[0].voffset = foffset;
10905             foffset = foffset+pvalues[0].vlength;
10906             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
10907             pvalues[1].vtype = VTYPE_UINT32;
10908             pvalues[1].vdesc = "Flags: 0x%08x";
10909             pvalues[1].vlength = 4;
10910             pvalues[1].hfname = hf_nds_req_flags;
10911             pvalues[1].voffset = foffset;
10912             foffset = foffset+pvalues[1].vlength;
10913             pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
10914             pvalues[2].vtype = VTYPE_UINT32;
10915             pvalues[2].vdesc = "Child Partition Root ID: 0x%08x";
10916             pvalues[2].vlength = 4;
10917             pvalues[2].voffset = foffset;
10918             pvalues[2].hfname= hf_nds_child_part_id;
10919             foffset = foffset+pvalues[2].vlength;
10920             break;
10921         case 0x19:
10922             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
10923             pvalues[0].vtype = VTYPE_UINT32;
10924             pvalues[0].vdesc = "Version: %u";
10925             pvalues[0].vlength = 4;
10926             pvalues[0].hfname = hf_nds_ver;
10927             pvalues[0].voffset = foffset;
10928             foffset = foffset+pvalues[0].vlength;
10929             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
10930             pvalues[1].vtype = VTYPE_UINT32;
10931             pvalues[1].vdesc = "Flags: 0x%08x";
10932             pvalues[1].vlength = 4;
10933             pvalues[1].hfname = hf_nds_req_flags;
10934             pvalues[1].voffset = foffset;
10935             foffset = foffset+pvalues[1].vlength;
10936             pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
10937             pvalues[2].vtype = VTYPE_UINT32;
10938             pvalues[2].vdesc = "Master Partition Root ID: 0x%08x";
10939             pvalues[2].vlength = 4;
10940             pvalues[2].voffset = foffset;
10941             pvalues[2].hfname= hf_nds_master_part_id;
10942             foffset = foffset+pvalues[2].vlength;
10943             pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
10944             pvalues[3].vstring = val_to_str_const(pvalues[3].vvalue, nds_replica_type, "No Replica Type Found");
10945             pvalues[3].vtype = VTYPE_STRING;
10946             pvalues[3].vdesc = "Replica Type: %s";
10947             pvalues[3].vlength = 4;
10948             pvalues[3].voffset = foffset;
10949             pvalues[3].mvtype = 0;
10950             pvalues[3].hfname= hf_replica_type;
10951             foffset = foffset + pvalues[3].vlength;
10952             pvalues[4].vtype = VTYPE_STRING;
10953             pvalues[4].vdesc = "Target Server Name: %s";
10954             pvalues[4].mvtype = 0;
10955             pvalues[4].vvalue = 0;
10956             pvalues[4].vlength = 256;
10957             pvalues[4].vlength = tvb_get_letohl(tvb, foffset);
10958             if (pvalues[4].vlength == 0x00 && !tvb_bytes_exist(tvb, foffset, pvalues[4].vlength))
10959             {
10960                 pvalues[4].vtype = VTYPE_NONE;
10961                 break;
10962             }
10963             pvalues[4].voffset = foffset+4;
10964             foffset = foffset + 4;
10965             pvalues[4].vstring = get_string(tvb, pvalues[4].voffset, pvalues[4].vlength);
10966             pvalues[4].hfname= hf_nds_target_name;
10967             break;
10968         case 0x1a:
10969             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
10970             break;
10971         case 0x1b:
10972             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
10973             pvalues[0].vtype = VTYPE_UINT32;
10974             pvalues[0].vdesc = "Version: %u";
10975             pvalues[0].vlength = 4;
10976             pvalues[0].hfname = hf_nds_ver;
10977             pvalues[0].voffset = foffset;
10978             foffset = foffset+pvalues[0].vlength;
10979             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
10980             pvalues[1].vtype = VTYPE_UINT32;
10981             pvalues[1].vdesc = "Streams Flags: 0x%08x";
10982             pvalues[1].vlength = 4;
10983             pvalues[1].hfname = hf_nds_stream_flags;
10984             pvalues[1].voffset = foffset;
10985             foffset = foffset+pvalues[1].vlength;
10986             pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
10987             pvalues[2].vtype = VTYPE_UINT32;
10988             pvalues[2].vdesc = "Entry ID: 0x%08x";
10989             pvalues[2].vlength = 4;
10990             resolve_eid = TRUE;
10991             global_eid = pvalues[2].vvalue;
10992             pvalues[2].voffset = foffset;
10993             pvalues[2].hfname= hf_nds_eid;
10994             foffset = foffset+pvalues[2].vlength;
10995             pvalues[3].vtype = VTYPE_STRING;
10996             pvalues[3].vdesc = "Stream Name: %s";
10997             pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
10998             pvalues[3].vvalue = 0;
10999             pvalues[3].vlength = 256;
11000             pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
11001             if (pvalues[3].vlength == 0x00 || !tvb_bytes_exist(tvb, foffset, pvalues[3].vlength))
11002             {
11003                 pvalues[3].vtype = VTYPE_NONE;
11004                 break;
11005             }
11006             pvalues[3].voffset = foffset+4;
11007             foffset += 4;
11008             pvalues[3].vstring = get_string(tvb, pvalues[3].voffset, pvalues[3].vlength);
11009             foffset += pvalues[3].vlength;
11010             foffset += align_4(tvb, foffset);
11011             pvalues[3].hfname= hf_nds_stream_name;
11012             break;
11013         case 0x1c:
11014             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11015             break;
11016         case 0x1d:
11017             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11018             break;
11019         case 0x1e:
11020             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11021             break;
11022         case 0x1f:
11023             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11024             break;
11025         case 0x20:
11026             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11027             break;
11028         case 0x21:
11029             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11030             break;
11031         case 0x22:
11032             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11033             break;
11034         case 0x23:
11035             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11036             break;
11037         case 0x24:
11038             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11039             break;
11040         case 0x25:
11041             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11042             break;
11043         case 0x26:
11044             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
11045             pvalues[0].vtype = VTYPE_UINT32;
11046             pvalues[0].vdesc = "Version: %u";
11047             pvalues[0].vlength = 4;
11048             pvalues[0].hfname = hf_nds_ver;
11049             pvalues[0].voffset = foffset;
11050             foffset = foffset+pvalues[0].vlength;
11051             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
11052             pvalues[1].vtype = VTYPE_UINT32;
11053             pvalues[1].vdesc = "Flags: 0x%08x";
11054             pvalues[1].vlength = 4;
11055             pvalues[1].hfname = hf_nds_req_flags;
11056             pvalues[1].voffset = foffset;
11057             foffset = foffset+pvalues[1].vlength;
11058             pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
11059             pvalues[2].vtype = VTYPE_UINT32;
11060             pvalues[2].vdesc = "Time Delay in Seconds: %u";
11061             pvalues[2].vlength = 4;
11062             pvalues[2].voffset = foffset;
11063             pvalues[2].hfname= hf_nds_time_delay;
11064             foffset = foffset+pvalues[2].vlength;
11065             if(pvalues[0].vvalue == 0)
11066             {
11067                 pvalues[3].vtype = VTYPE_STRING;
11068                 pvalues[3].vdesc = "Root Most Object Name: %s";
11069                 pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
11070                 pvalues[3].vvalue = 0;
11071                 pvalues[3].vlength = 256;
11072                 pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
11073                 if (pvalues[3].vlength == 0x00 || !tvb_bytes_exist(tvb, foffset, pvalues[3].vlength))
11074                 {
11075                     pvalues[3].vtype = VTYPE_NONE;
11076                     break;
11077                 }
11078                 pvalues[3].voffset = foffset+4;
11079                 foffset += 4;
11080                 pvalues[3].vstring = get_string(tvb, pvalues[3].voffset, pvalues[3].vlength);
11081                 foffset += pvalues[3].vlength;
11082                 foffset += align_4(tvb, foffset);
11083                 pvalues[3].hfname= hf_nds_root_name;
11084             }
11085             else
11086             {
11087                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
11088                 pvalues[3].vtype = VTYPE_UINT32;
11089                 pvalues[3].vdesc = "Entry ID: 0x%08x";
11090                 pvalues[3].vlength = 4;
11091                 resolve_eid = TRUE;
11092                 global_eid = pvalues[3].vvalue;
11093                 pvalues[3].voffset = foffset;
11094                 pvalues[3].hfname= hf_nds_eid;
11095                 foffset = foffset+pvalues[3].vlength;
11096                 resolve_eid = TRUE;
11097                 global_eid = pvalues[3].vvalue;
11098             }
11099             break;
11100         case 0x27:
11101             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11102             break;
11103         case 0x28:
11104             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11105             break;
11106         case 0x29:
11107             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11108             break;
11109         case 0x2a:
11110             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
11111             pvalues[0].vtype = VTYPE_UINT32;
11112             pvalues[0].vdesc = "Version: %u";
11113             pvalues[0].vlength = 4;
11114             pvalues[0].hfname = hf_nds_ver;
11115             pvalues[0].voffset = foffset;
11116             foffset = foffset+pvalues[0].vlength;
11117             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
11118             pvalues[1].vtype = VTYPE_UINT32;
11119             pvalues[1].vdesc = "Flags: 0x%08x";
11120             pvalues[1].vlength = 4;
11121             pvalues[1].hfname = hf_nds_req_flags;
11122             pvalues[1].voffset = foffset;
11123             foffset = foffset+pvalues[1].vlength;
11124             pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
11125             pvalues[2].vtype = VTYPE_UINT32;
11126             pvalues[2].vdesc = "Destination Parent Entry ID: 0x%08x";
11127             pvalues[2].vlength = 4;
11128             resolve_eid = TRUE;
11129             global_eid = pvalues[2].vvalue;
11130             pvalues[2].voffset = foffset;
11131             pvalues[2].hfname= hf_nds_eid;
11132             foffset = foffset+pvalues[2].vlength;
11133             global_eid = pvalues[2].vvalue;
11134             pvalues[3].vtype = VTYPE_STRING;
11135             pvalues[3].vdesc = "New RDN: %s";
11136             pvalues[3].mvtype = 0;
11137             pvalues[3].vvalue = 0;
11138             pvalues[3].vlength = 256;
11139             pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
11140             pvalues[3].voffset = foffset+4;
11141             foffset = foffset + 4;
11142             pvalues[3].vstring = get_string(tvb, pvalues[3].voffset, pvalues[3].vlength);
11143             pvalues[3].hfname= hf_nds_new_rdn;
11144             foffset = foffset+pvalues[3].vlength;
11145             foffset += align_4(tvb, foffset);
11146             pvalues[4].vtype = VTYPE_STRING;
11147             pvalues[4].vdesc = "Source Server Name: %s";
11148             pvalues[4].mvtype = 0;
11149             pvalues[4].vvalue = 0;
11150             pvalues[4].vlength = 256;
11151             pvalues[4].vlength = tvb_get_letohl(tvb, foffset);
11152             if (pvalues[4].vlength == 0x00 || !tvb_bytes_exist(tvb, foffset, pvalues[3].vlength))
11153             {
11154                 pvalues[4].vtype = VTYPE_NONE;
11155                 break;
11156             }
11157             pvalues[4].voffset = foffset+4;
11158             foffset = foffset + 4;
11159             pvalues[4].vstring = get_string(tvb, pvalues[4].voffset, pvalues[4].vlength);
11160             pvalues[4].hfname= hf_nds_target_name;
11161             break;
11162         case 0x2b:
11163             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
11164             pvalues[0].vtype = VTYPE_UINT32;
11165             pvalues[0].vdesc = "Version: %u";
11166             pvalues[0].vlength = 4;
11167             pvalues[0].hfname = hf_nds_ver;
11168             pvalues[0].voffset = foffset;
11169             foffset = foffset+pvalues[0].vlength;
11170             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
11171             pvalues[1].vtype = VTYPE_UINT32;
11172             pvalues[1].vdesc = val_to_str_const(pvalues[1].vvalue, nds_verb2b_flag_vals, "No Flag Definition Found");
11173             pvalues[1].vlength = 4;
11174             pvalues[1].hfname = hf_nds_verb2b_req_flags;
11175             pvalues[1].voffset = foffset;
11176             foffset = foffset+pvalues[1].vlength;
11177             pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
11178             pvalues[2].vtype = VTYPE_UINT32;
11179             pvalues[2].vdesc = "Source Entry ID: 0x%08x";
11180             pvalues[2].vlength = 4;
11181             resolve_eid = TRUE;
11182             global_eid = pvalues[2].vvalue;
11183             pvalues[2].voffset = foffset;
11184             pvalues[2].hfname= hf_nds_eid;
11185             foffset = foffset+pvalues[2].vlength;
11186             pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
11187             pvalues[3].vtype = VTYPE_UINT32;
11188             pvalues[3].vdesc = "Destination Parent Entry ID: 0x%08x";
11189             pvalues[3].vlength = 4;
11190             pvalues[3].voffset = foffset;
11191             pvalues[3].hfname= hf_nds_eid;
11192             foffset = foffset+pvalues[3].vlength;
11193             pvalues[4].vtype = VTYPE_STRING;
11194             pvalues[4].vdesc = "New RDN: %s";
11195             pvalues[4].mvtype = 0;
11196             pvalues[4].vvalue = 0;
11197             pvalues[4].vlength = 256;
11198             pvalues[4].vlength = tvb_get_letohl(tvb, foffset);
11199             pvalues[4].voffset = foffset+4;
11200             foffset = foffset + 4;
11201             pvalues[4].vstring = get_string(tvb, pvalues[4].voffset, pvalues[4].vlength);
11202             pvalues[4].hfname= hf_nds_new_rdn;
11203             foffset = foffset+pvalues[4].vlength;
11204             foffset += align_4(tvb, foffset);
11205             pvalues[5].vtype = VTYPE_STRING;
11206             pvalues[5].vdesc = "Source Server Name: %s";
11207             pvalues[5].mvtype = 0;
11208             pvalues[5].vvalue = 0;
11209             pvalues[5].vlength = 256;
11210             pvalues[5].vlength = tvb_get_letohl(tvb, foffset);
11211             if (pvalues[5].vlength == 0x00 || !tvb_bytes_exist(tvb, foffset, pvalues[3].vlength))
11212             {
11213                 pvalues[5].vtype = VTYPE_NONE;
11214                 break;
11215             }
11216             pvalues[5].voffset = foffset+4;
11217             foffset = foffset + 4;
11218             pvalues[5].vstring = get_string(tvb, pvalues[5].voffset, pvalues[5].vlength);
11219             pvalues[5].hfname= hf_nds_target_name;
11220             break;
11221         case 0x2c:
11222             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11223             break;
11224         case 0x2d:
11225             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11226             break;
11227         case 0x2e:
11228             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11229             break;
11230         case 0x2f:
11231             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11232             break;
11233         case 0x30:
11234             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11235             break;
11236         case 0x31:
11237             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11238             break;
11239         case 0x32:
11240             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
11241             pvalues[0].vtype = VTYPE_UINT32;
11242             pvalues[0].vdesc = "Version: %u";
11243             pvalues[0].vlength = 4;
11244             pvalues[0].hfname = hf_nds_ver;
11245             pvalues[0].voffset = foffset;
11246             foffset = foffset+pvalues[0].vlength;
11247             pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
11248             pvalues[2].vtype = VTYPE_UINT32;
11249             pvalues[2].vdesc = "Iteration Handle: 0x%08x";
11250             pvalues[2].vlength = 4;
11251             pvalues[2].voffset = foffset;
11252             pvalues[2].hfname= hf_nds_iteration;
11253             foffset = foffset+pvalues[2].vlength;
11254             pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
11255             pvalues[3].vtype = VTYPE_STRING;
11256             pvalues[3].vdesc = "NDS Verb: %s";
11257             pvalues[3].vstring = val_to_str_const(pvalues[3].vvalue, ncp_nds_verb_vals, "(No Verb Found)");
11258             pvalues[3].vlength = 4;
11259             pvalues[3].voffset = foffset;
11260             pvalues[3].hfname= hf_mv_string;
11261             foffset = foffset+pvalues[3].vlength;
11262             break;
11263         case 0x33:
11264             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11265             break;
11266         case 0x34:
11267             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11268             break;
11269         case 0x35:
11270             if (nds_version != 0)
11271             {
11272                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
11273                 pvalues[0].vtype = VTYPE_UINT32;
11274                 pvalues[0].vdesc = "Version: %u";
11275                 pvalues[0].vlength = 4;
11276                 pvalues[0].hfname = hf_nds_ver;
11277                 pvalues[0].voffset = foffset;
11278                 foffset = foffset+pvalues[0].vlength;
11279                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
11280                 global_flags = pvalues[1].vvalue;
11281                 pvalues[1].vtype = VTYPE_BITFIELD;
11282                 pvalues[1].vdesc = "Request Flags:";
11283                 pvalues[1].vlength = 2;
11284                 pvalues[1].hfname= hf_nds_rflags;
11285                 pvalues[1].voffset = foffset;
11286                 pvalues[1].bit1 = "Typeless";
11287                 pvalues[1].bit1hfname = hf_bit1rflags;
11288                 pvalues[1].bit2 = "Slashed";
11289                 pvalues[1].bit2hfname = hf_bit2rflags;
11290                 pvalues[1].bit3 = "Dotted";
11291                 pvalues[1].bit3hfname = hf_bit3rflags;
11292                 pvalues[1].bit4 = "Tuned";
11293                 pvalues[1].bit4hfname = hf_bit4rflags;
11294                 pvalues[1].bit5 = "Not Defined";
11295                 pvalues[1].bit5hfname = hf_bit5rflags;
11296                 pvalues[1].bit6 = "Not Defined";
11297                 pvalues[1].bit6hfname = hf_bit6rflags;
11298                 pvalues[1].bit7 = "Not Defined";
11299                 pvalues[1].bit7hfname = hf_bit7rflags;
11300                 pvalues[1].bit8 = "Not Defined";
11301                 pvalues[1].bit8hfname = hf_bit8rflags;
11302                 pvalues[1].bit9 = "Not Defined";
11303                 pvalues[1].bit9hfname = hf_bit9rflags;
11304                 pvalues[1].bit10 = "Not Defined";
11305                 pvalues[1].bit10hfname = hf_bit10rflags;
11306                 pvalues[1].bit11 = "Not Defined";
11307                 pvalues[1].bit11hfname = hf_bit11rflags;
11308                 pvalues[1].bit12 = "Not Defined";
11309                 pvalues[1].bit12hfname = hf_bit12rflags;
11310                 pvalues[1].bit13 = "Not Defined";
11311                 pvalues[1].bit13hfname = hf_bit13rflags;
11312                 pvalues[1].bit14 = "Not Defined";
11313                 pvalues[1].bit14hfname = hf_bit14rflags;
11314                 pvalues[1].bit15 = "Not Defined";
11315                 pvalues[1].bit15hfname = hf_bit15rflags;
11316                 pvalues[1].bit16 = "Not Defined";
11317                 pvalues[1].bit16hfname = hf_bit16rflags;
11318             }
11319             break;
11320         case 0x36:
11321             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11322             break;
11323         case 0x37:
11324             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11325             break;
11326         case 0x38:
11327             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11328             break;
11329         case 0x39:
11330             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
11331             pvalues[0].vtype = VTYPE_UINT32;
11332             pvalues[0].vdesc = "Version: %u";
11333             pvalues[0].vlength = 4;
11334             pvalues[0].voffset = foffset;
11335             pvalues[0].hfname= hf_nds_ver;
11336             foffset = foffset+pvalues[0].vlength;
11337             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
11338             pvalues[1].vtype = VTYPE_UINT32;
11339             pvalues[1].vdesc = "Entry ID: 0x%08x";
11340             pvalues[1].vlength = 4;
11341             resolve_eid = TRUE;
11342             global_eid = pvalues[1].vvalue;
11343             pvalues[1].voffset = foffset;
11344             pvalues[1].hfname= hf_nds_eid;
11345             foffset = foffset+pvalues[1].vlength;
11346             break;
11347         case 0x3a:
11348             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
11349             pvalues[0].vtype = VTYPE_UINT32;
11350             pvalues[0].vdesc = "Reply Buffer Size: %u";
11351             pvalues[0].vlength = 4;
11352             pvalues[0].voffset = foffset;
11353             pvalues[0].hfname= hf_nds_buffer_size;
11354             foffset = foffset+pvalues[0].vlength;
11355             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
11356             pvalues[1].vtype = VTYPE_UINT32;
11357             pvalues[1].vdesc = "Version: %u";
11358             pvalues[1].vlength = 4;
11359             pvalues[1].voffset = foffset;
11360             pvalues[1].hfname= hf_nds_ver;
11361             foffset = foffset+pvalues[1].vlength;
11362             pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
11363             pvalues[2].vtype = VTYPE_UINT32;
11364             pvalues[2].vdesc = "Entry ID: 0x%08x";
11365             pvalues[2].vlength = 4;
11366             resolve_eid = TRUE;
11367             global_eid = pvalues[2].vvalue;
11368             pvalues[2].voffset = foffset;
11369             pvalues[2].hfname= hf_nds_eid;
11370             foffset = foffset+pvalues[2].vlength;
11371             break;
11372         case 0x3b:
11373             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
11374             pvalues[0].vtype = VTYPE_UINT32;
11375             pvalues[0].vdesc = "Version: %u";
11376             pvalues[0].vlength = 4;
11377             pvalues[0].voffset = foffset;
11378             pvalues[0].hfname= hf_nds_ver;
11379             foffset = foffset+pvalues[0].vlength;
11380             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
11381             pvalues[1].vtype = VTYPE_UINT32;
11382             pvalues[1].vdesc = "Entry ID: 0x%08x";
11383             pvalues[1].vlength = 4;
11384             resolve_eid = TRUE;
11385             global_eid = pvalues[1].vvalue;
11386             pvalues[1].voffset = foffset;
11387             pvalues[1].hfname= hf_nds_eid;
11388             foffset = foffset+pvalues[1].vlength;
11389             break;
11390         case 0x3c:
11391             break;
11392         case 0x3d:
11393             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11394             break;
11395         case 0x3e:
11396             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11397             break;
11398         case 0x3f:
11399             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11400             break;
11401         case 0x40:
11402             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11403             break;
11404         case 0x41:
11405             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11406             break;
11407         case 0x42:
11408             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11409             break;
11410         case 0x43:
11411             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11412             break;
11413         case 0x44:
11414             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11415             break;
11416         case 0x45:
11417             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11418             break;
11419         case 0x46:
11420             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11421             break;
11422         case 0x47:
11423             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11424             break;
11425         case 0x48:
11426             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11427             break;
11428         case 0x49:
11429             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11430             break;
11431         case 0x4a:
11432             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11433             break;
11434         case 0x4b:
11435             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11436             break;
11437         case 0x4c:
11438             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11439             break;
11440         case 0x4d:
11441             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11442             break;
11443         case 0x6e:
11444             pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
11445             pvalues[0].vtype = VTYPE_UINT32;
11446             pvalues[0].vdesc = "Version: %u";
11447             pvalues[0].vlength = 4;
11448             pvalues[0].hfname = hf_nds_ver;
11449             pvalues[0].voffset = foffset;
11450             foffset = foffset+pvalues[0].vlength;
11451             pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
11452             global_flags = pvalues[1].vvalue;
11453             pvalues[1].vtype = VTYPE_BITFIELD;
11454             pvalues[1].vdesc = "Request Flags:";
11455             pvalues[1].vlength = 2;
11456             pvalues[1].hfname= hf_nds_rflags;
11457             pvalues[1].voffset = foffset;
11458             pvalues[1].bit1 = "Typeless";
11459             pvalues[1].bit1hfname = hf_bit1rflags;
11460             pvalues[1].bit2 = "Slashed";
11461             pvalues[1].bit2hfname = hf_bit2rflags;
11462             pvalues[1].bit3 = "Dotted";
11463             pvalues[1].bit3hfname = hf_bit3rflags;
11464             pvalues[1].bit4 = "Tuned";
11465             pvalues[1].bit4hfname = hf_bit4rflags;
11466             pvalues[1].bit5 = "Not Defined";
11467             pvalues[1].bit5hfname = hf_bit5rflags;
11468             pvalues[1].bit6 = "Not Defined";
11469             pvalues[1].bit6hfname = hf_bit6rflags;
11470             pvalues[1].bit7 = "Not Defined";
11471             pvalues[1].bit7hfname = hf_bit7rflags;
11472             pvalues[1].bit8 = "Not Defined";
11473             pvalues[1].bit8hfname = hf_bit8rflags;
11474             pvalues[1].bit9 = "Not Defined";
11475             pvalues[1].bit9hfname = hf_bit9rflags;
11476             pvalues[1].bit10 = "Not Defined";
11477             pvalues[1].bit10hfname = hf_bit10rflags;
11478             pvalues[1].bit11 = "Not Defined";
11479             pvalues[1].bit11hfname = hf_bit11rflags;
11480             pvalues[1].bit12 = "Not Defined";
11481             pvalues[1].bit12hfname = hf_bit12rflags;
11482             pvalues[1].bit13 = "Not Defined";
11483             pvalues[1].bit13hfname = hf_bit13rflags;
11484             pvalues[1].bit14 = "Not Defined";
11485             pvalues[1].bit14hfname = hf_bit14rflags;
11486             pvalues[1].bit15 = "Not Defined";
11487             pvalues[1].bit15hfname = hf_bit15rflags;
11488             pvalues[1].bit16 = "Not Defined";
11489             pvalues[1].bit16hfname = hf_bit16rflags;
11490             foffset = foffset+pvalues[1].vlength+2;
11491             pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
11492             pvalues[2].vtype = VTYPE_UINT32;
11493             pvalues[2].vdesc = "Iteration Handle: 0x%08x";
11494             pvalues[2].vlength = 4;
11495             pvalues[2].voffset = foffset;
11496             pvalues[2].hfname= hf_nds_iteration;
11497             foffset = foffset+pvalues[2].vlength;
11498             pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
11499             pvalues[3].vtype = VTYPE_UINT32;
11500             pvalues[3].vdesc = "Base Entry ID: 0x%08x";
11501             pvalues[3].vlength = 4;
11502             resolve_eid = TRUE;
11503             global_eid = pvalues[3].vvalue;
11504             pvalues[3].voffset = foffset;
11505             pvalues[3].hfname= hf_nds_eid;
11506             foffset = foffset+pvalues[3].vlength;
11507             pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
11508             pvalues[4].vtype = VTYPE_UINT32;
11509             pvalues[4].vdesc = val_to_str_const(pvalues[4].vvalue, nds_scope_vals, "Unknown Scope Defined");
11510             pvalues[4].vlength = 4;
11511             pvalues[4].hfname = hf_nds_scope;
11512             pvalues[4].voffset = foffset;
11513             foffset = foffset+pvalues[4].vlength;
11514             pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
11515             pvalues[5].vtype = VTYPE_MULTIVALUE_UINT32;
11516             pvalues[5].vdesc = "Iterator: 0x%08x";
11517             pvalues[5].vlength = 4;
11518             pvalues[5].voffset = foffset;
11519             pvalues[5].hfname= hf_nds_iterator;
11520             pvalues[5].mvtype = MVTYPE_PROCESS_ITERATOR;
11521             foffset = foffset+pvalues[5].vlength;
11522             break;
11523         default:
11524             pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
11525             break;
11526         }
11527     }
11528     /* Fill in the INFO column. */
11529     if (ncp_rec) {
11530         col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDS");
11531         if (nds_frag != 0xffffffff) {
11532             col_add_fstr(pinfo->cinfo, COL_INFO, "C Continue NDS Fragment 0x%08x", nds_frag);
11533         }
11534         else {
11535             col_add_fstr(pinfo->cinfo, COL_INFO, "C NDS %s", verb_string);
11536         }
11537         run_info_str = TRUE;
11538     }
11539     else {
11540         col_add_fstr(pinfo->cinfo, COL_INFO,
11541                         "C Unknown Function %d (0x%02x)",
11542                         func, func);
11543     }
11545     /* Keep track of the address and connection whence the request
11546        came, and the address and connection to which the request
11547        is being sent, so that we can match up calls with replies.
11548        (We don't include the sequence number, as we may want
11549        to have all packets over the same connection treated
11550        as being part of a single conversation so that we can
11551        let the user select that conversation to be displayed.) */
11553     conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
11554                                      PT_NCP, nw_connection, nw_connection, 0);
11555     if (conversation == NULL) {
11556         /* It's not part of any conversation - create a new one. */
11557         conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst,
11558                                         PT_NCP, nw_connection, nw_connection, 0);
11559     }
11561     if (!pinfo->fd->flags.visited) {
11562         request_value = ncp_hash_insert(conversation, sequence, ncp_rec, pinfo->fd->num);
11563         request_value->req_frame_num = pinfo->fd->num;
11564         request_value->req_frame_time=pinfo->fd->abs_ts;
11566         /* If this is the first time we're examining the packet,
11567          * check to see if this NCP type uses a "request condition".
11568          * If so, we have to build a proto_tree because request conditions
11569          * use display filters to work, and without a proto_tree,
11570          * display filters can't possibly work. If we already have
11571          * a proto_tree, then wonderful. If we don't, we need to build
11572          * one. */
11573         if (ncp_rec && !ncp_tree) {
11574             run_req_cond = TRUE;
11575         }
11576         /* Keep track of the Fragment number in the request for defrag logic */
11577         request_value->nds_frag_num = nds_frag;
11578     }
11580     /* If we have to handle a request condition, or have to
11581        add to the Info column, we need to construct a protocol
11582        tree.  If we already have a proto_tree, then wonderful.
11583        If we don't, we need to build one. */
11584     if ((run_info_str || run_req_cond) && !ncp_tree) {
11585         proto_item *ti;
11587         temp_tree = proto_tree_create_root(pinfo);
11588         proto_tree_set_visible(temp_tree, FALSE);
11589         ti = proto_tree_add_item(temp_tree, proto_ncp, tvb, 0, -1, FALSE);
11590         ncp_tree = proto_item_add_subtree(ti, ett_ncp);
11591     }
11593     if (ncp_tree) {
11594         /* If the dissection throws an exception, be sure to free
11595          * the temporary proto_tree that was created. Because of the
11596          * way the CLEANUP_PUSH macro works, we can't put it in an 'if'
11597          * block; it has to be in the same scope as the terminating
11598          * CLEANUP_POP or CLEANUP_POP_AND_ALLOC. So, we always
11599          * call CLEANUP_POP and friends, but the value of temp_tree is
11600          * NULL if no cleanup is needed, and non-null if cleanup is needed.
11601          */
11602         CLEANUP_PUSH(free_proto_tree, temp_tree);
11604 #ifdef FAKE_TREE_IS_VISIBLE
11605         PTREE_DATA(ncp_tree)->visible=1;
11606 #endif
11608         request_value = ncp_hash_lookup(conversation, sequence, pinfo->fd->num);
11609         switch (type) {
11610         case NCP_BROADCAST_SLOT:
11611             ; /* nothing */
11612             break;
11614         case NCP_SERVICE_REQUEST:
11616             ptvc = ptvcursor_new(ncp_tree, tvb, 7);
11617             if (ncp_rec && ncp_rec->request_ptvc)
11618             {
11619                 clear_repeat_vars();
11620                 process_ptvc_record(ptvc, ncp_rec->request_ptvc, NULL, TRUE, ncp_rec);
11621             }
11622             proto_tree_add_uint_format(ncp_tree, hf_ncp_func, tvb, 6, 1,
11623                                        func, "Function: %d (0x%02X), %s",
11624                                        func, func, ncp_rec ? ncp_rec->name : "Unknown");
11626             proto_tree_add_uint_format(ncp_tree, hf_ncp_subfunc, tvb, 7, 1,
11627                                        subfunc, "SubFunction: %d (0x%02x)",
11628                                        subfunc, subfunc);
11630             proto_tree_add_uint(ncp_tree, hf_ncp_fragment_handle, tvb, 8, 4,
11631                                 nds_frag);
11633             if (nds_frag == 0xffffffff) {
11635                 proto_tree_add_item(ncp_tree, hf_ncp_fragment_size, tvb, 12, 4, TRUE);
11637                 proto_tree_add_item(ncp_tree, hf_ncp_message_size, tvb, 16, 4, TRUE);
11639                 nds_prot_flags = tvb_get_letohs(tvb, 22);
11640                 prot_flags[0].vvalue = nds_prot_flags;
11641                 prot_flags[0].vtype = VTYPE_BITFIELD;
11642                 prot_flags[0].vdesc = "NDS Protocol Flags:";
11643                 prot_flags[0].vlength = 2;
11644                 prot_flags[0].hfname= hf_ncp_nds_flag;
11645                 prot_flags[0].voffset = 22;
11646                 prot_flags[0].bit1 = "Not Defined";
11647                 prot_flags[0].bit1hfname = hf_ndsprot1flag;
11648                 prot_flags[0].bit2 = "Not Defined";
11649                 prot_flags[0].bit2hfname = hf_ndsprot2flag;
11650                 prot_flags[0].bit3 = "Not Defined";
11651                 prot_flags[0].bit3hfname = hf_ndsprot3flag;
11652                 prot_flags[0].bit4 = "Not Defined";
11653                 prot_flags[0].bit4hfname = hf_ndsprot4flag;
11654                 prot_flags[0].bit5 = "Not Defined";
11655                 prot_flags[0].bit5hfname = hf_ndsprot5flag;
11656                 prot_flags[0].bit6 = "Not Defined";
11657                 prot_flags[0].bit6hfname = hf_ndsprot6flag;
11658                 prot_flags[0].bit7 = "Not Defined";
11659                 prot_flags[0].bit7hfname = hf_ndsprot7flag;
11660                 prot_flags[0].bit8 = "Not Defined";
11661                 prot_flags[0].bit8hfname = hf_ndsprot8flag;
11662                 prot_flags[0].bit9 = "Not Defined";
11663                 prot_flags[0].bit9hfname = hf_ndsprot9flag;
11664                 prot_flags[0].bit10 = "Not Defined";
11665                 prot_flags[0].bit10hfname = hf_ndsprot10flag;
11666                 prot_flags[0].bit11= "Not Defined";
11667                 prot_flags[0].bit11hfname = hf_ndsprot11flag;
11668                 prot_flags[0].bit12 = "Not Defined";
11669                 prot_flags[0].bit12hfname = hf_ndsprot12flag;
11670                 prot_flags[0].bit13 = "Not Defined";
11671                 prot_flags[0].bit13hfname = hf_ndsprot13flag;
11672                 prot_flags[0].bit14 = "Not Defined";
11673                 prot_flags[0].bit14hfname = hf_ndsprot14flag;
11674                 prot_flags[0].bit15 = "Include CRC in NDS Header";
11675                 prot_flags[0].bit15hfname = hf_ndsprot15flag;
11676                 prot_flags[0].bit16 = "Client is a Server";
11677                 prot_flags[0].bit16hfname = hf_ndsprot16flag;
11679                 process_bitfield(ncp_tree, tvb, &prot_flags[0]);
11681                 if (nds_version == 0) {
11682                     proto_tree_add_uint_format(ncp_tree, hf_ncp_nds_verb, tvb, 24, 4,
11683                                                nds_verb, "NDS Verb: %d, (0x%02x), %s",
11684                                                nds_verb, nds_verb, verb_string);
11685                 }
11686                 else {
11687                     proto_tree_add_uint_format(ncp_tree, hf_ncp_nds_verb, tvb, 32, 4,
11688                                                nds_verb, "NDS Verb: %d, (0x%02x), %s",
11689                                                nds_verb, nds_verb, verb_string);
11690                 }
11691                 added_arrow = FALSE;
11692                 for (i = 0; i < 9; i++) {
11693                     switch (pvalues[i].vtype) {
11695                     case VTYPE_NONE: /* no value */
11696                         break;
11698                     case VTYPE_UINT8:
11699                         proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
11700                                                    pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %u",
11701                                                    pvalues[i].vtype);
11702                         break;
11704                     case VTYPE_UINT16:
11705                         proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
11706                                                    pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %u",
11707                                                    pvalues[i].vtype);
11708                         break;
11710                     case VTYPE_UINT32:
11711                         proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
11712                                                    pvalues[i].vlength, pvalues[i].vvalue, pvalues[i].vdesc,
11713                                                    pvalues[i].vvalue);
11714                         break;
11716                     case VTYPE_STRING:
11717                         proto_tree_add_string_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
11718                                                      pvalues[i].vlength, pvalues[i].vstring, pvalues[i].vdesc, pvalues[i].vstring);
11719                         if (pvalues[i].mvtype == MVTYPE_ATTR_REQUEST) {
11720                             /*
11721                              * The "vstring" value is set to the input ES type
11722                              * for MVTYPE_PROC_ENTRY_SPECIFIERS,
11723                              * to add string to columninfo
11724                              */
11725                             if (!added_arrow) {
11726                                 col_append_str(pinfo->cinfo, COL_INFO, " -> ");
11727                                 added_arrow = TRUE;
11728                             }
11729                             col_append_str(pinfo->cinfo, COL_INFO, pvalues[i].vstring);
11730                         }
11731                         break;
11733                     case VTYPE_BITFIELD:
11734                         process_bitfield(ncp_tree, tvb, &pvalues[i]);
11735                         break;
11737                     case VTYPE_MULTIVALUE_UINT32:
11738                         process_multivalues(ncp_tree, tvb, pinfo, &pvalues[i]);
11739                         if (pvalues[i].mvtype == MVTYPE_PROC_ENTRY_SPECIFIERS) {
11740                             /*
11741                              * The "vstring" value is set to the input ES type
11742                              * by "process_multivalues()".
11743                              */
11744                             g_strlcpy(global_object_name, mv_resolve_name_string, 256);
11745                         }
11746                         if (pvalues[i].mvtype == MVTYPE_ATTR_REQUEST || pvalues[i].mvtype == MVTYPE_PROC_ENTRY_SPECIFIERS || pvalues[i].mvtype == MVTYPE_PROCESS_ITERATOR) {
11747                             /*
11748                              * The "vstring" value is set to the input ES type
11749                              * for MVTYPE_PROC_ENTRY_SPECIFIERS,
11750                              * and the last string for MVTYPE_ATTR_REQUEST,
11751                              * by "process_multivalues()".
11752                              */
11753                             col_append_str(pinfo->cinfo, COL_INFO, pvalues[i].vstring);
11754                             if (pvalues[i].mvtype != MVTYPE_PROCESS_ITERATOR) {
11755                                 if (!added_arrow) {
11756                                     col_append_str(pinfo->cinfo, COL_INFO, " -> ");
11757                                     added_arrow = TRUE;
11758                                 }
11759                                 col_append_str(pinfo->cinfo, COL_INFO, mv_resolve_name_string);
11760                             }
11761                         }
11762                         break;
11764                     case VTYPE_BYTES:
11765                         proto_tree_add_bytes(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
11766                                              pvalues[i].vlength, tvb_get_ptr(tvb, pvalues[i].voffset, pvalues[i].vvalue));
11767                         break;
11769                     case VTYPE_BOOLEAN:
11770                         proto_tree_add_item(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset, pvalues[i].vlength, TRUE);
11771                         break;
11773                     default:
11774                         proto_tree_add_uint_format(ncp_tree, hf_nds_p1type, tvb, pvalues[i].voffset,
11775                                                    pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %u",
11776                                                    pvalues[i].vtype);
11777                         break;
11778                     }
11779                 }
11780                 /* For NDS requests with just an EID, resolve name from hash table. */
11781                 request_eid_value = ncp_eid_hash_lookup(conversation, global_eid);
11782                 if(resolve_eid) {
11783                     if (request_eid_value) {
11784                         g_strlcpy(global_object_name, request_eid_value->object_name, 256);
11785                         col_append_str(pinfo->cinfo, COL_INFO, ", Object Name - ");
11786                         col_append_str(pinfo->cinfo, COL_INFO, global_object_name);
11787                     }
11788                 }
11789                 if (request_value)
11790                 {
11791                     request_value->nds_request_verb = nds_verb;
11792                     request_value->nds_version = nds_version;
11793                     g_strlcpy(request_value->object_name, global_object_name, 256);
11794                     request_value->req_nds_flags = global_flags;
11795                     request_value->req_nds_prot_flags = nds_prot_flags;
11796                 }
11797             }
11798             break;
11800         default:
11801             ; /* nothing */
11802             break;
11803         }
11804         ptvcursor_free(ptvc);
11806         /* Free the temporary proto_tree */
11807         CLEANUP_CALL_AND_POP;
11808     }
11812  * XXX - this duplicates stuff in "dissect_ncp_request()"; could
11813  * "dissect_ncp_request()" not just call "dissect_ping_req()" if
11814  * the operation is an NCP ping, and "dissect_ping_req()" just dissect
11815  * ping portion?
11816  */
11817 void
11818 dissect_ping_req(tvbuff_t *tvb, packet_info *pinfo,
11819                  guint32 nw_connection, guint8 sequence,
11820                  guint16 type, proto_tree *ncp_tree)
11822     guint8               func, subfunc = 0;
11823     ncp_req_hash_value  *request_value = NULL;
11824     const ncp_record    *ncp_rec = NULL;
11825     conversation_t      *conversation;
11826     ptvcursor_t         *ptvc = NULL;
11827     proto_tree          *temp_tree = NULL;
11828     gint                 length_remaining = 0;
11829     guint32              nds_flags;
11830     guint32              ping_version;
11831     nds_val              pvalue;
11833 #ifdef FAKE_TREE_IS_VISIBLE
11834     if (ncp_tree) {
11835         PTREE_DATA(ncp_tree)->visible=1;
11836     }
11837 #endif
11839     pvalue.vvalue = 0;
11840     pvalue.vlength = 0;
11841     pvalue.voffset = 0;
11842     pvalue.hfname = 0;
11843     pvalue.vdesc = "";
11844     pvalue.vstring = NULL;
11845     pvalue.mvtype = 0;
11847     func = tvb_get_guint8(tvb, 6);
11848     subfunc = tvb_get_guint8(tvb, 7);
11850     ncp_rec = ncp_record_find(func, subfunc);
11852     /* Fill in the INFO column. */
11853     if (ncp_rec)
11854     {
11855         col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDS");
11857         col_set_str(pinfo->cinfo, COL_INFO, "C Ping for NDS");
11859     }
11860     if (!pinfo->fd->flags.visited)
11861     {
11863         /* This is the first time we've looked at this packet.
11864            Keep track of the address and connection whence the request
11865            came, and the address and connection to which the request
11866            is being sent, so that we can match up calls with replies.
11867            (We don't include the sequence number, as we may want
11868            to have all packets over the same connection treated
11869            as being part of a single conversation so that we can
11870            let the user select that conversation to be displayed.) */
11872         conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
11873                                          PT_NCP, nw_connection, nw_connection, 0);
11875         if (conversation == NULL)
11876         {
11877             /* It's not part of any conversation - create a new one. */
11878             conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst,
11879                                             PT_NCP, nw_connection, nw_connection, 0);
11880         }
11882         request_value = ncp_hash_insert(conversation, sequence, ncp_rec, pinfo->fd->num);
11883         request_value->req_frame_num = pinfo->fd->num;
11884         request_value->req_frame_time=pinfo->fd->abs_ts;
11886         /* If this is the first time we're examining the packet,
11887          * check to see if this NCP type uses a "request condition".
11888          * If so, we have to build a proto_tree because request conditions
11889          * use display filters to work, and without a proto_tree,
11890          * display filters can't possibly work. If we already have
11891          * a proto_tree, then wonderful. If we don't, we need to build
11892          * one. */
11893         if (ncp_rec && !ncp_tree) {
11894             proto_item *ti;
11896             temp_tree = proto_tree_create_root(pinfo);
11897             proto_tree_set_visible(temp_tree, FALSE);
11898             ti = proto_tree_add_item(temp_tree, proto_ncp, tvb, 0, -1, FALSE);
11899             ncp_tree = proto_item_add_subtree(ti, ett_ncp);
11900         }
11901     }
11903     if (ncp_tree) {
11904         /* If the dissection throws an exception, be sure to free
11905          * the temporary proto_tree that was created. Because of the
11906          * way the CLEANUP_PUSH macro works, we can't put it in an 'if'
11907          * block; it has to be in the same scope as the terminating
11908          * CLEANUP_POP or CLEANUP_POP_AND_ALLOC. So, we always
11909          * call CLEANUP_POP and friends, but the value of temp_tree is
11910          * NULL if no cleanup is needed, and non-null if cleanup is needed.
11911          */
11912         CLEANUP_PUSH(free_proto_tree, temp_tree);
11914         switch (type) {
11916         case NCP_BROADCAST_SLOT:
11917             ; /* nothing */
11918             break;
11920         case NCP_SERVICE_REQUEST:
11921             proto_tree_add_uint_format(ncp_tree, hf_ncp_func, tvb, 6, 1,
11922                                        func, "Function: %u (0x%02X), %s",
11923                                        func, func, ncp_rec ? ncp_rec->name : "Unknown");
11925             proto_tree_add_uint_format(ncp_tree, hf_ncp_subfunc, tvb, 7, 1,
11926                                        subfunc, "SubFunction: %u (0x%02x)",
11927                                        subfunc, subfunc);
11929             length_remaining = tvb_reported_length_remaining(tvb, 8);
11931             if (length_remaining >= 8) {
11932                 proto_item *pi;
11934                 ping_version = tvb_get_letohl(tvb, 8);
11935                 proto_tree_add_uint(ncp_tree, hf_nds_ping_version, tvb, 8,
11936                                     4, ping_version);
11937                 nds_flags = tvb_get_letohl(tvb, 12);
11938                 if (request_value){
11939                     request_value->nds_request_verb = 0xf0;
11940                     request_value->req_nds_flags = nds_flags;
11941                 }
11943                 pi = proto_tree_add_uint(ncp_tree, hf_ncp_nds_verb, tvb, 0, 0, 240);
11944                 PROTO_ITEM_SET_HIDDEN(pi);
11946                 pvalue.vvalue = tvb_get_letohs(tvb, 12);
11947                 pvalue.vtype = VTYPE_BITFIELD;
11948                 pvalue.vstring = "";
11949                 pvalue.vdesc = "Ping (low) Request Flags:";
11950                 pvalue.vlength = 2;
11951                 pvalue.hfname= hf_nds_rflags;
11952                 pvalue.voffset = 12;
11953                 pvalue.bit1 = "Supported Fields";   /* 0x0001 */
11954                 pvalue.bit1hfname = hf_bit1pingflags1;
11955                 pvalue.bit2 = "Depth";              /* 0x0002 */
11956                 pvalue.bit2hfname = hf_bit2pingflags1;
11957                 pvalue.bit3 = "Build Number";       /* 0x0004 */
11958                 pvalue.bit3hfname = hf_bit3pingflags1;
11959                 pvalue.bit4 = "Flags";              /* 0x0008 */
11960                 pvalue.bit4hfname = hf_bit4pingflags1;
11961                 pvalue.bit5 = "Verification Flags"; /* 0x0010 */
11962                 pvalue.bit5hfname = hf_bit5pingflags1;
11963                 pvalue.bit6 = "Letter Version";     /* 0x0020 */
11964                 pvalue.bit6hfname = hf_bit6pingflags1;
11965                 pvalue.bit7 = "OS Version";         /* 0x0040 */
11966                 pvalue.bit7hfname = hf_bit7pingflags1;
11967                 pvalue.bit8 = "Not Defined";        /* 0x0080 */
11968                 pvalue.bit8hfname = hf_bit8pingflags1;
11969                 pvalue.bit9 = "License Flags";      /* 0x0100 */
11970                 pvalue.bit9hfname = hf_bit9pingflags1;
11971                 pvalue.bit10 = "DS Time";           /* 0x0200 */
11972                 pvalue.bit10hfname = hf_bit10pingflags1;
11973                 pvalue.bit11 = "Server Time";       /* 0x0400 */
11974                 pvalue.bit11hfname = hf_bit11pingflags1;
11975                 pvalue.bit12 = "Create Time";       /* 0x0800 */
11976                 pvalue.bit12hfname = hf_bit12pingflags1;
11977                 pvalue.bit13 = "Not Defined";
11978                 pvalue.bit13hfname = hf_bit13pingflags1;
11979                 pvalue.bit14 = "Not Defined";
11980                 pvalue.bit14hfname = hf_bit14pingflags1;
11981                 pvalue.bit15 = "Not Defined";
11982                 pvalue.bit15hfname = hf_bit15pingflags1;
11983                 pvalue.bit16 = "Not Defined";
11984                 pvalue.bit16hfname = hf_bit16pingflags1;
11986                 process_bitfield(ncp_tree, tvb, &pvalue);
11988                 pvalue.vvalue = tvb_get_letohs(tvb, 14);
11989                 pvalue.vtype = VTYPE_BITFIELD;
11990                 pvalue.vstring = "";
11991                 pvalue.vdesc = "Ping (high) Request Flags:";
11992                 pvalue.vlength = 2;
11993                 pvalue.hfname= hf_nds_rflags;
11994                 pvalue.voffset = 14;
11995                 pvalue.bit1 = "Sap Name";           /* 0x0001 */
11996                 pvalue.bit1hfname = hf_bit1pingflags2;
11997                 pvalue.bit2 = "Tree Name";          /* 0x0002 */
11998                 pvalue.bit2hfname = hf_bit2pingflags2;
11999                 pvalue.bit3 = "OS Name";            /* 0x0004 */
12000                 pvalue.bit3hfname = hf_bit3pingflags2;
12001                 pvalue.bit4 = "Hardware Name";      /* 0x0008 */
12002                 pvalue.bit4hfname = hf_bit4pingflags2;
12003                 pvalue.bit5 = "Vendor Name";        /* 0x0010 */
12004                 pvalue.bit5hfname = hf_bit5pingflags2;
12005                 pvalue.bit6 = "Not Defined";
12006                 pvalue.bit6hfname = hf_bit6pingflags2;
12007                 pvalue.bit7 = "Not Defined";
12008                 pvalue.bit7hfname = hf_bit7pingflags2;
12009                 pvalue.bit8 = "Not Defined";
12010                 pvalue.bit8hfname = hf_bit8pingflags2;
12011                 pvalue.bit9 = "Not Defined";
12012                 pvalue.bit9hfname = hf_bit9pingflags2;
12013                 pvalue.bit10 = "Not Defined";
12014                 pvalue.bit10hfname = hf_bit10pingflags2;
12015                 pvalue.bit11 = "Not Defined";
12016                 pvalue.bit11hfname = hf_bit11pingflags2;
12017                 pvalue.bit12 = "Not Defined";
12018                 pvalue.bit12hfname = hf_bit12pingflags2;
12019                 pvalue.bit13 = "Not Defined";
12020                 pvalue.bit13hfname = hf_bit13pingflags2;
12021                 pvalue.bit14 = "Not Defined";
12022                 pvalue.bit14hfname = hf_bit14pingflags2;
12023                 pvalue.bit15 = "Not Defined";
12024                 pvalue.bit15hfname = hf_bit15pingflags2;
12025                 pvalue.bit16 = "Not Defined";
12026                 pvalue.bit16hfname = hf_bit16pingflags2;
12028                 process_bitfield(ncp_tree, tvb, &pvalue);
12029             }
12030             break;
12032         default:
12033             ; /* nothing */
12034             break;
12035         }
12036         ptvc = ptvcursor_new(ncp_tree, tvb, 7);
12037         if (ncp_rec && ncp_rec->request_ptvc) {
12038             clear_repeat_vars();
12039             process_ptvc_record(ptvc, ncp_rec->request_ptvc, NULL, TRUE, ncp_rec);
12040         }
12041         ptvcursor_free(ptvc);
12043         /* Free the temporary proto_tree */
12044         CLEANUP_CALL_AND_POP;
12045     }