aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-02 10:22:43 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-02 10:22:43 +0000
commitb34e3da4e96d110290706f55ec44c97e796d65cd (patch)
treeb87db9a2700de6dbcccc2728df674802b8eb626d /src
parentd583ad46d4babd962f362deac20fa5aa6cdce7c7 (diff)
downloadgnunet-b34e3da4e96d110290706f55ec44c97e796d65cd.tar.gz
gnunet-b34e3da4e96d110290706f55ec44c97e796d65cd.zip
-vpn should use crc16 from util
Diffstat (limited to 'src')
-rw-r--r--src/vpn/Makefile.am6
-rw-r--r--src/vpn/gnunet-daemon-exit.c36
-rw-r--r--src/vpn/gnunet-daemon-vpn.c54
-rw-r--r--src/vpn/gnunet-vpn-checksum.c57
-rw-r--r--src/vpn/gnunet-vpn-checksum.h37
5 files changed, 47 insertions, 143 deletions
diff --git a/src/vpn/Makefile.am b/src/vpn/Makefile.am
index bdfca7f2f..38b37dd65 100644
--- a/src/vpn/Makefile.am
+++ b/src/vpn/Makefile.am
@@ -33,8 +33,7 @@ gnunet_helper_vpn_SOURCES = \
33 gnunet-helper-vpn.c 33 gnunet-helper-vpn.c
34 34
35gnunet_daemon_vpn_SOURCES = \ 35gnunet_daemon_vpn_SOURCES = \
36 gnunet-daemon-vpn.c gnunet-daemon-vpn.h \ 36 gnunet-daemon-vpn.c gnunet-daemon-vpn.h
37 gnunet-vpn-checksum.c gnunet-vpn-checksum.h
38gnunet_daemon_vpn_LDADD = \ 37gnunet_daemon_vpn_LDADD = \
39 $(top_builddir)/src/core/libgnunetcore.la \ 38 $(top_builddir)/src/core/libgnunetcore.la \
40 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 39 $(top_builddir)/src/statistics/libgnunetstatistics.la \
@@ -45,8 +44,7 @@ gnunet_daemon_vpn_LDADD = \
45 $(GN_LIBINTL) 44 $(GN_LIBINTL)
46 45
47gnunet_daemon_exit_SOURCES = \ 46gnunet_daemon_exit_SOURCES = \
48 gnunet-daemon-exit.c \ 47 gnunet-daemon-exit.c
49 gnunet-vpn-checksum.c gnunet-vpn-checksum.h
50gnunet_daemon_exit_LDADD = \ 48gnunet_daemon_exit_LDADD = \
51 $(top_builddir)/src/core/libgnunetcore.la \ 49 $(top_builddir)/src/core/libgnunetcore.la \
52 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 50 $(top_builddir)/src/statistics/libgnunetstatistics.la \
diff --git a/src/vpn/gnunet-daemon-exit.c b/src/vpn/gnunet-daemon-exit.c
index ebe3ec61a..608646202 100644
--- a/src/vpn/gnunet-daemon-exit.c
+++ b/src/vpn/gnunet-daemon-exit.c
@@ -835,8 +835,8 @@ prepare_ipv4_packet (size_t len, uint16_t pktlen, void *payload,
835 pkt4_tcp->tcp_hdr.crc = 0; 835 pkt4_tcp->tcp_hdr.crc = 0;
836 uint32_t sum = 0; 836 uint32_t sum = 0;
837 837
838 sum = calculate_checksum_update (sum, (uint16_t *) &pkt4->ip_hdr.sadr, sizeof (struct in_addr)); 838 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) &pkt4->ip_hdr.sadr, sizeof (struct in_addr));
839 sum = calculate_checksum_update (sum, (uint16_t *) &pkt4->ip_hdr.dadr, sizeof (struct in_addr)); 839 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) &pkt4->ip_hdr.dadr, sizeof (struct in_addr));
840 840
841 tmp = (protocol << 16) | (0xffff & pktlen); 841 tmp = (protocol << 16) | (0xffff & pktlen);
842 842
@@ -845,16 +845,16 @@ prepare_ipv4_packet (size_t len, uint16_t pktlen, void *payload,
845 845
846 tmp = htonl (tmp); 846 tmp = htonl (tmp);
847 847
848 sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4); 848 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & tmp, 4);
849 849
850 sum = 850 sum =
851 calculate_checksum_update (sum, (uint16_t *) & pkt4_tcp->tcp_hdr, 851 GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & pkt4_tcp->tcp_hdr,
852 pktlen); 852 pktlen);
853 pkt4_tcp->tcp_hdr.crc = calculate_checksum_end (sum); 853 pkt4_tcp->tcp_hdr.crc = GNUNET_CRYPTO_crc16_finish (sum);
854 } 854 }
855 855
856 pkt4->ip_hdr.chks = 856 pkt4->ip_hdr.chks =
857 calculate_ip_checksum ((uint16_t *) & pkt4->ip_hdr, 5 * 4); 857 GNUNET_CRYPTO_crc16_n ((uint16_t *) & pkt4->ip_hdr, 5 * 4);
858} 858}
859 859
860static void 860static void
@@ -919,20 +919,20 @@ prepare_ipv6_packet (size_t len, uint16_t pktlen, void *payload,
919 uint32_t sum = 0; 919 uint32_t sum = 0;
920 920
921 sum = 921 sum =
922 calculate_checksum_update (sum, (uint16_t *) & pkt6_udp->ip6_hdr.sadr, 922 GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & pkt6_udp->ip6_hdr.sadr,
923 16); 923 16);
924 sum = 924 sum =
925 calculate_checksum_update (sum, (uint16_t *) & pkt6_udp->ip6_hdr.dadr, 925 GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & pkt6_udp->ip6_hdr.dadr,
926 16); 926 16);
927 tmp = (htons (pktlen) & 0xffff); 927 tmp = (htons (pktlen) & 0xffff);
928 sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4); 928 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & tmp, 4);
929 tmp = htons (((pkt6_udp->ip6_hdr.nxthdr & 0x00ff))); 929 tmp = htons (((pkt6_udp->ip6_hdr.nxthdr & 0x00ff)));
930 sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4); 930 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & tmp, 4);
931 931
932 sum = 932 sum =
933 calculate_checksum_update (sum, (uint16_t *) & pkt6_udp->udp_hdr, 933 GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & pkt6_udp->udp_hdr,
934 ntohs (pkt6_udp->udp_hdr.len)); 934 ntohs (pkt6_udp->udp_hdr.len));
935 pkt6_udp->udp_hdr.crc = calculate_checksum_end (sum); 935 pkt6_udp->udp_hdr.crc = GNUNET_CRYPTO_crc16_finish (sum);
936 } 936 }
937 else if (IPPROTO_TCP == protocol) 937 else if (IPPROTO_TCP == protocol)
938 { 938 {
@@ -944,18 +944,18 @@ prepare_ipv6_packet (size_t len, uint16_t pktlen, void *payload,
944 uint32_t sum = 0; 944 uint32_t sum = 0;
945 945
946 sum = 946 sum =
947 calculate_checksum_update (sum, (uint16_t *) & pkt6->ip6_hdr.sadr, 16); 947 GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & pkt6->ip6_hdr.sadr, 16);
948 sum = 948 sum =
949 calculate_checksum_update (sum, (uint16_t *) & pkt6->ip6_hdr.dadr, 16); 949 GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & pkt6->ip6_hdr.dadr, 16);
950 tmp = htonl (pktlen); 950 tmp = htonl (pktlen);
951 sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4); 951 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & tmp, 4);
952 tmp = htonl (((pkt6->ip6_hdr.nxthdr & 0x000000ff))); 952 tmp = htonl (((pkt6->ip6_hdr.nxthdr & 0x000000ff)));
953 sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4); 953 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & tmp, 4);
954 954
955 sum = 955 sum =
956 calculate_checksum_update (sum, (uint16_t *) & pkt6_tcp->tcp_hdr, 956 GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & pkt6_tcp->tcp_hdr,
957 ntohs (pkt6->ip6_hdr.paylgth)); 957 ntohs (pkt6->ip6_hdr.paylgth));
958 pkt6_tcp->tcp_hdr.crc = calculate_checksum_end (sum); 958 pkt6_tcp->tcp_hdr.crc = GNUNET_CRYPTO_crc16_finish (sum);
959 } 959 }
960} 960}
961 961
diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c
index 35db8af7b..ad6ed5044 100644
--- a/src/vpn/gnunet-daemon-vpn.c
+++ b/src/vpn/gnunet-daemon-vpn.c
@@ -299,18 +299,18 @@ helper_write (void *cls GNUNET_UNUSED,
299 pkt->udp_dns.udp_hdr.crc = 0; 299 pkt->udp_dns.udp_hdr.crc = 0;
300 uint32_t sum = 0; 300 uint32_t sum = 0;
301 301
302 sum = calculate_checksum_update (sum, (uint16_t *) & pkt->ip6_hdr.sadr, 16); 302 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & pkt->ip6_hdr.sadr, 16);
303 sum = calculate_checksum_update (sum, (uint16_t *) & pkt->ip6_hdr.dadr, 16); 303 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & pkt->ip6_hdr.dadr, 16);
304 uint32_t tmp = (pkt->udp_dns.udp_hdr.len & 0xffff); 304 uint32_t tmp = (pkt->udp_dns.udp_hdr.len & 0xffff);
305 305
306 sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4); 306 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & tmp, 4);
307 tmp = htons (((pkt->ip6_hdr.nxthdr & 0x00ff))); 307 tmp = htons (((pkt->ip6_hdr.nxthdr & 0x00ff)));
308 sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4); 308 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & tmp, 4);
309 309
310 sum = 310 sum =
311 calculate_checksum_update (sum, (uint16_t *) & pkt->udp_dns.udp_hdr, 311 GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & pkt->udp_dns.udp_hdr,
312 ntohs (net_len - sizeof (struct ip6_hdr))); 312 ntohs (net_len - sizeof (struct ip6_hdr)));
313 pkt->udp_dns.udp_hdr.crc = calculate_checksum_end (sum); 313 pkt->udp_dns.udp_hdr.crc = GNUNET_CRYPTO_crc16_finish (sum);
314 314
315 pkt->ip6_hdr.version = 6; 315 pkt->ip6_hdr.version = 6;
316 pkt->ip6_hdr.paylgth = net_len - sizeof (struct ip6_hdr); 316 pkt->ip6_hdr.paylgth = net_len - sizeof (struct ip6_hdr);
@@ -360,7 +360,7 @@ helper_write (void *cls GNUNET_UNUSED,
360 memcpy (&pkt->ip_hdr.dadr, ans->pkt.to, 4); 360 memcpy (&pkt->ip_hdr.dadr, ans->pkt.to, 4);
361 361
362 pkt->ip_hdr.chks = 362 pkt->ip_hdr.chks =
363 calculate_ip_checksum ((uint16_t *) & pkt->ip_hdr, 5 * 4); 363 GNUNET_CRYPTO_crc16_n ((uint16_t *) & pkt->ip_hdr, 5 * 4);
364 364
365 /* set the udp-header */ 365 /* set the udp-header */
366 pkt->udp_dns.udp_hdr.spt = htons (53); 366 pkt->udp_dns.udp_hdr.spt = htons (53);
@@ -805,7 +805,7 @@ send_icmp4_response (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
805 response->ip_hdr.tot_lngth = request->ip_hdr.tot_lngth; 805 response->ip_hdr.tot_lngth = request->ip_hdr.tot_lngth;
806 806
807 response->ip_hdr.chks = 807 response->ip_hdr.chks =
808 calculate_ip_checksum ((uint16_t *) & response->ip_hdr, 20); 808 GNUNET_CRYPTO_crc16_n ((uint16_t *) & response->ip_hdr, 20);
809 809
810 response->icmp_hdr.code = 0; 810 response->icmp_hdr.code = 0;
811 response->icmp_hdr.type = 0x0; 811 response->icmp_hdr.type = 0x0;
@@ -1475,19 +1475,19 @@ receive_udp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1475 uint32_t sum = 0; 1475 uint32_t sum = 0;
1476 1476
1477 sum = 1477 sum =
1478 calculate_checksum_update (sum, (uint16_t *) & pkt6->ip6_hdr.sadr, 16); 1478 GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & pkt6->ip6_hdr.sadr, 16);
1479 sum = 1479 sum =
1480 calculate_checksum_update (sum, (uint16_t *) & pkt6->ip6_hdr.dadr, 16); 1480 GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & pkt6->ip6_hdr.dadr, 16);
1481 uint32_t tmp = (pkt6->udp_hdr.len & 0xffff); 1481 uint32_t tmp = (pkt6->udp_hdr.len & 0xffff);
1482 1482
1483 sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4); 1483 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & tmp, 4);
1484 tmp = htons (((pkt6->ip6_hdr.nxthdr & 0x00ff))); 1484 tmp = htons (((pkt6->ip6_hdr.nxthdr & 0x00ff)));
1485 sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4); 1485 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & tmp, 4);
1486 1486
1487 sum = 1487 sum =
1488 calculate_checksum_update (sum, (uint16_t *) & pkt6->udp_hdr, 1488 GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & pkt6->udp_hdr,
1489 ntohs (pkt->len)); 1489 ntohs (pkt->len));
1490 pkt6->udp_hdr.crc = calculate_checksum_end (sum); 1490 pkt6->udp_hdr.crc = GNUNET_CRYPTO_crc16_finish (sum);
1491 1491
1492 (void) GNUNET_HELPER_send (helper_handle, 1492 (void) GNUNET_HELPER_send (helper_handle,
1493 &pkt6->shdr, 1493 &pkt6->shdr,
@@ -1561,7 +1561,7 @@ receive_udp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1561 pkt4->udp_hdr.crc = 0; /* Optional for IPv4 */ 1561 pkt4->udp_hdr.crc = 0; /* Optional for IPv4 */
1562 1562
1563 pkt4->ip_hdr.chks = 1563 pkt4->ip_hdr.chks =
1564 calculate_ip_checksum ((uint16_t *) & pkt4->ip_hdr, 5 * 4); 1564 GNUNET_CRYPTO_crc16_n ((uint16_t *) & pkt4->ip_hdr, 5 * 4);
1565 1565
1566 (void) GNUNET_HELPER_send (helper_handle, 1566 (void) GNUNET_HELPER_send (helper_handle,
1567 &pkt4->shdr, 1567 &pkt4->shdr,
@@ -1655,18 +1655,18 @@ receive_tcp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1655 uint32_t tmp; 1655 uint32_t tmp;
1656 1656
1657 sum = 1657 sum =
1658 calculate_checksum_update (sum, (uint16_t *) & pkt6->ip6_hdr.sadr, 16); 1658 GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & pkt6->ip6_hdr.sadr, 16);
1659 sum = 1659 sum =
1660 calculate_checksum_update (sum, (uint16_t *) & pkt6->ip6_hdr.dadr, 16); 1660 GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & pkt6->ip6_hdr.dadr, 16);
1661 tmp = htonl (pktlen); 1661 tmp = htonl (pktlen);
1662 sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4); 1662 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & tmp, 4);
1663 tmp = htonl (((pkt6->ip6_hdr.nxthdr & 0x000000ff))); 1663 tmp = htonl (((pkt6->ip6_hdr.nxthdr & 0x000000ff)));
1664 sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4); 1664 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & tmp, 4);
1665 1665
1666 sum = 1666 sum =
1667 calculate_checksum_update (sum, (uint16_t *) & pkt6->tcp_hdr, 1667 GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & pkt6->tcp_hdr,
1668 ntohs (pkt6->ip6_hdr.paylgth)); 1668 ntohs (pkt6->ip6_hdr.paylgth));
1669 pkt6->tcp_hdr.crc = calculate_checksum_end (sum); 1669 pkt6->tcp_hdr.crc = GNUNET_CRYPTO_crc16_finish (sum);
1670 1670
1671 (void) GNUNET_HELPER_send (helper_handle, 1671 (void) GNUNET_HELPER_send (helper_handle,
1672 &pkt6->shdr, 1672 &pkt6->shdr,
@@ -1737,20 +1737,20 @@ receive_tcp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
1737 uint32_t sum = 0; 1737 uint32_t sum = 0;
1738 uint32_t tmp; 1738 uint32_t tmp;
1739 1739
1740 sum = calculate_checksum_update (sum, (uint16_t *) &pkt4->ip_hdr.sadr, 4); 1740 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) &pkt4->ip_hdr.sadr, 4);
1741 sum = calculate_checksum_update (sum, (uint16_t *) &pkt4->ip_hdr.dadr, 4); 1741 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) &pkt4->ip_hdr.dadr, 4);
1742 1742
1743 tmp = (0x06 << 16) | (0xffff & pktlen); // 0x06 for TCP? 1743 tmp = (0x06 << 16) | (0xffff & pktlen); // 0x06 for TCP?
1744 1744
1745 tmp = htonl (tmp); 1745 tmp = htonl (tmp);
1746 1746
1747 sum = calculate_checksum_update (sum, (uint16_t *) & tmp, 4); 1747 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & tmp, 4);
1748 1748
1749 sum = calculate_checksum_update (sum, (uint16_t *) & pkt4->tcp_hdr, pktlen); 1749 sum = GNUNET_CRYPTO_crc16_step (sum, (uint16_t *) & pkt4->tcp_hdr, pktlen);
1750 pkt4->tcp_hdr.crc = calculate_checksum_end (sum); 1750 pkt4->tcp_hdr.crc = GNUNET_CRYPTO_crc16_finish (sum);
1751 1751
1752 pkt4->ip_hdr.chks = 1752 pkt4->ip_hdr.chks =
1753 calculate_ip_checksum ((uint16_t *) & pkt4->ip_hdr, 5 * 4); 1753 GNUNET_CRYPTO_crc16_n ((uint16_t *) & pkt4->ip_hdr, 5 * 4);
1754 1754
1755 (void) GNUNET_HELPER_send (helper_handle, 1755 (void) GNUNET_HELPER_send (helper_handle,
1756 &pkt4->shdr, 1756 &pkt4->shdr,
diff --git a/src/vpn/gnunet-vpn-checksum.c b/src/vpn/gnunet-vpn-checksum.c
deleted file mode 100644
index 0e0e24cdc..000000000
--- a/src/vpn/gnunet-vpn-checksum.c
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 This file is part of GNUnet.
3 (C) 2010 Christian Grothoff
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file vpn/gnunet-vpn-checksum.c
23 * @brief
24 * @author Philipp Toelke
25 */
26
27#include "gnunet-vpn-checksum.h"
28
29uint32_t
30calculate_checksum_update (uint32_t sum, uint16_t * hdr, short len)
31{
32 for (; len >= 2; len -= 2)
33 sum += *(hdr++);
34 if (len == 1)
35 sum += *((unsigned char *) hdr);
36 return sum;
37}
38
39uint16_t
40calculate_checksum_end (uint32_t sum)
41{
42 while (sum >> 16)
43 sum = (sum >> 16) + (sum & 0xFFFF);
44
45 return ~sum;
46}
47
48/**
49 * Calculate the checksum of an IPv4-Header
50 */
51uint16_t
52calculate_ip_checksum (uint16_t * hdr, short len)
53{
54 uint32_t sum = calculate_checksum_update (0, hdr, len);
55
56 return calculate_checksum_end (sum);
57}
diff --git a/src/vpn/gnunet-vpn-checksum.h b/src/vpn/gnunet-vpn-checksum.h
deleted file mode 100644
index 51f044380..000000000
--- a/src/vpn/gnunet-vpn-checksum.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 This file is part of GNUnet.
3 (C) 2010 Christian Grothoff
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20#ifndef GNUNET_VPN_CHECKSUM_H
21#define GNUNET_VPN_CHECKSUM_H
22
23#include <platform.h>
24
25uint32_t
26calculate_checksum_update (uint32_t sum, uint16_t * hdr, short len);
27
28uint16_t
29calculate_checksum_end (uint32_t sum);
30
31/**
32 * Calculate the checksum of an IPv4-Header
33 */
34uint16_t
35calculate_ip_checksum (uint16_t * hdr, short len);
36
37#endif /* end of include guard: GNUNET-VPN-CHECKSUM_H */