Ruby  2.5.0dev(2017-10-22revision60238)
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
rubysocket.h File Reference
#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
 

Macros

#define SOCKLEN_MAX
 
#define RSTRING_SOCKLEN   (socklen_t)RSTRING_LENINT
 
#define EWOULDBLOCK   EAGAIN
 
#define pseudo_AF_FTIP   pseudo_AF_RTIP
 
#define IS_IP_FAMILY(af)   ((af) == AF_INET)
 
#define IN6_IS_ADDR_UNIQUE_LOCAL(a)   (((a)->s6_addr[0] == 0xfc) || ((a)->s6_addr[0] == 0xfd))
 
#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 FMODE_UNIX   0x00200000
 
#define FMODE_INET   0x00400000
 
#define FMODE_INET6   0x00800000
 
#define FMODE_SOCK   (FMODE_UNIX|FMODE_INET|FMODE_INET6)
 
#define BLOCKING_REGION_FD(func, arg)   (long)rb_thread_io_blocking_region((func), (arg), (arg)->fd)
 
#define SockAddrStringValue(v)   rsock_sockaddr_string_value(&(v))
 
#define SockAddrStringValuePtr(v)   rsock_sockaddr_string_value_ptr(&(v))
 
#define SockAddrStringValueWithAddrinfo(v, rai_ret)   rsock_sockaddr_string_value_with_addrinfo(&(v), &(rai_ret))
 
#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
 
#define rsock_maybe_fd_writable(fd)   rb_thread_fd_writable((fd))
 
#define rsock_maybe_wait_fd(fd)   rb_thread_wait_fd((fd))
 
#define MSG_DONTWAIT_RELIABLE   0
 

Typedefs

typedef int socklen_t
 

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 rsock_sockaddr_string_value_with_addrinfo (volatile VALUE *v, VALUE *ai_ret)
 
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 (rb_io_t *fptr)
 
int rb_getaddrinfo (const char *node, const char *service, const struct addrinfo *hints, struct rb_addrinfo **res)
 
void rb_freeaddrinfo (struct rb_addrinfo *ai)
 
VALUE rsock_freeaddrinfo (VALUE arg)
 
int rb_getnameinfo (const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags)
 
int rsock_fd_family (int fd)
 
struct rb_addrinforsock_addrinfo (VALUE host, VALUE port, int family, int socktype, int flags)
 
struct rb_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_addrinfo_inspect_sockaddr (VALUE rai)
 
VALUE rsock_make_ipaddr (struct sockaddr *addr, socklen_t addrlen)
 
VALUE rsock_ipaddr (struct sockaddr *sockaddr, socklen_t sockaddrlen, int norevlookup)
 
VALUE rsock_make_hostent (VALUE host, struct rb_addrinfo *addr, VALUE(*ipaddr)(struct sockaddr *, socklen_t))
 
VALUE rsock_inspect_sockaddr (struct sockaddr *addr, socklen_t socklen, VALUE ret)
 
socklen_t rsock_sockaddr_len (struct sockaddr *addr)
 
VALUE rsock_sockaddr_obj (struct sockaddr *addr, socklen_t len)
 
int rsock_revlookup_flag (VALUE revlookup, int *norevlookup)
 
int rsock_socket (int domain, int type, int proto)
 
int rsock_detect_cloexec (int fd)
 
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, VALUE len, VALUE flg, VALUE str, VALUE ex, 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, VALUE ex, 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_sockifaddr (void)
 
void rsock_init_socket_init (void)
 
 NORETURN (void rsock_syserr_fail_host_port(int err, const char *, VALUE, VALUE))
 
 NORETURN (void rsock_syserr_fail_path(int err, const char *, VALUE))
 
 NORETURN (void rsock_syserr_fail_sockaddr(int err, const char *mesg, struct sockaddr *addr, socklen_t len))
 
 NORETURN (void rsock_syserr_fail_raddrinfo(int err, const char *mesg, VALUE rai))
 
 NORETURN (void rsock_syserr_fail_raddrinfo_or_sockaddr(int err, const char *mesg, VALUE addr, VALUE rai))
 
 NORETURN (void rsock_sys_fail_host_port(const char *, VALUE, VALUE))
 
 NORETURN (void rsock_sys_fail_path(const char *, VALUE))
 
 NORETURN (void rsock_sys_fail_sockaddr(const char *, struct sockaddr *addr, socklen_t len))
 
 NORETURN (void rsock_sys_fail_raddrinfo(const char *, VALUE rai))
 
 NORETURN (void rsock_sys_fail_raddrinfo_or_sockaddr(const char *, VALUE addr, VALUE rai))
 
const char * inet_ntop (int, const void *, char *, size_t)
 

Variables

int rsock_do_not_reverse_lookup
 
int rsock_cmsg_cloexec_state
 
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
 

Macro Definition Documentation

◆ _SS_ALIGNSIZE

#define _SS_ALIGNSIZE   (sizeof(double))

Definition at line 168 of file rubysocket.h.

◆ _SS_MAXSIZE

#define _SS_MAXSIZE   128

Definition at line 167 of file rubysocket.h.

◆ _SS_PAD1SIZE

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

Definition at line 169 of file rubysocket.h.

◆ _SS_PAD2SIZE

#define _SS_PAD2SIZE
Value:
(_SS_MAXSIZE - sizeof(unsigned char) * 2 - \
#define _SS_ALIGNSIZE
Definition: rubysocket.h:168
#define _SS_MAXSIZE
Definition: rubysocket.h:167
#define _SS_PAD1SIZE
Definition: rubysocket.h:169

Definition at line 170 of file rubysocket.h.

◆ BLOCKING_REGION_FD

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

◆ EWOULDBLOCK

#define EWOULDBLOCK   EAGAIN

Definition at line 128 of file rubysocket.h.

Referenced by rb_w32_strerror().

◆ FMODE_INET

#define FMODE_INET   0x00400000

Definition at line 231 of file rubysocket.h.

Referenced by rsock_getfamily().

◆ FMODE_INET6

#define FMODE_INET6   0x00800000

Definition at line 232 of file rubysocket.h.

Referenced by rsock_getfamily().

◆ FMODE_NOREVLOOKUP

#define FMODE_NOREVLOOKUP   0x100

Definition at line 227 of file rubysocket.h.

Referenced by rsock_init_sock().

◆ FMODE_SOCK

#define FMODE_SOCK   (FMODE_UNIX|FMODE_INET|FMODE_INET6)

Definition at line 233 of file rubysocket.h.

Referenced by rsock_getfamily().

◆ FMODE_UNIX

#define FMODE_UNIX   0x00200000

Definition at line 230 of file rubysocket.h.

Referenced by rsock_getfamily().

◆ IN6_IS_ADDR_UNIQUE_LOCAL

#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.

◆ INET_CLIENT

#define INET_CLIENT   0

Definition at line 221 of file rubysocket.h.

◆ INET_SERVER

#define INET_SERVER   1

Definition at line 222 of file rubysocket.h.

◆ INET_SOCKS

#define INET_SOCKS   2

Definition at line 223 of file rubysocket.h.

◆ IS_IP_FAMILY

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

Definition at line 156 of file rubysocket.h.

Referenced by rsock_cmsg_type_arg(), rsock_level_arg(), and rsock_optname_arg().

◆ MSG_DONTWAIT_RELIABLE

#define MSG_DONTWAIT_RELIABLE   0

Definition at line 430 of file rubysocket.h.

◆ pseudo_AF_FTIP

#define pseudo_AF_FTIP   pseudo_AF_RTIP

Definition at line 138 of file rubysocket.h.

◆ rsock_bsock_recvmsg

#define rsock_bsock_recvmsg   rb_f_notimplement

Definition at line 371 of file rubysocket.h.

◆ rsock_bsock_recvmsg_nonblock

#define rsock_bsock_recvmsg_nonblock   rb_f_notimplement

Definition at line 372 of file rubysocket.h.

◆ rsock_bsock_sendmsg

#define rsock_bsock_sendmsg   rb_f_notimplement

Definition at line 360 of file rubysocket.h.

◆ rsock_bsock_sendmsg_nonblock

#define rsock_bsock_sendmsg_nonblock   rb_f_notimplement

Definition at line 361 of file rubysocket.h.

◆ rsock_maybe_fd_writable

#define rsock_maybe_fd_writable (   fd)    rb_thread_fd_writable((fd))

Definition at line 421 of file rubysocket.h.

Referenced by rsock_bsock_send().

◆ rsock_maybe_wait_fd

#define rsock_maybe_wait_fd (   fd)    rb_thread_wait_fd((fd))

Definition at line 422 of file rubysocket.h.

Referenced by rsock_s_accept().

◆ RSTRING_SOCKLEN

#define RSTRING_SOCKLEN   (socklen_t)RSTRING_LENINT

Definition at line 124 of file rubysocket.h.

Referenced by rsock_bsock_send(), and rsock_ipaddr().

◆ SockAddrStringValue

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

Definition at line 264 of file rubysocket.h.

Referenced by rsock_bsock_send().

◆ SockAddrStringValuePtr

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

Definition at line 265 of file rubysocket.h.

◆ SockAddrStringValueWithAddrinfo

#define SockAddrStringValueWithAddrinfo (   v,
  rai_ret 
)    rsock_sockaddr_string_value_with_addrinfo(&(v), &(rai_ret))

Definition at line 266 of file rubysocket.h.

◆ SOCKLEN_MAX

#define SOCKLEN_MAX
Value:
(0 < (socklen_t)-1 ? \
~(socklen_t)0 : \
(((((socklen_t)1) << (sizeof(socklen_t) * CHAR_BIT - 2)) - 1) * 2 + 1))
int socklen_t
Definition: rubysocket.h:108
int socklen_t
Definition: getaddrinfo.c:83
#define CHAR_BIT
Definition: ruby.h:196

Definition at line 118 of file rubysocket.h.

Referenced by rsock_ipaddr().

Typedef Documentation

◆ socklen_t

typedef int socklen_t

Definition at line 108 of file rubysocket.h.

Enumeration Type Documentation

◆ sock_recv_type

Enumerator
RECV_RECV 
RECV_IP 
RECV_UNIX 
RECV_SOCKET 

Definition at line 334 of file rubysocket.h.

Function Documentation

◆ inet_ntop()

const char* inet_ntop ( int  ,
const void *  ,
char *  ,
size_t   
)

Definition at line 651 of file option.c.

References snprintf.

◆ NORETURN() [1/11]

NORETURN ( void   rsock_raise_socket_errorconst char *, int)

◆ NORETURN() [2/11]

NORETURN ( void   rsock_syserr_fail_host_portint err, const char *, VALUE, VALUE)

◆ NORETURN() [3/11]

NORETURN ( void   rsock_syserr_fail_pathint err, const char *, VALUE)

◆ NORETURN() [4/11]

NORETURN ( void   rsock_syserr_fail_sockaddrint err, const char *mesg, struct sockaddr *addr, socklen_t len)

◆ NORETURN() [5/11]

NORETURN ( void   rsock_syserr_fail_raddrinfoint err, const char *mesg, VALUE rai)

◆ NORETURN() [6/11]

NORETURN ( void   rsock_syserr_fail_raddrinfo_or_sockaddrint err, const char *mesg, VALUE addr, VALUE rai)

◆ NORETURN() [7/11]

NORETURN ( void   rsock_sys_fail_host_portconst char *, VALUE, VALUE)

◆ NORETURN() [8/11]

NORETURN ( void   rsock_sys_fail_pathconst char *, VALUE)

◆ NORETURN() [9/11]

NORETURN ( void   rsock_sys_fail_sockaddrconst char *, struct sockaddr *addr, socklen_t len)

◆ NORETURN() [10/11]

NORETURN ( void   rsock_sys_fail_raddrinfoconst char *, VALUE rai)

◆ NORETURN() [11/11]

NORETURN ( void   rsock_sys_fail_raddrinfo_or_sockaddrconst char *, VALUE addr, VALUE rai)

◆ rb_check_sockaddr_string_type()

VALUE rb_check_sockaddr_string_type ( VALUE  )

Definition at line 2507 of file raddrinfo.c.

References IS_ADDRINFO.

◆ rb_freeaddrinfo()

void rb_freeaddrinfo ( struct rb_addrinfo ai)

◆ rb_getaddrinfo()

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.

◆ rb_getnameinfo()

int rb_getnameinfo ( const struct sockaddr *  sa,
socklen_t  salen,
char *  host,
size_t  hostlen,
char *  serv,
size_t  servlen,
int  flags 
)

◆ rsock_addrinfo()

struct rb_addrinfo* rsock_addrinfo ( VALUE  host,
VALUE  port,
int  family,
int  socktype,
int  flags 
)

◆ rsock_addrinfo_inspect_sockaddr()

VALUE rsock_addrinfo_inspect_sockaddr ( VALUE  rai)

Definition at line 1517 of file raddrinfo.c.

Referenced by rsock_syserr_fail_raddrinfo().

◆ rsock_addrinfo_new()

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

Definition at line 798 of file raddrinfo.c.

Referenced by rsock_syserr_fail_sockaddr().

◆ rsock_bsock_send()

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

◆ rsock_cmsg_type_arg()

int rsock_cmsg_type_arg ( int  family,
int  level,
VALUE  type 
)

Definition at line 100 of file constants.c.

References IS_IP_FAMILY.

◆ rsock_connect()

int rsock_connect ( int  fd,
const struct sockaddr *  sockaddr,
int  len,
int  socks 
)

Definition at line 454 of file init.c.

◆ rsock_detect_cloexec()

int rsock_detect_cloexec ( int  fd)

Definition at line 284 of file init.c.

References errno, F_GETFD, fcntl(), FD_CLOEXEC, recvfrom_arg::flags, rb_bug(), and strerror().

◆ rsock_family_arg()

int rsock_family_arg ( VALUE  domain)

Definition at line 43 of file constants.c.

◆ rsock_fd_family()

int rsock_fd_family ( int  fd)

Definition at line 534 of file raddrinfo.c.

References AF_UNSPEC, and offsetof.

◆ rsock_fd_socket_addrinfo()

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

Definition at line 2515 of file raddrinfo.c.

Referenced by rsock_io_socket_addrinfo().

◆ rsock_freeaddrinfo()

VALUE rsock_freeaddrinfo ( VALUE  arg)

Definition at line 696 of file raddrinfo.c.

References Qnil, and rb_freeaddrinfo().

◆ rsock_getaddrinfo()

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

Definition at line 506 of file raddrinfo.c.

References NI_MAXHOST, NI_MAXSERV, and NULL.

Referenced by rsock_addrinfo().

◆ rsock_getfamily()

int rsock_getfamily ( rb_io_t fptr)

◆ rsock_init_addrinfo()

void rsock_init_addrinfo ( void  )

Definition at line 2560 of file raddrinfo.c.

References rb_cAddrinfo, rb_cData, rb_define_alloc_func(), and rb_define_class().

Referenced by rsock_init_socket_init().

◆ rsock_init_ancdata()

void rsock_init_ancdata ( void  )

◆ rsock_init_basicsocket()

void rsock_init_basicsocket ( void  )

◆ rsock_init_inetsock()

VALUE rsock_init_inetsock ( VALUE  sock,
VALUE  remote_host,
VALUE  remote_serv,
VALUE  local_host,
VALUE  local_serv,
int  type 
)

◆ rsock_init_ipsocket()

void rsock_init_ipsocket ( void  )

Definition at line 364 of file ipsocket.c.

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

Referenced by rsock_init_socket_init().

◆ rsock_init_sock()

VALUE rsock_init_sock ( VALUE  sock,
int  fd 
)

◆ rsock_init_socket_constants()

void rsock_init_socket_constants ( void  )

Definition at line 141 of file constants.c.

Referenced by rsock_init_socket_init().

◆ rsock_init_socket_init()

void rsock_init_socket_init ( void  )

◆ rsock_init_sockifaddr()

void rsock_init_sockifaddr ( void  )

◆ rsock_init_sockopt()

void rsock_init_sockopt ( void  )

Definition at line 1438 of file option.c.

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

Referenced by rsock_init_socket_init().

◆ rsock_init_sockssocket()

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

◆ rsock_init_tcpserver()

void rsock_init_tcpserver ( void  )

Definition at line 106 of file tcpserver.c.

References rb_cTCPServer, rb_cTCPSocket, rb_define_class(), and rb_define_method().

Referenced by rsock_init_socket_init().

◆ rsock_init_tcpsocket()

void rsock_init_tcpsocket ( void  )

◆ rsock_init_udpsocket()

void rsock_init_udpsocket ( void  )

Definition at line 227 of file udpsocket.c.

References rb_cIPSocket, rb_cUDPSocket, rb_define_class(), and rb_define_method().

Referenced by rsock_init_socket_init().

◆ rsock_init_unixserver()

void rsock_init_unixserver ( void  )

◆ rsock_init_unixsock()

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

◆ rsock_init_unixsocket()

void rsock_init_unixsocket ( void  )

◆ rsock_inspect_sockaddr()

VALUE rsock_inspect_sockaddr ( struct sockaddr *  addr,
socklen_t  socklen,
VALUE  ret 
)

◆ rsock_io_socket_addrinfo()

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

◆ rsock_ipaddr()

VALUE rsock_ipaddr ( struct sockaddr *  sockaddr,
socklen_t  sockaddrlen,
int  norevlookup 
)

◆ rsock_level_arg()

int rsock_level_arg ( int  family,
VALUE  level 
)

Definition at line 57 of file constants.c.

References IS_IP_FAMILY.

◆ rsock_make_hostent()

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

◆ rsock_make_ipaddr()

VALUE rsock_make_ipaddr ( struct sockaddr *  addr,
socklen_t  addrlen 
)

Definition at line 396 of file raddrinfo.c.

◆ rsock_optname_arg()

int rsock_optname_arg ( int  family,
int  level,
VALUE  optname 
)

Definition at line 69 of file constants.c.

References IS_IP_FAMILY.

◆ rsock_revlookup_flag()

int rsock_revlookup_flag ( VALUE  revlookup,
int *  norevlookup 
)

Definition at line 172 of file ipsocket.c.

References Check_Type, id, Qfalse, Qnil, Qtrue, return_norevlookup, SYM2ID, and T_SYMBOL.

◆ rsock_s_accept()

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

◆ rsock_s_accept_nonblock()

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

◆ rsock_s_recvfrom()

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

Definition at line 146 of file init.c.

References recvfrom_arg::flags, len, NUM2INT, Qnil, rb_scan_args(), and recvfrom_arg::str.

◆ rsock_s_recvfrom_nonblock()

VALUE rsock_s_recvfrom_nonblock ( VALUE  sock,
VALUE  len,
VALUE  flg,
VALUE  str,
VALUE  ex,
enum sock_recv_type  from 
)

◆ rsock_send_blocking()

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

◆ rsock_sendto_blocking()

VALUE rsock_sendto_blocking ( void *  data)

◆ rsock_shutdown_how_arg()

int rsock_shutdown_how_arg ( VALUE  how)

Definition at line 131 of file constants.c.

◆ rsock_sock_listen()

VALUE rsock_sock_listen ( VALUE  sock,
VALUE  log 
)

Definition at line 644 of file socket.c.

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

Referenced by rsock_init_unixserver().

◆ rsock_sock_s_socketpair()

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

◆ rsock_sockaddr_len()

socklen_t rsock_sockaddr_len ( struct sockaddr *  addr)

◆ rsock_sockaddr_obj()

VALUE rsock_sockaddr_obj ( struct sockaddr *  addr,
socklen_t  len 
)

◆ rsock_sockaddr_string_value()

VALUE rsock_sockaddr_string_value ( volatile VALUE )

Definition at line 2476 of file raddrinfo.c.

References IS_ADDRINFO, and val.

Referenced by rsock_sockaddr_string_value_ptr().

◆ rsock_sockaddr_string_value_ptr()

char* rsock_sockaddr_string_value_ptr ( volatile VALUE )

Definition at line 2500 of file raddrinfo.c.

References rsock_sockaddr_string_value(), and RSTRING_PTR.

◆ rsock_sockaddr_string_value_with_addrinfo()

VALUE rsock_sockaddr_string_value_with_addrinfo ( volatile VALUE v,
VALUE ai_ret 
)

Definition at line 2487 of file raddrinfo.c.

References IS_ADDRINFO, Qnil, and val.

◆ rsock_socket()

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

Definition at line 357 of file init.c.

References recvfrom_arg::fd.

◆ rsock_sockopt_new()

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

Definition at line 107 of file option.c.

References NEWOBJ_OF, rb_cSockOpt, StringValue, and T_OBJECT.

◆ rsock_socktype_arg()

int rsock_socktype_arg ( VALUE  type)

Definition at line 50 of file constants.c.

Variable Documentation

◆ rb_cAddrinfo

VALUE rb_cAddrinfo

Definition at line 23 of file init.c.

Referenced by rsock_init_addrinfo().

◆ rb_cBasicSocket

VALUE rb_cBasicSocket

◆ rb_cIPSocket

VALUE rb_cIPSocket

Definition at line 14 of file init.c.

Referenced by rsock_init_ipsocket(), rsock_init_tcpsocket(), and rsock_init_udpsocket().

◆ rb_cSocket

VALUE rb_cSocket

Definition at line 22 of file init.c.

Referenced by Init_socket(), rsock_init_ancdata(), rsock_init_sockifaddr(), and rsock_init_sockopt().

◆ rb_cSockOpt

VALUE rb_cSockOpt

Definition at line 3 of file option.c.

Referenced by rsock_init_sockopt(), and rsock_sockopt_new().

◆ rb_cTCPServer

VALUE rb_cTCPServer

Definition at line 16 of file init.c.

Referenced by rsock_init_tcpserver().

◆ rb_cTCPSocket

VALUE rb_cTCPSocket

Definition at line 15 of file init.c.

Referenced by rsock_init_sockssocket(), rsock_init_tcpserver(), and rsock_init_tcpsocket().

◆ rb_cUDPSocket

VALUE rb_cUDPSocket

Definition at line 17 of file init.c.

Referenced by rsock_init_udpsocket().

◆ rb_eSocket

VALUE rb_eSocket

Definition at line 25 of file init.c.

Referenced by rsock_init_socket_init(), and rsock_raise_socket_error().

◆ rsock_cmsg_cloexec_state

int rsock_cmsg_cloexec_state

Definition at line 5 of file ancdata.c.

◆ rsock_do_not_reverse_lookup

int rsock_do_not_reverse_lookup

Definition at line 31 of file init.c.

Referenced by rsock_init_sock().