Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright (C) B.A.T.M.A.N. contributors:
0003  *
0004  * Linus Lüssing
0005  */
0006 
0007 #ifndef _NET_BATMAN_ADV_MULTICAST_H_
0008 #define _NET_BATMAN_ADV_MULTICAST_H_
0009 
0010 #include "main.h"
0011 
0012 #include <linux/netlink.h>
0013 #include <linux/skbuff.h>
0014 
0015 /**
0016  * enum batadv_forw_mode - the way a packet should be forwarded as
0017  */
0018 enum batadv_forw_mode {
0019     /**
0020      * @BATADV_FORW_ALL: forward the packet to all nodes (currently via
0021      *  classic flooding)
0022      */
0023     BATADV_FORW_ALL,
0024 
0025     /**
0026      * @BATADV_FORW_SOME: forward the packet to some nodes (currently via
0027      *  a multicast-to-unicast conversion and the BATMAN unicast routing
0028      *  protocol)
0029      */
0030     BATADV_FORW_SOME,
0031 
0032     /**
0033      * @BATADV_FORW_SINGLE: forward the packet to a single node (currently
0034      *  via the BATMAN unicast routing protocol)
0035      */
0036     BATADV_FORW_SINGLE,
0037 
0038     /** @BATADV_FORW_NONE: don't forward, drop it */
0039     BATADV_FORW_NONE,
0040 };
0041 
0042 #ifdef CONFIG_BATMAN_ADV_MCAST
0043 
0044 enum batadv_forw_mode
0045 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
0046                struct batadv_orig_node **mcast_single_orig,
0047                int *is_routable);
0048 
0049 int batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv,
0050                 struct sk_buff *skb,
0051                 unsigned short vid,
0052                 struct batadv_orig_node *orig_node);
0053 
0054 int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
0055                unsigned short vid, int is_routable);
0056 
0057 void batadv_mcast_init(struct batadv_priv *bat_priv);
0058 
0059 int batadv_mcast_mesh_info_put(struct sk_buff *msg,
0060                    struct batadv_priv *bat_priv);
0061 
0062 int batadv_mcast_flags_dump(struct sk_buff *msg, struct netlink_callback *cb);
0063 
0064 void batadv_mcast_free(struct batadv_priv *bat_priv);
0065 
0066 void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node);
0067 
0068 #else
0069 
0070 static inline enum batadv_forw_mode
0071 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
0072                struct batadv_orig_node **mcast_single_orig,
0073                int *is_routable)
0074 {
0075     return BATADV_FORW_ALL;
0076 }
0077 
0078 static inline int
0079 batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv,
0080                 struct sk_buff *skb,
0081                 unsigned short vid,
0082                 struct batadv_orig_node *orig_node)
0083 {
0084     kfree_skb(skb);
0085     return NET_XMIT_DROP;
0086 }
0087 
0088 static inline int
0089 batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
0090                unsigned short vid, int is_routable)
0091 {
0092     kfree_skb(skb);
0093     return NET_XMIT_DROP;
0094 }
0095 
0096 static inline int batadv_mcast_init(struct batadv_priv *bat_priv)
0097 {
0098     return 0;
0099 }
0100 
0101 static inline int
0102 batadv_mcast_mesh_info_put(struct sk_buff *msg, struct batadv_priv *bat_priv)
0103 {
0104     return 0;
0105 }
0106 
0107 static inline int batadv_mcast_flags_dump(struct sk_buff *msg,
0108                       struct netlink_callback *cb)
0109 {
0110     return -EOPNOTSUPP;
0111 }
0112 
0113 static inline void batadv_mcast_free(struct batadv_priv *bat_priv)
0114 {
0115 }
0116 
0117 static inline void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node)
0118 {
0119 }
0120 
0121 #endif /* CONFIG_BATMAN_ADV_MCAST */
0122 
0123 #endif /* _NET_BATMAN_ADV_MULTICAST_H_ */