xref: /linux/net/batman-adv/send.h (revision f097e25dbe9144447f46b6b61ca3da1a2ba432d4)
10b873931SAntonio Quartulli /* Copyright (C) 2007-2013 B.A.T.M.A.N. contributors:
2c6c8fea2SSven Eckelmann  *
3c6c8fea2SSven Eckelmann  * Marek Lindner, Simon Wunderlich
4c6c8fea2SSven Eckelmann  *
5c6c8fea2SSven Eckelmann  * This program is free software; you can redistribute it and/or
6c6c8fea2SSven Eckelmann  * modify it under the terms of version 2 of the GNU General Public
7c6c8fea2SSven Eckelmann  * License as published by the Free Software Foundation.
8c6c8fea2SSven Eckelmann  *
9c6c8fea2SSven Eckelmann  * This program is distributed in the hope that it will be useful, but
10c6c8fea2SSven Eckelmann  * WITHOUT ANY WARRANTY; without even the implied warranty of
11c6c8fea2SSven Eckelmann  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12c6c8fea2SSven Eckelmann  * General Public License for more details.
13c6c8fea2SSven Eckelmann  *
14c6c8fea2SSven Eckelmann  * You should have received a copy of the GNU General Public License
15c6c8fea2SSven Eckelmann  * along with this program; if not, write to the Free Software
16c6c8fea2SSven Eckelmann  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17c6c8fea2SSven Eckelmann  * 02110-1301, USA
18c6c8fea2SSven Eckelmann  */
19c6c8fea2SSven Eckelmann 
20c6c8fea2SSven Eckelmann #ifndef _NET_BATMAN_ADV_SEND_H_
21c6c8fea2SSven Eckelmann #define _NET_BATMAN_ADV_SEND_H_
22c6c8fea2SSven Eckelmann 
2356303d34SSven Eckelmann int batadv_send_skb_packet(struct sk_buff *skb,
2456303d34SSven Eckelmann 			   struct batadv_hard_iface *hard_iface,
25747e4221SSven Eckelmann 			   const uint8_t *dst_addr);
26e91ecfc6SMartin Hundebøll int batadv_send_skb_to_orig(struct sk_buff *skb,
27bb351ba0SMartin Hundebøll 			    struct batadv_orig_node *orig_node,
28bb351ba0SMartin Hundebøll 			    struct batadv_hard_iface *recv_if);
2956303d34SSven Eckelmann void batadv_schedule_bat_ogm(struct batadv_hard_iface *hard_iface);
3056303d34SSven Eckelmann int batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv,
319455e34cSSven Eckelmann 				    const struct sk_buff *skb,
329455e34cSSven Eckelmann 				    unsigned long delay);
339455e34cSSven Eckelmann void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work);
3456303d34SSven Eckelmann void
3556303d34SSven Eckelmann batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
3656303d34SSven Eckelmann 				 const struct batadv_hard_iface *hard_iface);
37*f097e25dSMartin Hundebøll bool batadv_send_skb_prepare_unicast_4addr(struct batadv_priv *bat_priv,
38*f097e25dSMartin Hundebøll 					   struct sk_buff *skb,
39*f097e25dSMartin Hundebøll 					   struct batadv_orig_node *orig_node,
40*f097e25dSMartin Hundebøll 					   int packet_subtype);
41*f097e25dSMartin Hundebøll int batadv_send_skb_generic_unicast(struct batadv_priv *bat_priv,
42*f097e25dSMartin Hundebøll 				    struct sk_buff *skb, int packet_type,
43*f097e25dSMartin Hundebøll 				    int packet_subtype);
44*f097e25dSMartin Hundebøll 
45*f097e25dSMartin Hundebøll 
46*f097e25dSMartin Hundebøll /**
47*f097e25dSMartin Hundebøll  * batadv_send_unicast_skb - send the skb encapsulated in a unicast packet
48*f097e25dSMartin Hundebøll  * @bat_priv: the bat priv with all the soft interface information
49*f097e25dSMartin Hundebøll  * @skb: the payload to send
50*f097e25dSMartin Hundebøll  *
51*f097e25dSMartin Hundebøll  * Returns 1 in case of error or 0 otherwise.
52*f097e25dSMartin Hundebøll  */
53*f097e25dSMartin Hundebøll static inline int batadv_send_skb_unicast(struct batadv_priv *bat_priv,
54*f097e25dSMartin Hundebøll 					  struct sk_buff *skb)
55*f097e25dSMartin Hundebøll {
56*f097e25dSMartin Hundebøll 	return batadv_send_skb_generic_unicast(bat_priv, skb, BATADV_UNICAST,
57*f097e25dSMartin Hundebøll 					       0);
58*f097e25dSMartin Hundebøll }
59*f097e25dSMartin Hundebøll 
60*f097e25dSMartin Hundebøll /**
61*f097e25dSMartin Hundebøll  * batadv_send_4addr_unicast_skb - send the skb encapsulated in a unicast 4addr
62*f097e25dSMartin Hundebøll  *  packet
63*f097e25dSMartin Hundebøll  * @bat_priv: the bat priv with all the soft interface information
64*f097e25dSMartin Hundebøll  * @skb: the payload to send
65*f097e25dSMartin Hundebøll  * @packet_subtype: the unicast 4addr packet subtype to use
66*f097e25dSMartin Hundebøll  *
67*f097e25dSMartin Hundebøll  * Returns 1 in case of error or 0 otherwise.
68*f097e25dSMartin Hundebøll  */
69*f097e25dSMartin Hundebøll static inline int batadv_send_skb_unicast_4addr(struct batadv_priv *bat_priv,
70*f097e25dSMartin Hundebøll 						struct sk_buff *skb,
71*f097e25dSMartin Hundebøll 						int packet_subtype)
72*f097e25dSMartin Hundebøll {
73*f097e25dSMartin Hundebøll 	return batadv_send_skb_generic_unicast(bat_priv, skb,
74*f097e25dSMartin Hundebøll 					       BATADV_UNICAST_4ADDR,
75*f097e25dSMartin Hundebøll 					       packet_subtype);
76*f097e25dSMartin Hundebøll }
77c6c8fea2SSven Eckelmann 
78c6c8fea2SSven Eckelmann #endif /* _NET_BATMAN_ADV_SEND_H_ */
79