s4:rpc_server/lsa: only return collision_info if filled in lsaRSetForestTrustInformat...
[Samba.git] / lib / param / param.h
blob5e8d2bdb16a762e722d54f37bafb5b87123a3c3a
1 /*
2 Unix SMB/CIFS implementation.
3 Generic parameter parsing interface
4 Copyright (C) Jelmer Vernooij 2005
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 _PARAM_H /* _PARAM_H */
21 #define _PARAM_H
23 struct loadparm_s3_helpers;
25 struct parmlist_entry;
27 struct param_context {
28 struct param_section *sections;
31 struct param_section {
32 const char *name;
33 struct param_section *prev, *next;
34 struct parmlist *parameters;
37 struct param_context;
38 struct smbsrv_connection;
40 #define Auto (2)
42 #include "libds/common/roles.h"
44 struct loadparm_context;
45 struct loadparm_service;
46 struct smbcli_options;
47 struct smbcli_session_options;
48 struct gensec_settings;
49 struct bitmap;
50 struct file_lists;
52 #ifdef CONFIG_H_IS_FROM_SAMBA
53 #include "lib/param/param_proto.h"
54 #include "lib/param/param_functions.h"
55 #endif
57 const char **lpcfg_interfaces(struct loadparm_context *);
58 const char *lpcfg_realm(struct loadparm_context *);
59 const char *lpcfg_netbios_name(struct loadparm_context *);
60 const char *lpcfg_private_dir(struct loadparm_context *);
61 int lpcfg_server_role(struct loadparm_context *);
62 int lpcfg_allow_dns_updates(struct loadparm_context *);
64 void reload_charcnv(struct loadparm_context *lp_ctx);
66 struct loadparm_service *lpcfg_default_service(struct loadparm_context *lp_ctx);
67 bool lpcfg_autoloaded(struct loadparm_service *, struct loadparm_service *);
69 char *lpcfg_tls_keyfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
70 char *lpcfg_tls_certfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
71 char *lpcfg_tls_cafile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
72 char *lpcfg_tls_dhpfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
73 char *lpcfg_tls_crlfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
75 const char *lpcfg_dnsdomain(struct loadparm_context *);
77 const char *lpcfg_servicename(const struct loadparm_service *service);
80 const char *lpcfg_get_parametric(struct loadparm_context *lp_ctx,
81 struct loadparm_service *service,
82 const char *type, const char *option);
84 const char *lpcfg_parm_string(struct loadparm_context *lp_ctx,
85 struct loadparm_service *service, const char *type,
86 const char *option);
87 const char **lpcfg_parm_string_list(TALLOC_CTX *mem_ctx,
88 struct loadparm_context *lp_ctx,
89 struct loadparm_service *service,
90 const char *type,
91 const char *option, const char *separator);
92 int lpcfg_parm_int(struct loadparm_context *lp_ctx,
93 struct loadparm_service *service, const char *type,
94 const char *option, int default_v);
95 int lpcfg_parm_bytes(struct loadparm_context *lp_ctx,
96 struct loadparm_service *service, const char *type,
97 const char *option, int default_v);
98 unsigned long lpcfg_parm_ulong(struct loadparm_context *lp_ctx,
99 struct loadparm_service *service, const char *type,
100 const char *option, unsigned long default_v);
101 long lpcfg_parm_long(struct loadparm_context *lp_ctx,
102 struct loadparm_service *service, const char *type,
103 const char *option, long default_v);
104 double lpcfg_parm_double(struct loadparm_context *lp_ctx,
105 struct loadparm_service *service, const char *type,
106 const char *option, double default_v);
107 bool lpcfg_parm_bool(struct loadparm_context *lp_ctx,
108 struct loadparm_service *service, const char *type,
109 const char *option, bool default_v);
110 struct loadparm_service *lpcfg_add_service(struct loadparm_context *lp_ctx,
111 const struct loadparm_service *pservice,
112 const char *name);
113 bool lpcfg_add_home(struct loadparm_context *lp_ctx,
114 const char *pszHomename,
115 struct loadparm_service *default_service,
116 const char *user, const char *pszHomedir);
117 bool lpcfg_add_printer(struct loadparm_context *lp_ctx,
118 const char *pszPrintername,
119 struct loadparm_service *default_service);
120 struct parm_struct *lpcfg_parm_struct(struct loadparm_context *lp_ctx, const char *name);
121 void *lpcfg_parm_ptr(struct loadparm_context *lp_ctx,
122 struct loadparm_service *service, struct parm_struct *parm);
123 bool lpcfg_parm_is_cmdline(struct loadparm_context *lp_ctx, const char *name);
124 bool lpcfg_file_list_changed(struct loadparm_context *lp_ctx);
126 bool lpcfg_do_global_parameter(struct loadparm_context *lp_ctx,
127 const char *pszParmName, const char *pszParmValue);
128 bool lpcfg_do_service_parameter(struct loadparm_context *lp_ctx,
129 struct loadparm_service *service,
130 const char *pszParmName, const char *pszParmValue);
133 * Process a parameter.
135 bool lpcfg_do_global_parameter_var(struct loadparm_context *lp_ctx,
136 const char *pszParmName, const char *fmt, ...);
137 bool lpcfg_set_cmdline(struct loadparm_context *lp_ctx, const char *pszParmName,
138 const char *pszParmValue);
139 bool lpcfg_set_option(struct loadparm_context *lp_ctx, const char *option);
142 * Display the contents of a single services record.
144 bool lpcfg_dump_a_parameter(struct loadparm_context *lp_ctx,
145 struct loadparm_service *service,
146 const char *parm_name, FILE * f);
149 * Unload unused services.
151 void lpcfg_killunused(struct loadparm_context *lp_ctx,
152 struct smbsrv_connection *smb,
153 bool (*snumused) (struct smbsrv_connection *, int));
156 * Initialise the global parameter structure.
158 struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx);
159 struct loadparm_context *loadparm_init_global(bool load_default);
160 const char *lpcfg_configfile(struct loadparm_context *lp_ctx);
161 bool lpcfg_load_default(struct loadparm_context *lp_ctx);
162 const char *lp_default_path(void);
165 * Load the services array from the services file.
167 * Return True on success, False on failure.
169 bool lpcfg_load(struct loadparm_context *lp_ctx, const char *filename);
172 * Return the max number of services.
174 int lpcfg_numservices(struct loadparm_context *lp_ctx);
177 * Display the contents of the services array in human-readable form.
179 void lpcfg_dump(struct loadparm_context *lp_ctx, FILE *f, bool show_defaults,
180 int maxtoprint);
183 * Display the contents of one service in human-readable form.
185 void lpcfg_dump_one(FILE *f, bool show_defaults, struct loadparm_service *service, struct loadparm_service *sDefault);
186 struct loadparm_service *lpcfg_servicebynum(struct loadparm_context *lp_ctx,
187 int snum);
188 struct loadparm_service *lpcfg_service(struct loadparm_context *lp_ctx,
189 const char *service_name);
192 * A useful volume label function.
194 const char *lp_cfg_volume_label(struct loadparm_service *service, struct loadparm_service *sDefault);
197 * If we are PDC then prefer us as DMB
199 const char *lpcfg_printername(struct loadparm_service *service, struct loadparm_service *sDefault);
202 * Return the max print jobs per queue.
204 int lpcfg_maxprintjobs(struct loadparm_service *service, struct loadparm_service *sDefault);
205 struct smb_iconv_handle *lpcfg_iconv_handle(struct loadparm_context *lp_ctx);
206 void lpcfg_smbcli_options(struct loadparm_context *lp_ctx,
207 struct smbcli_options *options);
208 void lpcfg_smbcli_session_options(struct loadparm_context *lp_ctx,
209 struct smbcli_session_options *options);
210 const char **lpcfg_smb_ports(struct loadparm_context *);
211 const char *lpcfg_socket_options(struct loadparm_context *);
212 struct dcerpc_server_info *lpcfg_dcerpc_server_info(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx);
213 struct gensec_settings *lpcfg_gensec_settings(TALLOC_CTX *, struct loadparm_context *);
216 /* The following definitions come from param/util.c */
220 * @file
221 * @brief Misc utility functions
223 bool lpcfg_is_mydomain(struct loadparm_context *lp_ctx,
224 const char *domain);
226 bool lpcfg_is_my_domain_or_realm(struct loadparm_context *lp_ctx,
227 const char *domain);
230 see if a string matches either our primary or one of our secondary
231 netbios aliases. do a case insensitive match
233 bool lpcfg_is_myname(struct loadparm_context *lp_ctx, const char *name);
236 A useful function for returning a path in the Samba lock directory.
238 char *lpcfg_lock_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
239 const char *name);
242 * @brief Returns an absolute path to a file in the directory containing the current config file
244 * @param name File to find, relative to the config file directory.
246 * @retval Pointer to a talloc'ed string containing the full path.
248 char *lpcfg_config_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
249 const char *name);
252 * @brief Returns an absolute path to a file in the Samba private directory.
254 * @param name File to find, relative to PRIVATEDIR.
255 * if name is not relative, then use it as-is
257 * @retval Pointer to a talloc'ed string containing the full path.
259 char *lpcfg_private_path(TALLOC_CTX* mem_ctx,
260 struct loadparm_context *lp_ctx,
261 const char *name);
264 * @brief Returns an absolute path to a NTDB or TDB file in the Samba
265 * private directory.
267 * @param name File to find, relative to PRIVATEDIR, without .(n)tdb extension.
268 * Only provide fixed-string names which are supposed to change with "use ntdb"
269 * option.
271 * @retval Pointer to a talloc'ed string containing the full path, for
272 * use with dbwrap_local_open().
274 char *lpcfg_private_db_path(TALLOC_CTX *mem_ctx,
275 struct loadparm_context *lp_ctx,
276 const char *name);
279 return a path in the smbd.tmp directory, where all temporary file
280 for smbd go. If NULL is passed for name then return the directory
281 path itself
283 char *smbd_tmp_path(TALLOC_CTX *mem_ctx,
284 struct loadparm_context *lp_ctx,
285 const char *name);
287 const char *lpcfg_imessaging_path(TALLOC_CTX *mem_ctx,
288 struct loadparm_context *lp_ctx);
289 struct smb_iconv_handle *smb_iconv_handle_reinit_lp(TALLOC_CTX *mem_ctx,
290 struct loadparm_context *lp_ctx,
291 struct smb_iconv_handle *old_ic);
293 const char *lpcfg_sam_name(struct loadparm_context *lp_ctx);
295 void lpcfg_default_kdc_policy(struct loadparm_context *lp_ctx,
296 time_t *svc_tkt_lifetime,
297 time_t *usr_tkt_lifetime,
298 time_t *renewal_lifetime);
300 /* The following definitions come from lib/version.c */
302 const char *samba_version_string(void);
305 #endif /* _PARAM_H */