xref: /linux/include/net/rpl.h (revision faee676944dab731c9b2b91cf86c769d291a2237)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *  RPL implementation
4  *
5  *  Author:
6  *  (C) 2020 Alexander Aring <alex.aring@gmail.com>
7  */
8 
9 #ifndef _NET_RPL_H
10 #define _NET_RPL_H
11 
12 #include <linux/rpl.h>
13 
14 /* Worst decompression memory usage ipv6 address (16) + pad 7 */
15 #define IPV6_RPL_SRH_WORST_SWAP_SIZE (sizeof(struct in6_addr) + 7)
16 
17 static inline size_t ipv6_rpl_srh_alloc_size(unsigned char n)
18 {
19 	return sizeof(struct ipv6_rpl_sr_hdr) +
20 		((n + 1) * sizeof(struct in6_addr));
21 }
22 
23 size_t ipv6_rpl_srh_size(unsigned char n, unsigned char cmpri,
24 			 unsigned char cmpre);
25 
26 void ipv6_rpl_srh_decompress(struct ipv6_rpl_sr_hdr *outhdr,
27 			     const struct ipv6_rpl_sr_hdr *inhdr,
28 			     const struct in6_addr *daddr, unsigned char n);
29 
30 void ipv6_rpl_srh_compress(struct ipv6_rpl_sr_hdr *outhdr,
31 			   const struct ipv6_rpl_sr_hdr *inhdr,
32 			   const struct in6_addr *daddr, unsigned char n);
33 
34 #endif /* _NET_RPL_H */
35