cdca0c393dddedbee14ad8432bd347d985f341f8
[ira/wip.git] / source3 / rpcclient / display_spool.c
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
7    
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.
12    
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.
17    
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.
21 */
22
23 #include "includes.h"
24
25 /****************************************************************************
26 printer info level 0 display function
27 ****************************************************************************/
28 static void display_print_info_0(FILE *out_hnd, PRINTER_INFO_0 *i1)
29 {
30         fstring name;
31         fstring server;
32         if (i1 == NULL)
33                 return;
34
35         rpcstr_pull(name, i1->printername.buffer, sizeof(name), 0, STR_TERMINATE);
36         rpcstr_pull(server, i1->servername.buffer, sizeof(server), 0, STR_TERMINATE);
37
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);
42         
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);
45         
46         report(out_hnd, "\tglobal_counter:[%x]\n", i1->global_counter);
47         report(out_hnd, "\ttotal_pages:[%x]\n", i1->total_pages);
48         
49         report(out_hnd, "\tmajorversion:[%x]\n", i1->major_version);
50         report(out_hnd, "\tbuildversion:[%x]\n", i1->build_version);
51         
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);
75 }
76
77 /****************************************************************************
78 printer info level 1 display function
79 ****************************************************************************/
80 static void display_print_info_1(FILE *out_hnd, PRINTER_INFO_1 *i1)
81 {
82         fstring desc;
83         fstring name;
84         fstring comm;
85         if (i1 == NULL)
86                 return;
87
88         rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
89         rpcstr_pull(desc, i1->description.buffer, sizeof(desc), 0, STR_TERMINATE);
90         rpcstr_pull(comm, i1->comment.buffer, sizeof(comm), 0, STR_TERMINATE);
91
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);
96 }
97
98 /****************************************************************************
99 printer info level 2 display function
100 ****************************************************************************/
101 static void display_print_info_2(FILE *out_hnd, PRINTER_INFO_2 *i2)
102 {
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;
114         
115         if (i2 == NULL)
116                 return;
117
118         rpcstr_pull(servername, i2->servername.buffer,sizeof(servername), 0, STR_TERMINATE);
119         rpcstr_pull(printername, i2->printername.buffer,sizeof(printername), 0, STR_TERMINATE);
120         rpcstr_pull(sharename, i2->sharename.buffer,sizeof(sharename), 0, STR_TERMINATE);
121         rpcstr_pull(portname, i2->portname.buffer,sizeof(portname), 0, STR_TERMINATE);
122         rpcstr_pull(drivername, i2->drivername.buffer,sizeof(drivername), 0, STR_TERMINATE);
123         rpcstr_pull(comment, i2->comment.buffer,sizeof(comment), 0, STR_TERMINATE);
124         rpcstr_pull(location, i2->location.buffer,sizeof(location), 0, STR_TERMINATE);
125         rpcstr_pull(sepfile, i2->sepfile.buffer,sizeof(sepfile), 0, STR_TERMINATE);
126         rpcstr_pull(printprocessor, i2->printprocessor.buffer,sizeof(printprocessor), 0, STR_TERMINATE);
127         rpcstr_pull(datatype, i2->datatype.buffer,sizeof(datatype), 0, STR_TERMINATE);
128         rpcstr_pull(parameters, i2->parameters.buffer,sizeof(parameters), 0, STR_TERMINATE);
129         
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);
149
150         if (i2->secdesc != NULL)
151         {
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);
155         }
156 }
157
158 /****************************************************************************
159 printer info level 3 display function
160 ****************************************************************************/
161 static void display_print_info_3(FILE *out_hnd, PRINTER_INFO_3 *i3)
162 {
163         if (i3 == NULL)
164                 return;
165
166         report(out_hnd, "\tflags:[%x]\n", i3->flags);
167
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);
171 }
172
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)
177 {
178         int i;
179         PRINTER_INFO_0 *in;
180
181         switch (action)
182         {
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]) );
190                         }
191                         break;
192                 case ACTION_FOOTER:
193                         report(out_hnd, "\n");
194                         break;
195         }
196 }
197
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)
202 {
203         int i;
204         PRINTER_INFO_1 *in;
205
206         switch (action)
207         {
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]) );
215                         }
216                         break;
217                 case ACTION_FOOTER:
218                         report(out_hnd, "\n");
219                         break;
220         }
221 }
222
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)
227 {
228         int i;
229         PRINTER_INFO_2 *in;
230
231         switch (action)
232         {
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]) );
240                         }
241                         break;
242                 case ACTION_FOOTER:
243                         report(out_hnd, "\n");
244                         break;
245         }
246 }
247
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)
252 {
253         int i;
254         PRINTER_INFO_3 *in;
255
256         switch (action)
257         {
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]) );
265                         }
266                         break;
267                 case ACTION_FOOTER:
268                         report(out_hnd, "\n");
269                         break;
270         }
271 }
272
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)
278 {
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;
295         }
296 }
297
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)
303 {
304         uint32  i = 0;
305         switch (action)
306         {
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;
317         }
318 }
319
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)
325 {
326         uint32  i = 0;
327         switch (action)
328         {
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;
339         }
340 }
341
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)
347 {
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;
358         }
359 }
360
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)
365 {
366         fstring buffer;
367         
368         switch (action)
369         {
370                 case ACTION_HEADER:
371                         report(out_hnd, "Port:\n");
372                         break;
373                 case ACTION_ENUMERATE:
374                         rpcstr_pull(buffer, i1->port_name.buffer, sizeof(bufferi), 0, STR_TERMINATE);
375                         fprintf (out_hnd, "\tPort Name:\t[%s]\n\n", buffer);
376                         break;
377                 case ACTION_FOOTER:
378                         report(out_hnd, "\n");
379                         break;
380         }
381 }
382
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)
387 {
388         fstring buffer;
389         
390         switch (action)
391         {
392                 case ACTION_HEADER:
393                         report(out_hnd, "Port:\n");
394                         break;
395                 case ACTION_ENUMERATE:
396                         rpcstr_pull(buffer, i2->port_name.buffer, sizeof(buffer), 0, STR_TERMINATE);
397                         fprintf (out_hnd, "\tPort Name:\t[%s]\n", buffer);
398                         rpcstr_pull(buffer, i2->monitor_name.buffer, sizeof(buffer), 0, STR_TERMINATE);
399
400                         fprintf (out_hnd, "\tMonitor Name:\t[%s]\n", buffer);
401                         rpcstr_pull(buffer, i2->description.buffer, sizeof(buffer), 0, STR_TERMINATE);
402                         fprintf (out_hnd, "\tDescription:\t[%s]\n", buffer);
403                         fprintf (out_hnd, "\tPort Type:\t[%d]\n", i2->port_type);
404                         fprintf (out_hnd, "\tReserved:\t[%d]\n", i2->reserved);
405                         fprintf (out_hnd, "\n");
406                         break;
407                 case ACTION_FOOTER:
408                         report(out_hnd, "\n");
409                         break;
410         }
411 }
412
413 /****************************************************************************
414 connection info container display function
415 ****************************************************************************/
416 void display_printer_enumdata(FILE *out_hnd, enum action_type action, uint32 idx, 
417                                 uint32 valuelen, uint16 *value, uint32 rvaluelen,
418                                 uint32 type, 
419                                 uint32 datalen, uint8 *data, uint32 rdatalen)
420 {
421         fstring buffer;
422         
423         switch (action)
424         {
425                 case ACTION_HEADER:
426                         report(out_hnd, "Printer enum data:\n");
427                         report(out_hnd, "index\tvaluelen\tvalue\t\trvaluelen");
428                         report(out_hnd, "\ttype\tdatalen\tdata\trdatalen\n");
429                         break;
430                 case ACTION_ENUMERATE:
431                         report(out_hnd, "[%d]", idx);
432                         report(out_hnd, "\t[%d]", valuelen);
433                         rpcstr_pull(buffer, value, sizeof(buffer), 0, STR_TERMINATE);
434                         report(out_hnd, "\t[%s]", buffer);
435                         report(out_hnd, "\t[%d]", rvaluelen);
436                         report(out_hnd, "\t\t[%d]", type);
437                         report(out_hnd, "\t[%d]", datalen);
438 /*                      report(out_hnd, "\t[%s]", data);*/
439                         report(out_hnd, "\t[%d]\n", rdatalen);
440                         break;
441                 case ACTION_FOOTER:
442                         report(out_hnd, "\n");
443                         break;
444         }
445 }
446
447 /****************************************************************************
448 job info level 2 display function
449 ****************************************************************************/
450 void display_job_info_2(FILE *out_hnd, enum action_type action, 
451                 JOB_INFO_2 *const i2)
452 {
453         if (i2 == NULL)
454         {
455                 return;
456         }
457
458         switch (action)
459         {
460                 case ACTION_HEADER:
461                 {
462                         report(out_hnd, "Job Info Level 2:\n");
463
464                         break;
465                 }
466                 case ACTION_ENUMERATE:
467                 {
468                         fstring tmp;
469
470                         report(out_hnd, "\tjob id:\t%d\n", i2->jobid);
471                         rpcstr_pull(tmp, i2->printername.buffer, sizeof(tmp), 0, STR_TERMINATE);
472                         report(out_hnd, "\tprinter name:\t%s\n", tmp);
473                         rpcstr_pull(tmp, i2->machinename.buffer, sizeof(tmp), 0, STR_TERMINATE);
474                         report(out_hnd, "\tmachine name:\t%s\n", tmp);
475                         rpcstr_pull(tmp, i2->username.buffer, sizeof(tmp), 0, STR_TERMINATE);
476                         report(out_hnd, "\tusername:\t%s\n", tmp);
477                         rpcstr_pull(tmp, i2->document.buffer, sizeof(tmp), 0, STR_TERMINATE);
478                         report(out_hnd, "\tdocument:\t%s\n", tmp);
479                         rpcstr_pull(tmp, i2->notifyname.buffer, sizeof(tmp), 0, STR_TERMINATE);
480                         report(out_hnd, "\tnotify name:\t%s\n", tmp);
481                         rpcstr_pull(tmp, i2->datatype.buffer, sizeof(tmp), 0, STR_TERMINATE);
482                         report(out_hnd, "\tdata type:\t%s\n", tmp);
483                         rpcstr_pull(tmp, i2->printprocessor.buffer, sizeof(tmp), 0, STR_TERMINATE);
484                         report(out_hnd, "\tprint processor:\t%s\n", tmp);
485                         rpcstr_pull(tmp, i2->parameters.buffer, sizeof(tmp), 0, STR_TERMINATE);
486                         report(out_hnd, "\tparameters:\t%s\n", tmp);
487                         rpcstr_pull(tmp, i2->drivername.buffer, sizeof(tmp), 0, STR_TERMINATE);
488                         report(out_hnd, "\tdriver name:\t%s\n", tmp);
489                         report(out_hnd, "\tDevice Mode:\tNOT DISPLAYED YET\n");
490
491                         rpcstr_pull(tmp, i2->text_status.buffer, sizeof(tmp), 0, STR_TERMINATE);
492                         report(out_hnd, "\ttext status:\t%s\n", tmp);
493                 /*      SEC_DESC sec_desc;*/
494                         report(out_hnd, "\tstatus:\t%d\n", i2->status);
495                         report(out_hnd, "\tpriority:\t%d\n", i2->priority);
496                         report(out_hnd, "\tposition:\t%d\n", i2->position);
497                         report(out_hnd, "\tstarttime:\t%d\n", i2->starttime);
498                         report(out_hnd, "\tuntiltime:\t%d\n", i2->untiltime);
499                         report(out_hnd, "\ttotalpages:\t%d\n", i2->totalpages);
500                         report(out_hnd, "\tsize:\t%d\n", i2->size);
501 /*
502                         SYSTEMTIME submitted;
503 */
504                         report(out_hnd, "\tsubmitted:\tNOT DISPLAYED YET\n");
505                         report(out_hnd, "\ttimeelapsed:\t%d\n", i2->timeelapsed);
506                         report(out_hnd, "\tpagesprinted:\t%d\n", i2->pagesprinted);
507                 }
508                 case ACTION_FOOTER:
509                 {
510                         report(out_hnd, "\n");
511                         break;
512                 }
513         }
514
515 }
516
517 /****************************************************************************
518 job info level 1 display function
519 ****************************************************************************/
520 void display_job_info_1(FILE *out_hnd, enum action_type action, 
521                 JOB_INFO_1 *const i1)
522 {
523         if (i1 == NULL)
524         {
525                 return;
526         }
527
528         switch (action)
529         {
530                 case ACTION_HEADER:
531                 {
532                         report(out_hnd, "Job Info Level 1:\n");
533
534                         break;
535                 }
536                 case ACTION_ENUMERATE:
537                 {
538                         fstring tmp;
539
540                         report(out_hnd, "\tjob id:\t%d\n", i1->jobid);
541                         rpcstr_pull(tmp, i1->printername.buffer, sizeof(tmp), 0, STR_TERMINATE);
542                         report(out_hnd, "\tprinter name:\t%s\n", tmp);
543                         rpcstr_pull(tmp, i1->machinename.buffer, sizeof(tmp), 0, STR_TERMINATE);
544                         report(out_hnd, "\tmachine name:\t%s\n", tmp);
545                         rpcstr_pull(tmp, i1->username.buffer, sizeof(tmp), 0, STR_TERMINATE);
546                         report(out_hnd, "\tusername:\t%s\n", tmp);
547                         rpcstr_pull(tmp, i1->document.buffer, sizeof(tmp), 0, STR_TERMINATE);
548                         report(out_hnd, "\tdocument:\t%s\n", tmp);
549                         rpcstr_pull(tmp, i1->datatype.buffer, sizeof(tmp), 0, STR_TERMINATE);
550                         report(out_hnd, "\tdata type:\t%s\n", tmp);
551                         rpcstr_pull(tmp, i1->text_status.buffer, sizeof(tmp), 0, STR_TERMINATE);
552                         report(out_hnd, "\ttext status:\t%s\n", tmp);
553                         report(out_hnd, "\tstatus:\t%d\n", i1->status);
554                         report(out_hnd, "\tpriority:\t%d\n", i1->priority);
555                         report(out_hnd, "\tposition:\t%d\n", i1->position);
556                         report(out_hnd, "\ttotalpages:\t%d\n", i1->totalpages);
557 /*
558                         SYSTEMTIME submitted;
559 */
560                         report(out_hnd, "\tsubmitted:\tNOT DISPLAYED YET\n");
561                         report(out_hnd, "\tpagesprinted:\t%d\n", i1->pagesprinted);
562
563                         break;
564                 }
565                 case ACTION_FOOTER:
566                 {
567                         report(out_hnd, "\n");
568                         break;
569                 }
570         }
571
572 }
573
574 /****************************************************************************
575 connection info level 2 container display function
576 ****************************************************************************/
577 void display_job_info_2_ctr(FILE *out_hnd, enum action_type action, 
578                                 uint32 count, JOB_INFO_2 *const *const ctr)
579 {
580         if (ctr == NULL)
581         {
582                 report(out_hnd, "display_job_info_2_ctr: unavailable due to an internal error\n");
583                 return;
584         }
585
586         switch (action)
587         {
588                 case ACTION_HEADER:
589                 {
590                         break;
591                 }
592                 case ACTION_ENUMERATE:
593                 {
594                         int i;
595
596                         for (i = 0; i < count; i++)
597                         {
598                                 display_job_info_2(out_hnd, ACTION_HEADER   , ctr[i]);
599                                 display_job_info_2(out_hnd, ACTION_ENUMERATE, ctr[i]);
600                                 display_job_info_2(out_hnd, ACTION_FOOTER   , ctr[i]);
601                         }
602                         break;
603                 }
604                 case ACTION_FOOTER:
605                 {
606                         break;
607                 }
608         }
609 }
610
611 /****************************************************************************
612 connection info level 1 container display function
613 ****************************************************************************/
614 void display_job_info_1_ctr(FILE *out_hnd, enum action_type action, 
615                                 uint32 count, JOB_INFO_1 *const *const ctr)
616 {
617         if (ctr == NULL)
618         {
619                 report(out_hnd, "display_job_info_1_ctr: unavailable due to an internal error\n");
620                 return;
621         }
622
623         switch (action)
624         {
625                 case ACTION_HEADER:
626                 {
627                         break;
628                 }
629                 case ACTION_ENUMERATE:
630                 {
631                         int i;
632
633                         for (i = 0; i < count; i++)
634                         {
635                                 display_job_info_1(out_hnd, ACTION_HEADER   , ctr[i]);
636                                 display_job_info_1(out_hnd, ACTION_ENUMERATE, ctr[i]);
637                                 display_job_info_1(out_hnd, ACTION_FOOTER   , ctr[i]);
638                         }
639                         break;
640                 }
641                 case ACTION_FOOTER:
642                 {
643                         break;
644                 }
645         }
646 }
647
648 /****************************************************************************
649 connection info container display function
650 ****************************************************************************/
651 void display_job_info_ctr(FILE *out_hnd, enum action_type action, 
652                                 uint32 level, uint32 count,
653                                 void *const *const ctr)
654 {
655         if (ctr == NULL)
656         {
657                 report(out_hnd, "display_job_info_ctr: unavailable due to an internal error\n");
658                 return;
659         }
660
661         switch (level)
662         {
663                 case 1:
664                 {
665                         display_job_info_1_ctr(out_hnd, action, 
666                                            count, (JOB_INFO_1*const*const)ctr);
667                         break;
668                 }
669                 case 2:
670                 {
671                         display_job_info_2_ctr(out_hnd, action, 
672                                            count, (JOB_INFO_2*const*const)ctr);
673                         break;
674                 }
675                 default:
676                 {
677                         report(out_hnd, "display_job_info_ctr: Unknown Info Level\n");
678                         break;
679                 }
680         }
681 }
682
683 /****************************************************************************
684 printer info level 0 display function
685 ****************************************************************************/
686 static void display_print_driver_1(FILE *out_hnd, DRIVER_INFO_1 *i1)
687 {
688         fstring name;
689         if (i1 == NULL)
690                 return;
691
692         rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
693
694         report(out_hnd, "\tname:[%s]\n", name);
695 }
696
697 /****************************************************************************
698 printer info level 1 display function
699 ****************************************************************************/
700 static void display_print_driver_2(FILE *out_hnd, DRIVER_INFO_2 *i1)
701 {
702         fstring name;
703         fstring architecture;
704         fstring driverpath;
705         fstring datafile;
706         fstring configfile;
707         if (i1 == NULL)
708                 return;
709
710         rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
711         rpcstr_pull(architecture, i1->architecture.buffer, sizeof(architecture), 0, STR_TERMINATE);
712         rpcstr_pull(driverpath, i1->driverpath.buffer, sizeof(driverpath), 0, STR_TERMINATE);
713         rpcstr_pull(datafile, i1->datafile.buffer, sizeof(datafile), 0, STR_TERMINATE);
714         rpcstr_pull(configfile, i1->conigfile.buffer, sizeof(configfile), 0, STR_TERMINATE);
715
716         report(out_hnd, "\tversion:[%x]\n", i1->version);
717         report(out_hnd, "\tname:[%s]\n", name);
718         report(out_hnd, "\tarchitecture:[%s]\n", architecture);
719         report(out_hnd, "\tdriverpath:[%s]\n", driverpath);
720         report(out_hnd, "\tdatafile:[%s]\n", datafile);
721         report(out_hnd, "\tconfigfile:[%s]\n", configfile);
722 }
723
724 /****************************************************************************
725 printer info level 2 display function
726 ****************************************************************************/
727 static void display_print_driver_3(FILE *out_hnd, DRIVER_INFO_3 *i1)
728 {
729         fstring name;
730         fstring architecture;
731         fstring driverpath;
732         fstring datafile;
733         fstring configfile;
734         fstring helpfile;
735         fstring dependentfiles;
736         fstring monitorname;
737         fstring defaultdatatype;
738         
739         int length=0;
740         BOOL valid = True;
741         
742         if (i1 == NULL)
743                 return;
744
745         rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
746         rpcstr_pull(architecture, i1->architecture.buffer, sizeof(architecture), 0, STR_TERMINATE);
747         rpcstr_pull(driverpath, i1->driverpath.buffer, sizeof(driverpath), 0, STR_TERMINATE);
748         rpcstr_pull(datafile, i1->datafile.buffer, sizeof(datafile), 0, STR_TERMINATE);
749         rpcstr_pull(configfile, i1->configfile.buffer, sizeof(configfile), 0, STR_TERMINATE);
750         rpcstr_pull(helpfile, i1->helpfile.buffer, sizeof(helpfile), 0, STR_TERMINATE);
751         rpcstr_pull(monitorname, i1->monitorname.buffer, sizeof(monitorname), 0, STR_TERMINATE);
752         rpcstr_pull(defaultdatatype, i1->defaultdatatype.buffer, sizeof(defaultdatatype), 0, STR_TERMINATE);
753
754         report(out_hnd, "\tversion:[%x]\n", i1->version);
755         report(out_hnd, "\tname:[%s]\n",name);
756         report(out_hnd, "\tarchitecture:[%s]\n", architecture);
757         report(out_hnd, "\tdriverpath:[%s]\n", driverpath);
758         report(out_hnd, "\tdatafile:[%s]\n", datafile);
759         report(out_hnd, "\tconfigfile:[%s]\n", configfile);
760         report(out_hnd, "\thelpfile:[%s]\n\n", helpfile);
761
762         while (valid)
763         {
764                 rpcstr_pull(dependentfiles, i1->dependentfiles+length, sizeof(dependentfiles), 0, STR_TERMINATE);
765                 length+=strlen(dependentfiles)+1;
766                 
767                 if (strlen(dependentfiles) > 0)
768                 {
769                         report(out_hnd, "\tdependentfiles:[%s]\n", dependentfiles);
770                 }
771                 else
772                 {
773                         valid = False;
774                 }
775         }
776         
777         report(out_hnd, "\n\tmonitorname:[%s]\n", monitorname);
778         report(out_hnd, "\tdefaultdatatype:[%s]\n", defaultdatatype);
779         
780 }
781
782 /****************************************************************************
783 connection info level 1 container display function
784 ****************************************************************************/
785 static void display_printer_driver_1_ctr(FILE *out_hnd, enum action_type action, uint32 count,  PRINTER_DRIVER_CTR ctr)
786 {
787         int i;
788         DRIVER_INFO_1 *in;
789
790         switch (action)
791         {
792                 case ACTION_HEADER:
793                         report(out_hnd, "Printer driver Level 1:\n");
794                         break;
795                 case ACTION_ENUMERATE:
796                         for (i = 0; i < count; i++) {
797                                 in=ctr.info1;
798                                 display_print_driver_1(out_hnd, &(in[i]) );
799                         }
800                         break;
801                 case ACTION_FOOTER:
802                         report(out_hnd, "\n");
803                         break;
804         }
805 }
806
807 /****************************************************************************
808 connection info level 2 container display function
809 ****************************************************************************/
810 static void display_printer_driver_2_ctr(FILE *out_hnd, enum action_type action, uint32 count,  PRINTER_DRIVER_CTR ctr)
811 {
812         int i;
813         DRIVER_INFO_2 *in;
814
815         switch (action)
816         {
817                 case ACTION_HEADER:
818                         report(out_hnd, "Printer driver Level 2:\n");
819                         break;
820                 case ACTION_ENUMERATE:
821                         for (i = 0; i < count; i++) {
822                                 in=ctr.info2;
823                                 display_print_driver_2(out_hnd, &(in[i]) );
824                         }
825                         break;
826                 case ACTION_FOOTER:
827                         report(out_hnd, "\n");
828                         break;
829         }
830 }
831
832 /****************************************************************************
833 connection info level 3 container display function
834 ****************************************************************************/
835 static void display_printer_driver_3_ctr(FILE *out_hnd, enum action_type action, uint32 count,  PRINTER_DRIVER_CTR ctr)
836 {
837         int i;
838         DRIVER_INFO_3 *in;
839
840         switch (action)
841         {
842                 case ACTION_HEADER:
843                         report(out_hnd, "Printer driver Level 3:\n");
844                         break;
845                 case ACTION_ENUMERATE:
846                         for (i = 0; i < count; i++) {
847                                 in=ctr.info3;
848                                 display_print_driver_3(out_hnd, &(in[i]) );
849                         }
850                         break;
851                 case ACTION_FOOTER:
852                         report(out_hnd, "\n");
853                         break;
854         }
855 }
856
857 /****************************************************************************
858 connection info container display function
859 ****************************************************************************/
860 void display_printer_driver_ctr(FILE *out_hnd, enum action_type action, uint32 level,
861                                 uint32 count, PRINTER_DRIVER_CTR ctr)
862 {
863         switch (level) {
864                 case 1:
865                         display_printer_driver_1_ctr(out_hnd, action, count, ctr);
866                         break;
867                 case 2:
868                         display_printer_driver_2_ctr(out_hnd, action, count, ctr);
869                         break;
870                 case 3:
871                         display_printer_driver_3_ctr(out_hnd, action, count, ctr);
872                         break;
873                 default:
874                         report(out_hnd, "display_printer_driver_ctr: Unknown Info Level\n");
875                         break;
876         }
877 }
878
879
880 /****************************************************************************
881 printer info level 1 display function
882 ****************************************************************************/
883 static void display_printdriverdir_info_1(FILE *out_hnd, DRIVER_DIRECTORY_1 *i1)
884 {
885         fstring name;
886         if (i1 == NULL)
887                 return;
888
889         rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE);
890
891         report(out_hnd, "\tname:[%s]\n", name);
892 }
893
894 /****************************************************************************
895 connection info level 1 container display function
896 ****************************************************************************/
897 static void display_printerdriverdir_info_1_ctr(FILE *out_hnd, enum action_type action, DRIVER_DIRECTORY_CTR ctr)
898 {
899
900         switch (action)
901         {
902                 case ACTION_HEADER:
903                         report(out_hnd, "Printer driver dir Info Level 1:\n");
904                         break;
905                 case ACTION_ENUMERATE:
906                                 display_printdriverdir_info_1(out_hnd, &(ctr.driver.info_1) );
907                         break;
908                 case ACTION_FOOTER:
909                         report(out_hnd, "\n");
910                         break;
911         }
912 }
913
914 /****************************************************************************
915 connection info container display function
916 ****************************************************************************/
917 void display_printerdriverdir_info_ctr(FILE *out_hnd, enum action_type action, uint32 level,
918                                 DRIVER_DIRECTORY_CTR ctr)
919 {
920         switch (level) {
921                 case 1:
922                         display_printerdriverdir_info_1_ctr(out_hnd, action, ctr);
923                         break;
924                 default:
925                         report(out_hnd, "display_printerdriverdir_info_ctr: Unknown Info Level\n");
926                         break;
927         }
928 }