dhcpsapi 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dhcpsapi/reservation.rb +5 -3
- data/lib/dhcpsapi/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eab370b485c2d24997d56b50fac94077e398180c
|
4
|
+
data.tar.gz: b353650fc66eff961b3830c7e889e45c505a6618
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 564ad7fc55c3e81878c45c6aa120a45dbc8c91fb1f1a269576b47eade09d9e1182b168575ad76d01e7dc72361e136e2b0d40f193a1d70807a89b1a127d83e7e1
|
7
|
+
data.tar.gz: 3cf3391b10eabfb292d181d14e41ace4ca3498e9a3e4d8bb931a9a39aa68a520f9a3da1ad60f06cbefb9cbb42b35cb61c40a74d7a9604f6299c4ee2947427421
|
data/lib/dhcpsapi/reservation.rb
CHANGED
@@ -30,19 +30,21 @@ module DhcpsApi
|
|
30
30
|
# @param reservation_mac [String] Reservation mac address
|
31
31
|
# @param reservation_name [String] Reservation name
|
32
32
|
# @param reservation_comment [String] Reservation comment
|
33
|
+
# @param client_type [String] Client type
|
33
34
|
#
|
34
35
|
# @return [Hash]
|
35
36
|
#
|
36
37
|
# @see DHCP_IP_RESERVATION_INFO DHCP_IP_RESERVATION_INFO documentation for the list of available fields.
|
38
|
+
# @see ClientType ClientType documentation for the list of available client types.
|
37
39
|
#
|
38
|
-
def create_reservation(reservation_ip, reservation_subnet_mask, reservation_mac, reservation_name, reservation_comment = '')
|
40
|
+
def create_reservation(reservation_ip, reservation_subnet_mask, reservation_mac, reservation_name, reservation_comment = '', client_type = DhcpsApi::ClientType::CLIENT_TYPE_DHCP)
|
39
41
|
subnet_element = DhcpsApi::DHCP_SUBNET_ELEMENT_DATA_V4.new
|
40
42
|
subnet_element[:element_type] = DhcpsApi::DHCP_SUBNET_ELEMENT_TYPE::DhcpReservedIps
|
41
43
|
subnet_element[:element][:reserved_ip] = (reserved_ip = DhcpsApi::DHCP_IP_RESERVATION_V4.new).pointer
|
42
44
|
|
43
45
|
reserved_ip[:reserved_ip_address] = ip_to_uint32(reservation_ip)
|
44
46
|
reserved_ip[:reserved_for_client] = DhcpsApi::DHCP_CLIENT_UID.from_mac_address(reservation_mac).pointer
|
45
|
-
reserved_ip[:b_allowed_client_types] =
|
47
|
+
reserved_ip[:b_allowed_client_types] = client_type
|
46
48
|
|
47
49
|
ip_as_octets = reservation_ip.split('.').map {|octet| octet.to_i}
|
48
50
|
mask_as_octets = reservation_subnet_mask.split('.').map {|octet| octet.to_i}
|
@@ -51,7 +53,7 @@ module DhcpsApi
|
|
51
53
|
error = DhcpsApi::Win2008::SubnetElement.DhcpAddSubnetElementV4(to_wchar_string(server_ip_address), ip_to_uint32(subnet_address), subnet_element.pointer)
|
52
54
|
raise DhcpsApi::Error.new("Error creating reservation.", error) if error != 0
|
53
55
|
|
54
|
-
modify_client(reservation_ip, reservation_subnet_mask, reservation_mac, reservation_name, reservation_comment, 0,
|
56
|
+
modify_client(reservation_ip, reservation_subnet_mask, reservation_mac, reservation_name, reservation_comment, 0, client_type)
|
55
57
|
|
56
58
|
subnet_element.as_ruby_struct
|
57
59
|
end
|
data/lib/dhcpsapi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dhcpsapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitri Dolguikh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|