xref: /openbmc/linux/net/batman-adv/tvlv.h (revision 724ba675)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) B.A.T.M.A.N. contributors:
3  *
4  * Marek Lindner, Simon Wunderlich
5  */
6 
7 #ifndef _NET_BATMAN_ADV_TVLV_H_
8 #define _NET_BATMAN_ADV_TVLV_H_
9 
10 #include "main.h"
11 
12 #include <linux/skbuff.h>
13 #include <linux/types.h>
14 #include <uapi/linux/batadv_packet.h>
15 
16 void batadv_tvlv_container_register(struct batadv_priv *bat_priv,
17 				    u8 type, u8 version,
18 				    void *tvlv_value, u16 tvlv_value_len);
19 u16 batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv,
20 				     unsigned char **packet_buff,
21 				     int *packet_buff_len, int packet_min_len);
22 void batadv_tvlv_ogm_receive(struct batadv_priv *bat_priv,
23 			     struct batadv_ogm_packet *batadv_ogm_packet,
24 			     struct batadv_orig_node *orig_node);
25 void batadv_tvlv_container_unregister(struct batadv_priv *bat_priv,
26 				      u8 type, u8 version);
27 
28 void batadv_tvlv_handler_register(struct batadv_priv *bat_priv,
29 				  void (*optr)(struct batadv_priv *bat_priv,
30 					       struct batadv_orig_node *orig,
31 					       u8 flags,
32 					       void *tvlv_value,
33 					       u16 tvlv_value_len),
34 				  int (*uptr)(struct batadv_priv *bat_priv,
35 					      u8 *src, u8 *dst,
36 					      void *tvlv_value,
37 					      u16 tvlv_value_len),
38 				  int (*mptr)(struct batadv_priv *bat_priv,
39 					      struct sk_buff *skb),
40 				  u8 type, u8 version, u8 flags);
41 void batadv_tvlv_handler_unregister(struct batadv_priv *bat_priv,
42 				    u8 type, u8 version);
43 int batadv_tvlv_containers_process(struct batadv_priv *bat_priv,
44 				   u8 packet_type,
45 				   struct batadv_orig_node *orig_node,
46 				   struct sk_buff *skb, void *tvlv_buff,
47 				   u16 tvlv_buff_len);
48 void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, const u8 *src,
49 			      const u8 *dst, u8 type, u8 version,
50 			      void *tvlv_value, u16 tvlv_value_len);
51 
52 #endif /* _NET_BATMAN_ADV_TVLV_H_ */
53