summaryrefslogtreecommitdiff
path: root/ext/standard/streamsfuncs.c
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2003-04-04 05:21:03 +0000
committerSara Golemon <pollita@php.net>2003-04-04 05:21:03 +0000
commitb2d4514580f1a89cae9cb6c8f6a575ed8eec1fed (patch)
tree7725df7967b178b37dd9e1be7756d7803f54d2c7 /ext/standard/streamsfuncs.c
parentc985b780a56f8b3fff96f35288aca3e90f8c309c (diff)
downloadphp-git-b2d4514580f1a89cae9cb6c8f6a575ed8eec1fed.tar.gz
Added stream_get_transports()
Diffstat (limited to 'ext/standard/streamsfuncs.c')
-rw-r--r--ext/standard/streamsfuncs.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index eaae8a25c4..814cafd2bf 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -337,6 +337,33 @@ PHP_FUNCTION(stream_get_meta_data)
}
/* }}} */
+/* {{{ proto array stream_get_transports()
+ Retrieves list of registered socket transports */
+PHP_FUNCTION(stream_get_transports)
+{
+ HashTable *stream_xport_hash;
+ char *stream_xport;
+ int key_flags, stream_xport_len;
+
+ if (ZEND_NUM_ARGS() != 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ if (stream_xport_hash = php_stream_xport_get_hash()) {
+ array_init(return_value);
+ for(zend_hash_internal_pointer_reset(stream_xport_hash);
+ (key_flags = zend_hash_get_current_key_ex(stream_xport_hash, &stream_xport, &stream_xport_len, NULL, 0, NULL)) != HASH_KEY_NON_EXISTANT;
+ zend_hash_move_forward(stream_xport_hash)) {
+ if (key_flags == HASH_KEY_IS_STRING) {
+ add_next_index_stringl(return_value, stream_xport, stream_xport_len, 1);
+ }
+ }
+ } else {
+ RETURN_FALSE;
+ }
+}
+/* }}} */
+
/* {{{ proto array stream_get_wrappers()
Retrieves list of registered stream wrappers */
PHP_FUNCTION(stream_get_wrappers)