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