Call subdissectors even if we're not building a protocol tree.
[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.69 2003/12/22 02:04:18 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  * XXX - this has several problems:
4098  *
4099  *      1) it uses global variables ("frags");
4100  *
4101  *      2) the sequence numbers don't start at a fixed value, they're
4102  *         per-connection sequence numbers;
4103  *
4104  *      3) the fragment size and handle aren't put into the protocol
4105  *         tree for fragments other than the last fragment.
4106  *
4107  * 2) needs to be fixed by having a way of doing defragmentation using
4108  * connection sequence numbers; that's needed for fragmentation in
4109  * connection-oriented protocols, e.g. COTP, as well.
4110  * That might let us fix 1) as well.
4111  *
4112  * 3) should be fixed by putting that into the protocol tree ourselves
4113  * if this isn't the first fragment.
4114 */         
4115 void
4116 nds_defrag(tvbuff_t *tvb, packet_info *pinfo, guint16 nw_connection, guint8 sequence, guint16 type, proto_tree *tree)
4117 {
4118     int                 i, frag_count=0;
4119     guint               len=0;
4120     guint32             tid = 1;
4121     tvbuff_t            *frag_tvb = NULL;
4122     fragment_data       *fd_head;
4123     ncp_req_hash_value  *request_value = NULL;
4124     conversation_t      *conversation;
4125     guint32             nds_frag;
4126     
4127     for (i = 0; i < 9; i++) {
4128         if (!frags[i].nds_fragmented)
4129         {
4130                 frags[i].nds_frag = 0;
4131         }
4132     }
4133     /* Check to see if defragmentation is enabeled in the dissector */
4134     if (!nds_defragment) {
4135         dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree);
4136         return;
4137     }
4138     /* Has this already been dissected? */
4139     if (!pinfo->fd->flags.visited) {
4140         /* Find the conversation whence the request would have come. */
4141         conversation = find_conversation(&pinfo->src, &pinfo->dst,
4142                     PT_NCP, nw_connection, nw_connection, 0);
4143         if (conversation != NULL) {
4144                 /* find the record telling us the request made that caused
4145                    this reply */
4146                 request_value = ncp_hash_lookup(conversation, sequence);
4147                 if (!request_value) {
4148                         dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree);
4149                         return;
4150                 }
4151                 p_add_proto_data(pinfo->fd, proto_ncp, (void*) request_value);
4152         }
4153         /* else... we haven't seen an NCP Request for that conversation and sequence. */
4154         else
4155         {
4156                 dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree);
4157                 return;
4158         }
4159     }
4160     else {
4161         request_value = p_get_proto_data(pinfo->fd, proto_ncp);
4162         if (!request_value) {
4163                 dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree);
4164                 return;
4165         }
4166     }
4167     /* Validate that this is an NDS packet */
4168     /* If this isn't an NDS packet then just return */
4169     if (!request_value->ncp_rec ||
4170          request_value->ncp_rec->func!=104 || request_value->ncp_rec->subfunc!=2) {
4171         dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree);
4172         return;
4173     }
4174     /* Get the fragment flag */
4175     nds_frag = tvb_get_letohl(tvb, 12);
4176     /* Now we need to find if this is a new fragment or already one defined. */
4177     /* We currently limit the maximum number of simultaneous fragments to 100. */
4178     for (i=0; i<100; i++)
4179     {
4180         if (frags[i].nds_frag == nds_frag || frags[i].nds_frag == 0)
4181         {
4182                 if (frags[i].nds_frag == 0)
4183                 {
4184                         frags[i].nds_length = 0;
4185                         frags[i].nds_frag = nds_frag;
4186                         frags[i].nds_fragmented = TRUE;
4187                 }
4188                 break;
4189         }
4190     }
4191     frag_count = i;
4192     
4193     /* Now we process the fragments */
4194     if (request_value->nds_frag || (request_value->nds_end_frag == pinfo->fd->num)) 
4195     {
4196         /* Check to see of this is a fragment. If so then mark as a fragment. */
4197         if (frags[frag_count].nds_frag==0xffffffff) {
4198                 request_value->nds_frag = FALSE;
4199                 /* nds_length of 0 means start of fragment */
4200                 frags[frag_count].nds_length = 0;
4201         }
4202         else
4203         {
4204                 if (frags[frag_count].nds_length == 0)
4205                 {
4206                         frags[frag_count].nds_length = tvb_get_letohl(tvb, 0);
4207                 }
4208         }
4209         /*   
4210          * Fragment
4211          *
4212          */
4213         tid = (pinfo->srcport+pinfo->destport);
4214         len = tvb_reported_length(tvb);
4215         if (len > 0 && tvb_bytes_exist(tvb, 0, len))
4216         {
4217             if (frags[frag_count].nds_length > len)
4218             {
4219                 /* This is the first fragment so remember the verb, version, and flags. */
4220                 frags[frag_count].nds_frag_verb = request_value->nds_request_verb;
4221                 frags[frag_count].nds_frag_version = request_value->nds_version;
4222                 frags[frag_count].nds_frag_flags = request_value->req_nds_flags;
4223                 fd_head = fragment_add_seq_next(tvb, 0, pinfo, tid, nds_fragment_table, nds_reassembled_table, len, request_value->nds_frag);
4224                 frags[frag_count].nds_length = 1;
4225             }
4226             else
4227             {
4228                 /* Subsequent fragments should be offset by 16 since we do not need */
4229                 /* the additional fragment handle and size fields in our composite data */
4230                 fd_head = fragment_add_seq_next(tvb, 16, pinfo, tid, nds_fragment_table, nds_reassembled_table, len-16, request_value->nds_frag);
4231             } 
4232             if (fd_head != NULL) 
4233             {
4234                 /* Is this the last fragment? nds_frag will indicate */
4235                 if (fd_head->next != NULL && !request_value->nds_frag) 
4236                 {
4237                     frag_tvb = tvb_new_real_data(fd_head->data,
4238                         fd_head->len, fd_head->len);
4239                     tvb_set_child_real_data_tvbuff(tvb,
4240                         frag_tvb);
4241                     add_new_data_source(pinfo,
4242                         frag_tvb,
4243                         "Reassembled NDS");
4244                     /* Show all fragments. */
4245                     if (tree) 
4246                     {
4247                         show_fragment_seq_tree(fd_head,
4248                             &nds_frag_items,
4249                             tree, pinfo,
4250                             frag_tvb);
4251                         tid++;
4252                     }
4253                     
4254                     if (!pinfo->fd->flags.visited) 
4255                     {
4256                          /* Now we need to find the original fragment number. */
4257                          /* Get the fragment flag */
4258                          nds_frag = tvb_get_letohl(frag_tvb, 12);
4259                          for (i=0; i<100; i++)
4260                          {
4261                              if (frags[i].nds_frag == nds_frag)
4262                              {
4263                                      break;
4264                              }
4265                          }
4266                          if (frags[i].nds_frag == 0)
4267                          {
4268                                  /* Error can't find fragment */
4269                                  /*g_assert(0);*/
4270                          }
4271                          frag_count = i;
4272                         /* Remember this fragment information so we can dissect.
4273                          * Only do this on the first dissection. After the first 
4274                          * dissection we will just read the memory values. 
4275                          */
4276                         request_value->nds_end_frag = pinfo->fd->num;
4277                         request_value->nds_request_verb = frags[frag_count].nds_frag_verb;
4278                         request_value->nds_version = frags[frag_count].nds_frag_version;
4279                         request_value->req_nds_flags = frags[frag_count].nds_frag_flags;
4280                     }
4281
4282                 } 
4283                 else 
4284                 {
4285                     /* This is either a beggining or middle fragment on second dissection */
4286                     frag_tvb = tvb_new_subset(tvb, 0, -1, -1);
4287                     if (check_col(pinfo->cinfo, COL_INFO))
4288                     {
4289                       if (request_value->nds_frag)
4290                       {
4291                         col_add_fstr(pinfo->cinfo, COL_INFO, "[NDS Fragment %08x]", frags[frag_count].nds_frag);
4292                       }
4293                     }
4294                 }
4295             }
4296             else 
4297             {
4298                 /* Fragment from first pass of dissection */
4299                 if (check_col(pinfo->cinfo, COL_INFO))
4300                 {
4301                   if (request_value->nds_frag)
4302                   {
4303                      col_add_fstr(pinfo->cinfo, COL_INFO, "[NDS Fragment %08x]", frags[frag_count].nds_frag);
4304                   }
4305                 }
4306                 frag_tvb = NULL;
4307             }
4308         }
4309         else 
4310         {
4311             /*
4312              * There are no bytes so Dissect this
4313              */
4314             frag_tvb = tvb_new_subset(tvb, 0, -1, -1);
4315         }
4316         if (frag_tvb == NULL)
4317         {
4318             /* This is a fragment packet */
4319                 frag_tvb = tvb_new_subset (tvb, 0, -1, -1);
4320                 nds_data_handle = find_dissector("data");
4321                 call_dissector(nds_data_handle, frag_tvb, pinfo, tree);
4322         }
4323         else
4324         {
4325             /* This is the end fragment so dissect */
4326             if (!request_value->nds_frag) {
4327                 frags[frag_count].nds_length = 0;
4328                 dissect_ncp_reply(frag_tvb, pinfo, nw_connection, sequence, type, tree);
4329             }
4330         }
4331     }
4332     else
4333     {
4334         /* This is not any fragment packet */
4335         frags[frag_count].nds_length = 0;
4336         request_value->nds_frag = FALSE;
4337         dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree);
4338     }
4339 }
4340
4341 void
4342 dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
4343                 guint16 nw_connection, guint8 sequence,
4344                 guint16 type, proto_tree *ncp_tree)
4345 {
4346         guint8                  func, subfunc = 0;
4347         gboolean                requires_subfunc = FALSE;
4348         gboolean                has_length = FALSE;
4349         ncp_req_hash_value      *request_value = NULL;
4350         const ncp_record        *ncp_rec = NULL;
4351         conversation_t          *conversation;
4352         ptvcursor_t             *ptvc = NULL;
4353         proto_tree              *temp_tree = NULL;
4354         gboolean                run_req_cond = FALSE;
4355         gboolean                run_info_str = FALSE;
4356         guint32                 length_remaining;
4357         guint32                 testvar;
4358
4359         func = tvb_get_guint8(tvb, 6);
4360
4361         /* Determine which ncp_record to use. */
4362         switch (type) {
4363                 case NCP_ALLOCATE_SLOT:
4364                         length_remaining = tvb_length_remaining(tvb, 4);
4365                         if (length_remaining > 4)
4366                         { 
4367                                 testvar = tvb_get_ntohl(tvb, 4);
4368                                 if( testvar == 0x4c495020)
4369                                 {
4370                                         ncp_rec = &ncplip_echo;
4371                                 }
4372                                 else
4373                                 {
4374                                         ncp_rec = &ncp1111_request;
4375                                 }        
4376                         }        
4377                         else
4378                         {
4379                                 ncp_rec = &ncp1111_request;
4380                         }        
4381                         break;
4382                 case NCP_SERVICE_REQUEST:
4383                         requires_subfunc = ncp_requires_subfunc(func);
4384                         has_length = ncp_has_length_parameter(func);
4385                         if (requires_subfunc) {
4386                                 if (has_length) {
4387                                         subfunc = tvb_get_guint8(tvb, 9);
4388                                 }
4389                                 else {
4390                                         subfunc = tvb_get_guint8(tvb, 7);
4391                                 }
4392                         }
4393                         ncp_rec = ncp_record_find(func, subfunc);
4394                         break;
4395                 case NCP_DEALLOCATE_SLOT:
4396                         ncp_rec = &ncp5555_request;
4397                         break;
4398                 case NCP_BROADCAST_SLOT:
4399                         ncp_rec = &ncpbbbb_request;
4400                         break;
4401                 case NCP_LIP_ECHO:
4402                         ncp_rec = &ncplip_echo;
4403                         break;        
4404                 default:
4405                         ncp_rec = NULL;
4406                         break;
4407         }
4408
4409         /* Fill in the INFO column. */
4410         if (check_col(pinfo->cinfo, COL_INFO)) {
4411                 if (ncp_rec) {
4412                         col_add_fstr(pinfo->cinfo, COL_INFO, "C %s", ncp_rec->name);
4413                         if (ncp_rec->req_info_str) {
4414                                 /* We want to add more stuff to the Info
4415                                    column. */
4416                                 run_info_str = TRUE;
4417                         }
4418                 }
4419                 else {
4420                         if (requires_subfunc) {
4421                                 col_add_fstr(pinfo->cinfo, COL_INFO,
4422                                         "C Unknown Function %u %u (0x%02X/0x%02x)",
4423                                         func, subfunc, func, subfunc);
4424                         }
4425                         else {
4426                                 col_add_fstr(pinfo->cinfo, COL_INFO,
4427                                         "C Unknown Function %u (0x%02x)",
4428                                         func, func);
4429                         }
4430                 }
4431         }
4432
4433         if (!pinfo->fd->flags.visited) {
4434                 /* This is the first time we've looked at this packet.
4435                    Keep track of the address and connection whence the request
4436                    came, and the address and connection to which the request
4437                    is being sent, so that we can match up calls with replies.
4438                    (We don't include the sequence number, as we may want
4439                    to have all packets over the same connection treated
4440                    as being part of a single conversation so that we can
4441                    let the user select that conversation to be displayed.) */
4442                 conversation = find_conversation(&pinfo->src, &pinfo->dst,
4443                     PT_NCP, nw_connection, nw_connection, 0);
4444
4445                 if (conversation == NULL) {
4446                         /* It's not part of any conversation - create a new one. */
4447                         conversation = conversation_new(&pinfo->src, &pinfo->dst,
4448                             PT_NCP, nw_connection, nw_connection, 0);
4449                 }
4450                 request_value = ncp_hash_insert(conversation, sequence, ncp_rec);
4451                 request_value->req_frame_num = pinfo->fd->num;
4452                 request_value->req_frame_time.secs=pinfo->fd->abs_secs;
4453                 request_value->req_frame_time.nsecs=pinfo->fd->abs_usecs*1000;
4454
4455                 /* If this is the first time we're examining the packet,
4456                  * check to see if this NCP type uses a "request condition".
4457                  * If so, we have to build a proto_tree because request conditions
4458                  * use display filters to work, and without a proto_tree,
4459                  * display filters can't possibly work. */
4460                 if (ncp_rec) {
4461                         if (ncp_rec->req_cond_indexes) {
4462                                 run_req_cond = TRUE;
4463                         }
4464                 }
4465         }
4466
4467         /* If we have to handle a request condition, or have to
4468            add to the Info column, we need to construct a protocol
4469            tree.  If we already have a proto_tree, then wonderful.
4470            If we don't, we need to build one. */
4471         if ((run_info_str || run_req_cond) && !ncp_tree) {
4472                 proto_item *ti;
4473
4474                 temp_tree = proto_tree_create_root();
4475                 proto_tree_set_visible(temp_tree, FALSE);
4476                 ti = proto_tree_add_item(temp_tree, proto_ncp, tvb, 0, -1, FALSE);
4477                 ncp_tree = proto_item_add_subtree(ti, ett_ncp);
4478         }
4479
4480         if (ncp_tree) {
4481                 /* If the dissection throws an exception, be sure to free
4482                  * the temporary proto_tree that was created. Because of the
4483                  * way the CLEANUP_PUSH macro works, we can't put it in an 'if'
4484                  * block; it has to be in the same scope as the terminating
4485                  * CLEANUP_POP or CLEANUP_POP_AND_ALLOC. So, we always
4486                  * call CLEANUP_POP and friends, but the value of temp_tree is
4487                  * NULL if no cleanup is needed, and non-null if cleanup is needed. */
4488                 CLEANUP_PUSH(free_proto_tree, temp_tree);
4489
4490                 /* Before the dissection, if we're saving data for a request
4491                  * condition, we have to prime the proto tree using the
4492                  * dfilter information */
4493                 if (run_req_cond) {
4494                         const int       *needed;
4495                         dfilter_t       *dfilter;
4496
4497                         needed = ncp_rec->req_cond_indexes;
4498
4499                         while (*needed != -1) {
4500                                 dfilter = req_conds[*needed].dfilter;
4501                                 /* Prime the proto_tree with "interesting fields". */
4502                                 dfilter_prime_proto_tree(dfilter, ncp_tree);
4503                                 needed++;
4504                         }
4505                 }
4506
4507                 /* Before the dissection, if we need a field for the info_str,
4508                  * prime the tree. */
4509                 if (run_info_str) {
4510                         proto_tree_prime_hfid(ncp_tree, *ncp_rec->req_info_str->hf_ptr);
4511                 }
4512
4513                 switch (type) {
4514                         case NCP_BROADCAST_SLOT:
4515                                 ; /* nothing */
4516                                 break;
4517
4518                         case NCP_SERVICE_REQUEST:
4519                                 proto_tree_add_uint_format(ncp_tree, hf_ncp_func, tvb, 6, 1,
4520                                         func, "Function: %u (0x%02X), %s",
4521                                         func, func, ncp_rec ? ncp_rec->name : "Unknown");
4522                                 break;
4523
4524                         default:
4525                                 ; /* nothing */
4526                                 break;
4527                 }
4528
4529                 if (requires_subfunc) {
4530                         if (has_length) {
4531                                 proto_tree_add_item(ncp_tree, hf_ncp_length, tvb, 7,
4532                                         2, FALSE);
4533                                 proto_tree_add_uint_format(ncp_tree, hf_ncp_subfunc, tvb, 9, 1,
4534                                         subfunc, "SubFunction: %u (0x%02x)",
4535                                         subfunc, subfunc);
4536                                 ptvc = ptvcursor_new(ncp_tree, tvb, 10);
4537                         }
4538                         else {
4539                                 proto_tree_add_uint_format(ncp_tree, hf_ncp_subfunc, tvb, 7, 1,
4540                                         subfunc, "SubFunction: %u (0x%02x)",
4541                                         subfunc, subfunc);
4542                                 ptvc = ptvcursor_new(ncp_tree, tvb, 8);
4543                         }
4544                 }
4545                 else {
4546                         ptvc = ptvcursor_new(ncp_tree, tvb, 7);
4547                 }
4548
4549                 /* The group is not part of the packet, but it's useful
4550                  * information to display anyway. */
4551                 if (ncp_rec) {
4552                         proto_tree_add_text(ncp_tree, tvb, 0, 0, "Group: %s",
4553                                         ncp_groups[ncp_rec->group]);
4554                 }
4555
4556                 if (ncp_rec && ncp_rec->request_ptvc) {
4557                         clear_repeat_vars();
4558                         process_ptvc_record(ptvc, ncp_rec->request_ptvc, NULL, TRUE, ncp_rec);
4559                 }
4560                 ptvcursor_free(ptvc);
4561
4562                 /* Now that the dissection is done, do we need to run
4563                  * some display filters on the resulting tree in order
4564                  * to save results for "request conditions" ? */
4565                 if (run_req_cond) {
4566                         const int       *needed;
4567                         gboolean        *results;
4568                         dfilter_t       *dfilter;
4569
4570                         results = g_new0(gboolean, NUM_REQ_CONDS);
4571                         needed = ncp_rec->req_cond_indexes;
4572
4573                         while (*needed != -1) {
4574                                 /* ncp_tree is not a root proto_tree, but
4575                                  * dfilters will still work on it. */
4576                                 dfilter = req_conds[*needed].dfilter;
4577                                 results[*needed] = dfilter_apply(dfilter, ncp_tree);
4578                                 needed++;
4579                         }
4580
4581                         /* Save the results so the reply packet dissection
4582                          * get to them. */
4583                         request_value->req_cond_results = results;
4584                 }
4585                 /* Construct the info string if necessary */
4586                 if (run_info_str) {
4587                         GPtrArray *parray;
4588                         char*   byte_string;
4589                         char    non_uni_string[1024];
4590                         int i, len;
4591                         field_info *finfo;
4592                         int info_type;
4593                         
4594                         if (!request_value)
4595                         {
4596                                 conversation = find_conversation(&pinfo->src, &pinfo->dst,
4597                                     PT_NCP, nw_connection, nw_connection, 0);
4598                                 if (conversation != NULL) {
4599                                         /* find the record telling us the request made that caused
4600                                         this reply */
4601                                         request_value = ncp_hash_lookup(conversation, sequence);
4602                                 }
4603                                 if (!conversation || !request_value)
4604                                 {
4605                                         return;
4606                                 }
4607                         }
4608                         
4609                         parray = proto_get_finfo_ptr_array(ncp_tree,
4610                                 *ncp_rec->req_info_str->hf_ptr);
4611                         len = g_ptr_array_len(parray);
4612                         
4613                         if (len > 0) {
4614                         
4615                                 col_set_str(pinfo->cinfo, COL_INFO, "C ");
4616
4617                                 finfo = g_ptr_array_index(parray, 0);
4618
4619                                 info_type = get_info_type((const gchar*) ncp_rec->req_info_str->first_string);
4620                                                             
4621                                 if (info_type != 0) {    /* Is this  a string or not? */
4622                                        
4623                                         if (info_type == 1) {   /* Is this bytes? */
4624                                                 byte_string = bytes_to_str(fvalue_get(&finfo->value), fvalue_length(&finfo->value));
4625                                                 col_append_fstr(pinfo->cinfo, COL_INFO,
4626                                                         (const gchar*) ncp_rec->req_info_str->first_string,
4627                                                         byte_string);
4628                                         }
4629                                         else
4630                                         {
4631                                                 if (info_type == 2) {   /* Is this a String? */
4632                                                         uni_to_string(fvalue_get(&finfo->value), fvalue_length(&finfo->value), non_uni_string);
4633                                                         col_append_fstr(pinfo->cinfo, COL_INFO,
4634                                                                 (const gchar*) ncp_rec->req_info_str->first_string,
4635                                                                 non_uni_string);
4636                                                 }
4637                                                 else
4638                                                 {
4639                                                         col_append_fstr(pinfo->cinfo, COL_INFO,
4640                                                                 (const gchar*) ncp_rec->req_info_str->first_string,
4641                                                                 fvalue_get(&finfo->value));
4642                                                 }
4643                                         }
4644                                 }
4645                                 else
4646                                 {
4647                                         col_append_fstr(pinfo->cinfo, COL_INFO,
4648                                                 (const gchar*) ncp_rec->req_info_str->first_string,
4649                                                 fvalue_get_integer(&finfo->value));
4650                                 }
4651                         }
4652                         if (len > 1) {
4653                                 for (i = 1; i < len; i++) {
4654                                         non_uni_string[0]='\0';
4655                                         finfo = g_ptr_array_index(parray, i);
4656                                         info_type = get_info_type((const gchar*) ncp_rec->req_info_str->repeat_string);
4657                                                                     
4658                                         if (info_type != 0) {    /* Is this  a string or not? */
4659                                               if (info_type == 1) 
4660                                               {   /* Is this bytes? */
4661                                                 byte_string = bytes_to_str(fvalue_get(&finfo->value), fvalue_length(&finfo->value));
4662                                                 col_append_fstr(pinfo->cinfo, COL_INFO,
4663                                                         (const gchar*) ncp_rec->req_info_str->repeat_string,
4664                                                         byte_string);
4665                                               }
4666                                               else
4667                                               {
4668                                                         if (info_type == 2) {   /* Is this a String? */
4669                                                                 uni_to_string(fvalue_get(&finfo->value), fvalue_length(&finfo->value), non_uni_string);
4670                                                                 col_append_fstr(pinfo->cinfo, COL_INFO,
4671                                                                         (const gchar*) ncp_rec->req_info_str->repeat_string,
4672                                                                         non_uni_string);
4673                                                         }
4674                                                         else
4675                                                         {
4676                                                                 col_append_fstr(pinfo->cinfo, COL_INFO,
4677                                                                         (const gchar*) ncp_rec->req_info_str->repeat_string,
4678                                                                         fvalue_get(&finfo->value));
4679                                                         }
4680                                               }
4681                                         }
4682                                         else
4683                                         {
4684                                                 col_append_fstr(pinfo->cinfo, COL_INFO,
4685                                                         (const gchar*) ncp_rec->req_info_str->repeat_string,
4686                                                         fvalue_get_integer(&finfo->value));
4687                                         }
4688                                 }
4689                         }
4690                 }
4691
4692                 /* Free the temporary proto_tree */
4693                 CLEANUP_CALL_AND_POP;
4694         }
4695 }
4696
4697
4698 void
4699 dissect_ncp_reply(tvbuff_t *tvb, packet_info *pinfo,
4700         guint16 nw_connection, guint8 sequence, guint16 type,
4701         proto_tree *ncp_tree)
4702 {
4703         conversation_t                  *conversation = NULL;
4704         ncp_req_hash_value              *request_value = NULL;
4705         ncp_req_eid_hash_value          *request_eid_value = NULL;
4706         const ncp_record                *ncp_rec = NULL;
4707         int                             *req_cond_results;
4708         guint8                          completion_code=0;
4709         guint                           length;
4710         ptvcursor_t                     *ptvc = NULL;
4711         const char                      *error_string;
4712         guint32                         nds_string_len = 0;
4713         guint8                          ping_version = 0;
4714         guint32                         nds_flags = 0;
4715         guint32                         nds_offset = 0;
4716         nw_uni_t                        reply_buffer;
4717         char *                          verb_string="";
4718         guint32                         nds_error_code = 0;
4719         guint32                         nds_reply_buffer = 0;
4720         char *                          nds_error_string = NULL;
4721         guint32                         nds_frag=0;
4722         nds_val                         pvalues[9];
4723         char                            string_buffer[9][1024];
4724         gboolean                        resolve_eid=FALSE;
4725         guint32                         global_eid=0;
4726         gboolean                        add_eid = FALSE;
4727         char                            global_object_name[256];
4728         int                             i;
4729         guint32                         bvalue=0;
4730         
4731         strcpy(reply_buffer.buffer, "");
4732         strcpy(global_object_name, "");
4733         
4734         if (!pinfo->fd->flags.visited) {
4735                 /* Find the conversation whence the request would have come. */
4736                 conversation = find_conversation(&pinfo->src, &pinfo->dst,
4737                             PT_NCP, nw_connection, nw_connection, 0);
4738                 if (conversation != NULL) {
4739                         /* find the record telling us the request made that caused
4740                            this reply */
4741                         request_value = ncp_hash_lookup(conversation, sequence);
4742                         if (request_value) {
4743                                 ncp_rec = request_value->ncp_rec;
4744                         }
4745                         p_add_proto_data(pinfo->fd, proto_ncp, (void*) request_value);
4746                 }
4747                 /* else... we haven't seen an NCP Request for that conversation and sequence. */
4748         }
4749         else {
4750                 request_value = p_get_proto_data(pinfo->fd, proto_ncp);
4751                 if (request_value) {
4752                         ncp_rec = request_value->ncp_rec;
4753                 }
4754         }
4755
4756         if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
4757                 if (ncp_rec && ncp_rec->func==0x68 &&
4758                     (ncp_rec->subfunc==0x02 || ncp_rec->subfunc==0x01)) {
4759                         col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDS");
4760                 }
4761         }
4762
4763         /* A completion code of 0 always means OK. Non-zero means failure,
4764          * but each non-zero value has a different meaning. And the same value
4765          * can have different meanings, depending on the ncp.func (and ncp.subfunc)
4766          * value. */
4767         completion_code = tvb_get_guint8(tvb, 6);
4768         if (completion_code == 0) {
4769                 
4770                 if(type == NCP_POSITIVE_ACK)
4771                 {
4772                         error_string = "Server Busy, Request Being Processed";
4773                 }
4774                 else
4775                 {                
4776                         error_string = "OK";
4777                 }        
4778         } else {
4779                 if (ncp_rec && ncp_rec->errors) {
4780                         error_string = ncp_error_string(ncp_rec->errors, completion_code);
4781                 }
4782                 else {
4783                         error_string = "Not OK";
4784                 }
4785         }
4786         if (type == NCP_SERVICE_REPLY && ncp_rec && ncp_rec->func==0x68 &&
4787             ncp_rec->subfunc==0x02)
4788         {
4789                 nds_offset = 8;
4790                 nds_reply_buffer = tvb_get_letohl(tvb, nds_offset);
4791                 nds_offset += 4;        
4792                 nds_frag = tvb_get_letohl(tvb, nds_offset);        
4793                 if (nds_reply_buffer > 7)
4794                 {                        
4795                         nds_offset += 4; 
4796                         nds_error_code = tvb_get_letohl(tvb, nds_offset);
4797                         nds_error_string = match_strval(nds_error_code, nds_reply_errors);
4798                         if (nds_error_string == NULL)
4799                         {
4800                                 nds_error_string = "NDS Error - No Definition Found";
4801                         }
4802                         if (nds_error_string == NULL || nds_error_code == 0x00000000)
4803                         {
4804                                 nds_error_string = "Ok";
4805                         }        
4806                 }
4807         }
4808
4809         if (check_col(pinfo->cinfo, COL_INFO)) {
4810                 col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s",
4811                     type == NCP_SERVICE_REPLY ? "R" : "ACK",
4812                     nds_error_string ? nds_error_string : error_string);
4813         }
4814
4815         if (ncp_tree) {
4816                 if (request_value) {
4817                         nstime_t ns;
4818
4819                         proto_tree_add_uint(ncp_tree, hf_ncp_req_frame_num, tvb, 0, 0,
4820                                 request_value->req_frame_num);
4821                         ns.secs=pinfo->fd->abs_secs-request_value->req_frame_time.secs;
4822                         ns.nsecs=pinfo->fd->abs_usecs*1000-request_value->req_frame_time.nsecs;
4823                         if(ns.nsecs<0){
4824                                 ns.nsecs+=1000000000;
4825                                 ns.secs--;
4826                         }
4827                         proto_tree_add_time(ncp_tree, hf_ncp_req_frame_time, tvb, 0, 0, &ns);
4828
4829                 }
4830
4831                 /* Put the func (and maybe subfunc) from the request packet
4832                  * in the proto tree, but hidden. That way filters on ncp.func
4833                  * or ncp.subfunc will find both the requests and the replies.
4834                  */
4835                 if (ncp_rec) {
4836                         proto_tree_add_uint_format(ncp_tree, hf_ncp_func, tvb, 6, 0,
4837                                 ncp_rec->func, "Function: %u (0x%02X), %s",
4838                                 ncp_rec->func, ncp_rec->func, ncp_rec->name);
4839                         if (ncp_requires_subfunc(ncp_rec->func)) {
4840                                 proto_tree_add_uint_format(ncp_tree, hf_ncp_subfunc, tvb, 6, 0,
4841                                         ncp_rec->subfunc, "SubFunction: %u (0x%02x)",
4842                                         ncp_rec->subfunc, ncp_rec->subfunc);
4843                         }
4844                 }
4845
4846                 proto_tree_add_uint_format(ncp_tree, hf_ncp_completion_code, tvb, 6, 1,
4847                         completion_code, "Completion Code: %d (0x%02x), %s",
4848                         completion_code, completion_code, error_string);
4849
4850                 proto_tree_add_item(ncp_tree, hf_ncp_connection_status, tvb, 7, 1, FALSE);
4851
4852                 /*
4853                  * Unless this is a reply, that's all there is to parse.
4854                  */
4855                 if (type != NCP_SERVICE_REPLY)
4856                         return;
4857
4858                 /* Decode NDS Reply packets */
4859                 if (ncp_rec) {
4860                         if ((ncp_rec->func == 0x68 && ncp_rec->subfunc == 0x01) && completion_code == 0) {
4861                                 ping_version = tvb_get_guint8(tvb, 8);
4862                                 proto_tree_add_item(ncp_tree, hf_ping_version, tvb, 8, 1, TRUE);
4863                                 if (ping_version == 9) {
4864                                         nds_string_len = tvb_get_ntohl(tvb, 9);
4865                                         nds_offset = nds_string_len+16;
4866                                         proto_tree_add_item(ncp_tree, hf_nds_tree_name, tvb, 16, nds_string_len, FALSE);
4867                                         proto_tree_add_item(ncp_tree, hf_nds_reply_depth, tvb, nds_offset, 4, FALSE);
4868                                         proto_tree_add_item(ncp_tree, hf_nds_reply_rev, tvb, (nds_offset+4), 4, FALSE);
4869                                         proto_tree_add_item(ncp_tree, hf_nds_reply_flags, tvb, (nds_offset+8), 4, TRUE);
4870                                 }
4871                                 else {
4872                                         nds_offset = 12;
4873                                         nds_flags = request_value->req_nds_flags;
4874                                         bvalue = 0x00000001;
4875                                                 
4876                                         for (i = 0 ; i < 32; i++ ) {
4877                                                 if (nds_flags & bvalue) 
4878                                                 {
4879                                                         switch(bvalue)
4880                                                         {
4881                                                                 case 0x00000001:   /* Supported Fields */
4882                                                                         pvalues[0].vvalue = tvb_get_letohs(tvb, nds_offset);
4883                                                                         pvalues[0].vtype = VTYPE_BITFIELD;
4884                                                                         pvalues[0].vstring = "";
4885                                                                         pvalues[0].vdesc = "Ping (low) Supported Fields:";
4886                                                                         pvalues[0].vlength = 2;
4887                                                                         pvalues[0].hfname= hf_nds_rflags;
4888                                                                         pvalues[0].voffset = nds_offset;
4889                                                                         pvalues[0].bit1 = "Supported Fields";
4890                                                                         pvalues[0].bit1hfname = hf_bit1pingflags1;
4891                                                                         pvalues[0].bit2 = "Depth";
4892                                                                         pvalues[0].bit2hfname = hf_bit2pingflags1;
4893                                                                         pvalues[0].bit3 = "Revision";
4894                                                                         pvalues[0].bit3hfname = hf_bit3pingflags1;
4895                                                                         pvalues[0].bit4 = "Flags";
4896                                                                         pvalues[0].bit4hfname = hf_bit4pingflags1;
4897                                                                         pvalues[0].bit5 = "Verification Flags";
4898                                                                         pvalues[0].bit5hfname = hf_bit5pingflags1;
4899                                                                         pvalues[0].bit6 = "Letter Version";
4900                                                                         pvalues[0].bit6hfname = hf_bit6pingflags1;
4901                                                                         pvalues[0].bit7 = "OS Version";
4902                                                                         pvalues[0].bit7hfname = hf_bit7pingflags1;
4903                                                                         pvalues[0].bit8 = "License Flags";
4904                                                                         pvalues[0].bit8hfname = hf_bit8pingflags1;
4905                                                                         pvalues[0].bit9 = "DS Time";
4906                                                                         pvalues[0].bit9hfname = hf_bit9pingflags1;
4907                                                                         pvalues[0].bit10 = "Not Defined";
4908                                                                         pvalues[0].bit10hfname = hf_bit10pingflags1;
4909                                                                         pvalues[0].bit11 = "Not Defined";
4910                                                                         pvalues[0].bit11hfname = hf_bit11pingflags1;
4911                                                                         pvalues[0].bit12 = "Not Defined";
4912                                                                         pvalues[0].bit12hfname = hf_bit12pingflags1;
4913                                                                         pvalues[0].bit13 = "Not Defined";
4914                                                                         pvalues[0].bit13hfname = hf_bit13pingflags1;
4915                                                                         pvalues[0].bit14 = "Not Defined";
4916                                                                         pvalues[0].bit14hfname = hf_bit14pingflags1;
4917                                                                         pvalues[0].bit15 = "Not Defined";
4918                                                                         pvalues[0].bit15hfname = hf_bit15pingflags1;
4919                                                                         pvalues[0].bit16 = "Not Defined";
4920                                                                         pvalues[0].bit16hfname = hf_bit16pingflags1;
4921                                                                         
4922                                                                         process_bitfield(ncp_tree, tvb, &pvalues[0]);
4923                                                                         nds_offset += 2;
4924                                                                         
4925                                                                         pvalues[0].vvalue = tvb_get_letohs(tvb, nds_offset);
4926                                                                         pvalues[0].vtype = VTYPE_BITFIELD;
4927                                                                         pvalues[0].vstring = "";
4928                                                                         pvalues[0].vdesc = "Ping (high) Supported Fields:";
4929                                                                         pvalues[0].vlength = 2;
4930                                                                         pvalues[0].hfname= hf_nds_rflags;
4931                                                                         pvalues[0].voffset = nds_offset;
4932                                                                         pvalues[0].bit1 = "Sap Name";
4933                                                                         pvalues[0].bit1hfname = hf_bit1pingflags2;
4934                                                                         pvalues[0].bit2 = "Tree Name";
4935                                                                         pvalues[0].bit2hfname = hf_bit2pingflags2;
4936                                                                         pvalues[0].bit3 = "OS Name";
4937                                                                         pvalues[0].bit3hfname = hf_bit3pingflags2;
4938                                                                         pvalues[0].bit4 = "Hardware Name";
4939                                                                         pvalues[0].bit4hfname = hf_bit4pingflags2;
4940                                                                         pvalues[0].bit5 = "Vendor Name";
4941                                                                         pvalues[0].bit5hfname = hf_bit5pingflags2;
4942                                                                         pvalues[0].bit6 = "Not Defined";
4943                                                                         pvalues[0].bit6hfname = hf_bit6pingflags2;
4944                                                                         pvalues[0].bit7 = "Not Defined";
4945                                                                         pvalues[0].bit7hfname = hf_bit7pingflags2;
4946                                                                         pvalues[0].bit8 = "Not Defined";
4947                                                                         pvalues[0].bit8hfname = hf_bit8pingflags2;
4948                                                                         pvalues[0].bit9 = "Not Defined";
4949                                                                         pvalues[0].bit9hfname = hf_bit9pingflags2;
4950                                                                         pvalues[0].bit10 = "Not Defined";
4951                                                                         pvalues[0].bit10hfname = hf_bit10pingflags2;
4952                                                                         pvalues[0].bit11 = "Not Defined";
4953                                                                         pvalues[0].bit11hfname = hf_bit11pingflags2;
4954                                                                         pvalues[0].bit12 = "Not Defined";
4955                                                                         pvalues[0].bit12hfname = hf_bit12pingflags2;
4956                                                                         pvalues[0].bit13 = "Not Defined";
4957                                                                         pvalues[0].bit13hfname = hf_bit13pingflags2;
4958                                                                         pvalues[0].bit14 = "Not Defined";
4959                                                                         pvalues[0].bit14hfname = hf_bit14pingflags2;
4960                                                                         pvalues[0].bit15 = "Not Defined";
4961                                                                         pvalues[0].bit15hfname = hf_bit15pingflags2;
4962                                                                         pvalues[0].bit16 = "Not Defined";
4963                                                                         pvalues[0].bit16hfname = hf_bit16pingflags2;
4964                                                                         
4965                                                                         process_bitfield(ncp_tree, tvb, &pvalues[0]);
4966                                                                         nds_offset += 2;
4967                                                                         break;
4968                                                                 case 0x00000002:
4969                                                                         proto_tree_add_item(ncp_tree, hf_nds_reply_depth, tvb, nds_offset, 4, TRUE);
4970                                                                         nds_offset += 4;
4971                                                                         break;
4972                                                                 case 0x00000004:
4973                                                                         proto_tree_add_item(ncp_tree, hf_nds_reply_rev, tvb, nds_offset, 4, TRUE);
4974                                                                         nds_offset += 4;
4975                                                                         break;
4976                                                                 case 0x00000008:
4977                                                                         pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
4978                                                                         pvalues[0].vtype = VTYPE_BITFIELD;
4979                                                                         pvalues[0].vstring = "";
4980                                                                         pvalues[0].vdesc = "Ping Flags:";
4981                                                                         pvalues[0].vlength = 4;
4982                                                                         pvalues[0].hfname= hf_nds_rflags;
4983                                                                         pvalues[0].voffset = nds_offset;
4984                                                                         pvalues[0].bit1 = "Root Most Master Replica";
4985                                                                         pvalues[0].bit1hfname = hf_bit1pingpflags1;
4986                                                                         pvalues[0].bit2 = "Time Synchronized";
4987                                                                         pvalues[0].bit2hfname = hf_bit2pingpflags1;
4988                                                                         pvalues[0].bit3 = "Not Defined";
4989                                                                         pvalues[0].bit3hfname = hf_bit3pingpflags1;
4990                                                                         pvalues[0].bit4 = "Not Defined";
4991                                                                         pvalues[0].bit4hfname = hf_bit4pingpflags1;
4992                                                                         pvalues[0].bit5 = "Not Defined";
4993                                                                         pvalues[0].bit5hfname = hf_bit5pingpflags1;
4994                                                                         pvalues[0].bit6 = "Not Defined";
4995                                                                         pvalues[0].bit6hfname = hf_bit6pingpflags1;
4996                                                                         pvalues[0].bit7 = "Not Defined";
4997                                                                         pvalues[0].bit7hfname = hf_bit7pingpflags1;
4998                                                                         pvalues[0].bit8 = "Not Defined";
4999                                                                         pvalues[0].bit8hfname = hf_bit8pingpflags1;
5000                                                                         pvalues[0].bit9 = "Not Defined";
5001                                                                         pvalues[0].bit9hfname = hf_bit9pingpflags1;
5002                                                                         pvalues[0].bit10 = "Not Defined";
5003                                                                         pvalues[0].bit10hfname = hf_bit10pingpflags1;
5004                                                                         pvalues[0].bit11 = "Not Defined";
5005                                                                         pvalues[0].bit11hfname = hf_bit11pingpflags1;
5006                                                                         pvalues[0].bit12 = "Not Defined";
5007                                                                         pvalues[0].bit12hfname = hf_bit12pingpflags1;
5008                                                                         pvalues[0].bit13 = "Not Defined";
5009                                                                         pvalues[0].bit13hfname = hf_bit13pingpflags1;
5010                                                                         pvalues[0].bit14 = "Not Defined";
5011                                                                         pvalues[0].bit14hfname = hf_bit14pingpflags1;
5012                                                                         pvalues[0].bit15 = "Not Defined";
5013                                                                         pvalues[0].bit15hfname = hf_bit15pingpflags1;
5014                                                                         pvalues[0].bit16 = "Not Defined";
5015                                                                         pvalues[0].bit16hfname = hf_bit16pingpflags1;
5016                                                                         
5017                                                                         process_bitfield(ncp_tree, tvb, &pvalues[0]);
5018                                                                         nds_offset += 4;
5019                                                                         break;
5020                                                                 case 0x00000010:
5021                                                                         pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
5022                                                                         pvalues[0].vtype = VTYPE_BITFIELD;
5023                                                                         pvalues[0].vstring = "";
5024                                                                         pvalues[0].vdesc = "Verification Flags:";
5025                                                                         pvalues[0].vlength = 4;
5026                                                                         pvalues[0].hfname= hf_nds_rflags;
5027                                                                         pvalues[0].voffset = nds_offset;
5028                                                                         pvalues[0].bit1 = "Checksum";
5029                                                                         pvalues[0].bit1hfname = hf_bit1pingvflags1;
5030                                                                         pvalues[0].bit2 = "CRC32";
5031                                                                         pvalues[0].bit2hfname = hf_bit2pingvflags1;
5032                                                                         pvalues[0].bit3 = "Not Defined";
5033                                                                         pvalues[0].bit3hfname = hf_bit3pingvflags1;
5034                                                                         pvalues[0].bit4 = "Not Defined";
5035                                                                         pvalues[0].bit4hfname = hf_bit4pingvflags1;
5036                                                                         pvalues[0].bit5 = "Not Defined";
5037                                                                         pvalues[0].bit5hfname = hf_bit5pingvflags1;
5038                                                                         pvalues[0].bit6 = "Not Defined";
5039                                                                         pvalues[0].bit6hfname = hf_bit6pingvflags1;
5040                                                                         pvalues[0].bit7 = "Not Defined";
5041                                                                         pvalues[0].bit7hfname = hf_bit7pingvflags1;
5042                                                                         pvalues[0].bit8 = "Not Defined";
5043                                                                         pvalues[0].bit8hfname = hf_bit8pingvflags1;
5044                                                                         pvalues[0].bit9 = "Not Defined";
5045                                                                         pvalues[0].bit9hfname = hf_bit9pingvflags1;
5046                                                                         pvalues[0].bit10 = "Not Defined";
5047                                                                         pvalues[0].bit10hfname = hf_bit10pingvflags1;
5048                                                                         pvalues[0].bit11 = "Not Defined";
5049                                                                         pvalues[0].bit11hfname = hf_bit11pingvflags1;
5050                                                                         pvalues[0].bit12 = "Not Defined";
5051                                                                         pvalues[0].bit12hfname = hf_bit12pingvflags1;
5052                                                                         pvalues[0].bit13 = "Not Defined";
5053                                                                         pvalues[0].bit13hfname = hf_bit13pingvflags1;
5054                                                                         pvalues[0].bit14 = "Not Defined";
5055                                                                         pvalues[0].bit14hfname = hf_bit14pingvflags1;
5056                                                                         pvalues[0].bit15 = "Not Defined";
5057                                                                         pvalues[0].bit15hfname = hf_bit15pingvflags1;
5058                                                                         pvalues[0].bit16 = "Not Defined";
5059                                                                         pvalues[0].bit16hfname = hf_bit16pingvflags1;
5060                                                                         
5061                                                                         process_bitfield(ncp_tree, tvb, &pvalues[0]);
5062                                                                         nds_offset += 4;
5063                                                                         break;
5064                                                                 case 0x00000020:
5065                                                                         proto_tree_add_item(ncp_tree, hf_nds_letter_ver, tvb, nds_offset, 4, TRUE);
5066                                                                         nds_offset += 4;
5067                                                                         break;
5068                                                                 case 0x00000040:
5069                                                                         proto_tree_add_item(ncp_tree, hf_nds_os_ver, tvb, nds_offset, 4, TRUE);
5070                                                                         nds_offset += 4;
5071                                                                         break;
5072                                                                 case 0x00000080:
5073                                                                         proto_tree_add_item(ncp_tree, hf_nds_lic_flags, tvb, nds_offset, 4, TRUE);
5074                                                                         nds_offset += 4;
5075                                                                         break;
5076                                                                 case 0x00000100:
5077                                                                         proto_tree_add_item(ncp_tree, hf_nds_ds_time, tvb, nds_offset, 4, TRUE);
5078                                                                         nds_offset += 4;
5079                                                                         break;
5080                                                                 case 0x00010000:
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, "SAP Name: %s", reply_buffer.buffer);
5085                                                                         nds_offset += nds_string_len;
5086                                                                         nds_offset += align_4(tvb, nds_offset);
5087                                                                         nds_offset += 2;
5088                                                                         break;
5089                                                                 case 0x00020000:
5090                                                                         nds_string_len = tvb_get_letohl(tvb, nds_offset);
5091                                                                         nds_offset += 4;
5092                                                                         get_string(tvb, nds_offset, nds_string_len, reply_buffer.buffer);
5093                                                                         proto_tree_add_text(ncp_tree, tvb, nds_offset, nds_string_len, "NDS Tree Name: %s", reply_buffer.buffer);
5094                                                                         nds_offset += nds_string_len;
5095                                                                         nds_offset += align_4(tvb, nds_offset);
5096                                                                         break;
5097                                                                 case 0x00040000:
5098                                                                         nds_string_len = tvb_get_letohl(tvb, nds_offset);
5099                                                                         nds_offset += 4;
5100                                                                         get_string(tvb, nds_offset, nds_string_len, reply_buffer.buffer);
5101                                                                         proto_tree_add_text(ncp_tree, tvb, nds_offset, nds_string_len, "OS Name: %s", reply_buffer.buffer);
5102                                                                         nds_offset += nds_string_len;
5103                                                                         nds_offset += align_4(tvb, nds_offset);
5104                                                                         break;
5105                                                                 case 0x00080000:
5106                                                                         nds_string_len = tvb_get_letohl(tvb, nds_offset);
5107                                                                         nds_offset += 4;
5108                                                                         get_string(tvb, nds_offset, nds_string_len, reply_buffer.buffer);
5109                                                                         proto_tree_add_text(ncp_tree, tvb, nds_offset, nds_string_len, "Hardware Name: %s", reply_buffer.buffer);
5110                                                                         nds_offset += nds_string_len;
5111                                                                         nds_offset += align_4(tvb, nds_offset);
5112                                                                         break;
5113                                                                 case 0x00100000:
5114                                                                         nds_string_len = tvb_get_letohl(tvb, nds_offset);
5115                                                                         nds_offset += 4;
5116                                                                         get_string(tvb, nds_offset, nds_string_len, reply_buffer.buffer);
5117                                                                         proto_tree_add_text(ncp_tree, tvb, nds_offset, nds_string_len, "Vendor Name: %s", reply_buffer.buffer);
5118                                                                         nds_offset += nds_string_len;
5119                                                                         nds_offset += align_4(tvb, nds_offset);
5120                                                                         break;
5121                                                                 case 0x00000200:
5122                                                                         /* Not Defined */
5123                                                                 case 0x00000400:
5124                                                                         /* Not Defined */
5125                                                                 case 0x00000800:
5126                                                                         /* Not Defined */
5127                                                                 case 0x00001000:
5128                                                                         /* Not Defined */
5129                                                                 case 0x00002000:
5130                                                                         /* Not Defined */
5131                                                                 case 0x00004000:
5132                                                                         /* Not Defined */
5133                                                                 case 0x00008000:
5134                                                                         /* Not Defined */
5135                                                                 case 0x00200000:
5136                                                                         /* Not Defined */
5137                                                                 case 0x00400000:
5138                                                                         /* Not Defined */
5139                                                                 case 0x00800000:
5140                                                                         /* Not Defined */
5141                                                                 case 0x01000000:
5142                                                                         /* Not Defined */
5143                                                                 case 0x02000000:
5144                                                                         /* Not Defined */
5145                                                                 case 0x04000000:
5146                                                                         /* Not Defined */
5147                                                                 case 0x08000000:
5148                                                                         /* Not Defined */
5149                                                                 case 0x10000000:
5150                                                                         /* Not Defined */
5151                                                                 case 0x20000000:
5152                                                                         /* Not Defined */
5153                                                                 case 0x40000000:
5154                                                                         /* Not Defined */
5155                                                                 case 0x80000000:
5156                                                                         /* Not Defined */
5157                                                                 default:
5158                                                                         break;
5159                                                         }
5160                                                 }
5161                                                 bvalue = bvalue*2;
5162                                         }
5163                                 }        
5164                         }
5165                         if (ncp_rec->func == 0x68 && ncp_rec->subfunc == 0x02) 
5166                         {       
5167                                 nds_offset = 8;
5168                                         
5169                                 nds_reply_buffer = tvb_get_letohl(tvb, nds_offset);        
5170                                 proto_tree_add_uint(ncp_tree, hf_ncp_fragment_size, tvb, nds_offset,
5171                                         4, nds_reply_buffer);
5172                                 nds_offset += 4;
5173                                 nds_frag = tvb_get_letohl(tvb, nds_offset);        
5174                                 proto_tree_add_uint(ncp_tree, hf_ncp_fragment_handle, tvb, nds_offset,
5175                                         4, nds_frag);
5176                                 nds_offset += 4;        
5177                                 if (nds_reply_buffer > 7)
5178                                 {                        
5179                                         /*
5180                                          * XXX - is this present in
5181                                          * replies to continuation
5182                                          * messages?  It doesn't appear to
5183                                          * be.
5184                                          */
5185                                         proto_tree_add_uint_format(ncp_tree, hf_nds_reply_error, tvb, nds_offset,
5186                                                 4, nds_error_code, "NDS Completion Code: 0x%08x, %s",
5187                                                 nds_error_code, nds_error_string);
5188                                 }
5189                                 if (request_value && nds_error_code == 0x00000000)
5190                                 {
5191                                         nds_offset = 20;
5192                                         for (i = 0; i < 9; i++) {
5193                                                 pvalues[i].vtype = 0;
5194                                                 pvalues[i].vvalue = 0;
5195                                                 pvalues[i].vlength = 0;
5196                                                 pvalues[i].voffset = 0;
5197                                                 pvalues[i].hfname = 0;
5198                                                 pvalues[i].vdesc = "";
5199                                                 string_buffer[i][0] = '\0';
5200                                                 pvalues[i].vstring = string_buffer[i];
5201                                                 pvalues[i].mvtype = 0;
5202                                         }
5203                                         verb_string = val_to_str(request_value->nds_request_verb,
5204                                             ncp_nds_verb_vals,
5205                                             "Continuation Fragment");
5206                                         switch (request_value->nds_request_verb)
5207                                         {
5208                                                 case 0x01:
5209                                                         if(request_value->nds_version == 0)
5210                                                         { 
5211                                                                 pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
5212                                                                 pvalues[0].vstring = match_strval(pvalues[0].vvalue, nds_tags);
5213                                                                 if(pvalues[0].vstring == NULL)
5214                                                                 {
5215                                                                         pvalues[0].vstring = "No Tags Set";
5216                                                                 }
5217                                                                 pvalues[0].vtype = VTYPE_STRING;
5218                                                                 pvalues[0].vdesc = "Tag: %s";
5219                                                                 pvalues[0].vlength = 4;
5220                                                                 pvalues[0].voffset = nds_offset;
5221                                                                 pvalues[0].hfname = hf_nds_tag_string;
5222                                                                 nds_offset = nds_offset+pvalues[0].vlength;
5223                                                                 switch(pvalues[0].vvalue)
5224                                                                 {
5225                                                                         case 0:         /* No Such Entry */
5226                                                                                 break;
5227                                                                         case 1:         /* Local Entry */
5228                                                                                 pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
5229                                                                                 pvalues[1].vtype = VTYPE_UINT32;
5230                                                                                 pvalues[1].vdesc = "Entry ID: 0x%08x";
5231                                                                                 add_eid = TRUE;
5232                                                                                 strcpy(global_object_name, request_value->object_name);
5233                                                                                 global_eid = pvalues[1].vvalue;
5234                                                                                 pvalues[1].vlength = 4;
5235                                                                                 pvalues[1].voffset = nds_offset;
5236                                                                                 pvalues[1].hfname = hf_nds_eid;
5237                                                                                 nds_offset = nds_offset+pvalues[1].vlength;
5238                                                                                 pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
5239                                                                                 pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
5240                                                                                 pvalues[2].vdesc = "Referral Records: %u";
5241                                                                                 pvalues[2].vlength = 4;
5242                                                                                 pvalues[2].voffset = nds_offset;
5243                                                                                 pvalues[2].hfname = hf_nds_referrals;
5244                                                                                 pvalues[2].mvtype = MVTYPE_LOC_ADDR_REFERRAL_REPLY;
5245                                                                                 break;
5246                                                                         case 2:         /* Remote Entry */
5247                                                                                 nds_offset += 4;   /* GUINT32 reserved field */
5248                                                                                 pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
5249                                                                                 pvalues[1].vtype = VTYPE_UINT32;
5250                                                                                 pvalues[1].vdesc = "Entry ID: 0x%08x";
5251                                                                                 add_eid = TRUE;
5252                                                                                 global_eid = pvalues[1].vvalue;
5253                                                                                 strcpy(global_object_name, request_value->object_name);
5254                                                                                 pvalues[1].vlength = 4;
5255                                                                                 pvalues[1].voffset = nds_offset;
5256                                                                                 pvalues[1].hfname = hf_nds_eid;
5257                                                                                 nds_offset = nds_offset+pvalues[1].vlength;
5258                                                                                 pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
5259                                                                                 pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
5260                                                                                 pvalues[2].vdesc = "Referral Records: %u";
5261                                                                                 pvalues[2].vlength = 4;
5262                                                                                 pvalues[2].voffset = nds_offset;
5263                                                                                 pvalues[2].hfname = hf_nds_referrals;
5264                                                                                 pvalues[2].mvtype = MVTYPE_LOC_ADDR_REFERRAL_REPLY;
5265                                                                                 break;
5266                                                                         case 3:         /* Alias Entry */
5267                                                                                 pvalues[1].vtype = VTYPE_STRING;
5268                                                                                 pvalues[1].vdesc = "Alias Name: %s";
5269                                                                                 pvalues[1].mvtype = MVTYPE_ATTR_REQUEST;
5270                                                                                 pvalues[1].vvalue = 0;
5271                                                                                 pvalues[1].vlength = 256;
5272                                                                                 pvalues[1].vlength = tvb_get_letohl(tvb, nds_offset);
5273                                                                                 if (pvalues[1].vlength == 0x00)
5274                                                                                 {
5275                                                                                         pvalues[1].vtype = VTYPE_NONE;
5276                                                                                         break;
5277                                                                                 }
5278                                                                                 pvalues[1].voffset = nds_offset+4;
5279                                                                                 nds_offset += 4;
5280                                                                                 get_string(tvb, pvalues[1].voffset, pvalues[1].vlength, pvalues[1].vstring);
5281                                                                                 nds_offset += pvalues[1].vlength;
5282                                                                                 nds_offset += align_4(tvb, nds_offset);
5283                                                                                 pvalues[1].hfname= hf_nds_name;
5284                                                                                 break;
5285                                                                         case 4:         /* Referral Information */
5286                                                                                 pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
5287                                                                                 pvalues[1].vtype = VTYPE_UINT32;
5288                                                                                 pvalues[1].vdesc = "Distance Object is From Root: 0x%08x";
5289                                                                                 pvalues[1].vlength = 4;
5290                                                                                 pvalues[1].voffset = nds_offset;
5291                                                                                 pvalues[1].hfname = hf_nds_eid;
5292                                                                                 nds_offset = nds_offset+pvalues[1].vlength;
5293                                                                                 pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
5294                                                                                 pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
5295                                                                                 pvalues[2].vdesc = "Referral Records: %u";
5296                                                                                 pvalues[2].vlength = 4;
5297                                                                                 pvalues[2].voffset = nds_offset;
5298                                                                                 pvalues[2].hfname = hf_nds_depth;
5299                                                                                 pvalues[2].mvtype = MVTYPE_LOC_ADDR_REFERRAL_REPLY;
5300                                                                                 break;
5301                                                                         case 6:          /* Entry and Referrals */
5302                                                                                 pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
5303                                                                                 pvalues[1].vtype = VTYPE_UINT32;
5304                                                                                 pvalues[1].vdesc = "Result Flags: 0x%08x";
5305                                                                                 pvalues[1].vlength = 4;
5306                                                                                 pvalues[1].voffset = nds_offset;
5307                                                                                 pvalues[1].hfname = hf_nds_result_flags;
5308                                                                                 nds_offset = nds_offset+pvalues[1].vlength;
5309                                                                                 pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
5310                                                                                 pvalues[2].vtype = VTYPE_UINT32;
5311                                                                                 pvalues[2].vdesc = "Entry ID: 0x%08x";
5312                                                                                 add_eid = TRUE;
5313                                                                                 global_eid = pvalues[2].vvalue;
5314                                                                                 strcpy(global_object_name, request_value->object_name);
5315                                                                                 pvalues[2].vlength = 4;
5316                                                                                 pvalues[2].voffset = nds_offset;
5317                                                                                 pvalues[2].hfname = hf_nds_eid;
5318                                                                                 nds_offset = nds_offset+pvalues[2].vlength;
5319                                                                                 pvalues[3].vvalue = tvb_get_letohl(tvb, nds_offset);
5320                                                                                 pvalues[3].vtype = VTYPE_MULTIVALUE_UINT32;
5321                                                                                 pvalues[3].vdesc = "Referral Records: %u";
5322                                                                                 pvalues[3].vlength = 4;
5323                                                                                 pvalues[3].voffset = nds_offset;
5324                                                                                 pvalues[3].mvtype = MVTYPE_ADDR_REFERRAL_REPLY;
5325                                                                                 pvalues[3].hfname = hf_nds_referrals;
5326                                                                                 break;
5327                                                                         default:
5328                                                                                 break;
5329                                                                 }
5330                                                         }
5331                                                         else
5332                                                         {
5333                                                                 pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
5334                                                                 pvalues[0].vtype = VTYPE_UINT32;
5335                                                                 pvalues[0].vdesc = "CRC: 0x%08x";
5336                                                                 pvalues[0].vlength = 4;
5337                                                                 pvalues[0].voffset = nds_offset;
5338                                                                 pvalues[0].hfname = hf_nds_crc;
5339                                                                 nds_offset = nds_offset+pvalues[0].vlength;
5340                                                                 pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
5341                                                                 pvalues[1].vstring = match_strval(pvalues[1].vvalue, nds_tags);
5342                                                                 if(pvalues[1].vstring == NULL)
5343                                                                 {
5344                                                                         pvalues[1].vstring = "No Tags Set";
5345                                                                 }
5346                                                                 pvalues[1].vtype = VTYPE_STRING;
5347                                                                 pvalues[1].vdesc = "Tag: %s";
5348                                                                 pvalues[1].vlength = 4;
5349                                                                 pvalues[1].voffset = nds_offset;
5350                                                                 nds_offset = nds_offset+pvalues[1].vlength;
5351                                                                 pvalues[1].hfname = hf_nds_tag_string;
5352                                                                 switch(pvalues[1].vvalue)
5353                                                                 {
5354                                                                         case 0:         /* No Such Entry */
5355                                                                                 break;
5356                                                                         case 1:         /* Local Entry */
5357                                                                                 pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
5358                                                                                 pvalues[2].vtype = VTYPE_UINT32;
5359                                                                                 pvalues[2].vdesc = "Entry ID: 0x%08x";
5360                                                                                 add_eid = TRUE;
5361                                                                                 global_eid = pvalues[2].vvalue;
5362                                                                                 strcpy(global_object_name, request_value->object_name);
5363                                                                                 pvalues[2].vlength = 4;
5364                                                                                 pvalues[2].voffset = nds_offset;
5365                                                                                 pvalues[2].hfname = hf_nds_eid;
5366                                                                                 nds_offset = nds_offset+pvalues[2].vlength;
5367                                                                                 pvalues[3].vvalue = tvb_get_letohl(tvb, nds_offset);
5368                                                                                 pvalues[3].vtype = VTYPE_MULTIVALUE_UINT32;
5369                                                                                 pvalues[3].vdesc = "Referral Records: %u";
5370                                                                                 pvalues[3].vlength = 4;
5371                                                                                 pvalues[3].voffset = nds_offset;
5372                                                                                 pvalues[3].hfname = hf_nds_referrals;
5373                                                                                 pvalues[3].mvtype = MVTYPE_LOC_ADDR_REFERRAL_REPLY;
5374                                                                                 break;
5375                                                                         case 2:         /* Remote Entry */
5376                                                                                 nds_offset += 4;   /* GUINT32 reserved field */
5377                                                                                 pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
5378                                                                                 add_eid = TRUE;
5379                                                                                 global_eid = pvalues[2].vvalue;
5380                                                                                 strcpy(global_object_name, request_value->object_name);
5381                                                                                 pvalues[2].vtype = VTYPE_UINT32;
5382                                                                                 pvalues[2].vdesc = "Entry ID: 0x%08x";
5383                                                                                 pvalues[2].vlength = 4;
5384                                                                                 pvalues[2].voffset = nds_offset;
5385                                                                                 pvalues[2].hfname = hf_nds_eid;
5386                                                                                 nds_offset = nds_offset+pvalues[2].vlength;
5387                                                                                 pvalues[3].vvalue = tvb_get_letohl(tvb, nds_offset);
5388                                                                                 pvalues[3].vtype = VTYPE_MULTIVALUE_UINT32;
5389                                                                                 pvalues[3].vdesc = "Referral Records: %u";
5390                                                                                 pvalues[3].vlength = 4;
5391                                                                                 pvalues[3].voffset = nds_offset;
5392                                                                                 pvalues[3].hfname = hf_nds_referrals;
5393                                                                                 pvalues[3].mvtype = MVTYPE_LOC_ADDR_REFERRAL_REPLY;
5394                                                                                 break;
5395                                                                         case 3:         /* Alias Entry */
5396                                                                                 pvalues[2].vtype = VTYPE_STRING;
5397                                                                                 pvalues[2].vdesc = "Alias Name: %s";
5398                                                                                 pvalues[2].mvtype = MVTYPE_ATTR_REQUEST;
5399                                                                                 pvalues[2].vvalue = 0;
5400                                                                                 pvalues[2].vlength = 256;
5401                                                                                 pvalues[2].vlength = tvb_get_letohl(tvb, nds_offset);
5402                                                                                 if (pvalues[2].vlength == 0x00)
5403                                                                                 {
5404                                                                                         pvalues[2].vtype = VTYPE_NONE;
5405                                                                                         break;
5406                                                                                 }
5407                                                                                 pvalues[2].voffset = nds_offset+4;
5408                                                                                 nds_offset += 4;
5409                                                                                 get_string(tvb, pvalues[2].voffset, pvalues[2].vlength, pvalues[2].vstring);
5410                                                                                 nds_offset += pvalues[2].vlength;
5411                                                                                 nds_offset += align_4(tvb, nds_offset);
5412                                                                                 pvalues[2].hfname= hf_nds_name;
5413                                                                                 break;
5414                                                                         case 4:         /* Referral Information */
5415                                                                                 pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
5416                                                                                 pvalues[2].vtype = VTYPE_UINT32;
5417                                                                                 pvalues[2].vdesc = "Distance Object is From Root: 0x%08x";
5418                                                                                 pvalues[2].vlength = 4;
5419                                                                                 pvalues[2].voffset = nds_offset;
5420                                                                                 pvalues[2].hfname = hf_nds_eid;
5421                                                                                 nds_offset = nds_offset+pvalues[2].vlength;
5422                                                                                 pvalues[3].vvalue = tvb_get_letohl(tvb, nds_offset);
5423                                                                                 pvalues[3].vtype = VTYPE_MULTIVALUE_UINT32;
5424                                                                                 pvalues[3].vdesc = "Referral Records: %u";
5425                                                                                 pvalues[3].vlength = 4;
5426                                                                                 pvalues[3].voffset = nds_offset;
5427                                                                                 pvalues[3].hfname = hf_nds_depth;
5428                                                                                 pvalues[3].mvtype = MVTYPE_ADDR_REFERRAL_REPLY;
5429                                                                                 break;
5430                                                                         case 6:          /* Entry and Referrals */
5431                                                                                 pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
5432                                                                                 pvalues[2].vtype = VTYPE_UINT32;
5433                                                                                 pvalues[2].vdesc = "Result Flags: 0x%08x";
5434                                                                                 pvalues[2].vlength = 4;
5435                                                                                 pvalues[2].voffset = nds_offset;
5436                                                                                 pvalues[2].hfname = hf_nds_result_flags;
5437                                                                                 nds_offset = nds_offset+pvalues[2].vlength;
5438                                                                                 pvalues[3].vvalue = tvb_get_letohl(tvb, nds_offset);
5439                                                                                 pvalues[3].vtype = VTYPE_UINT32;
5440                                                                                 pvalues[3].vdesc = "Entry ID: 0x%08x";
5441                                                                                 add_eid = TRUE;
5442                                                                                 strcpy(global_object_name, request_value->object_name);
5443                                                                                 global_eid = pvalues[3].vvalue;
5444                                                                                 pvalues[3].vlength = 4;
5445                                                                                 pvalues[3].voffset = nds_offset;
5446                                                                                 pvalues[3].hfname = hf_nds_eid;
5447                                                                                 nds_offset = nds_offset+pvalues[3].vlength;
5448                                                                                 pvalues[4].vvalue = tvb_get_letohl(tvb, nds_offset);
5449                                                                                 pvalues[4].vtype = VTYPE_MULTIVALUE_UINT32;
5450                                                                                 pvalues[4].vdesc = "Referral Records: %u";
5451                                                                                 pvalues[4].vlength = 4;
5452                                                                                 pvalues[4].voffset = nds_offset;
5453                                                                                 pvalues[4].mvtype = MVTYPE_ADDR_REFERRAL_REPLY;
5454                                                                                 pvalues[4].hfname = hf_nds_referrals;
5455                                                                                 break;
5456                                                                         default:
5457                                                                                 break;
5458                                                                 }
5459                                                                 
5460                                                         }
5461                                                         break;
5462                                                 case 0x02:    
5463                                                         if(request_value->nds_version != 0x000000fe)
5464                                                         { 
5465                                                                 pvalues[0].vvalue = 1;
5466                                                                 pvalues[0].vtype = VTYPE_MULTIVALUE_UINT32;
5467                                                                 pvalues[0].vdesc = "Entry Information";
5468                                                                 pvalues[0].vlength = 0;
5469                                                                 pvalues[0].voffset = nds_offset-4;
5470                                                                 pvalues[0].hfname = hf_nds_name;
5471                                                                 pvalues[0].mvtype = MVTYPE_LIST_PARTITIONS;
5472                                                                 pvalues[0].vflags = request_value->req_nds_flags;
5473                                                         }
5474                                                         else
5475                                                         {
5476                                                                 pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
5477                                                                 pvalues[0].vtype = VTYPE_UINT32;
5478                                                                 pvalues[0].vdesc = "CRC: 0x%08x";
5479                                                                 pvalues[0].vlength = 4;
5480                                                                 pvalues[0].voffset = nds_offset;
5481                                                                 pvalues[0].hfname = hf_nds_crc;
5482                                                                 nds_offset = nds_offset+pvalues[0].vlength;
5483                                                                 pvalues[1].vvalue = 1;
5484                                                                 pvalues[1].vtype = VTYPE_MULTIVALUE_UINT32;
5485                                                                 pvalues[1].vdesc = "Entry Information";
5486                                                                 pvalues[1].vlength = 0;
5487                                                                 pvalues[1].voffset = nds_offset-4;
5488                                                                 pvalues[1].hfname = hf_nds_name;
5489                                                                 pvalues[1].mvtype = MVTYPE_LIST_PARTITIONS;
5490                                                                 pvalues[1].vflags = request_value->req_nds_flags;
5491                                                         }
5492                                                         break;
5493                                                 case 0x03:    
5494                                                         if(request_value->nds_version != 0x000000fe)
5495                                                         { 
5496                                                                 pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
5497                                                                 pvalues[0].vtype = VTYPE_UINT32;
5498                                                                 pvalues[0].vdesc = "Iteration Handle: 0x%08x";
5499                                                                 pvalues[0].vlength = 4;
5500                                                                 pvalues[0].voffset = nds_offset;
5501                                                                 pvalues[0].hfname = hf_nds_iteration;
5502                                                                 nds_offset = nds_offset+pvalues[0].vlength;
5503                                                                 pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
5504                                                                 pvalues[1].vstring = match_strval(pvalues[1].vvalue, nds_info_type);
5505                                                                 if(pvalues[1].vstring == NULL)
5506                                                                 {
5507                                                                         pvalues[1].vstring = "No Info Type Set";
5508                                                                 }
5509                                                                 pvalues[1].vtype = VTYPE_STRING;
5510                                                                 pvalues[1].vdesc = "Info Type: %s";
5511                                                                 pvalues[1].vlength = 4;
5512                                                                 pvalues[1].voffset = nds_offset;
5513                                                                 pvalues[1].hfname = hf_nds_info_type;
5514                                                                 nds_offset = nds_offset+pvalues[1].vlength;
5515                                                                 pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
5516                                                                 pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
5517                                                                 pvalues[2].vdesc = "Number of Attributes: %u";
5518                                                                 pvalues[2].vlength = 4;
5519                                                                 pvalues[2].voffset = nds_offset;
5520                                                                 pvalues[2].hfname = hf_nds_attr;
5521                                                                 pvalues[2].mvtype = MVTYPE_ATTR_REPLY;
5522                                                                 pvalues[2].vflags = request_value->req_nds_flags;
5523                                                                 pvalues[2].nds_version = request_value->nds_version;
5524                                                         }
5525                                                         else
5526                                                         {
5527                                                                 pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
5528                                                                 pvalues[0].vtype = VTYPE_UINT32;
5529                                                                 pvalues[0].vdesc = "CRC: 0x%08x";
5530                                                                 pvalues[0].vlength = 4;
5531                                                                 pvalues[0].voffset = nds_offset;
5532                                                                 pvalues[0].hfname = hf_nds_crc;
5533                                                                 nds_offset = nds_offset+pvalues[0].vlength;
5534                                                                 pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
5535                                                                 pvalues[1].vtype = VTYPE_UINT32;
5536                                                                 pvalues[1].vdesc = "Iteration Handle: 0x%08x";
5537                                                                 pvalues[1].vlength = 4;
5538                                                                 pvalues[1].voffset = nds_offset;
5539                                                                 pvalues[1].hfname = hf_nds_iteration;
5540                                                                 nds_offset = nds_offset+pvalues[1].vlength;
5541                                                                 pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
5542                                                                 pvalues[2].vstring = match_strval(pvalues[2].vvalue, nds_info_type);
5543                                                                 if(pvalues[2].vstring == NULL)
5544                                                                 {
5545                                                                         pvalues[2].vstring = "No Info Type Set";
5546                                                                 }
5547                                                                 pvalues[2].vtype = VTYPE_STRING;
5548                                                                 pvalues[2].vdesc = "Info Type: %s";
5549                                                                 pvalues[2].vlength = 4;
5550                                                                 pvalues[2].voffset = nds_offset;
5551                                                                 pvalues[2].hfname = hf_nds_info_type;
5552                                                                 nds_offset = nds_offset+pvalues[2].vlength;
5553                                                                 pvalues[3].vvalue = tvb_get_letohl(tvb, nds_offset);
5554                                                                 pvalues[3].vtype = VTYPE_MULTIVALUE_UINT32;
5555                                                                 pvalues[3].vdesc = "Number of Attributes: %u";
5556                                                                 pvalues[3].vlength = 4;
5557                                                                 pvalues[3].voffset = nds_offset;
5558                                                                 pvalues[3].hfname = hf_nds_attr;
5559                                                                 pvalues[3].mvtype = MVTYPE_ATTR_REPLY;
5560                                                                 pvalues[3].vflags = request_value->req_nds_flags;
5561                                                                 pvalues[3].nds_version = request_value->nds_version;
5562                                                         }
5563                                                         break;
5564                                                 case 0x04:    
5565                                                         pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
5566                                                         if (pvalues[0].vvalue == 0x00000000)
5567                                                         {
5568                                                                 pvalues[0].vstring = "Did Not Match";
5569                                                         }        
5570                                                         else
5571                                                         {
5572                                                                 pvalues[0].vstring = "Matched";
5573                                                         }
5574                                                         pvalues[0].vtype = VTYPE_STRING;
5575                                                         pvalues[0].vdesc = "Compare Values Returned - %s";
5576                                                         pvalues[0].vlength = 4;
5577                                                         pvalues[0].voffset = nds_offset;
5578                                                         pvalues[0].mvtype = 0;
5579                                                         pvalues[0].hfname= hf_nds_compare_results;
5580                                                         nds_offset += pvalues[0].vlength;
5581                                                         break;
5582                                                 case 0x05:    
5583                                                         pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
5584                                                         pvalues[0].vtype = VTYPE_UINT32;
5585                                                         pvalues[0].vdesc = "Iteration Handle: 0x%08x";
5586                                                         pvalues[0].vlength = 4;
5587                                                         pvalues[0].voffset = nds_offset;
5588                                                         pvalues[0].hfname = hf_nds_iteration;
5589                                                         nds_offset = nds_offset+pvalues[0].vlength;
5590                                                         pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
5591                                                         pvalues[1].vtype = VTYPE_MULTIVALUE_UINT32;
5592                                                         pvalues[1].vdesc = "Entry Information";
5593                                                         pvalues[1].vlength = 0;
5594                                                         pvalues[1].voffset = nds_offset;
5595                                                         pvalues[1].hfname = hf_nds_name;
5596                                                         pvalues[1].mvtype = MVTYPE_LIST_PARTITIONS;
5597                                                         pvalues[1].vflags = request_value->req_nds_flags;
5598                                                         break;
5599                                                 case 0x06:    
5600                                                         break;
5601                                                 case 0x07:    
5602                                                         break;
5603                                                 case 0x08:    
5604                                                         break;
5605                                                 case 0x09:    
5606                                                         break;
5607                                                 case 0x0a:    
5608                                                         break;
5609                                                 case 0x0b:    
5610                                                         break;
5611                                                 case 0x0c:    
5612                                                         break;
5613                                                 case 0x0d:    
5614                                                         break;
5615                                                 case 0x0e:    
5616                                                         break;
5617                                                 case 0x0f:    
5618                                                         pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
5619                                                         pvalues[0].vtype = VTYPE_UINT32;
5620                                                         pvalues[0].vdesc = "Iteration Handle: 0x%08x";
5621                                                         pvalues[0].vlength = 4;
5622                                                         pvalues[0].voffset = nds_offset;
5623                                                         pvalues[0].hfname = hf_nds_iteration;
5624                                                         nds_offset = nds_offset+pvalues[0].vlength;
5625                                                         pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
5626                                                         pvalues[1].vstring = match_strval(pvalues[1].vvalue, class_def_type);
5627                                                         if(pvalues[1].vstring == NULL)
5628                                                         {
5629                                                                 pvalues[1].vstring = "No Class Definition Type Set";
5630                                                         }
5631                                                         pvalues[1].vtype = VTYPE_STRING;
5632                                                         pvalues[1].vdesc = "Class Definition Type: %s";
5633                                                         pvalues[1].vlength = 4;
5634                                                         pvalues[1].voffset = nds_offset;
5635                                                         pvalues[1].mvtype = 0;
5636                                                         pvalues[1].hfname= hf_nds_class_def_type;
5637                                                         nds_offset = nds_offset + pvalues[1].vlength;
5638                                                         pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);;
5639                                                         pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
5640                                                         pvalues[2].vdesc = "Class Definitions %u";
5641                                                         pvalues[2].vlength = 0;
5642                                                         pvalues[2].voffset = nds_offset;
5643                                                         pvalues[2].hfname = hf_nds_classes;
5644                                                         pvalues[2].mvtype = MVTYPE_CLASS_NAMES;
5645                                                         pvalues[2].vflags = request_value->req_nds_flags;
5646                                                         break;
5647                                                 case 0x10:    
5648                                                         break;
5649                                                 case 0x11:    
5650                                                         break;
5651                                                 case 0x12:    
5652                                                         pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
5653                                                         pvalues[0].vtype = VTYPE_UINT32;
5654                                                         pvalues[0].vdesc = "Iteration Handle: 0x%08x";
5655                                                         pvalues[0].vlength = 4;
5656                                                         pvalues[0].voffset = nds_offset;
5657                                                         pvalues[0].hfname = hf_nds_iteration;
5658                                                         nds_offset = nds_offset+pvalues[0].vlength;
5659                                                         pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
5660                                                         pvalues[1].vtype = VTYPE_MULTIVALUE_UINT32;
5661                                                         pvalues[1].vdesc = "Classes: %u";
5662                                                         pvalues[1].vlength = 4;
5663                                                         pvalues[1].voffset = nds_offset;
5664                                                         pvalues[1].mvtype = MVTYPE_READ_CLASS_REQ;
5665                                                         pvalues[1].hfname= hf_nds_classes;
5666                                                         break;
5667                                                 case 0x13:    
5668                                                         pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
5669                                                         pvalues[0].vtype = VTYPE_UINT32;
5670                                                         pvalues[0].vdesc = "Privileges: 0x%08x";
5671                                                         pvalues[0].vlength = 4;
5672                                                         pvalues[0].voffset = nds_offset;
5673                                                         pvalues[0].hfname = hf_nds_privileges;
5674                                                         nds_offset = nds_offset+pvalues[0].vlength;
5675                                                         break;
5676                                                 case 0x14:    
5677                                                         break;
5678                                                 case 0x15:    
5679                                                         break;
5680                                                 case 0x16:    
5681                                                         pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
5682                                                         pvalues[0].vtype = VTYPE_UINT32;
5683                                                         pvalues[0].vdesc = "Iteration Handle: 0x%08x";
5684                                                         pvalues[0].vlength = 4;
5685                                                         pvalues[0].voffset = nds_offset;
5686                                                         pvalues[0].hfname = hf_nds_iteration;
5687                                                         nds_offset = nds_offset+pvalues[0].vlength;
5688                                                         pvalues[1].vtype = VTYPE_STRING;
5689                                                         pvalues[1].vdesc = "Server Distinguished Name: %s";
5690                                                         pvalues[1].mvtype = MVTYPE_ATTR_REQUEST;
5691                                                         pvalues[1].vvalue = 0;
5692                                                         pvalues[1].vlength = 256;
5693                                                         pvalues[1].vlength = tvb_get_letohl(tvb, nds_offset);
5694                                                         if (pvalues[1].vlength == 0x00)
5695                                                         {
5696                                                                 pvalues[1].vtype = VTYPE_NONE;
5697                                                                 break;
5698                                                         }
5699                                                         pvalues[1].voffset = nds_offset+4;
5700                                                         nds_offset += 4;
5701                                                         get_string(tvb, pvalues[1].voffset, pvalues[1].vlength, pvalues[1].vstring);
5702                                                         nds_offset += pvalues[1].vlength;
5703                                                         nds_offset += align_4(tvb, nds_offset);
5704                                                         pvalues[1].hfname= hf_nds_name;
5705                                                         nds_offset += align_4(tvb, nds_offset);
5706                                                         pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
5707                                                         pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
5708                                                         pvalues[2].vdesc = "Replicas: %u";
5709                                                         pvalues[2].vlength = 4;
5710                                                         pvalues[2].voffset = nds_offset;
5711                                                         pvalues[2].hfname = hf_nds_replicas;
5712                                                         pvalues[2].mvtype = MVTYPE_READ_REPLICAS;
5713                                                         pvalues[2].bit1 = "Output Flags";
5714                                                         pvalues[2].bit2 = "Entry ID";
5715                                                         pvalues[2].bit3 = "Replica State";
5716                                                         pvalues[2].bit4 = "Modification Timestamp";
5717                                                         pvalues[2].bit5 = "Purge Time";
5718                                                         pvalues[2].bit6 = "Local Partition ID";
5719                                                         pvalues[2].bit7 = "Distinguished Name";
5720                                                         pvalues[2].bit8 = "Replica Type";
5721                                                         pvalues[2].bit9 = "Partition Busy";
5722                                                         pvalues[2].vflags = request_value->req_nds_flags;
5723                                                         break;
5724                                                 case 0x17:    
5725                                                         break;
5726                                                 case 0x18:    
5727                                                         break;
5728                                                 case 0x19:    
5729                                                         break;
5730                                                 case 0x1a:    
5731                                                         break;
5732                                                 case 0x1b:    
5733                                                         pvalues[0].vvalue = tvb_get_ntohl(tvb, nds_offset);
5734                                                         pvalues[0].vtype = VTYPE_UINT32;
5735                                                         pvalues[0].vdesc = "File Handle: 0x%08x";
5736                                                         pvalues[0].vlength = 4;
5737                                                         pvalues[0].voffset = nds_offset;
5738                                                         pvalues[0].hfname = hf_nds_file_handle;
5739                                                         nds_offset = nds_offset+pvalues[0].vlength;
5740                                                         pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
5741                                                         pvalues[1].vtype = VTYPE_UINT32;
5742                                                         pvalues[1].vdesc = "File Size: %u";
5743                                                         pvalues[1].vlength = 4;
5744                                                         pvalues[1].voffset = nds_offset;
5745                                                         pvalues[1].hfname = hf_nds_file_size;
5746                                                         nds_offset = nds_offset+pvalues[1].vlength;
5747                                                         break;
5748                                                 case 0x1c:    
5749                                                         break;
5750                                                 case 0x1d:    
5751                                                         break;
5752                                                 case 0x1e:    
5753                                                         break;
5754                                                 case 0x1f:    
5755                                                         break;
5756                                                 case 0x20:    
5757                                                         break;
5758                                                 case 0x21:    
5759                                                         break;
5760                                                 case 0x22:    
5761                                                         break;
5762                                                 case 0x23:    
5763                                                         break;
5764                                                 case 0x24:    
5765                                                         break;
5766                                                 case 0x25:    
5767                                                         break;
5768                                                 case 0x26:    
5769                                                         break;
5770                                                 case 0x27:    
5771                                                         break;
5772                                                 case 0x28:    
5773                                                         break;
5774                                                 case 0x29:    
5775                                                         break;                  
5776                                                 case 0x2a:    
5777                                                         break;
5778                                                 case 0x2b:    
5779                                                         break;
5780                                                 case 0x2c:    
5781                                                         break;
5782                                                 case 0x2d:    
5783                                                         break;
5784                                                 case 0x2e:    
5785                                                         break;
5786                                                 case 0x2f:    
5787                                                         break;
5788                                                 case 0x30:
5789                                                         break;
5790                                                 case 0x31:
5791                                                         break;
5792                                                 case 0x32:    
5793                                                         break;
5794                                                 case 0x33:    
5795                                                         break;
5796                                                 case 0x34:    
5797                                                         break;
5798                                                 case 0x35:    
5799                                                         if(request_value->nds_version != 0x000000fe)
5800                                                         { 
5801                                                                 pvalues[0].vtype = VTYPE_STRING;
5802                                                                 pvalues[0].vdesc = "Distinguished Name: %s";
5803                                                                 pvalues[0].mvtype = MVTYPE_ATTR_REQUEST;
5804                                                                 pvalues[0].vvalue = 0;
5805                                                                 pvalues[0].vlength = 256;
5806                                                                 pvalues[0].vlength = tvb_get_letohl(tvb, nds_offset);
5807                                                                 if (pvalues[0].vlength == 0x00)
5808                                                                 {
5809                                                                         pvalues[0].vtype = VTYPE_NONE;
5810                                                                         break;
5811                                                                 }
5812                                                                 pvalues[0].voffset = nds_offset+4;
5813                                                                 nds_offset += 4;
5814                                                                 get_string(tvb, pvalues[0].voffset, pvalues[0].vlength, pvalues[0].vstring);
5815                                                                 nds_offset += pvalues[0].vlength;
5816                                                                 nds_offset += align_4(tvb, nds_offset);
5817                                                                 pvalues[0].hfname= hf_nds_name;
5818                                                                 pvalues[1].vvalue = tvb_get_letohl(tvb, nds_offset);
5819                                                                 pvalues[1].vtype = VTYPE_MULTIVALUE_UINT32;
5820                                                                 pvalues[1].vdesc = "Referral Records: %u";
5821                                                                 pvalues[1].vlength = 4;
5822                                                                 pvalues[1].voffset = nds_offset;
5823                                                                 pvalues[1].hfname = hf_nds_referrals;
5824                                                                 pvalues[1].mvtype = MVTYPE_LOC_ADDR_REFERRAL_REPLY;
5825                                                         }
5826                                                         else
5827                                                         {
5828                                                                 pvalues[0].vvalue = tvb_get_letohl(tvb, nds_offset);
5829                                                                 pvalues[0].vtype = VTYPE_UINT32;
5830                                                                 pvalues[0].vdesc = "Iteration Handle: 0x%08x";
5831                                                                 pvalues[0].vlength = 4;
5832                                                                 pvalues[0].voffset = nds_offset;
5833                                                                 pvalues[0].hfname = hf_nds_iteration;
5834                                                                 nds_offset = nds_offset+pvalues[0].vlength;
5835                                                                 pvalues[1].vtype = VTYPE_STRING;
5836                                                                 pvalues[1].vdesc = "Distinguished Name: %s";
5837                                                                 pvalues[1].mvtype = MVTYPE_ATTR_REQUEST;
5838                                                                 pvalues[1].vvalue = 0;
5839                                                                 pvalues[1].vlength = 256;
5840                                                                 pvalues[1].vlength = tvb_get_letohl(tvb, nds_offset);
5841                                                                 if (pvalues[1].vlength == 0x00)
5842                                                                 {
5843                                                                         pvalues[1].vtype = VTYPE_NONE;
5844                                                                         break;
5845                                                                 }
5846                                                                 pvalues[1].voffset = nds_offset+4;
5847                                                                 nds_offset += 4;
5848                                                                 get_string(tvb, pvalues[1].voffset, pvalues[1].vlength, pvalues[1].vstring);
5849                                                                 nds_offset += pvalues[1].vlength;
5850                                                                 nds_offset += align_4(tvb, nds_offset);
5851                                                                 pvalues[1].hfname= hf_nds_name;
5852                                                                 pvalues[2].vvalue = tvb_get_letohl(tvb, nds_offset);
5853                                                                 pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
5854                                                                 pvalues[2].vdesc = "Referral Records: %u";
5855                                                                 pvalues[2].vlength = 4;
5856                                                                 pvalues[2].voffset = nds_offset;
5857                                                                 pvalues[2].hfname = hf_nds_referrals;
5858                                                                 pvalues[2].mvtype = MVTYPE_LOC_ADDR_REFERRAL_REPLY;
5859                                                         }        
5860                                                         break;
5861                                                 case 0x36:    
5862                                                         break;
5863                                                 case 0x37:    
5864                                                         break;
5865                                                 case 0x38:    
5866                                                         break;
5867                                                 case 0x39:    
5868                                                         break;
5869                                                 case 0x3a:    
5870                                                         break;
5871                                                 case 0x3b:    
5872                                                         break;
5873                                                 case 0x3c:    
5874                                                         break;
5875                                                 case 0x3d:    
5876                                                         break;
5877                                                 case 0x3e:    
5878                                                         break;
5879                                                 case 0x3f:    
5880                                                         break;
5881                                                 case 0x40:    
5882                                                         break;
5883                                                 case 0x41:              
5884                                                         break;
5885                                                 case 0x42:    
5886                                                         break;
5887                                                 case 0x43:    
5888                                                         break;
5889                                                 case 0x44:    
5890                                                         break;
5891                                                 case 0x45:    
5892                                                         break;
5893                                                 case 0x46:    
5894                                                         break;
5895                                                 case 0x47:    
5896                                                         break;
5897                                                 case 0x48:    
5898                                                         break;
5899                                                 case 0x49:    
5900                                                         break;
5901                                                 case 0x4a:    
5902                                                         break;
5903                                                 case 0x4b:    
5904                                                         break;
5905                                                 case 0x4c:    
5906                                                         break;
5907                                                 case 0x4d:    
5908                                                         break;
5909                                                 default:
5910                                                         break;
5911                                         }        
5912                                         if(request_value->nds_request_verb != 0)
5913                                         {
5914                                                 proto_tree_add_uint_format(ncp_tree, hf_ncp_nds_verb, tvb, 6, 0,
5915                                                         request_value->nds_request_verb, "NDS Verb: %d, %s",
5916                                                         request_value->nds_request_verb, verb_string);
5917                                         }
5918                                         /* NDS Entry ID's (EID) is identified in the reply packet of an NDS 
5919                                          * resolve name. We need to store this EID and it's associated
5920                                          * name into our hash so that we can resolve the name for 
5921                                          * other NDS requests. */
5922                                         if (!pinfo->fd->flags.visited) {
5923                                                 if(add_eid)
5924                                                 {
5925                                                         request_eid_value = ncp_eid_hash_lookup(conversation, global_eid);
5926                                                                 if (!request_eid_value) {
5927                                                                         request_eid_value = ncp_eid_hash_insert(global_eid);
5928                                                                         strcpy(request_eid_value->object_name, global_object_name);
5929                                                                 }        
5930                                                 }
5931                                         }
5932                                         /* For NDS requests with just an EID, resolve name from hash table. */
5933                                         if(resolve_eid)
5934                                         {
5935                                                 request_eid_value = ncp_eid_hash_lookup(conversation, global_eid);
5936                                                 if (request_eid_value) {
5937                                                         strcpy(global_object_name, request_eid_value->object_name);
5938                                                         proto_tree_add_string_format(ncp_tree, hf_nds_name, tvb, 6, 0,
5939                                                                 global_object_name, "NDS Name for EID - %s",
5940                                                                 global_object_name);
5941                                                 }
5942                                         }        
5943                                         for (i = 0; i < 9; i++) {
5944                                                 switch (pvalues[i].vtype) {
5945
5946                                                 case VTYPE_NONE: /* no value */
5947                                                         break;
5948
5949                                                 case VTYPE_UINT8:
5950                                                         proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
5951                                                             pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %u",
5952                                                             pvalues[i].vtype);
5953                                                         break;
5954
5955                                                 case VTYPE_UINT16:
5956                                                         proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
5957                                                             pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %u",
5958                                                             pvalues[i].vtype);
5959                                                         break;
5960
5961                                                 case VTYPE_UINT32:
5962                                                         proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
5963                                                             pvalues[i].vlength, pvalues[i].vvalue, pvalues[i].vdesc,
5964                                                             pvalues[i].vvalue);
5965                                                         break;
5966
5967                                                 case VTYPE_STRING:
5968                                                         proto_tree_add_string_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset, 
5969                                                             pvalues[i].vlength, pvalues[i].vstring, pvalues[i].vdesc,
5970                                                             pvalues[i].vstring);
5971                                                         break;
5972
5973                                                 case VTYPE_BITFIELD:
5974                                                         process_bitfield(ncp_tree, tvb, &pvalues[i]);
5975                                                         break;
5976
5977                                                 case VTYPE_MULTIVALUE_UINT32:
5978                                                         process_multivalues(ncp_tree, tvb, &pvalues[i]);
5979                                                         break;
5980
5981                                                 default:
5982                                                         proto_tree_add_uint_format(ncp_tree, hf_nds_p1type, tvb, pvalues[i].voffset,
5983                                                             pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %u",
5984                                                             pvalues[i].vtype);
5985                                                         break;
5986                                                 }
5987                                         }
5988                                 }                
5989                         }
5990                 }
5991
5992                 length = tvb_length(tvb);
5993                 if (!ncp_rec && length > 8) {
5994                         proto_tree_add_text(ncp_tree, tvb, 8, length - 8,
5995                                         "No request record found. Parsing is impossible.");
5996                 }
5997                 else if (ncp_rec && ncp_rec->reply_ptvc) {
5998                         /* If a non-zero completion code was found, it is
5999                          * legal to not have any fields, even if the packet
6000                          * type is defined as having fields. */
6001                         if (completion_code != 0 && tvb_length(tvb) == 8) {
6002                                 return;
6003                         }
6004                         /*printf("func=0x%x subfunc=0x%x\n", ncp_rec->func, ncp_rec->subfunc);*/
6005
6006                         /* Any request condition results? */
6007                         if (request_value) {
6008                                 req_cond_results = request_value->req_cond_results;
6009                         }
6010                         else {
6011                                 req_cond_results = NULL;
6012                         }
6013
6014                         clear_repeat_vars();
6015                         ptvc = ptvcursor_new(ncp_tree, tvb, 8);
6016                         process_ptvc_record(ptvc, ncp_rec->reply_ptvc, req_cond_results,
6017                                         TRUE, ncp_rec);
6018                         ptvcursor_free(ptvc);
6019                 }
6020         }
6021 }
6022
6023 void
6024 dissect_nds_request(tvbuff_t *tvb, packet_info *pinfo,
6025                 guint16 nw_connection, guint8 sequence,
6026                 guint16 type, proto_tree *ncp_tree)
6027 {
6028         guint8                  func, subfunc = 0;
6029         ncp_req_hash_value      *request_value = NULL;
6030         ncp_req_eid_hash_value  *request_eid_value = NULL;
6031         const ncp_record        *ncp_rec = NULL;          
6032         conversation_t          *conversation;
6033         ptvcursor_t             *ptvc = NULL;
6034         proto_tree              *temp_tree = NULL;
6035         gboolean                run_req_cond = FALSE;
6036         gboolean                run_info_str = FALSE;
6037         guint8                  nds_verb = 0;
6038         char *                  verb_string = "";
6039         guint32                 nds_frag = 0;
6040         gboolean                added_arrow;
6041         nds_val                 pvalues[9];
6042         char                    string_buffer[9][1024];
6043         guint8                  nds_version = 0;
6044         guint32                 foffset = 0;
6045         guint32                 nds_reply_buffer;
6046         nw_uni_t                req_buffer;
6047         char                    global_object_name[256];
6048         guint32                 global_eid=0;
6049         gboolean                resolve_eid=FALSE;
6050         guint32                 global_flags=0;
6051         int                     i;
6052         
6053         for (i = 0; i < 9; i++) {
6054                 pvalues[i].vtype = 0;
6055                 pvalues[i].vvalue = 0;
6056                 pvalues[i].vlength = 0;
6057                 pvalues[i].voffset = 0;
6058                 pvalues[i].hfname = 0;
6059                 pvalues[i].vdesc = "";
6060                 string_buffer[i][0] = '\0';
6061                 pvalues[i].vstring = string_buffer[i];
6062                 pvalues[i].mvtype = 0;
6063         }
6064         
6065         strcpy(req_buffer.buffer, "");
6066         strcpy(global_object_name, "");
6067         
6068         func = tvb_get_guint8(tvb, 6);
6069         subfunc = tvb_get_guint8(tvb, 7);
6070         
6071         ncp_rec = ncp_record_find(func, subfunc);
6072
6073         /* Check to see if this is a fragment packet */
6074         nds_frag = tvb_get_letohl(tvb, 8);
6075         
6076         /* Get NDS Verb */
6077         if (nds_frag == 0xffffffff) {
6078                 nds_verb = tvb_get_guint8(tvb, 24);
6079                 if (nds_verb == 0xfe) 
6080                 {
6081                         nds_version = nds_verb;
6082                         nds_verb = tvb_get_guint8(tvb, 32);
6083                         foffset = 36;
6084                 }
6085                 else
6086                 {
6087                         nds_version = 0;
6088                         foffset = 28;
6089                 }
6090                 nds_reply_buffer = tvb_get_letohl(tvb, foffset);        
6091                 proto_tree_add_uint(ncp_tree, hf_nds_buffer_size, tvb, foffset,
6092                         4, nds_reply_buffer);
6093                 foffset = foffset+4;        
6094                 verb_string = val_to_str(nds_verb, ncp_nds_verb_vals,
6095                     "Continuation Fragment");
6096                 switch(nds_verb) {
6097                 
6098                         case 0x01:
6099                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
6100                                 nds_version = pvalues[0].vvalue;
6101                                 pvalues[0].vtype = VTYPE_UINT32;
6102                                 pvalues[0].vdesc = "Version: %u";
6103                                 pvalues[0].vlength = 4;
6104                                 pvalues[0].hfname = hf_nds_ver;
6105                                 pvalues[0].voffset = foffset;
6106                                 foffset = foffset+pvalues[0].vlength;
6107                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
6108                                 pvalues[1].vtype = VTYPE_BITFIELD;
6109                                 pvalues[1].vdesc = "Flags:";
6110                                 pvalues[1].vlength = 2;
6111                                 pvalues[1].hfname= hf_nds_nflags;
6112                                 pvalues[1].voffset = foffset;
6113                                 pvalues[1].bit1 = "Entry ID";
6114                                 pvalues[1].bit1hfname = hf_bit1nflags;
6115                                 pvalues[1].bit2 = "Readable";
6116                                 pvalues[1].bit2hfname = hf_bit2nflags;
6117                                 pvalues[1].bit3 = "Writeable";
6118                                 pvalues[1].bit3hfname = hf_bit3nflags;
6119                                 pvalues[1].bit4 = "Master";
6120                                 pvalues[1].bit4hfname = hf_bit4nflags;
6121                                 pvalues[1].bit5 = "Create ID";
6122                                 pvalues[1].bit5hfname = hf_bit5nflags;
6123                                 pvalues[1].bit6 = "Walk Tree";
6124                                 pvalues[1].bit6hfname = hf_bit6nflags;
6125                                 pvalues[1].bit7 = "Dereference Alias";
6126                                 pvalues[1].bit7hfname = hf_bit7nflags;
6127                                 pvalues[1].bit8 = "Not Defined";
6128                                 pvalues[1].bit8hfname = hf_bit8nflags;
6129                                 pvalues[1].bit9 = "Not Defined";
6130                                 pvalues[1].bit9hfname = hf_bit9nflags;
6131                                 pvalues[1].bit10 = "Not Defined";
6132                                 pvalues[1].bit10hfname = hf_bit10nflags;
6133                                 pvalues[1].bit11= "Not Defined";
6134                                 pvalues[1].bit11hfname = hf_bit11nflags;
6135                                 pvalues[1].bit12 = "Not Defined";
6136                                 pvalues[1].bit12hfname = hf_bit12nflags;
6137                                 pvalues[1].bit13 = "Not Defined";
6138                                 pvalues[1].bit13hfname = hf_bit13nflags;
6139                                 pvalues[1].bit14 = "Prefer Referrals";
6140                                 pvalues[1].bit14hfname = hf_bit14nflags;
6141                                 pvalues[1].bit15 = "Prefer Only Referrals";
6142                                 pvalues[1].bit15hfname = hf_bit15nflags;
6143                                 pvalues[1].bit16 = "Not Defined";
6144                                 pvalues[1].bit16hfname = hf_bit16nflags;
6145                                 foffset = foffset+4;
6146                                 if (pvalues[0].vvalue == 0 || pvalues[0].vvalue == 1)
6147                                 {
6148                                         pvalues[2].vtype = VTYPE_UINT32;
6149                                         pvalues[2].vdesc = "Scope: %u";
6150                                         pvalues[2].vlength = 4;
6151                                         pvalues[2].voffset = foffset;
6152                                         pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
6153                                         pvalues[2].hfname= hf_nds_scope;
6154                                         foffset = foffset+pvalues[2].vlength;
6155                                         pvalues[3].vtype = VTYPE_STRING;
6156                                         pvalues[3].vdesc = "Name: %s";
6157                                         pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
6158                                         pvalues[3].vvalue = 0;
6159                                         pvalues[3].vlength = 256;
6160                                         pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
6161                                         if (pvalues[3].vlength == 0x00)
6162                                         {
6163                                                 pvalues[3].vtype = VTYPE_NONE;
6164                                                 break;
6165                                         }
6166                                         pvalues[3].voffset = foffset+4;
6167                                         foffset = foffset + 4;
6168                                         get_string(tvb, pvalues[3].voffset, pvalues[3].vlength, req_buffer.buffer);
6169                                         pvalues[3].vstring = req_buffer.buffer;
6170                                         strcpy(global_object_name, req_buffer.buffer);
6171                                         pvalues[3].hfname= hf_nds_name;
6172                                         foffset = foffset+pvalues[3].vlength;
6173                                         foffset += align_4(tvb, foffset);
6174                                         pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
6175                                         pvalues[4].vtype = VTYPE_MULTIVALUE_UINT32;
6176                                         pvalues[4].vdesc = "Communications Transports: %u";
6177                                         pvalues[4].vlength = 4;
6178                                         pvalues[4].hfname= hf_nds_comm_trans;
6179                                         pvalues[4].voffset = foffset;
6180                                         pvalues[4].mvtype = MVTYPE_ADDR_REFERRAL_REQUEST;
6181                                         foffset = foffset + (pvalues[4].vvalue * 4) + 4;
6182                                         pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
6183                                         pvalues[5].vtype = VTYPE_MULTIVALUE_UINT32;
6184                                         pvalues[5].vdesc = "Tree Walker Transport Type: %u";
6185                                         pvalues[5].vlength = 4;
6186                                         pvalues[5].mvtype = MVTYPE_ADDR_REFERRAL_REQUEST;
6187                                         pvalues[5].hfname= hf_nds_tree_trans;
6188                                         pvalues[5].voffset = foffset;
6189                                 }
6190                                 else
6191                                 {
6192                                         pvalues[2].vtype = VTYPE_UINT32;
6193                                         pvalues[2].vdesc = "Minimum DS Version: %u";
6194                                         pvalues[2].vlength = 4;
6195                                         pvalues[2].voffset = foffset;
6196                                         pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
6197                                         pvalues[2].hfname= hf_min_nds_ver;
6198                                         foffset = foffset+pvalues[2].vlength;
6199                                         pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
6200                                         pvalues[3].vtype = VTYPE_MULTIVALUE_UINT32;
6201                                         pvalues[3].vdesc = "Number of Versions to Include: %u";
6202                                         pvalues[3].vlength = 4;
6203                                         pvalues[3].mvtype = MVTYPE_ATTR_REQUEST2;
6204                                         pvalues[3].voffset = foffset;
6205                                         pvalues[3].hfname= hf_nds_ver_include;
6206                                         foffset += (pvalues[3].vvalue * 4) + 4;
6207                                         pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
6208                                         pvalues[4].vtype = VTYPE_MULTIVALUE_UINT32;
6209                                         pvalues[4].vdesc = "Number of Versions to Exclude: %u";
6210                                         pvalues[4].vlength = 4;
6211                                         pvalues[4].mvtype = MVTYPE_ATTR_REQUEST2;
6212                                         pvalues[4].hfname= hf_nds_ver_exclude;
6213                                         pvalues[4].voffset = foffset;
6214                                         foffset += 4;
6215                                         pvalues[5].vtype = VTYPE_UINT32;
6216                                         pvalues[5].vdesc = "DN Output Type: %u";
6217                                         pvalues[5].vlength = 4;
6218                                         pvalues[5].voffset = foffset;
6219                                         pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
6220                                         pvalues[5].hfname= hf_nds_dn_output_type;
6221                                         foffset = foffset+pvalues[5].vlength;
6222                                         pvalues[6].vtype = VTYPE_UINT32;
6223                                         pvalues[6].vdesc = "Nested Output Type: %u";
6224                                         pvalues[6].vlength = 4;
6225                                         pvalues[6].voffset = foffset;
6226                                         pvalues[6].vvalue = tvb_get_letohl(tvb, foffset);
6227                                         pvalues[6].hfname= hf_nds_nested_output_type;
6228                                         foffset = foffset+pvalues[6].vlength;
6229                                         pvalues[7].vtype = VTYPE_STRING;
6230                                         pvalues[7].vdesc = "Output Delimiter: %s";
6231                                         pvalues[7].mvtype = MVTYPE_ATTR_REQUEST;
6232                                         pvalues[7].vvalue = 0;
6233                                         pvalues[7].vlength = 256;
6234                                         pvalues[7].vlength = tvb_get_letohl(tvb, foffset);
6235                                         pvalues[7].voffset = foffset+4;
6236                                         foffset = foffset + 4;
6237                                         get_string(tvb, pvalues[7].voffset, pvalues[7].vlength, req_buffer.buffer);
6238                                         pvalues[7].vstring = req_buffer.buffer;
6239                                         pvalues[7].hfname= hf_nds_output_delimiter;
6240                                         foffset = foffset+pvalues[7].vlength;
6241                                         foffset += align_4(tvb, foffset);
6242                                         pvalues[8].vvalue = tvb_get_letohl(tvb, foffset);
6243                                         pvalues[8].vtype = VTYPE_MULTIVALUE_UINT32;
6244                                         pvalues[8].vdesc = "Size of Entry Specifier: %u";
6245                                         pvalues[8].vlength = 4;
6246                                         pvalues[8].mvtype = MVTYPE_PROC_ENTRY_SPECIFIERS;
6247                                         pvalues[8].hfname= hf_nds_output_entry_specifier;
6248                                         pvalues[8].voffset = foffset;
6249                                 }
6250                                 break;
6251                         case 0x02:    
6252                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
6253                                 pvalues[0].vtype = VTYPE_UINT32;
6254                                 pvalues[0].vdesc = "Version: %u";
6255                                 pvalues[0].vlength = 4;
6256                                 pvalues[0].voffset = foffset;
6257                                 pvalues[0].hfname= hf_nds_ver;
6258                                 foffset = foffset+pvalues[0].vlength;
6259                                 switch(pvalues[0].vvalue)
6260                                 {
6261                                         case 0:
6262                                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
6263                                                 pvalues[1].vtype = VTYPE_UINT32;
6264                                                 pvalues[1].vdesc = "Entry ID: 0x%08x";
6265                                                 pvalues[1].vlength = 4;
6266                                                 resolve_eid = TRUE;
6267                                                 global_eid = pvalues[1].vvalue;
6268                                                 pvalues[1].voffset = foffset;
6269                                                 pvalues[1].hfname = hf_nds_eid;
6270                                                 foffset = foffset+pvalues[1].vlength;
6271                                                 break;
6272                                         case 1:
6273                                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
6274                                                 pvalues[1].vtype = VTYPE_BITFIELD;
6275                                                 pvalues[1].vdesc = "Request Flags:";
6276                                                 pvalues[1].vlength = 2;
6277                                                 pvalues[1].hfname= hf_nds_rflags;
6278                                                 pvalues[1].voffset = foffset;
6279                                                 pvalues[1].bit1 = "Typeless";
6280                                                 pvalues[1].bit1hfname = hf_bit1rflags;
6281                                                 pvalues[1].bit2 = "Slashed";
6282                                                 pvalues[1].bit2hfname = hf_bit2rflags;
6283                                                 pvalues[1].bit3 = "Dotted";
6284                                                 pvalues[1].bit3hfname = hf_bit3rflags;
6285                                                 pvalues[1].bit4 = "Tuned";
6286                                                 pvalues[1].bit4hfname = hf_bit4rflags;
6287                                                 pvalues[1].bit5 = "Not Defined";
6288                                                 pvalues[1].bit5hfname = hf_bit5rflags;
6289                                                 pvalues[1].bit6 = "Not Defined";
6290                                                 pvalues[1].bit6hfname = hf_bit6rflags;
6291                                                 pvalues[1].bit7 = "Not Defined";
6292                                                 pvalues[1].bit7hfname = hf_bit7rflags;
6293                                                 pvalues[1].bit8 = "Not Defined";
6294                                                 pvalues[1].bit8hfname = hf_bit8rflags;
6295                                                 pvalues[1].bit9 = "Not Defined";
6296                                                 pvalues[1].bit9hfname = hf_bit9rflags;
6297                                                 pvalues[1].bit10 = "Not Defined";
6298                                                 pvalues[1].bit10hfname = hf_bit10rflags;
6299                                                 pvalues[1].bit11 = "Not Defined";
6300                                                 pvalues[1].bit11hfname = hf_bit11rflags;
6301                                                 pvalues[1].bit12 = "Not Defined";
6302                                                 pvalues[1].bit12hfname = hf_bit12rflags;
6303                                                 pvalues[1].bit13 = "Not Defined";
6304                                                 pvalues[1].bit13hfname = hf_bit13rflags;
6305                                                 pvalues[1].bit14 = "Not Defined";
6306                                                 pvalues[1].bit14hfname = hf_bit14rflags;
6307                                                 pvalues[1].bit15 = "Not Defined";
6308                                                 pvalues[1].bit15hfname = hf_bit15rflags;
6309                                                 pvalues[1].bit16 = "Not Defined";
6310                                                 pvalues[1].bit16hfname = hf_bit16rflags;
6311                                                 if((pvalues[1].vvalue&&0xf000) == 0xc000)
6312                                                 {
6313                                                         pvalues[2].vtype = VTYPE_STRING;
6314                                                         pvalues[2].vdesc = "Name Type: %s";
6315                                                         pvalues[2].vstring = "Partial";
6316                                                         pvalues[2].mvtype = 0;
6317                                                         pvalues[2].vvalue = 0;
6318                                                         pvalues[2].vlength = 0;
6319                                                         pvalues[2].voffset = 0;
6320                                                         pvalues[2].hfname= hf_nds_name_type;
6321                                                 }
6322                                                 else
6323                                                 {
6324                                                         pvalues[2].vtype = VTYPE_STRING;
6325                                                         pvalues[2].vdesc = "Name Type: %s";
6326                                                         pvalues[2].vstring = "Full";
6327                                                         pvalues[2].vvalue = 0;
6328                                                         pvalues[2].mvtype = 0;
6329                                                         pvalues[2].vlength = 0;
6330                                                         pvalues[2].voffset = 0;
6331                                                         pvalues[2].hfname= hf_nds_name_type;
6332                                                 }
6333                                                 foffset = foffset+4;
6334                                                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
6335                                                 pvalues[3].vtype = VTYPE_UINT32;
6336                                                 pvalues[3].vdesc = "Entry ID: 0x%08x";
6337                                                 pvalues[3].vlength = 4;
6338                                                 pvalues[3].voffset = foffset;
6339                                                 resolve_eid = TRUE;
6340                                                 global_eid = pvalues[3].vvalue;
6341                                                 pvalues[3].hfname = hf_nds_eid;
6342                                                 foffset = foffset+pvalues[3].vlength;
6343                                                 break;
6344                                         case 2:
6345                                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
6346                                                 pvalues[1].vtype = VTYPE_BITFIELD;
6347                                                 pvalues[1].vdesc = "Request Flags:";
6348                                                 pvalues[1].vlength = 2;
6349                                                 pvalues[1].hfname= hf_nds_rflags;
6350                                                 pvalues[1].voffset = foffset;
6351                                                 pvalues[1].bit1 = "Typeless";
6352                                                 pvalues[1].bit1hfname = hf_bit1rflags;
6353                                                 pvalues[1].bit2 = "Slashed";
6354                                                 pvalues[1].bit2hfname = hf_bit2rflags;
6355                                                 pvalues[1].bit3 = "Dotted";
6356                                                 pvalues[1].bit3hfname = hf_bit3rflags;
6357                                                 pvalues[1].bit4 = "Tuned";
6358                                                 pvalues[1].bit4hfname = hf_bit4rflags;
6359                                                 pvalues[1].bit5 = "Not Defined";
6360                                                 pvalues[1].bit5hfname = hf_bit5rflags;
6361                                                 pvalues[1].bit6 = "Not Defined";
6362                                                 pvalues[1].bit6hfname = hf_bit6rflags;
6363                                                 pvalues[1].bit7 = "Not Defined";
6364                                                 pvalues[1].bit7hfname = hf_bit7rflags;
6365                                                 pvalues[1].bit8 = "Not Defined";
6366                                                 pvalues[1].bit8hfname = hf_bit8rflags;
6367                                                 pvalues[1].bit9 = "Not Defined";
6368                                                 pvalues[1].bit9hfname = hf_bit9rflags;
6369                                                 pvalues[1].bit10 = "Not Defined";
6370                                                 pvalues[1].bit10hfname = hf_bit10rflags;
6371                                                 pvalues[1].bit11 = "Not Defined";
6372                                                 pvalues[1].bit11hfname = hf_bit11rflags;
6373                                                 pvalues[1].bit12 = "Not Defined";
6374                                                 pvalues[1].bit12hfname = hf_bit12rflags;
6375                                                 pvalues[1].bit13 = "Not Defined";
6376                                                 pvalues[1].bit13hfname = hf_bit13rflags;
6377                                                 pvalues[1].bit14 = "Not Defined";
6378                                                 pvalues[1].bit14hfname = hf_bit14rflags;
6379                                                 pvalues[1].bit15 = "Not Defined";
6380                                                 pvalues[1].bit15hfname = hf_bit15rflags;
6381                                                 pvalues[1].bit16 = "Not Defined";
6382                                                 pvalues[1].bit16hfname = hf_bit16rflags;
6383                                                 if((pvalues[1].vvalue&&0xf000) == 0xc000)
6384                                                 {
6385                                                         pvalues[2].vtype = VTYPE_STRING;
6386                                                         pvalues[2].vdesc = "Name Type: %s";
6387                                                         pvalues[2].vstring = "Return Partion Name";
6388                                                         pvalues[2].vvalue = 0;
6389                                                         pvalues[2].vlength = 4;
6390                                                         pvalues[2].voffset = pvalues[1].voffset;
6391                                                         pvalues[2].mvtype = 0;
6392                                                         pvalues[2].hfname= hf_nds_name_type;
6393                                                 }
6394                                                 else
6395                                                 {
6396                                                         pvalues[2].vtype = VTYPE_STRING;
6397                                                         pvalues[2].vdesc = "Name Type: %s";
6398                                                         pvalues[2].vstring = "Return Full Name";
6399                                                         pvalues[2].vvalue = 0;
6400                                                         pvalues[2].vlength = 4;
6401                                                         pvalues[2].mvtype = 0;
6402                                                         pvalues[2].voffset = pvalues[1].voffset;
6403                                                         pvalues[2].hfname= hf_nds_name_type;
6404                                                 }
6405                                                 foffset = foffset+4;
6406                                                 pvalues[3].vvalue = tvb_get_letohs(tvb, foffset);
6407                                                 global_flags = tvb_get_letohl(tvb, foffset);
6408                                                 pvalues[3].vtype = VTYPE_BITFIELD;
6409                                                 pvalues[3].vdesc = "Information Flags (low) Byte:";
6410                                                 pvalues[3].vlength = 2;
6411                                                 pvalues[3].hfname= hf_nds_rflags;
6412                                                 pvalues[3].voffset = foffset;
6413                                                 pvalues[3].bit1 = "Output Flags";
6414                                                 pvalues[3].bit1hfname = hf_bit1infoflagsl;
6415                                                 pvalues[3].bit2 = "Entry ID";
6416                                                 pvalues[3].bit2hfname = hf_bit2infoflagsl;
6417                                                 pvalues[3].bit3 = "Entry Flags";
6418                                                 pvalues[3].bit3hfname = hf_bit3infoflagsl;
6419                                                 pvalues[3].bit4 = "Subordinate Count";
6420                                                 pvalues[3].bit4hfname = hf_bit4infoflagsl;
6421                                                 pvalues[3].bit5 = "Modification Time";
6422                                                 pvalues[3].bit5hfname = hf_bit5infoflagsl;
6423                                                 pvalues[3].bit6 = "Modification Timestamp";
6424                                                 pvalues[3].bit6hfname = hf_bit6infoflagsl;
6425                                                 pvalues[3].bit7 = "Creation Timestamp";
6426                                                 pvalues[3].bit7hfname = hf_bit7infoflagsl;
6427                                                 pvalues[3].bit8 = "Partition Root ID";
6428                                                 pvalues[3].bit8hfname = hf_bit8infoflagsl;
6429                                                 pvalues[3].bit9 = "Parent ID";
6430                                                 pvalues[3].bit9hfname = hf_bit9infoflagsl;
6431                                                 pvalues[3].bit10 = "Revision Count";
6432                                                 pvalues[3].bit10hfname = hf_bit10infoflagsl;
6433                                                 pvalues[3].bit11 = "Replica Type";
6434                                                 pvalues[3].bit11hfname = hf_bit11infoflagsl;
6435                                                 pvalues[3].bit12 = "Base Class";
6436                                                 pvalues[3].bit12hfname = hf_bit12infoflagsl;
6437                                                 pvalues[3].bit13 = "Relative Distinguished Name";
6438                                                 pvalues[3].bit13hfname = hf_bit13infoflagsl;
6439                                                 pvalues[3].bit14 = "Distinguished Name";
6440                                                 pvalues[3].bit14hfname = hf_bit14infoflagsl;
6441                                                 pvalues[3].bit15 = "Root Distinguished Name";
6442                                                 pvalues[3].bit15hfname = hf_bit15infoflagsl;
6443                                                 pvalues[3].bit16 = "Parent Distinguished Name";
6444                                                 pvalues[3].bit16hfname = hf_bit16infoflagsl;
6445                                                 foffset = foffset+2;
6446                                                 pvalues[4].vvalue = tvb_get_letohs(tvb, foffset);
6447                                                 pvalues[4].vtype = VTYPE_BITFIELD;
6448                                                 pvalues[4].vdesc = "Information Flags (high) Byte:";
6449                                                 pvalues[4].vlength = 2;
6450                                                 pvalues[4].hfname= hf_nds_rflags;
6451                                                 pvalues[4].voffset = foffset;
6452                                                 pvalues[4].bit1 = "Purge Time";
6453                                                 pvalues[4].bit1hfname = hf_bit1infoflagsh;
6454                                                 pvalues[4].bit2 = "Dereference Base Class";
6455                                                 pvalues[4].bit2hfname = hf_bit2infoflagsh;
6456                                                 pvalues[4].bit3 = "Not Defined";
6457                                                 pvalues[4].bit3hfname = hf_bit3infoflagsh;
6458                                                 pvalues[4].bit4 = "Not Defined";
6459                                                 pvalues[4].bit4hfname = hf_bit4infoflagsh;
6460                                                 pvalues[4].bit5 = "Not Defined";
6461                                                 pvalues[4].bit5hfname = hf_bit5infoflagsh;
6462                                                 pvalues[4].bit6 = "Not Defined";
6463                                                 pvalues[4].bit6hfname = hf_bit6infoflagsh;
6464                                                 pvalues[4].bit7 = "Not Defined";
6465                                                 pvalues[4].bit7hfname = hf_bit7infoflagsh;
6466                                                 pvalues[4].bit8 = "Not Defined";
6467                                                 pvalues[4].bit8hfname = hf_bit8infoflagsh;
6468                                                 pvalues[4].bit9 = "Not Defined";
6469                                                 pvalues[4].bit9hfname = hf_bit9infoflagsh;
6470                                                 pvalues[4].bit10 = "Not Defined";
6471                                                 pvalues[4].bit10hfname = hf_bit10infoflagsh;
6472                                                 pvalues[4].bit11 = "Not Defined";
6473                                                 pvalues[4].bit11hfname = hf_bit11infoflagsh;
6474                                                 pvalues[4].bit12 = "Not Defined";
6475                                                 pvalues[4].bit12hfname = hf_bit12infoflagsh;
6476                                                 pvalues[4].bit13 = "Not Defined";
6477                                                 pvalues[4].bit13hfname = hf_bit13infoflagsh;
6478                                                 pvalues[4].bit14 = "Not Defined";
6479                                                 pvalues[4].bit14hfname = hf_bit14infoflagsh;
6480                                                 pvalues[4].bit15 = "Not Defined";
6481                                                 pvalues[4].bit15hfname = hf_bit15infoflagsh;
6482                                                 pvalues[4].bit16 = "Not Defined";
6483                                                 pvalues[4].bit16hfname = hf_bit16infoflagsh;
6484                                                 foffset = foffset+2;
6485                                                 pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
6486                                                 pvalues[5].vtype = VTYPE_UINT32;
6487                                                 pvalues[5].vdesc = "Entry ID: 0x%08x";
6488                                                 pvalues[5].vlength = 4;
6489                                                 pvalues[5].voffset = foffset;
6490                                                 resolve_eid = TRUE;
6491                                                 global_eid = pvalues[5].vvalue;
6492                                                 pvalues[5].hfname = hf_nds_eid;
6493                                                 foffset = foffset+pvalues[5].vlength;
6494                                                 break;
6495                                         default:
6496                                                 break;
6497                                 }
6498                                 
6499                                 break;
6500                         case 0x03:    
6501                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
6502                                 pvalues[0].vtype = VTYPE_UINT32;
6503                                 pvalues[0].vdesc = "Version: %u";
6504                                 pvalues[0].vlength = 4;
6505                                 pvalues[0].voffset = foffset;
6506                                 pvalues[0].hfname= hf_nds_ver;
6507                                 foffset = foffset+pvalues[0].vlength;
6508                                 if(pvalues[0].vvalue == 0)
6509                                 {
6510                                         pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
6511                                         pvalues[1].vtype = VTYPE_UINT32;
6512                                         pvalues[1].vdesc = "Iteration Handle: 0x%08x";
6513                                         pvalues[1].vlength = 4;
6514                                         pvalues[1].voffset = foffset;
6515                                         pvalues[1].hfname= hf_nds_iteration;
6516                                         foffset = foffset+pvalues[1].vlength;
6517                                         pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
6518                                         pvalues[2].vtype = VTYPE_UINT32;
6519                                         pvalues[2].vdesc = "Entry ID: 0x%08x";
6520                                         pvalues[2].vlength = 4;
6521                                         resolve_eid = TRUE;
6522                                         global_eid = pvalues[2].vvalue;
6523                                         pvalues[2].voffset = foffset;
6524                                         pvalues[2].hfname= hf_nds_eid;
6525                                         foffset = foffset+pvalues[2].vlength;
6526                                         pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
6527                                         pvalues[3].vstring = match_strval(pvalues[3].vvalue, nds_info_type);
6528                                         global_flags = pvalues[3].vvalue;
6529                                         if(pvalues[3].vstring == NULL)
6530                                         {
6531                                                 pvalues[3].vstring = "No Info Type Set";
6532                                         }
6533                                         pvalues[3].vtype = VTYPE_STRING;
6534                                         pvalues[3].vdesc = "Info Type: %s";
6535                                         pvalues[3].vlength = 4;
6536                                         pvalues[3].voffset = foffset;
6537                                         pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
6538                                         pvalues[3].hfname= hf_nds_info_type;
6539                                         foffset = foffset + pvalues[3].vlength;
6540                                         pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
6541                                         pvalues[4].vtype = VTYPE_UINT32;
6542                                         pvalues[4].vdesc = "All Attributes: %u";
6543                                         pvalues[4].vlength = 4;
6544                                         pvalues[4].voffset = foffset;
6545                                         pvalues[4].hfname= hf_nds_all_attr;
6546                                         foffset = foffset+pvalues[4].vlength;
6547                                         pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
6548                                         pvalues[5].vtype = VTYPE_MULTIVALUE_UINT32;
6549                                         pvalues[5].vdesc = "Attributes: %u";
6550                                         pvalues[5].vlength = 4;
6551                                         pvalues[5].voffset = foffset;
6552                                         pvalues[5].mvtype = MVTYPE_ATTR_REQUEST;
6553                                         pvalues[5].hfname= hf_nds_attr;
6554                                 }
6555                                 else
6556                                 {
6557                                         pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
6558                                         pvalues[1].vtype = VTYPE_UINT32;
6559                                         pvalues[1].vdesc = "Request Flags: 0x%08x";
6560                                         pvalues[1].vlength = 4;
6561                                         pvalues[1].voffset = foffset;
6562                                         pvalues[1].hfname= hf_nds_req_flags;
6563                                         foffset = foffset+pvalues[1].vlength;
6564                                         pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
6565                                         pvalues[2].vtype = VTYPE_UINT32;
6566                                         pvalues[2].vdesc = "Iteration Handle: 0x%08x";
6567                                         pvalues[2].vlength = 4;
6568                                         pvalues[2].voffset = foffset;
6569                                         pvalues[2].hfname= hf_nds_iteration;
6570                                         foffset = foffset+pvalues[2].vlength;
6571                                         pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
6572                                         pvalues[3].vtype = VTYPE_UINT32;
6573                                         pvalues[3].vdesc = "Entry ID: 0x%08x";
6574                                         pvalues[3].vlength = 4;
6575                                         resolve_eid = TRUE;
6576                                         global_eid = pvalues[3].vvalue;
6577                                         pvalues[3].voffset = foffset;
6578                                         pvalues[3].hfname= hf_nds_eid;
6579                                         foffset = foffset+pvalues[3].vlength;
6580                                         pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
6581                                         pvalues[4].vstring = match_strval(pvalues[4].vvalue, nds_info_type);
6582                                         global_flags = pvalues[4].vvalue;
6583                                         if(pvalues[4].vstring == NULL)
6584                                         {
6585                                                 pvalues[4].vstring = "No Info Type Set";
6586                                         }
6587                                         pvalues[4].vtype = VTYPE_STRING;
6588                                         pvalues[4].vdesc = "Info Type: %s";
6589                                         pvalues[4].vlength = 4;
6590                                         pvalues[4].voffset = foffset;
6591                                         pvalues[4].hfname= hf_nds_info_type;
6592                                         pvalues[4].mvtype = MVTYPE_ATTR_REQUEST;
6593                                         foffset = foffset+pvalues[4].vlength;
6594                                         pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
6595                                         pvalues[5].vtype = VTYPE_UINT32;
6596                                         pvalues[5].vdesc = "All Attributes: %u";
6597                                         pvalues[5].vlength = 4;
6598                                         pvalues[5].voffset = foffset;
6599                                         pvalues[5].hfname= hf_nds_all_attr;
6600                                         foffset = foffset+pvalues[5].vlength;
6601                                         pvalues[6].vvalue = tvb_get_letohl(tvb, foffset);
6602                                         pvalues[6].vtype = VTYPE_MULTIVALUE_UINT32;
6603                                         pvalues[6].vdesc = "Attributes: %u";
6604                                         pvalues[6].vlength = 4;
6605                                         pvalues[6].voffset = foffset;
6606                                         pvalues[6].mvtype = MVTYPE_ATTR_REQUEST;
6607                                         pvalues[6].hfname= hf_nds_attr;
6608                                 }
6609                                 break;
6610                         case 0x04:    
6611                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
6612                                 pvalues[0].vtype = VTYPE_UINT32;
6613                                 pvalues[0].vdesc = "Version: %u";
6614                                 pvalues[0].vlength = 4;
6615                                 pvalues[0].voffset = foffset;
6616                                 pvalues[0].hfname= hf_nds_ver;
6617                                 foffset = foffset+pvalues[0].vlength;
6618                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
6619                                 pvalues[1].vtype = VTYPE_UINT32;
6620                                 pvalues[1].vdesc = "Entry ID: 0x%08x";
6621                                 pvalues[1].vlength = 4;
6622                                 resolve_eid = TRUE;
6623                                 global_eid = pvalues[1].vvalue;
6624                                 pvalues[1].voffset = foffset;
6625                                 pvalues[1].hfname = hf_nds_eid;
6626                                 foffset = foffset+pvalues[1].vlength;
6627                                 foffset += 4;       /* Attribute Count = 1 */
6628                                 pvalues[2].vtype = VTYPE_STRING;
6629                                 pvalues[2].vdesc = "Attribute Name Being Compared: %s";
6630                                 pvalues[2].mvtype = MVTYPE_ATTR_REQUEST;
6631                                 pvalues[2].vvalue = 0;
6632                                 pvalues[2].vlength = 256;
6633                                 pvalues[2].vlength = tvb_get_letohl(tvb, foffset);
6634                                 if (pvalues[2].vlength == 0x00)
6635                                 {
6636                                         pvalues[2].vtype = VTYPE_NONE;
6637                                         break;
6638                                 }
6639                                 pvalues[2].voffset = foffset+4;
6640                                 foffset = foffset + 4;
6641                                 get_string(tvb, pvalues[2].voffset, pvalues[2].vlength, req_buffer.buffer);
6642                                 pvalues[2].vstring = req_buffer.buffer;
6643                                 strcpy(global_object_name, req_buffer.buffer);
6644                                 pvalues[2].hfname= hf_nds_name;
6645                                 foffset = foffset+pvalues[2].vlength;
6646                                 foffset += align_4(tvb, foffset);
6647                                 foffset += 4;       /* Attribute Value Count = 1 */
6648                                 /***************
6649                                  * Need Trace file to test. Will have to create a 
6650                                  * new mvtype to call print_nds_values.
6651                                  ***************/
6652                                 break;
6653                         case 0x05:    
6654                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
6655                                 pvalues[0].vtype = VTYPE_UINT32;
6656                                 pvalues[0].vdesc = "Version: %u";
6657                                 pvalues[0].vlength = 4;
6658                                 pvalues[0].voffset = foffset;
6659                                 pvalues[0].hfname= hf_nds_ver;
6660                                 foffset = foffset+pvalues[0].vlength;
6661                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
6662                                 pvalues[1].vtype = VTYPE_BITFIELD;
6663                                 pvalues[1].vdesc = "Request Flags:";
6664                                 pvalues[1].vlength = 2;
6665                                 pvalues[1].hfname= hf_nds_rflags;
6666                                 pvalues[1].voffset = foffset;
6667                                 pvalues[1].bit1 = "List Typeless";
6668                                 pvalues[1].bit1hfname = hf_bit1lflags;
6669                                 pvalues[1].bit2 = "List Containers";
6670                                 pvalues[1].bit2hfname = hf_bit2lflags;
6671                                 pvalues[1].bit3 = "List Slashed";
6672                                 pvalues[1].bit3hfname = hf_bit3lflags;
6673                                 pvalues[1].bit4 = "List Dotted";
6674                                 pvalues[1].bit4hfname = hf_bit4lflags;
6675                                 pvalues[1].bit5 = "Dereference Alias";
6676                                 pvalues[1].bit5hfname = hf_bit5lflags;
6677                                 pvalues[1].bit6 = "List All Containers";
6678                                 pvalues[1].bit6hfname = hf_bit6lflags;
6679                                 pvalues[1].bit7 = "List Obsolete";
6680                                 pvalues[1].bit7hfname = hf_bit7lflags;
6681                                 pvalues[1].bit8 = "List Tuned Output";
6682                                 pvalues[1].bit8hfname = hf_bit8lflags;
6683                                 pvalues[1].bit9 = "List External Reference";
6684                                 pvalues[1].bit9hfname = hf_bit9lflags;
6685                                 pvalues[1].bit10 = "Not Defined";
6686                                 pvalues[1].bit10hfname = hf_bit10lflags;
6687                                 pvalues[1].bit11 = "Not Defined";
6688                                 pvalues[1].bit11hfname = hf_bit11lflags;
6689                                 pvalues[1].bit12 = "Not Defined";
6690                                 pvalues[1].bit12hfname = hf_bit12lflags;
6691                                 pvalues[1].bit13 = "Not Defined";
6692                                 pvalues[1].bit13hfname = hf_bit13lflags;
6693                                 pvalues[1].bit14 = "Not Defined";
6694                                 pvalues[1].bit14hfname = hf_bit14lflags;
6695                                 pvalues[1].bit15 = "Not Defined";
6696                                 pvalues[1].bit15hfname = hf_bit15lflags;
6697                                 pvalues[1].bit16 = "Not Defined";
6698                                 pvalues[1].bit16hfname = hf_bit16lflags;
6699                                 foffset = foffset+pvalues[1].vlength;
6700                                 foffset += 2;
6701                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
6702                                 pvalues[2].vtype = VTYPE_UINT32;
6703                                 pvalues[2].vdesc = "Iteration Handle: 0x%08x";
6704                                 pvalues[2].vlength = 4;
6705                                 pvalues[2].voffset = foffset;
6706                                 pvalues[2].hfname= hf_nds_iteration;
6707                                 foffset = foffset+pvalues[2].vlength;
6708                                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
6709                                 pvalues[3].vtype = VTYPE_UINT32;
6710                                 pvalues[3].vdesc = "Parent ID: 0x%08x";
6711                                 pvalues[3].vlength = 4;
6712                                 pvalues[3].voffset = foffset;
6713                                 pvalues[3].hfname= hf_nds_parent;
6714                                 foffset = foffset+pvalues[3].vlength;
6715                                 pvalues[4].vvalue = tvb_get_letohs(tvb, foffset);
6716                                 global_flags = tvb_get_letohl(tvb, foffset);
6717                                 pvalues[4].vtype = VTYPE_BITFIELD;
6718                                 pvalues[4].vdesc = "Information Flags (low) Byte:";
6719                                 pvalues[4].vlength = 2;
6720                                 pvalues[4].hfname= hf_nds_rflags;
6721                                 pvalues[4].voffset = foffset;
6722                                 pvalues[4].bit1 = "Output Flags";
6723                                 pvalues[4].bit1hfname = hf_bit1infoflagsl;
6724                                 pvalues[4].bit2 = "Entry ID";
6725                                 pvalues[4].bit2hfname = hf_bit2infoflagsl;
6726                                 pvalues[4].bit3 = "Entry Flags";
6727                                 pvalues[4].bit3hfname = hf_bit3infoflagsl;
6728                                 pvalues[4].bit4 = "Subordinate Count";
6729                                 pvalues[4].bit4hfname = hf_bit4infoflagsl;
6730                                 pvalues[4].bit5 = "Modification Time";
6731                                 pvalues[4].bit5hfname = hf_bit5infoflagsl;
6732                                 pvalues[4].bit6 = "Modification Timestamp";
6733                                 pvalues[4].bit6hfname = hf_bit6infoflagsl;
6734                                 pvalues[4].bit7 = "Creation Timestamp";
6735                                 pvalues[4].bit7hfname = hf_bit7infoflagsl;
6736                                 pvalues[4].bit8 = "Partition Root ID";
6737                                 pvalues[4].bit8hfname = hf_bit8infoflagsl;
6738                                 pvalues[4].bit9 = "Parent ID";
6739                                 pvalues[4].bit9hfname = hf_bit9infoflagsl;
6740                                 pvalues[4].bit10 = "Revision Count";
6741                                 pvalues[4].bit10hfname = hf_bit10infoflagsl;
6742                                 pvalues[4].bit11 = "Replica Type";
6743                                 pvalues[4].bit11hfname = hf_bit11infoflagsl;
6744                                 pvalues[4].bit12 = "Base Class";
6745                                 pvalues[4].bit12hfname = hf_bit12infoflagsl;
6746                                 pvalues[4].bit13 = "Relative Distinguished Name";
6747                                 pvalues[4].bit13hfname = hf_bit13infoflagsl;
6748                                 pvalues[4].bit14 = "Distinguished Name";
6749                                 pvalues[4].bit14hfname = hf_bit14infoflagsl;
6750                                 pvalues[4].bit15 = "Root Distinguished Name";
6751                                 pvalues[4].bit15hfname = hf_bit15infoflagsl;
6752                                 pvalues[4].bit16 = "Parent Distinguished Name";
6753                                 pvalues[4].bit16hfname = hf_bit16infoflagsl;
6754                                 foffset = foffset+2;
6755                                 pvalues[5].vvalue = tvb_get_letohs(tvb, foffset);
6756                                 pvalues[5].vtype = VTYPE_BITFIELD;
6757                                 pvalues[5].vdesc = "Information Flags (high) Byte:";
6758                                 pvalues[5].vlength = 2;
6759                                 pvalues[5].hfname= hf_nds_rflags;
6760                                 pvalues[5].voffset = foffset;
6761                                 pvalues[5].bit1 = "Purge Time";
6762                                 pvalues[5].bit1hfname = hf_bit1infoflagsh;
6763                                 pvalues[5].bit2 = "Dereference Base Class";
6764                                 pvalues[5].bit2hfname = hf_bit2infoflagsh;
6765                                 pvalues[5].bit3 = "Not Defined";
6766                                 pvalues[5].bit3hfname = hf_bit3infoflagsh;
6767                                 pvalues[5].bit4 = "Not Defined";
6768                                 pvalues[5].bit4hfname = hf_bit4infoflagsh;
6769                                 pvalues[5].bit5 = "Not Defined";
6770                                 pvalues[5].bit5hfname = hf_bit5infoflagsh;
6771                                 pvalues[5].bit6 = "Not Defined";
6772                                 pvalues[5].bit6hfname = hf_bit6infoflagsh;
6773                                 pvalues[5].bit7 = "Not Defined";
6774                                 pvalues[5].bit7hfname = hf_bit7infoflagsh;
6775                                 pvalues[5].bit8 = "Not Defined";
6776                                 pvalues[5].bit8hfname = hf_bit8infoflagsh;
6777                                 pvalues[5].bit9 = "Not Defined";
6778                                 pvalues[5].bit9hfname = hf_bit9infoflagsh;
6779                                 pvalues[5].bit10 = "Not Defined";
6780                                 pvalues[5].bit10hfname = hf_bit10infoflagsh;
6781                                 pvalues[5].bit11 = "Not Defined";
6782                                 pvalues[5].bit11hfname = hf_bit11infoflagsh;
6783                                 pvalues[5].bit12 = "Not Defined";
6784                                 pvalues[5].bit12hfname = hf_bit12infoflagsh;
6785                                 pvalues[5].bit13 = "Not Defined";
6786                                 pvalues[5].bit13hfname = hf_bit13infoflagsh;
6787                                 pvalues[5].bit14 = "Not Defined";
6788                                 pvalues[5].bit14hfname = hf_bit14infoflagsh;
6789                                 pvalues[5].bit15 = "Not Defined";
6790                                 pvalues[5].bit15hfname = hf_bit15infoflagsh;
6791                                 pvalues[5].bit16 = "Not Defined";
6792                                 pvalues[5].bit16hfname = hf_bit16infoflagsh;
6793                                 foffset = foffset+2;
6794                                 pvalues[6].vtype = VTYPE_STRING;
6795                                 pvalues[6].vdesc = "Name Filter: %s";
6796                                 pvalues[6].mvtype = MVTYPE_ATTR_REQUEST;
6797                                 pvalues[6].vvalue = 0;
6798                                 pvalues[6].vlength = 256;
6799                                 pvalues[6].vlength = tvb_get_letohl(tvb, foffset);
6800                                 pvalues[6].voffset = foffset+4;
6801                                 foffset = foffset + 4;
6802                                 get_string(tvb, pvalues[6].voffset, pvalues[6].vlength, pvalues[6].vstring);
6803                                 pvalues[6].hfname= hf_nds_name_filter;
6804                                 foffset = foffset+pvalues[6].vlength;
6805                                 if(pvalues[0].vvalue == 0)
6806                                 {
6807                                         break;
6808                                 }        
6809                                 foffset += align_4(tvb, foffset);
6810                                 pvalues[7].vtype = VTYPE_STRING;
6811                                 pvalues[7].vdesc = "Class Filter: %s";
6812                                 pvalues[7].mvtype = MVTYPE_ATTR_REQUEST;
6813                                 pvalues[7].vvalue = 0;
6814                                 pvalues[7].vlength = 256;
6815                                 pvalues[7].vlength = tvb_get_letohl(tvb, foffset);
6816                                 pvalues[7].voffset = foffset+4;
6817                                 foffset = foffset + 4;
6818                                 get_string(tvb, pvalues[7].voffset, pvalues[7].vlength, pvalues[7].vstring);
6819                                 pvalues[7].hfname= hf_nds_class_filter;
6820                                 foffset = foffset+pvalues[7].vlength;
6821                                 if(pvalues[0].vvalue == 1)
6822                                 {
6823                                         break;
6824                                 }        
6825                                 foffset += align_4(tvb, foffset);
6826                                 pvalues[8].vvalue = tvb_get_letohl(tvb, foffset);
6827                                 pvalues[8].vtype = VTYPE_MULTIVALUE_UINT32;
6828                                 pvalues[8].vdesc = "Seconds: %u";
6829                                 pvalues[8].vlength = 4;
6830                                 pvalues[8].mvtype = MVTYPE_PRINT_TIMESTAMP;
6831                                 pvalues[8].hfname= hf_nds_time_filter;
6832                                 pvalues[8].voffset = foffset;
6833                                 break;
6834                         case 0x06:    
6835                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
6836                                 pvalues[0].vstring = "";
6837                                 pvalues[0].vtype = VTYPE_UINT32;
6838                                 pvalues[0].vdesc = "Version: %u";
6839                                 pvalues[0].vlength = 4;
6840                                 pvalues[0].voffset = foffset;
6841                                 pvalues[0].hfname= hf_nds_ver;
6842                                 foffset = foffset+pvalues[0].vlength;
6843                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
6844                                 pvalues[1].vtype = VTYPE_UINT32;
6845                                 pvalues[1].vstring = "";
6846                                 pvalues[1].vdesc = "Request Flags: 0x%08x"; 
6847                                 pvalues[1].vlength = 4;
6848                                 pvalues[1].hfname= hf_nds_rflags;
6849                                 pvalues[1].voffset = foffset;
6850                                 foffset = foffset+4;
6851                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
6852                                 pvalues[2].vtype = VTYPE_UINT32;
6853                                 pvalues[2].vdesc = "Iteration Handle: 0x%08x";
6854                                 pvalues[2].vlength = 4;
6855                                 pvalues[2].voffset = foffset;
6856                                 pvalues[2].hfname= hf_nds_iteration;
6857                                 foffset = foffset+pvalues[2].vlength;
6858                                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
6859                                 pvalues[3].vstring = "";
6860                                 pvalues[3].vtype = VTYPE_UINT32;
6861                                 pvalues[3].vdesc = "Base Entry ID: 0x%08x";
6862                                 pvalues[3].vlength = 4;
6863                                 resolve_eid = FALSE;
6864                                 global_eid = pvalues[3].vvalue;
6865                                 pvalues[3].voffset = foffset;
6866                                 pvalues[3].hfname= hf_nds_eid;
6867                                 foffset = foffset+pvalues[3].vlength;
6868                                 pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
6869                                 pvalues[4].vstring = match_strval(pvalues[4].vvalue, nds_search_scope);
6870                                 if(pvalues[4].vstring == NULL)
6871                                 {
6872                                         pvalues[4].vstring = "No Search Scope Defined";
6873                                 }
6874                                 pvalues[4].vtype = VTYPE_STRING;
6875                                 pvalues[4].vdesc = "Replica Type: %s";
6876                                 pvalues[4].vlength = 4;
6877                                 pvalues[4].voffset = foffset;
6878                                 pvalues[4].mvtype = 0;
6879                                 pvalues[4].hfname= hf_nds_search_scope;
6880                                 foffset = foffset + pvalues[4].vlength;
6881                                 pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
6882                                 pvalues[5].vtype = VTYPE_UINT32;
6883                                 pvalues[5].vdesc = "Number of Objects to Search: 0x%08x";
6884                                 pvalues[5].vlength = 4;
6885                                 pvalues[5].voffset = foffset;
6886                                 pvalues[5].hfname= hf_nds_num_objects;
6887                                 foffset = foffset+pvalues[5].vlength;
6888                                 pvalues[6].vvalue = tvb_get_letohl(tvb, foffset);
6889                                 pvalues[6].vtype = VTYPE_BITFIELD;
6890                                 pvalues[6].vdesc = "Information Types:";
6891                                 pvalues[6].vlength = 2;
6892                                 pvalues[6].hfname= hf_nds_nflags;
6893                                 pvalues[6].voffset = foffset;
6894                                 pvalues[6].bit1 = "Names";
6895                                 pvalues[6].bit1hfname = hf_bit1siflags;
6896                                 pvalues[6].bit2 = "Names and Values";
6897                                 pvalues[6].bit2hfname = hf_bit2siflags;
6898                                 pvalues[6].bit3 = "Effective Privileges";
6899                                 pvalues[6].bit3hfname = hf_bit3siflags;
6900                                 pvalues[6].bit4 = "Value Info";
6901                                 pvalues[6].bit4hfname = hf_bit4siflags;
6902                                 pvalues[6].bit5 = "Abbreviated Value";
6903                                 pvalues[6].bit5hfname = hf_bit5siflags;
6904                                 pvalues[6].bit6 = "Not Defined";
6905                                 pvalues[6].bit6hfname = hf_bit6siflags;
6906                                 pvalues[6].bit7 = "Not Defined";
6907                                 pvalues[6].bit7hfname = hf_bit7siflags;
6908                                 pvalues[6].bit8 = "Not Defined";
6909                                 pvalues[6].bit8hfname = hf_bit8siflags;
6910                                 pvalues[6].bit9 = "Expanded Class";
6911                                 pvalues[6].bit9hfname = hf_bit9siflags;
6912                                 pvalues[6].bit10 = "Not Defined";
6913                                 pvalues[6].bit10hfname = hf_bit10siflags;
6914                                 pvalues[6].bit11= "Not Defined";
6915                                 pvalues[6].bit11hfname = hf_bit11siflags;
6916                                 pvalues[6].bit12 = "Not Defined";
6917                                 pvalues[6].bit12hfname = hf_bit12siflags;
6918                                 pvalues[6].bit13 = "Not Defined";
6919                                 pvalues[6].bit13hfname = hf_bit13siflags;
6920                                 pvalues[6].bit14 = "Not Defined";
6921                                 pvalues[6].bit14hfname = hf_bit14siflags;
6922                                 pvalues[6].bit15 = "Not Defined";
6923                                 pvalues[6].bit15hfname = hf_bit15siflags;
6924                                 pvalues[6].bit16 = "Not Defined";
6925                                 pvalues[6].bit16hfname = hf_bit16siflags;
6926                                 foffset = foffset+4;
6927                                 if(pvalues[0].vvalue != 2)
6928                                 {
6929                                         pvalues[7].vvalue = tvb_get_letohs(tvb, foffset);
6930                                         global_flags = tvb_get_letohl(tvb, foffset);
6931                                         pvalues[7].vtype = VTYPE_BITFIELD;
6932                                         pvalues[7].vdesc = "Information Flags (low) Byte:";
6933                                         pvalues[7].vlength = 2;
6934                                         pvalues[7].hfname= hf_nds_rflags;
6935                                         pvalues[7].voffset = foffset;
6936                                         pvalues[7].bit1 = "Output Flags";
6937                                         pvalues[7].bit1hfname = hf_bit1infoflagsl;
6938                                         pvalues[7].bit2 = "Entry ID";
6939                                         pvalues[7].bit2hfname = hf_bit2infoflagsl;
6940                                         pvalues[7].bit3 = "Entry Flags";
6941                                         pvalues[7].bit3hfname = hf_bit3infoflagsl;
6942                                         pvalues[7].bit4 = "Subordinate Count";
6943                                         pvalues[7].bit4hfname = hf_bit4infoflagsl;
6944                                         pvalues[7].bit5 = "Modification Time";
6945                                         pvalues[7].bit5hfname = hf_bit5infoflagsl;
6946                                         pvalues[7].bit6 = "Modification Timestamp";
6947                                         pvalues[7].bit6hfname = hf_bit6infoflagsl;
6948                                         pvalues[7].bit7 = "Creation Timestamp";
6949                                         pvalues[7].bit7hfname = hf_bit7infoflagsl;
6950                                         pvalues[7].bit8 = "Partition Root ID";
6951                                         pvalues[7].bit8hfname = hf_bit8infoflagsl;
6952                                         pvalues[7].bit9 = "Parent ID";
6953                                         pvalues[7].bit9hfname = hf_bit9infoflagsl;
6954                                         pvalues[7].bit10 = "Revision Count";
6955                                         pvalues[7].bit10hfname = hf_bit10infoflagsl;
6956                                         pvalues[7].bit11 = "Replica Type";
6957                                         pvalues[7].bit11hfname = hf_bit11infoflagsl;
6958                                         pvalues[7].bit12 = "Base Class";
6959                                         pvalues[7].bit12hfname = hf_bit12infoflagsl;
6960                                         pvalues[7].bit13 = "Relative Distinguished Name";
6961                                         pvalues[7].bit13hfname = hf_bit13infoflagsl;
6962                                         pvalues[7].bit14 = "Distinguished Name";
6963                                         pvalues[7].bit14hfname = hf_bit14infoflagsl;
6964                                         pvalues[7].bit15 = "Root Distinguished Name";
6965                                         pvalues[7].bit15hfname = hf_bit15infoflagsl;
6966                                         pvalues[7].bit16 = "Parent Distinguished Name";
6967                                         pvalues[7].bit16hfname = hf_bit16infoflagsl;
6968                                         foffset = foffset+2;
6969                                         pvalues[8].vvalue = tvb_get_letohs(tvb, foffset);
6970                                         pvalues[8].vtype = VTYPE_BITFIELD;
6971                                         pvalues[8].vdesc = "Information Flags (high) Byte:";
6972                                         pvalues[8].vlength = 2;
6973                                         pvalues[8].hfname= hf_nds_rflags;
6974                                         pvalues[8].voffset = foffset;
6975                                         pvalues[8].bit1 = "Purge Time";
6976                                         pvalues[8].bit1hfname = hf_bit1infoflagsh;
6977                                         pvalues[8].bit2 = "Dereference Base Class";
6978                                         pvalues[8].bit2hfname = hf_bit2infoflagsh;
6979                                         pvalues[8].bit3 = "Not Defined";
6980                                         pvalues[8].bit3hfname = hf_bit3infoflagsh;
6981                                         pvalues[8].bit4 = "Not Defined";
6982                                         pvalues[8].bit4hfname = hf_bit4infoflagsh;
6983                                         pvalues[8].bit5 = "Not Defined";
6984                                         pvalues[8].bit5hfname = hf_bit5infoflagsh;
6985                                         pvalues[8].bit6 = "Not Defined";
6986                                         pvalues[8].bit6hfname = hf_bit6infoflagsh;
6987                                         pvalues[8].bit7 = "Not Defined";
6988                                         pvalues[8].bit7hfname = hf_bit7infoflagsh;
6989                                         pvalues[8].bit8 = "Not Defined";
6990                                         pvalues[8].bit8hfname = hf_bit8infoflagsh;
6991                                         pvalues[8].bit9 = "Not Defined";
6992                                         pvalues[8].bit9hfname = hf_bit9infoflagsh;
6993                                         pvalues[8].bit10 = "Not Defined";
6994                                         pvalues[8].bit10hfname = hf_bit10infoflagsh;
6995                                         pvalues[8].bit11 = "Not Defined";
6996                                         pvalues[8].bit11hfname = hf_bit11infoflagsh;
6997                                         pvalues[8].bit12 = "Not Defined";
6998                                         pvalues[8].bit12hfname = hf_bit12infoflagsh;
6999                                         pvalues[8].bit13 = "Not Defined";
7000                                         pvalues[8].bit13hfname = hf_bit13infoflagsh;
7001                                         pvalues[8].bit14 = "Not Defined";
7002                                         pvalues[8].bit14hfname = hf_bit14infoflagsh;
7003                                         pvalues[8].bit15 = "Not Defined";
7004                                         pvalues[8].bit15hfname = hf_bit15infoflagsh;
7005                                         pvalues[8].bit16 = "Not Defined";
7006                                         pvalues[8].bit16hfname = hf_bit16infoflagsh;
7007                                         foffset = foffset+2;
7008                                 }
7009                                 break;
7010                         case 0x07:    
7011                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7012                                 pvalues[0].vstring = "";
7013                                 pvalues[0].vtype = VTYPE_UINT32;
7014                                 pvalues[0].vdesc = "Version: %u";
7015                                 pvalues[0].vlength = 4;
7016                                 pvalues[0].voffset = foffset;
7017                                 pvalues[0].hfname= hf_nds_ver;
7018                                 foffset = foffset+pvalues[0].vlength;
7019                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7020                                 pvalues[1].vtype = VTYPE_UINT32;
7021                                 pvalues[1].vstring = "";
7022                                 pvalues[1].vdesc = "Request Flags: 0x%08x"; 
7023                                 pvalues[1].vlength = 4;
7024                                 pvalues[1].hfname= hf_nds_rflags;
7025                                 pvalues[1].voffset = foffset;
7026                                 foffset = foffset+4;
7027                                 if(pvalues[0].vvalue == 0)
7028                                 {
7029                                         pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7030                                         pvalues[2].vstring = "";
7031                                         pvalues[2].vtype = VTYPE_UINT32;
7032                                         pvalues[2].vdesc = "Parent Entry ID: 0x%08x";
7033                                         pvalues[2].vlength = 4;
7034                                         resolve_eid = FALSE;
7035                                         global_eid = pvalues[2].vvalue;
7036                                         pvalues[2].voffset = foffset;
7037                                         pvalues[2].hfname= hf_nds_eid;
7038                                         foffset = foffset+pvalues[2].vlength;
7039                                         pvalues[3].vtype = VTYPE_STRING;
7040                                         pvalues[3].vdesc = "Relative Distinguished Name: %s";
7041                                         pvalues[3].vstring = "";
7042                                         pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
7043                                         pvalues[3].vvalue = 0;
7044                                         pvalues[3].vlength = 256;
7045                                         pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
7046                                         if (pvalues[3].vlength == 0x00)
7047                                         {
7048                                                 pvalues[3].vtype = VTYPE_NONE;
7049                                                 break;
7050                                         }
7051                                         pvalues[3].voffset = foffset+4;
7052                                         foffset = foffset + 4;
7053                                         get_string(tvb, pvalues[3].voffset, pvalues[3].vlength, req_buffer.buffer);
7054                                         pvalues[3].vstring = req_buffer.buffer;
7055                                         strcpy(global_object_name, req_buffer.buffer);
7056                                         pvalues[3].hfname= hf_nds_relative_dn;
7057                                         foffset = foffset+pvalues[3].vlength;
7058                                         foffset += align_4(tvb, foffset);
7059                                         pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
7060                                         pvalues[4].vtype = VTYPE_MULTIVALUE_UINT32;
7061                                         pvalues[4].vstring = "";
7062                                         pvalues[4].vdesc = "Attributes: %u";
7063                                         pvalues[4].vlength = 4;
7064                                         pvalues[4].voffset = foffset;
7065                                         pvalues[4].mvtype = MVTYPE_ADD_ATTR_REQUEST;
7066                                         pvalues[4].hfname= hf_nds_attr;
7067                                 }
7068                                 else
7069                                 {
7070                                         pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7071                                         pvalues[2].vstring = "";
7072                                         pvalues[2].vtype = VTYPE_UINT32;
7073                                         pvalues[2].vdesc = "Iteration Handle: 0x%08x";
7074                                         pvalues[2].vlength = 4;
7075                                         pvalues[2].voffset = foffset;
7076                                         pvalues[2].hfname= hf_nds_iteration;
7077                                         foffset = foffset+pvalues[2].vlength;
7078                                         pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
7079                                         pvalues[3].vstring = "";
7080                                         pvalues[3].vtype = VTYPE_UINT32;
7081                                         pvalues[3].vdesc = "Parent Entry ID: 0x%08x";
7082                                         pvalues[3].vlength = 4;
7083                                         resolve_eid = FALSE;
7084                                         global_eid = pvalues[3].vvalue;
7085                                         pvalues[3].voffset = foffset;
7086                                         pvalues[3].hfname= hf_nds_eid;
7087                                         foffset = foffset+pvalues[3].vlength;
7088                                         pvalues[4].vtype = VTYPE_STRING;
7089                                         pvalues[4].vdesc = "Relative Distinguished Name: %s";
7090                                         pvalues[4].vstring = "";
7091                                         pvalues[4].mvtype = MVTYPE_ATTR_REQUEST;
7092                                         pvalues[4].vvalue = 0;
7093                                         pvalues[4].vlength = 256;
7094                                         pvalues[4].vlength = tvb_get_letohl(tvb, foffset);
7095                                         if (pvalues[4].vlength == 0x00)
7096                                         {
7097                                                 pvalues[4].vtype = VTYPE_NONE;
7098                                                 break;
7099                                         }
7100                                         pvalues[4].voffset = foffset+4;
7101                                         foffset = foffset + 4;
7102                                         get_string(tvb, pvalues[4].voffset, pvalues[4].vlength, req_buffer.buffer);
7103                                         pvalues[4].vstring = req_buffer.buffer;
7104                                         strcpy(global_object_name, req_buffer.buffer);
7105                                         pvalues[4].hfname= hf_nds_relative_dn;
7106                                         foffset = foffset+pvalues[4].vlength;
7107                                         foffset += align_4(tvb, foffset);
7108                                         pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
7109                                         pvalues[5].vtype = VTYPE_MULTIVALUE_UINT32;
7110                                         pvalues[5].vstring = "";
7111                                         pvalues[5].vdesc = "Attributes: %u";
7112                                         pvalues[5].vlength = 4;
7113                                         pvalues[5].voffset = foffset;
7114                                         pvalues[5].mvtype = MVTYPE_ADD_ATTR_REQUEST;
7115                                         pvalues[5].hfname= hf_nds_attr;
7116                                 }
7117                                 break;
7118                         case 0x08:    
7119                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7120                                 pvalues[0].vtype = VTYPE_UINT32;
7121                                 pvalues[0].vdesc = "Version: %u";
7122                                 pvalues[0].vlength = 4;
7123                                 pvalues[0].voffset = foffset;
7124                                 pvalues[0].hfname= hf_nds_ver;
7125                                 foffset = foffset+pvalues[0].vlength;
7126                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7127                                 pvalues[1].vtype = VTYPE_UINT32;
7128                                 pvalues[1].vdesc = "Entry ID: 0x%08x";
7129                                 pvalues[1].vlength = 4;
7130                                 resolve_eid = TRUE;
7131                                 global_eid = pvalues[1].vvalue;
7132                                 pvalues[1].voffset = foffset;
7133                                 pvalues[1].hfname= hf_nds_eid;
7134                                 foffset = foffset+pvalues[1].vlength;
7135                                 break;
7136                         case 0x09:    
7137                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7138                                 pvalues[0].vtype = VTYPE_UINT32;
7139                                 pvalues[0].vdesc = "Version: %u";
7140                                 pvalues[0].vlength = 4;
7141                                 pvalues[0].voffset = foffset;
7142                                 pvalues[0].hfname= hf_nds_ver;
7143                                 foffset = foffset+pvalues[0].vlength;
7144                                 if(pvalues[0].vvalue == 0)
7145                                 {
7146                                         pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7147                                         pvalues[1].vtype = VTYPE_UINT32;
7148                                         pvalues[1].vstring = "";
7149                                         pvalues[1].vdesc = "Iteration Handle: 0x%08x";  /* always 0 */
7150                                         pvalues[1].vlength = 4;
7151                                         pvalues[1].hfname= hf_nds_iteration;
7152                                         pvalues[1].voffset = foffset;
7153                                         foffset = foffset+4;
7154                                         pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7155                                         pvalues[2].vstring = "";
7156                                         pvalues[2].vtype = VTYPE_UINT32;
7157                                         pvalues[2].vdesc = "Entry ID: 0x%08x";
7158                                         pvalues[2].vlength = 4;
7159                                         pvalues[2].voffset = foffset;
7160                                         resolve_eid = TRUE;
7161                                         global_eid = pvalues[2].vvalue;
7162                                         pvalues[2].hfname = hf_nds_eid;
7163                                         foffset = foffset+pvalues[2].vlength;
7164                                         pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
7165                                         pvalues[3].vtype = VTYPE_MULTIVALUE_UINT32;
7166                                         pvalues[3].vstring = "";
7167                                         pvalues[3].vdesc = "Number of Attributes to Change %u";
7168                                         pvalues[3].vlength = 4;
7169                                         pvalues[3].mvtype = MVTYPE_MODIFY_ATTR_REQUEST;
7170                                         pvalues[3].hfname= hf_nds_number_of_changes;
7171                                         pvalues[3].voffset = foffset;
7172                                 }
7173                                 else
7174                                 {
7175                                         pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7176                                         pvalues[1].vtype = VTYPE_UINT32;
7177                                         pvalues[1].vstring = "";
7178                                         pvalues[1].vdesc = "Request Flags: 0x%08x";  /* always 0 */
7179                                         pvalues[1].vlength = 4;
7180                                         pvalues[1].hfname= hf_nds_rflags;
7181                                         pvalues[1].voffset = foffset;
7182                                         foffset = foffset+4;
7183                                         pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7184                                         pvalues[2].vtype = VTYPE_UINT32;
7185                                         pvalues[2].vstring = "";
7186                                         pvalues[2].vdesc = "Iteration Handle: 0x%08x";  /* always 0 */
7187                                         pvalues[2].vlength = 4;
7188                                         pvalues[2].hfname= hf_nds_iteration;
7189                                         pvalues[2].voffset = foffset;
7190                                         foffset = foffset+4;
7191                                         pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
7192                                         pvalues[3].vstring = "";
7193                                         pvalues[3].vtype = VTYPE_UINT32;
7194                                         pvalues[3].vdesc = "Entry ID: 0x%08x";
7195                                         pvalues[3].vlength = 4;
7196                                         pvalues[3].voffset = foffset;
7197                                         resolve_eid = TRUE;
7198                                         global_eid = pvalues[3].vvalue;
7199                                         pvalues[3].hfname = hf_nds_eid;
7200                                         foffset = foffset+pvalues[3].vlength;
7201                                         pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
7202                                         pvalues[4].vtype = VTYPE_MULTIVALUE_UINT32;
7203                                         pvalues[4].vstring = "";
7204                                         pvalues[4].vdesc = "Number of Attributes to Change %u";
7205                                         pvalues[4].vlength = 4;
7206                                         pvalues[4].mvtype = MVTYPE_MODIFY_ATTR_REQUEST;
7207                                         pvalues[4].hfname= hf_nds_number_of_changes;
7208                                         pvalues[4].voffset = foffset;
7209                                 }
7210                                 break;
7211                         case 0x0a:    
7212                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7213                                 pvalues[0].vtype = VTYPE_UINT32;
7214                                 pvalues[0].vdesc = "Version: %u";
7215                                 pvalues[0].vlength = 4;
7216                                 pvalues[0].voffset = foffset;
7217                                 pvalues[0].hfname= hf_nds_ver;
7218                                 foffset = foffset+pvalues[0].vlength;
7219                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7220                                 pvalues[1].vtype = VTYPE_UINT32;
7221                                 pvalues[1].vdesc = "Entry ID: 0x%08x";
7222                                 pvalues[1].vlength = 4;
7223                                 resolve_eid = TRUE;
7224                                 global_eid = pvalues[1].vvalue;
7225                                 pvalues[1].voffset = foffset;
7226                                 pvalues[1].hfname = hf_nds_eid;
7227                                 foffset = foffset+pvalues[1].vlength;
7228                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7229                                 pvalues[2].vtype = VTYPE_BOOLEAN;
7230                                 pvalues[2].vdesc = "Keep Original RDN: %s";
7231                                 pvalues[2].vlength = 4;
7232                                 pvalues[2].voffset = foffset;
7233                                 pvalues[2].mvtype = 0;
7234                                 pvalues[2].hfname= hf_nds_keep;
7235                                 foffset = foffset+4;
7236                                 foffset += align_4(tvb, foffset);
7237                                 pvalues[3].vtype = VTYPE_STRING;
7238                                 pvalues[3].vdesc = "New RDN: %s";
7239                                 pvalues[3].mvtype = 0;
7240                                 pvalues[3].vvalue = 0;
7241                                 pvalues[3].vlength = 256;
7242                                 pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
7243                                 pvalues[3].voffset = foffset+4;
7244                                 foffset = foffset + 4;
7245                                 get_string(tvb, pvalues[3].voffset, pvalues[3].vlength, pvalues[3].vstring);
7246                                 pvalues[3].hfname= hf_nds_new_rdn;
7247                                 foffset = foffset+pvalues[3].vlength;
7248                                 break;
7249                         case 0x0b:    
7250                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7251                                 pvalues[0].vtype = VTYPE_UINT32;
7252                                 pvalues[0].vdesc = "Version: %u";
7253                                 pvalues[0].vlength = 4;
7254                                 pvalues[0].voffset = foffset;
7255                                 pvalues[0].hfname= hf_nds_ver;
7256                                 foffset = foffset+pvalues[0].vlength;
7257                                 pvalues[1].vvalue = tvb_get_letohs(tvb, foffset);
7258                                 global_flags = tvb_get_letohl(tvb, foffset);
7259                                 pvalues[1].vtype = VTYPE_BITFIELD;
7260                                 pvalues[1].vdesc = "Attribute Constraints:";
7261                                 pvalues[1].vlength = 2;
7262                                 pvalues[1].hfname= hf_nds_acflags;
7263                                 pvalues[1].voffset = foffset;
7264                                 pvalues[1].bit1 = "Single Valued";
7265                                 pvalues[1].bit1hfname = hf_bit1acflags;
7266                                 pvalues[1].bit2 = "Sized";
7267                                 pvalues[1].bit2hfname = hf_bit2acflags;
7268                                 pvalues[1].bit3 = "Non-Removable";
7269                                 pvalues[1].bit3hfname = hf_bit3acflags;
7270                                 pvalues[1].bit4 = "Read Only";
7271                                 pvalues[1].bit4hfname = hf_bit4acflags;
7272                                 pvalues[1].bit5 = "Hidden";
7273                                 pvalues[1].bit5hfname = hf_bit5acflags;
7274                                 pvalues[1].bit6 = "String";
7275                                 pvalues[1].bit6hfname = hf_bit6acflags;
7276                                 pvalues[1].bit7 = "Synchronize Immediate";
7277                                 pvalues[1].bit7hfname = hf_bit7acflags;
7278                                 pvalues[1].bit8 = "Public Read";
7279                                 pvalues[1].bit8hfname = hf_bit8acflags;
7280                                 pvalues[1].bit9 = "Server Read";
7281                                 pvalues[1].bit9hfname = hf_bit9acflags;
7282                                 pvalues[1].bit10 = "Write Managed";
7283                                 pvalues[1].bit10hfname = hf_bit10acflags;
7284                                 pvalues[1].bit11 = "Per Replica";
7285                                 pvalues[1].bit11hfname = hf_bit11acflags;
7286                                 pvalues[1].bit12 = "Never Schedule Synchronization";
7287                                 pvalues[1].bit12hfname = hf_bit12acflags;
7288                                 pvalues[1].bit13 = "Operational";
7289                                 pvalues[1].bit13hfname = hf_bit13acflags;
7290                                 pvalues[1].bit14 = "Not Defined";
7291                                 pvalues[1].bit14hfname = hf_bit14acflags;
7292                                 pvalues[1].bit15 = "Not Defined";
7293                                 pvalues[1].bit15hfname = hf_bit15acflags;
7294                                 pvalues[1].bit16 = "Not Defined";
7295                                 pvalues[1].bit16hfname = hf_bit16acflags;
7296                                 foffset = foffset+4;
7297                                 pvalues[2].vtype = VTYPE_STRING;
7298                                 pvalues[2].vdesc = "Attribute Name: %s";
7299                                 pvalues[2].mvtype = MVTYPE_ATTR_REQUEST;
7300                                 pvalues[2].vvalue = 0;
7301                                 pvalues[2].vlength = 256;
7302                                 pvalues[2].vlength = tvb_get_letohl(tvb, foffset);
7303                                 if (pvalues[2].vlength == 0x00)
7304                                 {
7305                                         pvalues[2].vtype = VTYPE_NONE;
7306                                         break;
7307                                 }
7308                                 pvalues[2].voffset = foffset+4;
7309                                 foffset = foffset + 4;
7310                                 get_string(tvb, pvalues[2].voffset, pvalues[2].vlength, req_buffer.buffer);
7311                                 pvalues[2].vstring = req_buffer.buffer;
7312                                 strcpy(global_object_name, req_buffer.buffer);
7313                                 pvalues[2].hfname= hf_nds_name;
7314                                 foffset = foffset+pvalues[2].vlength;
7315                                 foffset += align_4(tvb, foffset);
7316                                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
7317                                 pvalues[3].vstring = match_strval(pvalues[3].vvalue, nds_syntax);
7318                                 if(pvalues[3].vstring == NULL)
7319                                 {
7320                                         pvalues[3].vstring = "No Syntax Found";
7321                                 }
7322                                 pvalues[3].vtype = VTYPE_STRING;
7323                                 pvalues[3].vdesc = "Syntax: %s";
7324                                 pvalues[3].vlength = 4;
7325                                 pvalues[3].voffset = foffset;
7326                                 pvalues[3].hfname= hf_nds_syntax;
7327                                 pvalues[3].mvtype = 0;
7328                                 foffset = foffset+pvalues[3].vlength;
7329                                 pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
7330                                 pvalues[4].vtype = VTYPE_UINT32;
7331                                 pvalues[4].vdesc = "Lower Limit Value %u";
7332                                 pvalues[4].vlength = 4;
7333                                 pvalues[4].voffset = foffset;
7334                                 pvalues[4].hfname = hf_nds_lower;
7335                                 foffset += 4;
7336                                 pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
7337                                 pvalues[5].vtype = VTYPE_UINT32;
7338                                 pvalues[5].vdesc = "Upper Limit Value %u";
7339                                 pvalues[5].vlength = 4;
7340                                 pvalues[5].voffset = foffset;
7341                                 pvalues[5].hfname = hf_nds_upper;
7342                                 foffset += 4;
7343                                 pvalues[6].vvalue = tvb_get_letohl(tvb, foffset); /* Length of bytes field */
7344                                 foffset += 4;
7345                                 pvalues[6].vtype = VTYPE_BYTES;
7346                                 pvalues[6].vdesc = "ASN.1 ID";
7347                                 pvalues[6].vlength = pvalues[6].vvalue;
7348                                 pvalues[6].voffset = foffset;
7349                                 pvalues[6].hfname = hf_nds_asn1;
7350                                 break;
7351                         case 0x0c:    
7352                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
7353                                 break;
7354                         case 0x0d:    
7355                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7356                                 pvalues[0].vtype = VTYPE_UINT32;
7357                                 pvalues[0].vdesc = "Version: %u";
7358                                 pvalues[0].vlength = 4;
7359                                 pvalues[0].voffset = foffset;
7360                                 pvalues[0].hfname= hf_nds_ver;
7361                                 foffset = foffset+pvalues[0].vlength;
7362                                 pvalues[1].vtype = VTYPE_STRING;
7363                                 pvalues[1].vdesc = "Attribute Name: %s";
7364                                 pvalues[1].mvtype = MVTYPE_ATTR_REQUEST;
7365                                 pvalues[1].vvalue = 0;
7366                                 pvalues[1].vlength = 256;
7367                                 pvalues[1].vlength = tvb_get_letohl(tvb, foffset);
7368                                 if (pvalues[1].vlength == 0x00)
7369                                 {
7370                                         pvalues[1].vtype = VTYPE_NONE;
7371                                         break;
7372                                 }
7373                                 pvalues[1].voffset = foffset+4;
7374                                 foffset = foffset + 4;
7375                                 get_string(tvb, pvalues[1].voffset, pvalues[1].vlength, req_buffer.buffer);
7376                                 pvalues[1].vstring = req_buffer.buffer;
7377                                 strcpy(global_object_name, req_buffer.buffer);
7378                                 pvalues[1].hfname= hf_nds_attribute_dn;
7379                                 break;
7380                         case 0x0e:    
7381                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
7382                                 break;
7383                         case 0x0f:    
7384                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7385                                 pvalues[0].vtype = VTYPE_UINT32;
7386                                 pvalues[0].vdesc = "Version: %u";
7387                                 pvalues[0].vlength = 4;
7388                                 pvalues[0].voffset = foffset;
7389                                 pvalues[0].hfname= hf_nds_ver;
7390                                 foffset = foffset+pvalues[0].vlength;
7391                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7392                                 pvalues[1].vtype = VTYPE_UINT32;
7393                                 pvalues[1].vdesc = "Iteration Handle: 0x%08x";
7394                                 pvalues[1].vlength = 4;
7395                                 pvalues[1].voffset = foffset;
7396                                 pvalues[1].hfname= hf_nds_iteration;
7397                                 foffset = foffset+pvalues[1].vlength;
7398                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7399                                 global_flags = pvalues[2].vvalue;
7400                                 pvalues[2].vstring = match_strval(pvalues[2].vvalue, class_def_type);
7401                                 if(pvalues[2].vstring == NULL)
7402                                 {
7403                                         pvalues[2].vstring = "No Class Definition Type Set";
7404                                 }
7405                                 pvalues[2].vtype = VTYPE_STRING;
7406                                 pvalues[2].vdesc = "Class Definition Type: %s";
7407                                 pvalues[2].vlength = 4;
7408                                 pvalues[2].voffset = foffset;
7409                                 pvalues[2].mvtype = 0;
7410                                 pvalues[2].hfname= hf_nds_class_def_type;
7411                                 foffset = foffset + pvalues[2].vlength;
7412                                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
7413                                 if (pvalues[3].vvalue == 0x00000000)
7414                                 {
7415                                         pvalues[3].vstring = "Do Not Return All Classes";
7416                                         pvalues[3].mvtype = 0;
7417                                 }        
7418                                 else
7419                                 {
7420                                         pvalues[3].vstring = "Return All Classes";
7421                                         pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
7422                                 }
7423                                 pvalues[3].vtype = VTYPE_STRING;
7424                                 pvalues[3].vdesc = "%s";
7425                                 pvalues[3].vlength = 4;
7426                                 pvalues[3].voffset = foffset;
7427                                 pvalues[3].hfname= hf_nds_return_all_classes;
7428                                 foffset = foffset + pvalues[3].vlength;
7429                                 foffset += align_4(tvb, foffset);
7430                                 pvalues[4].vvalue = tvb_get_letohl(tvb, foffset);
7431                                 pvalues[4].vtype = VTYPE_MULTIVALUE_UINT32;
7432                                 pvalues[4].vdesc = "Classes: %d";
7433                                 pvalues[4].vlength = 4;
7434                                 pvalues[4].voffset = foffset;
7435                                 pvalues[4].mvtype = MVTYPE_READ_CLASS_REQ;
7436                                 pvalues[4].hfname= hf_nds_classes;
7437                                 break;
7438                         case 0x10:    
7439                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7440                                 pvalues[0].vtype = VTYPE_UINT32;
7441                                 pvalues[0].vdesc = "Version: %u";
7442                                 pvalues[0].vlength = 4;
7443                                 pvalues[0].voffset = foffset;
7444                                 pvalues[0].hfname= hf_nds_ver;
7445                                 foffset = foffset+pvalues[0].vlength;
7446                                 pvalues[1].vtype = VTYPE_STRING;
7447                                 pvalues[1].vdesc = "Class Name: %s";
7448                                 pvalues[1].mvtype = MVTYPE_ATTR_REQUEST;
7449                                 pvalues[1].vvalue = 0;
7450                                 pvalues[1].vlength = 256;
7451                                 pvalues[1].vlength = tvb_get_letohl(tvb, foffset);
7452                                 if (pvalues[1].vlength == 0x00)
7453                                 {
7454                                         pvalues[1].vtype = VTYPE_NONE;
7455                                         break;
7456                                 }
7457                                 pvalues[1].voffset = foffset+4;
7458                                 foffset = foffset + 4;
7459                                 get_string(tvb, pvalues[1].voffset, pvalues[1].vlength, req_buffer.buffer);
7460                                 pvalues[1].vstring = req_buffer.buffer;
7461                                 strcpy(global_object_name, req_buffer.buffer);
7462                                 pvalues[1].hfname= hf_nds_base_class;
7463                                 foffset = foffset+pvalues[1].vlength;
7464                                 foffset += align_4(tvb, foffset);
7465                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7466                                 pvalues[2].vtype = VTYPE_MULTIVALUE_UINT32;
7467                                 pvalues[2].vdesc = "Number of Attributes to Add: %u";
7468                                 pvalues[2].vlength = 4;
7469                                 pvalues[2].voffset = foffset;
7470                                 pvalues[2].mvtype = MVTYPE_MODIFY_CLASS;
7471                                 pvalues[2].hfname= hf_nds_att_add;
7472                                 break;
7473                         case 0x11:    
7474                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7475                                 pvalues[0].vtype = VTYPE_UINT32;
7476                                 pvalues[0].vdesc = "Version: %u";
7477                                 pvalues[0].vlength = 4;
7478                                 pvalues[0].voffset = foffset;
7479                                 pvalues[0].hfname= hf_nds_ver;
7480                                 foffset = foffset+pvalues[0].vlength;
7481                                 pvalues[1].vtype = VTYPE_STRING;
7482                                 pvalues[1].vdesc = "Class Name: %s";
7483                                 pvalues[1].mvtype = MVTYPE_ATTR_REQUEST;
7484                                 pvalues[1].vvalue = 0;
7485                                 pvalues[1].vlength = 256;
7486                                 pvalues[1].vlength = tvb_get_letohl(tvb, foffset);
7487                                 if (pvalues[1].vlength == 0x00)
7488                                 {
7489                                         pvalues[1].vtype = VTYPE_NONE;
7490                                         break;
7491                                 }
7492                                 pvalues[1].voffset = foffset+4;
7493                                 foffset = foffset + 4;
7494                                 get_string(tvb, pvalues[1].voffset, pvalues[1].vlength, req_buffer.buffer);
7495                                 pvalues[1].vstring = req_buffer.buffer;
7496                                 strcpy(global_object_name, req_buffer.buffer);
7497                                 pvalues[1].hfname= hf_nds_base;
7498                                 break;
7499                         case 0x12:    
7500                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7501                                 pvalues[0].vtype = VTYPE_UINT32;
7502                                 pvalues[0].vdesc = "Version: %u";
7503                                 pvalues[0].vlength = 4;
7504                                 pvalues[0].voffset = foffset;
7505                                 pvalues[0].hfname= hf_nds_ver;
7506                                 foffset = foffset+pvalues[0].vlength;
7507                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7508                                 pvalues[1].vtype = VTYPE_UINT32;
7509                                 pvalues[1].vdesc = "Iteration Handle: 0x%08x";
7510                                 pvalues[1].vlength = 4;
7511                                 pvalues[1].voffset = foffset;
7512                                 pvalues[1].hfname= hf_nds_iteration;
7513                                 foffset = foffset+pvalues[1].vlength;
7514                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7515                                 pvalues[2].vtype = VTYPE_UINT32;
7516                                 pvalues[2].vdesc = "Entry ID: 0x%08x";
7517                                 pvalues[2].vlength = 4;
7518                                 resolve_eid = TRUE;
7519                                 global_eid = pvalues[2].vvalue;
7520                                 pvalues[2].voffset = foffset;
7521                                 pvalues[2].hfname= hf_nds_eid;
7522                                 foffset = foffset+pvalues[2].vlength;
7523                                 break;
7524                         case 0x13:    
7525                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7526                                 pvalues[0].vtype = VTYPE_UINT32;
7527                                 pvalues[0].vdesc = "Version: %u";
7528                                 pvalues[0].vlength = 4;
7529                                 pvalues[0].voffset = foffset;
7530                                 pvalues[0].hfname= hf_nds_ver;
7531                                 foffset = foffset+pvalues[0].vlength;
7532                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7533                                 pvalues[1].vtype = VTYPE_UINT32;
7534                                 pvalues[1].vdesc = "Entry ID: 0x%08x";
7535                                 pvalues[1].vlength = 4;
7536                                 resolve_eid = TRUE;
7537                                 global_eid = pvalues[1].vvalue;
7538                                 pvalues[1].voffset = foffset;
7539                                 pvalues[1].hfname= hf_nds_eid;
7540                                 foffset = foffset+pvalues[1].vlength;
7541                                 pvalues[2].vtype = VTYPE_STRING;
7542                                 pvalues[2].vdesc = "Trustee Name: %s";
7543                                 pvalues[2].mvtype = MVTYPE_ATTR_REQUEST;
7544                                 pvalues[2].vvalue = 0;
7545                                 pvalues[2].vlength = 256;
7546                                 pvalues[2].vlength = tvb_get_letohl(tvb, foffset);
7547                                 if (pvalues[2].vlength == 0x00)
7548                                 {
7549                                         pvalues[2].vtype = VTYPE_NONE;
7550                                         break;
7551                                 }
7552                                 pvalues[2].voffset = foffset+4;
7553                                 foffset = foffset + 4;
7554                                 get_string(tvb, pvalues[2].voffset, pvalues[2].vlength, req_buffer.buffer);
7555                                 pvalues[2].vstring = req_buffer.buffer;
7556                                 pvalues[2].hfname= hf_nds_name;
7557                                 foffset = foffset+pvalues[2].vlength;
7558                                 foffset += align_4(tvb, foffset);
7559                                 pvalues[3].vtype = VTYPE_STRING;
7560                                 pvalues[3].vdesc = "Attribute to be Checked: %s";
7561                                 pvalues[3].mvtype = 0;
7562                                 pvalues[3].vvalue = 0;
7563                                 pvalues[3].vlength = 256;
7564                                 pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
7565                                 if (pvalues[3].vlength == 0x00)
7566                                 {
7567                                         pvalues[3].vtype = VTYPE_NONE;
7568                                         break;
7569                                 }
7570                                 pvalues[3].voffset = foffset+4;
7571                                 foffset = foffset + 4;
7572                                 get_string(tvb, pvalues[3].voffset, pvalues[3].vlength, pvalues[3].vstring);
7573                                 pvalues[3].hfname= hf_nds_name;
7574                                 foffset = foffset+pvalues[3].vlength;
7575                                 foffset += align_4(tvb, foffset);
7576                                 if(pvalues[0].vvalue != 0)
7577                                 {
7578                                         pvalues[4].vtype = VTYPE_STRING;
7579                                         pvalues[4].vdesc = "Security Equivalence: %s";
7580                                         pvalues[4].mvtype = MVTYPE_ATTR_REQUEST;
7581                                         pvalues[4].vvalue = 0;
7582                                         pvalues[4].vlength = 256;
7583                                         pvalues[4].vlength = tvb_get_letohl(tvb, foffset);
7584                                         if (pvalues[4].vlength == 0x00)
7585                                         {
7586                                                 pvalues[4].vtype = VTYPE_NONE;
7587                                                 break;
7588                                         }
7589                                         pvalues[4].voffset = foffset+4;
7590                                         foffset = foffset + 4;
7591                                         get_string(tvb, pvalues[4].voffset, pvalues[4].vlength, pvalues[4].vstring);
7592                                         pvalues[4].hfname= hf_nds_name;
7593                                         foffset = foffset+pvalues[4].vlength;
7594                                         foffset += align_4(tvb, foffset);
7595                                 }
7596                                 break;
7597                         case 0x14:    
7598                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
7599                                 break;
7600                         case 0x15:    
7601                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
7602                                 break;
7603                         case 0x16:    
7604                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7605                                 pvalues[0].vtype = VTYPE_UINT32;
7606                                 pvalues[0].vdesc = "Version: %u";
7607                                 pvalues[0].vlength = 4;
7608                                 pvalues[0].voffset = foffset;
7609                                 pvalues[0].hfname= hf_nds_ver;
7610                                 foffset = foffset+pvalues[0].vlength;
7611                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7612                                 pvalues[1].vtype = VTYPE_BITFIELD;
7613                                 pvalues[1].vdesc = "Request Flags:";
7614                                 pvalues[1].vlength = 2;
7615                                 pvalues[1].hfname= hf_nds_rflags;
7616                                 pvalues[1].voffset = foffset;
7617                                 pvalues[1].bit1 = "Typeless";
7618                                 pvalues[1].bit1hfname = hf_nds_bit1;
7619                                 pvalues[1].bit2 = "All Containers";
7620                                 pvalues[1].bit2hfname = hf_nds_bit2;
7621                                 pvalues[1].bit3 = "Slashed";
7622                                 pvalues[1].bit3hfname = hf_nds_bit3;
7623                                 pvalues[1].bit4 = "Dotted";
7624                                 pvalues[1].bit4hfname = hf_nds_bit4;
7625                                 pvalues[1].bit5 = "Tuned";
7626                                 pvalues[1].bit5hfname = hf_nds_bit5;
7627                                 pvalues[1].bit6 = "Not Defined";
7628                                 pvalues[1].bit6hfname = hf_nds_bit6;
7629                                 pvalues[1].bit7 = "Not Defined";
7630                                 pvalues[1].bit7hfname = hf_nds_bit7;
7631                                 pvalues[1].bit8 = "Not Defined";
7632                                 pvalues[1].bit8hfname = hf_nds_bit8;
7633                                 pvalues[1].bit9 = "Not Defined";
7634                                 pvalues[1].bit9hfname = hf_nds_bit9;
7635                                 pvalues[1].bit10 = "Not Defined";
7636                                 pvalues[1].bit10hfname = hf_nds_bit10;
7637                                 pvalues[1].bit11 = "Not Defined";
7638                                 pvalues[1].bit11hfname = hf_nds_bit11;
7639                                 pvalues[1].bit12 = "Not Defined";
7640                                 pvalues[1].bit12hfname = hf_nds_bit12;
7641                                 pvalues[1].bit13 = "Not Defined";
7642                                 pvalues[1].bit13hfname = hf_nds_bit13;
7643                                 pvalues[1].bit14 = "Not Defined";
7644                                 pvalues[1].bit14hfname = hf_nds_bit14;
7645                                 pvalues[1].bit15 = "Not Defined";
7646                                 pvalues[1].bit15hfname = hf_nds_bit15;
7647                                 pvalues[1].bit16 = "Not Defined";
7648                                 pvalues[1].bit16hfname = hf_nds_bit16;
7649                                 foffset = foffset+pvalues[1].vlength;
7650                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7651                                 pvalues[2].vtype = VTYPE_UINT32;
7652                                 pvalues[2].vdesc = "Iteration Handle: 0x%08x";
7653                                 pvalues[2].vlength = 4;
7654                                 pvalues[2].voffset = foffset;
7655                                 pvalues[2].hfname= hf_nds_iteration;
7656                                 foffset = foffset+pvalues[2].vlength;
7657                                 if(pvalues[0].vvalue == 0)
7658                                 {
7659                                         global_flags = 0x000000c0;
7660                                         break;
7661                                 }
7662                                 pvalues[3].vvalue = tvb_get_letohs(tvb, foffset);
7663                                 pvalues[3].vtype = VTYPE_BITFIELD;
7664                                 pvalues[3].vdesc = "Information Flags (low) Byte:";
7665                                 pvalues[3].vlength = 2;
7666                                 pvalues[3].hfname= hf_nds_rflags;
7667                                 pvalues[3].voffset = foffset;
7668                                 pvalues[3].bit1 = "Output Flags";
7669                                 pvalues[3].bit1hfname = hf_bit1l1flagsl;
7670                                 pvalues[3].bit2 = "Entry ID";
7671                                 pvalues[3].bit2hfname = hf_bit2l1flagsl;
7672                                 pvalues[3].bit3 = "Replica State";
7673                                 pvalues[3].bit3hfname = hf_bit3l1flagsl;
7674                                 pvalues[3].bit4 = "Modification Timestamp";
7675                                 pvalues[3].bit4hfname = hf_bit4l1flagsl;
7676                                 pvalues[3].bit5 = "Purge Time";
7677                                 pvalues[3].bit5hfname = hf_bit5l1flagsl;
7678                                 pvalues[3].bit6 = "Local Partition ID";
7679                                 pvalues[3].bit6hfname = hf_bit6l1flagsl;
7680                                 pvalues[3].bit7 = "Distinguished Name";
7681                                 pvalues[3].bit7hfname = hf_bit7l1flagsl;
7682                                 pvalues[3].bit8 = "Replica Type";
7683                                 pvalues[3].bit8hfname = hf_bit8l1flagsl;
7684                                 pvalues[3].bit9 = "Partition Busy";
7685                                 pvalues[3].bit9hfname = hf_bit9l1flagsl;
7686                                 pvalues[3].bit10 = "Not Defined";
7687                                 pvalues[3].bit10hfname = hf_bit10l1flagsl;
7688                                 pvalues[3].bit11 = "Not Defined";
7689                                 pvalues[3].bit11hfname = hf_bit11l1flagsl;
7690                                 pvalues[3].bit12 = "Not Defined";
7691                                 pvalues[3].bit12hfname = hf_bit12l1flagsl;
7692                                 pvalues[3].bit13 = "Not Defined";
7693                                 pvalues[3].bit13hfname = hf_bit13l1flagsl;
7694                                 pvalues[3].bit14 = "Not Defined";
7695                                 pvalues[3].bit14hfname = hf_bit14l1flagsl;
7696                                 pvalues[3].bit15 = "Not Defined";
7697                                 pvalues[3].bit15hfname = hf_bit15l1flagsl;
7698                                 pvalues[3].bit16 = "Not Defined";
7699                                 pvalues[3].bit16hfname = hf_bit16l1flagsl;
7700                                 global_flags = pvalues[3].vvalue;
7701                                 foffset = foffset+2;
7702                                 pvalues[4].vvalue = tvb_get_letohs(tvb, foffset);
7703                                 pvalues[4].vtype = VTYPE_BITFIELD;
7704                                 pvalues[4].vdesc = "Information Flags (high) Byte:";
7705                                 pvalues[4].vlength = 2;
7706                                 pvalues[4].hfname= hf_nds_rflags;
7707                                 pvalues[4].voffset = foffset;
7708                                 pvalues[4].bit1 = "Not Defined";
7709                                 pvalues[4].bit1hfname = hf_bit1l1flagsl;
7710                                 pvalues[4].bit2 = "Not Defined";
7711                                 pvalues[4].bit2hfname = hf_bit2l1flagsl;
7712                                 pvalues[4].bit3 = "Not Defined";
7713                                 pvalues[4].bit3hfname = hf_bit3l1flagsl;
7714                                 pvalues[4].bit4 = "Not Defined";
7715                                 pvalues[4].bit4hfname = hf_bit4l1flagsl;
7716                                 pvalues[4].bit5 = "Not Defined";
7717                                 pvalues[4].bit5hfname = hf_bit5l1flagsl;
7718                                 pvalues[4].bit6 = "Not Defined";
7719                                 pvalues[4].bit6hfname = hf_bit6l1flagsl;
7720                                 pvalues[4].bit7 = "Not Defined";
7721                                 pvalues[4].bit7hfname = hf_bit7l1flagsl;
7722                                 pvalues[4].bit8 = "Not Defined";
7723                                 pvalues[4].bit8hfname = hf_bit8l1flagsl;
7724                                 pvalues[4].bit9 = "Not Defined";
7725                                 pvalues[4].bit9hfname = hf_bit9l1flagsl;
7726                                 pvalues[4].bit10 = "Not Defined";
7727                                 pvalues[4].bit10hfname = hf_bit10l1flagsl;
7728                                 pvalues[4].bit11 = "Not Defined";
7729                                 pvalues[4].bit11hfname = hf_bit11l1flagsl;
7730                                 pvalues[4].bit12 = "Not Defined";
7731                                 pvalues[4].bit12hfname = hf_bit12l1flagsl;
7732                                 pvalues[4].bit13 = "Not Defined";
7733                                 pvalues[4].bit13hfname = hf_bit13l1flagsl;
7734                                 pvalues[4].bit14 = "Not Defined";
7735                                 pvalues[4].bit14hfname = hf_bit14l1flagsl;
7736                                 pvalues[4].bit15 = "Not Defined";
7737                                 pvalues[4].bit15hfname = hf_bit15l1flagsl;
7738                                 pvalues[4].bit16 = "Not Defined";
7739                                 pvalues[4].bit16hfname = hf_bit16l1flagsl;
7740                                 foffset = foffset+2;
7741                                 if(pvalues[0].vvalue == 1)
7742                                 {
7743                                         break;
7744                                 }
7745                                 pvalues[5].vvalue = tvb_get_letohl(tvb, foffset);
7746                                 pvalues[5].vtype = VTYPE_UINT32;
7747                                 pvalues[5].vdesc = "Partition Root ID: 0x%08x";
7748                                 pvalues[5].vlength = 4;
7749                                 pvalues[5].voffset = foffset;
7750                                 pvalues[5].hfname= hf_nds_partition_root_id;
7751                                 foffset = foffset+pvalues[5].vlength;
7752                                 break;
7753                         case 0x17:    
7754                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7755                                 nds_version = pvalues[0].vvalue;
7756                                 pvalues[0].vtype = VTYPE_UINT32;
7757                                 pvalues[0].vdesc = "Version: %u";
7758                                 pvalues[0].vlength = 4;
7759                                 pvalues[0].hfname = hf_nds_ver;
7760                                 pvalues[0].voffset = foffset;
7761                                 foffset = foffset+pvalues[0].vlength;
7762                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7763                                 nds_version = pvalues[1].vvalue;
7764                                 pvalues[1].vtype = VTYPE_UINT32;
7765                                 pvalues[1].vdesc = "Flags: 0x%08x";
7766                                 pvalues[1].vlength = 4;
7767                                 pvalues[1].hfname = hf_nds_req_flags;
7768                                 pvalues[1].voffset = foffset;
7769                                 foffset = foffset+pvalues[1].vlength;
7770                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7771                                 pvalues[2].vtype = VTYPE_UINT32;
7772                                 pvalues[2].vdesc = "New Partition Root ID: 0x%08x";
7773                                 pvalues[2].vlength = 4;
7774                                 pvalues[2].voffset = foffset;
7775                                 pvalues[2].hfname= hf_nds_new_part_id;
7776                                 foffset = foffset+pvalues[2].vlength;
7777                                 break;
7778                         case 0x18:    
7779                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7780                                 nds_version = pvalues[0].vvalue;
7781                                 pvalues[0].vtype = VTYPE_UINT32;
7782                                 pvalues[0].vdesc = "Version: %u";
7783                                 pvalues[0].vlength = 4;
7784                                 pvalues[0].hfname = hf_nds_ver;
7785                                 pvalues[0].voffset = foffset;
7786                                 foffset = foffset+pvalues[0].vlength;
7787                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7788                                 nds_version = pvalues[1].vvalue;
7789                                 pvalues[1].vtype = VTYPE_UINT32;
7790                                 pvalues[1].vdesc = "Flags: 0x%08x";
7791                                 pvalues[1].vlength = 4;
7792                                 pvalues[1].hfname = hf_nds_req_flags;
7793                                 pvalues[1].voffset = foffset;
7794                                 foffset = foffset+pvalues[1].vlength;
7795                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7796                                 pvalues[2].vtype = VTYPE_UINT32;
7797                                 pvalues[2].vdesc = "Child Partition Root ID: 0x%08x";
7798                                 pvalues[2].vlength = 4;
7799                                 pvalues[2].voffset = foffset;
7800                                 pvalues[2].hfname= hf_nds_child_part_id;
7801                                 foffset = foffset+pvalues[2].vlength;
7802                                 break;
7803                         case 0x19:    
7804                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7805                                 nds_version = pvalues[0].vvalue;
7806                                 pvalues[0].vtype = VTYPE_UINT32;
7807                                 pvalues[0].vdesc = "Version: %u";
7808                                 pvalues[0].vlength = 4;
7809                                 pvalues[0].hfname = hf_nds_ver;
7810                                 pvalues[0].voffset = foffset;
7811                                 foffset = foffset+pvalues[0].vlength;
7812                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7813                                 nds_version = pvalues[1].vvalue;
7814                                 pvalues[1].vtype = VTYPE_UINT32;
7815                                 pvalues[1].vdesc = "Flags: 0x%08x";
7816                                 pvalues[1].vlength = 4;
7817                                 pvalues[1].hfname = hf_nds_req_flags;
7818                                 pvalues[1].voffset = foffset;
7819                                 foffset = foffset+pvalues[1].vlength;
7820                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7821                                 pvalues[2].vtype = VTYPE_UINT32;
7822                                 pvalues[2].vdesc = "Master Partition Root ID: 0x%08x";
7823                                 pvalues[2].vlength = 4;
7824                                 pvalues[2].voffset = foffset;
7825                                 pvalues[2].hfname= hf_nds_master_part_id;
7826                                 foffset = foffset+pvalues[2].vlength;
7827                                 pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
7828                                 pvalues[3].vstring = match_strval(pvalues[3].vvalue, nds_replica_type);
7829                                 if(pvalues[3].vstring == NULL)
7830                                 {
7831                                         pvalues[3].vstring = "No Replica Type Found";
7832                                 }
7833                                 pvalues[3].vtype = VTYPE_STRING;
7834                                 pvalues[3].vdesc = "Replica Type: %s";
7835                                 pvalues[3].vlength = 4;
7836                                 pvalues[3].voffset = foffset;
7837                                 pvalues[3].mvtype = 0;
7838                                 pvalues[3].hfname= hf_replica_type;
7839                                 foffset = foffset + pvalues[3].vlength;
7840                                 pvalues[4].vtype = VTYPE_STRING;
7841                                 pvalues[4].vdesc = "Target Server Name: %s";
7842                                 pvalues[4].mvtype = 0;
7843                                 pvalues[4].vvalue = 0;
7844                                 pvalues[4].vlength = 256;
7845                                 pvalues[4].vlength = tvb_get_letohl(tvb, foffset);
7846                                 if (pvalues[4].vlength == 0x00)
7847                                 {
7848                                         pvalues[4].vtype = VTYPE_NONE;
7849                                         break;
7850                                 }
7851                                 pvalues[4].voffset = foffset+4;
7852                                 foffset = foffset + 4;
7853                                 get_string(tvb, pvalues[4].voffset, pvalues[4].vlength, pvalues[4].vstring);
7854                                 pvalues[4].hfname= hf_nds_target_name;
7855                                 break;
7856                         case 0x1a:    
7857                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
7858                                 break;
7859                         case 0x1b:    
7860                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7861                                 nds_version = pvalues[0].vvalue;
7862                                 pvalues[0].vtype = VTYPE_UINT32;
7863                                 pvalues[0].vdesc = "Version: %u";
7864                                 pvalues[0].vlength = 4;
7865                                 pvalues[0].hfname = hf_nds_ver;
7866                                 pvalues[0].voffset = foffset;
7867                                 foffset = foffset+pvalues[0].vlength;
7868                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7869                                 nds_version = pvalues[1].vvalue;
7870                                 pvalues[1].vtype = VTYPE_UINT32;
7871                                 pvalues[1].vdesc = "Streams Flags: 0x%08x";
7872                                 pvalues[1].vlength = 4;
7873                                 pvalues[1].hfname = hf_nds_stream_flags;
7874                                 pvalues[1].voffset = foffset;
7875                                 foffset = foffset+pvalues[1].vlength;
7876                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7877                                 pvalues[2].vtype = VTYPE_UINT32;
7878                                 pvalues[2].vdesc = "Entry ID: 0x%08x";
7879                                 pvalues[2].vlength = 4;
7880                                 resolve_eid = TRUE;
7881                                 global_eid = pvalues[2].vvalue;
7882                                 pvalues[2].voffset = foffset;
7883                                 pvalues[2].hfname= hf_nds_eid;
7884                                 foffset = foffset+pvalues[2].vlength;
7885                                 pvalues[3].vtype = VTYPE_STRING;
7886                                 pvalues[3].vdesc = "Stream Name: %s";
7887                                 pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
7888                                 pvalues[3].vvalue = 0;
7889                                 pvalues[3].vlength = 256;
7890                                 pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
7891                                 if (pvalues[3].vlength == 0x00)
7892                                 {
7893                                         pvalues[3].vtype = VTYPE_NONE;
7894                                         break;
7895                                 }
7896                                 pvalues[3].voffset = foffset+4;
7897                                 foffset += 4;
7898                                 get_string(tvb, pvalues[3].voffset, pvalues[3].vlength, pvalues[3].vstring);
7899                                 foffset += pvalues[3].vlength;
7900                                 foffset += align_4(tvb, foffset);
7901                                 pvalues[3].hfname= hf_nds_stream_name;
7902                                 break;
7903                         case 0x1c:    
7904                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
7905                                 break;
7906                         case 0x1d:    
7907                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
7908                                 break;
7909                         case 0x1e:    
7910                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
7911                                 break;
7912                         case 0x1f:    
7913                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
7914                                 break;
7915                         case 0x20:    
7916                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
7917                                 break;
7918                         case 0x21:    
7919                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
7920                                 break;
7921                         case 0x22:    
7922                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
7923                                 break;
7924                         case 0x23:    
7925                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
7926                                 break;
7927                         case 0x24:    
7928                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
7929                                 break;
7930                         case 0x25:    
7931                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
7932                                 break;
7933                         case 0x26:    
7934                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
7935                                 nds_version = pvalues[0].vvalue;
7936                                 pvalues[0].vtype = VTYPE_UINT32;
7937                                 pvalues[0].vdesc = "Version: %u";
7938                                 pvalues[0].vlength = 4;
7939                                 pvalues[0].hfname = hf_nds_ver;
7940                                 pvalues[0].voffset = foffset;
7941                                 foffset = foffset+pvalues[0].vlength;
7942                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
7943                                 nds_version = pvalues[1].vvalue;
7944                                 pvalues[1].vtype = VTYPE_UINT32;
7945                                 pvalues[1].vdesc = "Flags: 0x%08x";
7946                                 pvalues[1].vlength = 4;
7947                                 pvalues[1].hfname = hf_nds_req_flags;
7948                                 pvalues[1].voffset = foffset;
7949                                 foffset = foffset+pvalues[1].vlength;
7950                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
7951                                 pvalues[2].vtype = VTYPE_UINT32;
7952                                 pvalues[2].vdesc = "Time Delay in Seconds: %u";
7953                                 pvalues[2].vlength = 4;
7954                                 pvalues[2].voffset = foffset;
7955                                 pvalues[2].hfname= hf_nds_time_delay;
7956                                 foffset = foffset+pvalues[2].vlength;
7957                                 if(pvalues[0].vvalue == 0)
7958                                 {
7959                                         pvalues[3].vtype = VTYPE_STRING;
7960                                         pvalues[3].vdesc = "Root Most Object Name: %s";
7961                                         pvalues[3].mvtype = MVTYPE_ATTR_REQUEST;
7962                                         pvalues[3].vvalue = 0;
7963                                         pvalues[3].vlength = 256;
7964                                         pvalues[3].vlength = tvb_get_letohl(tvb, foffset);
7965                                         if (pvalues[3].vlength == 0x00)
7966                                         {
7967                                                 pvalues[3].vtype = VTYPE_NONE;
7968                                                 break;
7969                                         }
7970                                         pvalues[3].voffset = foffset+4;
7971                                         foffset += 4;
7972                                         get_string(tvb, pvalues[3].voffset, pvalues[3].vlength, pvalues[3].vstring);
7973                                         foffset += pvalues[3].vlength;
7974                                         foffset += align_4(tvb, foffset);
7975                                         pvalues[3].hfname= hf_nds_root_name;
7976                                 }
7977                                 else
7978                                 {
7979                                         pvalues[3].vvalue = tvb_get_letohl(tvb, foffset);
7980                                         pvalues[3].vtype = VTYPE_UINT32;
7981                                         pvalues[3].vdesc = "Entry ID: 0x%08x";
7982                                         pvalues[3].vlength = 4;
7983                                         resolve_eid = TRUE;
7984                                         global_eid = pvalues[3].vvalue;
7985                                         pvalues[3].voffset = foffset;
7986                                         pvalues[3].hfname= hf_nds_eid;
7987                                         foffset = foffset+pvalues[3].vlength;
7988                                         resolve_eid = TRUE;
7989                                         global_eid = pvalues[3].vvalue;
7990                                 }
7991                                 break;
7992                         case 0x27:    
7993                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
7994                                 break;
7995                         case 0x28:    
7996                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
7997                                 break;
7998                         case 0x29:    
7999                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8000                                 break;
8001                         case 0x2a:    
8002                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8003                                 break;
8004                         case 0x2b:    
8005                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8006                                 break;
8007                         case 0x2c:    
8008                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8009                                 break;
8010                         case 0x2d:    
8011                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8012                                 break;
8013                         case 0x2e:    
8014                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8015                                 break;
8016                         case 0x2f:    
8017                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8018                                 break;
8019                         case 0x30:
8020                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8021                                 break;
8022                         case 0x31:
8023                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8024                                 break;
8025                         case 0x32:    
8026                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8027                                 break;
8028                         case 0x33:    
8029                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8030                                 break;
8031                         case 0x34:    
8032                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8033                                 break;
8034                         case 0x35:    
8035                                 pvalues[0].vvalue = 0;
8036                                 break;
8037                         case 0x36:    
8038                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8039                                 break;
8040                         case 0x37:    
8041                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8042                                 break;
8043                         case 0x38:    
8044                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8045                                 break;
8046                         case 0x39:    
8047                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8048                                 pvalues[0].vtype = VTYPE_UINT32;
8049                                 pvalues[0].vdesc = "Version: %u";
8050                                 pvalues[0].vlength = 4;
8051                                 pvalues[0].voffset = foffset;
8052                                 pvalues[0].hfname= hf_nds_ver;
8053                                 foffset = foffset+pvalues[0].vlength;
8054                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
8055                                 pvalues[1].vtype = VTYPE_UINT32;
8056                                 pvalues[1].vdesc = "Entry ID: 0x%08x";
8057                                 pvalues[1].vlength = 4;
8058                                 resolve_eid = TRUE;
8059                                 global_eid = pvalues[1].vvalue;
8060                                 pvalues[1].voffset = foffset;
8061                                 pvalues[1].hfname= hf_nds_eid;
8062                                 foffset = foffset+pvalues[1].vlength;
8063                                 break;
8064                         case 0x3a:    
8065                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8066                                 pvalues[0].vtype = VTYPE_UINT32;
8067                                 pvalues[0].vdesc = "Reply Buffer Size: %u";
8068                                 pvalues[0].vlength = 4;
8069                                 pvalues[0].voffset = foffset;
8070                                 pvalues[0].hfname= hf_nds_buffer_size;
8071                                 foffset = foffset+pvalues[0].vlength;
8072                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
8073                                 pvalues[1].vtype = VTYPE_UINT32;
8074                                 pvalues[1].vdesc = "Version: %u";
8075                                 pvalues[1].vlength = 4;
8076                                 pvalues[1].voffset = foffset;
8077                                 pvalues[1].hfname= hf_nds_ver;
8078                                 foffset = foffset+pvalues[1].vlength;
8079                                 pvalues[2].vvalue = tvb_get_letohl(tvb, foffset);
8080                                 pvalues[2].vtype = VTYPE_UINT32;
8081                                 pvalues[2].vdesc = "Entry ID: 0x%08x";
8082                                 pvalues[2].vlength = 4;
8083                                 resolve_eid = TRUE;
8084                                 global_eid = pvalues[2].vvalue;
8085                                 pvalues[2].voffset = foffset;
8086                                 pvalues[2].hfname= hf_nds_eid;
8087                                 foffset = foffset+pvalues[2].vlength;
8088                                 break;
8089                         case 0x3b:    
8090                                 pvalues[0].vvalue = tvb_get_letohl(tvb, foffset);
8091                                 pvalues[0].vtype = VTYPE_UINT32;
8092                                 pvalues[0].vdesc = "Version: %u";
8093                                 pvalues[0].vlength = 4;
8094                                 pvalues[0].voffset = foffset;
8095                                 pvalues[0].hfname= hf_nds_ver;
8096                                 foffset = foffset+pvalues[0].vlength;
8097                                 pvalues[1].vvalue = tvb_get_letohl(tvb, foffset);
8098                                 pvalues[1].vtype = VTYPE_UINT32;
8099                                 pvalues[1].vdesc = "Entry ID: 0x%08x";
8100                                 pvalues[1].vlength = 4;
8101                                 resolve_eid = TRUE;
8102                                 global_eid = pvalues[1].vvalue;
8103                                 pvalues[1].voffset = foffset;
8104                                 pvalues[1].hfname= hf_nds_eid;
8105                                 foffset = foffset+pvalues[1].vlength;
8106                                 break;
8107                         case 0x3c:    
8108                                 break;
8109                         case 0x3d:    
8110                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8111                                 break;
8112                         case 0x3e:    
8113                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8114                                 break;
8115                         case 0x3f:    
8116                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8117                                 break;
8118                         case 0x40:    
8119                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8120                                 break;
8121                         case 0x41:    
8122                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8123                                 break;
8124                         case 0x42:    
8125                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8126                                 break;
8127                         case 0x43:    
8128                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8129                                 break;
8130                         case 0x44:    
8131                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8132                                 break;
8133                         case 0x45:    
8134                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8135                                 break;
8136                         case 0x46:    
8137                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8138                                 break;
8139                         case 0x47:    
8140                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8141                                 break;
8142                         case 0x48:    
8143                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8144                                 break;
8145                         case 0x49:    
8146                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8147                                 break;
8148                         case 0x4a:    
8149                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8150                                 break;
8151                         case 0x4b:    
8152                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8153                                 break;
8154                         case 0x4c:    
8155                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8156                                 break;
8157                         case 0x4d:    
8158                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8159                                 break;
8160                         default:
8161                                 pvalues[0].vtype = VTYPE_NONE; /* Not Defined */
8162                 }
8163         }
8164         /* Fill in the INFO column. */
8165         if (check_col(pinfo->cinfo, COL_INFO)) {
8166                 if (ncp_rec) {
8167                         col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDS");
8168                         if (nds_frag != 0xffffffff) {
8169                                 col_add_fstr(pinfo->cinfo, COL_INFO, "C Continue NDS Fragment %08x", nds_frag);
8170                         }
8171                         else {
8172                                 col_add_fstr(pinfo->cinfo, COL_INFO, "C NDS %s", verb_string);
8173                         }
8174                         run_info_str = TRUE;
8175                 }
8176                 else {
8177                         col_add_fstr(pinfo->cinfo, COL_INFO,
8178                                 "C Unknown Function %d (0x%02x)",
8179                                 func, func);
8180                 }
8181                         
8182         }
8183
8184         /* Keep track of the address and connection whence the request
8185            came, and the address and connection to which the request
8186            is being sent, so that we can match up calls with replies.
8187            (We don't include the sequence number, as we may want
8188            to have all packets over the same connection treated
8189            as being part of a single conversation so that we can
8190            let the user select that conversation to be displayed.) */
8191
8192         conversation = find_conversation(&pinfo->src, &pinfo->dst,
8193                     PT_NCP, nw_connection, nw_connection, 0);
8194         if (conversation == NULL) {
8195                 /* It's not part of any conversation - create a new one. */
8196                 conversation = conversation_new(&pinfo->src, &pinfo->dst,
8197                     PT_NCP, nw_connection, nw_connection, 0);
8198         }
8199                 
8200         if (!pinfo->fd->flags.visited) {
8201                 request_value = ncp_hash_insert(conversation, sequence, ncp_rec);
8202                 request_value->req_frame_num = pinfo->fd->num;
8203                 request_value->req_frame_time.secs=pinfo->fd->abs_secs;
8204                 request_value->req_frame_time.nsecs=pinfo->fd->abs_usecs*1000;
8205
8206                 /* If this is the first time we're examining the packet,
8207                  * check to see if this NCP type uses a "request condition".
8208                  * If so, we have to build a proto_tree because request conditions
8209                  * use display filters to work, and without a proto_tree,
8210                  * display filters can't possibly work. If we already have
8211                  * a proto_tree, then wonderful. If we don't, we need to build
8212                  * one. */
8213                 if (ncp_rec && !ncp_tree) {
8214                         run_req_cond = TRUE;
8215                 }
8216         }
8217                 
8218         /* If we have to handle a request condition, or have to
8219            add to the Info column, we need to construct a protocol
8220            tree.  If we already have a proto_tree, then wonderful.
8221            If we don't, we need to build one. */
8222         if ((run_info_str || run_req_cond) && !ncp_tree) {
8223                 proto_item *ti;
8224                                        
8225                 temp_tree = proto_tree_create_root();
8226                 proto_tree_set_visible(temp_tree, FALSE);
8227                 ti = proto_tree_add_item(temp_tree, proto_ncp, tvb, 0, -1, FALSE);
8228                 ncp_tree = proto_item_add_subtree(ti, ett_ncp);
8229         }
8230
8231         if (ncp_tree) {
8232                 /* If the dissection throws an exception, be sure to free
8233                  * the temporary proto_tree that was created. Because of the
8234                  * way the CLEANUP_PUSH macro works, we can't put it in an 'if'
8235                  * block; it has to be in the same scope as the terminating
8236                  * CLEANUP_POP or CLEANUP_POP_AND_ALLOC. So, we always
8237                  * call CLEANUP_POP and friends, but the value of temp_tree is
8238                  * NULL if no cleanup is needed, and non-null if cleanup is needed. 
8239                  */
8240                          
8241                 CLEANUP_PUSH(free_proto_tree, temp_tree);
8242                
8243                 request_value = ncp_hash_lookup(conversation, sequence);
8244                 
8245                 switch (type) {
8246                         case NCP_BROADCAST_SLOT:
8247                                 ; /* nothing */
8248                                 break;
8249                 
8250                         case NCP_SERVICE_REQUEST:
8251                         
8252                                 ptvc = ptvcursor_new(ncp_tree, tvb, 7);
8253                                 if (ncp_rec && ncp_rec->request_ptvc)
8254                                 {
8255                                         clear_repeat_vars();
8256                                         process_ptvc_record(ptvc, ncp_rec->request_ptvc, NULL, TRUE, ncp_rec);
8257                                 }
8258                                 proto_tree_add_uint_format(ncp_tree, hf_ncp_func, tvb, 6, 1,
8259                                         func, "Function: %d (0x%02X), %s",
8260                                         func, func, ncp_rec ? ncp_rec->name : "Unknown");
8261                                                 
8262                                 proto_tree_add_uint_format(ncp_tree, hf_ncp_subfunc, tvb, 7, 1,
8263                                         subfunc, "SubFunction: %d (0x%02x)",
8264                                         subfunc, subfunc);
8265                                                 
8266                                 proto_tree_add_uint(ncp_tree, hf_ncp_fragment_handle, tvb, 8, 4,
8267                                         nds_frag);
8268                                                 
8269                                 if (nds_frag == 0xffffffff) {
8270                                         
8271                                         proto_tree_add_item(ncp_tree, hf_ncp_fragment_size, tvb, 12, 4, TRUE);
8272                                                 
8273                                         proto_tree_add_item(ncp_tree, hf_ncp_message_size, tvb, 16, 4, TRUE);
8274                                         
8275                                         proto_tree_add_item(ncp_tree, hf_ncp_nds_flag, tvb, 20, 4, FALSE);
8276                                         
8277                                         proto_tree_add_uint_format(ncp_tree, hf_ncp_nds_verb, tvb, 24, 4,
8278                                                 nds_verb, "NDS Verb: %d, (0x%02x), %s",
8279                                                 nds_verb, nds_verb, verb_string);
8280                                         added_arrow = FALSE;
8281                                         for (i = 0; i < 9; i++) {
8282                                                 switch (pvalues[i].vtype) {
8283
8284                                                 case VTYPE_NONE: /* no value */
8285                                                         break;
8286
8287                                                 case VTYPE_UINT8:
8288                                                         proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
8289                                                             pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %d",
8290                                                             pvalues[i].vtype);
8291                                                         break;
8292
8293                                                 case VTYPE_UINT16:
8294                                                         proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
8295                                                             pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %d",
8296                                                             pvalues[i].vtype);
8297                                                         break;
8298
8299                                                 case VTYPE_UINT32:
8300                                                         proto_tree_add_uint_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
8301                                                             pvalues[i].vlength, pvalues[i].vvalue, pvalues[i].vdesc,
8302                                                             pvalues[i].vvalue);
8303                                                         break;
8304
8305                                                 case VTYPE_STRING:
8306                                                         proto_tree_add_string_format(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset, 
8307                                                             pvalues[i].vlength, pvalues[i].vstring, pvalues[i].vdesc, pvalues[i].vstring);
8308                                                         if (pvalues[i].mvtype == MVTYPE_ATTR_REQUEST) {
8309                                                                 /*
8310                                                                  * The "vstring" value is set to the input ES type
8311                                                                  * for MVTYPE_PROC_ENTRY_SPECIFIERS,
8312                                                                  * to add string to columninfo
8313                                                                  */
8314                                                                 if (check_col(pinfo->cinfo, COL_INFO)) {
8315                                                                         if (!added_arrow) {
8316                                                                                 col_append_str(pinfo->cinfo, COL_INFO, " -> ");
8317                                                                                 added_arrow = TRUE;
8318                                                                         }
8319                                                                         col_append_str(pinfo->cinfo, COL_INFO, pvalues[i].vstring);
8320                                                                 }
8321                                                         }
8322                                                         break;
8323
8324                                                 case VTYPE_BITFIELD:
8325                                                         process_bitfield(ncp_tree, tvb, &pvalues[i]);
8326                                                         break;
8327
8328                                                 case VTYPE_MULTIVALUE_UINT32:
8329                                                         process_multivalues(ncp_tree, tvb, &pvalues[i]);
8330                                                         if (pvalues[i].mvtype == MVTYPE_PROC_ENTRY_SPECIFIERS) {
8331                                                                 /*
8332                                                                  * The "vstring" value is set to the input ES type
8333                                                                  * by "process_multivalues()".
8334                                                                  */
8335                                                                 strcpy(global_object_name, pvalues[i].vstring);
8336                                                         }
8337                                                         if (pvalues[i].mvtype == MVTYPE_ATTR_REQUEST || pvalues[i].mvtype == MVTYPE_PROC_ENTRY_SPECIFIERS) {
8338                                                                 /*
8339                                                                  * The "vstring" value is set to the input ES type
8340                                                                  * for MVTYPE_PROC_ENTRY_SPECIFIERS,
8341                                                                  * and the last string for MVTYPE_ATTR_REQUEST,
8342                                                                  * by "process_multivalues()".
8343                                                                  */
8344                                                                 if (check_col(pinfo->cinfo, COL_INFO)) {
8345                                                                         if (!added_arrow) {
8346                                                                                 col_append_str(pinfo->cinfo, COL_INFO, " -> ");
8347                                                                                 added_arrow = TRUE;
8348                                                                         }
8349                                                                         col_append_str(pinfo->cinfo, COL_INFO, pvalues[i].vstring);
8350                                                                 }
8351                                                         }
8352                                                         break;
8353
8354                                                 case VTYPE_BYTES:
8355                                                         proto_tree_add_bytes(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset,
8356                                                             pvalues[i].vlength, tvb_get_ptr(tvb, pvalues[i].voffset, pvalues[i].vvalue));
8357                                                         break;
8358
8359                                                 case VTYPE_BOOLEAN:
8360                                                         proto_tree_add_item(ncp_tree, pvalues[i].hfname, tvb, pvalues[i].voffset, pvalues[i].vlength, TRUE);
8361                                                         break;
8362
8363                                                 default:
8364                                                         proto_tree_add_uint_format(ncp_tree, hf_nds_p1type, tvb, pvalues[i].voffset,
8365                                                             pvalues[i].vlength, pvalues[i].vtype, "NDS Parameter not defined %u",
8366                                                             pvalues[i].vtype);
8367                                                         break;
8368                                                 }
8369                                                 /* For NDS requests with just an EID, resolve name from hash table. */
8370                                         }
8371                                         request_eid_value = ncp_eid_hash_lookup(conversation, global_eid);
8372                                         if(resolve_eid) {
8373                                                 if (request_eid_value) {
8374                                                         strcpy(global_object_name, request_eid_value->object_name);
8375                                                         if (check_col(pinfo->cinfo, COL_INFO)) 
8376                                                         {
8377                                                                 col_append_str(pinfo->cinfo, COL_INFO, ", Object Name - ");
8378                                                                 col_append_str(pinfo->cinfo, COL_INFO, global_object_name);
8379                                                         }
8380                                                 }        
8381                                         }
8382                                         if (request_value)
8383                                         {
8384                                                 request_value->nds_request_verb = nds_verb;
8385                                                 request_value->nds_version = nds_version;
8386                                                 strcpy(request_value->object_name, global_object_name);
8387                                                 request_value->req_nds_flags = global_flags;
8388                                         }
8389                                 }
8390                                 break;
8391                
8392                         default:
8393                                 ; /* nothing */
8394                                 break;
8395                 }
8396                 ptvcursor_free(ptvc);
8397                
8398                 /* Free the temporary proto_tree */
8399                 CLEANUP_CALL_AND_POP;
8400         }        
8401 }
8402
8403 /*
8404  * XXX - this duplicates stuff in "dissect_ncp_request()"; could
8405  * "dissect_ncp_request()" not just call "dissect_ping_req()" if
8406  * the operation is an NCP ping, and "dissect_ping_req()" just dissect
8407  * ping portion?
8408  */
8409 void
8410 dissect_ping_req(tvbuff_t *tvb, packet_info *pinfo,
8411                 guint16 nw_connection, guint8 sequence,
8412                 guint16 type, proto_tree *ncp_tree)
8413 {
8414         guint8                  func, subfunc = 0;
8415         ncp_req_hash_value      *request_value = NULL;
8416         const ncp_record        *ncp_rec = NULL;          
8417         conversation_t          *conversation;
8418         ptvcursor_t             *ptvc = NULL;
8419         proto_tree              *temp_tree = NULL;
8420         gint                    length_remaining = 0;
8421         guint32                 nds_flags;
8422         guint32                 ping_version;
8423         nds_val                 pvalue;
8424         char                    string_buffer[1024];
8425         
8426         pvalue.vvalue = 0;
8427         pvalue.vlength = 0;
8428         pvalue.voffset = 0;
8429         pvalue.hfname = 0;
8430         pvalue.vdesc = "";
8431         string_buffer[0] = '\0';
8432         pvalue.vstring = string_buffer;
8433         pvalue.mvtype = 0;
8434         
8435         func = tvb_get_guint8(tvb, 6);
8436         subfunc = tvb_get_guint8(tvb, 7);
8437         
8438         ncp_rec = ncp_record_find(func, subfunc);
8439
8440         /* Fill in the INFO column. */
8441         if (check_col(pinfo->cinfo, COL_INFO)) 
8442         {
8443                 if (ncp_rec) 
8444                 {
8445                         
8446                         col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDS");
8447                         col_add_fstr(pinfo->cinfo, COL_INFO, "C Ping for NDS");
8448                 }
8449                 
8450         }
8451         if (!pinfo->fd->flags.visited) 
8452         {
8453         
8454                 /* This is the first time we've looked at this packet.
8455                 Keep track of the address and connection whence the request
8456                 came, and the address and connection to which the request
8457                 is being sent, so that we can match up calls with replies.
8458                 (We don't include the sequence number, as we may want
8459                 to have all packets over the same connection treated
8460                 as being part of a single conversation so that we can
8461                 let the user select that conversation to be displayed.) */
8462                 
8463                 conversation = find_conversation(&pinfo->src, &pinfo->dst,
8464                     PT_NCP, nw_connection, nw_connection, 0);
8465         
8466                 if (conversation == NULL) 
8467                 {
8468                         /* It's not part of any conversation - create a new one. */
8469                         conversation = conversation_new(&pinfo->src, &pinfo->dst,
8470                             PT_NCP, nw_connection, nw_connection, 0);
8471                 }
8472                 
8473                 request_value = ncp_hash_insert(conversation, sequence, ncp_rec);
8474                 request_value->req_frame_num = pinfo->fd->num;
8475                 request_value->req_frame_time.secs=pinfo->fd->abs_secs;
8476                 request_value->req_frame_time.nsecs=pinfo->fd->abs_usecs*1000;
8477         
8478                 /* If this is the first time we're examining the packet,
8479                  * check to see if this NCP type uses a "request condition".
8480                  * If so, we have to build a proto_tree because request conditions
8481                  * use display filters to work, and without a proto_tree,
8482                  * display filters can't possibly work. If we already have
8483                  * a proto_tree, then wonderful. If we don't, we need to build
8484                  * one. */
8485                 if (ncp_rec && !ncp_tree) {
8486                         proto_item *ti;
8487                                
8488                         temp_tree = proto_tree_create_root();
8489                         proto_tree_set_visible(temp_tree, FALSE);
8490                         ti = proto_tree_add_item(temp_tree, proto_ncp, tvb, 0, -1, FALSE);
8491                         ncp_tree = proto_item_add_subtree(ti, ett_ncp);
8492                 }
8493         }
8494         
8495         if (ncp_tree) {
8496                 /* If the dissection throws an exception, be sure to free
8497                  * the temporary proto_tree that was created. Because of the
8498                  * way the CLEANUP_PUSH macro works, we can't put it in an 'if'
8499                  * block; it has to be in the same scope as the terminating
8500                  * CLEANUP_POP or CLEANUP_POP_AND_ALLOC. So, we always
8501                  * call CLEANUP_POP and friends, but the value of temp_tree is
8502                  * NULL if no cleanup is needed, and non-null if cleanup is needed. 
8503                  */
8504                 CLEANUP_PUSH(free_proto_tree, temp_tree);
8505         
8506                 switch (type) {
8507
8508                 case NCP_BROADCAST_SLOT:
8509                         ; /* nothing */
8510                         break;
8511         
8512                 case NCP_SERVICE_REQUEST:
8513                         proto_tree_add_uint_format(ncp_tree, hf_ncp_func, tvb, 6, 1,
8514                                 func, "Function: %u (0x%02X), %s",
8515                                 func, func, ncp_rec ? ncp_rec->name : "Unknown");
8516                                         
8517                         proto_tree_add_uint_format(ncp_tree, hf_ncp_subfunc, tvb, 7, 1,
8518                                 subfunc, "SubFunction: %u (0x%02x)",
8519                                 subfunc, subfunc);
8520                                         
8521                         length_remaining = tvb_reported_length_remaining(tvb, 8);
8522                         if (length_remaining >= 8) {
8523                                 ping_version = tvb_get_letohl(tvb, 8);
8524                                 proto_tree_add_uint(ncp_tree, hf_nds_ping_version, tvb, 8,
8525                                     4, ping_version);
8526                                 nds_flags = tvb_get_letohl(tvb, 12);
8527                                 if (request_value)
8528                                         request_value->req_nds_flags = nds_flags;
8529
8530                                 
8531                                 pvalue.vvalue = tvb_get_letohs(tvb, 12);
8532                                 pvalue.vtype = VTYPE_BITFIELD;
8533                                 pvalue.vstring = "";
8534                                 pvalue.vdesc = "Ping (low) Request Flags:";
8535                                 pvalue.vlength = 2;
8536                                 pvalue.hfname= hf_nds_rflags;
8537                                 pvalue.voffset = 12;
8538                                 pvalue.bit1 = "Supported Fields";
8539                                 pvalue.bit1hfname = hf_bit1pingflags1;
8540                                 pvalue.bit2 = "Depth";
8541                                 pvalue.bit2hfname = hf_bit2pingflags1;
8542                                 pvalue.bit3 = "Revision";
8543                                 pvalue.bit3hfname = hf_bit3pingflags1;
8544                                 pvalue.bit4 = "Flags";
8545                                 pvalue.bit4hfname = hf_bit4pingflags1;
8546                                 pvalue.bit5 = "Verification Flags";
8547                                 pvalue.bit5hfname = hf_bit5pingflags1;
8548                                 pvalue.bit6 = "Letter Version";
8549                                 pvalue.bit6hfname = hf_bit6pingflags1;
8550                                 pvalue.bit7 = "OS Version";
8551                                 pvalue.bit7hfname = hf_bit7pingflags1;
8552                                 pvalue.bit8 = "License Flags";
8553                                 pvalue.bit8hfname = hf_bit8pingflags1;
8554                                 pvalue.bit9 = "DS Time";
8555                                 pvalue.bit9hfname = hf_bit9pingflags1;
8556                                 pvalue.bit10 = "Not Defined";
8557                                 pvalue.bit10hfname = hf_bit10pingflags1;
8558                                 pvalue.bit11 = "Not Defined";
8559                                 pvalue.bit11hfname = hf_bit11pingflags1;
8560                                 pvalue.bit12 = "Not Defined";
8561                                 pvalue.bit12hfname = hf_bit12pingflags1;
8562                                 pvalue.bit13 = "Not Defined";
8563                                 pvalue.bit13hfname = hf_bit13pingflags1;
8564                                 pvalue.bit14 = "Not Defined";
8565                                 pvalue.bit14hfname = hf_bit14pingflags1;
8566                                 pvalue.bit15 = "Not Defined";
8567                                 pvalue.bit15hfname = hf_bit15pingflags1;
8568                                 pvalue.bit16 = "Not Defined";
8569                                 pvalue.bit16hfname = hf_bit16pingflags1;
8570                                 
8571                                 process_bitfield(ncp_tree, tvb, &pvalue);
8572                                 
8573                                 pvalue.vvalue = tvb_get_letohs(tvb, 14);
8574                                 pvalue.vtype = VTYPE_BITFIELD;
8575                                 pvalue.vstring = "";
8576                                 pvalue.vdesc = "Ping (high) Request Flags:";
8577                                 pvalue.vlength = 2;
8578                                 pvalue.hfname= hf_nds_rflags;
8579                                 pvalue.voffset = 14;
8580                                 pvalue.bit1 = "Sap Name";
8581                                 pvalue.bit1hfname = hf_bit1pingflags2;
8582                                 pvalue.bit2 = "Tree Name";
8583                                 pvalue.bit2hfname = hf_bit2pingflags2;
8584                                 pvalue.bit3 = "OS Name";
8585                                 pvalue.bit3hfname = hf_bit3pingflags2;
8586                                 pvalue.bit4 = "Hardware Name";
8587                                 pvalue.bit4hfname = hf_bit4pingflags2;
8588                                 pvalue.bit5 = "Vendor Name";
8589                                 pvalue.bit5hfname = hf_bit5pingflags2;
8590                                 pvalue.bit6 = "Not Defined";
8591                                 pvalue.bit6hfname = hf_bit6pingflags2;
8592                                 pvalue.bit7 = "Not Defined";
8593                                 pvalue.bit7hfname = hf_bit7pingflags2;
8594                                 pvalue.bit8 = "Not Defined";
8595                                 pvalue.bit8hfname = hf_bit8pingflags2;
8596                                 pvalue.bit9 = "Not Defined";
8597                                 pvalue.bit9hfname = hf_bit9pingflags2;
8598                                 pvalue.bit10 = "Not Defined";
8599                                 pvalue.bit10hfname = hf_bit10pingflags2;
8600                                 pvalue.bit11 = "Not Defined";
8601                                 pvalue.bit11hfname = hf_bit11pingflags2;
8602                                 pvalue.bit12 = "Not Defined";
8603                                 pvalue.bit12hfname = hf_bit12pingflags2;
8604                                 pvalue.bit13 = "Not Defined";
8605                                 pvalue.bit13hfname = hf_bit13pingflags2;
8606                                 pvalue.bit14 = "Not Defined";
8607                                 pvalue.bit14hfname = hf_bit14pingflags2;
8608                                 pvalue.bit15 = "Not Defined";
8609                                 pvalue.bit15hfname = hf_bit15pingflags2;
8610                                 pvalue.bit16 = "Not Defined";
8611                                 pvalue.bit16hfname = hf_bit16pingflags2;
8612                                 
8613                                 process_bitfield(ncp_tree, tvb, &pvalue);
8614                         }
8615                         break;
8616        
8617                 default:
8618                         ; /* nothing */
8619                         break;
8620                 }
8621                 ptvc = ptvcursor_new(ncp_tree, tvb, 7);
8622                 if (ncp_rec && ncp_rec->request_ptvc) {
8623                         clear_repeat_vars();
8624                         process_ptvc_record(ptvc, ncp_rec->request_ptvc, NULL, TRUE, ncp_rec);
8625                 }
8626                 ptvcursor_free(ptvc);
8627
8628                 /* Free the temporary proto_tree */
8629                 CLEANUP_CALL_AND_POP;
8630         }
8631 }