xref: /openbmc/linux/net/batman-adv/translation-table.h (revision 7db7d9f369a47e1a46f93c320b45cb89e81723e7)
1*7db7d9f3SSven Eckelmann /* SPDX-License-Identifier: GPL-2.0 */
2ac79cbb9SSven Eckelmann /* Copyright (C) 2007-2017  B.A.T.M.A.N. contributors:
3c6c8fea2SSven Eckelmann  *
435c133a0SAntonio Quartulli  * Marek Lindner, Simon Wunderlich, Antonio Quartulli
5c6c8fea2SSven Eckelmann  *
6c6c8fea2SSven Eckelmann  * This program is free software; you can redistribute it and/or
7c6c8fea2SSven Eckelmann  * modify it under the terms of version 2 of the GNU General Public
8c6c8fea2SSven Eckelmann  * License as published by the Free Software Foundation.
9c6c8fea2SSven Eckelmann  *
10c6c8fea2SSven Eckelmann  * This program is distributed in the hope that it will be useful, but
11c6c8fea2SSven Eckelmann  * WITHOUT ANY WARRANTY; without even the implied warranty of
12c6c8fea2SSven Eckelmann  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13c6c8fea2SSven Eckelmann  * General Public License for more details.
14c6c8fea2SSven Eckelmann  *
15c6c8fea2SSven Eckelmann  * You should have received a copy of the GNU General Public License
16ebf38fb7SAntonio Quartulli  * along with this program; if not, see <http://www.gnu.org/licenses/>.
17c6c8fea2SSven Eckelmann  */
18c6c8fea2SSven Eckelmann 
19c6c8fea2SSven Eckelmann #ifndef _NET_BATMAN_ADV_TRANSLATION_TABLE_H_
20c6c8fea2SSven Eckelmann #define _NET_BATMAN_ADV_TRANSLATION_TABLE_H_
21c6c8fea2SSven Eckelmann 
221e2c2a4fSSven Eckelmann #include "main.h"
231e2c2a4fSSven Eckelmann 
241e2c2a4fSSven Eckelmann #include <linux/types.h>
251e2c2a4fSSven Eckelmann 
26d34f0550SMatthias Schiffer struct netlink_callback;
271e2c2a4fSSven Eckelmann struct net_device;
281e2c2a4fSSven Eckelmann struct seq_file;
29d34f0550SMatthias Schiffer struct sk_buff;
301e2c2a4fSSven Eckelmann 
3156303d34SSven Eckelmann int batadv_tt_init(struct batadv_priv *bat_priv);
326b5e971aSSven Eckelmann bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr,
336b5e971aSSven Eckelmann 			 unsigned short vid, int ifindex, u32 mark);
346b5e971aSSven Eckelmann u16 batadv_tt_local_remove(struct batadv_priv *bat_priv,
356b5e971aSSven Eckelmann 			   const u8 *addr, unsigned short vid,
36c018ad3dSAntonio Quartulli 			   const char *message, bool roaming);
3708c36d3eSSven Eckelmann int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset);
3808c36d3eSSven Eckelmann int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset);
39d34f0550SMatthias Schiffer int batadv_tt_local_dump(struct sk_buff *msg, struct netlink_callback *cb);
40d34f0550SMatthias Schiffer int batadv_tt_global_dump(struct sk_buff *msg, struct netlink_callback *cb);
4156303d34SSven Eckelmann void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
4256303d34SSven Eckelmann 			       struct batadv_orig_node *orig_node,
436b5e971aSSven Eckelmann 			       s32 match_vid, const char *message);
441d8ab8d3SLinus Lüssing int batadv_tt_global_hash_count(struct batadv_priv *bat_priv,
456b5e971aSSven Eckelmann 				const u8 *addr, unsigned short vid);
4656303d34SSven Eckelmann struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv,
476b5e971aSSven Eckelmann 						  const u8 *src, const u8 *addr,
48c018ad3dSAntonio Quartulli 						  unsigned short vid);
4956303d34SSven Eckelmann void batadv_tt_free(struct batadv_priv *bat_priv);
506b5e971aSSven Eckelmann bool batadv_is_my_client(struct batadv_priv *bat_priv, const u8 *addr,
51c018ad3dSAntonio Quartulli 			 unsigned short vid);
526b5e971aSSven Eckelmann bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst,
536b5e971aSSven Eckelmann 			   unsigned short vid);
54e1bf0c14SMarek Lindner void batadv_tt_local_commit_changes(struct batadv_priv *bat_priv);
5556303d34SSven Eckelmann bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv,
566b5e971aSSven Eckelmann 					u8 *addr, unsigned short vid);
577c1fd91dSAntonio Quartulli bool batadv_tt_local_client_is_roaming(struct batadv_priv *bat_priv,
586b5e971aSSven Eckelmann 				       u8 *addr, unsigned short vid);
59a19d3d85SMarek Lindner void batadv_tt_local_resize_to_mtu(struct net_device *soft_iface);
6030cfd02bSAntonio Quartulli bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv,
6130cfd02bSAntonio Quartulli 					  struct batadv_orig_node *orig_node,
62c018ad3dSAntonio Quartulli 					  const unsigned char *addr,
63c018ad3dSAntonio Quartulli 					  unsigned short vid);
6442cb0befSAntonio Quartulli bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv,
656b5e971aSSven Eckelmann 				  const u8 *addr, unsigned short vid);
66c6c8fea2SSven Eckelmann 
6786452f81SSven Eckelmann int batadv_tt_cache_init(void);
6886452f81SSven Eckelmann void batadv_tt_cache_destroy(void);
6986452f81SSven Eckelmann 
70c6c8fea2SSven Eckelmann #endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */
71