Fix some spelling/punctuation/capitalization/etc. errors.
[obnox/wireshark/wip.git] / packet-ndps.c
1 /* packet-ndps.c
2  * Routines for NetWare's NDPS
3  * Greg Morris <gmorris@novell.com>
4  * Copyright (c) Novell, Inc. 2002-2003
5  *
6  * $Id: packet-ndps.c,v 1.17 2003/04/09 08:51:18 guy Exp $
7  *
8  * Ethereal - Network traffic analyzer
9  * By Gerald Combs <gerald@ethereal.com>
10  * Copyright 1998 Gerald Combs
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25  */
26
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30
31 #include <string.h>
32 #include <glib.h>
33 #include <epan/packet.h>
34 #include "prefs.h"
35 #include "packet-ipx.h"
36 #include "packet-tcp.h"
37 #include <epan/conversation.h>
38 #include "packet-ndps.h"
39 #include "reassemble.h"
40
41 #define NDPS_PACKET_INIT_COUNT  200
42
43 /* Tables for reassembly of fragments. */
44 static GHashTable *ndps_fragment_table = NULL;
45 static GHashTable *ndps_reassembled_table = NULL;
46
47 /* desegmentation of ndps */
48 static gboolean ndps_defragment = TRUE;
49 static guint32  frag_number = 0;
50 static guint32  save_frag_length=0;
51 static guint32  save_frag_seq=0;
52 static gboolean ndps_fragmented = FALSE;
53 static gboolean more_fragment = FALSE;
54 static guint32  tid = 1;
55
56 static void dissect_ndps_request(tvbuff_t*, packet_info*, proto_tree*, guint32, guint32, int);
57
58 static void dissect_ndps_reply(tvbuff_t *, packet_info*, proto_tree*, int);
59
60 static int hf_ndps_segments = -1;
61 static int hf_ndps_segment = -1;
62 static int hf_ndps_segment_overlap = -1;
63 static int hf_ndps_segment_overlap_conflict = -1;
64 static int hf_ndps_segment_multiple_tails = -1;
65 static int hf_ndps_segment_too_long_segment = -1;
66 static int hf_ndps_segment_error = -1;
67
68 static gint ett_ndps_segments = -1;
69 static gint ett_ndps_segment = -1;
70
71 static int proto_ndps = -1;
72 static int hf_ndps_record_mark = -1;
73 static int hf_ndps_length = -1;
74 static int hf_ndps_xid = -1;
75 static int hf_ndps_packet_type = -1;
76 static int hf_ndps_rpc_version = -1;
77 static int hf_ndps_error = -1;
78 static int hf_ndps_items = -1;
79 static int hf_ndps_objects = -1;
80 static int hf_ndps_attributes = -1;
81 static int hf_ndps_sbuffer = -1;
82 static int hf_ndps_rbuffer = -1;
83 static int hf_ndps_user_name = -1;
84 static int hf_ndps_broker_name = -1;
85 static int hf_ndps_pa_name = -1;
86 static int hf_ndps_tree = -1;
87 static int hf_ndps_reqframe = -1;
88 static int hf_ndps_error_val = -1;
89 static int hf_ndps_ext_error = -1;
90 static int hf_ndps_object = -1;
91 static int hf_ndps_cred_type = -1;
92 static int hf_ndps_server_name = -1;
93 static int hf_ndps_connection = -1;
94 static int hf_ndps_auth_null = -1;
95 static int hf_ndps_rpc_accept = -1;
96 static int hf_ndps_rpc_acc_stat = -1;
97 static int hf_ndps_rpc_rej_stat = -1;
98 static int hf_ndps_rpc_acc_results = -1;
99 static int hf_ndps_problem_type = -1;
100 static int hf_security_problem_type = -1;
101 static int hf_service_problem_type = -1;
102 static int hf_access_problem_type = -1;
103 static int hf_printer_problem_type = -1;
104 static int hf_selection_problem_type = -1;
105 static int hf_doc_access_problem_type = -1;
106 static int hf_attribute_problem_type = -1;
107 static int hf_update_problem_type = -1;
108 static int hf_obj_id_type = -1;
109 static int hf_oid_struct_size = -1;
110 static int hf_object_name = -1;
111 static int hf_ndps_document_number = -1;
112 static int hf_ndps_nameorid = -1;
113 static int hf_local_object_name = -1;
114 static int hf_printer_name = -1;
115 static int hf_ndps_qualified_name = -1;
116 static int hf_ndps_item_count = -1;
117 static int hf_ndps_qualifier = -1;
118 static int hf_ndps_lib_error = -1;
119 static int hf_ndps_other_error = -1;
120 static int hf_ndps_other_error_2 = -1;
121 static int hf_ndps_session = -1;
122 static int hf_ndps_abort_flag = -1;
123 static int hf_obj_attribute_type = -1;
124 static int hf_ndps_attribute_value = -1;
125 static int hf_ndps_lower_range = -1;
126 static int hf_ndps_upper_range = -1;
127 static int hf_ndps_n64 = -1;
128 static int hf_ndps_lower_range_n64 = -1;
129 static int hf_ndps_upper_range_n64 = -1;
130 static int hf_ndps_attrib_boolean = -1;
131 static int hf_ndps_realization = -1;
132 static int hf_ndps_xdimension_n64 = -1;
133 static int hf_ndps_ydimension_n64 = -1;
134 static int hf_ndps_dim_value = -1;
135 static int hf_ndps_dim_flag = -1;
136 static int hf_ndps_xydim_value = -1;
137 static int hf_ndps_location_value = -1;
138 static int hf_ndps_xmin_n64 = -1;
139 static int hf_ndps_xmax_n64 = -1;
140 static int hf_ndps_ymin_n64 = -1;
141 static int hf_ndps_ymax_n64 = -1;
142 static int hf_ndps_edge_value = -1;
143 static int hf_ndps_cardinal_or_oid = -1;
144 static int hf_ndps_cardinal_name_or_oid = -1;
145 static int hf_ndps_integer_or_oid = -1;
146 static int hf_ndps_profile_id = -1;
147 static int hf_ndps_persistence = -1;
148 static int hf_ndps_language_id = -1;
149 static int hf_address_type = -1;
150 static int hf_ndps_address = -1;
151 static int hf_ndps_add_bytes = -1;
152 static int hf_ndps_event_type = -1;
153 static int hf_ndps_event_object_identifier = -1;
154 static int hf_ndps_octet_string = -1;
155 static int hf_ndps_scope = -1;
156 static int hf_address_len = -1;
157 static int hf_ndps_net = -1;
158 static int hf_ndps_node = -1;
159 static int hf_ndps_socket = -1;
160 static int hf_ndps_port = -1;
161 static int hf_ndps_ip = -1;
162 static int hf_ndps_server_type = -1;
163 static int hf_ndps_service_type = -1;
164 static int hf_ndps_service_enabled = -1;
165 static int hf_ndps_method_name = -1;
166 static int hf_ndps_method_ver = -1;
167 static int hf_ndps_file_name = -1;
168 static int hf_ndps_admin_submit = -1;
169 static int hf_ndps_oid = -1;
170 static int hf_ndps_object_op = -1;
171 static int hf_answer_time = -1;
172 static int hf_oid_asn1_type = -1;
173 static int hf_ndps_item_ptr = -1;
174 static int hf_ndps_len = -1;
175 static int hf_limit_enc = -1;
176 static int hf_ndps_qualified_name2 = -1;
177 static int hf_ndps_delivery_add_type = -1;
178 static int hf_ndps_criterion_type = -1;
179 static int hf_ndps_ignored_type = -1;
180 static int hf_ndps_resource_type = -1;
181 static int hf_ndps_identifier_type = -1;
182 static int hf_ndps_page_flag = -1;
183 static int hf_ndps_media_type = -1;
184 static int hf_ndps_doc_content = -1;
185 static int hf_ndps_page_size = -1;
186 static int hf_ndps_direction = -1;
187 static int hf_ndps_page_order = -1;
188 static int hf_ndps_medium_size = -1;
189 static int hf_ndps_long_edge_feeds = -1;
190 static int hf_ndps_inc_across_feed = -1;
191 static int hf_ndps_size_inc_in_feed = -1;
192 static int hf_ndps_page_orientation = -1;
193 static int hf_ndps_numbers_up = -1;
194 static int hf_ndps_xdimension = -1;
195 static int hf_ndps_ydimension = -1;
196 static int hf_ndps_state_severity = -1;
197 static int hf_ndps_training = -1;
198 static int hf_ndps_colorant_set = -1;
199 static int hf_ndps_card_enum_time = -1;
200 static int hf_ndps_attrs_arg = -1;
201 static int hf_ndps_context = -1;
202 static int hf_ndps_filter = -1;
203 static int hf_ndps_item_filter = -1;
204 static int hf_ndps_substring_match = -1;
205 static int hf_ndps_time_limit = -1;
206 static int hf_ndps_count_limit = -1;
207 static int hf_ndps_operator = -1;
208 static int hf_ndps_password = -1;
209 static int hf_ndps_retrieve_restrictions = -1;
210 static int hf_bind_security = -1;
211 static int hf_ndps_max_items = -1;
212 static int hf_ndps_status_flags = -1;
213 static int hf_ndps_resource_list_type = -1;
214 static int hf_os_type = -1;
215 static int hf_ndps_printer_type = -1;
216 static int hf_ndps_printer_manuf = -1;
217 static int hf_ndps_inf_file_name = -1;
218 static int hf_ndps_vendor_dir = -1;
219 static int hf_banner_type = -1;
220 static int hf_font_type = -1;
221 static int hf_printer_id = -1;
222 static int hf_ndps_font_name = -1;
223 static int hf_ndps_return_code = -1;
224 static int hf_ndps_banner_name = -1;
225 static int hf_font_type_name = -1;
226 static int hf_font_file_name = -1;
227 static int hf_ndps_prn_file_name = -1;
228 static int hf_ndps_prn_dir_name = -1;
229 static int hf_ndps_def_file_name = -1;
230 static int hf_ndps_win31_items = -1;
231 static int hf_ndps_win95_items = -1;
232 static int hf_ndps_windows_key = -1;
233 static int hf_archive_type = -1;
234 static int hf_archive_file_size = -1;
235 static int hf_ndps_data = -1;
236 static int hf_get_status_flag = -1;
237 static int hf_res_type = -1;
238 static int hf_file_timestamp = -1;
239 static int hf_sub_complete = -1;
240 static int hf_doc_content = -1;
241 static int hf_ndps_doc_name = -1;
242 static int hf_print_arg = -1;
243 static int hf_local_id = -1;
244 static int hf_ndps_included_doc = -1;
245 static int hf_ndps_ref_name = -1;
246 static int hf_interrupt_job_type = -1;
247 static int hf_pause_job_type = -1;
248 static int hf_ndps_force = -1;
249 static int hf_resubmit_op_type = -1;
250 static int hf_shutdown_type = -1;
251 static int hf_ndps_supplier_flag = -1;
252 static int hf_ndps_language_flag = -1;
253 static int hf_ndps_method_flag = -1;
254 static int hf_ndps_delivery_address_flag = -1;
255 static int hf_ndps_list_profiles_type = -1;
256 static int hf_ndps_list_profiles_choice_type = -1;
257 static int hf_ndps_list_profiles_result_type = -1;
258 static int hf_ndps_integer_type_flag = -1;
259 static int hf_ndps_integer_type_value = -1;
260 static int hf_ndps_continuation_option = -1;
261 static int hf_ndps_ds_info_type = -1;
262 static int hf_ndps_guid = -1;
263 static int hf_ndps_list_services_type = -1;
264 static int hf_ndps_item_bytes = -1;
265 static int hf_ndps_certified = -1;
266 static int hf_ndps_attribute_set = -1;
267 static int hf_ndps_data_item_type = -1;
268 static int hf_info_int = -1;
269 static int hf_info_int16 = -1;
270 static int hf_info_int32 = -1;
271 static int hf_info_boolean = -1;
272 static int hf_info_string = -1;
273 static int hf_info_bytes = -1;
274 static int hf_ndps_list_local_servers_type = -1;
275 static int hf_ndps_registry_name = -1;
276 static int hf_ndps_client_server_type = -1;
277 static int hf_ndps_session_type = -1;
278 static int hf_time = -1;
279 static int hf_ndps_supplier_name = -1;
280 static int hf_ndps_message = -1;
281 static int hf_delivery_method_type = -1;
282 static int hf_ndps_get_session_type = -1;
283 static int hf_packet_count = -1;
284 static int hf_last_packet_flag = -1;
285 static int hf_ndps_get_resman_session_type = -1;
286 static int hf_problem_type = -1;
287
288 static int hf_spx_ndps_program = -1;
289 static int hf_spx_ndps_version = -1;
290 static int hf_spx_ndps_func_print = -1;
291 static int hf_spx_ndps_func_registry = -1;
292 static int hf_spx_ndps_func_notify = -1;
293 static int hf_spx_ndps_func_resman = -1;
294 static int hf_spx_ndps_func_delivery = -1;
295 static int hf_spx_ndps_func_broker = -1;
296
297 static gint ett_ndps = -1;
298 static dissector_handle_t ndps_data_handle;
299
300 /* desegmentation of NDPS over TCP */
301 static gboolean ndps_desegment = TRUE;
302
303 static const value_string true_false[] = {
304     { 0x00000000, "Accept" },
305     { 0x00000001, "Deny" },
306     { 0,          NULL }
307 };
308
309 static const value_string ndps_limit_enc_enum[] = {
310     { 0x00000000, "Time" },
311     { 0x00000001, "Count" },
312     { 0x00000002, "Error" },
313     { 0,          NULL }
314 };
315
316 static const value_string problem_type_enum[] = {
317     { 0x00000000, "Standard" },
318     { 0x00000001, "Extended" },
319     { 0,          NULL }
320 };
321
322 static const value_string accept_stat[] = {
323     { 0x00000000, "Success" },
324     { 0x00000001, "Program Unavailable" },
325     { 0x00000002, "Program Mismatch" },
326     { 0x00000003, "Procedure Unavailable" },
327     { 0x00000004, "Garbage Arguments" },
328     { 0x00000005, "System Error" },
329     { 0,          NULL }
330 };
331
332 static const value_string reject_stat[] = {
333     { 0x00000000, "RPC Mismatch" },
334     { 0x00000001, "Authentication Error" },
335     { 0,          NULL }
336 };
337
338 static const value_string error_type_enum[] = {
339     { 0x00000000, "Security Error" },
340     { 0x00000001, "Service Error" },
341     { 0x00000002, "Access Error" },
342     { 0x00000003, "Printer Error" },
343     { 0x00000004, "Selection Error" },
344     { 0x00000005, "Document Access Error" },
345     { 0x00000006, "Attribute Error" },
346     { 0x00000007, "Update Error" },
347     { 0,          NULL }
348 };
349
350 static const value_string security_problem_enum[] = {
351     { 0x00000000, "Authentication" },
352     { 0x00000001, "Credentials" },
353     { 0x00000002, "Rights" },
354     { 0x00000003, "Invalid PAC" },
355     { 0,          NULL }
356 };
357
358 static const value_string service_problem_enum[] = {
359     { 0x00000000, "Sever Busy" },
360     { 0x00000001, "Server Unavailable" },
361     { 0x00000002, "Complex Operation" },
362     { 0x00000003, "Resource Limit" },
363     { 0x00000004, "Unclassified Server Error" },
364     { 0x00000005, "Too Many Items in List" },
365     { 0x00000006, "Resource not Available" },
366     { 0x00000007, "Cancel Document Support" },
367     { 0x00000008, "Modify Document Support" },
368     { 0x00000009, "Multiple Document Support" },
369     { 0x0000000a, "Parameter Valid Support" },
370     { 0x0000000b, "Invalid Checkpoint" },
371     { 0x0000000c, "Continuation Context" },
372     { 0x0000000d, "Pause Limit Exceeded" },
373     { 0x0000000e, "Unsupported Operation" },
374     { 0x0000000f, "Notify Service Error" },
375     { 0x00000010, "Accounting Service Error" },
376     { 0,          NULL }
377 };
378
379 static const value_string access_problem_enum[] = {
380     { 0x00000000, "Wrong Object Class" },
381     { 0x00000001, "Lack of Access Rights" },
382     { 0x00000002, "Can't Interrupt Job" },
383     { 0x00000003, "Wrong Object State" },
384     { 0x00000004, "Client Not Bound" },
385     { 0x00000005, "Not Available" },
386     { 0x00000006, "Notify Service Not Connected" },
387     { 0x00000007, "PDS Not Connected" },
388     { 0,          NULL }
389 };
390
391 static const value_string printer_problem_enum[] = {
392     { 0x00000000, "Printer Error" },
393     { 0x00000001, "Printer Needs Attention" },
394     { 0x00000002, "Printer Needs Key Operator" },
395     { 0,          NULL }
396 };
397
398 static const value_string selection_problem_enum[] = {
399     { 0x00000000, "Invalid ID" },
400     { 0x00000001, "Unknown ID" },
401     { 0x00000002, "Object Exists" },
402     { 0x00000003, "ID Changed" },
403     { 0,          NULL }
404 };
405
406 static const value_string doc_access_problem_enum[] = {
407     { 0x00000000, "Access Not Available" },
408     { 0x00000001, "Time Expired" },
409     { 0x00000002, "Access Denied" },
410     { 0x00000003, "Unknown Document" },
411     { 0x00000004, "No Documents in Job" },
412     { 0,          NULL }
413 };
414
415 static const value_string attribute_problem_enum[] = {
416     { 0x00000000, "Invalid Syntax" },
417     { 0x00000001, "Undefined Type" },
418     { 0x00000002, "Wrong Matching" },
419     { 0x00000003, "Constraint Violated" },
420     { 0x00000004, "Unsupported Type" },
421     { 0x00000005, "Illegal Modification" },
422     { 0x00000006, "Consists With Other Attribute" },
423     { 0x00000007, "Undefined Attribute Value" },
424     { 0x00000008, "Unsupported Value" },
425     { 0x00000009, "Invalid Noncompulsed Modification" },
426     { 0x0000000a, "Per Job Inadmissible" },
427     { 0x0000000b, "Not Multivalued" },
428     { 0x0000000c, "Mandatory Omitted" },
429     { 0x0000000d, "Illegal For Class" },
430     { 0,          NULL }
431 };
432
433 static const value_string update_problem_enum[] = {
434     { 0x00000000, "No Modifications Allowed" },
435     { 0x00000001, "Insufficient Rights" },
436     { 0x00000002, "Previous Operation Incomplete" },
437     { 0x00000003, "Cancel Not Possible" },
438     { 0,          NULL }
439 };
440
441 static const value_string obj_identification_enum[] = {
442     { 0x00000000, "Printer Contained Object ID" },
443     { 0x00000001, "Document Identifier" },
444     { 0x00000002, "Object Identifier" },
445     { 0x00000003, "Object Name" },
446     { 0x00000004, "Name or Object ID" },
447     { 0x00000005, "Simple Name" },
448     { 0x00000006, "Printer Configuration Object ID" },
449     { 0x00000007, "Qualified Name" },
450     { 0x00000008, "Event Object ID" },
451     { 0,          NULL }
452 };
453
454 static const value_string nameorid_enum[] = {
455     { 0x00000000, "None" },
456     { 0x00000001, "Global" },
457     { 0x00000002, "Local" },
458     { 0,          NULL }
459 };
460
461 static const value_string qualified_name_enum[] = {
462     { 0x00000000, "None" },
463     { 0x00000001, "Simple" },
464     { 0x00000002, "NDS" },
465     { 0,          NULL }
466 };
467
468 static const value_string qualified_name_enum2[] = {
469     { 0x00000000, "NDS" },
470     { 0,          NULL }
471 };
472
473 static const value_string spx_ndps_program_vals[] = {
474     { 0x00060976, "Print Program" },
475     { 0x00060977, "Broker Program" },
476     { 0x00060978, "Registry Program" },
477     { 0x00060979, "Notify Program" },
478     { 0x0006097a, "Resource Manager Program" },
479     { 0x0006097b, "Programmatic Delivery Program" },
480     { 0,          NULL }
481 };
482
483 static const value_string spx_ndps_print_func_vals[] = {
484     { 0x00000000, "None" },
485     { 0x00000001, "Bind PSM" },
486     { 0x00000002, "Bind PA" },
487     { 0x00000003, "Unbind" },
488     { 0x00000004, "Print" },
489     { 0x00000005, "Modify Job" },
490     { 0x00000006, "Cancel Job" },
491     { 0x00000007, "List Object Attributes" },
492     { 0x00000008, "Promote Job" },
493     { 0x00000009, "Interrupt" },
494     { 0x0000000a, "Pause" },
495     { 0x0000000b, "Resume" },
496     { 0x0000000c, "Clean" },
497     { 0x0000000d, "Create" },
498     { 0x0000000e, "Delete" },
499     { 0x0000000f, "Disable PA" },
500     { 0x00000010, "Enable PA" },
501     { 0x00000011, "Resubmit Jobs" },
502     { 0x00000012, "Set" },
503     { 0x00000013, "Shutdown PA" },
504     { 0x00000014, "Startup PA" },
505     { 0x00000015, "Reorder Job" },
506     { 0x00000016, "Pause PA" },
507     { 0x00000017, "Resume PA" },
508     { 0x00000018, "Transfer Data" },
509     { 0x00000019, "Device Control" },
510     { 0x0000001a, "Add Event Profile" },
511     { 0x0000001b, "Remove Event Profile" },
512     { 0x0000001c, "Modify Event Profile" },
513     { 0x0000001d, "List Event Profiles" },
514     { 0x0000001e, "Shutdown PSM" },
515     { 0x0000001f, "Cancel PSM Shutdown" },
516     { 0x00000020, "Set Printer DS Information" },
517     { 0x00000021, "Clean User Jobs" },
518     { 0x00000022, "Map GUID to NDS Name" },
519     { 0,          NULL }
520 };
521
522 static const value_string spx_ndps_notify_func_vals[] = {
523     { 0x00000000, "None" },
524     { 0x00000001, "Notify Bind" },
525     { 0x00000002, "Notify Unbind" },
526     { 0x00000003, "Register Supplier" },
527     { 0x00000004, "Deregister Supplier" },
528     { 0x00000005, "Add Profile" },
529     { 0x00000006, "Remove Profile" },
530     { 0x00000007, "Modify Profile" },
531     { 0x00000008, "List Profiles" },
532     { 0x00000009, "Report Event" },
533     { 0x0000000a, "List Supported Languages" },
534     { 0x0000000b, "Report Notification" },
535     { 0x0000000c, "Add Delivery Method" },
536     { 0x0000000d, "Remove Delivery Method" },
537     { 0x0000000e, "List Delivery Methods" },
538     { 0x0000000f, "Get Delivery Method Information" },
539     { 0x00000010, "Get Notify NDS Object Name" },
540     { 0x00000011, "Get Notify Session Information" },
541     { 0,          NULL }
542 };
543
544 static const value_string spx_ndps_deliver_func_vals[] = {
545     { 0x00000000, "None" },
546     { 0x00000001, "Delivery Bind" },
547     { 0x00000002, "Delivery Unbind" },
548     { 0x00000003, "Delivery Send" },
549     { 0x00000004, "Delivery Send2" },
550     { 0,          NULL }
551 };
552
553 static const value_string spx_ndps_registry_func_vals[] = {
554     { 0x00000000, "None" },
555     { 0x00000001, "Bind" },
556     { 0x00000002, "Unbind" },
557     { 0x00000003, "Register Server" },
558     { 0x00000004, "Deregister Server" },
559     { 0x00000005, "Register Registry" },
560     { 0x00000006, "Deregister Registry" },
561     { 0x00000007, "Registry Update" },
562     { 0x00000008, "List Local Servers" },
563     { 0x00000009, "List Servers" },
564     { 0x0000000a, "List Known Registries" },
565     { 0x0000000b, "Get Registry NDS Object Name" },
566     { 0x0000000c, "Get Registry Session Information" },
567     { 0,          NULL }
568 };
569
570 static const value_string spx_ndps_resman_func_vals[] = {
571     { 0x00000000, "None" },
572     { 0x00000001, "Bind" },
573     { 0x00000002, "Unbind" },
574     { 0x00000003, "Add Resource File" },
575     { 0x00000004, "Delete Resource File" },
576     { 0x00000005, "List Resources" },
577     { 0x00000006, "Get Resource File" },
578     { 0x00000007, "Get Resource File Date" },
579     { 0x00000008, "Get Resource Manager NDS Object Name" },
580     { 0x00000009, "Get Resource Manager Session Information" },
581     { 0x0000000a, "Set Resource Language Context" },
582     { 0,          NULL }
583 };
584
585 static const value_string spx_ndps_broker_func_vals[] = {
586     { 0x00000000, "None" },
587     { 0x00000001, "Bind" },
588     { 0x00000002, "Unbind" },
589     { 0x00000003, "List Services" },
590     { 0x00000004, "Enable Service" },
591     { 0x00000005, "Disable Service" },
592     { 0x00000006, "Down Broker" },
593     { 0x00000007, "Get Broker NDS Object Name" },
594     { 0x00000008, "Get Broker Session Information" },
595     { 0,          NULL }
596 };
597
598 static const value_string ndps_packet_types[] = {
599     { 0x00000000, "Request" },
600     { 0x00000001, "Reply" },
601     { 0,          NULL }
602 };
603
604 static const value_string ndps_realization_enum[] = {
605     { 0x00000000, "Logical" },
606     { 0x00000001, "Physical" },
607     { 0x00000002, "Logical & Physical" },
608     { 0,          NULL }
609 };
610
611 static const value_string ndps_dim_value_enum[] = {
612     { 0x00000000, "Numeric" },
613     { 0x00000001, "Named" },
614     { 0,          NULL }
615 };
616
617 static const value_string ndps_xydim_value_enum[] = {
618     { 0x00000000, "Real" },
619     { 0x00000001, "Named" },
620     { 0x00000002, "Cardinal" },
621     { 0,          NULL }
622 };
623
624 static const value_string ndps_location_value_enum[] = {
625     { 0x00000000, "Numeric" },
626     { 0x00000001, "Named" },
627     { 0,          NULL }
628 };
629
630 static const value_string ndps_edge_value_enum[] = {
631     { 0x00000000, "Bottom" },
632     { 0x00000001, "Right" },
633     { 0x00000002, "Top" },
634     { 0x00000003, "Left" },
635     { 0,          NULL }
636 };
637
638 static const value_string ndps_card_or_oid_enum[] = {
639     { 0x00000000, "Number" },
640     { 0x00000001, "ID" },
641     { 0,          NULL }
642 };
643
644 static const value_string ndps_card_name_or_oid_enum[] = {
645     { 0x00000000, "Number" },
646     { 0x00000001, "ID" },
647     { 0,          NULL }
648 };
649
650 static const value_string ndps_integer_or_oid_enum[] = {
651     { 0x00000000, "ID" },
652     { 0x00000001, "Number" },
653     { 0,          NULL }
654 };
655
656 static const value_string ndps_persistence_enum[] = {
657     { 0x00000000, "Permanent" },
658     { 0x00000001, "Volatile" },
659     { 0,          NULL }
660 };
661
662 static const value_string ndps_address_type_enum[] = {
663     { 0x00000000, "User" },
664     { 0x00000001, "Server" },
665     { 0x00000002, "Volume" },
666     { 0x00000003, "Organization Unit" },
667     { 0x00000004, "Organization" },
668     { 0x00000005, "Group" },
669     { 0x00000006, "Distinguished Name" },
670     { 0x00000007, "User or Container" },
671     { 0x00000008, "Case Exact String" },
672     { 0x00000009, "Case Ignore String" },
673     { 0x0000000a, "Numeric String" },
674     { 0x0000000b, "DOS File Name" },
675     { 0x0000000c, "Phone Number" },
676     { 0x0000000d, "Boolean" },
677     { 0x0000000e, "Integer" },
678     { 0x0000000f, "Network Address" },
679     { 0x00000010, "Choice" },
680     { 0x00000011, "GroupWise User" },
681     { 0,          NULL }
682 };
683
684 static const value_string ndps_address_enum[] = {
685     { 0x00000000, "IPX" },
686     { 0x00000001, "IP" },
687     { 0x00000002, "SDLC" },
688     { 0x00000003, "Token Ring to Ethernet" },
689     { 0x00000004, "OSI" },
690     { 0x00000005, "AppleTalk" },
691     { 0x00000006, "Count" },
692     { 0,          NULL }
693 };
694
695
696 static const value_string ndps_server_type_enum[] = {
697     { 0x00000000, "All" },
698     { 0x00000001, "Public Access Printer Agent" },
699     { 0x00000002, "Notification Server" },
700     { 0x00000003, "Resource Manager" },
701     { 0x00000004, "Network Port Handler" },
702     { 0,          NULL }
703 };
704
705 static const value_string ndps_event_object_enum[] = {
706     { 0x00000000, "Object" },
707     { 0x00000001, "Filter" },
708     { 0x00000002, "Detail" },
709     { 0,          NULL }
710 };
711
712 static const value_string ndps_service_type_enum[] = {
713     { 0x00000000, "SRS" },
714     { 0x00000001, "ENS" },
715     { 0x00000002, "RMS" },
716     { 0,          NULL }
717 };
718
719 static const value_string ndps_delivery_add_enum[] = {
720     { 0x00000000, "MHS Address" },
721     { 0x00000001, "Distinguished Name" },
722     { 0x00000002, "Text" },
723     { 0x00000003, "Octet String" },
724     { 0x00000004, "Distinguished Name String" },
725     { 0x00000005, "RPC Address" },
726     { 0x00000006, "Qualified Name" },
727     { 0,          NULL }
728 };
729
730 static const value_string ndps_resource_enum[] = {
731     { 0x00000000, "Name or ID" },
732     { 0x00000001, "Text" },
733     { 0,          NULL }
734 };
735
736
737 static const value_string ndps_identifier_enum[] = {
738     { 0x00000000, "ID Nominal Number" },
739     { 0x00000001, "ID Alpha-numeric" },
740     { 0x00000002, "ID Tag" },
741     { 0,          NULL }
742 };
743
744 static const value_string ndps_media_enum[] = {
745     { 0x00000000, "Select All Pages" },
746     { 0x00000001, "Selected Pages" },
747     { 0,          NULL }
748 };
749
750 static const value_string ndps_page_size_enum[] = {
751     { 0x00000000, "ID" },
752     { 0x00000001, "Dimensions" },
753     { 0,          NULL }
754 };
755
756 static const value_string ndps_pres_direction_enum[] = {
757     { 0x00000000, "Right to Bottom" },
758     { 0x00000001, "Left to Bottom" },
759     { 0x00000002, "Bidirectional to Bottom" },
760     { 0x00000003, "Right to Top" },
761     { 0x00000004, "Left to Top" },
762     { 0x00000005, "Bidirectional to Top" },
763     { 0x00000006, "Bottom to Right" },
764     { 0x00000007, "Bottom to Left" },
765     { 0x00000008, "Top to Left" },
766     { 0x00000009, "Top to Right" },
767     { 0,          NULL }
768 };
769
770 static const value_string ndps_page_order_enum[] = {
771     { 0x00000000, "Unknown" },
772     { 0x00000001, "First to Last" },
773     { 0x00000002, "Last to First" },
774     { 0,          NULL }
775 };
776
777 static const value_string ndps_medium_size_enum[] = {
778     { 0x00000000, "Discrete" },
779     { 0x00000001, "Continuous" },
780     { 0,          NULL }
781 };
782
783 static const value_string ndps_page_orientation_enum[] = {
784     { 0x00000000, "Unknown" },
785     { 0x00000001, "Face Up" },
786     { 0x00000002, "Face Down" },
787     { 0,          NULL }
788 };
789
790 static const value_string ndps_numbers_up_enum[] = {
791     { 0x00000000, "Cardinal" },
792     { 0x00000001, "Name or Object ID" },
793     { 0x00000002, "Cardinal Range" },
794     { 0,          NULL }
795 };
796
797
798 static const value_string ndps_state_severity_enum[] = {
799     { 0x00000001, "Other" },
800     { 0x00000002, "Warning" },
801     { 0x00000003, "Critical" },
802     { 0,          NULL }
803 };
804
805
806 static const value_string ndps_training_enum[] = {
807     { 0x00000001, "Other" },
808     { 0x00000002, "Unknown" },
809     { 0x00000003, "Untrained" },
810     { 0x00000004, "Trained" },
811     { 0x00000005, "Field Service" },
812     { 0x00000006, "Management" },
813     { 0,          NULL }
814 };
815
816 static const value_string ndps_colorant_set_enum[] = {
817     { 0x00000000, "Name" },
818     { 0x00000001, "Description" },
819     { 0,          NULL }
820 };
821
822 static const value_string ndps_card_enum_time_enum[] = {
823     { 0x00000000, "Cardinal" },
824     { 0x00000001, "Enumeration" },
825     { 0x00000002, "Time" },
826     { 0,          NULL }
827 };
828
829 static const value_string ndps_attrs_arg_enum[] = {
830     { 0x00000000, "Continuation" },
831     { 0x00000001, "Specification" },
832     { 0,          NULL }
833 };
834
835
836 static const value_string ndps_filter_enum[] = {
837     { 0x00000000, "Item" },
838     { 0x00000001, "And" },
839     { 0x00000002, "Or" },
840     { 0x00000003, "Not" },
841     { 0,          NULL }
842 };
843
844
845 static const value_string ndps_filter_item_enum[] = {
846     { 0x00000000, "Equality" },
847     { 0x00000001, "Substrings" },
848     { 0x00000002, "Greater then or Equal to" },
849     { 0x00000003, "Less then or Equal to" },
850     { 0x00000004, "Present" },
851     { 0x00000005, "Subset of" },
852     { 0x00000006, "Superset of" },
853     { 0x00000007, "Non NULL Set Intersect" },
854     { 0,          NULL }
855 };
856
857 static const value_string ndps_match_criteria_enum[] = {
858     { 0x00000000, "Exact" },
859     { 0x00000001, "Case Insensitive" },
860     { 0x00000002, "Same Letter" },
861     { 0x00000003, "Approximate" },
862     { 0,          NULL }
863 };
864
865 static const value_string ndps_operator_enum[] = {
866     { 0x00000000, "Attributes" },
867     { 0x00000002, "Ordered Jobs" },
868     { 0,          NULL }
869 };
870
871 static const value_string ndps_resource_type_enum[] = {
872     { 0x00000000, "Printer Drivers" },
873     { 0x00000001, "Printer Definitions" },
874     { 0x00000002, "Printer Definitions Short" },
875     { 0x00000003, "Banner Page Files" },
876     { 0x00000004, "Font Types" },
877     { 0x00000005, "Printer Driver Files" },
878     { 0x00000006, "Printer Definition File" },
879     { 0x00000007, "Font Files" },
880     { 0x00000008, "Generic Type" },
881     { 0x00000009, "Generic Files" },
882     { 0x0000000a, "Printer Definition File 2" },
883     { 0x0000000b, "Printer Driver Types 2" },
884     { 0x0000000c, "Printer Driver Files 2" },
885     { 0x0000000d, "Printer Driver Types Archive" },
886     { 0x0000000e, "Languages Available" },
887     { 0,          NULL }
888 };
889
890 static const value_string ndps_os_type_enum[] = {
891     { 0x00000000, "DOS" },
892     { 0x00000001, "Windows 3.1" },
893     { 0x00000002, "Windows 95" },
894     { 0x00000003, "Windows NT" },
895     { 0x00000004, "OS2" },
896     { 0x00000005, "MAC" },
897     { 0x00000006, "UNIX" },
898     { 0x00000007, "Windows NT 4.0" },
899     { 0x00000008, "Windows 2000/XP" },
900     { 0x00000009, "Windows 98" },
901     { 0xffffffff, "None" },
902     { 0,          NULL }
903 };
904
905 static const value_string ndps_banner_type_enum[] = {
906     { 0x00000000, "All" },
907     { 0x00000001, "PCL" },
908     { 0x00000002, "PostScript" },
909     { 0x00000003, "ASCII Text" },
910     { 0,          NULL }
911 };
912
913 static const value_string ndps_font_type_enum[] = {
914     { 0x00000000, "TrueType" },
915     { 0x00000001, "PostScript" },
916     { 0x00000002, "System" },
917     { 0x00000003, "SPD" },
918     { 0x00000004, "True Doc" },
919     { 0,          NULL }
920 };
921
922 static const value_string ndps_archive_enum[] = {
923     { 0x00000000, "ZIP" },
924     { 0x00000001, "JAR" },
925     { 0,          NULL }
926 };
927
928
929 static const value_string ndps_res_type_enum[] = {
930     { 0x00000000, "Printer Driver" },
931     { 0x00000001, "Printer Definition" },
932     { 0x00000002, "Banner Page" },
933     { 0x00000003, "Font" },
934     { 0x00000004, "Generic Resource" },
935     { 0x00000005, "Print Driver Archive" },
936     { 0,          NULL }
937 };
938
939 static const value_string ndps_print_arg_enum[] = {
940     { 0x00000000, "Create Job" },
941     { 0x00000001, "Add Document" },
942     { 0x00000002, "Close Job" },
943     { 0,          NULL }
944 };
945
946 static const value_string ndps_doc_content_enum[] = {
947     { 0x00000000, "Content Included" },
948     { 0x00000001, "Content Referenced" },
949     { 0,          NULL }
950 };
951
952 static const value_string ndps_interrupt_job_enum[] = {
953     { 0x00000000, "Job ID" },
954     { 0x00000001, "Name" },
955     { 0,          NULL }
956 };
957
958 static const value_string ndps_pause_job_enum[] = {
959     { 0x00000000, "Job ID" },
960     { 0x00000001, "Name" },
961     { 0,          NULL }
962 };
963
964 static const value_string ndps_resubmit_op_enum[] = {
965     { 0x00000000, "Copy" },
966     { 0x00000001, "Move" },
967     { 0,          NULL }
968 };
969
970 static const value_string ndps_shutdown_enum[] = {
971     { 0x00000000, "Do Current Jobs" },
972     { 0x00000001, "Immediate" },
973     { 0x00000002, "Do Pending Jobs" },
974     { 0,          NULL }
975 };
976
977 static const value_string ndps_list_profiles_choice_enum[] = {
978     { 0x00000000, "ID" },
979     { 0x00000001, "Filter" },
980     { 0,          NULL }
981 };
982
983 static const value_string ndps_list_profiles_result_enum[] = {
984     { 0x00000000, "Complete" },
985     { 0x00000001, "No Event Objects" },
986     { 0x00000002, "Profile ID's" },
987     { 0,          NULL }
988 };
989
990 static const value_string ndps_ds_info_enum[] = {
991     { 0x00000000, "Add" },
992     { 0x00000001, "Remove" },
993     { 0x00000002, "Update" },
994     { 0,          NULL }
995 };
996
997 static const value_string ndps_list_services_enum[] = {
998     { 0x00000000, "Supported" },
999     { 0x00000001, "Enabled" },
1000     { 0,          NULL }
1001 };
1002
1003 static const value_string ndps_data_item_enum[] = {
1004     { 0x00000000, "Int8" },
1005     { 0x00000001, "Int16" },
1006     { 0x00000002, "Int32" },
1007     { 0x00000003, "Boolean" },
1008     { 0x00000004, "Character String" },
1009     { 0x00000005, "Byte String" },
1010     { 0,          NULL }
1011 };
1012
1013 static const value_string ndps_list_local_servers_enum[] = {
1014     { 0x00000000, "Specification" },
1015     { 0x00000001, "Continuation" },
1016     { 0,          NULL }
1017 };
1018
1019 static const value_string ndps_delivery_method_enum[] = {
1020     { 0x00000000, "Specification" },
1021     { 0x00000001, "Continuation" },
1022     { 0,          NULL }
1023 };
1024
1025 static const value_string ndps_attribute_enum[] = {
1026     { 0x00000000, "Null" },
1027     { 0x00000001, "Text" },
1028     { 0x00000002, "Descriptive Name" },
1029     { 0x00000003, "Descriptor" },
1030     { 0x00000004, "Message" },
1031     { 0x00000005, "Error Message" },
1032     { 0x00000006, "Simple Name" },
1033     { 0x00000007, "Distinguished Name String" },
1034     { 0x00000008, "Distinguished Name Seq" },
1035     { 0x00000009, "Delta Time" },
1036     { 0x0000000a, "Time" },
1037     { 0x0000000b, "Integer" },
1038     { 0x0000000c, "Integer Seq" },
1039     { 0x0000000d, "Cardinal" },
1040     { 0x0000000e, "Cardinal Seq" },
1041     { 0x0000000f, "Positive Integer" },
1042     { 0x00000010, "Integer Range" },
1043     { 0x00000011, "Cardinal Range" },
1044     { 0x00000012, "Maximum Integer" },
1045     { 0x00000013, "Minimum Integer" },
1046     { 0x00000014, "Integer 64" },
1047     { 0x00000015, "Integer 64 Seq" },
1048     { 0x00000016, "Cardinal 64" },
1049     { 0x00000017, "Cardinal 64 Seq" },
1050     { 0x00000018, "Positive Integer 64" },
1051     { 0x00000019, "Integer 64 Range" },
1052     { 0x0000001a, "Cardinal 64 Range" },
1053     { 0x0000001b, "Maximum Integer 64" },
1054     { 0x0000001c, "Minimum Integer 64" },
1055     { 0x0000001d, "Real" },
1056     { 0x0000001e, "Real Seq" },
1057     { 0x0000001f, "Non-Negative Real" },
1058     { 0x00000020, "Real Range" },
1059     { 0x00000021, "Non-Negative Real Range" },
1060     { 0x00000022, "Boolean" },
1061     { 0x00000023, "Percent" },
1062     { 0x00000024, "Object Identifier" },
1063     { 0x00000025, "Object Identifier Seq" },
1064     { 0x00000026, "Name or OID" },
1065     { 0x00000027, "Name or OID Seq" },
1066     { 0x00000028, "Distinguished Name" },
1067     { 0x00000029, "Relative Distinguished Name Seq" },
1068     { 0x0000002a, "Realization" },
1069     { 0x0000002b, "Medium Dimensions" },
1070     { 0x0000002c, "Dimension" },
1071     { 0x0000002d, "XY Dimensions" },
1072     { 0x0000002e, "Locations" },
1073     { 0x0000002f, "Area" },
1074     { 0x00000030, "Area Seq" },
1075     { 0x00000031, "Edge" },
1076     { 0x00000032, "Font Reference" },
1077     { 0x00000033, "Cardinal or OID" },
1078     { 0x00000034, "OID Cardinal Map" },
1079     { 0x00000035, "Cardinal or Name or OID" },
1080     { 0x00000036, "Positive Integer or OID" },
1081     { 0x00000037, "Event Handling Profile" },
1082     { 0x00000038, "Octet String" },
1083     { 0x00000039, "Priority" },
1084     { 0x0000003a, "Locale" },
1085     { 0x0000003b, "Method Delivery Address" },
1086     { 0x0000003c, "Object Identification" },
1087     { 0x0000003d, "Results Profile" },
1088     { 0x0000003e, "Criteria" },
1089     { 0x0000003f, "Job Password" },
1090     { 0x00000040, "Job Level" },
1091     { 0x00000041, "Job Categories" },
1092     { 0x00000042, "Print Checkpoint" },
1093     { 0x00000043, "Ignored Attribute" },
1094     { 0x00000044, "Resource" },
1095     { 0x00000045, "Medium Substitution" },
1096     { 0x00000046, "Font Substitution" },
1097     { 0x00000047, "Resource Context Seq" },
1098     { 0x00000048, "Sides" },
1099     { 0x00000049, "Page Select Seq" },
1100     { 0x0000004a, "Page Media Select" },
1101     { 0x0000004b, "Document Content" },
1102     { 0x0000004c, "Page Size" },
1103     { 0x0000004d, "Presentation Direction" },
1104     { 0x0000004e, "Page Order" },
1105     { 0x0000004f, "File Reference" },
1106     { 0x00000050, "Medium Source Size" },
1107     { 0x00000051, "Input Tray Medium" },
1108     { 0x00000052, "Output Bins Chars" },
1109     { 0x00000053, "Page ID Type" },
1110     { 0x00000054, "Level Range" },
1111     { 0x00000055, "Category Set" },
1112     { 0x00000056, "Numbers Up Supported" },
1113     { 0x00000057, "Finishing" },
1114     { 0x00000058, "Print Contained Object ID" },
1115     { 0x00000059, "Print Config Object ID" },
1116     { 0x0000005a, "Typed Name" },
1117     { 0x0000005b, "Network Address" },
1118     { 0x0000005c, "XY Dimensions Value" },
1119     { 0x0000005d, "Name or OID Dimensions Map" },
1120     { 0x0000005e, "Printer State Reason" },
1121     { 0x0000005f, "Enumeration" },
1122     { 0x00000060, "Qualified Name" },
1123     { 0x00000061, "Qualified Name Set" },
1124     { 0x00000062, "Colorant Set" },
1125     { 0x00000063, "Resource Printer ID" },
1126     { 0x00000064, "Event Object ID" },
1127     { 0x00000065, "Qualified Name Map" },
1128     { 0x00000066, "File Path" },
1129     { 0x00000067, "Uniform Resource Identifier" },
1130     { 0x00000068, "Cardinal or Enum or Time" },
1131     { 0x00000069, "Print Contained Object ID Set" },
1132     { 0x0000006a, "Octet String Pair" },
1133     { 0x0000006b, "Octet String Integer Pair" },
1134     { 0x0000006c, "Extended Resource Identifier" },
1135     { 0x0000006d, "Event Handling Profile 2" },
1136     { 0,          NULL }
1137 };
1138
1139 static const value_string ndps_error_types[] = {
1140     { 0x00000000, "Ok" },
1141     { 0x00000001, "Error" },
1142     { 0xFFFFFC18, "Broker Out of Memory" },      /* Broker Errors */
1143     { 0xFFFFFC17, "Broker Bad NetWare Version" },
1144     { 0xFFFFFC16, "Broker Wrong Command Line Arguments" },
1145     { 0xFFFFFC15, "Broker Name Not Given" },
1146     { 0xFFFFFC14, "Not Broker Class" },
1147     { 0xFFFFFC13, "Invalid Broker Password" },
1148     { 0xFFFFFC12, "Invalid Broker Name" },
1149     { 0xFFFFFC11, "Broker Failed to Create Thread" },
1150     { 0xFFFFFC10, "Broker Failed to Initialize NUT" },
1151     { 0xFFFFFC0F, "Broker Failed to Get Messages" },
1152     { 0xFFFFFC0E, "Broker Failed to Allocate Resources" },
1153     { 0xFFFFFC0D, "Broker Service Name Must be Fully Distinguished" },
1154     { 0xFFFFFC0C, "Broker Uninitialized Module" },
1155     { 0xFFFFFC0B, "Broker DS Value Size Too Large" },
1156     { 0xFFFFFC0A, "Broker No Attribute Values" },
1157     { 0xFFFFFC09, "Broker Unknown Session" },
1158     { 0xFFFFFC08, "Broker Service Disabled" },
1159     { 0xFFFFFC07, "Broker Unknown Modify Operation" },
1160     { 0xFFFFFC06, "Broker Invalid Arguments" },
1161     { 0xFFFFFC05, "Broker Duplicate Session ID" },
1162     { 0xFFFFFC04, "Broker Unknown Service" },
1163     { 0xFFFFFC03, "Broker Service Already Enabled" },
1164     { 0xFFFFFC02, "Broker Service Already Disabled" },
1165     { 0xFFFFFC01, "Broker Invalid Credential" },
1166     { 0xFFFFFC00, "Broker Unknown Designator" },
1167     { 0xFFFFFBFF, "Broker Failed to Make Change Permanent" },
1168     { 0xFFFFFBFE, "Broker Not Admin Type Session" },
1169     { 0xFFFFFBFD, "Broker Option Not Supported" },
1170     { 0xFFFFFBFC, "Broker No Effective Rights" },
1171     { 0xFFFFFBFB, "Broker Could Not Find File" },
1172     { 0xFFFFFBFA, "Broker Error Reading File" },
1173     { 0xFFFFFBF9, "Broker Not NLM File Format" },
1174     { 0xFFFFFBF8, "Broker Wrong NLM File Version" },
1175     { 0xFFFFFBF7, "Broker Reentrant Initialization Failure" },
1176     { 0xFFFFFBF6, "Broker Already in Progress" },
1177     { 0xFFFFFBF5, "Broker Initialize Failure" },
1178     { 0xFFFFFBF4, "Broker Inconsistent File Format" },
1179     { 0xFFFFFBF3, "Broker Can't Load at Startup" },
1180     { 0xFFFFFBF2, "Broker Autoload Modules Not Loaded" },
1181     { 0xFFFFFBF1, "Broker Unresolved External" },
1182     { 0xFFFFFBF0, "Broker Public Already Defined" },
1183     { 0xFFFFFBEF, "Broker Other Broker Using Object" },
1184     { 0xFFFFFBEE, "Broker Service Failed to Initialize" },
1185     { 0xFFFFFBB4, "Registry Out of Memory" },       /* SRS Errors */
1186     { 0xFFFFFBB3, "Registry Bad NetWare Version" },
1187     { 0xFFFFFBB2, "Registry Failed to Create Context" },
1188     { 0xFFFFFBB1, "Registry Failed Login" },
1189     { 0xFFFFFBB0, "Registry Failed to Create Thread" },
1190     { 0xFFFFFBAF, "Registry Failed to Get Messages" },
1191     { 0xFFFFFBAE, "Registry Service Name Must Be Fully Distinguished" },
1192     { 0xFFFFFBAD, "Registry DS Value Size Too Large" },
1193     { 0xFFFFFBAC, "Registry No Attribute Values" },
1194     { 0xFFFFFBAB, "Registry Unknown Session" },
1195     { 0xFFFFFBAA, "Registry Service Disabled" },
1196     { 0xFFFFFBA9, "Registry Unknown Modify Operation" },
1197     { 0xFFFFFBA8, "Registry Can't Start Advertise" },
1198     { 0xFFFFFBA7, "Registry Duplicate Server Entry" },
1199     { 0xFFFFFBA6, "Registry Can't Bind to Registry" },
1200     { 0xFFFFFBA5, "Registry Can't Create Client" },
1201     { 0xFFFFFBA4, "Registry Invalid Arguments" },
1202     { 0xFFFFFBA3, "Registry Duplicate Session ID" },
1203     { 0xFFFFFBA2, "Registry Unknown Server Entry" },
1204     { 0xFFFFFBA1, "Registry Invalid Credential" },
1205     { 0xFFFFFBA0, "Registry Type Session" },
1206     { 0xFFFFFB9F, "Registry Server Type Session" },
1207     { 0xFFFFFB9E, "Registry Not Server Type Session" },
1208     { 0xFFFFFB9D, "Not Registry Type Session" },
1209     { 0xFFFFFB9C, "Registry Unknown Designator" },
1210     { 0xFFFFFB9B, "Registry Option Not Supported" },
1211     { 0xFFFFFB9A, "Registry Not in List Iteration" },
1212     { 0xFFFFFB99, "Registry Invalid Continuation Handle" },
1213     { 0xFFFFFB50, "Notify Out of Memory" },        /* Notification Service Errors */
1214     { 0xFFFFFB4F, "Notify Bad NetWare Version" },
1215     { 0xFFFFFB4E, "Notify Failed to Create Thread" },
1216     { 0xFFFFFB4D, "Notify Failed to Get Messages" },
1217     { 0xFFFFFB4C, "Notify Failed to Create Context" },
1218     { 0xFFFFFB4B, "Notify Failed Login" },
1219     { 0xFFFFFB4A, "Notify Service Name Must be Fully Distiguished" },
1220     { 0xFFFFFB49, "Notify DS Value Size Too Large" },
1221     { 0xFFFFFB48, "Notify No Attribute Values" },
1222     { 0xFFFFFB47, "Notify Unknown Session" },
1223     { 0xFFFFFB46, "Notify Unknown Notify Profile" },
1224     { 0xFFFFFB45, "Notify Error Reading File" },
1225     { 0xFFFFFB44, "Notify Error Writing File" },
1226     { 0xFFFFFB43, "Wrong Notify Database Version" },
1227     { 0xFFFFFB42, "Corrupted Notify Database" },
1228     { 0xFFFFFB41, "Notify Unknown Event Object ID" },
1229     { 0xFFFFFB40, "Notify Method Already Installed" },
1230     { 0xFFFFFB3F, "Notify Unknown Method" },
1231     { 0xFFFFFB3E, "Notify Service Disabled" },
1232     { 0xFFFFFB3D, "Notify Unknown Modify Operation" },
1233     { 0xFFFFFB3C, "Out of Notify Entries" },
1234     { 0xFFFFFB3B, "Notify Unknown Language ID" },
1235     { 0xFFFFFB3A, "Notify Queue Empty" },
1236     { 0xFFFFFB39, "Notify Can't Load Delivery Method" },
1237     { 0xFFFFFB38, "Notify Invalid Arguments" },
1238     { 0xFFFFFB37, "Notify Duplicate Session ID" },
1239     { 0xFFFFFB36, "Notify Invalid Credentials" },
1240     { 0xFFFFFB35, "Notify Unknown Choice" },
1241     { 0xFFFFFB34, "Notify Unknown Attribute Value" },
1242     { 0xFFFFFB33, "Notify Error Writing Database" },
1243     { 0xFFFFFB32, "Notify Unknown Object ID" },
1244     { 0xFFFFFB31, "Notify Unknown Designator" },
1245     { 0xFFFFFB30, "Notify Failed to Make Change Permanent" },
1246     { 0xFFFFFB2F, "Notify User Interface Not Supported" },
1247     { 0xFFFFFB2E, "Notify Not Supplied Type of Session" },
1248     { 0xFFFFFB2D, "Notify Not Admin Type Session" },
1249     { 0xFFFFFB2C, "Notify No Service Registry Available" },
1250     { 0xFFFFFB2B, "Notify Failed to Register With Any Server" },
1251     { 0xFFFFFB2A, "Notify Empty Event Object Set" },
1252     { 0xFFFFFB29, "Notify Unknown Notify Handle" },
1253     { 0xFFFFFB28, "Notify Option Not Supported" },
1254     { 0xFFFFFB27, "Notify Unknown RPC Session" },
1255     { 0xFFFFFB26, "Notify Initialization Error" },
1256     { 0xFFFFFB25, "Notify No Effective Rights" },
1257     { 0xFFFFFB24, "Notify No Persistent Storage" },
1258     { 0xFFFFFB23, "Notify Bad Method Filename" },
1259     { 0xFFFFFB22, "Notify Unknown Continuation Handle" },
1260     { 0xFFFFFB21, "Notify Invalid Continuation Handle" },
1261     { 0xFFFFFB20, "Notify Could Not Find File" },
1262     { 0xFFFFFB1F, "Notify Error Reading File" },
1263     { 0xFFFFFB1E, "Notify Not NLM File Format" },
1264     { 0xFFFFFB1D, "Notify Wrong NLM File Version" },
1265     { 0xFFFFFB1C, "Notify Reentrant Initialization Failure" },
1266     { 0xFFFFFB1B, "Notify Already in Progress" },
1267     { 0xFFFFFB1A, "Notify Initialization Failure" },
1268     { 0xFFFFFB19, "Notify Inconsistent File Format" },
1269     { 0xFFFFFB18, "Notify Can't Load at Startup" },
1270     { 0xFFFFFB17, "Notify Autoload Modules Not Loaded" },
1271     { 0xFFFFFB16, "Notify Unresolved External" },
1272     { 0xFFFFFB15, "Notify Public Already Defined" },
1273     { 0xFFFFFB14, "Notify Using Unknown Methods" },
1274     { 0xFFFFFB13, "Notify Service Not Fully Enabled" },
1275     { 0xFFFFFB12, "Notify Foreign NDS Tree Name" },
1276     { 0xFFFFFB11, "Notify Delivery Method Rejected Address" },
1277     { 0xFFFFFB10, "Notify Unsupported Delivery Address Type" },
1278     { 0xFFFFFB0F, "Notify User Object No Default Server" },
1279     { 0xFFFFFB0E, "Notify Failed to Send Notification" },
1280     { 0xFFFFFB0D, "Notify Bad Volume in Address" },
1281     { 0xFFFFFB0C, "Notify Broker Has No File Rights" },
1282     { 0xFFFFFB0B, "Notify Maximum Methods Supported" },
1283     { 0xFFFFFB0A, "Notify No Filter Provided" },
1284     { 0xFFFFFB09, "Notify IPX Not Supported By Method" },
1285     { 0xFFFFFB08, "Notify IP Not Supported By Method" },
1286     { 0xFFFFFB07, "Notify Failed to Startup Winsock" },
1287     { 0xFFFFFB06, "Notify No Protocols Available" },
1288     { 0xFFFFFB05, "Notify Failed to Launch RPC Server" },
1289     { 0xFFFFFB04, "Notify Invalid SLP Attribute Format" },
1290     { 0xFFFFFB03, "Notify Invalid SLP URL Format" },
1291     { 0xFFFFFB02, "Notify Unknown Attribute Object ID" },
1292     { 0xFFFFFB01, "Notify Duplicate Session ID" },
1293     { 0xFFFFFB00, "Notify Failed to Authenticate" },
1294     { 0xFFFFFAFF, "Notify Failed to Authenticate Protocol Mismatch" },
1295     { 0xFFFFFAFE, "Notify Failed to Authenticate Internal Error" },
1296     { 0xFFFFFAFD, "Notify Failed to Authenticate Connection Error" },
1297     { 0xFFFFFC7C, "Resource Manager Out of Memory" },  /* ResMan Errors */
1298     { 0xFFFFFC7B, "Resource Manager Bad NetWare Version" },
1299     { 0xFFFFFC7A, "Resource Manager Wrong Command Line Arguments" },
1300     { 0xFFFFFC79, "Resource Manager Broker Name Not Given" },
1301     { 0xFFFFFC78, "Resource Manager Invalid Broker Password" },
1302     { 0xFFFFFC77, "Resource Manager Invalid Broker Name" },
1303     { 0xFFFFFC76, "Resource Manager Failed to Create Thread" },
1304     { 0xFFFFFC75, "Resource Manager Service Name Must be Fully Distinguished" },
1305     { 0xFFFFFC74, "Resource Manager DS Value Size Too Large" },
1306     { 0xFFFFFC73, "Resource Manager No Attribute Values" },
1307     { 0xFFFFFC72, "Resource Manager Unknown Session" },
1308     { 0xFFFFFC71, "Resource Manager Error Reading File" },
1309     { 0xFFFFFC70, "Resource Manager Error Writing File" },
1310     { 0xFFFFFC6F, "Resource Manager Service Disabled" },
1311     { 0xFFFFFC6E, "Resource Manager Unknown Modify Operation" },
1312     { 0xFFFFFC6D, "Resource Manager Duplicate Session ID" },
1313     { 0xFFFFFC6C, "Resource Manager Invalid Credentials" },
1314     { 0xFFFFFC6B, "Resource Manager No Service Registry Available" },
1315     { 0xFFFFFC6A, "Resource Manager Failed to Register With any Server" },
1316     { 0xFFFFFC69, "Resource Manager Failed to Get Messages" },
1317     { 0xFFFFFC68, "Resource Manager Failed to Create Context" },
1318     { 0xFFFFFC67, "Resource Manager Failed to Login" },
1319     { 0xFFFFFC66, "Resource Manager NPD Files Generation Error" },
1320     { 0xFFFFFC65, "Resource Manager INF File Format Error" },
1321     { 0xFFFFFC64, "Resource Manager No Printer Type in INF File" },
1322     { 0xFFFFFC63, "Resource Manager No INF Files Present" },
1323     { 0xFFFFFC62, "Resource Manager File Open Error" },
1324     { 0xFFFFFC61, "Resource Manager Read File Error" },
1325     { 0xFFFFFC60, "Resource Manager Write File Error" },
1326     { 0xFFFFFC5F, "Resource Manager Resource Type Invalid" },
1327     { 0xFFFFFC5E, "Resource Manager No Such Filename" },
1328     { 0xFFFFFC5D, "Resource Manager Banner Type Invalid" },
1329     { 0xFFFFFC5C, "Resource Manager List Type Unknown" },
1330     { 0xFFFFFC5B, "Resource Manager OS Not Supported" },
1331     { 0xFFFFFC5A, "Resource Manager No Banner Files Present" },
1332     { 0xFFFFFC59, "Resource Manager Printer Definition Type Unknown" },
1333     { 0xFFFFFC58, "Resource Manager No Printer Types in List" },
1334     { 0xFFFFFC57, "Resource Manager Option Not Supported" },
1335     { 0xFFFFFC56, "Resource Manager Unicode Convention Error" },
1336     { 0xFFFFFC55, "Resource Manager Invalid Arguments" },
1337     { 0xFFFFFC54, "Resource Manager Initialization Error" },
1338     { 0xFFFFFC53, "Resource Manager No Service Registry Available" },
1339     { 0xFFFFFC52, "Resource Manager Failed to Register to Any Server" },
1340     { 0xFFFFFC51, "Resource Manager Unknown Designator" },
1341     { 0xFFFFFC50, "Resource Manager Not Admin Session" },
1342     { 0xFFFFFC4F, "Resource Manager No Effective Rights" },
1343     { 0xFFFFFC4E, "Resource Manager Bad File Attribute" },
1344     { 0xFFFFFC4D, "Resource Manager Document ID Format Error" },
1345     { 0xFFFFFC4C, "Resource Manager Unknown RPC Session" },
1346     { 0xFFFFFC4B, "Resource Manager Session Being Removed" },
1347     { 0xFFFFFC49, "Resource Manager Font Manager IO Error" },
1348     { 0xFFFFFC48, "Resource Manager Font Manager Reentrancy" },
1349     { 0xFFFFFC47, "Resource Manager Font Manager Sequence Error" },
1350     { 0xFFFFFC46, "Resource Manager Font Manager Corrupt Index File" },
1351     { 0xFFFFFC45, "Resource Manager Font Manager No Such Font" },
1352     { 0xFFFFFC44, "Resource Manager Font Manager Not Initialized" },
1353     { 0xFFFFFC43, "Resource Manager Font Manager System Error" },
1354     { 0xFFFFFC42, "Resource Manager Font Manager Bad Parameter" },
1355     { 0xFFFFFC41, "Resource Manager Font Manager Path Too Long" },
1356     { 0xFFFFFC40, "Resource Manager Font Manager Failure" },
1357     { 0xFFFFFC3F, "Resource Manager Duplicate TIRPC Session" },
1358     { 0xFFFFFC3E, "Resource Manager Connection Lost RMS Data" },
1359     { 0xFFFFFC3D, "Resource Manager Failed to Start Winsock" },
1360     { 0xFFFFFC3C, "Resource Manager No Protocols Available" },
1361     { 0xFFFFFC3B, "Resource Manager Failed to Launch RPC Server" },
1362     { 0xFFFFFC3A, "Resource Manager Invalid SLP Attribute Format" },
1363     { 0xFFFFFC39, "Resource Manager Invalid SLP URL Format" },
1364     { 0xFFFFFC38, "Resource Manager Unresolved External" },
1365     { 0xFFFFFC37, "Resource Manager Failed to Authenticate" },
1366     { 0xFFFFFC36, "Resource Manager Failed to Authenticate Protocol Mismatch" },
1367     { 0xFFFFFC35, "Resource Manager Failed to Authenticate Internal Error" },
1368     { 0xFFFFFC34, "Resource Manager Failed to Authenticate Connection Error" },
1369     { 0xFFFFFC33, "Resource Manager No Rights to Remote Resdir" },
1370     { 0xFFFFFC32, "Resource Manager Can't Initialize NDPS Library" },
1371     { 0xFFFFFC31, "Resource Manager Can't Create Resource Reference" },
1372     { 0xFFFFFC30, "Resource Manager File is Zero Length" },
1373     { 0xFFFFFC2F, "Resource Manager Failed to Write INF in Address" },
1374     { 0xFFFFFCDF, "NDPSM No Memory" },               /* NDPSM Errors */
1375     { 0xFFFFFCDE, "NDPSM Memory Not Found" },
1376     { 0xFFFFFCDD, "NDPSM Job Storage Limit" },
1377     { 0xFFFFFCDC, "NDPSM Job Retention Limit" },
1378     { 0xFFFFFCDB, "NDPSM Unsupported Type" },
1379     { 0xFFFFFCDA, "NDPSM Undefined Type" },
1380     { 0xFFFFFCD9, "NDPSM Unsupported Operation" },
1381     { 0xFFFFFCD8, "NDPSM Error Accessing Database" },
1382     { 0xFFFFFCD7, "NDPSM No PDS" },
1383     { 0xFFFFFCD6, "NDPSM Invalid Class" },
1384     { 0xFFFFFCD5, "NDPSM Bad Parameter" },
1385     { 0xFFFFFCD4, "NDPSM Object Not Found" },
1386     { 0xFFFFFCD3, "NDPSM Attribute Not Found" },
1387     { 0xFFFFFCD2, "NDPSM Value Not Found" },
1388     { 0xFFFFFCD1, "NDPSM Values Not Comparable" },
1389     { 0xFFFFFCD0, "NDPSM Invalid Value Syntax" },
1390     { 0xFFFFFCCF, "NDPSM Job Not Found" },
1391     { 0xFFFFFCCE, "NDPSM Communications Error" },
1392     { 0xFFFFFCCD, "NDPSM Printer Agent Initializing" },
1393     { 0xFFFFFCCC, "NDPSM Printer Agent Going Down" },
1394     { 0xFFFFFCCB, "NDPSM Printer Agent Disabled" },
1395     { 0xFFFFFCCA, "NDPSM Printer Agent Paused" },
1396     { 0xFFFFFCC9, "NDPSM Bad Printer Agent Handle" },
1397     { 0xFFFFFCC8, "NDPSM Object Not Locked" },
1398     { 0xFFFFFCC7, "NDPSM Version Incompatible" },
1399     { 0xFFFFFCC6, "NDPSM PSM Initializing" },
1400     { 0xFFFFFCC5, "NDPSM PSM Going Down" },
1401     { 0xFFFFFCC4, "NDPSM Notification Service Error" },
1402     { 0xFFFFFCC3, "NDPSM Medium Needs Mounted" },
1403     { 0xFFFFFCC2, "NDPSM PDS Not Responding" },
1404     { 0xFFFFFCC1, "NDPSM Session Not Found" },
1405     { 0xFFFFFCC0, "NDPSM RPC Failure" },
1406     { 0xFFFFFCBF, "NDPSM Duplicate Value" },
1407     { 0xFFFFFCBE, "NDPSM PDS Refuses Rename" },
1408     { 0xFFFFFCBD, "NDPSM No Mandatory Attribute" },
1409     { 0xFFFFFCBC, "NDPSM Already Attached" },
1410     { 0xFFFFFCBB, "NDPSM Can't Attach" },
1411     { 0xFFFFFCBA, "NDPSM Too Many NetWare Servers" },
1412     { 0xFFFFFCB9, "NDPSM Can't Create Document File" },
1413     { 0xFFFFFCB8, "NDPSM Can't Delete Document File" },
1414     { 0xFFFFFCB7, "NDPSM Can't Open Document File" },
1415     { 0xFFFFFCB6, "NDPSM Can't Write Document File" },
1416     { 0xFFFFFCB5, "NDPSM Job is Active" },
1417     { 0xFFFFFCB4, "NDPSM No Scheduler" },
1418     { 0xFFFFFCB3, "NDPSM Changing Connection" },
1419     { 0xFFFFFCB2, "NDPSM Could not Create Account Reference" },
1420     { 0xFFFFFCB1, "NDPSM Accounting Service Error" },
1421     { 0xFFFFFCB0, "NDPSM RMS Service Error" },
1422     { 0xFFFFFCAF, "NDPSM Failed Validation" },
1423     { 0xFFFFFCAE, "NDPSM Broker Server Connecting" },
1424     { 0xFFFFFCAD, "NDPSM SRS Service Error" },
1425     { 0xFFFFFD44, "JPM Execute Request Later" },
1426     { 0xFFFFFD43, "JPM Failed to Open Document" },
1427     { 0xFFFFFD42, "JPM Failed to Read Document File" },
1428     { 0xFFFFFD41, "JPM Bad Printer Agent Handle" },
1429     { 0xFFFFFD40, "JPM Bad Job Handle" },
1430     { 0xFFFFFD3F, "JPM Bad Document Handle" },
1431     { 0xFFFFFD3E, "JPM Unsupported Operation" },
1432     { 0xFFFFFD3D, "JPM Request Queue Full" },
1433     { 0xFFFFFD3C, "JPM Printer Agent Not Found" },
1434     { 0xFFFFFD3B, "JPM Invalid Request" },
1435     { 0xFFFFFD3A, "JPM Not Accepting Requests" },
1436     { 0xFFFFFD39, "JPM Printer Agent Already Serviced By PDS" },
1437     { 0xFFFFFD38, "JPM No Job" },
1438     { 0xFFFFFD37, "JPM Job Not Found" },
1439     { 0xFFFFFD36, "JPM Could not Access Database" },
1440     { 0xFFFFFD35, "JPM Bad Object Type" },
1441     { 0xFFFFFD34, "JPM Job Already Closed" },
1442     { 0xFFFFFD33, "JPM Document Already Closed" },
1443     { 0xFFFFFD32, "JPM Print Handler Not Registered" },
1444     { 0xFFFFFD31, "JPM Version Incompatible" },
1445     { 0xFFFFFD30, "JPM Printer Agent Paused" },
1446     { 0xFFFFFD2F, "JPM Printer Agent Shutdown" },
1447     { 0xFFFFFD2E, "JPM No CLIB Context" },
1448     { 0xFFFFFD2D, "JPM Accounting Already Serviced" },
1449     { 0xFFFFFC7B, "Database Can't Create File" },
1450     { 0xFFFFFC7A, "Database Can't Find Data File" },
1451     { 0xFFFFFC79, "Database Can't Open Data File" },
1452     { 0xFFFFFC78, "Database Can't Open Index File" },
1453     { 0xFFFFFC77, "Database Index File Not Open" },
1454     { 0xFFFFFC76, "Database Can't Rename File" },
1455     { 0xFFFFFC75, "Database Can't Read Data File" },
1456     { 0xFFFFFC74, "Database Can't Read Index File" },
1457     { 0xFFFFFC73, "Database Can't Write Data File" },
1458     { 0xFFFFFC72, "Database Can't Write Index File" },
1459     { 0xFFFFFC71, "Database Can't Delete Printer Agent Directory" },
1460     { 0xFFFFFC70, "Database Already Deleted" },
1461     { 0xFFFFFC6F, "Database Object Exists" },
1462     { 0xFFFFFC6E, "Database Descriptor In Use" },
1463     { 0xFFFFFC6D, "Database Descriptor Being Deleted" },
1464     { 0,          NULL }
1465 };
1466
1467 static const value_string ndps_credential_enum[] = {
1468     { 0, "SIMPLE" },
1469     { 1, "CERTIFIED" },
1470     { 2, "NDPS 0" },
1471     { 3, "NDPS 1" },
1472     { 4, "NDPS 2" },
1473     { 0, NULL }
1474 };
1475
1476 static const value_string ndps_object_op_enum[] = {
1477     { 0, "None" },
1478     { 1, "Add" },
1479     { 2, "Delete" },
1480     { 3, "Delete Object" },
1481     { 0, NULL }
1482 };
1483
1484 static const value_string ndps_client_server_enum[] = {
1485     { 0, "Client" },
1486     { 1, "Server" },
1487     { 2, "Client and Server" },
1488     { 0, NULL }
1489 };
1490
1491 static const value_string ndps_session_type_enum[] = {
1492     { 0, "Unknown" },
1493     { 1, "User" },
1494     { 2, "Admin" },
1495     { 3, "Server" },
1496     { 4, "Registry" },
1497     { 0, NULL }
1498 };
1499
1500 static const value_string ndps_get_session_type_enum[] = {
1501     { 0, "Unknown" },
1502     { 1, "User" },
1503     { 2, "Admin" },
1504     { 3, "Supplier" },
1505     { 0, NULL }
1506 };
1507
1508 static const value_string ndps_get_resman_session_type_enum[] = {
1509     { 0, "Unknown" },
1510     { 1, "User" },
1511     { 2, "Admin" },
1512     { 0, NULL }
1513 };
1514
1515 static int
1516 align_4(tvbuff_t *tvb, int aoffset)
1517 {
1518        if(tvb_length_remaining(tvb, aoffset) > 4 )
1519        {
1520                 return (aoffset%4);
1521        }
1522        return 0;
1523 }
1524
1525 static int
1526 ndps_string(tvbuff_t* tvb, int hfinfo, proto_tree *ndps_tree, int offset)
1527 {
1528         int     foffset = offset;
1529         guint32 str_length;
1530         char    buffer[1024];
1531         guint32 i;
1532         guint16 c_char;
1533         guint32 length_remaining = 0;
1534         
1535         str_length = tvb_get_ntohl(tvb, foffset);
1536         foffset += 4;
1537         length_remaining = tvb_length_remaining(tvb, foffset);
1538         g_assert(length_remaining > 0);
1539         if(str_length > (guint)length_remaining || str_length > 1024)
1540         {
1541                 proto_tree_add_string(ndps_tree, hfinfo, tvb, foffset,
1542                     length_remaining + 4, "<String too long to process>");
1543                 foffset += length_remaining;
1544                 return foffset;
1545         }
1546         if(str_length == 0)
1547         {
1548             proto_tree_add_string(ndps_tree, hfinfo, tvb, offset,
1549                 4, "<Not Specified>");
1550             return foffset;
1551         }
1552         for ( i = 0; i < str_length; i++ )
1553         {
1554                 c_char = tvb_get_guint8(tvb, foffset );
1555                 if (c_char<0x20 || c_char>0x7e)
1556                 {
1557                         if (c_char != 0x00)
1558                         { 
1559                                 c_char = 0x2e;
1560                                 buffer[i] = c_char & 0xff;
1561                         }
1562                         else
1563                         {
1564                                 i--;
1565                                 str_length--;
1566                         }
1567                 }
1568                 else
1569                 {
1570                         buffer[i] = c_char & 0xff;
1571                 }
1572                 foffset++;
1573                 length_remaining--;
1574                 
1575                 if(length_remaining==1)
1576                 {
1577                         i++;
1578                         break;
1579                 }        
1580         }
1581         buffer[i] = '\0';
1582         
1583         str_length = tvb_get_ntohl(tvb, offset);
1584         proto_tree_add_string(ndps_tree, hfinfo, tvb, offset+4,
1585                 str_length, buffer);
1586         foffset += align_4(tvb, foffset);
1587         return foffset;
1588 }
1589
1590 static int
1591 objectidentifier(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
1592 {
1593     guint32  length=0;
1594  
1595     if (tvb_get_ntohl(tvb, foffset)==0) 
1596     {
1597         return foffset;
1598     }
1599     proto_tree_add_item(ndps_tree, hf_oid_struct_size, tvb, foffset, 4, FALSE);
1600     foffset += 4;
1601     proto_tree_add_item(ndps_tree, hf_oid_asn1_type, tvb, foffset, 1, FALSE);
1602     foffset += 1;
1603     length = tvb_get_guint8(tvb, foffset);
1604     foffset += 1;
1605     proto_tree_add_item(ndps_tree, hf_ndps_oid, tvb, foffset, length, FALSE);
1606     foffset += length;
1607     return foffset+(length%2);
1608 }
1609
1610 static int
1611 name_or_id(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
1612 {
1613     guint8  length=0;
1614
1615     proto_tree_add_item(ndps_tree, hf_ndps_nameorid, tvb, foffset, 4, FALSE);
1616     foffset += 4;
1617     if(tvb_get_ntohl(tvb, foffset-4)==1) /* Global */
1618     {
1619         foffset = objectidentifier(tvb, ndps_tree, foffset);
1620     }
1621     else
1622     {
1623         if(tvb_get_ntohl(tvb, foffset-4)==2) /* Local */
1624         {
1625             foffset = ndps_string(tvb, hf_local_object_name, ndps_tree, foffset);
1626         }
1627     }
1628     return foffset;
1629 }
1630
1631 static int
1632 objectidentification(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
1633 {
1634     guint32     h=0;
1635     guint32     object_count=0;
1636     guint32     object_type=0;
1637     guint32     qualified_name_type=0;
1638     guint32     length=0;
1639     proto_tree  *atree;
1640     proto_item  *aitem;
1641       
1642     object_type = tvb_get_ntohl(tvb, foffset); 
1643     aitem = proto_tree_add_item(ndps_tree, hf_obj_id_type, tvb, foffset, 4, FALSE);
1644     atree = proto_item_add_subtree(aitem, ett_ndps);
1645     foffset += 4;
1646     switch(object_type)
1647     {
1648         case 0:         /* Printer Contained Object ID */
1649             foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
1650             proto_tree_add_item(atree, hf_ndps_object, tvb, foffset, 
1651             4, FALSE);
1652             foffset += 4;
1653             break;
1654         case 1:         /* Document Identifier */
1655             foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
1656             /*proto_tree_add_item(atree, hf_ndps_object, tvb, foffset, 
1657             4, FALSE);
1658             foffset += 4;*/
1659             proto_tree_add_item(atree, hf_ndps_document_number, tvb, foffset, 
1660             4, FALSE);
1661             foffset += 4;
1662             break;
1663         case 2:         /* Object Identifier */
1664             foffset = objectidentifier(tvb, atree, foffset);
1665             break;
1666         case 3:         /* Object Name */
1667             foffset = ndps_string(tvb, hf_object_name, atree, foffset);
1668             if (foffset > tvb_length_remaining(tvb, foffset)) {
1669                 return foffset;
1670             }
1671             foffset = name_or_id(tvb, atree, foffset);
1672             break;
1673         case 4:         /* Name or Object ID */
1674             foffset = name_or_id(tvb, atree, foffset);
1675             break;
1676         case 5:         /* Simple Name */
1677             foffset = ndps_string(tvb, hf_object_name, atree, foffset);
1678             break;
1679         case 6:         /* Printer Configuration Object ID */
1680             foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
1681             break;
1682         case 7:         /* Qualified Name */
1683             qualified_name_type = tvb_get_ntohl(tvb, foffset);
1684             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
1685             4, qualified_name_type);
1686             foffset += 4;
1687             if (qualified_name_type != 0) {
1688                 if (qualified_name_type == 1) {
1689                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
1690                 }
1691                 else
1692                 {
1693                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
1694                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
1695                 }
1696             }
1697             break;
1698         case 8:         /* Event Object ID */
1699             foffset = ndps_string(tvb, hf_object_name, atree, foffset);
1700             foffset = objectidentifier(tvb, atree, foffset);
1701             proto_tree_add_item(atree, hf_ndps_event_type, tvb, foffset, 
1702             4, FALSE);
1703             foffset += 4;
1704         default:
1705             break;
1706     }
1707     return foffset;
1708 }
1709
1710 static int
1711 address_item(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
1712 {
1713     guint32     address_type=0;
1714     guint32     qualified_name_type;
1715     guint32     transport_type=0;
1716     guint32     octet_len=0;
1717
1718     address_type = tvb_get_ntohl(tvb, foffset); 
1719     proto_tree_add_uint(ndps_tree, hf_address_type, tvb, foffset, 4, address_type);
1720     foffset += 4;
1721     switch(address_type)
1722     {
1723     case 0:
1724     case 1:
1725     case 2:
1726     case 3:
1727     case 4:
1728     case 5:
1729     case 6:
1730     case 7:
1731         qualified_name_type = tvb_get_ntohl(tvb, foffset);
1732         proto_tree_add_uint(ndps_tree, hf_ndps_qualified_name, tvb, foffset, 
1733         4, qualified_name_type);
1734         foffset += 4;
1735         if (qualified_name_type != 0) {
1736             if (qualified_name_type == 1) {
1737                 foffset = ndps_string(tvb, hf_printer_name, ndps_tree, foffset);
1738             }
1739             else
1740             {
1741                 foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
1742                 foffset = ndps_string(tvb, hf_ndps_tree, ndps_tree, foffset);
1743             }
1744         }
1745         break;
1746     case 8:
1747     case 9:
1748     case 10:
1749     case 11:
1750     case 12:
1751         foffset = ndps_string(tvb, hf_object_name, ndps_tree, foffset);
1752         break;
1753     case 13:
1754         proto_tree_add_item(ndps_tree, hf_ndps_attrib_boolean, tvb, foffset, 4, FALSE);
1755         foffset += 4;
1756         break;
1757     case 14:
1758         proto_tree_add_item(ndps_tree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
1759         foffset += 4;
1760         break;
1761     case 15:
1762         transport_type=tvb_get_ntohl(tvb, foffset);
1763         proto_tree_add_item(ndps_tree, hf_ndps_address, tvb, foffset, 4, FALSE);
1764         foffset += 4;
1765         octet_len = tvb_get_ntohl(tvb, foffset);
1766         proto_tree_add_item(ndps_tree, hf_ndps_add_bytes, tvb, foffset, 4, FALSE);
1767         foffset += octet_len + 4;
1768         break;
1769     case 16:
1770     case 17:
1771     default:
1772         foffset = ndps_string(tvb, hf_object_name, ndps_tree, foffset);
1773         break;
1774     }
1775     return foffset;
1776 }
1777
1778 static int
1779 print_address(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
1780 {
1781     guint32     address_type=0;
1782     guint32     address=0;
1783     guint32     address_len=0;
1784
1785     address_type = tvb_get_ntohl(tvb, foffset); 
1786     proto_tree_add_uint(ndps_tree, hf_ndps_address, tvb, foffset, 4, address_type);
1787     foffset += 4;
1788     address_len = tvb_get_ntohl(tvb, foffset);
1789     proto_tree_add_item(ndps_tree, hf_address_len, tvb, foffset, 4, FALSE);
1790     foffset += 4;
1791     switch(address_type)
1792     {
1793     case 0x00000000:
1794             proto_tree_add_item(ndps_tree, hf_ndps_net, tvb, foffset, 4, FALSE);
1795             proto_tree_add_item(ndps_tree, hf_ndps_node, tvb, foffset+4, 6, FALSE);
1796             proto_tree_add_item(ndps_tree, hf_ndps_socket, tvb, foffset+10, 2, FALSE);
1797             foffset += address_len;
1798             break;
1799     case 0x00000001:
1800             proto_tree_add_item(ndps_tree, hf_ndps_port, tvb, foffset, 2, FALSE);
1801             address = tvb_get_letohl(tvb, foffset+2);
1802             proto_tree_add_ipv4(ndps_tree, hf_ndps_ip, tvb, foffset+2, 4, address);
1803             foffset += address_len;
1804             break;
1805     default:
1806         foffset += tvb_get_ntohl(tvb, foffset -4);
1807         break;
1808     }
1809     return foffset+(address_len%4);
1810 }
1811
1812
1813 static int
1814 attribute_value(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
1815 {
1816     guint8      h;
1817     guint8      i;
1818     guint8      j;
1819     guint8      number_of_values=0;
1820     guint8      number_of_items=0;
1821     guint8      number_of_items2=0;
1822     guint32     attribute_type=0;
1823     guint32     qualified_name_type=0;
1824     guint32     integer_or_oid=0;
1825     guint32     event_object_type=0;
1826     guint32     ignored_type=0;
1827     guint32     resource_type=0;
1828     guint32     identifier_type=0;
1829     guint32     criterion_type=0;
1830     guint32     card_enum_time=0;
1831     guint32     media_type=0;
1832     guint32     doc_content=0;
1833     guint32     page_size=0;
1834     guint32     medium_size=0;
1835     guint32     numbers_up=0;
1836     guint32     colorant_set=0;
1837     guint32     length=0;
1838     proto_tree  *atree;
1839     proto_item  *aitem;
1840     proto_tree  *btree;
1841     proto_item  *bitem;
1842     proto_tree  *ctree;
1843     proto_item  *citem;
1844
1845     attribute_type = tvb_get_ntohl(tvb, foffset); 
1846     aitem = proto_tree_add_item(ndps_tree, hf_obj_attribute_type, tvb, foffset, 4, FALSE);
1847     atree = proto_item_add_subtree(aitem, ett_ndps);
1848     foffset += 4;
1849     switch(attribute_type)
1850     {
1851         case 0:         /* Null */
1852             proto_tree_add_item(atree, hf_ndps_data, tvb, foffset+4, tvb_get_ntohl(tvb, foffset), FALSE);
1853             break;
1854         case 1:         /* Text */
1855         case 2:         /* Descriptive Name */
1856         case 3:         /* Descriptor */
1857         case 6:         /* Simple Name */
1858         case 40:         /* Distinguished Name*/
1859         case 50:         /* Font Reference */
1860         case 58:         /* Locale */
1861         case 102:         /* File Path */
1862         case 103:         /* Uniform Resource Identifier */
1863         case 108:         /* Extended Resource Identifier */
1864             foffset = ndps_string(tvb, hf_object_name, atree, foffset);
1865             break;
1866         case 4:         /* Message */
1867         case 5:         /* Error Message */
1868         case 38:         /* Name or OID */
1869             foffset = name_or_id(tvb, atree, foffset);
1870             break;
1871         case 39:         /* Name or OID Seq */
1872             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
1873             number_of_items = tvb_get_ntohl(tvb, foffset);
1874             foffset += 4;
1875             for (i = 1 ; i <= number_of_items; i++ )
1876             {
1877                 foffset = name_or_id(tvb, atree, foffset);
1878             }
1879             break;
1880         case 7:         /* Distinguished Name String*/
1881         case 79:         /* File Reference */
1882             foffset = ndps_string(tvb, hf_object_name, atree, foffset);
1883             foffset = name_or_id(tvb, atree, foffset);
1884             break;
1885         case 8:         /* Distinguished Name String Seq */
1886             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
1887             number_of_items = tvb_get_ntohl(tvb, foffset);
1888             foffset += 4;
1889             for (i = 1 ; i <= number_of_items; i++ )
1890             {
1891                 foffset = ndps_string(tvb, hf_object_name, atree, foffset);
1892                 foffset = name_or_id(tvb, atree, foffset);
1893             }
1894             break;
1895         case 9:          /* Delta Time */
1896         case 10:         /* Time */
1897         case 11:         /* Integer */
1898         case 13:         /* Cardinal */
1899         case 15:         /* Positive Integer */
1900         case 18:         /* Maximum Integer */
1901         case 19:         /* Minimum Integer */
1902         case 35:         /* Percent */
1903         case 57:         /* Job Priority */
1904         case 72:         /* Sides */
1905         case 95:         /* Enumeration */
1906             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
1907             foffset += 4;
1908             break;
1909         case 12:         /* Integer Seq */
1910         case 14:         /* Cardinal Seq */
1911             length = tvb_get_ntohl(tvb, foffset);
1912             foffset += 4;
1913             proto_tree_add_item(ndps_tree, hf_info_int32, tvb, foffset, length, FALSE);
1914             foffset += length;
1915             break;
1916         case 16:         /* Integer Range */
1917         case 17:         /* Cardinal Range */
1918             proto_tree_add_item(atree, hf_ndps_lower_range, tvb, foffset, 4, FALSE);
1919             foffset += 4;
1920             proto_tree_add_item(atree, hf_ndps_upper_range, tvb, foffset, 4, FALSE);
1921             foffset += 4;
1922             break;
1923         case 20:         /* Integer 64 */
1924         case 22:         /* Cardinal 64 */
1925         case 24:         /* Positive Integer 64 */
1926         case 31:         /* Non-Negative Real */
1927         case 29:         /* Real */
1928             proto_tree_add_item(atree, hf_ndps_n64, tvb, foffset, 8, FALSE);
1929             foffset += 8;
1930             break;
1931         case 21:         /* Integer 64 Seq */
1932         case 23:         /* Cardinal 64 Seq */
1933         case 30:         /* Real Seq */
1934             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
1935             number_of_items = tvb_get_ntohl(tvb, foffset);
1936             foffset += 4;
1937             for (i = 1 ; i <= number_of_items; i++ )
1938             {
1939                 proto_tree_add_item(atree, hf_ndps_n64, tvb, foffset, 8, FALSE);
1940                 foffset += 8;
1941             }
1942             break;
1943         case 25:         /* Integer 64 Range */
1944         case 26:         /* Cardinal 64 Range */
1945         case 32:         /* Real Range */
1946         case 33:         /* Non-Negative Real Range */
1947             proto_tree_add_item(atree, hf_ndps_lower_range_n64, tvb, foffset, 8, FALSE);
1948             foffset += 8;
1949             proto_tree_add_item(atree, hf_ndps_upper_range_n64, tvb, foffset, 8, FALSE);
1950             foffset += 8;
1951             break;
1952         case 27:         /* Maximum Integer 64 */
1953             proto_tree_add_item(atree, hf_ndps_lower_range_n64, tvb, foffset, 8, FALSE);
1954             foffset += 8;
1955             break;
1956         case 28:         /* Minimum Integer 64 */
1957             proto_tree_add_item(atree, hf_ndps_upper_range_n64, tvb, foffset, 8, FALSE);
1958             foffset += 8;
1959             break;
1960         case 34:         /* Boolean */
1961             proto_tree_add_item(atree, hf_ndps_attrib_boolean, tvb, foffset, 4, FALSE);
1962             foffset += 4;
1963             break;
1964         case 36:         /* Object Identifier */
1965                 foffset = objectidentifier(tvb, atree, foffset);
1966             break;
1967         case 37:         /* Object Identifier Seq */
1968             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
1969             number_of_items = tvb_get_ntohl(tvb, foffset);
1970             foffset += 4;
1971             for (i = 1 ; i <= number_of_items; i++ )
1972             {
1973                 foffset = objectidentifier(tvb, atree, foffset);
1974             }
1975             break;
1976         case 41:         /* Relative Distinguished Name Seq */
1977             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
1978             number_of_items = tvb_get_ntohl(tvb, foffset);
1979             foffset += 4;
1980             for (i = 1 ; i <= number_of_items; i++ )
1981             {
1982                 foffset = ndps_string(tvb, hf_object_name, atree, foffset);
1983             }
1984             break;
1985         case 42:         /* Realization */
1986             proto_tree_add_item(atree, hf_ndps_realization, tvb, foffset, 4, FALSE);
1987             foffset += 4;
1988             break;
1989         case 43:         /* Medium Dimensions */
1990             proto_tree_add_item(atree, hf_ndps_xdimension_n64, tvb, foffset, 8, FALSE);
1991             foffset += 8;
1992             proto_tree_add_item(atree, hf_ndps_ydimension_n64, tvb, foffset, 8, FALSE);
1993             foffset += 8;
1994             break;
1995         case 44:         /* Dimension */
1996             proto_tree_add_item(atree, hf_ndps_dim_value, tvb, foffset, 8, FALSE);
1997             foffset += 4;
1998             if (tvb_get_ntohl(tvb, foffset-4) == 0) {
1999                 proto_tree_add_item(atree, hf_ndps_n64, tvb, foffset, 8, FALSE);
2000                 foffset += 8;
2001             }
2002             else
2003             {
2004                 foffset = name_or_id(tvb, atree, foffset);
2005             }
2006             proto_tree_add_item(atree, hf_ndps_dim_flag, tvb, foffset, 8, FALSE);
2007             foffset += 4;
2008             proto_tree_add_item(atree, hf_ndps_n64, tvb, foffset, 8, FALSE);
2009             foffset += 8;
2010             break;
2011         case 45:         /* XY Dimensions */
2012             proto_tree_add_item(atree, hf_ndps_xydim_value, tvb, foffset, 8, FALSE);
2013             foffset += 4;
2014             if (tvb_get_ntohl(tvb, foffset-4) == 1) {
2015                 foffset = name_or_id(tvb, atree, foffset);
2016             }
2017             else
2018             {
2019                 proto_tree_add_item(atree, hf_ndps_xdimension_n64, tvb, foffset, 8, FALSE);
2020                 foffset += 8;
2021                 proto_tree_add_item(atree, hf_ndps_ydimension_n64, tvb, foffset, 8, FALSE);
2022                 foffset += 8;
2023             }
2024             proto_tree_add_item(atree, hf_ndps_dim_flag, tvb, foffset, 8, FALSE);
2025             foffset += 4;
2026             proto_tree_add_item(atree, hf_ndps_n64, tvb, foffset, 8, FALSE);
2027             foffset += 8;
2028             break;
2029         case 46:         /* Locations */
2030             proto_tree_add_item(atree, hf_ndps_location_value, tvb, foffset, 8, FALSE);
2031             foffset += 4;
2032             if (tvb_get_ntohl(tvb, foffset-4) == 0) {
2033                 proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
2034                 number_of_items = tvb_get_ntohl(tvb, foffset);
2035                 foffset += 4;
2036                 for (i = 1 ; i <= number_of_items; i++ )
2037                 {
2038                     proto_tree_add_item(atree, hf_ndps_n64, tvb, foffset, 8, FALSE);
2039                     foffset += 8;
2040                 }
2041             }
2042             else
2043             {
2044                 foffset = name_or_id(tvb, atree, foffset);
2045             }
2046             proto_tree_add_item(atree, hf_ndps_dim_flag, tvb, foffset, 8, FALSE);
2047             foffset += 4;
2048             proto_tree_add_item(atree, hf_ndps_n64, tvb, foffset, 8, FALSE);
2049             foffset += 8;
2050             break;
2051         case 47:         /* Area */
2052             proto_tree_add_item(atree, hf_ndps_xmin_n64, tvb, foffset, 8, FALSE);
2053             foffset += 8;
2054             proto_tree_add_item(atree, hf_ndps_xmax_n64, tvb, foffset, 8, FALSE);
2055             foffset += 8;
2056             proto_tree_add_item(atree, hf_ndps_ymin_n64, tvb, foffset, 8, FALSE);
2057             foffset += 8;
2058             proto_tree_add_item(atree, hf_ndps_ymax_n64, tvb, foffset, 8, FALSE);
2059             foffset += 8;
2060             break;
2061         case 48:         /* Area Seq */
2062             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
2063             number_of_items = tvb_get_ntohl(tvb, foffset);
2064             foffset += 4;
2065             for (i = 1 ; i <= number_of_items; i++ )
2066             {
2067                 proto_tree_add_item(atree, hf_ndps_xmin_n64, tvb, foffset, 8, FALSE);
2068                 foffset += 8;
2069                 proto_tree_add_item(atree, hf_ndps_xmax_n64, tvb, foffset, 8, FALSE);
2070                 foffset += 8;
2071                 proto_tree_add_item(atree, hf_ndps_ymin_n64, tvb, foffset, 8, FALSE);
2072                 foffset += 8;
2073                 proto_tree_add_item(atree, hf_ndps_ymax_n64, tvb, foffset, 8, FALSE);
2074                 foffset += 8;
2075             }
2076             break;
2077         case 49:         /* Edge */
2078             proto_tree_add_item(atree, hf_ndps_edge_value, tvb, foffset, 4, FALSE);
2079             foffset += 4;
2080             break;
2081         case 51:         /* Cardinal or OID */
2082             proto_tree_add_item(atree, hf_ndps_cardinal_or_oid, tvb, foffset, 4, FALSE);
2083             foffset += 4;
2084             if (tvb_get_ntohl(tvb, foffset-4)==0) {
2085                 proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2086                 foffset += 4;
2087             }
2088             else
2089             {
2090                 foffset = objectidentifier(tvb, atree, foffset);
2091             }
2092             break;
2093         case 52:         /* OID Cardinal Map */
2094             foffset = objectidentifier(tvb, atree, foffset);
2095             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2096             foffset += 4;
2097             break;
2098         case 53:         /* Cardinal or Name or OID */
2099             proto_tree_add_item(atree, hf_ndps_cardinal_name_or_oid, tvb, foffset, 4, FALSE);
2100             foffset += 4;
2101             if (tvb_get_ntohl(tvb, foffset-4)==0) {
2102                 proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2103                 foffset += 4;
2104             }
2105             else
2106             {
2107                 foffset = name_or_id(tvb, atree, foffset);
2108             }
2109             break;
2110         case 54:         /* Positive Integer or OID */
2111             integer_or_oid = tvb_get_ntohl(tvb, foffset);
2112             proto_tree_add_uint(atree, hf_ndps_integer_or_oid, tvb, foffset, 4, integer_or_oid);
2113             foffset += 4;
2114             if (integer_or_oid==0) {
2115                 foffset = objectidentifier(tvb, atree, foffset);
2116             }
2117             else
2118             {
2119                 proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2120                 foffset += 4;
2121             }
2122             break;
2123         case 55:         /* Event Handling Profile */
2124             proto_tree_add_item(atree, hf_ndps_profile_id, tvb, foffset, 4, FALSE);
2125             foffset += 4;
2126             proto_tree_add_item(atree, hf_ndps_persistence, tvb, foffset, 4, FALSE);
2127             foffset += 4;
2128             qualified_name_type = tvb_get_ntohl(tvb, foffset);
2129             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
2130             4, qualified_name_type);
2131             foffset += 4;
2132             if (qualified_name_type != 0) {
2133                 if (qualified_name_type == 1) {
2134                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
2135                 }
2136                 else
2137                 {
2138                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
2139                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2140                 }
2141             }
2142             length = tvb_get_ntohl(tvb, foffset);
2143             foffset += 4;
2144             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, length, FALSE);
2145             foffset += length;
2146             proto_tree_add_item(atree, hf_ndps_language_id, tvb, foffset, 4, FALSE);
2147             foffset += 4;
2148             foffset = name_or_id(tvb, atree, foffset);
2149             number_of_items = tvb_get_ntohl(tvb, foffset);
2150             for (i = 1 ; i <= number_of_items; i++ )
2151             {
2152                 foffset += address_item(tvb, atree, foffset);
2153             }
2154             number_of_items = tvb_get_ntohl(tvb, foffset);
2155             for (i = 1 ; i <= number_of_items; i++ )
2156             {
2157                 proto_tree_add_item(atree, hf_ndps_event_type, tvb, foffset, 4, FALSE);
2158                 foffset += 4;
2159                 foffset = objectidentifier(tvb, atree, foffset);
2160                 foffset = objectidentification(tvb, atree, foffset);
2161                 proto_tree_add_item(atree, hf_ndps_object_op, tvb, foffset, 4, FALSE);
2162                 foffset += 4;
2163                 
2164                 event_object_type = tvb_get_ntohl(tvb, foffset);
2165                 proto_tree_add_uint(atree, hf_ndps_event_object_identifier, tvb, foffset, 4, event_object_type);
2166                 foffset += 4;
2167                 if(event_object_type==1)
2168                 {
2169                     foffset = objectidentifier(tvb, atree, foffset);
2170                 }
2171                 else
2172                 {
2173                     if(event_object_type==0)
2174                     {
2175                         number_of_items2 = tvb_get_ntohl(tvb, foffset);
2176                         proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, number_of_items2);
2177                         foffset += 4;
2178                         for (j = 1 ; j <= number_of_items2; j++ )
2179                         {
2180                             foffset = objectidentifier(tvb, atree, foffset);
2181                         }
2182                     }
2183                 }
2184             }
2185             break;
2186         case 56:         /* Octet String */
2187         case 63:         /* Job Password */
2188         case 66:         /* Print Checkpoint */
2189             length = tvb_get_ntohl(tvb, foffset);
2190             foffset += 4;
2191             proto_tree_add_item(atree, hf_ndps_octet_string, tvb, foffset, length, FALSE);
2192             foffset += length;
2193             foffset += (length%2);
2194             break;
2195         case 59:         /* Method Delivery Address */
2196             proto_tree_add_item(atree, hf_ndps_delivery_add_type, tvb, foffset, 4, FALSE);
2197             event_object_type = tvb_get_ntohl(tvb, foffset);
2198             foffset += 4;
2199             switch(event_object_type)
2200             {
2201                 case 0:     /*MHS ADDR*/
2202                 case 1:     /*DISTINGUISHED_NAME*/
2203                 case 2:     /*TEXT*/
2204                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2205                     break;
2206                 case 3:     /*OCTET_STRING*/
2207                     length = tvb_get_ntohl(tvb, foffset);
2208                     foffset += 4;
2209                     proto_tree_add_item(atree, hf_ndps_octet_string, tvb, foffset, length, FALSE);
2210                     foffset += length;
2211                     foffset += (length%2);
2212                     break;
2213                 case 4:     /*DIST_NAME_STRING*/
2214                     foffset = ndps_string(tvb, hf_object_name, atree, foffset);
2215                     foffset = name_or_id(tvb, atree, foffset);
2216                     break;
2217                 case 5:     /*RPC_ADDRESS*/
2218                 case 6:     /*QUALIFIED_NAME*/
2219                     foffset = objectidentifier(tvb, atree, foffset);
2220                     qualified_name_type = tvb_get_ntohl(tvb, foffset);
2221                     proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
2222                     4, qualified_name_type);
2223                     foffset += 4;
2224                     if (qualified_name_type != 0) {
2225                         if (qualified_name_type == 1) {
2226                             foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
2227                         }
2228                         else
2229                         {
2230                             foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
2231                             foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2232                         }
2233                     }
2234                     break;
2235                 default:
2236                     break;
2237             }
2238             break;
2239         case 60:         /* Object Identification */
2240             foffset = objectidentification(tvb, atree, foffset);
2241             break;
2242         case 61:         /* Results Profile */
2243             foffset = objectidentifier(tvb, atree, foffset);
2244             foffset = name_or_id(tvb, atree, foffset);
2245             foffset = address_item(tvb, atree, foffset);
2246             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2247             foffset += 4;
2248             foffset = name_or_id(tvb, atree, foffset);
2249             break;
2250         case 62:         /* Criteria */
2251             foffset = objectidentifier(tvb, atree, foffset);
2252             criterion_type = tvb_get_ntohl(tvb, foffset);
2253             proto_tree_add_uint(atree, hf_ndps_criterion_type, tvb, foffset, 4, criterion_type);
2254             foffset += 4;
2255             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2256             foffset += 4;
2257             break;
2258         case 64:         /* Job Level */
2259             foffset = objectidentifier(tvb, atree, foffset);
2260             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2261             foffset += 4;
2262             break;
2263         case 65:         /* Job Categories */
2264             foffset = objectidentifier(tvb, atree, foffset);
2265             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
2266             number_of_items = tvb_get_ntohl(tvb, foffset);
2267             foffset += 4;
2268             for (i = 1 ; i <= number_of_items; i++ )
2269             {
2270                 length = tvb_get_ntohl(tvb, foffset);
2271                 foffset += 4;
2272                 proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, length, FALSE);
2273                 foffset += length;
2274                 foffset += (length%2);
2275             }
2276             break;
2277         case 67:         /* Ignored Attribute */
2278             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2279             foffset += 4;
2280             foffset = objectidentifier(tvb, atree, foffset);
2281             proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
2282             number_of_items = tvb_get_ntohl(tvb, foffset);
2283             foffset += 4;
2284             for (i = 1 ; i <= number_of_items; i++ )
2285             {
2286                 ignored_type = tvb_get_ntohl(tvb, foffset);
2287                 proto_tree_add_uint(atree, hf_ndps_ignored_type, tvb, foffset, 4, ignored_type);
2288                 foffset += 4;
2289                 if (ignored_type == 38)
2290                 {
2291                     foffset = name_or_id(tvb, atree, foffset);
2292                 }
2293                 else
2294                 {
2295                     foffset = objectidentifier(tvb, atree, foffset);
2296                 }
2297             }
2298             break;
2299         case 68:         /* Resource */
2300             resource_type = tvb_get_ntohl(tvb, foffset);
2301             proto_tree_add_uint(atree, hf_ndps_resource_type, tvb, foffset, 4, resource_type);
2302             foffset += 4;
2303             if (resource_type == 0)
2304             {
2305                 foffset = name_or_id(tvb, atree, foffset);
2306             }
2307             else
2308             {
2309                 foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2310             }
2311             break;
2312         case 69:         /* Medium Substitution */
2313             foffset = name_or_id(tvb, atree, foffset);
2314             foffset = name_or_id(tvb, atree, foffset);
2315             break;
2316         case 70:         /* Font Substitution */
2317             foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2318             foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2319             break;
2320         case 71:         /* Resource Context Seq */
2321             proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
2322             number_of_items = tvb_get_ntohl(tvb, foffset);
2323             foffset += 4;
2324             for (i = 1 ; i <= number_of_items; i++ )
2325             {
2326                 resource_type = tvb_get_ntohl(tvb, foffset);
2327                 proto_tree_add_uint(atree, hf_ndps_resource_type, tvb, foffset, 4, resource_type);
2328                 foffset += 4;
2329                 if (resource_type == 0)
2330                 {
2331                     foffset = name_or_id(tvb, atree, foffset);
2332                 }
2333                 else
2334                 {
2335                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2336                 }
2337             }
2338             break;
2339         case 73:         /* Page Select Seq */
2340             proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
2341             number_of_items = tvb_get_ntohl(tvb, foffset);
2342             foffset += 4;
2343             for (i = 1 ; i <= number_of_items; i++ )
2344             {
2345                 proto_tree_add_item(atree, hf_ndps_page_flag, tvb, foffset, 4, FALSE);
2346                 foffset += 4;
2347                 identifier_type = tvb_get_ntohl(tvb, foffset);
2348                 proto_tree_add_uint(atree, hf_ndps_identifier_type, tvb, foffset, 4, identifier_type);
2349                 foffset += 4;
2350                 if (identifier_type == 0)
2351                 {
2352                     proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2353                     foffset += 4;
2354                 }
2355                 if (identifier_type == 1)
2356                 {
2357                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2358                 }
2359                 if (identifier_type == 2)
2360                 {
2361                     foffset = name_or_id(tvb, atree, foffset);
2362                 }
2363                 proto_tree_add_item(atree, hf_ndps_page_flag, tvb, foffset, 4, FALSE);
2364                 foffset += 4;
2365                 identifier_type = tvb_get_ntohl(tvb, foffset);
2366                 proto_tree_add_uint(atree, hf_ndps_identifier_type, tvb, foffset, 4, identifier_type);
2367                 foffset += 4;
2368                 if (identifier_type == 0)
2369                 {
2370                     proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2371                     foffset += 4;
2372                 }
2373                 if (identifier_type == 1)
2374                 {
2375                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2376                 }
2377                 if (identifier_type == 2)
2378                 {
2379                     foffset = name_or_id(tvb, atree, foffset);
2380                 }
2381             }
2382             break;
2383         case 74:         /* Page Media Select */
2384             media_type = tvb_get_ntohl(tvb, foffset);
2385             proto_tree_add_uint(atree, hf_ndps_media_type, tvb, foffset, 4, media_type);
2386             foffset += 4;
2387             if (media_type == 0)
2388             {
2389                 foffset = name_or_id(tvb, atree, foffset);
2390             }
2391             else
2392             {
2393                 foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2394                 number_of_items = tvb_get_ntohl(tvb, foffset);
2395                 foffset += 4;
2396                 for (i = 1 ; i <= number_of_items; i++ )
2397                 {
2398                     proto_tree_add_item(atree, hf_ndps_page_flag, tvb, foffset, 4, FALSE);
2399                     foffset += 4;
2400                     identifier_type = tvb_get_ntohl(tvb, foffset);
2401                     proto_tree_add_uint(atree, hf_ndps_identifier_type, tvb, foffset, 4, identifier_type);
2402                     foffset += 4;
2403                     if (identifier_type == 0)
2404                     {
2405                         proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2406                         foffset += 4;
2407                     }
2408                     if (identifier_type == 1)
2409                     {
2410                         foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2411                     }
2412                     if (identifier_type == 2)
2413                     {
2414                         foffset = name_or_id(tvb, atree, foffset);
2415                     }
2416                 }
2417             }
2418             break;
2419         case 75:         /* Document Content */
2420             doc_content = tvb_get_ntohl(tvb, foffset);
2421             proto_tree_add_uint(atree, hf_ndps_doc_content, tvb, foffset, 4, doc_content);
2422             foffset += 4;
2423             if (doc_content == 0)
2424             {
2425                 length = tvb_get_ntohl(tvb, foffset);
2426                 foffset += 4;
2427                 proto_tree_add_item(atree, hf_ndps_octet_string, tvb, foffset, length, FALSE);
2428                 foffset += length;
2429                 foffset += (length%2);
2430             }
2431             else
2432             {
2433                 foffset = ndps_string(tvb, hf_object_name, atree, foffset);
2434                 foffset = name_or_id(tvb, atree, foffset);
2435             }
2436             break;
2437         case 76:         /* Page Size */
2438             page_size = tvb_get_ntohl(tvb, foffset);
2439             proto_tree_add_uint(atree, hf_ndps_page_size, tvb, foffset, 4, page_size);
2440             foffset += 4;
2441             if (page_size == 0)
2442             {
2443                 foffset = objectidentifier(tvb, atree, foffset);
2444             }
2445             else
2446             {
2447                 proto_tree_add_item(atree, hf_ndps_xdimension_n64, tvb, foffset, 8, FALSE);
2448                 foffset += 8;
2449                 proto_tree_add_item(atree, hf_ndps_ydimension_n64, tvb, foffset, 8, FALSE);
2450                 foffset += 8;
2451             }
2452             break;
2453         case 77:         /* Presentation Direction */
2454             proto_tree_add_uint(atree, hf_ndps_direction, tvb, foffset, 4, FALSE);
2455             foffset += 4;
2456             break;
2457         case 78:         /* Page Order */
2458             proto_tree_add_uint(atree, hf_ndps_page_order, tvb, foffset, 4, FALSE);
2459             foffset += 4;
2460             break;
2461         case 80:         /* Medium Source Size */
2462             foffset = name_or_id(tvb, atree, foffset);
2463             medium_size = tvb_get_ntohl(tvb, foffset);
2464             proto_tree_add_uint(atree, hf_ndps_medium_size, tvb, foffset, 4, medium_size);
2465             foffset += 4;
2466             if (medium_size == 0)
2467             {
2468                 page_size = tvb_get_ntohl(tvb, foffset);
2469                 proto_tree_add_uint(atree, hf_ndps_page_size, tvb, foffset, 4, page_size);
2470                 foffset += 4;
2471                 if (page_size == 0)
2472                 {
2473                     foffset = objectidentifier(tvb, atree, foffset);
2474                 }
2475                 else
2476                 {
2477                     proto_tree_add_item(atree, hf_ndps_xdimension_n64, tvb, foffset, 8, FALSE);
2478                     foffset += 8;
2479                     proto_tree_add_item(atree, hf_ndps_ydimension_n64, tvb, foffset, 8, FALSE);
2480                     foffset += 8;
2481                 }
2482                 proto_tree_add_item(atree, hf_ndps_long_edge_feeds, tvb, foffset, 4, FALSE);
2483                 foffset += 4;
2484                 proto_tree_add_item(atree, hf_ndps_xmin_n64, tvb, foffset, 8, FALSE);
2485                 foffset += 8;
2486                 proto_tree_add_item(atree, hf_ndps_xmax_n64, tvb, foffset, 8, FALSE);
2487                 foffset += 8;
2488                 proto_tree_add_item(atree, hf_ndps_ymin_n64, tvb, foffset, 8, FALSE);
2489                 foffset += 8;
2490                 proto_tree_add_item(atree, hf_ndps_ymax_n64, tvb, foffset, 8, FALSE);
2491                 foffset += 8;
2492             }
2493             else
2494             {
2495                 proto_tree_add_item(atree, hf_ndps_lower_range_n64, tvb, foffset, 8, FALSE);
2496                 foffset += 8;
2497                 proto_tree_add_item(atree, hf_ndps_upper_range_n64, tvb, foffset, 8, FALSE);
2498                 foffset += 8;
2499                 proto_tree_add_item(atree, hf_ndps_inc_across_feed, tvb, foffset, 8, FALSE);
2500                 foffset += 8;
2501                 proto_tree_add_item(atree, hf_ndps_lower_range_n64, tvb, foffset, 8, FALSE);
2502                 foffset += 8;
2503                 proto_tree_add_item(atree, hf_ndps_upper_range_n64, tvb, foffset, 8, FALSE);
2504                 foffset += 8;
2505                 proto_tree_add_item(atree, hf_ndps_size_inc_in_feed, tvb, foffset, 8, FALSE);
2506                 foffset += 8;
2507                 proto_tree_add_item(atree, hf_ndps_long_edge_feeds, tvb, foffset, 4, FALSE);
2508                 foffset += 4;
2509                 proto_tree_add_item(atree, hf_ndps_xmin_n64, tvb, foffset, 8, FALSE);
2510                 foffset += 8;
2511                 proto_tree_add_item(atree, hf_ndps_xmax_n64, tvb, foffset, 8, FALSE);
2512                 foffset += 8;
2513                 proto_tree_add_item(atree, hf_ndps_ymin_n64, tvb, foffset, 8, FALSE);
2514                 foffset += 8;
2515                 proto_tree_add_item(atree, hf_ndps_ymax_n64, tvb, foffset, 8, FALSE);
2516                 foffset += 8;
2517             }
2518             break;
2519         case 81:         /* Input Tray Medium */
2520             foffset = name_or_id(tvb, atree, foffset);
2521             foffset = name_or_id(tvb, atree, foffset);
2522             break;
2523         case 82:         /* Output Bins Characteristics */
2524             proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
2525             number_of_items = tvb_get_ntohl(tvb, foffset);
2526             foffset += 4;
2527             for (i = 1 ; i <= number_of_items; i++ )
2528             {
2529                 proto_tree_add_uint(atree, hf_ndps_page_order, tvb, foffset, 4, FALSE);
2530                 foffset += 4;
2531                 proto_tree_add_uint(atree, hf_ndps_page_orientation, tvb, foffset, 4, FALSE);
2532                 foffset += 4;
2533             }
2534             break;
2535         case 83:         /* Page ID Type */
2536             proto_tree_add_uint(atree, hf_ndps_identifier_type, tvb, foffset, 4, FALSE);
2537             foffset += 4;
2538             break;
2539         case 84:         /* Level Range */
2540             foffset = objectidentifier(tvb, atree, foffset);
2541             proto_tree_add_item(atree, hf_ndps_lower_range, tvb, foffset, 4, FALSE);
2542             foffset += 4;
2543             proto_tree_add_item(atree, hf_ndps_upper_range, tvb, foffset, 4, FALSE);
2544             foffset += 4;
2545             break;
2546         case 85:         /* Category Set */
2547             foffset = objectidentifier(tvb, atree, foffset);
2548             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
2549             number_of_items = tvb_get_ntohl(tvb, foffset);
2550             foffset += 4;
2551             for (i = 1 ; i <= number_of_items; i++ )
2552             {
2553                 length = tvb_get_ntohl(tvb, foffset);
2554                 foffset += 4;
2555                 proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, length, FALSE);
2556                 foffset += length;
2557                 foffset += (length%2);
2558             }
2559             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
2560             number_of_items = tvb_get_ntohl(tvb, foffset);
2561             foffset += 4;
2562             for (i = 1 ; i <= number_of_items; i++ )
2563             {
2564                 length = tvb_get_ntohl(tvb, foffset);
2565                 foffset += 4;
2566                 proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, length, FALSE);
2567                 foffset += length;
2568                 foffset += (length%2);
2569             }
2570             break;
2571         case 86:         /* Numbers Up Supported */
2572             proto_tree_add_uint(atree, hf_ndps_numbers_up, tvb, foffset, 4, FALSE);
2573             numbers_up=tvb_get_ntohl(tvb, foffset);
2574             foffset += 4;
2575             switch(numbers_up)
2576             {
2577             case 0:     /*Cardinal*/
2578                 proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2579                 foffset += 4;
2580                 break;
2581             case 1:     /*Name or OID*/
2582                 foffset = name_or_id(tvb, atree, foffset);
2583                 break;
2584             case 2:     /*Cardinal Range*/
2585                 proto_tree_add_item(atree, hf_ndps_lower_range, tvb, foffset, 4, FALSE);
2586                 foffset += 4;
2587                 proto_tree_add_item(atree, hf_ndps_upper_range, tvb, foffset, 4, FALSE);
2588                 foffset += 4;
2589                 break;
2590             default:
2591                 break;
2592             }
2593             break;
2594         case 87:         /* Finishing */
2595         case 88:         /* Print Contained Object ID */
2596             foffset = ndps_string(tvb, hf_object_name, atree, foffset);
2597             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2598             foffset += 4;
2599             break;
2600         case 89:         /* Print Config Object ID */
2601             foffset = ndps_string(tvb, hf_object_name, atree, foffset);
2602             qualified_name_type = tvb_get_ntohl(tvb, foffset);
2603             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
2604             4, qualified_name_type);
2605             foffset += 4;
2606             if (qualified_name_type != 0) {
2607                 if (qualified_name_type == 1) {
2608                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
2609                 }
2610                 else
2611                 {
2612                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
2613                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2614                 }
2615             }
2616             break;
2617         case 90:         /* Typed Name */
2618             foffset = ndps_string(tvb, hf_object_name, atree, foffset);
2619             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2620             foffset += 4;
2621             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2622             foffset += 4;
2623             break;
2624         case 91:         /* Network Address */
2625             proto_tree_add_item(atree, hf_ndps_address, tvb, foffset, 4, FALSE);
2626             foffset += 4;
2627             length = tvb_get_ntohl(tvb, foffset);
2628             foffset += 4;
2629             proto_tree_add_item(atree, hf_ndps_add_bytes, tvb, foffset, 4, FALSE);
2630             foffset += length;
2631             break;
2632         case 92:         /* XY Dimensions Value */
2633             proto_tree_add_item(atree, hf_ndps_xydim_value, tvb, foffset, 8, FALSE);
2634             foffset += 4;
2635             if (tvb_get_ntohl(tvb, foffset-4) == 1) {
2636                 foffset = name_or_id(tvb, atree, foffset);
2637             }
2638             else
2639             {
2640                 if (tvb_get_ntohl(tvb, foffset-4) == 0) 
2641                 {
2642                     proto_tree_add_item(atree, hf_ndps_xdimension_n64, tvb, foffset, 8, FALSE);
2643                     foffset += 8;
2644                     proto_tree_add_item(atree, hf_ndps_ydimension_n64, tvb, foffset, 8, FALSE);
2645                     foffset += 8;
2646                 }
2647                 else
2648                 {
2649                     proto_tree_add_item(atree, hf_ndps_xdimension, tvb, foffset, 4, FALSE);
2650                     foffset += 4;
2651                     proto_tree_add_item(atree, hf_ndps_ydimension, tvb, foffset, 4, FALSE);
2652                     foffset += 4;
2653                 }
2654             }
2655             break;
2656         case 93:         /* Name or OID Dimensions Map */
2657             foffset = name_or_id(tvb, atree, foffset);
2658             proto_tree_add_item(atree, hf_ndps_xdimension, tvb, foffset, 4, FALSE);
2659             foffset += 4;
2660             proto_tree_add_item(atree, hf_ndps_ydimension, tvb, foffset, 4, FALSE);
2661             foffset += 4;
2662             break;
2663         case 94:         /* Printer State Reason */
2664             foffset = name_or_id(tvb, atree, foffset);
2665             proto_tree_add_item(atree, hf_ndps_state_severity, tvb, foffset, 4, FALSE);
2666             foffset += 4;
2667             proto_tree_add_item(atree, hf_ndps_training, tvb, foffset, 4, FALSE);
2668             foffset += 4;
2669             foffset = objectidentifier(tvb, atree, foffset);
2670             foffset = objectidentification(tvb, atree, foffset);
2671             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2672             foffset += 4;
2673             foffset = name_or_id(tvb, atree, foffset);
2674             break;
2675         case 96:         /* Qualified Name */
2676             qualified_name_type = tvb_get_ntohl(tvb, foffset);
2677             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
2678             4, qualified_name_type);
2679             foffset += 4;
2680             if (qualified_name_type != 0) {
2681                 if (qualified_name_type == 1) {
2682                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
2683                 }
2684                 else
2685                 {
2686                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
2687                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2688                 }
2689             }
2690             break;
2691         case 97:         /* Qualified Name Set */
2692             proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
2693             number_of_items = tvb_get_ntohl(tvb, foffset);
2694             foffset += 4;
2695             for (i = 1 ; i <= number_of_items; i++ )
2696             {
2697                 qualified_name_type = tvb_get_ntohl(tvb, foffset);
2698                 proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
2699                 4, qualified_name_type);
2700                 foffset += 4;
2701                 if (qualified_name_type != 0) {
2702                     if (qualified_name_type == 1) {
2703                         foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
2704                     }
2705                     else
2706                     {
2707                         foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
2708                         foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2709                     }
2710                 }
2711             }
2712             break;
2713         case 98:         /* Colorant Set */
2714             colorant_set = tvb_get_ntohl(tvb, foffset);
2715             proto_tree_add_item(atree, hf_ndps_colorant_set, tvb, foffset, 4, FALSE);
2716             foffset += 4;
2717             if (colorant_set==0)
2718             {
2719                 foffset = name_or_id(tvb, atree, foffset);
2720             }
2721             else
2722             {
2723
2724                 foffset = objectidentifier(tvb, atree, foffset);
2725                 proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
2726                 number_of_items = tvb_get_ntohl(tvb, foffset);
2727                 foffset += 4;
2728                 for (i = 1 ; i <= number_of_items; i++ )
2729                 {
2730                     foffset = name_or_id(tvb, atree, foffset);
2731                 }
2732             }
2733             break;
2734         case 99:         /* Resource Printer ID */
2735             number_of_items = tvb_get_ntohl(tvb, foffset);
2736             foffset += 4;
2737             for (i = 1 ; i <= number_of_items; i++ )
2738             {
2739                 foffset = ndps_string(tvb, hf_ndps_printer_type, atree, foffset);
2740                 foffset = ndps_string(tvb, hf_ndps_printer_manuf, atree, foffset);
2741                 foffset = ndps_string(tvb, hf_ndps_inf_file_name, atree, foffset);
2742             }
2743             proto_tree_add_item(atree, hf_os_type, tvb, foffset, 4, FALSE);
2744             foffset += 4;
2745             break;
2746         case 100:         /* Event Object ID */
2747             foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
2748             foffset = objectidentifier(tvb, atree, foffset);
2749             proto_tree_add_item(atree, hf_ndps_event_type, tvb, foffset, 4, FALSE);
2750             foffset +=4;
2751             break;
2752         case 101:         /* Qualified Name Map */
2753             qualified_name_type = tvb_get_ntohl(tvb, foffset);
2754             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
2755             4, qualified_name_type);
2756             foffset += 4;
2757             if (qualified_name_type != 0) {
2758                 if (qualified_name_type == 1) {
2759                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
2760                 }
2761                 else
2762                 {
2763                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
2764                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2765                 }
2766             }
2767             qualified_name_type = tvb_get_ntohl(tvb, foffset);
2768             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
2769             4, qualified_name_type);
2770             foffset += 4;
2771             if (qualified_name_type != 0) {
2772                 if (qualified_name_type == 1) {
2773                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
2774                 }
2775                 else
2776                 {
2777                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
2778                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2779                 }
2780             }
2781             break;
2782         case 104:         /* Cardinal or Enum or Time */
2783             card_enum_time = tvb_get_ntohl(tvb, foffset);
2784             proto_tree_add_item(atree, hf_ndps_card_enum_time, tvb, foffset, 4, FALSE);
2785             foffset += 4;
2786             if (card_enum_time==0)
2787             {
2788                 proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2789                 foffset += 4;
2790             }
2791             else
2792             {
2793                 if (card_enum_time==1)
2794                 {
2795                     proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2796                     foffset += 4;
2797                 }
2798                 else
2799                 {
2800                     proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2801                     foffset += 4;
2802                 }
2803             }
2804             break;
2805         case 105:         /* Print Contained Object ID Set */
2806             proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
2807             number_of_items = tvb_get_ntohl(tvb, foffset);
2808             foffset += 4;
2809             for (i = 1 ; i <= number_of_items; i++ )
2810             {
2811                 foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
2812                 proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2813                 foffset += 4;
2814             }
2815             break;
2816         case 106:         /* Octet String Pair */
2817             length = tvb_get_ntohl(tvb, foffset);
2818             foffset += 4;
2819             proto_tree_add_item(atree, hf_ndps_octet_string, tvb, foffset, length, FALSE);
2820             foffset += length;
2821             foffset += (length%2);
2822             length = tvb_get_ntohl(tvb, foffset);
2823             foffset += 4;
2824             proto_tree_add_item(atree, hf_ndps_octet_string, tvb, foffset, length, FALSE);
2825             foffset += length;
2826             foffset += (length%2);
2827             break;
2828         case 107:         /* Octet String Integer Pair */
2829             length = tvb_get_ntohl(tvb, foffset);
2830             foffset += 4;
2831             proto_tree_add_item(atree, hf_ndps_octet_string, tvb, foffset, length, FALSE);
2832             foffset += length;
2833             foffset += (length%2);
2834             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2835             foffset += 4;
2836             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2837             foffset += 4;
2838             break;
2839         case 109:         /* Event Handling Profile 2 */
2840             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2841             foffset += 4;
2842             proto_tree_add_item(atree, hf_ndps_persistence, tvb, foffset, 4, FALSE);
2843             foffset += 4;
2844             qualified_name_type = tvb_get_ntohl(tvb, foffset);
2845             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
2846             4, qualified_name_type);
2847             foffset += 4;
2848             if (qualified_name_type != 0) {
2849                 if (qualified_name_type == 1) {
2850                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
2851                 }
2852                 else
2853                 {
2854                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
2855                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2856                 }
2857             }
2858             length = tvb_get_ntohl(tvb, foffset);
2859             foffset += 4;
2860             proto_tree_add_item(atree, hf_ndps_octet_string, tvb, foffset, length, FALSE);
2861             foffset += length;
2862             foffset += (length%2);
2863             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2864             foffset += 4;
2865             foffset = name_or_id(tvb, atree, foffset);
2866             proto_tree_add_item(atree, hf_ndps_delivery_add_type, tvb, foffset, 4, FALSE);
2867             event_object_type = tvb_get_ntohl(tvb, foffset);
2868             foffset += 4;
2869             switch(event_object_type)
2870             {
2871                 case 0:     /*MHS ADDR*/
2872                 case 1:     /*DISTINGUISHED_NAME*/
2873                 case 2:     /*TEXT*/
2874                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2875                     break;
2876                 case 3:     /*OCTET_STRING*/
2877                     length = tvb_get_ntohl(tvb, foffset);
2878                     foffset += 4;
2879                     proto_tree_add_item(atree, hf_ndps_octet_string, tvb, foffset, length, FALSE);
2880                     foffset += length;
2881                     foffset += (length%2);
2882                     break;
2883                 case 4:     /*DIST_NAME_STRING*/
2884                     foffset = ndps_string(tvb, hf_object_name, atree, foffset);
2885                     foffset = name_or_id(tvb, atree, foffset);
2886                     break;
2887                 case 5:     /*RPC_ADDRESS*/
2888                 case 6:     /*QUALIFIED_NAME*/
2889                     foffset = objectidentifier(tvb, atree, foffset);
2890                     qualified_name_type = tvb_get_ntohl(tvb, foffset);
2891                     proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
2892                     4, qualified_name_type);
2893                     foffset += 4;
2894                     if (qualified_name_type != 0) {
2895                         if (qualified_name_type == 1) {
2896                             foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
2897                         }
2898                         else
2899                         {
2900                             foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
2901                             foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2902                         }
2903                     }
2904                     break;
2905                 default:
2906                     break;
2907             }
2908             proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
2909             number_of_items = tvb_get_ntohl(tvb, foffset);
2910             foffset += 4;
2911             for (i = 1 ; i <= number_of_items; i++ )
2912             {
2913                 foffset = ndps_string(tvb, hf_object_name, atree, foffset);
2914                 foffset = objectidentifier(tvb, atree, foffset);
2915                 proto_tree_add_item(atree, hf_ndps_event_type, tvb, foffset, 
2916                 4, FALSE);
2917                 foffset += 4;
2918             }
2919             foffset = objectidentifier(tvb, atree, foffset);
2920             qualified_name_type = tvb_get_ntohl(tvb, foffset);
2921             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
2922             4, qualified_name_type);
2923             foffset += 4;
2924             if (qualified_name_type != 0) {
2925                 if (qualified_name_type == 1) {
2926                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
2927                 }
2928                 else
2929                 {
2930                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
2931                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
2932                 }
2933             }
2934             proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
2935             number_of_items = tvb_get_ntohl(tvb, foffset);
2936             foffset += 4;
2937             for (i = 1 ; i <= number_of_items; i++ )
2938             {
2939                 foffset = objectidentifier(tvb, atree, foffset);
2940             }
2941             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2942             foffset += 4;
2943             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2944             foffset += 4;
2945             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
2946             foffset += 4;
2947             foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
2948             break;
2949         default:
2950             break;
2951     }
2952     return foffset;
2953 }
2954
2955 static int
2956 filteritem(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
2957 {
2958     guint32     filter_op=0;
2959     guint32     number_of_items=0;
2960     guint32     i;
2961
2962     proto_tree_add_item(ndps_tree, hf_ndps_item_filter, tvb, foffset, 4, FALSE);
2963     filter_op = tvb_get_ntohl(tvb, foffset);
2964     foffset += 4;
2965     switch(filter_op)
2966     {
2967     case 0:       /* Equality */
2968     case 2:       /* Greater or Equal */
2969     case 3:       /* Less or Equal */
2970     case 5:       /* Subset of */
2971     case 6:       /* Superset of */
2972     case 7:       /* Non NULL Set Intersect */
2973         foffset = objectidentifier(tvb, ndps_tree, foffset);
2974         number_of_items = tvb_get_ntohl(tvb, foffset);
2975         proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
2976         foffset += 4;
2977         for (i = 1 ; i <= number_of_items; i++ )
2978         {
2979             foffset = attribute_value(tvb, ndps_tree, foffset);
2980         }
2981         proto_tree_add_item(ndps_tree, hf_ndps_qualifier, tvb, foffset, 4, FALSE);
2982         foffset += 4;
2983         break;
2984     case 1:        /* Substrings */
2985         foffset = objectidentifier(tvb, ndps_tree, foffset);
2986         proto_tree_add_item(ndps_tree, hf_ndps_substring_match, tvb, foffset, 4, FALSE);
2987         foffset += 4;
2988         foffset = attribute_value(tvb, ndps_tree, foffset); /* initial value */
2989         number_of_items = tvb_get_ntohl(tvb, foffset);
2990         proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
2991         foffset += 4;
2992         for (i = 1 ; i <= number_of_items; i++ )
2993         {
2994             foffset = attribute_value(tvb, ndps_tree, foffset);   /* Any Value Set Option */
2995         }
2996         foffset = attribute_value(tvb, ndps_tree, foffset);   /* Final Value */
2997         break;
2998     case 4:       /* Present */
2999         foffset = objectidentifier(tvb, ndps_tree, foffset);
3000     default:
3001         break;
3002     }
3003     return foffset;
3004 }
3005
3006 static const fragment_items ndps_frag_items = {
3007         &ett_ndps_segment,
3008         &ett_ndps_segments,
3009         &hf_ndps_segments,
3010         &hf_ndps_segment,
3011         &hf_ndps_segment_overlap,
3012         &hf_ndps_segment_overlap_conflict,
3013         &hf_ndps_segment_multiple_tails,
3014         &hf_ndps_segment_too_long_segment,
3015         &hf_ndps_segment_error,
3016         "segments"
3017 };
3018
3019 static dissector_handle_t ndps_data_handle;
3020
3021 /* NDPS packets come in request/reply pairs. The request packets tell the 
3022  * Function and Program numbers. The response, unfortunately, only
3023  * identifies itself via the Exchange ID; you have to know what type of NDPS
3024  * request the request packet contained in order to successfully parse the 
3025  * response. A global method for doing this does not exist in ethereal yet
3026  * (NFS also requires it), so for now the NDPS section will keep its own hash
3027  * table keeping track of NDPS packets.
3028  *
3029  * We construct a conversation specified by the client and server
3030  * addresses and the connection number; the key representing the unique
3031  * NDPS request then is composed of the pointer to the conversation
3032  * structure, cast to a "guint" (which may throw away the upper 32
3033  * bits of the pointer on a P64 platform, but the low-order 32 bits
3034  * are more likely to differ between conversations than the upper 32 bits),
3035  * and the sequence number.
3036  *
3037  * The value stored in the hash table is the ncp_req_hash_value pointer. This
3038  * struct tells us the NDPS Program and Function and gives the NDPS_record pointer.
3039  */
3040 typedef struct {
3041         conversation_t  *conversation;
3042         guint32             ndps_xport;
3043 } ndps_req_hash_key;
3044
3045 typedef struct {
3046         guint32             ndps_prog;
3047         guint32             ndps_func;
3048         guint32             ndps_frame_num;
3049 } ndps_req_hash_value;
3050
3051 static GHashTable *ndps_req_hash = NULL;
3052 static GMemChunk *ndps_req_hash_keys = NULL;
3053 static GMemChunk *ndps_req_hash_values = NULL;
3054
3055 /* Hash Functions */
3056 gint
3057 ndps_equal(gconstpointer v, gconstpointer v2)
3058 {
3059         const ndps_req_hash_key *val1 = (const ndps_req_hash_key*)v;
3060         const ndps_req_hash_key *val2 = (const ndps_req_hash_key*)v2;
3061
3062         if (val1->conversation == val2->conversation &&
3063             val1->ndps_xport  == val2->ndps_xport ) {
3064                 return 1;
3065         }
3066         return 0;
3067 }
3068
3069 guint
3070 ndps_hash(gconstpointer v)
3071 {
3072         const ndps_req_hash_key *ndps_key = (const ndps_req_hash_key*)v;
3073         return GPOINTER_TO_UINT(ndps_key->conversation) + ndps_key->ndps_xport;
3074 }
3075
3076 /* Initializes the hash table and the mem_chunk area each time a new
3077  * file is loaded or re-loaded in ethereal */
3078 static void
3079 ndps_init_protocol(void)
3080 {
3081         /* fragment */
3082         fragment_table_init(&ndps_fragment_table);
3083         reassembled_table_init(&ndps_reassembled_table);
3084
3085         if (ndps_req_hash)
3086                 g_hash_table_destroy(ndps_req_hash);
3087         if (ndps_req_hash_keys)
3088                 g_mem_chunk_destroy(ndps_req_hash_keys);
3089         if (ndps_req_hash_values)
3090                 g_mem_chunk_destroy(ndps_req_hash_values);
3091
3092         ndps_req_hash = g_hash_table_new(ndps_hash, ndps_equal);
3093         ndps_req_hash_keys = g_mem_chunk_new("ndps_req_hash_keys",
3094                         sizeof(ndps_req_hash_key),
3095                         NDPS_PACKET_INIT_COUNT * sizeof(ndps_req_hash_key),
3096                         G_ALLOC_ONLY);
3097         ndps_req_hash_values = g_mem_chunk_new("ndps_req_hash_values",
3098                         sizeof(ndps_req_hash_value),
3099                         NDPS_PACKET_INIT_COUNT * sizeof(ndps_req_hash_value),
3100                         G_ALLOC_ONLY);
3101 }
3102
3103 /* After the sequential run, we don't need the ncp_request hash and keys
3104  * anymore; the lookups have already been done and the vital info
3105  * saved in the reply-packets' private_data in the frame_data struct. */
3106 static void
3107 ndps_postseq_cleanup(void)
3108 {
3109         if (ndps_req_hash) {
3110                 /* Destroy the hash, but don't clean up request_condition data. */
3111                 g_hash_table_destroy(ndps_req_hash);
3112                 ndps_req_hash = NULL;
3113         }
3114         if (ndps_req_hash_keys) {
3115                 g_mem_chunk_destroy(ndps_req_hash_keys);
3116                 ndps_req_hash_keys = NULL;
3117         }
3118         /* Don't free the ncp_req_hash_values, as they're
3119          * needed during random-access processing of the proto_tree.*/
3120 }
3121
3122 ndps_req_hash_value*
3123 ndps_hash_insert(conversation_t *conversation, guint32 ndps_xport)
3124 {
3125         ndps_req_hash_key               *request_key;
3126         ndps_req_hash_value             *request_value;
3127
3128         /* Now remember the request, so we can find it if we later
3129            a reply to it. */
3130         request_key = g_mem_chunk_alloc(ndps_req_hash_keys);
3131         request_key->conversation = conversation;
3132         request_key->ndps_xport = ndps_xport;
3133
3134         request_value = g_mem_chunk_alloc(ndps_req_hash_values);
3135         request_value->ndps_prog = 0;
3136         request_value->ndps_func = 0;
3137         request_value->ndps_frame_num = 0;
3138        
3139         g_hash_table_insert(ndps_req_hash, request_key, request_value);
3140
3141         return request_value;
3142 }
3143
3144 /* Returns the ncp_rec*, or NULL if not found. */
3145 ndps_req_hash_value*
3146 ndps_hash_lookup(conversation_t *conversation, guint32 ndps_xport)
3147 {
3148         ndps_req_hash_key               request_key;
3149
3150         request_key.conversation = conversation;
3151         request_key.ndps_xport = ndps_xport;
3152
3153         return g_hash_table_lookup(ndps_req_hash, &request_key);
3154 }
3155
3156 /* ================================================================= */
3157 /* NDPS                                                               */
3158 /* ================================================================= */
3159
3160 static void
3161 dissect_ndps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree)
3162 {
3163     guint32     ndps_xid;
3164     guint32     ndps_prog;
3165     guint32     ndps_packet_type;
3166     guint32     ndps_rpc_version;
3167     int         foffset;
3168     guint32     ndps_hfname;
3169     guint32     ndps_func;
3170     const char  *ndps_program_string;
3171     const char  *ndps_func_string;
3172
3173
3174     ndps_packet_type = tvb_get_ntohl(tvb, 8);
3175     if (ndps_packet_type != 0 && ndps_packet_type != 1) {     /* Packet Type */
3176         if (check_col(pinfo->cinfo, COL_INFO))
3177             col_set_str(pinfo->cinfo, COL_INFO, "(Continuation Data)");
3178         proto_tree_add_text(ndps_tree, tvb, 0, tvb_length_remaining(tvb, 0), "Data - (%d Bytes)", tvb_length_remaining(tvb, 0));
3179         return;
3180     }
3181     foffset = 0;
3182     proto_tree_add_item(ndps_tree, hf_ndps_record_mark, tvb,
3183                    foffset, 2, FALSE);
3184     foffset += 2;
3185     proto_tree_add_item(ndps_tree, hf_ndps_length, tvb,
3186                    foffset, 2, FALSE);
3187     foffset += 2;
3188
3189     ndps_xid = tvb_get_ntohl(tvb, foffset);
3190     proto_tree_add_uint(ndps_tree, hf_ndps_xid, tvb, foffset, 4, ndps_xid);
3191     foffset += 4;
3192     ndps_packet_type = tvb_get_ntohl(tvb, foffset);
3193     proto_tree_add_uint(ndps_tree, hf_ndps_packet_type, tvb, foffset, 4, ndps_packet_type);
3194     foffset += 4;
3195     if(ndps_packet_type == 0x00000001)          /* Reply packet */
3196     {
3197         if (check_col(pinfo->cinfo, COL_INFO))
3198             col_set_str(pinfo->cinfo, COL_INFO, "R NDPS ");
3199         proto_tree_add_item(ndps_tree, hf_ndps_rpc_accept, tvb, foffset, 4, FALSE);
3200         if (tvb_get_ntohl(tvb, foffset)==0) {
3201             foffset += 4;
3202             proto_tree_add_item(ndps_tree, hf_ndps_auth_null, tvb, foffset, 8, FALSE);
3203             foffset += 8;
3204         }
3205         else
3206         {
3207             foffset += 4;
3208             proto_tree_add_item(ndps_tree, hf_ndps_rpc_rej_stat, tvb, foffset+4, 4, FALSE);
3209             foffset += 4;
3210         }
3211         dissect_ndps_reply(tvb, pinfo, ndps_tree, foffset);
3212     }
3213     else
3214     {
3215         if (check_col(pinfo->cinfo, COL_INFO))
3216             col_set_str(pinfo->cinfo, COL_INFO, "C NDPS ");
3217         ndps_rpc_version = tvb_get_ntohl(tvb, foffset);
3218         proto_tree_add_item(ndps_tree, hf_ndps_rpc_version, tvb, foffset, 4, FALSE);
3219         foffset += 4;
3220         ndps_prog = tvb_get_ntohl(tvb, foffset);
3221         ndps_program_string = match_strval(ndps_prog, spx_ndps_program_vals);
3222         if( ndps_program_string != NULL)
3223         {
3224             proto_tree_add_item(ndps_tree, hf_spx_ndps_program, tvb, foffset, 4, FALSE);
3225             foffset += 4;
3226             if (check_col(pinfo->cinfo, COL_INFO))
3227             {
3228                 col_append_str(pinfo->cinfo, COL_INFO, (const gchar*) ndps_program_string);
3229                 col_append_str(pinfo->cinfo, COL_INFO, ", ");
3230             }
3231             proto_tree_add_item(ndps_tree, hf_spx_ndps_version, tvb, foffset, 4, FALSE);
3232             foffset += 4;
3233             ndps_func = tvb_get_ntohl(tvb, foffset);
3234             switch(ndps_prog)
3235             {
3236                 case 0x060976:
3237                     ndps_hfname = hf_spx_ndps_func_print;
3238                     ndps_func_string = match_strval(ndps_func, spx_ndps_print_func_vals);
3239                     break;
3240                 case 0x060977:
3241                     ndps_hfname = hf_spx_ndps_func_broker;
3242                     ndps_func_string = match_strval(ndps_func, spx_ndps_broker_func_vals);
3243                     break;
3244                 case 0x060978:
3245                     ndps_hfname = hf_spx_ndps_func_registry;
3246                     ndps_func_string = match_strval(ndps_func, spx_ndps_registry_func_vals);
3247                     break;
3248                 case 0x060979:
3249                     ndps_hfname = hf_spx_ndps_func_notify;
3250                     ndps_func_string = match_strval(ndps_func, spx_ndps_notify_func_vals);
3251                     break;
3252                 case 0x06097a:
3253                     ndps_hfname = hf_spx_ndps_func_resman;
3254                     ndps_func_string = match_strval(ndps_func, spx_ndps_resman_func_vals);
3255                     break;
3256                 case 0x06097b:
3257                     ndps_hfname = hf_spx_ndps_func_delivery;
3258                     ndps_func_string = match_strval(ndps_func, spx_ndps_deliver_func_vals);
3259                     break;
3260                 default:
3261                     ndps_hfname = 0;
3262                     ndps_func_string = NULL;
3263                     break;
3264             }
3265             if(ndps_hfname != 0)
3266             {
3267                 proto_tree_add_item(ndps_tree, ndps_hfname, tvb, foffset, 4, FALSE);
3268                 if (ndps_func_string != NULL) 
3269                 {
3270                     if (check_col(pinfo->cinfo, COL_INFO))
3271                         col_append_str(pinfo->cinfo, COL_INFO, (const gchar*) ndps_func_string);
3272
3273                     foffset += 4;
3274                     proto_tree_add_item(ndps_tree, hf_ndps_auth_null, tvb, foffset, 16, FALSE);
3275                     foffset+=16;
3276                     dissect_ndps_request(tvb, pinfo, ndps_tree, ndps_prog, ndps_func, foffset);
3277                 }
3278             }
3279         }
3280     }
3281 }
3282
3283 static guint
3284 get_ndps_pdu_len(tvbuff_t *tvb, int offset)
3285 {
3286     guint16 plen;
3287
3288     /*
3289      * Get the length of the NDPS packet.
3290      */
3291     plen = tvb_get_ntohs(tvb, offset + 2);
3292
3293     /*
3294      * That length doesn't include the length of the record mark field
3295      * or the length field itself; add that in.
3296      * (XXX - is the field really a 31-bit length with the uppermost bit
3297      * being a record mark bit?)
3298      */
3299     return plen + 4;
3300 }
3301
3302 static void
3303 dissect_ndps_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3304 {
3305     proto_tree      *ndps_tree = NULL;
3306     proto_item      *ti;
3307
3308     if (check_col(pinfo->cinfo, COL_PROTOCOL))
3309         col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDPS");
3310
3311     if (check_col(pinfo->cinfo, COL_INFO))
3312         col_clear(pinfo->cinfo, COL_INFO);
3313         
3314     if (tree) {
3315         ti = proto_tree_add_item(tree, proto_ndps, tvb, 0, -1, FALSE);
3316         ndps_tree = proto_item_add_subtree(ti, ett_ndps);
3317     }
3318     dissect_ndps(tvb, pinfo, ndps_tree);
3319 }
3320
3321 static void
3322 ndps_defrag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3323 {
3324     guint16         record_mark=0;
3325     guint16         ndps_length=0;
3326     guint32         id=0;
3327     int             len=0;
3328     tvbuff_t        *next_tvb = NULL;
3329     fragment_data   *fd_head;
3330     spx_info        *spx_data;
3331
3332     spx_data = pinfo->private_data;
3333     if (!ndps_defragment || spx_data->num != pinfo->fd->num) {
3334         if (spx_data->num != pinfo->fd->num) {
3335             if (check_col(pinfo->cinfo, COL_INFO))
3336             {
3337                 col_add_fstr(pinfo->cinfo, COL_INFO, "[Retransmission] Original Packet %d", spx_data->num);
3338             }
3339             return;
3340         }
3341         dissect_ndps(tvb, pinfo, tree);
3342         return;
3343     }
3344     record_mark = tvb_get_ntohs(tvb, 0);
3345     ndps_length = tvb_get_ntohs(tvb, 2);
3346
3347     if (ndps_length > tvb_length_remaining(tvb, 0) || ndps_fragmented || ndps_length==0) 
3348     {
3349         more_fragment = TRUE;
3350         ndps_fragmented = TRUE;
3351
3352         /*
3353          * Fragment
3354          */
3355         tid = (pinfo->srcport+pinfo->destport);
3356         len = tvb_reported_length_remaining(tvb, 0);
3357         if ((frag_number + tvb_length_remaining(tvb, 0)-save_frag_length)<=10)
3358         {
3359             more_fragment = FALSE;
3360         }
3361         if (tvb_bytes_exist(tvb, 0, len))
3362         {
3363             fd_head = fragment_add_seq_next(tvb, 0, pinfo, tid, ndps_fragment_table, ndps_reassembled_table, len, more_fragment);
3364             if (fd_head != NULL) 
3365             {
3366                 if (fd_head->next != NULL) 
3367                 {
3368                     next_tvb = tvb_new_real_data(fd_head->data,
3369                         fd_head->len, fd_head->len);
3370                     tvb_set_child_real_data_tvbuff(tvb,
3371                         next_tvb);
3372                     add_new_data_source(pinfo,
3373                         next_tvb,
3374                         "Reassembled NDPS");
3375                     /* Show all fragments. */
3376                     if (tree) 
3377                     {
3378                         show_fragment_seq_tree(fd_head,
3379                             &ndps_frag_items,
3380                             tree, pinfo,
3381                             next_tvb);
3382                         tid++;
3383                     }
3384                     more_fragment = FALSE;
3385                     save_frag_length = 0;
3386                     frag_number=0;
3387                     ndps_fragmented=FALSE;
3388                 } 
3389                 else 
3390                 {
3391                     next_tvb = tvb_new_subset(tvb, 0, -1, -1);
3392                 }
3393             }
3394             else 
3395             {
3396                 if (save_frag_length == 0) 
3397                 {
3398                     save_frag_length = ndps_length;                 /* First Fragment */
3399                     save_frag_seq = tid;
3400                 }
3401                 if ((pinfo->srcport+pinfo->destport) == save_frag_seq) 
3402                 {
3403                     if (!pinfo->fd->flags.visited) 
3404                     {
3405                         frag_number += tvb_length_remaining(tvb, 0);    /* Current offset */
3406                     }
3407                     if (check_col(pinfo->cinfo, COL_INFO))
3408                     {
3409                       if (more_fragment)
3410                       {
3411                         col_append_fstr(pinfo->cinfo, COL_INFO, " [NDPS Fragment]");
3412                       }
3413                     }
3414                 }
3415                 next_tvb = NULL;
3416             }
3417         }
3418         else 
3419         {
3420             /*
3421              * Dissect this
3422              */
3423             next_tvb = tvb_new_subset(tvb, 0, -1, -1);
3424         }
3425         if (next_tvb == NULL)
3426         {
3427             if ((pinfo->srcport+pinfo->destport) == save_frag_seq) 
3428             {
3429                 next_tvb = tvb_new_subset (tvb, 0, -1, -1);
3430                 call_dissector(ndps_data_handle, next_tvb, pinfo, tree);
3431             }
3432             else
3433             {
3434                 dissect_ndps(tvb, pinfo, tree);
3435             }
3436         }
3437         else
3438         {
3439             dissect_ndps(next_tvb, pinfo, tree);
3440         }
3441     }
3442     else
3443     {
3444         dissect_ndps(tvb, pinfo, tree);
3445     }
3446 }
3447
3448 static void
3449 dissect_ndps_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3450 {
3451     tcp_dissect_pdus(tvb, pinfo, tree, ndps_desegment, 4, get_ndps_pdu_len,
3452         dissect_ndps_pdu);
3453 }
3454
3455
3456 static void
3457 dissect_ndps_ipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3458 {
3459     proto_tree      *ndps_tree = NULL;
3460     proto_item      *ti;
3461
3462     if (check_col(pinfo->cinfo, COL_PROTOCOL))
3463         col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDPS");
3464
3465     if (check_col(pinfo->cinfo, COL_INFO))
3466         col_clear(pinfo->cinfo, COL_INFO);
3467         
3468     if (tree) {
3469         ti = proto_tree_add_item(tree, proto_ndps, tvb, 0, -1, FALSE);
3470         ndps_tree = proto_item_add_subtree(ti, ett_ndps);
3471     }
3472     ndps_defrag(tvb, pinfo, ndps_tree);
3473 }
3474
3475 static void
3476 dissect_ndps_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, guint32 ndps_prog, guint32 ndps_func, int foffset)
3477 {
3478     ndps_req_hash_value *request_value = NULL;
3479     conversation_t      *conversation;
3480     guint32             i=0;
3481     guint32             j=0;
3482     guint32             name_len=0;
3483     guint32             field_len=0;
3484     guint32             cred_type=0;
3485     guint32             resource_type=0;
3486     guint32             filter_type=0;
3487     guint32             print_type=0;
3488     guint32             qualified_name_type=0;
3489     guint32             data_type=0;
3490     guint32             length=0;
3491     guint32             number_of_items=0;
3492     guint32             number_of_items2=0;
3493     proto_tree          *atree;
3494     proto_item          *aitem;
3495     proto_tree          *btree;
3496     proto_item          *bitem;
3497     proto_tree          *ctree;
3498     proto_item          *citem;
3499
3500     if (!pinfo->fd->flags.visited) 
3501     {
3502
3503         /* This is the first time we've looked at this packet.
3504         Keep track of the Program and connection whence the request
3505         came, and the address and connection to which the request
3506         is being sent, so that we can match up calls with replies.
3507         (We don't include the sequence number, as we may want
3508         to have all packets over the same connection treated
3509         as being part of a single conversation so that we can
3510         let the user select that conversation to be displayed.) */
3511         
3512         conversation = find_conversation(&pinfo->src, &pinfo->dst,
3513             PT_NCP, (guint32) pinfo->srcport, (guint32) pinfo->srcport, 0);
3514
3515         if (conversation == NULL) 
3516             {
3517             /* It's not part of any conversation - create a new one. */
3518             conversation = conversation_new(&pinfo->src, &pinfo->dst,
3519                 PT_NCP, (guint32) pinfo->srcport, (guint32) pinfo->srcport, 0);
3520         }
3521
3522         request_value = ndps_hash_insert(conversation, (guint32) pinfo->srcport);
3523         request_value->ndps_prog = ndps_prog;
3524         request_value->ndps_func = ndps_func;
3525         request_value->ndps_frame_num = pinfo->fd->num;
3526     }
3527     switch(ndps_prog)
3528     {
3529     case 0x060976:  /* Print */
3530         switch(ndps_func)
3531         {
3532         case 0x00000001:    /* Bind PSM */
3533             proto_tree_add_item(ndps_tree, hf_ndps_items, tvb, foffset,
3534             4, FALSE);
3535             foffset += 4;
3536             name_len = tvb_get_ntohl(tvb, foffset);
3537             foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
3538             /*if(name_len == 0)
3539             {
3540                 foffset += 2;
3541             }
3542             foffset += 2;*/
3543             proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
3544             2, FALSE);
3545             foffset += 2;
3546             foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
3547             break;
3548         case 0x00000002:    /* Bind PA */
3549             /* Start of credentials */
3550             cred_type = tvb_get_ntohl(tvb, foffset);
3551             proto_tree_add_item(ndps_tree, hf_ndps_cred_type, tvb, foffset, 4, FALSE);
3552             foffset += 4;
3553             switch (cred_type)
3554             {
3555             case 0:
3556                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
3557                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
3558                 atree = proto_item_add_subtree(aitem, ett_ndps);
3559                 foffset += 4;
3560                 for (i = 1 ; i <= number_of_items; i++ )
3561                 {
3562                     length = tvb_get_ntohl(tvb, foffset);
3563                     foffset += 4;
3564                     proto_tree_add_item(ndps_tree, hf_ndps_password, tvb, foffset, length, FALSE);
3565                     foffset += length;
3566                 }
3567                 break;
3568             case 1:
3569                 length = tvb_get_ntohl(tvb, foffset);
3570                 foffset += 4;
3571                 proto_tree_add_item(ndps_tree, hf_ndps_certified, tvb, foffset, length, FALSE);
3572                 foffset += length;
3573                 break;
3574             case 2:
3575                 name_len = tvb_get_ntohl(tvb, foffset);
3576                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
3577                 foffset += align_4(tvb, foffset);
3578                 foffset += 2;
3579                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
3580                 2, FALSE);
3581                 foffset += 2;
3582                 break;
3583             case 3:
3584                 name_len = tvb_get_ntohl(tvb, foffset);
3585                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
3586                 foffset += align_4(tvb, foffset);
3587                 foffset += 2;
3588                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
3589                 2, FALSE);
3590                 foffset += 2;
3591                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
3592                 break;
3593             case 4:
3594                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
3595                 foffset += align_4(tvb, foffset);
3596                 foffset += 2;
3597                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
3598                 2, FALSE);
3599                 foffset += 2;
3600                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
3601                 foffset += 8;   /* Don't know what these 8 bytes signify */
3602                 proto_tree_add_item(ndps_tree, hf_ndps_items, tvb, foffset,
3603                 4, FALSE);
3604                 foffset += 4;
3605                 foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
3606                 foffset = ndps_string(tvb, hf_ndps_tree, ndps_tree, foffset);
3607                 break;
3608             default:
3609                 break;
3610             }
3611             /* End of credentials */
3612             proto_tree_add_item(ndps_tree, hf_ndps_retrieve_restrictions, tvb, foffset, 4, FALSE);
3613             foffset += 4;
3614             aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
3615             atree = proto_item_add_subtree(aitem, ett_ndps);
3616             foffset += 4;
3617             for (i = 1 ; i <= number_of_items; i++ )
3618             {
3619                 length = tvb_get_ntohl(tvb, foffset);
3620                 foffset += 4;
3621                 proto_tree_add_item(ndps_tree, hf_bind_security, tvb, foffset, length, FALSE);
3622             }
3623             /* Start of QualifiedName */
3624             qualified_name_type = tvb_get_ntohl(tvb, foffset);
3625             proto_tree_add_uint(ndps_tree, hf_ndps_qualified_name, tvb, foffset, 
3626             4, qualified_name_type);
3627             foffset += 4;
3628             if (qualified_name_type != 0) {
3629                 if (qualified_name_type == 1) {
3630                     foffset = ndps_string(tvb, hf_printer_name, ndps_tree, foffset);
3631                 }
3632                 else
3633                 {
3634                     foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
3635                     foffset = ndps_string(tvb, hf_ndps_tree, ndps_tree, foffset);
3636                 }
3637             }
3638             /* End of QualifiedName */
3639             break;
3640         case 0x00000003:    /* Unbind */
3641             proto_tree_add_item(ndps_tree, hf_ndps_object, tvb, foffset, 
3642             4, FALSE);
3643             break;
3644         case 0x00000004:    /* Print */
3645             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
3646             foffset += 4;
3647             proto_tree_add_item(ndps_tree, hf_print_arg, tvb, foffset, 4, FALSE);
3648             print_type = tvb_get_ntohl(tvb, foffset);
3649             foffset += 4;
3650             switch (print_type) 
3651             {
3652             case 0:     /* Create Job */
3653                 foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
3654                 proto_tree_add_item(ndps_tree, hf_sub_complete, tvb, foffset, 4, FALSE);
3655                 foffset += 4;
3656                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Transfer Method");
3657                 atree = proto_item_add_subtree(aitem, ett_ndps);
3658                 number_of_items = tvb_get_ntohl(tvb, foffset);
3659                 proto_tree_add_item(atree, hf_ndps_objects, tvb, foffset, 4, FALSE);
3660                 foffset += 4;
3661                 for (i = 1 ; i <= number_of_items; i++ )
3662                 {
3663                     foffset = objectidentifier(tvb, atree, foffset);
3664                     number_of_items2 = tvb_get_ntohl(tvb, foffset);
3665                     bitem = proto_tree_add_item(atree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
3666                     btree = proto_item_add_subtree(bitem, ett_ndps);
3667                     foffset += 4;
3668                     for (j = 1 ; j <= number_of_items2; j++ )
3669                     {
3670                         foffset = attribute_value(tvb, btree, foffset);
3671                     }
3672                     proto_tree_add_item(btree, hf_ndps_qualifier, tvb, foffset, 4, FALSE);
3673                     foffset += 4;
3674                 }
3675                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Document Content");
3676                 atree = proto_item_add_subtree(aitem, ett_ndps);
3677                 number_of_items = tvb_get_ntohl(tvb, foffset);
3678                 proto_tree_add_item(atree, hf_ndps_objects, tvb, foffset, 4, FALSE);
3679                 foffset += 4;
3680                 for (i = 1 ; i <= number_of_items; i++ )
3681                 {
3682                     foffset = objectidentifier(tvb, atree, foffset);
3683                 }
3684                 foffset += align_4(tvb, foffset);
3685                 number_of_items = tvb_get_ntohl(tvb, foffset);
3686                 proto_tree_add_item(atree, hf_ndps_objects, tvb, foffset, 4, FALSE);
3687                 foffset += 4;
3688                 proto_tree_add_item(atree, hf_doc_content, tvb, foffset, 4, FALSE);
3689                 foffset += 4;
3690                 for (i = 1 ; i <= number_of_items; i++ )
3691                 {
3692                     if (tvb_get_ntohl(tvb, foffset-4)==0)
3693                     {
3694                         if (tvb_get_ntohl(tvb, foffset) > tvb_length_remaining(tvb, foffset)) /* Segmented Data */
3695                         {
3696                             proto_tree_add_item(atree, hf_ndps_data, tvb, foffset, tvb_length_remaining(tvb, foffset), FALSE);
3697                             return;
3698                         }
3699                         proto_tree_add_item(atree, hf_ndps_included_doc, tvb, foffset+4, tvb_get_ntohl(tvb, foffset), FALSE);
3700                         foffset += tvb_get_ntohl(tvb, foffset)+4;
3701                         foffset += (length%2);
3702                     }
3703                     else
3704                     {
3705                         foffset = ndps_string(tvb, hf_ndps_ref_name, atree, foffset);
3706                         foffset = name_or_id(tvb, atree, foffset);
3707                     }
3708                 }
3709                 foffset += 4;
3710                 if (align_4(tvb, foffset)>0) {
3711                     foffset += align_4(tvb, foffset);
3712                     foffset += 2;
3713                 }
3714                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Document Type");
3715                 number_of_items = tvb_get_ntohl(tvb, foffset);
3716                 atree = proto_item_add_subtree(aitem, ett_ndps);
3717                 proto_tree_add_item(atree, hf_ndps_objects, tvb, foffset, 4, FALSE);
3718                 foffset += 4;
3719                 foffset = objectidentifier(tvb, atree, foffset);
3720                 for (i = 1 ; i <= number_of_items; i++ )
3721                 {
3722                     number_of_items2 = tvb_get_ntohl(tvb, foffset);
3723                     bitem = proto_tree_add_item(atree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
3724                     btree = proto_item_add_subtree(bitem, ett_ndps);
3725                     foffset += 4;
3726                     for (j = 1 ; j <= number_of_items2; j++ )
3727                     {
3728                         foffset = attribute_value(tvb, btree, foffset);
3729                     }
3730                     proto_tree_add_item(btree, hf_ndps_qualifier, tvb, foffset, 4, FALSE);
3731                     foffset += 4;
3732                 }
3733                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Document Attributes");
3734                 number_of_items = tvb_get_ntohl(tvb, foffset);
3735                 atree = proto_item_add_subtree(aitem, ett_ndps);
3736                 proto_tree_add_item(atree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
3737                 foffset += 4;
3738                 for (i = 1 ; i <= number_of_items; i++ )
3739                 {
3740                     foffset = attribute_value(tvb, atree, foffset);  /* Document Attributes */
3741                 }
3742                 break;
3743             case 1:     /* Add Job */
3744                 foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
3745                 proto_tree_add_item(ndps_tree, hf_local_id, tvb, foffset, 4, FALSE);
3746                 foffset += 4;
3747                 proto_tree_add_item(ndps_tree, hf_sub_complete, tvb, foffset, 4, FALSE);
3748                 foffset += 4;
3749                 number_of_items = tvb_get_ntohl(tvb, foffset);
3750                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Transfer Method");
3751                 atree = proto_item_add_subtree(aitem, ett_ndps);
3752                 proto_tree_add_item(atree, hf_ndps_objects, tvb, foffset, 4, FALSE);
3753                 foffset += 4;
3754                 for (i = 1 ; i <= number_of_items; i++ )
3755                 {
3756                     foffset = objectidentifier(tvb, atree, foffset); /* Transfer Method */
3757                 }
3758                 proto_tree_add_item(ndps_tree, hf_doc_content, tvb, foffset, 4, FALSE);
3759                 foffset += 4;
3760                 number_of_items = tvb_get_ntohl(tvb, foffset);
3761                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Document Type");
3762                 atree = proto_item_add_subtree(aitem, ett_ndps);
3763                 proto_tree_add_item(atree, hf_ndps_objects, tvb, foffset, 4, FALSE);
3764                 foffset += 4;
3765                 for (i = 1 ; i <= number_of_items; i++ )
3766                 {
3767                     foffset = objectidentifier(tvb, atree, foffset); /* Document Type */
3768                 }
3769                 foffset += align_4(tvb, foffset);
3770                 number_of_items = tvb_get_ntohl(tvb, foffset);
3771                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Document Attributes");
3772                 atree = proto_item_add_subtree(aitem, ett_ndps);
3773                 proto_tree_add_item(atree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
3774                 foffset += 4;
3775                 for (i = 1 ; i <= number_of_items; i++ )
3776                 {
3777                     foffset = attribute_value(tvb, atree, foffset);  /* Document Attributes */
3778                 }
3779                 break;
3780             case 2:     /* Close Job */
3781                 foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
3782                 proto_tree_add_item(ndps_tree, hf_local_id, tvb, foffset, 4, FALSE);
3783                 foffset += 4;
3784                 break;
3785             default:
3786                 break;
3787             }
3788             break;
3789         case 0x00000005:    /* Modify Job */
3790             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
3791             foffset += 4;
3792             foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
3793             proto_tree_add_item(ndps_tree, hf_local_id, tvb, foffset, 4, FALSE);
3794             foffset += 4;
3795             proto_tree_add_item(ndps_tree, hf_ndps_document_number, tvb, foffset, 4, FALSE);
3796             foffset += 4;
3797             number_of_items = tvb_get_ntohl(tvb, foffset);
3798             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Job Modifications");
3799             atree = proto_item_add_subtree(aitem, ett_ndps);
3800             proto_tree_add_item(atree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
3801             foffset += 4;
3802             for (i = 1 ; i <= number_of_items; i++ )
3803             {
3804                 foffset = attribute_value(tvb, atree, foffset);  /* Job Modifications */
3805             }
3806             number_of_items = tvb_get_ntohl(tvb, foffset);
3807             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Document Modifications");
3808             atree = proto_item_add_subtree(aitem, ett_ndps);
3809             proto_tree_add_item(atree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
3810             foffset += 4;
3811             for (i = 1 ; i <= number_of_items; i++ )
3812             {
3813                 foffset = attribute_value(tvb, atree, foffset);  /* Document Modifications */
3814             }
3815             break;
3816         case 0x00000006:    /* Cancel Job */
3817             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
3818             foffset += 4;
3819             foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
3820             proto_tree_add_item(ndps_tree, hf_local_id, tvb, foffset, 4, FALSE);
3821             foffset += 4;
3822             proto_tree_add_item(ndps_tree, hf_ndps_document_number, tvb, foffset, 4, FALSE);
3823             foffset += 4;
3824             number_of_items = tvb_get_ntohl(tvb, foffset);
3825             /* Start of nameorid */
3826             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Cancel Message");
3827             atree = proto_item_add_subtree(aitem, ett_ndps);
3828             foffset = name_or_id(tvb, atree, foffset);
3829             /* End of nameorid */
3830             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Retention Period");
3831             atree = proto_item_add_subtree(aitem, ett_ndps);
3832             proto_tree_add_item(atree, hf_ndps_status_flags, tvb, foffset, 4, FALSE);
3833             foffset += 4;
3834             proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, 4, FALSE);
3835             foffset += 4;
3836              
3837             break;
3838         case 0x00000007:    /* List Object Attributes */
3839             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
3840             foffset += 4;
3841             proto_tree_add_item(ndps_tree, hf_ndps_attrs_arg, tvb, foffset, 4, FALSE);
3842             foffset += 4;
3843             if (tvb_get_ntohl(tvb, foffset-4)==0) /* Continuation */
3844             {
3845                 length = tvb_get_ntohl(tvb, foffset);
3846                 proto_tree_add_item(ndps_tree, hf_ndps_context, tvb, foffset, length, FALSE);
3847                 foffset += length;
3848                 foffset += (length%2);
3849                 proto_tree_add_item(ndps_tree, hf_ndps_abort_flag, tvb, foffset, 4, FALSE);
3850                 foffset += 4;
3851                 number_of_items = tvb_get_ntohl(tvb, foffset);
3852                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
3853                 atree = proto_item_add_subtree(aitem, ett_ndps);
3854                 foffset += 4;
3855                 for (i = 1 ; i <= number_of_items; i++ )
3856                 {
3857                     foffset = attribute_value(tvb, atree, foffset);
3858                 }
3859             }
3860             else                                  /* Specification */
3861             {
3862                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object Class");
3863                 atree = proto_item_add_subtree(aitem, ett_ndps);
3864                 foffset = objectidentifier(tvb, atree, foffset);
3865                 foffset += 4;
3866                 foffset += align_4(tvb, foffset);
3867                 proto_tree_add_item(ndps_tree, hf_ndps_scope, tvb, foffset, 4, FALSE);
3868                 foffset += 4;
3869                 if (tvb_get_ntohl(tvb, foffset-4)!=0)    /* Scope Does not equal 0 */
3870                 {
3871                     number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPSelector */
3872                     aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Selector Option");
3873                     atree = proto_item_add_subtree(aitem, ett_ndps);
3874                     proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
3875                     foffset += 4;
3876                     for (i = 1 ; i <= number_of_items; i++ )
3877                     {
3878                         foffset = objectidentification(tvb, atree, foffset);
3879                     }
3880                     foffset += align_4(tvb, foffset);
3881                     /*foffset += 4;*/
3882                     proto_tree_add_item(ndps_tree, hf_ndps_filter, tvb, foffset, 4, FALSE);
3883                     filter_type = tvb_get_ntohl(tvb, foffset);
3884                     foffset += 4;
3885                     /*if (filter_type == 0 || filter_type == 3 ) 
3886                     {
3887                         foffset = filteritem(tvb, ndps_tree, foffset);
3888                     }
3889                     else
3890                     {
3891                         aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
3892                         atree = proto_item_add_subtree(aitem, ett_ndps);
3893                         number_of_items = tvb_get_ntohl(tvb, foffset);
3894                         foffset += 4;
3895                         for (i = 1 ; i <= number_of_items; i++ )
3896                         {
3897                             foffset = filteritem(tvb, ndps_tree, foffset);
3898                         }
3899                     }*/
3900                     proto_tree_add_item(ndps_tree, hf_ndps_time_limit, tvb, foffset, 4, FALSE);
3901                     foffset += 4;
3902                     proto_tree_add_item(ndps_tree, hf_ndps_count_limit, tvb, foffset, 4, FALSE);
3903                     foffset += 4; /* End of NWDPSelector  */
3904                 }
3905                 foffset += 4;   /* Don't know what this is */
3906                 number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPObjectIdentifierSet */
3907                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Requested Attributes");
3908                 atree = proto_item_add_subtree(aitem, ett_ndps);
3909                 proto_tree_add_item(atree, hf_ndps_objects, tvb, foffset, 4, FALSE);
3910                 foffset += 4;
3911                 for (i = 1 ; i <= number_of_items; i++ )
3912                 {
3913                     foffset = objectidentifier(tvb, atree, foffset);
3914                 } /* End of NWDPObjectIdentifierSet */
3915                 proto_tree_add_item(ndps_tree, hf_ndps_operator, tvb, foffset, 4, FALSE);
3916                 foffset += 4;
3917                 number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
3918                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
3919                 atree = proto_item_add_subtree(aitem, ett_ndps);
3920                 proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
3921                 foffset += 4;
3922                 for (i = 1 ; i <= number_of_items; i++ )
3923                 {
3924                     foffset = attribute_value(tvb, atree, foffset);
3925                 } /* NWDPCommonArguments */
3926             }
3927             break;
3928         case 0x00000008:    /* Promote Job */
3929             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
3930             foffset += 4;
3931             /* Start of NWDPPrtContainedObjectId */
3932             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Job ID");
3933             atree = proto_item_add_subtree(aitem, ett_ndps);
3934             foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
3935             proto_tree_add_item(atree, hf_local_id, tvb, foffset, 4, FALSE);
3936             foffset += 4;
3937             /* End of NWDPPrtContainedObjectId */
3938             /* Start of nameorid */
3939             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Message Option");
3940             atree = proto_item_add_subtree(aitem, ett_ndps);
3941             foffset = name_or_id(tvb, atree, foffset);
3942             /* End of nameorid */
3943             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
3944             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
3945             atree = proto_item_add_subtree(aitem, ett_ndps);
3946             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
3947             foffset += 4;
3948             for (i = 1 ; i <= number_of_items; i++ )
3949             {
3950                 foffset = attribute_value(tvb, atree, foffset);
3951             } /* NWDPCommonArguments */
3952             break;
3953         case 0x00000009:    /* Interrupt */
3954             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
3955             foffset += 4;
3956             proto_tree_add_item(ndps_tree, hf_interrupt_job_type, tvb, foffset, 4, FALSE);
3957             foffset += 4;
3958             if (tvb_get_ntohl(tvb, foffset-4)==0)
3959             {
3960                 /* Start of NWDPPrtContainedObjectId */
3961                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Job ID");
3962                 atree = proto_item_add_subtree(aitem, ett_ndps);
3963                 foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
3964                 proto_tree_add_item(atree, hf_local_id, tvb, foffset, 4, FALSE);
3965                 foffset += 4;
3966                 /* End of NWDPPrtContainedObjectId */
3967             }
3968             else
3969             {
3970                 foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
3971             }
3972             /* Start of nameorid */
3973             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Interrupt Message Option");
3974             atree = proto_item_add_subtree(aitem, ett_ndps);
3975             foffset = name_or_id(tvb, atree, foffset);
3976             /* End of nameorid */
3977             /* Start of NWDPPrtContainedObjectId */
3978             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Interrupting Job");
3979             atree = proto_item_add_subtree(aitem, ett_ndps);
3980             foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
3981             proto_tree_add_item(atree, hf_local_id, tvb, foffset, 4, FALSE);
3982             foffset += 4;
3983             /* End of NWDPPrtContainedObjectId */
3984             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
3985             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
3986             atree = proto_item_add_subtree(aitem, ett_ndps);
3987             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
3988             foffset += 4;
3989             for (i = 1 ; i <= number_of_items; i++ )
3990             {
3991                 foffset = attribute_value(tvb, atree, foffset);
3992             } /* NWDPCommonArguments */
3993             break;
3994         case 0x0000000a:    /* Pause */
3995             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
3996             foffset += 4;
3997             proto_tree_add_item(ndps_tree, hf_pause_job_type, tvb, foffset, 4, FALSE);
3998             foffset += 4;
3999             if (tvb_get_ntohl(tvb, foffset-4)==0)
4000             {
4001                 /* Start of NWDPPrtContainedObjectId */
4002                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Job ID");
4003                 atree = proto_item_add_subtree(aitem, ett_ndps);
4004                 foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
4005                 proto_tree_add_item(atree, hf_local_id, tvb, foffset, 4, FALSE);
4006                 foffset += 4;
4007                 /* End of NWDPPrtContainedObjectId */
4008             }
4009             else
4010             {
4011                 foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
4012             }
4013             /* Start of nameorid */
4014             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Pause Message Option");
4015             atree = proto_item_add_subtree(aitem, ett_ndps);
4016             foffset = name_or_id(tvb, atree, foffset);
4017             /* End of nameorid */
4018             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
4019             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
4020             atree = proto_item_add_subtree(aitem, ett_ndps);
4021             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4022             foffset += 4;
4023             for (i = 1 ; i <= number_of_items; i++ )
4024             {
4025                 foffset = attribute_value(tvb, atree, foffset);
4026             } /* NWDPCommonArguments */
4027             break;
4028         case 0x0000000b:    /* Resume */
4029             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4030             foffset += 4;
4031             /* Start of NWDPPrtContainedObjectId */
4032             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Job ID");
4033             atree = proto_item_add_subtree(aitem, ett_ndps);
4034             foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
4035             proto_tree_add_item(atree, hf_local_id, tvb, foffset, 4, FALSE);
4036             foffset += 4;
4037             /* End of NWDPPrtContainedObjectId */
4038             /* Start of nameorid */
4039             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Resume Message Option");
4040             atree = proto_item_add_subtree(aitem, ett_ndps);
4041             foffset = name_or_id(tvb, atree, foffset);
4042             /* End of nameorid */
4043             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
4044             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
4045             atree = proto_item_add_subtree(aitem, ett_ndps);
4046             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4047             foffset += 4;
4048             for (i = 1 ; i <= number_of_items; i++ )
4049             {
4050                 foffset = attribute_value(tvb, atree, foffset);
4051             } /* NWDPCommonArguments */
4052             break;
4053         case 0x0000000c:    /* Clean */
4054             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4055             foffset += 4;
4056             /* Start of nameorid */
4057             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Clean Message Option");
4058             atree = proto_item_add_subtree(aitem, ett_ndps);
4059             foffset = name_or_id(tvb, atree, foffset);
4060             /* End of nameorid */
4061             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
4062             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
4063             atree = proto_item_add_subtree(aitem, ett_ndps);
4064             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4065             foffset += 4;
4066             for (i = 1 ; i <= number_of_items; i++ )
4067             {
4068                 foffset = attribute_value(tvb, atree, foffset);
4069             } /* NWDPCommonArguments */
4070             break;
4071         case 0x0000000d:    /* Create */
4072             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4073             foffset += 4;
4074             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object Class");
4075             atree = proto_item_add_subtree(aitem, ett_ndps);
4076             foffset = objectidentifier(tvb, atree, foffset);
4077             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object ID");
4078             atree = proto_item_add_subtree(aitem, ett_ndps);
4079             foffset = objectidentification(tvb, atree, foffset);
4080             proto_tree_add_item(ndps_tree, hf_ndps_force, tvb, foffset, 4, FALSE);
4081             foffset += 4;
4082             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Reference Object Option");
4083             atree = proto_item_add_subtree(aitem, ett_ndps);
4084             foffset = objectidentification(tvb, atree, foffset);
4085             /* Start of AttributeSet */
4086             number_of_items = tvb_get_ntohl(tvb, foffset);
4087             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object Attribute");
4088             atree = proto_item_add_subtree(aitem, ett_ndps);
4089             proto_tree_add_item(atree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
4090             foffset += 4;
4091             for (i = 1 ; i <= number_of_items; i++ )
4092             {
4093                 foffset = attribute_value(tvb, atree, foffset);  /* Object Attribute Set */
4094             }
4095             /* End of AttributeSet */
4096             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
4097             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
4098             atree = proto_item_add_subtree(aitem, ett_ndps);
4099             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4100             foffset += 4;
4101             for (i = 1 ; i <= number_of_items; i++ )
4102             {
4103                 foffset = attribute_value(tvb, atree, foffset);
4104             } /* NWDPCommonArguments */
4105             break;
4106         case 0x0000000e:    /* Delete */
4107             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4108             foffset += 4;
4109             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object Class");
4110             atree = proto_item_add_subtree(aitem, ett_ndps);
4111             foffset = objectidentifier(tvb, atree, foffset);
4112             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object ID");
4113             atree = proto_item_add_subtree(aitem, ett_ndps);
4114             foffset = objectidentification(tvb, atree, foffset);
4115             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
4116             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
4117             atree = proto_item_add_subtree(aitem, ett_ndps);
4118             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4119             foffset += 4;
4120             for (i = 1 ; i <= number_of_items; i++ )
4121             {
4122                 foffset = attribute_value(tvb, atree, foffset);
4123             } /* NWDPCommonArguments */
4124             break;
4125         case 0x0000000f:    /* Disable PA */
4126             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4127             foffset += 4;
4128             /* Start of NameorID */
4129             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Disable PA Message Option");
4130             atree = proto_item_add_subtree(aitem, ett_ndps);
4131             foffset = name_or_id(tvb, atree, foffset);
4132             /* End of NameorID */
4133             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
4134             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
4135             atree = proto_item_add_subtree(aitem, ett_ndps);
4136             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4137             foffset += 4;
4138             for (i = 1 ; i <= number_of_items; i++ )
4139             {
4140                 foffset = attribute_value(tvb, atree, foffset);
4141             } /* NWDPCommonArguments */
4142             break;
4143         case 0x00000010:    /* Enable PA */
4144             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4145             foffset += 4;
4146             /* Start of NameorID */
4147             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Enable PA Message Option");
4148             atree = proto_item_add_subtree(aitem, ett_ndps);
4149             foffset = name_or_id(tvb, atree, foffset);
4150             /* End of NameorID */
4151             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
4152             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
4153             atree = proto_item_add_subtree(aitem, ett_ndps);
4154             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4155             foffset += 4;
4156             for (i = 1 ; i <= number_of_items; i++ )
4157             {
4158                 foffset = attribute_value(tvb, atree, foffset);
4159             } /* NWDPCommonArguments */
4160             break;
4161         case 0x00000011:    /* Resubmit Jobs */
4162             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4163             foffset += 4;
4164             /* Start of QualifiedName */
4165             qualified_name_type = tvb_get_ntohl(tvb, foffset);
4166             proto_tree_add_uint(ndps_tree, hf_ndps_qualified_name, tvb, foffset, 
4167             4, qualified_name_type);
4168             foffset += 4;
4169             if (qualified_name_type != 0) {
4170                 if (qualified_name_type == 1) {
4171                     foffset = ndps_string(tvb, hf_printer_name, ndps_tree, foffset);
4172                 }
4173                 else
4174                 {
4175                     foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
4176                     foffset = ndps_string(tvb, hf_ndps_tree, ndps_tree, foffset);
4177                 }
4178             }
4179             /* End of QualifiedName */
4180             foffset = address_item(tvb, ndps_tree, foffset);
4181             proto_tree_add_item(ndps_tree, hf_resubmit_op_type, tvb, foffset, 4, FALSE);
4182             foffset += 4;
4183             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of ResubmitJob Set */
4184             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Resubmit Job");
4185             atree = proto_item_add_subtree(aitem, ett_ndps);
4186             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4187             foffset += 4;
4188             for (i = 1 ; i <= number_of_items; i++ )
4189             {
4190                 /* Start of NWDPPrtContainedObjectId */
4191                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Job ID");
4192                 btree = proto_item_add_subtree(bitem, ett_ndps);
4193                 foffset = ndps_string(tvb, hf_ndps_pa_name, btree, foffset);
4194                 proto_tree_add_item(btree, hf_local_id, tvb, foffset, 4, FALSE);
4195                 foffset += 4;
4196                 /* End of NWDPPrtContainedObjectId */
4197                 proto_tree_add_item(atree, hf_ndps_document_number, tvb, foffset, 4, FALSE);
4198                 foffset += 4;
4199                 /* Start of AttributeSet */
4200                 number_of_items = tvb_get_ntohl(tvb, foffset);
4201                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Job Attributes");
4202                 btree = proto_item_add_subtree(bitem, ett_ndps);
4203                 proto_tree_add_item(btree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
4204                 foffset += 4;
4205                 for (i = 1 ; i <= number_of_items; i++ )
4206                 {
4207                     foffset = attribute_value(tvb, btree, foffset);  /* Object Attribute Set */
4208                 }
4209                 /* End of AttributeSet */
4210                 /* Start of AttributeSet */
4211                 number_of_items = tvb_get_ntohl(tvb, foffset);
4212                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Document Attributes");
4213                 btree = proto_item_add_subtree(bitem, ett_ndps);
4214                 proto_tree_add_item(btree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
4215                 foffset += 4;
4216                 for (i = 1 ; i <= number_of_items; i++ )
4217                 {
4218                     foffset = attribute_value(tvb, btree, foffset);  /* Object Attribute Set */
4219                 }
4220                 /* End of AttributeSet */
4221             } /* End of ResubmitJob Set */
4222             /* Start of NameorID */
4223             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Resubmit Message Option");
4224             atree = proto_item_add_subtree(aitem, ett_ndps);
4225             foffset = name_or_id(tvb, atree, foffset);
4226             /* End of NameorID */
4227             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
4228             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
4229             atree = proto_item_add_subtree(aitem, ett_ndps);
4230             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4231             foffset += 4;
4232             for (i = 1 ; i <= number_of_items; i++ )
4233             {
4234                 foffset = attribute_value(tvb, atree, foffset);
4235             } /* NWDPCommonArguments */
4236             break;
4237         case 0x00000012:    /* Set */
4238             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4239             foffset += 4;
4240             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object Class");
4241             atree = proto_item_add_subtree(aitem, ett_ndps);
4242             foffset = objectidentifier(tvb, atree, foffset);
4243             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object ID");
4244             atree = proto_item_add_subtree(aitem, ett_ndps);
4245             foffset = objectidentification(tvb, atree, foffset);
4246             /* Start of AttributeSet */
4247             number_of_items = tvb_get_ntohl(tvb, foffset);
4248             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Attribute Modifications");
4249             atree = proto_item_add_subtree(aitem, ett_ndps);
4250             proto_tree_add_item(atree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
4251             foffset += 4;
4252             for (i = 1 ; i <= number_of_items; i++ )
4253             {
4254                 foffset = attribute_value(tvb, atree, foffset);  /* Object Attribute Set */
4255             }
4256             /* End of AttributeSet */
4257             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
4258             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
4259             atree = proto_item_add_subtree(aitem, ett_ndps);
4260             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4261             foffset += 4;
4262             for (i = 1 ; i <= number_of_items; i++ )
4263             {
4264                 foffset = attribute_value(tvb, atree, foffset);
4265             } /* NWDPCommonArguments */
4266             break;
4267         case 0x00000013:    /* Shutdown PA */
4268         case 0x0000001e:    /* Shutdown PSM */
4269             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4270             foffset += 4;
4271             proto_tree_add_item(ndps_tree, hf_shutdown_type, tvb, foffset, 4, FALSE);
4272             foffset += 4;
4273             foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
4274             /* Start of NameorID */
4275             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Shutdown Message Option");
4276             atree = proto_item_add_subtree(aitem, ett_ndps);
4277             foffset = name_or_id(tvb, atree, foffset);
4278             /* End of NameorID */
4279             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
4280             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
4281             atree = proto_item_add_subtree(aitem, ett_ndps);
4282             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4283             foffset += 4;
4284             for (i = 1 ; i <= number_of_items; i++ )
4285             {
4286                 foffset = attribute_value(tvb, atree, foffset);
4287             } /* NWDPCommonArguments */
4288             break;
4289         case 0x00000014:    /* Startup PA */
4290             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4291             foffset += 4;
4292             foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
4293             /* Start of NameorID */
4294             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Startup Message Option");
4295             atree = proto_item_add_subtree(aitem, ett_ndps);
4296             foffset = name_or_id(tvb, atree, foffset);
4297             /* End of NameorID */
4298             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
4299             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
4300             atree = proto_item_add_subtree(aitem, ett_ndps);
4301             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4302             foffset += 4;
4303             for (i = 1 ; i <= number_of_items; i++ )
4304             {
4305                 foffset = attribute_value(tvb, atree, foffset);
4306             } /* NWDPCommonArguments */
4307             break;
4308         case 0x00000015:    /* Reorder Job */
4309             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4310             foffset += 4;
4311             /* Start of NWDPPrtContainedObjectId */
4312             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Job Identification");
4313             atree = proto_item_add_subtree(aitem, ett_ndps);
4314             foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
4315             proto_tree_add_item(atree, hf_local_id, tvb, foffset, 4, FALSE);
4316             foffset += 4;
4317             /* End of NWDPPrtContainedObjectId */
4318             /* Start of NWDPPrtContainedObjectId */
4319             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Reference Job ID");
4320             atree = proto_item_add_subtree(aitem, ett_ndps);
4321             foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
4322             proto_tree_add_item(atree, hf_local_id, tvb, foffset, 4, FALSE);
4323             foffset += 4;
4324             /* End of NWDPPrtContainedObjectId */
4325             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
4326             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
4327             atree = proto_item_add_subtree(aitem, ett_ndps);
4328             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4329             foffset += 4;
4330             for (i = 1 ; i <= number_of_items; i++ )
4331             {
4332                 foffset = attribute_value(tvb, atree, foffset);
4333             } /* NWDPCommonArguments */
4334             break;
4335         case 0x00000016:    /* Pause PA */
4336             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4337             foffset += 4;
4338             /* Start of NameorID */
4339             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Pause Message Option");
4340             atree = proto_item_add_subtree(aitem, ett_ndps);
4341             foffset = name_or_id(tvb, atree, foffset);
4342             /* End of NameorID */
4343             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
4344             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
4345             atree = proto_item_add_subtree(aitem, ett_ndps);
4346             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4347             foffset += 4;
4348             for (i = 1 ; i <= number_of_items; i++ )
4349             {
4350                 foffset = attribute_value(tvb, atree, foffset);
4351             } /* NWDPCommonArguments */
4352             break;
4353         case 0x00000017:    /* Resume PA */
4354             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4355             foffset += 4;
4356             /* Start of NameorID */
4357             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Resume Message Option");
4358             atree = proto_item_add_subtree(aitem, ett_ndps);
4359             foffset = name_or_id(tvb, atree, foffset);
4360             /* End of NameorID */
4361             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
4362             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
4363             atree = proto_item_add_subtree(aitem, ett_ndps);
4364             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4365             foffset += 4;
4366             for (i = 1 ; i <= number_of_items; i++ )
4367             {
4368                 foffset = attribute_value(tvb, atree, foffset);
4369             } /* NWDPCommonArguments */
4370             break;
4371         case 0x00000018:    /* Transfer Data */
4372             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4373             foffset += 4;
4374             proto_tree_add_item(ndps_tree, hf_get_status_flag, tvb, foffset, 4, FALSE);
4375             foffset += 4;
4376             proto_tree_add_item(ndps_tree, hf_ndps_data, tvb, foffset+4, tvb_get_ntohl(tvb, foffset), FALSE);
4377             break;
4378         case 0x00000019:    /* Device Control */
4379             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4380             foffset += 4;
4381             /* Start of Object Identifier */
4382             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Operation ID");
4383             atree = proto_item_add_subtree(aitem, ett_ndps);
4384             foffset = objectidentifier(tvb, atree, foffset);
4385             /* End of Object Identifier */
4386             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
4387             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
4388             atree = proto_item_add_subtree(aitem, ett_ndps);
4389             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4390             foffset += 4;
4391             for (i = 1 ; i <= number_of_items; i++ )
4392             {
4393                 foffset = attribute_value(tvb, atree, foffset);
4394             } /* NWDPCommonArguments */
4395             break;
4396         case 0x0000001a:    /* Add Event Profile */
4397             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4398             foffset += 4;
4399             /* Start of Eventhandling */
4400             proto_tree_add_item(ndps_tree, hf_ndps_profile_id, tvb, foffset, 4, FALSE);
4401             foffset += 4;
4402             proto_tree_add_item(ndps_tree, hf_ndps_persistence, tvb, foffset, 4, FALSE);
4403             foffset += 4;
4404             /* Start of QualifiedName */
4405             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Consumer Name");
4406             atree = proto_item_add_subtree(aitem, ett_ndps);
4407             qualified_name_type = tvb_get_ntohl(tvb, foffset);
4408             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
4409             4, qualified_name_type);
4410             foffset += 4;
4411             if (qualified_name_type != 0) {
4412                 if (qualified_name_type == 1) {
4413                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
4414                 }
4415                 else
4416                 {
4417                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
4418                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
4419                 }
4420             }
4421             /* End of QualifiedName */
4422             length = tvb_get_ntohl(tvb, foffset);
4423             foffset += 4;
4424             proto_tree_add_item(ndps_tree, hf_ndps_attribute_value, tvb, foffset, length, FALSE);
4425             foffset += length;
4426             proto_tree_add_item(ndps_tree, hf_ndps_language_id, tvb, foffset, 4, FALSE);
4427             foffset += 4;
4428             /* Start of NameorID */
4429             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Method ID");
4430             atree = proto_item_add_subtree(aitem, ett_ndps);
4431             foffset = name_or_id(tvb, atree, foffset);
4432             /* End of NameorID */
4433             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Delivery Address");
4434             atree = proto_item_add_subtree(aitem, ett_ndps);
4435             number_of_items = tvb_get_ntohl(tvb, foffset);
4436             for (i = 1 ; i <= number_of_items; i++ )
4437             {
4438                 foffset += address_item(tvb, atree, foffset);
4439             }
4440             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Event Object");
4441             atree = proto_item_add_subtree(aitem, ett_ndps);
4442             number_of_items = tvb_get_ntohl(tvb, foffset);
4443             for (i = 1 ; i <= number_of_items; i++ )
4444             {
4445                 proto_tree_add_item(atree, hf_ndps_event_type, tvb, foffset, 4, FALSE);
4446                 foffset += 4;
4447                 foffset = objectidentifier(tvb, atree, foffset);
4448                 foffset = objectidentification(tvb, atree, foffset);
4449                 proto_tree_add_item(atree, hf_ndps_object_op, tvb, foffset, 4, FALSE);
4450                 foffset += 4;
4451                 
4452                 proto_tree_add_uint(atree, hf_ndps_event_object_identifier, tvb, foffset, 4, FALSE);
4453                 foffset += 4;
4454                 if(tvb_get_ntohl(tvb, foffset-4)==1)
4455                 {
4456                     foffset = objectidentifier(tvb, atree, foffset);
4457                 }
4458                 else
4459                 {
4460                     if(tvb_get_ntohl(tvb, foffset-4)==0)
4461                     {
4462                         number_of_items2 = tvb_get_ntohl(tvb, foffset);
4463                         proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, number_of_items2);
4464                         foffset += 4;
4465                         for (j = 1 ; j <= number_of_items2; j++ )
4466                         {
4467                             foffset = objectidentifier(tvb, atree, foffset);
4468                         }
4469                     }
4470                 }
4471             }
4472             /* End of Eventhandling */
4473             /* Start of QualifiedName */
4474             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Account");
4475             atree = proto_item_add_subtree(aitem, ett_ndps);
4476             qualified_name_type = tvb_get_ntohl(tvb, foffset);
4477             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
4478             4, qualified_name_type);
4479             foffset += 4;
4480             if (qualified_name_type != 0) {
4481                 if (qualified_name_type == 1) {
4482                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
4483                 }
4484                 else
4485                 {
4486                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
4487                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
4488                 }
4489             }
4490             /* End of QualifiedName */
4491             break;
4492         case 0x0000001b:    /* Remove Event Profile */
4493             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4494             foffset += 4;
4495             proto_tree_add_item(ndps_tree, hf_ndps_profile_id, tvb, foffset, 4, FALSE);
4496             foffset += 4;
4497             break;
4498         case 0x0000001c:    /* Modify Event Profile */
4499             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4500             foffset += 4;
4501             proto_tree_add_item(ndps_tree, hf_ndps_profile_id, tvb, foffset, 4, FALSE);
4502             foffset += 4;
4503             proto_tree_add_item(ndps_tree, hf_ndps_supplier_flag, tvb, foffset, 4, FALSE);
4504             foffset += 4;
4505             if (tvb_get_ntohl(tvb, foffset-4)==TRUE) 
4506             {
4507                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Supplier ID");
4508                 atree = proto_item_add_subtree(aitem, ett_ndps);
4509                 length = tvb_get_ntohl(tvb, foffset);
4510                 foffset += 4;
4511                 proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, length, FALSE);
4512                 foffset += length;
4513             }
4514             aitem = proto_tree_add_item(ndps_tree, hf_ndps_language_flag, tvb, foffset, 4, FALSE);
4515             atree = proto_item_add_subtree(aitem, ett_ndps);
4516             foffset += 4;
4517             if (tvb_get_ntohl(tvb, foffset-4)==TRUE) 
4518             {
4519                 proto_tree_add_item(atree, hf_ndps_language_id, tvb, foffset, 4, FALSE);
4520                 foffset += 4;
4521             }
4522             aitem = proto_tree_add_item(ndps_tree, hf_ndps_method_flag, tvb, foffset, 4, FALSE);
4523             atree = proto_item_add_subtree(aitem, ett_ndps);
4524             foffset += 4;
4525             if (tvb_get_ntohl(tvb, foffset-4)==TRUE) 
4526             {
4527                 /* Start of NameorID */
4528                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Method ID");
4529                 btree = proto_item_add_subtree(bitem, ett_ndps);
4530                 foffset = name_or_id(tvb, btree, foffset);
4531                 /* End of NameorID */
4532             }
4533             aitem = proto_tree_add_item(ndps_tree, hf_ndps_delivery_address_flag, tvb, foffset, 4, FALSE);
4534             atree = proto_item_add_subtree(aitem, ett_ndps);
4535             foffset += 4;
4536             if (tvb_get_ntohl(tvb, foffset-4)==TRUE) 
4537             {
4538                 foffset = print_address(tvb, atree, foffset);
4539             }
4540             /* Start of EventObjectSet */
4541             length = tvb_get_ntohl(tvb, foffset);   /* Len of record */
4542             if (length > 0) 
4543             {
4544                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Event Object");
4545                 atree = proto_item_add_subtree(aitem, ett_ndps);
4546                 proto_tree_add_item(atree, hf_ndps_event_type, tvb, foffset, 4, FALSE);
4547                 foffset += 4;
4548                 /* Start of objectidentifier */
4549                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Class ID");
4550                 btree = proto_item_add_subtree(bitem, ett_ndps);
4551                 foffset = objectidentifier(tvb, btree, foffset);
4552                 /* End of objectidentifier */
4553                 /* Start of objectidentification */
4554                 bitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object ID");
4555                 btree = proto_item_add_subtree(bitem, ett_ndps);
4556                 foffset = objectidentification(tvb, btree, foffset);
4557                 /* End of objectidentification */
4558                 proto_tree_add_item(atree, hf_ndps_object_op, tvb, foffset, 4, FALSE);
4559                 foffset += 4;
4560                 /* Start of ObjectItem */
4561                 proto_tree_add_uint(atree, hf_ndps_event_object_identifier, tvb, foffset, 4, FALSE);
4562                 foffset += 4;
4563                 if(tvb_get_ntohl(tvb, foffset-4)==1)
4564                 {
4565                     foffset = objectidentifier(tvb, atree, foffset);
4566                 }
4567                 else
4568                 {
4569                     if(tvb_get_ntohl(tvb, foffset-4)==0)
4570                     {
4571                         number_of_items = tvb_get_ntohl(tvb, foffset);
4572                         proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, number_of_items);
4573                         foffset += 4;
4574                         for (j = 1 ; j <= number_of_items; j++ )
4575                         {
4576                             foffset = objectidentifier(tvb, atree, foffset);
4577                         }
4578                     }
4579                 }
4580                 /* End of ObjectItem */
4581             }
4582             /* End of EventObjectSet */
4583             break;
4584         case 0x0000001d:    /* List Event Profiles */
4585             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4586             foffset += 4;
4587             proto_tree_add_item(ndps_tree, hf_ndps_list_profiles_type, tvb, foffset, 4, FALSE);
4588             foffset += 4;
4589             if (tvb_get_ntohl(tvb, foffset-4)==0)   /* Spec */
4590             {
4591                 /* Start of QualifiedName */
4592                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Supplier Alias");
4593                 atree = proto_item_add_subtree(aitem, ett_ndps);
4594                 qualified_name_type = tvb_get_ntohl(tvb, foffset);
4595                 proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
4596                 4, qualified_name_type);
4597                 foffset += 4;
4598                 if (qualified_name_type != 0) {
4599                     if (qualified_name_type == 1) {
4600                         foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
4601                     }
4602                     else
4603                     {
4604                         foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
4605                         foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
4606                     }
4607                 }
4608                 /* End of QualifiedName */
4609                 proto_tree_add_item(ndps_tree, hf_ndps_list_profiles_choice_type, tvb, foffset, 4, FALSE);
4610                 foffset += 4;
4611                 if (tvb_get_ntohl(tvb, foffset-4)==0)   /* Choice */
4612                 {
4613                     /* Start of CardinalSeq */
4614                     proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4615                     number_of_items = tvb_get_ntohl(tvb, foffset);
4616                     foffset += 4;
4617                     for (i = 1 ; i <= number_of_items; i++ )
4618                     {
4619                         length = tvb_get_ntohl(tvb, foffset);
4620                         foffset += 4;
4621                         proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, length, FALSE);
4622                         foffset += length;
4623                         foffset += (length%2);
4624                     }
4625                     /* End of CardinalSeq */
4626                 }
4627                 else
4628                 {
4629                     /* Start of QualifiedName */
4630                     aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Consumer");
4631                     atree = proto_item_add_subtree(aitem, ett_ndps);
4632                     qualified_name_type = tvb_get_ntohl(tvb, foffset);
4633                     proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
4634                     4, qualified_name_type);
4635                     foffset += 4;
4636                     if (qualified_name_type != 0) {
4637                         if (qualified_name_type == 1) {
4638                             foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
4639                         }
4640                         else
4641                         {
4642                             foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
4643                             foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
4644                         }
4645                     }
4646                     /* End of QualifiedName */
4647                     /* Start of NameorID */
4648                     aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Method ID");
4649                     atree = proto_item_add_subtree(aitem, ett_ndps);
4650                     foffset = name_or_id(tvb, atree, foffset);
4651                     /* End of NameorID */
4652                     proto_tree_add_item(atree, hf_ndps_language_id, tvb, foffset, 4, FALSE);
4653                     foffset += 4;
4654                 }
4655                 proto_tree_add_item(ndps_tree, hf_ndps_list_profiles_result_type, tvb, foffset, 4, FALSE);
4656                 foffset += 4;
4657                 /* Start of integeroption */
4658                 proto_tree_add_item(ndps_tree, hf_ndps_integer_type_flag, tvb, foffset, 4, FALSE);
4659                 foffset += 4;
4660                 if (tvb_get_ntohl(tvb, foffset-4)!=0) 
4661                 {
4662                     proto_tree_add_item(ndps_tree, hf_ndps_integer_type_value, tvb, foffset, 4, FALSE);
4663                     foffset += 4;
4664                 }
4665                 /* End of integeroption */
4666             }
4667             else                                    /* Cont */
4668             {
4669                 length = tvb_get_ntohl(tvb, foffset);
4670                 proto_tree_add_item(ndps_tree, hf_ndps_context, tvb, foffset, length, FALSE);
4671                 foffset += length;
4672                 foffset += (length%2);
4673                 proto_tree_add_item(ndps_tree, hf_ndps_abort_flag, tvb, foffset, 4, FALSE);
4674                 foffset += 4;
4675             }
4676             break;
4677         case 0x0000001f:    /* Cancel PSM Shutdown */
4678             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4679             foffset += 4;
4680             /* Start of NameorID */
4681             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Cancel Shutdown Message Option");
4682             atree = proto_item_add_subtree(aitem, ett_ndps);
4683             foffset = name_or_id(tvb, atree, foffset);
4684             /* End of NameorID */
4685             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
4686             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
4687             atree = proto_item_add_subtree(aitem, ett_ndps);
4688             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4689             foffset += 4;
4690             for (i = 1 ; i <= number_of_items; i++ )
4691             {
4692                 foffset = attribute_value(tvb, atree, foffset);
4693             } /* NWDPCommonArguments */
4694             break;
4695         case 0x00000020:    /* Set Printer DS Information */
4696             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4697             foffset += 4;
4698             proto_tree_add_item(ndps_tree, hf_ndps_ds_info_type, tvb, foffset, 4, FALSE);
4699             foffset += 4;
4700             foffset = ndps_string(tvb, hf_printer_name, ndps_tree, foffset);
4701             /* Start of QualifiedName */
4702             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "DS Object Name");
4703             atree = proto_item_add_subtree(aitem, ett_ndps);
4704             qualified_name_type = tvb_get_ntohl(tvb, foffset);
4705             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
4706             4, qualified_name_type);
4707             foffset += 4;
4708             if (qualified_name_type != 0) {
4709                 if (qualified_name_type == 1) {
4710                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
4711                 }
4712                 else
4713                 {
4714                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
4715                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
4716                 }
4717             }
4718             /* End of QualifiedName */
4719             break;
4720         case 0x00000021:    /* Clean User Jobs */
4721             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
4722             foffset += 4;
4723             /* Start of NameorID */
4724             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Clean Message Option");
4725             atree = proto_item_add_subtree(aitem, ett_ndps);
4726             foffset = name_or_id(tvb, atree, foffset);
4727             /* End of NameorID */
4728             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of NWDPCommonArguments */
4729             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Common Arguments");
4730             atree = proto_item_add_subtree(aitem, ett_ndps);
4731             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4732             foffset += 4;
4733             for (i = 1 ; i <= number_of_items; i++ )
4734             {
4735                 foffset = attribute_value(tvb, atree, foffset);
4736             } /* NWDPCommonArguments */
4737             break;
4738         case 0x00000022:    /* Map GUID to NDS Name */
4739             length = tvb_get_ntohl(tvb, foffset);
4740             foffset += 4;
4741             proto_tree_add_item(ndps_tree, hf_ndps_guid, tvb, foffset, length, FALSE);
4742             foffset += length;
4743             break;
4744         default:
4745             break;
4746         }
4747         break;
4748     case 0x060977:  /* Broker */
4749         switch(ndps_func)
4750         {
4751         case 0x00000001:    /* Bind */
4752             /* Start of credentials */
4753             cred_type = tvb_get_ntohl(tvb, foffset);
4754             proto_tree_add_item(ndps_tree, hf_ndps_cred_type, tvb, foffset, 4, FALSE);
4755             foffset += 4;
4756             switch (cred_type)
4757             {
4758             case 0:
4759                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
4760                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4761                 atree = proto_item_add_subtree(aitem, ett_ndps);
4762                 foffset += 4;
4763                 for (i = 1 ; i <= number_of_items; i++ )
4764                 {
4765                     length = tvb_get_ntohl(tvb, foffset);
4766                     foffset += 4;
4767                     proto_tree_add_item(ndps_tree, hf_ndps_password, tvb, foffset, length, FALSE);
4768                     foffset += length;
4769                 }
4770                 break;
4771             case 1:
4772                 length = tvb_get_ntohl(tvb, foffset);
4773                 foffset += 4;
4774                 proto_tree_add_item(ndps_tree, hf_ndps_certified, tvb, foffset, length, FALSE);
4775                 foffset += length;
4776                 break;
4777             case 2:
4778                 name_len = tvb_get_ntohl(tvb, foffset);
4779                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
4780                 foffset += align_4(tvb, foffset);
4781                 foffset += 2;
4782                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
4783                 2, FALSE);
4784                 foffset += 2;
4785                 break;
4786             case 3:
4787                 name_len = tvb_get_ntohl(tvb, foffset);
4788                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
4789                 foffset += align_4(tvb, foffset);
4790                 foffset += 2;
4791                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
4792                 2, FALSE);
4793                 foffset += 2;
4794                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
4795                 break;
4796             case 4:
4797                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
4798                 foffset += align_4(tvb, foffset);
4799                 foffset += 2;
4800                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
4801                 2, FALSE);
4802                 foffset += 2;
4803                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
4804                 foffset += 8;   /* Don't know what these 8 bytes signify */
4805                 proto_tree_add_item(ndps_tree, hf_ndps_items, tvb, foffset,
4806                 4, FALSE);
4807                 foffset += 4;
4808                 foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
4809                 foffset = ndps_string(tvb, hf_ndps_tree, ndps_tree, foffset);
4810                 break;
4811             default:
4812                 break;
4813             }
4814             /* End of credentials */
4815             proto_tree_add_item(ndps_tree, hf_ndps_retrieve_restrictions, tvb, foffset, 4, FALSE);
4816             foffset += 4;
4817             aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4818             atree = proto_item_add_subtree(aitem, ett_ndps);
4819             foffset += 4;
4820             for (i = 1 ; i <= number_of_items; i++ )
4821             {
4822                 length = tvb_get_ntohl(tvb, foffset);
4823                 foffset += 4;
4824                 proto_tree_add_item(ndps_tree, hf_bind_security, tvb, foffset, length, FALSE);
4825             }
4826             break;
4827         case 0x00000002:    /* Unbind */
4828             break;
4829         case 0x00000003:    /* List Services */
4830             proto_tree_add_item(ndps_tree, hf_ndps_list_services_type, tvb, foffset, 4, FALSE);
4831             foffset += 4;
4832             break;
4833         case 0x00000004:    /* Enable Service */
4834             proto_tree_add_item(ndps_tree, hf_ndps_service_type, tvb, foffset, 4, FALSE);
4835             foffset += 4;
4836             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Parameters");
4837             atree = proto_item_add_subtree(aitem, ett_ndps);
4838             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4839             foffset += 4;
4840             for (i = 1 ; i <= number_of_items; i++ )
4841             {
4842                 length = tvb_get_ntohl(tvb, foffset);
4843                 foffset += 4;
4844                 proto_tree_add_item(ndps_tree, hf_ndps_item_bytes, tvb, foffset, length, FALSE);
4845                 foffset += length;
4846             } 
4847             break;
4848         case 0x00000005:    /* Disable Service */
4849             proto_tree_add_item(ndps_tree, hf_ndps_list_services_type, tvb, foffset, 4, FALSE);
4850             foffset += 4;
4851             break;
4852         case 0x00000006:    /* Down Broker */
4853         case 0x00000007:    /* Get Broker NDS Object Name */
4854         case 0x00000008:    /* Get Broker Session Information */
4855         default:
4856             break;
4857         }
4858         break;
4859     case 0x060978:  /* Registry */
4860         switch(ndps_func)
4861         {
4862         case 0x00000001:    /* Bind */
4863             /* Start of credentials */
4864             cred_type = tvb_get_ntohl(tvb, foffset);
4865             proto_tree_add_item(ndps_tree, hf_ndps_cred_type, tvb, foffset, 4, FALSE);
4866             foffset += 4;
4867             switch (cred_type)
4868             {
4869             case 0:
4870                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
4871                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4872                 atree = proto_item_add_subtree(aitem, ett_ndps);
4873                 foffset += 4;
4874                 for (i = 1 ; i <= number_of_items; i++ )
4875                 {
4876                     length = tvb_get_ntohl(tvb, foffset);
4877                     foffset += 4;
4878                     proto_tree_add_item(ndps_tree, hf_ndps_password, tvb, foffset, length, FALSE);
4879                     foffset += length;
4880                 }
4881                 break;
4882             case 1:
4883                 length = tvb_get_ntohl(tvb, foffset);
4884                 foffset += 4;
4885                 proto_tree_add_item(ndps_tree, hf_ndps_certified, tvb, foffset, length, FALSE);
4886                 foffset += length;
4887                 break;
4888             case 2:
4889                 name_len = tvb_get_ntohl(tvb, foffset);
4890                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
4891                 foffset += align_4(tvb, foffset);
4892                 foffset += 2;
4893                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
4894                 2, FALSE);
4895                 foffset += 2;
4896                 break;
4897             case 3:
4898                 name_len = tvb_get_ntohl(tvb, foffset);
4899                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
4900                 foffset += align_4(tvb, foffset);
4901                 foffset += 2;
4902                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
4903                 2, FALSE);
4904                 foffset += 2;
4905                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
4906                 break;
4907             case 4:
4908                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
4909                 foffset += align_4(tvb, foffset);
4910                 foffset += 2;
4911                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
4912                 2, FALSE);
4913                 foffset += 2;
4914                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
4915                 foffset += 8;   /* Don't know what these 8 bytes signify */
4916                 proto_tree_add_item(ndps_tree, hf_ndps_items, tvb, foffset,
4917                 4, FALSE);
4918                 foffset += 4;
4919                 foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
4920                 foffset = ndps_string(tvb, hf_ndps_tree, ndps_tree, foffset);
4921                 break;
4922             default:
4923                 break;
4924             }
4925             /* End of credentials */
4926             proto_tree_add_item(ndps_tree, hf_ndps_retrieve_restrictions, tvb, foffset, 4, FALSE);
4927             foffset += 4;
4928             aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4929             atree = proto_item_add_subtree(aitem, ett_ndps);
4930             foffset += 4;
4931             for (i = 1 ; i <= number_of_items; i++ )
4932             {
4933                 length = tvb_get_ntohl(tvb, foffset);
4934                 foffset += 4;
4935                 proto_tree_add_item(ndps_tree, hf_bind_security, tvb, foffset, length, FALSE);
4936             }
4937             break;
4938         case 0x00000002:    /* Unbind */
4939             break;
4940         case 0x00000003:    /* Register Server */
4941             /* Start of Server Entry */
4942             foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
4943             aitem = proto_tree_add_item(ndps_tree, hf_ndps_server_type, tvb, foffset, 4, FALSE);
4944             atree = proto_item_add_subtree(aitem, ett_ndps);
4945             foffset += 4;
4946             foffset = print_address(tvb, atree, foffset);
4947             bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Server Info");
4948             btree = proto_item_add_subtree(bitem, ett_ndps);
4949             number_of_items2 = tvb_get_ntohl(tvb, foffset); 
4950             proto_tree_add_item(btree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
4951             foffset += 4;
4952             for (j = 1 ; j <= number_of_items2; j++ )
4953             {
4954                 data_type = tvb_get_ntohl(tvb, foffset);
4955                 proto_tree_add_item(btree, hf_ndps_data_item_type, tvb, foffset, 4, FALSE);
4956                 foffset += 4;
4957                 switch (data_type) 
4958                 {
4959                 case 0:   /* Int8 */
4960                     proto_tree_add_item(btree, hf_info_int, tvb, foffset, 1, FALSE);
4961                     foffset++;
4962                     break;
4963                 case 1:   /* Int16 */
4964                     proto_tree_add_item(btree, hf_info_int16, tvb, foffset, 2, FALSE);
4965                     foffset += 2;
4966                     break;
4967                 case 2:   /* Int32 */
4968                     proto_tree_add_item(btree, hf_info_int32, tvb, foffset, 4, FALSE);
4969                     foffset += 4;
4970                     break;
4971                 case 3:   /* Boolean */
4972                     proto_tree_add_item(btree, hf_info_boolean, tvb, foffset, 4, FALSE);
4973                     foffset += 4;
4974                     break;
4975                 case 4:   /* String */
4976                 case 5:   /* Bytes */
4977                     foffset = ndps_string(tvb, hf_info_string, btree, foffset);
4978                     break;
4979                     /*length = tvb_get_ntohl(tvb, foffset);
4980                     foffset += 4;
4981                     proto_tree_add_item(btree, hf_info_bytes, tvb, foffset, length, FALSE);
4982                     foffset += length;
4983                     foffset += (length%4);*/
4984                     break;
4985                 default:
4986                     break;
4987                 }
4988             }
4989             /* End of Server Entry */
4990             break;
4991         case 0x00000004:    /* Deregister Server */
4992         case 0x00000006:    /* Deregister Registry */
4993         case 0x0000000b:    /* Get Registry NDS Object Name */
4994         case 0x0000000c:    /* Get Registry Session Information */
4995             /* NoOp */
4996             break;
4997         case 0x00000005:    /* Register Registry */
4998             foffset = ndps_string(tvb, hf_ndps_registry_name, ndps_tree, foffset);
4999             foffset = print_address(tvb, ndps_tree, foffset);
5000             break;
5001         case 0x00000007:    /* Registry Update */
5002             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Add");
5003             atree = proto_item_add_subtree(aitem, ett_ndps);
5004             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
5005             foffset += 4;
5006             for (i = 1 ; i <= number_of_items; i++ )
5007             {
5008                 /* Start of Server Entry */
5009                 foffset = ndps_string(tvb, hf_ndps_server_name, atree, foffset);
5010                 bitem = proto_tree_add_item(atree, hf_ndps_server_type, tvb, foffset, 4, FALSE);
5011                 btree = proto_item_add_subtree(bitem, ett_ndps);
5012                 foffset += 4;
5013                 foffset = print_address(tvb, btree, foffset);
5014                 citem = proto_tree_add_text(btree, tvb, foffset, 0, "Server Info");
5015                 ctree = proto_item_add_subtree(citem, ett_ndps);
5016                 number_of_items2 = tvb_get_ntohl(tvb, foffset); 
5017                 proto_tree_add_item(ctree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
5018                 foffset += 4;
5019                 for (j = 1 ; j <= number_of_items2; j++ )
5020                 {
5021                     data_type = tvb_get_ntohl(tvb, foffset);
5022                     proto_tree_add_item(ctree, hf_ndps_data_item_type, tvb, foffset, 4, FALSE);
5023                     foffset += 4;
5024                     switch (data_type) 
5025                     {
5026                     case 0:   /* Int8 */
5027                         proto_tree_add_item(ctree, hf_info_int, tvb, foffset, 1, FALSE);
5028                         foffset++;
5029                         break;
5030                     case 1:   /* Int16 */
5031                         proto_tree_add_item(ctree, hf_info_int16, tvb, foffset, 2, FALSE);
5032                         foffset += 2;
5033                         break;
5034                     case 2:   /* Int32 */
5035                         proto_tree_add_item(ctree, hf_info_int32, tvb, foffset, 4, FALSE);
5036                         foffset += 4;
5037                         break;
5038                     case 3:   /* Boolean */
5039                         proto_tree_add_item(ctree, hf_info_boolean, tvb, foffset, 4, FALSE);
5040                         foffset += 4;
5041                         break;
5042                     case 4:   /* String */
5043                     case 5:   /* Bytes */
5044                         foffset = ndps_string(tvb, hf_info_string, ctree, foffset);
5045                         break;
5046                         /*length = tvb_get_ntohl(tvb, foffset);
5047                         foffset += 4;
5048                         proto_tree_add_item(ctree, hf_info_bytes, tvb, foffset, length, FALSE);
5049                         foffset += length;
5050                         foffset += (length%4);*/
5051                         break;
5052                     default:
5053                         break;
5054                     }
5055                 }
5056                 /* End of Server Entry */
5057             }
5058             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Remove");
5059             atree = proto_item_add_subtree(aitem, ett_ndps);
5060             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
5061             foffset += 4;
5062             for (i = 1 ; i <= number_of_items; i++ )
5063             {
5064                 /* Start of Server Entry */
5065                 foffset = ndps_string(tvb, hf_ndps_server_name, atree, foffset);
5066                 bitem = proto_tree_add_item(atree, hf_ndps_server_type, tvb, foffset, 4, FALSE);
5067                 btree = proto_item_add_subtree(bitem, ett_ndps);
5068                 foffset += 4;
5069                 foffset = print_address(tvb, btree, foffset);
5070                 citem = proto_tree_add_text(btree, tvb, foffset, 0, "Server Info");
5071                 ctree = proto_item_add_subtree(citem, ett_ndps);
5072                 number_of_items2 = tvb_get_ntohl(tvb, foffset); 
5073                 proto_tree_add_item(ctree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
5074                 foffset += 4;
5075                 for (j = 1 ; j <= number_of_items2; j++ )
5076                 {
5077                     data_type = tvb_get_ntohl(tvb, foffset);
5078                     proto_tree_add_item(ctree, hf_ndps_data_item_type, tvb, foffset, 4, FALSE);
5079                     foffset += 4;
5080                     switch (data_type) 
5081                     {
5082                     case 0:   /* Int8 */
5083                         proto_tree_add_item(ctree, hf_info_int, tvb, foffset, 1, FALSE);
5084                         foffset++;
5085                         break;
5086                     case 1:   /* Int16 */
5087                         proto_tree_add_item(ctree, hf_info_int16, tvb, foffset, 2, FALSE);
5088                         foffset += 2;
5089                         break;
5090                     case 2:   /* Int32 */
5091                         proto_tree_add_item(ctree, hf_info_int32, tvb, foffset, 4, FALSE);
5092                         foffset += 4;
5093                         break;
5094                     case 3:   /* Boolean */
5095                         proto_tree_add_item(ctree, hf_info_boolean, tvb, foffset, 4, FALSE);
5096                         foffset += 4;
5097                         break;
5098                     case 4:   /* String */
5099                     case 5:   /* Bytes */
5100                         foffset = ndps_string(tvb, hf_info_string, ctree, foffset);
5101                         break;
5102                         /*length = tvb_get_ntohl(tvb, foffset);
5103                         foffset += 4;
5104                         proto_tree_add_item(ctree, hf_info_bytes, tvb, foffset, length, FALSE);
5105                         foffset += length;
5106                         foffset += (length%4);*/
5107                         break;
5108                     default:
5109                         break;
5110                     }
5111                 }
5112                 /* End of Server Entry */
5113             }
5114             break;
5115         case 0x00000008:    /* List Local Servers */
5116         case 0x00000009:    /* List Servers */
5117         case 0x0000000a:    /* List Known Registries */
5118             proto_tree_add_item(ndps_tree, hf_ndps_list_local_servers_type, tvb, foffset, 4, FALSE);
5119             foffset += 4;
5120             if (tvb_get_ntohl(tvb, foffset-4)==0) 
5121             {
5122                 /* Start of integeroption */
5123                 proto_tree_add_item(ndps_tree, hf_ndps_integer_type_flag, tvb, foffset, 4, FALSE);
5124                 foffset += 4;
5125                 if (tvb_get_ntohl(tvb, foffset-4)!=0) 
5126                 {
5127                     proto_tree_add_item(ndps_tree, hf_ndps_integer_type_value, tvb, foffset, 4, FALSE);
5128                     foffset += 4;
5129                 }
5130                 /* End of integeroption */
5131             }
5132             else
5133             {
5134                 length = tvb_get_ntohl(tvb, foffset);
5135                 proto_tree_add_item(ndps_tree, hf_ndps_context, tvb, foffset, length, FALSE);
5136                 foffset += length;
5137                 foffset += (length%2);
5138                 proto_tree_add_item(ndps_tree, hf_ndps_abort_flag, tvb, foffset, 4, FALSE);
5139                 foffset += 4;
5140             }
5141             break;
5142         default:
5143             break;
5144         }
5145         break;
5146     case 0x060979:  /* Notify */
5147         switch(ndps_func)
5148         {
5149         case 0x00000001:    /* Notify Bind */
5150             /* Start of credentials */
5151             cred_type = tvb_get_ntohl(tvb, foffset);
5152             proto_tree_add_item(ndps_tree, hf_ndps_cred_type, tvb, foffset, 4, FALSE);
5153             foffset += 4;
5154             switch (cred_type)
5155             {
5156             case 0:
5157                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
5158                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
5159                 atree = proto_item_add_subtree(aitem, ett_ndps);
5160                 foffset += 4;
5161                 for (i = 1 ; i <= number_of_items; i++ )
5162                 {
5163                     length = tvb_get_ntohl(tvb, foffset);
5164                     foffset += 4;
5165                     proto_tree_add_item(ndps_tree, hf_ndps_password, tvb, foffset, length, FALSE);
5166                     foffset += length;
5167                 }
5168                 break;
5169             case 1:
5170                 length = tvb_get_ntohl(tvb, foffset);
5171                 foffset += 4;
5172                 proto_tree_add_item(ndps_tree, hf_ndps_certified, tvb, foffset, length, FALSE);
5173                 foffset += length;
5174                 break;
5175             case 2:
5176                 name_len = tvb_get_ntohl(tvb, foffset);
5177                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
5178                 foffset += align_4(tvb, foffset);
5179                 foffset += 2;
5180                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
5181                 2, FALSE);
5182                 foffset += 2;
5183                 break;
5184             case 3:
5185                 name_len = tvb_get_ntohl(tvb, foffset);
5186                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
5187                 foffset += align_4(tvb, foffset);
5188                 foffset += 2;
5189                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
5190                 2, FALSE);
5191                 foffset += 2;
5192                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
5193                 break;
5194             case 4:
5195                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
5196                 foffset += align_4(tvb, foffset);
5197                 foffset += 2;
5198                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
5199                 2, FALSE);
5200                 foffset += 2;
5201                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
5202                 foffset += 8;   /* Don't know what these 8 bytes signify */
5203                 proto_tree_add_item(ndps_tree, hf_ndps_items, tvb, foffset,
5204                 4, FALSE);
5205                 foffset += 4;
5206                 foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
5207                 foffset = ndps_string(tvb, hf_ndps_tree, ndps_tree, foffset);
5208                 break;
5209             default:
5210                 break;
5211             }
5212             /* End of credentials */
5213             proto_tree_add_item(ndps_tree, hf_ndps_retrieve_restrictions, tvb, foffset, 4, FALSE);
5214             foffset += 4;
5215             aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
5216             atree = proto_item_add_subtree(aitem, ett_ndps);
5217             foffset += 4;
5218             for (i = 1 ; i <= number_of_items; i++ )
5219             {
5220                 length = tvb_get_ntohl(tvb, foffset);
5221                 foffset += 4;
5222                 proto_tree_add_item(ndps_tree, hf_bind_security, tvb, foffset, length, FALSE);
5223             }
5224             break;
5225         case 0x00000002:    /* Notify Unbind */
5226         case 0x0000000a:    /* List Supported Languages */
5227         case 0x00000010:    /* Get Notify NDS Object Name */
5228         case 0x00000011:    /* Get Notify Session Information */
5229             /* NoOp */
5230             break;
5231         case 0x00000003:    /* Register Supplier */
5232             foffset = ndps_string(tvb, hf_ndps_supplier_name, ndps_tree, foffset);
5233             /* Start of QualifiedName Set*/
5234             aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
5235             atree = proto_item_add_subtree(aitem, ett_ndps);
5236             foffset += 4;
5237             for (i = 1 ; i <= number_of_items; i++ )
5238             {
5239                 /* Start of QualifiedName */
5240                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Supplier Alias");
5241                 btree = proto_item_add_subtree(bitem, ett_ndps);
5242                 qualified_name_type = tvb_get_ntohl(tvb, foffset);
5243                 proto_tree_add_uint(btree, hf_ndps_qualified_name, tvb, foffset, 
5244                 4, qualified_name_type);
5245                 foffset += 4;
5246                 if (qualified_name_type != 0) {
5247                     if (qualified_name_type == 1) {
5248                         foffset = ndps_string(tvb, hf_printer_name, btree, foffset);
5249                     }
5250                     else
5251                     {
5252                         foffset = ndps_string(tvb, hf_ndps_pa_name, btree, foffset);
5253                         foffset = ndps_string(tvb, hf_ndps_tree, btree, foffset);
5254                     }
5255                 }
5256                 /* End of QualifiedName */
5257             }
5258             /* End of QualifiedName Set*/
5259             break;
5260         case 0x00000004:    /* Deregister Supplier */
5261             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
5262             foffset += 4;
5263             break;
5264         case 0x00000005:    /* Add Profile */
5265             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
5266             foffset += 4;
5267             /* Start of QualifiedName */
5268             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Supplier Alias");
5269             atree = proto_item_add_subtree(aitem, ett_ndps);
5270             qualified_name_type = tvb_get_ntohl(tvb, foffset);
5271             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
5272             4, qualified_name_type);
5273             foffset += 4;
5274             if (qualified_name_type != 0) {
5275                 if (qualified_name_type == 1) {
5276                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
5277                 }
5278                 else
5279                 {
5280                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
5281                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
5282                 }
5283             }
5284             /* End of QualifiedName */
5285             /* Start of Eventhandling */
5286             proto_tree_add_item(ndps_tree, hf_ndps_profile_id, tvb, foffset, 4, FALSE);
5287             foffset += 4;
5288             proto_tree_add_item(ndps_tree, hf_ndps_persistence, tvb, foffset, 4, FALSE);
5289             foffset += 4;
5290             /* Start of QualifiedName */
5291             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Consumer Name");
5292             atree = proto_item_add_subtree(aitem, ett_ndps);
5293             qualified_name_type = tvb_get_ntohl(tvb, foffset);
5294             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
5295             4, qualified_name_type);
5296             foffset += 4;
5297             if (qualified_name_type != 0) {
5298                 if (qualified_name_type == 1) {
5299                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
5300                 }
5301                 else
5302                 {
5303                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
5304                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
5305                 }
5306             }
5307             /* End of QualifiedName */
5308             length = tvb_get_ntohl(tvb, foffset);
5309             foffset += 4;
5310             proto_tree_add_item(ndps_tree, hf_ndps_attribute_value, tvb, foffset, length, FALSE);
5311             foffset += length;
5312             proto_tree_add_item(ndps_tree, hf_ndps_language_id, tvb, foffset, 4, FALSE);
5313             foffset += 4;
5314             /* Start of NameorID */
5315             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Method ID");
5316             atree = proto_item_add_subtree(aitem, ett_ndps);
5317             foffset = name_or_id(tvb, atree, foffset);
5318             /* End of NameorID */
5319             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Delivery Address");
5320             atree = proto_item_add_subtree(aitem, ett_ndps);
5321             number_of_items = tvb_get_ntohl(tvb, foffset);
5322             for (i = 1 ; i <= number_of_items; i++ )
5323             {
5324                 foffset += address_item(tvb, atree, foffset);
5325             }
5326             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Event Object");
5327             atree = proto_item_add_subtree(aitem, ett_ndps);
5328             number_of_items = tvb_get_ntohl(tvb, foffset);
5329             for (i = 1 ; i <= number_of_items; i++ )
5330             {
5331                 proto_tree_add_item(atree, hf_ndps_event_type, tvb, foffset, 4, FALSE);
5332                 foffset += 4;
5333                 foffset = objectidentifier(tvb, atree, foffset);
5334                 foffset = objectidentification(tvb, atree, foffset);
5335                 proto_tree_add_item(atree, hf_ndps_object_op, tvb, foffset, 4, FALSE);
5336                 foffset += 4;
5337                 
5338                 proto_tree_add_uint(atree, hf_ndps_event_object_identifier, tvb, foffset, 4, FALSE);
5339                 foffset += 4;
5340                 if(tvb_get_ntohl(tvb, foffset-4)==1)
5341                 {
5342                     foffset = objectidentifier(tvb, atree, foffset);
5343                 }
5344                 else
5345                 {
5346                     if(tvb_get_ntohl(tvb, foffset-4)==0)
5347                     {
5348                         number_of_items2 = tvb_get_ntohl(tvb, foffset);
5349                         proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, number_of_items2);
5350                         foffset += 4;
5351                         for (j = 1 ; j <= number_of_items2; j++ )
5352                         {
5353                             foffset = objectidentifier(tvb, atree, foffset);
5354                         }
5355                     }
5356                 }
5357             }
5358             /* End of Eventhandling */
5359             break;
5360         case 0x00000006:    /* Remove Profile */
5361             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
5362             foffset += 4;
5363             proto_tree_add_item(ndps_tree, hf_ndps_profile_id, tvb, foffset, 4, FALSE);
5364             foffset += 4;
5365             break;
5366         case 0x00000007:    /* Modify Profile */
5367             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
5368             foffset += 4;
5369             proto_tree_add_item(ndps_tree, hf_ndps_profile_id, tvb, foffset, 4, FALSE);
5370             foffset += 4;
5371             proto_tree_add_item(ndps_tree, hf_ndps_supplier_flag, tvb, foffset, 4, FALSE);
5372             foffset += 4;
5373             if (tvb_get_ntohl(tvb, foffset-4)==TRUE) 
5374             {
5375                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Supplier ID");
5376                 atree = proto_item_add_subtree(aitem, ett_ndps);
5377                 length = tvb_get_ntohl(tvb, foffset);
5378                 foffset += 4;
5379                 proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, length, FALSE);
5380                 foffset += length;
5381             }
5382             aitem = proto_tree_add_item(ndps_tree, hf_ndps_language_flag, tvb, foffset, 4, FALSE);
5383             atree = proto_item_add_subtree(aitem, ett_ndps);
5384             foffset += 4;
5385             if (tvb_get_ntohl(tvb, foffset-4)==TRUE) 
5386             {
5387                 proto_tree_add_item(atree, hf_ndps_language_id, tvb, foffset, 4, FALSE);
5388                 foffset += 4;
5389             }
5390             aitem = proto_tree_add_item(ndps_tree, hf_ndps_method_flag, tvb, foffset, 4, FALSE);
5391             atree = proto_item_add_subtree(aitem, ett_ndps);
5392             foffset += 4;
5393             if (tvb_get_ntohl(tvb, foffset-4)==TRUE) 
5394             {
5395                 /* Start of NameorID */
5396                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Method ID");
5397                 btree = proto_item_add_subtree(bitem, ett_ndps);
5398                 foffset = name_or_id(tvb, btree, foffset);
5399                 /* End of NameorID */
5400             }
5401             aitem = proto_tree_add_item(ndps_tree, hf_ndps_delivery_address_flag, tvb, foffset, 4, FALSE);
5402             atree = proto_item_add_subtree(aitem, ett_ndps);
5403             foffset += 4;
5404             if (tvb_get_ntohl(tvb, foffset-4)==TRUE) 
5405             {
5406                 foffset = print_address(tvb, atree, foffset);
5407             }
5408             /* Start of EventObjectSet */
5409             length = tvb_get_ntohl(tvb, foffset);   /* Len of record */
5410             if (length > 0) 
5411             {
5412                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Event Object");
5413                 atree = proto_item_add_subtree(aitem, ett_ndps);
5414                 proto_tree_add_item(atree, hf_ndps_event_type, tvb, foffset, 4, FALSE);
5415                 foffset += 4;
5416                 /* Start of objectidentifier */
5417                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Class ID");
5418                 btree = proto_item_add_subtree(bitem, ett_ndps);
5419                 foffset = objectidentifier(tvb, btree, foffset);
5420                 /* End of objectidentifier */
5421                 /* Start of objectidentification */
5422                 bitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object ID");
5423                 btree = proto_item_add_subtree(bitem, ett_ndps);
5424                 foffset = objectidentification(tvb, btree, foffset);
5425                 /* End of objectidentification */
5426                 proto_tree_add_item(atree, hf_ndps_object_op, tvb, foffset, 4, FALSE);
5427                 foffset += 4;
5428                 /* Start of ObjectItem */
5429                 proto_tree_add_uint(atree, hf_ndps_event_object_identifier, tvb, foffset, 4, FALSE);
5430                 foffset += 4;
5431                 if(tvb_get_ntohl(tvb, foffset-4)==1)
5432                 {
5433                     foffset = objectidentifier(tvb, atree, foffset);
5434                 }
5435                 else
5436                 {
5437                     if(tvb_get_ntohl(tvb, foffset-4)==0)
5438                     {
5439                         number_of_items = tvb_get_ntohl(tvb, foffset);
5440                         proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, number_of_items);
5441                         foffset += 4;
5442                         for (j = 1 ; j <= number_of_items; j++ )
5443                         {
5444                             foffset = objectidentifier(tvb, atree, foffset);
5445                         }
5446                     }
5447                 }
5448                 /* End of ObjectItem */
5449             }
5450             /* End of EventObjectSet */
5451             break;
5452         case 0x00000008:    /* List Profiles */
5453             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
5454             foffset += 4;
5455             proto_tree_add_item(ndps_tree, hf_ndps_list_profiles_type, tvb, foffset, 4, FALSE);
5456             foffset += 4;
5457             if (tvb_get_ntohl(tvb, foffset-4)==0)   /* Spec */
5458             {
5459                 /* Start of QualifiedName */
5460                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Supplier Alias");
5461                 atree = proto_item_add_subtree(aitem, ett_ndps);
5462                 qualified_name_type = tvb_get_ntohl(tvb, foffset);
5463                 proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
5464                 4, qualified_name_type);
5465                 foffset += 4;
5466                 if (qualified_name_type != 0) {
5467                     if (qualified_name_type == 1) {
5468                         foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
5469                     }
5470                     else
5471                     {
5472                         foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
5473                         foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
5474                     }
5475                 }
5476                 /* End of QualifiedName */
5477                 proto_tree_add_item(ndps_tree, hf_ndps_list_profiles_choice_type, tvb, foffset, 4, FALSE);
5478                 foffset += 4;
5479                 if (tvb_get_ntohl(tvb, foffset-4)==0)   /* Choice */
5480                 {
5481                     /* Start of CardinalSeq */
5482                     proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
5483                     number_of_items = tvb_get_ntohl(tvb, foffset);
5484                     foffset += 4;
5485                     for (i = 1 ; i <= number_of_items; i++ )
5486                     {
5487                         length = tvb_get_ntohl(tvb, foffset);
5488                         foffset += 4;
5489                         proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, length, FALSE);
5490                         foffset += length;
5491                         foffset += (length%2);
5492                     }
5493                     /* End of CardinalSeq */
5494                 }
5495                 else
5496                 {
5497                     /* Start of QualifiedName */
5498                     aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Consumer");
5499                     atree = proto_item_add_subtree(aitem, ett_ndps);
5500                     qualified_name_type = tvb_get_ntohl(tvb, foffset);
5501                     proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
5502                     4, qualified_name_type);
5503                     foffset += 4;
5504                     if (qualified_name_type != 0) {
5505                         if (qualified_name_type == 1) {
5506                             foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
5507                         }
5508                         else
5509                         {
5510                             foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
5511                             foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
5512                         }
5513                     }
5514                     /* End of QualifiedName */
5515                     /* Start of NameorID */
5516                     aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Method ID");
5517                     atree = proto_item_add_subtree(aitem, ett_ndps);
5518                     foffset = name_or_id(tvb, atree, foffset);
5519                     /* End of NameorID */
5520                     proto_tree_add_item(atree, hf_ndps_language_id, tvb, foffset, 4, FALSE);
5521                     foffset += 4;
5522                 }
5523                 proto_tree_add_item(ndps_tree, hf_ndps_list_profiles_result_type, tvb, foffset, 4, FALSE);
5524                 foffset += 4;
5525                 /* Start of integeroption */
5526                 proto_tree_add_item(ndps_tree, hf_ndps_integer_type_flag, tvb, foffset, 4, FALSE);
5527                 foffset += 4;
5528                 if (tvb_get_ntohl(tvb, foffset-4)!=0) 
5529                 {
5530                     proto_tree_add_item(ndps_tree, hf_ndps_integer_type_value, tvb, foffset, 4, FALSE);
5531                     foffset += 4;
5532                 }
5533                 /* End of integeroption */
5534             }
5535             else                                    /* Cont */
5536             {
5537                 length = tvb_get_ntohl(tvb, foffset);
5538                 proto_tree_add_item(ndps_tree, hf_ndps_context, tvb, foffset, length, FALSE);
5539                 foffset += length;
5540                 foffset += (length%2);
5541                 proto_tree_add_item(ndps_tree, hf_ndps_abort_flag, tvb, foffset, 4, FALSE);
5542                 foffset += 4;
5543             }
5544             break;
5545         case 0x00000009:    /* Report Event */
5546             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
5547             foffset += 4;
5548             /* Start of ReportEventItemSet */
5549             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Event Items");
5550             atree = proto_item_add_subtree(aitem, ett_ndps);
5551             number_of_items = tvb_get_ntohl(tvb, foffset);
5552             for (i = 1 ; i <= number_of_items; i++ )
5553             {
5554                 /* Start of ReportEventItem */
5555                 proto_tree_add_item(atree, hf_ndps_event_type, tvb, foffset, 4, FALSE);
5556                 foffset += 4;
5557                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Containing Class");
5558                 btree = proto_item_add_subtree(bitem, ett_ndps);
5559                 foffset = objectidentifier(tvb, btree, foffset);
5560                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Containing Object");
5561                 btree = proto_item_add_subtree(bitem, ett_ndps);
5562                 foffset = objectidentification(tvb, btree, foffset);
5563                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Filter Class");
5564                 btree = proto_item_add_subtree(bitem, ett_ndps);
5565                 foffset = objectidentifier(tvb, btree, foffset);
5566                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Object Class");
5567                 btree = proto_item_add_subtree(bitem, ett_ndps);
5568                 foffset = objectidentifier(tvb, btree, foffset);
5569                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Object ID");
5570                 btree = proto_item_add_subtree(bitem, ett_ndps);
5571                 foffset = objectidentification(tvb, btree, foffset);
5572                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Event Object ID");
5573                 btree = proto_item_add_subtree(bitem, ett_ndps);
5574                 foffset = objectidentifier(tvb, btree, foffset);
5575                 /* Start of AttributeSet */
5576                 number_of_items = tvb_get_ntohl(tvb, foffset);
5577                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Attribute Modifications");
5578                 btree = proto_item_add_subtree(bitem, ett_ndps);
5579                 proto_tree_add_item(btree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
5580                 foffset += 4;
5581                 for (i = 1 ; i <= number_of_items; i++ )
5582                 {
5583                     foffset = attribute_value(tvb, btree, foffset);  /* Object Attribute Set */
5584                 }
5585                 /* End of AttributeSet */
5586                 foffset = ndps_string(tvb, hf_ndps_message, atree, foffset);
5587                 proto_tree_add_item(atree, hf_time, tvb, foffset, 4, FALSE);
5588                 foffset += 4;
5589                 /* End of ReportEventItem */
5590             }
5591             /* End of ReportEventItemSet */
5592             break;
5593         case 0x0000000b:    /* Report Notification */
5594             /* Start of DestinationSet */
5595             proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
5596             number_of_items = tvb_get_ntohl(tvb, foffset);
5597             foffset += 4;
5598             for (i = 1 ; i <= number_of_items; i++ )
5599             {
5600                 /* Start of Destination */
5601                 /* Start of NameorID */
5602                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Method ID");
5603                 atree = proto_item_add_subtree(aitem, ett_ndps);
5604                 foffset = name_or_id(tvb, atree, foffset);
5605                 /* End of NameorID */
5606                 /* Start of NotifyDeliveryAddr */
5607                 proto_tree_add_item(atree, hf_address_len, tvb, foffset, 4, FALSE);
5608                 foffset += 4;
5609                 foffset = print_address(tvb, atree, foffset);
5610                 /* End of NotifyDeliveryAddr */
5611                 /* End of Destination */
5612             }
5613             /* End of DestinationSet */
5614             foffset = ndps_string(tvb, hf_ndps_supplier_name, ndps_tree, foffset);
5615             proto_tree_add_item(ndps_tree, hf_ndps_event_type, tvb, foffset, 4, FALSE);
5616             foffset += 4;
5617             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Containing Class");
5618             atree = proto_item_add_subtree(aitem, ett_ndps);
5619             foffset = objectidentifier(tvb, atree, foffset);
5620             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Containing Object");
5621             atree = proto_item_add_subtree(aitem, ett_ndps);
5622             foffset = objectidentification(tvb, atree, foffset);
5623             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Filter Class");
5624             atree = proto_item_add_subtree(aitem, ett_ndps);
5625             foffset = objectidentifier(tvb, atree, foffset);
5626             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object Class");
5627             atree = proto_item_add_subtree(aitem, ett_ndps);
5628             foffset = objectidentifier(tvb, atree, foffset);
5629             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object ID");
5630             atree = proto_item_add_subtree(aitem, ett_ndps);
5631             foffset = objectidentification(tvb, atree, foffset);
5632             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Event Object ID");
5633             atree = proto_item_add_subtree(aitem, ett_ndps);
5634             foffset = objectidentifier(tvb, atree, foffset);
5635             /* Start of AttributeSet */
5636             number_of_items = tvb_get_ntohl(tvb, foffset);
5637             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Attribute");
5638             atree = proto_item_add_subtree(aitem, ett_ndps);
5639             proto_tree_add_item(atree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
5640             foffset += 4;
5641             for (i = 1 ; i <= number_of_items; i++ )
5642             {
5643                 foffset = attribute_value(tvb, atree, foffset);  
5644             }
5645             /* End of AttributeSet */
5646             foffset = ndps_string(tvb, hf_ndps_message, ndps_tree, foffset);
5647             proto_tree_add_item(ndps_tree, hf_time, tvb, foffset, 4, FALSE);
5648             foffset += 4;
5649             /* Start of QualifiedName */
5650             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Account");
5651             atree = proto_item_add_subtree(aitem, ett_ndps);
5652             qualified_name_type = tvb_get_ntohl(tvb, foffset);
5653             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
5654             4, qualified_name_type);
5655             foffset += 4;
5656             if (qualified_name_type != 0) {
5657                 if (qualified_name_type == 1) {
5658                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
5659                 }
5660                 else
5661                 {
5662                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
5663                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
5664                 }
5665             }
5666             /* End of QualifiedName */
5667             break;
5668         case 0x0000000c:    /* Add Delivery Method */
5669             foffset = ndps_string(tvb, hf_ndps_file_name, ndps_tree, foffset);
5670             break;
5671         case 0x0000000d:    /* Remove Delivery Method */
5672             /* Start of NameorID */
5673             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Method ID");
5674             atree = proto_item_add_subtree(aitem, ett_ndps);
5675             foffset = name_or_id(tvb, atree, foffset);
5676             /* End of NameorID */
5677             break;
5678         case 0x0000000e:    /* List Delivery Methods */
5679             cred_type = tvb_get_ntohl(tvb, foffset);
5680             proto_tree_add_item(ndps_tree, hf_delivery_method_type, tvb, foffset, 4, FALSE);
5681             foffset += 4;
5682             switch (cred_type)
5683             {
5684             case 0:        /* Specification */
5685                 /* Start of integeroption */
5686                 proto_tree_add_item(ndps_tree, hf_ndps_integer_type_flag, tvb, foffset, 4, FALSE);
5687                 foffset += 4;
5688                 if (tvb_get_ntohl(tvb, foffset-4)!=0) 
5689                 {
5690                     proto_tree_add_item(ndps_tree, hf_ndps_integer_type_value, tvb, foffset, 4, FALSE);
5691                     foffset += 4;
5692                 }
5693                 /* End of integeroption */
5694                 proto_tree_add_item(ndps_tree, hf_ndps_language_id, tvb, foffset, 4, FALSE);
5695                 foffset += 4;
5696                 break;
5697             case 1:       /* Continuation */
5698                 length = tvb_get_ntohl(tvb, foffset);
5699                 proto_tree_add_item(ndps_tree, hf_ndps_context, tvb, foffset, length, FALSE);
5700                 foffset += length;
5701                 foffset += (length%2);
5702                 proto_tree_add_item(ndps_tree, hf_ndps_abort_flag, tvb, foffset, 4, FALSE);
5703                 foffset += 4;
5704                 break;
5705             default:
5706                 break;
5707             }
5708             break;
5709         case 0x0000000f:    /* Get Delivery Method Information */
5710             /* Start of NameorID */
5711             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Method ID");
5712             atree = proto_item_add_subtree(aitem, ett_ndps);
5713             foffset = name_or_id(tvb, atree, foffset);
5714             /* End of NameorID */
5715             proto_tree_add_item(ndps_tree, hf_ndps_language_id, tvb, foffset, 4, FALSE);
5716             foffset += 4;
5717             break;
5718         default:
5719             break;
5720         }
5721         break;
5722     case 0x06097a:  /* Resman */
5723         switch(ndps_func)
5724         {
5725         case 0x00000001:    /* Bind */
5726             /* Start of credentials */
5727             cred_type = tvb_get_ntohl(tvb, foffset);
5728             proto_tree_add_item(ndps_tree, hf_ndps_cred_type, tvb, foffset, 4, FALSE);
5729             foffset += 4;
5730             switch (cred_type)
5731             {
5732             case 0:
5733                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
5734                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
5735                 atree = proto_item_add_subtree(aitem, ett_ndps);
5736                 foffset += 4;
5737                 for (i = 1 ; i <= number_of_items; i++ )
5738                 {
5739                     length = tvb_get_ntohl(tvb, foffset);
5740                     foffset += 4;
5741                     proto_tree_add_item(ndps_tree, hf_ndps_password, tvb, foffset, length, FALSE);
5742                     foffset += length;
5743                 }
5744                 break;
5745             case 1:
5746                 length = tvb_get_ntohl(tvb, foffset);
5747                 foffset += 4;
5748                 proto_tree_add_item(ndps_tree, hf_ndps_certified, tvb, foffset, length, FALSE);
5749                 foffset += length;
5750                 break;
5751             case 2:
5752                 name_len = tvb_get_ntohl(tvb, foffset);
5753                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
5754                 foffset += align_4(tvb, foffset);
5755                 foffset += 2;
5756                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
5757                 2, FALSE);
5758                 foffset += 2;
5759                 break;
5760             case 3:
5761                 name_len = tvb_get_ntohl(tvb, foffset);
5762                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
5763                 foffset += align_4(tvb, foffset);
5764                 foffset += 2;
5765                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
5766                 2, FALSE);
5767                 foffset += 2;
5768                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
5769                 break;
5770             case 4:
5771                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
5772                 foffset += align_4(tvb, foffset);
5773                 foffset += 2;
5774                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
5775                 2, FALSE);
5776                 foffset += 2;
5777                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
5778                 foffset += 8;   /* Don't know what these 8 bytes signify */
5779                 proto_tree_add_item(ndps_tree, hf_ndps_items, tvb, foffset,
5780                 4, FALSE);
5781                 foffset += 4;
5782                 foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
5783                 foffset = ndps_string(tvb, hf_ndps_tree, ndps_tree, foffset);
5784                 break;
5785             default:
5786                 break;
5787             }
5788             /* End of credentials */
5789             proto_tree_add_item(ndps_tree, hf_ndps_retrieve_restrictions, tvb, foffset, 4, FALSE);
5790             foffset += 4;
5791             aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
5792             atree = proto_item_add_subtree(aitem, ett_ndps);
5793             foffset += 4;
5794             for (i = 1 ; i <= number_of_items; i++ )
5795             {
5796                 length = tvb_get_ntohl(tvb, foffset);
5797                 foffset += 4;
5798                 proto_tree_add_item(ndps_tree, hf_bind_security, tvb, foffset, length, FALSE);
5799             }
5800             break;
5801         case 0x00000002:    /* Unbind */
5802         case 0x00000008:    /* Get Resource Manager NDS Object Name */
5803         case 0x00000009:    /* Get Resource Manager Session Information */
5804             /* NoOp */
5805             break;
5806         case 0x00000003:    /* Add Resource File */
5807             proto_tree_add_item(ndps_tree, hf_packet_count, tvb, foffset, 4, FALSE);
5808             foffset += 4;
5809             proto_tree_add_item(ndps_tree, hf_last_packet_flag, tvb, foffset, 4, FALSE);
5810             foffset += 4;
5811             proto_tree_add_item(ndps_tree, hf_file_timestamp, tvb, foffset, 4, FALSE);
5812             foffset += 4;
5813             /* Start of NWDPResAddInputData */
5814             proto_tree_add_item(ndps_tree, hf_res_type, tvb, foffset, 4, FALSE);
5815             resource_type = tvb_get_ntohl(tvb, foffset);
5816             foffset += 4;
5817             switch (resource_type) 
5818             {
5819             case 0:     /* Print Drivers */
5820                 proto_tree_add_item(ndps_tree, hf_os_type, tvb, foffset, 4, FALSE);
5821                 foffset += 4;
5822                 foffset = ndps_string(tvb, hf_ndps_prn_dir_name, ndps_tree, foffset);
5823                 foffset = ndps_string(tvb, hf_ndps_prn_file_name, ndps_tree, foffset);
5824                 break;
5825             case 1:     /* Printer Definitions */
5826                 foffset = ndps_string(tvb, hf_ndps_vendor_dir, ndps_tree, foffset);
5827                 foffset = ndps_string(tvb, hf_ndps_prn_file_name, ndps_tree, foffset);
5828                 break;
5829             case 2:     /* Banner Page Files */
5830                 foffset = ndps_string(tvb, hf_ndps_banner_name, ndps_tree, foffset);
5831                 break;
5832             case 3:     /* Font Types */
5833                 proto_tree_add_item(ndps_tree, hf_os_type, tvb, foffset, 4, FALSE);
5834                 foffset += 4;
5835                 proto_tree_add_item(ndps_tree, hf_font_type, tvb, foffset, 4, FALSE);
5836                 foffset += 4;
5837                 foffset = ndps_string(tvb, hf_ndps_prn_file_name, ndps_tree, foffset);
5838                 break;
5839             case 4:     /* Generic Files/ Archive */
5840             case 5:     /* Printer Driver Archive */
5841                 proto_tree_add_item(ndps_tree, hf_os_type, tvb, foffset, 4, FALSE);
5842                 foffset += 4;
5843                 foffset = ndps_string(tvb, hf_ndps_prn_dir_name, ndps_tree, foffset);
5844                 proto_tree_add_item(ndps_tree, hf_archive_type, tvb, foffset, 4, FALSE);
5845                 foffset += 4;
5846                 break;
5847             default:
5848                 break;
5849             }
5850             /* End of NWDPResAddInputData */
5851             proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
5852             number_of_items=tvb_get_ntohl(tvb, foffset);
5853             foffset += 4;
5854             for (i = 1 ; i <= number_of_items; i++ )
5855             {
5856                 length=tvb_get_ntohl(tvb, foffset);
5857                 if(tvb_length_remaining(tvb, foffset) < length)
5858                 {
5859                     return;
5860                 }
5861                 proto_tree_add_item(ndps_tree, hf_ndps_item_ptr, tvb, foffset, length, FALSE);
5862                 foffset += length;
5863             }
5864             break;
5865         case 0x00000004:    /* Delete Resource File */
5866             /* Start of NWDPResAddInputData */
5867             proto_tree_add_item(ndps_tree, hf_res_type, tvb, foffset, 4, FALSE);
5868             resource_type = tvb_get_ntohl(tvb, foffset);
5869             foffset += 4;
5870             switch (resource_type) 
5871             {
5872             case 0:     /* Print Drivers */
5873                 proto_tree_add_item(ndps_tree, hf_os_type, tvb, foffset, 4, FALSE);
5874                 foffset += 4;
5875                 foffset = ndps_string(tvb, hf_ndps_prn_dir_name, ndps_tree, foffset);
5876                 foffset = ndps_string(tvb, hf_ndps_prn_file_name, ndps_tree, foffset);
5877                 break;
5878             case 1:     /* Printer Definitions */
5879                 foffset = ndps_string(tvb, hf_ndps_vendor_dir, ndps_tree, foffset);
5880                 foffset = ndps_string(tvb, hf_ndps_prn_file_name, ndps_tree, foffset);
5881                 break;
5882             case 2:     /* Banner Page Files */
5883                 foffset = ndps_string(tvb, hf_ndps_banner_name, ndps_tree, foffset);
5884                 break;
5885             case 3:     /* Font Types */
5886                 proto_tree_add_item(ndps_tree, hf_os_type, tvb, foffset, 4, FALSE);
5887                 foffset += 4;
5888                 proto_tree_add_item(ndps_tree, hf_font_type, tvb, foffset, 4, FALSE);
5889                 foffset += 4;
5890                 foffset = ndps_string(tvb, hf_ndps_prn_file_name, ndps_tree, foffset);
5891                 break;
5892             case 4:     /* Generic Files/ Archive */
5893             case 5:     /* Printer Driver Archive */
5894                 proto_tree_add_item(ndps_tree, hf_os_type, tvb, foffset, 4, FALSE);
5895                 foffset += 4;
5896                 foffset = ndps_string(tvb, hf_ndps_prn_dir_name, ndps_tree, foffset);
5897                 proto_tree_add_item(ndps_tree, hf_archive_type, tvb, foffset, 4, FALSE);
5898                 foffset += 4;
5899                 break;
5900             default:
5901                 break;
5902             }
5903             /* End of NWDPResAddInputData */
5904             break;
5905         case 0x00000005:    /* List Resources */
5906             proto_tree_add_item(ndps_tree, hf_ndps_max_items, tvb, foffset, 4, FALSE);
5907             foffset += 4;
5908             proto_tree_add_item(ndps_tree, hf_ndps_status_flags, tvb, foffset, 4, FALSE);
5909             foffset += 4;
5910             proto_tree_add_item(ndps_tree, hf_ndps_resource_list_type, tvb, foffset, 4, FALSE);
5911             resource_type = tvb_get_ntohl(tvb, foffset);
5912             foffset += 4;
5913             switch (resource_type) 
5914             {
5915             case 0:     /* Print Drivers */
5916                 proto_tree_add_item(ndps_tree, hf_os_type, tvb, foffset, 4, FALSE);
5917                 foffset += 4;
5918                 break;
5919             case 1:     /* Printer Definitions */
5920             case 2:     /* Printer Definitions Short */
5921                 foffset = ndps_string(tvb, hf_ndps_vendor_dir, ndps_tree, foffset);
5922                 break;
5923             case 3:     /* Banner Page Files */
5924                 proto_tree_add_item(ndps_tree, hf_banner_type, tvb, foffset, 4, FALSE);
5925                 foffset += 4;
5926                 break;
5927             case 4:     /* Font Types */
5928                 proto_tree_add_item(ndps_tree, hf_font_type, tvb, foffset, 4, FALSE);
5929                 foffset += 4;
5930                 proto_tree_add_item(ndps_tree, hf_os_type, tvb, foffset, 4, FALSE);
5931                 foffset += 4;
5932                 break;
5933             case 5:     /* Printer Driver Files */
5934             case 12:    /* Printer Driver Files 2 */
5935             case 9:     /* Generic Files */
5936                 proto_tree_add_item(ndps_tree, hf_os_type, tvb, foffset, 4, FALSE);
5937                 foffset += 4;
5938                 foffset = ndps_string(tvb, hf_ndps_printer_type, ndps_tree, foffset);
5939                 foffset = ndps_string(tvb, hf_ndps_printer_manuf, ndps_tree, foffset);
5940                 foffset = ndps_string(tvb, hf_ndps_inf_file_name, ndps_tree, foffset);
5941                 field_len = tvb_get_ntohl(tvb, foffset);
5942                 foffset += 4;
5943                 proto_tree_add_item(ndps_tree, hf_printer_id, tvb, foffset, field_len, FALSE);
5944                 break;
5945             case 6:     /* Printer Definition File */
5946             case 10:    /* Printer Definition File 2 */
5947                 foffset = ndps_string(tvb, hf_ndps_vendor_dir, ndps_tree, foffset);
5948                 foffset += 4;
5949                 foffset = ndps_string(tvb, hf_ndps_printer_type, ndps_tree, foffset);
5950                 foffset = ndps_string(tvb, hf_ndps_printer_manuf, ndps_tree, foffset);
5951                 foffset = ndps_string(tvb, hf_ndps_inf_file_name, ndps_tree, foffset);
5952                 field_len = tvb_get_ntohl(tvb, foffset);
5953                 foffset += 4;
5954                 proto_tree_add_item(ndps_tree, hf_printer_id, tvb, foffset, field_len, FALSE);
5955                 break;
5956             case 7:     /* Font Files */
5957                 proto_tree_add_item(ndps_tree, hf_os_type, tvb, foffset, 4, FALSE);
5958                 foffset += 4;
5959                 proto_tree_add_item(ndps_tree, hf_font_type, tvb, foffset, 4, FALSE);
5960                 foffset += 4;
5961                 foffset = ndps_string(tvb, hf_ndps_font_name, ndps_tree, foffset);
5962                 break;
5963             case 8:     /* Generic Type */
5964             case 11:    /* Printer Driver Types 2 */
5965             case 13:    /* Printer Driver Types Archive */
5966                 foffset = ndps_string(tvb, hf_ndps_printer_manuf, ndps_tree, foffset);
5967                 foffset = ndps_string(tvb, hf_ndps_printer_type, ndps_tree, foffset);
5968                 foffset = ndps_string(tvb, hf_ndps_inf_file_name, ndps_tree, foffset);
5969                 break;
5970             case 14:    /* Languages Available */
5971                 break;
5972             default:
5973                 break;
5974             }
5975             break;
5976         case 0x00000006:    /* Get Resource File */
5977             proto_tree_add_item(ndps_tree, hf_get_status_flag, tvb, foffset, 4, FALSE);
5978             foffset += 4;
5979             proto_tree_add_item(ndps_tree, hf_res_type, tvb, foffset, 4, FALSE);
5980             resource_type = tvb_get_ntohl(tvb, foffset);
5981             foffset += 4;
5982             switch (resource_type) 
5983             {
5984             case 0:     /* Print Drivers */
5985                 proto_tree_add_item(ndps_tree, hf_os_type, tvb, foffset, 4, FALSE);
5986                 foffset += 4;
5987                 foffset = ndps_string(tvb, hf_ndps_prn_dir_name, ndps_tree, foffset);
5988                 foffset = ndps_string(tvb, hf_ndps_prn_file_name, ndps_tree, foffset);
5989                 break;
5990             case 1:     /* Printer Definitions */
5991                 foffset = ndps_string(tvb, hf_ndps_vendor_dir, ndps_tree, foffset);
5992                 foffset = ndps_string(tvb, hf_ndps_prn_file_name, ndps_tree, foffset);
5993                 break;
5994             case 2:     /* Banner Page Files */
5995                 foffset = ndps_string(tvb, hf_ndps_banner_name, ndps_tree, foffset);
5996                 break;
5997             case 3:     /* Font Types */
5998                 proto_tree_add_item(ndps_tree, hf_os_type, tvb, foffset, 4, FALSE);
5999                 foffset += 4;
6000                 proto_tree_add_item(ndps_tree, hf_font_type, tvb, foffset, 4, FALSE);
6001                 foffset += 4;
6002                 foffset = ndps_string(tvb, hf_ndps_prn_file_name, ndps_tree, foffset);
6003                 break;
6004             case 4:     /* Generic Files/ Archive */
6005             case 5:     /* Printer Driver Archive */
6006                 proto_tree_add_item(ndps_tree, hf_os_type, tvb, foffset, 4, FALSE);
6007                 foffset += 4;
6008                 foffset = ndps_string(tvb, hf_ndps_prn_dir_name, ndps_tree, foffset);
6009                 proto_tree_add_item(ndps_tree, hf_archive_type, tvb, foffset, 4, FALSE);
6010                 foffset += 4;
6011                 break;
6012             default:
6013                 break;
6014             }
6015             break;
6016         case 0x00000007:    /* Get Resource File Date */
6017             proto_tree_add_item(ndps_tree, hf_ndps_status_flags, tvb, foffset, 4, FALSE);
6018             foffset += 4;
6019             /* Start of NWDPResAddInputData */
6020             proto_tree_add_item(ndps_tree, hf_res_type, tvb, foffset, 4, FALSE);
6021             resource_type = tvb_get_ntohl(tvb, foffset);
6022             foffset += 4;
6023             switch (resource_type) 
6024             {
6025             case 0:     /* Print Drivers */
6026                 proto_tree_add_item(ndps_tree, hf_os_type, tvb, foffset, 4, FALSE);
6027                 foffset += 4;
6028                 foffset = ndps_string(tvb, hf_ndps_prn_dir_name, ndps_tree, foffset);
6029                 foffset = ndps_string(tvb, hf_ndps_prn_file_name, ndps_tree, foffset);
6030                 break;
6031             case 1:     /* Printer Definitions */
6032                 foffset = ndps_string(tvb, hf_ndps_vendor_dir, ndps_tree, foffset);
6033                 foffset = ndps_string(tvb, hf_ndps_prn_file_name, ndps_tree, foffset);
6034                 break;
6035             case 2:     /* Banner Page Files */
6036                 foffset = ndps_string(tvb, hf_ndps_banner_name, ndps_tree, foffset);
6037                 break;
6038             case 3:     /* Font Types */
6039                 proto_tree_add_item(ndps_tree, hf_os_type, tvb, foffset, 4, FALSE);
6040                 foffset += 4;
6041                 proto_tree_add_item(ndps_tree, hf_font_type, tvb, foffset, 4, FALSE);
6042                 foffset += 4;
6043                 foffset = ndps_string(tvb, hf_ndps_prn_file_name, ndps_tree, foffset);
6044                 break;
6045             case 4:     /* Generic Files/ Archive */
6046             case 5:     /* Printer Driver Archive */
6047                 proto_tree_add_item(ndps_tree, hf_os_type, tvb, foffset, 4, FALSE);
6048                 foffset += 4;
6049                 foffset = ndps_string(tvb, hf_ndps_prn_dir_name, ndps_tree, foffset);
6050                 proto_tree_add_item(ndps_tree, hf_archive_type, tvb, foffset, 4, FALSE);
6051                 foffset += 4;
6052                 break;
6053             default:
6054                 break;
6055             }
6056             /* End of NWDPResAddInputData */
6057             break;
6058         case 0x0000000a:    /* Set Resource Language Context */
6059             proto_tree_add_item(ndps_tree, hf_ndps_language_id, tvb, foffset, 4, FALSE);
6060             foffset += 4;
6061             break;
6062         default:
6063             break;
6064         }
6065         break;
6066     case 0x06097b:  /* Delivery */
6067         switch(ndps_func)
6068         {
6069         case 0x00000001:    /* Delivery Bind */
6070             /* Start of credentials */
6071             cred_type = tvb_get_ntohl(tvb, foffset);
6072             proto_tree_add_item(ndps_tree, hf_ndps_cred_type, tvb, foffset, 4, FALSE);
6073             foffset += 4;
6074             switch (cred_type)
6075             {
6076             case 0:
6077                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
6078                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
6079                 atree = proto_item_add_subtree(aitem, ett_ndps);
6080                 foffset += 4;
6081                 for (i = 1 ; i <= number_of_items; i++ )
6082                 {
6083                     length = tvb_get_ntohl(tvb, foffset);
6084                     foffset += 4;
6085                     proto_tree_add_item(ndps_tree, hf_ndps_password, tvb, foffset, length, FALSE);
6086                     foffset += length;
6087                 }
6088                 break;
6089             case 1:
6090                 length = tvb_get_ntohl(tvb, foffset);
6091                 foffset += 4;
6092                 proto_tree_add_item(ndps_tree, hf_ndps_certified, tvb, foffset, length, FALSE);
6093                 foffset += length;
6094                 break;
6095             case 2:
6096                 name_len = tvb_get_ntohl(tvb, foffset);
6097                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
6098                 foffset += align_4(tvb, foffset);
6099                 foffset += 2;
6100                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
6101                 2, FALSE);
6102                 foffset += 2;
6103                 break;
6104             case 3:
6105                 name_len = tvb_get_ntohl(tvb, foffset);
6106                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
6107                 foffset += align_4(tvb, foffset);
6108                 foffset += 2;
6109                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
6110                 2, FALSE);
6111                 foffset += 2;
6112                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
6113                 break;
6114             case 4:
6115                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
6116                 foffset += align_4(tvb, foffset);
6117                 foffset += 2;
6118                 proto_tree_add_item(ndps_tree, hf_ndps_connection, tvb, foffset, 
6119                 2, FALSE);
6120                 foffset += 2;
6121                 foffset = ndps_string(tvb, hf_ndps_user_name, ndps_tree, foffset);
6122                 foffset += 8;   /* Don't know what these 8 bytes signify */
6123                 proto_tree_add_item(ndps_tree, hf_ndps_items, tvb, foffset,
6124                 4, FALSE);
6125                 foffset += 4;
6126                 foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
6127                 foffset = ndps_string(tvb, hf_ndps_tree, ndps_tree, foffset);
6128                 break;
6129             default:
6130                 break;
6131             }
6132             /* End of credentials */
6133             break;
6134         case 0x00000002:    /* Delivery Unbind */
6135             /* NoOp */
6136             break;
6137         case 0x00000003:    /* Delivery Send */
6138             proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
6139             number_of_items = tvb_get_ntohl(tvb, foffset);
6140             foffset += 4;
6141             for (i = 1 ; i <= number_of_items; i++ )
6142             {
6143                 proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
6144                 foffset += 4;
6145                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Supplier ID");
6146                 atree = proto_item_add_subtree(aitem, ett_ndps);
6147                 length = tvb_get_ntohl(tvb, foffset);
6148                 foffset += 4;
6149                 proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, length, FALSE);
6150                 foffset += length;
6151                 proto_tree_add_item(ndps_tree, hf_ndps_event_type, tvb, foffset, 4, FALSE);
6152                 foffset += 4;
6153                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Containing Class");
6154                 atree = proto_item_add_subtree(aitem, ett_ndps);
6155                 foffset = objectidentifier(tvb, atree, foffset);
6156                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Containing Object");
6157                 atree = proto_item_add_subtree(aitem, ett_ndps);
6158                 foffset = objectidentification(tvb, atree, foffset);
6159                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Filter Class");
6160                 atree = proto_item_add_subtree(aitem, ett_ndps);
6161                 foffset = objectidentifier(tvb, atree, foffset);
6162                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object Class");
6163                 atree = proto_item_add_subtree(aitem, ett_ndps);
6164                 foffset = objectidentifier(tvb, atree, foffset);
6165                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object ID");
6166                 atree = proto_item_add_subtree(aitem, ett_ndps);
6167                 foffset = objectidentification(tvb, atree, foffset);
6168                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Event Object ID");
6169                 atree = proto_item_add_subtree(aitem, ett_ndps);
6170                 foffset = objectidentifier(tvb, atree, foffset);
6171                 foffset = attribute_value(tvb, ndps_tree, foffset);
6172                 foffset = ndps_string(tvb, hf_ndps_message, ndps_tree, foffset);
6173                 proto_tree_add_item(ndps_tree, hf_time, tvb, foffset, 4, FALSE);
6174                 foffset += 4;
6175                 /* Start of QualifiedName */
6176                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Account");
6177                 atree = proto_item_add_subtree(aitem, ett_ndps);
6178                 qualified_name_type = tvb_get_ntohl(tvb, foffset);
6179                 proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
6180                 4, qualified_name_type);
6181                 foffset += 4;
6182                 if (qualified_name_type != 0) {
6183                     if (qualified_name_type == 1) {
6184                         foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
6185                     }
6186                     else
6187                     {
6188                         foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
6189                         foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
6190                     }
6191                 }
6192                 /* End of QualifiedName */
6193             }
6194             break;
6195         case 0x00000004:    /* Delivery Send2 */
6196             proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
6197             number_of_items = tvb_get_ntohl(tvb, foffset);
6198             foffset += 4;
6199             for (i = 1 ; i <= number_of_items; i++ )
6200             {
6201                 proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
6202                 foffset += 4;
6203                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Supplier ID");
6204                 atree = proto_item_add_subtree(aitem, ett_ndps);
6205                 length = tvb_get_ntohl(tvb, foffset);
6206                 foffset += 4;
6207                 proto_tree_add_item(atree, hf_ndps_attribute_value, tvb, foffset, length, FALSE);
6208                 foffset += length;
6209                 proto_tree_add_item(ndps_tree, hf_ndps_event_type, tvb, foffset, 4, FALSE);
6210                 foffset += 4;
6211                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Containing Class");
6212                 atree = proto_item_add_subtree(aitem, ett_ndps);
6213                 foffset = objectidentifier(tvb, atree, foffset);
6214                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Containing Object");
6215                 atree = proto_item_add_subtree(aitem, ett_ndps);
6216                 foffset = objectidentification(tvb, atree, foffset);
6217                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Filter Class");
6218                 atree = proto_item_add_subtree(aitem, ett_ndps);
6219                 foffset = objectidentifier(tvb, atree, foffset);
6220                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object Class");
6221                 atree = proto_item_add_subtree(aitem, ett_ndps);
6222                 foffset = objectidentifier(tvb, atree, foffset);
6223                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object ID");
6224                 atree = proto_item_add_subtree(aitem, ett_ndps);
6225                 foffset = objectidentification(tvb, atree, foffset);
6226                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Event Object ID");
6227                 atree = proto_item_add_subtree(aitem, ett_ndps);
6228                 foffset = objectidentifier(tvb, atree, foffset);
6229                 /* Start of AttributeSet */
6230                 number_of_items = tvb_get_ntohl(tvb, foffset);
6231                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Attribute");
6232                 atree = proto_item_add_subtree(aitem, ett_ndps);
6233                 proto_tree_add_item(atree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
6234                 foffset += 4;
6235                 for (i = 1 ; i <= number_of_items; i++ )
6236                 {
6237                     foffset = attribute_value(tvb, atree, foffset);  
6238                 }
6239                 /* End of AttributeSet */
6240                 foffset = ndps_string(tvb, hf_ndps_message, ndps_tree, foffset);
6241                 proto_tree_add_item(ndps_tree, hf_time, tvb, foffset, 4, FALSE);
6242                 foffset += 4;
6243                 /* Start of QualifiedName */
6244                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Account");
6245                 atree = proto_item_add_subtree(aitem, ett_ndps);
6246                 qualified_name_type = tvb_get_ntohl(tvb, foffset);
6247                 proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
6248                 4, qualified_name_type);
6249                 foffset += 4;
6250                 if (qualified_name_type != 0) {
6251                     if (qualified_name_type == 1) {
6252                         foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
6253                     }
6254                     else
6255                     {
6256                         foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
6257                         foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
6258                     }
6259                 }
6260                 /* End of QualifiedName */
6261             }
6262             break;
6263         default:
6264             break;
6265         }
6266         break;
6267     default:
6268         break;
6269     }
6270     /*proto_tree_add_uint_format(ndps_tree, hf_ndps_xid, tvb, 0, 
6271     0, ndps_xid, "This is a Request Packet, XID %08x, Prog %08x, Func %08x", ndps_xid, ndps_prog, ndps_func);*/
6272     return;
6273 }
6274
6275 static int
6276 ndps_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffset)
6277 {
6278     guint32     number_of_items=0;
6279     guint32     problem_type=0;
6280     int         i;
6281     proto_tree  *atree;
6282     proto_item  *aitem;
6283
6284     problem_type = tvb_get_ntohl(tvb, foffset);
6285     /*if (problem_type == 0)
6286     {
6287         return FALSE;
6288     }*/
6289     if (check_col(pinfo->cinfo, COL_INFO))
6290         col_append_str(pinfo->cinfo, COL_INFO, "- Error");
6291     proto_tree_add_item(ndps_tree, hf_ndps_problem_type, tvb, foffset, 4, FALSE);
6292     foffset += 4;
6293     switch(problem_type)
6294     {
6295     case 0:                 /* Security Error */
6296         proto_tree_add_item(ndps_tree, hf_problem_type, tvb, foffset, 4, FALSE);
6297         foffset += 4;
6298         if (tvb_get_ntohl(tvb, foffset-4)==0) /* Standard Error */
6299         {
6300             proto_tree_add_item(ndps_tree, hf_security_problem_type, tvb, foffset, 4, FALSE);
6301             foffset += 4;
6302         }
6303         else                /* Extended Error */
6304         {
6305             /* Start of objectidentifier */
6306             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Extended Error");
6307             atree = proto_item_add_subtree(aitem, ett_ndps);
6308             foffset = objectidentifier(tvb, atree, foffset);
6309             /* End of objectidentifier */
6310         }
6311         /* Start of NameorID */
6312         aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Message");
6313         atree = proto_item_add_subtree(aitem, ett_ndps);
6314         foffset = name_or_id(tvb, atree, foffset);
6315         /* End of NameorID */
6316         break;
6317     case 1:                 /* Service Error */
6318         proto_tree_add_item(ndps_tree, hf_problem_type, tvb, foffset, 4, FALSE);
6319         foffset += 4;
6320         if (tvb_get_ntohl(tvb, foffset-4)==0) /* Standard Error */
6321         {
6322             proto_tree_add_item(ndps_tree, hf_service_problem_type, tvb, foffset, 4, FALSE);
6323             foffset += 4;
6324         }
6325         else                /* Extended Error */
6326         {
6327             /* Start of objectidentifier */
6328             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Extended Error");
6329             atree = proto_item_add_subtree(aitem, ett_ndps);
6330             foffset = objectidentifier(tvb, atree, foffset);
6331             /* End of objectidentifier */
6332         }
6333         foffset = objectidentification(tvb, ndps_tree, foffset);
6334         foffset = attribute_value(tvb, ndps_tree, foffset);  /* Object Attribute Set */
6335         proto_tree_add_item(ndps_tree, hf_ndps_lib_error, tvb, foffset, 4, FALSE);
6336         foffset += 4;
6337         proto_tree_add_item(ndps_tree, hf_ndps_other_error, tvb, foffset, 4, FALSE);
6338         foffset += 4;
6339         proto_tree_add_item(ndps_tree, hf_ndps_other_error_2, tvb, foffset, 4, FALSE);
6340         foffset += 4;
6341         break;
6342     case 2:                 /* Access Error */
6343         proto_tree_add_item(ndps_tree, hf_problem_type, tvb, foffset, 4, FALSE);
6344         foffset += 4;
6345         if (tvb_get_ntohl(tvb, foffset-4)==0) /* Standard Error */
6346         {
6347             proto_tree_add_item(ndps_tree, hf_access_problem_type, tvb, foffset, 4, FALSE);
6348             foffset += 4;
6349         }
6350         else                /* Extended Error */
6351         {
6352             /* Start of objectidentifier */
6353             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Extended Error");
6354             atree = proto_item_add_subtree(aitem, ett_ndps);
6355             foffset = objectidentifier(tvb, atree, foffset);
6356             /* End of objectidentifier */
6357         }
6358         foffset = objectidentification(tvb, ndps_tree, foffset);
6359         break;
6360     case 3:                 /* Printer Error */
6361         proto_tree_add_item(ndps_tree, hf_problem_type, tvb, foffset, 4, FALSE);
6362         foffset += 4;
6363         if (tvb_get_ntohl(tvb, foffset-4)==0) /* Standard Error */
6364         {
6365             proto_tree_add_item(ndps_tree, hf_printer_problem_type, tvb, foffset, 4, FALSE);
6366             foffset += 4;
6367         }
6368         else                /* Extended Error */
6369         {
6370             /* Start of objectidentifier */
6371             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Extended Error");
6372             atree = proto_item_add_subtree(aitem, ett_ndps);
6373             foffset = objectidentifier(tvb, atree, foffset);
6374             /* End of objectidentifier */
6375         }
6376         foffset = objectidentification(tvb, ndps_tree, foffset);
6377         break;
6378     case 4:                 /* Selection Error */
6379         proto_tree_add_item(ndps_tree, hf_problem_type, tvb, foffset, 4, FALSE);
6380         foffset += 4;
6381         if (tvb_get_ntohl(tvb, foffset-4)==0) /* Standard Error */
6382         {
6383             proto_tree_add_item(ndps_tree, hf_selection_problem_type, tvb, foffset, 4, FALSE);
6384             foffset += 4;
6385         }
6386         else                /* Extended Error */
6387         {
6388             /* Start of objectidentifier */
6389             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Extended Error");
6390             atree = proto_item_add_subtree(aitem, ett_ndps);
6391             foffset = objectidentifier(tvb, atree, foffset);
6392             /* End of objectidentifier */
6393         }
6394         foffset = objectidentification(tvb, ndps_tree, foffset);
6395         foffset = attribute_value(tvb, ndps_tree, foffset);  /* Object Attribute Set */
6396         break;
6397     case 5:                 /* Document Access Error */
6398         proto_tree_add_item(ndps_tree, hf_problem_type, tvb, foffset, 4, FALSE);
6399         foffset += 4;
6400         if (tvb_get_ntohl(tvb, foffset-4)==0) /* Standard Error */
6401         {
6402             proto_tree_add_item(ndps_tree, hf_doc_access_problem_type, tvb, foffset, 4, FALSE);
6403             foffset = objectidentifier(tvb, ndps_tree, foffset);
6404         }
6405         else                /* Extended Error */
6406         {
6407             /* Start of objectidentifier */
6408             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Extended Error");
6409             atree = proto_item_add_subtree(aitem, ett_ndps);
6410             foffset = objectidentifier(tvb, atree, foffset);
6411             /* End of objectidentifier */
6412         }
6413         foffset = objectidentification(tvb, ndps_tree, foffset);
6414         break;
6415     case 6:                 /* Attribute Error */
6416         number_of_items = tvb_get_ntohl(tvb, foffset); 
6417         aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
6418         atree = proto_item_add_subtree(aitem, ett_ndps);
6419         foffset += 4;
6420         for (i = 1 ; i <= number_of_items; i++ )
6421         {
6422             proto_tree_add_item(ndps_tree, hf_problem_type, tvb, foffset, 4, FALSE);
6423             foffset += 4;
6424             if (tvb_get_ntohl(tvb, foffset-4)==0) /* Standard Error */
6425             {
6426                 proto_tree_add_item(ndps_tree, hf_attribute_problem_type, tvb, foffset, 4, FALSE);
6427                 foffset += 4;
6428             }
6429             else                /* Extended Error */
6430             {
6431                 /* Start of objectidentifier */
6432                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Extended Error");
6433                 atree = proto_item_add_subtree(aitem, ett_ndps);
6434                 foffset = objectidentifier(tvb, atree, foffset);
6435                 /* End of objectidentifier */
6436             }
6437             foffset = attribute_value(tvb, ndps_tree, foffset);  /* Object Attribute Set */
6438         }
6439         break;
6440     case 7:                 /* Update Error */
6441         proto_tree_add_item(ndps_tree, hf_problem_type, tvb, foffset, 4, FALSE);
6442         foffset += 4;
6443         if (tvb_get_ntohl(tvb, foffset-4)==0) /* Standard Error */
6444         {
6445             proto_tree_add_item(ndps_tree, hf_update_problem_type, tvb, foffset, 4, FALSE);
6446             foffset += 4;
6447         }
6448         else                /* Extended Error */
6449         {
6450             /* Start of objectidentifier */
6451             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Extended Error");
6452             atree = proto_item_add_subtree(aitem, ett_ndps);
6453             foffset = objectidentifier(tvb, atree, foffset);
6454             /* End of objectidentifier */
6455         }
6456         foffset = objectidentification(tvb, ndps_tree, foffset);
6457         break;
6458     default:
6459         break;
6460     }
6461     return foffset;
6462 }
6463
6464 static void
6465 dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffset)
6466 {
6467     conversation_t          *conversation = NULL;
6468     ndps_req_hash_value     *request_value = NULL;
6469     proto_tree              *atree;
6470     proto_item              *aitem;
6471     proto_tree              *btree;
6472     proto_item              *bitem;
6473     proto_tree              *ctree;
6474     proto_item              *citem;
6475     guint32                 i;
6476     guint32                 j;
6477     guint32                 k;
6478     guint32                 number_of_items=0;
6479     guint32                 number_of_items2=0;
6480     guint32                 number_of_items3=0;
6481     guint32                 length=0;
6482     guint32                 ndps_func=0;
6483     guint32                 ndps_prog=0;
6484     guint32                 error_val=0;
6485     guint32                 problem_type=0;
6486     guint32                 field_len=0;
6487     guint32                 resource_type=0;
6488     guint32                 qualified_name_type=0;
6489     guint32                 data_type=0;
6490     
6491     if (!pinfo->fd->flags.visited) {
6492         /* Find the conversation whence the request would have come. */
6493         conversation = find_conversation(&pinfo->src, &pinfo->dst,
6494             PT_NCP, (guint32) pinfo->destport, (guint32) pinfo->destport, 0);
6495         if (conversation != NULL) {
6496             /* find the record telling us the request made that caused
6497             this reply */
6498             request_value = ndps_hash_lookup(conversation, (guint32) pinfo->destport);
6499             p_add_proto_data(pinfo->fd, proto_ndps, (void*) request_value);
6500         }
6501         /* else... we haven't seen an NDPS Request for that conversation. */
6502     }
6503     else {
6504         request_value = p_get_proto_data(pinfo->fd, proto_ndps);
6505     }
6506     if (request_value) {
6507         ndps_prog = request_value->ndps_prog;
6508         ndps_func = request_value->ndps_func;
6509         proto_tree_add_uint_format(ndps_tree, hf_ndps_reqframe, tvb, 0, 
6510            0, request_value->ndps_frame_num,
6511            "Response to Request in Frame Number: %u",
6512            request_value->ndps_frame_num);
6513     }
6514
6515     if (tvb_length_remaining(tvb, foffset) < 12 && tvb_get_ntohl(tvb, foffset) == 0) /* No error and no return data */
6516     {
6517         proto_tree_add_uint(ndps_tree, hf_ndps_error_val, tvb, foffset, 4, error_val);
6518         if (check_col(pinfo->cinfo, COL_INFO))
6519                 col_append_str(pinfo->cinfo, COL_INFO, "- Ok");
6520         return;
6521     }
6522     if(ndps_func == 1 || ndps_func == 2)
6523     {
6524         proto_tree_add_item(ndps_tree, hf_ndps_rpc_acc_stat, tvb, foffset, 4, FALSE);
6525         foffset += 4;
6526         if (tvb_length_remaining(tvb,foffset) < 4 ) {
6527             if (check_col(pinfo->cinfo, COL_INFO))
6528                 col_append_str(pinfo->cinfo, COL_INFO, "- Error");
6529             return;
6530         }
6531         proto_tree_add_item(ndps_tree, hf_ndps_rpc_acc_results, tvb, foffset, 4, FALSE);
6532         foffset += 4;
6533         if (tvb_length_remaining(tvb,foffset) < 4) {
6534             if (check_col(pinfo->cinfo, COL_INFO))
6535                 col_append_str(pinfo->cinfo, COL_INFO, "- Error");
6536             return;
6537         }
6538     }
6539     error_val = tvb_get_ntohl(tvb, foffset);
6540     proto_tree_add_uint(ndps_tree, hf_ndps_error_val, tvb, foffset, 4, error_val);
6541     foffset += 4;
6542     if (check_col(pinfo->cinfo, COL_INFO))
6543         col_append_str(pinfo->cinfo, COL_INFO, "- Ok");
6544     switch(ndps_prog)
6545     {
6546     case 0x060976:  /* Print */
6547         switch(ndps_func)
6548         {
6549         case 0x00000001:    /* Bind PSM */
6550             proto_tree_add_item(ndps_tree, hf_ndps_oid, tvb, foffset, 4, FALSE);
6551             foffset += 4;
6552             if(error_val != 0)
6553             {
6554                 foffset = ndps_error(tvb, pinfo, ndps_tree, foffset);
6555                 if(tvb_length_remaining(tvb, foffset) < 4)
6556                 {
6557                     break;
6558                 }
6559                 proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
6560                 foffset += 4;
6561             }
6562             /* Start of QualifiedName */
6563             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "PSM Name");
6564             atree = proto_item_add_subtree(aitem, ett_ndps);
6565             qualified_name_type = tvb_get_ntohl(tvb, foffset);
6566             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
6567             4, qualified_name_type);
6568             foffset += 4;
6569             if (qualified_name_type != 0) {
6570                 if (qualified_name_type == 1) {
6571                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
6572                 }
6573                 else
6574                 {
6575                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
6576                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
6577                 }
6578             }
6579             /* End of QualifiedName */
6580             break;
6581         case 0x00000002:    /* Bind PA */
6582             proto_tree_add_item(ndps_tree, hf_ndps_oid, tvb, foffset, 4, FALSE);
6583             foffset += 4;
6584             if(error_val != 0)
6585             {
6586                 foffset = ndps_error(tvb, pinfo, ndps_tree, foffset);
6587                 if(tvb_length_remaining(tvb, foffset) < 4)
6588                 {
6589                     break;
6590                 }
6591                 proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
6592                 foffset += 4;
6593             }
6594                 foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
6595             break;
6596         case 0x00000003:    /* Unbind */
6597             break;
6598         case 0x00000004:    /* Print */
6599             foffset = ndps_string(tvb, hf_ndps_pa_name, ndps_tree, foffset);
6600             proto_tree_add_item(ndps_tree, hf_local_id, tvb, foffset, 4, FALSE);
6601             foffset += 4;
6602             if(error_val != 0)
6603             {
6604                 foffset = ndps_error(tvb, pinfo, ndps_tree, foffset);
6605             }
6606             break;
6607         case 0x00000005:    /* Modify Job */
6608         case 0x00000006:    /* Cancel Job */
6609         case 0x00000008:    /* Promote Job */
6610         case 0x0000000b:    /* Resume */
6611         case 0x0000000d:    /* Create */
6612             /* Start of AttributeSet */
6613             number_of_items = tvb_get_ntohl(tvb, foffset);
6614             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object Attribute Set");
6615             atree = proto_item_add_subtree(aitem, ett_ndps);
6616             proto_tree_add_item(atree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
6617             foffset += 4;
6618             for (i = 1 ; i <= number_of_items; i++ )
6619             {
6620                 foffset = attribute_value(tvb, atree, foffset);  /* Object Attribute Set */
6621             }
6622             /* End of AttributeSet */
6623             if(error_val != 0)
6624             {
6625                 foffset = ndps_error(tvb, pinfo, ndps_tree, foffset);
6626             }
6627             break;
6628         case 0x00000007:    /* List Object Attributes */
6629             proto_tree_add_item(ndps_tree, hf_answer_time, tvb, foffset, 4, FALSE);
6630             foffset += 4;
6631             /* Continuation Option */
6632             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Continuation Option");
6633             atree = proto_item_add_subtree(aitem, ett_ndps);
6634             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
6635             number_of_items=tvb_get_ntohl(tvb, foffset);
6636             foffset += 4;
6637             for (i = 1 ; i <= number_of_items; i++ )
6638             {
6639                 length=tvb_get_ntohl(tvb, foffset);
6640                 if(tvb_length_remaining(tvb, foffset) < length)
6641                 {
6642                     return;
6643                 }
6644                 proto_tree_add_item(atree, hf_ndps_item_ptr, tvb, foffset, length, FALSE);
6645                 foffset += length;
6646             }
6647             /* Limit Encountered Option */
6648             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Limit Encountered Option");
6649             atree = proto_item_add_subtree(aitem, ett_ndps);
6650             proto_tree_add_item(atree, hf_ndps_len, tvb, foffset, 4, FALSE);
6651             foffset += 4;
6652             proto_tree_add_item(atree, hf_limit_enc, tvb, foffset, 4, FALSE);
6653             foffset += 4;
6654             /* Object Results Set */
6655             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object Results Set");
6656             atree = proto_item_add_subtree(aitem, ett_ndps);
6657             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
6658             number_of_items=tvb_get_ntohl(tvb, foffset);
6659             foffset += 4;
6660             for (i = 1 ; i <= number_of_items; i++ )
6661             {
6662                 foffset = objectidentification(tvb, atree, foffset);
6663                 number_of_items2 = tvb_get_ntohl(tvb, foffset);
6664                 bitem = proto_tree_add_item(atree, hf_ndps_objects, tvb, foffset, 4, FALSE);
6665                 btree = proto_item_add_subtree(bitem, ett_ndps);
6666                 foffset += 4;
6667                 foffset = objectidentifier(tvb, btree, foffset);
6668                 for (j = 1 ; j <= number_of_items2; j++ )
6669                 {
6670                     number_of_items3 = tvb_get_ntohl(tvb, foffset);
6671                     citem = proto_tree_add_item(btree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
6672                     ctree = proto_item_add_subtree(citem, ett_ndps);
6673                     foffset += 4;
6674                     for (k = 1 ; k <= number_of_items3; k++ )
6675                     {
6676                         foffset = attribute_value(tvb, ctree, foffset);
6677                     }
6678                     foffset += align_4(tvb, foffset);
6679                     proto_tree_add_item(btree, hf_ndps_qualifier, tvb, foffset, 4, FALSE);
6680                     foffset += 4;
6681                     foffset = objectidentifier(tvb, btree, foffset);
6682                 }
6683                 foffset += 2;
6684             }
6685             if(error_val != 0)
6686             {
6687                 foffset = ndps_error(tvb, pinfo, ndps_tree, foffset);
6688             }
6689             break;
6690         case 0x00000009:    /* Interrupt */
6691         case 0x0000000a:    /* Pause */
6692             /* Start of NWDPPrtContainedObjectId */
6693             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Job ID");
6694             atree = proto_item_add_subtree(aitem, ett_ndps);
6695             foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
6696             proto_tree_add_item(atree, hf_local_id, tvb, foffset, 4, FALSE);
6697             foffset += 4;
6698             /* End of NWDPPrtContainedObjectId */
6699             /* Start of AttributeSet */
6700             number_of_items = tvb_get_ntohl(tvb, foffset);
6701             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object Attribute Set");
6702             atree = proto_item_add_subtree(aitem, ett_ndps);
6703             proto_tree_add_item(atree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
6704             foffset += 4;
6705             for (i = 1 ; i <= number_of_items; i++ )
6706             {
6707                 foffset = attribute_value(tvb, atree, foffset);  /* Object Attribute Set */
6708             }
6709             /* End of AttributeSet */
6710             if(error_val != 0)
6711             {
6712                 foffset = ndps_error(tvb, pinfo, ndps_tree, foffset);
6713             }
6714             break;
6715         case 0x0000000c:    /* Clean */
6716         case 0x0000000e:    /* Delete */
6717         case 0x0000000f:    /* Disable PA */
6718         case 0x00000010:    /* Enable PA */
6719         case 0x00000012:    /* Set */
6720         case 0x00000013:    /* Shutdown PA */
6721         case 0x00000014:    /* Startup PA */
6722         case 0x00000018:    /* Transfer Data */
6723         case 0x00000019:    /* Device Control */
6724         case 0x0000001b:    /* Remove Event Profile */
6725         case 0x0000001c:    /* Modify Event Profile */
6726         case 0x0000001e:    /* Shutdown PSM */
6727         case 0x0000001f:    /* Cancel PSM Shutdown */
6728         case 0x00000020:    /* Set Printer DS Information */
6729         case 0x00000021:    /* Clean User Jobs */
6730             if(error_val != 0)
6731             {
6732                 foffset = ndps_error(tvb, pinfo, ndps_tree, foffset);
6733             }
6734             break;
6735         case 0x00000011:    /* Resubmit Jobs */
6736             number_of_items = tvb_get_ntohl(tvb, foffset); /* Start of ResubmitJob Set */
6737             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Resubmit Job");
6738             atree = proto_item_add_subtree(aitem, ett_ndps);
6739             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
6740             foffset += 4;
6741             for (i = 1 ; i <= number_of_items; i++ )
6742             {
6743                 /* Start of NWDPPrtContainedObjectId */
6744                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Old Job");
6745                 btree = proto_item_add_subtree(bitem, ett_ndps);
6746                 foffset = ndps_string(tvb, hf_ndps_pa_name, btree, foffset);
6747                 proto_tree_add_item(btree, hf_local_id, tvb, foffset, 4, FALSE);
6748                 foffset += 4;
6749                 /* End of NWDPPrtContainedObjectId */
6750                 /* Start of NWDPPrtContainedObjectId */
6751                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "New Job");
6752                 btree = proto_item_add_subtree(bitem, ett_ndps);
6753                 foffset = ndps_string(tvb, hf_ndps_pa_name, btree, foffset);
6754                 proto_tree_add_item(btree, hf_local_id, tvb, foffset, 4, FALSE);
6755                 foffset += 4;
6756                 /* End of NWDPPrtContainedObjectId */
6757                 /* Start of AttributeSet */
6758                 number_of_items = tvb_get_ntohl(tvb, foffset);
6759                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Job Status");
6760                 btree = proto_item_add_subtree(bitem, ett_ndps);
6761                 proto_tree_add_item(btree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
6762                 foffset += 4;
6763                 for (i = 1 ; i <= number_of_items; i++ )
6764                 {
6765                     foffset = attribute_value(tvb, btree, foffset);  /* Object Attribute Set */
6766                 }
6767                 /* End of AttributeSet */
6768             } /* End of ResubmitJob Set */
6769             if(error_val != 0)
6770             {
6771                 foffset = ndps_error(tvb, pinfo, ndps_tree, foffset);
6772             }
6773             break;
6774         case 0x00000015:    /* Reorder Job */
6775             /* Start of AttributeSet */
6776             number_of_items = tvb_get_ntohl(tvb, foffset);
6777             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Job Status");
6778             atree = proto_item_add_subtree(aitem, ett_ndps);
6779             proto_tree_add_item(atree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
6780             foffset += 4;
6781             for (i = 1 ; i <= number_of_items; i++ )
6782             {
6783                 foffset = attribute_value(tvb, atree, foffset);  /* Object Attribute Set */
6784             }
6785             /* End of AttributeSet */
6786             if(error_val != 0)
6787             {
6788                 foffset = ndps_error(tvb, pinfo, ndps_tree, foffset);
6789             }
6790             break;
6791         case 0x00000016:    /* Pause PA */
6792         case 0x00000017:    /* Resume PA */
6793             /* Start of AttributeSet */
6794             number_of_items = tvb_get_ntohl(tvb, foffset);
6795             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Printer Status");
6796             atree = proto_item_add_subtree(aitem, ett_ndps);
6797             proto_tree_add_item(atree, hf_ndps_attributes, tvb, foffset, 4, FALSE);
6798             foffset += 4;
6799             for (i = 1 ; i <= number_of_items; i++ )
6800             {
6801                 foffset = attribute_value(tvb, atree, foffset);  /* Object Attribute Set */
6802             }
6803             /* End of AttributeSet */
6804             if(error_val != 0)
6805             {
6806                 foffset = ndps_error(tvb, pinfo, ndps_tree, foffset);
6807             }
6808             break;
6809         case 0x0000001a:    /* Add Event Profile */
6810             proto_tree_add_item(ndps_tree, hf_ndps_profile_id, tvb, foffset, 4, FALSE);
6811             foffset += 4;
6812             if(error_val != 0)
6813             {
6814                 foffset = ndps_error(tvb, pinfo, ndps_tree, foffset);
6815             }
6816             break;
6817         case 0x0000001d:    /* List Event Profiles */
6818             length = tvb_get_ntohl(tvb, foffset);
6819             foffset += 4;
6820             proto_tree_add_item(ndps_tree, hf_ndps_attribute_value, tvb, foffset, length, FALSE);
6821             foffset += length;
6822             /* Start of Eventhandling */
6823             proto_tree_add_item(ndps_tree, hf_ndps_profile_id, tvb, foffset, 4, FALSE);
6824             foffset += 4;
6825             proto_tree_add_item(ndps_tree, hf_ndps_persistence, tvb, foffset, 4, FALSE);
6826             foffset += 4;
6827             /* Start of QualifiedName */
6828             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Consumer Name");
6829             atree = proto_item_add_subtree(aitem, ett_ndps);
6830             qualified_name_type = tvb_get_ntohl(tvb, foffset);
6831             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
6832             4, qualified_name_type);
6833             foffset += 4;
6834             if (qualified_name_type != 0) {
6835                 if (qualified_name_type == 1) {
6836                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
6837                 }
6838                 else
6839                 {
6840                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
6841                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
6842                 }
6843             }
6844             /* End of QualifiedName */
6845             length = tvb_get_ntohl(tvb, foffset);
6846             foffset += 4;
6847             proto_tree_add_item(ndps_tree, hf_ndps_attribute_value, tvb, foffset, length, FALSE);
6848             foffset += length;
6849             proto_tree_add_item(ndps_tree, hf_ndps_language_id, tvb, foffset, 4, FALSE);
6850             foffset += 4;
6851             /* Start of NameorID */
6852             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Method ID");
6853             atree = proto_item_add_subtree(aitem, ett_ndps);
6854             foffset = name_or_id(tvb, atree, foffset);
6855             /* End of NameorID */
6856             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Delivery Address");
6857             atree = proto_item_add_subtree(aitem, ett_ndps);
6858             number_of_items = tvb_get_ntohl(tvb, foffset);
6859             for (i = 1 ; i <= number_of_items; i++ )
6860             {
6861                 foffset += address_item(tvb, atree, foffset);
6862             }
6863             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Event Object");
6864             atree = proto_item_add_subtree(aitem, ett_ndps);
6865             number_of_items = tvb_get_ntohl(tvb, foffset);
6866             for (i = 1 ; i <= number_of_items; i++ )
6867             {
6868                 proto_tree_add_item(atree, hf_ndps_event_type, tvb, foffset, 4, FALSE);
6869                 foffset += 4;
6870                 foffset = objectidentifier(tvb, atree, foffset);
6871                 foffset = objectidentification(tvb, atree, foffset);
6872                 proto_tree_add_item(atree, hf_ndps_object_op, tvb, foffset, 4, FALSE);
6873                 foffset += 4;
6874
6875                 proto_tree_add_uint(atree, hf_ndps_event_object_identifier, tvb, foffset, 4, FALSE);
6876                 foffset += 4;
6877                 if(tvb_get_ntohl(tvb, foffset-4)==1)
6878                 {
6879                     foffset = objectidentifier(tvb, atree, foffset);
6880                 }
6881                 else
6882                 {
6883                     if(tvb_get_ntohl(tvb, foffset-4)==0)
6884                     {
6885                         number_of_items2 = tvb_get_ntohl(tvb, foffset);
6886                         proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, number_of_items2);
6887                         foffset += 4;
6888                         for (j = 1 ; j <= number_of_items2; j++ )
6889                         {
6890                             foffset = objectidentifier(tvb, atree, foffset);
6891                         }
6892                     }
6893                 }
6894             }
6895             /* End of Eventhandling */
6896             length = tvb_get_ntohl(tvb, foffset);
6897             foffset += 4;
6898             proto_tree_add_item(ndps_tree, hf_ndps_continuation_option, tvb, foffset, length, FALSE);
6899             foffset += length;
6900             if(error_val != 0)
6901             {
6902                 foffset = ndps_error(tvb, pinfo, ndps_tree, foffset);
6903             }
6904             break;
6905         case 0x00000022:    /* Map GUID to NDS Name */
6906             /* Start of QualifiedName */
6907             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "NDS Printer Name");
6908             atree = proto_item_add_subtree(aitem, ett_ndps);
6909             qualified_name_type = tvb_get_ntohl(tvb, foffset);
6910             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
6911             4, qualified_name_type);
6912             foffset += 4;
6913             if (qualified_name_type != 0) {
6914                 if (qualified_name_type == 1) {
6915                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
6916                 }
6917                 else
6918                 {
6919                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
6920                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
6921                 }
6922             }
6923             /* End of QualifiedName */
6924             if(error_val != 0)
6925             {
6926                 foffset = ndps_error(tvb, pinfo, ndps_tree, foffset);
6927             }
6928             break;
6929         default:
6930             break;
6931         }
6932         break;
6933     case 0x060977:  /* Broker */
6934         switch(ndps_func)
6935         {
6936         case 0x00000001:    /* Bind */
6937         case 0x00000002:    /* Unbind */
6938         case 0x00000004:    /* Enable Service */
6939         case 0x00000005:    /* Disable Service */
6940         case 0x00000006:    /* Down Broker */
6941             /* Start of NWDPBrokerReturnCode */
6942             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
6943             foffset += 4;
6944             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
6945             {
6946                 break;
6947             }
6948             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
6949             foffset += 4;
6950             /* End of NWDPBrokerReturnCode */
6951             break;
6952         case 0x00000003:    /* List Services */
6953             number_of_items = tvb_get_ntohl(tvb, foffset); 
6954             aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
6955             atree = proto_item_add_subtree(aitem, ett_ndps);
6956             foffset += 4;
6957             for (i = 1 ; i <= number_of_items; i++ )
6958             {
6959                 bitem = proto_tree_add_item(atree, hf_ndps_service_type, tvb, foffset, 4, FALSE);
6960                 btree = proto_item_add_subtree(bitem, ett_ndps);
6961                 foffset += 4;
6962                 proto_tree_add_item(btree, hf_ndps_service_enabled, tvb, foffset, 4, FALSE);
6963                 foffset += 4;
6964             }
6965             /* Start of NWDPBrokerReturnCode */
6966             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
6967             foffset += 4;
6968             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
6969             {
6970                 break;
6971             }
6972             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
6973             foffset += 4;
6974             /* End of NWDPBrokerReturnCode */
6975             break;
6976         case 0x00000007:    /* Get Broker NDS Object Name */
6977             proto_tree_add_item(ndps_tree, hf_ndps_items, tvb, foffset,
6978             4, FALSE);
6979             foffset += 4;
6980             foffset = ndps_string(tvb, hf_ndps_broker_name, ndps_tree, foffset);
6981             foffset = ndps_string(tvb, hf_ndps_tree, ndps_tree, foffset);
6982             /* Start of NWDPBrokerReturnCode */
6983             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
6984             foffset += 4;
6985             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
6986             {
6987                 break;
6988             }
6989             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
6990             foffset += 4;
6991             /* End of NWDPBrokerReturnCode */
6992             break;
6993         case 0x00000008:    /* Get Broker Session Information */
6994         default:
6995             break;
6996         }
6997         break;
6998     case 0x060978:  /* Registry */
6999         switch(ndps_func)
7000         {
7001         case 0x00000001:    /* Bind */
7002             aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7003             atree = proto_item_add_subtree(aitem, ett_ndps);
7004             foffset += 4;
7005             for (i = 1 ; i <= number_of_items; i++ )
7006             {
7007                 length = tvb_get_ntohl(tvb, foffset);
7008                 foffset += 4;
7009                 proto_tree_add_item(ndps_tree, hf_ndps_attribute_set, tvb, foffset, length, FALSE);
7010             }
7011             /* Start of NWDPRegReturnCode */
7012             /*proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7013             foffset += 4;
7014             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7015             {
7016                 break;
7017             }
7018             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7019             foffset += 4;*/
7020             /* End of NWDPRegReturnCode */
7021             break;
7022         case 0x00000002:    /* Unbind */
7023             /* NoOp */
7024             break;
7025         case 0x00000003:    /* Register Server */
7026         case 0x00000004:    /* Deregister Server */
7027         case 0x00000005:    /* Register Registry */
7028         case 0x00000006:    /* Deregister Registry */
7029         case 0x00000007:    /* Registry Update */
7030             /* Start of NWDPRegReturnCode */
7031             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7032             foffset += 4;
7033             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7034             {
7035                 break;
7036             }
7037             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7038             foffset += 4;
7039             /* End of NWDPRegReturnCode */
7040             break;
7041         case 0x00000008:    /* List Local Servers */
7042         case 0x00000009:    /* List Servers */
7043             number_of_items = tvb_get_ntohl(tvb, foffset); 
7044             proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7045             foffset += 4;
7046             for (i = 1 ; i <= number_of_items; i++ )
7047             {
7048                 /* Start of Server Entry */
7049                 foffset = ndps_string(tvb, hf_ndps_server_name, ndps_tree, foffset);
7050                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_server_type, tvb, foffset, 4, FALSE);
7051                 atree = proto_item_add_subtree(aitem, ett_ndps);
7052                 foffset += 4;
7053                 foffset = print_address(tvb, atree, foffset);
7054                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Server Info");
7055                 btree = proto_item_add_subtree(bitem, ett_ndps);
7056                 number_of_items2 = tvb_get_ntohl(tvb, foffset); 
7057                 proto_tree_add_item(btree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7058                 foffset += 4;
7059                 for (j = 1 ; j <= number_of_items2; j++ )
7060                 {
7061                     data_type = tvb_get_ntohl(tvb, foffset);
7062                     proto_tree_add_item(btree, hf_ndps_data_item_type, tvb, foffset, 4, FALSE);
7063                     foffset += 4;
7064                     switch (data_type) 
7065                     {
7066                     case 0:   /* Int8 */
7067                         proto_tree_add_item(btree, hf_info_int, tvb, foffset, 1, FALSE);
7068                         foffset++;
7069                         break;
7070                     case 1:   /* Int16 */
7071                         proto_tree_add_item(btree, hf_info_int16, tvb, foffset, 2, FALSE);
7072                         foffset += 2;
7073                         break;
7074                     case 2:   /* Int32 */
7075                         proto_tree_add_item(btree, hf_info_int32, tvb, foffset, 4, FALSE);
7076                         foffset += 4;
7077                         break;
7078                     case 3:   /* Boolean */
7079                         proto_tree_add_item(btree, hf_info_boolean, tvb, foffset, 4, FALSE);
7080                         foffset += 4;
7081                         break;
7082                     case 4:   /* String */
7083                     case 5:   /* Bytes */
7084                         foffset = ndps_string(tvb, hf_info_string, btree, foffset);
7085                         break;
7086                         /*length = tvb_get_ntohl(tvb, foffset);
7087                         foffset += 4;
7088                         proto_tree_add_item(btree, hf_info_bytes, tvb, foffset, length, FALSE);
7089                         foffset += length;
7090                         foffset += (length%4);*/
7091                         break;
7092                     default:
7093                         break;
7094                     }
7095                 }
7096                 /* End of Server Entry */
7097             }
7098             length = tvb_get_ntohl(tvb, foffset);
7099             foffset += 4;
7100             proto_tree_add_item(ndps_tree, hf_ndps_continuation_option, tvb, foffset, length, FALSE);
7101             foffset += length;
7102             /* Start of NWDPRegReturnCode */
7103             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7104             foffset += 4;
7105             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7106             {
7107                 break;
7108             }
7109             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7110             foffset += 4;
7111             /* End of NWDPRegReturnCode */
7112             break;
7113         case 0x0000000a:    /* List Known Registries */
7114             number_of_items = tvb_get_ntohl(tvb, foffset); 
7115             proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7116             foffset += 4;
7117             for (i = 1 ; i <= number_of_items; i++ )
7118             {
7119                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_client_server_type, tvb, foffset, 4, FALSE);
7120                 atree = proto_item_add_subtree(aitem, ett_ndps);
7121                 foffset += 4;
7122                 foffset = ndps_string(tvb, hf_ndps_registry_name, atree, foffset);
7123                 foffset = print_address(tvb, atree, foffset);
7124             }
7125             length = tvb_get_ntohl(tvb, foffset);
7126             foffset += 4;
7127             proto_tree_add_item(ndps_tree, hf_ndps_continuation_option, tvb, foffset, length, FALSE);
7128             foffset += length;
7129             /* Start of NWDPRegReturnCode */
7130             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7131             foffset += 4;
7132             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7133             {
7134                 break;
7135             }
7136             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7137             foffset += 4;
7138             /* End of NWDPRegReturnCode */
7139             break;
7140         case 0x0000000b:    /* Get Registry NDS Object Name */
7141             /* Start of QualifiedName */
7142             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "NDS Printer Name");
7143             atree = proto_item_add_subtree(aitem, ett_ndps);
7144             qualified_name_type = tvb_get_ntohl(tvb, foffset);
7145             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
7146             4, qualified_name_type);
7147             foffset += 4;
7148             if (qualified_name_type != 0) {
7149                 if (qualified_name_type == 1) {
7150                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
7151                 }
7152                 else
7153                 {
7154                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
7155                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
7156                 }
7157             }
7158             /* End of QualifiedName */
7159             /* Start of NWDPRegReturnCode */
7160             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7161             foffset += 4;
7162             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7163             {
7164                 break;
7165             }
7166             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7167             foffset += 4;
7168             /* End of NWDPRegReturnCode */
7169             break;
7170         case 0x0000000c:    /* Get Registry Session Information */
7171             proto_tree_add_item(ndps_tree, hf_ndps_session_type, tvb, foffset, 4, FALSE);
7172             foffset += 4;
7173             proto_tree_add_item(ndps_tree, hf_time, tvb, foffset, 4, FALSE);
7174             foffset += 4;
7175             /* Start of NWDPRegReturnCode */
7176             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7177             foffset += 4;
7178             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7179             {
7180                 break;
7181             }
7182             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7183             foffset += 4;
7184             /* End of NWDPRegReturnCode */
7185             break;
7186         default:
7187             break;
7188         }
7189         break;
7190     case 0x060979:  /* Notify */
7191         switch(ndps_func)
7192         {
7193         case 0x00000001:    /* Notify Bind */
7194             aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7195             atree = proto_item_add_subtree(aitem, ett_ndps);
7196             foffset += 4;
7197             for (i = 1 ; i <= number_of_items; i++ )
7198             {
7199                 length = tvb_get_ntohl(tvb, foffset);
7200                 foffset += 4;
7201                 proto_tree_add_item(ndps_tree, hf_ndps_attribute_set, tvb, foffset, length, FALSE);
7202             }
7203             /* Start of NWDPNotifyReturnCode */
7204             /*proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7205             foffset += 4;
7206             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7207             {
7208                 break;
7209             }
7210             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7211             foffset += 4;*/
7212             /* End of NWDPNotifyReturnCode */
7213             break;
7214         case 0x00000002:    /* Notify Unbind */
7215             /* NoOp */
7216             break;
7217         case 0x00000003:    /* Register Supplier */
7218             proto_tree_add_item(ndps_tree, hf_ndps_session, tvb, foffset, 4, FALSE);
7219             foffset += 4;
7220             /* Start of EventObjectSet */
7221             length = tvb_get_ntohl(tvb, foffset);   /* Len of record */
7222             if (length > 0) 
7223             {
7224                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Event Object");
7225                 atree = proto_item_add_subtree(aitem, ett_ndps);
7226                 proto_tree_add_item(atree, hf_ndps_event_type, tvb, foffset, 4, FALSE);
7227                 foffset += 4;
7228                 /* Start of objectidentifier */
7229                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Class ID");
7230                 btree = proto_item_add_subtree(bitem, ett_ndps);
7231                 foffset = objectidentifier(tvb, btree, foffset);
7232                 /* End of objectidentifier */
7233                 /* Start of objectidentification */
7234                 bitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object ID");
7235                 btree = proto_item_add_subtree(bitem, ett_ndps);
7236                 foffset = objectidentification(tvb, btree, foffset);
7237                 /* End of objectidentification */
7238                 proto_tree_add_item(atree, hf_ndps_object_op, tvb, foffset, 4, FALSE);
7239                 foffset += 4;
7240                 /* Start of ObjectItem */
7241                 proto_tree_add_uint(atree, hf_ndps_event_object_identifier, tvb, foffset, 4, FALSE);
7242                 foffset += 4;
7243                 if(tvb_get_ntohl(tvb, foffset-4)==1)
7244                 {
7245                     foffset = objectidentifier(tvb, atree, foffset);
7246                 }
7247                 else
7248                 {
7249                     if(tvb_get_ntohl(tvb, foffset-4)==0)
7250                     {
7251                         number_of_items = tvb_get_ntohl(tvb, foffset);
7252                         proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, number_of_items);
7253                         foffset += 4;
7254                         for (j = 1 ; j <= number_of_items; j++ )
7255                         {
7256                             foffset = objectidentifier(tvb, atree, foffset);
7257                         }
7258                     }
7259                 }
7260                 /* End of ObjectItem */
7261             }
7262             /* End of EventObjectSet */
7263             /* Start of NWDPNotifyReturnCode */
7264             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7265             foffset += 4;
7266             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7267             {
7268                 break;
7269             }
7270             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7271             foffset += 4;
7272             /* End of NWDPNotifyReturnCode */
7273             break;
7274         case 0x00000004:    /* Deregister Supplier */
7275         case 0x0000000b:    /* Report Notification */
7276         case 0x0000000d:    /* Remove Delivery Method */
7277             /* Start of NWDPNotifyReturnCode */
7278             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7279             foffset += 4;
7280             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7281             {
7282                 break;
7283             }
7284             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7285             foffset += 4;
7286             /* End of NWDPNotifyReturnCode */
7287             break;
7288         case 0x00000005:    /* Add Profile */
7289             proto_tree_add_item(ndps_tree, hf_ndps_profile_id, tvb, foffset, 4, FALSE);
7290             foffset += 4;
7291             /* Start of EventObjectSet */
7292             length = tvb_get_ntohl(tvb, foffset);   /* Len of record */
7293             if (length > 0) 
7294             {
7295                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Event Object");
7296                 atree = proto_item_add_subtree(aitem, ett_ndps);
7297                 proto_tree_add_item(atree, hf_ndps_event_type, tvb, foffset, 4, FALSE);
7298                 foffset += 4;
7299                 /* Start of objectidentifier */
7300                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Class ID");
7301                 btree = proto_item_add_subtree(bitem, ett_ndps);
7302                 foffset = objectidentifier(tvb, btree, foffset);
7303                 /* End of objectidentifier */
7304                 /* Start of objectidentification */
7305                 bitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object ID");
7306                 btree = proto_item_add_subtree(bitem, ett_ndps);
7307                 foffset = objectidentification(tvb, btree, foffset);
7308                 /* End of objectidentification */
7309                 proto_tree_add_item(atree, hf_ndps_object_op, tvb, foffset, 4, FALSE);
7310                 foffset += 4;
7311                 /* Start of ObjectItem */
7312                 proto_tree_add_uint(atree, hf_ndps_event_object_identifier, tvb, foffset, 4, FALSE);
7313                 foffset += 4;
7314                 if(tvb_get_ntohl(tvb, foffset-4)==1)
7315                 {
7316                     foffset = objectidentifier(tvb, atree, foffset);
7317                 }
7318                 else
7319                 {
7320                     if(tvb_get_ntohl(tvb, foffset-4)==0)
7321                     {
7322                         number_of_items = tvb_get_ntohl(tvb, foffset);
7323                         proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, number_of_items);
7324                         foffset += 4;
7325                         for (j = 1 ; j <= number_of_items; j++ )
7326                         {
7327                             foffset = objectidentifier(tvb, atree, foffset);
7328                         }
7329                     }
7330                 }
7331                 /* End of ObjectItem */
7332             }
7333             /* End of EventObjectSet */
7334             /* Start of NWDPNotifyReturnCode */
7335             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7336             foffset += 4;
7337             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7338             {
7339                 break;
7340             }
7341             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7342             foffset += 4;
7343             /* End of NWDPNotifyReturnCode */
7344             break;
7345         case 0x00000006:    /* Remove Profile */
7346         case 0x00000007:    /* Modify Profile */
7347         case 0x00000009:    /* Report Event */
7348             /* Start of EventObjectSet */
7349             length = tvb_get_ntohl(tvb, foffset);   /* Len of record */
7350             if (length > 0) 
7351             {
7352                 aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Event Object");
7353                 atree = proto_item_add_subtree(aitem, ett_ndps);
7354                 proto_tree_add_item(atree, hf_ndps_event_type, tvb, foffset, 4, FALSE);
7355                 foffset += 4;
7356                 /* Start of objectidentifier */
7357                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Class ID");
7358                 btree = proto_item_add_subtree(bitem, ett_ndps);
7359                 foffset = objectidentifier(tvb, btree, foffset);
7360                 /* End of objectidentifier */
7361                 /* Start of objectidentification */
7362                 bitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Object ID");
7363                 btree = proto_item_add_subtree(bitem, ett_ndps);
7364                 foffset = objectidentification(tvb, btree, foffset);
7365                 /* End of objectidentification */
7366                 proto_tree_add_item(atree, hf_ndps_object_op, tvb, foffset, 4, FALSE);
7367                 foffset += 4;
7368                 /* Start of ObjectItem */
7369                 proto_tree_add_uint(atree, hf_ndps_event_object_identifier, tvb, foffset, 4, FALSE);
7370                 foffset += 4;
7371                 if(tvb_get_ntohl(tvb, foffset-4)==1)
7372                 {
7373                     foffset = objectidentifier(tvb, atree, foffset);
7374                 }
7375                 else
7376                 {
7377                     if(tvb_get_ntohl(tvb, foffset-4)==0)
7378                     {
7379                         number_of_items = tvb_get_ntohl(tvb, foffset);
7380                         proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, number_of_items);
7381                         foffset += 4;
7382                         for (j = 1 ; j <= number_of_items; j++ )
7383                         {
7384                             foffset = objectidentifier(tvb, atree, foffset);
7385                         }
7386                     }
7387                 }
7388                 /* End of ObjectItem */
7389             }
7390             /* End of EventObjectSet */
7391             /* Start of NWDPNotifyReturnCode */
7392             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7393             foffset += 4;
7394             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7395             {
7396                 break;
7397             }
7398             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7399             foffset += 4;
7400             /* End of NWDPNotifyReturnCode */
7401             break;
7402         case 0x00000008:    /* List Profiles */
7403             /* Start of ProfileResultSet */
7404             proto_tree_add_item(ndps_tree, hf_ndps_len, tvb, foffset, 4, FALSE);
7405             foffset += 4;
7406             /* Start of Eventhandling */
7407             proto_tree_add_item(ndps_tree, hf_ndps_profile_id, tvb, foffset, 4, FALSE);
7408             foffset += 4;
7409             proto_tree_add_item(ndps_tree, hf_ndps_persistence, tvb, foffset, 4, FALSE);
7410             foffset += 4;
7411             /* Start of QualifiedName */
7412             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Consumer Name");
7413             atree = proto_item_add_subtree(aitem, ett_ndps);
7414             qualified_name_type = tvb_get_ntohl(tvb, foffset);
7415             proto_tree_add_uint(atree, hf_ndps_qualified_name, tvb, foffset, 
7416             4, qualified_name_type);
7417             foffset += 4;
7418             if (qualified_name_type != 0) {
7419                 if (qualified_name_type == 1) {
7420                     foffset = ndps_string(tvb, hf_printer_name, atree, foffset);
7421                 }
7422                 else
7423                 {
7424                     foffset = ndps_string(tvb, hf_ndps_pa_name, atree, foffset);
7425                     foffset = ndps_string(tvb, hf_ndps_tree, atree, foffset);
7426                 }
7427             }
7428             /* End of QualifiedName */
7429             length = tvb_get_ntohl(tvb, foffset);
7430             foffset += 4;
7431             proto_tree_add_item(ndps_tree, hf_ndps_attribute_value, tvb, foffset, length, FALSE);
7432             foffset += length;
7433             proto_tree_add_item(ndps_tree, hf_ndps_language_id, tvb, foffset, 4, FALSE);
7434             foffset += 4;
7435             /* Start of NameorID */
7436             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Method ID");
7437             atree = proto_item_add_subtree(aitem, ett_ndps);
7438             foffset = name_or_id(tvb, atree, foffset);
7439             /* End of NameorID */
7440             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Delivery Address");
7441             atree = proto_item_add_subtree(aitem, ett_ndps);
7442             number_of_items = tvb_get_ntohl(tvb, foffset);
7443             for (i = 1 ; i <= number_of_items; i++ )
7444             {
7445                 foffset += address_item(tvb, atree, foffset);
7446             }
7447             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Event Object");
7448             atree = proto_item_add_subtree(aitem, ett_ndps);
7449             number_of_items = tvb_get_ntohl(tvb, foffset);
7450             for (i = 1 ; i <= number_of_items; i++ )
7451             {
7452                 proto_tree_add_item(atree, hf_ndps_event_type, tvb, foffset, 4, FALSE);
7453                 foffset += 4;
7454                 foffset = objectidentifier(tvb, atree, foffset);
7455                 foffset = objectidentification(tvb, atree, foffset);
7456                 proto_tree_add_item(atree, hf_ndps_object_op, tvb, foffset, 4, FALSE);
7457                 foffset += 4;
7458
7459                 proto_tree_add_uint(atree, hf_ndps_event_object_identifier, tvb, foffset, 4, FALSE);
7460                 foffset += 4;
7461                 if(tvb_get_ntohl(tvb, foffset-4)==1)
7462                 {
7463                     foffset = objectidentifier(tvb, atree, foffset);
7464                 }
7465                 else
7466                 {
7467                     if(tvb_get_ntohl(tvb, foffset-4)==0)
7468                     {
7469                         number_of_items2 = tvb_get_ntohl(tvb, foffset);
7470                         proto_tree_add_uint(atree, hf_ndps_item_count, tvb, foffset, 4, number_of_items2);
7471                         foffset += 4;
7472                         for (j = 1 ; j <= number_of_items2; j++ )
7473                         {
7474                             foffset = objectidentifier(tvb, atree, foffset);
7475                         }
7476                     }
7477                 }
7478             }
7479             /* End of Eventhandling */
7480             /* End of ProfileResultSet */
7481             length = tvb_get_ntohl(tvb, foffset);
7482             foffset += 4;
7483             proto_tree_add_item(ndps_tree, hf_ndps_continuation_option, tvb, foffset, length, FALSE);
7484             foffset += length;
7485             /* Start of NWDPNotifyReturnCode */
7486             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7487             foffset += 4;
7488             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7489             {
7490                 break;
7491             }
7492             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7493             foffset += 4;
7494             /* End of NWDPNotifyReturnCode */
7495             break;
7496         case 0x0000000a:    /* List Supported Languages */
7497             /* Start of IntegerSeq */
7498             length = tvb_get_ntohl(tvb, foffset);
7499             foffset += 4;
7500             proto_tree_add_item(ndps_tree, hf_ndps_language_id, tvb, foffset, length, FALSE);
7501             foffset += length;
7502             /* End of IntegerSeq */
7503             /* Start of NWDPNotifyReturnCode */
7504             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7505             foffset += 4;
7506             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7507             {
7508                 break;
7509             }
7510             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7511             foffset += 4;
7512             /* End of NWDPNotifyReturnCode */
7513             break;
7514         case 0x0000000c:    /* Add Delivery Method */
7515             /* Start of NameorID */
7516             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Method ID");
7517             atree = proto_item_add_subtree(aitem, ett_ndps);
7518             foffset = name_or_id(tvb, atree, foffset);
7519             /* End of NameorID */
7520             /* Start of NWDPNotifyReturnCode */
7521             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7522             foffset += 4;
7523             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7524             {
7525                 break;
7526             }
7527             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7528             foffset += 4;
7529             /* End of NWDPNotifyReturnCode */
7530             break;
7531         case 0x0000000e:    /* List Delivery Methods */
7532             /* Start of DeliveryMethodSet */
7533             number_of_items = tvb_get_ntohl(tvb, foffset); 
7534             aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7535             atree = proto_item_add_subtree(aitem, ett_ndps);
7536             foffset += 4;
7537             for (i = 1 ; i <= number_of_items; i++ )
7538             {
7539                 /* Start of DeliveryMethod */
7540                 /* Start of NameorID */
7541                 bitem = proto_tree_add_text(atree, tvb, foffset, 0, "Method ID");
7542                 btree = proto_item_add_subtree(bitem, ett_ndps);
7543                 foffset = name_or_id(tvb, btree, foffset);
7544                 foffset += align_4(tvb, foffset);
7545                 /* End of NameorID */
7546                 foffset = ndps_string(tvb, hf_ndps_method_name, btree, foffset);
7547                 foffset = ndps_string(tvb, hf_ndps_method_ver, btree, foffset);
7548                 foffset = ndps_string(tvb, hf_ndps_file_name, btree, foffset);
7549                 proto_tree_add_item(btree, hf_ndps_admin_submit, tvb, foffset, 4, FALSE);
7550                 foffset += 4;
7551                 /* End of DeliveryMethod */
7552             }
7553             /* End of DeliveryMethodSet */
7554             /* Start of NWDPNotifyReturnCode */
7555             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7556             foffset += 4;
7557             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7558             {
7559                 break;
7560             }
7561             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7562             foffset += 4;
7563             /* End of NWDPNotifyReturnCode */
7564             break;
7565         case 0x0000000f:    /* Get Delivery Method Information */
7566             /* Start of DeliveryMethod */
7567             /* Start of NameorID */
7568             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Method ID");
7569             atree = proto_item_add_subtree(aitem, ett_ndps);
7570             foffset = name_or_id(tvb, atree, foffset);
7571             /* End of NameorID */
7572             foffset = ndps_string(tvb, hf_ndps_method_name, atree, foffset);
7573             foffset = ndps_string(tvb, hf_ndps_method_ver, atree, foffset);
7574             foffset = ndps_string(tvb, hf_ndps_file_name, atree, foffset);
7575             proto_tree_add_item(atree, hf_ndps_admin_submit, tvb, foffset, 4, FALSE);
7576             foffset += 4;
7577             /* End of DeliveryMethod */
7578             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Delivery Address");
7579             atree = proto_item_add_subtree(aitem, ett_ndps);
7580             number_of_items = tvb_get_ntohl(tvb, foffset);
7581             for (i = 1 ; i <= number_of_items; i++ )
7582             {
7583                 foffset += address_item(tvb, atree, foffset);
7584             }
7585             /* Start of NWDPNotifyReturnCode */
7586             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7587             foffset += 4;
7588             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7589             {
7590                 break;
7591             }
7592             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7593             foffset += 4;
7594             /* End of NWDPNotifyReturnCode */
7595             break;
7596         case 0x00000010:    /* Get Notify NDS Object Name */
7597             proto_tree_add_item(ndps_tree, hf_ndps_items, tvb, foffset,
7598             4, FALSE);
7599             foffset += 4;
7600             foffset = ndps_string(tvb, hf_ndps_broker_name, ndps_tree, foffset);
7601             foffset = ndps_string(tvb, hf_ndps_tree, ndps_tree, foffset);
7602             /* Start of NWDPNotifyReturnCode */
7603             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7604             foffset += 4;
7605             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7606             {
7607                 break;
7608             }
7609             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7610             foffset += 4;
7611             /* End of NWDPNotifyReturnCode */
7612             break;
7613         case 0x00000011:    /* Get Notify Session Information */
7614             proto_tree_add_item(ndps_tree, hf_ndps_get_session_type, tvb, foffset, 4, FALSE);
7615             foffset += 4;
7616             proto_tree_add_item(ndps_tree, hf_time, tvb, foffset, 4, FALSE);
7617             foffset += 4;
7618             /* Start of NWDPNotifyReturnCode */
7619             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7620             foffset += 4;
7621             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7622             {
7623                 break;
7624             }
7625             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7626             foffset += 4;
7627             /* End of NWDPNotifyReturnCode */
7628             break;
7629         default:
7630             break;
7631         }
7632         break;
7633     case 0x06097a:  /* Resman */
7634         switch(ndps_func)
7635         {
7636         case 0x00000001:    /* Bind */
7637             aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7638             atree = proto_item_add_subtree(aitem, ett_ndps);
7639             foffset += 4;
7640             for (i = 1 ; i <= number_of_items; i++ )
7641             {
7642                 length = tvb_get_ntohl(tvb, foffset);
7643                 foffset += 4;
7644                 proto_tree_add_item(ndps_tree, hf_ndps_attribute_set, tvb, foffset, length, FALSE);
7645             }
7646             /* Start of NWDPResManReturnCode */
7647             /*proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7648             foffset += 4;
7649             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7650             {
7651                 break;
7652             }
7653             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7654             foffset += 4;*/
7655             /* End of NWDPResManReturnCode */
7656             break;
7657         case 0x00000002:    /* Unbind */
7658             /* NoOp */
7659             break;
7660         case 0x00000003:    /* Add Resource File */
7661         case 0x00000004:    /* Delete Resource File */
7662             /* Start of NWDPResManReturnCode */
7663             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7664             foffset += 4;
7665             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7666             {
7667                 break;
7668             }
7669             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7670             foffset += 4;
7671             /* End of NWDPResManReturnCode */
7672             break;
7673         case 0x00000005:    /* List Resources */
7674             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7675             foffset += 4;
7676             if (tvb_get_ntohl(tvb, foffset-4) != 0) 
7677             {
7678                 break;
7679             }
7680             proto_tree_add_item(ndps_tree, hf_ndps_status_flags, tvb, foffset, 4, FALSE);
7681             foffset += 4;
7682             proto_tree_add_item(ndps_tree, hf_ndps_resource_list_type, tvb, foffset, 4, FALSE);
7683             resource_type = tvb_get_ntohl(tvb, foffset);
7684             foffset += 4;
7685             switch (resource_type) 
7686             {
7687             case 0:     /* Print Drivers */
7688             case 1:     /* Printer Definitions */
7689             case 2:     /* Printer Definitions Short */
7690                 number_of_items = tvb_get_ntohl(tvb, foffset);
7691                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7692                 atree = proto_item_add_subtree(aitem, ett_ndps);
7693                 foffset += 4;
7694                 for (i = 1 ; i <= number_of_items; i++ )
7695                 {
7696                     if (tvb_get_ntohl(tvb, foffset)==0) {  /* Offset for old type support */
7697                         foffset += 2;
7698                     }
7699                     foffset += 4; /* Item always == 1 */
7700                     foffset = ndps_string(tvb, hf_ndps_printer_manuf, atree, foffset);
7701                     if (tvb_get_ntohl(tvb, foffset)==0) {
7702                         foffset += 2;
7703                     }
7704                     foffset += 4;
7705                     foffset = ndps_string(tvb, hf_ndps_printer_type, atree, foffset);
7706                     if (tvb_get_ntohl(tvb, foffset)==0) {
7707                         foffset += 2;
7708                     }
7709                     foffset += 4;
7710                     foffset = ndps_string(tvb, hf_ndps_inf_file_name, atree, foffset);
7711                 }
7712                 break;
7713             case 3:     /* Banner Page Files */
7714                 number_of_items = tvb_get_ntohl(tvb, foffset);
7715                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7716                 atree = proto_item_add_subtree(aitem, ett_ndps);
7717                 foffset += 4;
7718                 for (i = 1 ; i <= number_of_items; i++ )
7719                 {
7720                     foffset = ndps_string(tvb, hf_ndps_banner_name, atree, foffset);
7721                 }
7722                 break;
7723             case 4:     /* Font Types */
7724                 number_of_items = tvb_get_ntohl(tvb, foffset);
7725                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7726                 atree = proto_item_add_subtree(aitem, ett_ndps);
7727                 foffset += 4;
7728                 for (i = 1 ; i <= number_of_items; i++ )
7729                 {
7730                     foffset = ndps_string(tvb, hf_font_type_name, atree, foffset);
7731                 }
7732                 break;
7733             case 7:     /* Font Files */
7734                 number_of_items = tvb_get_ntohl(tvb, foffset);
7735                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7736                 atree = proto_item_add_subtree(aitem, ett_ndps);
7737                 foffset += 4;
7738                 for (i = 1 ; i <= number_of_items; i++ )
7739                 {
7740                     foffset = ndps_string(tvb, hf_font_file_name, atree, foffset);
7741                 }
7742                 break;
7743             case 5:     /* Printer Driver Files */
7744             case 12:    /* Printer Driver Files 2 */
7745             case 9:     /* Generic Files */
7746                 number_of_items = tvb_get_ntohl(tvb, foffset);
7747                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7748                 atree = proto_item_add_subtree(aitem, ett_ndps);
7749                 foffset += 4;
7750                 for (i = 1 ; i <= number_of_items; i++ )
7751                 {
7752                     foffset = ndps_string(tvb, hf_ndps_prn_file_name, atree, foffset);
7753                     foffset = ndps_string(tvb, hf_ndps_prn_dir_name, atree, foffset);
7754                     foffset = ndps_string(tvb, hf_ndps_inf_file_name, atree, foffset);
7755                 }
7756                 break;
7757             case 6:     /* Printer Definition File */
7758                 number_of_items = tvb_get_ntohl(tvb, foffset);
7759                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7760                 atree = proto_item_add_subtree(aitem, ett_ndps);
7761                 foffset += 4;
7762                 for (i = 1 ; i <= number_of_items; i++ )
7763                 {
7764                     foffset = ndps_string(tvb, hf_ndps_prn_file_name, atree, foffset);
7765                     foffset = ndps_string(tvb, hf_ndps_prn_dir_name, atree, foffset);
7766                     foffset = ndps_string(tvb, hf_ndps_inf_file_name, atree, foffset);
7767                 }
7768                 number_of_items = tvb_get_ntohl(tvb, foffset);
7769                 bitem = proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7770                 btree = proto_item_add_subtree(bitem, ett_ndps);
7771                 foffset += 4;
7772                 for (i = 1 ; i <= number_of_items; i++ )
7773                 {
7774                     foffset = ndps_string(tvb, hf_ndps_def_file_name, btree, foffset);
7775                     number_of_items2 = tvb_get_ntohl(tvb, foffset);
7776                     citem = proto_tree_add_item(btree, hf_ndps_win31_items, tvb, foffset, 4, FALSE);
7777                     ctree = proto_item_add_subtree(citem, ett_ndps);
7778                     foffset += 4;
7779                     for (i = 1 ; i <= number_of_items2; i++ )
7780                     {
7781                         foffset = ndps_string(tvb, hf_ndps_windows_key, ctree, foffset);
7782                     }
7783                     number_of_items2 = tvb_get_ntohl(tvb, foffset);
7784                     citem = proto_tree_add_item(btree, hf_ndps_win95_items, tvb, foffset, 4, FALSE);
7785                     ctree = proto_item_add_subtree(citem, ett_ndps);
7786                     foffset += 4;
7787                     for (i = 1 ; i <= number_of_items2; i++ )
7788                     {
7789                         foffset = ndps_string(tvb, hf_ndps_windows_key, ctree, foffset);
7790                     }
7791                 }
7792                 break;
7793             case 10:    /* Printer Definition File 2 */
7794                 foffset = ndps_string(tvb, hf_ndps_def_file_name, ndps_tree, foffset);
7795                 number_of_items = tvb_get_ntohl(tvb, foffset);
7796                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7797                 atree = proto_item_add_subtree(aitem, ett_ndps);
7798                 foffset += 4;
7799                 for (i = 1 ; i <= number_of_items; i++ )
7800                 {
7801                     proto_tree_add_item(ndps_tree, hf_os_type, tvb, foffset, 4, FALSE);
7802                     foffset += 4;
7803                     number_of_items2 = tvb_get_ntohl(tvb, foffset);
7804                     bitem = proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7805                     btree = proto_item_add_subtree(bitem, ett_ndps);
7806                     foffset += 4;
7807                     for (i = 1 ; i <= number_of_items2; i++ )
7808                     {
7809                         foffset = ndps_string(tvb, hf_ndps_windows_key, btree, foffset);
7810                     }
7811                 }
7812                 break;
7813             case 8:     /* Generic Type */
7814             case 11:    /* Printer Driver Types 2 */
7815             case 13:    /* Printer Driver Types Archive */
7816                 number_of_items = tvb_get_ntohl(tvb, foffset);
7817                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7818                 atree = proto_item_add_subtree(aitem, ett_ndps);
7819                 foffset += 4;
7820                 for (i = 1 ; i <= number_of_items; i++ )
7821                 {
7822                     foffset = ndps_string(tvb, hf_ndps_printer_manuf, atree, foffset);
7823                     foffset = ndps_string(tvb, hf_ndps_printer_type, atree, foffset);
7824                     foffset = ndps_string(tvb, hf_ndps_prn_file_name, atree, foffset);
7825                     foffset = ndps_string(tvb, hf_ndps_prn_dir_name, atree, foffset);
7826                     proto_tree_add_item(atree, hf_archive_type, tvb, foffset, 4, FALSE);
7827                     foffset += 4;
7828                     proto_tree_add_item(atree, hf_archive_file_size, tvb, foffset, 4, FALSE);
7829                     foffset += 4;
7830                 }
7831                 break;
7832             case 14:    /* Languages Available */
7833                 number_of_items = tvb_get_ntohl(tvb, foffset);
7834                 aitem = proto_tree_add_item(ndps_tree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7835                 atree = proto_item_add_subtree(aitem, ett_ndps);
7836                 foffset += 4;
7837                 for (i = 1 ; i <= number_of_items; i++ )
7838                 {
7839                     proto_tree_add_item(atree, hf_ndps_language_id, tvb, foffset, 4, FALSE);
7840                     foffset += 4;
7841                 }
7842                 break;
7843             default:
7844                 break;
7845             }
7846             break;
7847         case 0x00000006:    /* Get Resource File */
7848             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7849             foffset += 4;
7850             if (tvb_get_ntohl(tvb, foffset-4) != 0) 
7851             {
7852                 break;
7853             }
7854             proto_tree_add_item(ndps_tree, hf_get_status_flag, tvb, foffset, 4, FALSE);
7855             foffset += 4;
7856             proto_tree_add_item(ndps_tree, hf_file_timestamp, tvb, foffset, 4, FALSE);
7857             foffset += 4;
7858             proto_tree_add_item(ndps_tree, hf_ndps_data, tvb, foffset, -1, FALSE);
7859             break;
7860         case 0x00000007:    /* Get Resource File Date */
7861             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7862             foffset += 4;
7863             if (tvb_get_ntohl(tvb, foffset-4) != 0) 
7864             {
7865                 break;
7866             }
7867             proto_tree_add_item(ndps_tree, hf_file_timestamp, tvb, foffset, 4, FALSE);
7868             foffset += 4;
7869             break;
7870         case 0x00000008:    /* Get Resource Manager NDS Object Name */
7871             qualified_name_type = tvb_get_ntohl(tvb, foffset);
7872             proto_tree_add_uint(ndps_tree, hf_ndps_qualified_name, tvb, foffset, 
7873             4, qualified_name_type);
7874             foffset += 4;
7875             if (qualified_name_type != 0) {
7876                 if (qualified_name_type == 1) {
7877                     foffset = ndps_string(tvb, hf_printer_name, ndps_tree, foffset);
7878                 }
7879                 else
7880                 {
7881                     foffset = ndps_string(tvb, hf_ndps_broker_name, ndps_tree, foffset);
7882                     foffset = ndps_string(tvb, hf_ndps_tree, ndps_tree, foffset);
7883                 }
7884             }
7885             proto_tree_add_uint(ndps_tree, hf_ndps_error_val, tvb, foffset, 4, error_val);
7886             foffset += 4;
7887             break;
7888         case 0x00000009:    /* Get Resource Manager Session Information */
7889             proto_tree_add_item(ndps_tree, hf_ndps_get_resman_session_type, tvb, foffset, 4, FALSE);
7890             foffset += 4;
7891             proto_tree_add_item(ndps_tree, hf_time, tvb, foffset, 4, FALSE);
7892             foffset += 4;
7893             /* Start of NWDPResManReturnCode */
7894             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7895             foffset += 4;
7896             if (tvb_get_ntohl(tvb, foffset-4) == 0) 
7897             {
7898                 break;
7899             }
7900             proto_tree_add_item(ndps_tree, hf_ndps_ext_error, tvb, foffset, 4, FALSE);
7901             foffset += 4;
7902             /* End of NWDPResManReturnCode */
7903             break;
7904         case 0x0000000a:    /* Set Resource Language Context */
7905             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7906             foffset += 4;
7907             if (tvb_get_ntohl(tvb, foffset-4) != 0) 
7908             {
7909                 break;
7910             }
7911             proto_tree_add_item(ndps_tree, hf_ndps_language_id, tvb, foffset, 4, FALSE);
7912             foffset += 4;
7913             break;
7914         default:
7915             break;
7916         }
7917         break;
7918     case 0x06097b:  /* Delivery */
7919         switch(ndps_func)
7920         {
7921         case 0x00000001:    /* Delivery Bind */
7922             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7923             foffset += 4;
7924             break;
7925         case 0x00000002:    /* Delivery Unbind */
7926             /* NoOp */
7927             break;
7928         case 0x00000003:    /* Delivery Send */
7929         case 0x00000004:    /* Delivery Send2 */
7930             proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE);
7931             foffset += 4;
7932             if (tvb_get_ntohl(tvb, foffset-4) != 0) 
7933             {
7934                 break;
7935             }
7936             aitem = proto_tree_add_text(ndps_tree, tvb, foffset, 0, "Failed Items");
7937             atree = proto_item_add_subtree(aitem, ett_ndps);
7938             proto_tree_add_item(atree, hf_ndps_item_count, tvb, foffset, 4, FALSE);
7939             number_of_items=tvb_get_ntohl(tvb, foffset);
7940             foffset += 4;
7941             for (i = 1 ; i <= number_of_items; i++ )
7942             {
7943                 length=tvb_get_ntohl(tvb, foffset);
7944                 if(tvb_length_remaining(tvb, foffset) < length)
7945                 {
7946                     return;
7947                 }
7948                 proto_tree_add_item(atree, hf_ndps_item_ptr, tvb, foffset, length, FALSE);
7949                 foffset += length;
7950             }
7951             break;
7952         default:
7953             break;
7954         }
7955         break;
7956     default:
7957         break;
7958     }
7959     return;
7960 }
7961
7962 void
7963 proto_register_ndps(void)
7964 {
7965         static hf_register_info hf_ndps[] = {
7966                 { &hf_ndps_record_mark,
7967                 { "Record Mark",                "ndps.record_mark", FT_UINT16, BASE_HEX, NULL, 0x0,
7968                         "Record Mark", HFILL }},
7969
7970         { &hf_ndps_packet_type,
7971         { "Packet Type",    "ndps.packet_type",
7972           FT_UINT32,    BASE_HEX,   VALS(ndps_packet_types),   0x0,
7973           "Packet Type", HFILL }},
7974
7975         { &hf_ndps_length,
7976         { "Record Length",    "ndps.record_length",
7977            FT_UINT16,    BASE_DEC,   NULL,   0x0,
7978            "Record Length", HFILL }},
7979         
7980         { &hf_ndps_xid,
7981         { "Exchange ID",    "ndps.xid",
7982            FT_UINT32,    BASE_HEX,   NULL,   0x0,
7983            "Exchange ID", HFILL }},
7984
7985         { &hf_ndps_rpc_version,
7986         { "RPC Version",    "ndps.rpc_version",
7987            FT_UINT32,    BASE_HEX,   NULL,   0x0,
7988            "RPC Version", HFILL }},
7989
7990         { &hf_spx_ndps_program,
7991         { "NDPS Program Number",    "spx.ndps_program",
7992           FT_UINT32,    BASE_HEX,   VALS(spx_ndps_program_vals),   0x0,
7993           "NDPS Program Number", HFILL }},
7994         
7995         { &hf_spx_ndps_version,
7996         { "Program Version",    "spx.ndps_version",
7997           FT_UINT32,    BASE_DEC,   NULL,   0x0,
7998           "Program Version", HFILL }}, 
7999     
8000         { &hf_ndps_error,
8001         { "NDPS Error",    "spx.ndps_error",
8002           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8003           "NDPS Error", HFILL }}, 
8004         
8005         { &hf_spx_ndps_func_print,
8006         { "Print Program",    "spx.ndps_func_print",
8007           FT_UINT32,    BASE_HEX,   VALS(spx_ndps_print_func_vals),   0x0,
8008           "Print Program", HFILL }},
8009         
8010         { &hf_spx_ndps_func_notify,
8011         { "Notify Program",    "spx.ndps_func_notify",
8012           FT_UINT32,    BASE_HEX,   VALS(spx_ndps_notify_func_vals),   0x0,
8013           "Notify Program", HFILL }},
8014         
8015         { &hf_spx_ndps_func_delivery,
8016         { "Delivery Program",    "spx.ndps_func_delivery",
8017           FT_UINT32,    BASE_HEX,   VALS(spx_ndps_deliver_func_vals),   0x0,
8018           "Delivery Program", HFILL }},
8019         
8020         { &hf_spx_ndps_func_registry,
8021         { "Registry Program",    "spx.ndps_func_registry",
8022           FT_UINT32,    BASE_HEX,   VALS(spx_ndps_registry_func_vals),   0x0,
8023           "Registry Program", HFILL }},
8024         
8025         { &hf_spx_ndps_func_resman,
8026         { "ResMan Program",    "spx.ndps_func_resman",
8027           FT_UINT32,    BASE_HEX,   VALS(spx_ndps_resman_func_vals),   0x0,
8028           "ResMan Program", HFILL }},
8029         
8030         { &hf_spx_ndps_func_broker,
8031         { "Broker Program",    "spx.ndps_func_broker",
8032           FT_UINT32,    BASE_HEX,   VALS(spx_ndps_broker_func_vals),   0x0,
8033           "Broker Program", HFILL }},
8034         
8035         { &hf_ndps_items,
8036         { "Number of Items",    "ndps.items",
8037           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8038           "Number of Items", HFILL }},
8039
8040         { &hf_ndps_objects,
8041         { "Number of Objects",    "ndps.objects",
8042           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8043           "Number of Obejcts", HFILL }},
8044
8045         { &hf_ndps_attributes,
8046         { "Number of Attributes",    "ndps.attributes",
8047           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8048           "Number of Attributes", HFILL }},
8049
8050         { &hf_ndps_sbuffer,
8051         { "Server",    "ndps.sbuffer",
8052           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8053           "Server", HFILL }},
8054         
8055         { &hf_ndps_rbuffer,
8056         { "Connection",    "ndps.rbuffer",
8057           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8058           "Connection", HFILL }},
8059
8060         { &hf_ndps_user_name,
8061         { "Trustee Name",    "ndps.user_name",
8062           FT_STRING,    BASE_NONE,   NULL,   0x0,
8063           "Trustee Name", HFILL }},
8064         
8065         { &hf_ndps_broker_name,
8066         { "Broker Name",    "ndps.broker_name",
8067           FT_STRING,    BASE_NONE,   NULL,   0x0,
8068           "Broker Name", HFILL }},
8069
8070         { &hf_ndps_pa_name,
8071         { "Printer Name",    "ndps.pa_name",
8072           FT_STRING,    BASE_NONE,   NULL,   0x0,
8073           "Printer Name", HFILL }},
8074         
8075         { &hf_ndps_tree,
8076         { "Tree",    "ndps.tree",
8077           FT_STRING,    BASE_NONE,   NULL,   0x0,
8078           "Tree", HFILL }},
8079
8080         { &hf_ndps_reqframe,
8081         { "Request Frame",    "ndps.reqframe",
8082           FT_FRAMENUM,  BASE_NONE,   NULL,   0x0,
8083           "Request Frame", HFILL }},
8084
8085         { &hf_ndps_error_val,
8086         { "Return Status",    "ndps.error_val",
8087           FT_UINT32,    BASE_HEX,   VALS(ndps_error_types),   0x0,
8088           "Return Status", HFILL }},
8089
8090         { &hf_ndps_object,
8091         { "Object ID",    "ndps.object",
8092           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8093           "Object ID", HFILL }},
8094
8095         { &hf_ndps_cred_type,
8096         { "Credential Type",    "ndps.cred_type",
8097           FT_UINT32,    BASE_HEX,   VALS(ndps_credential_enum),   0x0,
8098           "Credential Type", HFILL }},
8099
8100         { &hf_ndps_server_name,
8101         { "Server Name",    "ndps.server_name",
8102           FT_STRING,    BASE_DEC,   NULL,   0x0,
8103           "Server Name", HFILL }},
8104
8105         { &hf_ndps_connection,
8106         { "Connection",    "ndps.connection",
8107           FT_UINT16,    BASE_DEC,   NULL,   0x0,
8108           "Connection", HFILL }},
8109
8110         { &hf_ndps_ext_error,
8111         { "Extended Error Code",    "ndps.ext_error",
8112           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8113           "Extended Error Code", HFILL }},
8114
8115         { &hf_ndps_auth_null,
8116         { "Auth Null",    "ndps.auth_null",
8117           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8118           "Auth Null", HFILL }},
8119
8120         { &hf_ndps_rpc_accept,
8121         { "RPC Accept or Deny",    "ndps.rpc_acc",
8122           FT_UINT32,    BASE_HEX,   VALS(true_false),   0x0,
8123           "RPC Accept or Deny", HFILL }},
8124
8125         { &hf_ndps_rpc_acc_stat,
8126         { "RPC Accept Status",    "ndps.rpc_acc_stat",
8127           FT_UINT32,    BASE_HEX,   VALS(accept_stat),   0x0,
8128           "RPC Accept Status", HFILL }},
8129         
8130         { &hf_ndps_rpc_rej_stat,
8131         { "RPC Reject Status",    "ndps.rpc_rej_stat",
8132           FT_UINT32,    BASE_HEX,   VALS(reject_stat),   0x0,
8133           "RPC Reject Status", HFILL }},
8134         
8135         { &hf_ndps_rpc_acc_results,
8136         { "RPC Accept Results",    "ndps.rpc_acc_res",
8137           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8138           "RPC Accept Results", HFILL }},
8139
8140         { &hf_ndps_problem_type,
8141         { "Problem Type",    "ndps.rpc_prob_type",
8142           FT_UINT32,    BASE_HEX,   VALS(error_type_enum),   0x0,
8143           "Problem Type", HFILL }},
8144     
8145         { &hf_security_problem_type,
8146         { "Security Problem",    "ndps.rpc_sec_prob",
8147           FT_UINT32,    BASE_HEX,   VALS(security_problem_enum),   0x0,
8148           "Security Problem", HFILL }},
8149
8150         { &hf_service_problem_type,
8151         { "Service Problem",    "ndps.rpc_serv_prob",
8152           FT_UINT32,    BASE_HEX,   VALS(service_problem_enum),   0x0,
8153           "Service Problem", HFILL }},
8154         
8155         { &hf_access_problem_type,
8156         { "Access Problem",    "ndps.rpc_acc_prob",
8157           FT_UINT32,    BASE_HEX,   VALS(access_problem_enum),   0x0,
8158           "Access Problem", HFILL }},
8159         
8160         { &hf_printer_problem_type,
8161         { "Printer Problem",    "ndps.rpc_print_prob",
8162           FT_UINT32,    BASE_HEX,   VALS(printer_problem_enum),   0x0,
8163           "Printer Problem", HFILL }},
8164         
8165         { &hf_selection_problem_type,
8166         { "Selection Problem",    "ndps.rpc_sel_prob",
8167           FT_UINT32,    BASE_HEX,   VALS(selection_problem_enum),   0x0,
8168           "Selection Problem", HFILL }},
8169         
8170         { &hf_doc_access_problem_type,
8171         { "Document Access Problem",    "ndps.rpc_doc_acc_prob",
8172           FT_UINT32,    BASE_HEX,   VALS(doc_access_problem_enum),   0x0,
8173           "Document Access Problem", HFILL }},
8174         
8175         { &hf_attribute_problem_type,
8176         { "Attribute Problem",    "ndps.rpc_attr_prob",
8177           FT_UINT32,    BASE_HEX,   VALS(attribute_problem_enum),   0x0,
8178           "Attribute Problem", HFILL }},
8179
8180         { &hf_update_problem_type,
8181         { "Update Problem",    "ndps.rpc_update_prob",
8182           FT_UINT32,    BASE_HEX,   VALS(update_problem_enum),   0x0,
8183           "Update Problem", HFILL }},
8184         
8185         { &hf_obj_id_type,
8186         { "Object ID Type",    "ndps.rpc_obj_id_type",
8187           FT_UINT32,    BASE_HEX,   VALS(obj_identification_enum),   0x0,
8188           "Object ID Type", HFILL }},
8189
8190         { &hf_oid_struct_size,
8191         { "OID Struct Size",    "ndps.rpc_oid_struct_size",
8192           FT_UINT16,    BASE_HEX,   NULL,   0x0,
8193           "OID Struct Size", HFILL }},
8194         
8195         { &hf_object_name,
8196         { "Object Name",    "ndps.ndps_object_name",
8197           FT_STRING,    BASE_NONE,   NULL,   0x0,
8198           "Object Name", HFILL }},
8199
8200         { &hf_ndps_document_number,
8201         { "Document Number",    "ndps.ndps_doc_num",
8202           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8203           "Document Number", HFILL }},
8204
8205         { &hf_ndps_nameorid,
8206         { "Name or ID Type",    "ndps.ndps_nameorid",
8207           FT_UINT32,    BASE_HEX,   VALS(nameorid_enum),   0x0,
8208           "Name or ID Type", HFILL }},
8209
8210         { &hf_local_object_name,
8211         { "Local Object Name",    "ndps.ndps_loc_object_name",
8212           FT_STRING,    BASE_NONE,   NULL,   0x0,
8213           "Local Object Name", HFILL }},
8214
8215         { &hf_printer_name,
8216         { "Printer Name",    "ndps.ndps_printer_name",
8217           FT_STRING,    BASE_NONE,   NULL,   0x0,
8218           "Printer Name", HFILL }},
8219
8220         { &hf_ndps_qualified_name,
8221         { "Qualified Name Type",    "ndps.ndps_qual_name_type",
8222           FT_UINT32,    BASE_HEX,   VALS(qualified_name_enum),   0x0,
8223           "Qualified Name Type", HFILL }},
8224
8225         { &hf_ndps_qualified_name2,
8226         { "Qualified Name Type",    "ndps.ndps_qual_name_type2",
8227           FT_UINT32,    BASE_HEX,   VALS(qualified_name_enum2),   0x0,
8228           "Qualified Name Type", HFILL }},
8229         
8230
8231         { &hf_ndps_item_count,
8232         { "Number of Items",    "ndps.ndps_item_count",
8233           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8234           "Number of Items", HFILL }},
8235
8236         { &hf_ndps_qualifier,
8237         { "Qualifier",    "ndps.ndps_qual",
8238           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8239           "Qualifier", HFILL }},
8240
8241         { &hf_ndps_lib_error,
8242         { "Lib Error",    "ndps.ndps_lib_error",
8243           FT_UINT32,    BASE_HEX,   VALS(ndps_error_types),   0x0,
8244           "Lib Error", HFILL }},
8245
8246         { &hf_ndps_other_error,
8247         { "Other Error",    "ndps.ndps_other_error",
8248           FT_UINT32,    BASE_HEX,   VALS(ndps_error_types),   0x0,
8249           "Other Error", HFILL }},
8250
8251         { &hf_ndps_other_error_2,
8252         { "Other Error 2",    "ndps.ndps_other_error_2",
8253           FT_UINT32,    BASE_HEX,   VALS(ndps_error_types),   0x0,
8254           "Other Error 2", HFILL }},
8255
8256         { &hf_ndps_session,
8257         { "Session Handle",    "ndps.ndps_session",
8258           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8259           "Session Handle", HFILL }},
8260
8261         { &hf_ndps_abort_flag,
8262         { "Abort?",    "ndps.ndps_abort",
8263           FT_BOOLEAN,    BASE_NONE,   NULL,   0x0,
8264           "Abort?", HFILL }},
8265
8266         { &hf_obj_attribute_type,
8267         { "Attribute Type",    "ndps.ndps_attrib_type",
8268           FT_UINT32,    BASE_HEX,   VALS(ndps_attribute_enum),   0x0,
8269           "Attribute Type", HFILL }},
8270
8271         { &hf_ndps_attribute_value,
8272         { "Value",    "ndps.attribue_value",
8273           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8274           "Value", HFILL }},
8275
8276         { &hf_ndps_lower_range,
8277         { "Lower Range",    "ndps.lower_range",
8278           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8279           "Lower Range", HFILL }},
8280
8281         { &hf_ndps_upper_range,
8282         { "Upper Range",    "ndps.upper_range",
8283           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8284           "Upper Range", HFILL }},
8285
8286         { &hf_ndps_n64,
8287         { "Value",    "ndps.n64",
8288           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8289           "Value", HFILL }},
8290
8291         { &hf_ndps_lower_range_n64,
8292         { "Lower Range",    "ndps.lower_range_n64",
8293           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8294           "Lower Range", HFILL }},
8295
8296         { &hf_ndps_upper_range_n64,
8297         { "Upper Range",    "ndps.upper_range_n64",
8298           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8299           "Upper Range", HFILL }},
8300
8301         { &hf_ndps_attrib_boolean,
8302         { "Value?",    "ndps.ndps_attrib_boolean",
8303           FT_BOOLEAN,    BASE_NONE,   NULL,   0x0,
8304           "Value?", HFILL }},
8305
8306         { &hf_ndps_realization,
8307         { "Realization Type",    "ndps.ndps_realization",
8308           FT_UINT32,    BASE_HEX,   VALS(ndps_realization_enum),   0x0,
8309           "Realization Type", HFILL }},
8310
8311         { &hf_ndps_xdimension_n64,
8312         { "X Dimension",    "ndps.xdimension_n64",
8313           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8314           "X Dimension", HFILL }},
8315
8316         { &hf_ndps_ydimension_n64,
8317         { "Y Dimension",    "ndps.xdimension_n64",
8318           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8319           "Y Dimension", HFILL }},
8320
8321         { &hf_ndps_dim_value,
8322         { "Dimension Value Type",    "ndps.ndps_dim_value",
8323           FT_UINT32,    BASE_HEX,   VALS(ndps_dim_value_enum),   0x0,
8324           "Dimension Value Type", HFILL }},
8325
8326         { &hf_ndps_dim_flag,
8327         { "Dimension Flag",    "ndps.ndps_dim_falg",
8328           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8329           "Dimension Flag", HFILL }},
8330
8331         { &hf_ndps_xydim_value,
8332         { "XY Dimension Value Type",    "ndps.ndps_xydim_value",
8333           FT_UINT32,    BASE_HEX,   VALS(ndps_xydim_value_enum),   0x0,
8334           "XY Dimension Value Type", HFILL }},
8335
8336         { &hf_ndps_location_value,
8337         { "Location Value Type",    "ndps.ndps_location_value",
8338           FT_UINT32,    BASE_HEX,   VALS(ndps_location_value_enum),   0x0,
8339           "Location Value Type", HFILL }},
8340
8341         { &hf_ndps_xmin_n64,
8342         { "Minimum X Dimension",    "ndps.xmin_n64",
8343           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8344           "Minimum X Dimension", HFILL }},
8345
8346         { &hf_ndps_xmax_n64,
8347         { "Maximum X Dimension",    "ndps.xmax_n64",
8348           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8349           "Maximum X Dimension", HFILL }},
8350
8351         { &hf_ndps_ymin_n64,
8352         { "Minimum Y Dimension",    "ndps.ymin_n64",
8353           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8354           "Minimum Y Dimension", HFILL }},
8355
8356         { &hf_ndps_ymax_n64,
8357         { "Maximum Y Dimension",    "ndps.ymax_n64",
8358           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8359           "Maximum Y Dimension", HFILL }},
8360
8361         { &hf_ndps_edge_value,
8362         { "Edge Value",    "ndps.ndps_edge_value",
8363           FT_UINT32,    BASE_HEX,   VALS(ndps_edge_value_enum),   0x0,
8364           "Edge Value", HFILL }},
8365
8366         { &hf_ndps_cardinal_or_oid,
8367         { "Cardinal or OID",    "ndps.ndps_car_or_oid",
8368           FT_UINT32,    BASE_HEX,   VALS(ndps_card_or_oid_enum),   0x0,
8369           "Cardinal or OID", HFILL }},
8370
8371         { &hf_ndps_cardinal_name_or_oid,
8372         { "Cardinal Name or OID",    "ndps.ndps_car_name_or_oid",
8373           FT_UINT32,    BASE_HEX,   VALS(ndps_card_name_or_oid_enum),   0x0,
8374           "Cardinal Name or OID", HFILL }},
8375
8376         { &hf_ndps_integer_or_oid,
8377         { "Integer or OID",    "ndps.ndps_integer_or_oid",
8378           FT_UINT32,    BASE_HEX,   VALS(ndps_integer_or_oid_enum),   0x0,
8379           "Integer or OID", HFILL }},
8380
8381         { &hf_ndps_profile_id,
8382         { "Profile ID",    "ndps.ndps_profile_id",
8383           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8384           "Profile ID", HFILL }},
8385
8386         { &hf_ndps_persistence,
8387         { "Persistence",    "ndps.ndps_persistence",
8388           FT_UINT32,    BASE_HEX,   VALS(ndps_persistence_enum),   0x0,
8389           "Persistence", HFILL }},
8390
8391         { &hf_ndps_language_id,
8392         { "Language ID",    "ndps.ndps_lang_id",
8393           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8394           "Language ID", HFILL }},
8395
8396         { &hf_address_type,
8397         { "Address Type",    "ndps.ndps_address_type",
8398           FT_UINT32,    BASE_HEX,   VALS(ndps_address_type_enum),   0x0,
8399           "Address Type", HFILL }},
8400
8401         { &hf_ndps_address,
8402         { "Address",    "ndps.ndps_address",
8403           FT_UINT32,    BASE_HEX,   VALS(ndps_address_enum),   0x0,
8404           "Address", HFILL }},
8405
8406         { &hf_ndps_add_bytes,
8407         { "Address Bytes",    "ndps.add_bytes",
8408           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8409           "Address Bytes", HFILL }},
8410
8411         { &hf_ndps_event_type,
8412         { "Event Type",    "ndps.ndps_event_type",
8413           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8414           "Event Type", HFILL }},
8415
8416         { &hf_ndps_event_object_identifier,
8417         { "Event Object Type",    "ndps.ndps_event_object_identifier",
8418           FT_UINT32,    BASE_HEX,   VALS(ndps_event_object_enum),   0x0,
8419           "Event Object Type", HFILL }},
8420
8421         { &hf_ndps_octet_string,
8422         { "Octet String",    "ndps.octet_string",
8423           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8424           "Octet String", HFILL }},
8425
8426         { &hf_ndps_scope,
8427         { "Scope",    "ndps.scope",
8428           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8429           "Scope", HFILL }},
8430
8431         { &hf_address_len,
8432         { "Address Length",    "ndps.addr_len",
8433           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8434           "Address Length", HFILL }},
8435
8436         { &hf_ndps_net,
8437         { "IPX Network",    "ndps.net",
8438           FT_IPXNET,    BASE_NONE,   NULL,   0x0,
8439           "Scope", HFILL }},
8440
8441         { &hf_ndps_node,
8442         { "Node",    "ndps.node",
8443           FT_ETHER,    BASE_NONE,   NULL,   0x0,
8444           "Node", HFILL }},
8445
8446         { &hf_ndps_socket,
8447         { "IPX Socket",    "ndps.socket",
8448           FT_UINT16,    BASE_HEX,   NULL,   0x0,
8449           "IPX Socket", HFILL }},
8450
8451         { &hf_ndps_port,
8452         { "IP Port",    "ndps.port",
8453           FT_UINT16,    BASE_DEC,   NULL,   0x0,
8454           "IP Port", HFILL }},
8455
8456         { &hf_ndps_ip,
8457         { "IP Address",    "ndps.ip",
8458           FT_IPv4,    BASE_DEC,   NULL,   0x0,
8459           "IP Address", HFILL }},
8460         
8461         { &hf_ndps_server_type,
8462         { "NDPS Server Type",    "ndps.ndps_server_type",
8463           FT_UINT32,    BASE_HEX,   VALS(ndps_server_type_enum),   0x0,
8464           "NDPS Server Type", HFILL }},
8465
8466         { &hf_ndps_service_type,
8467         { "NDPS Service Type",    "ndps.ndps_service_type",
8468           FT_UINT32,    BASE_HEX,   VALS(ndps_service_type_enum),   0x0,
8469           "NDPS Service Type", HFILL }},
8470     
8471         { &hf_ndps_service_enabled,
8472         { "Service Enabled?",    "ndps.ndps_service_enabled",
8473           FT_BOOLEAN,    BASE_NONE,   NULL,   0x0,
8474           "Service Enabled?", HFILL }},
8475
8476         { &hf_ndps_method_name,
8477         { "Method Name",    "ndps.method_name",
8478           FT_STRING,    BASE_NONE,   NULL,   0x0,
8479           "Method Name", HFILL }},
8480
8481         { &hf_ndps_method_ver,
8482         { "Method Version",    "ndps.method_ver",
8483           FT_STRING,    BASE_NONE,   NULL,   0x0,
8484           "Method Version", HFILL }},
8485
8486         { &hf_ndps_file_name,
8487         { "File Name",    "ndps.file_name",
8488           FT_STRING,    BASE_NONE,   NULL,   0x0,
8489           "File Name", HFILL }},
8490         
8491         { &hf_ndps_admin_submit,
8492         { "Admin Submit Flag?",    "ndps.admin_submit_flag",
8493           FT_BOOLEAN,    BASE_NONE,   NULL,   0x0,
8494           "Admin Submit Flag?", HFILL }},
8495
8496         { &hf_ndps_oid,
8497         { "Object ID",    "ndps.oid",
8498           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8499           "Object ID", HFILL }},
8500
8501         { &hf_ndps_object_op,
8502         { "Operation",    "ndps.ndps_object_op",
8503           FT_UINT32,    BASE_HEX,   VALS(ndps_object_op_enum),   0x0,
8504           "Operation", HFILL }},
8505
8506         { &hf_answer_time,
8507         { "Answer Time",    "ndps.answer_time",
8508           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8509           "Answer Time", HFILL }},
8510         
8511         { &hf_oid_asn1_type,
8512         { "ASN.1 Type",    "ndps.asn1_type",
8513           FT_UINT16,    BASE_DEC,   NULL,   0x0,
8514           "ASN.1 Type", HFILL }},
8515
8516         { &hf_ndps_item_ptr,
8517         { "Item Pointer",    "ndps.item_ptr",
8518           FT_BYTES,    BASE_DEC,   NULL,   0x0,
8519           "Item Pointer", HFILL }},
8520
8521         { &hf_ndps_len,
8522         { "Length",    "ndps.ndps_len",
8523           FT_UINT16,    BASE_DEC,   NULL,   0x0,
8524           "Length", HFILL }},
8525      
8526         { &hf_limit_enc,
8527         { "Limit Encountered",    "ndps.ndps_limit_enc",
8528           FT_UINT32,    BASE_HEX,   VALS(ndps_limit_enc_enum),   0x0,
8529           "Limit Encountered", HFILL }},
8530         
8531         { &hf_ndps_delivery_add_type,
8532         { "Delivery Address Type",    "ndps.ndps_delivery_add_type",
8533           FT_UINT32,    BASE_HEX,   VALS(ndps_delivery_add_enum),   0x0,
8534           "Delivery Address Type", HFILL }},
8535
8536         { &hf_ndps_criterion_type,
8537         { "Criterion Type",    "ndps.ndps_criterion_type",
8538           FT_UINT32,    BASE_HEX,   VALS(ndps_attribute_enum),   0x0,
8539           "Criterion Type", HFILL }},
8540
8541         { &hf_ndps_ignored_type,
8542         { "Ignored Type",    "ndps.ndps_ignored_type",
8543           FT_UINT32,    BASE_HEX,   VALS(ndps_attribute_enum),   0x0,
8544           "Ignored Type", HFILL }},
8545
8546         { &hf_ndps_resource_type,
8547         { "Resource Type",    "ndps.ndps_resource_type",
8548           FT_UINT32,    BASE_HEX,   VALS(ndps_resource_enum),   0x0,
8549           "Resource Type", HFILL }},
8550       
8551         { &hf_ndps_identifier_type,
8552         { "Identifier Type",    "ndps.ndps_identifier_type",
8553           FT_UINT32,    BASE_HEX,   VALS(ndps_identifier_enum),   0x0,
8554           "Identifier Type", HFILL }},
8555
8556         { &hf_ndps_page_flag,
8557         { "Page Flag",    "ndps.ndps_page_flag",
8558           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8559           "Page Flag", HFILL }},
8560         
8561         { &hf_ndps_media_type,
8562         { "Media Type",    "ndps.ndps_media_type",
8563           FT_UINT32,    BASE_HEX,   VALS(ndps_media_enum),   0x0,
8564           "Media Type", HFILL }},
8565
8566         { &hf_ndps_page_size,
8567         { "Page Size",    "ndps.ndps_page_size",
8568           FT_UINT32,    BASE_HEX,   VALS(ndps_page_size_enum),   0x0,
8569           "Page Size", HFILL }},
8570      
8571         { &hf_ndps_direction,
8572         { "Direction",    "ndps.ndps_direction",
8573           FT_UINT32,    BASE_HEX,   VALS(ndps_pres_direction_enum),   0x0,
8574           "Direction", HFILL }},
8575        
8576         { &hf_ndps_page_order,
8577         { "Page Order",    "ndps.ndps_page_order",
8578           FT_UINT32,    BASE_HEX,   VALS(ndps_page_order_enum),   0x0,
8579           "Page Order", HFILL }},
8580
8581         { &hf_ndps_medium_size,
8582         { "Medium Size",    "ndps.ndps_medium_size",
8583           FT_UINT32,    BASE_HEX,   VALS(ndps_medium_size_enum),   0x0,
8584           "Medium Size", HFILL }},
8585
8586         { &hf_ndps_long_edge_feeds,
8587         { "Long Edge Feeds?",    "ndps.ndps_long_edge_feeds",
8588           FT_BOOLEAN,    BASE_NONE,   NULL,   0x0,
8589           "Long Edge Feeds?", HFILL }},
8590
8591         { &hf_ndps_inc_across_feed,
8592         { "Increment Across Feed",    "ndps.inc_across_feed",
8593           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8594           "Increment Across Feed", HFILL }},
8595
8596         { &hf_ndps_size_inc_in_feed,
8597         { "Size Increment in Feed",    "ndps.size_inc_in_feed",
8598           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8599           "Size Increment in Feed", HFILL }},
8600
8601         { &hf_ndps_page_orientation,
8602         { "Page Orientation",    "ndps.ndps_page_orientation",
8603           FT_UINT32,    BASE_HEX,   VALS(ndps_page_orientation_enum),   0x0,
8604           "Page Orientation", HFILL }},
8605
8606         { &hf_ndps_numbers_up,
8607         { "Numbers Up",    "ndps.ndps_numbers_up",
8608           FT_UINT32,    BASE_HEX,   VALS(ndps_numbers_up_enum),   0x0,
8609           "Numbers Up", HFILL }},
8610
8611         { &hf_ndps_xdimension,
8612         { "X Dimension",    "ndps.ndps_xdimension",
8613           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8614           "X Dimension", HFILL }},
8615         
8616         { &hf_ndps_ydimension,
8617         { "Y Dimension",    "ndps.ndps_ydimension",
8618           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8619           "Y Dimension", HFILL }},
8620         
8621         { &hf_ndps_state_severity,
8622         { "State Severity",    "ndps.ndps_state_severity",
8623           FT_UINT32,    BASE_HEX,   VALS(ndps_state_severity_enum),   0x0,
8624           "State Severity", HFILL }},
8625
8626         { &hf_ndps_training,
8627         { "Training",    "ndps.ndps_training",
8628           FT_UINT32,    BASE_HEX,   VALS(ndps_training_enum),   0x0,
8629           "Training", HFILL }},
8630
8631         { &hf_ndps_colorant_set,
8632         { "Colorant Set",    "ndps.ndps_colorant_set",
8633           FT_UINT32,    BASE_HEX,   VALS(ndps_colorant_set_enum),   0x0,
8634           "Colorant Set", HFILL }},
8635
8636         { &hf_ndps_card_enum_time,
8637         { "Cardinal, Enum, or Time",    "ndps.ndps_card_enum_time",
8638           FT_UINT32,    BASE_HEX,   VALS(ndps_card_enum_time_enum),   0x0,
8639           "Cardinal, Enum, or Time", HFILL }},
8640
8641         { &hf_ndps_attrs_arg,
8642         { "List Attribute Operation",    "ndps.ndps_attrs_arg",
8643           FT_UINT32,    BASE_HEX,   VALS(ndps_attrs_arg_enum),   0x0,
8644           "List Attribute Operation", HFILL }},
8645         
8646         { &hf_ndps_context,
8647         { "Context",    "ndps.context",
8648           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8649           "Context", HFILL }},
8650
8651         { &hf_ndps_filter,
8652         { "Filter Type",    "ndps.ndps_filter",
8653           FT_UINT32,    BASE_HEX,   VALS(ndps_filter_enum),   0x0,
8654           "Filter Type", HFILL }},
8655
8656         { &hf_ndps_item_filter,
8657         { "Filter Item Operation",    "ndps.ndps_filter_item",
8658           FT_UINT32,    BASE_HEX,   VALS(ndps_filter_item_enum),   0x0,
8659           "Filter Item Operation", HFILL }},
8660         
8661         { &hf_ndps_substring_match,
8662         { "Substring Match",    "ndps.ndps_substring_match",
8663           FT_UINT32,    BASE_HEX,   VALS(ndps_match_criteria_enum),   0x0,
8664           "Substring Match", HFILL }},
8665
8666         { &hf_ndps_time_limit,
8667         { "Time Limit",    "ndps.ndps_time_limit",
8668           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8669           "Time Limit", HFILL }},
8670
8671         { &hf_ndps_count_limit,
8672         { "Count Limit",    "ndps.ndps_count_limit",
8673           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8674           "Count Limit", HFILL }},
8675
8676         { &hf_ndps_operator,
8677         { "Operator Type",    "ndps.ndps_operator",
8678           FT_UINT32,    BASE_DEC,   VALS(ndps_operator_enum),   0x0,
8679           "Operator Type", HFILL }},
8680
8681         { &hf_ndps_password,
8682         { "Password",    "ndps.password",
8683           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8684           "Password", HFILL }},
8685         
8686         { &hf_ndps_retrieve_restrictions,
8687         { "Retrieve Restrictions",    "ndps.ndps_ret_restrict",
8688           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8689           "Retrieve Restrictions", HFILL }},
8690     
8691         { &hf_bind_security,
8692         { "Bind Security Options",    "ndps.ndps_bind_security",
8693           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8694           "Bind Security Options", HFILL }},
8695         
8696         { &hf_ndps_max_items,
8697         { "Maximum Items in List",    "ndps.ndps_max_items",
8698           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8699           "Maximum Items in List", HFILL }},
8700
8701         { &hf_ndps_status_flags,
8702         { "Status Flag",    "ndps.ndps_status_flags",
8703           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8704           "Status Flag", HFILL }},
8705
8706         { &hf_ndps_resource_list_type,
8707         { "Resource Type",    "ndps.ndps_resource_type",
8708           FT_UINT32,    BASE_DEC,   VALS(ndps_resource_type_enum),   0x0,
8709           "Resource Type", HFILL }},
8710
8711         { &hf_os_type,
8712         { "OS Type",    "ndps.os_type",
8713           FT_UINT32,    BASE_DEC,   VALS(ndps_os_type_enum),   0x0,
8714           "OS Type", HFILL }},
8715
8716         { &hf_ndps_printer_type,
8717         { "Printer Type",    "ndps.prn_type",
8718           FT_STRING,    BASE_NONE,   NULL,   0x0,
8719           "Printer Type", HFILL }},
8720
8721         { &hf_ndps_printer_manuf,
8722         { "Printer Manufacturer",    "ndps.prn_manuf",
8723           FT_STRING,    BASE_NONE,   NULL,   0x0,
8724           "Printer Manufacturer", HFILL }},
8725
8726         { &hf_ndps_inf_file_name,
8727         { "INF File Name",    "ndps.inf_file_name",
8728           FT_STRING,    BASE_NONE,   NULL,   0x0,
8729           "INF File Name", HFILL }},
8730
8731         { &hf_ndps_vendor_dir,
8732         { "Vendor Directory",    "ndps.vendor_dir",
8733           FT_STRING,    BASE_NONE,   NULL,   0x0,
8734           "Vendor Directory", HFILL }},
8735
8736         { &hf_banner_type,
8737         { "Banner Type",    "ndps.banner_type",
8738           FT_UINT32,    BASE_DEC,   VALS(ndps_banner_type_enum),   0x0,
8739           "Banner Type", HFILL }},
8740
8741         { &hf_font_type,
8742         { "Font Type",    "ndps.font_type",
8743           FT_UINT32,    BASE_DEC,   VALS(ndps_font_type_enum),   0x0,
8744           "Font Type", HFILL }},
8745
8746         { &hf_printer_id,
8747         { "Printer ID",    "ndps.printer_id",
8748           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8749           "Printer ID", HFILL }},
8750
8751         { &hf_ndps_font_name,
8752         { "Font Name",    "ndps.font_name",
8753           FT_STRING,    BASE_NONE,   NULL,   0x0,
8754           "Font Name", HFILL }},
8755
8756         { &hf_ndps_return_code,
8757         { "Return Code",    "ndps.ret_code",
8758           FT_UINT32,    BASE_HEX,   VALS(ndps_error_types),   0x0,
8759           "Return Code", HFILL }},
8760
8761         { &hf_ndps_banner_name,
8762         { "Banner Name",    "ndps.banner_name",
8763           FT_STRING,    BASE_NONE,   NULL,   0x0,
8764           "Banner Name", HFILL }},
8765
8766         { &hf_font_type_name,
8767         { "Font Type Name",    "ndps.font_type_name",
8768           FT_STRING,    BASE_NONE,   NULL,   0x0,
8769           "Font Type Name", HFILL }},
8770
8771         { &hf_font_file_name,
8772         { "Font File Name",    "ndps.font_file_name",
8773           FT_STRING,    BASE_NONE,   NULL,   0x0,
8774           "Font File Name", HFILL }},
8775
8776         { &hf_ndps_prn_file_name,
8777         { "Printer File Name",    "ndps.print_file_name",
8778           FT_STRING,    BASE_NONE,   NULL,   0x0,
8779           "Printer File Name", HFILL }},
8780
8781         { &hf_ndps_prn_dir_name,
8782         { "Printer Directory Name",    "ndps.print_dir_name",
8783           FT_STRING,    BASE_NONE,   NULL,   0x0,
8784           "Printer Directory Name", HFILL }},
8785
8786         { &hf_ndps_def_file_name,
8787         { "Printer Definition Name",    "ndps.print_def_name",
8788           FT_STRING,    BASE_NONE,   NULL,   0x0,
8789           "Printer Definition Name", HFILL }},
8790
8791         { &hf_ndps_win31_items,
8792         { "Windows 31 Keys",    "ndps.win31_keys",
8793           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8794           "Windows 31 Keys", HFILL }},
8795
8796         { &hf_ndps_win95_items,
8797         { "Windows 95 Keys",    "ndps.win95_keys",
8798           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8799           "Windows 95 Keys", HFILL }},
8800
8801         { &hf_ndps_windows_key,
8802         { "Windows Key",    "ndps.windows_key",
8803           FT_STRING,    BASE_NONE,   NULL,   0x0,
8804           "Windows Key", HFILL }},
8805
8806         { &hf_archive_type,
8807         { "Archive Type",    "ndps.archive_type",
8808           FT_UINT32,    BASE_DEC,   VALS(ndps_archive_enum),   0x0,
8809           "Archive Type", HFILL }},
8810
8811         { &hf_archive_file_size,
8812         { "Archive File Size",    "ndps.archive_size",
8813           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8814           "Archive File Size", HFILL }},
8815
8816         { &hf_ndps_segment_overlap,
8817           { "Segment overlap",  "ndps.segment.overlap", FT_BOOLEAN, BASE_NONE,
8818                 NULL, 0x0, "Segment overlaps with other segments", HFILL }},
8819     
8820         { &hf_ndps_segment_overlap_conflict,
8821           { "Conflicting data in segment overlap", "ndps.segment.overlap.conflict",
8822         FT_BOOLEAN, BASE_NONE,
8823                 NULL, 0x0, "Overlapping segments contained conflicting data", HFILL }},
8824     
8825         { &hf_ndps_segment_multiple_tails,
8826           { "Multiple tail segments found", "ndps.segment.multipletails",
8827         FT_BOOLEAN, BASE_NONE,
8828                 NULL, 0x0, "Several tails were found when desegmenting the packet", HFILL }},
8829     
8830         { &hf_ndps_segment_too_long_segment,
8831           { "Segment too long", "ndps.segment.toolongsegment", FT_BOOLEAN, BASE_NONE,
8832                 NULL, 0x0, "Segment contained data past end of packet", HFILL }},
8833     
8834         { &hf_ndps_segment_error,
8835           {"Desegmentation error",      "ndps.segment.error", FT_FRAMENUM, BASE_NONE,
8836                 NULL, 0x0, "Desegmentation error due to illegal segments", HFILL }},
8837     
8838         { &hf_ndps_segment,
8839           { "NDPS Fragment",            "ndps.fragment", FT_FRAMENUM, BASE_NONE,
8840                 NULL, 0x0, "NDPS Fragment", HFILL }},
8841     
8842         { &hf_ndps_segments,
8843           { "NDPS Fragments",   "ndps.fragments", FT_NONE, BASE_NONE,
8844                 NULL, 0x0, "NDPS Fragments", HFILL }},
8845
8846         { &hf_ndps_data,
8847           { "[Data]",   "ndps.data", FT_NONE, BASE_NONE,
8848                 NULL, 0x0, "[Data]", HFILL }},
8849
8850         { &hf_get_status_flag,
8851         { "Get Status Flag",    "ndps.get_status_flags",
8852           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8853           "Get Status Flag", HFILL }},
8854         
8855         { &hf_res_type,
8856         { "Resource Type",    "ndps.res_type",
8857           FT_UINT32,    BASE_DEC,   VALS(ndps_res_type_enum),   0x0,
8858           "Resource Type", HFILL }},
8859               
8860         { &hf_file_timestamp,
8861         { "File Time Stamp",    "ndps.file_time_stamp",
8862           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8863           "File Time Stamp", HFILL }},
8864
8865         { &hf_print_arg,
8866         { "Print Type",    "ndps.print_arg",
8867           FT_UINT32,    BASE_DEC,   VALS(ndps_print_arg_enum),   0x0,
8868           "Print Type", HFILL }},
8869
8870         { &hf_sub_complete,
8871           { "Submission Complete?",     "ndps.sub_complete", FT_BOOLEAN, BASE_NONE,
8872                 NULL, 0x0, "Submission Complete?", HFILL }},
8873
8874         { &hf_doc_content,
8875         { "Document Content",    "ndps.doc_content",
8876           FT_UINT32,    BASE_DEC,   VALS(ndps_doc_content_enum),   0x0,
8877           "Document Content", HFILL }},
8878
8879         { &hf_ndps_doc_name,
8880         { "Document Name",    "ndps.doc_name",
8881           FT_STRING,    BASE_NONE,   NULL,   0x0,
8882           "Document Name", HFILL }},
8883
8884         { &hf_local_id,
8885         { "Local ID",    "ndps.local_id",
8886           FT_UINT32,    BASE_DEC,   NULL,   0x0,
8887           "Local ID", HFILL }},
8888
8889         { &hf_ndps_included_doc,
8890         { "Included Document",    "ndps.included_doc",
8891           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8892           "Included Document", HFILL }},
8893
8894         { &hf_ndps_ref_name,
8895         { "Referenced Document Name",    "ndps.ref_doc_name",
8896           FT_STRING,    BASE_NONE,   NULL,   0x0,
8897           "Referenced Document Name", HFILL }},
8898
8899         { &hf_interrupt_job_type,
8900         { "Interrupt Job Identifier",    "ndps.interrupt_job_type",
8901           FT_UINT32,    BASE_DEC,   VALS(ndps_interrupt_job_enum),   0x0,
8902           "Interrupt Job Identifier", HFILL }},
8903
8904         { &hf_pause_job_type,
8905         { "Pause Job Identifier",    "ndps.pause_job_type",
8906           FT_UINT32,    BASE_DEC,   VALS(ndps_pause_job_enum),   0x0,
8907           "Pause Job Identifier", HFILL }},
8908
8909         { &hf_ndps_force,
8910         { "Force?",    "ndps.ndps_force",
8911           FT_BOOLEAN,    BASE_NONE,   NULL,   0x0,
8912           "Force?", HFILL }},
8913
8914         { &hf_resubmit_op_type,
8915         { "Resubmit Operation Type",    "ndps.resubmit_op_type",
8916           FT_UINT32,    BASE_DEC,   VALS(ndps_resubmit_op_enum),   0x0,
8917           "Resubmit Operation Type", HFILL }},
8918
8919         { &hf_shutdown_type,
8920         { "Shutdown Type",    "ndps.shutdown_type",
8921           FT_UINT32,    BASE_DEC,   VALS(ndps_shutdown_enum),   0x0,
8922           "Shutdown Type", HFILL }},
8923
8924         { &hf_ndps_supplier_flag,
8925         { "Supplier Data?",    "ndps.supplier_flag",
8926           FT_BOOLEAN,    BASE_NONE,   NULL,   0x0,
8927           "Supplier Data?", HFILL }},
8928
8929         { &hf_ndps_language_flag,
8930         { "Language Data?",    "ndps.language_flag",
8931           FT_BOOLEAN,    BASE_NONE,   NULL,   0x0,
8932           "Language Data?", HFILL }},
8933
8934         { &hf_ndps_method_flag,
8935         { "Method Data?",    "ndps.method_flag",
8936           FT_BOOLEAN,    BASE_NONE,   NULL,   0x0,
8937           "Method Data?", HFILL }},
8938         
8939         { &hf_ndps_delivery_address_flag,
8940         { "Delivery Address Data?",    "ndps.delivery_flag",
8941           FT_BOOLEAN,    BASE_NONE,   NULL,   0x0,
8942           "Delivery Address Data?", HFILL }},
8943        
8944         { &hf_ndps_list_profiles_type,
8945         { "List Profiles Type",    "ndps.ndps_list_profiles_type",
8946           FT_UINT32,    BASE_HEX,   VALS(ndps_attrs_arg_enum),   0x0,
8947           "List Profiles Type", HFILL }},
8948     
8949         { &hf_ndps_list_profiles_choice_type,
8950         { "List Profiles Choice Type",    "ndps.ndps_list_profiles_choice_type",
8951           FT_UINT32,    BASE_HEX,   VALS(ndps_list_profiles_choice_enum),   0x0,
8952           "List Profiles Choice Type", HFILL }},
8953         
8954         { &hf_ndps_list_profiles_result_type,
8955         { "List Profiles Result Type",    "ndps.ndps_list_profiles_result_type",
8956           FT_UINT32,    BASE_HEX,   VALS(ndps_list_profiles_result_enum),   0x0,
8957           "List Profiles Result Type", HFILL }},
8958         
8959         { &hf_ndps_integer_type_flag,
8960         { "Integer Type Flag",    "ndps.ndps_integer_type_flag",
8961           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8962           "Integer Type Flag", HFILL }},
8963         
8964         { &hf_ndps_integer_type_value,
8965         { "Integer Type Value",    "ndps.ndps_integer_type_value",
8966           FT_UINT32,    BASE_HEX,   NULL,   0x0,
8967           "Integer Type Value", HFILL }},
8968         
8969         { &hf_ndps_continuation_option,
8970         { "Continuation Option",    "ndps.ndps_continuation_option",
8971           FT_BYTES,    BASE_HEX,   NULL,   0x0,
8972           "Continuation Option", HFILL }},
8973
8974         { &hf_ndps_ds_info_type,
8975         { "DS Info Type",    "ndps.ndps_ds_info_type",
8976           FT_UINT32,    BASE_HEX,   VALS(ndps_ds_info_enum),   0x0,
8977           "DS Info Type", HFILL }},
8978
8979         { &hf_ndps_guid,
8980         { "GUID",    "ndps.guid",
8981           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8982           "GUID", HFILL }},
8983
8984         { &hf_ndps_list_services_type,
8985         { "Services Type",    "ndps.ndps_list_services_type",
8986           FT_UINT32,    BASE_HEX,   VALS(ndps_list_services_enum),   0x0,
8987           "Services Type", HFILL }},
8988
8989         { &hf_ndps_item_bytes,
8990         { "Item Ptr",    "ndps.item_bytes",
8991           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8992           "Item Ptr", HFILL }},
8993
8994         { &hf_ndps_certified,
8995         { "Certified",    "ndps.certified",
8996           FT_BYTES,    BASE_NONE,   NULL,   0x0,
8997           "Certified", HFILL }},
8998
8999         { &hf_ndps_attribute_set,
9000         { "Attribute Set",    "ndps.attribute_set",
9001           FT_BYTES,    BASE_NONE,   NULL,   0x0,
9002           "Attribute Set", HFILL }},
9003
9004         { &hf_ndps_data_item_type,
9005         { "Item Type",    "ndps.ndps_data_item_type",
9006           FT_UINT32,    BASE_HEX,   VALS(ndps_data_item_enum),   0x0,
9007           "Item Type", HFILL }},
9008
9009         { &hf_info_int,
9010         { "Integer Value",    "ndps.info_int",
9011           FT_UINT8,    BASE_HEX,   NULL,   0x0,
9012           "Integer Value", HFILL }},
9013
9014         { &hf_info_int16,
9015         { "16 Bit Integer Value",    "ndps.info_int16",
9016           FT_UINT16,    BASE_HEX,   NULL,   0x0,
9017           "16 Bit Integer Value", HFILL }},
9018
9019         { &hf_info_int32,
9020         { "32 Bit Integer Value",    "ndps.info_int32",
9021           FT_UINT32,    BASE_HEX,   NULL,   0x0,
9022           "32 Bit Integer Value", HFILL }},
9023
9024         { &hf_info_boolean,
9025         { "Boolean Value",    "ndps.info_boolean",
9026           FT_BOOLEAN,    BASE_NONE,   NULL,   0x0,
9027           "Boolean Value", HFILL }},
9028
9029         { &hf_info_string,
9030         { "String Value",    "ndps.info_string",
9031           FT_STRING,    BASE_NONE,   NULL,   0x0,
9032           "String Value", HFILL }},
9033
9034         { &hf_info_bytes,
9035         { "Byte Value",    "ndps.info_bytes",
9036           FT_BYTES,    BASE_NONE,   NULL,   0x0,
9037           "Byte Value", HFILL }},
9038        
9039         { &hf_ndps_list_local_servers_type,
9040         { "Server Type",    "ndps.ndps_list_local_server_type",
9041           FT_UINT32,    BASE_HEX,   VALS(ndps_list_local_servers_enum),   0x0,
9042           "Server Type", HFILL }},
9043
9044         { &hf_ndps_registry_name,
9045         { "Registry Name",    "ndps.registry_name",
9046           FT_STRING,    BASE_NONE,   NULL,   0x0,
9047           "Registry Name", HFILL }},
9048
9049         { &hf_ndps_client_server_type,
9050         { "Client/Server Type",    "ndps.ndps_client_server_type",
9051           FT_UINT32,    BASE_HEX,   VALS(ndps_client_server_enum),   0x0,
9052           "Client/Server Type", HFILL }},
9053
9054         { &hf_ndps_session_type,
9055         { "Session Type",    "ndps.ndps_session_type",
9056           FT_UINT32,    BASE_HEX,   VALS(ndps_session_type_enum),   0x0,
9057           "Session Type", HFILL }},
9058
9059         { &hf_time,
9060         { "Time",    "ndps.time",
9061           FT_UINT32,    BASE_DEC,   NULL,   0x0,
9062           "Time", HFILL }},
9063
9064         { &hf_ndps_supplier_name,
9065         { "Supplier Name",    "ndps.supplier_name",
9066           FT_STRING,    BASE_NONE,   NULL,   0x0,
9067           "Supplier Name", HFILL }},
9068
9069         { &hf_ndps_message,
9070         { "Message",    "ndps.message",
9071           FT_STRING,    BASE_NONE,   NULL,   0x0,
9072           "Message", HFILL }},
9073
9074         { &hf_delivery_method_type,
9075         { "Delivery Method Type",    "ndps.delivery_method_type",
9076           FT_UINT32,    BASE_HEX,   VALS(ndps_delivery_method_enum),   0x0,
9077           "Delivery Method Type", HFILL }},
9078
9079         { &hf_ndps_get_session_type,
9080         { "Session Type",    "ndps.ndps_get_session_type",
9081           FT_UINT32,    BASE_HEX,   VALS(ndps_get_session_type_enum),   0x0,
9082           "Session Type", HFILL }},
9083
9084         { &hf_packet_count,
9085         { "Packet Count",    "ndps.packet_count",
9086           FT_UINT32,    BASE_DEC,   NULL,   0x0,
9087           "Packet Count", HFILL }},
9088
9089         { &hf_last_packet_flag,
9090         { "Last Packet Flag",    "ndps.last_packet_flag",
9091           FT_UINT32,    BASE_DEC,   NULL,   0x0,
9092           "Last Packet Flag", HFILL }},
9093
9094         { &hf_ndps_get_resman_session_type,
9095         { "Session Type",    "ndps.ndps_get_resman_session_type",
9096           FT_UINT32,    BASE_HEX,   VALS(ndps_get_resman_session_type_enum),   0x0,
9097           "Session Type", HFILL }},
9098
9099         { &hf_problem_type,
9100         { "Problem Type",    "ndps.ndps_get_resman_session_type",
9101           FT_UINT32,    BASE_HEX,   VALS(problem_type_enum),   0x0,
9102           "Problem Type", HFILL }},
9103     };
9104
9105         static gint *ett[] = {
9106                 &ett_ndps,
9107                 &ett_ndps_segments,
9108                 &ett_ndps_segment,
9109         };
9110         module_t *ndps_module;
9111         
9112         proto_ndps = proto_register_protocol("Novell Distributed Print System", "NDPS", "ndps");
9113         proto_register_field_array(proto_ndps, hf_ndps, array_length(hf_ndps));
9114         proto_register_subtree_array(ett, array_length(ett));
9115
9116         ndps_module = prefs_register_protocol(proto_ndps, NULL);
9117         prefs_register_bool_preference(ndps_module, "desegment_tcp",
9118             "Desegment all NDPS messages spanning multiple TCP segments",
9119             "Whether the NDPS dissector should desegment all messages spanning multiple TCP segments",
9120             &ndps_desegment);
9121         prefs_register_bool_preference(ndps_module, "desegment_spx",
9122             "Desegment all NDPS messages spanning multiple SPX packets",
9123             "Whether the NDPS dissector should desegment all messages spanning multiple SPX packets",
9124             &ndps_defragment);
9125
9126         register_init_routine(&ndps_init_protocol);
9127         register_postseq_cleanup_routine(&ndps_postseq_cleanup);
9128 }
9129
9130 void
9131 proto_reg_handoff_ndps(void)
9132 {
9133         dissector_handle_t ndps_handle, ndps_tcp_handle;
9134
9135         ndps_handle = create_dissector_handle(dissect_ndps_ipx, proto_ndps);
9136         ndps_tcp_handle = create_dissector_handle(dissect_ndps_tcp, proto_ndps);
9137         
9138         dissector_add("spx.socket", SPX_SOCKET_PA, ndps_handle);
9139         dissector_add("spx.socket", SPX_SOCKET_BROKER, ndps_handle);
9140         dissector_add("spx.socket", SPX_SOCKET_SRS, ndps_handle);
9141         dissector_add("spx.socket", SPX_SOCKET_ENS, ndps_handle);
9142         dissector_add("spx.socket", SPX_SOCKET_RMS, ndps_handle);
9143         dissector_add("spx.socket", SPX_SOCKET_NOTIFY_LISTENER, ndps_handle);
9144         dissector_add("tcp.port", TCP_PORT_PA, ndps_tcp_handle);
9145         dissector_add("tcp.port", TCP_PORT_BROKER, ndps_tcp_handle);
9146         dissector_add("tcp.port", TCP_PORT_SRS, ndps_tcp_handle);
9147         dissector_add("tcp.port", TCP_PORT_ENS, ndps_tcp_handle);
9148         dissector_add("tcp.port", TCP_PORT_RMS, ndps_tcp_handle);
9149         dissector_add("tcp.port", TCP_PORT_NOTIFY_LISTENER, ndps_tcp_handle);
9150         ndps_data_handle = find_dissector("data");
9151 }