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