2 Unix SMB/Netbios implementation.
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.
25 /****************************************************************************
26 printer info level 0 display function
27 ****************************************************************************/
28 void display_print_info_0(FILE *out_hnd, enum action_type action,
29 PRINTER_INFO_0 *const i0)
40 report(out_hnd, "Printer Info Level 0:\n");
44 case ACTION_ENUMERATE:
49 unistr_to_ascii(name, i0->printername.buffer, sizeof(name)-1);
50 unistr_to_ascii(serv, i0->servername .buffer, sizeof(serv)-1);
52 report(out_hnd, "\tprinter name:\t%s\n", name);
53 report(out_hnd, "\tserver name:\t%s\n", serv);
54 report(out_hnd, "\t[Other info not displayed]\n");
60 report(out_hnd, "\n");
67 /****************************************************************************
68 printer info level 1 display function
69 ****************************************************************************/
70 void display_print_info_1(FILE *out_hnd, enum action_type action,
71 PRINTER_INFO_1 *const i1)
82 report(out_hnd, "Printer Info Level 1:\n");
86 case ACTION_ENUMERATE:
92 unistr_to_ascii(desc, i1->description.buffer, sizeof(desc)-1);
93 unistr_to_ascii(name, i1->name .buffer, sizeof(name)-1);
94 unistr_to_ascii(comm, i1->comment .buffer, sizeof(comm)-1);
96 report(out_hnd, "\tflags:\t%d\n", i1->flags);
97 report(out_hnd, "\tname:\t%s\n", name);
98 report(out_hnd, "\tdescription:\t%s\n", desc);
99 report(out_hnd, "\tcomment:\t%s\n", comm);
105 report(out_hnd, "\n");
112 /****************************************************************************
113 connection info level 0 container display function
114 ****************************************************************************/
115 void display_printer_info_0_ctr(FILE *out_hnd, enum action_type action,
116 uint32 count, PRINTER_INFO_0 *const *const ctr)
120 report(out_hnd, "display_printer_info_0_ctr: unavailable due to an internal error\n");
130 case ACTION_ENUMERATE:
134 for (i = 0; i < count; i++)
136 display_print_info_0(out_hnd, ACTION_HEADER , ctr[i]);
137 display_print_info_0(out_hnd, ACTION_ENUMERATE, ctr[i]);
138 display_print_info_0(out_hnd, ACTION_FOOTER , ctr[i]);
149 /****************************************************************************
150 connection info level 1 container display function
151 ****************************************************************************/
152 void display_printer_info_1_ctr(FILE *out_hnd, enum action_type action,
153 uint32 count, PRINTER_INFO_1 *const *const ctr)
157 report(out_hnd, "display_printer_info_1_ctr: unavailable due to an internal error\n");
167 case ACTION_ENUMERATE:
171 for (i = 0; i < count; i++)
173 display_print_info_1(out_hnd, ACTION_HEADER , ctr[i]);
174 display_print_info_1(out_hnd, ACTION_ENUMERATE, ctr[i]);
175 display_print_info_1(out_hnd, ACTION_FOOTER , ctr[i]);
186 /****************************************************************************
187 connection info container display function
188 ****************************************************************************/
189 void display_printer_info_ctr(FILE *out_hnd, enum action_type action,
190 uint32 level, uint32 count,
191 void *const *const ctr)
195 report(out_hnd, "display_printer_info_ctr: unavailable due to an internal error\n");
203 display_printer_info_0_ctr(out_hnd, action,
204 count, (PRINTER_INFO_0*const*const)ctr);
209 display_printer_info_1_ctr(out_hnd, action,
210 count, (PRINTER_INFO_1*const*const)ctr);
215 report(out_hnd, "display_printer_info_ctr: Unknown Info Level\n");
221 /****************************************************************************
222 job info level 2 display function
223 ****************************************************************************/
224 void display_job_info_2(FILE *out_hnd, enum action_type action,
225 JOB_INFO_2 *const i2)
236 report(out_hnd, "Job Info Level 2:\n");
240 case ACTION_ENUMERATE:
244 report(out_hnd, "\tjob id:\t%d\n", i2->jobid);
245 unistr_to_ascii(tmp, i2->printername.buffer, sizeof(tmp)-1);
246 report(out_hnd, "\tprinter name:\t%s\n", tmp);
247 unistr_to_ascii(tmp, i2->machinename.buffer, sizeof(tmp)-1);
248 report(out_hnd, "\tmachine name:\t%s\n", tmp);
249 unistr_to_ascii(tmp, i2->username.buffer, sizeof(tmp)-1);
250 report(out_hnd, "\tusername:\t%s\n", tmp);
251 unistr_to_ascii(tmp, i2->document.buffer, sizeof(tmp)-1);
252 report(out_hnd, "\tdocument:\t%s\n", tmp);
253 unistr_to_ascii(tmp, i2->notifyname.buffer, sizeof(tmp)-1);
254 report(out_hnd, "\tnotify name:\t%s\n", tmp);
255 unistr_to_ascii(tmp, i2->datatype.buffer, sizeof(tmp)-1);
256 report(out_hnd, "\tdata type:\t%s\n", tmp);
257 unistr_to_ascii(tmp, i2->printprocessor.buffer, sizeof(tmp)-1);
258 report(out_hnd, "\tprint processor:\t%s\n", tmp);
259 unistr_to_ascii(tmp, i2->parameters.buffer, sizeof(tmp)-1);
260 report(out_hnd, "\tparameters:\t%s\n", tmp);
261 unistr_to_ascii(tmp, i2->drivername.buffer, sizeof(tmp)-1);
262 report(out_hnd, "\tdriver name:\t%s\n", tmp);
263 report(out_hnd, "\tDevice Mode:\tNOT DISPLAYED YET\n");
267 unistr_to_ascii(tmp, i2->text_status.buffer, sizeof(tmp)-1);
268 report(out_hnd, "\ttext status:\t%s\n", tmp);
269 /* SEC_DESC sec_desc;*/
270 report(out_hnd, "\tstatus:\t%d\n", i2->status);
271 report(out_hnd, "\tpriority:\t%d\n", i2->priority);
272 report(out_hnd, "\tposition:\t%d\n", i2->position);
273 report(out_hnd, "\tstarttime:\t%d\n", i2->starttime);
274 report(out_hnd, "\tuntiltime:\t%d\n", i2->untiltime);
275 report(out_hnd, "\ttotalpages:\t%d\n", i2->totalpages);
276 report(out_hnd, "\tsize:\t%d\n", i2->size);
278 SYSTEMTIME submitted;
280 report(out_hnd, "\tsubmitted:\tNOT DISPLAYED YET\n");
281 report(out_hnd, "\ttimeelapsed:\t%d\n", i2->timeelapsed);
282 report(out_hnd, "\tpagesprinted:\t%d\n", i2->pagesprinted);
286 report(out_hnd, "\n");
293 /****************************************************************************
294 job info level 1 display function
295 ****************************************************************************/
296 void display_job_info_1(FILE *out_hnd, enum action_type action,
297 JOB_INFO_1 *const i1)
308 report(out_hnd, "Job Info Level 1:\n");
312 case ACTION_ENUMERATE:
316 report(out_hnd, "\tjob id:\t%d\n", i1->jobid);
317 unistr_to_ascii(tmp, i1->printername.buffer, sizeof(tmp)-1);
318 report(out_hnd, "\tprinter name:\t%s\n", tmp);
319 unistr_to_ascii(tmp, i1->machinename.buffer, sizeof(tmp)-1);
320 report(out_hnd, "\tmachine name:\t%s\n", tmp);
321 unistr_to_ascii(tmp, i1->username.buffer, sizeof(tmp)-1);
322 report(out_hnd, "\tusername:\t%s\n", tmp);
323 unistr_to_ascii(tmp, i1->document.buffer, sizeof(tmp)-1);
324 report(out_hnd, "\tdocument:\t%s\n", tmp);
325 unistr_to_ascii(tmp, i1->datatype.buffer, sizeof(tmp)-1);
326 report(out_hnd, "\tdata type:\t%s\n", tmp);
327 unistr_to_ascii(tmp, i1->text_status.buffer, sizeof(tmp)-1);
328 report(out_hnd, "\ttext status:\t%s\n", tmp);
329 report(out_hnd, "\tstatus:\t%d\n", i1->status);
330 report(out_hnd, "\tpriority:\t%d\n", i1->priority);
331 report(out_hnd, "\tposition:\t%d\n", i1->position);
332 report(out_hnd, "\ttotalpages:\t%d\n", i1->totalpages);
334 SYSTEMTIME submitted;
336 report(out_hnd, "\tsubmitted:\tNOT DISPLAYED YET\n");
337 report(out_hnd, "\tpagesprinted:\t%d\n", i1->pagesprinted);
343 report(out_hnd, "\n");
350 /****************************************************************************
351 connection info level 2 container display function
352 ****************************************************************************/
353 void display_job_info_2_ctr(FILE *out_hnd, enum action_type action,
354 uint32 count, JOB_INFO_2 *const *const ctr)
358 report(out_hnd, "display_job_info_2_ctr: unavailable due to an internal error\n");
368 case ACTION_ENUMERATE:
372 for (i = 0; i < count; i++)
374 display_job_info_2(out_hnd, ACTION_HEADER , ctr[i]);
375 display_job_info_2(out_hnd, ACTION_ENUMERATE, ctr[i]);
376 display_job_info_2(out_hnd, ACTION_FOOTER , ctr[i]);
387 /****************************************************************************
388 connection info level 1 container display function
389 ****************************************************************************/
390 void display_job_info_1_ctr(FILE *out_hnd, enum action_type action,
391 uint32 count, JOB_INFO_1 *const *const ctr)
395 report(out_hnd, "display_job_info_1_ctr: unavailable due to an internal error\n");
405 case ACTION_ENUMERATE:
409 for (i = 0; i < count; i++)
411 display_job_info_1(out_hnd, ACTION_HEADER , ctr[i]);
412 display_job_info_1(out_hnd, ACTION_ENUMERATE, ctr[i]);
413 display_job_info_1(out_hnd, ACTION_FOOTER , ctr[i]);
424 /****************************************************************************
425 connection info container display function
426 ****************************************************************************/
427 void display_job_info_ctr(FILE *out_hnd, enum action_type action,
428 uint32 level, uint32 count,
429 void *const *const ctr)
433 report(out_hnd, "display_job_info_ctr: unavailable due to an internal error\n");
441 display_job_info_1_ctr(out_hnd, action,
442 count, (JOB_INFO_1*const*const)ctr);
447 display_job_info_2_ctr(out_hnd, action,
448 count, (JOB_INFO_2*const*const)ctr);
453 report(out_hnd, "display_job_info_ctr: Unknown Info Level\n");