network-coding.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (C) 2012-2020 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/seq_file.h>
  11. #include <linux/skbuff.h>
  12. #include <linux/types.h>
  13. #include <uapi/linux/batadv_packet.h>
  14. #ifdef CONFIG_BATMAN_ADV_NC
  15. void batadv_nc_status_update(struct net_device *net_dev);
  16. int batadv_nc_init(void);
  17. int batadv_nc_mesh_init(struct batadv_priv *bat_priv);
  18. void batadv_nc_mesh_free(struct batadv_priv *bat_priv);
  19. void batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
  20. struct batadv_orig_node *orig_node,
  21. struct batadv_orig_node *orig_neigh_node,
  22. struct batadv_ogm_packet *ogm_packet,
  23. int is_single_hop_neigh);
  24. void batadv_nc_purge_orig(struct batadv_priv *bat_priv,
  25. struct batadv_orig_node *orig_node,
  26. bool (*to_purge)(struct batadv_priv *,
  27. struct batadv_nc_node *));
  28. void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv);
  29. void batadv_nc_init_orig(struct batadv_orig_node *orig_node);
  30. bool batadv_nc_skb_forward(struct sk_buff *skb,
  31. struct batadv_neigh_node *neigh_node);
  32. void batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv,
  33. struct sk_buff *skb);
  34. void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
  35. struct sk_buff *skb);
  36. int batadv_nc_nodes_seq_print_text(struct seq_file *seq, void *offset);
  37. void batadv_nc_init_debugfs(struct batadv_priv *bat_priv);
  38. #else /* ifdef CONFIG_BATMAN_ADV_NC */
  39. static inline void batadv_nc_status_update(struct net_device *net_dev)
  40. {
  41. }
  42. static inline int batadv_nc_init(void)
  43. {
  44. return 0;
  45. }
  46. static inline int batadv_nc_mesh_init(struct batadv_priv *bat_priv)
  47. {
  48. return 0;
  49. }
  50. static inline void batadv_nc_mesh_free(struct batadv_priv *bat_priv)
  51. {
  52. }
  53. static inline void
  54. batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
  55. struct batadv_orig_node *orig_node,
  56. struct batadv_orig_node *orig_neigh_node,
  57. struct batadv_ogm_packet *ogm_packet,
  58. int is_single_hop_neigh)
  59. {
  60. }
  61. static inline void
  62. batadv_nc_purge_orig(struct batadv_priv *bat_priv,
  63. struct batadv_orig_node *orig_node,
  64. bool (*to_purge)(struct batadv_priv *,
  65. struct batadv_nc_node *))
  66. {
  67. }
  68. static inline void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv)
  69. {
  70. }
  71. static inline void batadv_nc_init_orig(struct batadv_orig_node *orig_node)
  72. {
  73. }
  74. static inline bool batadv_nc_skb_forward(struct sk_buff *skb,
  75. struct batadv_neigh_node *neigh_node)
  76. {
  77. return false;
  78. }
  79. static inline void
  80. batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv,
  81. struct sk_buff *skb)
  82. {
  83. }
  84. static inline void
  85. batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
  86. struct sk_buff *skb)
  87. {
  88. }
  89. static inline int batadv_nc_nodes_seq_print_text(struct seq_file *seq,
  90. void *offset)
  91. {
  92. return 0;
  93. }
  94. static inline void batadv_nc_init_debugfs(struct batadv_priv *bat_priv)
  95. {
  96. }
  97. #endif /* ifdef CONFIG_BATMAN_ADV_NC */
  98. #endif /* _NET_BATMAN_ADV_NETWORK_CODING_H_ */