[s3]libsmbconf: add backend_requires_messaging() method to libsmbconf.
[ira/wip.git] / source3 / lib / smbconf / smbconf_private.h
1 /*
2  *  Unix SMB/CIFS implementation.
3  *  libsmbconf - Samba configuration library
4  *  Copyright (C) Michael Adam 2008
5  *
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.
10  *
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.
15  *
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/>.
18  */
19
20 #ifndef __LIBSMBCONF_PRIVATE_H__
21 #define __LIBSMBCONF_PRIVATE_H__
22
23 struct smbconf_ops {
24         WERROR (*init)(struct smbconf_ctx *ctx, const char *path);
25         int (*shutdown)(struct smbconf_ctx *ctx);
26         bool (*requires_messaging)(struct smbconf_ctx *ctx);
27         WERROR (*open_conf)(struct smbconf_ctx *ctx);
28         int (*close_conf)(struct smbconf_ctx *ctx);
29         void (*get_csn)(struct smbconf_ctx *ctx, struct smbconf_csn *csn,
30                         const char *service, const char *param);
31         WERROR (*drop)(struct smbconf_ctx *ctx);
32         WERROR (*get_share_names)(struct smbconf_ctx *ctx,
33                                   TALLOC_CTX *mem_ctx,
34                                   uint32_t *num_shares,
35                                   char ***share_names);
36         bool (*share_exists)(struct smbconf_ctx *ctx, const char *service);
37         WERROR (*create_share)(struct smbconf_ctx *ctx, const char *service);
38         WERROR (*get_share)(struct smbconf_ctx *ctx,
39                             TALLOC_CTX *mem_ctx,
40                             const char *servicename,
41                             struct smbconf_service **service);
42         WERROR (*delete_share)(struct smbconf_ctx *ctx,
43                                     const char *servicename);
44         WERROR (*set_parameter)(struct smbconf_ctx *ctx,
45                                 const char *service,
46                                 const char *param,
47                                 const char *valstr);
48         WERROR (*get_parameter)(struct smbconf_ctx *ctx,
49                                 TALLOC_CTX *mem_ctx,
50                                 const char *service,
51                                 const char *param,
52                                 char **valstr);
53         WERROR (*delete_parameter)(struct smbconf_ctx *ctx,
54                                    const char *service, const char *param);
55         WERROR (*get_includes)(struct smbconf_ctx *ctx,
56                                TALLOC_CTX *mem_ctx,
57                                const char *service,
58                                uint32_t *num_includes, char ***includes);
59         WERROR (*set_includes)(struct smbconf_ctx *ctx,
60                                const char *service,
61                                uint32_t num_includes, const char **includes);
62         WERROR (*delete_includes)(struct smbconf_ctx *ctx,
63                                   const char *service);
64 };
65
66 struct smbconf_ctx {
67         const char *path;
68         struct smbconf_ops *ops;
69         void *data; /* private data for use in backends */
70 };
71
72 WERROR smbconf_init_internal(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
73                              const char *path, struct smbconf_ops *ops);
74
75 WERROR smbconf_add_string_to_array(TALLOC_CTX *mem_ctx,
76                                    char ***array,
77                                    uint32_t count,
78                                    const char *string);
79
80 bool smbconf_find_in_array(const char *string, char **list,
81                            uint32_t num_entries, uint32_t *entry);
82
83 bool smbconf_reverse_find_in_array(const char *string, char **list,
84                                    uint32_t num_entries, uint32_t *entry);
85
86 #endif