|
| 1 | +<?php |
| 2 | +/* |
| 3 | + https://github.com/JetBrains/phpstorm-stubs |
| 4 | + Apache 2 Licensed |
| 5 | +*/ |
| 6 | + |
| 7 | +function socket_addrinfo_lookup(string $host, ?string $service, array $hints): array|false {} |
| 8 | +function socket_addrinfo_connect(AddressInfo $address): Socket|false {} |
| 9 | +function socket_addrinfo_bind(AddressInfo $address): Socket|false {} |
| 10 | +function socket_addrinfo_explain(AddressInfo $address): array {} |
| 11 | +function socket_select(?array &$read, ?array &$write, ?array &$except, ?int $seconds, int $microseconds = 0): int|false {} |
| 12 | +function socket_create(int $domain, int $type, int $protocol): Socket|false {} |
| 13 | +function socket_export_stream(Socket $socket) {} |
| 14 | +function socket_create_listen(int $port, int $backlog = 128): Socket|false {} |
| 15 | +function socket_create_pair(int $domain, int $type, int $protocol, &$pair): bool {} |
| 16 | +function socket_accept(Socket $socket): Socket|false {} |
| 17 | +function socket_set_nonblock(Socket $socket): bool {} |
| 18 | +function socket_set_block(Socket $socket): bool {} |
| 19 | +function socket_listen(Socket $socket, int $backlog = 0): bool {} |
| 20 | +function socket_close(Socket $socket): void {} |
| 21 | +function socket_write(Socket $socket, string $data, ?int $length = 0): int|false {} |
| 22 | +function socket_read(Socket $socket, int $length, int $mode = PHP_BINARY_READ): string|false {} |
| 23 | +function socket_getsockname(Socket $socket, &$address, &$port = null): bool {} |
| 24 | +function socket_getpeername(Socket $socket, &$address, &$port = null): bool {} |
| 25 | +function socket_connect(Socket $socket, string $address, ?int $port = 0): bool {} |
| 26 | +function socket_strerror(int $error_code): string {} |
| 27 | +function socket_bind(Socket $socket, string $address, int $port = 0): bool {} |
| 28 | +function socket_recv(Socket $socket, &$data, int $length, int $flags): int|false {} |
| 29 | +function socket_send(Socket $socket, string $data, int $length, int $flags): int|false {} |
| 30 | +function socket_sendmsg(Socket $socket, array $message, int $flags = 0): int|false {} |
| 31 | +function socket_recvfrom(Socket $socket, &$data, int $length, int $flags, &$address, &$port = null): int|false {} |
| 32 | +function socket_recvmsg(Socket $socket, array &$message, int $flags): int|false {} |
| 33 | +function socket_sendto(Socket $socket, string $data, int $length, int $flags, string $address, ?int $port = 0): int|false {} |
| 34 | +function socket_get_option(Socket $socket, int $level, int $option): array|int|false {} |
| 35 | +function socket_set_option(Socket $socket, int $level, int $option, $value): bool {} |
| 36 | +function socket_shutdown(Socket $socket, int $mode = 2): bool {} |
| 37 | +function socket_last_error(?Socket $socket = null): int {} |
| 38 | +function socket_clear_error(?Socket $socket = null): void {} |
| 39 | +function socket_import_stream($stream): Socket|false {} |
| 40 | +function socket_cmsg_space($level, $type, $n = 0): ?int {} |
| 41 | +function socket_getopt(Socket $socket, int $level, int $option): array|int|false {} |
| 42 | +function socket_setopt(Socket $socket, int $level, int $option, $value): bool {} |
| 43 | +function socket_wsaprotocol_info_export($socket, $target_pid) {} |
| 44 | +function socket_wsaprotocol_info_import($info_id) {} |
| 45 | +function socket_wsaprotocol_info_release($info_id) {} |
| 46 | + |
| 47 | +define('AF_UNIX', 1); |
| 48 | +define('AF_INET', 2); |
| 49 | +define('AF_INET6', 10); |
| 50 | +define('SOCK_STREAM', 1); |
| 51 | +define('SOCK_DGRAM', 2); |
| 52 | +define('SOCK_RAW', 3); |
| 53 | +define('SOCK_SEQPACKET', 5); |
| 54 | +define('SOCK_RDM', 4); |
| 55 | +define('MSG_OOB', 1); |
| 56 | +define('MSG_WAITALL', 256); |
| 57 | +define('MSG_CTRUNC', 8); |
| 58 | +define('MSG_TRUNC', 32); |
| 59 | +define('MSG_PEEK', 2); |
| 60 | +define('MSG_DONTROUTE', 4); |
| 61 | +define('MSG_EOR', 128); |
| 62 | +define('MSG_EOF', 512); |
| 63 | +define('MSG_CONFIRM', 2048); |
| 64 | +define('MSG_ERRQUEUE', 8192); |
| 65 | +define('MSG_NOSIGNAL', 16384); |
| 66 | +define('MSG_DONTWAIT', 64); |
| 67 | +define('MSG_MORE', 32768); |
| 68 | +define('MSG_WAITFORONE', 65536); |
| 69 | +define('MSG_CMSG_CLOEXEC', 1073741824); |
| 70 | +define('SO_DEBUG', 1); |
| 71 | +define('SO_REUSEADDR', 2); |
| 72 | +define('SO_REUSEPORT', 15); |
| 73 | +define('SO_KEEPALIVE', 9); |
| 74 | +define('SO_DONTROUTE', 5); |
| 75 | +define('SO_LINGER', 13); |
| 76 | +define('SO_BROADCAST', 6); |
| 77 | +define('SO_OOBINLINE', 10); |
| 78 | +define('SO_SNDBUF', 7); |
| 79 | +define('SO_RCVBUF', 8); |
| 80 | +define('SO_SNDLOWAT', 19); |
| 81 | +define('SO_RCVLOWAT', 18); |
| 82 | +define('SO_SNDTIMEO', 21); |
| 83 | +define('SO_RCVTIMEO', 20); |
| 84 | +define('SO_TYPE', 3); |
| 85 | +define('SO_ERROR', 4); |
| 86 | +define('SO_BINDTODEVICE', 25); |
| 87 | +define('SOL_SOCKET', 1); |
| 88 | +define('SOMAXCONN', 128); |
| 89 | +define('TCP_NODELAY', 1); |
| 90 | +define('PHP_NORMAL_READ', 1); |
| 91 | +define('PHP_BINARY_READ', 2); |
| 92 | +define('MCAST_JOIN_GROUP', 42); |
| 93 | +define('MCAST_LEAVE_GROUP', 45); |
| 94 | +define('MCAST_BLOCK_SOURCE', 43); |
| 95 | +define('MCAST_UNBLOCK_SOURCE', 44); |
| 96 | +define('MCAST_JOIN_SOURCE_GROUP', 46); |
| 97 | +define('MCAST_LEAVE_SOURCE_GROUP', 47); |
| 98 | +define('IP_MULTICAST_IF', 32); |
| 99 | +define('IP_MULTICAST_TTL', 33); |
| 100 | +define('IP_MULTICAST_LOOP', 34); |
| 101 | +define('IPV6_MULTICAST_IF', 17); |
| 102 | +define('IPV6_MULTICAST_HOPS', 18); |
| 103 | +define('IPV6_MULTICAST_LOOP', 19); |
| 104 | +define('IPV6_V6ONLY', 26); |
| 105 | +define('SOCKET_EPERM', 1); |
| 106 | +define('SOCKET_ENOENT', 2); |
| 107 | +define('SOCKET_EINTR', 4); |
| 108 | +define('SOCKET_EIO', 5); |
| 109 | +define('SOCKET_ENXIO', 6); |
| 110 | +define('SOCKET_E2BIG', 7); |
| 111 | +define('SOCKET_EBADF', 9); |
| 112 | +define('SOCKET_EAGAIN', 11); |
| 113 | +define('SOCKET_ENOMEM', 12); |
| 114 | +define('SOCKET_EACCES', 13); |
| 115 | +define('SOCKET_EFAULT', 14); |
| 116 | +define('SOCKET_ENOTBLK', 15); |
| 117 | +define('SOCKET_EBUSY', 16); |
| 118 | +define('SOCKET_EEXIST', 17); |
| 119 | +define('SOCKET_EXDEV', 18); |
| 120 | +define('SOCKET_ENODEV', 19); |
| 121 | +define('SOCKET_ENOTDIR', 20); |
| 122 | +define('SOCKET_EISDIR', 21); |
| 123 | +define('SOCKET_EINVAL', 22); |
| 124 | +define('SOCKET_ENFILE', 23); |
| 125 | +define('SOCKET_EMFILE', 24); |
| 126 | +define('SOCKET_ENOTTY', 25); |
| 127 | +define('SOCKET_ENOSPC', 28); |
| 128 | +define('SOCKET_ESPIPE', 29); |
| 129 | +define('SOCKET_EROFS', 30); |
| 130 | +define('SOCKET_EMLINK', 31); |
| 131 | +define('SOCKET_EPIPE', 32); |
| 132 | +define('SOCKET_ENAMETOOLONG', 36); |
| 133 | +define('SOCKET_ENOLCK', 37); |
| 134 | +define('SOCKET_ENOSYS', 38); |
| 135 | +define('SOCKET_ENOTEMPTY', 39); |
| 136 | +define('SOCKET_ELOOP', 40); |
| 137 | +define('SOCKET_EWOULDBLOCK', 11); |
| 138 | +define('SOCKET_ENOMSG', 42); |
| 139 | +define('SOCKET_EIDRM', 43); |
| 140 | +define('SOCKET_ECHRNG', 44); |
| 141 | +define('SOCKET_EL2NSYNC', 45); |
| 142 | +define('SOCKET_EL3HLT', 46); |
| 143 | +define('SOCKET_EL3RST', 47); |
| 144 | +define('SOCKET_ELNRNG', 48); |
| 145 | +define('SOCKET_EUNATCH', 49); |
| 146 | +define('SOCKET_ENOCSI', 50); |
| 147 | +define('SOCKET_EL2HLT', 51); |
| 148 | +define('SOCKET_EBADE', 52); |
| 149 | +define('SOCKET_EBADR', 53); |
| 150 | +define('SOCKET_EXFULL', 54); |
| 151 | +define('SOCKET_ENOANO', 55); |
| 152 | +define('SOCKET_EBADRQC', 56); |
| 153 | +define('SOCKET_EBADSLT', 57); |
| 154 | +define('SOCKET_ENOSTR', 60); |
| 155 | +define('SOCKET_ENODATA', 61); |
| 156 | +define('SOCKET_ETIME', 62); |
| 157 | +define('SOCKET_ENOSR', 63); |
| 158 | +define('SOCKET_ENONET', 64); |
| 159 | +define('SOCKET_EREMOTE', 66); |
| 160 | +define('SOCKET_ENOLINK', 67); |
| 161 | +define('SOCKET_EADV', 68); |
| 162 | +define('SOCKET_ESRMNT', 69); |
| 163 | +define('SOCKET_ECOMM', 70); |
| 164 | +define('SOCKET_EPROTO', 71); |
| 165 | +define('SOCKET_EMULTIHOP', 72); |
| 166 | +define('SOCKET_EBADMSG', 74); |
| 167 | +define('SOCKET_ENOTUNIQ', 76); |
| 168 | +define('SOCKET_EBADFD', 77); |
| 169 | +define('SOCKET_EREMCHG', 78); |
| 170 | +define('SOCKET_ERESTART', 85); |
| 171 | +define('SOCKET_ESTRPIPE', 86); |
| 172 | +define('SOCKET_EUSERS', 87); |
| 173 | +define('SOCKET_ENOTSOCK', 88); |
| 174 | +define('SOCKET_EDESTADDRREQ', 89); |
| 175 | +define('SOCKET_EMSGSIZE', 90); |
| 176 | +define('SOCKET_EPROTOTYPE', 91); |
| 177 | +define('SOCKET_ENOPROTOOPT', 92); |
| 178 | +define('SOCKET_EPROTONOSUPPORT', 93); |
| 179 | +define('SOCKET_ESOCKTNOSUPPORT', 94); |
| 180 | +define('SOCKET_EOPNOTSUPP', 95); |
| 181 | +define('SOCKET_EPFNOSUPPORT', 96); |
| 182 | +define('SOCKET_EAFNOSUPPORT', 97); |
| 183 | +define('SOCKET_EADDRINUSE', 98); |
| 184 | +define('SOCKET_EADDRNOTAVAIL', 99); |
| 185 | +define('SOCKET_ENETDOWN', 100); |
| 186 | +define('SOCKET_ENETUNREACH', 101); |
| 187 | +define('SOCKET_ENETRESET', 102); |
| 188 | +define('SOCKET_ECONNABORTED', 103); |
| 189 | +define('SOCKET_ECONNRESET', 104); |
| 190 | +define('SOCKET_ENOBUFS', 105); |
| 191 | +define('SOCKET_EISCONN', 106); |
| 192 | +define('SOCKET_ENOTCONN', 107); |
| 193 | +define('SOCKET_ESHUTDOWN', 108); |
| 194 | +define('SOCKET_ETOOMANYREFS', 109); |
| 195 | +define('SOCKET_ETIMEDOUT', 110); |
| 196 | +define('SOCKET_ECONNREFUSED', 111); |
| 197 | +define('SOCKET_EHOSTDOWN', 112); |
| 198 | +define('SOCKET_EHOSTUNREACH', 113); |
| 199 | +define('SOCKET_EALREADY', 114); |
| 200 | +define('SOCKET_EINPROGRESS', 115); |
| 201 | +define('SOCKET_EISNAM', 120); |
| 202 | +define('SOCKET_EREMOTEIO', 121); |
| 203 | +define('SOCKET_EDQUOT', 122); |
| 204 | +define('SOCKET_ENOMEDIUM', 123); |
| 205 | +define('SOCKET_EMEDIUMTYPE', 124); |
| 206 | +define('IPPROTO_IP', 0); |
| 207 | +define('IPPROTO_IPV6', 41); |
| 208 | +define('SOL_TCP', 6); |
| 209 | +define('SOL_UDP', 17); |
| 210 | +define('IPV6_UNICAST_HOPS', 16); |
| 211 | +define('IPV6_RECVPKTINFO', 49); |
| 212 | +define('IPV6_PKTINFO', 50); |
| 213 | +define('IPV6_RECVHOPLIMIT', 51); |
| 214 | +define('IPV6_HOPLIMIT', 52); |
| 215 | +define('IPV6_RECVTCLASS', 66); |
| 216 | +define('IPV6_TCLASS', 67); |
| 217 | +define('SCM_RIGHTS', 1); |
| 218 | +define('SCM_CREDENTIALS', 2); |
| 219 | +define('SO_PASSCRED', 16); |
| 220 | +define('SOCKET_EPROCLIM', 10067); |
| 221 | +define('SOCKET_ESTALE', 10070); |
| 222 | +define('SOCKET_EDISCON', 10101); |
| 223 | +define('SOCKET_SYSNOTREADY', 10091); |
| 224 | +define('SOCKET_VERNOTSUPPORTED', 10092); |
| 225 | +define('SOCKET_NOTINITIALISED', 10093); |
| 226 | +define('SOCKET_HOST_NOT_FOUND', 11001); |
| 227 | +define('SOCKET_TRY_AGAIN', 11002); |
| 228 | +define('SOCKET_NO_RECOVERY', 11003); |
| 229 | +define('SOCKET_NO_DATA', 11004); |
| 230 | +define('SOCKET_NO_ADDRESS', 11004); |
| 231 | +define('AI_PASSIVE', 1); |
| 232 | +define('AI_CANONNAME', 2); |
| 233 | +define('AI_NUMERICHOST', 4); |
| 234 | +define('AI_ADDRCONFIG', 32); |
| 235 | +define('AI_NUMERICSERV', 1024); |
| 236 | +define('AI_V4MAPPED', 8); |
| 237 | +define('AI_ALL', 16); |
| 238 | + |
| 239 | +final class Socket |
| 240 | +{ |
| 241 | + private function __construct() {} |
| 242 | +} |
| 243 | +final class AddressInfo |
| 244 | +{ |
| 245 | + private function __construct() {} |
| 246 | +} |
0 commit comments