aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/main.h
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2013-04-23 09:39:57 -0400
committerAntonio Quartulli <antonio@meshcoding.com>2013-10-09 15:22:26 -0400
commitef26157747d42254453f6b3ac2bd8bd3c53339c3 (patch)
treeac9f366de417ca89b225143eb176b9618376f5eb /net/batman-adv/main.h
parent60cf7981b770e329a05734d1e6eb055f13219202 (diff)
batman-adv: tvlv - basic infrastructure
The goal is to provide the infrastructure for sending, receiving and parsing information 'containers' while preserving backward compatibility. TVLV (based on the commonly known Type Length Value technique) was chosen as the format for those containers. Even if a node does not know the tvlv type of a certain container it can simply skip the current container and proceed with the next. Past experience has shown features evolve over time, so a 'version' field was added right from the start to allow differentiating between feature variants - hence the name: T(ype) V(ersion) L(ength) V(alue). This patch introduces the basic TVLV infrastructure: * register / unregister tvlv containers to be sent with each OGM (on primary interfaces only) * register / unregister callback handlers to be called upon finding the corresponding tvlv type in a tvlv buffer * unicast tvlv send / receive API calls Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Spyros Gasteratos <morfeas3000@gmail.com> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Diffstat (limited to 'net/batman-adv/main.h')
-rw-r--r--net/batman-adv/main.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 24675523930f..397722fb509b 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -326,4 +326,39 @@ static inline uint64_t batadv_sum_counter(struct batadv_priv *bat_priv,
326 */ 326 */
327#define BATADV_SKB_CB(__skb) ((struct batadv_skb_cb *)&((__skb)->cb[0])) 327#define BATADV_SKB_CB(__skb) ((struct batadv_skb_cb *)&((__skb)->cb[0]))
328 328
329void batadv_tvlv_container_register(struct batadv_priv *bat_priv,
330 uint8_t type, uint8_t version,
331 void *tvlv_value, uint16_t tvlv_value_len);
332uint16_t batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv,
333 unsigned char **packet_buff,
334 int *packet_buff_len,
335 int packet_min_len);
336void batadv_tvlv_ogm_receive(struct batadv_priv *bat_priv,
337 struct batadv_ogm_packet *batadv_ogm_packet,
338 struct batadv_orig_node *orig_node);
339void batadv_tvlv_container_unregister(struct batadv_priv *bat_priv,
340 uint8_t type, uint8_t version);
341
342void batadv_tvlv_handler_register(struct batadv_priv *bat_priv,
343 void (*optr)(struct batadv_priv *bat_priv,
344 struct batadv_orig_node *orig,
345 uint8_t flags,
346 void *tvlv_value,
347 uint16_t tvlv_value_len),
348 int (*uptr)(struct batadv_priv *bat_priv,
349 uint8_t *src, uint8_t *dst,
350 void *tvlv_value,
351 uint16_t tvlv_value_len),
352 uint8_t type, uint8_t version, uint8_t flags);
353void batadv_tvlv_handler_unregister(struct batadv_priv *bat_priv,
354 uint8_t type, uint8_t version);
355int batadv_tvlv_containers_process(struct batadv_priv *bat_priv,
356 bool ogm_source,
357 struct batadv_orig_node *orig_node,
358 uint8_t *src, uint8_t *dst,
359 void *tvlv_buff, uint16_t tvlv_buff_len);
360void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, uint8_t *src,
361 uint8_t *dst, uint8_t type, uint8_t version,
362 void *tvlv_value, uint16_t tvlv_value_len);
363
329#endif /* _NET_BATMAN_ADV_MAIN_H_ */ 364#endif /* _NET_BATMAN_ADV_MAIN_H_ */