-
Notifications
You must be signed in to change notification settings - Fork 0
/
parser.h
48 lines (37 loc) · 1.54 KB
/
parser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <rte_ip.h>
#ifndef __VE_PARSER_H
#define __VE_PARSER_H
#define is_multicast_ipv4_addr(ipv4_addr) \
(((rte_be_to_cpu_32((ipv4_addr)) >> 24) & 0x000000FF) == 0xE0)
#define DOT "."
struct configuration * parse_args(int argc, char **argv);
static int get_ip_address_type(const char *ip);
static int is_valid_digit(const char *c);
static int parse_number(const char *q_arg);
static int process_ip_addr(const char *what, const char *ip_str, struct sockaddr_in *addr, struct sockaddr_in6 *addr6);
struct configuration {
uint64_t timer_period; /* default period is 60 seconds */
uint64_t extra_timer_period; /* default extra time period of 10 sec */
uint64_t warm_up_time_period; /* default warmup time period of 0 sec */
struct sockaddr_in self_ipaddr; /* Self IP address. */
struct sockaddr_in6 self_ipaddr6; /* Self IPv6 address. */
struct sockaddr_in remote_ipaddr; /* Remote IP address. */
struct sockaddr_in6 remote_ipaddr6; /* Remote IPv6 address. */
uint64_t iteration_no; /* default iteration number is 1 */
uint64_t iterations; /* default iterations are 20 */
uint64_t rx_queues; /* default rx_queues is 1 */
bool ipv4; /* Active IP Mode is IPv4 */
};
static const char short_options[] =
"t:" /* timer period */
"i:" /* self IP */
"s:" /* remote IP */
"w:" /* extra time option */
"p:" /* packet size */
"j:" /* another ip */
"e:" /* extra time defaults to 10 */
"n:" /* iteration number*/
"r:" /* number of iterations */
"q:" /* number of rx queues */
;
#endif