96 bsock_close_read(
VALUE sock)
126 bsock_close_write(
VALUE sock)
198 bsock_setsockopt(
int argc,
VALUE *argv,
VALUE sock)
201 int family,
level, option;
231 v = (
char*)&i; vlen = (int)
sizeof(i);
241 if (setsockopt(fptr->
fd, level, option, v, vlen) < 0)
321 if (getsockopt(fptr->
fd, level, option, buf, &len) < 0)
341 bsock_getsockname(
VALUE sock)
349 if (getsockname(fptr->
fd, &buf.
addr, &len) < 0)
351 if (len0 < len) len = len0;
372 bsock_getpeername(
VALUE sock)
380 if (getpeername(fptr->
fd, &buf.
addr, &len) < 0)
382 if (len0 < len) len = len0;
386 #if defined(HAVE_GETPEEREID) || defined(SO_PEERCRED) || defined(HAVE_GETPEERUCRED) 412 #if defined(HAVE_GETPEEREID) 417 if (getpeereid(fptr->
fd, &euid, &egid) == -1)
420 #elif defined(SO_PEERCRED) 425 if (getsockopt(fptr->
fd, SOL_SOCKET, SO_PEERCRED, &cred, &len) == -1)
428 #elif defined(HAVE_GETPEERUCRED) 433 if (getpeerucred(fptr->
fd, &uc) == -1)
441 #define bsock_getpeereid rb_f_notimplement 462 bsock_local_address(
VALUE sock)
470 if (getsockname(fptr->
fd, &buf.
addr, &len) < 0)
472 if (len0 < len) len = len0;
496 bsock_remote_address(
VALUE sock)
504 if (getpeername(fptr->
fd, &buf.
addr, &len) < 0)
506 if (len0 < len) len = len0;
535 const char *funcname;
546 funcname =
"sendto(2)";
550 funcname =
"send(2)";
583 bsock_do_not_reverse_lookup(
VALUE sock)
606 bsock_do_not_reverse_lookup_set(
VALUE sock,
VALUE state)
663 bsock_do_not_rev_lookup(
void)
685 bsock_do_not_rev_lookup_set(
VALUE self,
VALUE val)
703 bsock_do_not_rev_lookup, 0);
705 bsock_do_not_rev_lookup_set, 1);
726 "__recv_nonblock", bsock_recv_nonblock, 4);
VALUE rsock_sendto_blocking(void *data)
#define SockAddrStringValue(v)
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
void rb_raise(VALUE exc, const char *fmt,...)
void rb_define_private_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
VALUE rsock_init_sock(VALUE sock, int fd)
#define rsock_maybe_fd_writable(fd)
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
#define rsock_bsock_sendmsg
VALUE rb_obj_alloc(VALUE)
Allocates an instance of klass.
#define FMODE_NOREVLOOKUP
VALUE rsock_s_recvfrom_nonblock(VALUE sock, VALUE len, VALUE flg, VALUE str, VALUE ex, enum sock_recv_type from)
void rb_undef_method(VALUE klass, const char *name)
#define GetOpenFile(obj, fp)
VALUE rsock_bsock_send(int argc, VALUE *argv, VALUE sock)
VALUE rsock_sockopt_new(int family, int level, int optname, VALUE data)
#define rsock_bsock_sendmsg_nonblock
VALUE rsock_send_blocking(void *data)
int rsock_getfamily(rb_io_t *fptr)
VALUE rb_define_class(const char *name, VALUE super)
Defines a top-level class.
int rsock_level_arg(int family, VALUE level)
int rb_io_wait_writable(int)
#define ALLOCA_N(type, n)
#define rsock_bsock_recvmsg_nonblock
void rb_sys_fail(const char *mesg)
VALUE rsock_s_recvfrom(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
VALUE rsock_fd_socket_addrinfo(int fd, struct sockaddr *addr, socklen_t len)
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
unsigned char buf[MIME_BUF_SIZE]
VALUE rb_assoc_new(VALUE car, VALUE cdr)
void rsock_init_basicsocket(void)
int rsock_do_not_reverse_lookup
VALUE rb_blocking_function_t(void *)
register unsigned int len
int rsock_optname_arg(int family, int level, VALUE optname)
void rsock_sys_fail_path(const char *mesg, VALUE path)
#define rsock_bsock_recvmsg
int rsock_shutdown_how_arg(VALUE how)
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
void rb_io_check_closed(rb_io_t *)
#define BLOCKING_REGION_FD(func, arg)
VALUE rb_str_new(const char *, long)