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 */
25 struct loadparm_s3_helpers
;
26 struct loadparm_substitution
;
28 struct parmlist_entry
;
30 struct param_context
{
31 struct param_section
*sections
;
34 struct param_section
{
36 struct param_section
*prev
, *next
;
37 struct parmlist
*parameters
;
41 struct smbsrv_connection
;
44 #define LP_ENUM_Default (-2)
46 struct loadparm_context
;
47 struct loadparm_service
;
48 struct smbcli_options
;
49 struct smbcli_session_options
;
50 struct gensec_settings
;
54 #ifdef CONFIG_H_IS_FROM_SAMBA
55 #include "lib/param/param_proto.h"
56 #include "lib/param/param_functions.h"
59 const char **lpcfg_interfaces(struct loadparm_context
*);
60 const char *lpcfg_realm(struct loadparm_context
*);
61 const char *lpcfg_netbios_name(struct loadparm_context
*);
62 const char *lpcfg_private_dir(struct loadparm_context
*);
63 const char *lpcfg_binddns_dir(struct loadparm_context
*);
64 int lpcfg_server_role(struct loadparm_context
*);
65 int lpcfg_allow_dns_updates(struct loadparm_context
*);
67 void reload_charcnv(struct loadparm_context
*lp_ctx
);
69 struct loadparm_service
*lpcfg_default_service(struct loadparm_context
*lp_ctx
);
70 bool lpcfg_autoloaded(struct loadparm_service
*, struct loadparm_service
*);
72 char *lpcfg_tls_keyfile(TALLOC_CTX
*mem_ctx
, struct loadparm_context
*);
73 char *lpcfg_tls_certfile(TALLOC_CTX
*mem_ctx
, struct loadparm_context
*);
74 char *lpcfg_tls_cafile(TALLOC_CTX
*mem_ctx
, struct loadparm_context
*);
75 char *lpcfg_tls_dhpfile(TALLOC_CTX
*mem_ctx
, struct loadparm_context
*);
76 char *lpcfg_tls_crlfile(TALLOC_CTX
*mem_ctx
, struct loadparm_context
*);
78 const char *lpcfg_dnsdomain(struct loadparm_context
*);
80 const char *lpcfg_servicename(const struct loadparm_service
*service
);
83 const char *lpcfg_get_parametric(struct loadparm_context
*lp_ctx
,
84 struct loadparm_service
*service
,
85 const char *type
, const char *option
);
87 const char *lpcfg_parm_string(struct loadparm_context
*lp_ctx
,
88 struct loadparm_service
*service
, const char *type
,
90 const char **lpcfg_parm_string_list(TALLOC_CTX
*mem_ctx
,
91 struct loadparm_context
*lp_ctx
,
92 struct loadparm_service
*service
,
94 const char *option
, const char *separator
);
95 int lpcfg_parm_int(struct loadparm_context
*lp_ctx
,
96 struct loadparm_service
*service
, const char *type
,
97 const char *option
, int default_v
);
98 int lpcfg_parm_bytes(struct loadparm_context
*lp_ctx
,
99 struct loadparm_service
*service
, const char *type
,
100 const char *option
, int default_v
);
101 unsigned long lpcfg_parm_ulong(struct loadparm_context
*lp_ctx
,
102 struct loadparm_service
*service
, const char *type
,
103 const char *option
, unsigned long default_v
);
104 unsigned long long lpcfg_parm_ulonglong(struct loadparm_context
*lp_ctx
,
105 struct loadparm_service
*service
,
106 const char *type
, const char *option
,
107 unsigned long long default_v
);
108 long lpcfg_parm_long(struct loadparm_context
*lp_ctx
,
109 struct loadparm_service
*service
, const char *type
,
110 const char *option
, long default_v
);
111 double lpcfg_parm_double(struct loadparm_context
*lp_ctx
,
112 struct loadparm_service
*service
, const char *type
,
113 const char *option
, double default_v
);
114 bool lpcfg_parm_bool(struct loadparm_context
*lp_ctx
,
115 struct loadparm_service
*service
, const char *type
,
116 const char *option
, bool default_v
);
117 struct loadparm_service
*lpcfg_add_service(struct loadparm_context
*lp_ctx
,
118 const struct loadparm_service
*pservice
,
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_parm_is_unspecified(struct loadparm_context
*lp_ctx
, const char *name
);
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 * Initialise the global parameter structure.
151 struct loadparm_context
*loadparm_init(TALLOC_CTX
*mem_ctx
);
152 struct loadparm_context
*loadparm_init_global(bool load_default
);
153 const char *lpcfg_configfile(struct loadparm_context
*lp_ctx
);
154 bool lpcfg_load_default(struct loadparm_context
*lp_ctx
);
155 const char *lp_default_path(void);
158 * Load the services array from the services file.
160 * Return True on success, False on failure.
162 bool lpcfg_load(struct loadparm_context
*lp_ctx
, const char *filename
);
165 * Return the max number of services.
167 int lpcfg_numservices(struct loadparm_context
*lp_ctx
);
170 * Display the contents of the services array in human-readable form.
172 void lpcfg_dump(struct loadparm_context
*lp_ctx
, FILE *f
, bool show_defaults
,
176 * Display the contents of one service in human-readable form.
178 void lpcfg_dump_one(FILE *f
, bool show_defaults
, struct loadparm_service
*service
, struct loadparm_service
*sDefault
);
179 struct loadparm_service
*lpcfg_servicebynum(struct loadparm_context
*lp_ctx
,
181 struct loadparm_service
*lpcfg_service(struct loadparm_context
*lp_ctx
,
182 const char *service_name
);
184 struct smb_iconv_handle
*lpcfg_iconv_handle(struct loadparm_context
*lp_ctx
);
185 void lpcfg_smbcli_options(struct loadparm_context
*lp_ctx
,
186 struct smbcli_options
*options
);
187 void lpcfg_smbcli_session_options(struct loadparm_context
*lp_ctx
,
188 struct smbcli_session_options
*options
);
189 const char **lpcfg_smb_ports(struct loadparm_context
*);
190 const char *lpcfg_socket_options(struct loadparm_context
*);
191 struct dcerpc_server_info
*lpcfg_dcerpc_server_info(TALLOC_CTX
*mem_ctx
, struct loadparm_context
*lp_ctx
);
192 struct gensec_settings
*lpcfg_gensec_settings(TALLOC_CTX
*, struct loadparm_context
*);
194 /* The following definitions come from param/util.c */
199 * @brief Misc utility functions
201 bool lpcfg_is_mydomain(struct loadparm_context
*lp_ctx
,
204 bool lpcfg_is_my_domain_or_realm(struct loadparm_context
*lp_ctx
,
208 see if a string matches either our primary or one of our secondary
209 netbios aliases. do a case insensitive match
211 bool lpcfg_is_myname(struct loadparm_context
*lp_ctx
, const char *name
);
214 A useful function for returning a path in the Samba lock directory.
216 char *lpcfg_lock_path(TALLOC_CTX
* mem_ctx
, struct loadparm_context
*lp_ctx
,
220 * @brief Returns an absolute path to a file in the directory containing the current config file
222 * @param name File to find, relative to the config file directory.
224 * @retval Pointer to a talloc'ed string containing the full path.
226 char *lpcfg_config_path(TALLOC_CTX
* mem_ctx
, struct loadparm_context
*lp_ctx
,
230 * @brief Returns an absolute path to a file in the Samba private directory.
232 * @param name File to find, relative to PRIVATEDIR.
233 * if name is not relative, then use it as-is
235 * @retval Pointer to a talloc'ed string containing the full path.
237 char *lpcfg_private_path(TALLOC_CTX
* mem_ctx
,
238 struct loadparm_context
*lp_ctx
,
242 * @brief Returns an absolute path to a NTDB or TDB file in the Samba
245 * @param name File to find, relative to PRIVATEDIR, without .tdb extension.
247 * @retval Pointer to a talloc'ed string containing the full path, for
248 * use with dbwrap_local_open().
250 char *lpcfg_private_db_path(TALLOC_CTX
*mem_ctx
,
251 struct loadparm_context
*lp_ctx
,
255 return a path in the smbd.tmp directory, where all temporary file
256 for smbd go. If NULL is passed for name then return the directory
259 char *smbd_tmp_path(TALLOC_CTX
*mem_ctx
,
260 struct loadparm_context
*lp_ctx
,
263 const char *lpcfg_imessaging_path(TALLOC_CTX
*mem_ctx
,
264 struct loadparm_context
*lp_ctx
);
265 const char *lpcfg_sam_name(struct loadparm_context
*lp_ctx
);
266 const char *lpcfg_sam_dnsname(struct loadparm_context
*lp_ctx
);
268 void lpcfg_default_kdc_policy(TALLOC_CTX
*mem_ctx
,
269 struct loadparm_context
*lp_ctx
,
270 time_t *svc_tkt_lifetime
,
271 time_t *usr_tkt_lifetime
,
272 time_t *renewal_lifetime
);
274 int lpcfg_rpc_port_low(struct loadparm_context
*lp_ctx
);
275 int lpcfg_rpc_port_high(struct loadparm_context
*lp_ctx
);
277 /* The following definitions come from lib/version.c */
279 const char *samba_version_string(void);
280 const char *samba_copyright_string(void);
283 #endif /* _PARAM_H */