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 _SRV_SPOOLSS_UITL_H
23 #define _SRV_SPOOLSS_UITL_H
28 * @brief Set printer data over the winreg pipe.
30 * @param[in] mem_ctx The talloc memory context to use.
32 * @param[in] server_info The server supplied session info.
34 * @param[in] printer The printer name.
36 * @param[in] key The key of the printer data to store the value.
38 * @param[in] value The value name to save.
40 * @param[in] type The type of the value to use.
42 * @param[in] data The data which sould be saved under the given value.
44 * @param[in] data_size The size of the data.
46 * @return On success WERR_OK, a corresponding DOS error is
47 * something went wrong.
49 WERROR
winreg_set_printer_dataex(TALLOC_CTX
*mem_ctx
,
50 struct auth_serversupplied_info
*server_info
,
54 enum winreg_Type type
,
61 * @brief Get printer data over a winreg pipe.
63 * @param[in] mem_ctx The talloc memory context to use.
65 * @param[in] server_info The server supplied session info.
67 * @param[in] printer The printer name.
69 * @param[in] key The key of the printer data to get the value.
71 * @param[in] value The name of the value to query.
73 * @param[in] type The type of the value to query.
75 * @param[out] data A pointer to store the data.
77 * @param[out] data_size A pointer to store the size of the data.
79 * @return On success WERR_OK, a corresponding DOS error is
80 * something went wrong.
82 WERROR
winreg_get_printer_dataex(TALLOC_CTX
*mem_ctx
,
83 struct auth_serversupplied_info
*server_info
,
87 enum winreg_Type
*type
,
94 * @brief Enumerate on the values of a given key and provide the data.
96 * @param[in] mem_ctx The talloc memory context to use.
98 * @param[in] server_info The server supplied session info.
100 * @param[in] printer The printer name.
102 * @param[in] key The key of the printer data to get the value.
104 * @param[out] pnum_values A pointer to store the number of values we found.
106 * @param[out] penum_values A pointer to store the values and its data.
108 * @return WERR_OK on success, the corresponding DOS error
109 * code if something gone wrong.
111 WERROR
winreg_enum_printer_dataex(TALLOC_CTX
*mem_ctx
,
112 struct auth_serversupplied_info
*server_info
,
115 uint32_t *pnum_values
,
116 struct spoolss_PrinterEnumValues
**penum_values
);
121 * @brief Delete printer data over a winreg pipe.
123 * @param[in] mem_ctx The talloc memory context to use.
125 * @param[in] server_info The server supplied session info.
127 * @param[in] printer The printer name.
129 * @param[in] key The key of the printer data to delete.
131 * @param[in] value The name of the value to delete.
133 * @return On success WERR_OK, a corresponding DOS error is
134 * something went wrong.
136 WERROR
winreg_delete_printer_dataex(TALLOC_CTX
*mem_ctx
,
137 struct auth_serversupplied_info
*server_info
,
145 * @brief Enumerate on the subkeys of a given key and provide the data.
147 * @param[in] mem_ctx The talloc memory context to use.
149 * @param[in] server_info The server supplied session info.
151 * @param[in] printer The printer name.
153 * @param[in] key The key of the printer data to get the value.
155 * @param[out] pnum_subkeys A pointer to store the number of subkeys found.
157 * @param[in] psubkeys A pointer to an array to store the names of the subkeys
160 * @return WERR_OK on success, the corresponding DOS error
161 * code if something gone wrong.
163 WERROR
winreg_enum_printer_key(TALLOC_CTX
*mem_ctx
,
164 struct auth_serversupplied_info
*server_info
,
167 uint32_t *pnum_subkeys
,
168 const char ***psubkeys
);
173 * @brief Delete a key with subkeys of a given printer.
175 * @param[in] mem_ctx The talloc memory context to use.
177 * @param[in] server_info The server supplied session info.
179 * @param[in] printer The printer name.
181 * @param[in] key The key of the printer to delete.
183 * @return On success WERR_OK, a corresponding DOS error is
184 * something went wrong.
186 WERROR
winreg_delete_printer_key(TALLOC_CTX
*mem_ctx
,
187 struct auth_serversupplied_info
*server_info
,
192 * @brief Update the ChangeID of a printer.
194 * The ChangeID **must** be increasing over the lifetime of client's spoolss
195 * service in order for the client's cache to show updates.
197 * If a form is updated of a printer, the we need to update the ChangeID of the
200 * @param[in] mem_ctx The talloc memory context to use.
202 * @param[in] server_info The server supplied session info.
204 * @param[in] printer The printer name.
206 * @return On success WERR_OK, a corresponding DOS error is
207 * something went wrong.
209 WERROR
winreg_printer_update_changeid(TALLOC_CTX
*mem_ctx
,
210 struct auth_serversupplied_info
*server_info
,
211 const char *printer
);
214 * @brief Get the ChangeID of the given printer.
216 * @param[in] mem_ctx The talloc memory context to use.
218 * @param[in] server_info The server supplied session info.
220 * @param[in] printer The printer name.
222 * @param[in] changeid A pointer to store the changeid.
224 * @return On success WERR_OK, a corresponding DOS error is
225 * something went wrong.
227 WERROR
winreg_printer_get_changeid(TALLOC_CTX
*mem_ctx
,
228 struct auth_serversupplied_info
*server_info
,
230 uint32_t *pchangeid
);
235 * @brief This function adds a form to the list of available forms that can be
236 * selected for the specified printer.
238 * @param[in] mem_ctx The talloc memory context to use.
240 * @param[in] server_info The server supplied session info.
242 * @param[in] form The form to add.
244 * @return WERR_OK on success.
245 * WERR_ALREADY_EXISTS if the form already exists or is a
247 * A corresponding DOS error is something went wrong.
249 WERROR
winreg_printer_addform1(TALLOC_CTX
*mem_ctx
,
250 struct auth_serversupplied_info
*server_info
,
251 struct spoolss_AddFormInfo1
*form
);
254 * @brief This function enumerates the forms supported by the specified printer.
256 * @param[in] mem_ctx The talloc memory context to use.
258 * @param[in] server_info The server supplied session info.
260 * @param[out] pnum_info A pointer to store the FormInfo count.
262 * @param[out] pinfo A pointer to store an array with FormInfo.
264 * @return On success WERR_OK, a corresponding DOS error is
265 * something went wrong.
267 WERROR
winreg_printer_enumforms1(TALLOC_CTX
*mem_ctx
,
268 struct auth_serversupplied_info
*server_info
,
270 union spoolss_FormInfo
**pinfo
);
273 * @brief This function removes a form name from the list of supported forms.
275 * @param[in] mem_ctx The talloc memory context to use.
277 * @param[in] server_info The server supplied session info.
279 * @param[in] form_name The name of the form to delete.
281 * @return WERR_OK on success.
282 * WERR_INVALID_PARAM if the form is a builtin form.
283 * WERR_INVALID_FORM_NAME if the form or key doesn't exist.
284 * A corresponding DOS error is something went wrong.
286 WERROR
winreg_printer_deleteform1(TALLOC_CTX
*mem_ctx
,
287 struct auth_serversupplied_info
*server_info
,
288 const char *form_name
);
291 * @brief This function sets the form information for the specified printer.
293 * If one provides both the name in the API call and inside the FormInfo
294 * structure, then the form gets renamed.
296 * @param[in] mem_ctx The talloc memory context to use.
298 * @param[in] server_info The server supplied session info.
300 * @param[in] form_name The name of the form to set or rename.
302 * @param[in] form The FormInfo structure to save.
304 * @return WERR_OK on success.
305 * WERR_INVALID_PARAM if the form is a builtin form.
306 * A corresponding DOS error is something went wrong.
308 WERROR
winreg_printer_setform1(TALLOC_CTX
*mem_ctx
,
309 struct auth_serversupplied_info
*server_info
,
310 const char *form_name
,
311 struct spoolss_AddFormInfo1
*form
);
314 * @brief This function retrieves information about a specified form.
316 * @param[in] mem_ctx The talloc memory context to use.
318 * @param[in] server_info The server supplied session info.
320 * @param[in] form_name The name of the form to query.
322 * @param[out] form A pointer to a form structure to fill out.
324 * @return On success WERR_OK, a corresponding DOS error is
325 * something went wrong.
327 WERROR
winreg_printer_getform1(TALLOC_CTX
*mem_ctx
,
328 struct auth_serversupplied_info
*server_info
,
329 const char *form_name
,
330 struct spoolss_FormInfo1
*form
);
332 #endif /* _SRV_SPOOLSS_UITL_H */