Class: OSPFv2::LinkType_Tlv
- Defined in:
- lib/lsa/tlv/link_type.rb
Instance Attribute Summary collapse
- 
  
    
      #link_type  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute link_type. 
- 
  
    
      #tlv_type  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute tlv_type. 
Class Method Summary collapse
Instance Method Summary collapse
- #__parse(s) ⇒ Object
- #encode ⇒ Object
- 
  
    
      #initialize(arg = {})  ⇒ LinkType_Tlv 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of LinkType_Tlv. 
- #to_s ⇒ Object
Methods included from Common
#ivar_to_klassname, #ivars, #set, #to_hash
Methods included from SubTlv
Methods included from Tlv
Constructor Details
#initialize(arg = {}) ⇒ LinkType_Tlv
Returns a new instance of LinkType_Tlv.
| 24 25 26 27 28 29 30 31 32 33 | # File 'lib/lsa/tlv/link_type.rb', line 24 def initialize(arg={}) @tlv_type, @link_type = 1,1 if arg.is_a?(Hash) then set(arg.dup) elsif arg.is_a?(String) __parse(arg) else raise ArgumentError, "Invalid argument", caller end end | 
Instance Attribute Details
#link_type ⇒ Object (readonly)
Returns the value of attribute link_type.
| 23 24 25 | # File 'lib/lsa/tlv/link_type.rb', line 23 def link_type @link_type end | 
#tlv_type ⇒ Object (readonly)
Returns the value of attribute tlv_type.
| 23 24 25 | # File 'lib/lsa/tlv/link_type.rb', line 23 def tlv_type @tlv_type end | 
Class Method Details
.type_to_s(arg) ⇒ Object
| 17 18 19 | # File 'lib/lsa/tlv/link_type.rb', line 17 def type_to_s(arg) "#{@link_type[arg]}" end | 
Instance Method Details
#__parse(s) ⇒ Object
| 37 38 39 | # File 'lib/lsa/tlv/link_type.rb', line 37 def __parse(s) @tlv_type, _, @link_type= s.unpack('nnC') end | 
#encode ⇒ Object
| 34 35 36 | # File 'lib/lsa/tlv/link_type.rb', line 34 def encode [@tlv_type, 1, @link_type,0,0,0].pack('nnCC3') end | 
#to_s ⇒ Object
| 40 41 42 | # File 'lib/lsa/tlv/link_type.rb', line 40 def to_s "Link Type : #{LinkType_Tlv.type_to_s(link_type)}" end |