Class: Watobo::NTLM::FieldSet
- Inherits:
-
Object
- Object
- Watobo::NTLM::FieldSet
show all
- Defined in:
- lib/watobo/utils/ntlm.rb
Overview
base class of data structure
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of FieldSet.
487
488
489
|
# File 'lib/watobo/utils/ntlm.rb', line 487
def initialize
@alist = self.class.prototypes.map{ |n, t, o| [n, t.new(o)] }
end
|
Class Method Details
.int16LE(name, opts) ⇒ Object
423
424
425
|
# File 'lib/watobo/utils/ntlm.rb', line 423
def int16LE(name, opts)
add_field(name, Int16LE, opts)
end
|
.int32LE(name, opts) ⇒ Object
431
432
433
|
# File 'lib/watobo/utils/ntlm.rb', line 431
def int32LE(name, opts)
add_field(name, Int32LE, opts)
end
|
.int64LE(name, opts) ⇒ Object
439
440
441
|
# File 'lib/watobo/utils/ntlm.rb', line 439
def int64LE(name, opts)
add_field(name, Int64LE, opts)
end
|
.names ⇒ Object
455
456
457
|
# File 'lib/watobo/utils/ntlm.rb', line 455
def names
@proto.map{|n, t, o| n}
end
|
.opts ⇒ Object
463
464
465
|
# File 'lib/watobo/utils/ntlm.rb', line 463
def opts
@proto.map{|n, t, o| o}
end
|
.prototypes ⇒ Object
451
452
453
|
# File 'lib/watobo/utils/ntlm.rb', line 451
def prototypes
@proto
end
|
.security_buffer(name, opts) ⇒ Object
447
448
449
|
# File 'lib/watobo/utils/ntlm.rb', line 447
def security_buffer(name, opts)
add_field(name, SecurityBuffer, opts)
end
|
.string(name, opts) ⇒ Object
415
416
417
|
# File 'lib/watobo/utils/ntlm.rb', line 415
def string(name, opts)
add_field(name, String, opts)
end
|
.types ⇒ Object
459
460
461
|
# File 'lib/watobo/utils/ntlm.rb', line 459
def types
@proto.map{|n, t, o| t}
end
|
Instance Method Details
#[](name) ⇒ Object
503
504
505
506
507
|
# File 'lib/watobo/utils/ntlm.rb', line 503
def [](name)
a = @alist.assoc(name.to_s.intern)
raise ArgumentError, "no such field: #{name}" unless a
a[1]
end
|
#[]=(name, val) ⇒ Object
509
510
511
512
513
|
# File 'lib/watobo/utils/ntlm.rb', line 509
def []=(name, val)
a = @alist.assoc(name.to_s.intern)
raise ArgumentError, "no such field: #{name}" unless a
a[1] = val
end
|
#disable(name) ⇒ Object
519
520
521
|
# File 'lib/watobo/utils/ntlm.rb', line 519
def disable(name)
self[name].active = false
end
|
#enable(name) ⇒ Object
515
516
517
|
# File 'lib/watobo/utils/ntlm.rb', line 515
def enable(name)
self[name].active = true
end
|
#parse(str, offset = 0) ⇒ Object
495
496
497
|
# File 'lib/watobo/utils/ntlm.rb', line 495
def parse(str, offset=0)
@alist.inject(offset){|cur, a| cur += a[1].parse(str, cur)}
end
|
#serialize ⇒ Object
491
492
493
|
# File 'lib/watobo/utils/ntlm.rb', line 491
def serialize
@alist.map{|n, f| f.serialize }.join
end
|
#size ⇒ Object
499
500
501
|
# File 'lib/watobo/utils/ntlm.rb', line 499
def size
@alist.inject(0){|sum, a| sum += a[1].size}
end
|