source: vendor/current/lib/param/param.h

Last change on this file was 988, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.3

File size: 11.2 KB
Line 
1/*
2 Unix SMB/CIFS implementation.
3 Generic parameter parsing interface
4 Copyright (C) Jelmer Vernooij 2005
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 _PARAM_H /* _PARAM_H */
21#define _PARAM_H
22
23struct loadparm_s3_helpers;
24
25struct parmlist_entry;
26
27struct param_context {
28 struct param_section *sections;
29};
30
31struct param_section {
32 const char *name;
33 struct param_section *prev, *next;
34 struct parmlist *parameters;
35};
36
37struct param_context;
38struct smbsrv_connection;
39
40#define Auto (2)
41
42struct loadparm_context;
43struct loadparm_service;
44struct smbcli_options;
45struct smbcli_session_options;
46struct gensec_settings;
47struct bitmap;
48struct file_lists;
49
50typedef bool (*lpcfg_defaults_hook) (struct loadparm_context *);
51
52#ifdef CONFIG_H_IS_FROM_SAMBA
53#include "lib/param/param_proto.h"
54#include "lib/param/param_functions.h"
55#endif
56
57const char **lpcfg_interfaces(struct loadparm_context *);
58const char *lpcfg_realm(struct loadparm_context *);
59const char *lpcfg_netbios_name(struct loadparm_context *);
60const char *lpcfg_private_dir(struct loadparm_context *);
61int lpcfg_server_role(struct loadparm_context *);
62int lpcfg_allow_dns_updates(struct loadparm_context *);
63
64void reload_charcnv(struct loadparm_context *lp_ctx);
65
66struct loadparm_service *lpcfg_default_service(struct loadparm_context *lp_ctx);
67bool lpcfg_autoloaded(struct loadparm_service *, struct loadparm_service *);
68
69char *lpcfg_tls_keyfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
70char *lpcfg_tls_certfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
71char *lpcfg_tls_cafile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
72char *lpcfg_tls_dhpfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
73char *lpcfg_tls_crlfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
74
75const char *lpcfg_dnsdomain(struct loadparm_context *);
76
77const char *lpcfg_servicename(const struct loadparm_service *service);
78
79
80const char *lpcfg_get_parametric(struct loadparm_context *lp_ctx,
81 struct loadparm_service *service,
82 const char *type, const char *option);
83
84const char *lpcfg_parm_string(struct loadparm_context *lp_ctx,
85 struct loadparm_service *service, const char *type,
86 const char *option);
87const 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);
92int lpcfg_parm_int(struct loadparm_context *lp_ctx,
93 struct loadparm_service *service, const char *type,
94 const char *option, int default_v);
95int lpcfg_parm_bytes(struct loadparm_context *lp_ctx,
96 struct loadparm_service *service, const char *type,
97 const char *option, int default_v);
98unsigned 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);
101unsigned long long lpcfg_parm_ulonglong(struct loadparm_context *lp_ctx,
102 struct loadparm_service *service,
103 const char *type, const char *option,
104 unsigned long long default_v);
105long lpcfg_parm_long(struct loadparm_context *lp_ctx,
106 struct loadparm_service *service, const char *type,
107 const char *option, long default_v);
108double lpcfg_parm_double(struct loadparm_context *lp_ctx,
109 struct loadparm_service *service, const char *type,
110 const char *option, double default_v);
111bool lpcfg_parm_bool(struct loadparm_context *lp_ctx,
112 struct loadparm_service *service, const char *type,
113 const char *option, bool default_v);
114struct loadparm_service *lpcfg_add_service(struct loadparm_context *lp_ctx,
115 const struct loadparm_service *pservice,
116 const char *name);
117bool lpcfg_add_home(struct loadparm_context *lp_ctx,
118 const char *pszHomename,
119 struct loadparm_service *default_service,
120 const char *user, const char *pszHomedir);
121bool lpcfg_add_printer(struct loadparm_context *lp_ctx,
122 const char *pszPrintername,
123 struct loadparm_service *default_service);
124struct parm_struct *lpcfg_parm_struct(struct loadparm_context *lp_ctx, const char *name);
125void *lpcfg_parm_ptr(struct loadparm_context *lp_ctx,
126 struct loadparm_service *service, struct parm_struct *parm);
127bool lpcfg_parm_is_cmdline(struct loadparm_context *lp_ctx, const char *name);
128bool lpcfg_file_list_changed(struct loadparm_context *lp_ctx);
129
130bool lpcfg_do_global_parameter(struct loadparm_context *lp_ctx,
131 const char *pszParmName, const char *pszParmValue);
132bool lpcfg_do_service_parameter(struct loadparm_context *lp_ctx,
133 struct loadparm_service *service,
134 const char *pszParmName, const char *pszParmValue);
135
136/**
137 * Process a parameter.
138 */
139bool lpcfg_do_global_parameter_var(struct loadparm_context *lp_ctx,
140 const char *pszParmName, const char *fmt, ...);
141bool lpcfg_set_cmdline(struct loadparm_context *lp_ctx, const char *pszParmName,
142 const char *pszParmValue);
143bool lpcfg_set_option(struct loadparm_context *lp_ctx, const char *option);
144
145/**
146 * Display the contents of a single services record.
147 */
148bool lpcfg_dump_a_parameter(struct loadparm_context *lp_ctx,
149 struct loadparm_service *service,
150 const char *parm_name, FILE * f);
151
152/**
153 * Unload unused services.
154 */
155void lpcfg_killunused(struct loadparm_context *lp_ctx,
156 struct smbsrv_connection *smb,
157 bool (*snumused) (struct smbsrv_connection *, int));
158
159/**
160 * Initialise the global parameter structure.
161 */
162struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx);
163struct loadparm_context *loadparm_init_global(bool load_default);
164const char *lpcfg_configfile(struct loadparm_context *lp_ctx);
165bool lpcfg_load_default(struct loadparm_context *lp_ctx);
166const char *lp_default_path(void);
167
168/**
169 * Load the services array from the services file.
170 *
171 * Return True on success, False on failure.
172 */
173bool lpcfg_load(struct loadparm_context *lp_ctx, const char *filename);
174
175/**
176 * Return the max number of services.
177 */
178int lpcfg_numservices(struct loadparm_context *lp_ctx);
179
180/**
181 * Display the contents of the services array in human-readable form.
182 */
183void lpcfg_dump(struct loadparm_context *lp_ctx, FILE *f, bool show_defaults,
184 int maxtoprint);
185
186/**
187 * Display the contents of one service in human-readable form.
188 */
189void lpcfg_dump_one(FILE *f, bool show_defaults, struct loadparm_service *service, struct loadparm_service *sDefault);
190struct loadparm_service *lpcfg_servicebynum(struct loadparm_context *lp_ctx,
191 int snum);
192struct loadparm_service *lpcfg_service(struct loadparm_context *lp_ctx,
193 const char *service_name);
194
195/**
196 * A useful volume label function.
197 */
198const char *lp_cfg_volume_label(struct loadparm_service *service, struct loadparm_service *sDefault);
199
200/**
201 * If we are PDC then prefer us as DMB
202 */
203const char *lpcfg_printername(struct loadparm_service *service, struct loadparm_service *sDefault);
204
205/**
206 * Return the max print jobs per queue.
207 */
208int lpcfg_maxprintjobs(struct loadparm_service *service, struct loadparm_service *sDefault);
209struct smb_iconv_handle *lpcfg_iconv_handle(struct loadparm_context *lp_ctx);
210void lpcfg_smbcli_options(struct loadparm_context *lp_ctx,
211 struct smbcli_options *options);
212void lpcfg_smbcli_session_options(struct loadparm_context *lp_ctx,
213 struct smbcli_session_options *options);
214const char **lpcfg_smb_ports(struct loadparm_context *);
215const char *lpcfg_socket_options(struct loadparm_context *);
216struct dcerpc_server_info *lpcfg_dcerpc_server_info(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx);
217struct gensec_settings *lpcfg_gensec_settings(TALLOC_CTX *, struct loadparm_context *);
218
219/* Hooks to override defaults.
220 *
221 * Every time a loadparm context is initialized, the hooks are
222 * called on it, once Samba itself has set defaults.
223 *
224 * This allows modules to tweak defaults (before any smb.conf file or registry
225 * is loaded). Usually they would do this by calling lpcfg_do_global_parameter
226 * or lpcfg_do_service_parameter.
227 *
228 * A good use case for this is OpenChange, which by default enables its
229 * DCE/RPC services when it is installed.
230 * */
231bool lpcfg_register_defaults_hook(const char *name, lpcfg_defaults_hook hook);
232
233/* The following definitions come from param/util.c */
234
235
236/**
237 * @file
238 * @brief Misc utility functions
239 */
240bool lpcfg_is_mydomain(struct loadparm_context *lp_ctx,
241 const char *domain);
242
243bool lpcfg_is_my_domain_or_realm(struct loadparm_context *lp_ctx,
244 const char *domain);
245
246/**
247 see if a string matches either our primary or one of our secondary
248 netbios aliases. do a case insensitive match
249*/
250bool lpcfg_is_myname(struct loadparm_context *lp_ctx, const char *name);
251
252/**
253 A useful function for returning a path in the Samba lock directory.
254**/
255char *lpcfg_lock_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
256 const char *name);
257
258/**
259 * @brief Returns an absolute path to a file in the directory containing the current config file
260 *
261 * @param name File to find, relative to the config file directory.
262 *
263 * @retval Pointer to a talloc'ed string containing the full path.
264 **/
265char *lpcfg_config_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
266 const char *name);
267
268/**
269 * @brief Returns an absolute path to a file in the Samba private directory.
270 *
271 * @param name File to find, relative to PRIVATEDIR.
272 * if name is not relative, then use it as-is
273 *
274 * @retval Pointer to a talloc'ed string containing the full path.
275 **/
276char *lpcfg_private_path(TALLOC_CTX* mem_ctx,
277 struct loadparm_context *lp_ctx,
278 const char *name);
279
280/**
281 * @brief Returns an absolute path to a NTDB or TDB file in the Samba
282 * private directory.
283 *
284 * @param name File to find, relative to PRIVATEDIR, without .tdb extension.
285 *
286 * @retval Pointer to a talloc'ed string containing the full path, for
287 * use with dbwrap_local_open().
288 **/
289char *lpcfg_private_db_path(TALLOC_CTX *mem_ctx,
290 struct loadparm_context *lp_ctx,
291 const char *name);
292
293/**
294 return a path in the smbd.tmp directory, where all temporary file
295 for smbd go. If NULL is passed for name then return the directory
296 path itself
297*/
298char *smbd_tmp_path(TALLOC_CTX *mem_ctx,
299 struct loadparm_context *lp_ctx,
300 const char *name);
301
302const char *lpcfg_imessaging_path(TALLOC_CTX *mem_ctx,
303 struct loadparm_context *lp_ctx);
304struct smb_iconv_handle *smb_iconv_handle_reinit_lp(TALLOC_CTX *mem_ctx,
305 struct loadparm_context *lp_ctx,
306 struct smb_iconv_handle *old_ic);
307
308const char *lpcfg_sam_name(struct loadparm_context *lp_ctx);
309
310void lpcfg_default_kdc_policy(struct loadparm_context *lp_ctx,
311 time_t *svc_tkt_lifetime,
312 time_t *usr_tkt_lifetime,
313 time_t *renewal_lifetime);
314
315/* The following definitions come from lib/version.c */
316
317const char *samba_version_string(void);
318
319
320#endif /* _PARAM_H */
Note: See TracBrowser for help on using the repository browser.