Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
|
#include "rubysocket.h"
Go to the source code of this file.
Data Structures | |
struct | recvfrom_arg |
struct | connect_arg |
struct | accept_arg |
Macros | |
#define | do_write_retry(code) ret = code |
Functions | |
void | rsock_raise_socket_error (const char *reason, int error) |
VALUE | rsock_init_sock (VALUE sock, int fd) |
VALUE | rsock_sendto_blocking (void *data) |
VALUE | rsock_send_blocking (void *data) |
VALUE | rsock_s_recvfrom (VALUE sock, int argc, VALUE *argv, enum sock_recv_type from) |
VALUE | rsock_s_recvfrom_nonblock (VALUE sock, VALUE len, VALUE flg, VALUE str, VALUE ex, enum sock_recv_type from) |
int | rsock_socket (int domain, int type, int proto) |
int | rsock_connect (int fd, const struct sockaddr *sockaddr, int len, int socks, struct timeval *timeout) |
void | rsock_make_fd_nonblock (int fd) |
VALUE | rsock_s_accept_nonblock (VALUE klass, VALUE ex, rb_io_t *fptr, struct sockaddr *sockaddr, socklen_t *len) |
VALUE | rsock_s_accept (VALUE klass, int fd, struct sockaddr *sockaddr, socklen_t *len) |
int | rsock_getfamily (rb_io_t *fptr) |
void | rsock_init_socket_init (void) |
Variables | |
VALUE | rb_cBasicSocket |
VALUE | rb_cIPSocket |
VALUE | rb_cTCPSocket |
VALUE | rb_cTCPServer |
VALUE | rb_cUDPSocket |
VALUE | rb_cSocket |
VALUE | rb_cAddrinfo |
VALUE | rb_eSocket |
int | rsock_do_not_reverse_lookup = 1 |
int rsock_connect | ( | int | fd, |
const struct sockaddr * | sockaddr, | ||
int | len, | ||
int | socks, | ||
struct timeval * | timeout | ||
) |
Definition at line 559 of file init.c.
References BLOCKING_REGION_FD, EINPROGRESS, connect_arg::fd, int(), len, connect_arg::len, and connect_arg::sockaddr.
Definition at line 720 of file init.c.
References union_sockaddr::addr, AF_UNSPEC, rb_io_t::fd, FMODE_INET, FMODE_INET6, FMODE_SOCK, FMODE_UNIX, and rb_io_t::mode.
Definition at line 78 of file init.c.
References rb_io_t::fd, FMODE_DUPLEX, FMODE_NOREVLOOKUP, FMODE_READWRITE, is_socket, MakeOpenFile, rb_io_t::mode, rb_io_ascii8bit_binmode(), rb_io_synchronized(), rb_reserved_fd_p(), rb_syserr_fail(), rb_update_max_fd(), and rsock_do_not_reverse_lookup.
Referenced by rsock_s_accept(), and rsock_s_accept_nonblock().
void rsock_init_socket_init | ( | void | ) |
Definition at line 752 of file init.c.
References ID2SYM, rb_define_class(), rb_eSocket, rb_eStandardError, rb_intern(), rsock_init_addrinfo(), rsock_init_ancdata(), rsock_init_ipsocket(), rsock_init_socket_constants(), rsock_init_sockifaddr(), rsock_init_sockopt(), rsock_init_sockssocket(), rsock_init_tcpserver(), rsock_init_tcpsocket(), rsock_init_udpsocket(), rsock_init_unixserver(), and rsock_init_unixsocket().
Referenced by Init_socket().
void rsock_make_fd_nonblock | ( | int | fd | ) |
Definition at line 590 of file init.c.
References F_SETFL, fcntl(), connect_arg::fd, O_NONBLOCK, and rb_sys_fail().
Definition at line 39 of file init.c.
References EAI_SYSTEM, error(), gai_strerror(), rb_default_internal_encoding(), rb_eSocket, rb_exc_new_str(), rb_exc_raise(), rb_raise(), rb_sprintf(), rb_str_concat(), rb_syserr_fail(), and rb_w32_conv_from_wchar().
Referenced by rsock_getaddrinfo(), rsock_inspect_sockaddr(), and rsock_ipaddr().
Definition at line 685 of file init.c.
References BLOCKING_REGION_FD, accept_arg::fd, int(), INT2NUM, len, accept_arg::len, rb_gc(), rb_io_wait_readable(), rb_obj_alloc(), rb_syserr_fail(), rb_update_max_fd(), rsock_init_sock(), rsock_maybe_wait_fd, and accept_arg::sockaddr.
VALUE rsock_s_accept_nonblock | ( | VALUE | klass, |
VALUE | ex, | ||
rb_io_t * | fptr, | ||
struct sockaddr * | sockaddr, | ||
socklen_t * | len | ||
) |
Definition at line 643 of file init.c.
References ECONNABORTED, EWOULDBLOCK, rb_io_t::fd, len, Qfalse, rb_io_set_nonblock(), RB_IO_WAIT_READABLE, rb_obj_alloc(), rb_readwrite_syserr_fail(), rb_syserr_fail(), rb_update_max_fd(), rsock_init_sock(), and connect_arg::sockaddr.
VALUE rsock_s_recvfrom | ( | VALUE | sock, |
int | argc, | ||
VALUE * | argv, | ||
enum sock_recv_type | from | ||
) |
Definition at line 169 of file init.c.
References union_sockaddr::addr, recvfrom_arg::alen, argc, argv, recvfrom_arg::buf, recvfrom_arg::fd, rb_io_t::fd, recvfrom_arg::flags, FMODE_NOREVLOOKUP, GetOpenFile, len, recvfrom_arg::length, long(), rb_io_t::mode, NUM2INT, Qnil, rb_assoc_new(), rb_bug(), rb_eIOError, rb_eTypeError, rb_io_check_closed(), rb_io_read_pending(), rb_io_wait_readable(), rb_raise(), rb_scan_args(), rb_str_locktmp_ensure(), rb_str_set_len(), rb_sys_fail(), RECV_IP, RECV_RECV, RECV_SOCKET, RECV_UNIX, rsock_io_socket_addrinfo(), rsock_ipaddr(), rsock_maybe_wait_fd, str, and recvfrom_arg::str.
VALUE rsock_s_recvfrom_nonblock | ( | VALUE | sock, |
VALUE | len, | ||
VALUE | flg, | ||
VALUE | str, | ||
VALUE | ex, | ||
enum sock_recv_type | from | ||
) |
Definition at line 231 of file init.c.
References recvfrom_arg::alen, EWOULDBLOCK, recvfrom_arg::fd, rb_io_t::fd, recvfrom_arg::flags, FMODE_NOREVLOOKUP, GetOpenFile, len, rb_io_t::mode, MSG_DONTWAIT_RELIABLE, NUM2INT, Qfalse, Qnil, rb_assoc_new(), rb_bug(), rb_eIOError, rb_io_check_closed(), rb_io_read_pending(), rb_io_set_nonblock(), RB_IO_WAIT_READABLE, rb_raise(), rb_readwrite_syserr_fail(), rb_str_set_len(), rb_syserr_fail(), RECV_IP, RECV_RECV, RECV_SOCKET, rsock_io_socket_addrinfo(), rsock_ipaddr(), RSTRING_LEN, RSTRING_PTR, and str.
VALUE rsock_send_blocking | ( | void * | data | ) |
Definition at line 111 of file init.c.
References do_write_retry, rsock_send_arg::fd, rsock_send_arg::flags, rsock_send_arg::mesg, RSTRING_LEN, and RSTRING_PTR.
Referenced by rsock_bsock_send().
VALUE rsock_sendto_blocking | ( | void * | data | ) |
Definition at line 100 of file init.c.
References do_write_retry, rsock_send_arg::fd, rsock_send_arg::flags, rsock_send_arg::mesg, RSTRING_LEN, RSTRING_PTR, rsock_send_arg::to, and rsock_send_arg::tolen.
Referenced by rsock_bsock_send().
Definition at line 437 of file init.c.
References recvfrom_arg::fd, rb_gc_for_fd(), and rb_update_max_fd().
VALUE rb_cAddrinfo |
Definition at line 27 of file init.c.
Referenced by rsock_addrinfo_new(), and rsock_init_addrinfo().
VALUE rb_cBasicSocket |
Definition at line 17 of file init.c.
Referenced by Init_socket(), rsock_init_basicsocket(), rsock_init_ipsocket(), and rsock_init_unixsocket().
VALUE rb_cIPSocket |
Definition at line 18 of file init.c.
Referenced by rsock_init_ipsocket(), rsock_init_tcpsocket(), and rsock_init_udpsocket().
VALUE rb_cSocket |
Definition at line 26 of file init.c.
Referenced by Init_socket(), rsock_init_ancdata(), rsock_init_sockifaddr(), and rsock_init_sockopt().
VALUE rb_cTCPServer |
Definition at line 20 of file init.c.
Referenced by rsock_init_tcpserver().
VALUE rb_cTCPSocket |
Definition at line 19 of file init.c.
Referenced by rsock_init_sockssocket(), rsock_init_tcpserver(), and rsock_init_tcpsocket().
VALUE rb_cUDPSocket |
Definition at line 21 of file init.c.
Referenced by rsock_init_udpsocket().
VALUE rb_eSocket |
Definition at line 29 of file init.c.
Referenced by rsock_getaddrinfo(), rsock_init_socket_init(), and rsock_raise_socket_error().
int rsock_do_not_reverse_lookup = 1 |
Definition at line 35 of file init.c.
Referenced by rsock_init_sock().