aboutsummaryrefslogtreecommitdiffstats
path: root/lib/checksum.h
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-04-09 18:51:05 +0200
committerlaforge <laforge@osmocom.org>2020-04-14 13:18:21 +0000
commit1c8ae666548d350701c3645a97792776203ff200 (patch)
tree9c6d63498fc2a5da2df0b83ae44d429724060d43 /lib/checksum.h
parentfcdaf31aa86b773cf7da07437d3b9b5bd9962ff7 (diff)
Move icmpv6 and checksum files from ggsn/ dir to lib/
They will be required by sgsnemu to implement ICMPv6 Router Soliciations. Change-Id: Ie878604f0fc0169cc98a1e9eee64b14d76be2c45
Diffstat (limited to 'lib/checksum.h')
-rw-r--r--lib/checksum.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/checksum.h b/lib/checksum.h
new file mode 100644
index 0000000..4b22431
--- /dev/null
+++ b/lib/checksum.h
@@ -0,0 +1,13 @@
+#pragma once
+#include <stdint.h>
+#include <netinet/in.h>
+
+uint16_t ip_fast_csum(const void *iph, unsigned int ihl);
+uint32_t csum_partial(const void *buff, int len, uint32_t wsum);
+uint16_t ip_compute_csum(const void *buff, int len);
+
+uint16_t csum_ipv6_magic(const struct in6_addr *saddr,
+ const struct in6_addr *daddr,
+ uint32_t len, uint8_t proto, uint32_t csum);
+
+uint16_t csum_fold(uint32_t csum);