Class: OSPFv2::RemoteInterfaceIpAddress_Tlv
- Defined in:
- lib/lsa/tlv/remote_interface.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#ip_address ⇒ Object
readonly
Returns the value of attribute ip_address.
-
#tlv_type ⇒ Object
readonly
Returns the value of attribute tlv_type.
Instance Method Summary collapse
- #__parse(s) ⇒ Object
- #encode ⇒ Object
-
#initialize(arg = {}) ⇒ RemoteInterfaceIpAddress_Tlv
constructor
A new instance of RemoteInterfaceIpAddress_Tlv.
- #to_s ⇒ Object
- #to_s_junos_style(ident = 0) ⇒ Object
Methods included from Common
#ivar_to_klassname, #ivars, #set, #to_hash
Methods included from SubTlv
Methods included from Tlv
Constructor Details
#initialize(arg = {}) ⇒ RemoteInterfaceIpAddress_Tlv
Returns a new instance of RemoteInterfaceIpAddress_Tlv.
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/lsa/tlv/remote_interface.rb', line 26 def initialize(arg={}) @tlv_type = 4 @ip_address = IpAddress.new 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
#ip_address ⇒ Object (readonly)
Returns the value of attribute ip_address.
22 23 24 |
# File 'lib/lsa/tlv/remote_interface.rb', line 22 def ip_address @ip_address end |
#tlv_type ⇒ Object (readonly)
Returns the value of attribute tlv_type.
22 23 24 |
# File 'lib/lsa/tlv/remote_interface.rb', line 22 def tlv_type @tlv_type end |
Instance Method Details
#__parse(s) ⇒ Object
43 44 45 46 |
# File 'lib/lsa/tlv/remote_interface.rb', line 43 def __parse(s) @tlv_type, _, ip_address = s.unpack('nna*') @ip_address = IpAddress.new_ntoh(ip_address) end |
#encode ⇒ Object
39 40 41 |
# File 'lib/lsa/tlv/remote_interface.rb', line 39 def encode [@tlv_type, 4, @ip_address.encode].pack('nna*') end |
#to_s ⇒ Object
49 50 51 |
# File 'lib/lsa/tlv/remote_interface.rb', line 49 def to_s "Neighbor Address : #{ip_address.to_ip}" end |
#to_s_junos_style(ident = 0) ⇒ Object
53 54 55 |
# File 'lib/lsa/tlv/remote_interface.rb', line 53 def to_s_junos_style(ident=0) " "*ident + "RtrAddr (1), length #{@length}: #{router_id.to_ip}" end |