network-coding.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /* Copyright (C) 2012-2015 B.A.T.M.A.N. contributors:
  2. *
  3. * Martin Hundebøll, Jeppe Ledet-Pedersen
  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_NETWORK_CODING_H_
  18. #define _NET_BATMAN_ADV_NETWORK_CODING_H_
  19. #include "main.h"
  20. #include <linux/types.h>
  21. struct batadv_nc_node;
  22. struct batadv_neigh_node;
  23. struct batadv_ogm_packet;
  24. struct batadv_orig_node;
  25. struct batadv_priv;
  26. struct net_device;
  27. struct seq_file;
  28. struct sk_buff;
  29. #ifdef CONFIG_BATMAN_ADV_NC
  30. void batadv_nc_status_update(struct net_device *net_dev);
  31. int batadv_nc_init(void);
  32. int batadv_nc_mesh_init(struct batadv_priv *bat_priv);
  33. void batadv_nc_mesh_free(struct batadv_priv *bat_priv);
  34. void batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
  35. struct batadv_orig_node *orig_node,
  36. struct batadv_orig_node *orig_neigh_node,
  37. struct batadv_ogm_packet *ogm_packet,
  38. int is_single_hop_neigh);
  39. void batadv_nc_purge_orig(struct batadv_priv *bat_priv,
  40. struct batadv_orig_node *orig_node,
  41. bool (*to_purge)(struct batadv_priv *,
  42. struct batadv_nc_node *));
  43. void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv);
  44. void batadv_nc_init_orig(struct batadv_orig_node *orig_node);
  45. bool batadv_nc_skb_forward(struct sk_buff *skb,
  46. struct batadv_neigh_node *neigh_node);
  47. void batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv,
  48. struct sk_buff *skb);
  49. void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
  50. struct sk_buff *skb);
  51. int batadv_nc_nodes_seq_print_text(struct seq_file *seq, void *offset);
  52. int batadv_nc_init_debugfs(struct batadv_priv *bat_priv);
  53. #else /* ifdef CONFIG_BATMAN_ADV_NC */
  54. static inline void batadv_nc_status_update(struct net_device *net_dev)
  55. {
  56. }
  57. static inline int batadv_nc_init(void)
  58. {
  59. return 0;
  60. }
  61. static inline int batadv_nc_mesh_init(struct batadv_priv *bat_priv)
  62. {
  63. return 0;
  64. }
  65. static inline void batadv_nc_mesh_free(struct batadv_priv *bat_priv)
  66. {
  67. }
  68. static inline void
  69. batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
  70. struct batadv_orig_node *orig_node,
  71. struct batadv_orig_node *orig_neigh_node,
  72. struct batadv_ogm_packet *ogm_packet,
  73. int is_single_hop_neigh)
  74. {
  75. }
  76. static inline void
  77. batadv_nc_purge_orig(struct batadv_priv *bat_priv,
  78. struct batadv_orig_node *orig_node,
  79. bool (*to_purge)(struct batadv_priv *,
  80. struct batadv_nc_node *))
  81. {
  82. }
  83. static inline void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv)
  84. {
  85. }
  86. static inline void batadv_nc_init_orig(struct batadv_orig_node *orig_node)
  87. {
  88. }
  89. static inline bool batadv_nc_skb_forward(struct sk_buff *skb,
  90. struct batadv_neigh_node *neigh_node)
  91. {
  92. return false;
  93. }
  94. static inline void
  95. batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv,
  96. struct sk_buff *skb)
  97. {
  98. }
  99. static inline void
  100. batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
  101. struct sk_buff *skb)
  102. {
  103. }
  104. static inline int batadv_nc_nodes_seq_print_text(struct seq_file *seq,
  105. void *offset)
  106. {
  107. return 0;
  108. }
  109. static inline int batadv_nc_init_debugfs(struct batadv_priv *bat_priv)
  110. {
  111. return 0;
  112. }
  113. #endif /* ifdef CONFIG_BATMAN_ADV_NC */
  114. #endif /* _NET_BATMAN_ADV_NETWORK_CODING_H_ */