samba 4.0.7 devel 程式設計之配置篇
阿新 • • 發佈:2019-02-05
/*************util/talloc_stack.h***************************/
/*
* Create a new talloc stack frame.
* 記憶體分配
* When free'd, it frees all stack frames that were created after this one and
* not explicitly freed.
*/
#define talloc_stackframe() _talloc_stackframe(__location__)
/*
* Get us the current top of the talloc stack.3
*/
#define talloc_tos() _talloc_tos(__location__)
TALLOC_CTX *_talloc_tos(const char *location);
/*
* return true if a talloc stackframe exists
* this can be used to prevent memory leaks for code that can
* optionally use a talloc stackframe (eg. nt_errstr())
*/
bool talloc_stackframe_exists(void);
/*******************param.h*******************************/
/**
* Initialise the global parameter structure.
初始化(記憶體)引數上下文
*/
struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx);
struct loadparm_context *loadparm_init_global(bool load_default);
const char *lpcfg_configfile(struct loadparm_context *lp_ctx);
const char *lp_default_path(void);
/**
* Load the services array from the services file.
*用配置檔案填充(記憶體)引數上下文
* Return True on success, False on failure.
*/
bool lpcfg_load(struct loadparm_context *lp_ctx, const char *filename);
bool lpcfg_load_default(struct loadparm_context *lp_ctx);
/**
* Return the max number of services.
* 返回共享服務數目( [share name] 個數 )
*/
int lpcfg_numservices(struct loadparm_context *lp_ctx);
/**
* Display the contents of the services array in human-readable form.
* 顯示當前所有共享的所有引數 ,輸出重定向f,show_defaults決定是否顯示預設引數
* 輸出的服務數目由maxtoprint決定,
*/
void lpcfg_dump(struct loadparm_context *lp_ctx, FILE *f, bool show_defaults,
int maxtoprint);
/**
* Display the contents of one service in human-readable form.
*顯示指定共享(service)的所有引數
*/
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,
int snum);
struct loadparm_service *lpcfg_service(struct loadparm_context *lp_ctx,
const char *service_name);
const char *lpcfg_servicename(const struct loadparm_service *service);
/**
* Display the contents of a single services record.
* 顯示指定共享(service)指定引數(parm_name) 的引數值
*/
bool lpcfg_dump_a_parameter(struct loadparm_context *lp_ctx,
struct loadparm_service *service,
const char *parm_name, FILE * f);
/*
*設定指定共享(service)的指定引數(ParmName)值(ParmValue)
*此設定只是在記憶體中修改,(要儲存,需要寫入檔案)
*/
bool lpcfg_do_service_parameter(struct loadparm_context *lp_ctx,
struct loadparm_service *service,
const char *pszParmName, const char *pszParmValue);
/**
* Process a parameter.
* 設定全域性 屬性 ParaName=ParaValue
*/
bool lpcfg_do_global_parameter(struct loadparm_context *lp_ctx,
const char *pszParmName, const char *pszParmValue);
bool lpcfg_do_global_parameter_var(struct loadparm_context *lp_ctx,
const char *pszParmName, const char *fmt, ...);
bool lpcfg_set_cmdline(struct loadparm_context *lp_ctx, const char *pszParmName,
const char *pszParmValue);
bool lpcfg_set_option(struct loadparm_context *lp_ctx, const char *option);
/**
* Return info about the next service in a service. snum==-1 gives the globals.
* Return NULL when out of parameters.
*/
struct parm_struct *lpcfg_next_parameter(struct loadparm_context *lp_ctx, int snum, int *i,
int allparameters);
/* The following definitions come from lib/version.c
* 顯示samba版本號
*/
const char *samba_version_string(void);
bool lpcfg_is_mydomain(struct loadparm_context *lp_ctx,
const char *domain);
bool lpcfg_is_my_domain_or_realm(struct loadparm_context *lp_ctx,
const char *domain);
/**
see if a string matches either our primary or one of our secondary
netbios aliases. do a case insensitive match
*/
bool lpcfg_is_myname(struct loadparm_context *lp_ctx, const char *name);
/*************查詢全域性屬性的值***************/
const char **lpcfg_interfaces(struct loadparm_context *);
const char *lpcfg_realm(struct loadparm_context *);
const char *lpcfg_netbios_name(struct loadparm_context *);
const char *lpcfg_private_dir(struct loadparm_context *);
enum server_role {
ROLE_STANDALONE = 0,
ROLE_DOMAIN_MEMBER = 1,
ROLE_DOMAIN_BDC = 2,
ROLE_DOMAIN_PDC = 3,
/* not in samr.idl */
ROLE_ACTIVE_DIRECTORY_DC = 4,
/* To determine the role automatically, this is not a valid role */
ROLE_AUTO = 100
};
int lpcfg_server_role(struct loadparm_context *);
int lpcfg_allow_dns_updates(struct loadparm_context *);
bool lpcfg_is_mydomain(struct loadparm_context *lp_ctx,
const char *domain);
bool lpcfg_is_my_domain_or_realm(struct loadparm_context *lp_ctx,
const char *domain);
bool lpcfg_is_myname(struct loadparm_context *lp_ctx, const char *name);
/*
*查詢指定檔案所在的位置(目錄)
*
*/
char *lpcfg_lock_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
const char *name);
char *lpcfg_config_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
const char *name);
char *lpcfg_private_path(TALLOC_CTX* mem_ctx,
struct loadparm_context *lp_ctx,
const char *name);
char *smbd_tmp_path(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx,
const char *name);
/**
* Return the max print jobs per queue.
* 查詢相關屬性的值
*/
int lpcfg_maxprintjobs(struct loadparm_service *service, struct loadparm_service *sDefault);
struct smb_iconv_handle *lpcfg_iconv_handle(struct loadparm_context *lp_ctx);
void lpcfg_smbcli_options(struct loadparm_context *lp_ctx,
struct smbcli_options *options);
void lpcfg_smbcli_session_options(struct loadparm_context *lp_ctx,
struct smbcli_session_options *options);
const char **lpcfg_smb_ports(struct loadparm_context *);
const char *lpcfg_socket_options(struct loadparm_context *);
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 *);
/*
* Create a new talloc stack frame.
* 記憶體分配
* When free'd, it frees all stack frames that were created after this one and
* not explicitly freed.
*/
#define talloc_stackframe() _talloc_stackframe(__location__)
/*
* Get us the current top of the talloc stack.3
*/
#define talloc_tos() _talloc_tos(__location__)
TALLOC_CTX *_talloc_tos(const char *location);
/*
* return true if a talloc stackframe exists
* this can be used to prevent memory leaks for code that can
* optionally use a talloc stackframe (eg. nt_errstr())
*/
bool talloc_stackframe_exists(void);
/*******************param.h*******************************/
/**
* Initialise the global parameter structure.
初始化(記憶體)引數上下文
*/
struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx);
struct loadparm_context *loadparm_init_global(bool load_default);
const char *lpcfg_configfile(struct loadparm_context *lp_ctx);
const char *lp_default_path(void);
/**
* Load the services array from the services file.
*用配置檔案填充(記憶體)引數上下文
* Return True on success, False on failure.
*/
bool lpcfg_load(struct loadparm_context *lp_ctx, const char *filename);
bool lpcfg_load_default(struct loadparm_context *lp_ctx);
/**
* Return the max number of services.
* 返回共享服務數目( [share name] 個數 )
*/
int lpcfg_numservices(struct loadparm_context *lp_ctx);
/**
* Display the contents of the services array in human-readable form.
* 顯示當前所有共享的所有引數 ,輸出重定向f,show_defaults決定是否顯示預設引數
* 輸出的服務數目由maxtoprint決定,
*/
void lpcfg_dump(struct loadparm_context *lp_ctx, FILE *f, bool show_defaults,
int maxtoprint);
/**
* Display the contents of one service in human-readable form.
*顯示指定共享(service)的所有引數
*/
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,
int snum);
struct loadparm_service *lpcfg_service(struct loadparm_context *lp_ctx,
const char *service_name);
const char *lpcfg_servicename(const struct loadparm_service *service);
/**
* Display the contents of a single services record.
* 顯示指定共享(service)指定引數(parm_name) 的引數值
*/
bool lpcfg_dump_a_parameter(struct loadparm_context *lp_ctx,
struct loadparm_service *service,
const char *parm_name, FILE * f);
/*
*設定指定共享(service)的指定引數(ParmName)值(ParmValue)
*此設定只是在記憶體中修改,(要儲存,需要寫入檔案)
*/
bool lpcfg_do_service_parameter(struct loadparm_context *lp_ctx,
struct loadparm_service *service,
const char *pszParmName, const char *pszParmValue);
/**
* Process a parameter.
* 設定全域性 屬性 ParaName=ParaValue
*/
bool lpcfg_do_global_parameter(struct loadparm_context *lp_ctx,
const char *pszParmName, const char *pszParmValue);
bool lpcfg_do_global_parameter_var(struct loadparm_context *lp_ctx,
const char *pszParmName, const char *fmt, ...);
bool lpcfg_set_cmdline(struct loadparm_context *lp_ctx, const char *pszParmName,
const char *pszParmValue);
bool lpcfg_set_option(struct loadparm_context *lp_ctx, const char *option);
/**
* Return info about the next service in a service. snum==-1 gives the globals.
* Return NULL when out of parameters.
*/
struct parm_struct *lpcfg_next_parameter(struct loadparm_context *lp_ctx, int snum, int *i,
int allparameters);
/* The following definitions come from lib/version.c
* 顯示samba版本號
*/
const char *samba_version_string(void);
bool lpcfg_is_mydomain(struct loadparm_context *lp_ctx,
const char *domain);
bool lpcfg_is_my_domain_or_realm(struct loadparm_context *lp_ctx,
const char *domain);
/**
see if a string matches either our primary or one of our secondary
netbios aliases. do a case insensitive match
*/
bool lpcfg_is_myname(struct loadparm_context *lp_ctx, const char *name);
/*************查詢全域性屬性的值***************/
const char **lpcfg_interfaces(struct loadparm_context *);
const char *lpcfg_realm(struct loadparm_context *);
const char *lpcfg_netbios_name(struct loadparm_context *);
const char *lpcfg_private_dir(struct loadparm_context *);
enum server_role {
ROLE_STANDALONE = 0,
ROLE_DOMAIN_MEMBER = 1,
ROLE_DOMAIN_BDC = 2,
ROLE_DOMAIN_PDC = 3,
/* not in samr.idl */
ROLE_ACTIVE_DIRECTORY_DC = 4,
/* To determine the role automatically, this is not a valid role */
ROLE_AUTO = 100
};
int lpcfg_server_role(struct loadparm_context *);
int lpcfg_allow_dns_updates(struct loadparm_context *);
bool lpcfg_is_mydomain(struct loadparm_context *lp_ctx,
const char *domain);
bool lpcfg_is_my_domain_or_realm(struct loadparm_context *lp_ctx,
const char *domain);
bool lpcfg_is_myname(struct loadparm_context *lp_ctx, const char *name);
/*
*查詢指定檔案所在的位置(目錄)
*
*/
char *lpcfg_lock_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
const char *name);
char *lpcfg_config_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
const char *name);
char *lpcfg_private_path(TALLOC_CTX* mem_ctx,
struct loadparm_context *lp_ctx,
const char *name);
char *smbd_tmp_path(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx,
const char *name);
/**
* Return the max print jobs per queue.
* 查詢相關屬性的值
*/
int lpcfg_maxprintjobs(struct loadparm_service *service, struct loadparm_service *sDefault);
struct smb_iconv_handle *lpcfg_iconv_handle(struct loadparm_context *lp_ctx);
void lpcfg_smbcli_options(struct loadparm_context *lp_ctx,
struct smbcli_options *options);
void lpcfg_smbcli_session_options(struct loadparm_context *lp_ctx,
struct smbcli_session_options *options);
const char **lpcfg_smb_ports(struct loadparm_context *);
const char *lpcfg_socket_options(struct loadparm_context *);
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 *);