Class: CcipherFactory::BinStruct

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/ccipher_factory/encoding/bin_struct.rb

Instance Method Summary collapse

Instance Method Details

#struct(key, ver = "1.0") ⇒ Object



8
9
10
11
# File 'lib/ccipher_factory/encoding/bin_struct.rb', line 8

def struct(key, ver = "1.0")
  st = structure(ver)[key] 
  st.clone if not st.nil?
end

#struct_from_bin(bin) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/ccipher_factory/encoding/bin_struct.rb', line 13

def struct_from_bin(bin)
  bs = Binenc::EngineFactory.instance(:bin_struct)
  type, ver = bs.value_from_bin_struct(bin, 0, 1)
  c = BTag.value_constant(type) 
  st = struct(c, translate_version(ver))
  st.from_bin(bin) if not st.nil?
end