Sven Eckelmann | 7db7d9f | 2017-11-19 15:05:11 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Sven Eckelmann | cfa55c6 | 2021-01-01 00:00:01 +0100 | [diff] [blame] | 2 | /* Copyright (C) B.A.T.M.A.N. contributors: |
Martin Hundebøll | 610bfc6bc | 2013-05-23 16:53:02 +0200 | [diff] [blame] | 3 | * |
| 4 | * Martin Hundebøll <martin@hundeboll.net> |
Martin Hundebøll | 610bfc6bc | 2013-05-23 16:53:02 +0200 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef _NET_BATMAN_ADV_FRAGMENTATION_H_ |
| 8 | #define _NET_BATMAN_ADV_FRAGMENTATION_H_ |
| 9 | |
Sven Eckelmann | 1e2c2a4 | 2015-04-17 19:40:28 +0200 | [diff] [blame] | 10 | #include "main.h" |
| 11 | |
| 12 | #include <linux/compiler.h> |
| 13 | #include <linux/list.h> |
Sven Eckelmann | 68a600d | 2019-05-24 20:11:17 +0200 | [diff] [blame] | 14 | #include <linux/skbuff.h> |
Sven Eckelmann | 1e2c2a4 | 2015-04-17 19:40:28 +0200 | [diff] [blame] | 15 | #include <linux/stddef.h> |
| 16 | #include <linux/types.h> |
| 17 | |
Martin Hundebøll | 610bfc6bc | 2013-05-23 16:53:02 +0200 | [diff] [blame] | 18 | void batadv_frag_purge_orig(struct batadv_orig_node *orig, |
| 19 | bool (*check_cb)(struct batadv_frag_table_entry *)); |
| 20 | bool batadv_frag_skb_fwd(struct sk_buff *skb, |
| 21 | struct batadv_hard_iface *recv_if, |
| 22 | struct batadv_orig_node *orig_node_src); |
| 23 | bool batadv_frag_skb_buffer(struct sk_buff **skb, |
| 24 | struct batadv_orig_node *orig_node); |
Antonio Quartulli | f50ca95 | 2016-05-18 11:38:48 +0200 | [diff] [blame] | 25 | int batadv_frag_send_packet(struct sk_buff *skb, |
| 26 | struct batadv_orig_node *orig_node, |
| 27 | struct batadv_neigh_node *neigh_node); |
Martin Hundebøll | 610bfc6bc | 2013-05-23 16:53:02 +0200 | [diff] [blame] | 28 | |
| 29 | /** |
Sven Eckelmann | 7e9a8c2 | 2017-12-02 19:51:47 +0100 | [diff] [blame] | 30 | * batadv_frag_check_entry() - check if a list of fragments has timed out |
Martin Hundebøll | 610bfc6bc | 2013-05-23 16:53:02 +0200 | [diff] [blame] | 31 | * @frags_entry: table entry to check |
| 32 | * |
Sven Eckelmann | 62fe710 | 2015-09-15 19:00:48 +0200 | [diff] [blame] | 33 | * Return: true if the frags entry has timed out, false otherwise. |
Martin Hundebøll | 610bfc6bc | 2013-05-23 16:53:02 +0200 | [diff] [blame] | 34 | */ |
| 35 | static inline bool |
| 36 | batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry) |
| 37 | { |
Sven Eckelmann | 176e5b7 | 2016-07-27 12:31:07 +0200 | [diff] [blame] | 38 | if (!hlist_empty(&frags_entry->fragment_list) && |
Martin Hundebøll | 610bfc6bc | 2013-05-23 16:53:02 +0200 | [diff] [blame] | 39 | batadv_has_timed_out(frags_entry->timestamp, BATADV_FRAG_TIMEOUT)) |
| 40 | return true; |
Antonio Quartulli | 24820df | 2014-09-01 14:37:25 +0200 | [diff] [blame] | 41 | return false; |
Martin Hundebøll | 610bfc6bc | 2013-05-23 16:53:02 +0200 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | #endif /* _NET_BATMAN_ADV_FRAGMENTATION_H_ */ |