File Index
Files and directories
Sign in
FILE

multicast.h

File preview with syntax highlighting.

linux-6.19.14/net/batman-adv/multicast.h C
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/* Copyright (C) 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#include <linux/netlink.h>
 13#include <linux/skbuff.h>
 14#include <linux/types.h>
 15
 16/**
 17 * enum batadv_forw_mode - the way a packet should be forwarded as
 18 */
 19enum batadv_forw_mode {
 20	/**
 21	 * @BATADV_FORW_BCAST: forward the packet to all nodes via a batman-adv
 22	 *  broadcast packet
 23	 */
 24	BATADV_FORW_BCAST,
 25
 26	/**
 27	 * @BATADV_FORW_UCASTS: forward the packet to some nodes via one
 28	 *  or more batman-adv unicast packets
 29	 */
 30	BATADV_FORW_UCASTS,
 31
 32	/**
 33	 * @BATADV_FORW_MCAST: forward the packet to some nodes via a
 34	 *  batman-adv multicast packet
 35	 */
 36	BATADV_FORW_MCAST,
 37
 38	/** @BATADV_FORW_NONE: don't forward, drop it */
 39	BATADV_FORW_NONE,
 40};
 41
 42#ifdef CONFIG_BATMAN_ADV_MCAST
 43
 44enum batadv_forw_mode
 45batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
 46		       unsigned short vid, int *is_routable);
 47
 48int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
 49			   unsigned short vid, int is_routable);
 50
 51void batadv_mcast_init(struct batadv_priv *bat_priv);
 52
 53int batadv_mcast_mesh_info_put(struct sk_buff *msg,
 54			       struct batadv_priv *bat_priv);
 55
 56int batadv_mcast_flags_dump(struct sk_buff *msg, struct netlink_callback *cb);
 57
 58void batadv_mcast_free(struct batadv_priv *bat_priv);
 59
 60void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node);
 61
 62/* multicast_forw.c */
 63
 64int batadv_mcast_forw_tracker_tvlv_handler(struct batadv_priv *bat_priv,
 65					   struct sk_buff *skb);
 66
 67unsigned int batadv_mcast_forw_packet_hdrlen(unsigned int num_dests);
 68
 69bool batadv_mcast_forw_push(struct batadv_priv *bat_priv, struct sk_buff *skb,
 70			    unsigned short vid, int is_routable, int count);
 71
 72int batadv_mcast_forw_mcsend(struct batadv_priv *bat_priv, struct sk_buff *skb);
 73
 74#else
 75
 76static inline enum batadv_forw_mode
 77batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
 78		       unsigned short vid, int *is_routable)
 79{
 80	return BATADV_FORW_BCAST;
 81}
 82
 83static inline int
 84batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
 85		       unsigned short vid, int is_routable)
 86{
 87	kfree_skb(skb);
 88	return NET_XMIT_DROP;
 89}
 90
 91static inline int batadv_mcast_init(struct batadv_priv *bat_priv)
 92{
 93	return 0;
 94}
 95
 96static inline int
 97batadv_mcast_mesh_info_put(struct sk_buff *msg, struct batadv_priv *bat_priv)
 98{
 99	return 0;
100}
101
102static inline int batadv_mcast_flags_dump(struct sk_buff *msg,
103					  struct netlink_callback *cb)
104{
105	return -EOPNOTSUPP;
106}
107
108static inline void batadv_mcast_free(struct batadv_priv *bat_priv)
109{
110}
111
112static inline void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node)
113{
114}
115
116static 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
123#endif /* CONFIG_BATMAN_ADV_MCAST */
124
125#endif /* _NET_BATMAN_ADV_MULTICAST_H_ */
~/ Read-only file preview.