blob: 944512e0778290c3539193b262c83e4bebc19754 [file] [log] [blame]
Sven Eckelmann7db7d9f2017-11-19 15:05:11 +01001/* SPDX-License-Identifier: GPL-2.0 */
Sven Eckelmann6b1aea82018-01-01 00:00:00 +01002/* Copyright (C) 2013-2018 B.A.T.M.A.N. contributors:
Martin Hundebøll610bfc6bc2013-05-23 16:53:02 +02003 *
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
Antonio Quartulliebf38fb2013-11-03 20:40:48 +010016 * along with this program; if not, see <http://www.gnu.org/licenses/>.
Martin Hundebøll610bfc6bc2013-05-23 16:53:02 +020017 */
18
19#ifndef _NET_BATMAN_ADV_FRAGMENTATION_H_
20#define _NET_BATMAN_ADV_FRAGMENTATION_H_
21
Sven Eckelmann1e2c2a42015-04-17 19:40:28 +020022#include "main.h"
23
24#include <linux/compiler.h>
25#include <linux/list.h>
26#include <linux/stddef.h>
27#include <linux/types.h>
28
29struct sk_buff;
30
Martin Hundebøll610bfc6bc2013-05-23 16:53:02 +020031void batadv_frag_purge_orig(struct batadv_orig_node *orig,
32 bool (*check_cb)(struct batadv_frag_table_entry *));
33bool batadv_frag_skb_fwd(struct sk_buff *skb,
34 struct batadv_hard_iface *recv_if,
35 struct batadv_orig_node *orig_node_src);
36bool batadv_frag_skb_buffer(struct sk_buff **skb,
37 struct batadv_orig_node *orig_node);
Antonio Quartullif50ca952016-05-18 11:38:48 +020038int batadv_frag_send_packet(struct sk_buff *skb,
39 struct batadv_orig_node *orig_node,
40 struct batadv_neigh_node *neigh_node);
Martin Hundebøll610bfc6bc2013-05-23 16:53:02 +020041
42/**
Sven Eckelmann7e9a8c22017-12-02 19:51:47 +010043 * batadv_frag_check_entry() - check if a list of fragments has timed out
Martin Hundebøll610bfc6bc2013-05-23 16:53:02 +020044 * @frags_entry: table entry to check
45 *
Sven Eckelmann62fe7102015-09-15 19:00:48 +020046 * Return: true if the frags entry has timed out, false otherwise.
Martin Hundebøll610bfc6bc2013-05-23 16:53:02 +020047 */
48static inline bool
49batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry)
50{
Sven Eckelmann176e5b72016-07-27 12:31:07 +020051 if (!hlist_empty(&frags_entry->fragment_list) &&
Martin Hundebøll610bfc6bc2013-05-23 16:53:02 +020052 batadv_has_timed_out(frags_entry->timestamp, BATADV_FRAG_TIMEOUT))
53 return true;
Antonio Quartulli24820df2014-09-01 14:37:25 +020054 return false;
Martin Hundebøll610bfc6bc2013-05-23 16:53:02 +020055}
56
57#endif /* _NET_BATMAN_ADV_FRAGMENTATION_H_ */