network-coding.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (C) 2012-2018 B.A.T.M.A.N. contributors:
  3. *
  4. * Martin Hundebøll, Jeppe Ledet-Pedersen
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of version 2 of the GNU General Public
  8. * License as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef _NET_BATMAN_ADV_NETWORK_CODING_H_
  19. #define _NET_BATMAN_ADV_NETWORK_CODING_H_
  20. #include "main.h"
  21. #include <linux/types.h>
  22. struct batadv_ogm_packet;
  23. struct net_device;
  24. struct seq_file;
  25. struct sk_buff;
  26. #ifdef CONFIG_BATMAN_ADV_NC
  27. void batadv_nc_status_update(struct net_device *net_dev);
  28. int batadv_nc_init(void);
  29. int batadv_nc_mesh_init(struct batadv_priv *bat_priv);
  30. void batadv_nc_mesh_free(struct batadv_priv *bat_priv);
  31. void batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
  32. struct batadv_orig_node *orig_node,
  33. struct batadv_orig_node *orig_neigh_node,
  34. struct batadv_ogm_packet *ogm_packet,
  35. int is_single_hop_neigh);
  36. void batadv_nc_purge_orig(struct batadv_priv *bat_priv,
  37. struct batadv_orig_node *orig_node,
  38. bool (*to_purge)(struct batadv_priv *,
  39. struct batadv_nc_node *));
  40. void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv);
  41. void batadv_nc_init_orig(struct batadv_orig_node *orig_node);
  42. bool batadv_nc_skb_forward(struct sk_buff *skb,
  43. struct batadv_neigh_node *neigh_node);
  44. void batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv,
  45. struct sk_buff *skb);
  46. void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
  47. struct sk_buff *skb);
  48. int batadv_nc_nodes_seq_print_text(struct seq_file *seq, void *offset);
  49. int batadv_nc_init_debugfs(struct batadv_priv *bat_priv);
  50. #else /* ifdef CONFIG_BATMAN_ADV_NC */
  51. static inline void batadv_nc_status_update(struct net_device *net_dev)
  52. {
  53. }
  54. static inline int batadv_nc_init(void)
  55. {
  56. return 0;
  57. }
  58. static inline int batadv_nc_mesh_init(struct batadv_priv *bat_priv)
  59. {
  60. return 0;
  61. }
  62. static inline void batadv_nc_mesh_free(struct batadv_priv *bat_priv)
  63. {
  64. }
  65. static inline void
  66. batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
  67. struct batadv_orig_node *orig_node,
  68. struct batadv_orig_node *orig_neigh_node,
  69. struct batadv_ogm_packet *ogm_packet,
  70. int is_single_hop_neigh)
  71. {
  72. }
  73. static inline void
  74. batadv_nc_purge_orig(struct batadv_priv *bat_priv,
  75. struct batadv_orig_node *orig_node,
  76. bool (*to_purge)(struct batadv_priv *,
  77. struct batadv_nc_node *))
  78. {
  79. }
  80. static inline void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv)
  81. {
  82. }
  83. static inline void batadv_nc_init_orig(struct batadv_orig_node *orig_node)
  84. {
  85. }
  86. static inline bool batadv_nc_skb_forward(struct sk_buff *skb,
  87. struct batadv_neigh_node *neigh_node)
  88. {
  89. return false;
  90. }
  91. static inline void
  92. batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv,
  93. struct sk_buff *skb)
  94. {
  95. }
  96. static inline void
  97. batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
  98. struct sk_buff *skb)
  99. {
  100. }
  101. static inline int batadv_nc_nodes_seq_print_text(struct seq_file *seq,
  102. void *offset)
  103. {
  104. return 0;
  105. }
  106. static inline int batadv_nc_init_debugfs(struct batadv_priv *bat_priv)
  107. {
  108. return 0;
  109. }
  110. #endif /* ifdef CONFIG_BATMAN_ADV_NC */
  111. #endif /* _NET_BATMAN_ADV_NETWORK_CODING_H_ */