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