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