blob: 368cc3130e4c910f1c551aae1bf4038e3c3bd867 [file] [log] [blame]
Sven Eckelmann7db7d9f2017-11-19 15:05:11 +01001/* SPDX-License-Identifier: GPL-2.0 */
Sven Eckelmanncfa55c62021-01-01 00:00:01 +01002/* Copyright (C) B.A.T.M.A.N. contributors:
Martin Hundebølld353d8d2013-01-25 11:12:38 +01003 *
4 * Martin Hundebøll, Jeppe Ledet-Pedersen
Martin Hundebølld353d8d2013-01-25 11:12:38 +01005 */
6
7#ifndef _NET_BATMAN_ADV_NETWORK_CODING_H_
8#define _NET_BATMAN_ADV_NETWORK_CODING_H_
9
Sven Eckelmann1e2c2a42015-04-17 19:40:28 +020010#include "main.h"
11
Sven Eckelmann68a600d2019-05-24 20:11:17 +020012#include <linux/netdevice.h>
Sven Eckelmann68a600d2019-05-24 20:11:17 +020013#include <linux/skbuff.h>
Sven Eckelmann1e2c2a42015-04-17 19:40:28 +020014#include <linux/types.h>
Sven Eckelmann68a600d2019-05-24 20:11:17 +020015#include <uapi/linux/batadv_packet.h>
Sven Eckelmann1e2c2a42015-04-17 19:40:28 +020016
Martin Hundebølld353d8d2013-01-25 11:12:38 +010017#ifdef CONFIG_BATMAN_ADV_NC
18
Marek Lindner3f4841f2013-04-23 21:40:00 +080019void batadv_nc_status_update(struct net_device *net_dev);
Matthias Schiffer6c519ba2013-09-27 18:03:39 +020020int batadv_nc_init(void);
21int batadv_nc_mesh_init(struct batadv_priv *bat_priv);
22void batadv_nc_mesh_free(struct batadv_priv *bat_priv);
Martin Hundebølld56b1702013-01-25 11:12:39 +010023void batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
24 struct batadv_orig_node *orig_node,
25 struct batadv_orig_node *orig_neigh_node,
26 struct batadv_ogm_packet *ogm_packet,
27 int is_single_hop_neigh);
28void batadv_nc_purge_orig(struct batadv_priv *bat_priv,
29 struct batadv_orig_node *orig_node,
30 bool (*to_purge)(struct batadv_priv *,
31 struct batadv_nc_node *));
Martin Hundebølld353d8d2013-01-25 11:12:38 +010032void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv);
Martin Hundebølld56b1702013-01-25 11:12:39 +010033void batadv_nc_init_orig(struct batadv_orig_node *orig_node);
Martin Hundebøll95332472013-01-25 11:12:40 +010034bool batadv_nc_skb_forward(struct sk_buff *skb,
Martin Hundebølle91ecfc2013-04-20 13:54:39 +020035 struct batadv_neigh_node *neigh_node);
Martin Hundebøll612d2b42013-01-25 11:12:42 +010036void batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv,
37 struct sk_buff *skb);
38void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
39 struct sk_buff *skb);
Martin Hundebølld353d8d2013-01-25 11:12:38 +010040
41#else /* ifdef CONFIG_BATMAN_ADV_NC */
42
Marek Lindner3f4841f2013-04-23 21:40:00 +080043static inline void batadv_nc_status_update(struct net_device *net_dev)
44{
45}
46
Matthias Schiffer6c519ba2013-09-27 18:03:39 +020047static inline int batadv_nc_init(void)
Martin Hundebølld353d8d2013-01-25 11:12:38 +010048{
49 return 0;
50}
51
Matthias Schiffer6c519ba2013-09-27 18:03:39 +020052static inline int batadv_nc_mesh_init(struct batadv_priv *bat_priv)
53{
54 return 0;
55}
56
57static inline void batadv_nc_mesh_free(struct batadv_priv *bat_priv)
Martin Hundebølld353d8d2013-01-25 11:12:38 +010058{
Martin Hundebølld353d8d2013-01-25 11:12:38 +010059}
60
Martin Hundebølld56b1702013-01-25 11:12:39 +010061static inline void
62batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
63 struct batadv_orig_node *orig_node,
64 struct batadv_orig_node *orig_neigh_node,
65 struct batadv_ogm_packet *ogm_packet,
66 int is_single_hop_neigh)
67{
Martin Hundebølld56b1702013-01-25 11:12:39 +010068}
69
70static inline void
71batadv_nc_purge_orig(struct batadv_priv *bat_priv,
72 struct batadv_orig_node *orig_node,
73 bool (*to_purge)(struct batadv_priv *,
74 struct batadv_nc_node *))
75{
Martin Hundebølld56b1702013-01-25 11:12:39 +010076}
77
Martin Hundebølld353d8d2013-01-25 11:12:38 +010078static inline void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv)
79{
Martin Hundebølld353d8d2013-01-25 11:12:38 +010080}
81
Martin Hundebølld56b1702013-01-25 11:12:39 +010082static inline void batadv_nc_init_orig(struct batadv_orig_node *orig_node)
83{
Martin Hundebølld56b1702013-01-25 11:12:39 +010084}
85
Martin Hundebøll95332472013-01-25 11:12:40 +010086static inline bool batadv_nc_skb_forward(struct sk_buff *skb,
Martin Hundebølle91ecfc2013-04-20 13:54:39 +020087 struct batadv_neigh_node *neigh_node)
Martin Hundebøll95332472013-01-25 11:12:40 +010088{
89 return false;
90}
91
Martin Hundebøll612d2b42013-01-25 11:12:42 +010092static inline void
93batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv,
94 struct sk_buff *skb)
95{
Martin Hundebøll612d2b42013-01-25 11:12:42 +010096}
97
98static inline void
99batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
100 struct sk_buff *skb)
101{
Martin Hundebøll612d2b42013-01-25 11:12:42 +0100102}
103
Martin Hundebølld353d8d2013-01-25 11:12:38 +0100104#endif /* ifdef CONFIG_BATMAN_ADV_NC */
105
106#endif /* _NET_BATMAN_ADV_NETWORK_CODING_H_ */