96bsock_close_read(
VALUE sock)
105 fptr->
mode &= ~FMODE_READABLE;
126bsock_close_write(
VALUE sock)
135 fptr->
mode &= ~FMODE_WRITABLE;
200 VALUE lev, optname, val;
201 int family, level, option;
231 v = (
char*)&i; vlen = (
int)
sizeof(i);
241 if (setsockopt(fptr->
fd, level, option, v, vlen) < 0)
333 if (getsockopt(fptr->
fd, level, option,
buf, &
len) < 0)
353bsock_getsockname(
VALUE sock)
361 if (getsockname(fptr->
fd, &
buf.addr, &
len) < 0)
363 if (len0 <
len)
len = len0;
384bsock_getpeername(
VALUE sock)
392 if (getpeername(fptr->
fd, &
buf.addr, &
len) < 0)
394 if (len0 <
len)
len = len0;
398#if defined(HAVE_GETPEEREID) || defined(SO_PEERCRED) || defined(HAVE_GETPEERUCRED)
424#if defined(HAVE_GETPEEREID)
429 if (getpeereid(fptr->
fd, &euid, &egid) == -1)
432#elif defined(SO_PEERCRED)
437 if (getsockopt(fptr->
fd, SOL_SOCKET, SO_PEERCRED, &cred, &
len) == -1)
440#elif defined(HAVE_GETPEERUCRED)
445 if (getpeerucred(fptr->
fd, &uc) == -1)
453#define bsock_getpeereid rb_f_notimplement
474bsock_local_address(
VALUE sock)
482 if (getsockname(fptr->
fd, &
buf.addr, &
len) < 0)
484 if (len0 <
len)
len = len0;
508bsock_remote_address(
VALUE sock)
516 if (getpeername(fptr->
fd, &
buf.addr, &
len) < 0)
518 if (len0 <
len)
len = len0;
547 const char *funcname;
558 funcname =
"sendto(2)";
562 funcname =
"send(2)";
595bsock_do_not_reverse_lookup(
VALUE sock)
627 fptr->
mode &= ~FMODE_NOREVLOOKUP;
675bsock_do_not_rev_lookup(
VALUE _)
697bsock_do_not_rev_lookup_set(
VALUE self,
VALUE val)
715 bsock_do_not_rev_lookup, 0);
717 bsock_do_not_rev_lookup_set, 1);
738 "__recv_nonblock", bsock_recv_nonblock, 4);
740#if MSG_DONTWAIT_RELIABLE
VALUE rb_assoc_new(VALUE car, VALUE cdr)
void rsock_init_basicsocket(void)
VALUE rsock_bsock_send(int argc, VALUE *argv, VALUE sock)
int rsock_shutdown_how_arg(VALUE how)
int rsock_optname_arg(int family, int level, VALUE optname)
int rsock_level_arg(int family, VALUE level)
#define rb_define_method(klass, mid, func, arity)
Defines klass#mid.
#define rb_define_singleton_method(klass, mid, func, arity)
Defines klass.mid.
#define rb_define_private_method(klass, mid, func, arity)
Defines klass#mid and makes it private.
char str[HTML_ESCAPE_MAX_LEN+1]
#define RSTRING_PTR(string)
VALUE rb_define_class(const char *name, VALUE super)
Defines a top-level class.
void rb_undef_method(VALUE klass, const char *name)
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
void rb_raise(VALUE exc, const char *fmt,...)
void rb_sys_fail(const char *mesg)
VALUE rb_obj_alloc(VALUE)
Allocates an instance of klass.
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
#define rb_str_new(str, len)
VALUE rb_blocking_function_t(void *)
ID rb_intern(const char *)
void rb_io_check_closed(rb_io_t *)
int rb_io_wait_writable(int fd)
VALUE rsock_sendto_blocking(void *data)
VALUE rsock_s_recvfrom_nonblock(VALUE sock, VALUE len, VALUE flg, VALUE str, VALUE ex, enum sock_recv_type from)
int rsock_getfamily(rb_io_t *fptr)
VALUE rsock_init_sock(VALUE sock, int fd)
int rsock_do_not_reverse_lookup
VALUE rsock_s_recvfrom(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
VALUE rsock_send_blocking(void *data)
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
#define ALLOCA_N(type, n)
VALUE rsock_sockopt_new(int family, int level, int optname, VALUE data)
VALUE rsock_fd_socket_addrinfo(int fd, struct sockaddr *addr, socklen_t len)
#define SockAddrStringValue(v)
#define rsock_bsock_recvmsg
#define rsock_bsock_sendmsg_nonblock
#define rsock_bsock_recvmsg_nonblock
#define rsock_bsock_sendmsg
#define rsock_maybe_fd_writable(fd)
VALUE rsock_write_nonblock(VALUE sock, VALUE buf, VALUE ex)
VALUE rsock_read_nonblock(VALUE sock, VALUE length, VALUE buf, VALUE ex)
void rsock_sys_fail_path(const char *, VALUE)
#define BLOCKING_REGION_FD(func, arg)
#define FMODE_NOREVLOOKUP