dhcpsapi 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3287715b0d2e3c50cf1be8df79f06db118c13d6e
4
- data.tar.gz: 14fc8fe2e68f3a0ec64a43568d3d8e454a25f6ea
3
+ metadata.gz: 8de1b8659955ca630bb905e80a25a5f9cd3da392
4
+ data.tar.gz: e084547979b41c1943dcc23a411a8b00c45cb8e4
5
5
  SHA512:
6
- metadata.gz: e8db883b8de7ace5b47217d15a4f28c019aad3b0bff3540f03547683c92a45ceb8a4fee30219a855f4d49735f34177e32ad0927044484a9afb39cc37b4567d5d
7
- data.tar.gz: 184a8fae50cbce438dcf5bda28ce954e9bcf6dbf85e9e65b578aab82256f55e7d2dadef82af97bd2ae2f513d8cd719553506d5657d56cc6b9b605fa00189aea2
6
+ metadata.gz: 795bb44c1631a4b0144a9c668644fcd95ed8f12a2dd2ed64f4b41f1ab4664eedda2d19a493b9a1da0eee82f6c0717ab63f2f2c857c00fa15235d5fcea80e84f1
7
+ data.tar.gz: 1074863887ba322813fc7a034debc55f3ff55b372bb5533455c01725f086d3ba0c8fdbe73b30b08af88e85492d37cb20f3b3c714d06530fa6f9001324684ea5e
@@ -1,23 +1,4 @@
1
1
  module DhcpsApi
2
- class QuarantineStatus
3
- #The DHCP client is compliant with the health policies defined by the administrator and has normal access to the network.
4
- NOQUARANTINE = 0
5
- #The DHCP client is not compliant with the health policies defined by the administrator and is being quarantined with restricted access to the network.
6
- RESTRICTEDACCESS = 1
7
- #The DHCP client is not compliant with the health policies defined by the administrator and is being denied access to the network.
8
- # The DHCP server does not grant an IP address lease to this client.
9
- DROPPACKET = 2
10
- #The DHCP client is not compliant with the health policies defined by the administrator and is being granted normal access to the network for a limited time.
11
- PROBATION = 3
12
- #The DHCP client is exempt from compliance with the health policies defined by the administrator and is granted normal access to the network.
13
- EXEMPT = 4
14
- #The DHCP client is put into the default quarantine state configured on the DHCP NAP server. When a network policy server (NPS) is unavailable,
15
- # the DHCP client can be put in any of the states NOQUARANTINE, RESTRICTEDACCESS, or DROPPACKET, depending on the default setting on the DHCP NAP server.
16
- DEFAULTQUARSETTING = 5
17
- #No quarantine.
18
- NOQUARINFO = 6
19
- end
20
-
21
2
  =begin
22
3
  typedef struct _DHCP_CLIENT_INFO_PB {
23
4
  DHCP_IP_ADDRESS ClientIpAddress;
@@ -1,32 +1,4 @@
1
1
  module DhcpsApi
2
- DHCP_FLAGS_OPTION_IS_VENDOR = 3
3
-
4
- class ClientType
5
- # The client's dynamic IP address protocol is unknown.
6
- CLIENT_TYPE_UNSPECIFIED = 0x0
7
- # The client uses DHCP for dynamic IP address service.
8
- CLIENT_TYPE_DHCP = 0x1
9
- # The client uses BOOTP for dynamic IP address service.
10
- CLIENT_TYPE_BOOTP = 0x2
11
- # The client can use either DHCP or BOOTP for dynamic IP address service.
12
- CLIENT_TYPE_BOTH =( CLIENT_TYPE_DHCP | CLIENT_TYPE_BOOTP )
13
- # The client does not use a supported dynamic IP address service.
14
- CLIENT_TYPE_NONE = 0x64
15
- CLIENT_TYPE_RESERVATION_FLAG = 0x4
16
- end
17
-
18
- class DHCP_FORCE_FLAG
19
- # The operation deletes all client records affected by the element, and then deletes the element.
20
- DhcpFullForce = 0
21
- # The operation only deletes the subnet element, leaving intact any client records impacted by the change.
22
- DhcpNoForce = 1
23
- # The operation deletes all client records affected by the element, and then deletes the element from the DHCP server.
24
- # But it does not delete any registered DNS records associated with the deleted client records from the DNS server.
25
- # This flag is only valid when passed to DhcpDeleteSubnet.
26
- # Note that the minimum server OS requirement for this value is Windows Server 2012 R2 with KB 3100473 installed.
27
- DhcpFailoverForce = 2
28
- end
29
-
30
2
  =begin
31
3
  typedef struct _DHCP_IP_ARRAY {
32
4
  DWORD NumElements;
@@ -128,19 +100,6 @@ module DhcpsApi
128
100
  end
129
101
  end
130
102
 
131
- =begin
132
- typedef enum _DHCP_CLIENT_SEARCH_TYPE {
133
- DhcpClientIpAddress,
134
- DhcpClientHardwareAddress,
135
- DhcpClientName
136
- } DHCP_SEARCH_INFO_TYPE, *LPDHCP_SEARCH_INFO_TYPE;
137
- =end
138
- class DHCP_SEARCH_INFO_TYPE
139
- DhcpClientIpAddress = 0
140
- DhcpClientHardwareAddress = 1
141
- DhcpClientName = 2
142
- end
143
-
144
103
  =begin
145
104
  typedef struct _DHCP_CLIENT_SEARCH_INFO {
146
105
  DHCP_SEARCH_INFO_TYPE SearchType;
@@ -161,37 +120,6 @@ module DhcpsApi
161
120
  :search_info, SEARCH_INFO_UNION
162
121
  end
163
122
 
164
- =begin
165
- typedef enum _DHCP_OPTION_DATA_TYPE {
166
- DhcpByteOption,
167
- DhcpWordOption,
168
- DhcpDWordOption,
169
- DhcpDWordDWordOption,
170
- DhcpIpAddressOption,
171
- DhcpStringDataOption,
172
- DhcpBinaryDataOption,
173
- DhcpEncapsulatedDataOption,
174
- DhcpIpv6AddressOption
175
- } DHCP_OPTION_DATA_TYPE, *LPDHCP_OPTION_DATA_TYPE;
176
- =end
177
- class DHCP_OPTION_DATA_TYPE
178
- DhcpByteOption = 0
179
- DhcpWordOption = 1
180
- DhcpDWordOption = 2
181
- # The option data is stored as a DWORD_DWORD value.
182
- DhcpDWordDWordOption = 3
183
- # The option data is an IP address, stored as a DHCP_IP_ADDRESS value (DWORD).
184
- DhcpIpAddressOption = 4
185
- # The option data is stored as a Unicode string.
186
- DhcpStringDataOption = 5
187
- # The option data is stored as a DHCP_BINARY_DATA structure.
188
- DhcpBinaryDataOption = 6
189
- # The option data is encapsulated and stored as a DHCP_BINARY_DATA structure.
190
- DhcpEncapsulatedDataOption = 7
191
- # The option data is stored as a Unicode string.
192
- DhcpIpv6AddressOption = 8
193
- end
194
-
195
123
  class DWORD_DWORD < DHCPS_Struct
196
124
  layout :dword1, :uint32,
197
125
  :dword2, :uint32
@@ -0,0 +1,150 @@
1
+ module DhcpsApi
2
+ DHCP_FLAGS_OPTION_IS_VENDOR = 3
3
+
4
+ class ClientType
5
+ # The client's dynamic IP address protocol is unknown.
6
+ CLIENT_TYPE_UNSPECIFIED = 0x0
7
+ # The client uses DHCP for dynamic IP address service.
8
+ CLIENT_TYPE_DHCP = 0x1
9
+ # The client uses BOOTP for dynamic IP address service.
10
+ CLIENT_TYPE_BOOTP = 0x2
11
+ # The client can use either DHCP or BOOTP for dynamic IP address service.
12
+ CLIENT_TYPE_BOTH =( CLIENT_TYPE_DHCP | CLIENT_TYPE_BOOTP )
13
+ # The client does not use a supported dynamic IP address service.
14
+ CLIENT_TYPE_NONE = 0x64
15
+ CLIENT_TYPE_RESERVATION_FLAG = 0x4
16
+ end
17
+
18
+ class DHCP_FORCE_FLAG
19
+ # The operation deletes all client records affected by the element, and then deletes the element.
20
+ DhcpFullForce = 0
21
+ # The operation only deletes the subnet element, leaving intact any client records impacted by the change.
22
+ DhcpNoForce = 1
23
+ # The operation deletes all client records affected by the element, and then deletes the element from the DHCP server.
24
+ # But it does not delete any registered DNS records associated with the deleted client records from the DNS server.
25
+ # This flag is only valid when passed to DhcpDeleteSubnet.
26
+ # Note that the minimum server OS requirement for this value is Windows Server 2012 R2 with KB 3100473 installed.
27
+ DhcpFailoverForce = 2
28
+ end
29
+
30
+ =begin
31
+ typedef enum _DHCP_CLIENT_SEARCH_TYPE {
32
+ DhcpClientIpAddress,
33
+ DhcpClientHardwareAddress,
34
+ DhcpClientName
35
+ } DHCP_SEARCH_INFO_TYPE, *LPDHCP_SEARCH_INFO_TYPE;
36
+ =end
37
+ class DHCP_SEARCH_INFO_TYPE
38
+ DhcpClientIpAddress = 0
39
+ DhcpClientHardwareAddress = 1
40
+ DhcpClientName = 2
41
+ end
42
+
43
+ =begin
44
+ typedef enum _DHCP_OPTION_DATA_TYPE {
45
+ DhcpByteOption,
46
+ DhcpWordOption,
47
+ DhcpDWordOption,
48
+ DhcpDWordDWordOption,
49
+ DhcpIpAddressOption,
50
+ DhcpStringDataOption,
51
+ DhcpBinaryDataOption,
52
+ DhcpEncapsulatedDataOption,
53
+ DhcpIpv6AddressOption
54
+ } DHCP_OPTION_DATA_TYPE, *LPDHCP_OPTION_DATA_TYPE;
55
+ =end
56
+ class DHCP_OPTION_DATA_TYPE
57
+ DhcpByteOption = 0
58
+ DhcpWordOption = 1
59
+ DhcpDWordOption = 2
60
+ # The option data is stored as a DWORD_DWORD value.
61
+ DhcpDWordDWordOption = 3
62
+ # The option data is an IP address, stored as a DHCP_IP_ADDRESS value (DWORD).
63
+ DhcpIpAddressOption = 4
64
+ # The option data is stored as a Unicode string.
65
+ DhcpStringDataOption = 5
66
+ # The option data is stored as a DHCP_BINARY_DATA structure.
67
+ DhcpBinaryDataOption = 6
68
+ # The option data is encapsulated and stored as a DHCP_BINARY_DATA structure.
69
+ DhcpEncapsulatedDataOption = 7
70
+ # The option data is stored as a Unicode string.
71
+ DhcpIpv6AddressOption = 8
72
+ end
73
+
74
+ class QuarantineStatus
75
+ #The DHCP client is compliant with the health policies defined by the administrator and has normal access to the network.
76
+ NOQUARANTINE = 0
77
+ #The DHCP client is not compliant with the health policies defined by the administrator and is being quarantined with restricted access to the network.
78
+ RESTRICTEDACCESS = 1
79
+ #The DHCP client is not compliant with the health policies defined by the administrator and is being denied access to the network.
80
+ # The DHCP server does not grant an IP address lease to this client.
81
+ DROPPACKET = 2
82
+ #The DHCP client is not compliant with the health policies defined by the administrator and is being granted normal access to the network for a limited time.
83
+ PROBATION = 3
84
+ #The DHCP client is exempt from compliance with the health policies defined by the administrator and is granted normal access to the network.
85
+ EXEMPT = 4
86
+ #The DHCP client is put into the default quarantine state configured on the DHCP NAP server. When a network policy server (NPS) is unavailable,
87
+ # the DHCP client can be put in any of the states NOQUARANTINE, RESTRICTEDACCESS, or DROPPACKET, depending on the default setting on the DHCP NAP server.
88
+ DEFAULTQUARSETTING = 5
89
+ #No quarantine.
90
+ NOQUARINFO = 6
91
+ end
92
+
93
+ =begin
94
+ typedef enum _DHCP_OPTION_TYPE {
95
+ DhcpUnaryElementTypeOption,
96
+ DhcpArrayTypeOption
97
+ } DHCP_OPTION_TYPE, *LPDHCP_OPTION_TYPE;
98
+ =end
99
+ class DHCP_OPTION_TYPE
100
+ DhcpUnaryElementTypeOption = 0
101
+ DhcpArrayTypeOption = 1
102
+ end
103
+
104
+ #
105
+ # DHCP_OPTION_SCOPE_TYPE enumeration defines the set of possible DHCP option scopes.
106
+ #
107
+ # @see https://msdn.microsoft.com/en-us/library/windows/desktop/aa363363(v=vs.85).aspx
108
+ #
109
+ class DHCP_OPTION_SCOPE_TYPE
110
+ # The DHCP options correspond to the default scope.
111
+ DhcpDefaultOptions = 0
112
+ # The DHCP options correspond to the global scope.
113
+ DhcpGlobalOptions = 1
114
+ # The DHCP options correspond to a specific subnet scope.
115
+ DhcpSubnetOptions = 2
116
+ # The DHCP options correspond to a reserved IP address.
117
+ DhcpReservedOptions = 3
118
+ # The DHCP options correspond to a multicast scope.
119
+ DhcpMScopeOptions = 4
120
+ end
121
+
122
+ class DHCP_SUBNET_STATE
123
+ DhcpsApiubnetEnabled = 0
124
+ DhcpsApiubnetDisabled = 1
125
+ DhcpsApiubnetEnabledSwitched = 2
126
+ DhcpsApiubnetDisabledSwitched = 3
127
+ DhcpsApiubnetInvalidState = 4
128
+ end
129
+
130
+ =begin
131
+ typedef enum _DHCP_SUBNET_ELEMENT_TYPE_V5 {
132
+ DhcpIpRanges,
133
+ DhcpSecondaryHosts,
134
+ DhcpReservedIps,
135
+ DhcpExcludedIpRanges,
136
+ DhcpIpRangesDhcpOnly,
137
+ DhcpIpRangesDhcpBootp,
138
+ DhcpIpRangesBootpOnly
139
+ } DHCP_SUBNET_ELEMENT_TYPE, *LPDHCP_SUBNET_ELEMENT_TYPE;
140
+ =end
141
+ class DHCP_SUBNET_ELEMENT_TYPE
142
+ DhcpIpRanges = 0
143
+ DhcpSecondaryHosts = 1
144
+ DhcpReservedIps = 2
145
+ DhcpExcludedIpRanges = 3
146
+ DhcpIpRangesDhcpOnly = 4
147
+ DhcpIpRangesDhcpBootp = 5
148
+ DhcpIpRangesBootpOnly = 6
149
+ end
150
+ end
@@ -1,15 +1,4 @@
1
1
  module DhcpsApi
2
- =begin
3
- typedef enum _DHCP_OPTION_TYPE {
4
- DhcpUnaryElementTypeOption,
5
- DhcpArrayTypeOption
6
- } DHCP_OPTION_TYPE, *LPDHCP_OPTION_TYPE;
7
- =end
8
- class DHCP_OPTION_TYPE
9
- DhcpUnaryElementTypeOption = 0
10
- DhcpArrayTypeOption = 1
11
- end
12
-
13
2
  =begin
14
3
  typedef struct _DHCP_OPTION {
15
4
  DHCP_OPTION_ID OptionID;
@@ -13,25 +13,6 @@ module DhcpsApi
13
13
  :reserved_ip_subnet_address, :uint32
14
14
  end
15
15
 
16
-
17
- #
18
- # DHCP_OPTION_SCOPE_TYPE enumeration defines the set of possible DHCP option scopes.
19
- #
20
- # @see https://msdn.microsoft.com/en-us/library/windows/desktop/aa363363(v=vs.85).aspx
21
- #
22
- class DHCP_OPTION_SCOPE_TYPE
23
- # The DHCP options correspond to the default scope.
24
- DhcpDefaultOptions = 0
25
- # The DHCP options correspond to the global scope.
26
- DhcpGlobalOptions = 1
27
- # The DHCP options correspond to a specific subnet scope.
28
- DhcpSubnetOptions = 2
29
- # The DHCP options correspond to a reserved IP address.
30
- DhcpReservedOptions = 3
31
- # The DHCP options correspond to a multicast scope.
32
- DhcpMScopeOptions = 4
33
- end
34
-
35
16
  #
36
17
  # DHCP_RESERVED_SCOPE_UNION describes a DHCP scope.
37
18
  #
@@ -1,12 +1,4 @@
1
1
  module DhcpsApi
2
- class DHCP_SUBNET_STATE
3
- DhcpsApiubnetEnabled = 0
4
- DhcpsApiubnetDisabled = 1
5
- DhcpsApiubnetEnabledSwitched = 2
6
- DhcpsApiubnetDisabledSwitched = 3
7
- DhcpsApiubnetInvalidState = 4
8
- end
9
-
10
2
  =begin
11
3
  typedef struct _DHCP_SUBNET_INFO {
12
4
  DHCP_IP_ADDRESS SubnetAddress;
@@ -1,25 +1,4 @@
1
1
  module DhcpsApi
2
- =begin
3
- typedef enum _DHCP_SUBNET_ELEMENT_TYPE_V5 {
4
- DhcpIpRanges,
5
- DhcpSecondaryHosts,
6
- DhcpReservedIps,
7
- DhcpExcludedIpRanges,
8
- DhcpIpRangesDhcpOnly,
9
- DhcpIpRangesDhcpBootp,
10
- DhcpIpRangesBootpOnly
11
- } DHCP_SUBNET_ELEMENT_TYPE, *LPDHCP_SUBNET_ELEMENT_TYPE;
12
- =end
13
- class DHCP_SUBNET_ELEMENT_TYPE
14
- DhcpIpRanges = 0
15
- DhcpSecondaryHosts = 1
16
- DhcpReservedIps = 2
17
- DhcpExcludedIpRanges = 3
18
- DhcpIpRangesDhcpOnly = 4
19
- DhcpIpRangesDhcpBootp = 5
20
- DhcpIpRangesBootpOnly = 6
21
- end
22
-
23
2
  =begin
24
3
  typedef struct _DHCP_SUBNET_ELEMENT_DATA_V4 {
25
4
  DHCP_SUBNET_ELEMENT_TYPE ElementType;
@@ -1,3 +1,3 @@
1
1
  module DhcpsApi
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/dhcpsapi.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'ffi'
2
2
  require 'dhcpsapi/ffi'
3
+ require 'dhcpsapi/enums'
3
4
  require 'dhcpsapi/version'
4
5
  require 'dhcpsapi/common'
5
6
  require 'dhcpsapi/common_data_structs'
@@ -0,0 +1,9 @@
1
+ module DhcpsApi
2
+ class Server
3
+ attr_reader :server_ip_address
4
+
5
+ def initialize(server_ip_address)
6
+ @server_ip_address = server_ip_address
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ require 'dhcpsapi/enums'
2
+ require 'dhcpsapi/error'
3
+ require 'dhcpsapi_for_testing/server'
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dhcpsapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
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-07-27 00:00:00.000000000 Z
11
+ date: 2016-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: yard
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: Ruby wrappers for MS DHCP api
@@ -80,6 +80,7 @@ files:
80
80
  - lib/dhcpsapi/client.rb
81
81
  - lib/dhcpsapi/common.rb
82
82
  - lib/dhcpsapi/common_data_structs.rb
83
+ - lib/dhcpsapi/enums.rb
83
84
  - lib/dhcpsapi/error.rb
84
85
  - lib/dhcpsapi/ffi.rb
85
86
  - lib/dhcpsapi/misc.rb
@@ -90,6 +91,8 @@ files:
90
91
  - lib/dhcpsapi/subnet.rb
91
92
  - lib/dhcpsapi/subnet_element.rb
92
93
  - lib/dhcpsapi/version.rb
94
+ - lib/dhcpsapi_for_testing.rb
95
+ - lib/dhcpsapi_for_testing/server.rb
93
96
  homepage: https://github.com/witlessbird/ruby-dhcpsapi
94
97
  licenses:
95
98
  - Apache License, v2.0
@@ -100,12 +103,12 @@ require_paths:
100
103
  - lib
101
104
  required_ruby_version: !ruby/object:Gem::Requirement
102
105
  requirements:
103
- - - ">="
106
+ - - '>='
104
107
  - !ruby/object:Gem::Version
105
108
  version: '0'
106
109
  required_rubygems_version: !ruby/object:Gem::Requirement
107
110
  requirements:
108
- - - ">="
111
+ - - '>='
109
112
  - !ruby/object:Gem::Version
110
113
  version: '0'
111
114
  requirements: []