1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 
3 #pragma once
4 
5 #include <linux/batman_adv.h>
6 
7 #include "conf-parser.h"
8 #include "netdev.h"
9 
10 #define BATADV_GENL_NAME "batadv"
11 
12 typedef enum BatadvGatewayModes {
13         BATADV_GATEWAY_MODE_OFF = BATADV_GW_MODE_OFF,
14         BATADV_GATEWAY_MODE_CLIENT = BATADV_GW_MODE_CLIENT,
15         BATADV_GATEWAY_MODE_SERVER = BATADV_GW_MODE_SERVER,
16         _BATADV_GATEWAY_MODE_MAX,
17         _BATADV_GATEWAY_MODE_INVALID = -EINVAL,
18 } BatadvGatewayModes;
19 
20 typedef enum BatadvRoutingAlgorithm {
21         BATADV_ROUTING_ALGORITHM_BATMAN_V,
22         BATADV_ROUTING_ALGORITHM_BATMAN_IV,
23         _BATADV_ROUTING_ALGORITHM_MAX,
24         _BATADV_ROUTING_ALGORITHM_INVALID = -EINVAL,
25 } BatadvRoutingAlgorithm;
26 
27 typedef struct Batadv {
28         NetDev meta;
29 
30         BatadvGatewayModes gateway_mode;
31         uint32_t gateway_bandwidth_down;
32         uint32_t gateway_bandwidth_up;
33         uint8_t hop_penalty;
34         BatadvRoutingAlgorithm routing_algorithm;
35         usec_t originator_interval;
36         bool aggregation;
37         bool bridge_loop_avoidance;
38         bool distributed_arp_table;
39         bool fragmentation;
40 } BatmanAdvanced;
41 
42 DEFINE_NETDEV_CAST(BATADV, BatmanAdvanced);
43 extern const NetDevVTable batadv_vtable;
44 
45 CONFIG_PARSER_PROTOTYPE(config_parse_batadv_gateway_mode);
46 CONFIG_PARSER_PROTOTYPE(config_parse_batadv_routing_algorithm);
47 CONFIG_PARSER_PROTOTYPE(config_parse_badadv_bandwidth);
48