This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.
[kai/samba-autobuild/.git] / source / rpcclient / display_spool.c
1 /* 
2    Unix SMB/CIFS implementation.
3    Samba utility functions
4    Copyright (C) Andrew Tridgell 1992-1999
5    Copyright (C) Luke Kenneth Casson Leighton 1996 - 1999
6    
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful, 
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22 #include "includes.h"
23
24 /****************************************************************************
25 printer info level 0 display function
26 ****************************************************************************/
27 static void display_print_info_0(FILE *out_hnd, PRINTER_INFO_0 *i1)
28 {
29         fstring name;
30         fstring server;
31         if (i1 == NULL)
32                 return;
33
34         rpcstr_pull(name, i1->printername.buffer, sizeof(name), 0, STR_TERMINATE);
35         rpcstr_pull(server, i1->servername.buffer, sizeof(server), 0, STR_TERMINATE);
36
37         report(out_hnd, "\tprintername:[%s]\n", name);
38         report(out_hnd, "\tservername:[%s]\n", server);
39         report(out_hnd, "\tcjobs:[%x]\n", i1->cjobs);
40         report(out_hnd, "\ttotal_jobs:[%x]\n", i1->total_jobs);
41         
42         report(out_hnd, "\t:date: [%d]-[%d]-[%d] (%d)\n", i1->year, i1->month, i1->day, i1->dayofweek);
43         report(out_hnd, "\t:time: [%d]-[%d]-[%d]-[%d]\n", i1->hour, i1->minute, i1->second, i1->milliseconds);
44         
45         report(out_hnd, "\tglobal_counter:[%x]\n", i1->global_counter);
46         report(out_hnd, "\ttotal_pages:[%x]\n", i1->total_pages);
47         
48         report(out_hnd, "\tmajorversion:[%x]\n", i1->major_version);
49         report(out_hnd, "\tbuildversion:[%x]\n", i1->build_version);
50         
51         report(out_hnd, "\tunknown7:[%x]\n", i1->unknown7);
52         report(out_hnd, "\tunknown8:[%x]\n", i1->unknown8);
53         report(out_hnd, "\tunknown9:[%x]\n", i1->unknown9);
54         report(out_hnd, "\tsession_counter:[%x]\n", i1->session_counter);
55         report(out_hnd, "\tunknown11:[%x]\n", i1->unknown11);
56         report(out_hnd, "\tprinter_errors:[%x]\n", i1->printer_errors);
57         report(out_hnd, "\tunknown13:[%x]\n", i1->unknown13);
58         report(out_hnd, "\tunknown14:[%x]\n", i1->unknown14);
59         report(out_hnd, "\tunknown15:[%x]\n", i1->unknown15);
60         report(out_hnd, "\tunknown16:[%x]\n", i1->unknown16);
61         report(out_hnd, "\tchange_id:[%x]\n", i1->change_id);
62         report(out_hnd, "\tunknown18:[%x]\n", i1->unknown18);
63         report(out_hnd, "\tstatus:[%x]\n", i1->status);
64         report(out_hnd, "\tunknown20:[%x]\n", i1->unknown20);
65         report(out_hnd, "\tc_setprinter:[%x]\n", i1->c_setprinter);
66         report(out_hnd, "\tunknown22:[%x]\n", i1->unknown22);
67         report(out_hnd, "\tunknown23:[%x]\n", i1->unknown23);
68         report(out_hnd, "\tunknown24:[%x]\n", i1->unknown24);
69         report(out_hnd, "\tunknown25:[%x]\n", i1->unknown25);
70         report(out_hnd, "\tunknown26:[%x]\n", i1->unknown26);
71         report(out_hnd, "\tunknown27:[%x]\n", i1->unknown27);
72         report(out_hnd, "\tunknown28:[%x]\n", i1->unknown28);
73         report(out_hnd, "\tunknown29:[%x]\n", i1->unknown29);
74 }
75
76 /****************************************************************************
77 printer info level 1 display function
78 ****************************************************************************/
79 static void display_print_info_1(FILE *out_hnd, PRINTER_INFO_1 *i1)
80 {
81         fstring desc;
82         fstring name;
83         fstring comm;
84         if (i1 == NULL)
85                 return;
86
87         rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
88         rpcstr_pull(desc, i1->description.buffer, sizeof(desc), 0, STR_TERMINATE);
89         rpcstr_pull(comm, i1->comment.buffer, sizeof(comm), 0, STR_TERMINATE);
90
91         report(out_hnd, "\tflags:[%x]\n", i1->flags);
92         report(out_hnd, "\tname:[%s]\n", name);
93         report(out_hnd, "\tdescription:[%s]\n", desc);
94         report(out_hnd, "\tcomment:[%s]\n\n", comm);
95 }
96
97 /****************************************************************************
98 printer info level 2 display function
99 ****************************************************************************/
100 static void display_print_info_2(FILE *out_hnd, PRINTER_INFO_2 *i2)
101 {
102         fstring servername;
103         fstring printername;
104         fstring sharename;
105         fstring portname;
106         fstring drivername;
107         fstring comment;
108         fstring location;
109         fstring sepfile;
110         fstring printprocessor;
111         fstring datatype;
112         fstring parameters;
113         
114         if (i2 == NULL)
115                 return;
116
117         rpcstr_pull(servername, i2->servername.buffer,sizeof(servername), 0, STR_TERMINATE);
118         rpcstr_pull(printername, i2->printername.buffer,sizeof(printername), 0, STR_TERMINATE);
119         rpcstr_pull(sharename, i2->sharename.buffer,sizeof(sharename), 0, STR_TERMINATE);
120         rpcstr_pull(portname, i2->portname.buffer,sizeof(portname), 0, STR_TERMINATE);
121         rpcstr_pull(drivername, i2->drivername.buffer,sizeof(drivername), 0, STR_TERMINATE);
122         rpcstr_pull(comment, i2->comment.buffer,sizeof(comment), 0, STR_TERMINATE);
123         rpcstr_pull(location, i2->location.buffer,sizeof(location), 0, STR_TERMINATE);
124         rpcstr_pull(sepfile, i2->sepfile.buffer,sizeof(sepfile), 0, STR_TERMINATE);
125         rpcstr_pull(printprocessor, i2->printprocessor.buffer,sizeof(printprocessor), 0, STR_TERMINATE);
126         rpcstr_pull(datatype, i2->datatype.buffer,sizeof(datatype), 0, STR_TERMINATE);
127         rpcstr_pull(parameters, i2->parameters.buffer,sizeof(parameters), 0, STR_TERMINATE);
128         
129         report(out_hnd, "\tservername:[%s]\n", servername);
130         report(out_hnd, "\tprintername:[%s]\n", printername);
131         report(out_hnd, "\tsharename:[%s]\n", sharename);
132         report(out_hnd, "\tportname:[%s]\n", portname);
133         report(out_hnd, "\tdrivername:[%s]\n", drivername);
134         report(out_hnd, "\tcomment:[%s]\n", comment);
135         report(out_hnd, "\tlocation:[%s]\n", location);
136         report(out_hnd, "\tsepfile:[%s]\n", sepfile);
137         report(out_hnd, "\tprintprocessor:[%s]\n", printprocessor);
138         report(out_hnd, "\tdatatype:[%s]\n", datatype);
139         report(out_hnd, "\tparameters:[%s]\n", parameters);
140         report(out_hnd, "\tattributes:[%x]\n", i2->attributes);
141         report(out_hnd, "\tpriority:[%x]\n", i2->priority);
142         report(out_hnd, "\tdefaultpriority:[%x]\n", i2->defaultpriority);
143         report(out_hnd, "\tstarttime:[%x]\n", i2->starttime);
144         report(out_hnd, "\tuntiltime:[%x]\n", i2->untiltime);
145         report(out_hnd, "\tstatus:[%x]\n", i2->status);
146         report(out_hnd, "\tcjobs:[%x]\n", i2->cjobs);
147         report(out_hnd, "\taverageppm:[%x]\n\n", i2->averageppm);
148
149         if (i2->secdesc != NULL)
150         {
151                 display_sec_desc(out_hnd, ACTION_HEADER   , i2->secdesc);
152                 display_sec_desc(out_hnd, ACTION_ENUMERATE, i2->secdesc);
153                 display_sec_desc(out_hnd, ACTION_FOOTER   , i2->secdesc);
154         }
155 }
156
157 /****************************************************************************
158 printer info level 3 display function
159 ****************************************************************************/
160 static void display_print_info_3(FILE *out_hnd, PRINTER_INFO_3 *i3)
161 {
162         if (i3 == NULL)
163                 return;
164
165         report(out_hnd, "\tflags:[%x]\n", i3->flags);
166
167         display_sec_desc(out_hnd, ACTION_HEADER   , i3->secdesc);
168         display_sec_desc(out_hnd, ACTION_ENUMERATE, i3->secdesc);
169         display_sec_desc(out_hnd, ACTION_FOOTER   , i3->secdesc);
170 }
171
172 /****************************************************************************
173 connection info level 0 container display function
174 ****************************************************************************/
175 static void display_printer_info_0_ctr(FILE *out_hnd, enum action_type action, uint32 count,  PRINTER_INFO_CTR ctr)
176 {
177         int i;
178         PRINTER_INFO_0 *in;
179
180         switch (action)
181         {
182                 case ACTION_HEADER:
183                         report(out_hnd, "Printer Info Level 0:\n");
184                         break;
185                 case ACTION_ENUMERATE:
186                         for (i = 0; i < count; i++) {
187                                 in=ctr.printers_0;
188                                 display_print_info_0(out_hnd, &(in[i]) );
189                         }
190                         break;
191                 case ACTION_FOOTER:
192                         report(out_hnd, "\n");
193                         break;
194         }
195 }
196
197 /****************************************************************************
198 connection info level 1 container display function
199 ****************************************************************************/
200 static void display_printer_info_1_ctr(FILE *out_hnd, enum action_type action, uint32 count,  PRINTER_INFO_CTR ctr)
201 {
202         int i;
203         PRINTER_INFO_1 *in;
204
205         switch (action)
206         {
207                 case ACTION_HEADER:
208                         report(out_hnd, "Printer Info Level 1:\n");
209                         break;
210                 case ACTION_ENUMERATE:
211                         for (i = 0; i < count; i++) {
212                                 in=ctr.printers_1;
213                                 display_print_info_1(out_hnd, &(in[i]) );
214                         }
215                         break;
216                 case ACTION_FOOTER:
217                         report(out_hnd, "\n");
218                         break;
219         }
220 }
221
222 /****************************************************************************
223 connection info level 2 container display function
224 ****************************************************************************/
225 static void display_printer_info_2_ctr(FILE *out_hnd, enum action_type action, uint32 count,  PRINTER_INFO_CTR ctr)
226 {
227         int i;
228         PRINTER_INFO_2 *in;
229
230         switch (action)
231         {
232                 case ACTION_HEADER:
233                         report(out_hnd, "Printer Info Level 2:\n");
234                         break;
235                 case ACTION_ENUMERATE:
236                         for (i = 0; i < count; i++) {
237                                 in=ctr.printers_2;
238                                 display_print_info_2(out_hnd, &(in[i]) );
239                         }
240                         break;
241                 case ACTION_FOOTER:
242                         report(out_hnd, "\n");
243                         break;
244         }
245 }
246
247 /****************************************************************************
248 connection info level 3 container display function
249 ****************************************************************************/
250 static void display_printer_info_3_ctr(FILE *out_hnd, enum action_type action, uint32 count,  PRINTER_INFO_CTR ctr)
251 {
252         int i;
253         PRINTER_INFO_3 *in;
254
255         switch (action)
256         {
257                 case ACTION_HEADER:
258                         report(out_hnd, "Printer Info Level 3:\n");
259                         break;
260                 case ACTION_ENUMERATE:
261                         for (i = 0; i < count; i++) {
262                                 in=ctr.printers_3;
263                                 display_print_info_3(out_hnd, &(in[i]) );
264                         }
265                         break;
266                 case ACTION_FOOTER:
267                         report(out_hnd, "\n");
268                         break;
269         }
270 }
271
272 /****************************************************************************
273 connection info container display function
274 ****************************************************************************/
275 void display_printer_info_ctr(FILE *out_hnd, enum action_type action, uint32 level,
276                                 uint32 count, PRINTER_INFO_CTR ctr)
277 {
278         switch (level) {
279                 case 0:
280                         display_printer_info_0_ctr(out_hnd, action, count, ctr);
281                         break;
282                 case 1:
283                         display_printer_info_1_ctr(out_hnd, action, count, ctr);
284                         break;
285                 case 2:
286                         display_printer_info_2_ctr(out_hnd, action, count, ctr);
287                         break;
288                 case 3:
289                         display_printer_info_3_ctr(out_hnd, action, count, ctr);
290                         break;
291                 default:
292                         report(out_hnd, "display_printer_info_ctr: Unknown Info Level\n");
293                         break;
294         }
295 }
296
297 /****************************************************************************
298 connection info level 3 container display function
299 ****************************************************************************/
300 static void display_port_info_1_ctr(FILE *out_hnd, enum action_type action, 
301                                     uint32 count,  PORT_INFO_CTR *ctr)
302 {
303         uint32  i = 0;
304         switch (action)
305         {
306                 case ACTION_HEADER:
307                         report(out_hnd, "Port Info Level 1:\n");
308                         break;
309                 case ACTION_ENUMERATE:
310                         for (i=0; i<count; i++)
311                                 display_port_info_1(out_hnd, action, &ctr->port.info_1[i]);
312                         break;
313                 case ACTION_FOOTER:
314                         report(out_hnd, "\n");
315                         break;
316         }
317 }
318
319 /****************************************************************************
320 connection info level 3 container display function
321 ****************************************************************************/
322 static void display_port_info_2_ctr(FILE *out_hnd, enum action_type action, 
323                                     uint32 count,  PORT_INFO_CTR *ctr)
324 {
325         uint32  i = 0;
326         switch (action)
327         {
328                 case ACTION_HEADER:
329                         report(out_hnd, "Port Info Level 2:\n");
330                         break;
331                 case ACTION_ENUMERATE:
332                         for (i=0; i<count; i++)
333                                 display_port_info_2(out_hnd, action, &ctr->port.info_2[i]);
334                         break;
335                 case ACTION_FOOTER:
336                         report(out_hnd, "\n");
337                         break;
338         }
339 }
340
341 /****************************************************************************
342 connection info container display function
343 ****************************************************************************/
344 void display_port_info_ctr(FILE *out_hnd, enum action_type action, uint32 level,
345                                 uint32 count, PORT_INFO_CTR *ctr)
346 {
347         switch (level) {
348                 case 1:
349                         display_port_info_1_ctr(out_hnd, action, count, ctr);
350                         break;
351                 case 2:
352                         display_port_info_2_ctr(out_hnd, action, count, ctr);
353                         break;
354                 default:
355                         report(out_hnd, "display_port_info_ctr: Unknown Info Level\n");
356                         break;
357         }
358 }
359
360 /****************************************************************************
361 connection info container display function
362 ****************************************************************************/
363 void display_port_info_1(FILE *out_hnd, enum action_type action, PORT_INFO_1 *i1)
364 {
365         fstring buffer;
366         
367         switch (action)
368         {
369                 case ACTION_HEADER:
370                         report(out_hnd, "Port:\n");
371                         break;
372                 case ACTION_ENUMERATE:
373                         rpcstr_pull(buffer, i1->port_name.buffer, sizeof(bufferi), 0, STR_TERMINATE);
374                         fprintf (out_hnd, "\tPort Name:\t[%s]\n\n", buffer);
375                         break;
376                 case ACTION_FOOTER:
377                         report(out_hnd, "\n");
378                         break;
379         }
380 }
381
382 /****************************************************************************
383 connection info container display function
384 ****************************************************************************/
385 void display_port_info_2(FILE *out_hnd, enum action_type action, PORT_INFO_2 *i2)
386 {
387         fstring buffer;
388         
389         switch (action)
390         {
391                 case ACTION_HEADER:
392                         report(out_hnd, "Port:\n");
393                         break;
394                 case ACTION_ENUMERATE:
395                         rpcstr_pull(buffer, i2->port_name.buffer, sizeof(buffer), 0, STR_TERMINATE);
396                         fprintf (out_hnd, "\tPort Name:\t[%s]\n", buffer);
397                         rpcstr_pull(buffer, i2->monitor_name.buffer, sizeof(buffer), 0, STR_TERMINATE);
398
399                         fprintf (out_hnd, "\tMonitor Name:\t[%s]\n", buffer);
400                         rpcstr_pull(buffer, i2->description.buffer, sizeof(buffer), 0, STR_TERMINATE);
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;
409         }
410 }
411
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)
419 {
420         fstring buffer;
421         
422         switch (action)
423         {
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                         rpcstr_pull(buffer, value, sizeof(buffer), 0, STR_TERMINATE);
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;
443         }
444 }
445
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)
451 {
452         if (i2 == NULL)
453         {
454                 return;
455         }
456
457         switch (action)
458         {
459                 case ACTION_HEADER:
460                 {
461                         report(out_hnd, "Job Info Level 2:\n");
462
463                         break;
464                 }
465                 case ACTION_ENUMERATE:
466                 {
467                         fstring tmp;
468
469                         report(out_hnd, "\tjob id:\t%d\n", i2->jobid);
470                         rpcstr_pull(tmp, i2->printername.buffer, sizeof(tmp), 0, STR_TERMINATE);
471                         report(out_hnd, "\tprinter name:\t%s\n", tmp);
472                         rpcstr_pull(tmp, i2->machinename.buffer, sizeof(tmp), 0, STR_TERMINATE);
473                         report(out_hnd, "\tmachine name:\t%s\n", tmp);
474                         rpcstr_pull(tmp, i2->username.buffer, sizeof(tmp), 0, STR_TERMINATE);
475                         report(out_hnd, "\tusername:\t%s\n", tmp);
476                         rpcstr_pull(tmp, i2->document.buffer, sizeof(tmp), 0, STR_TERMINATE);
477                         report(out_hnd, "\tdocument:\t%s\n", tmp);
478                         rpcstr_pull(tmp, i2->notifyname.buffer, sizeof(tmp), 0, STR_TERMINATE);
479                         report(out_hnd, "\tnotify name:\t%s\n", tmp);
480                         rpcstr_pull(tmp, i2->datatype.buffer, sizeof(tmp), 0, STR_TERMINATE);
481                         report(out_hnd, "\tdata type:\t%s\n", tmp);
482                         rpcstr_pull(tmp, i2->printprocessor.buffer, sizeof(tmp), 0, STR_TERMINATE);
483                         report(out_hnd, "\tprint processor:\t%s\n", tmp);
484                         rpcstr_pull(tmp, i2->parameters.buffer, sizeof(tmp), 0, STR_TERMINATE);
485                         report(out_hnd, "\tparameters:\t%s\n", tmp);
486                         rpcstr_pull(tmp, i2->drivername.buffer, sizeof(tmp), 0, STR_TERMINATE);
487                         report(out_hnd, "\tdriver name:\t%s\n", tmp);
488                         report(out_hnd, "\tDevice Mode:\tNOT DISPLAYED YET\n");
489
490                         rpcstr_pull(tmp, i2->text_status.buffer, sizeof(tmp), 0, STR_TERMINATE);
491                         report(out_hnd, "\ttext status:\t%s\n", tmp);
492                 /*      SEC_DESC sec_desc;*/
493                         report(out_hnd, "\tstatus:\t%d\n", i2->status);
494                         report(out_hnd, "\tpriority:\t%d\n", i2->priority);
495                         report(out_hnd, "\tposition:\t%d\n", i2->position);
496                         report(out_hnd, "\tstarttime:\t%d\n", i2->starttime);
497                         report(out_hnd, "\tuntiltime:\t%d\n", i2->untiltime);
498                         report(out_hnd, "\ttotalpages:\t%d\n", i2->totalpages);
499                         report(out_hnd, "\tsize:\t%d\n", i2->size);
500 /*
501                         SYSTEMTIME submitted;
502 */
503                         report(out_hnd, "\tsubmitted:\tNOT DISPLAYED YET\n");
504                         report(out_hnd, "\ttimeelapsed:\t%d\n", i2->timeelapsed);
505                         report(out_hnd, "\tpagesprinted:\t%d\n", i2->pagesprinted);
506                 }
507                 case ACTION_FOOTER:
508                 {
509                         report(out_hnd, "\n");
510                         break;
511                 }
512         }
513
514 }
515
516 /****************************************************************************
517 job info level 1 display function
518 ****************************************************************************/
519 void display_job_info_1(FILE *out_hnd, enum action_type action, 
520                 JOB_INFO_1 *const i1)
521 {
522         if (i1 == NULL)
523         {
524                 return;
525         }
526
527         switch (action)
528         {
529                 case ACTION_HEADER:
530                 {
531                         report(out_hnd, "Job Info Level 1:\n");
532
533                         break;
534                 }
535                 case ACTION_ENUMERATE:
536                 {
537                         fstring tmp;
538
539                         report(out_hnd, "\tjob id:\t%d\n", i1->jobid);
540                         rpcstr_pull(tmp, i1->printername.buffer, sizeof(tmp), 0, STR_TERMINATE);
541                         report(out_hnd, "\tprinter name:\t%s\n", tmp);
542                         rpcstr_pull(tmp, i1->machinename.buffer, sizeof(tmp), 0, STR_TERMINATE);
543                         report(out_hnd, "\tmachine name:\t%s\n", tmp);
544                         rpcstr_pull(tmp, i1->username.buffer, sizeof(tmp), 0, STR_TERMINATE);
545                         report(out_hnd, "\tusername:\t%s\n", tmp);
546                         rpcstr_pull(tmp, i1->document.buffer, sizeof(tmp), 0, STR_TERMINATE);
547                         report(out_hnd, "\tdocument:\t%s\n", tmp);
548                         rpcstr_pull(tmp, i1->datatype.buffer, sizeof(tmp), 0, STR_TERMINATE);
549                         report(out_hnd, "\tdata type:\t%s\n", tmp);
550                         rpcstr_pull(tmp, i1->text_status.buffer, sizeof(tmp), 0, STR_TERMINATE);
551                         report(out_hnd, "\ttext status:\t%s\n", tmp);
552                         report(out_hnd, "\tstatus:\t%d\n", i1->status);
553                         report(out_hnd, "\tpriority:\t%d\n", i1->priority);
554                         report(out_hnd, "\tposition:\t%d\n", i1->position);
555                         report(out_hnd, "\ttotalpages:\t%d\n", i1->totalpages);
556 /*
557                         SYSTEMTIME submitted;
558 */
559                         report(out_hnd, "\tsubmitted:\tNOT DISPLAYED YET\n");
560                         report(out_hnd, "\tpagesprinted:\t%d\n", i1->pagesprinted);
561
562                         break;
563                 }
564                 case ACTION_FOOTER:
565                 {
566                         report(out_hnd, "\n");
567                         break;
568                 }
569         }
570
571 }
572
573 /****************************************************************************
574 connection info level 2 container display function
575 ****************************************************************************/
576 void display_job_info_2_ctr(FILE *out_hnd, enum action_type action, 
577                                 uint32 count, JOB_INFO_2 *const *const ctr)
578 {
579         if (ctr == NULL)
580         {
581                 report(out_hnd, "display_job_info_2_ctr: unavailable due to an internal error\n");
582                 return;
583         }
584
585         switch (action)
586         {
587                 case ACTION_HEADER:
588                 {
589                         break;
590                 }
591                 case ACTION_ENUMERATE:
592                 {
593                         int i;
594
595                         for (i = 0; i < count; i++)
596                         {
597                                 display_job_info_2(out_hnd, ACTION_HEADER   , ctr[i]);
598                                 display_job_info_2(out_hnd, ACTION_ENUMERATE, ctr[i]);
599                                 display_job_info_2(out_hnd, ACTION_FOOTER   , ctr[i]);
600                         }
601                         break;
602                 }
603                 case ACTION_FOOTER:
604                 {
605                         break;
606                 }
607         }
608 }
609
610 /****************************************************************************
611 connection info level 1 container display function
612 ****************************************************************************/
613 void display_job_info_1_ctr(FILE *out_hnd, enum action_type action, 
614                                 uint32 count, JOB_INFO_1 *const *const ctr)
615 {
616         if (ctr == NULL)
617         {
618                 report(out_hnd, "display_job_info_1_ctr: unavailable due to an internal error\n");
619                 return;
620         }
621
622         switch (action)
623         {
624                 case ACTION_HEADER:
625                 {
626                         break;
627                 }
628                 case ACTION_ENUMERATE:
629                 {
630                         int i;
631
632                         for (i = 0; i < count; i++)
633                         {
634                                 display_job_info_1(out_hnd, ACTION_HEADER   , ctr[i]);
635                                 display_job_info_1(out_hnd, ACTION_ENUMERATE, ctr[i]);
636                                 display_job_info_1(out_hnd, ACTION_FOOTER   , ctr[i]);
637                         }
638                         break;
639                 }
640                 case ACTION_FOOTER:
641                 {
642                         break;
643                 }
644         }
645 }
646
647 /****************************************************************************
648 connection info container display function
649 ****************************************************************************/
650 void display_job_info_ctr(FILE *out_hnd, enum action_type action, 
651                                 uint32 level, uint32 count,
652                                 void *const *const ctr)
653 {
654         if (ctr == NULL)
655         {
656                 report(out_hnd, "display_job_info_ctr: unavailable due to an internal error\n");
657                 return;
658         }
659
660         switch (level)
661         {
662                 case 1:
663                 {
664                         display_job_info_1_ctr(out_hnd, action, 
665                                            count, (JOB_INFO_1*const*const)ctr);
666                         break;
667                 }
668                 case 2:
669                 {
670                         display_job_info_2_ctr(out_hnd, action, 
671                                            count, (JOB_INFO_2*const*const)ctr);
672                         break;
673                 }
674                 default:
675                 {
676                         report(out_hnd, "display_job_info_ctr: Unknown Info Level\n");
677                         break;
678                 }
679         }
680 }
681
682 /****************************************************************************
683 printer info level 0 display function
684 ****************************************************************************/
685 static void display_print_driver_1(FILE *out_hnd, DRIVER_INFO_1 *i1)
686 {
687         fstring name;
688         if (i1 == NULL)
689                 return;
690
691         rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
692
693         report(out_hnd, "\tname:[%s]\n", name);
694 }
695
696 /****************************************************************************
697 printer info level 1 display function
698 ****************************************************************************/
699 static void display_print_driver_2(FILE *out_hnd, DRIVER_INFO_2 *i1)
700 {
701         fstring name;
702         fstring architecture;
703         fstring driverpath;
704         fstring datafile;
705         fstring configfile;
706         if (i1 == NULL)
707                 return;
708
709         rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
710         rpcstr_pull(architecture, i1->architecture.buffer, sizeof(architecture), 0, STR_TERMINATE);
711         rpcstr_pull(driverpath, i1->driverpath.buffer, sizeof(driverpath), 0, STR_TERMINATE);
712         rpcstr_pull(datafile, i1->datafile.buffer, sizeof(datafile), 0, STR_TERMINATE);
713         rpcstr_pull(configfile, i1->conigfile.buffer, sizeof(configfile), 0, STR_TERMINATE);
714
715         report(out_hnd, "\tversion:[%x]\n", i1->version);
716         report(out_hnd, "\tname:[%s]\n", name);
717         report(out_hnd, "\tarchitecture:[%s]\n", architecture);
718         report(out_hnd, "\tdriverpath:[%s]\n", driverpath);
719         report(out_hnd, "\tdatafile:[%s]\n", datafile);
720         report(out_hnd, "\tconfigfile:[%s]\n", configfile);
721 }
722
723 /****************************************************************************
724 printer info level 2 display function
725 ****************************************************************************/
726 static void display_print_driver_3(FILE *out_hnd, DRIVER_INFO_3 *i1)
727 {
728         fstring name;
729         fstring architecture;
730         fstring driverpath;
731         fstring datafile;
732         fstring configfile;
733         fstring helpfile;
734         fstring dependentfiles;
735         fstring monitorname;
736         fstring defaultdatatype;
737         
738         int length=0;
739         BOOL valid = True;
740         
741         if (i1 == NULL)
742                 return;
743
744         rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
745         rpcstr_pull(architecture, i1->architecture.buffer, sizeof(architecture), 0, STR_TERMINATE);
746         rpcstr_pull(driverpath, i1->driverpath.buffer, sizeof(driverpath), 0, STR_TERMINATE);
747         rpcstr_pull(datafile, i1->datafile.buffer, sizeof(datafile), 0, STR_TERMINATE);
748         rpcstr_pull(configfile, i1->configfile.buffer, sizeof(configfile), 0, STR_TERMINATE);
749         rpcstr_pull(helpfile, i1->helpfile.buffer, sizeof(helpfile), 0, STR_TERMINATE);
750         rpcstr_pull(monitorname, i1->monitorname.buffer, sizeof(monitorname), 0, STR_TERMINATE);
751         rpcstr_pull(defaultdatatype, i1->defaultdatatype.buffer, sizeof(defaultdatatype), 0, STR_TERMINATE);
752
753         report(out_hnd, "\tversion:[%x]\n", i1->version);
754         report(out_hnd, "\tname:[%s]\n",name);
755         report(out_hnd, "\tarchitecture:[%s]\n", architecture);
756         report(out_hnd, "\tdriverpath:[%s]\n", driverpath);
757         report(out_hnd, "\tdatafile:[%s]\n", datafile);
758         report(out_hnd, "\tconfigfile:[%s]\n", configfile);
759         report(out_hnd, "\thelpfile:[%s]\n\n", helpfile);
760
761         while (valid)
762         {
763                 rpcstr_pull(dependentfiles, i1->dependentfiles+length, sizeof(dependentfiles), 0, STR_TERMINATE);
764                 length+=strlen(dependentfiles)+1;
765                 
766                 if (strlen(dependentfiles) > 0)
767                 {
768                         report(out_hnd, "\tdependentfiles:[%s]\n", dependentfiles);
769                 }
770                 else
771                 {
772                         valid = False;
773                 }
774         }
775         
776         report(out_hnd, "\n\tmonitorname:[%s]\n", monitorname);
777         report(out_hnd, "\tdefaultdatatype:[%s]\n", defaultdatatype);
778         
779 }
780
781 /****************************************************************************
782 connection info level 1 container display function
783 ****************************************************************************/
784 static void display_printer_driver_1_ctr(FILE *out_hnd, enum action_type action, uint32 count,  PRINTER_DRIVER_CTR ctr)
785 {
786         int i;
787         DRIVER_INFO_1 *in;
788
789         switch (action)
790         {
791                 case ACTION_HEADER:
792                         report(out_hnd, "Printer driver Level 1:\n");
793                         break;
794                 case ACTION_ENUMERATE:
795                         for (i = 0; i < count; i++) {
796                                 in=ctr.info1;
797                                 display_print_driver_1(out_hnd, &(in[i]) );
798                         }
799                         break;
800                 case ACTION_FOOTER:
801                         report(out_hnd, "\n");
802                         break;
803         }
804 }
805
806 /****************************************************************************
807 connection info level 2 container display function
808 ****************************************************************************/
809 static void display_printer_driver_2_ctr(FILE *out_hnd, enum action_type action, uint32 count,  PRINTER_DRIVER_CTR ctr)
810 {
811         int i;
812         DRIVER_INFO_2 *in;
813
814         switch (action)
815         {
816                 case ACTION_HEADER:
817                         report(out_hnd, "Printer driver Level 2:\n");
818                         break;
819                 case ACTION_ENUMERATE:
820                         for (i = 0; i < count; i++) {
821                                 in=ctr.info2;
822                                 display_print_driver_2(out_hnd, &(in[i]) );
823                         }
824                         break;
825                 case ACTION_FOOTER:
826                         report(out_hnd, "\n");
827                         break;
828         }
829 }
830
831 /****************************************************************************
832 connection info level 3 container display function
833 ****************************************************************************/
834 static void display_printer_driver_3_ctr(FILE *out_hnd, enum action_type action, uint32 count,  PRINTER_DRIVER_CTR ctr)
835 {
836         int i;
837         DRIVER_INFO_3 *in;
838
839         switch (action)
840         {
841                 case ACTION_HEADER:
842                         report(out_hnd, "Printer driver Level 3:\n");
843                         break;
844                 case ACTION_ENUMERATE:
845                         for (i = 0; i < count; i++) {
846                                 in=ctr.info3;
847                                 display_print_driver_3(out_hnd, &(in[i]) );
848                         }
849                         break;
850                 case ACTION_FOOTER:
851                         report(out_hnd, "\n");
852                         break;
853         }
854 }
855
856 /****************************************************************************
857 connection info container display function
858 ****************************************************************************/
859 void display_printer_driver_ctr(FILE *out_hnd, enum action_type action, uint32 level,
860                                 uint32 count, PRINTER_DRIVER_CTR ctr)
861 {
862         switch (level) {
863                 case 1:
864                         display_printer_driver_1_ctr(out_hnd, action, count, ctr);
865                         break;
866                 case 2:
867                         display_printer_driver_2_ctr(out_hnd, action, count, ctr);
868                         break;
869                 case 3:
870                         display_printer_driver_3_ctr(out_hnd, action, count, ctr);
871                         break;
872                 default:
873                         report(out_hnd, "display_printer_driver_ctr: Unknown Info Level\n");
874                         break;
875         }
876 }
877
878
879 /****************************************************************************
880 printer info level 1 display function
881 ****************************************************************************/
882 static void display_printdriverdir_info_1(FILE *out_hnd, DRIVER_DIRECTORY_1 *i1)
883 {
884         fstring name;
885         if (i1 == NULL)
886                 return;
887
888         rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
889
890         report(out_hnd, "\tname:[%s]\n", name);
891 }
892
893 /****************************************************************************
894 connection info level 1 container display function
895 ****************************************************************************/
896 static void display_printerdriverdir_info_1_ctr(FILE *out_hnd, enum action_type action, DRIVER_DIRECTORY_CTR ctr)
897 {
898
899         switch (action)
900         {
901                 case ACTION_HEADER:
902                         report(out_hnd, "Printer driver dir Info Level 1:\n");
903                         break;
904                 case ACTION_ENUMERATE:
905                                 display_printdriverdir_info_1(out_hnd, &(ctr.driver.info_1) );
906                         break;
907                 case ACTION_FOOTER:
908                         report(out_hnd, "\n");
909                         break;
910         }
911 }
912
913 /****************************************************************************
914 connection info container display function
915 ****************************************************************************/
916 void display_printerdriverdir_info_ctr(FILE *out_hnd, enum action_type action, uint32 level,
917                                 DRIVER_DIRECTORY_CTR ctr)
918 {
919         switch (level) {
920                 case 1:
921                         display_printerdriverdir_info_1_ctr(out_hnd, action, ctr);
922                         break;
923                 default:
924                         report(out_hnd, "display_printerdriverdir_info_ctr: Unknown Info Level\n");
925                         break;
926         }
927 }