Converted to call lib/wins_srv.c:wins_srv_ip() instead of lp_wins_server()
[Samba.git] / source3 / rpcclient / display_spool.c
blob54162a99b733ffad1d3f2ea34b2a403b7a6051a9
1 /*
2 Unix SMB/Netbios implementation.
3 Version 1.9.
4 Samba utility functions
5 Copyright (C) Andrew Tridgell 1992-1999
6 Copyright (C) Luke Kenneth Casson Leighton 1996 - 1999
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "includes.h"
25 /****************************************************************************
26 printer info level 0 display function
27 ****************************************************************************/
28 static void display_print_info_0(FILE *out_hnd, PRINTER_INFO_0 *i1)
30 fstring name;
31 fstring server;
32 if (i1 == NULL)
33 return;
35 unistr_to_ascii(name, i1->printername.buffer, sizeof(name)-1);
36 unistr_to_ascii(server, i1->servername.buffer, sizeof(server)-1);
38 report(out_hnd, "\tprintername:[%s]\n", name);
39 report(out_hnd, "\tservername:[%s]\n", server);
40 report(out_hnd, "\tcjobs:[%x]\n", i1->cjobs);
41 report(out_hnd, "\ttotal_jobs:[%x]\n", i1->total_jobs);
43 report(out_hnd, "\t:date: [%d]-[%d]-[%d] (%d)\n", i1->year, i1->month, i1->day, i1->dayofweek);
44 report(out_hnd, "\t:time: [%d]-[%d]-[%d]-[%d]\n", i1->hour, i1->minute, i1->second, i1->milliseconds);
46 report(out_hnd, "\tglobal_counter:[%x]\n", i1->global_counter);
47 report(out_hnd, "\ttotal_pages:[%x]\n", i1->total_pages);
49 report(out_hnd, "\tmajorversion:[%x]\n", i1->major_version);
50 report(out_hnd, "\tbuildversion:[%x]\n", i1->build_version);
52 report(out_hnd, "\tunknown7:[%x]\n", i1->unknown7);
53 report(out_hnd, "\tunknown8:[%x]\n", i1->unknown8);
54 report(out_hnd, "\tunknown9:[%x]\n", i1->unknown9);
55 report(out_hnd, "\tsession_counter:[%x]\n", i1->session_counter);
56 report(out_hnd, "\tunknown11:[%x]\n", i1->unknown11);
57 report(out_hnd, "\tprinter_errors:[%x]\n", i1->printer_errors);
58 report(out_hnd, "\tunknown13:[%x]\n", i1->unknown13);
59 report(out_hnd, "\tunknown14:[%x]\n", i1->unknown14);
60 report(out_hnd, "\tunknown15:[%x]\n", i1->unknown15);
61 report(out_hnd, "\tunknown16:[%x]\n", i1->unknown16);
62 report(out_hnd, "\tchange_id:[%x]\n", i1->change_id);
63 report(out_hnd, "\tunknown18:[%x]\n", i1->unknown18);
64 report(out_hnd, "\tstatus:[%x]\n", i1->status);
65 report(out_hnd, "\tunknown20:[%x]\n", i1->unknown20);
66 report(out_hnd, "\tc_setprinter:[%x]\n", i1->c_setprinter);
67 report(out_hnd, "\tunknown22:[%x]\n", i1->unknown22);
68 report(out_hnd, "\tunknown23:[%x]\n", i1->unknown23);
69 report(out_hnd, "\tunknown24:[%x]\n", i1->unknown24);
70 report(out_hnd, "\tunknown25:[%x]\n", i1->unknown25);
71 report(out_hnd, "\tunknown26:[%x]\n", i1->unknown26);
72 report(out_hnd, "\tunknown27:[%x]\n", i1->unknown27);
73 report(out_hnd, "\tunknown28:[%x]\n", i1->unknown28);
74 report(out_hnd, "\tunknown29:[%x]\n", i1->unknown29);
77 /****************************************************************************
78 printer info level 1 display function
79 ****************************************************************************/
80 static void display_print_info_1(FILE *out_hnd, PRINTER_INFO_1 *i1)
82 fstring desc;
83 fstring name;
84 fstring comm;
85 if (i1 == NULL)
86 return;
88 unistr_to_ascii(desc, i1->description.buffer, sizeof(desc)-1);
89 unistr_to_ascii(name, i1->name .buffer, sizeof(name)-1);
90 unistr_to_ascii(comm, i1->comment .buffer, sizeof(comm)-1);
92 report(out_hnd, "\tflags:[%x]\n", i1->flags);
93 report(out_hnd, "\tname:[%s]\n", name);
94 report(out_hnd, "\tdescription:[%s]\n", desc);
95 report(out_hnd, "\tcomment:[%s]\n\n", comm);
98 /****************************************************************************
99 printer info level 2 display function
100 ****************************************************************************/
101 static void display_print_info_2(FILE *out_hnd, PRINTER_INFO_2 *i2)
103 fstring servername;
104 fstring printername;
105 fstring sharename;
106 fstring portname;
107 fstring drivername;
108 fstring comment;
109 fstring location;
110 fstring sepfile;
111 fstring printprocessor;
112 fstring datatype;
113 fstring parameters;
115 if (i2 == NULL)
116 return;
118 unistr_to_ascii(servername, i2->servername.buffer, sizeof(servername)-1);
119 unistr_to_ascii(printername, i2->printername.buffer, sizeof(printername)-1);
120 unistr_to_ascii(sharename, i2->sharename.buffer, sizeof(sharename)-1);
121 unistr_to_ascii(portname, i2->portname.buffer, sizeof(portname)-1);
122 unistr_to_ascii(drivername, i2->drivername.buffer, sizeof(drivername)-1);
123 unistr_to_ascii(comment, i2->comment.buffer, sizeof(comment)-1);
124 unistr_to_ascii(location, i2->location.buffer, sizeof(location)-1);
125 unistr_to_ascii(sepfile, i2->sepfile.buffer, sizeof(sepfile)-1);
126 unistr_to_ascii(printprocessor, i2->printprocessor.buffer, sizeof(printprocessor)-1);
127 unistr_to_ascii(datatype, i2->datatype.buffer, sizeof(datatype)-1);
128 unistr_to_ascii(parameters, i2->parameters.buffer, sizeof(parameters)-1);
130 report(out_hnd, "\tservername:[%s]\n", servername);
131 report(out_hnd, "\tprintername:[%s]\n", printername);
132 report(out_hnd, "\tsharename:[%s]\n", sharename);
133 report(out_hnd, "\tportname:[%s]\n", portname);
134 report(out_hnd, "\tdrivername:[%s]\n", drivername);
135 report(out_hnd, "\tcomment:[%s]\n", comment);
136 report(out_hnd, "\tlocation:[%s]\n", location);
137 report(out_hnd, "\tsepfile:[%s]\n", sepfile);
138 report(out_hnd, "\tprintprocessor:[%s]\n", printprocessor);
139 report(out_hnd, "\tdatatype:[%s]\n", datatype);
140 report(out_hnd, "\tparameters:[%s]\n", parameters);
141 report(out_hnd, "\tattributes:[%x]\n", i2->attributes);
142 report(out_hnd, "\tpriority:[%x]\n", i2->priority);
143 report(out_hnd, "\tdefaultpriority:[%x]\n", i2->defaultpriority);
144 report(out_hnd, "\tstarttime:[%x]\n", i2->starttime);
145 report(out_hnd, "\tuntiltime:[%x]\n", i2->untiltime);
146 report(out_hnd, "\tstatus:[%x]\n", i2->status);
147 report(out_hnd, "\tcjobs:[%x]\n", i2->cjobs);
148 report(out_hnd, "\taverageppm:[%x]\n\n", i2->averageppm);
150 if (i2->secdesc != NULL)
152 display_sec_desc(out_hnd, ACTION_HEADER , i2->secdesc);
153 display_sec_desc(out_hnd, ACTION_ENUMERATE, i2->secdesc);
154 display_sec_desc(out_hnd, ACTION_FOOTER , i2->secdesc);
158 /****************************************************************************
159 printer info level 3 display function
160 ****************************************************************************/
161 static void display_print_info_3(FILE *out_hnd, PRINTER_INFO_3 *i3)
163 if (i3 == NULL)
164 return;
166 report(out_hnd, "\tflags:[%x]\n", i3->flags);
168 display_sec_desc(out_hnd, ACTION_HEADER , i3->secdesc);
169 display_sec_desc(out_hnd, ACTION_ENUMERATE, i3->secdesc);
170 display_sec_desc(out_hnd, ACTION_FOOTER , i3->secdesc);
173 /****************************************************************************
174 connection info level 0 container display function
175 ****************************************************************************/
176 static void display_printer_info_0_ctr(FILE *out_hnd, enum action_type action, uint32 count, PRINTER_INFO_CTR ctr)
178 int i;
179 PRINTER_INFO_0 *in;
181 switch (action)
183 case ACTION_HEADER:
184 report(out_hnd, "Printer Info Level 0:\n");
185 break;
186 case ACTION_ENUMERATE:
187 for (i = 0; i < count; i++) {
188 in=ctr.printers_0;
189 display_print_info_0(out_hnd, &(in[i]) );
191 break;
192 case ACTION_FOOTER:
193 report(out_hnd, "\n");
194 break;
198 /****************************************************************************
199 connection info level 1 container display function
200 ****************************************************************************/
201 static void display_printer_info_1_ctr(FILE *out_hnd, enum action_type action, uint32 count, PRINTER_INFO_CTR ctr)
203 int i;
204 PRINTER_INFO_1 *in;
206 switch (action)
208 case ACTION_HEADER:
209 report(out_hnd, "Printer Info Level 1:\n");
210 break;
211 case ACTION_ENUMERATE:
212 for (i = 0; i < count; i++) {
213 in=ctr.printers_1;
214 display_print_info_1(out_hnd, &(in[i]) );
216 break;
217 case ACTION_FOOTER:
218 report(out_hnd, "\n");
219 break;
223 /****************************************************************************
224 connection info level 2 container display function
225 ****************************************************************************/
226 static void display_printer_info_2_ctr(FILE *out_hnd, enum action_type action, uint32 count, PRINTER_INFO_CTR ctr)
228 int i;
229 PRINTER_INFO_2 *in;
231 switch (action)
233 case ACTION_HEADER:
234 report(out_hnd, "Printer Info Level 2:\n");
235 break;
236 case ACTION_ENUMERATE:
237 for (i = 0; i < count; i++) {
238 in=ctr.printers_2;
239 display_print_info_2(out_hnd, &(in[i]) );
241 break;
242 case ACTION_FOOTER:
243 report(out_hnd, "\n");
244 break;
248 /****************************************************************************
249 connection info level 3 container display function
250 ****************************************************************************/
251 static void display_printer_info_3_ctr(FILE *out_hnd, enum action_type action, uint32 count, PRINTER_INFO_CTR ctr)
253 int i;
254 PRINTER_INFO_3 *in;
256 switch (action)
258 case ACTION_HEADER:
259 report(out_hnd, "Printer Info Level 3:\n");
260 break;
261 case ACTION_ENUMERATE:
262 for (i = 0; i < count; i++) {
263 in=ctr.printers_3;
264 display_print_info_3(out_hnd, &(in[i]) );
266 break;
267 case ACTION_FOOTER:
268 report(out_hnd, "\n");
269 break;
273 /****************************************************************************
274 connection info container display function
275 ****************************************************************************/
276 void display_printer_info_ctr(FILE *out_hnd, enum action_type action, uint32 level,
277 uint32 count, PRINTER_INFO_CTR ctr)
279 switch (level) {
280 case 0:
281 display_printer_info_0_ctr(out_hnd, action, count, ctr);
282 break;
283 case 1:
284 display_printer_info_1_ctr(out_hnd, action, count, ctr);
285 break;
286 case 2:
287 display_printer_info_2_ctr(out_hnd, action, count, ctr);
288 break;
289 case 3:
290 display_printer_info_3_ctr(out_hnd, action, count, ctr);
291 break;
292 default:
293 report(out_hnd, "display_printer_info_ctr: Unknown Info Level\n");
294 break;
298 /****************************************************************************
299 connection info level 3 container display function
300 ****************************************************************************/
301 static void display_port_info_1_ctr(FILE *out_hnd, enum action_type action,
302 uint32 count, PORT_INFO_CTR *ctr)
304 uint32 i = 0;
305 switch (action)
307 case ACTION_HEADER:
308 report(out_hnd, "Port Info Level 1:\n");
309 break;
310 case ACTION_ENUMERATE:
311 for (i=0; i<count; i++)
312 display_port_info_1(out_hnd, action, &ctr->port.info_1[i]);
313 break;
314 case ACTION_FOOTER:
315 report(out_hnd, "\n");
316 break;
320 /****************************************************************************
321 connection info level 3 container display function
322 ****************************************************************************/
323 static void display_port_info_2_ctr(FILE *out_hnd, enum action_type action,
324 uint32 count, PORT_INFO_CTR *ctr)
326 uint32 i = 0;
327 switch (action)
329 case ACTION_HEADER:
330 report(out_hnd, "Port Info Level 2:\n");
331 break;
332 case ACTION_ENUMERATE:
333 for (i=0; i<count; i++)
334 display_port_info_2(out_hnd, action, &ctr->port.info_2[i]);
335 break;
336 case ACTION_FOOTER:
337 report(out_hnd, "\n");
338 break;
342 /****************************************************************************
343 connection info container display function
344 ****************************************************************************/
345 void display_port_info_ctr(FILE *out_hnd, enum action_type action, uint32 level,
346 uint32 count, PORT_INFO_CTR *ctr)
348 switch (level) {
349 case 1:
350 display_port_info_1_ctr(out_hnd, action, count, ctr);
351 break;
352 case 2:
353 display_port_info_2_ctr(out_hnd, action, count, ctr);
354 break;
355 default:
356 report(out_hnd, "display_port_info_ctr: Unknown Info Level\n");
357 break;
361 /****************************************************************************
362 connection info container display function
363 ****************************************************************************/
364 void display_port_info_1(FILE *out_hnd, enum action_type action, PORT_INFO_1 *i1)
366 fstring buffer;
368 switch (action)
370 case ACTION_HEADER:
371 report(out_hnd, "Port:\n");
372 break;
373 case ACTION_ENUMERATE:
374 unistr_to_ascii(buffer, i1->port_name.buffer, sizeof(buffer)-1);
375 fprintf (out_hnd, "\tPort Name:\t[%s]\n\n", buffer);
376 break;
377 case ACTION_FOOTER:
378 report(out_hnd, "\n");
379 break;
383 /****************************************************************************
384 connection info container display function
385 ****************************************************************************/
386 void display_port_info_2(FILE *out_hnd, enum action_type action, PORT_INFO_2 *i2)
388 fstring buffer;
390 switch (action)
392 case ACTION_HEADER:
393 report(out_hnd, "Port:\n");
394 break;
395 case ACTION_ENUMERATE:
396 unistr_to_ascii(buffer, i2->port_name.buffer, sizeof(buffer)-1);
397 fprintf (out_hnd, "\tPort Name:\t[%s]\n", buffer);
398 unistr_to_ascii(buffer, i2->monitor_name.buffer, sizeof(buffer)-1);
399 fprintf (out_hnd, "\tMonitor Name:\t[%s]\n", buffer);
400 unistr_to_ascii(buffer, i2->description.buffer, sizeof(buffer)-1);
401 fprintf (out_hnd, "\tDescription:\t[%s]\n", buffer);
402 fprintf (out_hnd, "\tPort Type:\t[%d]\n", i2->port_type);
403 fprintf (out_hnd, "\tReserved:\t[%d]\n", i2->reserved);
404 fprintf (out_hnd, "\n");
405 break;
406 case ACTION_FOOTER:
407 report(out_hnd, "\n");
408 break;
412 /****************************************************************************
413 connection info container display function
414 ****************************************************************************/
415 void display_printer_enumdata(FILE *out_hnd, enum action_type action, uint32 idx,
416 uint32 valuelen, uint16 *value, uint32 rvaluelen,
417 uint32 type,
418 uint32 datalen, uint8 *data, uint32 rdatalen)
420 fstring buffer;
422 switch (action)
424 case ACTION_HEADER:
425 report(out_hnd, "Printer enum data:\n");
426 report(out_hnd, "index\tvaluelen\tvalue\t\trvaluelen");
427 report(out_hnd, "\ttype\tdatalen\tdata\trdatalen\n");
428 break;
429 case ACTION_ENUMERATE:
430 report(out_hnd, "[%d]", idx);
431 report(out_hnd, "\t[%d]", valuelen);
432 unistr_to_ascii(buffer, value, sizeof(buffer)-1);
433 report(out_hnd, "\t[%s]", buffer);
434 report(out_hnd, "\t[%d]", rvaluelen);
435 report(out_hnd, "\t\t[%d]", type);
436 report(out_hnd, "\t[%d]", datalen);
437 /* report(out_hnd, "\t[%s]", data);*/
438 report(out_hnd, "\t[%d]\n", rdatalen);
439 break;
440 case ACTION_FOOTER:
441 report(out_hnd, "\n");
442 break;
446 /****************************************************************************
447 job info level 2 display function
448 ****************************************************************************/
449 void display_job_info_2(FILE *out_hnd, enum action_type action,
450 JOB_INFO_2 *const i2)
452 if (i2 == NULL)
454 return;
457 switch (action)
459 case ACTION_HEADER:
461 report(out_hnd, "Job Info Level 2:\n");
463 break;
465 case ACTION_ENUMERATE:
467 fstring tmp;
469 report(out_hnd, "\tjob id:\t%d\n", i2->jobid);
470 unistr_to_ascii(tmp, i2->printername.buffer, sizeof(tmp)-1);
471 report(out_hnd, "\tprinter name:\t%s\n", tmp);
472 unistr_to_ascii(tmp, i2->machinename.buffer, sizeof(tmp)-1);
473 report(out_hnd, "\tmachine name:\t%s\n", tmp);
474 unistr_to_ascii(tmp, i2->username.buffer, sizeof(tmp)-1);
475 report(out_hnd, "\tusername:\t%s\n", tmp);
476 unistr_to_ascii(tmp, i2->document.buffer, sizeof(tmp)-1);
477 report(out_hnd, "\tdocument:\t%s\n", tmp);
478 unistr_to_ascii(tmp, i2->notifyname.buffer, sizeof(tmp)-1);
479 report(out_hnd, "\tnotify name:\t%s\n", tmp);
480 unistr_to_ascii(tmp, i2->datatype.buffer, sizeof(tmp)-1);
481 report(out_hnd, "\tdata type:\t%s\n", tmp);
482 unistr_to_ascii(tmp, i2->printprocessor.buffer, sizeof(tmp)-1);
483 report(out_hnd, "\tprint processor:\t%s\n", tmp);
484 unistr_to_ascii(tmp, i2->parameters.buffer, sizeof(tmp)-1);
485 report(out_hnd, "\tparameters:\t%s\n", tmp);
486 unistr_to_ascii(tmp, i2->drivername.buffer, sizeof(tmp)-1);
487 report(out_hnd, "\tdriver name:\t%s\n", tmp);
488 report(out_hnd, "\tDevice Mode:\tNOT DISPLAYED YET\n");
490 DEVICEMODE *devmode;
492 unistr_to_ascii(tmp, i2->text_status.buffer, sizeof(tmp)-1);
493 report(out_hnd, "\ttext status:\t%s\n", tmp);
494 /* SEC_DESC sec_desc;*/
495 report(out_hnd, "\tstatus:\t%d\n", i2->status);
496 report(out_hnd, "\tpriority:\t%d\n", i2->priority);
497 report(out_hnd, "\tposition:\t%d\n", i2->position);
498 report(out_hnd, "\tstarttime:\t%d\n", i2->starttime);
499 report(out_hnd, "\tuntiltime:\t%d\n", i2->untiltime);
500 report(out_hnd, "\ttotalpages:\t%d\n", i2->totalpages);
501 report(out_hnd, "\tsize:\t%d\n", i2->size);
503 SYSTEMTIME submitted;
505 report(out_hnd, "\tsubmitted:\tNOT DISPLAYED YET\n");
506 report(out_hnd, "\ttimeelapsed:\t%d\n", i2->timeelapsed);
507 report(out_hnd, "\tpagesprinted:\t%d\n", i2->pagesprinted);
509 case ACTION_FOOTER:
511 report(out_hnd, "\n");
512 break;
518 /****************************************************************************
519 job info level 1 display function
520 ****************************************************************************/
521 void display_job_info_1(FILE *out_hnd, enum action_type action,
522 JOB_INFO_1 *const i1)
524 if (i1 == NULL)
526 return;
529 switch (action)
531 case ACTION_HEADER:
533 report(out_hnd, "Job Info Level 1:\n");
535 break;
537 case ACTION_ENUMERATE:
539 fstring tmp;
541 report(out_hnd, "\tjob id:\t%d\n", i1->jobid);
542 unistr_to_ascii(tmp, i1->printername.buffer, sizeof(tmp)-1);
543 report(out_hnd, "\tprinter name:\t%s\n", tmp);
544 unistr_to_ascii(tmp, i1->machinename.buffer, sizeof(tmp)-1);
545 report(out_hnd, "\tmachine name:\t%s\n", tmp);
546 unistr_to_ascii(tmp, i1->username.buffer, sizeof(tmp)-1);
547 report(out_hnd, "\tusername:\t%s\n", tmp);
548 unistr_to_ascii(tmp, i1->document.buffer, sizeof(tmp)-1);
549 report(out_hnd, "\tdocument:\t%s\n", tmp);
550 unistr_to_ascii(tmp, i1->datatype.buffer, sizeof(tmp)-1);
551 report(out_hnd, "\tdata type:\t%s\n", tmp);
552 unistr_to_ascii(tmp, i1->text_status.buffer, sizeof(tmp)-1);
553 report(out_hnd, "\ttext status:\t%s\n", tmp);
554 report(out_hnd, "\tstatus:\t%d\n", i1->status);
555 report(out_hnd, "\tpriority:\t%d\n", i1->priority);
556 report(out_hnd, "\tposition:\t%d\n", i1->position);
557 report(out_hnd, "\ttotalpages:\t%d\n", i1->totalpages);
559 SYSTEMTIME submitted;
561 report(out_hnd, "\tsubmitted:\tNOT DISPLAYED YET\n");
562 report(out_hnd, "\tpagesprinted:\t%d\n", i1->pagesprinted);
564 break;
566 case ACTION_FOOTER:
568 report(out_hnd, "\n");
569 break;
575 /****************************************************************************
576 connection info level 2 container display function
577 ****************************************************************************/
578 void display_job_info_2_ctr(FILE *out_hnd, enum action_type action,
579 uint32 count, JOB_INFO_2 *const *const ctr)
581 if (ctr == NULL)
583 report(out_hnd, "display_job_info_2_ctr: unavailable due to an internal error\n");
584 return;
587 switch (action)
589 case ACTION_HEADER:
591 break;
593 case ACTION_ENUMERATE:
595 int i;
597 for (i = 0; i < count; i++)
599 display_job_info_2(out_hnd, ACTION_HEADER , ctr[i]);
600 display_job_info_2(out_hnd, ACTION_ENUMERATE, ctr[i]);
601 display_job_info_2(out_hnd, ACTION_FOOTER , ctr[i]);
603 break;
605 case ACTION_FOOTER:
607 break;
612 /****************************************************************************
613 connection info level 1 container display function
614 ****************************************************************************/
615 void display_job_info_1_ctr(FILE *out_hnd, enum action_type action,
616 uint32 count, JOB_INFO_1 *const *const ctr)
618 if (ctr == NULL)
620 report(out_hnd, "display_job_info_1_ctr: unavailable due to an internal error\n");
621 return;
624 switch (action)
626 case ACTION_HEADER:
628 break;
630 case ACTION_ENUMERATE:
632 int i;
634 for (i = 0; i < count; i++)
636 display_job_info_1(out_hnd, ACTION_HEADER , ctr[i]);
637 display_job_info_1(out_hnd, ACTION_ENUMERATE, ctr[i]);
638 display_job_info_1(out_hnd, ACTION_FOOTER , ctr[i]);
640 break;
642 case ACTION_FOOTER:
644 break;
649 /****************************************************************************
650 connection info container display function
651 ****************************************************************************/
652 void display_job_info_ctr(FILE *out_hnd, enum action_type action,
653 uint32 level, uint32 count,
654 void *const *const ctr)
656 if (ctr == NULL)
658 report(out_hnd, "display_job_info_ctr: unavailable due to an internal error\n");
659 return;
662 switch (level)
664 case 1:
666 display_job_info_1_ctr(out_hnd, action,
667 count, (JOB_INFO_1*const*const)ctr);
668 break;
670 case 2:
672 display_job_info_2_ctr(out_hnd, action,
673 count, (JOB_INFO_2*const*const)ctr);
674 break;
676 default:
678 report(out_hnd, "display_job_info_ctr: Unknown Info Level\n");
679 break;
684 /****************************************************************************
685 printer info level 0 display function
686 ****************************************************************************/
687 static void display_print_driver_1(FILE *out_hnd, DRIVER_INFO_1 *i1)
689 fstring name;
690 if (i1 == NULL)
691 return;
693 unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1);
695 report(out_hnd, "\tname:[%s]\n", name);
698 /****************************************************************************
699 printer info level 1 display function
700 ****************************************************************************/
701 static void display_print_driver_2(FILE *out_hnd, DRIVER_INFO_2 *i1)
703 fstring name;
704 fstring architecture;
705 fstring driverpath;
706 fstring datafile;
707 fstring configfile;
708 if (i1 == NULL)
709 return;
711 unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1);
712 unistr_to_ascii(architecture, i1->architecture.buffer, sizeof(architecture)-1);
713 unistr_to_ascii(driverpath, i1->driverpath.buffer, sizeof(driverpath)-1);
714 unistr_to_ascii(datafile, i1->datafile.buffer, sizeof(datafile)-1);
715 unistr_to_ascii(configfile, i1->configfile.buffer, sizeof(configfile)-1);
717 report(out_hnd, "\tversion:[%x]\n", i1->version);
718 report(out_hnd, "\tname:[%s]\n", name);
719 report(out_hnd, "\tarchitecture:[%s]\n", architecture);
720 report(out_hnd, "\tdriverpath:[%s]\n", driverpath);
721 report(out_hnd, "\tdatafile:[%s]\n", datafile);
722 report(out_hnd, "\tconfigfile:[%s]\n", configfile);
725 /****************************************************************************
726 printer info level 2 display function
727 ****************************************************************************/
728 static void display_print_driver_3(FILE *out_hnd, DRIVER_INFO_3 *i1)
730 fstring name;
731 fstring architecture;
732 fstring driverpath;
733 fstring datafile;
734 fstring configfile;
735 fstring helpfile;
736 fstring dependentfiles;
737 fstring monitorname;
738 fstring defaultdatatype;
740 int length=0;
741 BOOL valid = True;
743 if (i1 == NULL)
744 return;
746 unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1);
747 unistr_to_ascii(architecture, i1->architecture.buffer, sizeof(architecture)-1);
748 unistr_to_ascii(driverpath, i1->driverpath.buffer, sizeof(driverpath)-1);
749 unistr_to_ascii(datafile, i1->datafile.buffer, sizeof(datafile)-1);
750 unistr_to_ascii(configfile, i1->configfile.buffer, sizeof(configfile)-1);
751 unistr_to_ascii(helpfile, i1->helpfile.buffer, sizeof(helpfile)-1);
753 unistr_to_ascii(monitorname, i1->monitorname.buffer, sizeof(monitorname)-1);
754 unistr_to_ascii(defaultdatatype, i1->defaultdatatype.buffer, sizeof(defaultdatatype)-1);
756 report(out_hnd, "\tversion:[%x]\n", i1->version);
757 report(out_hnd, "\tname:[%s]\n",name );
758 report(out_hnd, "\tarchitecture:[%s]\n", architecture);
759 report(out_hnd, "\tdriverpath:[%s]\n", driverpath);
760 report(out_hnd, "\tdatafile:[%s]\n", datafile);
761 report(out_hnd, "\tconfigfile:[%s]\n", configfile);
762 report(out_hnd, "\thelpfile:[%s]\n\n", helpfile);
764 while (valid)
766 unistr_to_ascii(dependentfiles, i1->dependentfiles+length, sizeof(dependentfiles)-1);
767 length+=strlen(dependentfiles)+1;
769 if (strlen(dependentfiles) > 0)
771 report(out_hnd, "\tdependentfiles:[%s]\n", dependentfiles);
773 else
775 valid = False;
779 report(out_hnd, "\n\tmonitorname:[%s]\n", monitorname);
780 report(out_hnd, "\tdefaultdatatype:[%s]\n", defaultdatatype);
784 /****************************************************************************
785 connection info level 1 container display function
786 ****************************************************************************/
787 static void display_printer_driver_1_ctr(FILE *out_hnd, enum action_type action, uint32 count, PRINTER_DRIVER_CTR ctr)
789 int i;
790 DRIVER_INFO_1 *in;
792 switch (action)
794 case ACTION_HEADER:
795 report(out_hnd, "Printer driver Level 1:\n");
796 break;
797 case ACTION_ENUMERATE:
798 for (i = 0; i < count; i++) {
799 in=ctr.info1;
800 display_print_driver_1(out_hnd, &(in[i]) );
802 break;
803 case ACTION_FOOTER:
804 report(out_hnd, "\n");
805 break;
809 /****************************************************************************
810 connection info level 2 container display function
811 ****************************************************************************/
812 static void display_printer_driver_2_ctr(FILE *out_hnd, enum action_type action, uint32 count, PRINTER_DRIVER_CTR ctr)
814 int i;
815 DRIVER_INFO_2 *in;
817 switch (action)
819 case ACTION_HEADER:
820 report(out_hnd, "Printer driver Level 2:\n");
821 break;
822 case ACTION_ENUMERATE:
823 for (i = 0; i < count; i++) {
824 in=ctr.info2;
825 display_print_driver_2(out_hnd, &(in[i]) );
827 break;
828 case ACTION_FOOTER:
829 report(out_hnd, "\n");
830 break;
834 /****************************************************************************
835 connection info level 3 container display function
836 ****************************************************************************/
837 static void display_printer_driver_3_ctr(FILE *out_hnd, enum action_type action, uint32 count, PRINTER_DRIVER_CTR ctr)
839 int i;
840 DRIVER_INFO_3 *in;
842 switch (action)
844 case ACTION_HEADER:
845 report(out_hnd, "Printer driver Level 3:\n");
846 break;
847 case ACTION_ENUMERATE:
848 for (i = 0; i < count; i++) {
849 in=ctr.info3;
850 display_print_driver_3(out_hnd, &(in[i]) );
852 break;
853 case ACTION_FOOTER:
854 report(out_hnd, "\n");
855 break;
859 /****************************************************************************
860 connection info container display function
861 ****************************************************************************/
862 void display_printer_driver_ctr(FILE *out_hnd, enum action_type action, uint32 level,
863 uint32 count, PRINTER_DRIVER_CTR ctr)
865 switch (level) {
866 case 1:
867 display_printer_driver_1_ctr(out_hnd, action, count, ctr);
868 break;
869 case 2:
870 display_printer_driver_2_ctr(out_hnd, action, count, ctr);
871 break;
872 case 3:
873 display_printer_driver_3_ctr(out_hnd, action, count, ctr);
874 break;
875 default:
876 report(out_hnd, "display_printer_driver_ctr: Unknown Info Level\n");
877 break;
882 /****************************************************************************
883 printer info level 1 display function
884 ****************************************************************************/
885 static void display_printdriverdir_info_1(FILE *out_hnd, DRIVER_DIRECTORY_1 *i1)
887 fstring name;
888 if (i1 == NULL)
889 return;
891 unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1);
893 report(out_hnd, "\tname:[%s]\n", name);
896 /****************************************************************************
897 connection info level 1 container display function
898 ****************************************************************************/
899 static void display_printerdriverdir_info_1_ctr(FILE *out_hnd, enum action_type action, DRIVER_DIRECTORY_CTR ctr)
902 switch (action)
904 case ACTION_HEADER:
905 report(out_hnd, "Printer driver dir Info Level 1:\n");
906 break;
907 case ACTION_ENUMERATE:
908 display_printdriverdir_info_1(out_hnd, &(ctr.driver.info_1) );
909 break;
910 case ACTION_FOOTER:
911 report(out_hnd, "\n");
912 break;
916 /****************************************************************************
917 connection info container display function
918 ****************************************************************************/
919 void display_printerdriverdir_info_ctr(FILE *out_hnd, enum action_type action, uint32 level,
920 DRIVER_DIRECTORY_CTR ctr)
922 switch (level) {
923 case 1:
924 display_printerdriverdir_info_1_ctr(out_hnd, action, ctr);
925 break;
926 default:
927 report(out_hnd, "display_printerdriverdir_info_ctr: Unknown Info Level\n");
928 break;