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

Go to the source code of this file.

## Data Structures

struct | udp_arg

## Functions

static VALUE | udp_init (int argc, VALUE *argv, VALUE sock)
static VALUE | udp_connect_internal (struct udp_arg *arg)
VALUE | rsock_freeaddrinfo (struct addrinfo *addr)
static VALUE | udp_connect (VALUE sock, VALUE host, VALUE port)
static VALUE | udp_bind (VALUE sock, VALUE host, VALUE port)
static VALUE | udp_send (int argc, VALUE *argv, VALUE sock)
static VALUE | udp_recvfrom_nonblock (int argc, VALUE *argv, VALUE sock)
void | rsock_init_udpsocket (void)

## Function Documentation

VALUE rsock_freeaddrinfo | ( | struct addrinfo * | addr | ) |

Definition at line 491 of file raddrinfo.c.

References freeaddrinfo(), and Qnil.

Referenced by rsock_make_hostent(), and udp_connect().

void rsock_init_udpsocket | ( | void |  | ) |

Definition at line 250 of file udpsocket.c.

References rb_cIPSocket, rb_cUDPSocket, rb_define_class(), rb_define_method(), udp_bind(), udp_connect(), udp_init(), udp_recvfrom_nonblock(), and udp_send().

Referenced by rsock_init_socket_init().

static VALUE udp_bind | ( | VALUE | sock,
|  | VALUE | host,
|  | VALUE | port
| ) |  |

static

Definition at line 113 of file udpsocket.c.

References addrinfo::ai_addr, addrinfo::ai_addrlen, addrinfo::ai_next, rb_io_t::fd, freeaddrinfo(), GetOpenFile, INT2FIX, rb_secure(), rb_sys_fail(), and rsock_addrinfo().

Referenced by rsock_init_udpsocket().

static VALUE udp_connect | ( | VALUE | sock,
|  | VALUE | host,
|  | VALUE | port
| ) |  |

static

Definition at line 84 of file udpsocket.c.

References udp_arg::fd, rb_io_t::fd, GetOpenFile, INT2FIX, rb_ensure(), rb_secure(), rb_sys_fail(), udp_arg::res, rsock_addrinfo(), rsock_freeaddrinfo(), and udp_connect_internal().

Referenced by rsock_init_udpsocket().

static VALUE udp_connect_internal | ( | struct udp_arg * | arg | ) |

static

Definition at line 52 of file udpsocket.c.

References addrinfo::ai_addr, addrinfo::ai_addrlen, addrinfo::ai_next, udp_arg::fd, Qfalse, Qtrue, udp_arg::res, and rsock_connect().

Referenced by udp_connect().

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

static

Definition at line 27 of file udpsocket.c.

References arg, rb_scan_args(), rb_secure(), rb_sys_fail(), rsock_family_arg(), rsock_init_sock(), and rsock_socket().

Referenced by rsock_init_udpsocket().

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

static

Definition at line 244 of file udpsocket.c.

References RECV_IP, and rsock_s_recvfrom_nonblock().

Referenced by rsock_init_udpsocket().

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

static

Definition at line 156 of file udpsocket.c.

References addrinfo::ai_addr, addrinfo::ai_addrlen, addrinfo::ai_next, BLOCKING_REGION_FD, rb_io_t::fd, rsock_send_arg::fd, rsock_send_arg::flags, freeaddrinfo(), GetOpenFile, INT2FIX, rsock_send_arg::mesg, NUM2INT, rb_io_wait_writable(), rb_scan_args(), rb_secure(), rb_sys_fail(), rb_thread_fd_writable(), rsock_addrinfo(), rsock_bsock_send(), rsock_sendto_blocking(), StringValue, rsock_send_arg::to, and rsock_send_arg::tolen.

Referenced by rsock_init_udpsocket().