ext/socket/socket.c File Reference

#include "rubysocket.h"

Go to the source code of this file.

Defines

#define HOST_NAME_MAX   1024

Functions

static void setup_domain_and_type (VALUE domain, int *dv, VALUE type, int *tv)
static VALUE sock_initialize (int argc, VALUE *argv, VALUE sock)
static VALUE io_call_close (VALUE io)
static VALUE io_close (VALUE io)
static VALUE pair_yield (VALUE pair)
VALUE rsock_sock_s_socketpair (int argc, VALUE *argv, VALUE klass)
static VALUE sock_connect (VALUE sock, VALUE addr)
static VALUE sock_connect_nonblock (VALUE sock, VALUE addr)
static VALUE sock_bind (VALUE sock, VALUE addr)
VALUE rsock_sock_listen (VALUE sock, VALUE log)
static VALUE sock_recvfrom (int argc, VALUE *argv, VALUE sock)
static VALUE sock_recvfrom_nonblock (int argc, VALUE *argv, VALUE sock)
static VALUE sock_accept (VALUE sock)
static VALUE sock_accept_nonblock (VALUE sock)
static VALUE sock_sysaccept (VALUE sock)
static VALUE sock_gethostname (VALUE obj)
static VALUE make_addrinfo (struct addrinfo *res0, int norevlookup)
static VALUE sock_sockaddr (struct sockaddr *addr, size_t len)
static VALUE sock_s_gethostbyname (VALUE obj, VALUE host)
static VALUE sock_s_gethostbyaddr (int argc, VALUE *argv)
static VALUE sock_s_getservbyname (int argc, VALUE *argv)
static VALUE sock_s_getservbyport (int argc, VALUE *argv)
static VALUE sock_s_getaddrinfo (int argc, VALUE *argv)
static VALUE sock_s_getnameinfo (int argc, VALUE *argv)
static VALUE sock_s_pack_sockaddr_in (VALUE self, VALUE port, VALUE host)
static VALUE sock_s_unpack_sockaddr_in (VALUE self, VALUE addr)
static VALUE sock_s_pack_sockaddr_un (VALUE self, VALUE path)
static VALUE sock_s_unpack_sockaddr_un (VALUE self, VALUE addr)
static VALUE sockaddr_obj (struct sockaddr *addr)
static VALUE socket_s_ip_address_list (VALUE self)
void Init_socket ()

Define Documentation

#define HOST_NAME_MAX   1024

Referenced by sock_gethostname().


Function Documentation

void Init_socket (  ) 
static VALUE io_call_close ( VALUE  io  )  [static]

Definition at line 60 of file socket.c.

References rb_funcall(), and rb_intern.

Referenced by io_close().

static VALUE io_close ( VALUE  io  )  [static]

Definition at line 66 of file socket.c.

References io_call_close(), and rb_rescue().

Referenced by pair_yield(), and rsock_sock_s_socketpair().

static VALUE make_addrinfo ( struct addrinfo res0,
int  norevlookup 
) [static]
static VALUE pair_yield ( VALUE  pair  )  [static]

Definition at line 72 of file socket.c.

References io_close(), rb_ary_entry(), rb_ensure(), and rb_yield().

Referenced by rsock_sock_s_socketpair().

VALUE rsock_sock_listen ( VALUE  sock,
VALUE  log 
)
VALUE rsock_sock_s_socketpair ( int  argc,
VALUE argv,
VALUE  klass 
)
static void setup_domain_and_type ( VALUE  domain,
int *  dv,
VALUE  type,
int *  tv 
) [static]

Definition at line 14 of file socket.c.

References rsock_family_arg(), and rsock_socktype_arg().

Referenced by rsock_sock_s_socketpair(), and sock_initialize().

static VALUE sock_accept ( VALUE  sock  )  [static]
static VALUE sock_accept_nonblock ( VALUE  sock  )  [static]
static VALUE sock_bind ( VALUE  sock,
VALUE  addr 
) [static]

Definition at line 415 of file socket.c.

References rb_io_t::fd, GetOpenFile, INT2FIX, rb_sys_fail, RSTRING_LENINT, RSTRING_PTR, and SockAddrStringValue.

Referenced by Init_socket().

static VALUE sock_connect ( VALUE  sock,
VALUE  addr 
) [static]
static VALUE sock_connect_nonblock ( VALUE  sock,
VALUE  addr 
) [static]
static VALUE sock_gethostname ( VALUE  obj  )  [static]

Definition at line 848 of file socket.c.

References buf, HOST_NAME_MAX, rb_secure(), rb_str_new2, and rb_sys_fail.

Referenced by Init_socket().

static VALUE sock_initialize ( int  argc,
VALUE argv,
VALUE  sock 
) [static]
static VALUE sock_recvfrom ( int  argc,
VALUE argv,
VALUE  sock 
) [static]

Definition at line 618 of file socket.c.

References RECV_SOCKET, and rsock_s_recvfrom().

Referenced by Init_socket().

static VALUE sock_recvfrom_nonblock ( int  argc,
VALUE argv,
VALUE  sock 
) [static]

Definition at line 686 of file socket.c.

References RECV_SOCKET, and rsock_s_recvfrom_nonblock().

Referenced by Init_socket().

static VALUE sock_s_getaddrinfo ( int  argc,
VALUE argv 
) [static]
static VALUE sock_s_gethostbyaddr ( int  argc,
VALUE argv 
) [static]
static VALUE sock_s_gethostbyname ( VALUE  obj,
VALUE  host 
) [static]

Definition at line 937 of file socket.c.

References AI_CANONNAME, Qnil, rb_secure(), rsock_addrinfo(), rsock_make_hostent(), and sock_sockaddr().

Referenced by Init_socket().

static VALUE sock_s_getnameinfo ( int  argc,
VALUE argv 
) [static]
static VALUE sock_s_getservbyname ( int  argc,
VALUE argv 
) [static]

Definition at line 1015 of file socket.c.

References INT2FIX, NIL_P, proto, rb_eSocket, rb_raise(), rb_scan_args(), StringValue, StringValueCStr, and STRTOUL.

Referenced by Init_socket().

static VALUE sock_s_getservbyport ( int  argc,
VALUE argv 
) [static]
static VALUE sock_s_pack_sockaddr_in ( VALUE  self,
VALUE  port,
VALUE  host 
) [static]
static VALUE sock_s_pack_sockaddr_un ( VALUE  self,
VALUE  path 
) [static]
static VALUE sock_s_unpack_sockaddr_in ( VALUE  self,
VALUE  addr 
) [static]
static VALUE sock_s_unpack_sockaddr_un ( VALUE  self,
VALUE  addr 
) [static]
static VALUE sock_sockaddr ( struct sockaddr *  addr,
size_t  len 
) [static]

Definition at line 905 of file socket.c.

References rb_eSocket, rb_raise(), and rb_str_new().

Referenced by sock_s_gethostbyname().

static VALUE sock_sysaccept ( VALUE  sock  )  [static]

Definition at line 822 of file socket.c.

References rb_io_t::fd, GetOpenFile, len, rb_assoc_new(), rsock_io_socket_addrinfo(), and rsock_s_accept().

Referenced by Init_socket().

static VALUE sockaddr_obj ( struct sockaddr *  addr  )  [static]

Definition at line 1428 of file socket.c.

References len, NULL, Qnil, rsock_addrinfo_new(), and SA_LEN.

Referenced by socket_s_ip_address_list().

static VALUE socket_s_ip_address_list ( VALUE  self  )  [static]

Generated on 27 Nov 2014 for Ruby by  doxygen 1.6.1