mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Added some consts for arguments in network.c declarations. Moved
php_sockaddr_storage to php_network.h and added check for struct sockaddr_storage
This commit is contained in:
parent
350777932a
commit
6e1878b0fc
5 changed files with 22 additions and 9 deletions
|
@ -352,6 +352,15 @@ dnl Checks for types
|
|||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_UID_T
|
||||
|
||||
dnl Check for struct sockaddr_storage
|
||||
AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_sockaddr_storage,
|
||||
[AC_TRY_COMPILE([ #include <sys/types.h>
|
||||
#include <sys/socket.h>], [struct sockaddr_storage s; s],
|
||||
ac_cv_sockaddr_storage=yes, ac_cv_sockaddr_storage=no)])
|
||||
if test "$ac_cv_sockaddr_storage" = yes; then
|
||||
AC_DEFINE(HAVE_SOCKADDR_STORAGE,1,[Whether you have struct sockaddr_storage])
|
||||
fi
|
||||
|
||||
dnl Check for IPv6 support
|
||||
AC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support,
|
||||
[AC_TRY_COMPILE([ #include <sys/types.h>
|
||||
|
|
|
@ -102,11 +102,6 @@ typedef struct {
|
|||
SOCKET max_fd;
|
||||
} php_fd_set;
|
||||
|
||||
typedef struct {
|
||||
long family;
|
||||
char info[256];
|
||||
} php_sockaddr_storage;
|
||||
|
||||
typedef struct {
|
||||
zend_bool use_system_read;
|
||||
} php_sockets_globals;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#endif
|
||||
|
||||
#include "php.h"
|
||||
#include "php_network.h"
|
||||
|
||||
#if HAVE_SOCKETS
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ static int php_network_getaddresses(const char *host, struct sockaddr ***sal)
|
|||
|
||||
/* {{{ php_connect_nonb */
|
||||
PHPAPI int php_connect_nonb(int sockfd,
|
||||
struct sockaddr *addr,
|
||||
const struct sockaddr *addr,
|
||||
socklen_t addrlen,
|
||||
struct timeval *timeout)
|
||||
{
|
||||
|
@ -284,7 +284,7 @@ ok:
|
|||
* port, returns the created socket on success, else returns -1.
|
||||
* timeout gives timeout in seconds, 0 means blocking mode.
|
||||
*/
|
||||
int php_hostconnect(char *host, unsigned short port, int socktype, int timeout)
|
||||
int php_hostconnect(const char *host, unsigned short port, int socktype, int timeout)
|
||||
{
|
||||
int s;
|
||||
struct sockaddr **sal, **psal;
|
||||
|
|
|
@ -41,10 +41,18 @@
|
|||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SOCKADDR_STORAGE
|
||||
typedef struct sockaddr_storage php_sockaddr_storage;
|
||||
#else
|
||||
typedef struct {
|
||||
unsigned short ss_family;
|
||||
char info[256];
|
||||
} php_sockaddr_storage;
|
||||
#endif
|
||||
|
||||
|
||||
int php_hostconnect(char *host, unsigned short port, int socktype, int timeout);
|
||||
PHPAPI int php_connect_nonb(int sockfd, struct sockaddr *addr, socklen_t addrlen, struct timeval *timeout);
|
||||
int php_hostconnect(const char *host, unsigned short port, int socktype, int timeout);
|
||||
PHPAPI int php_connect_nonb(int sockfd, const struct sockaddr *addr, socklen_t addrlen, struct timeval *timeout);
|
||||
|
||||
#endif /* _PHP_NETWORK_H */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue