1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2016 Intel Corporation
5 #ifndef __INCLUDE_SOFTNIC_PARSER_H__
6 #define __INCLUDE_SOFTNIC_PARSER_H__
11 #include <rte_ether.h>
13 #define PARSE_DELIMITER " \f\n\r\t\v"
15 #define skip_white_spaces(pos) \
17 __typeof__(pos) _p = (pos); \
18 for ( ; isspace(*_p); _p++) \
24 skip_digits(const char *src)
28 for (i = 0; isdigit(src[i]); i++)
34 int softnic_parser_read_arg_bool(const char *p);
36 int softnic_parser_read_int32(int32_t *value, const char *p);
38 int softnic_parser_read_uint64(uint64_t *value, const char *p);
39 int softnic_parser_read_uint32(uint32_t *value, const char *p);
40 int softnic_parser_read_uint16(uint16_t *value, const char *p);
41 int softnic_parser_read_uint8(uint8_t *value, const char *p);
43 int softnic_parser_read_uint64_hex(uint64_t *value, const char *p);
44 int softnic_parser_read_uint32_hex(uint32_t *value, const char *p);
45 int softnic_parser_read_uint16_hex(uint16_t *value, const char *p);
46 int softnic_parser_read_uint8_hex(uint8_t *value, const char *p);
48 int softnic_parse_hex_string(char *src, uint8_t *dst, uint32_t *size);
50 int softnic_parse_ipv4_addr(const char *token, struct in_addr *ipv4);
51 int softnic_parse_ipv6_addr(const char *token, struct in6_addr *ipv6);
52 int softnic_parse_mac_addr(const char *token, struct rte_ether_addr *addr);
53 int softnic_parse_mpls_labels(char *string,
54 uint32_t *labels, uint32_t *n_labels);
56 struct softnic_cpu_core_params {
62 int softnic_parse_cpu_core(const char *entry,
63 struct softnic_cpu_core_params *p);
65 int softnic_parse_tokenize_string(char *string,
66 char *tokens[], uint32_t *n_tokens);