s3-spoolss: use pidl for _spoolss_GetJob.
[gd/samba-autobuild/.git] / source3 / rpc_server / srv_spoolss.c
1 /* 
2  *  Unix SMB/CIFS implementation.
3  *  RPC Pipe client / server routines
4  *  Copyright (C) Andrew Tridgell              1992-2000,
5  *  Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
6  *  Copyright (C) Jean François Micouleau      1998-2000,
7  *  Copyright (C) Jeremy Allison                    2001,
8  *  Copyright (C) Gerald Carter                2001-2002,
9  *  Copyright (C) Jim McDonough <jmcd@us.ibm.com>   2003.
10  *  
11  *  This program is free software; you can redistribute it and/or modify
12  *  it under the terms of the GNU General Public License as published by
13  *  the Free Software Foundation; either version 3 of the License, or
14  *  (at your option) any later version.
15  *  
16  *  This program is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *  
21  *  You should have received a copy of the GNU General Public License
22  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
23  */
24
25 #include "includes.h"
26
27 #undef DBGC_CLASS
28 #define DBGC_CLASS DBGC_RPC_SRV
29
30 /*******************************************************************
31  ********************************************************************/
32
33 static bool proxy_spoolss_call(pipes_struct *p, uint8_t opnum)
34 {
35         struct api_struct *fns;
36         int n_fns;
37
38         spoolss_get_pipe_fns(&fns, &n_fns);
39
40         if (opnum >= n_fns) {
41                 return false;
42         }
43
44         if (fns[opnum].opnum != opnum) {
45                 smb_panic("SPOOLSS function table not sorted");
46         }
47
48         return fns[opnum].fn(p);
49 }
50
51 /********************************************************************
52  * api_spoolss_open_printer_ex (rarely seen - older call)
53  ********************************************************************/
54
55 static bool api_spoolss_open_printer(pipes_struct *p)
56 {
57         return proxy_spoolss_call(p, NDR_SPOOLSS_OPENPRINTER);
58 }
59
60 /********************************************************************
61  * api_spoolss_open_printer_ex
62  ********************************************************************/
63
64 static bool api_spoolss_open_printer_ex(pipes_struct *p)
65 {
66         return proxy_spoolss_call(p, NDR_SPOOLSS_OPENPRINTEREX);
67 }
68
69 /********************************************************************
70  * api_spoolss_getprinterdata
71  *
72  * called from the spoolss dispatcher
73  ********************************************************************/
74
75 static bool api_spoolss_getprinterdata(pipes_struct *p)
76 {
77         SPOOL_Q_GETPRINTERDATA q_u;
78         SPOOL_R_GETPRINTERDATA r_u;
79         prs_struct *data = &p->in_data.data;
80         prs_struct *rdata = &p->out_data.rdata;
81
82         ZERO_STRUCT(q_u);
83         ZERO_STRUCT(r_u);
84
85         /* read the stream and fill the struct */
86         if (!spoolss_io_q_getprinterdata("", &q_u, data, 0)) {
87                 DEBUG(0,("spoolss_io_q_getprinterdata: unable to unmarshall SPOOL_Q_GETPRINTERDATA.\n"));
88                 return False;
89         }
90         
91         r_u.status = _spoolss_getprinterdata( p, &q_u, &r_u);
92
93         if (!spoolss_io_r_getprinterdata("", &r_u, rdata, 0)) {
94                 DEBUG(0,("spoolss_io_r_getprinterdata: unable to marshall SPOOL_R_GETPRINTERDATA.\n"));
95                 return False;
96         }
97
98         return True;
99 }
100
101 /********************************************************************
102  * api_spoolss_deleteprinterdata
103  *
104  * called from the spoolss dispatcher
105  ********************************************************************/
106
107 static bool api_spoolss_deleteprinterdata(pipes_struct *p)
108 {
109         return proxy_spoolss_call(p, NDR_SPOOLSS_DELETEPRINTERDATA);
110 }
111
112 /********************************************************************
113  * api_spoolss_closeprinter
114  *
115  * called from the spoolss dispatcher
116  ********************************************************************/
117
118 static bool api_spoolss_closeprinter(pipes_struct *p)
119 {
120         return proxy_spoolss_call(p, NDR_SPOOLSS_CLOSEPRINTER);
121 }
122
123 /********************************************************************
124  * api_spoolss_abortprinter
125  *
126  * called from the spoolss dispatcher
127  ********************************************************************/
128
129 static bool api_spoolss_abortprinter(pipes_struct *p)
130 {
131         return proxy_spoolss_call(p, NDR_SPOOLSS_ABORTPRINTER);
132 }
133
134 /********************************************************************
135  * api_spoolss_deleteprinter
136  *
137  * called from the spoolss dispatcher
138  ********************************************************************/
139
140 static bool api_spoolss_deleteprinter(pipes_struct *p)
141 {
142         return proxy_spoolss_call(p, NDR_SPOOLSS_DELETEPRINTER);
143 }
144
145 /********************************************************************
146  * api_spoolss_deleteprinterdriver
147  *
148  * called from the spoolss dispatcher
149  ********************************************************************/
150
151 static bool api_spoolss_deleteprinterdriver(pipes_struct *p)
152 {
153         return proxy_spoolss_call(p, NDR_SPOOLSS_DELETEPRINTERDRIVER);
154 }
155
156
157 /********************************************************************
158  * api_spoolss_rffpcnex
159  * ReplyFindFirstPrinterChangeNotifyEx
160  ********************************************************************/
161
162 static bool api_spoolss_rffpcnex(pipes_struct *p)
163 {
164         return proxy_spoolss_call(p, NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX);
165 }
166
167
168 /********************************************************************
169  * api_spoolss_rfnpcnex
170  * ReplyFindNextPrinterChangeNotifyEx
171  * called from the spoolss dispatcher
172
173  * Note - this is the *ONLY* function that breaks the RPC call
174  * symmetry in all the other calls. We need to do this to fix
175  * the massive memory allocation problem with thousands of jobs...
176  * JRA.
177  ********************************************************************/
178
179 static bool api_spoolss_rfnpcnex(pipes_struct *p)
180 {
181         return proxy_spoolss_call(p, NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY);
182 }
183
184
185 /********************************************************************
186  * api_spoolss_enumprinters
187  * called from the spoolss dispatcher
188  *
189  ********************************************************************/
190
191 static bool api_spoolss_enumprinters(pipes_struct *p)
192 {
193         SPOOL_Q_ENUMPRINTERS q_u;
194         SPOOL_R_ENUMPRINTERS r_u;
195         prs_struct *data = &p->in_data.data;
196         prs_struct *rdata = &p->out_data.rdata;
197
198         ZERO_STRUCT(q_u);
199         ZERO_STRUCT(r_u);
200
201         if (!spoolss_io_q_enumprinters("", &q_u, data, 0)) {
202                 DEBUG(0,("spoolss_io_q_enumprinters: unable to unmarshall SPOOL_Q_ENUMPRINTERS.\n"));
203                 return False;
204         }
205
206         r_u.status = _spoolss_enumprinters( p, &q_u, &r_u);
207
208         if (!spoolss_io_r_enumprinters("", &r_u, rdata, 0)) {
209                 DEBUG(0,("spoolss_io_r_enumprinters: unable to marshall SPOOL_R_ENUMPRINTERS.\n"));
210                 return False;
211         }
212
213         return True;
214 }
215
216 /********************************************************************
217  * api_spoolss_getprinter
218  * called from the spoolss dispatcher
219  *
220  ********************************************************************/
221
222 static bool api_spoolss_getprinter(pipes_struct *p)
223 {
224         SPOOL_Q_GETPRINTER q_u;
225         SPOOL_R_GETPRINTER r_u;
226         prs_struct *data = &p->in_data.data;
227         prs_struct *rdata = &p->out_data.rdata;
228
229         ZERO_STRUCT(q_u);
230         ZERO_STRUCT(r_u);
231
232         if(!spoolss_io_q_getprinter("", &q_u, data, 0)) {
233                 DEBUG(0,("spoolss_io_q_getprinter: unable to unmarshall SPOOL_Q_GETPRINTER.\n"));
234                 return False;
235         }
236
237         r_u.status = _spoolss_getprinter(p, &q_u, &r_u);
238
239         if(!spoolss_io_r_getprinter("",&r_u,rdata,0)) {
240                 DEBUG(0,("spoolss_io_r_getprinter: unable to marshall SPOOL_R_GETPRINTER.\n"));
241                 return False;
242         }
243
244         return True;
245 }
246
247 /********************************************************************
248  * api_spoolss_getprinter
249  * called from the spoolss dispatcher
250  *
251  ********************************************************************/
252
253 static bool api_spoolss_getprinterdriver2(pipes_struct *p)
254 {
255         SPOOL_Q_GETPRINTERDRIVER2 q_u;
256         SPOOL_R_GETPRINTERDRIVER2 r_u;
257         prs_struct *data = &p->in_data.data;
258         prs_struct *rdata = &p->out_data.rdata;
259
260         ZERO_STRUCT(q_u);
261         ZERO_STRUCT(r_u);
262
263         if(!spoolss_io_q_getprinterdriver2("", &q_u, data, 0)) {
264                 DEBUG(0,("spoolss_io_q_getprinterdriver2: unable to unmarshall SPOOL_Q_GETPRINTERDRIVER2.\n"));
265                 return False;
266         }
267
268         r_u.status = _spoolss_getprinterdriver2(p, &q_u, &r_u);
269         
270         if(!spoolss_io_r_getprinterdriver2("",&r_u,rdata,0)) {
271                 DEBUG(0,("spoolss_io_r_getprinterdriver2: unable to marshall SPOOL_R_GETPRINTERDRIVER2.\n"));
272                 return False;
273         }
274         
275         return True;
276 }
277
278 /********************************************************************
279  * api_spoolss_getprinter
280  * called from the spoolss dispatcher
281  *
282  ********************************************************************/
283
284 static bool api_spoolss_startpageprinter(pipes_struct *p)
285 {
286         return proxy_spoolss_call(p, NDR_SPOOLSS_STARTPAGEPRINTER);
287 }
288
289 /********************************************************************
290  * api_spoolss_getprinter
291  * called from the spoolss dispatcher
292  *
293  ********************************************************************/
294
295 static bool api_spoolss_endpageprinter(pipes_struct *p)
296 {
297         return proxy_spoolss_call(p, NDR_SPOOLSS_ENDPAGEPRINTER);
298 }
299
300 /********************************************************************
301 ********************************************************************/
302
303 static bool api_spoolss_startdocprinter(pipes_struct *p)
304 {
305         return proxy_spoolss_call(p, NDR_SPOOLSS_STARTDOCPRINTER);
306 }
307
308 /********************************************************************
309 ********************************************************************/
310
311 static bool api_spoolss_enddocprinter(pipes_struct *p)
312 {
313         return proxy_spoolss_call(p, NDR_SPOOLSS_ENDDOCPRINTER);
314 }
315
316 /********************************************************************
317 ********************************************************************/
318
319 static bool api_spoolss_writeprinter(pipes_struct *p)
320 {
321         return proxy_spoolss_call(p, NDR_SPOOLSS_WRITEPRINTER);
322 }
323
324 /****************************************************************************
325
326 ****************************************************************************/
327
328 static bool api_spoolss_setprinter(pipes_struct *p)
329 {
330         return proxy_spoolss_call(p, NDR_SPOOLSS_SETPRINTER);
331 }
332
333 /****************************************************************************
334 ****************************************************************************/
335
336 static bool api_spoolss_fcpn(pipes_struct *p)
337 {
338         return proxy_spoolss_call(p, NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY);
339 }
340
341 /****************************************************************************
342 ****************************************************************************/
343
344 static bool api_spoolss_addjob(pipes_struct *p)
345 {
346         return proxy_spoolss_call(p, NDR_SPOOLSS_ADDJOB);
347 }
348
349 /****************************************************************************
350 ****************************************************************************/
351
352 static bool api_spoolss_enumjobs(pipes_struct *p)
353 {
354         return proxy_spoolss_call(p, NDR_SPOOLSS_ENUMJOBS);
355 }
356
357 /****************************************************************************
358 ****************************************************************************/
359
360 static bool api_spoolss_schedulejob(pipes_struct *p)
361 {
362         return proxy_spoolss_call(p, NDR_SPOOLSS_SCHEDULEJOB);
363 }
364
365 /****************************************************************************
366 ****************************************************************************/
367
368 static bool api_spoolss_setjob(pipes_struct *p)
369 {
370         return proxy_spoolss_call(p, NDR_SPOOLSS_SETJOB);
371 }
372
373 /****************************************************************************
374 ****************************************************************************/
375
376 static bool api_spoolss_enumprinterdrivers(pipes_struct *p)
377 {
378         SPOOL_Q_ENUMPRINTERDRIVERS q_u;
379         SPOOL_R_ENUMPRINTERDRIVERS r_u;
380         prs_struct *data = &p->in_data.data;
381         prs_struct *rdata = &p->out_data.rdata;
382
383         ZERO_STRUCT(q_u);
384         ZERO_STRUCT(r_u);
385
386         if (!spoolss_io_q_enumprinterdrivers("", &q_u, data, 0)) {
387                 DEBUG(0,("spoolss_io_q_enumprinterdrivers: unable to unmarshall SPOOL_Q_ENUMPRINTERDRIVERS.\n"));
388                 return False;
389         }
390
391         r_u.status = _spoolss_enumprinterdrivers(p, &q_u, &r_u);
392
393         if (!spoolss_io_r_enumprinterdrivers("",&r_u,rdata,0)) {
394                 DEBUG(0,("spoolss_io_r_enumprinterdrivers: unable to marshall SPOOL_R_ENUMPRINTERDRIVERS.\n"));
395                 return False;
396         }
397
398         return True;
399 }
400
401 /****************************************************************************
402 ****************************************************************************/
403
404 static bool api_spoolss_getform(pipes_struct *p)
405 {
406         return proxy_spoolss_call(p, NDR_SPOOLSS_GETFORM);
407 }
408
409 /****************************************************************************
410 ****************************************************************************/
411
412 static bool api_spoolss_enumforms(pipes_struct *p)
413 {
414         return proxy_spoolss_call(p, NDR_SPOOLSS_ENUMFORMS);
415 }
416
417 /****************************************************************************
418 ****************************************************************************/
419
420 static bool api_spoolss_enumports(pipes_struct *p)
421 {
422         return proxy_spoolss_call(p, NDR_SPOOLSS_ENUMPORTS);
423 }
424
425 /****************************************************************************
426 ****************************************************************************/
427
428 static bool api_spoolss_addprinterex(pipes_struct *p)
429 {
430         return proxy_spoolss_call(p, NDR_SPOOLSS_ADDPRINTEREX);
431 }
432
433 /****************************************************************************
434 ****************************************************************************/
435
436 static bool api_spoolss_addprinterdriver(pipes_struct *p)
437 {
438         return proxy_spoolss_call(p, NDR_SPOOLSS_ADDPRINTERDRIVER);
439 }
440
441 /****************************************************************************
442 ****************************************************************************/
443
444 static bool api_spoolss_getprinterdriverdirectory(pipes_struct *p)
445 {
446         return proxy_spoolss_call(p, NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY);
447 }
448
449 /****************************************************************************
450 ****************************************************************************/
451
452 static bool api_spoolss_enumprinterdata(pipes_struct *p)
453 {
454         SPOOL_Q_ENUMPRINTERDATA q_u;
455         SPOOL_R_ENUMPRINTERDATA r_u;
456         prs_struct *data = &p->in_data.data;
457         prs_struct *rdata = &p->out_data.rdata;
458         
459         ZERO_STRUCT(q_u);
460         ZERO_STRUCT(r_u);
461         
462         if(!spoolss_io_q_enumprinterdata("", &q_u, data, 0)) {
463                 DEBUG(0,("spoolss_io_q_enumprinterdata: unable to unmarshall SPOOL_Q_ENUMPRINTERDATA.\n"));
464                 return False;
465         }
466         
467         r_u.status = _spoolss_enumprinterdata(p, &q_u, &r_u);
468                                 
469         if(!spoolss_io_r_enumprinterdata("", &r_u, rdata, 0)) {
470                 DEBUG(0,("spoolss_io_r_enumprinterdata: unable to marshall SPOOL_R_ENUMPRINTERDATA.\n"));
471                 return False;
472         }
473
474         return True;
475 }
476
477 /****************************************************************************
478 ****************************************************************************/
479
480 static bool api_spoolss_setprinterdata(pipes_struct *p)
481 {
482         SPOOL_Q_SETPRINTERDATA q_u;
483         SPOOL_R_SETPRINTERDATA r_u;
484         prs_struct *data = &p->in_data.data;
485         prs_struct *rdata = &p->out_data.rdata;
486         
487         ZERO_STRUCT(q_u);
488         ZERO_STRUCT(r_u);
489         
490         if(!spoolss_io_q_setprinterdata("", &q_u, data, 0)) {
491                 DEBUG(0,("spoolss_io_q_setprinterdata: unable to unmarshall SPOOL_Q_SETPRINTERDATA.\n"));
492                 return False;
493         }
494         
495         r_u.status = _spoolss_setprinterdata(p, &q_u, &r_u);
496                                 
497         if(!spoolss_io_r_setprinterdata("", &r_u, rdata, 0)) {
498                 DEBUG(0,("spoolss_io_r_setprinterdata: unable to marshall SPOOL_R_SETPRINTERDATA.\n"));
499                 return False;
500         }
501
502         return True;
503 }
504
505 /****************************************************************************
506 ****************************************************************************/
507 static bool api_spoolss_reset_printer(pipes_struct *p)
508 {
509         return proxy_spoolss_call(p, NDR_SPOOLSS_RESETPRINTER);
510 }
511
512 /****************************************************************************
513 ****************************************************************************/
514 static bool api_spoolss_addform(pipes_struct *p)
515 {
516         return proxy_spoolss_call(p, NDR_SPOOLSS_ADDFORM);
517 }
518
519 /****************************************************************************
520 ****************************************************************************/
521
522 static bool api_spoolss_deleteform(pipes_struct *p)
523 {
524         return proxy_spoolss_call(p, NDR_SPOOLSS_DELETEFORM);
525 }
526
527 /****************************************************************************
528 ****************************************************************************/
529
530 static bool api_spoolss_setform(pipes_struct *p)
531 {
532         return proxy_spoolss_call(p, NDR_SPOOLSS_SETFORM);
533 }
534
535 /****************************************************************************
536 ****************************************************************************/
537
538 static bool api_spoolss_enumprintprocessors(pipes_struct *p)
539 {
540         return proxy_spoolss_call(p, NDR_SPOOLSS_ENUMPRINTPROCESSORS);
541 }
542
543 /****************************************************************************
544 ****************************************************************************/
545
546 static bool api_spoolss_addprintprocessor(pipes_struct *p)
547 {
548         return proxy_spoolss_call(p, NDR_SPOOLSS_ADDPRINTPROCESSOR);
549 }
550
551 /****************************************************************************
552 ****************************************************************************/
553
554 static bool api_spoolss_enumprintprocdatatypes(pipes_struct *p)
555 {
556         return proxy_spoolss_call(p, NDR_SPOOLSS_ENUMPRINTPROCDATATYPES);
557 }
558
559 /****************************************************************************
560 ****************************************************************************/
561
562 static bool api_spoolss_enumprintmonitors(pipes_struct *p)
563 {
564         return proxy_spoolss_call(p, NDR_SPOOLSS_ENUMMONITORS);
565 }
566
567 /****************************************************************************
568 ****************************************************************************/
569
570 static bool api_spoolss_getjob(pipes_struct *p)
571 {
572         return proxy_spoolss_call(p, NDR_SPOOLSS_GETJOB);
573 }
574
575 /********************************************************************
576  * api_spoolss_getprinterdataex
577  *
578  * called from the spoolss dispatcher
579  ********************************************************************/
580
581 static bool api_spoolss_getprinterdataex(pipes_struct *p)
582 {
583         return proxy_spoolss_call(p, NDR_SPOOLSS_GETPRINTERDATAEX);
584 }
585
586 /****************************************************************************
587 ****************************************************************************/
588
589 static bool api_spoolss_setprinterdataex(pipes_struct *p)
590 {
591         return proxy_spoolss_call(p, NDR_SPOOLSS_SETPRINTERDATAEX);
592 }
593
594
595 /****************************************************************************
596 ****************************************************************************/
597
598 static bool api_spoolss_enumprinterkey(pipes_struct *p)
599 {
600         SPOOL_Q_ENUMPRINTERKEY q_u;
601         SPOOL_R_ENUMPRINTERKEY r_u;
602         prs_struct *data = &p->in_data.data;
603         prs_struct *rdata = &p->out_data.rdata;
604         
605         ZERO_STRUCT(q_u);
606         ZERO_STRUCT(r_u);
607         
608         if(!spoolss_io_q_enumprinterkey("", &q_u, data, 0)) {
609                 DEBUG(0,("spoolss_io_q_setprinterkey: unable to unmarshall SPOOL_Q_ENUMPRINTERKEY.\n"));
610                 return False;
611         }
612         
613         r_u.status = _spoolss_enumprinterkey(p, &q_u, &r_u);
614                                 
615         if(!spoolss_io_r_enumprinterkey("", &r_u, rdata, 0)) {
616                 DEBUG(0,("spoolss_io_r_enumprinterkey: unable to marshall SPOOL_R_ENUMPRINTERKEY.\n"));
617                 return False;
618         }
619
620         return True;
621 }
622
623 /****************************************************************************
624 ****************************************************************************/
625
626 static bool api_spoolss_enumprinterdataex(pipes_struct *p)
627 {
628         SPOOL_Q_ENUMPRINTERDATAEX q_u;
629         SPOOL_R_ENUMPRINTERDATAEX r_u;
630         prs_struct *data = &p->in_data.data;
631         prs_struct *rdata = &p->out_data.rdata;
632         
633         ZERO_STRUCT(q_u);
634         ZERO_STRUCT(r_u);
635         
636         if(!spoolss_io_q_enumprinterdataex("", &q_u, data, 0)) {
637                 DEBUG(0,("spoolss_io_q_enumprinterdataex: unable to unmarshall SPOOL_Q_ENUMPRINTERDATAEX.\n"));
638                 return False;
639         }
640         
641         r_u.status = _spoolss_enumprinterdataex(p, &q_u, &r_u);
642                                 
643         if(!spoolss_io_r_enumprinterdataex("", &r_u, rdata, 0)) {
644                 DEBUG(0,("spoolss_io_r_enumprinterdataex: unable to marshall SPOOL_R_ENUMPRINTERDATAEX.\n"));
645                 return False;
646         }
647
648         return True;
649 }
650
651 /****************************************************************************
652 ****************************************************************************/
653
654 static bool api_spoolss_getprintprocessordirectory(pipes_struct *p)
655 {
656         return proxy_spoolss_call(p, NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY);
657 }
658
659 /****************************************************************************
660 ****************************************************************************/
661
662 static bool api_spoolss_deleteprinterdataex(pipes_struct *p)
663 {
664         return proxy_spoolss_call(p, NDR_SPOOLSS_DELETEPRINTERDATAEX);
665 }
666
667 /****************************************************************************
668 ****************************************************************************/
669
670 static bool api_spoolss_deleteprinterkey(pipes_struct *p)
671 {
672         return proxy_spoolss_call(p, NDR_SPOOLSS_DELETEPRINTERKEY);
673 }
674
675 /****************************************************************************
676 ****************************************************************************/
677
678 static bool api_spoolss_addprinterdriverex(pipes_struct *p)
679 {
680         return proxy_spoolss_call(p, NDR_SPOOLSS_ADDPRINTERDRIVEREX);
681 }
682
683 /****************************************************************************
684 ****************************************************************************/
685
686 static bool api_spoolss_deleteprinterdriverex(pipes_struct *p)
687 {
688         return proxy_spoolss_call(p, NDR_SPOOLSS_DELETEPRINTERDRIVEREX);
689 }
690
691 /****************************************************************************
692 ****************************************************************************/
693
694 static bool api_spoolss_xcvdataport(pipes_struct *p)
695 {
696         return proxy_spoolss_call(p, NDR_SPOOLSS_XCVDATA);
697 }
698
699 /*******************************************************************
700 \pipe\spoolss commands
701 ********************************************************************/
702
703   struct api_struct api_spoolss_cmds[] = 
704     {
705  {"SPOOLSS_OPENPRINTER",               SPOOLSS_OPENPRINTER,               api_spoolss_open_printer              },
706  {"SPOOLSS_OPENPRINTEREX",             SPOOLSS_OPENPRINTEREX,             api_spoolss_open_printer_ex           },
707  {"SPOOLSS_GETPRINTERDATA",            SPOOLSS_GETPRINTERDATA,            api_spoolss_getprinterdata            },
708  {"SPOOLSS_CLOSEPRINTER",              SPOOLSS_CLOSEPRINTER,              api_spoolss_closeprinter              },
709  {"SPOOLSS_DELETEPRINTER",             SPOOLSS_DELETEPRINTER,             api_spoolss_deleteprinter             },
710  {"SPOOLSS_ABORTPRINTER",              SPOOLSS_ABORTPRINTER,              api_spoolss_abortprinter              },
711  {"SPOOLSS_RFFPCNEX",                  SPOOLSS_RFFPCNEX,                  api_spoolss_rffpcnex                  },
712  {"SPOOLSS_RFNPCNEX",                  SPOOLSS_RFNPCNEX,                  api_spoolss_rfnpcnex                  },
713  {"SPOOLSS_ENUMPRINTERS",              SPOOLSS_ENUMPRINTERS,              api_spoolss_enumprinters              },
714  {"SPOOLSS_GETPRINTER",                SPOOLSS_GETPRINTER,                api_spoolss_getprinter                },
715  {"SPOOLSS_GETPRINTERDRIVER2",         SPOOLSS_GETPRINTERDRIVER2,         api_spoolss_getprinterdriver2         }, 
716  {"SPOOLSS_STARTPAGEPRINTER",          SPOOLSS_STARTPAGEPRINTER,          api_spoolss_startpageprinter          },
717  {"SPOOLSS_ENDPAGEPRINTER",            SPOOLSS_ENDPAGEPRINTER,            api_spoolss_endpageprinter            }, 
718  {"SPOOLSS_STARTDOCPRINTER",           SPOOLSS_STARTDOCPRINTER,           api_spoolss_startdocprinter           },
719  {"SPOOLSS_ENDDOCPRINTER",             SPOOLSS_ENDDOCPRINTER,             api_spoolss_enddocprinter             },
720  {"SPOOLSS_WRITEPRINTER",              SPOOLSS_WRITEPRINTER,              api_spoolss_writeprinter              },
721  {"SPOOLSS_SETPRINTER",                SPOOLSS_SETPRINTER,                api_spoolss_setprinter                },
722  {"SPOOLSS_FCPN",                      SPOOLSS_FCPN,                      api_spoolss_fcpn                      },
723  {"SPOOLSS_ADDJOB",                    SPOOLSS_ADDJOB,                    api_spoolss_addjob                    },
724  {"SPOOLSS_ENUMJOBS",                  SPOOLSS_ENUMJOBS,                  api_spoolss_enumjobs                  },
725  {"SPOOLSS_SCHEDULEJOB",               SPOOLSS_SCHEDULEJOB,               api_spoolss_schedulejob               },
726  {"SPOOLSS_SETJOB",                    SPOOLSS_SETJOB,                    api_spoolss_setjob                    },
727  {"SPOOLSS_ENUMFORMS",                 SPOOLSS_ENUMFORMS,                 api_spoolss_enumforms                 },
728  {"SPOOLSS_ENUMPORTS",                 SPOOLSS_ENUMPORTS,                 api_spoolss_enumports                 },
729  {"SPOOLSS_ENUMPRINTERDRIVERS",        SPOOLSS_ENUMPRINTERDRIVERS,        api_spoolss_enumprinterdrivers        },
730  {"SPOOLSS_ADDPRINTEREX",              SPOOLSS_ADDPRINTEREX,              api_spoolss_addprinterex              },
731  {"SPOOLSS_ADDPRINTERDRIVER",          SPOOLSS_ADDPRINTERDRIVER,          api_spoolss_addprinterdriver          },
732  {"SPOOLSS_DELETEPRINTERDRIVER",       SPOOLSS_DELETEPRINTERDRIVER,       api_spoolss_deleteprinterdriver       },
733  {"SPOOLSS_GETPRINTERDRIVERDIRECTORY", SPOOLSS_GETPRINTERDRIVERDIRECTORY, api_spoolss_getprinterdriverdirectory },
734  {"SPOOLSS_ENUMPRINTERDATA",           SPOOLSS_ENUMPRINTERDATA,           api_spoolss_enumprinterdata           },
735  {"SPOOLSS_SETPRINTERDATA",            SPOOLSS_SETPRINTERDATA,            api_spoolss_setprinterdata            },
736  {"SPOOLSS_RESETPRINTER",              SPOOLSS_RESETPRINTER,              api_spoolss_reset_printer             },
737  {"SPOOLSS_DELETEPRINTERDATA",         SPOOLSS_DELETEPRINTERDATA,         api_spoolss_deleteprinterdata         },
738  {"SPOOLSS_ADDFORM",                   SPOOLSS_ADDFORM,                   api_spoolss_addform                   },
739  {"SPOOLSS_DELETEFORM",                SPOOLSS_DELETEFORM,                api_spoolss_deleteform                },
740  {"SPOOLSS_GETFORM",                   SPOOLSS_GETFORM,                   api_spoolss_getform                   },
741  {"SPOOLSS_SETFORM",                   SPOOLSS_SETFORM,                   api_spoolss_setform                   },
742  {"SPOOLSS_ADDPRINTPROCESSOR",         SPOOLSS_ADDPRINTPROCESSOR,         api_spoolss_addprintprocessor         },
743  {"SPOOLSS_ENUMPRINTPROCESSORS",       SPOOLSS_ENUMPRINTPROCESSORS,       api_spoolss_enumprintprocessors       },
744  {"SPOOLSS_ENUMMONITORS",              SPOOLSS_ENUMMONITORS,              api_spoolss_enumprintmonitors         },
745  {"SPOOLSS_GETJOB",                    SPOOLSS_GETJOB,                    api_spoolss_getjob                    },
746  {"SPOOLSS_ENUMPRINTPROCDATATYPES",    SPOOLSS_ENUMPRINTPROCDATATYPES,    api_spoolss_enumprintprocdatatypes    },
747  {"SPOOLSS_GETPRINTERDATAEX",          SPOOLSS_GETPRINTERDATAEX,          api_spoolss_getprinterdataex          },
748  {"SPOOLSS_SETPRINTERDATAEX",          SPOOLSS_SETPRINTERDATAEX,          api_spoolss_setprinterdataex          },
749  {"SPOOLSS_DELETEPRINTERDATAEX",       SPOOLSS_DELETEPRINTERDATAEX,       api_spoolss_deleteprinterdataex       },
750  {"SPOOLSS_ENUMPRINTERDATAEX",         SPOOLSS_ENUMPRINTERDATAEX,         api_spoolss_enumprinterdataex         },
751  {"SPOOLSS_ENUMPRINTERKEY",            SPOOLSS_ENUMPRINTERKEY,            api_spoolss_enumprinterkey            },
752  {"SPOOLSS_DELETEPRINTERKEY",          SPOOLSS_DELETEPRINTERKEY,          api_spoolss_deleteprinterkey          },
753  {"SPOOLSS_GETPRINTPROCESSORDIRECTORY",SPOOLSS_GETPRINTPROCESSORDIRECTORY,api_spoolss_getprintprocessordirectory},
754  {"SPOOLSS_ADDPRINTERDRIVEREX",        SPOOLSS_ADDPRINTERDRIVEREX,        api_spoolss_addprinterdriverex        },
755  {"SPOOLSS_DELETEPRINTERDRIVEREX",     SPOOLSS_DELETEPRINTERDRIVEREX,     api_spoolss_deleteprinterdriverex     },
756  {"SPOOLSS_XCVDATAPORT",               SPOOLSS_XCVDATAPORT,               api_spoolss_xcvdataport               },
757 };
758
759 void spoolss2_get_pipe_fns( struct api_struct **fns, int *n_fns )
760 {
761         *fns = api_spoolss_cmds;
762         *n_fns = sizeof(api_spoolss_cmds) / sizeof(struct api_struct);
763 }
764
765 NTSTATUS rpc_spoolss2_init(void)
766 {
767         return rpc_srv_register(
768                 SMB_RPC_INTERFACE_VERSION, "spoolss", "spoolss",
769                 &ndr_table_spoolss,
770                 api_spoolss_cmds,
771                 sizeof(api_spoolss_cmds) / sizeof(struct api_struct));
772 }