Class: Net::NTLM::SecurityBuffer

Inherits:
FieldSet
  • Object
show all
Defined in:
lib/net/ntlm/security_buffer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from FieldSet

#[], #[]=, #disable, #enable, #has_disabled_fields?, int16LE, int32LE, int64LE, names, opts, prototypes, security_buffer, #size, string, types

Constructor Details

#initialize(opts = {}) ⇒ SecurityBuffer

Returns a new instance of SecurityBuffer.



12
13
14
15
16
17
# File 'lib/net/ntlm/security_buffer.rb', line 12

def initialize(opts={})
  super()
  @value  = opts[:value]
  @active = opts[:active].nil? ? true : opts[:active]
  @size = 8
end

Instance Attribute Details

#activeObject

Returns the value of attribute active.



11
12
13
# File 'lib/net/ntlm/security_buffer.rb', line 11

def active
  @active
end

Instance Method Details

#allocatedInt16LE

Returns:



8
# File 'lib/net/ntlm/security_buffer.rb', line 8

int16LE   :allocated,     {:value => 0}

#allocated=Int16LE

Returns:



8
# File 'lib/net/ntlm/security_buffer.rb', line 8

int16LE   :allocated,     {:value => 0}

#data_sizeObject



42
43
44
# File 'lib/net/ntlm/security_buffer.rb', line 42

def data_size
  @active ? @value.size : 0
end

#lengthInt16LE

Returns:



7
# File 'lib/net/ntlm/security_buffer.rb', line 7

int16LE   :length,        {:value => 0}

#length=Int16LE

Returns:



7
# File 'lib/net/ntlm/security_buffer.rb', line 7

int16LE   :length,        {:value => 0}

#offsetInt32LE

Returns:



9
# File 'lib/net/ntlm/security_buffer.rb', line 9

int32LE   :offset,        {:value => 0}

#offset=Int32LE

Returns:



9
# File 'lib/net/ntlm/security_buffer.rb', line 9

int32LE   :offset,        {:value => 0}

#parse(str, offset = 0) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/net/ntlm/security_buffer.rb', line 19

def parse(str, offset=0)
  if @active and str.size >= offset + @size
    super(str, offset)
    @value = str[self.offset, self.length]
    @size
  else
    0
  end
end

#serializeObject



29
30
31
# File 'lib/net/ntlm/security_buffer.rb', line 29

def serialize
  super if @active
end

#valueObject



33
34
35
# File 'lib/net/ntlm/security_buffer.rb', line 33

def value
  @value
end

#value=(val) ⇒ Object



37
38
39
40
# File 'lib/net/ntlm/security_buffer.rb', line 37

def value=(val)
  @value = val
  self.length = self.allocated = val.size
end