summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/socket_test_util.h
diff options
context:
space:
mode:
authorIan Gudger <igudger@google.com>2019-02-08 18:22:31 -0800
committerShentubot <shentubot@google.com>2019-02-08 18:23:38 -0800
commit85d53d81d9f544277e3e86f83558cbc008ff7adb (patch)
tree17253850e3288c6e99f49ad6d2da1aba9df59582 /test/syscalls/linux/socket_test_util.h
parentf17692d8074787d058dc33cc95587b15dba3b161 (diff)
Use socket address functions in unbound IPv4 UDP tests.
Also switch to the correct casing style for local address variables. PiperOrigin-RevId: 233161128 Change-Id: Ibc4a10a5d3ab04c40907aa885e8237b255c65a79
Diffstat (limited to 'test/syscalls/linux/socket_test_util.h')
-rw-r--r--test/syscalls/linux/socket_test_util.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/syscalls/linux/socket_test_util.h b/test/syscalls/linux/socket_test_util.h
index 826374dc6..906b3e929 100644
--- a/test/syscalls/linux/socket_test_util.h
+++ b/test/syscalls/linux/socket_test_util.h
@@ -449,6 +449,23 @@ void RecvNoData(int sock);
// sockets.
using AllSocketPairTest = SocketPairTest;
+struct TestAddress {
+ std::string description;
+ sockaddr_storage addr;
+ socklen_t addr_len;
+
+ int family() const { return addr.ss_family; }
+ explicit TestAddress(std::string description = "")
+ : description(std::move(description)), addr(), addr_len() {}
+};
+
+TestAddress V4Any();
+TestAddress V4Loopback();
+TestAddress V4MappedAny();
+TestAddress V4MappedLoopback();
+TestAddress V6Any();
+TestAddress V6Loopback();
+
} // namespace testing
} // namespace gvisor