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
00193 virtual int getPosition (size_t* ppos) {
00194 return mpStream->getPosition (ppos);
00195 }
00196
00202 virtual OSBOOL isOpened () { return mpStream->isOpened (); }
00203
00209 virtual size_t currentPos () { return mpStream->currentPos (); }
00210
00220 virtual OSBOOL markSupported () {
00221 return TRUE;
00222 }
00223
00239 int mark (size_t readAheadLimit) {
00240 return mpStream->mark (readAheadLimit);
00241 }
00242
00255 virtual long read (OSOCTET* pDestBuf, size_t maxToRead) {
00256 return mpStream->read (pDestBuf, maxToRead);
00257 }
00258
00270 virtual long readBlocking (OSOCTET* pDestBuf, size_t toReadBytes) {
00271 return mpStream->readBlocking (pDestBuf, toReadBytes);
00272 }
00273
00283 int reset () { return mpStream->reset (); }
00284
00295 virtual int setPosition (size_t pos) {
00296 return mpStream->setPosition (pos);
00297 }
00298
00309 virtual int skip (size_t n) { return mpStream->skip (n); }
00310
00320 ASN1BERDecodeStream& operator >> (ASN1CType& val);
00321
00329 size_t byteIndex ();
00330
00343 OSBOOL chkend (ASN1CCB& ccb);
00344
00370 int decodeBigInt (const char*& pval, ASN1TagType tagging = ASN1EXPL,
00371 int length = 0);
00372
00410 int decodeBitStr (OSOCTET* pbits, OSUINT32& numbits,
00411 ASN1TagType tagging = ASN1EXPL, int length = 0);
00412
00437 int decodeBitStr (ASN1DynBitStr& val, ASN1TagType tagging = ASN1EXPL,
00438 int length = 0);
00439
00463 int decodeBMPStr (Asn116BitCharString& val, ASN1TagType tagging = ASN1EXPL,
00464 int length = 0);
00465
00489 int decodeBool (OSBOOL& val, ASN1TagType tagging = ASN1EXPL,
00490 int length = 0);
00491
00528 int decodeCharStr (const char*& pval, ASN1TagType tagging = ASN1EXPL,
00529 ASN1TAG tag = 0, int length = 0);
00530
00554 int decodeEnum (OSINT32& val, ASN1TagType tagging = ASN1EXPL,
00555 int length = 0);
00556
00565 int decodeEoc ();
00566
00590 int decodeInt (OSINT32& val, ASN1TagType tagging = ASN1EXPL,
00591 int length = 0);
00592
00616 int decodeInt8 (OSINT8& val, ASN1TagType tagging = ASN1EXPL,
00617 int length = 0);
00618
00642 int decodeInt16 (OSINT16& val, ASN1TagType tagging = ASN1EXPL,
00643 int length = 0);
00644
00668 int decodeInt64 (OSINT64& val, ASN1TagType tagging = ASN1EXPL,
00669 int length = 0);
00670
00685 int decodeLength (OSINT32& length);
00686
00702 int decodeNull (ASN1TagType tagging = ASN1EXPL);
00703
00712 int decodeObj (ASN1CType& val);
00713
00737 int decodeObjId (ASN1OBJID& val, ASN1TagType tagging = ASN1EXPL,
00738 int length = 0);
00739
00765 int decodeObjId64 (ASN1OID64& val, ASN1TagType tagging = ASN1EXPL,
00766 int length = 0);
00767
00805 int decodeOctStr (OSOCTET* pocts, OSUINT32& numocts,
00806 ASN1TagType tagging = ASN1EXPL, int length = 0);
00807
00832 int decodeOctStr (ASN1DynOctStr& val, ASN1TagType tagging = ASN1EXPL,
00833 int length = 0);
00834
00848 int decodeOpenType (ASN1OpenType& val);
00849
00873 int decodeReal (OSREAL& val, ASN1TagType tagging = ASN1EXPL,
00874 int length = 0);
00875
00899 int decodeRelativeOID (ASN1OBJID& val, ASN1TagType tagging = ASN1EXPL,
00900 int length = 0);
00901
00913 int decodeTag (ASN1TAG& tag);
00914
00932 int decodeTagAndLen (ASN1TAG& tag, OSINT32& len);
00933
00958 int decodeUInt (OSUINT32& val, ASN1TagType tagging = ASN1EXPL,
00959 int length = 0);
00960
00985 int decodeUInt8 (OSUINT8& val, ASN1TagType tagging = ASN1EXPL,
00986 int length = 0);
00987
01012 int decodeUInt16 (OSUINT16& val, ASN1TagType tagging = ASN1EXPL,
01013 int length = 0);
01014
01039 int decodeUInt64 (OSUINT64& val, ASN1TagType tagging = ASN1EXPL,
01040 int length = 0);
01041
01065 int decodeUnivStr (Asn132BitCharString& val,
01066 ASN1TagType tagging = ASN1EXPL,
01067 int length = 0);
01068
01079 int getTLVLength ();
01080
01095 OSBOOL isA (int bufferType);
01096
01115 int peekTagAndLen (ASN1TAG& tag, int& len);
01116
01127 int readTLV (OSOCTET* pDestBuf, size_t bufsiz);
01128
01129 } ;
01130
01133 #endif
01134