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

Function parse_cb_ipv4_trace

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

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

Source from the content-addressed store, hash-verified

436 * <src_port> <space> <dst_port> <space> <proto>
437 */
438static int
439parse_cb_ipv4_trace(char *str, struct ipv4_5tuple *v)
440{
441 int i;
442 char *s, *sp, *in[CB_TRC_NUM];
443 static const char *dlm = " \t\n";
444
445 s = str;
446 for (i = 0; i != RTE_DIM(in); i++) {
447 in[i] = strtok_r(s, dlm, &sp);
448 if (in[i] == NULL)
449 return -EINVAL;
450 s = NULL;
451 }
452
453 GET_CB_FIELD(in[CB_TRC_SRC_ADDR], v->ip_src, 0, UINT32_MAX, 0);
454 GET_CB_FIELD(in[CB_TRC_DST_ADDR], v->ip_dst, 0, UINT32_MAX, 0);
455 GET_CB_FIELD(in[CB_TRC_SRC_PORT], v->port_src, 0, UINT16_MAX, 0);
456 GET_CB_FIELD(in[CB_TRC_DST_PORT], v->port_dst, 0, UINT16_MAX, 0);
457 GET_CB_FIELD(in[CB_TRC_PROTO], v->proto, 0, UINT8_MAX, 0);
458
459 /* convert to network byte order. */
460 v->ip_src = rte_cpu_to_be_32(v->ip_src);
461 v->ip_dst = rte_cpu_to_be_32(v->ip_dst);
462 v->port_src = rte_cpu_to_be_16(v->port_src);
463 v->port_dst = rte_cpu_to_be_16(v->port_dst);
464
465 return 0;
466}
467
468static int
469parse_cb_ipv6_addr_trace(const char *in, uint32_t v[IPV6_ADDR_U32])

Callers 1

tracef_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected