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



48
49
50
51
52
# File 'ext/source/Ruby/Protocol/QUIC/Socket.cpp', line 48

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



76
77
78
79
80
81
82
# File 'ext/source/Ruby/Protocol/QUIC/Socket.cpp', line 76

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



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

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



54
55
56
57
58
59
60
61
62
63
# File 'ext/source/Ruby/Protocol/QUIC/Socket.cpp', line 54

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



65
66
67
68
69
70
71
72
73
74
# File 'ext/source/Ruby/Protocol/QUIC/Socket.cpp', line 65

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;
	}
}