libnl: /data/src/libnl3/include/netlink/route/link/bridge.h Source File

libnl 3.10.0

bridge.h
1/* SPDX-License-Identifier: LGPL-2.1-only */
2/*
3 * Copyright (c) 2013 Thomas Graf <tgraf@suug.ch>
4 */
5
6#ifndef NETLINK_LINK_BRIDGE_H_
7#define NETLINK_LINK_BRIDGE_H_
8
9#include <netlink/netlink.h>
10#include <netlink/route/link.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#define RTNL_LINK_BRIDGE_VLAN_BITMAP_MAX 4096
17#define RTNL_LINK_BRIDGE_VLAN_BITMAP_LEN (RTNL_LINK_BRIDGE_VLAN_BITMAP_MAX / 32)
18
19 struct rtnl_link_bridge_vlan
20{
21 uint16_t pvid;
22 uint32_t vlan_bitmap[RTNL_LINK_BRIDGE_VLAN_BITMAP_LEN];
23 uint32_t untagged_bitmap[RTNL_LINK_BRIDGE_VLAN_BITMAP_LEN];
24};
25
26/**
27 * Bridge flags
28 * @ingroup bridge
29 */
30 enum rtnl_link_bridge_flags {
31 RTNL_BRIDGE_HAIRPIN_MODE = 0x0001,
32 RTNL_BRIDGE_BPDU_GUARD = 0x0002,
33 RTNL_BRIDGE_ROOT_BLOCK = 0x0004,
34 RTNL_BRIDGE_FAST_LEAVE = 0x0008,
35 RTNL_BRIDGE_UNICAST_FLOOD = 0x0010,
36 RTNL_BRIDGE_LEARNING = 0x0020,
37 RTNL_BRIDGE_LEARNING_SYNC = 0x0040,
38};
39
40#define RTNL_BRIDGE_HWMODE_VEB BRIDGE_MODE_VEB
41#define RTNL_BRIDGE_HWMODE_VEPA BRIDGE_MODE_VEPA
42#define RTNL_BRIDGE_HWMODE_MAX BRIDGE_MODE_VEPA
43#define RTNL_BRIDGE_HWMODE_UNDEF BRIDGE_MODE_UNDEF
44
45extern struct rtnl_link *rtnl_link_bridge_alloc(void);
46
47extern int rtnl_link_is_bridge(struct rtnl_link *);
48extern int rtnl_link_bridge_has_ext_info(struct rtnl_link *);
49
50extern int rtnl_link_bridge_set_port_state(struct rtnl_link *, uint8_t );
51extern int rtnl_link_bridge_get_port_state(struct rtnl_link *);
52
53extern int rtnl_link_bridge_set_priority(struct rtnl_link *, uint16_t);
54extern int rtnl_link_bridge_get_priority(struct rtnl_link *);
55
56extern int rtnl_link_bridge_set_cost(struct rtnl_link *, uint32_t);
57extern int rtnl_link_bridge_get_cost(struct rtnl_link *, uint32_t *);
58
59extern int rtnl_link_bridge_unset_flags(struct rtnl_link *, unsigned int);
60extern int rtnl_link_bridge_set_flags(struct rtnl_link *, unsigned int);
61extern int rtnl_link_bridge_get_flags(struct rtnl_link *);
62
63extern int rtnl_link_bridge_set_self(struct rtnl_link *);
64extern int rtnl_link_bridge_set_master(struct rtnl_link *);
65
66extern int rtnl_link_bridge_get_hwmode(struct rtnl_link *, uint16_t *);
67extern int rtnl_link_bridge_set_hwmode(struct rtnl_link *, uint16_t);
68
69extern char * rtnl_link_bridge_flags2str(int, char *, size_t);
70extern int rtnl_link_bridge_str2flags(const char *);
71
72extern char * rtnl_link_bridge_portstate2str(int, char *, size_t);
73extern int rtnl_link_bridge_str2portstate(const char *);
74
75extern char * rtnl_link_bridge_hwmode2str(uint16_t, char *, size_t);
76extern uint16_t rtnl_link_bridge_str2hwmode(const char *);
77
78extern int rtnl_link_bridge_add(struct nl_sock *sk, const char *name);
79
80extern int rtnl_link_bridge_enable_vlan(struct rtnl_link *link);
81extern int rtnl_link_bridge_set_port_vlan_map_range (struct rtnl_link *link, uint16_t start, uint16_t end, int untagged);
82extern int rtnl_link_bridge_unset_port_vlan_map_range (struct rtnl_link *link, uint16_t start, uint16_t end);
83extern int rtnl_link_bridge_set_port_vlan_pvid (struct rtnl_link *link, uint16_t pvid);
84extern int rtnl_link_bridge_pvid(struct rtnl_link *link);
85extern int rtnl_link_bridge_has_vlan(struct rtnl_link *link);
86
87extern struct rtnl_link_bridge_vlan *rtnl_link_bridge_get_port_vlan(struct rtnl_link *link);
88#ifdef __cplusplus
89}
90#endif
91
92#endif
93
rtnl_link_bridge_set_cost
int rtnl_link_bridge_set_cost(struct rtnl_link *, uint32_t)
Set Spanning Tree Protocol (STP) path cost.
Definition bridge.c:798
rtnl_link_bridge_get_port_state
int rtnl_link_bridge_get_port_state(struct rtnl_link *)
Get Spanning Tree Protocol (STP) port state.
Definition bridge.c:739
rtnl_link_bridge_set_hwmode
int rtnl_link_bridge_set_hwmode(struct rtnl_link *, uint16_t)
Set hardware mode.
Definition bridge.c:1001
rtnl_link_bridge_flags
rtnl_link_bridge_flags
Bridge flags.
Definition bridge.h:30
rtnl_link_bridge_has_ext_info
int rtnl_link_bridge_has_ext_info(struct rtnl_link *)
Check if bridge has extended information.
Definition bridge.c:686
rtnl_link_bridge_set_master
int rtnl_link_bridge_set_master(struct rtnl_link *)
Set link change type to master.
Definition bridge.c:945
rtnl_link_bridge_add
int rtnl_link_bridge_add(struct nl_sock *sk, const char *name)
Create a new kernel bridge device.
Definition bridge.c:644
rtnl_link_bridge_set_port_vlan_map_range
int rtnl_link_bridge_set_port_vlan_map_range(struct rtnl_link *link, uint16_t start, uint16_t end, int untagged)
Set port vlan membership range.
Definition bridge.c:1132
rtnl_link_is_bridge
int rtnl_link_is_bridge(struct rtnl_link *)
Check if a link is a bridge.
Definition bridge.c:667
rtnl_link_bridge_set_port_state
int rtnl_link_bridge_set_port_state(struct rtnl_link *, uint8_t)
Set Spanning Tree Protocol (STP) port state.
Definition bridge.c:715
rtnl_link_bridge_enable_vlan
int rtnl_link_bridge_enable_vlan(struct rtnl_link *link)
Enable the ability to set vlan info.
Definition bridge.c:1100
rtnl_link_bridge_set_self
int rtnl_link_bridge_set_self(struct rtnl_link *)
Set link change type to self.
Definition bridge.c:922
rtnl_link_bridge_set_port_vlan_pvid
int rtnl_link_bridge_set_port_vlan_pvid(struct rtnl_link *link, uint16_t pvid)
Set port primary vlan id.
Definition bridge.c:1212
rtnl_link_bridge_alloc
struct rtnl_link * rtnl_link_bridge_alloc(void)
Allocate link object of type bridge.
Definition bridge.c:618
rtnl_link_bridge_get_hwmode
int rtnl_link_bridge_get_hwmode(struct rtnl_link *, uint16_t *)
Get hardware mode.
Definition bridge.c:968
rtnl_link_bridge_get_flags
int rtnl_link_bridge_get_flags(struct rtnl_link *)
Get flags.
Definition bridge.c:902
rtnl_link_bridge_get_cost
int rtnl_link_bridge_get_cost(struct rtnl_link *, uint32_t *)
Get Spanning Tree Protocol (STP) path cost.
Definition bridge.c:821
rtnl_link_bridge_get_priority
int rtnl_link_bridge_get_priority(struct rtnl_link *)
Get priority.
Definition bridge.c:779
rtnl_link_bridge_unset_flags
int rtnl_link_bridge_unset_flags(struct rtnl_link *, unsigned int)
Unset flags.
Definition bridge.c:846
rtnl_link_bridge_unset_port_vlan_map_range
int rtnl_link_bridge_unset_port_vlan_map_range(struct rtnl_link *link, uint16_t start, uint16_t end)
Unset port vlan membership range.
Definition bridge.c:1173
rtnl_link_bridge_set_priority
int rtnl_link_bridge_set_priority(struct rtnl_link *, uint16_t)
Set priority.
Definition bridge.c:758
rtnl_link_bridge_set_flags
int rtnl_link_bridge_set_flags(struct rtnl_link *, unsigned int)
Set flags.
Definition bridge.c:879
rtnl_link_bridge_vlan
Definition bridge.h:20
rtnl_link
Link object.
Definition nl-route.h:29