network-coding.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (C) B.A.T.M.A.N. contributors:
  3. *
  4. * Martin Hundebøll, Jeppe Ledet-Pedersen
  5. */
  6. #ifndef _NET_BATMAN_ADV_NETWORK_CODING_H_
  7. #define _NET_BATMAN_ADV_NETWORK_CODING_H_
  8. #include "main.h"
  9. #include <linux/netdevice.h>
  10. #include <linux/skbuff.h>
  11. #include <linux/types.h>
  12. #include <uapi/linux/batadv_packet.h>
  13. #ifdef CONFIG_BATMAN_ADV_NC
  14. void batadv_nc_status_update(struct net_device *net_dev);
  15. int batadv_nc_init(void);
  16. int batadv_nc_mesh_init(struct batadv_priv *bat_priv);
  17. void batadv_nc_mesh_free(struct batadv_priv *bat_priv);
  18. void batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
  19. struct batadv_orig_node *orig_node,
  20. struct batadv_orig_node *orig_neigh_node,
  21. struct batadv_ogm_packet *ogm_packet,
  22. int is_single_hop_neigh);
  23. void batadv_nc_purge_orig(struct batadv_priv *bat_priv,
  24. struct batadv_orig_node *orig_node,
  25. bool (*to_purge)(struct batadv_priv *,
  26. struct batadv_nc_node *));
  27. void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv);
  28. void batadv_nc_init_orig(struct batadv_orig_node *orig_node);
  29. bool batadv_nc_skb_forward(struct sk_buff *skb,
  30. struct batadv_neigh_node *neigh_node);
  31. void batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv,
  32. struct sk_buff *skb);
  33. void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
  34. struct sk_buff *skb);
  35. #else /* ifdef CONFIG_BATMAN_ADV_NC */
  36. static inline void batadv_nc_status_update(struct net_device *net_dev)
  37. {
  38. }
  39. static inline int batadv_nc_init(void)
  40. {
  41. return 0;
  42. }
  43. static inline int batadv_nc_mesh_init(struct batadv_priv *bat_priv)
  44. {
  45. return 0;
  46. }
  47. static inline void batadv_nc_mesh_free(struct batadv_priv *bat_priv)
  48. {
  49. }
  50. static inline void
  51. batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
  52. struct batadv_orig_node *orig_node,
  53. struct batadv_orig_node *orig_neigh_node,
  54. struct batadv_ogm_packet *ogm_packet,
  55. int is_single_hop_neigh)
  56. {
  57. }
  58. static inline void
  59. batadv_nc_purge_orig(struct batadv_priv *bat_priv,
  60. struct batadv_orig_node *orig_node,
  61. bool (*to_purge)(struct batadv_priv *,
  62. struct batadv_nc_node *))
  63. {
  64. }
  65. static inline void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv)
  66. {
  67. }
  68. static inline void batadv_nc_init_orig(struct batadv_orig_node *orig_node)
  69. {
  70. }
  71. static inline bool batadv_nc_skb_forward(struct sk_buff *skb,
  72. struct batadv_neigh_node *neigh_node)
  73. {
  74. return false;
  75. }
  76. static inline void
  77. batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv,
  78. struct sk_buff *skb)
  79. {
  80. }
  81. static inline void
  82. batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
  83. struct sk_buff *skb)
  84. {
  85. }
  86. #endif /* ifdef CONFIG_BATMAN_ADV_NC */
  87. #endif /* _NET_BATMAN_ADV_NETWORK_CODING_H_ */