Annotation of embedaddon/php/ext/sockets/php_sockets.h, revision 1.1.1.2
1.1 misho 1: /*
2: +----------------------------------------------------------------------+
3: | PHP Version 5 |
4: +----------------------------------------------------------------------+
5: | Copyright (c) 1997-2012 The PHP Group |
6: +----------------------------------------------------------------------+
7: | This source file is subject to version 3.01 of the PHP license, |
8: | that is bundled with this package in the file LICENSE, and is |
9: | available through the world-wide-web at the following url: |
10: | http://www.php.net/license/3_01.txt |
11: | If you did not receive a copy of the PHP license and are unable to |
12: | obtain it through the world-wide-web, please send a note to |
13: | license@php.net so we can mail you a copy immediately. |
14: +----------------------------------------------------------------------+
15: | Authors: Chris Vandomelen <chrisv@b0rked.dhs.org> |
16: | Sterling Hughes <sterling@php.net> |
17: | |
18: | WinSock: Daniel Beulshausen <daniel@php4win.de> |
19: +----------------------------------------------------------------------+
20: */
21:
22: #ifndef PHP_SOCKETS_H
23: #define PHP_SOCKETS_H
24:
1.1.1.2 ! misho 25: /* $Id$ */
1.1 misho 26:
27: #if HAVE_SOCKETS
28:
29: extern zend_module_entry sockets_module_entry;
30: #define phpext_sockets_ptr &sockets_module_entry
31:
32: #ifdef PHP_WIN32
33: #include <winsock.h>
34: #else
35: #if HAVE_SYS_SOCKET_H
36: #include <sys/socket.h>
37: #endif
38: #endif
39:
40: PHP_MINIT_FUNCTION(sockets);
41: PHP_MINFO_FUNCTION(sockets);
42: PHP_RSHUTDOWN_FUNCTION(sockets);
43:
44: PHP_FUNCTION(socket_select);
45: PHP_FUNCTION(socket_create_listen);
46: #ifdef HAVE_SOCKETPAIR
47: PHP_FUNCTION(socket_create_pair);
48: #endif
49: PHP_FUNCTION(socket_accept);
50: PHP_FUNCTION(socket_set_nonblock);
51: PHP_FUNCTION(socket_set_block);
52: PHP_FUNCTION(socket_listen);
53: PHP_FUNCTION(socket_close);
54: PHP_FUNCTION(socket_write);
55: PHP_FUNCTION(socket_read);
56: PHP_FUNCTION(socket_getsockname);
57: PHP_FUNCTION(socket_getpeername);
58: PHP_FUNCTION(socket_create);
59: PHP_FUNCTION(socket_connect);
60: PHP_FUNCTION(socket_strerror);
61: PHP_FUNCTION(socket_bind);
62: PHP_FUNCTION(socket_recv);
63: PHP_FUNCTION(socket_send);
64: PHP_FUNCTION(socket_recvfrom);
65: PHP_FUNCTION(socket_sendto);
66: PHP_FUNCTION(socket_get_option);
67: PHP_FUNCTION(socket_set_option);
68: #ifdef HAVE_SHUTDOWN
69: PHP_FUNCTION(socket_shutdown);
70: #endif
71: PHP_FUNCTION(socket_last_error);
72: PHP_FUNCTION(socket_clear_error);
1.1.1.2 ! misho 73: PHP_FUNCTION(socket_import_stream);
1.1 misho 74:
75: #ifndef PHP_WIN32
76: typedef int PHP_SOCKET;
77: # define PHP_SOCKETS_API PHPAPI
78: #else
79: # define PHP_SOCKETS_API __declspec(dllexport)
80: typedef SOCKET PHP_SOCKET;
81: #endif
82:
83: typedef struct {
1.1.1.2 ! misho 84: PHP_SOCKET bsd_socket;
! 85: int type;
! 86: int error;
! 87: int blocking;
! 88: zval *zstream;
1.1 misho 89: } php_socket;
90:
91: #ifdef PHP_WIN32
92: struct sockaddr_un {
93: short sun_family;
94: char sun_path[108];
95: };
96: #endif
97:
98: PHP_SOCKETS_API int php_sockets_le_socket(void);
99:
100: #define php_sockets_le_socket_name "Socket"
101:
102: /* Prototypes */
103: #ifdef ilia_0 /* not needed, only causes a compiler warning */
104: static int php_open_listen_sock(php_socket **php_sock, int port, int backlog TSRMLS_DC);
105: static int php_accept_connect(php_socket *in_sock, php_socket **new_sock, struct sockaddr *la TSRMLS_DC);
106: static int php_read(php_socket *sock, void *buf, size_t maxlen, int flags);
107: static char *php_strerror(int error TSRMLS_DC);
108: #endif
109:
110: ZEND_BEGIN_MODULE_GLOBALS(sockets)
111: int last_error;
112: char *strerror_buf;
113: ZEND_END_MODULE_GLOBALS(sockets)
114:
115: #ifdef ZTS
116: #define SOCKETS_G(v) TSRMG(sockets_globals_id, zend_sockets_globals *, v)
117: #else
118: #define SOCKETS_G(v) (sockets_globals.v)
119: #endif
120:
121: #else
122: #define phpext_sockets_ptr NULL
123: #endif
124:
125: #endif
126:
127: /*
128: * Local variables:
129: * tab-width: 4
130: * c-basic-offset: 4
131: * End:
132: */
133:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>