Sha256: 0782ac4a8e6570c7121e74777da0fcd0dadb5ca4b4aef33bb23e269e6b4b7ce4

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

# -*- coding: binary -*-

module Rex
  module Proto
    module Rmi
      module Model
        # This class provides a representation of an RMI PingAck stream. A PingAck is the acknowledgement
        # for a Ping message.
        class PingAck < Element

          # @!attribute stream_id
          #   @return [Fixnum] the input stream id
          attr_accessor :stream_id

          private

          # Reads the stream id from the IO
          #
          # @param io [IO] the IO to read from
          # @return [String]
          # @raise [RuntimeError] if fails to decode stream id
          def decode_stream_id(io)
            stream_id = read_byte(io)
            unless stream_id == PING_ACK
              raise ::RuntimeError, 'Failed to decode PingAck stream id'
            end

            stream_id
          end

          # Encodes the stream_id field
          #
          # @return [String]
          def encode_stream_id
            [stream_id].pack('C')
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rex-2.0.8 lib/rex/proto/rmi/model/ping_ack.rb
rex-2.0.7 lib/rex/proto/rmi/model/ping_ack.rb