Class: Protocol::QUIC::Socket

Inherits:
Object
  • Object
show all
Defined in:
ext/source/Ruby/Protocol/QUIC/Socket.cpp

Instance Method Summary collapse

Constructor Details

#initialize(domain, type, protocol) ⇒ Object



63
64
65
66
67
# File 'ext/source/Ruby/Protocol/QUIC/Socket.cpp', line 63

static VALUE Ruby_Protocol_QUIC_Socket_initialize(VALUE self, VALUE domain, VALUE type, VALUE protocol) {
	DATA_PTR(self) = new ::Protocol::QUIC::Socket(RB_NUM2INT(domain), RB_NUM2INT(type), RB_NUM2INT(protocol));
	
	return self;
}

Instance Method Details

#bind(address) ⇒ Object



91
92
93
94
95
96
97
# File 'ext/source/Ruby/Protocol/QUIC/Socket.cpp', line 91

static VALUE Ruby_Protocol_QUIC_Socket_bind(VALUE self, VALUE address) {
	auto socket = Ruby_Protocol_QUIC_Socket_get(self);
	
	return RTEST(
		socket->bind(*Ruby_Protocol_QUIC_Address_get(address))
	);
}

#connect(address) ⇒ Object



99
100
101
102
103
104
105
# File 'ext/source/Ruby/Protocol/QUIC/Socket.cpp', line 99

static VALUE Ruby_Protocol_QUIC_Socket_connect(VALUE self, VALUE address) {
	auto socket = Ruby_Protocol_QUIC_Socket_get(self);
	
	return RTEST(
		socket->connect(*Ruby_Protocol_QUIC_Address_get(address))
	);
}

#local_addressObject



69
70
71
72
73
74
75
76
77
78
# File 'ext/source/Ruby/Protocol/QUIC/Socket.cpp', line 69

static VALUE Ruby_Protocol_QUIC_Socket_local_address(VALUE self) {
	auto socket = Ruby_Protocol_QUIC_Socket_get(self);
	auto &address = socket->local_address();
	
	if (address) {
		return Ruby_Protocol_QUIC_Address_wrap(Ruby_Protocol_QUIC_Address, address);
	} else {
		return Qnil;
	}
}

#remote_addressObject



80
81
82
83
84
85
86
87
88
89
# File 'ext/source/Ruby/Protocol/QUIC/Socket.cpp', line 80

static VALUE Ruby_Protocol_QUIC_Socket_remote_address(VALUE self) {
	auto socket = Ruby_Protocol_QUIC_Socket_get(self);
	auto &address = socket->remote_address();
	
	if (address) {
		return Ruby_Protocol_QUIC_Address_wrap(Ruby_Protocol_QUIC_Address, address);
	} else {
		return Qnil;
	}
}