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

Function parse_table_action

dpdk/examples/ip_pipeline/cli.c:4060–4251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4058}
4059
4060static uint32_t
4061parse_table_action(char **tokens,
4062 uint32_t n_tokens,
4063 char *out,
4064 size_t out_size,
4065 struct table_rule_action *a)
4066{
4067 uint32_t n_tokens0 = n_tokens;
4068
4069 memset(a, 0, sizeof(*a));
4070
4071 if ((n_tokens < 2) ||
4072 strcmp(tokens[0], "action"))
4073 return 0;
4074
4075 tokens++;
4076 n_tokens--;
4077
4078 if (n_tokens && (strcmp(tokens[0], "fwd") == 0)) {
4079 uint32_t n;
4080
4081 n = parse_table_action_fwd(tokens, n_tokens, a);
4082 if (n == 0) {
4083 snprintf(out, out_size, MSG_ARG_INVALID,
4084 "action fwd");
4085 return 0;
4086 }
4087
4088 tokens += n;
4089 n_tokens -= n;
4090 }
4091
4092 if (n_tokens && (strcmp(tokens[0], "balance") == 0)) {
4093 uint32_t n;
4094
4095 n = parse_table_action_balance(tokens, n_tokens, a);
4096 if (n == 0) {
4097 snprintf(out, out_size, MSG_ARG_INVALID,
4098 "action balance");
4099 return 0;
4100 }
4101
4102 tokens += n;
4103 n_tokens -= n;
4104 }
4105
4106 if (n_tokens && (strcmp(tokens[0], "meter") == 0)) {
4107 uint32_t n;
4108
4109 n = parse_table_action_meter(tokens, n_tokens, a);
4110 if (n == 0) {
4111 snprintf(out, out_size, MSG_ARG_INVALID,
4112 "action meter");
4113 return 0;
4114 }
4115
4116 tokens += n;
4117 n_tokens -= n;

Callers 2

cli_rule_file_processFunction · 0.85

Calls 15

memsetFunction · 0.85
strcmpFunction · 0.85
parse_table_action_fwdFunction · 0.85
snprintfFunction · 0.85
parse_table_action_meterFunction · 0.85
parse_table_action_tmFunction · 0.85
parse_table_action_encapFunction · 0.85
parse_table_action_natFunction · 0.85
parse_table_action_ttlFunction · 0.85
parse_table_action_statsFunction · 0.85
parse_table_action_timeFunction · 0.85

Tested by

no test coverage detected