/*1* Copyright (C) 2010-2011 B.A.T.M.A.N. contributors:2*3* Andreas Langer4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of version 2 of the GNU General Public7* License as published by the Free Software Foundation.8*9* This program is distributed in the hope that it will be useful, but10* WITHOUT ANY WARRANTY; without even the implied warranty of11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU12* General Public License for more details.13*14* You should have received a copy of the GNU General Public License15* along with this program; if not, write to the Free Software16* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA17* 02110-1301, USA18*19*/2021#ifndef _NET_BATMAN_ADV_UNICAST_H_22#define _NET_BATMAN_ADV_UNICAST_H_2324#include "packet.h"2526#define FRAG_TIMEOUT 10000 /* purge frag list entrys after time in ms */27#define FRAG_BUFFER_SIZE 6 /* number of list elements in buffer */2829int frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,30struct sk_buff **new_skb);31void frag_list_free(struct list_head *head);32int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv);33int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,34struct hard_iface *hard_iface, uint8_t dstaddr[]);3536static inline int frag_can_reassemble(struct sk_buff *skb, int mtu)37{38struct unicast_frag_packet *unicast_packet;39int uneven_correction = 0;40unsigned int merged_size;4142unicast_packet = (struct unicast_frag_packet *)skb->data;4344if (unicast_packet->flags & UNI_FRAG_LARGETAIL) {45if (unicast_packet->flags & UNI_FRAG_HEAD)46uneven_correction = 1;47else48uneven_correction = -1;49}5051merged_size = (skb->len - sizeof(struct unicast_frag_packet)) * 2;52merged_size += sizeof(struct unicast_packet) + uneven_correction;5354return merged_size <= mtu;55}5657#endif /* _NET_BATMAN_ADV_UNICAST_H_ */585960