Sha256: 3afc6a510bdf87f483899f8421e0d1bb4ab0ab158b4ff23e34383b6b0b2258a6
Contents?: true
Size: 841 Bytes
Versions: 3
Compression:
Stored size: 841 Bytes
Contents
module PacketGen module PcapNG # Mixin module to declare some common methods for block classes. module Block # Has this block option? # @return [Boolean] def has_options? self[:options].size > 0 end # Calculate block length and update :block_len and block_len2 fields # @return [void] def recalc_block_len len = to_a.map(&:to_s).join.size self[:block_len].value = self[:block_len2].value = len end # Pad given field to 32 bit boundary, if needed # @param [Array<Symbol>] fields block fields to pad # @return [void] def pad_field(*fields) fields.each do |field| unless self[field].size % 4 == 0 self[field] << "\x00" * (4 - (self[field].size % 4)) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
packetgen-0.3.0 | lib/packetgen/pcapng/block.rb |
packetgen-0.2.0 | lib/packetgen/pcapng/block.rb |
packetgen-0.1.0 | lib/packetgen/pcapng/block.rb |