Sha256: 9df9c9ba01662aa5d9386ca5004b0ca27a94ec1545aa4ea548b6aff3bf494a15

Contents?: true

Size: 1.83 KB

Versions: 5

Compression:

Stored size: 1.83 KB

Contents

# -*- coding: binary -*-

module Rex
  module Proto
    module Rmi
      module Model
        # This class provides a representation of UniqueIdentifier as used in RMI calls
        class UniqueIdentifier < Element

          # @!attribute number
          #   @return [Fixnum] Identifies the VM where an object is generated
          attr_accessor :number
          # @!attribute time
          #   @return [Fixnum] Time where the object was generated
          attr_accessor :time
          # @!attribute count
          #   @return [Fixnum] Identifies different instance of the same object generated from the same VM
          #     at the same time
          attr_accessor :count

          private

          # Reads the number from the IO
          #
          # @param io [IO] the IO to read from
          # @return [Fixnum]
          def decode_number(io)
            number = read_int(io)

            number
          end

          # Reads the time from the IO
          #
          # @param io [IO] the IO to read from
          # @return [Fixnum]
          def decode_time(io)
            time = read_long(io)

            time
          end

          # Reads the count from the IO
          #
          # @param io [IO] the IO to read from
          # @return [Fixnum]
          def decode_count(io)
            count = read_short(io)

            count
          end

          # Encodes the number field
          #
          # @return [String]
          def encode_number
            [number].pack('l>')
          end

          # Encodes the time field
          #
          # @return [String]
          def encode_time
            [time].pack('q>')
          end

          # Encodes the count field
          #
          # @return [String]
          def encode_count
            [count].pack('s>')
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rex-2.0.13 lib/rex/proto/rmi/model/unique_identifier.rb
rex-2.0.12 lib/rex/proto/rmi/model/unique_identifier.rb
rex-2.0.11 lib/rex/proto/rmi/model/unique_identifier.rb
rex-2.0.10 lib/rex/proto/rmi/model/unique_identifier.rb
rex-2.0.9 lib/rex/proto/rmi/model/unique_identifier.rb