ASN1C C# Runtime Library  7.3
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
Asn1ObjectIdentifier Class Reference
Inheritance diagram for Asn1ObjectIdentifier:
Asn1Type Asn1TypeIF Asn1RelativeOID

Public Member Functions

virtual void Append (int[] value2)
 
 Asn1ObjectIdentifier ()
 
 Asn1ObjectIdentifier (int[] value)
 
override void Decode (Asn1BerDecodeBuffer buffer, bool explicitTagging, int implicitLength)
 
override void Decode (Asn1PerDecodeBuffer buffer)
 
virtual void DecodeXER (System.String buffer, System.String attrs)
 
override void DecodeXML (System.String buffer, System.String attrs)
 
override int Encode (Asn1BerEncodeBuffer buffer, bool explicitTagging)
 
override void Encode (Asn1PerEncodeBuffer buffer)
 
override void Encode (Asn1XerEncoder buffer, System.String elemName)
 
override void Encode (Asn1XmlEncoder buffer, System.String elemName, System.String nsPrefix)
 
override void Encode (Asn1BerOutputStream outs, bool explicitTagging)
 
override void Encode (Asn1PerOutputStream outs)
 
override bool Equals (System.Object value)
 
override int GetHashCode ()
 
override System.String ToString ()
 
String ToXMLValue ()
 
- Public Member Functions inherited from Asn1Type
void _SetKey (byte[] rtkey)
 
virtual void Decode (Asn1BerDecodeBuffer buffer)
 
virtual void Decode (System.Object reader, System.String xmlURI)
 
virtual void Decode (System.Object reader, System.IO.Stream byteStream)
 
virtual void DecodeXML (String buffer, String attrs)
 
virtual int Encode (Asn1BerEncodeBuffer buffer)
 
virtual void Encode (Asn1XerEncoder buffer)
 
virtual void Encode (Asn1XmlEncoder buffer)
 
virtual void Encode (Asn1CerOutputStream outs, bool explicitTagging)
 
virtual void EncodeAttribute (Asn1XmlEncoder buffer, System.String attrName)
 
virtual bool Equals (Asn1Type obj)
 
String GetNonParameterizedTypeName ()
 
virtual void Indent (System.IO.TextWriter outs, int level)
 
virtual bool IsOpenType ()
 
virtual bool MatchTypeName (System.String typeName)
 
virtual void Pdiag (System.String s)
 
virtual void Print (System.IO.TextWriter outs, System.String varName, int level)
 
virtual void Print (System.String varName)
 
void SetNonParameterizedTypeName (String value)
 
virtual void SetOpenType ()
 

Public Attributes

const int MAXSUBIDS = 128
 
int [] mValue
 
- Public Attributes inherited from Asn1Type
const short BIT_STRING = 3
 
const short BMPString = 30
 
const short BOOLEAN = 1
 
const short DATE = 31
 
const short ENUMERATED = 10
 
const short EOC = 0
 
const short EXTERNAL = 8
 
const short GeneralString = 27
 
const short GeneralTime = 24
 
const short GraphicString = 25
 
const short IA5String = 22
 
const short INTEGER = 2
 
const short NULL = 5
 
const short NumericString = 18
 
const short OBJECT_IDENTIFIER = 6
 
const short ObjectDescriptor = 7
 
const short OCTET_STRING = 4
 
const short OpenType = 99
 
const short PrintableString = 19
 
const short REAL = 9
 
const short RELATIVE_OID_IRI = 36
 
const short RelativeOID = 13
 
const short SEQUENCE = 16
 
const short SET = 17
 
const short T61String = TeletexString
 
const short TeletexString = 20
 
const short TIME = 14
 
const short UniversalString = 28
 
const short UTCTime = 23
 
const short UTF8String = 12
 
const short VideotexString = 21
 
const short VisibleString = 26
 

Static Public Attributes

static new readonly Asn1Tag _TAG
 
- Static Public Attributes inherited from Asn1Type
static readonly Asn1Tag _TAG
 

Protected Member Functions

virtual void Validate ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Asn1Type
static void _SetKey2 (byte[] rtkey)
 
static Asn1Type Decode (Asn1BerDecodeBuffer buffer, Asn1OpenTypeField openTypeField, bool explicitTag, int implicitLength)
 
static Asn1Type Decode (Asn1PerDecodeBuffer buffer, Asn1OpenTypeField openTypeField)
 
static System.String GetTypeName (short typeCode)
 
- Properties inherited from Asn1Type
virtual String AsnTypeName [get]
 
virtual int Length [get]
 

Detailed Description

This is a container class for holding the components of an ASN.1 object identifier value.

Constructor & Destructor Documentation

◆ Asn1ObjectIdentifier() [1/2]

This constructor creates an empty object identifier that can be used in a Decode method call to receive an OID value.

◆ Asn1ObjectIdentifier() [2/2]

Asn1ObjectIdentifier ( int []  value)

This constructor initializes the object identifier from the given array of integer subidentifier values.

Parameters
valueArray of subidentifiers

Member Function Documentation

◆ Append()

virtual void Append ( int []  value2)
virtual

This method appends an object identifier value onto the existing value. A typical use of this method would be for SNMP objects to create the base and index parts.

Parameters
value2Array of subidentifiers to append

References Asn1DecodeBuffer.DecodeOIDContents(), Asn1Type.OBJECT_IDENTIFIER, and Asn1MessageBufferBase.TypeCode.

◆ Decode() [1/2]

override void Decode ( Asn1BerDecodeBuffer  buffer,
bool  explicitTagging,
int  implicitLength 
)
virtual

This method decodes an ASN.1 object identifier value including the UNIVERSAL tag value and length if explicit tagging is specified.

Parameters
bufferDecode message buffer object
explicitTaggingFlag indicating element is explicitly tagged
implicitLengthLength of contents if implicit

Reimplemented from Asn1Type.

Reimplemented in Asn1RelativeOID.

◆ Decode() [2/2]

override void Decode ( Asn1PerDecodeBuffer  buffer)
virtual

This method decodes an ASN.1 object identifier value using the packed encoding rules (PER).

Parameters
bufferDecode message buffer object

Reimplemented from Asn1Type.

Reimplemented in Asn1RelativeOID.

◆ DecodeXER()

virtual void DecodeXER ( System.String  buffer,
System.String  attrs 
)
virtual

This method decodes an ASN.1 object identifier value using the XML encoding rules (XER).

Parameters
bufferString containing data to be decoded
attrsAttributes string from element tag

Reimplemented in Asn1RelativeOID.

References Asn1XmlXerEncoder.Copy(), Asn1XmlEncoder.EncodeEndElement(), and Asn1XmlEncoder.EncodeStartElement().

◆ DecodeXML()

override void DecodeXML ( System.String  buffer,
System.String  attrs 
)

This method decodes an ASN.1 object identifier value using the XML schema encoding rules(asn2xsd).

Parameters
bufferString containing data to be decoded
attrsAttributes string from element tag

◆ Encode() [1/6]

override int Encode ( Asn1BerEncodeBuffer  buffer,
bool  explicitTagging 
)
virtual

This method encodes an ASN.1 object identifier value including the UNIVERSAL tag value and length if explicit tagging is specified.

Parameters
bufferEncode message buffer object
explicitTaggingFlag indicating explicit tagging should be done
Returns
Length of encoded component in octets

Reimplemented from Asn1Type.

Reimplemented in Asn1RelativeOID.

References Asn1PerDecodeBuffer.DecodeLength(), Asn1DecodeBuffer.DecodeOIDContents(), Asn1BerEncodeBuffer.EncodeIdentifier(), Asn1BerEncodeBuffer.EncodeTagAndLength(), Asn1PerTraceHandler.NewBitField(), Asn1Type.OBJECT_IDENTIFIER, Diag.Prtln(), Asn1PerTraceHandler.SetBitCount(), Asn1PerDecodeBuffer.TraceHandler, and Asn1MessageBufferBase.TypeCode.

◆ Encode() [2/6]

override void Encode ( Asn1PerEncodeBuffer  buffer)
virtual

This method encodes an ASN.1 object identifier value using the packed encoding rules (PER).

The value to be encoded is stored in the mValue public member variable within this class.

Parameters
bufferEncode message buffer object

Reimplemented from Asn1Type.

Reimplemented in Asn1RelativeOID.

References Asn1XmlXerEncoder.Copy(), Asn1XerEncoder.EncodeEndElement(), Asn1PerEncodeBuffer.EncodeOIDLengthAndValue(), Asn1XerEncoder.EncodeStartElement(), and Asn1Type.OBJECT_IDENTIFIER.

◆ Encode() [3/6]

override void Encode ( Asn1XerEncoder  buffer,
System.String  elemName 
)
virtual

This method encodes an ASN.1 object identifier value using the XML encoding rules (XER).

Parameters
bufferEncode message buffer object
elemNameElement name

Reimplemented from Asn1Type.

Reimplemented in Asn1RelativeOID.

◆ Encode() [4/6]

override void Encode ( Asn1XmlEncoder  buffer,
System.String  elemName,
System.String  nsPrefix 
)
virtual

This method encodes an ASN.1 object identifier value using the XML Encoding as specified in the XML schema standard(asn2xsd).

Parameters
bufferEncode message buffer object
elemNameElement name
nsPrefixElement namespace value

Reimplemented from Asn1Type.

Reimplemented in Asn1RelativeOID.

◆ Encode() [5/6]

override void Encode ( Asn1BerOutputStream  outs,
bool  explicitTagging 
)
virtual

This method encodes and writes to the stream an ASN.1 object identifier value including the UNIVERSAL tag value and length if explicit tagging is specified. This overloaded version uses the Basic Encoding Rules (BER).

Throws, Exception thrown by C# System.IO.Stream for I/O error

Parameters
outsBER Output Stream object
explicitTaggingFlag indicating explicit tagging should be done
Exceptions
Asn1ExceptionThrown, if operation is failed.

Reimplemented from Asn1Type.

Reimplemented in Asn1RelativeOID.

◆ Encode() [6/6]

override void Encode ( Asn1PerOutputStream  outs)
virtual

This method encodes an ASN.1 object identifier value using the packed encoding rules (PER).

The value to be encoded is stored in the mValue public member variable within this class.

Also throws any exception thrown by the underlying Asn1PerOutputStream.

Parameters
outsPER Output Stream object
Exceptions
Asn1ExceptionThrown, if operation is failed.

Reimplemented from Asn1Type.

Reimplemented in Asn1RelativeOID.

◆ Equals()

override bool Equals ( System.Object  value)

This method compares this object identifier to the given one for equality.

Parameters
valueThe Object to compare with the current Object. Object should be instance of Asn1ObjectIdentifier.
Returns
true if the specified Object is equal to the current Object; otherwise, false.

References Asn1ObjectIdentifier.mValue.

◆ GetHashCode()

override int GetHashCode ( )

Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.

Returns
A hash code for the current Object.

◆ ToString()

override System.String ToString ( )

This method will return a string representation of the OID value. The format is the ASN.1 value format for this type. Note that textual subidentifiers are not used, only numeric values..

Returns
Stringified representation of the value

References Asn1BerOutputStream.EncodeIdentifier(), Asn1BerOutputStream.EncodeLength(), Asn1PerOutputStream.EncodeOIDLengthAndValue(), Asn1BerOutputStream.EncodeTag(), Asn1Tag.PRIM, Diag.Prtln(), and Asn1Tag.UNIV.

◆ ToXMLValue()

String ToXMLValue ( )

Return the XML value representation (defined in X.680) for this object identifier.

Exceptions
Asn1InvalidObjectIDExceptionif this is not a valid value.

◆ Validate()

virtual void Validate ( )
protectedvirtual

Do some minimal validation. Subclasses may override this to adjust for their validation rules (e.g. Asn1RelativeOID overrides this to be more lax). Minimally, the implementation should enforce that value is not null and that there is at least one arc.

Exceptions
Asn1InvalidObjectIDExceptionif validation fails

Reimplemented in Asn1RelativeOID.

Member Data Documentation

◆ _TAG

new readonly Asn1Tag _TAG
static

The _TAG constant describes the universal tag for this data type (UNIVERSAL 6).

◆ MAXSUBIDS

const int MAXSUBIDS = 128

The MAXSUBIDS constant specifies the maximum number of subidentifiers that can appear in an OID value (128).

Referenced by Asn1DecodeBuffer.DecodeOIDContents(), and Asn1DecodeBuffer.DecodeRelOIDContents().

◆ mValue

int [] mValue

The mValue public member variable is where the object identifier value is stored.

Referenced by Asn1ObjectIdentifier.Equals().