.. | .. |
---|
1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
---|
2 | | -/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors: |
---|
| 2 | +/* Copyright (C) 2007-2020 B.A.T.M.A.N. contributors: |
---|
3 | 3 | * |
---|
4 | 4 | * Marek Lindner, Simon Wunderlich, Antonio Quartulli |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or |
---|
7 | | - * modify it under the terms of version 2 of the GNU General Public |
---|
8 | | - * License as published by the Free Software Foundation. |
---|
9 | | - * |
---|
10 | | - * This program is distributed in the hope that it will be useful, but |
---|
11 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
13 | | - * General Public License for more details. |
---|
14 | | - * |
---|
15 | | - * You should have received a copy of the GNU General Public License |
---|
16 | | - * along with this program; if not, see <http://www.gnu.org/licenses/>. |
---|
17 | 5 | */ |
---|
18 | 6 | |
---|
19 | 7 | #ifndef _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ |
---|
.. | .. |
---|
21 | 9 | |
---|
22 | 10 | #include "main.h" |
---|
23 | 11 | |
---|
| 12 | +#include <linux/kref.h> |
---|
| 13 | +#include <linux/netdevice.h> |
---|
| 14 | +#include <linux/netlink.h> |
---|
| 15 | +#include <linux/seq_file.h> |
---|
| 16 | +#include <linux/skbuff.h> |
---|
24 | 17 | #include <linux/types.h> |
---|
25 | | - |
---|
26 | | -struct netlink_callback; |
---|
27 | | -struct net_device; |
---|
28 | | -struct seq_file; |
---|
29 | | -struct sk_buff; |
---|
30 | 18 | |
---|
31 | 19 | int batadv_tt_init(struct batadv_priv *bat_priv); |
---|
32 | 20 | bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr, |
---|
.. | .. |
---|
41 | 29 | void batadv_tt_global_del_orig(struct batadv_priv *bat_priv, |
---|
42 | 30 | struct batadv_orig_node *orig_node, |
---|
43 | 31 | s32 match_vid, const char *message); |
---|
| 32 | +struct batadv_tt_global_entry * |
---|
| 33 | +batadv_tt_global_hash_find(struct batadv_priv *bat_priv, const u8 *addr, |
---|
| 34 | + unsigned short vid); |
---|
| 35 | +void batadv_tt_global_entry_release(struct kref *ref); |
---|
44 | 36 | int batadv_tt_global_hash_count(struct batadv_priv *bat_priv, |
---|
45 | 37 | const u8 *addr, unsigned short vid); |
---|
46 | 38 | struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv, |
---|
.. | .. |
---|
67 | 59 | int batadv_tt_cache_init(void); |
---|
68 | 60 | void batadv_tt_cache_destroy(void); |
---|
69 | 61 | |
---|
| 62 | +/** |
---|
| 63 | + * batadv_tt_global_entry_put() - decrement the tt_global_entry refcounter and |
---|
| 64 | + * possibly release it |
---|
| 65 | + * @tt_global_entry: tt_global_entry to be free'd |
---|
| 66 | + */ |
---|
| 67 | +static inline void |
---|
| 68 | +batadv_tt_global_entry_put(struct batadv_tt_global_entry *tt_global_entry) |
---|
| 69 | +{ |
---|
| 70 | + if (!tt_global_entry) |
---|
| 71 | + return; |
---|
| 72 | + |
---|
| 73 | + kref_put(&tt_global_entry->common.refcount, |
---|
| 74 | + batadv_tt_global_entry_release); |
---|
| 75 | +} |
---|
| 76 | + |
---|
70 | 77 | #endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */ |
---|