return lp_ctx->globals->var_name ? talloc_strdup(ctx, lpcfg_string(lp_ctx->globals->var_name)) : talloc_strdup(ctx, ""); \
}
+#define FN_GLOBAL_SUBSTITUTED_STRING(fn_name,var_name) \
+ _PUBLIC_ char *lpcfg_ ## fn_name(struct loadparm_context *lp_ctx, \
+ const struct loadparm_substitution *lp_sub, TALLOC_CTX *mem_ctx) \
+{ \
+ if (lp_ctx == NULL) return NULL; \
+ return lpcfg_substituted_string(mem_ctx, lp_sub, \
+ lp_ctx->globals->var_name ? lp_ctx->globals->var_name : ""); \
+}
+
#define FN_GLOBAL_CONST_STRING(fn_name,var_name) \
_PUBLIC_ const char *lpcfg_ ## fn_name(struct loadparm_context *lp_ctx) { \
if (lp_ctx == NULL) return NULL; \
return(talloc_strdup(ctx, lpcfg_string((const char *)((service != NULL && service->val != NULL) ? service->val : sDefault->val)))); \
}
+/* just a copy for now */
+#define FN_LOCAL_SUBSTITUTED_STRING(fn_name,val) FN_LOCAL_STRING(fn_name,val)
+
#define FN_LOCAL_CONST_STRING(fn_name,val) \
_PUBLIC_ const char *lpcfg_ ## fn_name(struct loadparm_service *service, \
struct loadparm_service *sDefault) { \
#define _PARAM_H
struct loadparm_s3_helpers;
+struct loadparm_substitution;
struct parmlist_entry;
continue
constant = parameter.attrib.get("constant")
+ substitution = parameter.attrib.get("substitution")
parm = parameter.attrib.get("parm")
if name is None or param_type is None or context is None:
raise Exception("Error parsing parameter: " + name)
'context': context,
'function': func,
'constant': (constant == '1'),
+ 'substitution': (substitution == '1'),
'parm': (parm == '1'),
'synonym' : synonym,
'generated' : generated,
output_string += temp
if parameter['constant']:
output_string += "_CONST"
+ if parameter['substitution']:
+ output_string += "_SUBSTITUTED"
if parameter['parm']:
output_string += "_PARM"
temp = param_type_dict.get(parameter['type'])
else:
param = "int"
- if parameter['type'] == 'string' and not parameter['constant']:
+ if parameter['type'] == 'string' and parameter['substitution']:
+ if parameter['context'] == 'G':
+ output_string += '(TALLOC_CTX *ctx, const struct loadparm_substitution *lp_sub);\n'
+ elif parameter['context'] == 'S':
+ output_string += '(TALLOC_CTX *ctx, const struct loadparm_substitution *lp_sub, %s);\n' % param
+ else:
+ raise Exception(parameter['name'] + " has an invalid param type " + parameter['type'])
+ elif parameter['type'] == 'string' and not parameter['constant']:
if parameter['context'] == 'G':
output_string += '(TALLOC_CTX *ctx);\n'
elif parameter['context'] == 'S':
output_string += "lpcfg_%s" % parameter['function']
- if parameter['type'] == 'string' and not parameter['constant']:
+ if parameter['type'] == 'string' and parameter['substitution']:
+ if parameter['context'] == 'G':
+ output_string += '(struct loadparm_context *, const struct loadparm_substitution *lp_sub, TALLOC_CTX *ctx);\n'
+ elif parameter['context'] == 'S':
+ output_string += '(struct loadparm_service *, struct loadparm_service *, TALLOC_CTX *ctx);\n'
+ else:
+ raise Exception(parameter['name'] + " has an invalid context " + parameter['context'])
+ elif parameter['type'] == 'string' and not parameter['constant']:
if parameter['context'] == 'G':
output_string += '(struct loadparm_context *, TALLOC_CTX *ctx);\n'
elif parameter['context'] == 'S':
#include "lib/util/samba_util.h"
#include "lib/util_path.h"
+struct loadparm_substitution;
struct share_params;
#include "source3/param/param_proto.h"
#define FN_GLOBAL_STRING(fn_name,ptr) \
char *lp_ ## fn_name(TALLOC_CTX *ctx) {return(lp_string((ctx), *(char **)(&Globals.ptr) ? *(char **)(&Globals.ptr) : ""));}
+#define FN_GLOBAL_SUBSTITUTED_STRING(fn_name,ptr) \
+char *lp_ ## fn_name(TALLOC_CTX *ctx, const struct loadparm_substitution *lp_sub) \
+ {return lpcfg_substituted_string(ctx, lp_sub, *(char **)(&Globals.ptr) ? *(char **)(&Globals.ptr) : "");}
#define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
const char *lp_ ## fn_name(void) {return(*(const char * const *)(&Globals.ptr) ? *(const char * const *)(&Globals.ptr) : "");}
#define FN_GLOBAL_LIST(fn_name,ptr) \
#define FN_LOCAL_STRING(fn_name,val) \
char *lp_ ## fn_name(TALLOC_CTX *ctx,int i) {return(lp_string((ctx), (LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
+#define FN_LOCAL_SUBSTITUTED_STRING(fn_name,val) \
+char *lp_ ## fn_name(TALLOC_CTX *ctx, const struct loadparm_substitution *lp_sub, int i) \
+ {return lpcfg_substituted_string((ctx), lp_sub, (LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
#define FN_LOCAL_CONST_STRING(fn_name,val) \
const char *lp_ ## fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
#define FN_LOCAL_LIST(fn_name,val) \