sockets.stub.php 3.9 KB

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