// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2023 Robin Jarry

#pragma once

#include "vec.h"

#include <sched.h>
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
#include <unistd.h>

struct gr_config {
	const char *api_sock_path;
	uid_t api_sock_uid;
	gid_t api_sock_gid;
	mode_t api_sock_mode;
	unsigned log_level;
	unsigned max_mtu;
	bool test_mode;
	bool poll_mode;
	bool adaptive_irq; // --adaptive-irq: adaptive interrupt rx
	bool log_syslog;
	bool log_packets;
	bool override_default_route;
	bool override_rp_filter;
	vec char **eal_extra_args;
	cpu_set_t control_cpus; // control plane threads allowed CPUs
	cpu_set_t datapath_cpus; // datapath threads allowed CPUs
	const char *metrics_addr; // openmetrics listen address (NULL to disable)
	uint16_t metrics_port; // openmetrics listen port (0 to disable)
	uint32_t max_ifaces;
	uint32_t mempool_chunk_size;
	uint32_t max_nexthops;
	uint32_t max_routes;
	uint32_t max_fdb_entries;
	uint32_t max_conntracks;
	uint32_t port_queue_size;
	const char *fib4_algorithm;
	const char *fib6_algorithm;
};

extern struct gr_config gr_config;

int config_parse(int argc, char **argv);
void config_print(void);
