#include "rubysocket.h"Go to the source code of this file.
Defines | |
| #define | rsock_sock_s_socketpair rb_f_notimplement |
| #define | sock_gethostname rb_f_notimplement |
| #define | socket_s_ip_address_list rb_f_notimplement |
Functions | |
| static VALUE | sock_s_unpack_sockaddr_in (VALUE, VALUE) |
| void | rsock_sys_fail_host_port (const char *mesg, VALUE host, VALUE port) |
| void | rsock_syserr_fail_host_port (int err, const char *mesg, VALUE host, VALUE port) |
| void | rsock_sys_fail_path (const char *mesg, VALUE path) |
| void | rsock_syserr_fail_path (int err, const char *mesg, VALUE path) |
| void | rsock_sys_fail_sockaddr (const char *mesg, struct sockaddr *addr, socklen_t len) |
| void | rsock_syserr_fail_sockaddr (int err, const char *mesg, struct sockaddr *addr, socklen_t len) |
| void | rsock_sys_fail_raddrinfo (const char *mesg, VALUE rai) |
| void | rsock_syserr_fail_raddrinfo (int err, const char *mesg, VALUE rai) |
| void | rsock_sys_fail_raddrinfo_or_sockaddr (const char *mesg, VALUE addr, VALUE rai) |
| void | rsock_syserr_fail_raddrinfo_or_sockaddr (int err, const char *mesg, VALUE addr, VALUE rai) |
| static void | setup_domain_and_type (VALUE domain, int *dv, VALUE type, int *tv) |
| static VALUE | sock_initialize (int argc, VALUE *argv, VALUE sock) |
| static VALUE | sock_connect (VALUE sock, VALUE addr) |
| static VALUE | sock_connect_nonblock (VALUE sock, VALUE addr) |
| static VALUE | sock_bind (VALUE sock, VALUE addr) |
| VALUE | rsock_sock_listen (VALUE sock, VALUE log) |
| static VALUE | sock_recvfrom (int argc, VALUE *argv, VALUE sock) |
| static VALUE | sock_recvfrom_nonblock (int argc, VALUE *argv, VALUE sock) |
| static VALUE | sock_accept (VALUE sock) |
| static VALUE | sock_accept_nonblock (VALUE sock) |
| static VALUE | sock_sysaccept (VALUE sock) |
| static VALUE | make_addrinfo (struct rb_addrinfo *res0, int norevlookup) |
| static VALUE | sock_sockaddr (struct sockaddr *addr, socklen_t len) |
| static VALUE | sock_s_gethostbyname (VALUE obj, VALUE host) |
| static VALUE | sock_s_gethostbyaddr (int argc, VALUE *argv) |
| static VALUE | sock_s_getservbyname (int argc, VALUE *argv) |
| static VALUE | sock_s_getservbyport (int argc, VALUE *argv) |
| static VALUE | sock_s_getaddrinfo (int argc, VALUE *argv) |
| static VALUE | sock_s_getnameinfo (int argc, VALUE *argv) |
| static VALUE | sock_s_pack_sockaddr_in (VALUE self, VALUE port, VALUE host) |
| void | Init_socket () |
| #define rsock_sock_s_socketpair rb_f_notimplement |
Definition at line 282 of file socket.c.
Referenced by Init_socket().
| #define sock_gethostname rb_f_notimplement |
Definition at line 1041 of file socket.c.
Referenced by Init_socket().
| #define socket_s_ip_address_list rb_f_notimplement |
Definition at line 2007 of file socket.c.
Referenced by Init_socket().
| void Init_socket | ( | ) |
Definition at line 2011 of file socket.c.
References rb_cBasicSocket, rb_cSocket, rb_define_class(), rb_define_method(), rb_define_singleton_method(), rsock_init_basicsocket(), rsock_init_socket_init(), rsock_sock_listen(), rsock_sock_s_socketpair, sock_accept(), sock_accept_nonblock(), sock_bind(), sock_connect(), sock_connect_nonblock(), sock_gethostname, sock_initialize(), sock_recvfrom(), sock_recvfrom_nonblock(), sock_s_getaddrinfo(), sock_s_gethostbyaddr(), sock_s_gethostbyname(), sock_s_getnameinfo(), sock_s_getservbyname(), sock_s_getservbyport(), sock_s_pack_sockaddr_in(), sock_s_unpack_sockaddr_in(), sock_sysaccept(), and socket_s_ip_address_list.
| static VALUE make_addrinfo | ( | struct rb_addrinfo * | res0, | |
| int | norevlookup | |||
| ) | [static] |
Definition at line 1046 of file socket.c.
References rb_addrinfo::ai, addrinfo::ai_addr, addrinfo::ai_addrlen, addrinfo::ai_canonname, addrinfo::ai_family, addrinfo::ai_next, addrinfo::ai_protocol, addrinfo::ai_socktype, INT2FIX, NULL, RARRAY_PTR, rb_ary_new(), rb_ary_push(), rb_eSocket, rb_raise(), rb_str_new2, and rsock_ipaddr().
Referenced by sock_s_getaddrinfo().
| VALUE rsock_sock_listen | ( | VALUE | sock, | |
| VALUE | log | |||
| ) |
Definition at line 649 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().
| void rsock_sys_fail_host_port | ( | const char * | mesg, | |
| VALUE | host, | |||
| VALUE | port | |||
| ) |
Definition at line 16 of file socket.c.
References errno, and rsock_syserr_fail_host_port().
Referenced by udp_bind(), udp_connect(), and udp_send().
| void rsock_sys_fail_path | ( | const char * | mesg, | |
| VALUE | path | |||
| ) |
Definition at line 33 of file socket.c.
References errno, and rsock_syserr_fail_path().
Referenced by bsock_getsockopt(), and bsock_setsockopt().
| void rsock_sys_fail_raddrinfo | ( | const char * | mesg, | |
| VALUE | rai | |||
| ) |
Definition at line 69 of file socket.c.
References errno, and rsock_syserr_fail_raddrinfo().
| void rsock_sys_fail_raddrinfo_or_sockaddr | ( | const char * | mesg, | |
| VALUE | addr, | |||
| VALUE | rai | |||
| ) |
Definition at line 86 of file socket.c.
References errno, and rsock_syserr_fail_raddrinfo_or_sockaddr().
Referenced by sock_bind(), sock_connect(), and sock_connect_nonblock().
| void rsock_sys_fail_sockaddr | ( | const char * | mesg, | |
| struct sockaddr * | addr, | |||
| socklen_t | len | |||
| ) |
Definition at line 53 of file socket.c.
References errno, and rsock_syserr_fail_sockaddr().
| void rsock_syserr_fail_host_port | ( | int | err, | |
| const char * | mesg, | |||
| VALUE | host, | |||
| VALUE | port | |||
| ) |
Definition at line 22 of file socket.c.
References PRIsVALUE, rb_sprintf(), and rb_syserr_fail_str().
Referenced by init_inetsock_internal(), and rsock_sys_fail_host_port().
| void rsock_syserr_fail_path | ( | int | err, | |
| const char * | mesg, | |||
| VALUE | path | |||
| ) |
Definition at line 39 of file socket.c.
References PRIsVALUE, rb_sprintf(), rb_syserr_fail(), rb_syserr_fail_str(), RB_TYPE_P, and T_STRING.
Referenced by rsock_sys_fail_path().
| void rsock_syserr_fail_raddrinfo | ( | int | err, | |
| const char * | mesg, | |||
| VALUE | rai | |||
| ) |
Definition at line 75 of file socket.c.
References PRIsVALUE, rb_sprintf(), rb_syserr_fail_str(), and rsock_addrinfo_inspect_sockaddr().
Referenced by rsock_sys_fail_raddrinfo(), rsock_syserr_fail_raddrinfo_or_sockaddr(), and rsock_syserr_fail_sockaddr().
| void rsock_syserr_fail_raddrinfo_or_sockaddr | ( | int | err, | |
| const char * | mesg, | |||
| VALUE | addr, | |||
| VALUE | rai | |||
| ) |
Definition at line 92 of file socket.c.
References NIL_P, rsock_syserr_fail_raddrinfo(), rsock_syserr_fail_sockaddr(), RSTRING_LEN, RSTRING_PTR, and StringValue.
Referenced by rsock_sys_fail_raddrinfo_or_sockaddr().
| void rsock_syserr_fail_sockaddr | ( | int | err, | |
| const char * | mesg, | |||
| struct sockaddr * | addr, | |||
| socklen_t | len | |||
| ) |
Definition at line 59 of file socket.c.
References PF_UNSPEC, Qnil, rsock_addrinfo_new(), and rsock_syserr_fail_raddrinfo().
Referenced by rsock_sys_fail_sockaddr(), and rsock_syserr_fail_raddrinfo_or_sockaddr().
| static void setup_domain_and_type | ( | VALUE | domain, | |
| int * | dv, | |||
| VALUE | type, | |||
| int * | tv | |||
| ) | [static] |
Definition at line 106 of file socket.c.
References rsock_family_arg(), and rsock_socktype_arg().
Referenced by sock_initialize().
| static VALUE sock_accept | ( | VALUE | sock | ) | [static] |
Definition at line 856 of file socket.c.
References union_sockaddr::addr, buf, rb_io_t::fd, GetOpenFile, rb_assoc_new(), rb_cSocket, rsock_io_socket_addrinfo(), and rsock_s_accept().
Referenced by Init_socket().
| static VALUE sock_accept_nonblock | ( | VALUE | sock | ) | [static] |
Definition at line 921 of file socket.c.
References union_sockaddr::addr, buf, GetOpenFile, rb_assoc_new(), rb_cSocket, rsock_io_socket_addrinfo(), and rsock_s_accept_nonblock().
Referenced by Init_socket().
| static VALUE sock_bind | ( | VALUE | sock, | |
| VALUE | addr | |||
| ) | [static] |
Definition at line 565 of file socket.c.
References rb_io_t::fd, GetOpenFile, INT2FIX, rsock_sys_fail_raddrinfo_or_sockaddr(), RSTRING_PTR, RSTRING_SOCKLEN, and SockAddrStringValueWithAddrinfo.
Referenced by Init_socket().
| static VALUE sock_connect | ( | VALUE | sock, | |
| VALUE | addr | |||
| ) | [static] |
Definition at line 397 of file socket.c.
References rb_io_t::fd, GetOpenFile, INT2FIX, rb_str_new4, rsock_connect(), rsock_sys_fail_raddrinfo_or_sockaddr(), RSTRING_PTR, RSTRING_SOCKLEN, and SockAddrStringValueWithAddrinfo.
Referenced by Init_socket().
| static VALUE sock_connect_nonblock | ( | VALUE | sock, | |
| VALUE | addr | |||
| ) | [static] |
Definition at line 458 of file socket.c.
References EINPROGRESS, errno, rb_io_t::fd, GetOpenFile, INT2FIX, rb_io_set_nonblock(), RB_IO_WAIT_WRITABLE, rb_readwrite_sys_fail(), rb_str_new4, rsock_sys_fail_raddrinfo_or_sockaddr(), RSTRING_PTR, RSTRING_SOCKLEN, and SockAddrStringValueWithAddrinfo.
Referenced by Init_socket().
| static VALUE sock_initialize | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | sock | |||
| ) | [static] |
Definition at line 131 of file socket.c.
References INT2FIX, NIL_P, NUM2INT, rb_scan_args(), rb_secure(), rb_sys_fail(), rsock_init_sock(), rsock_socket(), setup_domain_and_type(), t(), and type.
Referenced by Init_socket().
| static VALUE sock_recvfrom | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | sock | |||
| ) | [static] |
Definition at line 768 of file socket.c.
References RECV_SOCKET, and rsock_s_recvfrom().
Referenced by Init_socket().
| static VALUE sock_recvfrom_nonblock | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | sock | |||
| ) | [static] |
Definition at line 836 of file socket.c.
References RECV_SOCKET, and rsock_s_recvfrom_nonblock().
Referenced by Init_socket().
| static VALUE sock_s_getaddrinfo | ( | int | argc, | |
| VALUE * | argv | |||
| ) | [static] |
Definition at line 1275 of file socket.c.
References addrinfo::ai_family, addrinfo::ai_flags, addrinfo::ai_protocol, addrinfo::ai_socktype, make_addrinfo(), MEMZERO, NIL_P, NUM2INT, PF_UNSPEC, rb_freeaddrinfo(), rb_scan_args(), rsock_do_not_reverse_lookup, rsock_family_arg(), rsock_getaddrinfo(), rsock_revlookup_flag(), and rsock_socktype_arg().
Referenced by Init_socket().
| static VALUE sock_s_gethostbyaddr | ( | int | argc, | |
| VALUE * | argv | |||
| ) | [static] |
Definition at line 1117 of file socket.c.
References INT2NUM, names, NIL_P, NULL, rb_ary_new(), rb_ary_push(), rb_eSocket, rb_raise(), rb_scan_args(), rb_str_new(), rb_str_new2, rsock_family_arg(), RSTRING_LEN, RSTRING_PTR, RSTRING_SOCKLEN, and StringValue.
Referenced by Init_socket().
| static VALUE sock_s_gethostbyname | ( | VALUE | obj, | |
| VALUE | host | |||
| ) | [static] |
Definition at line 1101 of file socket.c.
References AI_CANONNAME, Qnil, rb_secure(), rsock_addrinfo(), rsock_make_hostent(), and sock_sockaddr().
Referenced by Init_socket().
| static VALUE sock_s_getnameinfo | ( | int | argc, | |
| VALUE * | argv | |||
| ) | [static] |
Definition at line 1329 of file socket.c.
References union_sockaddr::addr, rb_addrinfo::ai, addrinfo::ai_addr, addrinfo::ai_addrlen, addrinfo::ai_family, addrinfo::ai_flags, addrinfo::ai_next, AI_NUMERICHOST, addrinfo::ai_socktype, errno, FIXNUM_P, MEMZERO, NI_DGRAM, NIL_P, NULL, NUM2INT, NUM2LONG, PF_UNSPEC, Qnil, RARRAY_LEN, RARRAY_PTR, rb_assoc_new(), rb_check_array_type(), rb_check_sockaddr_string_type(), rb_eArgError, rb_eSocket, rb_eTypeError, rb_freeaddrinfo(), rb_getaddrinfo(), rb_getnameinfo(), rb_raise(), rb_scan_args(), rb_str_new2, rsock_family_arg(), rsock_raise_socket_error(), RSTRING_LEN, RSTRING_PTR, RSTRING_SOCKLEN, snprintf, StringValuePtr, UNREACHABLE, and VALIDATE_SOCKLEN.
Referenced by Init_socket().
| static VALUE sock_s_getservbyname | ( | int | argc, | |
| VALUE * | argv | |||
| ) | [static] |
Definition at line 1179 of file socket.c.
References INT2FIX, NIL_P, proto, rb_eSocket, rb_raise(), rb_scan_args(), StringValue, StringValueCStr, and STRTOUL.
Referenced by Init_socket().
| static VALUE sock_s_getservbyport | ( | int | argc, | |
| VALUE * | argv | |||
| ) | [static] |
Definition at line 1220 of file socket.c.
References NIL_P, NUM2LONG, proto, rb_eRangeError, rb_eSocket, rb_raise(), rb_scan_args(), rb_tainted_str_new2, and StringValueCStr.
Referenced by Init_socket().
| static VALUE sock_s_pack_sockaddr_in | ( | VALUE | self, | |
| VALUE | port, | |||
| VALUE | host | |||
| ) | [static] |
Definition at line 1480 of file socket.c.
References rb_addrinfo::ai, addrinfo::ai_addr, addrinfo::ai_addrlen, OBJ_INFECT, rb_freeaddrinfo(), rb_str_new(), and rsock_addrinfo().
Referenced by Init_socket().
| static VALUE sock_s_unpack_sockaddr_in | ( | VALUE | self, | |
| VALUE | addr | |||
| ) | [static] |
Definition at line 1506 of file socket.c.
References INT2NUM, OBJ_INFECT, rb_assoc_new(), rb_eArgError, rb_raise(), rsock_make_ipaddr(), RSTRING_LEN, RSTRING_SOCKLEN, and SockAddrStringValuePtr.
Referenced by Init_socket().
| static VALUE sock_sockaddr | ( | struct sockaddr * | addr, | |
| socklen_t | len | |||
| ) | [static] |
Definition at line 1069 of file socket.c.
References rb_eSocket, rb_raise(), and rb_str_new().
Referenced by sock_s_gethostbyname().
| static VALUE sock_sysaccept | ( | VALUE | sock | ) | [static] |
Definition at line 972 of file socket.c.
References union_sockaddr::addr, buf, rb_io_t::fd, GetOpenFile, rb_assoc_new(), rsock_io_socket_addrinfo(), and rsock_s_accept().
Referenced by Init_socket().
1.6.1