ext/socket/rubysocket.h File Reference

#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/util.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"

Include dependency graph for rubysocket.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sockaddr_storage
struct  rsock_send_arg

Defines

#define RUBY_SOCKET_H   1
#define EWOULDBLOCK   EAGAIN
#define pseudo_AF_FTIP   pseudo_AF_RTIP
#define IS_IP_FAMILY(af)   ((af) == AF_INET)
#define _SS_MAXSIZE   128
#define _SS_ALIGNSIZE   (sizeof(double))
#define _SS_PAD1SIZE   (_SS_ALIGNSIZE - sizeof(unsigned char) * 2)
#define _SS_PAD2SIZE
#define INET_CLIENT   0
#define INET_SERVER   1
#define INET_SOCKS   2
#define FMODE_NOREVLOOKUP   0x100
#define BLOCKING_REGION(func, arg)   (long)rb_thread_blocking_region((func), (arg), RUBY_UBF_IO, 0)
#define SockAddrStringValue(v)   rsock_sockaddr_string_value(&(v))
#define SockAddrStringValuePtr(v)   rsock_sockaddr_string_value_ptr(&(v))
#define rsock_bsock_sendmsg   rb_f_notimplement
#define rsock_bsock_sendmsg_nonblock   rb_f_notimplement
#define rsock_bsock_recvmsg   rb_f_notimplement
#define rsock_bsock_recvmsg_nonblock   rb_f_notimplement

Enumerations

enum  sock_recv_type { RECV_RECV, RECV_IP, RECV_UNIX, RECV_SOCKET }

Functions

VALUE rsock_sockaddr_string_value (volatile VALUE *)
char * rsock_sockaddr_string_value_ptr (volatile VALUE *)
VALUE rb_check_sockaddr_string_type (VALUE)
 NORETURN (void rsock_raise_socket_error(const char *, int))
int rsock_family_arg (VALUE domain)
int rsock_socktype_arg (VALUE type)
int rsock_level_arg (int family, VALUE level)
int rsock_optname_arg (int family, int level, VALUE optname)
int rsock_cmsg_type_arg (int family, int level, VALUE type)
int rsock_shutdown_how_arg (VALUE how)
int rsock_getfamily (int sockfd)
int rb_getaddrinfo (const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)
int rb_getnameinfo (const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags)
addrinforsock_addrinfo (VALUE host, VALUE port, int socktype, int flags)
addrinforsock_getaddrinfo (VALUE host, VALUE port, struct addrinfo *hints, int socktype_hack)
VALUE rsock_fd_socket_addrinfo (int fd, struct sockaddr *addr, socklen_t len)
VALUE rsock_io_socket_addrinfo (VALUE io, struct sockaddr *addr, socklen_t len)
VALUE rsock_addrinfo_new (struct sockaddr *addr, socklen_t len, int family, int socktype, int protocol, VALUE canonname, VALUE inspectname)
VALUE rsock_make_ipaddr (struct sockaddr *addr)
VALUE rsock_ipaddr (struct sockaddr *sockaddr, int norevlookup)
VALUE rsock_make_hostent (VALUE host, struct addrinfo *addr, VALUE(*ipaddr)(struct sockaddr *, size_t))
int rsock_revlookup_flag (VALUE revlookup, int *norevlookup)
int rsock_socket (int domain, int type, int proto)
VALUE rsock_init_sock (VALUE sock, int fd)
VALUE rsock_sock_s_socketpair (int argc, VALUE *argv, VALUE klass)
VALUE rsock_init_inetsock (VALUE sock, VALUE remote_host, VALUE remote_serv, VALUE local_host, VALUE local_serv, int type)
VALUE rsock_init_unixsock (VALUE sock, VALUE path, int server)
VALUE rsock_sendto_blocking (void *data)
VALUE rsock_send_blocking (void *data)
VALUE rsock_bsock_send (int argc, VALUE *argv, VALUE sock)
VALUE rsock_s_recvfrom_nonblock (VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
VALUE rsock_s_recvfrom (VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
int rsock_connect (int fd, const struct sockaddr *sockaddr, int len, int socks)
VALUE rsock_s_accept (VALUE klass, int fd, struct sockaddr *sockaddr, socklen_t *len)
VALUE rsock_s_accept_nonblock (VALUE klass, rb_io_t *fptr, struct sockaddr *sockaddr, socklen_t *len)
VALUE rsock_sock_listen (VALUE sock, VALUE log)
VALUE rsock_sockopt_new (int family, int level, int optname, VALUE data)
void rsock_init_basicsocket (void)
void rsock_init_ipsocket (void)
void rsock_init_tcpsocket (void)
void rsock_init_tcpserver (void)
void rsock_init_sockssocket (void)
void rsock_init_udpsocket (void)
void rsock_init_unixsocket (void)
void rsock_init_unixserver (void)
void rsock_init_socket_constants (void)
void rsock_init_ancdata (void)
void rsock_init_addrinfo (void)
void rsock_init_sockopt (void)
void rsock_init_socket_init (void)

Variables

int rsock_do_not_reverse_lookup
VALUE rb_cBasicSocket
VALUE rb_cIPSocket
VALUE rb_cTCPSocket
VALUE rb_cTCPServer
VALUE rb_cUDPSocket
VALUE rb_cSocket
VALUE rb_cAddrinfo
VALUE rb_cSockOpt
VALUE rb_eSocket


Define Documentation

#define _SS_ALIGNSIZE   (sizeof(double))

Definition at line 123 of file rubysocket.h.

#define _SS_MAXSIZE   128

Definition at line 122 of file rubysocket.h.

#define _SS_PAD1SIZE   (_SS_ALIGNSIZE - sizeof(unsigned char) * 2)

Definition at line 124 of file rubysocket.h.

#define _SS_PAD2SIZE

Value:

(_SS_MAXSIZE - sizeof(unsigned char) * 2 - \
                                _SS_PAD1SIZE - _SS_ALIGNSIZE)

Definition at line 125 of file rubysocket.h.

#define BLOCKING_REGION ( func,
arg   )     (long)rb_thread_blocking_region((func), (arg), RUBY_UBF_IO, 0)

Definition at line 199 of file rubysocket.h.

Referenced by do_select(), rb_getaddrinfo(), rb_getnameinfo(), rb_thread_blocking_region(), rsock_bsock_send(), rsock_connect(), rsock_s_accept(), rsock_s_recvfrom(), and udp_send().

#define EWOULDBLOCK   EAGAIN

Definition at line 88 of file rubysocket.h.

Referenced by io_getpartial(), maygvl_copy_stream_read(), nogvl_copy_stream_write(), pipe_open(), rb_file_flock(), rb_io_wait_readable(), rb_io_wait_writable(), rb_io_write_nonblock(), rb_w32_strerror(), rsock_s_accept_nonblock(), and rsock_s_recvfrom_nonblock().

#define FMODE_NOREVLOOKUP   0x100

Definition at line 170 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 INET_CLIENT   0

Definition at line 165 of file rubysocket.h.

Referenced by tcp_init().

#define INET_SERVER   1

Definition at line 166 of file rubysocket.h.

Referenced by init_inetsock_internal(), and tcp_svr_init().

#define INET_SOCKS   2

Definition at line 167 of file rubysocket.h.

Referenced by init_inetsock_internal().

#define IS_IP_FAMILY ( af   )     ((af) == AF_INET)

Definition at line 115 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(), and sockopt_inspect().

#define pseudo_AF_FTIP   pseudo_AF_RTIP

Definition at line 98 of file rubysocket.h.

#define rsock_bsock_recvmsg   rb_f_notimplement

Definition at line 284 of file rubysocket.h.

Referenced by rsock_init_basicsocket().

#define rsock_bsock_recvmsg_nonblock   rb_f_notimplement

Definition at line 285 of file rubysocket.h.

Referenced by rsock_init_basicsocket().

#define rsock_bsock_sendmsg   rb_f_notimplement

Definition at line 277 of file rubysocket.h.

Referenced by rsock_init_basicsocket().

#define rsock_bsock_sendmsg_nonblock   rb_f_notimplement

Definition at line 278 of file rubysocket.h.

Referenced by rsock_init_basicsocket().

#define RUBY_SOCKET_H   1

Definition at line 2 of file rubysocket.h.

#define SockAddrStringValue (  )     rsock_sockaddr_string_value(&(v))

Definition at line 201 of file rubysocket.h.

Referenced by rsock_bsock_send(), sock_bind(), sock_connect(), and sock_connect_nonblock().

#define SockAddrStringValuePtr (  )     rsock_sockaddr_string_value_ptr(&(v))

Definition at line 202 of file rubysocket.h.

Referenced by sock_s_unpack_sockaddr_in().


Enumeration Type Documentation

enum sock_recv_type

Enumerator:
RECV_RECV 
RECV_IP 
RECV_UNIX 
RECV_SOCKET 

Definition at line 255 of file rubysocket.h.


Function Documentation

NORETURN ( void   rsock_raise_socket_error(const char *, int)  ) 

VALUE rb_check_sockaddr_string_type ( VALUE   ) 

Definition at line 2098 of file raddrinfo.c.

References addrinfo_to_sockaddr(), IS_ADDRINFO, and rb_check_string_type().

Referenced by sock_s_getnameinfo().

int rb_getaddrinfo ( const char *  node,
const char *  service,
const struct addrinfo hints,
struct addrinfo **  res 
)

Definition at line 146 of file raddrinfo.c.

References BLOCKING_REGION, getaddrinfo, getaddrinfo_arg::hints, MEMZERO, nogvl_getaddrinfo(), and getaddrinfo_arg::res.

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 189 of file raddrinfo.c.

References BLOCKING_REGION, getnameinfo_arg::flags, getnameinfo, getnameinfo_arg::host, getnameinfo_arg::hostlen, nogvl_getnameinfo(), 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 addrinfo* rsock_addrinfo ( VALUE  host,
VALUE  port,
int  socktype,
int  flags 
)

Definition at line 369 of file raddrinfo.c.

References AF_UNSPEC, 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().

VALUE rsock_addrinfo_new ( struct sockaddr *  addr,
socklen_t  len,
int  family,
int  socktype,
int  protocol,
VALUE  canonname,
VALUE  inspectname 
)

Definition at line 593 of file raddrinfo.c.

References a(), addrinfo_s_allocate(), alloc_addrinfo(), DATA_PTR, init_addrinfo(), and rb_cAddrinfo.

Referenced by addrinfo_firstonly_new(), addrinfo_list_new(), and rsock_fd_socket_addrinfo().

VALUE rsock_bsock_send ( int  argc,
VALUE argv,
VALUE  sock 
)

Definition at line 536 of file basicsocket.c.

References BLOCKING_REGION, 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_secure(), rb_str_new4, rb_sys_fail, rb_thread_fd_writable(), rsock_send_blocking(), rsock_sendto_blocking(), RSTRING_LENINT, RSTRING_PTR, 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 365 of file init.c.

References BLOCKING_REGION, connect_blocking(), EALREADY, EINPROGRESS, EISCONN, errno, connect_arg::fd, func, connect_arg::len, rb_thread_wait_for(), connect_arg::sockaddr, wait_connectable(), and WAIT_IN_PROGRESS.

Referenced by init_inetsock_internal(), sock_connect(), and udp_connect_internal().

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_int(), and udp_init().

VALUE rsock_fd_socket_addrinfo ( int  fd,
struct sockaddr *  addr,
socklen_t  len 
)

Definition at line 2106 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().

struct addrinfo* rsock_getaddrinfo ( VALUE  host,
VALUE  port,
struct addrinfo hints,
int  socktype_hack 
)

Definition at line 322 of file raddrinfo.c.

References addrinfo::ai_flags, addrinfo::ai_next, addrinfo::ai_protocol, addrinfo::ai_socktype, host_str(), IPPROTO_TCP, IPPROTO_UDP, NI_MAXHOST, NI_MAXSERV, NULL, port_str(), rb_eSocket, rb_getaddrinfo(), rb_raise(), rsock_raise_socket_error(), and str_is_number().

Referenced by call_getaddrinfo(), rsock_addrinfo(), and sock_s_getaddrinfo().

int rsock_getfamily ( int  sockfd  ) 

Definition at line 539 of file init.c.

References AF_UNSPEC, and sockaddr_storage::ss_family.

Referenced by bsock_getsockopt(), and bsock_setsockopt().

void rsock_init_addrinfo ( void   ) 

Definition at line 2149 of file raddrinfo.c.

References addrinfo_afamily(), addrinfo_canonname(), addrinfo_getnameinfo(), addrinfo_initialize(), addrinfo_inspect(), addrinfo_inspect_sockaddr(), 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(), and rb_define_singleton_method().

Referenced by rsock_init_socket_init().

void rsock_init_ancdata ( void   ) 

Definition at line 1771 of file ancdata.c.

References rb_cObject, rb_cSocket, rb_define_class_under(), rb_define_method(), and rb_define_singleton_method().

Referenced by rsock_init_socket_init().

void rsock_init_basicsocket ( void   ) 

Definition at line 739 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_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 120 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 297 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().

VALUE rsock_init_sock ( VALUE  sock,
int  fd 
)

Definition at line 43 of file init.c.

References rb_io_t::fd, FMODE_DUPLEX, FMODE_NOREVLOOKUP, FMODE_READWRITE, fstat, MakeOpenFile, rb_io_t::mode, rb_eArgError, rb_io_ascii8bit_binmode(), rb_io_synchronized(), rb_raise(), rb_sys_fail, rb_w32_is_socket(), rsock_do_not_reverse_lookup, and stat.

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 555 of file init.c.

References rb_define_class(), rb_eSocket, rb_eStandardError, rsock_init_addrinfo(), rsock_init_ancdata(), rsock_init_ipsocket(), rsock_init_socket_constants(), 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_init_sockopt ( void   ) 

Definition at line 669 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_data(), sockopt_family_m(), sockopt_initialize(), sockopt_inspect(), sockopt_int(), sockopt_level_m(), sockopt_linger(), sockopt_optname_m(), sockopt_s_bool(), sockopt_s_int(), sockopt_s_linger(), and sockopt_unpack().

Referenced by rsock_init_socket_init().

void rsock_init_sockssocket ( void   ) 

Definition at line 49 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 137 of file tcpserver.c.

References rb_cTCPServer, rb_cTCPSocket, rb_define_class(), rb_define_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 64 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 255 of file udpsocket.c.

References rb_cIPSocket, rb_cUDPSocket, rb_define_class(), rb_define_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 144 of file unixserver.c.

References rb_define_class(), rb_define_method(), and rsock_sock_listen().

Referenced by rsock_init_socket_init().

VALUE rsock_init_unixsock ( VALUE  sock,
VALUE  path,
int  server 
)

void rsock_init_unixsocket ( void   ) 

Definition at line 498 of file unixsocket.c.

References rb_cBasicSocket, rb_define_class(), rb_define_method(), and rb_define_singleton_method().

Referenced by rsock_init_socket_init().

VALUE rsock_io_socket_addrinfo ( VALUE  io,
struct sockaddr *  addr,
socklen_t  len 
)

Definition at line 2125 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, and TYPE.

Referenced by rsock_s_recvfrom(), rsock_s_recvfrom_nonblock(), sock_accept(), sock_accept_nonblock(), and sock_sysaccept().

VALUE rsock_ipaddr ( struct sockaddr *  sockaddr,
int  norevlookup 
)

Definition at line 381 of file raddrinfo.c.

References id, INT2FIX, NI_NUMERICHOST, NI_NUMERICSERV, NULL, Qnil, rb_ary_new3(), rb_getnameinfo(), rb_id2str(), rb_str_dup(), rb_str_new2, rsock_intern_family(), rsock_raise_socket_error(), and SA_LEN.

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(), and sockopt_s_int().

VALUE rsock_make_hostent ( VALUE  host,
struct addrinfo addr,
VALUE(*)(struct sockaddr *, size_t)  ipaddr 
)

Definition at line 496 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().

VALUE rsock_make_ipaddr ( struct sockaddr *  addr  ) 

Definition at line 222 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(), and sockopt_s_int().

int rsock_revlookup_flag ( VALUE  revlookup,
int *  norevlookup 
)

Definition at line 140 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().

VALUE rsock_s_accept ( VALUE  klass,
int  fd,
struct sockaddr *  sockaddr,
socklen_t *  len 
)

Definition at line 506 of file init.c.

References accept_blocking(), BLOCKING_REGION, errno, accept_arg::fd, INT2NUM(), accept_arg::len, rb_gc(), rb_io_wait_readable(), rb_obj_alloc(), rb_secure(), rb_sys_fail, rb_thread_wait_fd(), rsock_init_sock(), and accept_arg::sockaddr.

Referenced by sock_accept(), sock_sysaccept(), tcp_accept(), and tcp_sysaccept().

VALUE rsock_s_accept_nonblock ( VALUE  klass,
rb_io_t fptr,
struct sockaddr *  sockaddr,
socklen_t *  len 
)

Definition at line 467 of file init.c.

References ECONNABORTED, errno, EWOULDBLOCK, rb_io_t::fd, make_fd_nonblock(), rb_io_set_nonblock(), rb_mod_sys_fail(), rb_mWaitReadable, rb_obj_alloc(), rb_secure(), rb_sys_fail, and rsock_init_sock().

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 104 of file init.c.

References recvfrom_arg::alen, BLOCKING_REGION, 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_eRuntimeError, rb_eTypeError, rb_io_check_closed(), rb_io_read_pending(), rb_io_wait_readable(), rb_obj_taint(), rb_raise(), rb_scan_args(), rb_str_set_len, rb_sys_fail, rb_tainted_str_new(), rb_thread_wait_fd(), RBASIC, RECV_IP, RECV_RECV, RECV_SOCKET, RECV_UNIX, recvfrom_blocking(), rsock_io_socket_addrinfo(), rsock_ipaddr(), RSTRING_LEN, and recvfrom_arg::str.

Referenced by bsock_recv(), ip_recvfrom(), and sock_recvfrom().

VALUE rsock_s_recvfrom_nonblock ( VALUE  sock,
int  argc,
VALUE argv,
enum sock_recv_type  from 
)

Definition at line 172 of file init.c.

References buf, errno, EWOULDBLOCK, rb_io_t::fd, FMODE_NOREVLOOKUP, GetOpenFile, len, rb_io_t::mode, NUM2INT, Qnil, rb_assoc_new(), rb_bug(), rb_eIOError, rb_io_check_closed(), rb_io_read_pending(), rb_io_set_nonblock(), rb_mod_sys_fail(), rb_mWaitReadable, rb_obj_taint(), rb_raise(), rb_scan_args(), rb_str_set_len, rb_sys_fail, rb_tainted_str_new(), RECV_IP, RECV_RECV, RECV_SOCKET, rsock_io_socket_addrinfo(), rsock_ipaddr(), RSTRING_LEN, RSTRING_PTR, and recvfrom_arg::str.

Referenced by bsock_recv_nonblock(), sock_recvfrom_nonblock(), and udp_recvfrom_nonblock().

VALUE rsock_send_blocking ( void *  data  ) 

Definition at line 80 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 71 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().

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().

VALUE rsock_sock_listen ( VALUE  sock,
VALUE  log 
)

Definition at line 496 of file socket.c.

References rb_io_t::fd, GetOpenFile, INT2FIX, NUM2INT, rb_secure(), and rb_sys_fail.

Referenced by Init_socket(), rsock_init_tcpserver(), and rsock_init_unixserver().

VALUE rsock_sock_s_socketpair ( int  argc,
VALUE argv,
VALUE  klass 
)

VALUE rsock_sockaddr_string_value ( volatile VALUE  ) 

Definition at line 2080 of file raddrinfo.c.

References addrinfo_to_sockaddr(), IS_ADDRINFO, and StringValue.

Referenced by rsock_sockaddr_string_value_ptr().

char* rsock_sockaddr_string_value_ptr ( volatile VALUE  ) 

Definition at line 2091 of file raddrinfo.c.

References rsock_sockaddr_string_value(), and RSTRING_PTR.

int rsock_socket ( int  domain,
int  type,
int  proto 
)

Definition at line 242 of file init.c.

References errno, and rb_gc().

Referenced by init_inetsock_internal(), sock_initialize(), and udp_init().

VALUE rsock_sockopt_new ( int  family,
int  level,
int  optname,
VALUE  data 
)

Definition at line 62 of file option.c.

References INT2NUM(), NEWOBJ, OBJSETUP, rb_cSockOpt, sockopt_initialize(), StringValue, and T_OBJECT.

Referenced by bsock_getsockopt(), sockopt_s_bool(), sockopt_s_int(), 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(), call_getaddrinfo(), setup_domain_and_type(), and sock_s_getaddrinfo().


Variable Documentation

VALUE rb_cAddrinfo

Definition at line 23 of file init.c.

Referenced by 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_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_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().


Generated on Wed Aug 10 09:18:24 2011 for Ruby by  doxygen 1.4.7