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

Function cmd_pipeline_table_show

dpdk/examples/pipeline/cli.c:1146–1183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1144"pipeline <pipeline_name> table <table_name> show [filename]\n";
1145
1146static void
1147cmd_pipeline_table_show(char **tokens,
1148 uint32_t n_tokens,
1149 char *out,
1150 size_t out_size,
1151 void *obj __rte_unused)
1152{
1153 struct rte_swx_ctl_pipeline *ctl;
1154 char *pipeline_name, *table_name;
1155 FILE *file = NULL;
1156 int status;
1157
1158 if (n_tokens != 5 && n_tokens != 6) {
1159 snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
1160 return;
1161 }
1162
1163 pipeline_name = tokens[1];
1164 ctl = rte_swx_ctl_pipeline_find(pipeline_name);
1165 if (!ctl) {
1166 snprintf(out, out_size, MSG_ARG_INVALID, "pipeline_name");
1167 return;
1168 }
1169
1170 table_name = tokens[3];
1171 file = (n_tokens == 6) ? fopen(tokens[5], "w") : stdout;
1172 if (!file) {
1173 snprintf(out, out_size, "Cannot open file %s.\n", tokens[5]);
1174 return;
1175 }
1176
1177 status = rte_swx_ctl_pipeline_table_fprintf(file, ctl, table_name);
1178 if (status)
1179 snprintf(out, out_size, MSG_ARG_INVALID, "table_name");
1180
1181 if (file)
1182 fclose(file);
1183}
1184
1185static const char cmd_pipeline_selector_group_add_help[] =
1186"pipeline <pipeline_name> selector <selector_name> group add\n";

Callers 1

cli_processFunction · 0.85

Calls 3

snprintfFunction · 0.85

Tested by

no test coverage detected