libsmbconf: rewrite API to use smbconf_service struct
[Samba.git] / source / lib / smbconf / smbconf.h
blobe3374766652550dd86daeaff28d118267e89cee5
1 /*
2 * Unix SMB/CIFS implementation.
3 * libsmbconf - Samba configuration library
4 * Copyright (C) Michael Adam 2008
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.
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.
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/>.
20 #ifndef __LIBSMBCONF_H__
21 #define __LIBSMBCONF_H__
23 struct smbconf_ctx;
25 /* the change sequence number */
26 struct smbconf_csn {
27 uint64_t csn;
30 struct smbconf_service {
31 char *name;
32 uint32_t num_params;
33 char **param_names;
34 char **param_values;
38 /**
39 * intialization dispatcher function.
40 * takes source string in the form of "backend:path"
42 WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
43 const char *source);
45 /**
46 * initialization functions for the available modules
49 WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx,
50 const char *path);
52 WERROR smbconf_init_txt(TALLOC_CTX *mem_ctx,
53 struct smbconf_ctx **conf_ctx,
54 const char *path);
57 * the smbconf API functions
59 void smbconf_shutdown(struct smbconf_ctx *ctx);
60 bool smbconf_changed(struct smbconf_ctx *ctx, struct smbconf_csn *csn,
61 const char *service, const char *param);
62 WERROR smbconf_drop(struct smbconf_ctx *ctx);
63 WERROR smbconf_get_config(struct smbconf_ctx *ctx,
64 TALLOC_CTX *mem_ctx,
65 uint32_t *num_shares,
66 struct smbconf_service ***services);
67 WERROR smbconf_get_share_names(struct smbconf_ctx *ctx,
68 TALLOC_CTX *mem_ctx,
69 uint32_t *num_shares,
70 char ***share_names);
71 bool smbconf_share_exists(struct smbconf_ctx *ctx, const char *servicename);
72 WERROR smbconf_create_share(struct smbconf_ctx *ctx, const char *servicename);
73 WERROR smbconf_get_share(struct smbconf_ctx *ctx,
74 TALLOC_CTX *mem_ctx,
75 const char *servicename,
76 struct smbconf_service **service);
77 WERROR smbconf_delete_share(struct smbconf_ctx *ctx,
78 const char *servicename);
79 WERROR smbconf_set_parameter(struct smbconf_ctx *ctx,
80 const char *service,
81 const char *param,
82 const char *valstr);
83 WERROR smbconf_set_global_parameter(struct smbconf_ctx *ctx,
84 const char *param, const char *val);
85 WERROR smbconf_get_parameter(struct smbconf_ctx *ctx,
86 TALLOC_CTX *mem_ctx,
87 const char *service,
88 const char *param,
89 char **valstr);
90 WERROR smbconf_get_global_parameter(struct smbconf_ctx *ctx,
91 TALLOC_CTX *mem_ctx,
92 const char *param,
93 char **valstr);
94 WERROR smbconf_delete_parameter(struct smbconf_ctx *ctx,
95 const char *service, const char *param);
96 WERROR smbconf_delete_global_parameter(struct smbconf_ctx *ctx,
97 const char *param);
98 WERROR smbconf_get_includes(struct smbconf_ctx *ctx,
99 TALLOC_CTX *mem_ctx,
100 const char *service,
101 uint32_t *num_includes, char ***includes);
102 WERROR smbconf_get_global_includes(struct smbconf_ctx *ctx,
103 TALLOC_CTX *mem_ctx,
104 uint32_t *num_includes, char ***includes);
105 WERROR smbconf_set_includes(struct smbconf_ctx *ctx,
106 const char *service,
107 uint32_t num_includes, const char **includes);
108 WERROR smbconf_set_global_includes(struct smbconf_ctx *ctx,
109 uint32_t num_includes,
110 const char **includes);
111 WERROR smbconf_delete_includes(struct smbconf_ctx *ctx, const char *service);
112 WERROR smbconf_delete_global_includes(struct smbconf_ctx *ctx);
114 #endif /* _LIBSMBCONF_H_ */