C# Class SnmpSharpNet.AsnType

Base class for all ASN.1 value classes
Inheritance: ICloneable
Show file Open project: griffina/SnmpSharpNet Class Usage Examples

Public Properties

Property Type Description
APPLICATION byte
BITSTRING byte
BOOLEAN byte
CONSTRUCTOR byte
CONTEXT byte
INTEGER byte
NULL byte
OBJECTID byte
OCTETSTRING byte
PRIMITIVE byte
PRIVATE byte
SEQUENCE byte
SET byte
UNIVERSAL byte

Protected Properties

Property Type Description
EXTENSION_ID byte
HIGH_BIT byte
_asnType byte

Public Methods

Method Description
Clone ( ) : object

Abstract Clone() member function

decode ( byte buffer, int offset ) : int

Decodes the ASN.1 buffer and sets the values in the AsnType object.

encode ( MutableByte buffer ) : void

Encodes the data object in the specified buffer

Private Methods

Method Description
BuildHeader ( MutableByte mb, byte asnType, int asnLength ) : void

Build ASN.1 header in the MutableByte array.

Header is the TL part of the TLV (type, length, value) BER encoded data representation. Each value is encoded as a Type byte, length of the data field and the actual, encoded data. This method will encode the type and length fields.

BuildLength ( MutableByte mb, int asnLength ) : void

Append BER encoded length to the MutableByte

ParseHeader ( byte mb, int &offset, int &length ) : byte

Parse ASN.1 header.

ParseLength ( byte mb, int &offset ) : int

MutableByte version of ParseLength. Retrieve BER encoded length from a byte array at supplied offset

Method Details

Clone() public abstract method

Abstract Clone() member function
public abstract Clone ( ) : object
return object

decode() public abstract method

Decodes the ASN.1 buffer and sets the values in the AsnType object.
public abstract decode ( byte buffer, int offset ) : int
buffer byte The encoded data buffer
offset int The offset of the first valid byte.
return int

encode() public abstract method

Encodes the data object in the specified buffer
public abstract encode ( MutableByte buffer ) : void
buffer MutableByte The buffer to write the encoded information
return void

Property Details

APPLICATION public static property

Relevant to a particular application. These are defined in standards other than ASN.1.
public static byte APPLICATION
return byte

BITSTRING public static property

Bit sequence type
public static byte BITSTRING
return byte

BOOLEAN public static property

Bool true/false value type
public static byte BOOLEAN
return byte

CONSTRUCTOR public static property

A constructed data object such as a set or sequence.
public static byte CONSTRUCTOR
return byte

CONTEXT public static property

Also relevant to a particular application, but limited by context
public static byte CONTEXT
return byte

EXTENSION_ID protected static property

Defines the BER extension "value" that is used to mark an extension type.
protected static byte EXTENSION_ID
return byte

HIGH_BIT protected static property

Defines the "high bit" that is the sign extension bit for a 8-bit signed value.
protected static byte HIGH_BIT
return byte

INTEGER public static property

Signed 32-bit integer type
public static byte INTEGER
return byte

NULL public static property

Null (no value) type
public static byte NULL
return byte

OBJECTID public static property

Object id type
public static byte OBJECTID
return byte

OCTETSTRING public static property

Octet (byte) value type
public static byte OCTETSTRING
return byte

PRIMITIVE public static property

A primitive data object.
public static byte PRIMITIVE
return byte

PRIVATE public static property

These are types not covered by any standard but instead defined by users.
public static byte PRIVATE
return byte

SEQUENCE public static property

Arbitrary data type
public static byte SEQUENCE
return byte

SET public static property

Defined by referencing a fixed, unordered list of types, some of which may be declared optional. Each value is an unordered list of values, one from each component type.
public static byte SET
return byte

UNIVERSAL public static property

Generally useful, application-independent types and construction mechanisms.
public static byte UNIVERSAL
return byte

_asnType protected property

ASN.1 type byte.
protected byte _asnType
return byte