s3-spoolss: remove old spoolss_ReplyOpenPrinter.
[tprouty/samba.git] / source3 / rpc_client / cli_spoolss_notify.c
1 /* 
2    Unix SMB/CIFS implementation.
3    RPC pipe client
4
5    Copyright (C) Gerald Carter                2001-2002,
6    Copyright (C) Tim Potter                   2000-2002,
7    Copyright (C) Andrew Tridgell              1994-2000,
8    Copyright (C) Jean-Francois Micouleau      1999-2000.
9    Copyright (C) Jeremy Allison                    2005.
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 /*
28  * SPOOLSS Client RPC's used by servers as the notification
29  * back channel.
30  */
31
32 /*********************************************************************
33  This SPOOLSS_REPLY_RRPCN function is used to send a change 
34  notification event when the registration **did** use 
35  SPOOL_NOTIFY_OPTION_TYPE structure to specify the events to monitor
36  Also see cli_spoolss_routereplyprinter()
37  *********************************************************************/
38
39 WERROR rpccli_spoolss_rrpcn(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, 
40                          POLICY_HND *pol, uint32 notify_data_len,
41                          SPOOL_NOTIFY_INFO_DATA *notify_data,
42                          uint32 change_low, uint32 change_high)
43 {
44         prs_struct qbuf, rbuf;
45         SPOOL_Q_REPLY_RRPCN q;
46         SPOOL_R_REPLY_RRPCN r;
47         WERROR result = W_ERROR(ERRgeneral);
48         SPOOL_NOTIFY_INFO       notify_info;
49
50         ZERO_STRUCT(q);
51         ZERO_STRUCT(r);
52
53         ZERO_STRUCT(notify_info);
54
55         /* Initialise input parameters */
56
57         notify_info.version = 0x2;
58         notify_info.flags   = 0x00020000;       /* ?? */
59         notify_info.count   = notify_data_len;
60         notify_info.data    = notify_data;
61
62         /* create and send a MSRPC command with api  */
63         /* store the parameters */
64
65         make_spoolss_q_reply_rrpcn(&q, pol, change_low, change_high, 
66                                    &notify_info);
67
68         /* Marshall data and send request */
69
70         CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_RRPCN,
71                 q, r,
72                 qbuf, rbuf,
73                 spoolss_io_q_reply_rrpcn,
74                 spoolss_io_r_reply_rrpcn,
75                 WERR_GENERAL_FAILURE );
76
77         if (r.unknown0 == 0x00080000)
78                 DEBUG(8,("cli_spoolss_reply_rrpcn: I think the spooler resonded that the notification was ignored.\n"));
79         else if ( r.unknown0 != 0x0 )
80                 DEBUG(8,("cli_spoolss_reply_rrpcn: unknown0 is non-zero [0x%x]\n", r.unknown0));
81         
82         result = r.status;
83         return result;
84 }
85
86 /*********************************************************************
87  *********************************************************************/
88  
89 WERROR rpccli_spoolss_rffpcnex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
90                             POLICY_HND *pol, uint32 flags, uint32 options,
91                             const char *localmachine, uint32 printerlocal,
92                             SPOOL_NOTIFY_OPTION *option)
93 {
94         prs_struct qbuf, rbuf;
95         SPOOL_Q_RFFPCNEX q;
96         SPOOL_R_RFFPCNEX r;
97         WERROR result = W_ERROR(ERRgeneral);
98
99         ZERO_STRUCT(q);
100         ZERO_STRUCT(r);
101
102         /* Initialise input parameters */
103
104         make_spoolss_q_rffpcnex(
105                 &q, pol, flags, options, localmachine, printerlocal,
106                 option);
107
108         /* Marshall data and send request */
109
110         CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_RFFPCNEX,
111                 q, r,
112                 qbuf, rbuf,
113                 spoolss_io_q_rffpcnex,
114                 spoolss_io_r_rffpcnex,
115                 WERR_GENERAL_FAILURE );
116
117         result = r.status;
118         return result;
119 }