Top Level Namespace

Defined Under Namespace

Modules: TLV

Instance Method Summary collapse

Instance Method Details

#add_const(e, d) ⇒ Object



40
41
42
43
# File 'lib/tlv/parser/dictionaries/asn.rb', line 40

def add_const e,d
  tag = "" << (e[2] | 0x20)
  d[tag] = e[0]
end

#add_primitive(e, d) ⇒ Object



36
37
38
39
# File 'lib/tlv/parser/dictionaries/asn.rb', line 36

def add_primitive e,d
  tag = ("" <<  e[2])
  d[tag] = e[0]
end

#make_dictObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/tlv/parser/dictionaries/asn.rb', line 35

def make_dict
  def add_primitive e,d
    tag = ("" <<  e[2])
    d[tag] = e[0]
  end
  def add_const e,d
    tag = "" << (e[2] | 0x20)
    d[tag] = e[0]
  end
  dict = {}
  TLV::UNIVERSAL.each {|entry|
    case entry[1]
    when "P"
      add_primitive entry, dict
    when "C"
      add_const entry, dict
    when "P/C"
      add_primitive entry, dict
      add_const entry, dict
    end
  }
  TLV::DICTIONARIES["ASN"] = dict
end