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