source: vendor/3.6.23/source4/param/param.h

Last change on this file was 740, checked in by Silvan Scherrer, 13 years ago

Samba Server: update vendor to 3.6.0

File size: 12.8 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 parmlist_entry;
24
25struct param_context {
26 struct param_section *sections;
27};
28
29struct param_section {
30 const char *name;
31 struct param_section *prev, *next;
32 struct parmlist *parameters;
33};
34
35struct param_context;
36struct smbsrv_connection;
37
38#define Auto (2)
39
40typedef NTSTATUS (*init_module_fn) (void);
41
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"
47
48enum server_role {
49 ROLE_STANDALONE=0,
50 ROLE_DOMAIN_MEMBER=1,
51 ROLE_DOMAIN_CONTROLLER=2,
52};
53
54enum sid_generator {
55 SID_GENERATOR_INTERNAL=0,
56 SID_GENERATOR_BACKEND=1,
57};
58
59enum 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
64};
65
66struct loadparm_context;
67struct loadparm_service;
68struct smbcli_options;
69struct smbcli_session_options;
70struct gensec_settings;
71
72#ifdef CONFIG_H_IS_FROM_SAMBA
73#include "param/param_proto.h"
74#endif
75
76const char **lpcfg_interfaces(struct loadparm_context *);
77const char *lpcfg_realm(struct loadparm_context *);
78const char *lpcfg_netbios_name(struct loadparm_context *);
79const char *lpcfg_private_dir(struct loadparm_context *);
80int lpcfg_server_role(struct loadparm_context *);
81
82void reload_charcnv(struct loadparm_context *lp_ctx);
83
84struct loadparm_service *lpcfg_default_service(struct loadparm_context *lp_ctx);
85struct parm_struct *lpcfg_parm_table(void);
86
87
88char *lpcfg_tls_keyfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
89char *lpcfg_tls_certfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
90char *lpcfg_tls_cafile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
91char *lpcfg_tls_dhpfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
92char *lpcfg_tls_crlfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
93
94const char *lpcfg_servicename(const struct loadparm_service *service);
95
96
97const char *lpcfg_get_parametric(struct loadparm_context *lp_ctx,
98 struct loadparm_service *service,
99 const char *type, const char *option);
100
101const char *lpcfg_parm_string(struct loadparm_context *lp_ctx,
102 struct loadparm_service *service, const char *type,
103 const char *option);
104const char **lpcfg_parm_string_list(TALLOC_CTX *mem_ctx,
105 struct loadparm_context *lp_ctx,
106 struct loadparm_service *service,
107 const char *type,
108 const char *option, const char *separator);
109int lpcfg_parm_int(struct loadparm_context *lp_ctx,
110 struct loadparm_service *service, const char *type,
111 const char *option, int default_v);
112int lpcfg_parm_bytes(struct loadparm_context *lp_ctx,
113 struct loadparm_service *service, const char *type,
114 const char *option, int default_v);
115unsigned long lpcfg_parm_ulong(struct loadparm_context *lp_ctx,
116 struct loadparm_service *service, const char *type,
117 const char *option, unsigned long default_v);
118double lpcfg_parm_double(struct loadparm_context *lp_ctx,
119 struct loadparm_service *service, const char *type,
120 const char *option, double default_v);
121bool lpcfg_parm_bool(struct loadparm_context *lp_ctx,
122 struct loadparm_service *service, const char *type,
123 const char *option, bool default_v);
124struct loadparm_service *lpcfg_add_service(struct loadparm_context *lp_ctx,
125 const struct loadparm_service *pservice,
126 const char *name);
127bool lpcfg_add_home(struct loadparm_context *lp_ctx,
128 const char *pszHomename,
129 struct loadparm_service *default_service,
130 const char *user, const char *pszHomedir);
131bool lpcfg_add_printer(struct loadparm_context *lp_ctx,
132 const char *pszPrintername,
133 struct loadparm_service *default_service);
134struct parm_struct *lpcfg_parm_struct(const char *name);
135void *lpcfg_parm_ptr(struct loadparm_context *lp_ctx,
136 struct loadparm_service *service, struct parm_struct *parm);
137bool lpcfg_file_list_changed(struct loadparm_context *lp_ctx);
138
139bool lpcfg_do_global_parameter(struct loadparm_context *lp_ctx,
140 const char *pszParmName, const char *pszParmValue);
141bool lpcfg_do_service_parameter(struct loadparm_context *lp_ctx,
142 struct loadparm_service *service,
143 const char *pszParmName, const char *pszParmValue);
144
145/**
146 * Process a parameter.
147 */
148bool lpcfg_do_global_parameter_var(struct loadparm_context *lp_ctx,
149 const char *pszParmName, const char *fmt, ...);
150bool lpcfg_set_cmdline(struct loadparm_context *lp_ctx, const char *pszParmName,
151 const char *pszParmValue);
152bool lpcfg_set_option(struct loadparm_context *lp_ctx, const char *option);
153
154/**
155 * Display the contents of a single services record.
156 */
157bool lpcfg_dump_a_parameter(struct loadparm_context *lp_ctx,
158 struct loadparm_service *service,
159 const char *parm_name, FILE * f);
160
161/**
162 * Return info about the next service in a service. snum==-1 gives the globals.
163 * Return NULL when out of parameters.
164 */
165struct parm_struct *lpcfg_next_parameter(struct loadparm_context *lp_ctx, int snum, int *i,
166 int allparameters);
167
168/**
169 * Unload unused services.
170 */
171void lpcfg_killunused(struct loadparm_context *lp_ctx,
172 struct smbsrv_connection *smb,
173 bool (*snumused) (struct smbsrv_connection *, int));
174
175/**
176 * Initialise the global parameter structure.
177 */
178struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx);
179struct loadparm_context *loadparm_init_global(bool load_default);
180const char *lpcfg_configfile(struct loadparm_context *lp_ctx);
181bool lpcfg_load_default(struct loadparm_context *lp_ctx);
182const char *lp_default_path(void);
183
184/**
185 * Load the services array from the services file.
186 *
187 * Return True on success, False on failure.
188 */
189bool lpcfg_load(struct loadparm_context *lp_ctx, const char *filename);
190
191/**
192 * Return the max number of services.
193 */
194int lpcfg_numservices(struct loadparm_context *lp_ctx);
195
196/**
197 * Display the contents of the services array in human-readable form.
198 */
199void lpcfg_dump(struct loadparm_context *lp_ctx, FILE *f, bool show_defaults,
200 int maxtoprint);
201
202/**
203 * Display the contents of one service in human-readable form.
204 */
205void lpcfg_dump_one(FILE *f, bool show_defaults, struct loadparm_service *service, struct loadparm_service *sDefault);
206struct loadparm_service *lpcfg_servicebynum(struct loadparm_context *lp_ctx,
207 int snum);
208struct loadparm_service *lpcfg_service(struct loadparm_context *lp_ctx,
209 const char *service_name);
210
211/**
212 * A useful volume label function.
213 */
214const char *volume_label(struct loadparm_service *service, struct loadparm_service *sDefault);
215
216/**
217 * If we are PDC then prefer us as DMB
218 */
219const char *lpcfg_printername(struct loadparm_service *service, struct loadparm_service *sDefault);
220
221/**
222 * Return the max print jobs per queue.
223 */
224int lpcfg_maxprintjobs(struct loadparm_service *service, struct loadparm_service *sDefault);
225struct smb_iconv_convenience *lpcfg_iconv_convenience(struct loadparm_context *lp_ctx);
226void lpcfg_smbcli_options(struct loadparm_context *lp_ctx,
227 struct smbcli_options *options);
228void lpcfg_smbcli_session_options(struct loadparm_context *lp_ctx,
229 struct smbcli_session_options *options);
230struct dcerpc_server_info *lpcfg_dcerpc_server_info(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx);
231struct gensec_settings *lpcfg_gensec_settings(TALLOC_CTX *, struct loadparm_context *);
232
233
234/* The following definitions come from param/generic.c */
235
236struct param_section *param_get_section(struct param_context *ctx, const char *name);
237struct parmlist_entry *param_section_get(struct param_section *section,
238 const char *name);
239struct parmlist_entry *param_get (struct param_context *ctx, const char *name, const char *section_name);
240struct param_section *param_add_section(struct param_context *ctx, const char *section_name);
241struct parmlist_entry *param_get_add(struct param_context *ctx, const char *name, const char *section_name);
242const char *param_get_string(struct param_context *ctx, const char *param, const char *section);
243int param_set_string(struct param_context *ctx, const char *param, const char *value, const char *section);
244const char **param_get_string_list(struct param_context *ctx, const char *param, const char *separator, const char *section);
245int param_set_string_list(struct param_context *ctx, const char *param, const char **list, const char *section);
246int param_get_int(struct param_context *ctx, const char *param, int default_v, const char *section);
247void param_set_int(struct param_context *ctx, const char *param, int value, const char *section);
248unsigned long param_get_ulong(struct param_context *ctx, const char *param, unsigned long default_v, const char *section);
249void param_set_ulong(struct param_context *ctx, const char *name, unsigned long value, const char *section);
250struct param_context *param_init(TALLOC_CTX *mem_ctx);
251int param_read(struct param_context *ctx, const char *fn);
252int param_use(struct loadparm_context *lp_ctx, struct param_context *ctx);
253int param_write(struct param_context *ctx, const char *fn);
254
255/* The following definitions come from param/util.c */
256
257
258/**
259 * @file
260 * @brief Misc utility functions
261 */
262bool lpcfg_is_mydomain(struct loadparm_context *lp_ctx,
263 const char *domain);
264
265bool lpcfg_is_my_domain_or_realm(struct loadparm_context *lp_ctx,
266 const char *domain);
267
268/**
269 see if a string matches either our primary or one of our secondary
270 netbios aliases. do a case insensitive match
271*/
272bool lpcfg_is_myname(struct loadparm_context *lp_ctx, const char *name);
273
274/**
275 A useful function for returning a path in the Samba lock directory.
276**/
277char *lock_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
278 const char *name);
279
280/**
281 * @brief Returns an absolute path to a file in the directory containing the current config file
282 *
283 * @param name File to find, relative to the config file directory.
284 *
285 * @retval Pointer to a talloc'ed string containing the full path.
286 **/
287char *config_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
288 const char *name);
289
290/**
291 * @brief Returns an absolute path to a file in the Samba private directory.
292 *
293 * @param name File to find, relative to PRIVATEDIR.
294 * if name is not relative, then use it as-is
295 *
296 * @retval Pointer to a talloc'ed string containing the full path.
297 **/
298char *private_path(TALLOC_CTX* mem_ctx,
299 struct loadparm_context *lp_ctx,
300 const char *name);
301
302/**
303 return a path in the smbd.tmp directory, where all temporary file
304 for smbd go. If NULL is passed for name then return the directory
305 path itself
306*/
307char *smbd_tmp_path(TALLOC_CTX *mem_ctx,
308 struct loadparm_context *lp_ctx,
309 const char *name);
310
311/**
312 * Obtain the init function from a shared library file
313 */
314init_module_fn load_module(TALLOC_CTX *mem_ctx, const char *path);
315
316/**
317 * Obtain list of init functions from the modules in the specified
318 * directory
319 */
320init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path);
321
322/**
323 * Run the specified init functions.
324 *
325 * @return true if all functions ran successfully, false otherwise
326 */
327bool run_init_functions(init_module_fn *fns);
328
329/**
330 * Load the initialization functions from DSO files for a specific subsystem.
331 *
332 * Will return an array of function pointers to initialization functions
333 */
334init_module_fn *load_samba_modules(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *subsystem);
335const char *lpcfg_messaging_path(TALLOC_CTX *mem_ctx,
336 struct loadparm_context *lp_ctx);
337struct smb_iconv_convenience *smb_iconv_convenience_reinit_lp(TALLOC_CTX *mem_ctx,
338 struct loadparm_context *lp_ctx,
339 struct smb_iconv_convenience *old_ic);
340
341const char *lpcfg_sam_name(struct loadparm_context *lp_ctx);
342
343/* The following definitions come from lib/version.c */
344
345const char *samba_version_string(void);
346
347
348#endif /* _PARAM_H */
Note: See TracBrowser for help on using the repository browser.