481c2b169396aadd4730b09932fd8ebed130c11c
[kai/samba.git] / source / lib / smbconf / smbconf.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_H__
21 #define __LIBSMBCONF_H__
22
23 struct smbconf_ctx;
24
25 /* the change sequence number */
26 struct smbconf_csn {
27         uint64_t csn;
28 };
29
30 /*
31  * initialization functions for the available modules
32  */
33
34 WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
35                     const char *source);
36
37 WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
38                         const char *path);
39
40 WERROR smbconf_init_txt_simple(TALLOC_CTX *mem_ctx,
41                                struct smbconf_ctx **conf_ctx,
42                                const char *path);
43
44 /*
45  * the smbconf API functions
46  */
47 void smbconf_shutdown(struct smbconf_ctx *ctx);
48 bool smbconf_changed(struct smbconf_ctx *ctx, struct smbconf_csn *csn,
49                      const char *service, const char *param);
50 WERROR smbconf_drop(struct smbconf_ctx *ctx);
51 WERROR smbconf_get_config(struct smbconf_ctx *ctx,
52                           TALLOC_CTX *mem_ctx,
53                           uint32_t *num_shares,
54                           char ***share_names, uint32_t **num_params,
55                           char ****param_names, char ****param_values);
56 WERROR smbconf_get_share_names(struct smbconf_ctx *ctx,
57                                TALLOC_CTX *mem_ctx,
58                                uint32_t *num_shares,
59                                char ***share_names);
60 bool smbconf_share_exists(struct smbconf_ctx *ctx, const char *servicename);
61 WERROR smbconf_create_share(struct smbconf_ctx *ctx, const char *servicename);
62 WERROR smbconf_get_share(struct smbconf_ctx *ctx,
63                          TALLOC_CTX *mem_ctx,
64                          const char *servicename, uint32_t *num_params,
65                          char ***param_names, char ***param_values);
66 WERROR smbconf_delete_share(struct smbconf_ctx *ctx,
67                             const char *servicename);
68 WERROR smbconf_set_parameter(struct smbconf_ctx *ctx,
69                              const char *service,
70                              const char *param,
71                              const char *valstr);
72 WERROR smbconf_set_global_parameter(struct smbconf_ctx *ctx,
73                                     const char *param, const char *val);
74 WERROR smbconf_get_parameter(struct smbconf_ctx *ctx,
75                              TALLOC_CTX *mem_ctx,
76                              const char *service,
77                              const char *param,
78                              char **valstr);
79 WERROR smbconf_get_global_parameter(struct smbconf_ctx *ctx,
80                                     TALLOC_CTX *mem_ctx,
81                                     const char *param,
82                                     char **valstr);
83 WERROR smbconf_delete_parameter(struct smbconf_ctx *ctx,
84                                 const char *service, const char *param);
85 WERROR smbconf_delete_global_parameter(struct smbconf_ctx *ctx,
86                                        const char *param);
87 WERROR smbconf_get_includes(struct smbconf_ctx *ctx,
88                             TALLOC_CTX *mem_ctx,
89                             const char *service,
90                             uint32_t *num_includes, char ***includes);
91 WERROR smbconf_get_global_includes(struct smbconf_ctx *ctx,
92                                    TALLOC_CTX *mem_ctx,
93                                    uint32_t *num_includes, char ***includes);
94 WERROR smbconf_set_includes(struct smbconf_ctx *ctx,
95                             const char *service,
96                             uint32_t num_includes, const char **includes);
97 WERROR smbconf_set_global_includes(struct smbconf_ctx *ctx,
98                                    uint32_t num_includes,
99                                    const char **includes);
100 WERROR smbconf_delete_includes(struct smbconf_ctx *ctx, const char *service);
101 WERROR smbconf_delete_global_includes(struct smbconf_ctx *ctx);
102
103 #endif /*  _LIBSMBCONF_H_  */