2005-08-30 17:58:48 +04:00
/*
Unix SMB / CIFS implementation .
Generic parameter parsing interface
Copyright ( C ) Jelmer Vernooij 2005
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
2007-07-10 06:07:03 +04:00
the Free Software Foundation ; either version 3 of the License , or
2005-08-30 17:58:48 +04:00
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
2007-07-10 06:07:03 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2005-08-30 17:58:48 +04:00
*/
2006-03-14 18:22:36 +03:00
# ifndef _PARAM_H /* _PARAM_H */
# define _PARAM_H
2005-08-30 17:58:48 +04:00
2012-06-27 17:24:39 +04:00
struct loadparm_s3_helpers ;
2011-06-01 17:22:24 +04:00
2009-11-24 05:43:59 +03:00
struct parmlist_entry ;
2005-08-30 17:58:48 +04:00
2007-10-02 17:00:33 +04:00
struct param_context {
struct param_section * sections ;
2005-08-30 17:58:48 +04:00
} ;
struct param_section {
const char * name ;
struct param_section * prev , * next ;
2009-09-27 01:59:35 +04:00
struct parmlist * parameters ;
2005-08-30 17:58:48 +04:00
} ;
2006-03-14 18:22:36 +03:00
struct param_context ;
struct smbsrv_connection ;
2006-04-01 03:28:18 +04:00
# define Auto (2)
2011-05-02 06:05:13 +04:00
# include "libds/common/roles.h"
2007-08-31 04:31:32 +04:00
2007-09-08 21:25:24 +04:00
struct loadparm_context ;
2007-09-09 00:03:19 +04:00
struct loadparm_service ;
2008-01-04 02:22:12 +03:00
struct smbcli_options ;
2008-09-30 03:29:53 +04:00
struct smbcli_session_options ;
2008-11-02 04:05:48 +03:00
struct gensec_settings ;
2014-02-19 04:47:38 +04:00
struct bitmap ;
2014-02-20 02:01:52 +04:00
struct file_lists ;
2007-08-31 04:31:32 +04:00
2010-09-13 22:40:19 +04:00
# ifdef CONFIG_H_IS_FROM_SAMBA
2012-06-15 06:34:28 +04:00
# include "lib/param/param_proto.h"
2014-01-15 08:18:13 +04:00
# include "lib/param/param_functions.h"
2010-09-13 22:40:19 +04:00
# endif
const char * * lpcfg_interfaces ( struct loadparm_context * ) ;
const char * lpcfg_realm ( struct loadparm_context * ) ;
const char * lpcfg_netbios_name ( struct loadparm_context * ) ;
2010-09-14 04:36:51 +04:00
const char * lpcfg_private_dir ( struct loadparm_context * ) ;
2011-02-23 01:52:25 +03:00
int lpcfg_server_role ( struct loadparm_context * ) ;
2011-12-16 17:25:57 +04:00
int lpcfg_allow_dns_updates ( struct loadparm_context * ) ;
2010-08-11 07:36:48 +04:00
2008-04-02 06:53:27 +04:00
void reload_charcnv ( struct loadparm_context * lp_ctx ) ;
2006-03-14 18:22:36 +03:00
2010-07-16 08:32:10 +04:00
struct loadparm_service * lpcfg_default_service ( struct loadparm_context * lp_ctx ) ;
2014-01-15 08:18:13 +04:00
bool lpcfg_autoloaded ( struct loadparm_service * , struct loadparm_service * ) ;
2010-07-16 08:32:10 +04:00
char * lpcfg_tls_keyfile ( TALLOC_CTX * mem_ctx , struct loadparm_context * ) ;
char * lpcfg_tls_certfile ( TALLOC_CTX * mem_ctx , struct loadparm_context * ) ;
char * lpcfg_tls_cafile ( TALLOC_CTX * mem_ctx , struct loadparm_context * ) ;
char * lpcfg_tls_dhpfile ( TALLOC_CTX * mem_ctx , struct loadparm_context * ) ;
char * lpcfg_tls_crlfile ( TALLOC_CTX * mem_ctx , struct loadparm_context * ) ;
2014-01-15 08:18:13 +04:00
const char * lpcfg_dnsdomain ( struct loadparm_context * ) ;
2010-07-16 08:32:10 +04:00
const char * lpcfg_servicename ( const struct loadparm_service * service ) ;
const char * lpcfg_get_parametric ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
struct loadparm_service * service ,
const char * type , const char * option ) ;
2010-07-16 08:32:10 +04:00
const char * lpcfg_parm_string ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
struct loadparm_service * service , const char * type ,
const char * option ) ;
2010-07-16 08:32:10 +04:00
const char * * lpcfg_parm_string_list ( TALLOC_CTX * mem_ctx ,
2008-04-02 06:53:27 +04:00
struct loadparm_context * lp_ctx ,
struct loadparm_service * service ,
const char * type ,
const char * option , const char * separator ) ;
2010-07-16 08:32:10 +04:00
int lpcfg_parm_int ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
struct loadparm_service * service , const char * type ,
const char * option , int default_v ) ;
2010-07-16 08:32:10 +04:00
int lpcfg_parm_bytes ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
struct loadparm_service * service , const char * type ,
const char * option , int default_v ) ;
2010-07-16 08:32:10 +04:00
unsigned long lpcfg_parm_ulong ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
struct loadparm_service * service , const char * type ,
const char * option , unsigned long default_v ) ;
2012-06-18 12:02:47 +04:00
long lpcfg_parm_long ( struct loadparm_context * lp_ctx ,
struct loadparm_service * service , const char * type ,
const char * option , long default_v ) ;
2010-07-16 08:32:10 +04:00
double lpcfg_parm_double ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
struct loadparm_service * service , const char * type ,
const char * option , double default_v ) ;
2010-07-16 08:32:10 +04:00
bool lpcfg_parm_bool ( struct loadparm_context * lp_ctx ,
struct loadparm_service * service , const char * type ,
const char * option , bool default_v ) ;
struct loadparm_service * lpcfg_add_service ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
const struct loadparm_service * pservice ,
const char * name ) ;
2010-07-16 08:32:10 +04:00
bool lpcfg_add_home ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
const char * pszHomename ,
struct loadparm_service * default_service ,
const char * user , const char * pszHomedir ) ;
2010-07-16 08:32:10 +04:00
bool lpcfg_add_printer ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
const char * pszPrintername ,
struct loadparm_service * default_service ) ;
2011-07-07 14:33:55 +04:00
struct parm_struct * lpcfg_parm_struct ( struct loadparm_context * lp_ctx , const char * name ) ;
2010-07-16 08:32:10 +04:00
void * lpcfg_parm_ptr ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
struct loadparm_service * service , struct parm_struct * parm ) ;
2011-10-18 01:41:46 +04:00
bool lpcfg_parm_is_cmdline ( struct loadparm_context * lp_ctx , const char * name ) ;
2010-07-16 08:32:10 +04:00
bool lpcfg_file_list_changed ( struct loadparm_context * lp_ctx ) ;
2008-04-02 06:53:27 +04:00
2010-07-16 08:32:10 +04:00
bool lpcfg_do_global_parameter ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
const char * pszParmName , const char * pszParmValue ) ;
2010-07-16 08:32:10 +04:00
bool lpcfg_do_service_parameter ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
struct loadparm_service * service ,
const char * pszParmName , const char * pszParmValue ) ;
/**
* Process a parameter .
*/
2010-07-16 08:32:10 +04:00
bool lpcfg_do_global_parameter_var ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
const char * pszParmName , const char * fmt , . . . ) ;
2010-07-16 08:32:10 +04:00
bool lpcfg_set_cmdline ( struct loadparm_context * lp_ctx , const char * pszParmName ,
2008-04-02 06:53:27 +04:00
const char * pszParmValue ) ;
2010-07-16 08:32:10 +04:00
bool lpcfg_set_option ( struct loadparm_context * lp_ctx , const char * option ) ;
2008-04-02 06:53:27 +04:00
/**
* Display the contents of a single services record .
*/
2010-07-16 08:32:10 +04:00
bool lpcfg_dump_a_parameter ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
struct loadparm_service * service ,
const char * parm_name , FILE * f ) ;
/**
* Unload unused services .
*/
2010-07-16 08:32:10 +04:00
void lpcfg_killunused ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
struct smbsrv_connection * smb ,
bool ( * snumused ) ( struct smbsrv_connection * , int ) ) ;
/**
* Initialise the global parameter structure .
*/
struct loadparm_context * loadparm_init ( TALLOC_CTX * mem_ctx ) ;
2010-11-29 05:24:51 +03:00
struct loadparm_context * loadparm_init_global ( bool load_default ) ;
2010-07-16 08:32:10 +04:00
const char * lpcfg_configfile ( struct loadparm_context * lp_ctx ) ;
bool lpcfg_load_default ( struct loadparm_context * lp_ctx ) ;
2009-01-16 17:05:15 +03:00
const char * lp_default_path ( void ) ;
2008-04-02 06:53:27 +04:00
/**
* Load the services array from the services file .
*
* Return True on success , False on failure .
*/
2010-07-16 08:32:10 +04:00
bool lpcfg_load ( struct loadparm_context * lp_ctx , const char * filename ) ;
2008-04-02 06:53:27 +04:00
/**
* Return the max number of services .
*/
2010-07-16 08:32:10 +04:00
int lpcfg_numservices ( struct loadparm_context * lp_ctx ) ;
2008-04-02 06:53:27 +04:00
/**
* Display the contents of the services array in human - readable form .
*/
2010-07-16 08:32:10 +04:00
void lpcfg_dump ( struct loadparm_context * lp_ctx , FILE * f , bool show_defaults ,
2008-04-02 06:53:27 +04:00
int maxtoprint ) ;
/**
* Display the contents of one service in human - readable form .
*/
2010-07-16 08:32:10 +04:00
void lpcfg_dump_one ( FILE * f , bool show_defaults , struct loadparm_service * service , struct loadparm_service * sDefault ) ;
struct loadparm_service * lpcfg_servicebynum ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
int snum ) ;
2010-07-16 08:32:10 +04:00
struct loadparm_service * lpcfg_service ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
const char * service_name ) ;
/**
* A useful volume label function .
*/
2011-04-29 07:30:18 +04:00
const char * lp_cfg_volume_label ( struct loadparm_service * service , struct loadparm_service * sDefault ) ;
2008-04-02 06:53:27 +04:00
/**
* If we are PDC then prefer us as DMB
*/
2010-07-16 08:32:10 +04:00
const char * lpcfg_printername ( struct loadparm_service * service , struct loadparm_service * sDefault ) ;
2008-04-02 06:53:27 +04:00
/**
* Return the max print jobs per queue .
*/
2010-07-16 08:32:10 +04:00
int lpcfg_maxprintjobs ( struct loadparm_service * service , struct loadparm_service * sDefault ) ;
2011-03-25 00:37:00 +03:00
struct smb_iconv_handle * lpcfg_iconv_handle ( struct loadparm_context * lp_ctx ) ;
2010-07-16 08:32:10 +04:00
void lpcfg_smbcli_options ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
struct smbcli_options * options ) ;
2010-07-16 08:32:10 +04:00
void lpcfg_smbcli_session_options ( struct loadparm_context * lp_ctx ,
2008-09-30 03:29:53 +04:00
struct smbcli_session_options * options ) ;
2011-10-12 01:51:37 +04:00
const char * * lpcfg_smb_ports ( struct loadparm_context * ) ;
2011-10-12 01:53:59 +04:00
const char * lpcfg_socket_options ( struct loadparm_context * ) ;
2010-07-16 08:32:10 +04:00
struct dcerpc_server_info * lpcfg_dcerpc_server_info ( TALLOC_CTX * mem_ctx , struct loadparm_context * lp_ctx ) ;
struct gensec_settings * lpcfg_gensec_settings ( TALLOC_CTX * , struct loadparm_context * ) ;
2008-11-01 17:09:26 +03:00
2008-04-02 06:53:27 +04:00
/* The following definitions come from param/generic.c */
struct param_section * param_get_section ( struct param_context * ctx , const char * name ) ;
2009-09-27 01:59:35 +04:00
struct parmlist_entry * param_section_get ( struct param_section * section ,
2008-04-02 06:53:27 +04:00
const char * name ) ;
2009-09-27 01:59:35 +04:00
struct parmlist_entry * param_get ( struct param_context * ctx , const char * name , const char * section_name ) ;
2008-04-02 06:53:27 +04:00
struct param_section * param_add_section ( struct param_context * ctx , const char * section_name ) ;
2009-09-27 01:59:35 +04:00
struct parmlist_entry * param_get_add ( struct param_context * ctx , const char * name , const char * section_name ) ;
2008-04-02 06:53:27 +04:00
const char * param_get_string ( struct param_context * ctx , const char * param , const char * section ) ;
int param_set_string ( struct param_context * ctx , const char * param , const char * value , const char * section ) ;
const char * * param_get_string_list ( struct param_context * ctx , const char * param , const char * separator , const char * section ) ;
int param_set_string_list ( struct param_context * ctx , const char * param , const char * * list , const char * section ) ;
int param_get_int ( struct param_context * ctx , const char * param , int default_v , const char * section ) ;
void param_set_int ( struct param_context * ctx , const char * param , int value , const char * section ) ;
unsigned long param_get_ulong ( struct param_context * ctx , const char * param , unsigned long default_v , const char * section ) ;
void param_set_ulong ( struct param_context * ctx , const char * name , unsigned long value , const char * section ) ;
struct param_context * param_init ( TALLOC_CTX * mem_ctx ) ;
int param_read ( struct param_context * ctx , const char * fn ) ;
int param_use ( struct loadparm_context * lp_ctx , struct param_context * ctx ) ;
int param_write ( struct param_context * ctx , const char * fn ) ;
/* The following definitions come from param/util.c */
/**
* @ file
* @ brief Misc utility functions
*/
2010-07-16 08:32:10 +04:00
bool lpcfg_is_mydomain ( struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
const char * domain ) ;
2010-07-16 08:32:10 +04:00
bool lpcfg_is_my_domain_or_realm ( struct loadparm_context * lp_ctx ,
2009-05-26 06:31:39 +04:00
const char * domain ) ;
2008-04-02 06:53:27 +04:00
/**
see if a string matches either our primary or one of our secondary
netbios aliases . do a case insensitive match
*/
2010-07-16 08:32:10 +04:00
bool lpcfg_is_myname ( struct loadparm_context * lp_ctx , const char * name ) ;
2008-04-02 06:53:27 +04:00
/**
A useful function for returning a path in the Samba lock directory .
* */
2011-04-29 06:41:45 +04:00
char * lpcfg_lock_path ( TALLOC_CTX * mem_ctx , struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
const char * name ) ;
/**
* @ brief Returns an absolute path to a file in the directory containing the current config file
*
* @ param name File to find , relative to the config file directory .
*
* @ retval Pointer to a talloc ' ed string containing the full path .
* */
2011-04-29 06:46:10 +04:00
char * lpcfg_config_path ( TALLOC_CTX * mem_ctx , struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
const char * name ) ;
/**
* @ brief Returns an absolute path to a file in the Samba private directory .
*
* @ param name File to find , relative to PRIVATEDIR .
* if name is not relative , then use it as - is
*
* @ retval Pointer to a talloc ' ed string containing the full path .
* */
2011-04-29 06:47:11 +04:00
char * lpcfg_private_path ( TALLOC_CTX * mem_ctx ,
2008-04-02 06:53:27 +04:00
struct loadparm_context * lp_ctx ,
const char * name ) ;
2013-04-11 11:42:10 +04:00
/**
* @ brief Returns an absolute path to a NTDB or TDB file in the Samba
* private directory .
*
* @ param name File to find , relative to PRIVATEDIR , without . ( n ) tdb extension .
* Only provide fixed - string names which are supposed to change with " use ntdb "
* option .
*
* @ retval Pointer to a talloc ' ed string containing the full path , for
* use with dbwrap_local_open ( ) .
* */
char * lpcfg_private_db_path ( TALLOC_CTX * mem_ctx ,
struct loadparm_context * lp_ctx ,
const char * name ) ;
2008-04-02 06:53:27 +04:00
/**
return a path in the smbd . tmp directory , where all temporary file
for smbd go . If NULL is passed for name then return the directory
path itself
*/
char * smbd_tmp_path ( TALLOC_CTX * mem_ctx ,
2010-07-16 08:32:10 +04:00
struct loadparm_context * lp_ctx ,
2008-04-02 06:53:27 +04:00
const char * name ) ;
2011-05-03 04:40:33 +04:00
const char * lpcfg_imessaging_path ( TALLOC_CTX * mem_ctx ,
2008-04-02 06:53:27 +04:00
struct loadparm_context * lp_ctx ) ;
2011-03-25 00:37:00 +03:00
struct smb_iconv_handle * smb_iconv_handle_reinit_lp ( TALLOC_CTX * mem_ctx ,
2010-03-18 06:06:13 +03:00
struct loadparm_context * lp_ctx ,
2011-03-25 00:37:00 +03:00
struct smb_iconv_handle * old_ic ) ;
2008-04-02 06:53:27 +04:00
2010-07-16 08:32:10 +04:00
const char * lpcfg_sam_name ( struct loadparm_context * lp_ctx ) ;
2009-05-26 06:31:39 +04:00
2012-04-19 19:16:03 +04:00
void lpcfg_default_kdc_policy ( struct loadparm_context * lp_ctx ,
time_t * svc_tkt_lifetime ,
time_t * usr_tkt_lifetime ,
time_t * renewal_lifetime ) ;
2008-04-02 06:53:27 +04:00
/* The following definitions come from lib/version.c */
const char * samba_version_string ( void ) ;
2006-03-14 18:22:36 +03:00
# endif /* _PARAM_H */