xref: /PHP-7.4/ext/sockets/sockaddr_conv.h (revision bdeb220f)
1 #ifndef PHP_SOCKADR_CONV_H
2 #define PHP_SOCKADR_CONV_H
3 
4 #include <php_network.h>
5 #include "php_sockets.h" /* php_socket */
6 
7 #ifndef PHP_WIN32
8 # include <netinet/in.h>
9 #else
10 # include <Winsock2.h>
11 #endif
12 
13 
14 /*
15  * Convert an IPv6 literal or a hostname info a sockaddr_in6.
16  * The IPv6 literal can be a IPv4 mapped address (like ::ffff:127.0.0.1).
17  * If the hostname yields no IPv6 addresses, a mapped IPv4 address may be returned (AI_V4MAPPED)
18  */
19 int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_sock);
20 
21 /*
22  * Convert an IPv4 literal or a hostname into a sockaddr_in.
23  */
24 int php_set_inet_addr(struct sockaddr_in *sin, char *string, php_socket *php_sock);
25 
26 /*
27  * Calls either php_set_inet6_addr() or php_set_inet_addr(), depending on the type of the socket.
28  */
29 int php_set_inet46_addr(php_sockaddr_storage *ss, socklen_t *ss_len, char *string, php_socket *php_sock);
30 
31 #endif
32