ruby-amt 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +1 -0
- data/COPYING +15 -0
- data/ChangeLog +392 -0
- data/GPL +674 -0
- data/Rakefile +292 -0
- data/VERSION +1 -0
- data/doc/default.css +211 -0
- data/doc/default.template +78 -0
- data/doc/documentation.page +40 -0
- data/doc/img/bg.jpg +0 -0
- data/doc/img/image.jpg +0 -0
- data/doc/img/line.jpg +0 -0
- data/doc/img/shadow.jpg +0 -0
- data/doc/index.page +61 -0
- data/doc/installation.page +115 -0
- data/doc/news.page +25 -0
- data/doc/news/release_0_1_0.page +16 -0
- data/doc/virtual +2 -0
- data/lib/amt/pt_status.rb +59 -0
- data/lib/amt/service.rb +16 -0
- data/lib/amt/service/basic.rb +159 -0
- data/lib/amt/service/hardware_asset.rb +83 -0
- data/lib/amt/service/hardware_asset/amt_information_table.rb +49 -0
- data/lib/amt/service/hardware_asset/asset.rb +118 -0
- data/lib/amt/service/hardware_asset/baseboard.rb +31 -0
- data/lib/amt/service/hardware_asset/bios.rb +65 -0
- data/lib/amt/service/hardware_asset/computer_system.rb +30 -0
- data/lib/amt/service/hardware_asset/fru.rb +37 -0
- data/lib/amt/service/hardware_asset/media_device.rb +63 -0
- data/lib/amt/service/hardware_asset/memory_module.rb +91 -0
- data/lib/amt/service/hardware_asset/portable_battery.rb +80 -0
- data/lib/amt/service/hardware_asset/processor.rb +123 -0
- data/lib/amt/service/hardware_asset/vpro_verification_table.rb +120 -0
- data/lib/amt/service/network_administration.rb +181 -0
- data/lib/amt/service/network_administration/structures.rb +29 -0
- data/lib/amt/service/remote_control.rb +73 -0
- data/lib/amt/service/remote_control/structures.rb +120 -0
- data/lib/amt/service/security_administration.rb +430 -0
- data/lib/amt/service/security_administration/structures.rb +117 -0
- data/lib/amt/system.rb +134 -0
- data/lib/amt/utility.rb +33 -0
- data/lib/amt/utility/bit_struct.rb +164 -0
- data/lib/amt/utility/enum.rb +119 -0
- data/lib/amt/version.rb +8 -0
- data/setup.rb +1585 -0
- metadata +125 -0
@@ -0,0 +1,91 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'amt/utility'
|
4
|
+
require 'amt/service/hardware_asset'
|
5
|
+
|
6
|
+
module AMT
|
7
|
+
module Service
|
8
|
+
class HardwareAsset
|
9
|
+
|
10
|
+
# Represents a single physical memory module of the system managed by the AMT device.
|
11
|
+
#
|
12
|
+
# There is at most one instance of this class for every physical memory module in the hardware
|
13
|
+
# asset inventory of each AMT device.
|
14
|
+
#
|
15
|
+
# Available fields:
|
16
|
+
#
|
17
|
+
# [+size+] The size of the memory device. If the value is +0+, then no memory module is
|
18
|
+
# installed in this socket. If the value is +FFFFh+, then the size is unknown. Also
|
19
|
+
# see #installed?
|
20
|
+
# [+form_factor+] The implementation form factor for this memory module (an instance of
|
21
|
+
# FormFactor).
|
22
|
+
# [+type+] The type of memory used in the module (an instance of Type).
|
23
|
+
# [+type_detail+] Additional detail on the memory module (an instance of TypeDetail).
|
24
|
+
# [+speed+] The speed of the memory module in MHz. If the value is +0+, then the value is
|
25
|
+
# unknown.
|
26
|
+
# [+manufacturer+] The name of the memory module manufacturer.
|
27
|
+
# [+serial_number+] The serial number of the memory module.
|
28
|
+
# [+asset_tag+] The asset tag of the memory module.
|
29
|
+
# [+part_number+] The part number of the memory module.
|
30
|
+
class MemoryModule < Asset
|
31
|
+
|
32
|
+
# The implementation form factor enumeration.
|
33
|
+
class FormFactor < AMT::Utility::Enum
|
34
|
+
multi_add(1 => "Other", 2 => "Unknown", 3 => "SIMM", 4 => "SIP",
|
35
|
+
5 => "Chip", 6 => "DIP", 7 => "ZIP", 8 => "Proprietary Card",
|
36
|
+
9 => "DIMM", 10 => "TSOP", 11 => "Row of chips", 12 => "RIMM",
|
37
|
+
13 => "SODIMM", 14 => "SRIMM", 15 => "FB-DIMM")
|
38
|
+
end
|
39
|
+
|
40
|
+
# The memory type enumeration.
|
41
|
+
class Type < AMT::Utility::Enum
|
42
|
+
multi_add(1 => "Other", 2 => "Unknown", 3 => "DRAM", 4 => "EDRAM", 5 => "VRAM",
|
43
|
+
6 => "SRAM", 7 => "RAM", 8 => "ROM", 9 => "FLASH", 10 => "EEPROM",
|
44
|
+
11 => "FEPROM", 12 => "EPROM", 13 => "CDRAM", 14 => "3DRAM",
|
45
|
+
15 => "SDRAM", 16 => "SGRAM", 17 => "RDRAM", 18 => "DDR",
|
46
|
+
19 => "DDR2", 20 => "DDR2 FB-DIMM", 24 => "DDR3", 25 => "FBD2")
|
47
|
+
end
|
48
|
+
|
49
|
+
# The additional available details on the memory module.
|
50
|
+
class TypeDetail < AMT::Utility::BitStruct
|
51
|
+
boolean 1, :other, 'Other'
|
52
|
+
boolean 2, :unknown, 'Unknown'
|
53
|
+
boolean 3, :fast_paged, 'Fast-paged'
|
54
|
+
boolean 4, :static_column, 'Static column'
|
55
|
+
boolean 5, :pseudo_static, 'Pseudo-static'
|
56
|
+
boolean 6, :rambus, 'RAMBUS'
|
57
|
+
boolean 7, :synchronous, 'Synchronous'
|
58
|
+
boolean 8, :cmos, 'CMOS'
|
59
|
+
boolean 9, :edo, 'EDO'
|
60
|
+
boolean 10, :window_dram, 'Window DRAM'
|
61
|
+
boolean 11, :cache_dram, 'Cache DRAM'
|
62
|
+
boolean 12, :non_volatile, 'Non-volatile'
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
set_unpack_data "ISCCSSZ65Z65Z65Z65", 272, [[:size, lambda {|d|
|
67
|
+
if d == 0 then 0
|
68
|
+
elsif d == 0xffff then -1
|
69
|
+
else
|
70
|
+
(d & 0x8000 == 0x8000 ? d & 0x7fff : (d & 0x7fff) * 1024)
|
71
|
+
end
|
72
|
+
}],
|
73
|
+
[:form_factor, :enum, FormFactor],
|
74
|
+
[:type, :enum, Type],
|
75
|
+
[:type_detail, :struct, TypeDetail],
|
76
|
+
:speed, :manufacturer, :serial_number, :asset_tag, :part_number]
|
77
|
+
|
78
|
+
# Return +true+ if the memory module is installed in the socket.
|
79
|
+
def installed?
|
80
|
+
@size != 0
|
81
|
+
end
|
82
|
+
|
83
|
+
def inspect # :nodoc:
|
84
|
+
installed? ? super : "#<#{self.class.name} not installed>"
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'amt/utility'
|
4
|
+
require 'amt/service/hardware_asset'
|
5
|
+
|
6
|
+
module AMT
|
7
|
+
module Service
|
8
|
+
class HardwareAsset
|
9
|
+
|
10
|
+
# Represents a portable battery of the system managed by the AMT device.
|
11
|
+
#
|
12
|
+
# There is at most one instance of this class for every physical portable battery in the
|
13
|
+
# hardware asset inventory of each AMT device.
|
14
|
+
#
|
15
|
+
# Available fields:
|
16
|
+
#
|
17
|
+
# [+oem_specific+] Contains OEM- or BIOS vendor-specific information.
|
18
|
+
# [+manufacturer+] The name of the company that manufactured the battery.
|
19
|
+
# [+manufacture_date+] The date the battery was manufactured.
|
20
|
+
# [+design_capacity+] The design capacity of the battery in mWatt-hours. If the value is +0+,
|
21
|
+
# then the capacity is unknown.
|
22
|
+
# [+design_voltage+] The design voltage of the battery in mVolts. If the value is +0+, then
|
23
|
+
# the voltage is unknown.
|
24
|
+
# [+serial_number+] The serial number of the battery.
|
25
|
+
# [+device_chemistry+] Identifies the battery chemistry (an instance of DeviceChemistry).
|
26
|
+
# [+maximum_error_in_battery_data+] The maximum error (as a percentage in the range 0 to 100)
|
27
|
+
# in the Watt-hour data reported by the battery, indicating
|
28
|
+
# an upper bound on how much additional energy the battery
|
29
|
+
# might have above the energy it reports having. If the
|
30
|
+
# value is +FFh+, then the maximum error is unknown.
|
31
|
+
# [+sbds_version_number+] The Smart Battery Data Specification version number supported by
|
32
|
+
# this battery. If the string is empty, then the battery does not
|
33
|
+
# support the function.
|
34
|
+
# [+location+] The location of the battery.
|
35
|
+
# [+device_name+] The name of the battery.
|
36
|
+
class PortableBattery < Asset
|
37
|
+
|
38
|
+
# Device chemistry enumeration.
|
39
|
+
class DeviceChemistry < AMT::Utility::Enum
|
40
|
+
multi_add(1 => 'Other', 2 => 'Unknown', 3 => 'Lead Acid',
|
41
|
+
4 => 'Nickel Cadmium', 5 => 'Nickel metal hydride',
|
42
|
+
6 => 'Lithium-ion', 7 => 'Zinc air', 8 => 'Lithium Polymer')
|
43
|
+
end
|
44
|
+
|
45
|
+
set_unpack_data "IIISSSCCCA65A65A65A65A65A65A65", 476
|
46
|
+
|
47
|
+
attr_reader :oem_specific, :manufacture_date, :design_capacity, :design_voltage, :serial_number, :device_chemistry # :nodoc:
|
48
|
+
attr_reader :maximum_error_in_battery_data, :sbds_version_number, :location, :manufacturer, :device_name # :nodoc:
|
49
|
+
|
50
|
+
def init_data(data) # :nodoc:
|
51
|
+
@oem_specific = data[0]
|
52
|
+
@sbds_version_number = data[9].strip
|
53
|
+
if data[12].strip.empty?
|
54
|
+
@manufacture_date = Date.new(1980 + (data[1] & 0x0000f1000), data[1] & 0x00001e000, data[1] & 0x0000001f)
|
55
|
+
else
|
56
|
+
@manufacture_date = data[12].strip
|
57
|
+
end
|
58
|
+
@design_capacity = data[2] * data[5]
|
59
|
+
@design_voltage = data[3]
|
60
|
+
if data[8].strip.empty?
|
61
|
+
@serial_number = data[4]
|
62
|
+
else
|
63
|
+
@serial_number = data[8].strip
|
64
|
+
end
|
65
|
+
@device_chemistry = as_enum(data[6], DeviceChemistry).first
|
66
|
+
if @device_chemistry == 'Unknown' && !@sbds_version_number.empty?
|
67
|
+
@device_chemistry = data[14].strip
|
68
|
+
end
|
69
|
+
@maximum_error_in_battery_data = data[7]
|
70
|
+
@location = data[10].strip
|
71
|
+
@manufacturer = data[11].strip
|
72
|
+
@device_name = data[13].strip
|
73
|
+
end
|
74
|
+
private :init_data
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'amt/utility'
|
4
|
+
require 'amt/service/hardware_asset'
|
5
|
+
|
6
|
+
module AMT
|
7
|
+
module Service
|
8
|
+
class HardwareAsset
|
9
|
+
|
10
|
+
# Represents a physical processor of the system managed by the AMT device.
|
11
|
+
#
|
12
|
+
# There is at most one instance of this class for every physical processor in the hardware
|
13
|
+
# asset inventory of each AMT device.
|
14
|
+
#
|
15
|
+
# Available fields:
|
16
|
+
#
|
17
|
+
# [+manufacturer+] The name of the processor manufacturer.
|
18
|
+
# [+version+] The version of the processor.
|
19
|
+
# [+socket_designation+] The reference designation for the processor socket.
|
20
|
+
# [+id+] Contains processor-specific information that describes the processor's features
|
21
|
+
# (returned as string).
|
22
|
+
# [+max_socket_speed+] The maximum processor speed supported by the system for this processor
|
23
|
+
# socket in MHz. If equal to +0+, then the value is unknown.
|
24
|
+
# [+current_speed+] The current speed of the processor in MHz.
|
25
|
+
# [+status+] Indicates the status of the processor (an instance of Status).
|
26
|
+
# [+type+] Specifies the type of the processor (an instance of Type).
|
27
|
+
# [+family+] Specifies the processor family (an instance of Family).
|
28
|
+
# [+upgrade_information+] Specifies the processor upgrade method (an instance of
|
29
|
+
# UpgradeInformation).
|
30
|
+
# [+socket_populated+] If the processor socket is populated, then +true+, else +false+.
|
31
|
+
class Processor < Asset
|
32
|
+
|
33
|
+
# The processor type enumeration.
|
34
|
+
class Type < AMT::Utility::Enum
|
35
|
+
multi_add(1 => 'Other', 2 => 'Unknown', 3 => 'Central Processor',
|
36
|
+
4 => 'Math Processor', 5 => 'DSP Processor', 6 => 'Video Processor')
|
37
|
+
end
|
38
|
+
|
39
|
+
# The processor family enumeration.
|
40
|
+
#
|
41
|
+
# Taken from the SMBIOS Reference Specification DSP 0134. Since I don't know all possible
|
42
|
+
# values, I just excluded the impossible ones (since AMT works only on newer generation
|
43
|
+
# processors from Intel) sothat the list gets shorter.
|
44
|
+
class Family < AMT::Utility::Enum
|
45
|
+
multi_add(1 => "Other", 2 => "Unknown",
|
46
|
+
20 => "Intel(R) Celeron(R) M processor",
|
47
|
+
21 => "Intel(R) Pentium(R) 4 HT processor",
|
48
|
+
40 => "Intel(R) Core(TM) Duo processor",
|
49
|
+
41 => "Intel(R) Core(TM) Duo mobile processor",
|
50
|
+
42 => "Intel(R) Core(TM) Solo mobile processor",
|
51
|
+
43 => "Intel(R) Atom(TM) processor",
|
52
|
+
161 => "Quad-Core Intel(R) Xeon(R) processor 3200 Series",
|
53
|
+
162 => "Dual-Core Intel(R) Xeon(R) processor 3000 Series",
|
54
|
+
163 => "Quad-Core Intel(R) Xeon(R) processor 5300 Series",
|
55
|
+
164 => "Dual-Core Intel(R) Xeon(R) processor 5100 Series",
|
56
|
+
165 => "Dual-Core Intel(R) Xeon(R) processor 5000 Series",
|
57
|
+
166 => "Dual-Core Intel(R) Xeon(R) processor LV",
|
58
|
+
167 => "Dual-Core Intel(R) Xeon(R) processor ULV",
|
59
|
+
168 => "Dual-Core Intel(R) Xeon(R) processor 7100 Series",
|
60
|
+
169 => "Quad-Core Intel(R) Xeon(R) processor 5400 Series",
|
61
|
+
170 => "Quad-Core Intel(R) Xeon(R) processor",
|
62
|
+
171 => "Dual-Core Intel(R) Xeon(R) processor 5200 Series",
|
63
|
+
172 => "Dual-Core Intel(R) Xeon(R) processor 7200 Series",
|
64
|
+
173 => "Quad-Core Intel(R) Xeon(R) processor 7300 Series",
|
65
|
+
174 => "Quad-Core Intel(R) Xeon(R) processor 7400 Series",
|
66
|
+
175 => "Multi-Core Intel(R) Xeon(R) processor 7400 Series",
|
67
|
+
184 => "Intel® Itanium® 2 processor",
|
68
|
+
185 => "Intel® Pentium® M processor",
|
69
|
+
186 => "Intel® Celeron® D processor",
|
70
|
+
187 => "Intel® Pentium® D processor",
|
71
|
+
188 => "Intel® Pentium® Processor Extreme Edition",
|
72
|
+
189 => "Intel(R) Core(TM) Solo Processor",
|
73
|
+
190 => "Intel(R) Core(TM)2 Duo Processor",
|
74
|
+
191 => "Intel(R) Core(TM) 2 Duo Processor",
|
75
|
+
192 => "Intel(R) Core(TM)2 Solo processor",
|
76
|
+
193 => "Intel(R) Core(TM)2 Extreme processor",
|
77
|
+
194 => "Intel(R) Core(TM)2 Quad processor",
|
78
|
+
195 => "Intel(R) Core(TM)2 Extreme mobile processor",
|
79
|
+
196 => "Intel(R) Core(TM)2 Duo mobile processor",
|
80
|
+
197 => "Intel(R) Core(TM)2 Solo mobile processor",
|
81
|
+
198 => "Intel(R) Core(TM) i7 processor",
|
82
|
+
199 => "Dual-Core Intel(R) Celeron(R) processor",
|
83
|
+
214 => "Multi-Core Intel(R) Xeon(R) processor",
|
84
|
+
215 => "Dual-Core Intel(R) Xeon(R) processor 3xxx Series",
|
85
|
+
216 => "Quad-Core Intel(R) Xeon(R) processor 3xxx Series",
|
86
|
+
218 => "Dual-Core Intel(R) Xeon(R) processor 5xxx Series",
|
87
|
+
219 => "Quad-Core Intel(R) Xeon(R) processor 5xxx Series",
|
88
|
+
221 => "Dual-Core Intel(R) Xeon(R) processor 7xxx Series",
|
89
|
+
222 => "Quad-Core Intel(R) Xeon(R) processor 7xxx Series",
|
90
|
+
223 => "Multi-Core Intel(R) Xeon(R) processor 7xxx Series")
|
91
|
+
end
|
92
|
+
|
93
|
+
# The processor status enumeration (a subclass of AMT::Utility::Enum).
|
94
|
+
class Status < AMT::Utility::Enum
|
95
|
+
multi_add(0 => 'Unknown', 1 => 'Enabled', 2 => 'Disabled by user via BIOS setup',
|
96
|
+
3 => 'Disabled by BIOS (POST Error)', 4 => 'Idle, waiting to be enabled', 7 => 'Other')
|
97
|
+
end
|
98
|
+
|
99
|
+
# The processor upgrade method enumeration.
|
100
|
+
class UpgradeInformation < AMT::Utility::Enum
|
101
|
+
multi_add(1 => 'Other', 2 => 'Unknown', 3 => 'Daughter Board', 4 => 'ZIF Socket',
|
102
|
+
5 => 'Replaceable Piggy Back', 6 => 'None', 7 => 'LIF Socket', 8 => 'Slot 1',
|
103
|
+
9 => 'Slot 2', 10 => '370-pin socket', 11 => 'Slot A', 12 => 'Slot M',
|
104
|
+
13 => 'Socket 423', 14 => 'Socket A (Socket 462)', 15 => 'Socket 478',
|
105
|
+
16 => 'Socket 754', 17 => 'Socket 940', 18 => 'Socket 939',
|
106
|
+
19 => 'Socket mPGA604', 20 => 'Socket LGA771', 21 => 'Socket LGA775',
|
107
|
+
22 => 'Socket S1', 23 => 'Socket AM2', 24 => 'Socket F (1207)', 25 => 'Socket LGA1366')
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
set_unpack_data "Ia8SSCCCCCZ65Z65Z65", 216, [[:id, :raw], :max_socket_speed, :current_speed,
|
112
|
+
[:status, :enum, Status],
|
113
|
+
[:type, :enum, Type],
|
114
|
+
[:family, :enum, Family],
|
115
|
+
[:upgrade_information, :enum, UpgradeInformation],
|
116
|
+
[:socket_populated, :boolean],
|
117
|
+
:socket_designation, :manufacturer, :version]
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'amt/utility'
|
4
|
+
require 'amt/service/hardware_asset'
|
5
|
+
|
6
|
+
module AMT
|
7
|
+
module Service
|
8
|
+
class HardwareAsset
|
9
|
+
|
10
|
+
# Represents a structure with information about vPro capabilities.
|
11
|
+
#
|
12
|
+
# Available fields:
|
13
|
+
#
|
14
|
+
# [+cpu_capabilities+] Capabilities supported by the CPU (an instance of CpuCapabilities.)
|
15
|
+
# [+mch_capabilities+] Capabilities supported by the Mch (an instance of MchCapabilities).
|
16
|
+
# [+ich_capabilities+] Capabilities supported by the Ich (an instance of IchCapabilities).
|
17
|
+
# [+me_capabilities+] Capabilities supported by the ME (an instance of MeCapabilities).
|
18
|
+
# [+tpm_capabilities+] Capabilities supported by the TPM (an instance of TpmCapabilities).
|
19
|
+
# [+network_device+] Information about the vPro network device (an instance of NetworkDevice).
|
20
|
+
# [+bios_capabilities+] Capabilities supported by the BIOS (an instance of BiosCapabilities).
|
21
|
+
class VproVerificationTable < Asset
|
22
|
+
|
23
|
+
# Defines a set of bit flags that indicate the features the CPU supports.
|
24
|
+
class CpuCapabilities < AMT::Utility::BitStruct
|
25
|
+
boolean 0, :vmx_enabled, 'VMX enabled'
|
26
|
+
boolean 1, :smx_enabled, 'SMX enabled'
|
27
|
+
boolean 2, :lt_txt_capable, 'LT/TXT capable'
|
28
|
+
boolean 3, :lt_txt_enabled, 'LT/TXT enabled'
|
29
|
+
boolean 4, :vt_x_capable, 'VT-x capable'
|
30
|
+
boolean 5, :vt_x_enabled, 'VT-x enabled'
|
31
|
+
end
|
32
|
+
|
33
|
+
# Defines a set of bit flags that indicate the features of the Mch device and some values
|
34
|
+
# that identify it.
|
35
|
+
class MchCapabilities < AMT::Utility::BitStruct
|
36
|
+
unsigned 0..2, :function_number, 'Function Number of PCI Device'
|
37
|
+
unsigned 3..7, :device_number, 'Device Number of PCI Device'
|
38
|
+
unsigned 8..15, :bus_number, 'Bus Number of PCI Device'
|
39
|
+
unsigned 16..31, :did, 'Device Identification Number'
|
40
|
+
boolean 32, :vt_d_capable, 'VT-d capable'
|
41
|
+
boolean 33, :vt_d_enabled, 'VT-d enabled'
|
42
|
+
boolean 34, :txt_capable, 'TXT capable'
|
43
|
+
boolean 35, :txt_enabled, 'TXT enabled'
|
44
|
+
end
|
45
|
+
|
46
|
+
# Defines some values that identify the Mch device.
|
47
|
+
class IchCapabilities < AMT::Utility::BitStruct
|
48
|
+
unsigned 0..2, :function_number, 'Function Number of PCI Device'
|
49
|
+
unsigned 3..7, :device_number, 'Device Number of PCI Device'
|
50
|
+
unsigned 8..15, :bus_number, 'Bus Number of PCI Device'
|
51
|
+
unsigned 16..31, :did, 'Device Identification Number'
|
52
|
+
end
|
53
|
+
|
54
|
+
# Defines a set of bit flags that indicate the features the Management Engine supports and
|
55
|
+
# provides information about the ME firmware version.
|
56
|
+
class MeCapabilities < AMT::Utility::BitStruct
|
57
|
+
boolean 0, :me_enabled, 'ME enabled'
|
58
|
+
boolean 1, :intel_qst_fw_support, 'Intel QST FW support'
|
59
|
+
boolean 2, :intel_asf_fw_support, 'Intel ASF FW support'
|
60
|
+
boolean 3, :intel_amt_fw_support, 'Intel AMT FW support'
|
61
|
+
unsigned 32..47, :me_fw_minor_version, 'ME FW Minor Version'
|
62
|
+
unsigned 48..63, :me_fw_major_version, 'ME FW Major Version'
|
63
|
+
unsigned 64..79, :me_fw_build_number, 'ME FW Build Number'
|
64
|
+
unsigned 80..95, :me_fw_hotfix_number, 'ME FW Hotfix Number'
|
65
|
+
end
|
66
|
+
|
67
|
+
# Defines a set of bit flags that indicate the features the TPM device supports and which
|
68
|
+
# TCG spec is supported.
|
69
|
+
class TpmCapabilities < AMT::Utility::BitStruct
|
70
|
+
boolean 0, :supported, 'Supports TPM on board'
|
71
|
+
boolean 1, :enabled, 'TPM enabled'
|
72
|
+
unsigned 16..23, :tcg_spec_major_version, 'TCG spec major version'
|
73
|
+
unsigned 24..31, :tcg_spec_minor_version, 'TCG spec minor version'
|
74
|
+
end
|
75
|
+
|
76
|
+
# Defines some values that identify the network device used by vPro.
|
77
|
+
class NetworkDevice < AMT::Utility::BitStruct
|
78
|
+
unsigned 0..2, :function_number, 'Function Number'
|
79
|
+
unsigned 3..7, :device_number, 'Device Number'
|
80
|
+
unsigned 8..15, :bus_number, 'Bus Number'
|
81
|
+
unsigned 16..31, :did, 'Device Identification Number'
|
82
|
+
end
|
83
|
+
|
84
|
+
# Defines a set of bit flags that indicate the features the BIOS supports regarding vPro.
|
85
|
+
class BiosCapabilities < AMT::Utility::BitStruct
|
86
|
+
boolean 0, :vt_x_supported, 'BIOS supports VT-x in BIOS setup screen'
|
87
|
+
boolean 1, :vt_d_supported, 'BIOS supports VT-d in BIOS setup screen'
|
88
|
+
boolean 2, :txt_supported, 'BIOS supports TXT in BIOS setup screen'
|
89
|
+
boolean 3, :tpm_supported, 'BIOS supports TPM in BIOS setup screen'
|
90
|
+
boolean 4, :me_supported, 'BIOS supports ME in BIOS setup screen'
|
91
|
+
boolean 5, :va_extension_supported, 'BIOS supports VA extension'
|
92
|
+
boolean 6, :spi_flash_platform_data_region_reserved, 'SPI Flash has Platform Data region reserved'
|
93
|
+
unsigned 7..9, :maximum_va_version, 'BIOS supported maximum VA version'
|
94
|
+
end
|
95
|
+
|
96
|
+
set_unpack_data "IIa8a8a12Ia12IIx4", 64
|
97
|
+
|
98
|
+
attr_reader :cpu_capabilities, :mch_capabilities, :ich_capabilities, :me_capabilities #:nodoc:
|
99
|
+
attr_reader :tpm_capabilities, :network_device, :bios_capabilities #:nodoc:
|
100
|
+
|
101
|
+
def init_data(data) #:nodoc:
|
102
|
+
@cpu_capabilities = CpuCapabilities.new(data[0])
|
103
|
+
first, last = *data[1].unpack("II")
|
104
|
+
@mch_capabilities = MchCapabilities.new((first << 32) + last)
|
105
|
+
first, last = *data[2].unpack("II")
|
106
|
+
@ich_capabilities = IchCapabilities.new((first << 32) + last)
|
107
|
+
first, second, last = *data[3].unpack("III")
|
108
|
+
@me_capabilities = MeCapabilities.new((first << 64) + (second << 32) + last)
|
109
|
+
@tpm_capabilities = TpmCapabilities.new(data[4])
|
110
|
+
first, second, last = *data[5].unpack("III")
|
111
|
+
@network_device = NetworkDevice.new((first << 64) + (second << 32) + last)
|
112
|
+
@bios_capabilities = BiosCapabilities.new(data[6])
|
113
|
+
end
|
114
|
+
private :init_data
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,181 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'ipaddr'
|
4
|
+
require 'amt/service/basic'
|
5
|
+
|
6
|
+
module AMT
|
7
|
+
|
8
|
+
module Service
|
9
|
+
|
10
|
+
# The Network Administration Service enables administrators to configure network parameters.
|
11
|
+
# This service implements all AMT 5.0 methods sans 802.1x related ones.
|
12
|
+
class NetworkAdministration < Basic
|
13
|
+
|
14
|
+
require 'amt/service/network_administration/structures'
|
15
|
+
|
16
|
+
|
17
|
+
# Set the host name of the AMT device to +name+.
|
18
|
+
#
|
19
|
+
# *Note*: You also need to call SecurityAdministration#commit_changes for the changes to
|
20
|
+
# actually take effect.
|
21
|
+
#
|
22
|
+
# Supported by AMT 1.0 and later.
|
23
|
+
def set_host_name(name)
|
24
|
+
soap_call('SetHostName') {|msg| msg.add('ns:HostName', name)}.process
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
# Return the host name of the AMT device.
|
29
|
+
#
|
30
|
+
# Supported by AMT 1.0 and later.
|
31
|
+
def get_host_name
|
32
|
+
soap_call('GetHostName').process {|node| node.xpath('./ns:HostName/text()').to_s}
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
# Set the domain name of the AMT device to +name+.
|
37
|
+
#
|
38
|
+
# *Note*: You also need to call SecurityAdministration#commit_changes for the changes to
|
39
|
+
# actually take effect.
|
40
|
+
#
|
41
|
+
# Supported by AMT 2.0 and later.
|
42
|
+
def set_domain_name(name)
|
43
|
+
soap_call('SetDomainName') {|msg| msg.add('ns:DomainName', name)}.process
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
# Return the domain name of the AMT device.
|
48
|
+
#
|
49
|
+
# Supported by AMT 2.0 and later.
|
50
|
+
def get_domain_name
|
51
|
+
soap_call('GetDomainName').process {|node| node.xpath('./ns:DomainName/text()').to_s}
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
# Set VLAN parameters (mode and vlan tag).
|
56
|
+
#
|
57
|
+
# [+enabled+] Boolean defining whether the VLAN support should be enabled on the AMT device.
|
58
|
+
# [+tag+] The VLAN tag (VLAN ID) to be set.
|
59
|
+
# [+interface_handle+] An optional interface handle for specifying the LAN interface to which
|
60
|
+
# the VLAN parameters should be applied.
|
61
|
+
#
|
62
|
+
# *Note*: You also need to call SecurityAdministration#commit_changes for the changes to
|
63
|
+
# actually take effect.
|
64
|
+
#
|
65
|
+
# Supported by AMT 1.0 and later. Not supported in 2.5, 2.6 and 4.0.
|
66
|
+
def set_vlan_parameters(enabled, tag, interface_handle = nil)
|
67
|
+
soap_call('SetVlanParameters') do |msg|
|
68
|
+
msg.add('ns:InterfaceHandle', interface_handle) if interface_handle
|
69
|
+
msg.add('ns:VlanMode', enabled)
|
70
|
+
msg.add('ns:VlanTag', tag)
|
71
|
+
end.process
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
# Return the VLAN parameters of the default interface or the one specified by
|
76
|
+
# +interface_handle+ as instance of the VlanParameters class.
|
77
|
+
#
|
78
|
+
# Supported by AMT 1.0 and later. Not supported in 2.5, 2.6 and 4.0.
|
79
|
+
def get_vlan_parameters(interface_handle = nil)
|
80
|
+
soap_call('GetVlanParameters') do |msg|
|
81
|
+
msg.add('ns:InterfaceHandle', interface_handle) if interface_handle
|
82
|
+
end.process do |node|
|
83
|
+
vp = VlanParameters.new
|
84
|
+
vp.enabled = node.xpath('./ns:VlanMode/text()').to_boolean
|
85
|
+
vp.tag = node.xpath('./ns:VlanTag/text()').to_i if vp.enabled
|
86
|
+
vp
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
# Set the behaviour of the AMT device regarding ICMP ping responses. If +enabled+ is +true+,
|
92
|
+
# ping responses will be enabled and else disabled.
|
93
|
+
#
|
94
|
+
# Supported by AMT 1.0 and later.
|
95
|
+
def set_ping_response(enabled)
|
96
|
+
soap_call('SetPingResponse') {|msg| msg.add('ns:enabled', enabled)}.process
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
# Return whether ICMP ping responses are enabled on the AMT device.
|
101
|
+
#
|
102
|
+
# Supported by AMT 1.0 and later.
|
103
|
+
def get_ping_response
|
104
|
+
soap_call('GetPingResponse').process {|node| node.xpath('./ns:enabled/text()').to_boolean}
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
# Return an array of handles (integers) to all known interfaces of the AMT device.
|
109
|
+
#
|
110
|
+
# Supported by AMT 2.5 and later.
|
111
|
+
def enumerate_interfaces
|
112
|
+
soap_call('EnumerateInterfaces').process do |node|
|
113
|
+
node.xpath('./ns:InterfaceHandles/text()').collect {|n| n.to_i }
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
# Return the settings of the interface specified by +interface_handle+ as an instance of
|
119
|
+
# +InterfaceDescriptor+.
|
120
|
+
#
|
121
|
+
# Supported by AMT 2.5 and later.
|
122
|
+
def get_interface_settings(interface_handle)
|
123
|
+
soap_call('GetInterfaceSettings') do |msg|
|
124
|
+
msg.add('ns:InterfaceHandle', interface_handle)
|
125
|
+
end.process do |node|
|
126
|
+
result = InterfaceDescriptor.new
|
127
|
+
result.hardware_description = node.xpath('./ns:InterfaceDescriptor/ns:HardwareAddressDescription/text()').to_s
|
128
|
+
result.mac = node.xpath('./ns:InterfaceDescriptor/ns:MACAddress/text()').to_s.gsub('-', ':').upcase
|
129
|
+
result.interface_mode = node.xpath('./ns:InterfaceDescriptor/ns:InterfaceMode/text()').to_s
|
130
|
+
result.link_policy = LinkPolicy.new(node.xpath('./ns:InterfaceDescriptor/ns:LinkPolicy/text()').to_i)
|
131
|
+
result.dhcp_enabled = node.xpath('./ns:InterfaceDescriptor/ns:DhcpEnabled/text()').to_boolean
|
132
|
+
if node.xpath('./ns:InterfaceDescriptor/ns:IPv4Parameters')
|
133
|
+
ipp = result.ip_parameters = IPParameters.new
|
134
|
+
ipp.ip = IPAddr.new(node.xpath('./ns:InterfaceDescriptor/ns:IPv4Parameters/ns:LocalAddress/text()').to_i, Socket::AF_INET)
|
135
|
+
ipp.mask = IPAddr.new(node.xpath('./ns:InterfaceDescriptor/ns:IPv4Parameters/ns:SubnetMask/text()').to_i, Socket::AF_INET)
|
136
|
+
ipp.gateway = IPAddr.new(node.xpath('./ns:InterfaceDescriptor/ns:IPv4Parameters/ns:DefaultGatewayAddress/text()').to_i, Socket::AF_INET)
|
137
|
+
ipp.primary_dns = IPAddr.new(node.xpath('./ns:InterfaceDescriptor/ns:IPv4Parameters/ns:PrimaryDnsAddress/text()').to_i, Socket::AF_INET)
|
138
|
+
ipp.secondary_dns = IPAddr.new(node.xpath('./ns:InterfaceDescriptor/ns:IPv4Parameters/ns:SecondaryDnsAddress/text()').to_i, Socket::AF_INET)
|
139
|
+
end
|
140
|
+
result
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
|
145
|
+
# Set the interface parameters for the network interface identified by +interface_handle+.
|
146
|
+
#
|
147
|
+
# [+interface_handle+] The handle to the network interface that should be configured.
|
148
|
+
# [+interface_mode+] Has to be either +SEPARATE_MAC_ADDRESS+ or +SHARED_MAC_ADDRESS+.
|
149
|
+
# [+link_policy+] The link policy (an instance of LinkPolicy) that should be set.
|
150
|
+
# [+ip_parameters+] If not specified (ie. +nil+), the interface is configured via DHCP.
|
151
|
+
# Otherwise this needs to be an instance of IPParameters.
|
152
|
+
#
|
153
|
+
# *Note*: You also need to call SecurityAdministration#commit_changes for the changes to
|
154
|
+
# actually take effect.
|
155
|
+
#
|
156
|
+
# Supported by AMT 2.5 and later.
|
157
|
+
def set_interface_settings(interface_handle, interface_mode, link_policy, ip_parameters = nil)
|
158
|
+
unless interface_mode == 'SEPARATE_MAC_ADDRESS' || interface_mode == 'SHARED_MAC_ADDRESS'
|
159
|
+
raise ArgumentError, "interface_mode is invalid: #{interface_mode}"
|
160
|
+
end
|
161
|
+
soap_call('SetInterfaceSettings') do |msg|
|
162
|
+
msg.add('ns:InterfaceHandle', interface_handle)
|
163
|
+
msg.add('ns:InterfaceDescriptor') do |ifd|
|
164
|
+
ifd.add('ns:InterfaceMode', interface_mode)
|
165
|
+
ifd.add('ns:LinkPolicy', link_policy.value)
|
166
|
+
ifd.add('ns:IPv4Parameters') do |ipp|
|
167
|
+
ipp.add('ns:LocalAddress', ip_parameters.ip.to_i)
|
168
|
+
ipp.add('ns:SubnetMask', ip_parameters.mask.to_i)
|
169
|
+
ipp.add('ns:DefaultGatewayAddress', ip_parameters.gateway.to_i)
|
170
|
+
ipp.add('ns:PrimaryDnsAddress', ip_parameters.primary_dns.to_i)
|
171
|
+
ipp.add('ns:SecondaryDnsAddress', ip_parameters.secondary_dns.to_i)
|
172
|
+
end if ip_parameters
|
173
|
+
end
|
174
|
+
end.process
|
175
|
+
end
|
176
|
+
|
177
|
+
end
|
178
|
+
|
179
|
+
end
|
180
|
+
|
181
|
+
end
|