Class Racket::L4::VRRP
In: lib/racket/l4/vrrp.rb  (CVS)
Parent: RacketPart

Virtual Router Redundancy Protocol (VRRP) tools.ietf.org/html/rfc2338 tools.ietf.org/html/rfc3768

Methods

add_auth   add_ip   checksum!   checksum?   fix!   new  

Attributes

auth_type    Authentication type (0, 1, 2)
checksum    Checksum
id    Virtual Router Identifier (VRID)
interval    Advertisement interval
num_ips    Total number of IPs contained in this VRRP message
payload   
priority    the sending VRRP router‘s priority for the virtual router. Higher values equal higher priority.
type    VRRP packet type
version    Version

Public Class methods

[Source]

# File lib/racket/l4/vrrp.rb, line 80
  def initialize(*args)
    @ips = []
    @authdata = ""
    super
  end

Public Instance methods

Add authentication data

[Source]

# File lib/racket/l4/vrrp.rb, line 59
  def add_auth(authdata)
    @authdata = authdata[0,8].ljust(32, "\x00")
  end

Add a new IP to this message

[Source]

# File lib/racket/l4/vrrp.rb, line 54
  def add_ip(ip)
    @ips << L3::Misc.ipv42long(ip)
  end

compute and set the checksum

[Source]

# File lib/racket/l4/vrrp.rb, line 69
  def checksum!
    self.checksum = compute_checksum
  end

Validate the checksum

[Source]

# File lib/racket/l4/vrrp.rb, line 64
  def checksum?
    self.checksum == compute_checksum
  end

(really, just set the checksum)

[Source]

# File lib/racket/l4/vrrp.rb, line 74
  def fix!
    self.payload = [@ips, @authdata].flatten.pack("N#{@ips.size}a*")
    self.num_ips = @ips.size
    self.checksum!
  end

[Validate]