Linux 5.7.7
[linux/fpc-iii.git] / net / batman-adv / multicast.h
blobebf825991ecd963e3cf284b625b9aa3ed456f2df
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2014-2020 B.A.T.M.A.N. contributors:
4 * Linus Lüssing
5 */
7 #ifndef _NET_BATMAN_ADV_MULTICAST_H_
8 #define _NET_BATMAN_ADV_MULTICAST_H_
10 #include "main.h"
12 #include <linux/netlink.h>
13 #include <linux/seq_file.h>
14 #include <linux/skbuff.h>
16 /**
17 * enum batadv_forw_mode - the way a packet should be forwarded as
19 enum batadv_forw_mode {
20 /**
21 * @BATADV_FORW_ALL: forward the packet to all nodes (currently via
22 * classic flooding)
24 BATADV_FORW_ALL,
26 /**
27 * @BATADV_FORW_SOME: forward the packet to some nodes (currently via
28 * a multicast-to-unicast conversion and the BATMAN unicast routing
29 * protocol)
31 BATADV_FORW_SOME,
33 /**
34 * @BATADV_FORW_SINGLE: forward the packet to a single node (currently
35 * via the BATMAN unicast routing protocol)
37 BATADV_FORW_SINGLE,
39 /** @BATADV_FORW_NONE: don't forward, drop it */
40 BATADV_FORW_NONE,
43 #ifdef CONFIG_BATMAN_ADV_MCAST
45 enum batadv_forw_mode
46 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
47 struct batadv_orig_node **mcast_single_orig);
49 int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
50 unsigned short vid);
52 void batadv_mcast_init(struct batadv_priv *bat_priv);
54 int batadv_mcast_flags_seq_print_text(struct seq_file *seq, void *offset);
56 int batadv_mcast_mesh_info_put(struct sk_buff *msg,
57 struct batadv_priv *bat_priv);
59 int batadv_mcast_flags_dump(struct sk_buff *msg, struct netlink_callback *cb);
61 void batadv_mcast_free(struct batadv_priv *bat_priv);
63 void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node);
65 #else
67 static inline enum batadv_forw_mode
68 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
69 struct batadv_orig_node **mcast_single_orig)
71 return BATADV_FORW_ALL;
74 static inline int
75 batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
76 unsigned short vid)
78 kfree_skb(skb);
79 return NET_XMIT_DROP;
82 static inline int batadv_mcast_init(struct batadv_priv *bat_priv)
84 return 0;
87 static inline int
88 batadv_mcast_mesh_info_put(struct sk_buff *msg, struct batadv_priv *bat_priv)
90 return 0;
93 static inline int batadv_mcast_flags_dump(struct sk_buff *msg,
94 struct netlink_callback *cb)
96 return -EOPNOTSUPP;
99 static inline void batadv_mcast_free(struct batadv_priv *bat_priv)
103 static inline void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node)
107 #endif /* CONFIG_BATMAN_ADV_MCAST */
109 #endif /* _NET_BATMAN_ADV_MULTICAST_H_ */