s3: Lift the smbd_messaging_context from winreg_printer_addform1
[abartlet/samba.git/.git] / source3 / rpc_server / srv_spoolss_util.h
index a4b5c88271451983a66cfb1bcafbb362ef869b83..ada7cabdeec02301b6925178d6947530c75f2a0e 100644 (file)
 #ifndef _SRV_SPOOLSS_UITL_H
 #define _SRV_SPOOLSS_UITL_H
 
+
+enum spoolss_PrinterInfo2Mask {
+       SPOOLSS_PRINTER_INFO_ATTRIBUTES      = (int)(0x00000001),
+       SPOOLSS_PRINTER_INFO_AVERAGEPPM      = (int)(0x00000002),
+       SPOOLSS_PRINTER_INFO_CJOBS           = (int)(0x00000004),
+       SPOOLSS_PRINTER_INFO_COMMENT         = (int)(0x00000008),
+       SPOOLSS_PRINTER_INFO_DATATYPE        = (int)(0x00000010),
+       SPOOLSS_PRINTER_INFO_DEFAULTPRIORITY = (int)(0x00000020),
+       SPOOLSS_PRINTER_INFO_DEVMODE         = (int)(0x00000040),
+       SPOOLSS_PRINTER_INFO_DRIVERNAME      = (int)(0x00000080),
+       SPOOLSS_PRINTER_INFO_LOCATION        = (int)(0x00000100),
+       SPOOLSS_PRINTER_INFO_NAME            = (int)(0x00000200),
+       SPOOLSS_PRINTER_INFO_PARAMETERS      = (int)(0x00000400),
+       SPOOLSS_PRINTER_INFO_PORTNAME        = (int)(0x00000800),
+       SPOOLSS_PRINTER_INFO_PRINTERNAME     = (int)(0x00001000),
+       SPOOLSS_PRINTER_INFO_PRINTPROCESSOR  = (int)(0x00002000),
+       SPOOLSS_PRINTER_INFO_PRIORITY        = (int)(0x00004000),
+       SPOOLSS_PRINTER_INFO_SECDESC         = (int)(0x00008000),
+       SPOOLSS_PRINTER_INFO_SEPFILE         = (int)(0x00010000),
+       SPOOLSS_PRINTER_INFO_SERVERNAME      = (int)(0x00020000),
+       SPOOLSS_PRINTER_INFO_SHARENAME       = (int)(0x00040000),
+       SPOOLSS_PRINTER_INFO_STARTTIME       = (int)(0x00080000),
+       SPOOLSS_PRINTER_INFO_STATUS          = (int)(0x00100000),
+       SPOOLSS_PRINTER_INFO_UNTILTIME       = (int)(0x00200000)
+};
+
+#define SPOOLSS_PRINTER_INFO_ALL SPOOLSS_PRINTER_INFO_ATTRIBUTES      | \
+                                 SPOOLSS_PRINTER_INFO_AVERAGEPPM      | \
+                                 SPOOLSS_PRINTER_INFO_CJOBS           | \
+                                 SPOOLSS_PRINTER_INFO_COMMENT         | \
+                                 SPOOLSS_PRINTER_INFO_DATATYPE        | \
+                                 SPOOLSS_PRINTER_INFO_DEFAULTPRIORITY | \
+                                 SPOOLSS_PRINTER_INFO_DEVMODE         | \
+                                 SPOOLSS_PRINTER_INFO_DRIVERNAME      | \
+                                 SPOOLSS_PRINTER_INFO_LOCATION        | \
+                                 SPOOLSS_PRINTER_INFO_NAME            | \
+                                 SPOOLSS_PRINTER_INFO_PARAMETERS      | \
+                                 SPOOLSS_PRINTER_INFO_PORTNAME        | \
+                                 SPOOLSS_PRINTER_INFO_PRINTERNAME     | \
+                                 SPOOLSS_PRINTER_INFO_PRINTPROCESSOR  | \
+                                 SPOOLSS_PRINTER_INFO_PRIORITY        | \
+                                 SPOOLSS_PRINTER_INFO_SECDESC         | \
+                                 SPOOLSS_PRINTER_INFO_SEPFILE         | \
+                                 SPOOLSS_PRINTER_INFO_SERVERNAME      | \
+                                 SPOOLSS_PRINTER_INFO_SHARENAME       | \
+                                 SPOOLSS_PRINTER_INFO_STARTTIME       | \
+                                 SPOOLSS_PRINTER_INFO_STATUS          | \
+                                 SPOOLSS_PRINTER_INFO_UNTILTIME
+
+WERROR winreg_create_printer(TALLOC_CTX *mem_ctx,
+                            struct auth_serversupplied_info *server_info,
+                            struct messaging_context *msg_ctx,
+                            const char *servername,
+                            const char *sharename);
+
+/**
+ * @internal
+ *
+ * @brief Update the information of a printer in the registry.
+ *
+ * @param[in]  mem_ctx  The talloc memory context to use.
+ *
+ * @param[in]  server_info The server supplied session info.
+ *
+ * @param[in]  sharename  The share name.
+ *
+ * @param[in]  info2_mask A bitmask which defines which values should be set.
+ *
+ * @param[in]  info2    A SetPrinterInfo2 structure with the data to set.
+ *
+ * @param[in]  devmode  A device mode structure with the data to set.
+ *
+ * @param[in]  secdesc  A security descriptor structure with the data to set.
+ *
+ * @return              On success WERR_OK, a corresponding DOS error is
+ *                      something went wrong.
+ */
+WERROR winreg_update_printer(TALLOC_CTX *mem_ctx,
+                            struct auth_serversupplied_info *server_info,
+                            struct messaging_context *msg_ctx,
+                            const char *sharename,
+                            uint32_t info2_mask,
+                            struct spoolss_SetPrinterInfo2 *info2,
+                            struct spoolss_DeviceMode *devmode,
+                            struct security_descriptor *secdesc);
+
+
+/**
+ * @brief Get the inforamtion of a printer stored in the registry.
+ *
+ * @param[in]  mem_ctx  The talloc memory context to use.
+ *
+ * @param[in]  server_info The server supplied session info.
+ *
+ * @param[in]  printer  The servername to use.
+ *
+ * @param[in]  printer  The name of the printer to get.
+ *
+ * @param[out] pinfo2   A pointer to store a PRINTER_INFO_2 structure.
+ *
+ * @return              On success WERR_OK, a corresponding DOS error is
+ *                      something went wrong.
+ */
+WERROR winreg_get_printer(TALLOC_CTX *mem_ctx,
+                         struct auth_serversupplied_info *server_info,
+                         struct messaging_context *msg_ctx,
+                         const char *servername,
+                         const char *printer,
+                         struct spoolss_PrinterInfo2 **pinfo2);
+
+/**
+ * @brief Get the security descriptor for a printer.
+ *
+ * @param[in]  mem_ctx  The talloc memory context to use.
+ *
+ * @param[in]  server_info The server supplied session info.
+ *
+ * @param[in]  sharename  The share name.
+ *
+ * @param[out] psecdesc   A pointer to store the security descriptor.
+ *
+ * @return              On success WERR_OK, a corresponding DOS error is
+ *                      something went wrong.
+ */
+WERROR winreg_get_printer_secdesc(TALLOC_CTX *mem_ctx,
+                                 struct auth_serversupplied_info *server_info,
+                                 struct messaging_context *msg_ctx,
+                                 const char *sharename,
+                                 struct spoolss_security_descriptor **psecdesc);
+
+/**
+ * @brief Set the security descriptor for a printer.
+ *
+ * @param[in]  mem_ctx  The talloc memory context to use.
+ *
+ * @param[in]  server_info The server supplied session info.
+ *
+ * @param[in]  sharename  The share name.
+ *
+ * @param[in]  secdesc  The security descriptor to save.
+ *
+ * @return              On success WERR_OK, a corresponding DOS error is
+ *                      something went wrong.
+ */
+WERROR winreg_set_printer_secdesc(TALLOC_CTX *mem_ctx,
+                                 struct auth_serversupplied_info *server_info,
+                                 struct messaging_context *msg_ctx,
+                                 const char *sharename,
+                                 const struct spoolss_security_descriptor *secdesc);
+
 /**
  * @internal
  *
  */
 WERROR winreg_set_printer_dataex(TALLOC_CTX *mem_ctx,
                                 struct auth_serversupplied_info *server_info,
+                                struct messaging_context *msg_ctx,
                                 const char *printer,
                                 const char *key,
                                 const char *value,
@@ -81,6 +232,7 @@ WERROR winreg_set_printer_dataex(TALLOC_CTX *mem_ctx,
  */
 WERROR winreg_get_printer_dataex(TALLOC_CTX *mem_ctx,
                                 struct auth_serversupplied_info *server_info,
+                                struct messaging_context *msg_ctx,
                                 const char *printer,
                                 const char *key,
                                 const char *value,
@@ -110,6 +262,7 @@ WERROR winreg_get_printer_dataex(TALLOC_CTX *mem_ctx,
  */
 WERROR winreg_enum_printer_dataex(TALLOC_CTX *mem_ctx,
                                  struct auth_serversupplied_info *server_info,
+                                 struct messaging_context *msg_ctx,
                                  const char *printer,
                                  const char *key,
                                  uint32_t *pnum_values,
@@ -135,6 +288,7 @@ WERROR winreg_enum_printer_dataex(TALLOC_CTX *mem_ctx,
  */
 WERROR winreg_delete_printer_dataex(TALLOC_CTX *mem_ctx,
                                    struct auth_serversupplied_info *server_info,
+                                   struct messaging_context *msg_ctx,
                                    const char *printer,
                                    const char *key,
                                    const char *value);
@@ -162,6 +316,7 @@ WERROR winreg_delete_printer_dataex(TALLOC_CTX *mem_ctx,
  */
 WERROR winreg_enum_printer_key(TALLOC_CTX *mem_ctx,
                               struct auth_serversupplied_info *server_info,
+                              struct messaging_context *msg_ctx,
                               const char *printer,
                               const char *key,
                               uint32_t *pnum_subkeys,
@@ -185,6 +340,7 @@ WERROR winreg_enum_printer_key(TALLOC_CTX *mem_ctx,
  */
 WERROR winreg_delete_printer_key(TALLOC_CTX *mem_ctx,
                                 struct auth_serversupplied_info *server_info,
+                                struct messaging_context *msg_ctx,
                                 const char *printer,
                                 const char *key);
 
@@ -208,6 +364,7 @@ WERROR winreg_delete_printer_key(TALLOC_CTX *mem_ctx,
  */
 WERROR winreg_printer_update_changeid(TALLOC_CTX *mem_ctx,
                                      struct auth_serversupplied_info *server_info,
+                                     struct messaging_context *msg_ctx,
                                      const char *printer);
 
 /**
@@ -226,6 +383,7 @@ WERROR winreg_printer_update_changeid(TALLOC_CTX *mem_ctx,
  */
 WERROR winreg_printer_get_changeid(TALLOC_CTX *mem_ctx,
                                   struct auth_serversupplied_info *server_info,
+                                  struct messaging_context *msg_ctx,
                                   const char *printer,
                                   uint32_t *pchangeid);
 
@@ -248,6 +406,7 @@ WERROR winreg_printer_get_changeid(TALLOC_CTX *mem_ctx,
  */
 WERROR winreg_printer_addform1(TALLOC_CTX *mem_ctx,
                               struct auth_serversupplied_info *server_info,
+                              struct messaging_context *msg_ctx,
                               struct spoolss_AddFormInfo1 *form);
 
 /*
@@ -329,4 +488,99 @@ WERROR winreg_printer_getform1(TALLOC_CTX *mem_ctx,
                               const char *form_name,
                               struct spoolss_FormInfo1 *form);
 
+/**
+ * @brief This function adds a new spool driver
+ *
+ * @param[in]  mem_ctx        A talloc memory context.
+ *
+ * @param[in]  server_info     Auth info to open the pipe.
+ *
+ * @param[in]  r              The structure containing the new driver data.
+ *
+ * @param[out] driver_name     Returns the driver name.
+ *
+ * @param[out] driver_version  Returns the driver version.
+ *
+ * @return              On success WERR_OK, a corresponding DOS error is
+ *                      something went wrong.
+ */
+WERROR winreg_add_driver(TALLOC_CTX *mem_ctx,
+                        struct auth_serversupplied_info *server_info,
+                        struct spoolss_AddDriverInfoCtr *r,
+                        const char **driver_name,
+                        uint32_t *driver_version);
+
+/**
+ * @brief This function gets printer driver information
+ *
+ * @param[in]  mem_ctx        A talloc memory context.
+ *
+ * @param[in]  server_info     Auth info to open the pipe.
+ *
+ * @param[in]  architecture    The architecture type.
+ *
+ * @param[in]  driver_name     The driver name.
+ *
+ * @param[in]  driver_version  The driver version.
+ *
+ * @param[out] _info8   The structure that holds the full driver information.
+ *
+ * @return              On success WERR_OK, a corresponding DOS error is
+ *                      something went wrong.
+ */
+
+WERROR winreg_get_driver(TALLOC_CTX *mem_ctx,
+                        struct auth_serversupplied_info *server_info,
+                        const char *architecture,
+                        const char *driver_name,
+                        uint32_t driver_version,
+                        struct spoolss_DriverInfo8 **_info8);
+
+/**
+ * @brief This function deletes a printer driver information
+ *
+ * @param[in]  mem_ctx        A talloc memory context.
+ *
+ * @param[in]  server_info     Auth info to open the pipe.
+ *
+ * @param[out] info8    The structure that holds the full driver information.
+ *
+ * @param[in]  version  The driver type version.
+ *
+ * @return              On success WERR_OK, a corresponding DOS error is
+ *                      something went wrong.
+ */
+
+WERROR winreg_del_driver(TALLOC_CTX *mem_ctx,
+                        struct auth_serversupplied_info *server_info,
+                        struct spoolss_DriverInfo8 *info8,
+                        uint32_t version);
+
+/**
+ * @brief This function gets printer drivers list for the specified
+ *        architecture and type version
+ *
+ * @param[in]  mem_ctx        A talloc memory context.
+ *
+ * @param[in]  server_info     Auth info to open the pipe.
+ *
+ * @param[in]  architecture    The architecture type.
+ *
+ * @param[in]  version         The driver version.
+ *
+ * @param[out] num_drivers     The number of drivers.
+ *
+ * @param[out] version         The drivers names.
+ *
+ * @return              On success WERR_OK, a corresponding DOS error is
+ *                      something went wrong.
+ */
+
+WERROR winreg_get_driver_list(TALLOC_CTX *mem_ctx,
+                             struct auth_serversupplied_info *server_info,
+                             const char *architecture,
+                             uint32_t version,
+                             uint32_t *num_drivers,
+                             const char ***drivers);
+
 #endif /* _SRV_SPOOLSS_UITL_H */