packetgen 3.1.3 → 3.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/lib/packetgen.rb +24 -2
  3. data/lib/packetgen/capture.rb +30 -24
  4. data/lib/packetgen/config.rb +2 -2
  5. data/lib/packetgen/deprecation.rb +33 -7
  6. data/lib/packetgen/header.rb +2 -9
  7. data/lib/packetgen/header/arp.rb +2 -2
  8. data/lib/packetgen/header/asn1_base.rb +2 -2
  9. data/lib/packetgen/header/base.rb +2 -4
  10. data/lib/packetgen/header/bootp.rb +3 -3
  11. data/lib/packetgen/header/dhcp.rb +2 -2
  12. data/lib/packetgen/header/dhcp/option.rb +2 -2
  13. data/lib/packetgen/header/dhcp/options.rb +2 -2
  14. data/lib/packetgen/header/dhcpv6.rb +12 -12
  15. data/lib/packetgen/header/dhcpv6/duid.rb +8 -4
  16. data/lib/packetgen/header/dhcpv6/option.rb +4 -4
  17. data/lib/packetgen/header/dhcpv6/options.rb +2 -2
  18. data/lib/packetgen/header/dhcpv6/relay.rb +2 -2
  19. data/lib/packetgen/header/dns.rb +9 -9
  20. data/lib/packetgen/header/dns/name.rb +2 -2
  21. data/lib/packetgen/header/dns/opt.rb +2 -2
  22. data/lib/packetgen/header/dns/option.rb +2 -2
  23. data/lib/packetgen/header/dns/qdsection.rb +2 -2
  24. data/lib/packetgen/header/dns/question.rb +35 -35
  25. data/lib/packetgen/header/dns/rr.rb +3 -3
  26. data/lib/packetgen/header/dns/rrsection.rb +2 -2
  27. data/lib/packetgen/header/dot11.rb +5 -13
  28. data/lib/packetgen/header/dot11/control.rb +5 -5
  29. data/lib/packetgen/header/dot11/data.rb +2 -2
  30. data/lib/packetgen/header/dot11/element.rb +16 -16
  31. data/lib/packetgen/header/dot11/management.rb +2 -2
  32. data/lib/packetgen/header/dot11/sub_mngt.rb +2 -12
  33. data/lib/packetgen/header/dot1q.rb +2 -2
  34. data/lib/packetgen/header/dot1x.rb +6 -6
  35. data/lib/packetgen/header/eap.rb +16 -16
  36. data/lib/packetgen/header/eap/fast.rb +2 -2
  37. data/lib/packetgen/header/eap/md5.rb +2 -2
  38. data/lib/packetgen/header/eap/tls.rb +2 -2
  39. data/lib/packetgen/header/eap/ttls.rb +2 -2
  40. data/lib/packetgen/header/eth.rb +8 -5
  41. data/lib/packetgen/header/gre.rb +2 -2
  42. data/lib/packetgen/header/http.rb +2 -0
  43. data/lib/packetgen/header/http/headers.rb +2 -2
  44. data/lib/packetgen/header/http/request.rb +5 -5
  45. data/lib/packetgen/header/http/response.rb +6 -6
  46. data/lib/packetgen/header/http/verbs.rb +2 -2
  47. data/lib/packetgen/header/icmp.rb +2 -2
  48. data/lib/packetgen/header/icmpv6.rb +2 -2
  49. data/lib/packetgen/header/igmp.rb +4 -4
  50. data/lib/packetgen/header/igmpv3.rb +3 -3
  51. data/lib/packetgen/header/igmpv3/group_record.rb +6 -6
  52. data/lib/packetgen/header/igmpv3/mq.rb +2 -2
  53. data/lib/packetgen/header/igmpv3/mr.rb +2 -2
  54. data/lib/packetgen/header/ip.rb +3 -5
  55. data/lib/packetgen/header/ip/addr.rb +7 -2
  56. data/lib/packetgen/header/ip/option.rb +4 -6
  57. data/lib/packetgen/header/ip/options.rb +3 -5
  58. data/lib/packetgen/header/ipv6.rb +2 -2
  59. data/lib/packetgen/header/ipv6/addr.rb +7 -2
  60. data/lib/packetgen/header/ipv6/extension.rb +2 -2
  61. data/lib/packetgen/header/ipv6/hop_by_hop.rb +3 -3
  62. data/lib/packetgen/header/llc.rb +2 -2
  63. data/lib/packetgen/header/mdns.rb +2 -2
  64. data/lib/packetgen/header/mld.rb +2 -2
  65. data/lib/packetgen/header/mldv2.rb +2 -2
  66. data/lib/packetgen/header/mldv2/mcast_address_record.rb +2 -2
  67. data/lib/packetgen/header/mldv2/mlq.rb +2 -2
  68. data/lib/packetgen/header/mldv2/mlr.rb +2 -2
  69. data/lib/packetgen/header/ospfv2.rb +9 -9
  70. data/lib/packetgen/header/ospfv2/db_description.rb +2 -2
  71. data/lib/packetgen/header/ospfv2/hello.rb +2 -2
  72. data/lib/packetgen/header/ospfv2/ls_ack.rb +2 -2
  73. data/lib/packetgen/header/ospfv2/ls_request.rb +2 -2
  74. data/lib/packetgen/header/ospfv2/ls_update.rb +2 -2
  75. data/lib/packetgen/header/ospfv2/lsa.rb +3 -5
  76. data/lib/packetgen/header/ospfv2/lsa_header.rb +6 -6
  77. data/lib/packetgen/header/ospfv3.rb +2 -2
  78. data/lib/packetgen/header/ospfv3/db_description.rb +2 -2
  79. data/lib/packetgen/header/ospfv3/hello.rb +2 -2
  80. data/lib/packetgen/header/ospfv3/ipv6_prefix.rb +2 -2
  81. data/lib/packetgen/header/ospfv3/ls_ack.rb +2 -2
  82. data/lib/packetgen/header/ospfv3/ls_request.rb +2 -2
  83. data/lib/packetgen/header/ospfv3/ls_update.rb +2 -2
  84. data/lib/packetgen/header/ospfv3/lsa.rb +3 -5
  85. data/lib/packetgen/header/ospfv3/lsa_header.rb +7 -7
  86. data/lib/packetgen/header/snmp.rb +31 -28
  87. data/lib/packetgen/header/tcp.rb +3 -3
  88. data/lib/packetgen/header/tcp/option.rb +3 -5
  89. data/lib/packetgen/header/tcp/options.rb +2 -2
  90. data/lib/packetgen/header/tftp.rb +6 -6
  91. data/lib/packetgen/header/udp.rb +3 -3
  92. data/lib/packetgen/headerable.rb +5 -4
  93. data/lib/packetgen/inject.rb +23 -0
  94. data/lib/packetgen/inspect.rb +24 -5
  95. data/lib/packetgen/packet.rb +76 -51
  96. data/lib/packetgen/pcap.rb +29 -0
  97. data/lib/packetgen/pcapng.rb +2 -2
  98. data/lib/packetgen/pcapng/block.rb +12 -12
  99. data/lib/packetgen/pcapng/epb.rb +3 -7
  100. data/lib/packetgen/pcapng/file.rb +134 -95
  101. data/lib/packetgen/pcapng/idb.rb +30 -30
  102. data/lib/packetgen/pcapng/shb.rb +25 -34
  103. data/lib/packetgen/pcapng/spb.rb +4 -8
  104. data/lib/packetgen/pcapng/unknown_block.rb +2 -2
  105. data/lib/packetgen/pcaprub_wrapper.rb +67 -0
  106. data/lib/packetgen/proto.rb +2 -2
  107. data/lib/packetgen/types.rb +2 -0
  108. data/lib/packetgen/types/abstract_tlv.rb +24 -6
  109. data/lib/packetgen/types/array.rb +5 -5
  110. data/lib/packetgen/types/cstring.rb +2 -2
  111. data/lib/packetgen/types/enum.rb +3 -2
  112. data/lib/packetgen/types/fields.rb +5 -7
  113. data/lib/packetgen/types/int.rb +3 -5
  114. data/lib/packetgen/types/int_string.rb +2 -2
  115. data/lib/packetgen/types/length_from.rb +3 -3
  116. data/lib/packetgen/types/oui.rb +2 -2
  117. data/lib/packetgen/types/string.rb +2 -2
  118. data/lib/packetgen/types/tlv.rb +2 -2
  119. data/lib/packetgen/utils.rb +2 -2
  120. data/lib/packetgen/utils/arp_spoofer.rb +2 -2
  121. data/lib/packetgen/version.rb +3 -3
  122. metadata +26 -50
  123. data/.gitignore +0 -13
  124. data/.rubocop.yml +0 -30
  125. data/.travis.yml +0 -19
  126. data/Gemfile +0 -4
  127. data/Rakefile +0 -21
  128. data/packetgen.gemspec +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4bbe2b2ffd9d59d7fc57ac668744bd794deafa09b813fb7834588da9a571b64
4
- data.tar.gz: 24ac8e7feb4d0ad95aee6fb52f3ab53e8f0304e35991428e8fafba04002ceeaf
3
+ metadata.gz: 2adf2b07c2d2d334e4f0ae6e4e7b49571d4d436788bef51df6cf7c1a5aaba9c8
4
+ data.tar.gz: 8997321a31379ea6952ab42a4642d98a717587ed777652ebdb9e25b5928cc8d4
5
5
  SHA512:
6
- metadata.gz: 961b3c05d1d18c61c1b55042500a73f136654f612c05a8749e18b2d294517b23dde7f3c8fb0ac0e1fdf9bfc672b6b0535aa64e5f90fa156eb88d1a74a095a358
7
- data.tar.gz: 2d274501fa186766775374ad4c8d24c46a646dd3422d1da6930c96426c3e861f7f7cdd04f8cd5e1308b7237fa45679ad669e4503705121d97e6e9562f2a5c9c9
6
+ metadata.gz: b5af6e0d04f8bb03af01d63cde3879a6a13c8a78477811be2b95fee5c597820f4714f8ac8b69f4aa8f04d3d5b81c5e25b5787815ee2237a8c3329721b5dc7895
7
+ data.tar.gz: 6eebb203f8dfde49505987d16778c1ecbc81c463d6ac8b5f005e2c6f486166ba0cceabd848d3b3aeebe867b138993171026e8dcacfb04c84a126bc149ff5c616
@@ -1,11 +1,11 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  # This file is part of PacketGen
3
5
  # See https://github.com/sdaubert/packetgen for more informations
4
6
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
5
7
  # This program is published under MIT license.
6
8
 
7
- # frozen_string_literal: true
8
-
9
9
  require 'packetgen/version'
10
10
  require 'interfacez'
11
11
 
@@ -24,6 +24,26 @@ module PacketGen
24
24
  # Sending packet on wire error
25
25
  class WireError < Error; end
26
26
 
27
+ # No known binding
28
+ class BindingError < Error
29
+ # @return [Headerable]
30
+ attr_reader :prev_hdr
31
+ # @return [Headerable]
32
+ attr_reader :hdr
33
+
34
+ def initialize(prev_hdr, hdr)
35
+ @prev_hdr = prev_hdr
36
+ @hdr = hdr
37
+ end
38
+
39
+ def message
40
+ "#{prev_hdr.class} knowns no layer association with #{hdr.protocol_name}. " \
41
+ "Try #{prev_hdr.class}.bind_layer(#{hdr.class}, " \
42
+ "#{prev_hdr.method_name}_proto_field: " \
43
+ "<value_for_#{hdr.method_name}>)"
44
+ end
45
+ end
46
+
27
47
  # Shortcut for {Packet.gen}
28
48
  # @param [String] protocol base protocol for packet
29
49
  # @param [Hash] options specific options for +protocol+
@@ -97,6 +117,8 @@ require 'packetgen/deprecation'
97
117
  require 'packetgen/types'
98
118
  require 'packetgen/inspect'
99
119
  require 'packetgen/pcapng'
120
+ require 'packetgen/pcap'
100
121
  require 'packetgen/packet'
101
122
  require 'packetgen/capture'
123
+ require 'packetgen/inject'
102
124
  require 'packetgen/proto'
@@ -1,21 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
-
6
- # frozen_string_literal: true
7
+ require_relative 'pcaprub_wrapper'
7
8
 
8
9
  module PacketGen
9
10
  # Capture packets from wire
10
11
  # @author Sylvain Daubert
11
12
  # @author Kent 'picat' Gruber
12
13
  class Capture
13
- # Default snaplen to use if :snaplen option not defined.
14
- DEFAULT_SNAPLEN = 0xffff
15
-
16
14
  private
17
15
 
18
- attr_reader :filter, :cap_thread
16
+ attr_reader :filter, :cap_thread, :snaplen, :promisc
19
17
 
20
18
  public
21
19
 
@@ -44,8 +42,8 @@ module PacketGen
44
42
  # @param [Integer] snaplen maximum number of bytes to capture for
45
43
  # each packet.
46
44
  # @since 2.0.0 remove old 1.x API
47
- # @since 3.0.0 arguments are kwargs and nor more a hash
48
- def initialize(iface: nil, max: nil, timeout: nil, filter: nil, promisc: false, parse: true, snaplen: DEFAULT_SNAPLEN)
45
+ # @since 3.0.0 arguments are kwargs and no more a hash
46
+ def initialize(iface: nil, max: nil, timeout: nil, filter: nil, promisc: false, parse: true, snaplen: nil)
49
47
  @iface = iface || Interfacez.default || Interfacez.loopback
50
48
 
51
49
  @packets = []
@@ -57,23 +55,13 @@ module PacketGen
57
55
  # @see {#initialize} for parameters
58
56
  # @yieldparam [Packet,String] packet if a block is given, yield each
59
57
  # captured packet (Packet or raw data String, depending on +:parse+ option)
60
- # @since 3.0.0 arguments are kwargs and nor more a hash
61
- def start(iface: nil, max: nil, timeout: nil, filter: nil, promisc: false, parse: true, snaplen: DEFAULT_SNAPLEN)
58
+ # @since 3.0.0 arguments are kwargs and no more a hash
59
+ def start(iface: nil, max: nil, timeout: nil, filter: nil, promisc: false, parse: true, snaplen: nil, &block)
62
60
  set_options iface, max, timeout, filter, promisc, parse, snaplen
63
61
 
64
- pcap = PCAPRUB::Pcap.open_live(self.iface, @snaplen, @promisc, 1)
65
- set_filter_on pcap
66
-
67
62
  @cap_thread = Thread.new do
68
- pcap.each do |packet_data|
69
- raw_packets << packet_data
70
- if @parse
71
- packet = Packet.parse(packet_data)
72
- packets << packet
73
- yield packet if block_given?
74
- elsif block_given?
75
- yield packet_data
76
- end
63
+ PCAPRUBWrapper.capture(**capture_args) do |packet_data|
64
+ add_packet(packet_data, &block)
77
65
  break if defined?(@max) && (raw_packets.size >= @max)
78
66
  end
79
67
  end
@@ -101,10 +89,28 @@ module PacketGen
101
89
  @iface = iface unless iface.nil?
102
90
  end
103
91
 
104
- def set_filter_on(pcap)
92
+ def capture_args
93
+ h = { iface: iface, filter: filter }
94
+ h[:snaplen] = snaplen unless snaplen.nil?
95
+ h[:promisc] = promisc unless promisc.nil?
96
+ h
97
+ end
98
+
99
+ def filter_on(pcap)
105
100
  return if filter.nil? || filter.empty?
106
101
 
107
- pcap.setfilter filter
102
+ PCAPRUBWrapper.filter_on(pcap: pcap, filter: filter)
103
+ end
104
+
105
+ def add_packet(data, &block)
106
+ raw_packets << data
107
+ if @parse
108
+ packet = Packet.parse(data)
109
+ packets << packet
110
+ block&.call(packet)
111
+ elsif block
112
+ yield data
113
+ end
108
114
  end
109
115
  end
110
116
  end
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  require 'socket'
9
9
  require 'singleton'
10
10
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PacketGen
2
4
  # Deprecation module
3
5
  # @since 2.7.0
@@ -8,6 +10,14 @@ module PacketGen
8
10
  # @since 3.1.0
9
11
  REMOVE_VERSION = '4.0.0'
10
12
 
13
+ # @private
14
+ # @param [String] remove_version
15
+ # @return [String]
16
+ # @since 3.1.4
17
+ def self.removed(remove_version)
18
+ "It will be removed in PacketGen #{remove_version}"
19
+ end
20
+
11
21
  # Warn when using a deprecated method
12
22
  # @param [Module] klass class/module of deprecated method
13
23
  # @param [Symbol,String] deprecated_method
@@ -17,15 +27,14 @@ module PacketGen
17
27
  # @param [String] remove_version version from which +deprecated_method+ will
18
28
  # no more exist.
19
29
  def self.deprecated(klass, deprecated_method, new_method=nil, klass_method: false, remove_version: REMOVE_VERSION)
20
- separator = klass_method ? '.' : '#'
21
- base_name = klass.to_s + separator
22
- complete_deprecated_method_name = base_name + deprecated_method.to_s
23
- complete_new_method_name = base_name + new_method.to_s unless new_method.nil?
30
+ base_name = "#{klass}#{klass_method ? '.' : '#'}"
31
+ complete_deprecated_method_name = "#{base_name}#{deprecated_method}"
32
+ complete_new_method_name = "#{base_name}#{new_method}" unless new_method.nil?
24
33
 
25
- file, line = caller(2).first.split(':')[0, 2]
34
+ file, line = caller(2..2).split(':')[0, 2]
26
35
  message = +"#{file}:#{line}: #{complete_deprecated_method_name} is deprecated"
27
36
  message << " in favor of #{complete_new_method_name}" unless new_method.nil?
28
- message << ". It will be remove in PacketGen #{remove_version}."
37
+ message << '. ' << self.removed(remove_version)
29
38
  warn message
30
39
  end
31
40
 
@@ -39,7 +48,24 @@ module PacketGen
39
48
  file, line = caller(2..2).first.split(':')[0, 2]
40
49
  message = +"#{file}:#{line}: #{klass} is deprecated"
41
50
  message << " in favor of #{new_klass}" unless new_klass.nil?
42
- message << ". It will be remove in PacketGen #{remove_version}."
51
+ message << '. ' << self.removed(remove_version)
52
+ warn message
53
+ end
54
+
55
+ # Warn when using a deprecated method's option
56
+ # @param [Module] klass deprecated class/module
57
+ # @param [Module] method method name
58
+ # @param [Symbol] option option name
59
+ # @param [Boolean] klass_method +deprecated_method+ is a class method (+true+)
60
+ # or a, instance one (+false+)
61
+ # @param [String] remove_version version from which +klass+ will
62
+ # no more exist.
63
+ # @since 3.1.4
64
+ def self.deprecated_option(klass, method, option, klass_method: false, remove_version: REMOVE_VERSION)
65
+ base_name = "#{klass}#{klass_method ? '.' : '#'}"
66
+ method_name = "#{base_name}#{method}"
67
+ message = +"option #{option} is deprecated for method #{method_name}. "
68
+ message << self.removed(remove_version)
43
69
  warn message
44
70
  end
45
71
  end
@@ -1,11 +1,11 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  # This file is part of PacketGen
3
5
  # See https://github.com/sdaubert/packetgen for more informations
4
6
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
5
7
  # This program is published under MIT license.
6
8
 
7
- # frozen_string_literal: true
8
-
9
9
  module PacketGen
10
10
  # Namespace for protocol header classes.
11
11
  #
@@ -30,13 +30,6 @@ module PacketGen
30
30
  # pkt.myheader.field2.read 0x01
31
31
  # @author Sylvain Daubert
32
32
  module Header
33
- # @private snap length for PCAPRUB
34
- PCAP_SNAPLEN = 0xffff
35
- # @private promiscuous (or not) for PCAPRUB
36
- PCAP_PROMISC = false
37
- # @private timeout for PCAPRUB
38
- PCAP_TIMEOUT = 1
39
-
40
33
  @added_header_classes = {}
41
34
 
42
35
  class << self
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  # An ARP header consists of:
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  require 'rasn1'
9
9
 
10
10
  module PacketGen
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  # @abstract Base class for all header types.
@@ -193,7 +193,6 @@ module PacketGen
193
193
  end
194
194
  end
195
195
 
196
-
197
196
  # Helper method to calculate length of +hdr+ and set its +length+ field.
198
197
  # To be used by +#calc_length+ in Base subclasses.
199
198
  # @param [Base] hdr
@@ -221,7 +220,6 @@ module PacketGen
221
220
  super
222
221
  end
223
222
 
224
-
225
223
  # @api private
226
224
  # Get +header+ id in {Packet#headers} array
227
225
  # @param [Header] header
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  # Bootstrap Protocol, {https://tools.ietf.org/html/rfc951
@@ -45,7 +45,7 @@ module PacketGen
45
45
  # DHCP opcodes
46
46
  OPCODES = {
47
47
  'BOOTREQUEST' => 1,
48
- 'BOOTREPLY' => 2
48
+ 'BOOTREPLY' => 2
49
49
  }.freeze
50
50
 
51
51
  # @!attribute op
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  # Dynamic Host Configuration Protocol, {https://tools.ietf.org/html/rfc2131
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  class DHCP
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  class DHCP
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  # Dynamic Host Configuration Protocol for IPv6, {https://tools.ietf.org/html/rfc3315
@@ -55,16 +55,16 @@ module PacketGen
55
55
 
56
56
  # DHCPv6 message types
57
57
  MESSAGE_TYPES = {
58
- 'SOLLICIT' => 1,
59
- 'ADVERTISE' => 2,
60
- 'REQUEST' => 3,
61
- 'CONFIRM' => 4,
62
- 'RENEW' => 5,
63
- 'REBIND' => 6,
64
- 'REPLY' => 7,
65
- 'RELEASE' => 8,
66
- 'DECLINE' => 9,
67
- 'RECONFIGURE' => 10,
58
+ 'SOLLICIT' => 1,
59
+ 'ADVERTISE' => 2,
60
+ 'REQUEST' => 3,
61
+ 'CONFIRM' => 4,
62
+ 'RENEW' => 5,
63
+ 'REBIND' => 6,
64
+ 'REPLY' => 7,
65
+ 'RELEASE' => 8,
66
+ 'DECLINE' => 9,
67
+ 'RECONFIGURE' => 10,
68
68
  'INFORMATION-REQUEST' => 11
69
69
  }.freeze
70
70
 
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of PacketGen
2
4
  # See https://github.com/sdaubert/packetgen for more informations
3
5
  # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
4
6
  # This program is published under MIT license.
5
7
 
6
- # frozen_string_literal: true
7
-
8
8
  module PacketGen
9
9
  module Header
10
10
  class DHCPv6
@@ -13,8 +13,8 @@ module PacketGen
13
13
  class DUID < Types::Fields
14
14
  TYPES = {
15
15
  'DUID-LLT' => 1,
16
- 'DUID-EN' => 2,
17
- 'DUID-LL' => 3
16
+ 'DUID-EN' => 2,
17
+ 'DUID-LL' => 3
18
18
  }.freeze
19
19
 
20
20
  # @!attribute type
@@ -58,6 +58,8 @@ module PacketGen
58
58
  end
59
59
  end
60
60
 
61
+ # rubocop:disable Naming/ClassAndModuleCamelCase
62
+
61
63
  # DUID Based on Link-layer Address Plus Time
62
64
  # @author Sylvain Daubert
63
65
  class DUID_LLT < DUID
@@ -140,3 +142,5 @@ module PacketGen
140
142
  end
141
143
  end
142
144
  end
145
+
146
+ # rubocop:enable Naming/ClassAndModuleCamelCase