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

Function cmd_pipeline_table_rule_add

dpdk/examples/ip_pipeline/cli.c:4259–4333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4257" action <table_action>\n";
4258
4259static void
4260cmd_pipeline_table_rule_add(char **tokens,
4261 uint32_t n_tokens,
4262 char *out,
4263 size_t out_size)
4264{
4265 struct table_rule_match m;
4266 struct table_rule_action a;
4267 char *pipeline_name;
4268 uint32_t table_id, t0, n_tokens_parsed;
4269 int status;
4270
4271 if (n_tokens < 8) {
4272 snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
4273 return;
4274 }
4275
4276 pipeline_name = tokens[1];
4277
4278 if (strcmp(tokens[2], "table") != 0) {
4279 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "table");
4280 return;
4281 }
4282
4283 if (parser_read_uint32(&table_id, tokens[3]) != 0) {
4284 snprintf(out, out_size, MSG_ARG_INVALID, "table_id");
4285 return;
4286 }
4287
4288 if (strcmp(tokens[4], "rule") != 0) {
4289 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "rule");
4290 return;
4291 }
4292
4293 if (strcmp(tokens[5], "add") != 0) {
4294 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "add");
4295 return;
4296 }
4297
4298 t0 = 6;
4299
4300 /* match */
4301 n_tokens_parsed = parse_match(tokens + t0,
4302 n_tokens - t0,
4303 out,
4304 out_size,
4305 &m);
4306 if (n_tokens_parsed == 0)
4307 return;
4308 t0 += n_tokens_parsed;
4309
4310 /* action */
4311 n_tokens_parsed = parse_table_action(tokens + t0,
4312 n_tokens - t0,
4313 out,
4314 out_size,
4315 &a);
4316 if (n_tokens_parsed == 0)

Callers 1

cli_processFunction · 0.85

Calls 7

snprintfFunction · 0.85
strcmpFunction · 0.85
parse_matchFunction · 0.85
parse_table_actionFunction · 0.85
pipeline_table_rule_addFunction · 0.85
parser_read_uint32Function · 0.70

Tested by

no test coverage detected