Blame view

net/batman-adv/send.h 4.16 KB
7db7d9f36   Sven Eckelmann   batman-adv: Add S...
1
  /* SPDX-License-Identifier: GPL-2.0 */
7a79d717e   Sven Eckelmann   batman-adv: Updat...
2
  /* Copyright (C) 2007-2019  B.A.T.M.A.N. contributors:
c6c8fea29   Sven Eckelmann   net: Add batman-a...
3
4
   *
   * Marek Lindner, Simon Wunderlich
c6c8fea29   Sven Eckelmann   net: Add batman-a...
5
6
7
8
   */
  
  #ifndef _NET_BATMAN_ADV_SEND_H_
  #define _NET_BATMAN_ADV_SEND_H_
1e2c2a4fe   Sven Eckelmann   batman-adv: Add r...
9
10
11
  #include "main.h"
  
  #include <linux/compiler.h>
68a600de9   Sven Eckelmann   batman-adv: Use i...
12
  #include <linux/skbuff.h>
9b4aec647   Linus Lüssing   batman-adv: fix r...
13
  #include <linux/spinlock.h>
1e2c2a4fe   Sven Eckelmann   batman-adv: Add r...
14
  #include <linux/types.h>
fec149f5d   Sven Eckelmann   batman-adv: Conve...
15
  #include <uapi/linux/batadv_packet.h>
1e2c2a4fe   Sven Eckelmann   batman-adv: Add r...
16

bd687fe41   Sven Eckelmann   batman-adv: use c...
17
18
  void batadv_forw_packet_free(struct batadv_forw_packet *forw_packet,
  			     bool dropped);
a65e54813   Linus Lüssing   batman-adv: Intro...
19
20
21
22
  struct batadv_forw_packet *
  batadv_forw_packet_alloc(struct batadv_hard_iface *if_incoming,
  			 struct batadv_hard_iface *if_outgoing,
  			 atomic_t *queue_left,
99ba18ef0   Linus Lüssing   batman-adv: priva...
23
24
  			 struct batadv_priv *bat_priv,
  			 struct sk_buff *skb);
9b4aec647   Linus Lüssing   batman-adv: fix r...
25
26
27
28
  bool batadv_forw_packet_steal(struct batadv_forw_packet *packet, spinlock_t *l);
  void batadv_forw_packet_ogmv1_queue(struct batadv_priv *bat_priv,
  				    struct batadv_forw_packet *forw_packet,
  				    unsigned long send_time);
e2d9ba435   Linus Lüssing   batman-adv: restr...
29
  bool batadv_forw_packet_is_rebroadcast(struct batadv_forw_packet *forw_packet);
a65e54813   Linus Lüssing   batman-adv: Intro...
30

e91ecfc64   Martin Hundebøll   batman-adv: Move ...
31
32
33
  int batadv_send_skb_to_orig(struct sk_buff *skb,
  			    struct batadv_orig_node *orig_node,
  			    struct batadv_hard_iface *recv_if);
95d392784   Antonio Quartulli   batman-adv: keep ...
34
35
36
37
38
39
40
  int batadv_send_skb_packet(struct sk_buff *skb,
  			   struct batadv_hard_iface *hard_iface,
  			   const u8 *dst_addr);
  int batadv_send_broadcast_skb(struct sk_buff *skb,
  			      struct batadv_hard_iface *hard_iface);
  int batadv_send_unicast_skb(struct sk_buff *skb,
  			    struct batadv_neigh_node *neigh_node);
56303d34a   Sven Eckelmann   batman-adv: Prefi...
41
  int batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv,
9455e34cb   Sven Eckelmann   batman-adv: Prefi...
42
  				    const struct sk_buff *skb,
3111beed0   Linus Lüssing   batman-adv: Simpl...
43
44
  				    unsigned long delay,
  				    bool own_packet);
56303d34a   Sven Eckelmann   batman-adv: Prefi...
45
46
47
  void
  batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
  				 const struct batadv_hard_iface *hard_iface);
f097e25db   Martin Hundebøll   batman-adv: Remov...
48
49
50
51
  bool batadv_send_skb_prepare_unicast_4addr(struct batadv_priv *bat_priv,
  					   struct sk_buff *skb,
  					   struct batadv_orig_node *orig_node,
  					   int packet_subtype);
1d8ab8d3c   Linus Lüssing   batman-adv: Modif...
52
53
54
55
56
  int batadv_send_skb_unicast(struct batadv_priv *bat_priv,
  			    struct sk_buff *skb, int packet_type,
  			    int packet_subtype,
  			    struct batadv_orig_node *orig_node,
  			    unsigned short vid);
e300d3146   Linus Lüssing   batman-adv: refin...
57
58
  int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv,
  				   struct sk_buff *skb, int packet_type,
6b5e971a2   Sven Eckelmann   batman-adv: Repla...
59
  				   int packet_subtype, u8 *dst_hint,
6c413b1c2   Antonio Quartulli   batman-adv: send ...
60
  				   unsigned short vid);
e300d3146   Linus Lüssing   batman-adv: refin...
61
62
  int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb,
  			   unsigned short vid);
f097e25db   Martin Hundebøll   batman-adv: Remov...
63
64
  
  /**
7e9a8c2ce   Sven Eckelmann   batman-adv: Use p...
65
   * batadv_send_skb_via_tt() - send an skb via TT lookup
f097e25db   Martin Hundebøll   batman-adv: Remov...
66
67
   * @bat_priv: the bat priv with all the soft interface information
   * @skb: the payload to send
c5d3a652a   Antonio Quartulli   batman-adv: add k...
68
   * @dst_hint: can be used to override the destination contained in the skb
c018ad3de   Antonio Quartulli   batman-adv: add t...
69
   * @vid: the vid to be used to search the translation table
f097e25db   Martin Hundebøll   batman-adv: Remov...
70
   *
e300d3146   Linus Lüssing   batman-adv: refin...
71
72
73
74
   * Look up the recipient node for the destination address in the ethernet
   * header via the translation table. Wrap the given skb into a batman-adv
   * unicast header. Then send this frame to the according destination node.
   *
62fe710f6   Sven Eckelmann   batman-adv: Fix k...
75
   * Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
f097e25db   Martin Hundebøll   batman-adv: Remov...
76
   */
e300d3146   Linus Lüssing   batman-adv: refin...
77
  static inline int batadv_send_skb_via_tt(struct batadv_priv *bat_priv,
6b5e971a2   Sven Eckelmann   batman-adv: Repla...
78
  					 struct sk_buff *skb, u8 *dst_hint,
e300d3146   Linus Lüssing   batman-adv: refin...
79
  					 unsigned short vid)
f097e25db   Martin Hundebøll   batman-adv: Remov...
80
  {
e300d3146   Linus Lüssing   batman-adv: refin...
81
  	return batadv_send_skb_via_tt_generic(bat_priv, skb, BATADV_UNICAST, 0,
6c413b1c2   Antonio Quartulli   batman-adv: send ...
82
  					      dst_hint, vid);
f097e25db   Martin Hundebøll   batman-adv: Remov...
83
84
85
  }
  
  /**
7e9a8c2ce   Sven Eckelmann   batman-adv: Use p...
86
   * batadv_send_skb_via_tt_4addr() - send an skb via TT lookup
f097e25db   Martin Hundebøll   batman-adv: Remov...
87
88
89
   * @bat_priv: the bat priv with all the soft interface information
   * @skb: the payload to send
   * @packet_subtype: the unicast 4addr packet subtype to use
c5d3a652a   Antonio Quartulli   batman-adv: add k...
90
   * @dst_hint: can be used to override the destination contained in the skb
c018ad3de   Antonio Quartulli   batman-adv: add t...
91
   * @vid: the vid to be used to search the translation table
f097e25db   Martin Hundebøll   batman-adv: Remov...
92
   *
e300d3146   Linus Lüssing   batman-adv: refin...
93
94
95
96
97
   * Look up the recipient node for the destination address in the ethernet
   * header via the translation table. Wrap the given skb into a batman-adv
   * unicast-4addr header. Then send this frame to the according destination
   * node.
   *
62fe710f6   Sven Eckelmann   batman-adv: Fix k...
98
   * Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
f097e25db   Martin Hundebøll   batman-adv: Remov...
99
   */
e300d3146   Linus Lüssing   batman-adv: refin...
100
101
102
  static inline int batadv_send_skb_via_tt_4addr(struct batadv_priv *bat_priv,
  					       struct sk_buff *skb,
  					       int packet_subtype,
6b5e971a2   Sven Eckelmann   batman-adv: Repla...
103
  					       u8 *dst_hint,
e300d3146   Linus Lüssing   batman-adv: refin...
104
  					       unsigned short vid)
f097e25db   Martin Hundebøll   batman-adv: Remov...
105
  {
e300d3146   Linus Lüssing   batman-adv: refin...
106
107
  	return batadv_send_skb_via_tt_generic(bat_priv, skb,
  					      BATADV_UNICAST_4ADDR,
6c413b1c2   Antonio Quartulli   batman-adv: send ...
108
  					      packet_subtype, dst_hint, vid);
f097e25db   Martin Hundebøll   batman-adv: Remov...
109
  }
c6c8fea29   Sven Eckelmann   net: Add batman-a...
110
111
  
  #endif /* _NET_BATMAN_ADV_SEND_H_ */