1999-04-17 00:37:12 +00:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
2000-07-24 01:40:02 +00:00
|
|
|
| PHP version 4.0 |
|
1999-04-17 00:37:12 +00:00
|
|
|
+----------------------------------------------------------------------+
|
2001-02-26 06:11:02 +00:00
|
|
|
| Copyright (c) 1997-2001 The PHP Group |
|
1999-04-17 00:37:12 +00:00
|
|
|
+----------------------------------------------------------------------+
|
2000-07-24 01:40:02 +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. |
|
1999-04-17 00:37:12 +00:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Authors: Paul Panotzki - Bunyip Information Systems |
|
|
|
|
| Jim Winstead (jimw@php.net) |
|
2001-05-05 18:36:22 +00:00
|
|
|
| Wez Furlong |
|
1999-04-17 00:37:12 +00:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
2000-07-24 01:40:02 +00:00
|
|
|
|
1999-04-17 00:37:12 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
1999-12-18 04:01:20 +00:00
|
|
|
/* Synced with php 3.0 revision 1.24 1999-06-18 [ssb] */
|
1999-06-18 13:42:21 +00:00
|
|
|
|
2000-07-02 23:46:51 +00:00
|
|
|
#ifndef FSOCK_H
|
|
|
|
#define FSOCK_H
|
1999-04-17 00:37:12 +00:00
|
|
|
|
2001-01-13 13:59:22 +00:00
|
|
|
#include "file.h"
|
|
|
|
|
|
|
|
#define PHP_FSOCK_CHUNK_SIZE 8192
|
|
|
|
|
2001-05-06 09:39:11 +00:00
|
|
|
#include "php_network.h"
|
|
|
|
|
2001-04-17 17:06:06 +00:00
|
|
|
#if HAVE_PHP_STREAM
|
|
|
|
extern php_stream_ops php_stream_socket_ops;
|
|
|
|
#endif
|
|
|
|
|
2001-05-05 18:36:22 +00:00
|
|
|
/* stream->abstract points to an instance of this */
|
2000-02-01 20:02:44 +00:00
|
|
|
struct php_sockbuf {
|
|
|
|
int socket;
|
|
|
|
unsigned char *readbuf;
|
|
|
|
size_t readbuflen;
|
|
|
|
size_t readpos;
|
|
|
|
size_t writepos;
|
|
|
|
struct php_sockbuf *next;
|
|
|
|
struct php_sockbuf *prev;
|
|
|
|
char eof;
|
|
|
|
char persistent;
|
|
|
|
char is_blocked;
|
|
|
|
size_t chunk_size;
|
|
|
|
struct timeval timeout;
|
|
|
|
char timeout_event;
|
2001-05-05 18:36:22 +00:00
|
|
|
#if HAVE_PHP_STREAM
|
|
|
|
php_stream * stream;
|
|
|
|
#endif
|
2000-02-01 20:02:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct php_sockbuf php_sockbuf;
|
|
|
|
|
1999-05-16 11:19:26 +00:00
|
|
|
PHP_FUNCTION(fsockopen);
|
|
|
|
PHP_FUNCTION(pfsockopen);
|
2000-02-01 20:02:44 +00:00
|
|
|
|
2001-02-20 20:52:53 +00:00
|
|
|
PHPAPI int php_lookup_hostname(const char *addr, struct in_addr *in);
|
2001-02-20 20:34:14 +00:00
|
|
|
PHPAPI char *php_sock_fgets(char *buf, size_t maxlen, int socket);
|
|
|
|
PHPAPI size_t php_sock_fread(char *buf, size_t maxlen, int socket);
|
|
|
|
PHPAPI int php_sock_feof(int socket);
|
|
|
|
PHPAPI int php_sock_fgetc(int socket);
|
|
|
|
PHPAPI int php_is_persistent_sock(int);
|
|
|
|
PHPAPI int php_sockset_blocking(int socket, int mode);
|
|
|
|
PHPAPI void php_sockset_timeout(int socket, struct timeval *timeout);
|
|
|
|
PHPAPI int php_sockdestroy(int socket);
|
|
|
|
PHPAPI int php_sock_close(int socket);
|
|
|
|
PHPAPI size_t php_sock_set_def_chunk_size(size_t size);
|
|
|
|
PHPAPI void php_msock_destroy(int *data);
|
2001-07-28 11:36:37 +00:00
|
|
|
PHPAPI void php_cleanup_sockbuf(int persistent TSRMLS_DC);
|
1999-04-17 00:37:12 +00:00
|
|
|
|
2000-02-01 20:02:44 +00:00
|
|
|
PHPAPI struct php_sockbuf *php_get_socket(int socket);
|
* fixed some #if/#ifdef issues
* hand-patched in php3 changes from 3.0.6 to HEAD in these files:
fopen-wrappers.[ch] ext/standard/file.[ch] ext/standard/fsock.[ch]
ext/standard/php3_string.h ext/standard/string.c
* added some new file/socket macros for more readable code:
FP_FGETS(buf,len,sock,fp,issock)
FP_FREAD(buf,len,sock,fp,issock)
FP_FEOF(sock,fp,issock)
FP_FGETC(sock,fp,issock)
1999-06-16 17:06:53 +00:00
|
|
|
|
1999-07-26 20:09:08 +00:00
|
|
|
PHP_RSHUTDOWN_FUNCTION(fsock);
|
1999-05-14 18:25:16 +00:00
|
|
|
|
2001-05-05 18:36:22 +00:00
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* End:
|
|
|
|
* vim: sw=4 ts=4 tw=78
|
|
|
|
*/
|
2000-07-02 23:46:51 +00:00
|
|
|
#endif /* FSOCK_H */
|