Module: Pio::Type::IPv4Header
- Included in:
- Dhcp::Frame, Icmp::Format, PacketIn::DataParser::IPv4Packet
- Defined in:
- lib/pio/type/ipv4_header.rb
Overview
IP Version 4 Header Format
Instance Method Summary collapse
-
#ipv4_header(options = {}) ⇒ Object
This method smells of :reek:TooManyStatements rubocop:disable MethodLength rubocop:disable AbcSize.
Instance Method Details
#ipv4_header(options = {}) ⇒ Object
This method smells of :reek:TooManyStatements rubocop:disable MethodLength rubocop:disable AbcSize
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pio/type/ipv4_header.rb', line 10 def ipv4_header( = {}) class_eval do bit4 :ip_version, initial_value: 0x4 bit4 :ip_header_length, initial_value: 0x5 uint8 :ip_type_of_service, initial_value: 0 uint16be :ip_total_length, initial_value: [:ip_total_length] || 0 uint16be :ip_identifier, initial_value: 0 bit3 :ip_flag, initial_value: 0 bit13 :ip_fragment, initial_value: 0 uint8 :ip_ttl, initial_value: 128 uint8 :ip_protocol, initial_value: [:ip_protocol] || 0 uint16be :ip_header_checksum, initial_value: [:ip_header_checksum] || 0 ip_address :ip_source_address ip_address :ip_destination_address string :option, read_length: -> { 20 - ip_header_length * 4 } end end |