send.h 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* Copyright (C) 2007-2014 B.A.T.M.A.N. contributors:
  2. *
  3. * Marek Lindner, Simon Wunderlich
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of version 2 of the GNU General Public
  7. * License as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef _NET_BATMAN_ADV_SEND_H_
  18. #define _NET_BATMAN_ADV_SEND_H_
  19. int batadv_send_skb_packet(struct sk_buff *skb,
  20. struct batadv_hard_iface *hard_iface,
  21. const uint8_t *dst_addr);
  22. int batadv_send_skb_to_orig(struct sk_buff *skb,
  23. struct batadv_orig_node *orig_node,
  24. struct batadv_hard_iface *recv_if);
  25. void batadv_schedule_bat_ogm(struct batadv_hard_iface *hard_iface);
  26. int batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv,
  27. const struct sk_buff *skb,
  28. unsigned long delay);
  29. void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work);
  30. void
  31. batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
  32. const struct batadv_hard_iface *hard_iface);
  33. bool batadv_send_skb_prepare_unicast_4addr(struct batadv_priv *bat_priv,
  34. struct sk_buff *skb,
  35. struct batadv_orig_node *orig_node,
  36. int packet_subtype);
  37. int batadv_send_skb_unicast(struct batadv_priv *bat_priv,
  38. struct sk_buff *skb, int packet_type,
  39. int packet_subtype,
  40. struct batadv_orig_node *orig_node,
  41. unsigned short vid);
  42. int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv,
  43. struct sk_buff *skb, int packet_type,
  44. int packet_subtype, uint8_t *dst_hint,
  45. unsigned short vid);
  46. int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb,
  47. unsigned short vid);
  48. /**
  49. * batadv_send_skb_via_tt - send an skb via TT lookup
  50. * @bat_priv: the bat priv with all the soft interface information
  51. * @skb: the payload to send
  52. * @dst_hint: can be used to override the destination contained in the skb
  53. * @vid: the vid to be used to search the translation table
  54. *
  55. * Look up the recipient node for the destination address in the ethernet
  56. * header via the translation table. Wrap the given skb into a batman-adv
  57. * unicast header. Then send this frame to the according destination node.
  58. *
  59. * Returns NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
  60. */
  61. static inline int batadv_send_skb_via_tt(struct batadv_priv *bat_priv,
  62. struct sk_buff *skb, uint8_t *dst_hint,
  63. unsigned short vid)
  64. {
  65. return batadv_send_skb_via_tt_generic(bat_priv, skb, BATADV_UNICAST, 0,
  66. dst_hint, vid);
  67. }
  68. /**
  69. * batadv_send_skb_via_tt_4addr - send an skb via TT lookup
  70. * @bat_priv: the bat priv with all the soft interface information
  71. * @skb: the payload to send
  72. * @packet_subtype: the unicast 4addr packet subtype to use
  73. * @dst_hint: can be used to override the destination contained in the skb
  74. * @vid: the vid to be used to search the translation table
  75. *
  76. * Look up the recipient node for the destination address in the ethernet
  77. * header via the translation table. Wrap the given skb into a batman-adv
  78. * unicast-4addr header. Then send this frame to the according destination
  79. * node.
  80. *
  81. * Returns NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
  82. */
  83. static inline int batadv_send_skb_via_tt_4addr(struct batadv_priv *bat_priv,
  84. struct sk_buff *skb,
  85. int packet_subtype,
  86. uint8_t *dst_hint,
  87. unsigned short vid)
  88. {
  89. return batadv_send_skb_via_tt_generic(bat_priv, skb,
  90. BATADV_UNICAST_4ADDR,
  91. packet_subtype, dst_hint, vid);
  92. }
  93. #endif /* _NET_BATMAN_ADV_SEND_H_ */