MINOR: sample: fill the struct sample with the options.

Options are relative to the sample. Each sample fetched is associated with
fetch options or fetch flags.

This patch adds the 'opt' vaue in the sample struct. This permits to reduce
the sample-fetch function prototype. In other way, the converters will have
more detail about the origin of the sample.
This commit is contained in:
Thierry FOURNIER 2015-05-11 15:25:29 +02:00 committed by Willy Tarreau
parent 0a9a2b8cec
commit 1d33b882d2
3 changed files with 4 additions and 0 deletions

View File

@ -252,6 +252,7 @@ struct sample {
struct proxy *px;
struct session *sess;
struct stream *strm;
unsigned int opt; /* fetch options (SMP_OPT_*) */
};
/* Used to store sample constant */

View File

@ -2773,6 +2773,7 @@ __LJMP static int hlua_run_sample_fetch(lua_State *L)
smp.px = hsmp->p;
smp.sess = hsmp->s->sess;
smp.strm = hsmp->s;
smp.opt = 0;
if (!f->process(0, args, &smp, f->kw, f->private)) {
if (hsmp->stringsafe)
lua_pushstring(L, "");
@ -2894,6 +2895,7 @@ __LJMP static int hlua_run_sample_conv(lua_State *L)
smp.px = hsmp->p;
smp.sess = hsmp->s->sess;
smp.strm = hsmp->s;
smp.opt = 0;
if (!conv->process(args, &smp, conv->private)) {
if (hsmp->stringsafe)
lua_pushstring(L, "");

View File

@ -1036,6 +1036,7 @@ struct sample *sample_process(struct proxy *px, struct session *sess,
p->px = px;
p->sess = sess;
p->strm = strm;
p->opt = opt;
if (!expr->fetch->process(opt, expr->arg_p, p, expr->fetch->kw, expr->fetch->private))
return NULL;