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