diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-06 03:56:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-06 03:56:38 +0000 |
commit | d17d1b111341f2c8979cf8fbd63ec7ec9db7c3ad (patch) | |
tree | 5e35d5b41aae961b37cf6632f60c42f51c7aa775 /ext/dl/win32/lib/win32/resolv.rb | |
parent | 101e79d7b434c01c0e6f4bcc480003858ab8e1a4 (diff) | |
download | ruby-d17d1b111341f2c8979cf8fbd63ec7ec9db7c3ad.tar.gz ruby-d17d1b111341f2c8979cf8fbd63ec7ec9db7c3ad.tar.xz ruby-d17d1b111341f2c8979cf8fbd63ec7ec9db7c3ad.zip |
* {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/win32/lib/win32/resolv.rb')
-rw-r--r-- | ext/dl/win32/lib/win32/resolv.rb | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/ext/dl/win32/lib/win32/resolv.rb b/ext/dl/win32/lib/win32/resolv.rb index beb7f40ca..a164fd54d 100644 --- a/ext/dl/win32/lib/win32/resolv.rb +++ b/ext/dl/win32/lib/win32/resolv.rb @@ -9,13 +9,13 @@ require 'win32/registry' module Win32 module Resolv API = Registry::API - + def self.get_hosts_path path = get_hosts_dir path = File.expand_path('hosts', path) File.exist?(path) ? path : nil end - + def self.get_resolv_info search, nameserver = get_info if search.empty? @@ -47,7 +47,7 @@ if info.unpack('V5')[4] == 2 # VER_PLATFORM_WIN32_NT #==================================================================== module_eval <<-'__EOS__', __FILE__, __LINE__+1 TCPIP_NT = 'SYSTEM\CurrentControlSet\Services\Tcpip\Parameters' - + class << self private def get_hosts_dir @@ -55,7 +55,7 @@ if info.unpack('V5')[4] == 2 # VER_PLATFORM_WIN32_NT reg.read_s_expand('DataBasePath') end end - + def get_info search = nil nameserver = [] @@ -65,7 +65,7 @@ if info.unpack('V5')[4] == 2 # VER_PLATFORM_WIN32_NT search = slist.split(/,\s*/) unless slist.empty? rescue Registry::Error end - + if add_search = search.nil? search = [] begin @@ -81,7 +81,7 @@ if info.unpack('V5')[4] == 2 # VER_PLATFORM_WIN32_NT rescue Registry::Error end end - + reg.open('Interfaces') do |h| h.each_key do |iface,| h.open(iface) do |regif| @@ -99,7 +99,7 @@ if info.unpack('V5')[4] == 2 # VER_PLATFORM_WIN32_NT end rescue Registry::Error end - + if add_search begin [ 'Domain', 'DhcpDomain' ].each do |key| @@ -129,16 +129,16 @@ else TCPIP_9X = 'SYSTEM\CurrentControlSet\Services\VxD\MSTCP' DHCP_9X = 'SYSTEM\CurrentControlSet\Services\VxD\DHCP' WINDOWS = 'Software\Microsoft\Windows\CurrentVersion' - + class << self # private - + def get_hosts_dir Registry::HKEY_LOCAL_MACHINE.open(WINDOWS) do |reg| reg.read_s_expand('SystemRoot') end end - + def get_info search = [] nameserver = [] @@ -155,13 +155,13 @@ else end rescue Registry::Error end - + dhcpinfo = get_dhcpinfo search.concat(dhcpinfo[0]) nameserver.concat(dhcpinfo[1]) [ search, nameserver ] end - + def get_dhcpinfo macaddrs = {} ipaddrs = {} @@ -170,7 +170,7 @@ else ipaddr.each { |ipaddr| ipaddrs[ipaddr] = 1 } end iflist = [ macaddrs, ipaddrs ] - + search = [] nameserver = [] version = -1 @@ -179,7 +179,7 @@ else version = API.unpackdw(reg.read_bin("Version")) rescue Registry::Error end - + reg.each_key do |key,| catch(:not_used) do reg.open(key) do |regdi| @@ -192,7 +192,7 @@ else end [ search, nameserver ] end - + def get_dhcpinfo_95(reg) dhcp = reg.read_bin("DhcpInfo") [ @@ -203,7 +203,7 @@ else reg.read_bin("OptionInfo"), ] end - + def get_dhcpinfo_98(reg) [ API.unpackdw(reg.read_bin("DhcpIPAddress")), @@ -213,7 +213,7 @@ else reg.read_bin("OptionInfo"), ] end - + def get_dhcpinfo_key(version, reg, iflist) info = case version when 1 @@ -234,7 +234,7 @@ else macaddr and macaddr.size == 6 and hwtype == 1 and iflist[0][macaddr] and iflist[1][ipaddr] - + size = opt.size idx = 0 while idx <= size @@ -258,7 +258,7 @@ else throw :not_used end end - + module WsControl module WSock32 extend DL::Importer @@ -266,7 +266,7 @@ else end WsControl = WSock32.extern "int WsControl(int, int, void *, void *, void *, void *", :stdcall WSAGetLastError = WSock32.extern "int WSAGetLastError(void)", :stdcall - + MAX_TDI_ENTITIES = 512 IPPROTO_TCP = 6 WSCTL_TCP_QUERY_INFORMATION = 0 @@ -282,7 +282,7 @@ else IF_MIB = 0x202 IF_MIB_STATS_ID = 1 IP_MIB_ADDRTABLE_ENTRY_ID = 0x102 - + def self.wsctl(tei_entity, tei_instance, toi_class, toi_type, toi_id, buffsize) @@ -308,7 +308,7 @@ else [ buff, API.unpackdw(buffsize) ] end private_class_method :wsctl - + def self.get_iflist # Get TDI Entity List entities, size = @@ -345,7 +345,7 @@ else end end end - + # Get IP Addresses entities.each do |entity, instance| if entity == CL_NL_ENTITY |