Class Racket::L2::VTPSubsetAdvertisement
In: lib/racket/l2/vtp.rb  (CVS)
Parent: VTPGeneric

Methods

add_vlan_info   fix!   new  

Attributes

payload    all of the vlan info fields
revision    Configuration revision

Public Class methods

[Source]

# File lib/racket/l2/vtp.rb, line 79
  def initialize(*args)
    @vlan_info = []
    super(*args)
    self.code = 2 
  end

Public Instance methods

[Source]

# File lib/racket/l2/vtp.rb, line 64
  def add_vlan_info(status, type, id, mtu, index, name)
    name_length = name.length
    # zero pad name to a multiple of 4 bytes
    name = name.length % 4 == 0 ? name : name.ljust(name.length + (4 - (name.length % 4)), "\x00")
    length = 12 + name.length
    @vlan_info << [length, status, type, name_length, id, mtu, index, name]
  end

[Source]

# File lib/racket/l2/vtp.rb, line 72
  def fix!
    @vlan_info.each do |v|
      self.payload += v.pack("CCCCnnNa*")
    end
    super
  end

[Validate]