xref: /openbmc/linux/net/batman-adv/tvlv.h (revision c2cd9d04)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2007-2019  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/types.h>
13 
14 struct batadv_ogm_packet;
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 				  u8 type, u8 version, u8 flags);
39 void batadv_tvlv_handler_unregister(struct batadv_priv *bat_priv,
40 				    u8 type, u8 version);
41 int batadv_tvlv_containers_process(struct batadv_priv *bat_priv,
42 				   bool ogm_source,
43 				   struct batadv_orig_node *orig_node,
44 				   u8 *src, u8 *dst,
45 				   void *tvlv_buff, u16 tvlv_buff_len);
46 void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, u8 *src,
47 			      u8 *dst, u8 type, u8 version,
48 			      void *tvlv_value, u16 tvlv_value_len);
49 
50 #endif /* _NET_BATMAN_ADV_TVLV_H_ */
51