Asn1DecodeBuffer Class Reference

Inheritance diagram for Asn1DecodeBuffer:
Asn1MessageBuffer Asn1BerDecodeBuffer Asn1MderDecodeBuffer Asn1PerDecodeBuffer Asn1BerInputStream Asn1DerDecodeBuffer Asn1PerInputStream Asn1CerInputStream Asn1DerInputStream

List of all members.

Public Member Functions

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 Read (byte[] buffer)
virtual void Read (byte[] buffer, int offset, int nbytes)
virtual int Read ()
int Read2Bytes ()
int Read4Bytes ()
abstract int ReadByte ()
virtual void RemoveCaptureBuffer (System.IO.MemoryStream buffer)
virtual void Reset ()
virtual void SetInputStream (byte[] msgdata, int offset, int length)
virtual long Skip (long nbytes)

Protected Member Functions

virtual internal void Init ()

Protected Attributes

internal int mByteCount

Properties

virtual int ByteCount [get]
bool LazyOpenTypeDecode [get, set]

Detailed Description

This is the base class to specific Decode buffer classes for the different types of encoding rules (BER, DER and PER).


Member Function Documentation

virtual void AddCaptureBuffer ( System.IO.MemoryStream  buffer  )  [virtual]

This method is used to add a capture buffer to the internal capture buffer list. A capture buffer is used to capture all bytes read from this position forward from the input stream.

Parameters:
buffer Buffer into which captured bytes are to be stored
virtual void Capture ( int  nbytes  )  [virtual]

This method captures bytes from the input stream to a separate object for later analysis.

Parameters:
nbytes Number of bytes to capture
virtual long DecodeIntValue ( int  length,
bool  signExtend 
) [virtual]

This method decodes the contents of an ASN.1 integer value. It can be used for either BER or PER decoding.

Parameters:
length Length of encoded contents
signExtend Sign-extend the decoded value to form a 2's comp result
Returns:
Decoded long integer value
virtual int [] DecodeOIDContents ( int  llen  )  [virtual]

This method decodes the contents of an ASN.1 object identifier value. It can be used for either BER or PER decoding.

Parameters:
llen Length of encoded contents
Returns:
Decoded object identifier value
virtual int [] DecodeRelOIDContents ( int  llen  )  [virtual]

This method decodes the contents of an ASN.1 relative object identifier value. It can be used for either BER or PER decoding.

Parameters:
llen Length of encoded contents
Returns:
Decoded object identifier value
override System.IO.Stream GetInputStream (  )  [virtual]

This method returns a reference to the current current Decode input stream object.

Returns:
New input stream object containing encoded message

Implements Asn1MessageBuffer.

virtual void HexDump (  )  [virtual]

This method provides a hex dump of the bytes in the message being decoded.

virtual internal void Init (  )  [protected, virtual]

This method initializes the input stream for decoding.

virtual void Mark (  )  [virtual]

This method is used to mark the current position in the input stream for retry processing.

Reimplemented in Asn1BerInputStream, Asn1DerInputStream, and Asn1PerInputStream.

virtual void Read ( byte[]  buffer  )  [virtual]

This version of the read method reads the number of bytes equal to the length of the given input buffer.

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

Parameters:
buffer the buffer into which the data is read
Exceptions:
Asn1EndOfBufferException Thrown if at end-of-stream
virtual void Read ( byte[]  buffer,
int  offset,
int  nbytes 
) [virtual]

This version of the read method reads the given number of bytes from the current input stream and writes them to the specified byte array at the given offset. It also writes the data to all registered capture buffers.

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

Parameters:
buffer the buffer into which the data is read
offset the start offset of the data
nbytes number of bytes to read
Exceptions:
Asn1EndOfBufferException Thrown if at end-of-stream
virtual int Read (  )  [virtual]

The read method reads a single byte from the current input stream and returns it to the caller. It will also write the byte out to all registered capture buffers.

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

Returns:
byte that was read from the input stream
Exceptions:
Asn1EndOfBufferException Thrown if at end-of-stream
int Read2Bytes (  ) 

Read the next two bytes from the current input stream into an int, and return that int. The bytes of the int, from lowest to highest, will correspond to the bytes read from the stream, from last to first. The highest two bytes will be 0.

Each byte read will be written to all registered capture buffers.

Returns:
an int representing the 2 bytes read, as described above.
Exceptions:
Asn1EndOfBufferException if at end-of-stream
int Read4Bytes (  ) 

Read the next four bytes from the current input stream into an int, and return that int. The bytes of the int, from lowest to highest, will correspond to the bytes read from the stream, from last to first.

Each byte read will be written to all registered capture buffers.

Returns:
an int representing the 4 bytes read, as described above.
Exceptions:
Asn1EndOfBufferException if at end-of-stream
abstract int ReadByte (  )  [pure virtual]

This abstract 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

Implemented in Asn1BerDecodeBuffer, Asn1MderDecodeBuffer, and Asn1PerDecodeBuffer.

virtual void RemoveCaptureBuffer ( System.IO.MemoryStream  buffer  )  [virtual]

This method is used to remove a capture buffer from the internal capture buffer list. The add and remove methods can be used to get a set of raw bytes from the input stream for further processing.

Parameters:
buffer Buffer in which captured bytes stored
virtual void Reset (  )  [virtual]

This method is used to reset the current position in the decode buffer back to the location of the last 'mark' call.

Reimplemented in Asn1BerInputStream, Asn1DerInputStream, and Asn1PerInputStream.

virtual 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:
msgdata Byte array containing encoded message data
offset Starting offset of data in the byte array
length Length (in bytes) of the encoded data

Reimplemented in Asn1PerDecodeBuffer.

virtual long Skip ( long  nbytes  )  [virtual]

This method will skip over the requested number of bytes in the input stream.

Parameters:
nbytes Number of bytes to skip
Returns:
Skipped number of bytes

Reimplemented in Asn1BerInputStream, Asn1DerInputStream, and Asn1PerInputStream.


Member Data Documentation

internal int mByteCount [protected]

This member variable holds the count of bytes currently read from the message being decoded or input stream.


Property Documentation

virtual int ByteCount [get]

Gets the count of bytes currently read from the message being decoded or input stream.

bool LazyOpenTypeDecode [get, set]

Lazy open type decoding. This property is relevant only when generating table constraint code (otherwise, open types cannot be decoded). Generated decode methods check this property to determine whether to decode open types or not. When lazy open type decoding is turned on, you can use the generated decodeOpenType* methods to decode open types (again, assuming table constraint code was generated).