]>
Commit | Line | Data |
---|---|---|
7db7d9f3 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
cfa55c6d | 2 | /* Copyright (C) B.A.T.M.A.N. contributors: |
c5caf4ef LL |
3 | * |
4 | * Linus Lüssing | |
c5caf4ef LL |
5 | */ |
6 | ||
7 | #ifndef _NET_BATMAN_ADV_MULTICAST_H_ | |
8 | #define _NET_BATMAN_ADV_MULTICAST_H_ | |
9 | ||
1e2c2a4f SE |
10 | #include "main.h" |
11 | ||
68a600de | 12 | #include <linux/netlink.h> |
68a600de | 13 | #include <linux/skbuff.h> |
90039133 | 14 | #include <linux/types.h> |
1e2c2a4f | 15 | |
1d8ab8d3 | 16 | /** |
6f68b002 | 17 | * enum batadv_forw_mode - the way a packet should be forwarded as |
1d8ab8d3 LL |
18 | */ |
19 | enum batadv_forw_mode { | |
8b84cc4f | 20 | /** |
e7d6127b LL |
21 | * @BATADV_FORW_BCAST: forward the packet to all nodes via a batman-adv |
22 | * broadcast packet | |
8b84cc4f | 23 | */ |
e7d6127b | 24 | BATADV_FORW_BCAST, |
8b84cc4f | 25 | |
32e72744 | 26 | /** |
e7d6127b LL |
27 | * @BATADV_FORW_UCASTS: forward the packet to some nodes via one |
28 | * or more batman-adv unicast packets | |
32e72744 | 29 | */ |
e7d6127b | 30 | BATADV_FORW_UCASTS, |
8b84cc4f | 31 | |
90039133 LL |
32 | /** |
33 | * @BATADV_FORW_MCAST: forward the packet to some nodes via a | |
34 | * batman-adv multicast packet | |
35 | */ | |
36 | BATADV_FORW_MCAST, | |
37 | ||
8b84cc4f | 38 | /** @BATADV_FORW_NONE: don't forward, drop it */ |
1d8ab8d3 LL |
39 | BATADV_FORW_NONE, |
40 | }; | |
41 | ||
c5caf4ef LL |
42 | #ifdef CONFIG_BATMAN_ADV_MCAST |
43 | ||
1d8ab8d3 LL |
44 | enum batadv_forw_mode |
45 | batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, | |
90039133 | 46 | unsigned short vid, int *is_routable); |
1d8ab8d3 | 47 | |
32e72744 | 48 | int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb, |
938f2e0b | 49 | unsigned short vid, int is_routable); |
32e72744 | 50 | |
60432d75 LL |
51 | void batadv_mcast_init(struct batadv_priv *bat_priv); |
52 | ||
53dd9a68 LL |
53 | int batadv_mcast_mesh_info_put(struct sk_buff *msg, |
54 | struct batadv_priv *bat_priv); | |
55 | ||
56 | int batadv_mcast_flags_dump(struct sk_buff *msg, struct netlink_callback *cb); | |
57 | ||
c5caf4ef LL |
58 | void batadv_mcast_free(struct batadv_priv *bat_priv); |
59 | ||
60432d75 LL |
60 | void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node); |
61 | ||
07afe1ba LL |
62 | /* multicast_forw.c */ |
63 | ||
64 | int batadv_mcast_forw_tracker_tvlv_handler(struct batadv_priv *bat_priv, | |
65 | struct sk_buff *skb); | |
66 | ||
90039133 LL |
67 | unsigned int batadv_mcast_forw_packet_hdrlen(unsigned int num_dests); |
68 | ||
69 | bool batadv_mcast_forw_push(struct batadv_priv *bat_priv, struct sk_buff *skb, | |
70 | unsigned short vid, int is_routable, int count); | |
71 | ||
72 | int batadv_mcast_forw_mcsend(struct batadv_priv *bat_priv, struct sk_buff *skb); | |
73 | ||
c5caf4ef LL |
74 | #else |
75 | ||
1d8ab8d3 LL |
76 | static inline enum batadv_forw_mode |
77 | batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, | |
90039133 | 78 | unsigned short vid, int *is_routable) |
1d8ab8d3 | 79 | { |
e7d6127b | 80 | return BATADV_FORW_BCAST; |
3236d215 LL |
81 | } |
82 | ||
32e72744 LL |
83 | static inline int |
84 | batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb, | |
938f2e0b | 85 | unsigned short vid, int is_routable) |
32e72744 LL |
86 | { |
87 | kfree_skb(skb); | |
88 | return NET_XMIT_DROP; | |
89 | } | |
90 | ||
60432d75 LL |
91 | static inline int batadv_mcast_init(struct batadv_priv *bat_priv) |
92 | { | |
93 | return 0; | |
94 | } | |
95 | ||
53dd9a68 LL |
96 | static inline int |
97 | batadv_mcast_mesh_info_put(struct sk_buff *msg, struct batadv_priv *bat_priv) | |
98 | { | |
99 | return 0; | |
100 | } | |
101 | ||
102 | static inline int batadv_mcast_flags_dump(struct sk_buff *msg, | |
103 | struct netlink_callback *cb) | |
104 | { | |
105 | return -EOPNOTSUPP; | |
106 | } | |
107 | ||
c5caf4ef LL |
108 | static inline void batadv_mcast_free(struct batadv_priv *bat_priv) |
109 | { | |
c5caf4ef LL |
110 | } |
111 | ||
60432d75 LL |
112 | static inline void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node) |
113 | { | |
60432d75 LL |
114 | } |
115 | ||
90039133 LL |
116 | static inline int batadv_mcast_forw_mcsend(struct batadv_priv *bat_priv, |
117 | struct sk_buff *skb) | |
118 | { | |
119 | kfree_skb(skb); | |
120 | return NET_XMIT_DROP; | |
121 | } | |
122 | ||
c5caf4ef LL |
123 | #endif /* CONFIG_BATMAN_ADV_MCAST */ |
124 | ||
125 | #endif /* _NET_BATMAN_ADV_MULTICAST_H_ */ |