]> asedeno.scripts.mit.edu Git - linux.git/blob - net/batman-adv/multicast.h
34fb922a4566bd4e43d09804eadc098dd9e93d46
[linux.git] / net / batman-adv / multicast.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2014-2019  B.A.T.M.A.N. contributors:
3  *
4  * Linus Lüssing
5  */
6
7 #ifndef _NET_BATMAN_ADV_MULTICAST_H_
8 #define _NET_BATMAN_ADV_MULTICAST_H_
9
10 #include "main.h"
11
12 struct netlink_callback;
13 struct seq_file;
14 struct sk_buff;
15
16 /**
17  * enum batadv_forw_mode - the way a packet should be forwarded as
18  */
19 enum batadv_forw_mode {
20         /**
21          * @BATADV_FORW_ALL: forward the packet to all nodes (currently via
22          *  classic flooding)
23          */
24         BATADV_FORW_ALL,
25
26         /**
27          * @BATADV_FORW_SINGLE: forward the packet to a single node (currently
28          *  via the BATMAN unicast routing protocol)
29          */
30         BATADV_FORW_SINGLE,
31
32         /** @BATADV_FORW_NONE: don't forward, drop it */
33         BATADV_FORW_NONE,
34 };
35
36 #ifdef CONFIG_BATMAN_ADV_MCAST
37
38 enum batadv_forw_mode
39 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
40                        struct batadv_orig_node **mcast_single_orig);
41
42 void batadv_mcast_init(struct batadv_priv *bat_priv);
43
44 int batadv_mcast_flags_seq_print_text(struct seq_file *seq, void *offset);
45
46 int batadv_mcast_mesh_info_put(struct sk_buff *msg,
47                                struct batadv_priv *bat_priv);
48
49 int batadv_mcast_flags_dump(struct sk_buff *msg, struct netlink_callback *cb);
50
51 void batadv_mcast_free(struct batadv_priv *bat_priv);
52
53 void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node);
54
55 #else
56
57 static inline enum batadv_forw_mode
58 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
59                        struct batadv_orig_node **mcast_single_orig)
60 {
61         return BATADV_FORW_ALL;
62 }
63
64 static inline int batadv_mcast_init(struct batadv_priv *bat_priv)
65 {
66         return 0;
67 }
68
69 static inline int
70 batadv_mcast_mesh_info_put(struct sk_buff *msg, struct batadv_priv *bat_priv)
71 {
72         return 0;
73 }
74
75 static inline int batadv_mcast_flags_dump(struct sk_buff *msg,
76                                           struct netlink_callback *cb)
77 {
78         return -EOPNOTSUPP;
79 }
80
81 static inline void batadv_mcast_free(struct batadv_priv *bat_priv)
82 {
83 }
84
85 static inline void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node)
86 {
87 }
88
89 #endif /* CONFIG_BATMAN_ADV_MCAST */
90
91 #endif /* _NET_BATMAN_ADV_MULTICAST_H_ */