Class oclc.ber.ASN1
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class oclc.ber.ASN1

java.lang.Object
   |
   +----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.8 06/27/96
Author:
Jenny Colvard
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
 o lenLen(int)
Get the length needed to represent the given length.
 o numLen(int)
Get the length needed to represent the given number.
 o putNum(byte[], int, int)
Put a number into a given buffer
 o tagLen(int)
Get the length needed to represent the given fldid.

Variables

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

Constructors

 o ASN1
  public ASN1()

Methods

 o tagLen
  protected final static int tagLen(int fldid)
Get the length needed to represent the given fldid.
Parameters:
fldid - determine length needed to encode this
Returns:
length needed to encode given fldid
 o lenLen
  protected final static int lenLen(int length)
Get the length needed to represent the given length.
Parameters:
length - determine length needed to encode this
Returns:
length needed to encode given length
 o numLen
  protected final static int numLen(int num)
Get the length needed to represent the given number.
Parameters:
number - determine length needed to encode this
Returns:
length needed to encode given number
 o putNum
  protected final static void putNum(byte record[],
                                     int offset,
                                     int num)
Put a number into a given buffer
Parameters:
record - buffer to use
offset - offset into buffer
num - number to put into buffer
 o getNum
  public final static 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