2000-07-03 04:35:57 +00:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| PHP version 4.0 |
|
|
|
|
+----------------------------------------------------------------------+
|
2001-02-26 06:11:02 +00:00
|
|
|
| Copyright (c) 1997-2001 The PHP Group |
|
2000-07-03 04:35:57 +00:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| This source file is subject to version 2.02 of the PHP license, |
|
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
|
|
|
| available at through the world-wide-web at |
|
|
|
|
| http://www.php.net/license/2_02.txt. |
|
|
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@php.net so we can mail you a copy immediately. |
|
|
|
|
+----------------------------------------------------------------------+
|
2000-08-20 10:31:27 +00:00
|
|
|
| Authors: Chris Vandomelen <chrisv@b0rked.dhs.org> |
|
2001-05-17 17:02:37 +00:00
|
|
|
| Sterling Hughes <sterling@php.net> |
|
|
|
|
| |
|
|
|
|
| WinSock: Daniel Beulshausen <daniel@php4win.de> |
|
2000-07-03 04:35:57 +00:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
2000-07-03 06:45:07 +00:00
|
|
|
#ifndef PHP_SOCKETS_H
|
|
|
|
#define PHP_SOCKETS_H
|
2000-07-03 04:35:57 +00:00
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
#if HAVE_SOCKETS
|
|
|
|
|
|
|
|
extern zend_module_entry sockets_module_entry;
|
|
|
|
#define phpext_sockets_ptr &sockets_module_entry
|
|
|
|
|
|
|
|
#ifdef PHP_WIN32
|
|
|
|
#define PHP_SOCKETS_API __declspec(dllexport)
|
|
|
|
#else
|
|
|
|
#define PHP_SOCKETS_API
|
|
|
|
#endif
|
|
|
|
|
|
|
|
PHP_MINIT_FUNCTION(sockets);
|
|
|
|
PHP_MINFO_FUNCTION(sockets);
|
|
|
|
|
2001-05-17 17:02:37 +00:00
|
|
|
PHP_FUNCTION(socket_fd_alloc);
|
|
|
|
PHP_FUNCTION(socket_fd_free);
|
|
|
|
PHP_FUNCTION(socket_fd_set);
|
|
|
|
PHP_FUNCTION(socket_fd_isset);
|
|
|
|
PHP_FUNCTION(socket_fd_clear);
|
|
|
|
PHP_FUNCTION(socket_fd_zero);
|
|
|
|
PHP_FUNCTION(socket_iovec_alloc);
|
|
|
|
PHP_FUNCTION(socket_iovec_free);
|
|
|
|
PHP_FUNCTION(socket_iovec_set);
|
|
|
|
PHP_FUNCTION(socket_iovec_fetch);
|
|
|
|
PHP_FUNCTION(socket_iovec_add);
|
|
|
|
PHP_FUNCTION(socket_iovec_delete);
|
|
|
|
PHP_FUNCTION(socket_select);
|
|
|
|
PHP_FUNCTION(socket_create_listen);
|
|
|
|
PHP_FUNCTION(socket_create_pair);
|
|
|
|
PHP_FUNCTION(socket_accept);
|
|
|
|
PHP_FUNCTION(socket_set_nonblock);
|
|
|
|
PHP_FUNCTION(socket_listen);
|
|
|
|
PHP_FUNCTION(socket_close);
|
|
|
|
PHP_FUNCTION(socket_write);
|
|
|
|
PHP_FUNCTION(socket_read);
|
|
|
|
PHP_FUNCTION(socket_getsockname);
|
|
|
|
PHP_FUNCTION(socket_getpeername);
|
|
|
|
PHP_FUNCTION(socket_create);
|
|
|
|
PHP_FUNCTION(socket_connect);
|
|
|
|
PHP_FUNCTION(socket_strerror);
|
|
|
|
PHP_FUNCTION(socket_bind);
|
|
|
|
PHP_FUNCTION(socket_recv);
|
|
|
|
PHP_FUNCTION(socket_send);
|
|
|
|
PHP_FUNCTION(socket_recvfrom);
|
|
|
|
PHP_FUNCTION(socket_sendto);
|
|
|
|
PHP_FUNCTION(socket_recvmsg);
|
|
|
|
PHP_FUNCTION(socket_sendmsg);
|
|
|
|
PHP_FUNCTION(socket_readv);
|
|
|
|
PHP_FUNCTION(socket_writev);
|
|
|
|
PHP_FUNCTION(socket_getopt);
|
|
|
|
PHP_FUNCTION(socket_setopt);
|
|
|
|
PHP_FUNCTION(socket_shutdown);
|
2000-08-20 10:31:27 +00:00
|
|
|
|
|
|
|
typedef struct php_iovec {
|
2001-07-25 22:03:55 +00:00
|
|
|
struct iovec *iov_array;
|
|
|
|
unsigned int count;
|
2000-08-20 10:31:27 +00:00
|
|
|
} php_iovec_t;
|
2000-07-03 04:35:57 +00:00
|
|
|
|
2001-07-25 22:03:55 +00:00
|
|
|
#ifndef PHP_WIN32
|
|
|
|
typedef int SOCKET;
|
2001-05-17 17:02:37 +00:00
|
|
|
#endif
|
2001-07-25 22:03:55 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
SOCKET socket;
|
|
|
|
int type;
|
2001-05-17 17:02:37 +00:00
|
|
|
} php_socket;
|
|
|
|
|
2000-07-03 04:35:57 +00:00
|
|
|
typedef struct {
|
2001-07-25 22:03:55 +00:00
|
|
|
fd_set set;
|
|
|
|
SOCKET max_fd;
|
|
|
|
} php_fd_set;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
unsigned char info[256];
|
|
|
|
} php_sockaddr_storage;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
zend_bool use_system_read;
|
2000-07-03 04:35:57 +00:00
|
|
|
} php_sockets_globals;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ZTS
|
|
|
|
#define SOCKETSG(v) (sockets_globals->v)
|
2000-09-07 12:32:47 +00:00
|
|
|
#define SOCKETSLS_FETCH() php_sockets_globals *sockets_globals = ts_resource(sockets_globals_id)
|
2000-07-03 04:35:57 +00:00
|
|
|
#else
|
|
|
|
#define SOCKETSG(v) (sockets_globals.v)
|
|
|
|
#define SOCKETSLS_FETCH()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#else
|
|
|
|
#define phpext_sockets_ptr NULL
|
|
|
|
#endif
|
|
|
|
|
2001-05-17 17:02:37 +00:00
|
|
|
#endif
|
2000-07-03 04:35:57 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* End:
|
2001-05-21 19:36:22 +00:00
|
|
|
*/
|
|
|
|
|