1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #include "conf-parser.h"
5 #include "netdev.h"
6 
7 #define LINK_BRIDGE_PORT_PRIORITY_INVALID 128
8 #define LINK_BRIDGE_PORT_PRIORITY_MAX 63
9 
10 typedef struct Bridge {
11         NetDev meta;
12 
13         int mcast_querier;
14         int mcast_snooping;
15         int vlan_filtering;
16         int vlan_protocol;
17         int stp;
18         uint16_t priority;
19         uint16_t group_fwd_mask;
20         uint16_t default_pvid;
21         uint8_t igmp_version;
22 
23         usec_t forward_delay;
24         usec_t hello_time;
25         usec_t max_age;
26         usec_t ageing_time;
27 } Bridge;
28 
29 typedef enum MulticastRouter {
30         MULTICAST_ROUTER_NONE,
31         MULTICAST_ROUTER_TEMPORARY_QUERY,
32         MULTICAST_ROUTER_PERMANENT,
33         MULTICAST_ROUTER_TEMPORARY,
34         _MULTICAST_ROUTER_MAX,
35         _MULTICAST_ROUTER_INVALID = -EINVAL,
36 } MulticastRouter;
37 
38 DEFINE_NETDEV_CAST(BRIDGE, Bridge);
39 extern const NetDevVTable bridge_vtable;
40 
41 const char* multicast_router_to_string(MulticastRouter i) _const_;
42 MulticastRouter multicast_router_from_string(const char *s) _pure_;
43 
44 CONFIG_PARSER_PROTOTYPE(config_parse_multicast_router);
45 CONFIG_PARSER_PROTOTYPE(config_parse_bridge_igmp_version);
46 CONFIG_PARSER_PROTOTYPE(config_parse_bridge_port_priority);
47