Sven Eckelmann | 9f6446c | 2015-04-23 13:16:35 +0200 | [diff] [blame] | 1 | /* Copyright (C) 2012-2015 B.A.T.M.A.N. contributors: |
Martin Hundebøll | d353d8d | 2013-01-25 11:12:38 +0100 | [diff] [blame] | 2 | * |
| 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 Quartulli | ebf38fb | 2013-11-03 20:40:48 +0100 | [diff] [blame] | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
Martin Hundebøll | d353d8d | 2013-01-25 11:12:38 +0100 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | #ifndef _NET_BATMAN_ADV_NETWORK_CODING_H_ |
| 19 | #define _NET_BATMAN_ADV_NETWORK_CODING_H_ |
| 20 | |
Sven Eckelmann | 1e2c2a4 | 2015-04-17 19:40:28 +0200 | [diff] [blame^] | 21 | #include "main.h" |
| 22 | |
| 23 | #include <linux/types.h> |
| 24 | |
| 25 | struct batadv_nc_node; |
| 26 | struct batadv_neigh_node; |
| 27 | struct batadv_ogm_packet; |
| 28 | struct batadv_orig_node; |
| 29 | struct batadv_priv; |
| 30 | struct net_device; |
| 31 | struct seq_file; |
| 32 | struct sk_buff; |
| 33 | |
Martin Hundebøll | d353d8d | 2013-01-25 11:12:38 +0100 | [diff] [blame] | 34 | #ifdef CONFIG_BATMAN_ADV_NC |
| 35 | |
Marek Lindner | 3f4841f | 2013-04-23 21:40:00 +0800 | [diff] [blame] | 36 | void batadv_nc_status_update(struct net_device *net_dev); |
Matthias Schiffer | 6c519ba | 2013-09-27 18:03:39 +0200 | [diff] [blame] | 37 | int batadv_nc_init(void); |
| 38 | int batadv_nc_mesh_init(struct batadv_priv *bat_priv); |
| 39 | void batadv_nc_mesh_free(struct batadv_priv *bat_priv); |
Martin Hundebøll | d56b170 | 2013-01-25 11:12:39 +0100 | [diff] [blame] | 40 | void 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); |
| 45 | void 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øll | d353d8d | 2013-01-25 11:12:38 +0100 | [diff] [blame] | 49 | void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv); |
Martin Hundebøll | d56b170 | 2013-01-25 11:12:39 +0100 | [diff] [blame] | 50 | void batadv_nc_init_orig(struct batadv_orig_node *orig_node); |
Martin Hundebøll | 9533247 | 2013-01-25 11:12:40 +0100 | [diff] [blame] | 51 | bool batadv_nc_skb_forward(struct sk_buff *skb, |
Martin Hundebøll | e91ecfc | 2013-04-20 13:54:39 +0200 | [diff] [blame] | 52 | struct batadv_neigh_node *neigh_node); |
Martin Hundebøll | 612d2b4 | 2013-01-25 11:12:42 +0100 | [diff] [blame] | 53 | void batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv, |
| 54 | struct sk_buff *skb); |
| 55 | void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv, |
| 56 | struct sk_buff *skb); |
Martin Hundebøll | d56b170 | 2013-01-25 11:12:39 +0100 | [diff] [blame] | 57 | int batadv_nc_nodes_seq_print_text(struct seq_file *seq, void *offset); |
| 58 | int batadv_nc_init_debugfs(struct batadv_priv *bat_priv); |
Martin Hundebøll | d353d8d | 2013-01-25 11:12:38 +0100 | [diff] [blame] | 59 | |
| 60 | #else /* ifdef CONFIG_BATMAN_ADV_NC */ |
| 61 | |
Marek Lindner | 3f4841f | 2013-04-23 21:40:00 +0800 | [diff] [blame] | 62 | static inline void batadv_nc_status_update(struct net_device *net_dev) |
| 63 | { |
| 64 | } |
| 65 | |
Matthias Schiffer | 6c519ba | 2013-09-27 18:03:39 +0200 | [diff] [blame] | 66 | static inline int batadv_nc_init(void) |
Martin Hundebøll | d353d8d | 2013-01-25 11:12:38 +0100 | [diff] [blame] | 67 | { |
| 68 | return 0; |
| 69 | } |
| 70 | |
Matthias Schiffer | 6c519ba | 2013-09-27 18:03:39 +0200 | [diff] [blame] | 71 | static inline int batadv_nc_mesh_init(struct batadv_priv *bat_priv) |
| 72 | { |
| 73 | return 0; |
| 74 | } |
| 75 | |
| 76 | static inline void batadv_nc_mesh_free(struct batadv_priv *bat_priv) |
Martin Hundebøll | d353d8d | 2013-01-25 11:12:38 +0100 | [diff] [blame] | 77 | { |
Martin Hundebøll | d353d8d | 2013-01-25 11:12:38 +0100 | [diff] [blame] | 78 | } |
| 79 | |
Martin Hundebøll | d56b170 | 2013-01-25 11:12:39 +0100 | [diff] [blame] | 80 | static inline void |
| 81 | batadv_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øll | d56b170 | 2013-01-25 11:12:39 +0100 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | static inline void |
| 90 | batadv_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øll | d56b170 | 2013-01-25 11:12:39 +0100 | [diff] [blame] | 95 | } |
| 96 | |
Martin Hundebøll | d353d8d | 2013-01-25 11:12:38 +0100 | [diff] [blame] | 97 | static inline void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv) |
| 98 | { |
Martin Hundebøll | d353d8d | 2013-01-25 11:12:38 +0100 | [diff] [blame] | 99 | } |
| 100 | |
Martin Hundebøll | d56b170 | 2013-01-25 11:12:39 +0100 | [diff] [blame] | 101 | static inline void batadv_nc_init_orig(struct batadv_orig_node *orig_node) |
| 102 | { |
Martin Hundebøll | d56b170 | 2013-01-25 11:12:39 +0100 | [diff] [blame] | 103 | } |
| 104 | |
Martin Hundebøll | 9533247 | 2013-01-25 11:12:40 +0100 | [diff] [blame] | 105 | static inline bool batadv_nc_skb_forward(struct sk_buff *skb, |
Martin Hundebøll | e91ecfc | 2013-04-20 13:54:39 +0200 | [diff] [blame] | 106 | struct batadv_neigh_node *neigh_node) |
Martin Hundebøll | 9533247 | 2013-01-25 11:12:40 +0100 | [diff] [blame] | 107 | { |
| 108 | return false; |
| 109 | } |
| 110 | |
Martin Hundebøll | 612d2b4 | 2013-01-25 11:12:42 +0100 | [diff] [blame] | 111 | static inline void |
| 112 | batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv, |
| 113 | struct sk_buff *skb) |
| 114 | { |
Martin Hundebøll | 612d2b4 | 2013-01-25 11:12:42 +0100 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | static inline void |
| 118 | batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv, |
| 119 | struct sk_buff *skb) |
| 120 | { |
Martin Hundebøll | 612d2b4 | 2013-01-25 11:12:42 +0100 | [diff] [blame] | 121 | } |
| 122 | |
Martin Hundebøll | d56b170 | 2013-01-25 11:12:39 +0100 | [diff] [blame] | 123 | static inline int batadv_nc_nodes_seq_print_text(struct seq_file *seq, |
| 124 | void *offset) |
| 125 | { |
| 126 | return 0; |
| 127 | } |
| 128 | |
| 129 | static inline int batadv_nc_init_debugfs(struct batadv_priv *bat_priv) |
| 130 | { |
| 131 | return 0; |
| 132 | } |
| 133 | |
Martin Hundebøll | d353d8d | 2013-01-25 11:12:38 +0100 | [diff] [blame] | 134 | #endif /* ifdef CONFIG_BATMAN_ADV_NC */ |
| 135 | |
| 136 | #endif /* _NET_BATMAN_ADV_NETWORK_CODING_H_ */ |