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