Ruby  2.4.2p198(2017-09-14revision59899)
Data Structures | Functions | Variables
init.c File Reference
#include "rubysocket.h"
Include dependency graph for init.c:

Go to the source code of this file.

Data Structures

struct  recvfrom_arg
 
struct  connect_arg
 
struct  accept_arg
 

Functions

void rsock_raise_socket_error (const char *reason, int error)
 
static int is_socket (int fd)
 
VALUE rsock_init_sock (VALUE sock, int fd)
 
VALUE rsock_sendto_blocking (void *data)
 
VALUE rsock_send_blocking (void *data)
 
static VALUE recvfrom_blocking (void *data)
 
static VALUE rsock_strbuf (VALUE str, long buflen)
 
static VALUE recvfrom_locktmp (VALUE v)
 
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)
 
static int rsock_socket0 (int domain, int type, int proto)
 
int rsock_socket (int domain, int type, int proto)
 
static int wait_connectable (int fd)
 
static VALUE connect_blocking (void *data)
 
int rsock_connect (int fd, const struct sockaddr *sockaddr, int len, int socks)
 
static void make_fd_nonblock (int fd)
 
static int cloexec_accept (int socket, struct sockaddr *address, socklen_t *address_len, int nonblock)
 
VALUE rsock_s_accept_nonblock (VALUE klass, VALUE ex, rb_io_t *fptr, struct sockaddr *sockaddr, socklen_t *len)
 
static VALUE accept_blocking (void *data)
 
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
 
static VALUE sym_wait_readable
 

Function Documentation

◆ accept_blocking()

static VALUE accept_blocking ( void *  data)
static

Definition at line 588 of file init.c.

References cloexec_accept(), accept_arg::fd, accept_arg::len, and accept_arg::sockaddr.

Referenced by rsock_s_accept().

◆ cloexec_accept()

static int cloexec_accept ( int  socket,
struct sockaddr *  address,
socklen_t address_len,
int  nonblock 
)
static

◆ connect_blocking()

static VALUE connect_blocking ( void *  data)
static

Definition at line 438 of file init.c.

References connect_arg::fd, connect_arg::len, and connect_arg::sockaddr.

Referenced by rsock_connect().

◆ is_socket()

static int is_socket ( int  fd)
static

Definition at line 49 of file init.c.

References fstat, rb_sys_fail(), and stat.

Referenced by rsock_init_sock().

◆ make_fd_nonblock()

static void make_fd_nonblock ( int  fd)
static

Definition at line 485 of file init.c.

References F_SETFL, fcntl(), recvfrom_arg::flags, O_NONBLOCK, and rb_sys_fail().

Referenced by cloexec_accept().

◆ recvfrom_blocking()

static VALUE recvfrom_blocking ( void *  data)
static

◆ recvfrom_locktmp()

static VALUE recvfrom_locktmp ( VALUE  v)
static

Definition at line 138 of file init.c.

References recvfrom_arg::fd, rb_thread_io_blocking_region(), and recvfrom_blocking().

Referenced by rsock_s_recvfrom().

◆ rsock_connect()

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

◆ rsock_detect_cloexec()

int rsock_detect_cloexec ( int  fd)

◆ 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_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 
)

◆ rsock_s_accept_nonblock()

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

◆ rsock_s_recvfrom()

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

◆ 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_socket()

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

◆ rsock_socket0()

static int rsock_socket0 ( int  domain,
int  type,
int  proto 
)
static

Definition at line 344 of file init.c.

References rb_fd_fix_cloexec().

Referenced by rsock_detect_cloexec(), and rsock_socket().

◆ rsock_strbuf()

static VALUE rsock_strbuf ( VALUE  str,
long  buflen 
)
static

◆ wait_connectable()

static int wait_connectable ( int  fd)
static

Definition at line 374 of file init.c.

References EALREADY, EINPROGRESS, EISCONN, errno, NULL, rb_wait_for_single_fd(), RB_WAITFD_IN, and RB_WAITFD_OUT.

Referenced by rsock_connect().

Variable Documentation

◆ rb_cAddrinfo

VALUE rb_cAddrinfo

Definition at line 23 of file init.c.

Referenced by addrinfo_s_udp(), rsock_addrinfo_new(), and 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

◆ rb_cTCPServer

VALUE rb_cTCPServer

Definition at line 16 of file init.c.

Referenced by rsock_init_tcpserver().

◆ rb_cTCPSocket

VALUE rb_cTCPSocket

◆ rb_cUDPSocket

VALUE rb_cUDPSocket

Definition at line 17 of file init.c.

Referenced by rsock_init_udpsocket().

◆ rb_eSocket

VALUE rb_eSocket

◆ rsock_do_not_reverse_lookup

int rsock_do_not_reverse_lookup = 1

◆ sym_wait_readable

VALUE sym_wait_readable
static