2 Unix SMB/CIFS implementation.
4 Copyright (C) Guenther Deschner 2016
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "librpc/gen_ndr/ndr_winspool.h"
22 #include "librpc/gen_ndr/ndr_spoolss.h"
23 #include "rpc_server/spoolss/iremotewinspool_util.h"
25 #define _PAR_MAPPING(NAME) { .iremotewinspool_opcode = NDR_WINSPOOL_ASYNC ##NAME, .spoolss_opcode = NDR_SPOOLSS_ ##NAME }
26 #define _PAR_MAPPING_EX(NAME) { .iremotewinspool_opcode = NDR_WINSPOOL_ASYNC ##NAME, .spoolss_opcode = NDR_SPOOLSS_ ##NAME## EX }
27 #define _PAR_MAPPING_2(NAME) { .iremotewinspool_opcode = NDR_WINSPOOL_ASYNC ##NAME, .spoolss_opcode = NDR_SPOOLSS_ ##NAME## 2 }
30 int iremotewinspool_opcode
;
34 /* 3.1.4.1. Printer Management Methods */
36 _PAR_MAPPING_EX(OPENPRINTER
),
37 _PAR_MAPPING_EX(ADDPRINTER
),
38 _PAR_MAPPING(DELETEPRINTER
),
39 _PAR_MAPPING(SETPRINTER
),
40 _PAR_MAPPING(GETPRINTER
),
41 _PAR_MAPPING(GETPRINTERDATA
),
42 _PAR_MAPPING(GETPRINTERDATAEX
),
43 _PAR_MAPPING(SETPRINTERDATA
),
44 _PAR_MAPPING(SETPRINTERDATAEX
),
45 _PAR_MAPPING(CLOSEPRINTER
),
46 _PAR_MAPPING(ENUMPRINTERDATA
),
47 _PAR_MAPPING(ENUMPRINTERDATAEX
),
48 _PAR_MAPPING(ENUMPRINTERKEY
),
49 _PAR_MAPPING(DELETEPRINTERDATA
),
50 _PAR_MAPPING(DELETEPRINTERDATAEX
),
51 _PAR_MAPPING(DELETEPRINTERKEY
),
52 _PAR_MAPPING(SENDRECVBIDIDATA
),
53 _PAR_MAPPING(CREATEPRINTERIC
),
54 _PAR_MAPPING(PLAYGDISCRIPTONPRINTERIC
),
55 _PAR_MAPPING(DELETEPRINTERIC
),
56 _PAR_MAPPING(ENUMPRINTERS
),
57 _PAR_MAPPING(ADDPERMACHINECONNECTION
),
58 _PAR_MAPPING(DELETEPERMACHINECONNECTION
),
59 _PAR_MAPPING(ENUMPERMACHINECONNECTIONS
),
60 _PAR_MAPPING(RESETPRINTER
),
62 /* 3.1.4.2. Printer Driver Management Methods */
64 _PAR_MAPPING_2(GETPRINTERDRIVER
),
65 _PAR_MAPPING_EX(ADDPRINTERDRIVER
),
66 _PAR_MAPPING(ENUMPRINTERDRIVERS
),
67 _PAR_MAPPING(GETPRINTERDRIVERDIRECTORY
),
68 _PAR_MAPPING(DELETEPRINTERDRIVER
),
69 _PAR_MAPPING(DELETEPRINTERDRIVEREX
),
70 /* No mapping for: RpcAsyncInstallPrinterDriverFromPackage */
71 /* No mapping for: RpcAsyncUploadPrinterDriverPackage */
72 _PAR_MAPPING(GETCOREPRINTERDRIVERS
),
73 /* No mapping for: RpcAsyncCorePrinterDriverInstalled */
74 _PAR_MAPPING(GETPRINTERDRIVERPACKAGEPATH
),
75 /* No mapping for: RpcAsyncDeletePrinterDriverPackage */
77 /* 3.1.4.3. Printer Port Management Methods */
79 _PAR_MAPPING(XCVDATA
),
80 _PAR_MAPPING(ENUMPORTS
),
81 _PAR_MAPPING_EX(ADDPORT
),
82 _PAR_MAPPING(SETPORT
),
84 /* 3.1.4.4. Printer Processor Management Methods */
86 _PAR_MAPPING(ADDPRINTPROCESSOR
),
87 _PAR_MAPPING(ENUMPRINTPROCESSORS
),
88 _PAR_MAPPING(GETPRINTPROCESSORDIRECTORY
),
89 _PAR_MAPPING(DELETEPRINTPROCESSOR
),
90 _PAR_MAPPING(ENUMPRINTPROCESSORDATATYPES
),
92 /* 3.1.4.5. Port Monitor Management Methods */
94 _PAR_MAPPING(ENUMMONITORS
),
95 _PAR_MAPPING(ADDMONITOR
),
96 _PAR_MAPPING(DELETEMONITOR
),
98 /* 3.1.4.6. Form Management Methods */
100 _PAR_MAPPING(ADDFORM
),
101 _PAR_MAPPING(DELETEFORM
),
102 _PAR_MAPPING(GETFORM
),
103 _PAR_MAPPING(SETFORM
),
104 _PAR_MAPPING(ENUMFORMS
),
106 /* 3.1.4.7. Job Management Methods */
108 _PAR_MAPPING(SETJOB
),
109 _PAR_MAPPING(GETJOB
),
110 _PAR_MAPPING(ENUMJOBS
),
111 _PAR_MAPPING(ADDJOB
),
112 _PAR_MAPPING(SCHEDULEJOB
),
114 /* 3.1.4.8. Job Printing Methods */
116 _PAR_MAPPING(STARTDOCPRINTER
),
117 _PAR_MAPPING(STARTPAGEPRINTER
),
118 _PAR_MAPPING(WRITEPRINTER
),
119 _PAR_MAPPING(ENDPAGEPRINTER
),
120 _PAR_MAPPING(ENDDOCPRINTER
),
121 _PAR_MAPPING(ABORTPRINTER
),
122 _PAR_MAPPING(READPRINTER
),
124 /* 3.1.4.9. Printing Related Notification Methods */
126 /* No mapping for: RpcSyncRegisterForRemoteNotifications */
127 /* No mapping for: RpcSyncUnRegisterForRemoteNotifications */
128 /* No mapping for: RpcSyncRefreshRemoteNotifications */
129 /* No mapping for: RpcAsyncGetRemoteNotifications */
131 /* 3.1.4.10. Job Named Property Management Methods */
133 _PAR_MAPPING(GETJOBNAMEDPROPERTYVALUE
),
134 _PAR_MAPPING(SETJOBNAMEDPROPERTY
),
135 _PAR_MAPPING(DELETEJOBNAMEDPROPERTY
),
136 _PAR_MAPPING(ENUMJOBNAMEDPROPERTIES
),
138 /* 3.1.4.11. Branch Office Remote Logging Methods */
140 _PAR_MAPPING(LOGJOBINFOFORBRANCHOFFICE
),
143 bool iremotewinspool_map_opcode(uint16_t opcode
,
144 uint16_t *proxy_opcode
)
148 for (i
= 0; i
<ARRAY_SIZE(proxy_table
); i
++) {
149 if (proxy_table
[i
].iremotewinspool_opcode
== opcode
) {
150 *proxy_opcode
= proxy_table
[i
].spoolss_opcode
;