s3-srvsvc: Use struct pipes_struct.
[Samba/gbeck.git] / source4 / param / param.h
blob15ea564c403c6c85bb732003aac3b7e230e62ae8
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 parmlist_entry;
25 struct param_context {
26 struct param_section *sections;
29 struct param_section {
30 const char *name;
31 struct param_section *prev, *next;
32 struct parmlist *parameters;
35 struct param_context;
36 struct smbsrv_connection;
38 #define Auto (2)
40 typedef NTSTATUS (*init_module_fn) (void);
42 /* this needs to be a string which is not in the C library. We
43 previously used "init_module", but that meant that modules which
44 did not define this function ended up calling the C library
45 function init_module() which makes a system call */
46 #define SAMBA_INIT_MODULE "samba_init_module"
48 enum server_role {
49 ROLE_STANDALONE=0,
50 ROLE_DOMAIN_MEMBER=1,
51 ROLE_DOMAIN_CONTROLLER=2,
54 enum sid_generator {
55 SID_GENERATOR_INTERNAL=0,
56 SID_GENERATOR_BACKEND=1,
59 enum announce_as {/* Types of machine we can announce as. */
60 ANNOUNCE_AS_NT_SERVER=1,
61 ANNOUNCE_AS_WIN95=2,
62 ANNOUNCE_AS_WFW=3,
63 ANNOUNCE_AS_NT_WORKSTATION=4
66 struct loadparm_context;
67 struct loadparm_service;
68 struct smbcli_options;
69 struct smbcli_session_options;
70 struct gensec_settings;
72 void reload_charcnv(struct loadparm_context *lp_ctx);
74 struct loadparm_service *lpcfg_default_service(struct loadparm_context *lp_ctx);
75 struct parm_struct *lpcfg_parm_table(void);
78 #define DECL_GLOBAL_STRING(fn_name) \
79 const char *lpcfg_ ## fn_name(struct loadparm_context *lp_ctx); \
80 const char *lp_ ## fn_name(void)
82 #define DECL_GLOBAL_CONST_STRING(fn_name) \
83 const char *lpcfg_ ## fn_name(struct loadparm_context *lp_ctx); \
84 const char *lp_ ## fn_name(void)
86 #define DECL_GLOBAL_LIST(fn_name) \
87 const char **lpcfg_ ## fn_name(struct loadparm_context *lp_ctx); \
88 const char **lp_ ## fn_name(void)
90 #define DECL_GLOBAL_BOOL(fn_name) \
91 bool lpcfg_ ## fn_name(struct loadparm_context *lp_ctx); \
92 bool lp_ ## fn_name(void)
94 #define DECL_GLOBAL_INTEGER(fn_name) \
95 int lpcfg_ ## fn_name(struct loadparm_context *lp_ctx); \
96 int lp_ ## fn_name(void)
98 #define DECL_LOCAL_STRING(fn_name) \
99 const char *lpcfg_ ## fn_name(struct loadparm_service *service, struct loadparm_service *sDefault); \
100 const char *lp_ ## fn_name(int i)
102 #define DECL_LOCAL_LIST(fn_name) \
103 const char **lpcfg_ ## fn_name(struct loadparm_service *service, struct loadparm_service *sDefault); \
104 const char **lp_ ## fn_name(int i)
106 #define DECL_LOCAL_BOOL(fn_name) \
107 bool lpcfg_ ## fn_name(struct loadparm_service *service, struct loadparm_service *sDefault); \
108 bool lp_ ## fn_name(int i)
110 #define DECL_LOCAL_INTEGER(fn_name) \
111 int lpcfg_ ## fn_name(struct loadparm_service *service, struct loadparm_service *sDefault); \
112 int lp_ ## fn_name(int i)
115 DECL_GLOBAL_INTEGER(server_role);
116 DECL_GLOBAL_INTEGER(sid_generator);
117 DECL_GLOBAL_LIST(smb_ports);
118 DECL_GLOBAL_INTEGER(nbt_port);
119 DECL_GLOBAL_INTEGER(dgram_port);
120 DECL_GLOBAL_INTEGER(cldap_port);
121 DECL_GLOBAL_INTEGER(krb5_port);
122 DECL_GLOBAL_INTEGER(kpasswd_port);
123 DECL_GLOBAL_INTEGER(web_port);
124 DECL_GLOBAL_BOOL(tls_enabled);
125 DECL_GLOBAL_STRING(share_backend);
126 DECL_GLOBAL_STRING(sam_url);
127 DECL_GLOBAL_STRING(idmap_url);
128 DECL_GLOBAL_STRING(secrets_url);
129 DECL_GLOBAL_STRING(spoolss_url);
130 DECL_GLOBAL_STRING(wins_config_url);
131 DECL_GLOBAL_STRING(wins_url);
132 DECL_GLOBAL_CONST_STRING(winbind_separator);
133 DECL_GLOBAL_CONST_STRING(winbindd_socket_directory);
134 DECL_GLOBAL_CONST_STRING(winbindd_privileged_socket_directory);
135 DECL_GLOBAL_CONST_STRING(template_shell);
136 DECL_GLOBAL_CONST_STRING(template_homedir);
137 DECL_GLOBAL_BOOL(winbind_sealed_pipes);
138 DECL_GLOBAL_BOOL(idmap_trusted_only);
139 DECL_GLOBAL_STRING(private_dir);
140 DECL_GLOBAL_STRING(serverstring);
141 DECL_GLOBAL_STRING(lockdir);
142 DECL_GLOBAL_STRING(modulesdir);
143 DECL_GLOBAL_STRING(setupdir);
144 DECL_GLOBAL_STRING(ncalrpc_dir);
145 DECL_GLOBAL_STRING(dos_charset);
146 DECL_GLOBAL_STRING(unix_charset);
147 DECL_GLOBAL_STRING(display_charset);
148 DECL_GLOBAL_STRING(piddir);
149 DECL_GLOBAL_LIST(rndc_command);
150 DECL_GLOBAL_LIST(dns_update_command);
151 DECL_GLOBAL_LIST(spn_update_command);
152 DECL_GLOBAL_STRING(nsupdate_command);
153 DECL_GLOBAL_LIST(dcerpc_endpoint_servers);
154 DECL_GLOBAL_LIST(server_services);
155 DECL_GLOBAL_STRING(ntptr_providor);
156 DECL_GLOBAL_STRING(auto_services);
157 DECL_GLOBAL_STRING(passwd_chat);
158 DECL_GLOBAL_LIST(passwordserver);
159 DECL_GLOBAL_LIST(name_resolve_order);
160 DECL_GLOBAL_STRING(realm);
161 DECL_GLOBAL_STRING(dnsdomain);
162 DECL_GLOBAL_STRING(socket_options);
163 DECL_GLOBAL_STRING(workgroup);
164 DECL_GLOBAL_STRING(netbios_name);
165 DECL_GLOBAL_STRING(netbios_scope);
166 DECL_GLOBAL_LIST(wins_server_list);
167 DECL_GLOBAL_LIST(interfaces);
168 DECL_GLOBAL_STRING(socket_address);
169 DECL_GLOBAL_LIST(netbios_aliases);
170 DECL_GLOBAL_BOOL(disable_netbios);
171 DECL_GLOBAL_BOOL(wins_support);
172 DECL_GLOBAL_BOOL(wins_dns_proxy);
173 DECL_GLOBAL_STRING(wins_hook);
174 DECL_GLOBAL_BOOL(local_master);
175 DECL_GLOBAL_BOOL(readraw);
176 DECL_GLOBAL_BOOL(large_readwrite);
177 DECL_GLOBAL_BOOL(writeraw);
178 DECL_GLOBAL_BOOL(null_passwords);
179 DECL_GLOBAL_BOOL(obey_pam_restrictions);
180 DECL_GLOBAL_BOOL(encrypted_passwords);
181 DECL_GLOBAL_BOOL(time_server);
182 DECL_GLOBAL_BOOL(bind_interfaces_only);
183 DECL_GLOBAL_BOOL(unicode);
184 DECL_GLOBAL_BOOL(nt_status_support);
185 DECL_GLOBAL_BOOL(lanman_auth);
186 DECL_GLOBAL_BOOL(ntlm_auth);
187 DECL_GLOBAL_BOOL(client_plaintext_auth);
188 DECL_GLOBAL_BOOL(client_lanman_auth);
189 DECL_GLOBAL_BOOL(client_ntlmv2_auth);
190 DECL_GLOBAL_BOOL(client_use_spnego_principal);
191 DECL_GLOBAL_BOOL(host_msdfs);
192 DECL_GLOBAL_BOOL(unix_extensions);
193 DECL_GLOBAL_BOOL(use_spnego);
194 DECL_GLOBAL_BOOL(rpc_big_endian);
195 DECL_GLOBAL_INTEGER(max_wins_ttl);
196 DECL_GLOBAL_INTEGER(min_wins_ttl);
197 DECL_GLOBAL_INTEGER(maxmux);
198 DECL_GLOBAL_INTEGER(max_xmit);
199 DECL_GLOBAL_INTEGER(passwordlevel);
200 DECL_GLOBAL_INTEGER(srv_maxprotocol);
201 DECL_GLOBAL_INTEGER(srv_minprotocol);
202 DECL_GLOBAL_INTEGER(cli_maxprotocol);
203 DECL_GLOBAL_INTEGER(cli_minprotocol);
204 DECL_GLOBAL_INTEGER(security);
205 DECL_GLOBAL_BOOL(paranoid_server_security);
206 DECL_GLOBAL_INTEGER(announce_as);
207 DECL_LOCAL_STRING(pathname);
208 DECL_LOCAL_LIST(hostsallow);
209 DECL_LOCAL_LIST(hostsdeny);
210 DECL_LOCAL_STRING(comment);
211 DECL_LOCAL_STRING(fstype);
212 DECL_LOCAL_LIST(ntvfs_handler);
213 DECL_LOCAL_BOOL(msdfs_root);
214 DECL_LOCAL_BOOL(browseable);
215 DECL_LOCAL_BOOL(readonly);
216 DECL_LOCAL_BOOL(print_ok);
217 DECL_LOCAL_BOOL(map_hidden);
218 DECL_LOCAL_BOOL(map_archive);
219 DECL_LOCAL_BOOL(strict_locking);
220 DECL_LOCAL_BOOL(oplocks);
221 DECL_LOCAL_BOOL(strict_sync);
222 DECL_LOCAL_BOOL(ci_filesystem);
223 DECL_LOCAL_BOOL(map_system);
224 DECL_LOCAL_INTEGER(max_connections);
225 DECL_LOCAL_INTEGER(csc_policy);
226 DECL_LOCAL_INTEGER(create_mask);
227 DECL_LOCAL_INTEGER(force_create_mode);
228 DECL_LOCAL_INTEGER(dir_mask);
229 DECL_LOCAL_INTEGER(force_dir_mode);
230 DECL_GLOBAL_INTEGER(server_signing);
231 DECL_GLOBAL_INTEGER(client_signing);
232 DECL_GLOBAL_CONST_STRING(ntp_signd_socket_directory);
235 char *lpcfg_tls_keyfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
236 char *lpcfg_tls_certfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
237 char *lpcfg_tls_cafile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
238 char *lpcfg_tls_dhpfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
239 char *lpcfg_tls_crlfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
241 const char *lpcfg_servicename(const struct loadparm_service *service);
244 const char *lpcfg_get_parametric(struct loadparm_context *lp_ctx,
245 struct loadparm_service *service,
246 const char *type, const char *option);
248 const char *lpcfg_parm_string(struct loadparm_context *lp_ctx,
249 struct loadparm_service *service, const char *type,
250 const char *option);
251 const char **lpcfg_parm_string_list(TALLOC_CTX *mem_ctx,
252 struct loadparm_context *lp_ctx,
253 struct loadparm_service *service,
254 const char *type,
255 const char *option, const char *separator);
256 int lpcfg_parm_int(struct loadparm_context *lp_ctx,
257 struct loadparm_service *service, const char *type,
258 const char *option, int default_v);
259 int lpcfg_parm_bytes(struct loadparm_context *lp_ctx,
260 struct loadparm_service *service, const char *type,
261 const char *option, int default_v);
262 unsigned long lpcfg_parm_ulong(struct loadparm_context *lp_ctx,
263 struct loadparm_service *service, const char *type,
264 const char *option, unsigned long default_v);
265 double lpcfg_parm_double(struct loadparm_context *lp_ctx,
266 struct loadparm_service *service, const char *type,
267 const char *option, double default_v);
268 bool lpcfg_parm_bool(struct loadparm_context *lp_ctx,
269 struct loadparm_service *service, const char *type,
270 const char *option, bool default_v);
271 struct loadparm_service *lpcfg_add_service(struct loadparm_context *lp_ctx,
272 const struct loadparm_service *pservice,
273 const char *name);
274 bool lpcfg_add_home(struct loadparm_context *lp_ctx,
275 const char *pszHomename,
276 struct loadparm_service *default_service,
277 const char *user, const char *pszHomedir);
278 bool lpcfg_add_printer(struct loadparm_context *lp_ctx,
279 const char *pszPrintername,
280 struct loadparm_service *default_service);
281 struct parm_struct *lpcfg_parm_struct(const char *name);
282 void *lpcfg_parm_ptr(struct loadparm_context *lp_ctx,
283 struct loadparm_service *service, struct parm_struct *parm);
284 bool lpcfg_file_list_changed(struct loadparm_context *lp_ctx);
286 bool lpcfg_do_global_parameter(struct loadparm_context *lp_ctx,
287 const char *pszParmName, const char *pszParmValue);
288 bool lpcfg_do_service_parameter(struct loadparm_context *lp_ctx,
289 struct loadparm_service *service,
290 const char *pszParmName, const char *pszParmValue);
293 * Process a parameter.
295 bool lpcfg_do_global_parameter_var(struct loadparm_context *lp_ctx,
296 const char *pszParmName, const char *fmt, ...);
297 bool lpcfg_set_cmdline(struct loadparm_context *lp_ctx, const char *pszParmName,
298 const char *pszParmValue);
299 bool lpcfg_set_option(struct loadparm_context *lp_ctx, const char *option);
302 * Display the contents of a single services record.
304 bool lpcfg_dump_a_parameter(struct loadparm_context *lp_ctx,
305 struct loadparm_service *service,
306 const char *parm_name, FILE * f);
309 * Return info about the next service in a service. snum==-1 gives the globals.
310 * Return NULL when out of parameters.
312 struct parm_struct *lpcfg_next_parameter(struct loadparm_context *lp_ctx, int snum, int *i,
313 int allparameters);
316 * Unload unused services.
318 void lpcfg_killunused(struct loadparm_context *lp_ctx,
319 struct smbsrv_connection *smb,
320 bool (*snumused) (struct smbsrv_connection *, int));
323 * Initialise the global parameter structure.
325 struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx);
326 const char *lpcfg_configfile(struct loadparm_context *lp_ctx);
327 bool lpcfg_load_default(struct loadparm_context *lp_ctx);
328 const char *lp_default_path(void);
331 * Load the services array from the services file.
333 * Return True on success, False on failure.
335 bool lpcfg_load(struct loadparm_context *lp_ctx, const char *filename);
338 * Return the max number of services.
340 int lpcfg_numservices(struct loadparm_context *lp_ctx);
343 * Display the contents of the services array in human-readable form.
345 void lpcfg_dump(struct loadparm_context *lp_ctx, FILE *f, bool show_defaults,
346 int maxtoprint);
349 * Display the contents of one service in human-readable form.
351 void lpcfg_dump_one(FILE *f, bool show_defaults, struct loadparm_service *service, struct loadparm_service *sDefault);
352 struct loadparm_service *lpcfg_servicebynum(struct loadparm_context *lp_ctx,
353 int snum);
354 struct loadparm_service *lpcfg_service(struct loadparm_context *lp_ctx,
355 const char *service_name);
358 * A useful volume label function.
360 const char *volume_label(struct loadparm_service *service, struct loadparm_service *sDefault);
363 * If we are PDC then prefer us as DMB
365 const char *lpcfg_printername(struct loadparm_service *service, struct loadparm_service *sDefault);
368 * Return the max print jobs per queue.
370 int lpcfg_maxprintjobs(struct loadparm_service *service, struct loadparm_service *sDefault);
371 struct smb_iconv_convenience *lpcfg_iconv_convenience(struct loadparm_context *lp_ctx);
372 void lpcfg_smbcli_options(struct loadparm_context *lp_ctx,
373 struct smbcli_options *options);
374 void lpcfg_smbcli_session_options(struct loadparm_context *lp_ctx,
375 struct smbcli_session_options *options);
376 struct dcerpc_server_info *lpcfg_dcerpc_server_info(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx);
377 struct gensec_settings *lpcfg_gensec_settings(TALLOC_CTX *, struct loadparm_context *);
380 /* The following definitions come from param/generic.c */
382 struct param_section *param_get_section(struct param_context *ctx, const char *name);
383 struct parmlist_entry *param_section_get(struct param_section *section,
384 const char *name);
385 struct parmlist_entry *param_get (struct param_context *ctx, const char *name, const char *section_name);
386 struct param_section *param_add_section(struct param_context *ctx, const char *section_name);
387 struct parmlist_entry *param_get_add(struct param_context *ctx, const char *name, const char *section_name);
388 const char *param_get_string(struct param_context *ctx, const char *param, const char *section);
389 int param_set_string(struct param_context *ctx, const char *param, const char *value, const char *section);
390 const char **param_get_string_list(struct param_context *ctx, const char *param, const char *separator, const char *section);
391 int param_set_string_list(struct param_context *ctx, const char *param, const char **list, const char *section);
392 int param_get_int(struct param_context *ctx, const char *param, int default_v, const char *section);
393 void param_set_int(struct param_context *ctx, const char *param, int value, const char *section);
394 unsigned long param_get_ulong(struct param_context *ctx, const char *param, unsigned long default_v, const char *section);
395 void param_set_ulong(struct param_context *ctx, const char *name, unsigned long value, const char *section);
396 struct param_context *param_init(TALLOC_CTX *mem_ctx);
397 int param_read(struct param_context *ctx, const char *fn);
398 int param_use(struct loadparm_context *lp_ctx, struct param_context *ctx);
399 int param_write(struct param_context *ctx, const char *fn);
401 /* The following definitions come from param/util.c */
405 * @file
406 * @brief Misc utility functions
408 bool lpcfg_is_mydomain(struct loadparm_context *lp_ctx,
409 const char *domain);
411 bool lpcfg_is_my_domain_or_realm(struct loadparm_context *lp_ctx,
412 const char *domain);
415 see if a string matches either our primary or one of our secondary
416 netbios aliases. do a case insensitive match
418 bool lpcfg_is_myname(struct loadparm_context *lp_ctx, const char *name);
421 A useful function for returning a path in the Samba lock directory.
423 char *lock_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
424 const char *name);
427 * @brief Returns an absolute path to a file in the directory containing the current config file
429 * @param name File to find, relative to the config file directory.
431 * @retval Pointer to a talloc'ed string containing the full path.
433 char *config_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
434 const char *name);
437 * @brief Returns an absolute path to a file in the Samba private directory.
439 * @param name File to find, relative to PRIVATEDIR.
440 * if name is not relative, then use it as-is
442 * @retval Pointer to a talloc'ed string containing the full path.
444 char *private_path(TALLOC_CTX* mem_ctx,
445 struct loadparm_context *lp_ctx,
446 const char *name);
449 return a path in the smbd.tmp directory, where all temporary file
450 for smbd go. If NULL is passed for name then return the directory
451 path itself
453 char *smbd_tmp_path(TALLOC_CTX *mem_ctx,
454 struct loadparm_context *lp_ctx,
455 const char *name);
458 * Obtain the init function from a shared library file
460 init_module_fn load_module(TALLOC_CTX *mem_ctx, const char *path);
463 * Obtain list of init functions from the modules in the specified
464 * directory
466 init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path);
469 * Run the specified init functions.
471 * @return true if all functions ran successfully, false otherwise
473 bool run_init_functions(init_module_fn *fns);
476 * Load the initialization functions from DSO files for a specific subsystem.
478 * Will return an array of function pointers to initialization functions
480 init_module_fn *load_samba_modules(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *subsystem);
481 const char *lpcfg_messaging_path(TALLOC_CTX *mem_ctx,
482 struct loadparm_context *lp_ctx);
483 struct smb_iconv_convenience *smb_iconv_convenience_reinit_lp(TALLOC_CTX *mem_ctx,
484 struct loadparm_context *lp_ctx,
485 struct smb_iconv_convenience *old_ic);
487 const char *lpcfg_sam_name(struct loadparm_context *lp_ctx);
489 /* The following definitions come from lib/version.c */
491 const char *samba_version_string(void);
494 #endif /* _PARAM_H */