class Packetman::Clause
Attributes
mask[RW]
search[RW]
start_bit[RW]
Public Class Methods
new(search, mask, start_bit)
click to toggle source
# File lib/packetman/clause.rb, line 7 def initialize(search, mask, start_bit) self.search = search self.mask = mask self.start_bit = start_bit end
Public Instance Methods
data_address()
click to toggle source
Full address of the query data (eg. `tcp`)
# File lib/packetman/clause.rb, line 23 def data_address "#{config.transport}[#{start_byte}:#{num_bytes}]" end
num_bytes()
click to toggle source
# File lib/packetman/clause.rb, line 18 def num_bytes Filter.bit_length(search)/8 end
start_byte()
click to toggle source
Address of first byte
# File lib/packetman/clause.rb, line 14 def start_byte [config.payload_query, (config.offset_bits + start_bit)/8].compact.join(' + ') end
to_s()
click to toggle source
The whole filter clause fully assembled
# File lib/packetman/clause.rb, line 28 def to_s "#{data_address} & #{mask} = #{search}" end