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