Class: Wiretap::ServerInfo
- Inherits:
-
Object
- Object
- Wiretap::ServerInfo
- 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
-
#hostname ⇒ Object
Extract hostname from server information.
-
#product ⇒ Object
Extract product name from server information.
-
#product_version ⇒ Object
Extract product version from server information.
-
#server ⇒ Object
Connect to server, described in this information.
-
#storage ⇒ Object
Extract storage ID from server information.
-
#to_s ⇒ Object
:nodoc:.
- #uri ⇒ Object
-
#vendor ⇒ Object
Extract vendor name from server information.
-
#version ⇒ Object
Extract version of server from server information.
Instance Method Details
#hostname ⇒ Object
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());
}
|
#product ⇒ Object
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_version ⇒ Object
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);
}
|
#server ⇒ Object
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); } |
#storage ⇒ Object
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_s ⇒ Object
:nodoc:
44 45 46 |
# File 'lib/wiretap.rb', line 44 def to_s #:nodoc: super.gsub />$/, " hostname:'#{hostname}'>" end |
#uri ⇒ Object
40 41 42 |
# File 'lib/wiretap.rb', line 40 def uri server.uri end |
#vendor ⇒ Object
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());
}
|
#version ⇒ Object
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);
}
|