Class: Net::NTLM::Int64LE

Inherits:
Field
  • Object
show all
Defined in:
lib/watobo/external/ntlm/ntlm.rb

Instance Attribute Summary

Attributes inherited from Field

#active, #value

Instance Method Summary collapse

Methods inherited from Field

#size

Constructor Details

#initialize(opt) ⇒ Int64LE

Returns a new instance of Int64LE.



362
363
364
365
# File 'lib/watobo/external/ntlm/ntlm.rb', line 362

def initialize(opt)
  super(opt)
  @size = 8
end

Instance Method Details

#parse(str, offset = 0) ⇒ Object



367
368
369
370
371
372
373
374
375
# File 'lib/watobo/external/ntlm/ntlm.rb', line 367

def parse(str, offset=0)
  if @active and str.size >= offset + @size
    d, u = str.slice(offset, @size).unpack("V2")
    @value = (u * 0x100000000 + d)
    @size
  else
    0
  end
end

#serializeObject



377
378
379
# File 'lib/watobo/external/ntlm/ntlm.rb', line 377

def serialize
  [@value & 0x00000000ffffffff, @value >> 32].pack("V2") if @active
end