Methods
Included Modules
- PacketFu START:includes
Class Public methods
Source: show
# File lib/packetfu/protos/tcp.rb, line 53 def initialize(args={}) super(args[:hlen]) end
Instance Public methods
Reads a string to populate the object.
Source: show
# File lib/packetfu/protos/tcp.rb, line 65 def read(str) force_binary(str) return self if str.nil? || str.size.zero? if 1.respond_to? :ord self[:hlen] = (str[0].ord & 0b11110000) >> 4 else self[:hlen] = (str[0] & 0b11110000) >> 4 end self end
Returns the TcpHlen field as an integer. Note these will become the high bits at the TCP header’s offset, even though the lower 4 bits will be further chopped up.
Source: show
# File lib/packetfu/protos/tcp.rb, line 60 def to_i hlen.to_i & 0b1111 end
Returns the object in string form.
Source: show
# File lib/packetfu/protos/tcp.rb, line 77 def to_s [self.to_i].pack("C") end