Module: Net::BER::Extensions::Array

### Home Classes Methods

### In Files

- lib/net/ber/core_ext/array.rb

### Methods

- #to_ber
- #to_ber_appsequence
- #to_ber_contextspecific
- #to_ber_oid
- #to_ber_sequence
- #to_ber_set

### Files

- History.rdoc
- Manifest.txt

### Class/Module Index

Quicksearch

- Net
- Net::BER
- Net::BER::BERParser
- Net::BER::BerError
- Net::BER::BerIdentifiedArray
- Net::BER::BerIdentifiedNull
- Net::BER::BerIdentifiedOid
- Net::BER::BerIdentifiedString
- Net::BER::Extensions
- Net::BER::Extensions::Array
- Net::BER::Extensions::Bignum
- Net::BER::Extensions::FalseClass
- Net::BER::Extensions::Fixnum
- Net::BER::Extensions::String
- Net::BER::Extensions::TrueClass
- Net::LDAP
- Net::LDAP::Connection
- Net::LDAP::Connection::GetbyteForSSLSocket
- Net::LDAP::DN
- Net::LDAP::Dataset
- Net::LDAP::Entry
- Net::LDAP::Filter
- Net::LDAP::LdapControls
- Net::LDAP::LdapError
- Net::LDAP::PDU
- Net::LDAP::PDU::Error
- Net::LDAP::Password
- OpenSSL
- OpenSSL::SSL
- OpenSSL::SSL::SSLSocket

No matching classes.

# Net::BER::Extensions::Array

BER extensions to the Array class.

### Public Instance Methods

to_ber(id = 0) click to toggle source

Converts an Array to a BER sequence. All values in the Array are expected to be in BER format prior to calling this method.

    # File lib/net/ber/core_ext/array.rb, line 7
    def to_ber(id = 0)
      # The universal sequence tag 0x30 is composed of the base tag value
      # (0x10) and the constructed flag (0x20).
      to_ber_seq_internal(0x30 + id)
    end

Also aliased as: to_ber_sequence
to_ber_appsequence(id = 0) click to toggle source

Converts an Array to an application-specific sequence, assigned a tag value that is meaningful to the particular protocol being used. All values in the Array are expected to be in BER format pr prior to calling this method.

    # File lib/net/ber/core_ext/array.rb, line 39
    def to_ber_appsequence(id = 0)
      # The application sequence tag always starts from the application flag
      # (0x40) and the constructed flag (0x20).
      to_ber_seq_internal(0x60 + id)
    end

to_ber_contextspecific(id = 0) click to toggle source

Converts an Array to a context-specific sequence, assigned a tag value that is meaningful to the particular context of the particular protocol being used. All values in the Array are expected to be in BER format prior to calling this method.

    # File lib/net/ber/core_ext/array.rb, line 50
    def to_ber_contextspecific(id = 0)
      # The application sequence tag always starts from the context flag
      # (0x80) and the constructed flag (0x20).
      to_ber_seq_internal(0xa0 + id)
    end

to_ber_oid() click to toggle source

SNMP Object Identifiers (OID) are special arrays

    # File lib/net/ber/core_ext/array.rb, line 72
    def to_ber_oid
      ary = self.dup
      first = ary.shift
      raise Net::BER::BerError, "Invalid OID" unless [0, 1, 2].include?(first)
      first = first * 40 + ary.shift
      ary.unshift first
      oid = ary.pack("w*")
      [6, oid.length].pack("CC") + oid
    end

to_ber_sequence(id = 0) click to toggle source
Alias for: to_ber
to_ber_set(id = 0) click to toggle source

Converts an Array to a BER set. All values in the Array are expected to be in BER format prior to calling this method.

    # File lib/net/ber/core_ext/array.rb, line 17
    def to_ber_set(id = 0)
      # The universal set tag 0x31 is composed of the base tag value (0x11)
      # and the constructed flag (0x20).
      to_ber_seq_internal(0x31 + id)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.