vfs_catia: add chmod()
[Samba.git] / source3 / rpc_client / cli_winreg_spoolss.h
blobaa4d98f681f8eeba4b7b482a325b788c623959b2
1 /*
2 * Unix SMB/CIFS implementation.
4 * SPOOLSS RPC Pipe server / winreg client routines
6 * Copyright (c) 2010 Andreas Schneider <asn@samba.org>
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 3 of the License, or
11 * (at your option) any later version.
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.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
22 #ifndef _RPC_CLIENT_CLI_WINREG_SPOOLSS_H_
23 #define _RPC_CLIENT_CLI_WINREG_SPOOLSS_H_
25 struct dcerpc_binding_handle;
27 enum spoolss_PrinterInfo2Mask {
28 SPOOLSS_PRINTER_INFO_ATTRIBUTES = (int)(0x00000001),
29 SPOOLSS_PRINTER_INFO_AVERAGEPPM = (int)(0x00000002),
30 SPOOLSS_PRINTER_INFO_CJOBS = (int)(0x00000004),
31 SPOOLSS_PRINTER_INFO_COMMENT = (int)(0x00000008),
32 SPOOLSS_PRINTER_INFO_DATATYPE = (int)(0x00000010),
33 SPOOLSS_PRINTER_INFO_DEFAULTPRIORITY = (int)(0x00000020),
34 SPOOLSS_PRINTER_INFO_DEVMODE = (int)(0x00000040),
35 SPOOLSS_PRINTER_INFO_DRIVERNAME = (int)(0x00000080),
36 SPOOLSS_PRINTER_INFO_LOCATION = (int)(0x00000100),
37 SPOOLSS_PRINTER_INFO_NAME = (int)(0x00000200),
38 SPOOLSS_PRINTER_INFO_PARAMETERS = (int)(0x00000400),
39 SPOOLSS_PRINTER_INFO_PORTNAME = (int)(0x00000800),
40 SPOOLSS_PRINTER_INFO_PRINTERNAME = (int)(0x00001000),
41 SPOOLSS_PRINTER_INFO_PRINTPROCESSOR = (int)(0x00002000),
42 SPOOLSS_PRINTER_INFO_PRIORITY = (int)(0x00004000),
43 SPOOLSS_PRINTER_INFO_SECDESC = (int)(0x00008000),
44 SPOOLSS_PRINTER_INFO_SEPFILE = (int)(0x00010000),
45 SPOOLSS_PRINTER_INFO_SERVERNAME = (int)(0x00020000),
46 SPOOLSS_PRINTER_INFO_SHARENAME = (int)(0x00040000),
47 SPOOLSS_PRINTER_INFO_STARTTIME = (int)(0x00080000),
48 SPOOLSS_PRINTER_INFO_STATUS = (int)(0x00100000),
49 SPOOLSS_PRINTER_INFO_UNTILTIME = (int)(0x00200000)
52 #define SPOOLSS_PRINTER_INFO_ALL SPOOLSS_PRINTER_INFO_ATTRIBUTES | \
53 SPOOLSS_PRINTER_INFO_AVERAGEPPM | \
54 SPOOLSS_PRINTER_INFO_CJOBS | \
55 SPOOLSS_PRINTER_INFO_COMMENT | \
56 SPOOLSS_PRINTER_INFO_DATATYPE | \
57 SPOOLSS_PRINTER_INFO_DEFAULTPRIORITY | \
58 SPOOLSS_PRINTER_INFO_DEVMODE | \
59 SPOOLSS_PRINTER_INFO_DRIVERNAME | \
60 SPOOLSS_PRINTER_INFO_LOCATION | \
61 SPOOLSS_PRINTER_INFO_NAME | \
62 SPOOLSS_PRINTER_INFO_PARAMETERS | \
63 SPOOLSS_PRINTER_INFO_PORTNAME | \
64 SPOOLSS_PRINTER_INFO_PRINTERNAME | \
65 SPOOLSS_PRINTER_INFO_PRINTPROCESSOR | \
66 SPOOLSS_PRINTER_INFO_PRIORITY | \
67 SPOOLSS_PRINTER_INFO_SECDESC | \
68 SPOOLSS_PRINTER_INFO_SEPFILE | \
69 SPOOLSS_PRINTER_INFO_SERVERNAME | \
70 SPOOLSS_PRINTER_INFO_SHARENAME | \
71 SPOOLSS_PRINTER_INFO_STARTTIME | \
72 SPOOLSS_PRINTER_INFO_STATUS | \
73 SPOOLSS_PRINTER_INFO_UNTILTIME
75 WERROR winreg_create_printer(TALLOC_CTX *mem_ctx,
76 struct dcerpc_binding_handle *b,
77 const char *sharename);
79 /**
80 * @internal
82 * @brief Update the information of a printer in the registry.
84 * @param[in] mem_ctx The talloc memory context to use.
86 * @param[in] b The dcerpc binding handle
88 * @param[in] sharename The share name.
90 * @param[in] info2_mask A bitmask which defines which values should be set.
92 * @param[in] info2 A SetPrinterInfo2 structure with the data to set.
94 * @param[in] devmode A device mode structure with the data to set.
96 * @param[in] secdesc A security descriptor structure with the data to set.
98 * @return On success WERR_OK, a corresponding DOS error is
99 * something went wrong.
101 WERROR winreg_update_printer(TALLOC_CTX *mem_ctx,
102 struct dcerpc_binding_handle *b,
103 const char *sharename,
104 uint32_t info2_mask,
105 struct spoolss_SetPrinterInfo2 *info2,
106 struct spoolss_DeviceMode *devmode,
107 struct security_descriptor *secdesc);
111 * @brief Get the inforamtion of a printer stored in the registry.
113 * @param[in] mem_ctx The talloc memory context to use.
115 * @param[in] b The dcerpc binding handle
117 * @param[in] printer The name of the printer to get.
119 * @param[out] pinfo2 A pointer to store a PRINTER_INFO_2 structure.
121 * @return On success WERR_OK, a corresponding DOS error is
122 * something went wrong.
124 WERROR winreg_get_printer(TALLOC_CTX *mem_ctx,
125 struct dcerpc_binding_handle *b,
126 const char *printer,
127 struct spoolss_PrinterInfo2 **pinfo2);
130 * @brief Get the security descriptor for a printer.
132 * @param[in] mem_ctx The talloc memory context to use.
134 * @param[in] b The dcerpc binding handle
136 * @param[in] sharename The share name.
138 * @param[out] psecdesc A pointer to store the security descriptor.
140 * @return On success WERR_OK, a corresponding DOS error is
141 * something went wrong.
143 WERROR winreg_get_printer_secdesc(TALLOC_CTX *mem_ctx,
144 struct dcerpc_binding_handle *b,
145 const char *sharename,
146 struct spoolss_security_descriptor **psecdesc);
149 * @brief Set the security descriptor for a printer.
151 * @param[in] mem_ctx The talloc memory context to use.
153 * @param[in] b The dcerpc binding handle
155 * @param[in] sharename The share name.
157 * @param[in] secdesc The security descriptor to save.
159 * @return On success WERR_OK, a corresponding DOS error is
160 * something went wrong.
162 WERROR winreg_set_printer_secdesc(TALLOC_CTX *mem_ctx,
163 struct dcerpc_binding_handle *b,
164 const char *sharename,
165 const struct spoolss_security_descriptor *secdesc);
168 * @internal
170 * @brief Set printer data over the winreg pipe.
172 * @param[in] mem_ctx The talloc memory context to use.
174 * @param[in] b The dcerpc binding handle
176 * @param[in] printer The printer name.
178 * @param[in] key The key of the printer data to store the value.
180 * @param[in] value The value name to save.
182 * @param[in] type The type of the value to use.
184 * @param[in] data The data which sould be saved under the given value.
186 * @param[in] data_size The size of the data.
188 * @return On success WERR_OK, a corresponding DOS error is
189 * something went wrong.
191 WERROR winreg_set_printer_dataex(TALLOC_CTX *mem_ctx,
192 struct dcerpc_binding_handle *b,
193 const char *printer,
194 const char *key,
195 const char *value,
196 enum winreg_Type type,
197 uint8_t *data,
198 uint32_t data_size);
201 * @internal
203 * @brief Get printer data over a winreg pipe.
205 * @param[in] mem_ctx The talloc memory context to use.
207 * @param[in] b The dcerpc binding handle
209 * @param[in] printer The printer name.
211 * @param[in] key The key of the printer data to get the value.
213 * @param[in] value The name of the value to query.
215 * @param[in] type The type of the value to query.
217 * @param[out] data A pointer to store the data.
219 * @param[out] data_size A pointer to store the size of the data.
221 * @return On success WERR_OK, a corresponding DOS error is
222 * something went wrong.
224 WERROR winreg_get_printer_dataex(TALLOC_CTX *mem_ctx,
225 struct dcerpc_binding_handle *b,
226 const char *printer,
227 const char *key,
228 const char *value,
229 enum winreg_Type *type,
230 uint8_t **data,
231 uint32_t *data_size);
234 * @internal
236 * @brief Enumerate on the values of a given key and provide the data.
238 * @param[in] mem_ctx The talloc memory context to use.
240 * @param[in] b The dcerpc binding handle
242 * @param[in] printer The printer name.
244 * @param[in] key The key of the printer data to get the value.
246 * @param[out] pnum_values A pointer to store the number of values we found.
248 * @param[out] penum_values A pointer to store the values and its data.
250 * @return WERR_OK on success, the corresponding DOS error
251 * code if something gone wrong.
253 WERROR winreg_enum_printer_dataex(TALLOC_CTX *mem_ctx,
254 struct dcerpc_binding_handle *b,
255 const char *printer,
256 const char *key,
257 uint32_t *pnum_values,
258 struct spoolss_PrinterEnumValues **penum_values);
261 * @internal
263 * @brief Delete printer data over a winreg pipe.
265 * @param[in] mem_ctx The talloc memory context to use.
267 * @param[in] b The dcerpc binding handle
269 * @param[in] printer The printer name.
271 * @param[in] key The key of the printer data to delete.
273 * @param[in] value The name of the value to delete.
275 * @return On success WERR_OK, a corresponding DOS error is
276 * something went wrong.
278 WERROR winreg_delete_printer_dataex(TALLOC_CTX *mem_ctx,
279 struct dcerpc_binding_handle *b,
280 const char *printer,
281 const char *key,
282 const char *value);
285 * @internal
287 * @brief Enumerate on the subkeys of a given key and provide the data.
289 * @param[in] mem_ctx The talloc memory context to use.
291 * @param[in] b The dcerpc binding handle
293 * @param[in] printer The printer name.
295 * @param[in] key The key of the printer data to get the value.
297 * @param[out] pnum_subkeys A pointer to store the number of subkeys found.
299 * @param[in] psubkeys A pointer to an array to store the names of the subkeys
300 * found.
302 * @return WERR_OK on success, the corresponding DOS error
303 * code if something gone wrong.
305 WERROR winreg_enum_printer_key(TALLOC_CTX *mem_ctx,
306 struct dcerpc_binding_handle *b,
307 const char *printer,
308 const char *key,
309 uint32_t *pnum_subkeys,
310 const char ***psubkeys);
313 * @internal
315 * @brief Delete a key with subkeys of a given printer.
317 * @param[in] mem_ctx The talloc memory context to use.
319 * @param[in] b The dcerpc binding handle
321 * @param[in] printer The printer name.
323 * @param[in] key The key of the printer to delete.
325 * @return On success WERR_OK, a corresponding DOS error is
326 * something went wrong.
328 WERROR winreg_delete_printer_key(TALLOC_CTX *mem_ctx,
329 struct dcerpc_binding_handle *b,
330 const char *printer,
331 const char *key);
334 * @brief Update the ChangeID of a printer.
336 * The ChangeID **must** be increasing over the lifetime of client's spoolss
337 * service in order for the client's cache to show updates.
339 * If a form is updated of a printer, the we need to update the ChangeID of the
340 * pritner.
342 * @param[in] mem_ctx The talloc memory context to use.
344 * @param[in] b The dcerpc binding handle
346 * @param[in] printer The printer name.
348 * @return On success WERR_OK, a corresponding DOS error is
349 * something went wrong.
351 WERROR winreg_printer_update_changeid(TALLOC_CTX *mem_ctx,
352 struct dcerpc_binding_handle *b,
353 const char *printer);
356 * @brief Get the ChangeID of the given printer.
358 * @param[in] mem_ctx The talloc memory context to use.
360 * @param[in] b The dcerpc binding handle
362 * @param[in] printer The printer name.
364 * @param[in] changeid A pointer to store the changeid.
366 * @return On success WERR_OK, a corresponding DOS error is
367 * something went wrong.
369 WERROR winreg_printer_get_changeid(TALLOC_CTX *mem_ctx,
370 struct dcerpc_binding_handle *b,
371 const char *printer,
372 uint32_t *pchangeid);
375 * @internal
377 * @brief This function adds a form to the list of available forms that can be
378 * selected for the specified printer.
380 * @param[in] mem_ctx The talloc memory context to use.
382 * @param[in] b The dcerpc binding handle
384 * @param[in] form The form to add.
386 * @return WERR_OK on success.
387 * WERR_ALREADY_EXISTS if the form already exists or is a
388 * builtin form.
389 * A corresponding DOS error is something went wrong.
391 WERROR winreg_printer_addform1(TALLOC_CTX *mem_ctx,
392 struct dcerpc_binding_handle *b,
393 struct spoolss_AddFormInfo1 *form);
396 * @brief This function enumerates the forms supported by the specified printer.
398 * @param[in] mem_ctx The talloc memory context to use.
400 * @param[in] b The dcerpc binding handle
402 * @param[out] pnum_info A pointer to store the FormInfo count.
404 * @param[out] pinfo A pointer to store an array with FormInfo.
406 * @return On success WERR_OK, a corresponding DOS error is
407 * something went wrong.
409 WERROR winreg_printer_enumforms1(TALLOC_CTX *mem_ctx,
410 struct dcerpc_binding_handle *b,
411 uint32_t *pnum_info,
412 union spoolss_FormInfo **pinfo);
415 * @brief This function removes a form name from the list of supported forms.
417 * @param[in] mem_ctx The talloc memory context to use.
419 * @param[in] b The dcerpc binding handle
421 * @param[in] form_name The name of the form to delete.
423 * @return WERR_OK on success.
424 * WERR_INVALID_PARAM if the form is a builtin form.
425 * WERR_INVALID_FORM_NAME if the form or key doesn't exist.
426 * A corresponding DOS error is something went wrong.
428 WERROR winreg_printer_deleteform1(TALLOC_CTX *mem_ctx,
429 struct dcerpc_binding_handle *b,
430 const char *form_name);
433 * @brief This function sets the form information for the specified printer.
435 * If one provides both the name in the API call and inside the FormInfo
436 * structure, then the form gets renamed.
438 * @param[in] mem_ctx The talloc memory context to use.
440 * @param[in] b The dcerpc binding handle
442 * @param[in] form_name The name of the form to set or rename.
444 * @param[in] form The FormInfo structure to save.
446 * @return WERR_OK on success.
447 * WERR_INVALID_PARAM if the form is a builtin form.
448 * A corresponding DOS error is something went wrong.
450 WERROR winreg_printer_setform1(TALLOC_CTX *mem_ctx,
451 struct dcerpc_binding_handle *b,
452 const char *form_name,
453 struct spoolss_AddFormInfo1 *form);
456 * @brief This function retrieves information about a specified form.
458 * @param[in] mem_ctx The talloc memory context to use.
460 * @param[in] b The dcerpc binding handle
462 * @param[in] form_name The name of the form to query.
464 * @param[out] form A pointer to a form structure to fill out.
466 * @return On success WERR_OK, a corresponding DOS error is
467 * something went wrong.
469 WERROR winreg_printer_getform1(TALLOC_CTX *mem_ctx,
470 struct dcerpc_binding_handle *b,
471 const char *form_name,
472 struct spoolss_FormInfo1 *form);
475 * @brief This function adds a new spool driver
477 * @param[in] mem_ctx A talloc memory context.
479 * @param[in] b The dcerpc binding handle
481 * @param[in] r The structure containing the new driver data.
483 * @param[out] driver_name Returns the driver name.
485 * @param[out] driver_version Returns the driver version.
487 * @return On success WERR_OK, a corresponding DOS error is
488 * something went wrong.
490 WERROR winreg_add_driver(TALLOC_CTX *mem_ctx,
491 struct dcerpc_binding_handle *b,
492 struct spoolss_AddDriverInfoCtr *r,
493 const char **driver_name,
494 uint32_t *driver_version);
497 * @brief This function gets printer driver information
499 * @param[in] mem_ctx A talloc memory context.
501 * @param[in] b The dcerpc binding handle
503 * @param[in] architecture The architecture type.
505 * @param[in] driver_name The driver name.
507 * @param[in] driver_version The driver version.
509 * @param[out] _info8 The structure that holds the full driver information.
511 * @return On success WERR_OK, a corresponding DOS error is
512 * something went wrong.
515 WERROR winreg_get_driver(TALLOC_CTX *mem_ctx,
516 struct dcerpc_binding_handle *b,
517 const char *architecture,
518 const char *driver_name,
519 uint32_t driver_version,
520 struct spoolss_DriverInfo8 **_info8);
523 * @brief This function deletes a printer driver information
525 * @param[in] mem_ctx A talloc memory context.
527 * @param[in] b The dcerpc binding handle
529 * @param[out] info8 The structure that holds the full driver information.
531 * @param[in] version The driver type version.
533 * @return On success WERR_OK, a corresponding DOS error is
534 * something went wrong.
537 WERROR winreg_del_driver(TALLOC_CTX *mem_ctx,
538 struct dcerpc_binding_handle *b,
539 struct spoolss_DriverInfo8 *info8,
540 uint32_t version);
543 * @brief This function gets printer drivers list for the specified
544 * architecture and type version
546 * @param[in] mem_ctx A talloc memory context.
548 * @param[in] b The dcerpc binding handle
550 * @param[in] architecture The architecture type.
552 * @param[in] version The driver version.
554 * @param[out] num_drivers The number of drivers.
556 * @param[out] version The drivers names.
558 * @return On success WERR_OK, a corresponding DOS error is
559 * something went wrong.
562 WERROR winreg_get_driver_list(TALLOC_CTX *mem_ctx,
563 struct dcerpc_binding_handle *b,
564 const char *architecture,
565 uint32_t version,
566 uint32_t *num_drivers,
567 const char ***drivers);
569 #endif /* _RPC_CLIENT_CLI_WINREG_SPOOLSS_H_ */