fragmentation.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (C) 2013-2018 B.A.T.M.A.N. contributors:
  3. *
  4. * Martin Hundebøll <martin@hundeboll.net>
  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. */
  18. #ifndef _NET_BATMAN_ADV_FRAGMENTATION_H_
  19. #define _NET_BATMAN_ADV_FRAGMENTATION_H_
  20. #include "main.h"
  21. #include <linux/compiler.h>
  22. #include <linux/list.h>
  23. #include <linux/stddef.h>
  24. #include <linux/types.h>
  25. struct sk_buff;
  26. void batadv_frag_purge_orig(struct batadv_orig_node *orig,
  27. bool (*check_cb)(struct batadv_frag_table_entry *));
  28. bool batadv_frag_skb_fwd(struct sk_buff *skb,
  29. struct batadv_hard_iface *recv_if,
  30. struct batadv_orig_node *orig_node_src);
  31. bool batadv_frag_skb_buffer(struct sk_buff **skb,
  32. struct batadv_orig_node *orig_node);
  33. int batadv_frag_send_packet(struct sk_buff *skb,
  34. struct batadv_orig_node *orig_node,
  35. struct batadv_neigh_node *neigh_node);
  36. /**
  37. * batadv_frag_check_entry() - check if a list of fragments has timed out
  38. * @frags_entry: table entry to check
  39. *
  40. * Return: true if the frags entry has timed out, false otherwise.
  41. */
  42. static inline bool
  43. batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry)
  44. {
  45. if (!hlist_empty(&frags_entry->fragment_list) &&
  46. batadv_has_timed_out(frags_entry->timestamp, BATADV_FRAG_TIMEOUT))
  47. return true;
  48. return false;
  49. }
  50. #endif /* _NET_BATMAN_ADV_FRAGMENTATION_H_ */