diff options
| author | Daniel Lowrey <rdlowrey@php.net> | 2015-02-28 15:32:15 -0500 |
|---|---|---|
| committer | Daniel Lowrey <rdlowrey@php.net> | 2015-02-28 17:41:29 -0500 |
| commit | 13acb7ec653c543c56437ed417c3889fbf54f608 (patch) | |
| tree | ce4f370ed06d601b6964ac3ba6aeb73b530da2fb /ext/standard/streamsfuncs.c | |
| parent | 3ff36c265fce0ec5375e1917764db4fca88eb1ae (diff) | |
| download | php-git-13acb7ec653c543c56437ed417c3889fbf54f608.tar.gz | |
Add stream_socket_crypto_info() function
Diffstat (limited to 'ext/standard/streamsfuncs.c')
| -rw-r--r-- | ext/standard/streamsfuncs.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 46c2aaa9a1..a344ed69db 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -1485,6 +1485,45 @@ PHP_FUNCTION(stream_socket_enable_crypto) } /* }}} */ +/* {{{ proto int stream_socket_crypto_info(resource stream [, int infotype]) + Retrieve information about the stream's crypto session */ +PHP_FUNCTION(stream_socket_crypto_info) +{ + zval *zstream = NULL; + php_stream *stream = NULL; + zend_long infotype = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &zstream, &infotype) == FAILURE) { + RETURN_FALSE; + } + + php_stream_from_zval(stream, zstream); + + if (infotype == 0) { + infotype = STREAM_CRYPTO_INFO_ALL; + } else { + switch (infotype) { + case STREAM_CRYPTO_INFO_CIPHER_NAME: + case STREAM_CRYPTO_INFO_CIPHER_BITS: + case STREAM_CRYPTO_INFO_CIPHER_VERSION: + case STREAM_CRYPTO_INFO_CIPHER: + case STREAM_CRYPTO_INFO_PROTOCOL: + case STREAM_CRYPTO_INFO_ALL: + break; + default: + php_error_docref(NULL, E_WARNING, "unknown crypto info type"); + RETURN_FALSE; + } + } + + if (php_stream_xport_crypto_info(stream, infotype, return_value) != PHP_STREAM_OPTION_RETURN_OK) { + RETURN_FALSE; + } + + /* return_value populated by php_stream_xport_crypto_info() upon success */ +} +/* }}} */ + /* {{{ proto string stream_resolve_include_path(string filename) Determine what file will be opened by calls to fopen() with a relative path */ PHP_FUNCTION(stream_resolve_include_path) |
