ASN1C C# Runtime Library  7.6
Public Member Functions | Properties | List of all members
Asn1DecodeBitBuffer Class Reference
Inheritance diagram for Asn1DecodeBitBuffer:
Asn1DecodeBuffer Asn1MessageBuffer Asn1MessageBufferBase Asn1OerDecodeBuffer Asn1PerDecodeBuffer Asn1PerInputStream

Public Member Functions

 Asn1DecodeBitBuffer (byte[] msgdata)
 
 Asn1DecodeBitBuffer (System.IO.Stream istream)
 
virtual void ByteAlign ()
 
virtual bool DecodeBit ()
 
virtual int DecodeBitsToInt (int nbits)
 
virtual long DecodeBitsToLong (int nbits)
 
virtual void DecodeBitsToOctetArray (byte[] data, int offset, int nbits)
 
virtual void DecodeBitsToOctetArray (byte[] data, int offset, int bitOffset, int nbits)
 
void MoveBitCursor (long offset)
 
sealed override int ReadByte ()
 
sealed override void SetInputStream (byte[] msgdata, int offset, int length)
 
- Public Member Functions inherited from Asn1DecodeBuffer
virtual void AddCaptureBuffer (System.IO.MemoryStream buffer)
 
virtual void Capture (int nbytes)
 
virtual long DecodeIntValue (int length, bool signExtend)
 
virtual int [] DecodeOIDContents (int llen)
 
virtual int [] DecodeRelOIDContents (int llen)
 
override System.IO.Stream GetInputStream ()
 
virtual void HexDump ()
 
virtual void Mark ()
 
virtual void MarkPos (ref BufferPos bufferPos)
 
virtual int Read ()
 
virtual void Read (byte[] buffer, int offset, int nbytes)
 
virtual void Read (byte[] buffer)
 
int Read2Bytes ()
 
int Read4Bytes ()
 
virtual void RemoveCaptureBuffer (System.IO.MemoryStream buffer)
 
virtual void Reset ()
 
virtual void ResetPos (ref BufferPos bufferPos)
 
virtual long Skip (long nbytes)
 
- Public Member Functions inherited from Asn1MessageBuffer
virtual void AddNamedEventHandler (Asn1NamedEventHandler handler)
 
virtual void InvokeCharacters (System.String svalue)
 
virtual void InvokeEndElement (System.String name, int index)
 
virtual void InvokeStartElement (System.String name, int index)
 
- Public Member Functions inherited from Asn1MessageBufferBase
void SetKey (byte[] rtkey)
 
void SetPermanentKey (byte[] rtkey)
 

Properties

virtual long BitOffset [get]
 
virtual int MsgBitCnt [get]
 
- Properties inherited from Asn1DecodeBuffer
virtual int ByteCount [get]
 
bool LazyOpenTypeDecode [get, set]
 
- Properties inherited from Asn1MessageBuffer
virtual Asn1MessageBuffer EventHandlerList [set]
 
- Properties inherited from Asn1MessageBufferBase
Asn1Context Context [get]
 
virtual short TypeCode [set]
 

Additional Inherited Members

- Static Public Member Functions inherited from Asn1MessageBufferBase
static void HexDump (System.IO.Stream ins, System.IO.StreamWriter outs)
 
static void HexDump (System.IO.Stream ins)
 

Detailed Description

This class handles decoding where the decode buffer is viewed as a set of bits (i.e. a bit offset is maintained).

Constructor & Destructor Documentation

◆ Asn1DecodeBitBuffer() [1/2]

Asn1DecodeBitBuffer ( byte []  msgdata)

This constructor creates a Decode buffer object that references an encoded ASN.1 message.

Parameters
msgdataByte array containing an encoded ASN.1 message.

◆ Asn1DecodeBitBuffer() [2/2]

Asn1DecodeBitBuffer ( System.IO.Stream  istream)

This constructor creates a Decode buffer object that references an encoded ASN.1 message. In this case, the message is passed in using an System.IO.Stream object.

Parameters
istreamInput stream containing an encoded ASN.1 message.

Member Function Documentation

◆ ByteAlign()

virtual void ByteAlign ( )
virtual

This methods byte-aligns the buffer.

Reimplemented in Asn1PerDecodeBuffer.

◆ DecodeBit()

virtual bool DecodeBit ( )
virtual

This method decodes a single bit value.

Returns
Boolean value of bit that was decoded.

Reimplemented in Asn1PerDecodeBuffer.

Referenced by Asn1TimeUtil.ConvertToDER().

◆ DecodeBitsToInt()

virtual int DecodeBitsToInt ( int  nbits)
virtual

This method decodes bits from the input stream into a standard integer value. Up to 32 bits can be decoded. The bits are placed in the least-significant bytes of the integer.

Parameters
nbitsNumber of bits to Decode
Returns
Integer value containing decoded bits

Reimplemented in Asn1PerDecodeBuffer.

Referenced by Asn1BigInteger.DecodeUnsigned(), and Asn1Boolean.Encode().

◆ DecodeBitsToLong()

virtual long DecodeBitsToLong ( int  nbits)
virtual

This method decodes bits from the input stream into a long integer value. Up to 64 bits can be decoded. The bits are placed in the least-significant bytes of the long integer.

Returns
Long integer value containing decoded bits
Parameters
nbitsNumber of bits to Decode

Reimplemented in Asn1PerDecodeBuffer.

References Diag.Prtln(), Asn1Util.ToHexString(), and Asn1Util.URShift().

◆ DecodeBitsToOctetArray() [1/2]

virtual void DecodeBitsToOctetArray ( byte []  data,
int  offset,
int  nbits 
)
virtual

This method decodes bits from the input stream into an array of octets. The user is expected to have provided an array large enough to hold the number of bits requested to be decoded.

Parameters
dataOctet array for decoded data
offsetStarting byte offset into array
nbitsNumber of bits to Decode

Reimplemented in Asn1PerDecodeBuffer.

Referenced by Asn1Real.DecodeDouble(), Asn1BigInteger.DecodeSigned(), Asn1Real.DecodeSingle(), and Asn1BigInteger.DecodeUnsigned().

◆ DecodeBitsToOctetArray() [2/2]

virtual void DecodeBitsToOctetArray ( byte []  data,
int  offset,
int  bitOffset,
int  nbits 
)
virtual

This method decodes bits from the input stream into an array of octets. The user is expected to have provided an array large enough to hold the number of bits requested to be decoded.

The first bit is decoded into the given offset byte at the MSB if bitOffset == 0, and at the LSB if bitOffset == 7.

Parameters
dataOctet array for decoded data
offsetStarting byte offset into array
bitOffsetWhere in first byte the first bit goes
nbitsNumber of bits to Decode

References Diag.Prtln(), and Asn1Util.ToHexString().

◆ MoveBitCursor()

void MoveBitCursor ( long  offset)

This method moves the bit cursor to the given offset.

Parameters
offsetAbsolute bit offset value

◆ ReadByte()

sealed override int ReadByte ( )
virtual

This method returns the next available 8-bit value from the input stream. It is implemented differently for BER/DER and PER to take into account odd alignments in PER.

Returns
Next 8-bit byte value from input stream

Implements Asn1DecodeBuffer.

Referenced by Asn1Real10.Encode(), and Asn1CharString.validate().

◆ SetInputStream()

sealed override void SetInputStream ( byte []  msgdata,
int  offset,
int  length 
)
virtual

This method will set the input stream from which data is read. This version of the method allows a byte array containing encoded data to be specified.

Parameters
msgdataByte array containing encoded message data
offsetStarting offset of data in the byte array
lengthLength (in bytes) of the encoded data

Reimplemented from Asn1DecodeBuffer.

Referenced by Asn1PerDecodeBuffer.SetBuffer().

Property Documentation

◆ BitOffset

virtual long BitOffset
get

Gets the absolute offset to the current bit in the Decode buffer.

Value: offset to current bit in Decode buffer

◆ MsgBitCnt

virtual int MsgBitCnt
get

Gets the number of bits in the encoded message.

Value: count of bits in encoded message