Asn1OerEncodeBuffer Class Reference

Inherits Com::Objsys::Asn1::Runtime::Asn1EncodeBitBuffer.

List of all members.

Public Member Functions

 Asn1OerEncodeBuffer (int size)
 Asn1OerEncodeBuffer ()
Asn1OerEncodeBuffer BeginSetOf ()
override void BinDump (System.IO.StreamWriter outs, System.String varName)
void EncodeIdentifier (int ident)
void EncodeIntSigned (long value)
void EncodeIntSigned (long value, int octets)
void EncodeIntUnsigned (long value)
void EncodeIntUnsigned (long value, int octets)
void EncodeLength (long length)
void EncodeQuantity (int quantity)
void EncodeTag (short tagClass, int tagNumber)
Asn1OerEncodeBuffer EndSetOf ()
bool GetCanonicalMode ()
int GetIdentifierLength (int ident)
Asn1OerEncodeBuffer NewBuffer ()
void SetCanonicalMode (bool value)
void SetOfRepDone ()

Detailed Description

This class handles the encoding of ASN.1 messages as specified in the Octet Encoding Rules (OER) as specified in the ITU-T X.696 standard. A reference to an object of this type is passed to each of the ASN.1 type encode methods involved in encoding a particular message type.


Constructor & Destructor Documentation

This constructor creates a OER encode buffer object with the default initial size. Whenever the buffer becomes full, it will be expanded.

Asn1OerEncodeBuffer ( int  size  ) 

This constructor creates a OER encode buffer object with the given initial size. Whenever the buffer becomes full, it will be expanded. For best performance, this size should be large enough to prevent resizing in normal operation.

Parameters:
size The initial size in bytes of an encode buffer.

Member Function Documentation

Asn1OerEncodeBuffer BeginSetOf (  ) 

If canonical mode is on, return a new Asn1OerEncodeBuffer into which the repetitions of a SET OF can be encoded. This should be paired with a later call to EndSetOf (which see).

If canonical mode is off, this simply returns this buffer.

Example usage: buffer = buffer.BeginSetOf(); //buffer is now new, temp buffer for each repetition encode repetition to buffer buffer.SetOfOccurrenceDone(); buffer = buffer.EndSetOf(); //buffer is original buffer again and SET OF is encoded, sorted, into it.

override void BinDump ( System.IO.StreamWriter  outs,
System.String  varName 
) [virtual]

This method dumps the encoded message in a human-readable format to the given print output stream.

Implements Asn1EncodeBuffer.

void EncodeIdentifier ( int  ident  ) 

Encode an identifier according to OER. This is the encoding used for a tag number > 62, i.e. in a variable number of octets, with 7 bits of the value encoded in each octet and the first bit serving as a flag bit. It is also the encoding used for the subidentifiers in an OBJECT IDENTIFIER encoding.

Parameters:
ident The tag number.
void EncodeIntSigned ( long  value  ) 

Encode an integer value as a variable length, signed integer, including encoding the length, according to OER. This is used for integer values that have a lower bound less than -2^63, no lower bound, or a lower bound less than zero in combination with an upper bound greater than 2^63–1, or no upper bound. (In other words, it doesn't fit in a signed 64-bit integer.)

Parameters:
value The value to encode.
void EncodeIntSigned ( long  value,
int  octets 
)

Encode an integer value as a signed value (2's complement form), in the given number of octets. The given value must be able to fit in the given number of octets.

Parameters:
value The value to encode. It must fit in the given number of octets.
octets The number of octets to encode in; 0 < octets <= 8
void EncodeIntUnsigned ( long  value  ) 

Encode an integer value as a variable length, unsigned integer, including encoding the length, according to OER. This is used for integer values that are constrained to be non-negative but which have no upper bound or an upper bound greater than 2^64 - 1.

Parameters:
value The value to encode. It must be non-negative.
void EncodeIntUnsigned ( long  value,
int  octets 
)

Encode an integer value as an unsigned value (binary integer) in the given number of octets.

Parameters:
value The value to encode. It must be non-negative and fit in the given number of octets.
octets The number of octets to encode in; 0 < octets <= 8.
void EncodeLength ( long  length  ) 

Encode an OER length determinant

void EncodeQuantity ( int  quantity  ) 

Encode an OER quantity (used for SEQUENCE-OF and SET-OF).

void EncodeTag ( short  tagClass,
int  tagNumber 
)

Encode a tag according to OER.

Parameters:
tagClass The tag class. The highest 2 bits shall be set equal to the bits specified in the encoding rules for the tag's class. The remaining bits shall be zero. Asn1Tag.UNIV etc. fulfill this.
tagNumber The tag number.
Asn1OerEncodeBuffer EndSetOf (  ) 

If canonical mode is on, encode each of the SET OF occurrences, in sorted order, to the original buffer, the one that created this buffer.

If canonical mode is off, this simply returns itself.

Returns:
In canonical mode, the original buffer, the one that was used to create this buffer by calling BeginSetOf(). Otherwise, this.
bool GetCanonicalMode (  ) 

Return true if canonical mode has been indicated by calling SetCanonicalMode(true);

int GetIdentifierLength ( int  ident  ) 

Return the minimal number of octets required to encode the given identifier, where the identifier is encoded following the OER rules for encoding a tag number greater than 62, i.e. in a variable number of octets, with 7 bits of the value encoded in each octet and the first bit serving as a flag bit.

Asn1OerEncodeBuffer NewBuffer (  ) 

Return a new OER encode buffer with the same canonical mode setting as this buffer.

void SetCanonicalMode ( bool  value  ) 

Turn canonical mode on/off. Turning canonical mode on acts as a signal to both generated code and runtime code that the user wants to encode according to the canonical OER rules.

void SetOfRepDone (  ) 

Invoke this method to signal to the buffer that another occurrence in a SET OF has been completely encoded into it.

This has no effect if canonical mode is off.