net-dhcp 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document CHANGED
@@ -9,3 +9,5 @@ bin/*
9
9
  -
10
10
  features/**/*.feature
11
11
  LICENSE
12
+ README
13
+ CHANGELOG
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ *1.1.0
2
+
3
+ * Added BroadcastAddressOption and cleaned up the output for some options to make them more readable [rakshasa]
4
+
1
5
  *1.0.2
2
6
 
3
7
  * Ensure chaddr is packed to the correct size (https://github.com/mjtko/net-dhcp-ruby/pull/1) [rakshasa]
@@ -1,5 +1,5 @@
1
1
  module Net
2
2
  module Dhcp
3
- VERSION = "1.0.2"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
data/lib/net/dhcp/core.rb CHANGED
@@ -205,7 +205,7 @@ module DHCP
205
205
  def to_s
206
206
  out = "DHCP Message\r\n"
207
207
  out << "\tFIELDS:\r\n"
208
- out << "\t\tTransaction ID = #{self.xid}\r\n"
208
+ out << "\t\tTransaction ID = 0x#{self.xid.to_s(16)}\r\n"
209
209
  out << "\t\tClient IP address = #{[self.ciaddr].pack('N').unpack('C4').join('.')}\r\n"
210
210
  out << "\t\tYour IP address = #{[self.yiaddr].pack('N').unpack('C4').join('.')}\r\n"
211
211
  out << "\t\tNext server IP address = #{[self.siaddr].pack('N').unpack('C4').join('.')}\r\n"
@@ -172,6 +172,25 @@ module DHCP
172
172
  end
173
173
  end
174
174
 
175
+ # This option specifies the broadcast address in use on the client's
176
+ # subnet. Legal values for broadcast addresses are specified in
177
+ # section 3.2.1.3 of [4].
178
+ #
179
+ # The code for this option is 28, and its length is 4.
180
+ #
181
+ # The default value for this option is 255.255.255.255
182
+ class BroadcastAddressOption < Option
183
+ def initialize(params={})
184
+ params[:type] = $DHCP_BROADCASTADDR
185
+ params[:payload] = params.fetch(:payload, [255, 255, 255, 255])
186
+ super(params)
187
+ end
188
+
189
+ def to_s()
190
+ "Broadcast Adress = #{self.payload.join('.')}"
191
+ end
192
+ end
193
+
175
194
  # This option is used in a client request (DHCPDISCOVER) to allow the
176
195
  # client to request that a particular IP address be assigned.
177
196
  #
@@ -209,7 +228,10 @@ module DHCP
209
228
  end
210
229
 
211
230
  def to_s()
212
- "IP Address Lease Time = #{self.payload.pack('C*').unpack('N').first} seg"
231
+ value = self.payload.pack('C*').unpack('N').first
232
+ value = "infinite" if value == 0xffffffff
233
+
234
+ "IP Address Lease Time = #{value} seg"
213
235
  end
214
236
  end
215
237
 
@@ -289,7 +311,7 @@ module DHCP
289
311
  end
290
312
 
291
313
  def to_s
292
- "Parameter Request List = #{self.payload}"
314
+ "Parameter Request List = #{self.payload.join(',')}"
293
315
  end
294
316
  end
295
317
 
@@ -561,7 +583,7 @@ module DHCP
561
583
  $DHCP_MTUTABLE => Option,
562
584
  $DHCP_MTUSIZE => Option,
563
585
  $DHCP_LOCALSUBNETS => Option,
564
- $DHCP_BROADCASTADDR => Option,
586
+ $DHCP_BROADCASTADDR => BroadcastAddressOption,
565
587
  $DHCP_DOMASKDISCOV => Option,
566
588
  $DHCP_MASKSUPPLY => Option,
567
589
  $DHCP_DOROUTEDISC => Option,
data/net-dhcp.gemspec CHANGED
@@ -5,15 +5,16 @@ Gem::Specification.new do |s|
5
5
  s.name = 'net-dhcp'
6
6
  s.version = Net::Dhcp::VERSION
7
7
  s.platform = Gem::Platform::RUBY
8
- s.date = "2011-12-06"
8
+ s.date = "2011-12-08"
9
9
  s.authors = ['daniel martin gomez (etd)', 'syonbori', 'Mark J. Titorenko']
10
10
  s.email = 'mark.titorenko@alces-software.com'
11
- s.homepage = 'http://github.com/mjtko/net-dhcp'
11
+ s.homepage = 'http://github.com/mjtko/net-dhcp-ruby'
12
12
  s.summary = %Q{set of classes to low level handle the DHCP protocol}
13
13
  s.description = %Q{The aim of Net::DHCP is to provide a set of classes to low level handle the DHCP protocol (rfc2131, rfc2132, etc.). With Net::DHCP you will be able to craft custom DHCP packages and have access to all the fields defined for the protocol.}
14
14
  s.extra_rdoc_files = [
15
15
  'LICENSE',
16
16
  'README',
17
+ 'CHANGELOG'
17
18
  ]
18
19
 
19
20
  s.required_rubygems_version = Gem::Requirement.new('>= 1.3.7')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-dhcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-12-06 00:00:00.000000000 Z
14
+ date: 2011-12-08 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec
18
- requirement: &70120488772720 !ruby/object:Gem::Requirement
18
+ requirement: &70241335055920 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: '0'
24
24
  type: :development
25
25
  prerelease: false
26
- version_requirements: *70120488772720
26
+ version_requirements: *70241335055920
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
- requirement: &70120488772220 !ruby/object:Gem::Requirement
29
+ requirement: &70241335055440 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
- version_requirements: *70120488772220
37
+ version_requirements: *70241335055440
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: bueller
40
- requirement: &70120488771700 !ruby/object:Gem::Requirement
40
+ requirement: &70241335054900 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: '0'
46
46
  type: :development
47
47
  prerelease: false
48
- version_requirements: *70120488771700
48
+ version_requirements: *70241335054900
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: rake
51
- requirement: &70120488771220 !ruby/object:Gem::Requirement
51
+ requirement: &70241335054440 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: '0'
57
57
  type: :development
58
58
  prerelease: false
59
- version_requirements: *70120488771220
59
+ version_requirements: *70241335054440
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: rcov
62
- requirement: &70120488770760 !ruby/object:Gem::Requirement
62
+ requirement: &70241335054000 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ! '>='
@@ -67,7 +67,7 @@ dependencies:
67
67
  version: '0'
68
68
  type: :development
69
69
  prerelease: false
70
- version_requirements: *70120488770760
70
+ version_requirements: *70241335054000
71
71
  description: The aim of Net::DHCP is to provide a set of classes to low level handle
72
72
  the DHCP protocol (rfc2131, rfc2132, etc.). With Net::DHCP you will be able to craft
73
73
  custom DHCP packages and have access to all the fields defined for the protocol.
@@ -78,6 +78,7 @@ extensions: []
78
78
  extra_rdoc_files:
79
79
  - LICENSE
80
80
  - README
81
+ - CHANGELOG
81
82
  files:
82
83
  - .document
83
84
  - .gitignore
@@ -99,7 +100,7 @@ files:
99
100
  - spec/net-dhcp_spec.rb
100
101
  - spec/spec_helper.rb
101
102
  - test/dhcp_test.rb
102
- homepage: http://github.com/mjtko/net-dhcp
103
+ homepage: http://github.com/mjtko/net-dhcp-ruby
103
104
  licenses: []
104
105
  post_install_message:
105
106
  rdoc_options: []
@@ -113,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
114
  version: '0'
114
115
  segments:
115
116
  - 0
116
- hash: 3355116122344638198
117
+ hash: 2925178242952011714
117
118
  required_rubygems_version: !ruby/object:Gem::Requirement
118
119
  none: false
119
120
  requirements: