Fix heredoc/nowdoc bugs with large docs, docs crossing buffer boundaries
[hiphop-php.git] / hphp / idl / stream.idl.php
blob319ff38b06d838dcdb947ac235bb0bade810a599
1 <?php
2 /**
3 * Automatically generated by running "php schema.php stream".
5 * You may modify the file, but re-running schema.php against this file will
6 * standardize the format without losing your schema changes. It does lose
7 * any changes that are not part of schema. Use "note" field to comment on
8 * schema itself, and "note" fields are not used in any code generation but
9 * only staying within this file.
11 ///////////////////////////////////////////////////////////////////////////////
12 // Preamble: C++ code inserted at beginning of ext_{name}.h
14 DefinePreamble(<<<CPP
16 CPP
19 ///////////////////////////////////////////////////////////////////////////////
20 // Constants
22 // array (
23 // 'name' => name of the constant
24 // 'type' => type of the constant
25 // 'note' => additional note about this constant's schema
26 // )
29 ///////////////////////////////////////////////////////////////////////////////
30 // Functions
32 // array (
33 // 'name' => name of the function
34 // 'desc' => description of the function's purpose
35 // 'flags' => attributes of the function, see base.php for possible values
36 // 'opt' => optimization callback function's name for compiler
37 // 'note' => additional note about this function's schema
38 // 'return' =>
39 // array (
40 // 'type' => return type, use Reference for ref return
41 // 'desc' => description of the return value
42 // )
43 // 'args' => arguments
44 // array (
45 // 'name' => name of the argument
46 // 'type' => type of the argument, use Reference for output parameter
47 // 'value' => default value of the argument
48 // 'desc' => description of the argument
49 // )
50 // )
52 DefineFunction(
53 array(
54 'name' => "stream_context_create",
55 'desc' => "Creates and returns a stream context with any options supplied in options preset.",
56 'flags' => HasDocComment,
57 'return' => array(
58 'type' => Resource,
59 'desc' => "A stream context resource.",
61 'args' => array(
62 array(
63 'name' => "options",
64 'type' => VariantMap,
65 'value' => "null_array",
66 'desc' => "Must be an associative array of associative arrays in the format \$arr['wrapper']['option'] = \$value.\n\nDefault to an empty array.",
68 array(
69 'name' => "params",
70 'type' => VariantMap,
71 'value' => "null_array",
72 'desc' => "Must be an associative array in the format \$arr['parameter'] = \$value. Refer to context parameters for a listing of standard stream parameters.",
75 ));
77 DefineFunction(
78 array(
79 'name' => "stream_context_get_default",
80 'flags' => HasDocComment,
81 'return' => array(
82 'type' => Resource,
83 'desc' => "A stream context resource.",
85 'args' => array(
86 array(
87 'name' => "options",
88 'type' => VariantMap,
89 'value' => "null_array",
90 'desc' => "options must be an associative array of associative arrays in the format \$arr['wrapper']['option'] = \$value.\n\nAs of PHP 5.3.0, the stream_context_set_default() function can be used to set the default context.",
93 ));
95 DefineFunction(
96 array(
97 'name' => "stream_context_get_options",
98 'flags' => HasDocComment,
99 'return' => array(
100 'type' => Variant,
101 'desc' => "Returns an associative array with the options.",
103 'args' => array(
104 array(
105 'name' => "stream_or_context",
106 'type' => Resource,
107 'desc' => "The stream or context to get options from",
112 DefineFunction(
113 array(
114 'name' => "stream_context_set_option",
115 'flags' => HasDocComment,
116 'return' => array(
117 'type' => Boolean,
118 'desc' => "Returns TRUE on success or FALSE on failure.",
120 'args' => array(
121 array(
122 'name' => "stream_or_context",
123 'type' => Resource,
124 'desc' => "The stream or context resource to apply the options too.",
126 array(
127 'name' => "wrapper",
128 'type' => Variant,
129 'desc' => "The options to set for the default context.\n\noptions must be an associative array of associative arrays in the format \$arr['wrapper']['option'] = \$value.\n\nRefer to context options and parameters for a listing of stream options.",
131 array(
132 'name' => "option",
133 'type' => String,
134 'value' => "null_string",
136 array(
137 'name' => "value",
138 'type' => Variant,
139 'value' => "null_variant",
144 DefineFunction(
145 array(
146 'name' => "stream_context_set_param",
147 'flags' => HasDocComment,
148 'return' => array(
149 'type' => Boolean,
151 'args' => array(
152 array(
153 'name' => "stream_or_context",
154 'type' => Resource,
156 array(
157 'name' => "params",
158 'type' => VariantMap,
163 DefineFunction(
164 array(
165 'name' => "stream_copy_to_stream",
166 'desc' => "Makes a copy of up to maxlength bytes of data from the current position (or from the offset position, if specified) in source to dest. If maxlength is not specified, all remaining content in source will be copied.",
167 'flags' => HasDocComment,
168 'return' => array(
169 'type' => Variant,
170 'desc' => "Returns the total count of bytes copied.",
172 'args' => array(
173 array(
174 'name' => "source",
175 'type' => Resource,
176 'desc' => "The source stream",
178 array(
179 'name' => "dest",
180 'type' => Resource,
181 'desc' => "The destination stream",
183 array(
184 'name' => "maxlength",
185 'type' => Int32,
186 'value' => "-1",
187 'desc' => "Maximum bytes to copy",
189 array(
190 'name' => "offset",
191 'type' => Int32,
192 'value' => "0",
193 'desc' => "The offset where to start to copy data",
198 DefineFunction(
199 array(
200 'name' => "stream_encoding",
201 'flags' => HasDocComment,
202 'return' => array(
203 'type' => Boolean,
205 'args' => array(
206 array(
207 'name' => "stream",
208 'type' => Resource,
210 array(
211 'name' => "encoding",
212 'type' => String,
213 'value' => "null_string",
218 DefineFunction(
219 array(
220 'name' => "stream_bucket_append",
221 'flags' => HasDocComment,
222 'return' => array(
223 'type' => null,
225 'args' => array(
226 array(
227 'name' => "brigade",
228 'type' => Resource,
230 array(
231 'name' => "bucket",
232 'type' => Resource,
237 DefineFunction(
238 array(
239 'name' => "stream_bucket_prepend",
240 'flags' => HasDocComment,
241 'return' => array(
242 'type' => null,
244 'args' => array(
245 array(
246 'name' => "brigade",
247 'type' => Resource,
249 array(
250 'name' => "bucket",
251 'type' => Resource,
256 DefineFunction(
257 array(
258 'name' => "stream_bucket_make_writeable",
259 'flags' => HasDocComment,
260 'return' => array(
261 'type' => Resource,
263 'args' => array(
264 array(
265 'name' => "brigade",
266 'type' => Resource,
271 DefineFunction(
272 array(
273 'name' => "stream_bucket_new",
274 'flags' => HasDocComment,
275 'return' => array(
276 'type' => Resource,
278 'args' => array(
279 array(
280 'name' => "stream",
281 'type' => Resource,
283 array(
284 'name' => "buffer",
285 'type' => String,
290 DefineFunction(
291 array(
292 'name' => "stream_filter_register",
293 'desc' => "stream_filter_register() allows you to implement your own filter on any registered stream used with all the other filesystem functions (such as fopen(), fread() etc.).",
294 'flags' => HasDocComment,
295 'return' => array(
296 'type' => Boolean,
297 'desc' => "Returns TRUE on success or FALSE on failure.\n\nstream_filter_register() will return FALSE if the filtername is already defined.",
299 'args' => array(
300 array(
301 'name' => "filtername",
302 'type' => String,
303 'desc' => "The filter name to be registered.",
305 array(
306 'name' => "classname",
307 'type' => String,
308 'desc' => "To implement a filter, you need to define a class as an extension of php_user_filter with a number of member functions as defined below. When performing read/write operations on the stream to which your filter is attached, PHP will pass the data through your filter (and any other filters attached to that stream) so that the data may be modified as desired. You must implement the methods exactly as described below - doing otherwise will lead to undefined behaviour. int filter ( resource \$in , resource \$out , int &\$consumed , bool \$closing )\n\nThis method is called whenever data is read from or written to the attached stream (such as with fread() or fwrite()). in is a resource pointing to a bucket brigade which contains one or more bucket objects containing data to be filtered. out is a resource pointing to a second bucket brigade into which your modified buckets should be placed. consumed, which must always be declared by reference, should be incremented by the length of the data which your filter reads in and alters. In most cases this means you will increment consumed by \$bucket->datalen for each \$bucket. If the stream is in the process of closing (and therefore this is the last pass through the filterchain), the closing parameter will be set to TRUE. The filter() method must return one of three values upon completion. Return Value Meaning PSFS_PASS_ON Filter processed successfully with data available in the out bucket brigade. PSFS_FEED_ME Filter processed successfully, however no data was available to return. More data is required from the stream or prior filter. PSFS_ERR_FATAL (default) The filter experienced an unrecoverable error and cannot continue. bool onCreate ( void ) This method is called during instantiation of the filter class object. If your filter allocates or initializes any other resources (such as a buffer), this is the place to do it. Your implementation of this method should return FALSE on failure, or TRUE on success. When your filter is first instantiated, and yourfilter->onCreate() is called, a number of properties will be available as shown in the table below.\n\nProperty Contents FilterClass->filtername A string containing the name the filter was instantiated with. Filters may be registered under multiple names or under wildcards. Use this property to determine which name was used. FilterClass->params The contents of the params parameter passed to stream_filter_append() or stream_filter_prepend(). FilterClass->stream The stream resource being filtered. Maybe available only during filter() calls when the closing parameter is set to FALSE. void onClose ( void )\n\nThis method is called upon filter shutdown (typically, this is also during stream shutdown), and is executed after the flush method is called. If any resources were allocated or initialized during onCreate() this would be the time to destroy or dispose of them.",
313 DefineFunction(
314 array(
315 'name' => "stream_filter_remove",
316 'desc' => "Removes a stream filter previously added to a stream with stream_filter_prepend() or stream_filter_append(). Any data remaining in the filter's internal buffer will be flushed through to the next filter before removing it.",
317 'flags' => HasDocComment,
318 'return' => array(
319 'type' => Boolean,
320 'desc' => "Returns TRUE on success or FALSE on failure.",
322 'args' => array(
323 array(
324 'name' => "stream_filter",
325 'type' => Resource,
326 'desc' => "The stream filter to be removed.",
331 DefineFunction(
332 array(
333 'name' => "stream_filter_append",
334 'desc' => "Adds filtername to the list of filters attached to stream.",
335 'flags' => HasDocComment,
336 'return' => array(
337 'type' => Resource,
338 'desc' => "Returns a resource which can be used to refer to this filter instance during a call to stream_filter_remove().",
340 'args' => array(
341 array(
342 'name' => "stream",
343 'type' => Resource,
344 'desc' => "The target stream.",
346 array(
347 'name' => "filtername",
348 'type' => String,
349 'desc' => "The filter name.",
351 array(
352 'name' => "read_write",
353 'type' => Int32,
354 'value' => "0",
355 'desc' => "By default, stream_filter_append() will attach the filter to the read filter chain if the file was opened for reading (i.e. File Mode: r, and/or +). The filter will also be attached to the write filter chain if the file was opened for writing (i.e. File Mode: w, a, and/or +). STREAM_FILTER_READ, STREAM_FILTER_WRITE, and/or STREAM_FILTER_ALL can also be passed to the read_write parameter to override this behavior.",
357 array(
358 'name' => "params",
359 'type' => Variant,
360 'value' => "null_variant",
361 'desc' => "This filter will be added with the specified params to the end of the list and will therefore be called last during stream operations. To add a filter to the beginning of the list, use stream_filter_prepend().",
366 DefineFunction(
367 array(
368 'name' => "stream_filter_prepend",
369 'desc' => "Adds filtername to the list of filters attached to stream.",
370 'flags' => HasDocComment,
371 'return' => array(
372 'type' => Resource,
373 'desc' => "Returns a resource which can be used to refer to this filter instance during a call to stream_filter_remove().",
375 'args' => array(
376 array(
377 'name' => "stream",
378 'type' => Resource,
379 'desc' => "The target stream.",
381 array(
382 'name' => "filtername",
383 'type' => String,
384 'desc' => "The filter name.",
386 array(
387 'name' => "read_write",
388 'type' => Int32,
389 'value' => "0",
390 'desc' => "By default, stream_filter_prepend() will attach the filter to the read filter chain if the file was opened for reading (i.e. File Mode: r, and/or +). The filter will also be attached to the write filter chain if the file was opened for writing (i.e. File Mode: w, a, and/or +). STREAM_FILTER_READ, STREAM_FILTER_WRITE, and/or STREAM_FILTER_ALL can also be passed to the read_write parameter to override this behavior. See stream_filter_append() for an example of using this parameter.",
392 array(
393 'name' => "params",
394 'type' => Variant,
395 'value' => "null_variant",
396 'desc' => "This filter will be added with the specified params to the beginning of the list and will therefore be called first during stream operations. To add a filter to the end of the list, use stream_filter_append().",
401 DefineFunction(
402 array(
403 'name' => "stream_get_contents",
404 'desc' => "Identical to file_get_contents(), except that stream_get_contents() operates on an already open stream resource and returns the remaining contents in a string, up to maxlength bytes and starting at the specified offset.",
405 'flags' => HasDocComment,
406 'return' => array(
407 'type' => Variant,
408 'desc' => "Returns a string or FALSE on failure.",
410 'args' => array(
411 array(
412 'name' => "handle",
413 'type' => Resource,
414 'desc' => "A stream resource (e.g. returned from fopen())",
416 array(
417 'name' => "maxlen",
418 'type' => Int32,
419 'value' => "0",
420 'desc' => "The maximum bytes to read. Defaults to -1 (read all the remaining buffer).",
422 array(
423 'name' => "offset",
424 'type' => Int32,
425 'value' => "0",
426 'desc' => "Seek to the specified offset before reading.",
431 DefineFunction(
432 array(
433 'name' => "stream_get_filters",
434 'flags' => HasDocComment,
435 'return' => array(
436 'type' => StringVec,
437 'desc' => "Returns an indexed array containing the name of all stream filters available.",
441 DefineFunction(
442 array(
443 'name' => "stream_get_line",
444 'desc' => "Gets a line from the given handle.\n\nReading ends when length bytes have been read, when the string specified by ending is found (which is not included in the return value), or on EOF (whichever comes first).\n\nThis function is nearly identical to fgets() except in that it allows end of line delimiters other than the standard \\n, \\r, and \\r\\n, and does not return the delimiter itself.",
445 'flags' => HasDocComment,
446 'return' => array(
447 'type' => Variant,
448 'desc' => "Returns a string of up to length bytes read from the file pointed to by handle.\n\nIf an error occurs, returns FALSE.",
450 'args' => array(
451 array(
452 'name' => "handle",
453 'type' => Resource,
454 'desc' => "A valid file handle.",
456 array(
457 'name' => "length",
458 'type' => Int32,
459 'value' => "0",
460 'desc' => "The number of bytes to read from the handle.",
462 array(
463 'name' => "ending",
464 'type' => String,
465 'value' => "null_string",
466 'desc' => "An optional string delimiter.",
471 DefineFunction(
472 array(
473 'name' => "stream_get_meta_data",
474 'desc' => "Returns information about an existing stream.",
475 'flags' => HasDocComment,
476 'return' => array(
477 'type' => Variant,
478 'desc' => "The result array contains the following items:\n\ntimed_out (bool) - TRUE if the stream timed out while waiting for data on the last call to fread() or fgets().\n\nblocked (bool) - TRUE if the stream is in blocking IO mode. See stream_set_blocking().\n\neof (bool) - TRUE if the stream has reached end-of-file. Note that for socket streams this member can be TRUE even when unread_bytes is non-zero. To determine if there is more data to be read, use feof() instead of reading this item.\n\nunread_bytes (int) - the number of bytes currently contained in the PHP's own internal buffer. You shouldn't use this value in a script.\n\nstream_type (string) - a label describing the underlying implementation of the stream.\n\nwrapper_type (string) - a label describing the protocol wrapper implementation layered over the stream. See List of Supported Protocols/Wrappers for more information about wrappers.\n\nwrapper_data (mixed) - wrapper specific data attached to this stream. See List of Supported Protocols/Wrappers for more information about wrappers and their wrapper data.\n\nfilters (array) - and array containing the names of any filters that have been stacked onto this stream. Documentation on filters can be found in the Filters appendix.\n\nmode (string) - the type of access required for this stream (see Table 1 of the fopen() reference)\n\nseekable (bool) - whether the current stream can be seeked.\n\nuri (string) - the URI/filename associated with this stream.",
480 'args' => array(
481 array(
482 'name' => "stream",
483 'type' => Resource,
484 'desc' => "The stream can be any stream created by fopen(), fsockopen() and pfsockopen().",
489 DefineFunction(
490 array(
491 'name' => "stream_get_transports",
492 'flags' => HasDocComment,
493 'return' => array(
494 'type' => StringVec,
495 'desc' => "Returns an indexed array of socket transports names.",
499 DefineFunction(
500 array(
501 'name' => "stream_get_wrappers",
502 'desc' => "Retrieve list of registered streams available on the running system.",
503 'flags' => HasDocComment,
504 'return' => array(
505 'type' => StringVec,
506 'desc' => "Returns an indexed array containing the name of all stream wrappers available on the running system.",
510 DefineFunction(
511 array(
512 'name' => "stream_register_wrapper",
513 'flags' => HasDocComment,
514 'return' => array(
515 'type' => Boolean,
517 'args' => array(
518 array(
519 'name' => "protocol",
520 'type' => String,
522 array(
523 'name' => "classname",
524 'type' => String,
529 DefineFunction(
530 array(
531 'name' => "stream_wrapper_register",
532 'desc' => "Allows you to implement your own protocol handlers and streams for use with all the other filesystem functions (such as fopen(), fread() etc.).",
533 'flags' => HasDocComment,
534 'return' => array(
535 'type' => Boolean,
536 'desc' => "Returns TRUE on success or FALSE on failure.\n\nstream_wrapper_register() will return FALSE if the protocol already has a handler.",
538 'args' => array(
539 array(
540 'name' => "protocol",
541 'type' => String,
542 'desc' => "The wrapper name to be registered.",
544 array(
545 'name' => "classname",
546 'type' => String,
547 'desc' => "The classname which implements the protocol.",
552 DefineFunction(
553 array(
554 'name' => "stream_wrapper_restore",
555 'desc' => "Restores a built-in wrapper previously unregistered with stream_wrapper_unregister().",
556 'flags' => HasDocComment,
557 'return' => array(
558 'type' => Boolean,
559 'desc' => "Returns TRUE on success or FALSE on failure.",
561 'args' => array(
562 array(
563 'name' => "protocol",
564 'type' => String,
569 DefineFunction(
570 array(
571 'name' => "stream_wrapper_unregister",
572 'desc' => "Allows you to disable an already defined stream wrapper. Once the wrapper has been disabled you may override it with a user-defined wrapper using stream_wrapper_register() or reenable it later on with stream_wrapper_restore().",
573 'flags' => HasDocComment,
574 'return' => array(
575 'type' => Boolean,
576 'desc' => "Returns TRUE on success or FALSE on failure.",
578 'args' => array(
579 array(
580 'name' => "protocol",
581 'type' => String,
586 DefineFunction(
587 array(
588 'name' => "stream_resolve_include_path",
589 'desc' => "Resolve filename against the include path according to the same rules as fopen()/include() does.",
590 'flags' => HasDocComment,
591 'return' => array(
592 'type' => String,
593 'desc' => "On success, the resolved absolute filename is returned. On failure, FALSE is returned.",
595 'args' => array(
596 array(
597 'name' => "filename",
598 'type' => String,
599 'desc' => "The filename to resolve.",
601 array(
602 'name' => "context",
603 'type' => Resource,
604 'value' => "null_object",
605 'desc' => "A valid context resource created with stream_context_create().",
610 DefineFunction(
611 array(
612 'name' => "stream_select",
613 'desc' => "The stream_select() function accepts arrays of streams and waits for them to change status. Its operation is equivalent to that of the socket_select() function except in that it acts on streams.",
614 'flags' => HasDocComment,
615 'return' => array(
616 'type' => Variant,
617 'desc' => "On success stream_select() returns the number of stream resources contained in the modified arrays, which may be zero if the timeout expires before anything interesting happens. On error FALSE is returned and a warning raised (this can happen if the system call is interrupted by an incoming signal).",
619 'args' => array(
620 array(
621 'name' => "read",
622 'type' => Variant | Reference,
623 'desc' => "The streams listed in the read array will be watched to see if characters become available for reading (more precisely, to see if a read will not block - in particular, a stream resource is also ready on end-of-file, in which case an fread() will return a zero length string).",
625 array(
626 'name' => "write",
627 'type' => Variant | Reference,
628 'desc' => "The streams listed in the write array will be watched to see if a write will not block.",
630 array(
631 'name' => "except",
632 'type' => Variant | Reference,
633 'desc' => "The streams listed in the except array will be watched for high priority exceptional (\"out-of-band\") data arriving.\n\nWhen stream_select() returns, the arrays read, write and except are modified to indicate which stream resource(s) actually changed status. You do not need to pass every array to stream_select(). You can leave it out and use an empty array or NULL instead. Also do not forget that those arrays are passed by reference and will be modified after stream_select() returns.",
635 array(
636 'name' => "vtv_sec",
637 'type' => Variant,
638 'desc' => "The tv_sec and tv_usec together form the timeout parameter, tv_sec specifies the number of seconds while tv_usec the number of microseconds. The timeout is an upper bound on the amount of time that stream_select() will wait before it returns. If tv_sec and tv_usec are both set to 0, stream_select() will not wait for data - instead it will return immediately, indicating the current status of the streams.\n\nIf tv_sec is NULL stream_select() can block indefinitely, returning only when an event on one of the watched streams occurs (or if a signal interrupts the system call). Warning\n\nUsing a timeout value of 0 allows you to instantaneously poll the status of the streams, however, it is NOT a good idea to use a 0 timeout value in a loop as it will cause your script to consume too much CPU time.\n\nIt is much better to specify a timeout value of a few seconds, although if you need to be checking and running other code concurrently, using a timeout value of at least 200000 microseconds will help reduce the CPU usage of your script.\n\nRemember that the timeout value is the maximum time that will elapse; stream_select() will return as soon as the requested streams are ready for use.",
640 array(
641 'name' => "tv_usec",
642 'type' => Int32,
643 'value' => "0",
644 'desc' => "See tv_sec description.",
649 DefineFunction(
650 array(
651 'name' => "stream_set_blocking",
652 'desc' => "Sets blocking or non-blocking mode on a stream.\n\nThis function works for any stream that supports non-blocking mode (currently, regular files and socket streams).",
653 'flags' => HasDocComment,
654 'return' => array(
655 'type' => Boolean,
656 'desc' => "Returns TRUE on success or FALSE on failure.",
658 'args' => array(
659 array(
660 'name' => "stream",
661 'type' => Resource,
662 'desc' => "The stream.",
664 array(
665 'name' => "mode",
666 'type' => Int32,
667 'desc' => "If mode is 0, the given stream will be switched to non-blocking mode, and if 1, it will be switched to blocking mode. This affects calls like fgets() and fread() that read from the stream. In non-blocking mode an fgets() call will always return right away while in blocking mode it will wait for data to become available on the stream.",
672 DefineFunction(
673 array(
674 'name' => "stream_set_timeout",
675 'desc' => "Sets the timeout value on stream, expressed in the sum of seconds and microseconds.\n\nWhen the stream times out, the 'timed_out' key of the array returned by stream_get_meta_data() is set to TRUE, although no error/warning is generated.",
676 'flags' => HasDocComment,
677 'return' => array(
678 'type' => Boolean,
679 'desc' => "Returns TRUE on success or FALSE on failure.",
681 'args' => array(
682 array(
683 'name' => "stream",
684 'type' => Resource,
685 'desc' => "The target stream.",
687 array(
688 'name' => "seconds",
689 'type' => Int32,
690 'desc' => "The seconds part of the timeout to be set.",
692 array(
693 'name' => "microseconds",
694 'type' => Int32,
695 'value' => "0",
696 'desc' => "The microseconds part of the timeout to be set.",
701 DefineFunction(
702 array(
703 'name' => "stream_set_write_buffer",
704 'desc' => "Sets the buffering for write operations on the given stream to buffer bytes. Output using fwrite() is normally buffered at 8K. This means that if there are two processes wanting to write to the same output stream (a file), each is paused after 8K of data to allow the other to write.",
705 'flags' => HasDocComment,
706 'return' => array(
707 'type' => Int64,
708 'desc' => "Returns 0 on success, or EOF if the request cannot be honored.",
710 'args' => array(
711 array(
712 'name' => "stream",
713 'type' => Resource,
714 'desc' => "The file pointer.",
716 array(
717 'name' => "buffer",
718 'type' => Int32,
719 'desc' => "The number of bytes to buffer. If buffer is 0 then write operations are unbuffered. This ensures that all writes with fwrite() are completed before other processes are allowed to write to that output stream.",
724 DefineFunction(
725 array(
726 'name' => "set_file_buffer",
727 'flags' => HasDocComment,
728 'return' => array(
729 'type' => Int64,
731 'args' => array(
732 array(
733 'name' => "stream",
734 'type' => Resource,
736 array(
737 'name' => "buffer",
738 'type' => Int32,
743 DefineFunction(
744 array(
745 'name' => "stream_socket_accept",
746 'desc' => "Accept a connection on a socket previously created by stream_socket_server().",
747 'flags' => HasDocComment,
748 'return' => array(
749 'type' => Variant,
750 'desc' => "Returns a stream to the accepted socket connection or FALSE on failure.",
752 'args' => array(
753 array(
754 'name' => "server_socket",
755 'type' => Resource,
756 'desc' => "The server socket to accept a connection from.",
758 array(
759 'name' => "timeout",
760 'type' => Double,
761 'value' => "0.0",
762 'desc' => "Override the default socket accept timeout. Time should be given in seconds.",
764 array(
765 'name' => "peername",
766 'type' => Variant | Reference,
767 'value' => "null",
768 'desc' => "Will be set to the name (address) of the client which connected, if included and available from the selected transport.\n\nCan also be determined later using stream_socket_get_name().",
773 DefineFunction(
774 array(
775 'name' => "stream_socket_server",
776 'desc' => "Creates a stream or datagram socket on the specified local_socket.\n\nThis function only creates a socket, to begin accepting connections use stream_socket_accept().",
777 'flags' => HasDocComment,
778 'return' => array(
779 'type' => Variant,
780 'desc' => "Returns the created stream, or FALSE on error.",
782 'args' => array(
783 array(
784 'name' => "local_socket",
785 'type' => String,
786 'desc' => "The type of socket created is determined by the transport specified using standard URL formatting: transport://target.\n\nFor Internet Domain sockets (AF_INET) such as TCP and UDP, the target portion of the remote_socket parameter should consist of a hostname or IP address followed by a colon and a port number. For Unix domain sockets, the target portion should point to the socket file on the filesystem.\n\nDepending on the environment, Unix domain sockets may not be available. A list of available transports can be retrieved using stream_get_transports(). See List of Supported Socket Transports for a list of bulitin transports.",
788 array(
789 'name' => "errnum",
790 'type' => Variant | Reference,
791 'value' => "null",
792 'desc' => "If the optional errno and errstr arguments are present they will be set to indicate the actual system level error that occurred in the system-level socket(), bind(), and listen() calls. If the value returned in errno is 0 and the function returned FALSE, it is an indication that the error occurred before the bind() call. This is most likely due to a problem initializing the socket. Note that the errno and errstr arguments will always be passed by reference.",
794 array(
795 'name' => "errstr",
796 'type' => Variant | Reference,
797 'value' => "null",
798 'desc' => "See errno description.",
800 array(
801 'name' => "flags",
802 'type' => Int32,
803 'value' => "0",
804 'desc' => "A bitmask field which may be set to any combination of socket creation flags.\n\nFor UDP sockets, you must use STREAM_SERVER_BIND as the flags parameter.",
806 array(
807 'name' => "context",
808 'type' => Resource,
809 'value' => "null_object",
814 DefineFunction(
815 array(
816 'name' => "stream_socket_client",
817 'desc' => "Initiates a stream or datagram connection to the destination specified by remote_socket. The type of socket created is determined by the transport specified using standard URL formatting: transport://target. For Internet Domain sockets (AF_INET) such as TCP and UDP, the target portion of the remote_socket parameter should consist of a hostname or IP address followed by a colon and a port number. For Unix domain sockets, the target portion should point to the socket file on the filesystem.\n\nThe stream will by default be opened in blocking mode. You can switch it to non-blocking mode by using stream_set_blocking().",
818 'flags' => HasDocComment,
819 'return' => array(
820 'type' => Variant,
821 'desc' => "On success a stream resource is returned which may be used together with the other file functions (such as fgets(), fgetss(), fwrite(), fclose(), and feof()), FALSE on failure.",
823 'args' => array(
824 array(
825 'name' => "remote_socket",
826 'type' => String,
827 'desc' => "Address to the socket to connect to.",
829 array(
830 'name' => "errnum",
831 'type' => Variant | Reference,
832 'value' => "null",
833 'desc' => "Will be set to the system level error number if connection fails.",
835 array(
836 'name' => "errstr",
837 'type' => Variant | Reference,
838 'value' => "null",
839 'desc' => "Will be set to the system level error message if the connection fails.",
841 array(
842 'name' => "timeout",
843 'type' => Double,
844 'value' => "0.0",
845 'desc' => "Number of seconds until the connect() system call should timeout. This parameter only applies when not making asynchronous connection attempts.\n\nTo set a timeout for reading/writing data over the socket, use the stream_set_timeout(), as the timeout only applies while making connecting the socket.",
847 array(
848 'name' => "flags",
849 'type' => Int32,
850 'value' => "0",
851 'desc' => "Bitmask field which may be set to any combination of connection flags. Currently the select of connection flags is limited to STREAM_CLIENT_CONNECT (default), STREAM_CLIENT_ASYNC_CONNECT and STREAM_CLIENT_PERSISTENT.",
853 array(
854 'name' => "context",
855 'type' => Resource,
856 'value' => "null_object",
857 'desc' => "A valid context resource created with stream_context_create().",
862 DefineFunction(
863 array(
864 'name' => "stream_socket_enable_crypto",
865 'flags' => HasDocComment,
866 'return' => array(
867 'type' => Variant,
868 'desc' => "Returns TRUE on success, FALSE if negotiation has failed or 0 if there isn't enough data and you should try again (only for non-blocking sockets).",
870 'args' => array(
871 array(
872 'name' => "stream",
873 'type' => Resource,
874 'desc' => "The stream resource.",
876 array(
877 'name' => "enable",
878 'type' => Boolean,
879 'desc' => "Enable/disable cryptography on the stream.",
881 array(
882 'name' => "crypto_type",
883 'type' => Int32,
884 'value' => "0",
885 'desc' => "Setup encryption on the stream. Valid methods are STREAM_CRYPTO_METHOD_SSLv2_CLIENT STREAM_CRYPTO_METHOD_SSLv3_CLIENT STREAM_CRYPTO_METHOD_SSLv23_CLIENT STREAM_CRYPTO_METHOD_TLS_CLIENT STREAM_CRYPTO_METHOD_SSLv2_SERVER STREAM_CRYPTO_METHOD_SSLv3_SERVER STREAM_CRYPTO_METHOD_SSLv23_SERVER STREAM_CRYPTO_METHOD_TLS_SERVER",
887 array(
888 'name' => "session_stream",
889 'type' => Resource,
890 'value' => "null_object",
891 'desc' => "Seed the stream with settings from session_stream.",
896 DefineFunction(
897 array(
898 'name' => "stream_socket_get_name",
899 'desc' => "Returns the local or remote name of a given socket connection.",
900 'flags' => HasDocComment,
901 'return' => array(
902 'type' => Variant,
903 'desc' => "The name of the socket.",
905 'args' => array(
906 array(
907 'name' => "handle",
908 'type' => Resource,
909 'desc' => "The socket to get the name of.",
911 array(
912 'name' => "want_peer",
913 'type' => Boolean,
914 'desc' => "If set to TRUE the remote socket name will be returned, if set to FALSE the local socket name will be returned.",
919 DefineFunction(
920 array(
921 'name' => "stream_socket_pair",
922 'desc' => "stream_socket_pair() creates a pair of connected, indistinguishable socket streams. This function is commonly used in IPC (Inter-Process Communication).\nPlease consult the Streams constant list for further details on each constant.",
923 'flags' => HasDocComment,
924 'return' => array(
925 'type' => Variant,
926 'desc' => "Returns an array with the two socket resources on success, or FALSE on failure.",
928 'args' => array(
929 array(
930 'name' => "domain",
931 'type' => Int32,
932 'desc' => "The protocol family to be used: STREAM_PF_INET, STREAM_PF_INET6 or STREAM_PF_UNIX",
934 array(
935 'name' => "type",
936 'type' => Int32,
937 'desc' => "The type of communication to be used: STREAM_SOCK_DGRAM, STREAM_SOCK_RAW, STREAM_SOCK_RDM, STREAM_SOCK_SEQPACKET or STREAM_SOCK_STREAM",
939 array(
940 'name' => "protocol",
941 'type' => Int32,
942 'desc' => "The protocol to be used: STREAM_IPPROTO_ICMP, STREAM_IPPROTO_IP, STREAM_IPPROTO_RAW, STREAM_IPPROTO_TCP or STREAM_IPPROTO_UDP",
947 DefineFunction(
948 array(
949 'name' => "stream_socket_recvfrom",
950 'desc' => "stream_socket_recvfrom() accepts data from a remote socket up to length bytes.",
951 'flags' => HasDocComment,
952 'return' => array(
953 'type' => Variant,
954 'desc' => "Returns the read data, as a string",
956 'args' => array(
957 array(
958 'name' => "socket",
959 'type' => Resource,
960 'desc' => "The remote socket.",
962 array(
963 'name' => "length",
964 'type' => Int32,
965 'desc' => "The number of bytes to receive from the socket.",
967 array(
968 'name' => "flags",
969 'type' => Int32,
970 'value' => "0",
971 'desc' => "The value of flags can be any combination of the following: Possible values for flags STREAM_OOB Process OOB (out-of-band) data. STREAM_PEEK Retrieve data from the socket, but do not consume the buffer. Subsequent calls to fread() or stream_socket_recvfrom() will see the same data.",
973 array(
974 'name' => "address",
975 'type' => String,
976 'value' => "null_string",
977 'desc' => "If address is provided it will be populated with the address of the remote socket.",
982 DefineFunction(
983 array(
984 'name' => "stream_socket_sendto",
985 'desc' => "Sends the specified data through the socket.",
986 'flags' => HasDocComment,
987 'return' => array(
988 'type' => Variant,
989 'desc' => "Returns a result code, as an integer.",
991 'args' => array(
992 array(
993 'name' => "socket",
994 'type' => Resource,
995 'desc' => "The socket to send data to.",
997 array(
998 'name' => "data",
999 'type' => String,
1000 'desc' => "The data to be sent.",
1002 array(
1003 'name' => "flags",
1004 'type' => Int32,
1005 'value' => "0",
1006 'desc' => "The value of flags can be any combination of the following: possible values for flags STREAM_OOB Process OOB (out-of-band) data.",
1008 array(
1009 'name' => "address",
1010 'type' => String,
1011 'value' => "null_string",
1012 'desc' => "The address specified when the socket stream was created will be used unless an alternate address is specified in address.\n\nIf specified, it must be in dotted quad (or [ipv6]) format.",
1017 DefineFunction(
1018 array(
1019 'name' => "stream_socket_shutdown",
1020 'desc' => "Shutdowns (partially or not) a full-duplex connection.",
1021 'flags' => HasDocComment,
1022 'return' => array(
1023 'type' => Boolean,
1024 'desc' => "Returns TRUE on success or FALSE on failure.",
1026 'args' => array(
1027 array(
1028 'name' => "stream",
1029 'type' => Resource,
1030 'desc' => "An open stream (opened with stream_socket_client(), for example)",
1032 array(
1033 'name' => "how",
1034 'type' => Int32,
1035 'desc' => "One of the following constants: STREAM_SHUT_RD (disable further receptions), STREAM_SHUT_WR (disable further transmissions) or STREAM_SHUT_RDWR (disable further receptions and transmissions).",
1041 ///////////////////////////////////////////////////////////////////////////////
1042 // Classes
1044 // BeginClass
1045 // array (
1046 // 'name' => name of the class
1047 // 'desc' => description of the class's purpose
1048 // 'flags' => attributes of the class, see base.php for possible values
1049 // 'note' => additional note about this class's schema
1050 // 'parent' => parent class name, if any
1051 // 'ifaces' => array of interfaces tihs class implements
1052 // 'bases' => extra internal and special base classes this class requires
1053 // 'footer' => extra C++ inserted at end of class declaration
1054 // )
1056 // DefineConstant(..)
1057 // DefineConstant(..)
1058 // ...
1059 // DefineFunction(..)
1060 // DefineFunction(..)
1061 // ...
1062 // DefineProperty
1063 // DefineProperty
1065 // array (
1066 // 'name' => name of the property
1067 // 'type' => type of the property
1068 // 'flags' => attributes of the property
1069 // 'desc' => description of the property
1070 // 'note' => additional note about this property's schema
1071 // )
1073 // EndClass()