All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ORG.oclc.ber.ASN1

java.lang.Object
   |
   +----ORG.oclc.ber.ASN1

public class ASN1
extends Object
ASN1 is the constant data needed for BerString and DataDir. It also contains generic routines used by both of those classes.

The BER utilities presented here are a translation of the C version of berutil written by Ralph Levan at OCLC. The documentation presented here is pretty much taken from his docummentation.

OCLC has chosen not to use an ASN.1 compiler in its ASN.1 activities. These activities include ASN.1 encoding of z39.50, DBI (an internal variant on z39.50) and ASN.1 encoding of all database records, including MARC records. Strictly speaking, OCLC does not use ASN.1 internally, other than as a language for communicating record specifications to programmers. However, all the records mentioned above are encoded using the Basic Encoding Rules and are manipulable by the BER decoders of ASN.1 compilers. We have chosen to represent the BER records internally as a tree structure of linked lists that describe the parts of the BER record. We believe that this hierarchical structure fully represents the complexity of record encodable with the BER. The nodes in this tree structure contain the BER tag, class, form and either a pointer to data or a pointer to the next node down in the hierarchy, depending on whether the form was primitive or constructed. We often use a picture of this tree structure for describing the syntax of the record being encoded, rather than using ASN.1. For instance, the DeleteResultSetRequest is described in ASN.1 as:

DeleteResultSetRequest ::=
SEQUENCE
{referenceId                  ReferenceId OPTIONAL,
deleteSetFunction        [32] IMPLICIT INTEGER
{DeleteSpecificSet (0),
deleteAllSets      (1)}
resultSetId                   ResultSetId OPTIONAL}
with appropriate definitions for the non-terminals given somewhere else. We describe the same thing with the following picture:
DeleteResultSetRequest [26]
|
[ReferenceId [2]] --- deleteSetFunction [32] --- [resultSetId [31]]
|
OCTETSTRING
with appropriate descriptions of the values that the leaves in the tree can take. We do not make any claims that this is better than ASN.1, it's just that it maps directly into the tree structure that gets mapped into and out of the BER records. What we lose by using our own internal syntax is the use of a Presentation Layer produced by someone else. This means that currently those things that could be done by the Presentation layer are done by the application. This includes integer byte ordering, characterset translation and BER encoding. While this could be a major loss, is hasn't been one so far and we haven't heard of any real Presentation layers that do all the things promised anyway.

Version:
@(#)ASN1.java 1.10 01/13/97
See Also:
BerString, DataDir

Variable Index

 o APPLICATION
 o arbitrary
 o BITSTRING
 o BOOLEAN
 o CONSTRUCTED
 o CONTEXT
 o EXTERNAL
 o GENERALSTRING
 o INTEGER
 o NULL
 o OBJECTDESCRIPTOR
 o OBJECTIDENTIFIER
 o octet_aligned
 o OCTETSTRING
 o PRIMITIVE
 o PRIVATE
 o SEQUENCE
 o SET
 o single_ASN1_type
 o UNIVERSAL
 o VISIBLESTRING

Constructor Index

 o ASN1()

Method Index

 o getNum(byte[], int, int)
Get a number from a buffer

Variables

 o UNIVERSAL
 public static final byte UNIVERSAL
 o APPLICATION
 public static final byte APPLICATION
 o CONTEXT
 public static final byte CONTEXT
 o PRIVATE
 public static final byte PRIVATE
 o PRIMITIVE
 public static final byte PRIMITIVE
 o CONSTRUCTED
 public static final byte CONSTRUCTED
 o BOOLEAN
 public static final byte BOOLEAN
 o INTEGER
 public static final byte INTEGER
 o BITSTRING
 public static final byte BITSTRING
 o OCTETSTRING
 public static final byte OCTETSTRING
 o NULL
 public static final byte NULL
 o OBJECTIDENTIFIER
 public static final byte OBJECTIDENTIFIER
 o OBJECTDESCRIPTOR
 public static final byte OBJECTDESCRIPTOR
 o EXTERNAL
 public static final byte EXTERNAL
 o SEQUENCE
 public static final byte SEQUENCE
 o SET
 public static final byte SET
 o VISIBLESTRING
 public static final byte VISIBLESTRING
 o GENERALSTRING
 public static final byte GENERALSTRING
 o single_ASN1_type
 public static final byte single_ASN1_type
 o octet_aligned
 public static final byte octet_aligned
 o arbitrary
 public static final byte arbitrary

Constructors

 o ASN1
 public ASN1()

Methods

 o getNum
 public static final int getNum(byte record[],
                                int offset,
                                int len)
Get a number from a buffer

Parameters:
record - buffer
offset - start at this offset
len - length of the number to get

All Packages  Class Hierarchy  This Package  Previous  Next  Index