blob: dbf0871f87030344ba14bc56c4b50123c88900ac [file] [log] [blame]
Sven Eckelmann7db7d9f2017-11-19 15:05:11 +01001/* SPDX-License-Identifier: GPL-2.0 */
Sven Eckelmanncfa55c62021-01-01 00:00:01 +01002/* Copyright (C) B.A.T.M.A.N. contributors:
Martin Hundebøll610bfc6bc2013-05-23 16:53:02 +02003 *
4 * Martin Hundebøll <martin@hundeboll.net>
Martin Hundebøll610bfc6bc2013-05-23 16:53:02 +02005 */
6
7#ifndef _NET_BATMAN_ADV_FRAGMENTATION_H_
8#define _NET_BATMAN_ADV_FRAGMENTATION_H_
9
Sven Eckelmann1e2c2a42015-04-17 19:40:28 +020010#include "main.h"
11
12#include <linux/compiler.h>
13#include <linux/list.h>
Sven Eckelmann68a600d2019-05-24 20:11:17 +020014#include <linux/skbuff.h>
Sven Eckelmann1e2c2a42015-04-17 19:40:28 +020015#include <linux/stddef.h>
16#include <linux/types.h>
17
Martin Hundebøll610bfc6bc2013-05-23 16:53:02 +020018void batadv_frag_purge_orig(struct batadv_orig_node *orig,
19 bool (*check_cb)(struct batadv_frag_table_entry *));
20bool batadv_frag_skb_fwd(struct sk_buff *skb,
21 struct batadv_hard_iface *recv_if,
22 struct batadv_orig_node *orig_node_src);
23bool batadv_frag_skb_buffer(struct sk_buff **skb,
24 struct batadv_orig_node *orig_node);
Antonio Quartullif50ca952016-05-18 11:38:48 +020025int batadv_frag_send_packet(struct sk_buff *skb,
26 struct batadv_orig_node *orig_node,
27 struct batadv_neigh_node *neigh_node);
Martin Hundebøll610bfc6bc2013-05-23 16:53:02 +020028
29/**
Sven Eckelmann7e9a8c22017-12-02 19:51:47 +010030 * batadv_frag_check_entry() - check if a list of fragments has timed out
Martin Hundebøll610bfc6bc2013-05-23 16:53:02 +020031 * @frags_entry: table entry to check
32 *
Sven Eckelmann62fe7102015-09-15 19:00:48 +020033 * Return: true if the frags entry has timed out, false otherwise.
Martin Hundebøll610bfc6bc2013-05-23 16:53:02 +020034 */
35static inline bool
36batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry)
37{
Sven Eckelmann176e5b72016-07-27 12:31:07 +020038 if (!hlist_empty(&frags_entry->fragment_list) &&
Martin Hundebøll610bfc6bc2013-05-23 16:53:02 +020039 batadv_has_timed_out(frags_entry->timestamp, BATADV_FRAG_TIMEOUT))
40 return true;
Antonio Quartulli24820df2014-09-01 14:37:25 +020041 return false;
Martin Hundebøll610bfc6bc2013-05-23 16:53:02 +020042}
43
44#endif /* _NET_BATMAN_ADV_FRAGMENTATION_H_ */