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

Function print_result

dpdk/app/test-sad/main.c:457–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455}
456
457static void
458print_result(const union rte_ipsec_sad_key *key, void *res)
459{
460 struct rule *rule = res;
461 const struct rte_ipsec_sadv4_key *v4;
462 const struct rte_ipsec_sadv6_key *v6;
463 const char *spi_only = "SPI_ONLY";
464 const char *spi_dip = "SPI_DIP";
465 const char *spi_dip_sip = "SPI_DIP_SIP";
466 const char *rule_type;
467 const void *dip, *sip;
468 uint32_t spi;
469 int af;
470
471 af = (config.ipv6) ? AF_INET6 : AF_INET;
472 v4 = &key->v4;
473 v6 = &key->v6;
474 spi = (config.ipv6 == 0) ? v4->spi : v6->spi;
475 dip = (config.ipv6 == 0) ? &v4->dip : (const void *)v6->dip;
476 sip = (config.ipv6 == 0) ? &v4->sip : (const void *)v6->sip;
477
478 if (res == NULL) {
479 printf("TUPLE: ");
480 print_tuple(af, spi, dip, sip);
481 printf(" not found\n");
482 return;
483 }
484
485 switch (rule->rule_type) {
486 case RTE_IPSEC_SAD_SPI_ONLY:
487 rule_type = spi_only;
488 break;
489 case RTE_IPSEC_SAD_SPI_DIP:
490 rule_type = spi_dip;
491 break;
492 case RTE_IPSEC_SAD_SPI_DIP_SIP:
493 rule_type = spi_dip_sip;
494 break;
495 default:
496 return;
497 }
498
499 print_tuple(af, spi, dip, sip);
500 v4 = &rule->tuple.v4;
501 v6 = &rule->tuple.v6;
502 spi = (config.ipv6 == 0) ? v4->spi : v6->spi;
503 dip = (config.ipv6 == 0) ? &v4->dip : (const void *)v6->dip;
504 sip = (config.ipv6 == 0) ? &v4->sip : (const void *)v6->sip;
505 printf("\n\tpoints to RULE ID %zu ",
506 RTE_PTR_DIFF(res, rules_tbl)/sizeof(struct rule));
507 print_tuple(af, spi, dip, sip);
508 printf(" %s\n", rule_type);
509}
510
511static int
512lookup(void *arg)

Callers 1

lookupFunction · 0.85

Calls 2

print_tupleFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected