MCPcopy Create free account
hub / github.com/F-Stack/f-stack / parse_action

Function parse_action

dpdk/app/test-pmd/cmdline_flow.c:10023–10055  ·  view source on GitHub ↗

Parse action names. */

Source from the content-addressed store, hash-verified

10021
10022/** Parse action names. */
10023static int
10024parse_action(struct context *ctx, const struct token *token,
10025 const char *str, unsigned int len,
10026 void *buf, unsigned int size)
10027{
10028 struct buffer *out = buf;
10029 const struct arg *arg = pop_args(ctx);
10030 unsigned int i;
10031
10032 (void)size;
10033 /* Argument is expected. */
10034 if (!arg)
10035 return -1;
10036 /* Parse action name. */
10037 for (i = 0; next_action[i]; ++i) {
10038 const struct parse_action_priv *priv;
10039
10040 token = &token_list[next_action[i]];
10041 if (strcmp_partial(token->name, str, len))
10042 continue;
10043 priv = token->priv;
10044 if (!priv)
10045 goto error;
10046 if (out)
10047 memcpy((uint8_t *)ctx->object + arg->offset,
10048 &priv->type,
10049 arg->size);
10050 return len;
10051 }
10052error:
10053 push_args(ctx, arg);
10054 return -1;
10055}
10056
10057/** Parse tokens for list command. */
10058static int

Callers

nothing calls this directly

Calls 4

pop_argsFunction · 0.85
strcmp_partialFunction · 0.85
push_argsFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected