00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00030 #ifndef _ASN1BERDECODESTREAM_H_
00031 #define _ASN1BERDECODESTREAM_H_
00032
00033 #include "rtsrc/asn1CppTypes.h"
00034 #include "rtxsrc/OSRTInputStreamIF.h"
00035 #include "rtbersrc/asn1berStream.h"
00036
00049 class EXTERNBER ASN1BERDecodeStream : public ASN1MessageBuffer
00050 {
00051 protected:
00052 OSRTInputStreamIF* mpStream;
00053 OSBOOL mbOwnStream;
00054
00055 public:
00060 ASN1BERDecodeStream (OSRTInputStreamIF& is);
00061
00062 ASN1BERDecodeStream (OSRTInputStreamIF* pis, OSBOOL bOwnStream = TRUE);
00063
00064 ~ASN1BERDecodeStream ();
00065
00069 virtual void* getAppInfo () { return ASN1MessageBuffer::getAppInfo (); }
00070
00077 virtual OSRTCtxtPtr getContext () {
00078 return ASN1MessageBuffer::getContext ();
00079 }
00080
00087 virtual OSCTXT* getCtxtPtr () { return ASN1MessageBuffer::getCtxtPtr (); }
00088
00096 virtual char* getErrorInfo () { return ASN1MessageBuffer::getErrorInfo (); }
00097
00114 virtual char* getErrorInfo (char* pBuf, size_t& bufSize) {
00115 return ASN1MessageBuffer::getErrorInfo (pBuf, bufSize);
00116 }
00117
00131 virtual int getStatus () const { return ASN1MessageBuffer::getStatus (); }
00132
00137 virtual void printErrorInfo () { ASN1MessageBuffer::printErrorInfo (); }
00138
00143 virtual void resetErrorInfo () { ASN1MessageBuffer::resetErrorInfo (); }
00144
00148 virtual void setAppInfo (void* pAppInfo) {
00149 ASN1MessageBuffer::setAppInfo (pAppInfo);
00150 }
00151
00157 virtual void setDiag (OSBOOL value=TRUE) {
00158 ASN1MessageBuffer::setDiag (value);
00159 }
00160
00161
00172 virtual int close () { return mpStream->close (); }
00173
00182 virtual int flush () { return mpStream->flush (); }
00183
00189 virtual OSBOOL isOpened () { return mpStream->isOpened (); }
00190
00196 virtual size_t currentPos () { return mpStream->currentPos (); }
00197
00207 virtual OSBOOL markSupported () {
00208 return TRUE;
00209 }
00210
00226 int mark (size_t readAheadLimit) {
00227 return mpStream->mark (readAheadLimit);
00228 }
00229
00242 virtual long read (OSOCTET* pDestBuf, size_t maxToRead) {
00243 return mpStream->read (pDestBuf, maxToRead);
00244 }
00245
00257 virtual long readBlocking (OSOCTET* pDestBuf, size_t toReadBytes) {
00258 return mpStream->readBlocking (pDestBuf, toReadBytes);
00259 }
00260
00270 int reset () { return mpStream->reset (); }
00271
00282 virtual int skip (size_t n) { return mpStream->skip (n); }
00283
00293 ASN1BERDecodeStream& operator >> (ASN1CType& val);
00294
00302 size_t byteIndex ();
00303
00316 OSBOOL chkend (ASN1CCB& ccb);
00317
00343 int decodeBigInt (const char*& pval, ASN1TagType tagging = ASN1EXPL,
00344 int length = 0);
00345
00383 int decodeBitStr (OSOCTET* pbits, OSUINT32& numbits,
00384 ASN1TagType tagging = ASN1EXPL, int length = 0);
00385
00410 int decodeBitStr (ASN1DynBitStr& val, ASN1TagType tagging = ASN1EXPL,
00411 int length = 0);
00412
00436 int decodeBMPStr (Asn116BitCharString& val, ASN1TagType tagging = ASN1EXPL,
00437 int length = 0);
00438
00462 int decodeBool (OSBOOL& val, ASN1TagType tagging = ASN1EXPL,
00463 int length = 0);
00464
00501 int decodeCharStr (const char*& pval, ASN1TagType tagging = ASN1EXPL,
00502 ASN1TAG tag = 0, int length = 0);
00503
00527 int decodeEnum (OSINT32& val, ASN1TagType tagging = ASN1EXPL,
00528 int length = 0);
00529
00538 int decodeEoc ();
00539
00563 int decodeInt (OSINT32& val, ASN1TagType tagging = ASN1EXPL,
00564 int length = 0);
00565
00589 int decodeInt8 (OSINT8& val, ASN1TagType tagging = ASN1EXPL,
00590 int length = 0);
00591
00615 int decodeInt16 (OSINT16& val, ASN1TagType tagging = ASN1EXPL,
00616 int length = 0);
00617
00641 int decodeInt64 (OSINT64& val, ASN1TagType tagging = ASN1EXPL,
00642 int length = 0);
00643
00658 int decodeLength (OSINT32& length);
00659
00675 int decodeNull (ASN1TagType tagging = ASN1EXPL);
00676
00685 int decodeObj (ASN1CType& val);
00686
00710 int decodeObjId (ASN1OBJID& val, ASN1TagType tagging = ASN1EXPL,
00711 int length = 0);
00712
00738 int decodeObjId64 (ASN1OID64& val, ASN1TagType tagging = ASN1EXPL,
00739 int length = 0);
00740
00778 int decodeOctStr (OSOCTET* pocts, OSUINT32& numocts,
00779 ASN1TagType tagging = ASN1EXPL, int length = 0);
00780
00805 int decodeOctStr (ASN1DynOctStr& val, ASN1TagType tagging = ASN1EXPL,
00806 int length = 0);
00807
00821 int decodeOpenType (ASN1OpenType& val);
00822
00846 int decodeReal (OSREAL& val, ASN1TagType tagging = ASN1EXPL,
00847 int length = 0);
00848
00872 int decodeRelativeOID (ASN1OBJID& val, ASN1TagType tagging = ASN1EXPL,
00873 int length = 0);
00874
00886 int decodeTag (ASN1TAG& tag);
00887
00905 int decodeTagAndLen (ASN1TAG& tag, OSINT32& len);
00906
00931 int decodeUInt (OSUINT32& val, ASN1TagType tagging = ASN1EXPL,
00932 int length = 0);
00933
00958 int decodeUInt8 (OSUINT8& val, ASN1TagType tagging = ASN1EXPL,
00959 int length = 0);
00960
00985 int decodeUInt16 (OSUINT16& val, ASN1TagType tagging = ASN1EXPL,
00986 int length = 0);
00987
01012 int decodeUInt64 (OSUINT64& val, ASN1TagType tagging = ASN1EXPL,
01013 int length = 0);
01014
01038 int decodeUnivStr (Asn132BitCharString& val,
01039 ASN1TagType tagging = ASN1EXPL,
01040 int length = 0);
01041
01052 int getTLVLength ();
01053
01068 OSBOOL isA (int bufferType);
01069
01088 int peekTagAndLen (ASN1TAG& tag, int& len);
01089
01100 int readTLV (OSOCTET* pDestBuf, size_t bufsiz);
01101
01102 } ;
01103
01106 #endif
01107