Sha256: 793a9935d31f642a4d5d2361c20a155f8e8078a9e24f6b5d5c138d56dc7e0004
Contents?: true
Size: 947 Bytes
Versions: 7
Compression:
Stored size: 947 Bytes
Contents
# This file is part of PacketGen # See https://github.com/sdaubert/packetgen for more informations # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net> # This program is published under MIT license. # frozen_string_literal: true module PacketGen module Header class IP # Class to handle IP options # @author Sylvain Daubert class Options < Types::Array set_of Option HUMAN_SEPARATOR = ';' # Get binary string # @return [String] def to_s str = super if str.length % 4 != 0 str += ([0] * (4 - (str.length % 4))).pack('C*') end str end private def record_from_hash(hsh) Option.build(hsh) end def real_type(opt) types = Option.types types.value?(opt.type) ? IP.const_get(types.key(opt.type)) : opt.class end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems