blob: 5b79aa8c64c1f87c823d20e2366a2352d4b0e30e [file] [log] [blame]
Sven Eckelmann9f6446c2015-04-23 13:16:35 +02001/* Copyright (C) 2012-2015 B.A.T.M.A.N. contributors:
Martin Hundebølld353d8d2013-01-25 11:12:38 +01002 *
3 * Martin Hundebøll, Jeppe Ledet-Pedersen
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU General Public
7 * License as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
Antonio Quartulliebf38fb2013-11-03 20:40:48 +010015 * along with this program; if not, see <http://www.gnu.org/licenses/>.
Martin Hundebølld353d8d2013-01-25 11:12:38 +010016 */
17
18#ifndef _NET_BATMAN_ADV_NETWORK_CODING_H_
19#define _NET_BATMAN_ADV_NETWORK_CODING_H_
20
Sven Eckelmann1e2c2a42015-04-17 19:40:28 +020021#include "main.h"
22
23#include <linux/types.h>
24
25struct batadv_nc_node;
26struct batadv_neigh_node;
27struct batadv_ogm_packet;
28struct batadv_orig_node;
29struct batadv_priv;
30struct net_device;
31struct seq_file;
32struct sk_buff;
33
Martin Hundebølld353d8d2013-01-25 11:12:38 +010034#ifdef CONFIG_BATMAN_ADV_NC
35
Marek Lindner3f4841f2013-04-23 21:40:00 +080036void batadv_nc_status_update(struct net_device *net_dev);
Matthias Schiffer6c519ba2013-09-27 18:03:39 +020037int batadv_nc_init(void);
38int batadv_nc_mesh_init(struct batadv_priv *bat_priv);
39void batadv_nc_mesh_free(struct batadv_priv *bat_priv);
Martin Hundebølld56b1702013-01-25 11:12:39 +010040void batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
41 struct batadv_orig_node *orig_node,
42 struct batadv_orig_node *orig_neigh_node,
43 struct batadv_ogm_packet *ogm_packet,
44 int is_single_hop_neigh);
45void batadv_nc_purge_orig(struct batadv_priv *bat_priv,
46 struct batadv_orig_node *orig_node,
47 bool (*to_purge)(struct batadv_priv *,
48 struct batadv_nc_node *));
Martin Hundebølld353d8d2013-01-25 11:12:38 +010049void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv);
Martin Hundebølld56b1702013-01-25 11:12:39 +010050void batadv_nc_init_orig(struct batadv_orig_node *orig_node);
Martin Hundebøll95332472013-01-25 11:12:40 +010051bool batadv_nc_skb_forward(struct sk_buff *skb,
Martin Hundebølle91ecfc2013-04-20 13:54:39 +020052 struct batadv_neigh_node *neigh_node);
Martin Hundebøll612d2b42013-01-25 11:12:42 +010053void batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv,
54 struct sk_buff *skb);
55void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
56 struct sk_buff *skb);
Martin Hundebølld56b1702013-01-25 11:12:39 +010057int batadv_nc_nodes_seq_print_text(struct seq_file *seq, void *offset);
58int batadv_nc_init_debugfs(struct batadv_priv *bat_priv);
Martin Hundebølld353d8d2013-01-25 11:12:38 +010059
60#else /* ifdef CONFIG_BATMAN_ADV_NC */
61
Marek Lindner3f4841f2013-04-23 21:40:00 +080062static inline void batadv_nc_status_update(struct net_device *net_dev)
63{
64}
65
Matthias Schiffer6c519ba2013-09-27 18:03:39 +020066static inline int batadv_nc_init(void)
Martin Hundebølld353d8d2013-01-25 11:12:38 +010067{
68 return 0;
69}
70
Matthias Schiffer6c519ba2013-09-27 18:03:39 +020071static inline int batadv_nc_mesh_init(struct batadv_priv *bat_priv)
72{
73 return 0;
74}
75
76static inline void batadv_nc_mesh_free(struct batadv_priv *bat_priv)
Martin Hundebølld353d8d2013-01-25 11:12:38 +010077{
Martin Hundebølld353d8d2013-01-25 11:12:38 +010078}
79
Martin Hundebølld56b1702013-01-25 11:12:39 +010080static inline void
81batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
82 struct batadv_orig_node *orig_node,
83 struct batadv_orig_node *orig_neigh_node,
84 struct batadv_ogm_packet *ogm_packet,
85 int is_single_hop_neigh)
86{
Martin Hundebølld56b1702013-01-25 11:12:39 +010087}
88
89static inline void
90batadv_nc_purge_orig(struct batadv_priv *bat_priv,
91 struct batadv_orig_node *orig_node,
92 bool (*to_purge)(struct batadv_priv *,
93 struct batadv_nc_node *))
94{
Martin Hundebølld56b1702013-01-25 11:12:39 +010095}
96
Martin Hundebølld353d8d2013-01-25 11:12:38 +010097static inline void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv)
98{
Martin Hundebølld353d8d2013-01-25 11:12:38 +010099}
100
Martin Hundebølld56b1702013-01-25 11:12:39 +0100101static inline void batadv_nc_init_orig(struct batadv_orig_node *orig_node)
102{
Martin Hundebølld56b1702013-01-25 11:12:39 +0100103}
104
Martin Hundebøll95332472013-01-25 11:12:40 +0100105static inline bool batadv_nc_skb_forward(struct sk_buff *skb,
Martin Hundebølle91ecfc2013-04-20 13:54:39 +0200106 struct batadv_neigh_node *neigh_node)
Martin Hundebøll95332472013-01-25 11:12:40 +0100107{
108 return false;
109}
110
Martin Hundebøll612d2b42013-01-25 11:12:42 +0100111static inline void
112batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv,
113 struct sk_buff *skb)
114{
Martin Hundebøll612d2b42013-01-25 11:12:42 +0100115}
116
117static inline void
118batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
119 struct sk_buff *skb)
120{
Martin Hundebøll612d2b42013-01-25 11:12:42 +0100121}
122
Martin Hundebølld56b1702013-01-25 11:12:39 +0100123static inline int batadv_nc_nodes_seq_print_text(struct seq_file *seq,
124 void *offset)
125{
126 return 0;
127}
128
129static inline int batadv_nc_init_debugfs(struct batadv_priv *bat_priv)
130{
131 return 0;
132}
133
Martin Hundebølld353d8d2013-01-25 11:12:38 +0100134#endif /* ifdef CONFIG_BATMAN_ADV_NC */
135
136#endif /* _NET_BATMAN_ADV_NETWORK_CODING_H_ */