Class: RubySMB::Dcerpc::Ndr::NdrString

Inherits:
BinData::Primitive
  • Object
show all
Defined in:
lib/ruby_smb/dcerpc/ndr.rb

Overview

An NDR Conformant and Varying String representation as defined in Transfer Syntax NDR - Conformant and Varying Strings The string elements are Stringz16 (unicode)

Instance Method Summary collapse

Instance Method Details

#getObject



46
47
48
# File 'lib/ruby_smb/dcerpc/ndr.rb', line 46

def get
  self.actual_count == 0 ? 0 : self.str
end

#set(v) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/ruby_smb/dcerpc/ndr.rb', line 50

def set(v)
  if v.is_a?(Integer) && v == 0
    self.actual_count = 0
  else
    self.str = v
    self.max_count = self.actual_count = str.to_binary_s.size / 2
  end
end