network-coding.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /* Copyright (C) 2012-2013 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, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  17. * 02110-1301, USA
  18. */
  19. #ifndef _NET_BATMAN_ADV_NETWORK_CODING_H_
  20. #define _NET_BATMAN_ADV_NETWORK_CODING_H_
  21. #ifdef CONFIG_BATMAN_ADV_NC
  22. void batadv_nc_status_update(struct net_device *net_dev);
  23. int batadv_nc_init(void);
  24. int batadv_nc_mesh_init(struct batadv_priv *bat_priv);
  25. void batadv_nc_mesh_free(struct batadv_priv *bat_priv);
  26. void batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
  27. struct batadv_orig_node *orig_node,
  28. struct batadv_orig_node *orig_neigh_node,
  29. struct batadv_ogm_packet *ogm_packet,
  30. int is_single_hop_neigh);
  31. void batadv_nc_purge_orig(struct batadv_priv *bat_priv,
  32. struct batadv_orig_node *orig_node,
  33. bool (*to_purge)(struct batadv_priv *,
  34. struct batadv_nc_node *));
  35. void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv);
  36. void batadv_nc_init_orig(struct batadv_orig_node *orig_node);
  37. bool batadv_nc_skb_forward(struct sk_buff *skb,
  38. struct batadv_neigh_node *neigh_node);
  39. void batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv,
  40. struct sk_buff *skb);
  41. void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
  42. struct sk_buff *skb);
  43. int batadv_nc_nodes_seq_print_text(struct seq_file *seq, void *offset);
  44. int batadv_nc_init_debugfs(struct batadv_priv *bat_priv);
  45. #else /* ifdef CONFIG_BATMAN_ADV_NC */
  46. static inline void batadv_nc_status_update(struct net_device *net_dev)
  47. {
  48. }
  49. static inline int batadv_nc_init(void)
  50. {
  51. return 0;
  52. }
  53. static inline int batadv_nc_mesh_init(struct batadv_priv *bat_priv)
  54. {
  55. return 0;
  56. }
  57. static inline void batadv_nc_mesh_free(struct batadv_priv *bat_priv)
  58. {
  59. return;
  60. }
  61. static inline void
  62. batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
  63. struct batadv_orig_node *orig_node,
  64. struct batadv_orig_node *orig_neigh_node,
  65. struct batadv_ogm_packet *ogm_packet,
  66. int is_single_hop_neigh)
  67. {
  68. return;
  69. }
  70. static inline void
  71. batadv_nc_purge_orig(struct batadv_priv *bat_priv,
  72. struct batadv_orig_node *orig_node,
  73. bool (*to_purge)(struct batadv_priv *,
  74. struct batadv_nc_node *))
  75. {
  76. return;
  77. }
  78. static inline void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv)
  79. {
  80. return;
  81. }
  82. static inline void batadv_nc_init_orig(struct batadv_orig_node *orig_node)
  83. {
  84. return;
  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. return;
  96. }
  97. static inline void
  98. batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
  99. struct sk_buff *skb)
  100. {
  101. return;
  102. }
  103. static inline int batadv_nc_nodes_seq_print_text(struct seq_file *seq,
  104. void *offset)
  105. {
  106. return 0;
  107. }
  108. static inline int batadv_nc_init_debugfs(struct batadv_priv *bat_priv)
  109. {
  110. return 0;
  111. }
  112. #endif /* ifdef CONFIG_BATMAN_ADV_NC */
  113. #endif /* _NET_BATMAN_ADV_NETWORK_CODING_H_ */