static int table_process_entry_per_key(struct appctx *appctx, char **args)
{
struct stream_interface *si = appctx->owner;
- int action = (long)appctx->private;
struct proxy *px = appctx->ctx.table.target;
struct stksess *ts;
uint32_t uint32_key;
static_table_key->key_len = strlen(args[4]);
break;
default:
- switch (action) {
+ switch (appctx->ctx.table.action) {
case STK_CLI_ACT_SHOW:
appctx->ctx.cli.msg = "Showing keys from tables of type other than ip, ipv6, string and integer is not supported\n";
break;
ts = stktable_lookup_key(&px->table, static_table_key);
- switch (action) {
+ switch (appctx->ctx.table.action) {
case STK_CLI_ACT_SHOW:
if (!ts)
return 1;
*/
static int table_prepare_data_request(struct appctx *appctx, char **args)
{
- int action = (long)appctx->private;
-
- if (action != STK_CLI_ACT_SHOW && action != STK_CLI_ACT_CLR) {
+ if (appctx->ctx.table.action != STK_CLI_ACT_SHOW && appctx->ctx.table.action != STK_CLI_ACT_CLR) {
appctx->ctx.cli.msg = "content-based lookup is only supported with the \"show\" and \"clear\" actions";
appctx->st0 = CLI_ST_PRINT;
return 1;
/* returns 0 if wants to be called, 1 if has ended processing */
static int cli_parse_table_req(char **args, struct appctx *appctx, void *private)
{
- int action = (long)private;
-
- appctx->private = private;
appctx->ctx.table.data_type = -1;
appctx->ctx.table.target = NULL;
appctx->ctx.table.proxy = NULL;
appctx->ctx.table.entry = NULL;
+ appctx->ctx.table.action = (long)private; // keyword argument, one of STK_CLI_ACT_*
if (*args[2]) {
appctx->ctx.table.target = proxy_tbl_by_name(args[2]);
}
}
else {
- if (action != STK_CLI_ACT_SHOW)
+ if (appctx->ctx.table.action != STK_CLI_ACT_SHOW)
goto err_args;
return 0;
}
return 0;
err_args:
- switch (action) {
+ switch (appctx->ctx.table.action) {
case STK_CLI_ACT_SHOW:
appctx->ctx.cli.msg = "Optional argument only supports \"data.<store_data_type>\" <operator> <value> and key <key>\n";
break;
static int cli_io_handler_table(struct appctx *appctx)
{
struct stream_interface *si = appctx->owner;
- int action = (long)appctx->private;
struct stream *s = si_strm(si);
struct ebmb_node *eb;
int dt;
int skip_entry;
- int show = action == STK_CLI_ACT_SHOW;
+ int show = appctx->ctx.table.action == STK_CLI_ACT_SHOW;
/*
* We have 3 possible states in appctx->st2 :