rpc_client/cli_spoolss_notify.c

説明を見る。
00001 /* 
00002    Unix SMB/CIFS implementation.
00003    RPC pipe client
00004 
00005    Copyright (C) Gerald Carter                2001-2002,
00006    Copyright (C) Tim Potter                   2000-2002,
00007    Copyright (C) Andrew Tridgell              1994-2000,
00008    Copyright (C) Jean-Francois Micouleau      1999-2000.
00009    Copyright (C) Jeremy Allison                    2005.
00010 
00011    This program is free software; you can redistribute it and/or modify
00012    it under the terms of the GNU General Public License as published by
00013    the Free Software Foundation; either version 2 of the License, or
00014    (at your option) any later version.
00015    
00016    This program is distributed in the hope that it will be useful,
00017    but WITHOUT ANY WARRANTY; without even the implied warranty of
00018    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019    GNU General Public License for more details.
00020    
00021    You should have received a copy of the GNU General Public License
00022    along with this program; if not, write to the Free Software
00023    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00024 */
00025 
00026 #include "includes.h"
00027 
00028 /*
00029  * SPOOLSS Client RPC's used by servers as the notification
00030  * back channel.
00031  */
00032 
00033 /* Send a ReplyOpenPrinter request.  This rpc is made by the printer
00034    server to the printer client in response to a rffpcnex request.
00035    The rrfpcnex request names a printer and a handle (the printerlocal
00036    value) and this rpc establishes a back-channel over which printer
00037    notifications are performed. */
00038 
00039 WERROR rpccli_spoolss_reply_open_printer(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, 
00040                                       const char *printer, uint32 printerlocal, uint32 type, 
00041                                       POLICY_HND *handle)
00042 {
00043         prs_struct qbuf, rbuf;
00044         SPOOL_Q_REPLYOPENPRINTER q;
00045         SPOOL_R_REPLYOPENPRINTER r;
00046         WERROR result = W_ERROR(ERRgeneral);
00047         
00048         /* Initialise input parameters */
00049 
00050         make_spoolss_q_replyopenprinter(&q, printer, printerlocal, type);
00051 
00052         /* Marshall data and send request */
00053 
00054         CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_REPLYOPENPRINTER,
00055                 q, r,
00056                 qbuf, rbuf,
00057                 spoolss_io_q_replyopenprinter,
00058                 spoolss_io_r_replyopenprinter,
00059                 WERR_GENERAL_FAILURE );
00060 
00061         /* Return result */
00062 
00063         memcpy(handle, &r.handle, sizeof(r.handle));
00064         result = r.status;
00065 
00066         return result;
00067 }
00068 
00069 /* Close a back-channel notification connection */
00070 
00071 WERROR rpccli_spoolss_reply_close_printer(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, 
00072                                        POLICY_HND *handle)
00073 {
00074         prs_struct qbuf, rbuf;
00075         SPOOL_Q_REPLYCLOSEPRINTER q;
00076         SPOOL_R_REPLYCLOSEPRINTER r;
00077         WERROR result = W_ERROR(ERRgeneral);
00078 
00079         /* Initialise input parameters */
00080 
00081         make_spoolss_q_reply_closeprinter(&q, handle);
00082 
00083         /* Marshall data and send request */
00084 
00085         CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_REPLYCLOSEPRINTER,
00086                 q, r,
00087                 qbuf, rbuf,
00088                 spoolss_io_q_replycloseprinter,
00089                 spoolss_io_r_replycloseprinter,
00090                 WERR_GENERAL_FAILURE );
00091 
00092         /* Return result */
00093 
00094         result = r.status;
00095         return result;
00096 }
00097 
00098 /*********************************************************************
00099  This SPOOLSS_ROUTERREPLYPRINTER function is used to send a change 
00100  notification event when the registration **did not** use 
00101  SPOOL_NOTIFY_OPTION_TYPE structure to specify the events to monitor.
00102  Also see cli_spolss_reply_rrpcn()
00103  *********************************************************************/
00104  
00105 WERROR rpccli_spoolss_routerreplyprinter(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
00106                                       POLICY_HND *pol, uint32 condition, uint32 change_id)
00107 {
00108         prs_struct qbuf, rbuf;
00109         SPOOL_Q_ROUTERREPLYPRINTER q;
00110         SPOOL_R_ROUTERREPLYPRINTER r;
00111         WERROR result = W_ERROR(ERRgeneral);
00112 
00113         /* Initialise input parameters */
00114 
00115         make_spoolss_q_routerreplyprinter(&q, pol, condition, change_id);
00116 
00117         /* Marshall data and send request */
00118 
00119         CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_ROUTERREPLYPRINTER,
00120                 q, r,
00121                 qbuf, rbuf,
00122                 spoolss_io_q_routerreplyprinter,
00123                 spoolss_io_r_routerreplyprinter,
00124                 WERR_GENERAL_FAILURE );
00125 
00126         /* Return output parameters */
00127 
00128         result = r.status;
00129         return result;  
00130 }
00131 
00132 /*********************************************************************
00133  This SPOOLSS_REPLY_RRPCN function is used to send a change 
00134  notification event when the registration **did** use 
00135  SPOOL_NOTIFY_OPTION_TYPE structure to specify the events to monitor
00136  Also see cli_spoolss_routereplyprinter()
00137  *********************************************************************/
00138 
00139 WERROR rpccli_spoolss_rrpcn(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, 
00140                          POLICY_HND *pol, uint32 notify_data_len,
00141                          SPOOL_NOTIFY_INFO_DATA *notify_data,
00142                          uint32 change_low, uint32 change_high)
00143 {
00144         prs_struct qbuf, rbuf;
00145         SPOOL_Q_REPLY_RRPCN q;
00146         SPOOL_R_REPLY_RRPCN r;
00147         WERROR result = W_ERROR(ERRgeneral);
00148         SPOOL_NOTIFY_INFO       notify_info;
00149 
00150         ZERO_STRUCT(q);
00151         ZERO_STRUCT(r);
00152 
00153         ZERO_STRUCT(notify_info);
00154 
00155         /* Initialise input parameters */
00156 
00157         notify_info.version = 0x2;
00158         notify_info.flags   = 0x00020000;       /* ?? */
00159         notify_info.count   = notify_data_len;
00160         notify_info.data    = notify_data;
00161 
00162         /* create and send a MSRPC command with api  */
00163         /* store the parameters */
00164 
00165         make_spoolss_q_reply_rrpcn(&q, pol, change_low, change_high, 
00166                                    &notify_info);
00167 
00168         /* Marshall data and send request */
00169 
00170         CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_RRPCN,
00171                 q, r,
00172                 qbuf, rbuf,
00173                 spoolss_io_q_reply_rrpcn,
00174                 spoolss_io_r_reply_rrpcn,
00175                 WERR_GENERAL_FAILURE );
00176 
00177         if (r.unknown0 == 0x00080000)
00178                 DEBUG(8,("cli_spoolss_reply_rrpcn: I think the spooler resonded that the notification was ignored.\n"));
00179         else if ( r.unknown0 != 0x0 )
00180                 DEBUG(8,("cli_spoolss_reply_rrpcn: unknown0 is non-zero [0x%x]\n", r.unknown0));
00181         
00182         result = r.status;
00183         return result;
00184 }
00185 
00186 /*********************************************************************
00187  *********************************************************************/
00188  
00189 WERROR rpccli_spoolss_rffpcnex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
00190                             POLICY_HND *pol, uint32 flags, uint32 options,
00191                             const char *localmachine, uint32 printerlocal,
00192                             SPOOL_NOTIFY_OPTION *option)
00193 {
00194         prs_struct qbuf, rbuf;
00195         SPOOL_Q_RFFPCNEX q;
00196         SPOOL_R_RFFPCNEX r;
00197         WERROR result = W_ERROR(ERRgeneral);
00198 
00199         ZERO_STRUCT(q);
00200         ZERO_STRUCT(r);
00201 
00202         /* Initialise input parameters */
00203 
00204         make_spoolss_q_rffpcnex(
00205                 &q, pol, flags, options, localmachine, printerlocal,
00206                 option);
00207 
00208         /* Marshall data and send request */
00209 
00210         CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_RFFPCNEX,
00211                 q, r,
00212                 qbuf, rbuf,
00213                 spoolss_io_q_rffpcnex,
00214                 spoolss_io_r_rffpcnex,
00215                 WERR_GENERAL_FAILURE );
00216 
00217         result = r.status;
00218         return result;
00219 }

Sambaに対してSat Aug 29 21:23:16 2009に生成されました。  doxygen 1.4.7