Module: Net::BER::BERParser

### Home Classes Methods

### In Files

- lib/net/ber/ber_parser.rb

### Methods

- #read_ber

### 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::BERParser

Implements Basic Encoding Rules parsing to be mixed into types as needed.

### Constants

BuiltinSyntax

  The universal, built-in ASN.1 BER syntax.

### Public Instance Methods

read_ber(syntax = nil) click to toggle source

Reads a BER object from the including object. Requires that getbyte is implemented on the including object and that it returns a Fixnum value. Also requires read(bytes) to work.

This does not work with non-blocking I/O.

    # File lib/net/ber/ber_parser.rb, line 151
    def read_ber(syntax = nil)
      # TODO: clean this up so it works properly with partial packets coming
      # from streams that don't block when we ask for more data (like
      # StringIOs). At it is, this can throw TypeErrors and other nasties.

      id = getbyte or return nil  # don't trash this value, we'll use it later
      content_length = read_ber_length

      if -1 == content_length
        raise Net::BER::BerError, "Indeterminite BER content length not implemented."
      else
        data = read(content_length)
      end

      parse_ber_object(syntax, id, data)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.