Struct.new(:hsrp_version, :hsrp_opcode, :hsrp_state, :hsrp_hellotime, :hsrp_holdtime, :hsrp_priority, :hsrp_group, :hsrp_reserved, :hsrp_password, :hsrp_vip, :body)
HSRPHeader is a complete HSRP struct, used in HSRPPacket. HSRP is typically used for fault-tolerant default gateway in IP routing environment.
For more on HSRP packets, see www.networksorcery.com/enp/protocol/hsrp.htm
Submitted by fropert@packetfault.org. Thanks, Francois!
Int8 :hsrp_version Default: 0 # Version Int8 :hsrp_opcode # Opcode Int8 :hsrp_state # State Int8 :hsrp_hellotime Default: 3 # Hello Time Int8 :hsrp_holdtime Default: 10 # Hold Time Int8 :hsrp_priority # Priority Int8 :hsrp_group # Group Int8 :hsrp_reserved Default: 0 # Reserved String :hsrp_password # Authentication Data Octets :hsrp_vip # Virtual IP Address String :body
# File lib/packetfu/protos/hsrp/header.rb, line 30 def initialize(args={}) super( Int8.new(args[:hsrp_version] || 0), Int8.new(args[:hsrp_opcode]), Int8.new(args[:hsrp_state]), Int8.new(args[:hsrp_hellotime] || 3), Int8.new(args[:hsrp_holdtime] || 10), Int8.new(args[:hsrp_priority]), Int8.new(args[:hsrp_group]), Int8.new(args[:hsrp_reserved] || 0), StructFu::String.new.read(args[:hsrp_password] || "cisco\x00\x00\x00"), Octets.new.read(args[:hsrp_vip] || ("\x00" * 4)), StructFu::String.new.read(args[:body]) ) end
Returns a more readable IP source address.
# File lib/packetfu/protos/hsrp/header.rb, line 107 def hsrp_addr self[:hsrp_vip].to_x end
# File lib/packetfu/protos/hsrp/header.rb, line 102 def hsrp_addr=(addr) self[:hsrp_vip].read_quad(addr) end
Getter for the type.
# File lib/packetfu/protos/hsrp/header.rb, line 96 def hsrp_group; self[:hsrp_group].to_i; end
Setter for the type.
# File lib/packetfu/protos/hsrp/header.rb, line 94 def hsrp_group=(i); typecast i; end
Getter for the type.
# File lib/packetfu/protos/hsrp/header.rb, line 84 def hsrp_hellotime; self[:hsrp_hellotime].to_i; end
Setter for the type.
# File lib/packetfu/protos/hsrp/header.rb, line 82 def hsrp_hellotime=(i); typecast i; end
Getter for the type.
# File lib/packetfu/protos/hsrp/header.rb, line 88 def hsrp_holdtime; self[:hsrp_holdtime].to_i; end
Setter for the type.
# File lib/packetfu/protos/hsrp/header.rb, line 86 def hsrp_holdtime=(i); typecast i; end
Getter for the type.
# File lib/packetfu/protos/hsrp/header.rb, line 76 def hsrp_opcode; self[:hsrp_opcode].to_i; end
Setter for the type.
# File lib/packetfu/protos/hsrp/header.rb, line 74 def hsrp_opcode=(i); typecast i; end
# File lib/packetfu/protos/hsrp/header.rb, line 115 def hsrp_password_readable hsrp_password.to_s.inspect end
Getter for the type.
# File lib/packetfu/protos/hsrp/header.rb, line 92 def hsrp_priority; self[:hsrp_priority].to_i; end
Setter for the type.
# File lib/packetfu/protos/hsrp/header.rb, line 90 def hsrp_priority=(i); typecast i; end
Getter for the type.
# File lib/packetfu/protos/hsrp/header.rb, line 100 def hsrp_reserved; self[:hsrp_reserved].to_i; end
Setter for the type.
# File lib/packetfu/protos/hsrp/header.rb, line 98 def hsrp_reserved=(i); typecast i; end
Getter for the type.
# File lib/packetfu/protos/hsrp/header.rb, line 80 def hsrp_state; self[:hsrp_state].to_i; end
Setter for the type.
# File lib/packetfu/protos/hsrp/header.rb, line 78 def hsrp_state=(i); typecast i; end
Getter for the type.
# File lib/packetfu/protos/hsrp/header.rb, line 72 def hsrp_version; self[:hsrp_version].to_i; end
Setter for the type.
# File lib/packetfu/protos/hsrp/header.rb, line 70 def hsrp_version=(i); typecast i; end
Reads a string to populate the object.
# File lib/packetfu/protos/hsrp/header.rb, line 52 def read(str) force_binary(str) return self if str.nil? self[:hsrp_version].read(str[0,1]) self[:hsrp_opcode].read(str[1,1]) self[:hsrp_state].read(str[2,1]) self[:hsrp_hellotime].read(str[3,1]) self[:hsrp_holdtime].read(str[4,1]) self[:hsrp_priority].read(str[5,1]) self[:hsrp_group].read(str[6,1]) self[:hsrp_reserved].read(str[7,1]) self[:hsrp_password].read(str[8,8]) self[:hsrp_vip].read(str[16,4]) self[:body].read(str[20,str.size]) if str.size > 20 self end
Generated with the Darkfish Rdoc Generator 2.