Lines Matching refs:sock
265 int socket_recv_queue (struct link_socket *sock, int maxsize);
267 int socket_send_queue (struct link_socket *sock,
299 link_socket_init_phase1 (struct link_socket *sock,
333 void link_socket_init_phase2 (struct link_socket *sock,
341 void link_socket_close (struct link_socket *sock);
559 link_socket_connection_oriented (const struct link_socket *sock)
561 if (sock)
562 return link_socket_proto_connection_oriented (sock->info.proto);
718 socket_foreign_protocol_detected (const struct link_socket *sock)
720 return link_socket_connection_oriented (sock)
721 && sock->stream_buf.port_share_state == PS_FOREIGN;
725 socket_foreign_protocol_head (const struct link_socket *sock)
727 return &sock->stream_buf.buf;
731 socket_foreign_protocol_sd (const struct link_socket *sock)
733 return sock->sd;
739 socket_connection_reset (const struct link_socket *sock, int status)
741 if (link_socket_connection_oriented (sock))
743 if (sock->stream_reset || sock->stream_buf.error)
838 stream_buf_read_setup (struct link_socket* sock)
840 bool stream_buf_read_setup_dowork (struct link_socket* sock);
841 if (link_socket_connection_oriented (sock))
842 return stream_buf_read_setup_dowork (sock);
851 int link_socket_read_tcp (struct link_socket *sock,
857 link_socket_read_udp_win32 (struct link_socket *sock,
861 return socket_finalize (sock->sd, &sock->reads, buf, from);
866 int link_socket_read_udp_posix (struct link_socket *sock,
875 link_socket_read (struct link_socket *sock,
880 if (proto_is_udp(sock->info.proto)) /* unified UDPv4 and UDPv6 */
885 res = link_socket_read_udp_win32 (sock, buf, from);
887 res = link_socket_read_udp_posix (sock, buf, maxsize, from);
891 else if (proto_is_tcp(sock->info.proto)) /* unified TCPv4 and TCPv6 */
894 addr_copy_sa(&from->dest, &sock->info.lsa->actual.dest);
895 return link_socket_read_tcp (sock, buf);
908 int link_socket_write_tcp (struct link_socket *sock,
915 link_socket_write_win32 (struct link_socket *sock,
921 if (overlapped_io_active (&sock->writes))
923 status = socket_finalize (sock->sd, &sock->writes, NULL, NULL);
927 socket_send_queue (sock, buf, to);
940 link_socket_write_udp_posix (struct link_socket *sock,
945 int link_socket_write_udp_posix_sendmsg (struct link_socket *sock,
949 if (proto_is_udp(sock->info.proto) && (sock->sockflags & SF_USE_IP_PKTINFO)
951 return link_socket_write_udp_posix_sendmsg (sock, buf, to);
954 return sendto (sock->sd, BPTR (buf), BLEN (buf), 0,
960 link_socket_write_tcp_posix (struct link_socket *sock,
964 return send (sock->sd, BPTR (buf), BLEN (buf), MSG_NOSIGNAL);
970 link_socket_write_udp (struct link_socket *sock,
975 return link_socket_write_win32 (sock, buf, to);
977 return link_socket_write_udp_posix (sock, buf, to);
983 link_socket_write (struct link_socket *sock,
987 if (proto_is_udp(sock->info.proto)) /* unified UDPv4 and UDPv6 */
989 return link_socket_write_udp (sock, buf, to);
991 else if (proto_is_tcp(sock->info.proto)) /* unified TCPv4 and TCPv6 */
993 return link_socket_write_tcp (sock, buf, to);