diff options
author | Wez Furlong <wez@php.net> | 2003-02-27 17:43:38 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2003-02-27 17:43:38 +0000 |
commit | fd61f69077f6156ca71dde60ecfd9ed9765a02db (patch) | |
tree | 7285ad393cdb5a85107a3329d1ab2bcafe89f051 /main/php_streams.h | |
parent | 560e33968de93250377606782949f5004affca83 (diff) | |
download | php-git-fd61f69077f6156ca71dde60ecfd9ed9765a02db.tar.gz |
Another big commit (tm).
Main Changes:
- Implement a socket transport layer for use by all code that needs to open
some kind of "special" socket for network or IPC.
- Extensions can register (and override) transports.
- Implement ftruncate() on streams via the ioctl-alike option interface.
- Implement mmap() on streams via the ioctl-alike option interface.
- Implement generic crypto API via the ioctl-alike option interface.
(currently only supports OpenSSL, but could support other SSL toolkits,
and other crypto transport protocols).
Impact:
- tcp sockets can be overloaded by the openssl capable sockets at runtime,
removing the link-time requirement for ssl:// and https:// sockets and
streams.
- checking stream types using PHP_STREAM_IS_SOCKET is deprecated, since
there are now a range of possible socket-type streams.
Working towards:
- socket servers using the new transport layer
- mmap support under win32
- Cleaner code.
# I will be updating the win32 build to add the new files shortly
# after this commit.
Diffstat (limited to 'main/php_streams.h')
-rwxr-xr-x | main/php_streams.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/main/php_streams.h b/main/php_streams.h index bcb6c33f47..008bcdb1a4 100755 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -332,8 +332,22 @@ PHPAPI int _php_stream_set_option(php_stream *stream, int option, int value, voi /* whether or not locking is supported */ #define PHP_STREAM_LOCK_SUPPORTED 1 -#define php_stream_supports_lock(stream) php_stream_set_option((stream), PHP_STREAM_OPTION_LOCKING, 0, (void *) PHP_STREAM_LOCK_SUPPORTED TSRMLS_CC) == 0 ? 1 : 0 -#define php_stream_lock(stream, mode) php_stream_set_option((stream), PHP_STREAM_OPTION_LOCKING, (mode), (void *) NULL TSRMLS_CC) +#define php_stream_supports_lock(stream) _php_stream_set_option((stream), PHP_STREAM_OPTION_LOCKING, 0, (void *) PHP_STREAM_LOCK_SUPPORTED TSRMLS_CC) == 0 ? 1 : 0 +#define php_stream_lock(stream, mode) _php_stream_set_option((stream), PHP_STREAM_OPTION_LOCKING, (mode), (void *) NULL TSRMLS_CC) + +/* option code used by the php_stream_xport_XXX api */ +#define PHP_STREAM_OPTION_XPORT_API 7 /* see php_stream_transport.h */ +#define PHP_STREAM_OPTION_CRYPTO_API 8 /* see php_stream_transport.h */ +#define PHP_STREAM_OPTION_MMAP_API 9 /* see php_stream_mmap.h */ +#define PHP_STREAM_OPTION_TRUNCATE_API 10 + +#define PHP_STREAM_TRUNCATE_SUPPORTED 0 +#define PHP_STREAM_TRUNCATE_SET_SIZE 1 /* ptrparam is a pointer to a size_t */ + +#define php_stream_truncate_supported(stream) (_php_stream_set_option((stream), PHP_STREAM_OPTION_TRUNCATE_API, PHP_STREAM_TRUNCATE_SUPPORTED, NULL TSRMLS_CC) == PHP_STREAM_OPTION_RETURN_OK ? 1 : 0) + +PHPAPI int _php_stream_truncate_set_size(php_stream *stream, size_t newsize TSRMLS_DC); +#define php_stream_truncate_set_size(stream, size) _php_stream_truncate_set_size((stream), (size) TSRMLS_CC) #define PHP_STREAM_OPTION_RETURN_OK 0 /* option set OK */ #define PHP_STREAM_OPTION_RETURN_ERR -1 /* problem setting option */ @@ -356,8 +370,10 @@ PHPAPI size_t _php_stream_copy_to_mem(php_stream *src, char **buf, size_t maxlen PHPAPI size_t _php_stream_passthru(php_stream * src STREAMS_DC TSRMLS_DC); #define php_stream_passthru(stream) _php_stream_passthru((stream) STREAMS_CC TSRMLS_CC) +#include "streams/php_stream_transport.h" #include "streams/php_stream_plain_wrapper.h" #include "streams/php_stream_userspace.h" +#include "streams/php_stream_mmap.h" /* coerce the stream into some other form */ /* cast as a stdio FILE * */ |