Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright (C) B.A.T.M.A.N. contributors:
0003  *
0004  * Martin Hundebøll, Jeppe Ledet-Pedersen
0005  */
0006 
0007 #ifndef _NET_BATMAN_ADV_NETWORK_CODING_H_
0008 #define _NET_BATMAN_ADV_NETWORK_CODING_H_
0009 
0010 #include "main.h"
0011 
0012 #include <linux/netdevice.h>
0013 #include <linux/skbuff.h>
0014 #include <linux/types.h>
0015 #include <uapi/linux/batadv_packet.h>
0016 
0017 #ifdef CONFIG_BATMAN_ADV_NC
0018 
0019 void batadv_nc_status_update(struct net_device *net_dev);
0020 int batadv_nc_init(void);
0021 int batadv_nc_mesh_init(struct batadv_priv *bat_priv);
0022 void batadv_nc_mesh_free(struct batadv_priv *bat_priv);
0023 void batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
0024                   struct batadv_orig_node *orig_node,
0025                   struct batadv_orig_node *orig_neigh_node,
0026                   struct batadv_ogm_packet *ogm_packet,
0027                   int is_single_hop_neigh);
0028 void batadv_nc_purge_orig(struct batadv_priv *bat_priv,
0029               struct batadv_orig_node *orig_node,
0030               bool (*to_purge)(struct batadv_priv *,
0031                        struct batadv_nc_node *));
0032 void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv);
0033 void batadv_nc_init_orig(struct batadv_orig_node *orig_node);
0034 bool batadv_nc_skb_forward(struct sk_buff *skb,
0035                struct batadv_neigh_node *neigh_node);
0036 void batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv,
0037                       struct sk_buff *skb);
0038 void batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
0039                      struct sk_buff *skb);
0040 
0041 #else /* ifdef CONFIG_BATMAN_ADV_NC */
0042 
0043 static inline void batadv_nc_status_update(struct net_device *net_dev)
0044 {
0045 }
0046 
0047 static inline int batadv_nc_init(void)
0048 {
0049     return 0;
0050 }
0051 
0052 static inline int batadv_nc_mesh_init(struct batadv_priv *bat_priv)
0053 {
0054     return 0;
0055 }
0056 
0057 static inline void batadv_nc_mesh_free(struct batadv_priv *bat_priv)
0058 {
0059 }
0060 
0061 static inline void
0062 batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
0063              struct batadv_orig_node *orig_node,
0064              struct batadv_orig_node *orig_neigh_node,
0065              struct batadv_ogm_packet *ogm_packet,
0066              int is_single_hop_neigh)
0067 {
0068 }
0069 
0070 static inline void
0071 batadv_nc_purge_orig(struct batadv_priv *bat_priv,
0072              struct batadv_orig_node *orig_node,
0073              bool (*to_purge)(struct batadv_priv *,
0074                       struct batadv_nc_node *))
0075 {
0076 }
0077 
0078 static inline void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv)
0079 {
0080 }
0081 
0082 static inline void batadv_nc_init_orig(struct batadv_orig_node *orig_node)
0083 {
0084 }
0085 
0086 static inline bool batadv_nc_skb_forward(struct sk_buff *skb,
0087                      struct batadv_neigh_node *neigh_node)
0088 {
0089     return false;
0090 }
0091 
0092 static inline void
0093 batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv,
0094                  struct sk_buff *skb)
0095 {
0096 }
0097 
0098 static inline void
0099 batadv_nc_skb_store_sniffed_unicast(struct batadv_priv *bat_priv,
0100                     struct sk_buff *skb)
0101 {
0102 }
0103 
0104 #endif /* ifdef CONFIG_BATMAN_ADV_NC */
0105 
0106 #endif /* _NET_BATMAN_ADV_NETWORK_CODING_H_ */