Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Functions | Variables
ipsocket.c File Reference
`#include "rubysocket.h"`
Include dependency graph for ipsocket.c:

Go to the source code of this file.

## Data Structures
struct | inetsock_arg

## Macros
#define | return_norevlookup(x) {*norevlookup = (x); return 1;}

## Functions
static VALUE | inetsock_cleanup (struct inetsock_arg *arg)
static VALUE | init_inetsock_internal (struct inetsock_arg *arg)
VALUE | rsock_init_inetsock (VALUE sock, VALUE remote_host, VALUE remote_serv, VALUE local_host, VALUE local_serv, int type)
int | rsock_revlookup_flag (VALUE revlookup, int *norevlookup)
static VALUE | ip_addr (int argc, VALUE *argv, VALUE sock)
static VALUE | ip_peeraddr (int argc, VALUE *argv, VALUE sock)
static VALUE | ip_recvfrom (int argc, VALUE *argv, VALUE sock)
static VALUE | ip_s_getaddress (VALUE obj, VALUE host)
void | rsock_init_ipsocket (void)

## Variables
static ID | id_numeric
static ID | id_hostname

## Macro Definition Documentation

#define return_norevlookup | ( |  | x | ) | {*norevlookup = (x); return 1;}

Referenced by rsock_revlookup_flag().

## Function Documentation

static VALUE inetsock_cleanup | ( | struct inetsock_arg * | arg | ) |
| static

Definition at line 25 of file ipsocket.c.

References inetsock_arg::fd, freeaddrinfo(), inetsock_arg::local, Qnil, inetsock_arg::remote, and inetsock_arg::res.

Referenced by rsock_init_inetsock().

static VALUE init_inetsock_internal | ( | struct inetsock_arg * | arg | ) |
| static

Definition at line 42 of file ipsocket.c.

References addrinfo::ai_addr, addrinfo::ai_addrlen, addrinfo::ai_family, addrinfo::ai_next, AI_PASSIVE, addrinfo::ai_protocol, addrinfo::ai_socktype, inetsock_arg::fd, inetsock_arg::host, INET_SERVER, INET_SOCKS, inetsock_arg::local, NIL_P(), rb_sys_fail(), inetsock_arg::remote, inetsock_arg::res, res, rsock_addrinfo(), rsock_connect(), rsock_init_sock(), rsock_socket(), inetsock_arg::serv, inetsock_arg::sock, SOMAXCONN, status, inetsock_arg::type, and type.

Referenced by rsock_init_inetsock().

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

Definition at line 184 of file ipsocket.c.

References rb_io_t::fd, FMODE_NOREVLOOKUP, GetOpenFile, len, rb_io_t::mode, rb_sys_fail(), rsock_ipaddr(), and rsock_revlookup_flag().

Referenced by rsock_init_ipsocket().

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

Definition at line 225 of file ipsocket.c.

References rb_io_t::fd, FMODE_NOREVLOOKUP, GetOpenFile, len, rb_io_t::mode, rb_sys_fail(), rsock_ipaddr(), and rsock_revlookup_flag().

Referenced by rsock_init_ipsocket().

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

Definition at line 263 of file ipsocket.c.

References RECV_IP, and rsock_s_recvfrom().

Referenced by rsock_init_ipsocket().

static VALUE ip_s_getaddress | ( | VALUE | obj,
|  | VALUE | host
| ) |  |
| static

Definition at line 279 of file ipsocket.c.

References addrinfo::ai_addr, addrinfo::ai_addrlen, freeaddrinfo(), memcpy(), Qnil, res, rsock_addrinfo(), and rsock_make_ipaddr().

Referenced by rsock_init_ipsocket().

VALUE rsock_init_inetsock | ( | VALUE | sock,
|  | VALUE | remote_host,
|  | VALUE | remote_serv,
|  | VALUE | local_host,
|  | VALUE | local_serv,
|  | int | type
| ) |  |

Definition at line 120 of file ipsocket.c.

References inetsock_arg::fd, inetsock_arg::host, inetsock_cleanup(), init_inetsock_internal(), inetsock_arg::local, rb_ensure(), inetsock_arg::remote, inetsock_arg::res, inetsock_arg::serv, inetsock_arg::sock, inetsock_arg::type, and type.

Referenced by tcp_init(), and tcp_svr_init().

void rsock_init_ipsocket | ( | void |  | ) |

Definition at line 292 of file ipsocket.c.

References id_hostname, id_numeric, ip_addr(), ip_peeraddr(), ip_recvfrom(), ip_s_getaddress(), rb_cBasicSocket, rb_cIPSocket, rb_define_class(), rb_define_method(), rb_define_singleton_method(), rb_intern_const, and rb_undef_method().

Referenced by rsock_init_socket_init().

int rsock_revlookup_flag | ( | VALUE | revlookup,
|  | int * | norevlookup
| ) |  |

Definition at line 140 of file ipsocket.c.

References Check_Type, id, id_hostname, id_numeric, Qfalse, Qnil, Qtrue, rb_eArgError, rb_id2name(), rb_raise(), return_norevlookup, SYM2ID, and T_SYMBOL.

Referenced by ip_addr(), ip_peeraddr(), and sock_s_getaddrinfo().

## Variable Documentation

ID id_hostname
| static

Definition at line 137 of file ipsocket.c.

Referenced by rsock_init_ipsocket(), and rsock_revlookup_flag().

ID id_numeric
| static

Definition at line 137 of file ipsocket.c.

Referenced by rsock_init_ipsocket(), and rsock_revlookup_flag().