#define _HAPROXY_SAMPLE_T_H
#include <haproxy/api-t.h>
+#include <haproxy/tinfo-t.h>
#include <haproxy/sample_data-t.h>
/* input and output sample types
unsigned int in_type; /* expected input sample type */
unsigned int out_type; /* output sample type */
void *private; /* private values. only used by maps and Lua */
+ struct thread_exec_ctx exec_ctx; /* execution context */
};
/* sample conversion expression */
unsigned int use; /* fetch source (SMP_USE_*) */
unsigned int val; /* fetch validity (SMP_VAL_*) */
void *private; /* private values. only used by Lua */
+ struct thread_exec_ctx exec_ctx; /* execution context */
};
/* sample expression */
/* Run the sample fetch process. */
smp_set_owner(&smp, hsmp->p, hsmp->s->sess, hsmp->s, hsmp->dir & SMP_OPT_DIR);
- if (!f->process(args, &smp, f->kw, f->private)) {
+ if (!EXEC_CTX_WITH_RET(f->exec_ctx, f->process(args, &smp, f->kw, f->private))) {
if (hsmp->flags & HLUA_F_AS_STRING)
lua_pushstring(L, "");
else
}
/* Run the sample conversion process. */
- if (!conv->process(args, &smp, conv->private)) {
+ if (!EXEC_CTX_WITH_RET(conv->exec_ctx, conv->process(args, &smp, conv->private))) {
if (hsmp->flags & HLUA_F_AS_STRING)
lua_pushstring(L, "");
else
for (bit = 0; bit < SMP_SRC_ENTRIES; bit++)
if (sf->use & (1 << bit))
sf->val |= fetch_cap[bit];
+ /* store declaration file/line if known */
+ if (sf->exec_ctx.type)
+ continue;
+
+ if (caller_initcall) {
+ sf->exec_ctx.type = TH_EX_CTX_INITCALL;
+ sf->exec_ctx.initcall = caller_initcall;
+ }
}
LIST_APPEND(&sample_fetches.list, &kwl->list);
}
*/
void sample_register_convs(struct sample_conv_kw_list *pckl)
{
+ struct sample_conv *sc;
+
+ /* store declaration file/line if known */
+ for (sc = pckl->kw; sc->kw != NULL; sc++) {
+ if (sc->exec_ctx.type)
+ continue;
+
+ if (caller_initcall) {
+ sc->exec_ctx.type = TH_EX_CTX_INITCALL;
+ sc->exec_ctx.initcall = caller_initcall;
+ }
+ }
LIST_APPEND(&sample_convs.list, &pckl->list);
}
}
/* OK cast succeeded */
-
- if (!conv_expr->conv->process(conv_expr->arg_p, p, conv_expr->conv->private))
+ if (!EXEC_CTX_WITH_RET(conv_expr->conv->exec_ctx,
+ conv_expr->conv->process(conv_expr->arg_p, p, conv_expr->conv->private)))
return 0;
}
return 1;
}
smp_set_owner(p, px, sess, strm, opt);
- if (!expr->fetch->process(expr->arg_p, p, expr->fetch->kw, expr->fetch->private))
+ if (!EXEC_CTX_WITH_RET(expr->fetch->exec_ctx,
+ expr->fetch->process(expr->arg_p, p, expr->fetch->kw, expr->fetch->private)))
return NULL;
if (!sample_process_cnv(expr, p))