Class: Scriptroute::RecordRoute_option
- Inherits:
-
IPv4option
- Object
- IPv4option
- Scriptroute::RecordRoute_option
- Defined in:
- lib/scriptroute/packets.rb
Constant Summary
Constants inherited from IPv4option
IPv4option::IPOPT_EOL, IPv4option::IPOPT_EOOL, IPv4option::IPOPT_NOOP, IPv4option::IPOPT_RR, IPv4option::IPOPT_TIMESTAMP, IPv4option::IPOPT_TS, IPv4option::IPOPT_TS_PRESPEC, IPv4option::IPOPT_TS_TSANDADDR, IPv4option::IPOPT_TS_TSONLY
Instance Attribute Summary collapse
-
#routers ⇒ Object
readonly
Returns the value of attribute routers.
Attributes inherited from IPv4option
Instance Method Summary collapse
-
#initialize(*rest) ⇒ RecordRoute_option
constructor
A new instance of RecordRoute_option.
-
#marshal ⇒ String
The option in string form.
- #to_s ⇒ String
Methods inherited from IPv4option
Constructor Details
#initialize(*rest) ⇒ RecordRoute_option
Returns a new instance of RecordRoute_option.
520 521 522 523 524 525 526 527 528 |
# File 'lib/scriptroute/packets.rb', line 520 def initialize(*rest) if(rest.length == 0) super(IPOPT_RR, 39, 4) @routers = Array.new((@ipt_len - 3 + 1)/4, 0) else super(rest[0]) @routers = rest[0][3..@ipt_len].unpack("N*").map { |addr| IPaddress.new(addr) } end end |
Instance Attribute Details
#routers ⇒ Object (readonly)
Returns the value of attribute routers.
516 517 518 |
# File 'lib/scriptroute/packets.rb', line 516 def routers @routers end |
Instance Method Details
#marshal ⇒ String
Returns the option in string form.
530 531 532 |
# File 'lib/scriptroute/packets.rb', line 530 def marshal super + @routers.pack("N*") + "\0" end |
#to_s ⇒ String
534 535 536 |
# File 'lib/scriptroute/packets.rb', line 534 def to_s super + ': RR: {' + @routers.join(", ") + '}' end |