xref: /PHP-8.0/ext/sockets/sockets.stub.php (revision 41e9a8eb)
1<?php
2
3/** @generate-function-entries */
4
5final class Socket
6{
7}
8
9final class AddressInfo
10{
11}
12
13function socket_select(?array &$read, ?array &$write, ?array &$except, ?int $seconds, int $microseconds = 0): int|false {}
14
15function socket_create_listen(int $port, int $backlog = 128): Socket|false {}
16
17function socket_accept(Socket $socket): Socket|false {}
18
19function socket_set_nonblock(Socket $socket): bool {}
20
21function socket_set_block(Socket $socket): bool {}
22
23function socket_listen(Socket $socket, int $backlog = 0): bool {}
24
25function socket_close(Socket $socket): void {}
26
27function socket_write(Socket $socket, string $data, ?int $length = null): int|false {}
28
29function socket_read(Socket $socket, int $length, int $mode = PHP_BINARY_READ): string|false {}
30
31/**
32 * @param string $address
33 * @param int $port
34 */
35function socket_getsockname(Socket $socket, &$address, &$port = null): bool {}
36
37/**
38 * @param string $address
39 * @param int $port
40 */
41function socket_getpeername(Socket $socket, &$address, &$port = null): bool {}
42
43function socket_create(int $domain, int $type, int $protocol): Socket|false {}
44
45function socket_connect(Socket $socket, string $address, ?int $port = null): bool {}
46
47function socket_strerror(int $error_code): string {}
48
49function socket_bind(Socket $socket, string $address, int $port = 0): bool {}
50
51/** @param string|null $data */
52function socket_recv(Socket $socket, &$data, int $length, int $flags): int|false {}
53
54function socket_send(Socket $socket, string $data, int $length, int $flags): int|false {}
55
56/**
57 * @param string $data
58 * @param string $address
59 * @param int $port
60 */
61function socket_recvfrom(Socket $socket, &$data, int $length, int $flags, &$address, &$port = null): int|false {}
62
63function socket_sendto(Socket $socket, string $data, int $length, int $flags, string $address, ?int $port = null): int|false {}
64
65function socket_get_option(Socket $socket, int $level, int $option): array|int|false {}
66
67/** @alias socket_get_option */
68function socket_getopt(Socket $socket, int $level, int $option): array|int|false {}
69
70/** @param array|string|int $value */
71function socket_set_option(Socket $socket, int $level, int $option, $value): bool {}
72
73/**
74 * @param array|string|int $value
75 * @alias socket_set_option
76 */
77function socket_setopt(Socket $socket, int $level, int $option, $value): bool {}
78
79#ifdef HAVE_SOCKETPAIR
80/** @param array $pair */
81function socket_create_pair(int $domain, int $type, int $protocol, &$pair): bool {}
82#endif
83
84#ifdef HAVE_SHUTDOWN
85function socket_shutdown(Socket $socket, int $mode = 2): bool {}
86#endif
87
88function socket_last_error(?Socket $socket = null): int {}
89
90function socket_clear_error(?Socket $socket = null): void {}
91
92/** @param resource $stream */
93function socket_import_stream($stream): Socket|false {}
94
95/** @return resource|false */
96function socket_export_stream(Socket $socket) {}
97
98function socket_sendmsg(Socket $socket, array $message, int $flags = 0): int|false {}
99
100function socket_recvmsg(Socket $socket, array &$message, int $flags = 0): int|false {}
101
102function socket_cmsg_space(int $level, int $type, int $num = 0): ?int {}
103
104function socket_addrinfo_lookup(string $host, ?string $service = null, array $hints = []): array|false {}
105
106function socket_addrinfo_connect(AddressInfo $address): Socket|false {}
107
108function socket_addrinfo_bind(AddressInfo $address): Socket|false {}
109
110function socket_addrinfo_explain(AddressInfo $address): array {}
111
112#ifdef PHP_WIN32
113function socket_wsaprotocol_info_export(Socket $socket, int $process_id): string|false {}
114
115function socket_wsaprotocol_info_import(string $info_id): Socket|false {}
116
117function socket_wsaprotocol_info_release(string $info_id): bool {}
118#endif
119