Sha256: 0dbbd619886c82a5cfaa90d3fc248d6cf53cbca55f098f4b81210e98e789a8eb

Contents?: true

Size: 1.76 KB

Versions: 7

Compression:

Stored size: 1.76 KB

Contents

# -*- coding: binary -*-

module Rex
  module Proto
    module Rmi
      module Model
        # This class provides a representation of an RMI continuation stream
        class Continuation < Element

          # @!attribute length
          #   @return [Fixnum] the end point address length
          attr_accessor :length
          # @!attribute address
          #   @return [String] the end point address
          attr_accessor :address
          # @!attribute port
          #   @return [Fixnum] the end point port
          attr_accessor :port

          private

          # Reads the end point identifier address length from the IO
          #
          # @param io [IO] the IO to read from
          # @return [Fixnum]
          def decode_length(io)
            length = read_short(io)

            length
          end

          # Reads the end point address from the IO
          #
          # @param io [IO] the IO to read from
          # @return [String]
          def decode_address(io)
            version = read_string(io, length)

            version
          end

          # Reads the end point port from the IO
          #
          # @param io [IO] the IO to read from
          # @return [Fixnum]
          def decode_port(io)
            port = read_int(io)

            port
          end

          # Encodes the length field
          #
          # @return [String]
          def encode_length
            [length].pack('n')
          end

          # Encodes the address field
          #
          # @return [String]
          def encode_address
            address
          end

          # Encodes the port field
          #
          # @return [String]
          def encode_port
            [port].pack('N')
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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