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

Function get_input_opts

dpdk/app/test-acl/main.c:1233–1305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1231
1232
1233static void
1234get_input_opts(int argc, char **argv)
1235{
1236 static struct option lgopts[] = {
1237 {OPT_RULE_FILE, 1, 0, 0},
1238 {OPT_TRACE_FILE, 1, 0, 0},
1239 {OPT_TRACE_NUM, 1, 0, 0},
1240 {OPT_RULE_NUM, 1, 0, 0},
1241 {OPT_MAX_SIZE, 1, 0, 0},
1242 {OPT_TRACE_STEP, 1, 0, 0},
1243 {OPT_BLD_CATEGORIES, 1, 0, 0},
1244 {OPT_RUN_CATEGORIES, 1, 0, 0},
1245 {OPT_ITER_NUM, 1, 0, 0},
1246 {OPT_VERBOSE, 1, 0, 0},
1247 {OPT_SEARCH_ALG, 1, 0, 0},
1248 {OPT_IPV6, 2, 0, 0},
1249 {NULL, 0, 0, 0}
1250 };
1251
1252 int opt, opt_idx;
1253
1254 while ((opt = getopt_long(argc, argv, "", lgopts, &opt_idx)) != EOF) {
1255
1256 if (opt != 0) {
1257 print_usage(config.prgname);
1258 rte_exit(-EINVAL, "unknown option: %c", opt);
1259 }
1260
1261 if (strcmp(lgopts[opt_idx].name, OPT_RULE_FILE) == 0) {
1262 config.rule_file = optarg;
1263 } else if (strcmp(lgopts[opt_idx].name, OPT_TRACE_FILE) == 0) {
1264 config.trace_file = optarg;
1265 } else if (strcmp(lgopts[opt_idx].name, OPT_RULE_NUM) == 0) {
1266 config.nb_rules = get_ulong_opt(optarg,
1267 lgopts[opt_idx].name, 1, RTE_ACL_MAX_INDEX + 1);
1268 } else if (strcmp(lgopts[opt_idx].name, OPT_MAX_SIZE) == 0) {
1269 config.max_size = get_ulong_opt(optarg,
1270 lgopts[opt_idx].name, 0, SIZE_MAX);
1271 } else if (strcmp(lgopts[opt_idx].name, OPT_TRACE_NUM) == 0) {
1272 config.nb_traces = get_ulong_opt(optarg,
1273 lgopts[opt_idx].name, 1, UINT32_MAX);
1274 } else if (strcmp(lgopts[opt_idx].name, OPT_TRACE_STEP) == 0) {
1275 config.trace_step = get_ulong_opt(optarg,
1276 lgopts[opt_idx].name, 1, TRACE_STEP_MAX);
1277 } else if (strcmp(lgopts[opt_idx].name,
1278 OPT_BLD_CATEGORIES) == 0) {
1279 config.bld_categories = get_ulong_opt(optarg,
1280 lgopts[opt_idx].name, 1,
1281 RTE_ACL_MAX_CATEGORIES);
1282 } else if (strcmp(lgopts[opt_idx].name,
1283 OPT_RUN_CATEGORIES) == 0) {
1284 config.run_categories = get_ulong_opt(optarg,
1285 lgopts[opt_idx].name, 1,
1286 RTE_ACL_MAX_CATEGORIES);
1287 } else if (strcmp(lgopts[opt_idx].name, OPT_ITER_NUM) == 0) {
1288 config.iter_num = get_ulong_opt(optarg,
1289 lgopts[opt_idx].name, 1, INT32_MAX);
1290 } else if (strcmp(lgopts[opt_idx].name, OPT_VERBOSE) == 0) {

Callers 1

mainFunction · 0.85

Calls 7

getopt_longFunction · 0.85
rte_exitFunction · 0.85
strcmpFunction · 0.85
get_ulong_optFunction · 0.85
get_alg_optFunction · 0.85
get_ipv6_optFunction · 0.85
print_usageFunction · 0.70

Tested by

no test coverage detected