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