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