Class: Wiretap::ServerInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/wiretap.rb,
ext/serverlist.cpp

Overview

Returned from ServerList and contains information about a specific server. Call ServerInfo#server to retrieve the actual server object

Instance Method Summary collapse

Instance Method Details

#hostnameObject

Extract hostname from server information



16
17
18
19
20
# File 'ext/serverlist.cpp', line 16

static VALUE wiretap_server_info_hostname(VALUE self) {
	WireTapServerList::ServerInfo* server_info;
	Data_Get_Struct(self, WireTapServerList::ServerInfo, server_info);
	return rb_str_new2(server_info->getHostname());
}

#productObject

Extract product name from server information



38
39
40
41
42
# File 'ext/serverlist.cpp', line 38

static VALUE wiretap_server_info_product(VALUE self) {
	WireTapServerList::ServerInfo* server_info;
	Data_Get_Struct(self, WireTapServerList::ServerInfo, server_info);
	return rb_str_new2(server_info->getProduct());
}

#product_versionObject

Extract product version from server information



56
57
58
59
60
61
62
63
64
# File 'ext/serverlist.cpp', line 56

static VALUE wiretap_server_info_product_version(VALUE self) {
	WireTapServerList::ServerInfo* server_info;
	Data_Get_Struct(self, WireTapServerList::ServerInfo, server_info);
	int major = server_info->getProductVersionMajor();
	int minor = server_info->getProductVersionMinor();
	char buf[256];
	snprintf(buf, sizeof(buf), "%d.%d", major, minor);
	return rb_str_new2(buf);
}

#serverObject

Connect to server, described in this information.



82
83
84
85
# File 'ext/serverlist.cpp', line 82

static VALUE wiretap_server_info_server(VALUE self) {
	VALUE hostname = rb_funcall(self, rb_intern("hostname"), 0);
	return rb_funcall(cServer, rb_intern("new"), 1, hostname);
}

#storageObject

Extract storage ID from server information



69
70
71
72
73
74
75
76
77
# File 'ext/serverlist.cpp', line 69

static VALUE wiretap_server_info_storage(VALUE self) {
	WireTapServerList::ServerInfo* server_info;
	Data_Get_Struct(self, WireTapServerList::ServerInfo, server_info);
	const char* storage_id = server_info->getStorageId();
	if(!storage_id) {
		rb_raise(eError, "Problem in wiretap. File: %s: %d", __FILE__, __LINE__);
	}
	return rb_str_new2(storage_id);
}

#to_sObject

:nodoc:



44
45
46
# File 'lib/wiretap.rb', line 44

def to_s #:nodoc:
  super.gsub />$/, " hostname:'#{hostname}'>"
end

#uriObject



40
41
42
# File 'lib/wiretap.rb', line 40

def uri
  server.uri
end

#vendorObject

Extract vendor name from server information



47
48
49
50
51
# File 'ext/serverlist.cpp', line 47

static VALUE wiretap_server_info_vendor(VALUE self) {
	WireTapServerList::ServerInfo* server_info;
	Data_Get_Struct(self, WireTapServerList::ServerInfo, server_info);
	return rb_str_new2(server_info->getVendor());
}

#versionObject

Extract version of server from server information



25
26
27
28
29
30
31
32
33
# File 'ext/serverlist.cpp', line 25

static VALUE wiretap_server_info_version(VALUE self) {
	WireTapServerList::ServerInfo* server_info;
	Data_Get_Struct(self, WireTapServerList::ServerInfo, server_info);
	int major = server_info->getVersionMajor();
	int minor = server_info->getVersionMinor();
	char buf[256];
	snprintf(buf, sizeof(buf), "%d.%d", major, minor);
	return rb_str_new2(buf);
}