gateway_client.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (C) 2009-2020 B.A.T.M.A.N. contributors:
  3. *
  4. * Marek Lindner
  5. */
  6. #ifndef _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
  7. #define _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
  8. #include "main.h"
  9. #include <linux/kref.h>
  10. #include <linux/netlink.h>
  11. #include <linux/seq_file.h>
  12. #include <linux/skbuff.h>
  13. #include <linux/types.h>
  14. #include <uapi/linux/batadv_packet.h>
  15. void batadv_gw_check_client_stop(struct batadv_priv *bat_priv);
  16. void batadv_gw_reselect(struct batadv_priv *bat_priv);
  17. void batadv_gw_election(struct batadv_priv *bat_priv);
  18. struct batadv_orig_node *
  19. batadv_gw_get_selected_orig(struct batadv_priv *bat_priv);
  20. void batadv_gw_check_election(struct batadv_priv *bat_priv,
  21. struct batadv_orig_node *orig_node);
  22. void batadv_gw_node_update(struct batadv_priv *bat_priv,
  23. struct batadv_orig_node *orig_node,
  24. struct batadv_tvlv_gateway_data *gateway);
  25. void batadv_gw_node_delete(struct batadv_priv *bat_priv,
  26. struct batadv_orig_node *orig_node);
  27. void batadv_gw_node_free(struct batadv_priv *bat_priv);
  28. void batadv_gw_node_release(struct kref *ref);
  29. struct batadv_gw_node *
  30. batadv_gw_get_selected_gw_node(struct batadv_priv *bat_priv);
  31. int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset);
  32. int batadv_gw_dump(struct sk_buff *msg, struct netlink_callback *cb);
  33. bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, struct sk_buff *skb);
  34. enum batadv_dhcp_recipient
  35. batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len,
  36. u8 *chaddr);
  37. struct batadv_gw_node *batadv_gw_node_get(struct batadv_priv *bat_priv,
  38. struct batadv_orig_node *orig_node);
  39. /**
  40. * batadv_gw_node_put() - decrement the gw_node refcounter and possibly release
  41. * it
  42. * @gw_node: gateway node to free
  43. */
  44. static inline void batadv_gw_node_put(struct batadv_gw_node *gw_node)
  45. {
  46. if (!gw_node)
  47. return;
  48. kref_put(&gw_node->refcount, batadv_gw_node_release);
  49. }
  50. #endif /* _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ */