|
Open SiteSearch 4.1.1 Final |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ORG.oclc.ber.ASN1
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]] | OCTETSTRINGwith 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.
BerString
,
DataDir
Field Summary | |
static byte |
APPLICATION
|
static byte |
arbitrary
|
static byte |
BITSTRING
|
static byte |
BOOLEAN
|
static byte |
CONSTRUCTED
|
static byte |
CONTEXT
|
static byte |
ENUMERATED
|
static byte |
EXTERNAL
|
static byte |
GENERALSTRING
|
static byte |
INTEGER
|
static byte |
NULL
|
static byte |
OBJECTDESCRIPTOR
|
static byte |
OBJECTIDENTIFIER
|
static byte |
octet_aligned
|
static byte |
OCTETSTRING
|
static byte |
PRIMITIVE
|
static byte |
PRIVATE
|
static byte |
SEQUENCE
|
static byte |
SET
|
static byte |
single_ASN1_type
|
static byte |
UNIVERSAL
|
static byte |
VISIBLESTRING
|
Constructor Summary | |
ASN1()
|
Method Summary | |
static long |
getLong(byte[] record,
int offset,
int len)
Get a number from a buffer |
static int |
getNum(byte[] record,
int offset,
int len)
|
protected static int |
lenLen(int length)
Get the length needed to represent the given length. |
protected static int |
numLen(long num)
Get the length needed to represent the given number. |
protected static void |
putNum(byte[] record,
int offset,
long num)
Put a number into a given buffer |
protected static int |
tagLen(int fldid)
Get the length needed to represent the given fldid. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final byte UNIVERSAL
public static final byte APPLICATION
public static final byte CONTEXT
public static final byte PRIVATE
public static final byte PRIMITIVE
public static final byte CONSTRUCTED
public static final byte BOOLEAN
public static final byte INTEGER
public static final byte BITSTRING
public static final byte OCTETSTRING
public static final byte NULL
public static final byte OBJECTIDENTIFIER
public static final byte OBJECTDESCRIPTOR
public static final byte EXTERNAL
public static final byte ENUMERATED
public static final byte SEQUENCE
public static final byte SET
public static final byte VISIBLESTRING
public static final byte GENERALSTRING
public static final byte single_ASN1_type
public static final byte octet_aligned
public static final byte arbitrary
Constructor Detail |
public ASN1()
Method Detail |
protected static final int tagLen(int fldid)
fldid
- determine length needed to encode thisprotected static final int lenLen(int length)
length
- determine length needed to encode thisprotected static final int numLen(long num)
number
- determine length needed to encode thisprotected static final void putNum(byte[] record, int offset, long num)
record
- buffer to useoffset
- offset into buffernum
- number to put into bufferpublic static final long getLong(byte[] record, int offset, int len)
record
- bufferoffset
- start at this offsetlen
- length of the number to getpublic static final int getNum(byte[] record, int offset, int len)
|
Open SiteSearch 4.1.1 Final |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |