ASN1BERDecodeStream Class Reference
[C++ classes for streaming BER decoding.]
#include <ASN1BERDecodeStream.h>
Public Member Functions | |
ASN1BERDecodeStream (OSRTInputStreamIF &is) | |
ASN1BERDecodeStream (OSRTInputStreamIF *pis, OSBOOL bOwnStream=TRUE) | |
virtual void * | getAppInfo () |
virtual OSRTCtxtPtr | getContext () |
virtual OSCTXT * | getCtxtPtr () |
virtual char * | getErrorInfo () |
virtual char * | getErrorInfo (char *pBuf, size_t &bufSize) |
virtual int | getStatus () const |
virtual void | printErrorInfo () |
virtual void | resetErrorInfo () |
virtual void | setAppInfo (void *pAppInfo) |
virtual void | setDiag (OSBOOL value=TRUE) |
virtual int | close () |
virtual int | flush () |
virtual int | getPosition (size_t *ppos) |
virtual OSBOOL | isOpened () |
virtual size_t | currentPos () |
virtual OSBOOL | markSupported () |
int | mark (size_t readAheadLimit) |
virtual long | read (OSOCTET *pDestBuf, size_t maxToRead) |
virtual long | readBlocking (OSOCTET *pDestBuf, size_t toReadBytes) |
int | reset () |
virtual int | setPosition (size_t pos) |
virtual int | skip (size_t n) |
ASN1BERDecodeStream & | operator>> (ASN1CType &val) |
size_t | byteIndex () |
OSBOOL | chkend (ASN1CCB &ccb) |
int | decodeBigInt (const char *&pval, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeBitStr (OSOCTET *pbits, OSUINT32 &numbits, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeBitStr (ASN1DynBitStr &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeBMPStr (Asn116BitCharString &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeBool (OSBOOL &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeCharStr (const char *&pval, ASN1TagType tagging=ASN1EXPL, ASN1TAG tag=0, int length=0) |
int | decodeEnum (OSINT32 &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeEoc () |
int | decodeInt (OSINT32 &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeInt8 (OSINT8 &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeInt16 (OSINT16 &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeInt64 (OSINT64 &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeLength (OSINT32 &length) |
int | decodeNull (ASN1TagType tagging=ASN1EXPL) |
int | decodeObj (ASN1CType &val) |
int | decodeObjId (ASN1OBJID &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeObjId64 (ASN1OID64 &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeOctStr (OSOCTET *pocts, OSUINT32 &numocts, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeOctStr (ASN1DynOctStr &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeOpenType (ASN1OpenType &val) |
int | decodeReal (OSREAL &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeRelativeOID (ASN1OBJID &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeTag (ASN1TAG &tag) |
int | decodeTagAndLen (ASN1TAG &tag, OSINT32 &len) |
int | decodeUInt (OSUINT32 &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeUInt8 (OSUINT8 &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeUInt16 (OSUINT16 &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeUInt64 (OSUINT64 &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | decodeUnivStr (Asn132BitCharString &val, ASN1TagType tagging=ASN1EXPL, int length=0) |
int | getTLVLength () |
OSBOOL | isA (int bufferType) |
int | peekTagAndLen (ASN1TAG &tag, int &len) |
int | readTLV (OSOCTET *pDestBuf, size_t bufsiz) |
Protected Attributes | |
OSRTInputStreamIF * | mpStream |
OSBOOL | mbOwnStream |
Detailed Description
This class is a base class for other ASN.1 BER input stream's classes. It is derived from the ASN1Stream base class. It contains variables and methods specific to streaming decoding of BER messages. It is used to manage the input stream containing the ASN.1 message to be decoded.
Constructor & Destructor Documentation
ASN1BERDecodeStream::ASN1BERDecodeStream | ( | OSRTInputStreamIF & | is | ) |
A default constructor. Use getStatus() method to determine if an error occured during the initialization or not.
Member Function Documentation
size_t ASN1BERDecodeStream::byteIndex | ( | ) |
This method returns the total number of octets (bytes) already decoded from the stream.
- Returns:
- Number of octets (bytes) already decoded from the stream.
OSBOOL ASN1BERDecodeStream::chkend | ( | ASN1CCB & | ccb | ) |
This method determines if the decoder has reached the end of a message context block. This method could be called when decoding a SET or SEQUENCE OF/SET OF construct.
- Parameters:
-
ccb Reference to a 'context control block' structure. This is basically a loop control mechanism to keep the variable associated with parsing a nested constructed element straight.
- Returns:
- Boolean value indicating whether or not the end-of-context has been reached.
virtual int ASN1BERDecodeStream::close | ( | ) | [inline, virtual] |
Closes the input or output stream and releases any system resources associated with the stream. For output streams this function also flushes all internal buffers to the stream.
- Returns:
- Completion status of operation:
- 0 = success,
- negative return value is error.
- See also:
- rtxStreamClose
virtual size_t ASN1BERDecodeStream::currentPos | ( | ) | [inline, virtual] |
This method returns the current position in the stream (in octets).
- Returns:
- The number of octets already read from the stream.
int ASN1BERDecodeStream::decodeBigInt | ( | const char *& | pval, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a variable of the ASN.1 INTEGER type. In this case, the integer is assumed to be of a larger size than can fit in a C or C++ long type (normally 32 or 64 bits).
- Parameters:
-
pval Reference to a pointer to a variable to receive a decoded big integer value. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmBigInt
int ASN1BERDecodeStream::decodeBitStr | ( | ASN1DynBitStr & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a variable of the ASN.1 BIT STRING type. It will allocate dynamic memory to store the decoded result.
- Parameters:
-
val Reference to an ASN1DynBitStr variable to receive the decoded bit string. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmDynBitStr
int ASN1BERDecodeStream::decodeBitStr | ( | OSOCTET * | pbits, | |
OSUINT32 & | numbits, | |||
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a variable of the ASN.1 BIT STRING type into a static memory structure. It is used to decode a sized bit string production.
- Parameters:
-
pbits Pointer to a variable to receive the decoded bit string. This is assumed to be a static array large enough to hold the number of bits specified in the numbits input parameter. numbits As input parameter it is a reference to an integer variable containing the size (in bits) of the sized ASN.1 bit string. An error will occur if the number of bits in the decoded string is larger than this value. Note that this is also used as an output variable - the actual number of decoded bits will be returned in this variable. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmBitStr
int ASN1BERDecodeStream::decodeBMPStr | ( | Asn116BitCharString & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a variable of the ASN.1 BMPString type.
- Parameters:
-
val Reference to a variable to receive the decoded BMPString value. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmBMPStr
int ASN1BERDecodeStream::decodeBool | ( | OSBOOL & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a variable of the ASN.1 BOOLEAN type.
- Parameters:
-
val Reference to a variable to receive the decoded boolean value. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmBool
int ASN1BERDecodeStream::decodeCharStr | ( | const char *& | pval, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
ASN1TAG | tag = 0 , |
|||
int | length = 0 | |||
) |
This method decodes a variable of one of the ASN.1 8-bit character string types. These types include IA5String, VisibleString, PrintableString, and NumericString.
- Parameters:
-
pval Reference to a character string pointer variable to receive the decoded string. The string is stored as a standard null-terminated C string. Memory is allocated for the string by the rtxMemAlloc function. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. tag The ASN.1 tag to be decoded. This parameter is passed using the ASN1C internal tag representation. It is passed as an unsigned 32-bit integer. This parameter only has meaning if the tagging parameter specifies explicit decoding. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmCharStr
int ASN1BERDecodeStream::decodeEnum | ( | OSINT32 & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a variable of the ASN.1 ENUMERATED type.
- Parameters:
-
val Reference to a variable to receive the decoded enumerated value. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmEnum
int ASN1BERDecodeStream::decodeEoc | ( | ) |
This method decodes the end-of-contents octets.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmMatchEOC
int ASN1BERDecodeStream::decodeInt | ( | OSINT32 & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a variable of the ASN.1 INTEGER type.
- Parameters:
-
val Reference to a variable to receive a decoded 32-bit integer value. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmInt
int ASN1BERDecodeStream::decodeInt16 | ( | OSINT16 & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a 16-bit variable of the ASN.1 INTEGER type.
- Parameters:
-
val Reference to a variable to receive a decoded 16-bit integer value. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmInt16
int ASN1BERDecodeStream::decodeInt64 | ( | OSINT64 & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a 64-bit variable of the ASN.1 INTEGER type.
- Parameters:
-
val Reference to a variable to receive a decoded 64-bit integer value. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmInt64
int ASN1BERDecodeStream::decodeInt8 | ( | OSINT8 & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes an 8-bit variable of the ASN.1 INTEGER type.
- Parameters:
-
val Reference to a variable to receive a decoded 8-bit integer value. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmInt8
int ASN1BERDecodeStream::decodeLength | ( | OSINT32 & | length | ) |
This method decodes a BER length determinant value.
- Parameters:
-
length Reference to a variable to receive the decoded length of the tagged component. The returned value will either be the actual length or the special constant 'ASN_K_INDEFLEN', which indicates indefinite length.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmLength
int ASN1BERDecodeStream::decodeNull | ( | ASN1TagType | tagging = ASN1EXPL |
) |
This method decodes a variable of the ASN.1 NULL type.
- Parameters:
-
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmNull
int ASN1BERDecodeStream::decodeObj | ( | ASN1CType & | val | ) |
This method decodes an ASN.1 constructed object from the stream.
- Parameters:
-
val A reference to an object to be decoded.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int ASN1BERDecodeStream::decodeObjId | ( | ASN1OBJID & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a variable of the ASN.1 OBJECT IDENTIFIER type.
- Parameters:
-
val Reference to a variable to receive the decoded OBJECT IDENTIFIER value. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmObjId
int ASN1BERDecodeStream::decodeObjId64 | ( | ASN1OID64 & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a variable of the ASN.1 OBJECT IDENTIFIER type using 64-bit subidentifiers..
- Parameters:
-
val Reference to a variable to receive the decoded 64-bit OBJECT IDENTIFIER value. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmObjId64
int ASN1BERDecodeStream::decodeOctStr | ( | ASN1DynOctStr & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a variable of the ASN.1 OCTET STRING type. It will allocate dynamic memory to store the decoded result.
- Parameters:
-
val Reference to an ASN1DynOctStr variable to receive the decoded octet string. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmDynOctStr
int ASN1BERDecodeStream::decodeOctStr | ( | OSOCTET * | pocts, | |
OSUINT32 & | numocts, | |||
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a variable of the ASN.1 OCTET STRING type into a static memory structure. It is used to decode a sized octet string production.
- Parameters:
-
pocts Pointer to a variable to receive the decoded octet string. This is assumed to be a static array large enough to hold the number of octets specified in the numocts input parameter. numocts Reference to an integer variable containing the size (in octets) of the sized ASN.1 octet string. An error will occur if the number of octets in the decoded string is larger than this value. Note that this is also used as an output variable - the actual number of decoded octets will be returned in this variable. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmOctStr
int ASN1BERDecodeStream::decodeOpenType | ( | ASN1OpenType & | val | ) |
This method decodes an ASN.1 open type value. This is a value of any ASN.1 data type. It may be constructed and contain multiple elements including elements encoded with indefinite lengths. This method will allocate dynamic memory to store the decoded result.
- Parameters:
-
val Reference to an ASN1OpenType variable to receive the decoded open type data.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmDynOctStr
int ASN1BERDecodeStream::decodeReal | ( | OSREAL & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a variable of the ASN.1 REAL type.
- Parameters:
-
val Reference to a variable to receive the decoded REAL value. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmReal
int ASN1BERDecodeStream::decodeRelativeOID | ( | ASN1OBJID & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a variable of the ASN.1 RELATIVE-OID type.
- Parameters:
-
val Reference to a variable to receive the decoded RELATIVE-OID value. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmRelativeOID
int ASN1BERDecodeStream::decodeTag | ( | ASN1TAG & | tag | ) |
This method decodes the tag at the current decode pointer location and returns the results.
- Parameters:
-
tag Reference to a variable to receive the decoded ASN.1 tag value.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmTag
int ASN1BERDecodeStream::decodeTagAndLen | ( | ASN1TAG & | tag, | |
OSINT32 & | len | |||
) |
This method decodes the tag and length at the current decode pointer location and returns the results.
- Parameters:
-
tag Reference to a variable to receive the decoded ASN.1 tag value. len Reference to a variable to receive the decoded length of the tagged component. The returned value will either be the actual length or the special constant 'ASN_K_INDEFLEN', which indicates indefinite length.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmTagAndLen
int ASN1BERDecodeStream::decodeUInt | ( | OSUINT32 & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a variable of the unsigned variant of ASN.1 INTEGER type.
- Parameters:
-
val Reference to a variable to receive a decoded unsigned 32-bit integer value. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmUInt
int ASN1BERDecodeStream::decodeUInt16 | ( | OSUINT16 & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a 16-bit variable of the unsigned variant of ASN.1 INTEGER type.
- Parameters:
-
val Reference to a variable to receive a decoded unsigned 16-bit integer value. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmUInt16
int ASN1BERDecodeStream::decodeUInt64 | ( | OSUINT64 & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a 64-bit variable of the unsigned variant of ASN.1 INTEGER type.
- Parameters:
-
val Reference to a variable to receive a decoded unsigned 64-bit integer value. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmUInt64
int ASN1BERDecodeStream::decodeUInt8 | ( | OSUINT8 & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes an 8-bit variable of the unsigned variant of ASN.1 INTEGER type.
- Parameters:
-
val Reference to a variable to receive a decoded unsigned 8-bit integer value. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmUInt8
int ASN1BERDecodeStream::decodeUnivStr | ( | Asn132BitCharString & | val, | |
ASN1TagType | tagging = ASN1EXPL , |
|||
int | length = 0 | |||
) |
This method decodes a variable of the ASN.1 UniversalString type.
- Parameters:
-
val Reference to a variable to receive the decoded UniversalString value. tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'. length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmUnivStr
virtual int ASN1BERDecodeStream::flush | ( | ) | [inline, virtual] |
Flushes the buffered data to the stream.
- Returns:
- Completion status of operation:
- 0 = success,
- negative return value is error.
- See also:
- rtxStreamFlush
virtual void* ASN1BERDecodeStream::getAppInfo | ( | ) | [inline, virtual] |
Returns a pointer to application-specific information block
virtual OSRTCtxtPtr ASN1BERDecodeStream::getContext | ( | ) | [inline, virtual] |
The getContext method returns the underlying context smart-pointer object.
- Returns:
- Context smart pointer object.
virtual OSCTXT* ASN1BERDecodeStream::getCtxtPtr | ( | ) | [inline, virtual] |
The getCtxtPtr method returns the underlying C runtime context. This context can be used in calls to C runtime functions.
- Returns:
- The pointer to C runtime context.
virtual char* ASN1BERDecodeStream::getErrorInfo | ( | char * | pBuf, | |
size_t & | bufSize | |||
) | [inline, virtual] |
Returns error text in a memory buffer. If buffer pointer is specified in parameters (not NULL) then error text will be copied in the passed buffer. Otherwise, this method allocates memory using the 'operator new []' function. The calling routine is responsible to free the memory by using 'operator delete []'.
- Parameters:
-
pBuf A pointer to a destination buffer to obtain the error text. If NULL, dynamic buffer will be allocated. bufSize A reference to buffer size. If pBuf is NULL it will receive the size of allocated dynamic buffer.
- Returns:
- A pointer to a buffer with error text. If pBuf is not NULL, the return pointer will be equal to it. Otherwise, returns newly allocated buffer with error text or NULL, if error.
virtual char* ASN1BERDecodeStream::getErrorInfo | ( | ) | [inline, virtual] |
Returns error text in a dynamic memory buffer. The buffer will be allocated by 'operator new []'. The calling routine is responsible to free the memory by using 'operator delete []'.
- Returns:
- A pointer to a newly allocated buffer with error text.
virtual int ASN1BERDecodeStream::getPosition | ( | size_t * | ppos | ) | [inline, virtual] |
Returns the current stream position. This may be used with the setPosition
method to reset back to an arbitrary point in the input stream.
- Parameters:
-
ppos Pointer to a variable to receive position.
- Returns:
- Completion status of operation: 0 = success, negative return value is error.
virtual int ASN1BERDecodeStream::getStatus | ( | ) | const [inline, virtual] |
This method returns the completion status of previous operation. It can be used to check completion status of constructors or methods, which do not return completion status. If error occurs, use printErrorInfo method to print out the error's description and stack trace. Method resetError can be used to reset error to continue operations after recovering from the error.
- Returns:
- Runtime status code:
- 0 (0) = success,
- negative return value is error.
int ASN1BERDecodeStream::getTLVLength | ( | ) |
Get the total length of a tag-length-value (TLV) component. This is not the length stored in the L field. It is the total length of the component which is equal to the parsed length plus the number of bytes in the tag and length fields.
- Returns:
- The total number of octets in the TLV or a negative error code.
- See also:
- berDecStrmGetTLVLength
OSBOOL ASN1BERDecodeStream::isA | ( | int | bufferType | ) |
This method matches an enumerated identifier defined in the base class. One identifier is declared for each of the derived classes.
- Parameters:
-
bufferType Enumerated identifier specifying a derived class. This type is defined as a public access type in the ASN1MessageBufferIF base interface. Possible values are: BEREncode, BERDecode, PEREncode, PERDecode, XEREncode, XERDecode, XMLEncode, XMLDecode, Stream.
- Returns:
- Boolean result of the match operation. True if this is the class corresponding to the identifier argument.
virtual OSBOOL ASN1BERDecodeStream::isOpened | ( | ) | [inline, virtual] |
Checks, is the stream opened or not.
- Returns:
- TRUE, if the stream is opened, FALSE otherwise.
- See also:
- rtxStreamIsOpened
int ASN1BERDecodeStream::mark | ( | size_t | readAheadLimit | ) | [inline] |
This method marks the current position in this input stream. A subsequent call to the ASN1BERDecodeStream::reset method repositions this stream at the last marked position so that subsequent reads re-read the same bytes. The readAheadLimit argument tells this input stream to allow that many bytes to be read before the mark position gets invalidated.
- Parameters:
-
readAheadLimit the maximum limit of bytes that can be read before the mark position becomes invalid.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- rtxStreamBufMark, rtxStreamBufReset
virtual OSBOOL ASN1BERDecodeStream::markSupported | ( | ) | [inline, virtual] |
Tests if this input stream supports the mark and reset methods. Whether or not mark and reset are supported is an invariant property of a particular input stream instance. By default, it returns FALSE.
- Returns:
- TRUE if this stream instance supports the mark and reset methods; FALSE otherwise.
- See also:
- rtxStreamIsMarkSupported
ASN1BERDecodeStream& ASN1BERDecodeStream::operator>> | ( | ASN1CType & | val | ) |
Decodes an ASN.1 constructed object from the stream. Use getStatus() method to determine if an error occured during the operation or not.
- Parameters:
-
val A reference to an object to be decoded.
- Returns:
- reference to this class to perform sequential decoding.
int ASN1BERDecodeStream::peekTagAndLen | ( | ASN1TAG & | tag, | |
int & | len | |||
) |
This method "peeks" the tag and length at the current decode pointer location and returns the results. The decode pointer location is left as it was before call to this function.
- Parameters:
-
tag Reference to a variable to receive the decoded ASN.1 tag value. len Reference to a variable to receive the decoded length of the tagged component. The returned value will either be the actual length or the special constant 'ASN_K_INDEFLEN', which indicates indefinite length.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- berDecStrmTagAndLen
virtual void ASN1BERDecodeStream::printErrorInfo | ( | ) | [inline, virtual] |
The printErrorInfo method prints information on errors contained within the context.
virtual long ASN1BERDecodeStream::read | ( | OSOCTET * | pDestBuf, | |
size_t | maxToRead | |||
) | [inline, virtual] |
Read data from the stream. This method reads up to maxToRead
bytes from the stream. It may return a value less then this if the maximum number of bytes is not available.
- Parameters:
-
pDestBuf Pointer to a buffer to receive a data. maxToRead Size of the buffer.
- Returns:
- The total number of octets read into the buffer, or negative value with error code if any error is occurred.
- See also:
- rtxStreamRead
virtual long ASN1BERDecodeStream::readBlocking | ( | OSOCTET * | pDestBuf, | |
size_t | toReadBytes | |||
) | [inline, virtual] |
Read data from the stream. This method reads maxToRead
bytes from the stream. It will block until either the bytes are available or an error occurs.
- Parameters:
-
pDestBuf Pointer to a buffer to receive a data. toReadBytes Number of bytes to be read.
- Returns:
- The total number of octets read into the buffer, or negative error code.
- See also:
- rtxStreamReadBlocking
int ASN1BERDecodeStream::readTLV | ( | OSOCTET * | pDestBuf, | |
size_t | bufsiz | |||
) |
Read a complete tag-length-value (TLV) from the decode stream into the given memory buffer.
- Parameters:
-
pDestBuf Pointer to a buffer to receive a data. bufsiz Size of the buffer.
- Returns:
- The total number of octets read into the buffer, or negative error code.
- See also:
- berDecStrmReadTLV
int ASN1BERDecodeStream::reset | ( | ) | [inline] |
Repositions this stream to the position at the time the mark method was last called on this input stream.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- rtxStreamBufMark, rtxStreamBufReset
virtual void ASN1BERDecodeStream::resetErrorInfo | ( | ) | [inline, virtual] |
The resetErrorInfo method resets information on errors contained within the context.
virtual void ASN1BERDecodeStream::setAppInfo | ( | void * | pAppInfo | ) | [inline, virtual] |
Sets the application-specific information block.
virtual void ASN1BERDecodeStream::setDiag | ( | OSBOOL | value = TRUE |
) | [inline, virtual] |
The setDiag method will turn diagnostic tracing on or off.
- Parameters:
-
value - Boolean value (default = TRUE = on)
virtual int ASN1BERDecodeStream::setPosition | ( | size_t | pos | ) | [inline, virtual] |
Sets the current stream position to the given offset.
- Parameters:
-
pos Position stream is to be reset to. This is normally obtained via a call to getPosition
, although in most cases it is a zero-based offset.
- Returns:
- Completion status of operation: 0 = success, negative return value is error.
virtual int ASN1BERDecodeStream::skip | ( | size_t | n | ) | [inline, virtual] |
Skips over and discards the specified amount of data octets from this input stream.
- Parameters:
-
n The number of octets to be skipped.
- Returns:
- Completion status of operation:
- 0 = success,
- negative return value is error.
- See also:
- rtxStreamSkip
The documentation for this class was generated from the following file: