Class: RubySMB::SMB1::Packet::NegotiateResponse
- Inherits:
-
GenericPacket
- Object
- BinData::Record
- GenericPacket
- RubySMB::SMB1::Packet::NegotiateResponse
- Defined in:
- lib/ruby_smb/smb1/packet/negotiate_response.rb
Overview
A SMB1 SMB_COM_NEGOTIATE Non-Extended Security Response Packet as defined in 2.2.4.5.2.2 Non-Extended Security Response
Defined Under Namespace
Classes: DataBlock, ParameterBlock
Instance Method Summary collapse
-
#dialects=(dialects) ⇒ Object
Stores the list of Dialect that were sent to the peer/server in the related Negotiate Request.
- #initialize_instance ⇒ Object
-
#negotiated_dialect ⇒ String
Returns the negotiated dialect identifier.
- #valid? ⇒ Boolean
Methods inherited from GenericPacket
describe, #display, fields_hashed, format_field, #packet_smb_version, read, #status_code, walk_fields
Instance Method Details
#dialects=(dialects) ⇒ Object
Stores the list of Dialect that were sent to the peer/server in the related Negotiate Request. This will be used by the #negotiated_dialect method.
51 52 53 54 55 56 |
# File 'lib/ruby_smb/smb1/packet/negotiate_response.rb', line 51 def dialects=(dialects) unless dialects.all? { |dialect| dialect.is_a? Dialect } raise ArgumentError, 'Dialects must be an array of Dialect objects' end @dialects = dialects end |
#initialize_instance ⇒ Object
33 34 35 36 37 38 |
# File 'lib/ruby_smb/smb1/packet/negotiate_response.rb', line 33 def initialize_instance super header = smb_header header.command = RubySMB::SMB1::Commands::SMB_COM_NEGOTIATE header.flags.reply = 1 end |
#negotiated_dialect ⇒ String
Returns the negotiated dialect identifier
61 62 63 64 |
# File 'lib/ruby_smb/smb1/packet/negotiate_response.rb', line 61 def negotiated_dialect return '' if @dialects.nil? || @dialects.empty? @dialects[parameter_block.dialect_index].dialect_string end |
#valid? ⇒ Boolean
40 41 42 |
# File 'lib/ruby_smb/smb1/packet/negotiate_response.rb', line 40 def valid? smb_header.command == RubySMB::SMB1::Commands::SMB_COM_NEGOTIATE end |