Net::BER

Constants

VERSION

Public Class Methods

compile_syntax(syn) click to toggle source
    # File lib/net/ber.rb, line 37
37:     def self.compile_syntax(syn)
38:       out = [nil] * 256
39:       syn.each do |tclass, tclasses|
40:         tagclass = {:universal=>0, :application=>64, :context_specific=>128, :private=>192} [tclass]
41:         tclasses.each do |codingtype,codings|
42:           encoding = {:primitive=>0, :constructed=>32} [codingtype]
43:           codings.each {|tag, objtype| out[tagclass + encoding + tag] = objtype }
44:         end
45:       end
46:       out
47:     end

Public Instance Methods

to_ber() click to toggle source
    # File lib/net/ber.rb, line 49
49:     def to_ber
50:       # Provisional implementation.
51:       # We ASSUME that our incoming value is an array, and we
52:       # use the Array#to_ber_oid method defined below.
53:       # We probably should obsolete that method, actually, in
54:       # and move the code here.
55:       # WE ARE NOT CURRENTLY ENCODING THE BER-IDENTIFIER.
56:       # This implementation currently hardcodes 6, the universal OID tag.
57:       ary = @value.dup
58:       first = ary.shift
59:       raise Net::BER::BerError.new(" invalid OID" ) unless [0,1,2].include?(first)
60:       first = first * 40 + ary.shift
61:       ary.unshift first
62:       oid = ary.pack("w*")
63:       [6, oid.length].pack("CC") + oid
64:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.