Class: Scriptroute::IPv4option
- Inherits:
-
Object
- Object
- Scriptroute::IPv4option
show all
- Defined in:
- lib/scriptroute/packets.rb,
lib/scriptroute/packets.rb
Overview
base class for IPv4 options.
Constant Summary
collapse
- IPOPT_EOOL =
0
- IPOPT_EOL =
deprecated, backward compatibility.
0
- IPOPT_NOOP =
1
- IPOPT_TS =
68
- IPOPT_TIMESTAMP =
IPOPT_TS
- IPOPT_RR =
7
- IPOPT_TS_TSONLY =
0
- IPOPT_TS_TSANDADDR =
1
- IPOPT_TS_PRESPEC =
3
- @@creators =
Hash.new
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(*rest) ⇒ IPv4option
Returns a new instance of IPv4option.
420
421
422
423
424
425
426
427
428
|
# File 'lib/scriptroute/packets.rb', line 420
def initialize(*rest)
if(rest.length == 3) then
@ipt_code = rest[0]
@ipt_len = rest[1]
@ipt_ptr = rest[2]
else
@ipt_code, @ipt_len, @ipt_ptr = rest[0].unpack("CCC")
end
end
|
Instance Attribute Details
#ipt_code ⇒ Fixnum
409
410
411
|
# File 'lib/scriptroute/packets.rb', line 409
def ipt_code
@ipt_code
end
|
#ipt_len ⇒ Fixnum
409
410
411
|
# File 'lib/scriptroute/packets.rb', line 409
def ipt_len
@ipt_len
end
|
#ipt_ptr ⇒ Fixnum
409
410
411
|
# File 'lib/scriptroute/packets.rb', line 409
def ipt_ptr
@ipt_ptr
end
|
Class Method Details
.creator(str) ⇒ Object
412
413
414
415
416
417
418
419
|
# File 'lib/scriptroute/packets.rb', line 412
def IPv4option.creator(str)
ipt_code, ipt_len, ipt_ptr = str.unpack("CCC")
if(@@creators[ipt_code]) then
pkt = (@@creators[ipt_code]).call(str)
else
raise "unknown ip option code %d" % ipt_code
end
end
|
Instance Method Details
#to_s ⇒ String
435
436
437
|
# File 'lib/scriptroute/packets.rb', line 435
def to_s
": opt: code %d len %d ptr %d" % [ @ipt_code, @ipt_len, @ipt_ptr ]
end
|