|
JoeSNMP API 0.3.3 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.opennms.protocols.snmp.asn1.BerEncoder
The BerEncoder class is used to implement the AsnEncoder interface for the Basic Encoding Rules (BER). The encoding rules are used to encode and decode SNMP values using BER.
| Field Summary | |
private static byte |
CONSTRUCTOR
Defines the BER constructor id |
private static byte |
EXTENSION_ID
Defines the BER extension "value" that is used to mark an extension type. |
private static byte |
HIGH_BIT
Defines the "high bit" that is the sign extension bit for a 8-bit signed value. |
private static byte |
LONG_LENGTH
Defines the ASN.1 long length marker for the Basic Encoding Rule (BER) |
| Constructor Summary | |
BerEncoder()
|
|
| Method Summary | |
int |
buildHeader(byte[] buf,
int startOffset,
byte asnType,
int asnLength)
The buildHeader() method is used to encode an ASN.1 header into the specified byte buffer. |
int |
buildInteger32(byte[] buf,
int startOffset,
byte asnType,
int asnInt32)
The buildInteger32() method is used to encode an ASN.1 32-bit signed integer into the specified byte buffer. |
int |
buildLength(byte[] buf,
int startOffset,
int asnLength)
The buildLength() method is used to encode an ASN.1 length into the specified byte buffer. |
int |
buildNull(byte[] buf,
int startOffset,
byte asnType)
The buildNull() method is used to encode an ASN.1 NULL value into the specified byte buffer. |
int |
buildObjectId(byte[] buf,
int startOffset,
byte asnType,
int[] oids)
The buildObjectId() method is used to encode an ASN.1 object id value into the specified byte buffer. |
int |
buildString(byte[] buf,
int startOffset,
byte asnType,
byte[] opaque)
The buildString() method is used to encode an ASN.1 string value into the specified byte buffer. |
int |
buildUInteger32(byte[] buf,
int startOffset,
byte asnType,
long asnUInt32)
The buildUInteger32() method is used to encode an ASN.1 32-bit unsigned integer into the specified byte buffer. |
int |
buildUInteger64(byte[] buf,
int startOffset,
byte asnType,
java.math.BigInteger asnUInt64)
The buildUInteger64() method is used to encode an ASN.1 64-bit unsigned integer into the specified byte buffer. |
protected static int |
byteToInt(byte b)
Converts a primitive byte to a primitive long using "unsigned" logic. |
protected static long |
byteToLong(byte b)
Converts a primitive byte to a primitive long. |
protected static boolean |
isConstructor(byte b)
Used to determine if the ASN.1 type is a constructor. |
protected static boolean |
isExtensionId(byte b)
Used to test if the ASN.1 type is an extension. |
java.lang.Object[] |
parseHeader(byte[] buf,
int startOffset)
The parseHeader() method is used to decode an ASN.1 header from the specified buffer. |
java.lang.Object[] |
parseInteger32(byte[] buf,
int startOffset)
The parseInteger32() method is used to decode an ASN.1 32-bit signed integer from the specified buffer. |
java.lang.Object[] |
parseLength(byte[] buf,
int startOffset)
The parseLength() method is used to decode an ASN.1 length from the specified buffer. |
java.lang.Object[] |
parseNull(byte[] buf,
int startOffset)
The parseNull() method is used to decode an ASN.1 Null value from the specified buffer. |
java.lang.Object[] |
parseObjectId(byte[] buf,
int startOffset)
The parseObjectId() method is used to decode an ASN.1 Object Identifer from the specified buffer. |
java.lang.Object[] |
parseString(byte[] buf,
int startOffset)
The parseString() method is used to decode an ASN.1 opaque string from the specified buffer. |
java.lang.Object[] |
parseUInteger32(byte[] buf,
int startOffset)
The parseUInteger32() method is used to decode an ASN.1 32-bit unsigned integer from the specified buffer. |
java.lang.Object[] |
parseUInteger64(byte[] buf,
int startOffset)
The parseUInteger64() method is used to decode an ASN.1 64-bit unsigned integer from the specified buffer. |
protected static void |
rotate(byte[] buf,
int begin,
int pivot,
int end)
Rotates a give buffer area marked by begin, pivot, and end. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static final byte LONG_LENGTH
private static final byte HIGH_BIT
private static final byte EXTENSION_ID
private static final byte CONSTRUCTOR
| Constructor Detail |
public BerEncoder()
| Method Detail |
protected static int byteToInt(byte b)
b - The 8-bit value to convert
protected static long byteToLong(byte b)
b - The 8-bit value to convert
protected static boolean isConstructor(byte b)
b - The ASN.1 type
protected static boolean isExtensionId(byte b)
b - The ASN.1 type.
protected static void rotate(byte[] buf,
int begin,
int pivot,
int end)
throws java.lang.ArrayIndexOutOfBoundsException
buf - The buffer containing the data to rotatebegin - The start of the rotationpivot - The pivot point for the rotationend - The end of the rotational buffer
java.lang.ArrayIndexOutOfBoundsException - Thrown if an access exception occurs
public int buildLength(byte[] buf,
int startOffset,
int asnLength)
throws AsnEncodingException
buildLength in interface AsnEncoderbuf - The output buffer of encoded bytes.startOffset - The offset from the start of the buffer where the
method should start writing the encoded data.asnLength - The length to be encoded.
AsnEncodingException - Thrown if an error occurs encoding
the datatype.
public java.lang.Object[] parseLength(byte[] buf,
int startOffset)
throws AsnDecodingException
parseLength in interface AsnEncoderbuf - The input bufferstartOffset - The offset to start decoding in the buffer
AsnDecodingException - Thrown if an error occurs decoding
the buffer.
public int buildHeader(byte[] buf,
int startOffset,
byte asnType,
int asnLength)
throws AsnEncodingException
buildHeader in interface AsnEncoderbuf - The output buffer of encoded bytes.startOffset - The offset from the start of the buffer where the
method should start writing the encoded data.asnType - The ASN.1 type to place in the bufferasnLength - The length to be encoded.
AsnEncodingException - Thrown if an error occurs encoding
the datatype.
public java.lang.Object[] parseHeader(byte[] buf,
int startOffset)
throws AsnDecodingException
parseHeader in interface AsnEncoderbuf - The input bufferstartOffset - The offset to start decoding in the buffer
AsnDecodingException - Thrown if an error occurs decoding
the buffer.
public int buildInteger32(byte[] buf,
int startOffset,
byte asnType,
int asnInt32)
throws AsnEncodingException
buildInteger32 in interface AsnEncoderbuf - The output buffer of encoded bytes.startOffset - The offset from the start of the buffer where the
method should start writing the encoded data.asnType - The ASN.1 type to place in the bufferasnInt32 - The 32-bit signed integer to encode.
AsnEncodingException - Thrown if an error occurs encoding
the datatype.
public java.lang.Object[] parseInteger32(byte[] buf,
int startOffset)
throws AsnDecodingException
parseInteger32 in interface AsnEncoderbuf - The input bufferstartOffset - The offset to start decoding in the buffer
AsnDecodingException - Thrown if an error occurs decoding
the buffer.
public int buildUInteger32(byte[] buf,
int startOffset,
byte asnType,
long asnUInt32)
throws AsnEncodingException
buildUInteger32 in interface AsnEncoderbuf - The output buffer of encoded bytes.startOffset - The offset from the start of the buffer where the
method should start writing the encoded data.asnType - The ASN.1 type to place in the bufferasnUInt32 - The 32-bit unsigned integer to encode.
AsnEncodingException - Thrown if an error occurs encoding
the datatype.
public java.lang.Object[] parseUInteger32(byte[] buf,
int startOffset)
throws AsnDecodingException
parseUInteger32 in interface AsnEncoderbuf - The input bufferstartOffset - The offset to start decoding in the buffer
AsnDecodingException - Thrown if an error occurs decoding
the buffer.
public int buildUInteger64(byte[] buf,
int startOffset,
byte asnType,
java.math.BigInteger asnUInt64)
throws AsnEncodingException
buildUInteger64 in interface AsnEncoderbuf - The output buffer of encoded bytes.startOffset - The offset from the start of the buffer where the
method should start writing the encoded data.asnType - The ASN.1 type to place in the bufferasnUInt64 - The 64-bit unsigned integer to encode.
AsnEncodingException - Thrown if an error occurs encoding
the datatype.
public java.lang.Object[] parseUInteger64(byte[] buf,
int startOffset)
throws AsnDecodingException
parseUInteger64 in interface AsnEncoderbuf - The input bufferstartOffset - The offset to start decoding in the buffer
AsnDecodingException - Thrown if an error occurs decoding
the buffer.
public int buildNull(byte[] buf,
int startOffset,
byte asnType)
throws AsnEncodingException
buildNull in interface AsnEncoderbuf - The output buffer of encoded bytes.startOffset - The offset from the start of the buffer where the
method should start writing the encoded data.asnType - The ASN.1 type to place in the buffer
AsnEncodingException - Thrown if an error occurs encoding
the datatype.
public java.lang.Object[] parseNull(byte[] buf,
int startOffset)
throws AsnDecodingException
parseNull in interface AsnEncoderbuf - The input bufferstartOffset - The offset to start decoding in the buffer
AsnDecodingException - Thrown if an error occurs decoding
the buffer.
public int buildString(byte[] buf,
int startOffset,
byte asnType,
byte[] opaque)
throws AsnEncodingException
buildString in interface AsnEncoderbuf - The output buffer of encoded bytes.startOffset - The offset from the start of the buffer where the
method should start writing the encoded data.asnType - The ASN.1 type to place in the bufferopaque - An array of bytes to encode into the string.
AsnEncodingException - Thrown if an error occurs encoding
the datatype.
public java.lang.Object[] parseString(byte[] buf,
int startOffset)
throws AsnDecodingException
parseString in interface AsnEncoderbuf - The input bufferstartOffset - The offset to start decoding in the buffer
AsnDecodingException - Thrown if an error occurs decoding
the buffer.
public int buildObjectId(byte[] buf,
int startOffset,
byte asnType,
int[] oids)
throws AsnEncodingException
buildObjectId in interface AsnEncoderbuf - The output buffer of encoded bytes.startOffset - The offset from the start of the buffer where the
method should start writing the encoded data.asnType - The ASN.1 type to place in the bufferoids - An array of integers to encode.
AsnEncodingException - Thrown if an error occurs encoding
the datatype.
public java.lang.Object[] parseObjectId(byte[] buf,
int startOffset)
throws AsnDecodingException
parseObjectId in interface AsnEncoderbuf - The input bufferstartOffset - The offset to start decoding in the buffer
AsnDecodingException - Thrown if an error occurs decoding
the buffer.
|
JoeSNMP API 0.3.3 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||