xref: /openbmc/linux/net/batman-adv/tvlv.h (revision 1491eaf9)
1 /* Copyright (C) 2007-2016  B.A.T.M.A.N. contributors:
2  *
3  * Marek Lindner, Simon Wunderlich
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, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef _NET_BATMAN_ADV_TVLV_H_
19 #define _NET_BATMAN_ADV_TVLV_H_
20 
21 #include "main.h"
22 
23 #include <linux/types.h>
24 
25 struct batadv_ogm_packet;
26 
27 void batadv_tvlv_container_register(struct batadv_priv *bat_priv,
28 				    u8 type, u8 version,
29 				    void *tvlv_value, u16 tvlv_value_len);
30 u16 batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv,
31 				     unsigned char **packet_buff,
32 				     int *packet_buff_len, int packet_min_len);
33 void batadv_tvlv_ogm_receive(struct batadv_priv *bat_priv,
34 			     struct batadv_ogm_packet *batadv_ogm_packet,
35 			     struct batadv_orig_node *orig_node);
36 void batadv_tvlv_container_unregister(struct batadv_priv *bat_priv,
37 				      u8 type, u8 version);
38 
39 void batadv_tvlv_handler_register(struct batadv_priv *bat_priv,
40 				  void (*optr)(struct batadv_priv *bat_priv,
41 					       struct batadv_orig_node *orig,
42 					       u8 flags,
43 					       void *tvlv_value,
44 					       u16 tvlv_value_len),
45 				  int (*uptr)(struct batadv_priv *bat_priv,
46 					      u8 *src, u8 *dst,
47 					      void *tvlv_value,
48 					      u16 tvlv_value_len),
49 				  u8 type, u8 version, u8 flags);
50 void batadv_tvlv_handler_unregister(struct batadv_priv *bat_priv,
51 				    u8 type, u8 version);
52 int batadv_tvlv_containers_process(struct batadv_priv *bat_priv,
53 				   bool ogm_source,
54 				   struct batadv_orig_node *orig_node,
55 				   u8 *src, u8 *dst,
56 				   void *tvlv_buff, u16 tvlv_buff_len);
57 void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, u8 *src,
58 			      u8 *dst, u8 type, u8 version,
59 			      void *tvlv_value, u16 tvlv_value_len);
60 
61 #endif /* _NET_BATMAN_ADV_TVLV_H_ */
62