diff options
author | Manuel Bentele | 2020-09-11 11:48:48 +0200 |
---|---|---|
committer | Manuel Bentele | 2020-09-16 07:37:56 +0200 |
commit | a4215c3632c13218bb389d1f066549ab783028e3 (patch) | |
tree | 0468836ef5303f6eb94b876189ccaa60a7a2b453 /kernel/tests/include/tst_net.h | |
parent | Updated README with documentation of general information and build options (diff) | |
download | xloop-a4215c3632c13218bb389d1f066549ab783028e3.tar.gz xloop-a4215c3632c13218bb389d1f066549ab783028e3.tar.xz xloop-a4215c3632c13218bb389d1f066549ab783028e3.zip |
Added testcases from the Linux testing project (LTP)
Diffstat (limited to 'kernel/tests/include/tst_net.h')
-rw-r--r-- | kernel/tests/include/tst_net.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/kernel/tests/include/tst_net.h b/kernel/tests/include/tst_net.h new file mode 100644 index 0000000..daefdd9 --- /dev/null +++ b/kernel/tests/include/tst_net.h @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2017-2019 Petr Vorel <pvorel@suse.cz> + */ + +#ifndef TST_NET_H_ +#define TST_NET_H_ + +#include <arpa/inet.h> +#include <netdb.h> +#include <netinet/in.h> +#include <netinet/ip.h> +#include <sys/types.h> + +void tst_get_in_addr(const char *ip_str, struct in_addr *ip); +void tst_get_in6_addr(const char *ip_str, struct in6_addr *ip6); + +/* + * Find valid connection address for a given bound socket + */ +socklen_t tst_get_connect_address(int sock, struct sockaddr_storage *addr); + +/* + * Initialize AF_INET/AF_INET6 socket address structure with address and port + */ +void tst_init_sockaddr_inet(struct sockaddr_in *sa, const char *ip_str, uint16_t port); +void tst_init_sockaddr_inet_bin(struct sockaddr_in *sa, uint32_t ip_val, uint16_t port); +void tst_init_sockaddr_inet6(struct sockaddr_in6 *sa, const char *ip_str, uint16_t port); +void tst_init_sockaddr_inet6_bin(struct sockaddr_in6 *sa, const struct in6_addr *ip_val, uint16_t port); + +void safe_getaddrinfo(const char *file, const int lineno, const char *src_addr, + const char *port, const struct addrinfo *hints, + struct addrinfo **addr_info); + +#endif /* TST_NET_H_ */ |