]> granicus.if.org Git - php/commitdiff
Added stream_get_transports()
authorSara Golemon <pollita@php.net>
Fri, 4 Apr 2003 05:21:03 +0000 (05:21 +0000)
committerSara Golemon <pollita@php.net>
Fri, 4 Apr 2003 05:21:03 +0000 (05:21 +0000)
ext/standard/basic_functions.c
ext/standard/streamsfuncs.c
ext/standard/streamsfuncs.h

index 9ae0e20a857ca036ec9de36b5a6b6bbcfe6fcd47..80894af6341338592667bccac565a81ed1bf0b5a 100644 (file)
@@ -701,6 +701,7 @@ function_entry basic_functions[] = {
        PHP_FE(stream_get_line,                                                                                         NULL)
        PHP_FE(stream_register_wrapper,                                                                                 NULL)
        PHP_FE(stream_get_wrappers,                                                                                             NULL)
+       PHP_FE(stream_get_transports,                                                                                   NULL)
        PHP_FE(get_headers,                                                                                                     NULL)
 
 #if HAVE_SYS_TIME_H || defined(PHP_WIN32)
index eaae8a25c41eb0958783c15f0ddc78ff7d645961..814cafd2bf32bf13a09437ab531eb72b110aaac2 100644 (file)
@@ -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)
index 9da5f1f5af74e111aa4204f9cc912e798b3da94b..95c1271d973e72ea363cc03459fbd4c60b4906b8 100644 (file)
@@ -34,6 +34,7 @@ PHP_FUNCTION(stream_set_blocking);
 PHP_FUNCTION(stream_select);
 PHP_FUNCTION(stream_set_timeout);
 PHP_FUNCTION(stream_set_write_buffer);
+PHP_FUNCTION(stream_get_transports);
 PHP_FUNCTION(stream_get_wrappers);
 PHP_FUNCTION(stream_get_line);
 PHP_FUNCTION(stream_get_meta_data);