Ruby  2.7.1p83(2020-03-31revisiona0c7c23c9cec0d0ffcba012279cd652d28ad5bf3)
Data Structures | Macros | Functions | Variables
init.c File Reference
#include "rubysocket.h"

Go to the source code of this file.

Data Structures

struct  recvfrom_arg
 
struct  connect_arg
 
struct  accept_arg
 

Macros

#define do_write_retry(code)   ret = code
 

Functions

void rsock_raise_socket_error (const char *reason, int error)
 
VALUE rsock_init_sock (VALUE sock, int fd)
 
VALUE rsock_sendto_blocking (void *data)
 
VALUE rsock_send_blocking (void *data)
 
VALUE rsock_s_recvfrom (VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
 
VALUE rsock_s_recvfrom_nonblock (VALUE sock, VALUE len, VALUE flg, VALUE str, VALUE ex, enum sock_recv_type from)
 
int rsock_detect_cloexec (int fd)
 
int rsock_socket (int domain, int type, int proto)
 
int rsock_connect (int fd, const struct sockaddr *sockaddr, int len, int socks)
 
void rsock_make_fd_nonblock (int fd)
 
VALUE rsock_s_accept_nonblock (VALUE klass, VALUE ex, rb_io_t *fptr, struct sockaddr *sockaddr, socklen_t *len)
 
VALUE rsock_s_accept (VALUE klass, int fd, struct sockaddr *sockaddr, socklen_t *len)
 
int rsock_getfamily (rb_io_t *fptr)
 
void rsock_init_socket_init (void)
 

Variables

VALUE rb_cBasicSocket
 
VALUE rb_cIPSocket
 
VALUE rb_cTCPSocket
 
VALUE rb_cTCPServer
 
VALUE rb_cUDPSocket
 
VALUE rb_cSocket
 
VALUE rb_cAddrinfo
 
VALUE rb_eSocket
 
int rsock_do_not_reverse_lookup = 1
 

Macro Definition Documentation

◆ do_write_retry

#define do_write_retry (   code)    ret = code

Definition at line 74 of file init.c.

Function Documentation

◆ rsock_connect()

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

Definition at line 607 of file init.c.

◆ rsock_detect_cloexec()

int rsock_detect_cloexec ( int  fd)

Definition at line 412 of file init.c.

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

◆ rsock_getfamily()

int rsock_getfamily ( rb_io_t fptr)

◆ rsock_init_sock()

VALUE rsock_init_sock ( VALUE  sock,
int  fd 
)

◆ rsock_init_socket_init()

void rsock_init_socket_init ( void  )

◆ rsock_make_fd_nonblock()

void rsock_make_fd_nonblock ( int  fd)

Definition at line 638 of file init.c.

References F_SETFL, fcntl(), connect_arg::fd, O_NONBLOCK, and rb_sys_fail().

◆ rsock_raise_socket_error()

void rsock_raise_socket_error ( const char reason,
int  error 
)

◆ rsock_s_accept()

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

Definition at line 751 of file init.c.

References arg, BLOCKING_REGION_FD, accept_arg::fd, int, len, rsock_maybe_wait_fd, and accept_arg::sockaddr.

◆ 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 709 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 169 of file init.c.

References arg, argc, argv, len, NUM2INT, Qnil, rb_scan_args, and 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 
)

Definition at line 231 of file init.c.

References recvfrom_arg::alen, buf, recvfrom_arg::fd, recvfrom_arg::flags, len, NUM2INT, Qnil, and str.

◆ rsock_send_blocking()

VALUE rsock_send_blocking ( void data)

Definition at line 111 of file init.c.

References arg, do_write_retry, rsock_send_arg::mesg, RSTRING_LEN, and RSTRING_PTR.

Referenced by rsock_bsock_send().

◆ rsock_sendto_blocking()

VALUE rsock_sendto_blocking ( void data)

Definition at line 100 of file init.c.

References arg, do_write_retry, rsock_send_arg::mesg, RSTRING_LEN, and RSTRING_PTR.

Referenced by rsock_bsock_send().

◆ rsock_socket()

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

Definition at line 491 of file init.c.

References recvfrom_arg::fd.

Variable Documentation

◆ rb_cAddrinfo

VALUE rb_cAddrinfo

Definition at line 27 of file init.c.

◆ rb_cBasicSocket

VALUE rb_cBasicSocket

◆ rb_cIPSocket

VALUE rb_cIPSocket

Definition at line 18 of file init.c.

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

◆ rb_cSocket

VALUE rb_cSocket

Definition at line 26 of file init.c.

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

◆ rb_cTCPServer

VALUE rb_cTCPServer

Definition at line 20 of file init.c.

Referenced by rsock_init_tcpserver().

◆ rb_cTCPSocket

VALUE rb_cTCPSocket

Definition at line 19 of file init.c.

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

◆ rb_cUDPSocket

VALUE rb_cUDPSocket

Definition at line 21 of file init.c.

Referenced by rsock_init_udpsocket().

◆ rb_eSocket

VALUE rb_eSocket

Definition at line 29 of file init.c.

Referenced by rsock_init_socket_init().

◆ rsock_do_not_reverse_lookup

int rsock_do_not_reverse_lookup = 1

Definition at line 35 of file init.c.

Referenced by rsock_init_sock().