Ruby
2.4.2p198(2017-09-14revision59899)
|
#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#include "internal.h"
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <errno.h>
#include "addrinfo.h"
#include "sockport.h"
#include "constdefs.h"
Go to the source code of this file.
Data Structures | |
struct | sockaddr_storage |
union | union_sockaddr |
struct | rb_addrinfo |
struct | rsock_send_arg |
Typedefs | |
typedef int | socklen_t |
Enumerations | |
enum | sock_recv_type { RECV_RECV, RECV_IP, RECV_UNIX, RECV_SOCKET } |
#define _SS_ALIGNSIZE (sizeof(double)) |
Definition at line 168 of file rubysocket.h.
#define _SS_MAXSIZE 128 |
Definition at line 167 of file rubysocket.h.
#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) * 2) |
Definition at line 169 of file rubysocket.h.
#define _SS_PAD2SIZE |
Definition at line 170 of file rubysocket.h.
#define BLOCKING_REGION_FD | ( | func, | |
arg | |||
) | (long)rb_thread_io_blocking_region((func), (arg), (arg)->fd) |
Definition at line 262 of file rubysocket.h.
Referenced by rsock_bsock_send(), rsock_connect(), rsock_s_accept(), and udp_send_internal().
#define EWOULDBLOCK EAGAIN |
Definition at line 128 of file rubysocket.h.
Referenced by mustbe_callable(), rb_exec_async_signal_safe(), rb_file_flock(), rb_w32_read(), rb_w32_strerror(), rb_w32_write(), rsock_s_accept_nonblock(), rsock_s_recvfrom_nonblock(), and set_syserr().
#define FMODE_INET 0x00400000 |
Definition at line 231 of file rubysocket.h.
Referenced by rsock_getfamily().
#define FMODE_INET6 0x00800000 |
Definition at line 232 of file rubysocket.h.
Referenced by rsock_getfamily().
#define FMODE_NOREVLOOKUP 0x100 |
Definition at line 227 of file rubysocket.h.
Referenced by bsock_do_not_reverse_lookup(), bsock_do_not_reverse_lookup_set(), ip_addr(), ip_peeraddr(), rsock_init_sock(), rsock_s_recvfrom(), and rsock_s_recvfrom_nonblock().
#define FMODE_SOCK (FMODE_UNIX|FMODE_INET|FMODE_INET6) |
Definition at line 233 of file rubysocket.h.
Referenced by rsock_getfamily().
#define FMODE_UNIX 0x00200000 |
Definition at line 230 of file rubysocket.h.
Referenced by rsock_getfamily().
#define IN6_IS_ADDR_UNIQUE_LOCAL | ( | a | ) | (((a)->s6_addr[0] == 0xfc) || ((a)->s6_addr[0] == 0xfd)) |
Definition at line 160 of file rubysocket.h.
Referenced by addrinfo_ipv4_multicast_p().
#define INET_CLIENT 0 |
Definition at line 221 of file rubysocket.h.
Referenced by tcp_init().
#define INET_SERVER 1 |
Definition at line 222 of file rubysocket.h.
Referenced by init_inetsock_internal(), and tcp_svr_init().
#define INET_SOCKS 2 |
Definition at line 223 of file rubysocket.h.
Referenced by init_inetsock_internal().
#define IS_IP_FAMILY | ( | af | ) | ((af) == AF_INET) |
Definition at line 156 of file rubysocket.h.
Referenced by addrinfo_ip_address(), addrinfo_ip_p(), addrinfo_ip_port(), addrinfo_ip_unpack(), addrinfo_mdump(), addrinfo_mload(), rsock_cmsg_type_arg(), rsock_level_arg(), rsock_optname_arg(), sock_s_unpack_sockaddr_in(), and sockopt_inspect().
#define MSG_DONTWAIT_RELIABLE 0 |
Definition at line 430 of file rubysocket.h.
Referenced by rsock_s_recvfrom_nonblock().
#define pseudo_AF_FTIP pseudo_AF_RTIP |
Definition at line 138 of file rubysocket.h.
#define rsock_bsock_recvmsg rb_f_notimplement |
Definition at line 371 of file rubysocket.h.
Referenced by rsock_init_basicsocket().
#define rsock_bsock_recvmsg_nonblock rb_f_notimplement |
Definition at line 372 of file rubysocket.h.
Referenced by rsock_init_basicsocket().
#define rsock_bsock_sendmsg rb_f_notimplement |
Definition at line 360 of file rubysocket.h.
Referenced by rsock_init_basicsocket().
#define rsock_bsock_sendmsg_nonblock rb_f_notimplement |
Definition at line 361 of file rubysocket.h.
Referenced by rsock_init_basicsocket().
#define rsock_maybe_fd_writable | ( | fd | ) | rb_thread_fd_writable((fd)) |
Definition at line 421 of file rubysocket.h.
Referenced by rsock_bsock_send(), and udp_send_internal().
#define rsock_maybe_wait_fd | ( | fd | ) | rb_thread_wait_fd((fd)) |
Definition at line 422 of file rubysocket.h.
Referenced by rsock_s_accept(), and rsock_s_recvfrom().
#define RSTRING_SOCKLEN (socklen_t)RSTRING_LENINT |
Definition at line 124 of file rubysocket.h.
Referenced by addrinfo_initialize(), bsock_setsockopt(), rsock_bsock_send(), rsock_ipaddr(), sock_bind(), sock_connect(), sock_connect_nonblock(), sock_s_gethostbyaddr(), sock_s_getnameinfo(), and sock_s_unpack_sockaddr_in().
#define SockAddrStringValue | ( | v | ) | rsock_sockaddr_string_value(&(v)) |
Definition at line 264 of file rubysocket.h.
Referenced by rsock_bsock_send().
#define SockAddrStringValuePtr | ( | v | ) | rsock_sockaddr_string_value_ptr(&(v)) |
Definition at line 265 of file rubysocket.h.
Referenced by sock_s_unpack_sockaddr_in().
#define SockAddrStringValueWithAddrinfo | ( | v, | |
rai_ret | |||
) | rsock_sockaddr_string_value_with_addrinfo(&(v), &(rai_ret)) |
Definition at line 266 of file rubysocket.h.
Referenced by sock_bind(), sock_connect(), and sock_connect_nonblock().
#define SOCKLEN_MAX |
Definition at line 118 of file rubysocket.h.
Referenced by rsock_ipaddr().
typedef int socklen_t |
Definition at line 108 of file rubysocket.h.
enum sock_recv_type |
Enumerator | |
---|---|
RECV_RECV | |
RECV_IP | |
RECV_UNIX | |
RECV_SOCKET |
Definition at line 334 of file rubysocket.h.
Definition at line 651 of file option.c.
References memcpy, and snprintf.
Referenced by getnameinfo(), and rb_if_indextoname().
NORETURN | ( | void | rsock_raise_socket_errorconst char *, int | ) |
NORETURN | ( | void | rsock_syserr_fail_host_portint err, const char *, VALUE, VALUE | ) |
NORETURN | ( | void | rsock_syserr_fail_pathint err, const char *, VALUE | ) |
NORETURN | ( | void | rsock_syserr_fail_sockaddrint err, const char *mesg, struct sockaddr *addr, socklen_t len | ) |
NORETURN | ( | void | rsock_syserr_fail_raddrinfoint err, const char *mesg, VALUE rai | ) |
NORETURN | ( | void | rsock_syserr_fail_raddrinfo_or_sockaddrint err, const char *mesg, VALUE addr, VALUE rai | ) |
NORETURN | ( | void | rsock_sys_fail_host_portconst char *, VALUE, VALUE | ) |
NORETURN | ( | void | rsock_sys_fail_pathconst char *, VALUE | ) |
NORETURN | ( | void | rsock_sys_fail_sockaddrconst char *, struct sockaddr *addr, socklen_t len | ) |
NORETURN | ( | void | rsock_sys_fail_raddrinfoconst char *, VALUE rai | ) |
NORETURN | ( | void | rsock_sys_fail_raddrinfo_or_sockaddrconst char *, VALUE addr, VALUE rai | ) |
Definition at line 2509 of file raddrinfo.c.
References addrinfo_to_sockaddr(), IS_ADDRINFO, and rb_check_string_type().
Referenced by sock_s_getnameinfo().
void rb_freeaddrinfo | ( | struct rb_addrinfo * | ai | ) |
Definition at line 322 of file raddrinfo.c.
References rb_addrinfo::ai, addrinfo::ai_addr, addrinfo::ai_next, rb_addrinfo::allocated_by_malloc, freeaddrinfo(), and xfree().
Referenced by addrinfo_firstonly_new(), addrinfo_list_new(), addrinfo_mload(), inetsock_cleanup(), init_addrinfo_getaddrinfo(), ip_s_getaddress(), rsock_freeaddrinfo(), sock_s_getaddrinfo(), sock_s_getnameinfo(), and sock_s_pack_sockaddr_in().
int rb_getaddrinfo | ( | const char * | node, |
const char * | service, | ||
const struct addrinfo * | hints, | ||
struct rb_addrinfo ** | res | ||
) |
Definition at line 288 of file raddrinfo.c.
References rb_addrinfo::ai, rb_addrinfo::allocated_by_malloc, getaddrinfo(), getaddrinfo_arg::hints, MEMZERO, getaddrinfo_arg::node, nogvl_getaddrinfo(), numeric_getaddrinfo(), rb_thread_call_without_gvl(), getaddrinfo_arg::res, RUBY_UBF_IO, getaddrinfo_arg::service, and xmalloc.
Referenced by rsock_getaddrinfo(), and sock_s_getnameinfo().
int rb_getnameinfo | ( | const struct sockaddr * | sa, |
socklen_t | salen, | ||
char * | host, | ||
size_t | hostlen, | ||
char * | serv, | ||
size_t | servlen, | ||
int | flags | ||
) |
Definition at line 363 of file raddrinfo.c.
References getnameinfo_arg::flags, getnameinfo(), getnameinfo_arg::host, getnameinfo_arg::hostlen, nogvl_getnameinfo(), rb_thread_call_without_gvl(), RUBY_UBF_IO, getnameinfo_arg::sa, getnameinfo_arg::salen, getnameinfo_arg::serv, and getnameinfo_arg::servlen.
Referenced by make_inspectname(), make_ipaddr0(), rsock_ipaddr(), and sock_s_getnameinfo().
struct rb_addrinfo* rsock_addrinfo | ( | VALUE | host, |
VALUE | port, | ||
int | family, | ||
int | socktype, | ||
int | flags | ||
) |
Definition at line 547 of file raddrinfo.c.
References addrinfo::ai_family, addrinfo::ai_flags, addrinfo::ai_socktype, MEMZERO, and rsock_getaddrinfo().
Referenced by init_inetsock_internal(), ip_s_getaddress(), sock_s_gethostbyname(), sock_s_pack_sockaddr_in(), tcp_s_gethostbyname(), udp_bind(), udp_connect(), and udp_send().
Definition at line 1519 of file raddrinfo.c.
References inspect_sockaddr(), and rb_str_new().
Referenced by rsock_init_addrinfo(), and rsock_syserr_fail_raddrinfo().
VALUE rsock_addrinfo_new | ( | struct sockaddr * | addr, |
socklen_t | len, | ||
int | family, | ||
int | socktype, | ||
int | protocol, | ||
VALUE | canonname, | ||
VALUE | inspectname | ||
) |
Definition at line 800 of file raddrinfo.c.
References addrinfo_s_allocate(), alloc_addrinfo(), DATA_PTR, init_addrinfo(), and rb_cAddrinfo.
Referenced by addrinfo_firstonly_new(), addrinfo_ipv4_multicast_p(), addrinfo_list_new(), rsock_fd_socket_addrinfo(), rsock_syserr_fail_sockaddr(), and sock_s_unpack_sockaddr_in().
Definition at line 528 of file basicsocket.c.
References BLOCKING_REGION_FD, rb_io_t::fd, rsock_send_arg::fd, rsock_send_arg::flags, func, GetOpenFile, INT2FIX, rsock_send_arg::mesg, NIL_P, NUM2INT, rb_io_wait_writable(), rb_scan_args(), rb_str_new4, rb_sys_fail(), rsock_maybe_fd_writable, rsock_send_blocking(), rsock_sendto_blocking(), RSTRING_PTR, RSTRING_SOCKLEN, SockAddrStringValue, StringValue, rsock_send_arg::to, and rsock_send_arg::tolen.
Referenced by rsock_init_basicsocket(), and udp_send().
int rsock_cmsg_type_arg | ( | int | family, |
int | level, | ||
VALUE | type | ||
) |
Definition at line 100 of file constants.c.
References constant_arg(), IPPROTO_IP, IPPROTO_TCP, IPPROTO_UDP, IS_IP_FAMILY, NUM2INT, rsock_ip_optname_to_int(), rsock_scm_optname_to_int(), rsock_tcp_optname_to_int(), and rsock_udp_optname_to_int().
int rsock_connect | ( | int | fd, |
const struct sockaddr * | sockaddr, | ||
int | len, | ||
int | socks | ||
) |
Definition at line 454 of file init.c.
References BLOCKING_REGION_FD, connect_blocking(), EINPROGRESS, errno, recvfrom_arg::fd, connect_arg::fd, func, len, connect_arg::len, connect_arg::sockaddr, and wait_connectable().
Referenced by init_inetsock_internal(), sock_connect(), and udp_connect_internal().
int rsock_detect_cloexec | ( | int | fd | ) |
Definition at line 284 of file init.c.
References errno, F_GETFD, fcntl(), FD_CLOEXEC, recvfrom_arg::flags, proto, rb_bug(), rb_maygvl_fd_fix_cloexec(), rb_update_max_fd(), rsock_detect_cloexec(), rsock_socket0(), and strerror().
Referenced by rsock_detect_cloexec(), and sock_initialize().
int rsock_family_arg | ( | VALUE | domain | ) |
Definition at line 43 of file constants.c.
References constant_arg(), and rsock_family_to_int().
Referenced by addrinfo_initialize(), call_getaddrinfo(), setup_domain_and_type(), sock_s_getaddrinfo(), sock_s_gethostbyaddr(), sock_s_getnameinfo(), sockopt_initialize(), sockopt_s_bool(), sockopt_s_byte(), sockopt_s_int(), and udp_init().
int rsock_fd_family | ( | int | fd | ) |
Definition at line 534 of file raddrinfo.c.
References AF_UNSPEC, and offsetof.
Referenced by udp_bind(), udp_connect(), and udp_send().
Definition at line 2517 of file raddrinfo.c.
References get_afamily(), Qnil, rb_sys_fail(), and rsock_addrinfo_new().
Referenced by bsock_local_address(), bsock_remote_address(), and rsock_io_socket_addrinfo().
Definition at line 696 of file raddrinfo.c.
References Qnil, and rb_freeaddrinfo().
Referenced by rsock_make_hostent(), udp_bind(), udp_connect(), and udp_send().
struct rb_addrinfo* rsock_getaddrinfo | ( | VALUE | host, |
VALUE | port, | ||
struct addrinfo * | hints, | ||
int | socktype_hack | ||
) |
Definition at line 506 of file raddrinfo.c.
References addrinfo::ai_flags, addrinfo::ai_socktype, host_str(), NI_MAXHOST, NI_MAXSERV, NULL, port_str(), rb_eSocket, rb_getaddrinfo(), rb_raise(), getaddrinfo_arg::res, rsock_raise_socket_error(), str_is_number(), and strlen().
Referenced by call_getaddrinfo(), rsock_addrinfo(), and sock_s_getaddrinfo().
int rsock_getfamily | ( | rb_io_t * | fptr | ) |
Definition at line 630 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.
Referenced by bsock_getsockopt(), and bsock_setsockopt().
void rsock_init_addrinfo | ( | void | ) |
Definition at line 2562 of file raddrinfo.c.
References addrinfo_afamily(), addrinfo_canonname(), addrinfo_getnameinfo(), addrinfo_initialize(), addrinfo_inspect(), addrinfo_ip_address(), addrinfo_ip_p(), addrinfo_ip_port(), addrinfo_ip_unpack(), addrinfo_ipv4_loopback_p(), addrinfo_ipv4_multicast_p(), addrinfo_ipv4_p(), addrinfo_ipv4_private_p(), addrinfo_ipv6_p(), addrinfo_mdump(), addrinfo_mload(), addrinfo_pfamily(), addrinfo_protocol(), addrinfo_s_allocate(), addrinfo_s_getaddrinfo(), addrinfo_s_ip(), addrinfo_s_tcp(), addrinfo_s_udp(), addrinfo_socktype(), addrinfo_to_sockaddr(), addrinfo_unix_p(), rb_cAddrinfo, rb_cData, rb_define_alloc_func(), rb_define_class(), rb_define_method(), rb_define_singleton_method(), and rsock_addrinfo_inspect_sockaddr().
Referenced by rsock_init_socket_init().
void rsock_init_ancdata | ( | void | ) |
Definition at line 1695 of file ancdata.c.
References ID2SYM, rb_cObject, rb_cSocket, rb_define_class_under(), rb_define_method(), rb_define_singleton_method(), rb_intern, sym_wait_readable, and sym_wait_writable.
Referenced by rsock_init_socket_init().
void rsock_init_basicsocket | ( | void | ) |
Definition at line 689 of file basicsocket.c.
References bsock_close_read(), bsock_close_write(), bsock_do_not_rev_lookup(), bsock_do_not_rev_lookup_set(), bsock_do_not_reverse_lookup(), bsock_do_not_reverse_lookup_set(), bsock_getpeereid, bsock_getpeername(), bsock_getsockname(), bsock_getsockopt(), bsock_local_address(), bsock_recv(), bsock_recv_nonblock(), bsock_remote_address(), bsock_s_for_fd(), bsock_setsockopt(), bsock_shutdown(), rb_cBasicSocket, rb_cIO, rb_define_class(), rb_define_method(), rb_define_private_method(), rb_define_singleton_method(), rb_undef_method(), rsock_bsock_recvmsg, rsock_bsock_recvmsg_nonblock, rsock_bsock_send(), rsock_bsock_sendmsg, and rsock_bsock_sendmsg_nonblock.
Referenced by Init_socket().
VALUE rsock_init_inetsock | ( | VALUE | sock, |
VALUE | remote_host, | ||
VALUE | remote_serv, | ||
VALUE | local_host, | ||
VALUE | local_serv, | ||
int | type | ||
) |
Definition at line 152 of file ipsocket.c.
References inetsock_arg::fd, inetsock_arg::host, inetsock_cleanup(), init_inetsock_internal(), inetsock_arg::local, rb_ensure(), inetsock_arg::remote, inetsock_arg::res, inetsock_arg::serv, inetsock_arg::sock, and inetsock_arg::type.
Referenced by tcp_init(), and tcp_svr_init().
void rsock_init_ipsocket | ( | void | ) |
Definition at line 327 of file ipsocket.c.
References id_hostname, id_numeric, ip_addr(), ip_peeraddr(), ip_recvfrom(), ip_s_getaddress(), rb_cBasicSocket, rb_cIPSocket, rb_define_class(), rb_define_method(), rb_define_singleton_method(), rb_intern_const, and rb_undef_method().
Referenced by rsock_init_socket_init().
Definition at line 60 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 bsock_s_for_fd(), init_inetsock_internal(), rsock_s_accept(), rsock_s_accept_nonblock(), sock_initialize(), and udp_init().
void rsock_init_socket_constants | ( | void | ) |
Definition at line 141 of file constants.c.
References init_constants().
Referenced by rsock_init_socket_init().
void rsock_init_socket_init | ( | void | ) |
Definition at line 662 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(), rsock_init_unixsocket(), and sym_wait_readable.
Referenced by Init_socket().
void rsock_init_sockifaddr | ( | void | ) |
Definition at line 439 of file ifaddr.c.
References rb_cData, rb_cSocket, rb_define_class_under(), rb_define_method(), rb_define_singleton_method(), and socket_s_getifaddrs.
Referenced by rsock_init_socket_init().
void rsock_init_sockopt | ( | void | ) |
Definition at line 1438 of file option.c.
References rb_cObject, rb_cSocket, rb_cSockOpt, rb_define_class_under(), rb_define_method(), rb_define_singleton_method(), sockopt_bool(), sockopt_byte(), sockopt_data(), sockopt_family_m(), sockopt_initialize(), sockopt_inspect(), sockopt_int(), sockopt_ipv4_multicast_loop(), sockopt_ipv4_multicast_ttl(), sockopt_level_m(), sockopt_linger(), sockopt_optname_m(), sockopt_s_bool(), sockopt_s_byte(), sockopt_s_int(), sockopt_s_ipv4_multicast_loop(), sockopt_s_ipv4_multicast_ttl(), sockopt_s_linger(), and sockopt_unpack().
Referenced by rsock_init_socket_init().
void rsock_init_sockssocket | ( | void | ) |
Definition at line 52 of file sockssocket.c.
References rb_cTCPSocket, rb_define_class(), and rb_define_method().
Referenced by rsock_init_socket_init().
void rsock_init_tcpserver | ( | void | ) |
Definition at line 106 of file tcpserver.c.
References rb_cTCPServer, rb_cTCPSocket, rb_define_class(), rb_define_method(), rb_define_private_method(), rsock_sock_listen(), tcp_accept(), tcp_accept_nonblock(), tcp_svr_init(), and tcp_sysaccept().
Referenced by rsock_init_socket_init().
void rsock_init_tcpsocket | ( | void | ) |
Definition at line 59 of file tcpsocket.c.
References rb_cIPSocket, rb_cTCPSocket, rb_define_class(), rb_define_method(), rb_define_singleton_method(), tcp_init(), and tcp_s_gethostbyname().
Referenced by rsock_init_socket_init().
void rsock_init_udpsocket | ( | void | ) |
Definition at line 227 of file udpsocket.c.
References rb_cIPSocket, rb_cUDPSocket, rb_define_class(), rb_define_method(), rb_define_private_method(), udp_bind(), udp_connect(), udp_init(), udp_recvfrom_nonblock(), and udp_send().
Referenced by rsock_init_socket_init().
void rsock_init_unixserver | ( | void | ) |
Definition at line 109 of file unixserver.c.
References rb_define_class(), rb_define_method(), rb_define_private_method(), and rsock_sock_listen().
Referenced by rsock_init_socket_init().
void rsock_init_unixsocket | ( | void | ) |
Definition at line 529 of file unixsocket.c.
References rb_cBasicSocket, rb_define_class(), rb_define_method(), and rb_define_singleton_method().
Referenced by rsock_init_socket_init().
Definition at line 1143 of file raddrinfo.c.
References union_sockaddr::addr, AF_UNSPEC, buf, getnameinfo(), IFNAMSIZ, ISPRINT, ISSPACE, len, NI_NUMERICHOST, NI_NUMERICSERV, NULL, offsetof, rb_id2name(), rb_str_cat(), rb_str_cat2(), rb_str_catf(), rsock_intern_family(), and rsock_raise_socket_error().
Referenced by inspect_sockaddr().
Definition at line 2536 of file raddrinfo.c.
References rb_io_t::fd, FIX2INT, GetOpenFile, NUM2INT, rb_eTypeError, rb_raise(), rsock_fd_socket_addrinfo(), T_BIGNUM, T_FILE, T_FIXNUM, TYPE, and UNREACHABLE.
Referenced by rsock_s_recvfrom(), rsock_s_recvfrom_nonblock(), sock_accept(), sock_accept_nonblock(), and sock_sysaccept().
Definition at line 559 of file raddrinfo.c.
References id, INT2FIX, len, NI_NUMERICHOST, NI_NUMERICSERV, NULL, offsetof, Qnil, rb_ary_new3, rb_assoc_new(), rb_eArgError, rb_getnameinfo(), rb_id2str, rb_raise(), rb_str_dup(), rb_str_new(), rb_str_new2, rsock_intern_family(), rsock_raise_socket_error(), RSTRING_LEN, RSTRING_PTR, RSTRING_SOCKLEN, and SOCKLEN_MAX.
Referenced by ip_addr(), ip_peeraddr(), make_addrinfo(), rsock_s_recvfrom(), and rsock_s_recvfrom_nonblock().
int rsock_level_arg | ( | int | family, |
VALUE | level | ||
) |
Definition at line 57 of file constants.c.
References constant_arg(), IS_IP_FAMILY, rsock_ip_level_to_int(), and rsock_unknown_level_to_int().
Referenced by bsock_getsockopt(), bsock_setsockopt(), sockopt_initialize(), sockopt_s_bool(), sockopt_s_byte(), and sockopt_s_int().
VALUE rsock_make_hostent | ( | VALUE | host, |
struct rb_addrinfo * | addr, | ||
VALUE(*)(struct sockaddr *, socklen_t) | ipaddr | ||
) |
Definition at line 704 of file raddrinfo.c.
References hostent_arg::addr, hostent_arg::host, hostent_arg::ipaddr, make_hostent_internal(), rb_ensure(), and rsock_freeaddrinfo().
Referenced by sock_s_gethostbyname(), and tcp_s_gethostbyname().
Definition at line 396 of file raddrinfo.c.
References make_ipaddr0(), and rb_str_new2.
Referenced by ip_s_getaddress(), sock_s_unpack_sockaddr_in(), and tcp_sockaddr().
int rsock_optname_arg | ( | int | family, |
int | level, | ||
VALUE | optname | ||
) |
Definition at line 69 of file constants.c.
References constant_arg(), IPPROTO_IP, IPPROTO_TCP, IPPROTO_UDP, IS_IP_FAMILY, NUM2INT, rsock_ip_optname_to_int(), rsock_so_optname_to_int(), rsock_tcp_optname_to_int(), and rsock_udp_optname_to_int().
Referenced by bsock_getsockopt(), bsock_setsockopt(), sockopt_initialize(), sockopt_s_bool(), sockopt_s_byte(), and sockopt_s_int().
int rsock_revlookup_flag | ( | VALUE | revlookup, |
int * | norevlookup | ||
) |
Definition at line 172 of file ipsocket.c.
References Check_Type, id, id_hostname, id_numeric, Qfalse, Qnil, Qtrue, rb_eArgError, rb_id2name(), rb_raise(), return_norevlookup, SYM2ID, and T_SYMBOL.
Referenced by ip_addr(), ip_peeraddr(), and sock_s_getaddrinfo().
Definition at line 595 of file init.c.
References accept_blocking(), BLOCKING_REGION_FD, errno, recvfrom_arg::fd, accept_arg::fd, 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.
Referenced by sock_accept(), sock_sysaccept(), tcp_accept(), and tcp_sysaccept().
VALUE rsock_s_accept_nonblock | ( | VALUE | klass, |
VALUE | ex, | ||
rb_io_t * | fptr, | ||
struct sockaddr * | sockaddr, | ||
socklen_t * | len | ||
) |
Definition at line 553 of file init.c.
References cloexec_accept(), ECONNABORTED, errno, EWOULDBLOCK, rb_io_t::fd, 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 sym_wait_readable.
Referenced by sock_accept_nonblock(), and tcp_accept_nonblock().
VALUE rsock_s_recvfrom | ( | VALUE | sock, |
int | argc, | ||
VALUE * | argv, | ||
enum sock_recv_type | from | ||
) |
Definition at line 146 of file init.c.
References union_sockaddr::addr, recvfrom_arg::alen, recvfrom_arg::buf, rb_io_t::fd, recvfrom_arg::fd, recvfrom_arg::flags, FMODE_NOREVLOOKUP, GetOpenFile, len, 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_obj_taint(), rb_raise(), rb_scan_args(), rb_str_locktmp_ensure(), rb_str_set_len(), rb_sys_fail(), RECV_IP, RECV_RECV, RECV_SOCKET, RECV_UNIX, recvfrom_locktmp(), rsock_io_socket_addrinfo(), rsock_ipaddr(), rsock_maybe_wait_fd, rsock_strbuf(), RSTRING_LEN, and recvfrom_arg::str.
Referenced by bsock_recv(), ip_recvfrom(), and sock_recvfrom().
VALUE rsock_s_recvfrom_nonblock | ( | VALUE | sock, |
VALUE | len, | ||
VALUE | flg, | ||
VALUE | str, | ||
VALUE | ex, | ||
enum sock_recv_type | from | ||
) |
Definition at line 209 of file init.c.
References union_sockaddr::addr, recvfrom_arg::alen, recvfrom_arg::buf, errno, EWOULDBLOCK, rb_io_t::fd, recvfrom_arg::fd, recvfrom_arg::flags, FMODE_NOREVLOOKUP, GetOpenFile, 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_obj_taint(), 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(), rsock_strbuf(), RSTRING_LEN, RSTRING_PTR, recvfrom_arg::str, and sym_wait_readable.
Referenced by bsock_recv_nonblock(), sock_recvfrom_nonblock(), and udp_recvfrom_nonblock().
VALUE rsock_send_blocking | ( | void * | data | ) |
Definition at line 91 of file init.c.
References 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 82 of file init.c.
References 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(), and udp_send_internal().
int rsock_shutdown_how_arg | ( | VALUE | how | ) |
Definition at line 131 of file constants.c.
References constant_arg(), and rsock_shutdown_how_to_int().
Referenced by bsock_shutdown().
Definition at line 644 of file socket.c.
References rb_io_t::fd, GetOpenFile, INT2FIX, NUM2INT, and rb_sys_fail().
Referenced by Init_socket(), rsock_init_tcpserver(), and rsock_init_unixserver().
socklen_t rsock_sockaddr_len | ( | struct sockaddr * | addr | ) |
Referenced by sock_s_unpack_sockaddr_in().
Referenced by sock_s_unpack_sockaddr_in().
Definition at line 2478 of file raddrinfo.c.
References addrinfo_to_sockaddr(), IS_ADDRINFO, StringValue, and val.
Referenced by rsock_sockaddr_string_value_ptr().
char* rsock_sockaddr_string_value_ptr | ( | volatile VALUE * | ) |
Definition at line 2502 of file raddrinfo.c.
References rsock_sockaddr_string_value(), and RSTRING_PTR.
Definition at line 2489 of file raddrinfo.c.
References addrinfo_to_sockaddr(), IS_ADDRINFO, Qnil, StringValue, and val.
int rsock_socket | ( | int | domain, |
int | type, | ||
int | proto | ||
) |
Definition at line 357 of file init.c.
References errno, recvfrom_arg::fd, rb_gc_for_fd(), rb_update_max_fd(), and rsock_socket0().
Referenced by init_inetsock_internal(), sock_initialize(), and udp_init().
Definition at line 107 of file option.c.
References INT2NUM, NEWOBJ_OF, rb_cSockOpt, sockopt_initialize(), StringValue, and T_OBJECT.
Referenced by bsock_getsockopt(), sockopt_s_bool(), sockopt_s_byte(), sockopt_s_int(), sockopt_s_ipv4_multicast_loop(), sockopt_s_ipv4_multicast_ttl(), and sockopt_s_linger().
int rsock_socktype_arg | ( | VALUE | type | ) |
Definition at line 50 of file constants.c.
References constant_arg(), and rsock_socktype_to_int().
Referenced by addrinfo_initialize(), addrinfo_s_udp(), call_getaddrinfo(), setup_domain_and_type(), and sock_s_getaddrinfo().
VALUE rb_cAddrinfo |
Definition at line 23 of file init.c.
Referenced by addrinfo_s_udp(), rsock_addrinfo_new(), and rsock_init_addrinfo().
VALUE rb_cBasicSocket |
Definition at line 13 of file init.c.
Referenced by Init_socket(), rsock_init_basicsocket(), rsock_init_ipsocket(), and rsock_init_unixsocket().
VALUE rb_cIPSocket |
Definition at line 14 of file init.c.
Referenced by rsock_init_ipsocket(), rsock_init_tcpsocket(), and rsock_init_udpsocket().
VALUE rb_cSocket |
Definition at line 22 of file init.c.
Referenced by init_constants(), Init_socket(), rsock_init_ancdata(), rsock_init_sockifaddr(), rsock_init_sockopt(), sock_accept(), and sock_accept_nonblock().
VALUE rb_cSockOpt |
Definition at line 3 of file option.c.
Referenced by rsock_init_sockopt(), and rsock_sockopt_new().
VALUE rb_cTCPServer |
Definition at line 16 of file init.c.
Referenced by rsock_init_tcpserver().
VALUE rb_cTCPSocket |
Definition at line 15 of file init.c.
Referenced by rsock_init_sockssocket(), rsock_init_tcpserver(), rsock_init_tcpsocket(), tcp_accept(), and tcp_accept_nonblock().
VALUE rb_cUDPSocket |
Definition at line 17 of file init.c.
Referenced by rsock_init_udpsocket().
VALUE rb_eSocket |
Definition at line 25 of file init.c.
Referenced by addrinfo_initialize(), addrinfo_ip_address(), addrinfo_ip_port(), addrinfo_ip_unpack(), addrinfo_ipv4_multicast_p(), addrinfo_mdump(), addrinfo_mload(), call_getaddrinfo(), constant_arg(), make_addrinfo(), rsock_getaddrinfo(), rsock_init_socket_init(), rsock_raise_socket_error(), sock_s_gethostbyaddr(), sock_s_getnameinfo(), sock_s_getservbyname(), sock_s_getservbyport(), and sock_sockaddr().
int rsock_do_not_reverse_lookup |
Definition at line 31 of file init.c.
Referenced by bsock_do_not_rev_lookup(), bsock_do_not_rev_lookup_set(), rsock_init_sock(), and sock_s_getaddrinfo().