Asn1DecodeBuffer Class Reference

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

List of all members.

Public Member Functions

virtual void AddCaptureBuffer (System.IO.MemoryStream buffer)
virtual void AddNamedEventHandler (Asn1NamedEventHandler handler)
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 InvokeCharacters (System.String svalue)
virtual void InvokeEndElement (System.String name, int index)
virtual void InvokeStartElement (System.String name, int index)
virtual void Mark ()
virtual void Read (byte[] buffer)
virtual void Read (byte[] buffer, int offset, int nbytes)
virtual int Read ()
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]
virtual Asn1DecodeBuffer EventHandlerList [set]
virtual short TypeCode [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 AddNamedEventHandler ( Asn1NamedEventHandler  handler  )  [virtual]

This method adds a named event handler to the named event handler list for this buffer.

Parameters:
handler Asn1NamedEventHandler object to be added
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 InvokeCharacters ( System.String  svalue  )  [virtual]

This method is used by the event handling logic to invoke the 'characters' event handling method when message contents are parsed.

Parameters:
svalue Stringified representation of a parsed value field
virtual void InvokeEndElement ( System.String  name,
int  index 
) [virtual]

This method is used by the event handling logic to invoke the 'endElement' event handling method when parsing of an element within a message is completed.

Parameters:
name Name of the element
index Index of element if SEQUENCE OF or SET OF element
virtual void InvokeStartElement ( System.String  name,
int  index 
) [virtual]

This method is used by the event handling logic to invoke the 'StartElement' event handling method when parsing of an element within a message is started.

Parameters:
name Name of the element
index Index of element if SEQUENCE OF or SET OF element
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
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, 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.

virtual Asn1DecodeBuffer EventHandlerList [set]

Sets the event handler list in this object to be equal to that in the given Decode buffer object.

Value: Decode buffer object

virtual short TypeCode [set]

Sets the internal type code to the given value. This is a code describing the last type parsed by the decoder.

Value: Type code (codes are defined in Asn1Type.cs). The codes correspond to the UNIVERSAL tag ID values for the built-in types.