Class: Pio::Arp::Format

Inherits:
BinData::Record show all
Includes:
Ethernet
Defined in:
lib/pio/arp/format.rb

Overview

ARP parser.

Constant Summary

Constants included from Ethernet

Ethernet::MINIMUM_FRAME_SIZE

Instance Method Summary collapse

Methods included from Ethernet

#ethernet_header_length, included

Instance Method Details

#to_binaryObject

rubocop:enable MethodLength



48
49
50
# File 'lib/pio/arp/format.rb', line 48

def to_binary
  to_binary_s + "\000" * (64 - num_bytes)
end

#to_exact_match(in_port) ⇒ Object

rubocop:disable MethodLength



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/pio/arp/format.rb', line 29

def to_exact_match(in_port)
  match_options = {
    in_port: in_port,
    source_mac_address: source_mac,
    destination_mac_address: destination_mac,
    vlan_vid: 0xffff,
    vlan_priority: vlan_pcp,
    ether_type: ether_type,
    tos: 0,
    ip_protocol: operation,
    source_ip_address: sender_protocol_address,
    destination_ip_address: target_protocol_address,
    transport_source_port: 0,
    transport_destination_port: 0
  }
  Pio::OpenFlow10::Match.new(match_options)
end