Class: Pio::SetIpAddr
- Inherits:
- 
      Object
      
        - Object
- Pio::SetIpAddr
 
- Extended by:
- Forwardable
- Defined in:
- lib/pio/set_ip_addr.rb
Overview
An action to modify the IPv4 source/destination address of a packet.
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- 
  
    
      #initialize(ip_address)  ⇒ SetIpAddr 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of SetIpAddr. 
Constructor Details
#initialize(ip_address) ⇒ SetIpAddr
Returns a new instance of SetIpAddr.
| 35 36 37 | # File 'lib/pio/set_ip_addr.rb', line 35 def initialize(ip_address) @format = self.class.const_get(:Format).new(ip_address: ip_address) end | 
Class Method Details
.def_format(action_type) ⇒ Object
| 8 9 10 11 12 13 14 15 16 17 18 19 | # File 'lib/pio/set_ip_addr.rb', line 8 def self.def_format(action_type) str = %( class Format < BinData::Record endian :big uint16 :type, value: #{action_type} uint16 :message_length, value: 8 ip_address :ip_address end ) module_eval str end | 
.read(raw_data) ⇒ Object
| 21 22 23 24 25 26 | # File 'lib/pio/set_ip_addr.rb', line 21 def self.read(raw_data) set_ip_addr = allocate set_ip_addr.instance_variable_set(:@format, const_get(:Format).read(raw_data)) set_ip_addr end |