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

Function parse_cb_ipv6_trace

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

* Parse ClassBench input trace (test vectors and expected results) file. * Expected format: * \ * */

Source from the content-addressed store, hash-verified

481 * <src_port> <space> <dst_port> <space> <proto>
482 */
483static int
484parse_cb_ipv6_trace(char *str, struct ipv6_5tuple *v)
485{
486 int32_t i, rc;
487 char *s, *sp, *in[CB_TRC_NUM];
488 static const char *dlm = " \t\n";
489
490 s = str;
491 for (i = 0; i != RTE_DIM(in); i++) {
492 in[i] = strtok_r(s, dlm, &sp);
493 if (in[i] == NULL)
494 return -EINVAL;
495 s = NULL;
496 }
497
498 /* get ip6 src address. */
499 rc = parse_cb_ipv6_addr_trace(in[CB_TRC_SRC_ADDR], v->ip_src);
500 if (rc != 0)
501 return rc;
502
503 /* get ip6 dst address. */
504 rc = parse_cb_ipv6_addr_trace(in[CB_TRC_DST_ADDR], v->ip_dst);
505 if (rc != 0)
506 return rc;
507
508 GET_CB_FIELD(in[CB_TRC_SRC_PORT], v->port_src, 0, UINT16_MAX, 0);
509 GET_CB_FIELD(in[CB_TRC_DST_PORT], v->port_dst, 0, UINT16_MAX, 0);
510 GET_CB_FIELD(in[CB_TRC_PROTO], v->proto, 0, UINT8_MAX, 0);
511
512 /* convert to network byte order. */
513 v->port_src = rte_cpu_to_be_16(v->port_src);
514 v->port_dst = rte_cpu_to_be_16(v->port_dst);
515
516 return 0;
517}
518
519/* Bypass comment and empty lines */
520static int

Callers 1

tracef_initFunction · 0.85

Calls 1

parse_cb_ipv6_addr_traceFunction · 0.85

Tested by

no test coverage detected