lib-dhcp 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43a9da83b7dd82429f766e5d142f0918a2f5bd823695d54583e04e8be6293bd4
4
- data.tar.gz: 3b5b782fddf0c68f0949ebf02b3e5d5f5c7cc3b1c04a5a21cd8a4c248be42c24
3
+ metadata.gz: fdd10e98acc7696e58820d6b1e40ce262a65c9a85a48d60229a5a9b9c2876b3b
4
+ data.tar.gz: 739aff2909214a5dc49bf09d8169bf8f0fda1b4349bb67a1cd372502bc135950
5
5
  SHA512:
6
- metadata.gz: 8c099424600a5bf373a0518ca8f5ad0687db9a42ee7f1f687664826bce04d193b38812238334e6a0ce11eec93a0d2eb4ea1996df657fd2989a9ed48830dd3edf
7
- data.tar.gz: 99e3916d6e1a28792408f4885528ba1b00573aff88bef6336ed6033eb1818a83ea00d59cfbfd371811306100817c57b0c86dc98ee75be6a32925c46d57b9807b
6
+ metadata.gz: 0465a4aa77a5fea5860de2676ffcce737ba494055db6fcda1296aa3b69c42fb412ff53f7477697834c55b8ca55bfb558d0b35691f0ce0fdafac0e0bae833b964
7
+ data.tar.gz: c5705c5689e2155aff7225cdb8b7cd0cd8b57755366eb77ecff58264a7b26083b75b5bfdabd66ceba06be506578c4c8d3a04bd87c7aa57db3899856f4c3d2f93
@@ -27,6 +27,8 @@ jobs:
27
27
 
28
28
  - name: Set up Ruby
29
29
  uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: 3.0.2
30
32
 
31
33
  - name: Publish to RubyGems
32
34
  run: |
@@ -12,6 +12,8 @@ jobs:
12
12
 
13
13
  - name: Set up Ruby
14
14
  uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: 3.0.2
15
17
 
16
18
  - name: Install dependencies
17
19
  run: bundle install
@@ -10,7 +10,7 @@ module Lib
10
10
  module DHCP
11
11
  class Message
12
12
  class ACK < Message
13
- def initialize(htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
13
+ def initialize(op:BOOTREPLY, htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
14
14
  if block_given?
15
15
  yield self
16
16
  else
@@ -40,6 +40,8 @@ module Lib
40
40
  end
41
41
 
42
42
  self.options.add Lib::DHCP::Option53.new(ACKNOWLEDGE)
43
+ self.option53 = ACKNOWLEDGE
44
+ self.op = BOOTREPLY
43
45
  end
44
46
 
45
47
  def pack
@@ -52,7 +54,7 @@ module Lib
52
54
 
53
55
  def self.unpack(packet)
54
56
  res = super packet
55
- raise TypeError, "No implicit conversion of #{res.class.name} into #{self.class.name}" unless res.is_a? self.class
57
+ raise TypeError, "No implicit conversion of #{res.class.name} into #{self.name}" unless res.is_a? self
56
58
  res
57
59
  end
58
60
 
@@ -9,7 +9,7 @@ module Lib
9
9
  module DHCP
10
10
  class Message
11
11
  class Decline < Message
12
- def initialize(htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
12
+ def initialize(op:BOOTREQUEST, htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
13
13
  if block_given?
14
14
  yield self
15
15
  else
@@ -51,7 +51,7 @@ module Lib
51
51
 
52
52
  def self.unpack(packet)
53
53
  res = super(packet)
54
- raise TypeError, "No implicit conversion of #{res.class.name} into #{self.class.name}" unless res.is_a? self.class
54
+ raise TypeError, "No implicit conversion of #{res.class.name} into #{self.name}" unless res.is_a? self
55
55
  res
56
56
  end
57
57
 
@@ -9,7 +9,7 @@ module Lib
9
9
  module DHCP
10
10
  class Message
11
11
  class Discover < Message
12
- def initialize(htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
12
+ def initialize(op:BOOTREQUEST, htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
13
13
  if block_given?
14
14
  yield self
15
15
  else
@@ -50,7 +50,7 @@ module Lib
50
50
 
51
51
  def self.unpack(packet)
52
52
  res = super(packet)
53
- raise TypeError, "No implicit conversion of #{res.class.name} into #{self.class.name}" unless res.is_a? self.class
53
+ raise TypeError, "No implicit conversion of #{res.class.name} into #{self.name}" unless res.is_a? self
54
54
  res
55
55
  end
56
56
 
@@ -9,7 +9,7 @@ module Lib
9
9
  module DHCP
10
10
  class Message
11
11
  class Inform < Message
12
- def initialize(htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
12
+ def initialize(op:BOOTREQUEST, htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
13
13
  if block_given?
14
14
  yield self
15
15
  else
@@ -50,7 +50,7 @@ module Lib
50
50
 
51
51
  def self.unpack(packet)
52
52
  res = super(packet)
53
- raise TypeError, "No implicit conversion of #{res.class.name} into #{self.class.name}" unless res.is_a? self.class
53
+ raise TypeError, "No implicit conversion of #{res.class.name} into #{self.name}" unless res.is_a? self
54
54
  res
55
55
  end
56
56
 
@@ -9,7 +9,7 @@ module Lib
9
9
  module DHCP
10
10
  class Message
11
11
  class LeaseActive < Message
12
- def initialize(htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
12
+ def initialize(op:BOOTREPLY, htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
13
13
  if block_given?
14
14
  yield self
15
15
  else
@@ -51,7 +51,7 @@ module Lib
51
51
 
52
52
  def self.unpack(packet)
53
53
  res = super(packet)
54
- raise TypeError, "No implicit conversion of #{res.class.name} into #{self.class.name}" unless res.is_a? self.class
54
+ raise TypeError, "No implicit conversion of #{res.class.name} into #{self.name}" unless res.is_a? self
55
55
  res
56
56
  end
57
57
 
@@ -9,7 +9,7 @@ module Lib
9
9
  module DHCP
10
10
  class Message
11
11
  class LeaseQuery < Message
12
- def initialize(htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
12
+ def initialize(op:BOOTREQUEST, htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
13
13
  if block_given?
14
14
  yield self
15
15
  else
@@ -50,7 +50,7 @@ module Lib
50
50
 
51
51
  def self.unpack(packet)
52
52
  res = super(packet)
53
- raise TypeError, "No implicit conversion of #{res.class.name} into #{self.class.name}" unless res.is_a? self.class
53
+ raise TypeError, "No implicit conversion of #{res.class.name} into #{self.name}" unless res.is_a? self
54
54
  res
55
55
  end
56
56
 
@@ -9,7 +9,7 @@ module Lib
9
9
  module DHCP
10
10
  class Message
11
11
  class LeaseUnassigned < Message
12
- def initialize(htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
12
+ def initialize(op:BOOTREPLY, htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
13
13
  if block_given?
14
14
  yield self
15
15
  else
@@ -50,7 +50,7 @@ module Lib
50
50
 
51
51
  def self.unpack(packet)
52
52
  res = super(packet)
53
- raise TypeError, "No implicit conversion of #{res.class.name} into #{self.class.name}" unless res.is_a? self.class
53
+ raise TypeError, "No implicit conversion of #{res.class.name} into #{self.name}" unless res.is_a? self
54
54
  res
55
55
  end
56
56
 
@@ -9,7 +9,7 @@ module Lib
9
9
  module DHCP
10
10
  class Message
11
11
  class LeaseUnknown < Message
12
- def initialize(htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
12
+ def initialize(op:BOOTREPLY, htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
13
13
  if block_given?
14
14
  yield self
15
15
  else
@@ -50,7 +50,7 @@ module Lib
50
50
 
51
51
  def self.unpack(packet)
52
52
  res = super(packet)
53
- raise TypeError, "No implicit conversion of #{res.class.name} into #{self.class.name}" unless res.is_a? self.class
53
+ raise TypeError, "No implicit conversion of #{res.class.name} into #{self.name}" unless res.is_a? self
54
54
  res
55
55
  end
56
56
 
@@ -49,6 +49,10 @@ module Lib
49
49
  end
50
50
  end
51
51
 
52
+ def self.from_json(json)
53
+ self.unpack(super(json).pack)
54
+ end
55
+
52
56
  def self.unpack(packet)
53
57
  packet = super(packet)
54
58
  # noinspection RubyResolve
@@ -9,7 +9,7 @@ module Lib
9
9
  module DHCP
10
10
  class Message
11
11
  class NACK < Message
12
- def initialize(htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
12
+ def initialize(op:BOOTREPLY, htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
13
13
  if block_given?
14
14
  yield self
15
15
  else
@@ -50,7 +50,7 @@ module Lib
50
50
 
51
51
  def self.unpack(packet)
52
52
  res = super(packet)
53
- raise TypeError, "No implicit conversion of #{res.class.name} into #{self.class.name}" unless res.is_a? self.class
53
+ raise TypeError, "No implicit conversion of #{res.class.name} into #{self.name}" unless res.is_a? self
54
54
  res
55
55
  end
56
56
 
@@ -9,7 +9,7 @@ module Lib
9
9
  module DHCP
10
10
  class Message
11
11
  class Offer < Message
12
- def initialize(htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
12
+ def initialize(op:BOOTREPLY, htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
13
13
  if block_given?
14
14
  yield self
15
15
  else
@@ -50,7 +50,7 @@ module Lib
50
50
 
51
51
  def self.unpack(packet)
52
52
  res = super(packet)
53
- raise TypeError, "No implicit conversion of #{res.class.name} into #{self.class.name}" unless res.is_a? self.class
53
+ raise TypeError, "No implicit conversion of #{res.class.name} into #{self.name}" unless res.is_a? self
54
54
  res
55
55
  end
56
56
 
@@ -9,7 +9,7 @@ module Lib
9
9
  module DHCP
10
10
  class Message
11
11
  class Release < Message
12
- def initialize(htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
12
+ def initialize(op:BOOTREQUEST, htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
13
13
  if block_given?
14
14
  yield self
15
15
  else
@@ -50,7 +50,7 @@ module Lib
50
50
 
51
51
  def self.unpack(packet)
52
52
  res = super(packet)
53
- raise TypeError, "No implicit conversion of #{res.class.name} into #{self.class.name}" unless res.is_a? self.class
53
+ raise TypeError, "No implicit conversion of #{res.class.name} into #{self.name}" unless res.is_a? self
54
54
  res
55
55
  end
56
56
 
@@ -9,7 +9,7 @@ module Lib
9
9
  module DHCP
10
10
  class Message
11
11
  class Request < Message
12
- def initialize(htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
12
+ def initialize(op:BOOTREQUEST, htype: 1, hlen: 6, hops: 0, xid: nil, secs: 0, flags: 0, ciaddr: 0, yiaddr: 0, siaddr: 0, giaddr: 0, chaddr: 0, sname: '.', file: '.', options: nil)
13
13
  if block_given?
14
14
  yield self
15
15
  else
@@ -50,7 +50,7 @@ module Lib
50
50
 
51
51
  def self.unpack(packet)
52
52
  res = super(packet)
53
- raise TypeError, "No implicit conversion of #{res.class.name} into #{self.class.name}" unless res.is_a? self.class
53
+ raise TypeError, "No implicit conversion of #{res.class.name} into #{self.name}" unless res.is_a? self
54
54
  res
55
55
  end
56
56
 
@@ -1,5 +1,5 @@
1
1
  module Lib
2
2
  module DHCP
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lib-dhcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Wojcieszonek
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-14 00:00:00.000000000 Z
11
+ date: 2025-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -404,7 +404,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
404
404
  - !ruby/object:Gem::Version
405
405
  version: '0'
406
406
  requirements: []
407
- rubygems_version: 3.2.32
407
+ rubygems_version: 3.2.22
408
408
  signing_key:
409
409
  specification_version: 4
410
410
  summary: DHCP protocol library.