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