xref: /openbmc/linux/net/batman-adv/translation-table.h (revision 68a600de9afc2134aa24d0cce539b98a0acb68b1)
17db7d9f3SSven Eckelmann /* SPDX-License-Identifier: GPL-2.0 */
27a79d717SSven Eckelmann /* Copyright (C) 2007-2019  B.A.T.M.A.N. contributors:
3c6c8fea2SSven Eckelmann  *
435c133a0SAntonio Quartulli  * Marek Lindner, Simon Wunderlich, Antonio Quartulli
5c6c8fea2SSven Eckelmann  */
6c6c8fea2SSven Eckelmann 
7c6c8fea2SSven Eckelmann #ifndef _NET_BATMAN_ADV_TRANSLATION_TABLE_H_
8c6c8fea2SSven Eckelmann #define _NET_BATMAN_ADV_TRANSLATION_TABLE_H_
9c6c8fea2SSven Eckelmann 
101e2c2a4fSSven Eckelmann #include "main.h"
111e2c2a4fSSven Eckelmann 
12*68a600deSSven Eckelmann #include <linux/netdevice.h>
13*68a600deSSven Eckelmann #include <linux/netlink.h>
14*68a600deSSven Eckelmann #include <linux/seq_file.h>
15*68a600deSSven Eckelmann #include <linux/skbuff.h>
161e2c2a4fSSven Eckelmann #include <linux/types.h>
171e2c2a4fSSven Eckelmann 
1856303d34SSven Eckelmann int batadv_tt_init(struct batadv_priv *bat_priv);
196b5e971aSSven Eckelmann bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr,
206b5e971aSSven Eckelmann 			 unsigned short vid, int ifindex, u32 mark);
216b5e971aSSven Eckelmann u16 batadv_tt_local_remove(struct batadv_priv *bat_priv,
226b5e971aSSven Eckelmann 			   const u8 *addr, unsigned short vid,
23c018ad3dSAntonio Quartulli 			   const char *message, bool roaming);
2408c36d3eSSven Eckelmann int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset);
2508c36d3eSSven Eckelmann int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset);
26d34f0550SMatthias Schiffer int batadv_tt_local_dump(struct sk_buff *msg, struct netlink_callback *cb);
27d34f0550SMatthias Schiffer int batadv_tt_global_dump(struct sk_buff *msg, struct netlink_callback *cb);
2856303d34SSven Eckelmann void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
2956303d34SSven Eckelmann 			       struct batadv_orig_node *orig_node,
306b5e971aSSven Eckelmann 			       s32 match_vid, const char *message);
3132e72744SLinus Lüssing struct batadv_tt_global_entry *
3232e72744SLinus Lüssing batadv_tt_global_hash_find(struct batadv_priv *bat_priv, const u8 *addr,
3332e72744SLinus Lüssing 			   unsigned short vid);
3432e72744SLinus Lüssing void batadv_tt_global_entry_put(struct batadv_tt_global_entry *tt_global_entry);
351d8ab8d3SLinus Lüssing int batadv_tt_global_hash_count(struct batadv_priv *bat_priv,
366b5e971aSSven Eckelmann 				const u8 *addr, unsigned short vid);
3756303d34SSven Eckelmann struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv,
386b5e971aSSven Eckelmann 						  const u8 *src, const u8 *addr,
39c018ad3dSAntonio Quartulli 						  unsigned short vid);
4056303d34SSven Eckelmann void batadv_tt_free(struct batadv_priv *bat_priv);
416b5e971aSSven Eckelmann bool batadv_is_my_client(struct batadv_priv *bat_priv, const u8 *addr,
42c018ad3dSAntonio Quartulli 			 unsigned short vid);
436b5e971aSSven Eckelmann bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst,
446b5e971aSSven Eckelmann 			   unsigned short vid);
45e1bf0c14SMarek Lindner void batadv_tt_local_commit_changes(struct batadv_priv *bat_priv);
4656303d34SSven Eckelmann bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv,
476b5e971aSSven Eckelmann 					u8 *addr, unsigned short vid);
487c1fd91dSAntonio Quartulli bool batadv_tt_local_client_is_roaming(struct batadv_priv *bat_priv,
496b5e971aSSven Eckelmann 				       u8 *addr, unsigned short vid);
50a19d3d85SMarek Lindner void batadv_tt_local_resize_to_mtu(struct net_device *soft_iface);
5130cfd02bSAntonio Quartulli bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv,
5230cfd02bSAntonio Quartulli 					  struct batadv_orig_node *orig_node,
53c018ad3dSAntonio Quartulli 					  const unsigned char *addr,
54c018ad3dSAntonio Quartulli 					  unsigned short vid);
5542cb0befSAntonio Quartulli bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv,
566b5e971aSSven Eckelmann 				  const u8 *addr, unsigned short vid);
57c6c8fea2SSven Eckelmann 
5886452f81SSven Eckelmann int batadv_tt_cache_init(void);
5986452f81SSven Eckelmann void batadv_tt_cache_destroy(void);
6086452f81SSven Eckelmann 
61c6c8fea2SSven Eckelmann #endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */
62