summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/socket_test_util.h
diff options
context:
space:
mode:
authorKevin Krakauer <krakauer@google.com>2019-08-15 16:30:25 -0700
committergVisor bot <gvisor-bot@google.com>2019-08-15 16:31:35 -0700
commitef045b914bc8d9795f9184aed4b13351be70a3cf (patch)
tree6a6cfa039c5f7de68ad8e04910483b7c4b1833d6 /test/syscalls/linux/socket_test_util.h
parent6cfc76798b586a6c33c1ec311cb5f0d82b90ca72 (diff)
Add tests for "cooked" AF_PACKET sockets.
PiperOrigin-RevId: 263666789
Diffstat (limited to 'test/syscalls/linux/socket_test_util.h')
-rw-r--r--test/syscalls/linux/socket_test_util.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/syscalls/linux/socket_test_util.h b/test/syscalls/linux/socket_test_util.h
index 4fd59767a..ae0da2679 100644
--- a/test/syscalls/linux/socket_test_util.h
+++ b/test/syscalls/linux/socket_test_util.h
@@ -17,9 +17,12 @@
#include <errno.h>
#include <netinet/ip.h>
+#include <netinet/ip_icmp.h>
+#include <netinet/udp.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
+
#include <functional>
#include <memory>
#include <string>
@@ -478,6 +481,17 @@ TestAddress V4MappedLoopback();
TestAddress V6Any();
TestAddress V6Loopback();
+// Compute the internet checksum of an IP header.
+uint16_t IPChecksum(struct iphdr ip);
+
+// Compute the internet checksum of a UDP header.
+uint16_t UDPChecksum(struct iphdr iphdr, struct udphdr udphdr,
+ const char* payload, ssize_t payload_len);
+
+// Compute the internet checksum of an ICMP header.
+uint16_t ICMPChecksum(struct icmphdr icmphdr, const char* payload,
+ ssize_t payload_len);
+
} // namespace testing
} // namespace gvisor