translation-table.h 2.5 KB
Newer Older
1
/* SPDX-License-Identifier: GPL-2.0 */
2
/* Copyright (C) 2007-2019  B.A.T.M.A.N. contributors:
3
 *
4
 * Marek Lindner, Simon Wunderlich, Antonio Quartulli
5 6 7 8 9
 */

#ifndef _NET_BATMAN_ADV_TRANSLATION_TABLE_H_
#define _NET_BATMAN_ADV_TRANSLATION_TABLE_H_

10 11 12 13
#include "main.h"

#include <linux/types.h>

14
struct netlink_callback;
15 16
struct net_device;
struct seq_file;
17
struct sk_buff;
18

19
int batadv_tt_init(struct batadv_priv *bat_priv);
20 21 22 23 24
bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr,
			 unsigned short vid, int ifindex, u32 mark);
u16 batadv_tt_local_remove(struct batadv_priv *bat_priv,
			   const u8 *addr, unsigned short vid,
			   const char *message, bool roaming);
25 26
int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset);
int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset);
27 28
int batadv_tt_local_dump(struct sk_buff *msg, struct netlink_callback *cb);
int batadv_tt_global_dump(struct sk_buff *msg, struct netlink_callback *cb);
29 30
void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
			       struct batadv_orig_node *orig_node,
31
			       s32 match_vid, const char *message);
32 33 34 35
struct batadv_tt_global_entry *
batadv_tt_global_hash_find(struct batadv_priv *bat_priv, const u8 *addr,
			   unsigned short vid);
void batadv_tt_global_entry_put(struct batadv_tt_global_entry *tt_global_entry);
36
int batadv_tt_global_hash_count(struct batadv_priv *bat_priv,
37
				const u8 *addr, unsigned short vid);
38
struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv,
39
						  const u8 *src, const u8 *addr,
40
						  unsigned short vid);
41
void batadv_tt_free(struct batadv_priv *bat_priv);
42
bool batadv_is_my_client(struct batadv_priv *bat_priv, const u8 *addr,
43
			 unsigned short vid);
44 45
bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst,
			   unsigned short vid);
46
void batadv_tt_local_commit_changes(struct batadv_priv *bat_priv);
47
bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv,
48
					u8 *addr, unsigned short vid);
49
bool batadv_tt_local_client_is_roaming(struct batadv_priv *bat_priv,
50
				       u8 *addr, unsigned short vid);
51
void batadv_tt_local_resize_to_mtu(struct net_device *soft_iface);
52 53
bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv,
					  struct batadv_orig_node *orig_node,
54 55
					  const unsigned char *addr,
					  unsigned short vid);
56
bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv,
57
				  const u8 *addr, unsigned short vid);
58

59 60 61
int batadv_tt_cache_init(void);
void batadv_tt_cache_destroy(void);

62
#endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */