Class: RubySMB::SMB2::Packet::NegotiateRequest
- Inherits:
- 
      GenericPacket
      
        - Object
- BinData::Record
- GenericPacket
- RubySMB::SMB2::Packet::NegotiateRequest
 
- 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
Instance Method Summary collapse
- 
  
    
      #add_dialect(dialect)  ⇒ Array<Fixnum> 
    
    
  
  
  
  
  
  
  
  
  
    Adds a dialect to the Dialects array. 
- 
  
    
      #add_negotiate_context(nc)  ⇒ Array<Fixnum> 
    
    
  
  
  
  
  
  
  
  
  
    Adds a Negotiate Context to the #negotiate_context_list. 
- 
  
    
      #find_negotiate_context(type)  ⇒ NegotiateContext 
    
    
  
  
  
  
  
  
  
  
  
    Find the first Negotiate Context structure that matches the given context type. 
- 
  
    
      #set_dialects(add_dialects = [])  ⇒ Array<Fixnum> 
    
    
  
  
  
  
  
  
  
  
  
    Takes an array of dialects and sets it on the packet. 
Methods inherited from GenericPacket
describe, #display, fields_hashed, format_field, from_hex, #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
| 34 35 36 37 | # File 'lib/ruby_smb/smb2/packet/negotiate_request.rb', line 34 def add_dialect(dialect) raise ArgumentError, 'Must be a number' unless dialect.is_a? Integer self.dialects << dialect end | 
#add_negotiate_context(nc) ⇒ Array<Fixnum>
Adds a Negotiate Context to the #negotiate_context_list
| 58 59 60 61 62 63 64 65 | # File 'lib/ruby_smb/smb2/packet/negotiate_request.rb', line 58 def add_negotiate_context(nc) raise ArgumentError, 'Must be a NegotiateContext' unless nc.is_a? NegotiateContext previous_element = negotiate_context_list.last || negotiate_context_list pad_length = pad_length(previous_element) self.negotiate_context_list << nc self.negotiate_context_list.last.pad = "\x00" * pad_length self.negotiate_context_list end | 
#find_negotiate_context(type) ⇒ NegotiateContext
Find the first Negotiate Context structure that matches the given context type
not found
| 73 74 75 | # File 'lib/ruby_smb/smb2/packet/negotiate_request.rb', line 73 def find_negotiate_context(type) negotiate_context_list.find { |nc| nc.context_type == type } 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.
| 45 46 47 48 49 50 51 | # File 'lib/ruby_smb/smb2/packet/negotiate_request.rb', line 45 def set_dialects(add_dialects = []) self.dialects = [] add_dialects.each do |dialect| add_dialect(dialect) end dialects end |