basicsocket.c File Reference
`#include "rubysocket.h"`

Go to the source code of this file.

## Macros

#define | rb_sys_fail_path(path) rb_sys_fail(NIL_P(path) ? 0 : RSTRING_PTR(path))
#define | bsock_getpeereid rb_f_notimplement

## Functions

static VALUE | bsock_s_for_fd (VALUE klass, VALUE fd)
static VALUE | bsock_shutdown (int argc, VALUE *argv, VALUE sock)
static VALUE | bsock_close_read (VALUE sock)
static VALUE | bsock_close_write (VALUE sock)
static VALUE | bsock_setsockopt (int argc, VALUE *argv, VALUE sock)
static VALUE | bsock_getsockopt (VALUE sock, VALUE lev, VALUE optname)
static VALUE | bsock_getsockname (VALUE sock)
static VALUE | bsock_getpeername (VALUE sock)
static VALUE | bsock_local_address (VALUE sock)
static VALUE | bsock_remote_address (VALUE sock)
VALUE | rsock_bsock_send (int argc, VALUE *argv, VALUE sock)
static VALUE | bsock_do_not_reverse_lookup (VALUE sock)
static VALUE | bsock_do_not_reverse_lookup_set (VALUE sock, VALUE state)
static VALUE | bsock_recv (int argc, VALUE *argv, VALUE sock)
static VALUE | bsock_recv_nonblock (int argc, VALUE *argv, VALUE sock)
static VALUE | bsock_do_not_rev_lookup (void)
static VALUE | bsock_do_not_rev_lookup_set (VALUE self, VALUE val)
void | rsock_init_basicsocket (void)

## Macro Definition Documentation

#define bsock_getpeereid rb_f_notimplement

Definition at line 453 of file basicsocket.c.

Referenced by rsock_init_basicsocket().

#define rb_sys_fail_path | ( |  | path | ) | rb_sys_fail(NIL_P(path) ? 0 : RSTRING_PTR(path))

## Function Documentation

static VALUE bsock_close_read | ( | VALUE | sock | ) |

static

Definition at line 99 of file basicsocket.c.

References rb_io_t::fd, FMODE_READABLE, FMODE_WRITABLE, GetOpenFile, rb_io_t::mode, OBJ_TAINTED, Qnil, rb_eSecurityError, rb_io_close(), rb_raise(), rb_safe_level, and shutdown.

Referenced by rsock_init_basicsocket().

static VALUE bsock_close_write | ( | VALUE | sock | ) |

static

Definition at line 132 of file basicsocket.c.

References rb_io_t::fd, FMODE_READABLE, FMODE_WRITABLE, GetOpenFile, rb_io_t::mode, OBJ_TAINTED, Qnil, rb_eSecurityError, rb_io_close(), rb_raise(), rb_safe_level, and shutdown.

Referenced by rsock_init_basicsocket().

static VALUE bsock_do_not_rev_lookup | ( | void |  | ) |

static

Definition at line 706 of file basicsocket.c.

References Qfalse, Qtrue, and rsock_do_not_reverse_lookup.

Referenced by rsock_init_basicsocket().

static VALUE bsock_do_not_rev_lookup_set | ( | VALUE | self,
|  | VALUE | val
| ) |  |

static

Definition at line 728 of file basicsocket.c.

References rb_secure(), rsock_do_not_reverse_lookup, and RTEST.

Referenced by rsock_init_basicsocket().

static VALUE bsock_do_not_reverse_lookup | ( | VALUE | sock | ) |

static

Definition at line 585 of file basicsocket.c.

References FMODE_NOREVLOOKUP, GetOpenFile, rb_io_t::mode, Qfalse, and Qtrue.

Referenced by rsock_init_basicsocket().

static VALUE bsock_do_not_reverse_lookup_set | ( | VALUE | sock,
|  | VALUE | state
| ) |  |

static

Definition at line 606 of file basicsocket.c.

References FMODE_NOREVLOOKUP, GetOpenFile, rb_io_t::mode, rb_secure(), and RTEST.

Referenced by rsock_init_basicsocket().

static VALUE bsock_getpeername | ( | VALUE | sock | ) |

static

Definition at line 386 of file basicsocket.c.

References rb_io_t::fd, GetOpenFile, len, rb_str_new(), and rb_sys_fail().

Referenced by rsock_init_basicsocket().

static VALUE bsock_getsockname | ( | VALUE | sock | ) |

static

Definition at line 357 of file basicsocket.c.

References rb_io_t::fd, GetOpenFile, len, rb_str_new(), and rb_sys_fail().

Referenced by rsock_init_basicsocket().

static VALUE bsock_getsockopt | ( | VALUE | sock,
|  | VALUE | lev,
|  | VALUE | optname
| ) |  |

static

Definition at line 317 of file basicsocket.c.

References ALLOCA_N, buf, rb_io_t::fd, GetOpenFile, len, rb_io_t::pathv, rb_io_check_closed(), rb_str_new(), rb_sys_fail_path, rsock_getfamily(), rsock_level_arg(), rsock_optname_arg(), and rsock_sockopt_new().

Referenced by rsock_init_basicsocket().

static VALUE bsock_local_address | ( | VALUE | sock | ) |

static

Definition at line 474 of file basicsocket.c.

References rb_io_t::fd, GetOpenFile, rb_sys_fail(), and rsock_fd_socket_addrinfo().

Referenced by rsock_init_basicsocket().

static VALUE bsock_recv | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | sock
| ) |  |

static

Definition at line 641 of file basicsocket.c.

References RECV_RECV, and rsock_s_recvfrom().

Referenced by rsock_init_basicsocket().

static VALUE bsock_recv_nonblock | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | sock
| ) |  |

static

Definition at line 692 of file basicsocket.c.

References RECV_RECV, and rsock_s_recvfrom_nonblock().

Referenced by rsock_init_basicsocket().

static VALUE bsock_remote_address | ( | VALUE | sock | ) |

static

Definition at line 506 of file basicsocket.c.

References rb_io_t::fd, GetOpenFile, rb_sys_fail(), and rsock_fd_socket_addrinfo().

Referenced by rsock_init_basicsocket().

static VALUE bsock_s_for_fd | ( | VALUE | klass,
|  | VALUE | fd
| ) |  |

static

Definition at line 25 of file basicsocket.c.

References GetOpenFile, NUM2INT, rb_obj_alloc(), and rsock_init_sock().

Referenced by rsock_init_basicsocket().

static VALUE bsock_setsockopt | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | sock
| ) |  |

static

Definition at line 207 of file basicsocket.c.

References rb_io_t::fd, FIX2INT, GetOpenFile, i, INT2FIX, rb_io_t::pathv, rb_funcall(), rb_intern, rb_io_check_closed(), rb_scan_args(), rb_secure(), rb_sys_fail_path, rsock_getfamily(), rsock_level_arg(), rsock_optname_arg(), RSTRING_LENINT, RSTRING_PTR, StringValue, T_FALSE, T_FIXNUM, T_TRUE, TYPE, and v.

Referenced by rsock_init_basicsocket().

static VALUE bsock_shutdown | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | sock
| ) |  |

static

Definition at line 63 of file basicsocket.c.

References rb_io_t::fd, GetOpenFile, INT2FIX, OBJ_TAINTED, Qnil, rb_eArgError, rb_eSecurityError, rb_raise(), rb_safe_level, rb_scan_args(), rb_sys_fail(), rsock_shutdown_how_arg(), SHUT_RD, SHUT_WR, and shutdown.

Referenced by rsock_init_basicsocket().

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

Definition at line 536 of file basicsocket.c.

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

void rsock_init_basicsocket | ( | void |  | ) |

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