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