Asn1PerEncodeBuffer Class Reference
Public Member Functions | |
Asn1PerEncodeBuffer (bool aligned, int sizeIncrement) | |
Asn1PerEncodeBuffer (bool aligned) | |
override void | BinDump (System.IO.StreamWriter outs, System.String varName) |
override void | ByteAlign () |
override void | EncodeBit (bool value) |
virtual void | EncodeBit (bool value, System.String ident) |
override void | EncodeBits (byte[] value, int offset, int nbits) |
override void | EncodeBits (byte[] value, int offset, int bitOffset, int nbits) |
virtual void | EncodeBits (byte[] value, int offset, int bitOffset, int nbits, System.String ident) |
virtual void | EncodeBits (byte[] value, int offset, int nbits, System.String ident) |
virtual void | EncodeCharString (System.String value, int nchars, int offset, int abpc, int ubpc, Asn1CharSet charSet) |
virtual void | EncodeConsWholeNumber (long adjustedValue, long rangeValue) |
virtual void | EncodeConsWholeNumber (long adjustedValue, long rangeValue, System.String ident) |
virtual void | EncodeInt (long value, bool encodeLen, bool signExtend) |
virtual void | EncodeInt (long value, bool encodeLen, bool signExtend, System.String ident) |
virtual void | EncodeInt (long value, int nbits) |
virtual void | EncodeInt (long value, int nbits, System.String ident) |
virtual void | EncodeLength (long value, long lower, long upper) |
virtual long | EncodeLength (long value) |
virtual void | EncodeLengthEOM (long value) |
virtual void | EncodeOctetString (byte[] value, int offset, int nbytes) |
virtual void | EncodeOIDLengthAndValue (int[] value) |
virtual void | EncodeOpenType (Asn1PerEncodeBuffer buffer, System.String elemName) |
virtual void | EncodeOpenType (byte[] value, int offset, int nbytes) |
virtual void | EncodeRelOIDLengthAndValue (int[] value) |
virtual void | EncodeSmallLength (int value) |
virtual void | EncodeSmallNonNegWholeNumber (int value) |
virtual long | EncodeUnconsLength (long value) |
override void | HexDump () |
virtual bool | IsAligned () |
override void | Reset () |
virtual void | SetAligned (bool value) |
void | SetSizeConstraint (long lower, long upper) |
void | SetSizeConstraintExt (long lower, long upper, long extLower, long extUpper) |
Protected Attributes | |
internal Asn1PerTraceHandler | mTraceHandler |
Properties | |
virtual Asn1PerTraceHandler | TraceHandler [get] |
Detailed Description
This class handles the encoding of ASN.1 messages as specified in the Packed Encoding Rules (PER) ITU-T X.691 standard.
Constructor & Destructor Documentation
Asn1PerEncodeBuffer | ( | bool | aligned | ) |
This constructor creates a PER encode buffer object with the default size increment. Whenever the buffer becomes full, the buffer will be expanded by the sizeIncrement size.
- Parameters:
-
aligned true
for PER aligned orfalse
for PER unaligned encoding.
Asn1PerEncodeBuffer | ( | bool | aligned, | |
int | sizeIncrement | |||
) |
This constructor creates a PER encode buffer object with the given size increment. Whenever the buffer becomes full, the buffer will be expanded by the sizeIncrement size. This size should be large enough to prevent resizing in normal operation.
- Parameters:
-
aligned true
for PER aligned orfalse
for PER unaligned encoding.sizeIncrement The initial size in bytes of an encode buffer. If the buffer becomes full, it will be expanded by the amount.
Member Function Documentation
override void BinDump | ( | System.IO.StreamWriter | outs, | |
System.String | varName | |||
) | [virtual] |
This method dumps the encoded message in a human-readable format showing a bit trace of all fields to the given print output stream.
- Parameters:
-
outs StreamWriter object to which output should be written varName Name of top-level message object variable
Implements Asn1EncodeBuffer.
override void ByteAlign | ( | ) |
This method byte-aligns the buffer if the buffer is set to be aligned.
Implements Asn1PerMessageBuffer.
override void EncodeBit | ( | bool | value | ) |
This method encodes a single bit value. The ident
argument which is used for tracing is defaulted to 'value'. Equivalent to EncodeBit(value, "value");
- Parameters:
-
value Boolean value of bit to be encoded.
Implements Asn1PerEncoder.
virtual void EncodeBit | ( | bool | value, | |
System.String | ident | |||
) | [virtual] |
This method encodes a single bit value.
- Parameters:
-
value Boolean value of bit to be encoded. ident Bit field identifier name for tracing.
Implements Asn1PerEncoder.
override void EncodeBits | ( | byte[] | value, | |
int | offset, | |||
int | nbits | |||
) |
This method encodes bit values from an array of octets. The ident
argument which is used for tracing is defaulted to 'value'.
- Parameters:
-
value Octet array containing bits to be encoded offset Starting byte offset in value nbits Number of bits to encode
Implements Asn1PerEncoder.
override void EncodeBits | ( | byte[] | value, | |
int | offset, | |||
int | bitOffset, | |||
int | nbits | |||
) |
This method encodes bit values from an array of octets.
This overrides the parent class method in order to default the name for tracing to "value". Equivalent to: encodeBits(value, offset, bitOffset, nbits, "value");
virtual void EncodeBits | ( | byte[] | value, | |
int | offset, | |||
int | bitOffset, | |||
int | nbits, | |||
System.String | ident | |||
) | [virtual] |
This method encodes bit values from an array of octets.
- Parameters:
-
value Octet array containing bits to be encoded offset Starting byte offset in value bitOffset Starting bit offset in first byte. For example, passing 0 would begin encoding with the most significant bit, while passing 7 would begin encoding with the least significant bit. nbits Number of bits to encode ident Bit field identifier name for tracing.
virtual void EncodeBits | ( | byte[] | value, | |
int | offset, | |||
int | nbits, | |||
System.String | ident | |||
) | [virtual] |
This method encodes bit values from an array of octets.
- Parameters:
-
value Octet array containing bits to be encoded offset Starting byte offset in value nbits Number of bits to encode ident Bit field identifier name for tracing.
Implements Asn1PerEncoder.
virtual void EncodeCharString | ( | System.String | value, | |
int | nchars, | |||
int | offset, | |||
int | abpc, | |||
int | ubpc, | |||
Asn1CharSet | charSet | |||
) | [virtual] |
This method encodes the contents of a known-multiplier character string type. This version assumes a permitted alphabet constraint was specified.
- Parameters:
-
value String containing characters to encode nchars Number of characters from string to encode offset Offset to first char in string to encode abpc Number of bits per character (aligned) ubpc Number of bits per character (unaligned) charSet Object representing permitted alphabet constraint character set (optional)
Implements Asn1PerEncoder.
virtual void EncodeConsWholeNumber | ( | long | adjustedValue, | |
long | rangeValue | |||
) | [virtual] |
This method implements the rules to encode a constrained whole number as specified in section 10.5 of the X.691 standard. The ident
argument which is used for tracing is defaulted to 'value'.
- Parameters:
-
adjustedValue Adjusted value to be encoded = value - lower range endpoint value rangeValue lower - upper + 1
Implements Asn1PerEncoder.
virtual void EncodeConsWholeNumber | ( | long | adjustedValue, | |
long | rangeValue, | |||
System.String | ident | |||
) | [virtual] |
This method implements the rules to encode a constrained whole number as specified in section 10.5 of the X.691 standard.
- Parameters:
-
adjustedValue Adjusted value to be encoded = value - lower range endpoint value rangeValue lower - upper + 1 ident Tracing identifier
Implements Asn1PerEncoder.
virtual void EncodeInt | ( | long | value, | |
bool | encodeLen, | |||
bool | signExtend | |||
) | [virtual] |
This method implements the rules to encode either a non-negative binary integer as specified in section 10.3 or a two's complement binary integer as specified in section 10.4 of the X.691 standard. The ident
argument which is used for tracing is defaulted to 'value'.
- Parameters:
-
value Integer value to be encoded encodeLen Flag indicating length determinant should be encoded before encoding integer value. signExtend Flag indicating if sign extension should be performed.
Implements Asn1PerEncoder.
virtual void EncodeInt | ( | long | value, | |
bool | encodeLen, | |||
bool | signExtend, | |||
System.String | ident | |||
) | [virtual] |
This method implements the rules to encode either a non-negative binary integer as specified in section 10.3 or a two's complement binary integer as specified in section 10.4 of the X.691 standard.
- Parameters:
-
value Integer value to be encoded encodeLen Flag indicating length determinant should be encoded before encoding integer value. signExtend Flag indicating if sign extension should be performed. ident Tracing identifier
Implements Asn1PerEncoder.
virtual void EncodeInt | ( | long | value, | |
int | nbits | |||
) | [virtual] |
This method encodes bit values from an integer value. The least significant bits from the integer are encoded. The ident
argument which is used for tracing is defaulted to 'value'.
- Parameters:
-
value Integer containing bits to be encoded nbits Number of bits to encode
Implements Asn1PerEncoder.
virtual void EncodeInt | ( | long | value, | |
int | nbits, | |||
System.String | ident | |||
) | [virtual] |
This method encodes bit values from an integer value. The least significant bits from the integer are encoded.
- Parameters:
-
value Integer containing bits to be encoded nbits Number of bits to encode ident Tracing identifier
Implements Asn1PerEncoder.
virtual void EncodeLength | ( | long | value, | |
long | lower, | |||
long | upper | |||
) | [virtual] |
This method encodes a constrained length determinant value.
- Parameters:
-
value Length value to be encoded lower Lower bound (inclusive) of length value range upper Upper bound (inclusive) of length value range
Implements Asn1PerEncoder.
virtual long EncodeLength | ( | long | value | ) | [virtual] |
This method encodes either a constrained or unconstrained length depending on whether a size constraint object is set in this object.
- Parameters:
-
value Length value to be encoded
- Returns:
- Value that was actually encoded. This may be less than the value that was passed in if fragementation was done (i.e the value was >= 16k).
Implements Asn1PerEncoder.
virtual void EncodeLengthEOM | ( | long | value | ) | [virtual] |
This method checks to see if a zero byte needs to be added after a fragmented length has been encoded. It will add it to the byte stream if necessary.
- Parameters:
-
value Original length value that was encoded.
Implements Asn1PerEncoder.
virtual void EncodeOctetString | ( | byte[] | value, | |
int | offset, | |||
int | nbytes | |||
) | [virtual] |
This method encodes the given array of bytes as an unconstrained octet string value.
- Parameters:
-
value Byte array containing data to encode. This is assumed to contain a previously encoded PER component. offset Starting offset in byte array value nbytes Number of bytes to encode
Implements Asn1PerEncoder.
virtual void EncodeOIDLengthAndValue | ( | int[] | value | ) | [virtual] |
This method encodes the length and contents of an object identifier value.
- Parameters:
-
value Integer array containing arcs to encode
Implements Asn1PerEncoder.
virtual void EncodeOpenType | ( | Asn1PerEncodeBuffer | buffer, | |
System.String | elemName | |||
) | [virtual] |
This overloaded version of encodeOpenType will encode the componet in the given PER encode buffer into this PER encode buffer.
- Parameters:
-
buffer PER encode buffer containing encoded message component. elemName Name of element being encoded.
virtual void EncodeOpenType | ( | byte[] | value, | |
int | offset, | |||
int | nbytes | |||
) | [virtual] |
This method encodes the given array of bytes as an open type.
- Parameters:
-
value Byte array containing data to encode. This is assumed to contain a previously encoded PER component. offset Starting offset in byte array value nbytes Number of bytes to encode
Implements Asn1PerEncoder.
virtual void EncodeRelOIDLengthAndValue | ( | int[] | value | ) | [virtual] |
This method encodes the length and contents of a relative object identifier value.
- Parameters:
-
value Integer array containing arcs to encode
Implements Asn1PerEncoder.
virtual void EncodeSmallLength | ( | int | value | ) | [virtual] |
This method implements the rules to encode a normally small length as specified in section 11.9 of the X.691 standard.
- Parameters:
-
value Value to be encoded
Implements Asn1PerEncoder.
virtual void EncodeSmallNonNegWholeNumber | ( | int | value | ) | [virtual] |
This method implements the rules to encode a small non-negative whole number as specified in section 10.6 of the X.691 standard.
- Parameters:
-
value Value to be encoded
Implements Asn1PerEncoder.
virtual long EncodeUnconsLength | ( | long | value | ) | [virtual] |
This method encodes a general (unconstrained) length determinant value as described in section 10.9 or the X.691 standard.
- Parameters:
-
value Length value to be encoded
- Returns:
- Value that was actually encoded. This may be less than the value that was passed in if fragementation was done (i.e the value was >= 16k).
override void HexDump | ( | ) | [virtual] |
This method dumps the encoded message in hex/ascii format to the standard output stream.
Reimplemented from Asn1EncodeBuffer.
virtual bool IsAligned | ( | ) | [virtual] |
This method is used to test if PER aligned encoding has been specified.
- Returns:
true
for PER aligned encoding orfalse
for unaligned encoding.
Implements Asn1PerMessageBuffer.
override void Reset | ( | ) | [virtual] |
This method resets the buffer object so that it can be reused to encode another PER message. Any previously encoded data is lost.
Implements Asn1EncodeBuffer.
virtual void SetAligned | ( | bool | value | ) | [virtual] |
This method is used to turn PER aligned encoding on or off
- Parameters:
-
value true
for PER aligned encoding orfalse
for unaligned encoding.
void SetSizeConstraint | ( | long | lower, | |
long | upper | |||
) |
This method is used to set a size constraint within the buffer object. The constraint will only be set if an existing constraint is not already in place (i.e. if the existing reference is not null). This is used for length decoding of SEQUENCE OF objects to pass constraints applied to referenced objects to the base object.
void SetSizeConstraintExt | ( | long | lower, | |
long | upper, | |||
long | extLower, | |||
long | extUpper | |||
) |
This method is used to set an extensible size constraint in the buffer object. The constraint will only be set if an existing constraint is not already in place (i.e. if the existing reference is not null). This is used for length encoding of SEQUENCE OF objects to pass constraints applied to referenced objects to the base object.
Member Data Documentation
internal Asn1PerTraceHandler mTraceHandler [protected] |
Variable holds the PER message trace handler
Property Documentation
virtual Asn1PerTraceHandler TraceHandler [get] |
Gets a reference to the internal trace handler object used to trace the bit fields within a PER message.
Value:
Asn1PerTraceHandler object
Implements Asn1PerMessageBuffer.