Sha256: e808d7c64430a714cfa89738e0dbbb61700dcad655ed20fbdb999a60c40327a9
Contents?: true
Size: 901 Bytes
Versions: 3
Compression:
Stored size: 901 Bytes
Contents
# frozen_string_literal: true # This file is part of PacketGen # See https://github.com/lemontree55/packetgen for more informations # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net> # Copyright (C) 2024 LemonTree55 <lenontree@proton.me> # This program is published under MIT license. module PacketGen module Header class SCTP # Mixin to handle 32-bit padding in SCTP classes module Padded32 # Handle padding # @param [Bool] no_padding # @return [::String] def to_s(no_padding: false) s = super() return s if no_padding padlen = -(s.size % -4) s << force_binary("\x00" * padlen) end # Say if binary string is padded # @return [bool] def padded? str = to_s(no_padding: true) (str.size % 4).positive? end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
packetgen-4.0.0 | lib/packetgen/header/sctp/padded32.rb |
packetgen-3.3.3 | lib/packetgen/header/sctp/padded32.rb |
packetgen-3.3.2 | lib/packetgen/header/sctp/padded32.rb |