Class: RubySMB::SMB2::Packet::NegotiateRequest

Inherits:
GenericPacket
  • Object
show all
Defined in:
lib/ruby_smb/smb2/packet/negotiate_request.rb

Overview

An SMB2 NEGOTIATE Request packet as defined by 2.2.3 SMB2 NEGOTIATE Request

Constant Summary collapse

COMMAND =
RubySMB::SMB2::Commands::NEGOTIATE

Instance Method Summary collapse

Methods inherited from GenericPacket

describe, #display, fields_hashed, format_field, #initialize_instance, #packet_smb_version, read, #status_code, #valid?, walk_fields

Instance Method Details

#add_dialect(dialect) ⇒ Array<Fixnum>

Adds a dialect to the Dialects array and increments the dialect count

Parameters:

  • the (Fixnum)

    numeric code for the dialect you wish to add

Returns:

  • (Array<Fixnum>)

    the array of all currently selected dialects



24
25
26
27
28
# File 'lib/ruby_smb/smb2/packet/negotiate_request.rb', line 24

def add_dialect(dialect)
  return ArgumentError, 'Must be a number' unless dialect.is_a? Integer
  self.dialect_count += 1
  dialects << dialect
end

#set_dialects(add_dialects = []) ⇒ Array<Fixnum>

Takes an array of dialects and sets it on the packet. Also updates the dialect_count field appropriately. Will erase any previously set dialects.

Parameters:

  • the (Array<Fixnum>)

    array of dialects to set

Returns:

  • (Array<Fixnum>)

    the current value of the dialects array



36
37
38
39
40
41
42
43
# File 'lib/ruby_smb/smb2/packet/negotiate_request.rb', line 36

def set_dialects(add_dialects = [])
  self.dialects = []
  self.dialect_count = 0
  add_dialects.each do |dialect|
    add_dialect(dialect)
  end
  dialects
end