Lines Matching refs:php_sock

519 	php_socket	*php_sock;  local
532 php_sock = Z_SOCKET_P(element);
533 if (IS_INVALID_SOCKET(php_sock)) {
538 PHP_SAFE_FD_SET(php_sock->bsd_socket, fds);
539 if (php_sock->bsd_socket > *max_fd) {
540 *max_fd = php_sock->bsd_socket;
553 php_socket *php_sock; local
564 php_sock = Z_SOCKET_P(element);
565 ZEND_ASSERT(php_sock); /* element is supposed to be Socket object */
566 ZEND_ASSERT(!IS_INVALID_SOCKET(php_sock));
568 if (PHP_SAFE_FD_ISSET(php_sock->bsd_socket, fds)) {
674 php_socket *php_sock; local
684 php_sock = Z_SOCKET_P(return_value);
686 if (!php_open_listen_sock(php_sock, port, backlog)) {
691 php_sock->error = 0;
692 php_sock->blocking = 1;
700 php_socket *php_sock, *new_sock; local
708 php_sock = Z_SOCKET_P(arg1);
709 ENSURE_SOCKET_VALID(php_sock);
714 if (!php_accept_connect(php_sock, new_sock, (struct sockaddr*)&sa, &php_sa_len)) {
725 php_socket *php_sock; local
731 php_sock = Z_SOCKET_P(arg1);
732 ENSURE_SOCKET_VALID(php_sock);
734 if (!Z_ISUNDEF(php_sock->zstream)) {
737 …stream = zend_fetch_resource2_ex(&php_sock->zstream, NULL, php_file_le_stream(), php_file_le_pstre…
741 php_sock->blocking = 0;
747 if (php_set_sock_blocking(php_sock->bsd_socket, 0) == SUCCESS) {
748 php_sock->blocking = 0;
751 PHP_SOCKET_ERROR(php_sock, "unable to set nonblocking mode", errno);
761 php_socket *php_sock; local
767 php_sock = Z_SOCKET_P(arg1);
768 ENSURE_SOCKET_VALID(php_sock);
773 if (!Z_ISUNDEF(php_sock->zstream)) {
775 …stream = zend_fetch_resource2_ex(&php_sock->zstream, NULL, php_file_le_stream(), php_file_le_pstre…
779 php_sock->blocking = 1;
785 if (php_set_sock_blocking(php_sock->bsd_socket, 1) == SUCCESS) {
786 php_sock->blocking = 1;
789 PHP_SOCKET_ERROR(php_sock, "unable to set blocking mode", errno);
799 php_socket *php_sock; local
808 php_sock = Z_SOCKET_P(arg1);
809 ENSURE_SOCKET_VALID(php_sock);
811 if (listen(php_sock->bsd_socket, backlog) != 0) {
812 PHP_SOCKET_ERROR(php_sock, "unable to listen on socket", errno);
857 php_socket *php_sock; local
871 php_sock = Z_SOCKET_P(arg1);
872 ENSURE_SOCKET_VALID(php_sock);
884 retval = write(php_sock->bsd_socket, str, MIN(length, str_len));
886 retval = send(php_sock->bsd_socket, str, min(length, str_len), 0);
890 PHP_SOCKET_ERROR(php_sock, "unable to write to socket", errno);
902 php_socket *php_sock; local
914 php_sock = Z_SOCKET_P(arg1);
915 ENSURE_SOCKET_VALID(php_sock);
925 retval = php_read(php_sock, ZSTR_VAL(tmpbuf), length, 0);
927 retval = recv(php_sock->bsd_socket, ZSTR_VAL(tmpbuf), length, 0);
934 php_sock->error = errno;
937 PHP_SOCKET_ERROR(php_sock, "unable to read from socket", errno);
960 php_socket *php_sock; local
978 php_sock = Z_SOCKET_P(arg1);
979 ENSURE_SOCKET_VALID(php_sock);
983 if (getsockname(php_sock->bsd_socket, sa, &salen) != 0) {
984 PHP_SOCKET_ERROR(php_sock, "unable to retrieve socket name", errno);
1031 php_socket *php_sock; local
1049 php_sock = Z_SOCKET_P(arg1);
1050 ENSURE_SOCKET_VALID(php_sock);
1054 if (getpeername(php_sock->bsd_socket, sa, &salen) < 0) {
1055 PHP_SOCKET_ERROR(php_sock, "unable to retrieve peer name", errno);
1104 php_socket *php_sock; local
1137 php_sock = Z_SOCKET_P(return_value);
1139 php_sock->bsd_socket = socket(domain, type, protocol);
1140 php_sock->type = domain;
1142 if (IS_INVALID_SOCKET(php_sock)) {
1149 php_sock->error = 0;
1150 php_sock->blocking = 1;
1158 php_socket *php_sock; local
1172 php_sock = Z_SOCKET_P(resource_socket);
1173 ENSURE_SOCKET_VALID(php_sock);
1175 switch(php_sock->type) {
1190 if (! php_set_inet6_addr(&sin6, addr, php_sock)) {
1194 retval = connect(php_sock->bsd_socket, (struct sockaddr *)&sin6, sizeof(struct sockaddr_in6));
1209 if (! php_set_inet_addr(&sin, addr, php_sock)) {
1213 retval = connect(php_sock->bsd_socket, (struct sockaddr *)&sin, sizeof(struct sockaddr_in));
1227 retval = connect(php_sock->bsd_socket, (struct sockaddr *) &s_un,
1238 PHP_SOCKET_ERROR(php_sock, "unable to connect", errno);
1270 php_socket *php_sock; local
1283 php_sock = Z_SOCKET_P(arg1);
1284 ENSURE_SOCKET_VALID(php_sock);
1286 switch(php_sock->type) {
1299 retval = bind(php_sock->bsd_socket, (struct sockaddr *) sa,
1311 if (! php_set_inet_addr(sa, addr, php_sock)) {
1315 retval = bind(php_sock->bsd_socket, (struct sockaddr *)sa, sizeof(struct sockaddr_in));
1326 if (! php_set_inet6_addr(sa, addr, php_sock)) {
1330 retval = bind(php_sock->bsd_socket, (struct sockaddr *)sa, sizeof(struct sockaddr_in6));
1340 PHP_SOCKET_ERROR(php_sock, "Unable to bind address", errno);
1353 php_socket *php_sock; local
1364 php_sock = Z_SOCKET_P(php_sock_res);
1365 ENSURE_SOCKET_VALID(php_sock);
1374 if ((retval = recv(php_sock->bsd_socket, ZSTR_VAL(recv_buf), len, flags)) < 1) {
1384 PHP_SOCKET_ERROR(php_sock, "Unable to read from socket", errno);
1396 php_socket *php_sock; local
1408 php_sock = Z_SOCKET_P(arg1);
1409 ENSURE_SOCKET_VALID(php_sock);
1416 retval = send(php_sock->bsd_socket, buf, (buf_len < (size_t)len ? buf_len : (size_t)len), flags);
1419 PHP_SOCKET_ERROR(php_sock, "Unable to write to socket", errno);
1431 php_socket *php_sock; local
1454 php_sock = Z_SOCKET_P(arg1);
1455 ENSURE_SOCKET_VALID(php_sock);
1466 switch (php_sock->type) {
1472 …retval = recvfrom(php_sock->bsd_socket, ZSTR_VAL(recv_buf), arg3, arg4, (struct sockaddr *)&s_un, …
1475 PHP_SOCKET_ERROR(php_sock, "Unable to recvfrom", errno);
1496 …retval = recvfrom(php_sock->bsd_socket, ZSTR_VAL(recv_buf), arg3, arg4, (struct sockaddr *)&sin, (…
1499 PHP_SOCKET_ERROR(php_sock, "Unable to recvfrom", errno);
1523 …retval = recvfrom(php_sock->bsd_socket, ZSTR_VAL(recv_buf), arg3, arg4, (struct sockaddr *)&sin6, …
1526 PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno);
1554 php_socket *php_sock; local
1576 php_sock = Z_SOCKET_P(arg1);
1577 ENSURE_SOCKET_VALID(php_sock);
1584 switch (php_sock->type) {
1590 …retval = sendto(php_sock->bsd_socket, buf, ((size_t)len > buf_len) ? buf_len : (size_t)len, flags,…
1603 if (! php_set_inet_addr(&sin, addr, php_sock)) {
1607 …retval = sendto(php_sock->bsd_socket, buf, ((size_t)len > buf_len) ? buf_len : (size_t)len, flags,…
1620 if (! php_set_inet6_addr(&sin6, addr, php_sock)) {
1624 …retval = sendto(php_sock->bsd_socket, buf, ((size_t)len > buf_len) ? buf_len : (size_t)len, flags,…
1633 PHP_SOCKET_ERROR(php_sock, "Unable to write to socket", errno);
1653 php_socket *php_sock; local
1663 php_sock = Z_SOCKET_P(arg1);
1664 ENSURE_SOCKET_VALID(php_sock);
1672 if (getsockopt(php_sock->bsd_socket, level, optname, (char*)&if_addr, &optlen) != 0) {
1673 PHP_SOCKET_ERROR(php_sock, "Unable to retrieve socket option", errno);
1676 if (php_add4_to_if_index(&if_addr, php_sock, &if_index) == SUCCESS) {
1686 int ret = php_do_getsockopt_ipv6_rfc3542(php_sock, level, optname, return_value);
1701 if (getsockopt(php_sock->bsd_socket, level, optname, name, &optlen) != 0) {
1702 PHP_SOCKET_ERROR(php_sock, "Unable to retrieve socket option", errno);
1719 if (getsockopt(php_sock->bsd_socket, level, optname, &tsf, &optlen) != 0) {
1720 PHP_SOCKET_ERROR(php_sock, "Unable to retrieve socket option", errno);
1742 if (getsockopt(php_sock->bsd_socket, level, optname, (char*)&linger_val, &optlen) != 0) {
1743 PHP_SOCKET_ERROR(php_sock, "Unable to retrieve socket option", errno);
1756 if (getsockopt(php_sock->bsd_socket, level, optname, (char*)&timeout, &optlen) != 0) {
1757 PHP_SOCKET_ERROR(php_sock, "Unable to retrieve socket option", errno);
1779 if (getsockopt(php_sock->bsd_socket, level, optname, (char*)minfo, &optlen) != 0) {
1780 PHP_SOCKET_ERROR(php_sock, "Unable to retrieve socket option", errno);
1811 if (getsockopt(php_sock->bsd_socket, level, optname, (char*)&af, &optlen) != 0) {
1812 PHP_SOCKET_ERROR(php_sock, "Unable to retrieve socket option", errno);
1835 if (getsockopt(php_sock->bsd_socket, level, optname, (char*)fi, &optlen) != 0) {
1836 PHP_SOCKET_ERROR(php_sock, "Unable to retrieve socket option", errno);
1854 if (getsockopt(php_sock->bsd_socket, level, optname, (char*)&other_val, &optlen) != 0) {
1855 PHP_SOCKET_ERROR(php_sock, "Unable to retrieve socket option", errno);
1872 php_socket *php_sock; local
1892 php_sock = Z_SOCKET_P(arg1);
1893 ENSURE_SOCKET_VALID(php_sock);
1906 int res = php_do_setsockopt_ip_mcast(php_sock, level, optname, arg4);
1912 int res = php_do_setsockopt_ipv6_mcast(php_sock, level, optname, arg4);
1914 res = php_do_setsockopt_ipv6_rfc3542(php_sock, level, optname, arg4);
1931 if (setsockopt(php_sock->bsd_socket, level, optname, opt_ptr, optlen) != 0) {
1932 PHP_SOCKET_ERROR(php_sock, "Unable to set socket option", errno);
1951 if (setsockopt(php_sock->bsd_socket, level, optname, opt_ptr, optlen) != 0) {
1952 PHP_SOCKET_ERROR(php_sock, "Unable to set socket option", errno);
2158 retval = setsockopt(php_sock->bsd_socket, level, optname, opt_ptr, optlen);
2160 PHP_SOCKET_ERROR(php_sock, "Unable to set socket option", errno);
2173 php_socket *php_sock[2]; local
2209 php_sock[0] = Z_SOCKET_P(&retval[0]);
2212 php_sock[1] = Z_SOCKET_P(&retval[1]);
2229 php_sock[0]->bsd_socket = fds_array[0];
2230 php_sock[1]->bsd_socket = fds_array[1];
2231 php_sock[0]->type = domain;
2232 php_sock[1]->type = domain;
2233 php_sock[0]->error = 0;
2234 php_sock[1]->error = 0;
2235 php_sock[0]->blocking = 1;
2236 php_sock[1]->blocking = 1;
2252 php_socket *php_sock; local
2260 php_sock = Z_SOCKET_P(arg1);
2261 ENSURE_SOCKET_VALID(php_sock);
2263 if (shutdown(php_sock->bsd_socket, how_shutdown) != 0) {
2264 PHP_SOCKET_ERROR(php_sock, "Unable to shutdown socket", errno);
2277 php_socket *php_sock; local
2284 php_sock = Z_SOCKET_P(arg1);
2285 ENSURE_SOCKET_VALID(php_sock);
2287 r = sockatmark(php_sock->bsd_socket);
2289 PHP_SOCKET_ERROR(php_sock, "Unable to apply sockmark", errno);
2303 php_socket *php_sock; local
2311 php_sock = Z_SOCKET_P(arg1);
2312 ENSURE_SOCKET_VALID(php_sock);
2314 RETVAL_LONG(php_sock->error);
2325 php_socket *php_sock; local
2333 php_sock = Z_SOCKET_P(arg1);
2334 ENSURE_SOCKET_VALID(php_sock);
2336 php_sock->error = 0;
2603 php_socket *php_sock; local
2612 php_sock = Z_SOCKET_P(return_value);
2614php_sock->bsd_socket = socket(ai->addrinfo.ai_family, ai->addrinfo.ai_socktype, ai->addrinfo.ai_pr…
2615 php_sock->type = ai->addrinfo.ai_family;
2617 if (IS_INVALID_SOCKET(php_sock)) {
2624 php_sock->error = 0;
2625 php_sock->blocking = 1;
2627 switch(php_sock->type) {
2631 close(php_sock->bsd_socket);
2641 retval = bind(php_sock->bsd_socket, ai->addrinfo.ai_addr, ai->addrinfo.ai_addrlen);
2645 close(php_sock->bsd_socket);
2652 PHP_SOCKET_ERROR(php_sock, "Unable to bind address", errno);
2653 close(php_sock->bsd_socket);
2666 php_socket *php_sock; local
2675 php_sock = Z_SOCKET_P(return_value);
2677php_sock->bsd_socket = socket(ai->addrinfo.ai_family, ai->addrinfo.ai_socktype, ai->addrinfo.ai_pr…
2678 php_sock->type = ai->addrinfo.ai_family;
2680 if (IS_INVALID_SOCKET(php_sock)) {
2687 php_sock->error = 0;
2688 php_sock->blocking = 1;
2690 switch(php_sock->type) {
2694 close(php_sock->bsd_socket);
2704 retval = connect(php_sock->bsd_socket, ai->addrinfo.ai_addr, ai->addrinfo.ai_addrlen);
2709 close(php_sock->bsd_socket);
2715 PHP_SOCKET_ERROR(php_sock, "Unable to connect address", errno);
2716 close(php_sock->bsd_socket);
2840 php_socket *php_sock; local
2882 php_sock = Z_SOCKET_P(return_value);
2884 php_sock->bsd_socket = sock;
2885 php_sock->type = wi.iAddressFamily;
2886 php_sock->error = 0;
2887 php_sock->blocking = 1;