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 _ASN1BERENCODESTREAM_H_
00031 #define _ASN1BERENCODESTREAM_H_
00032
00033 #include "rtsrc/asn1CppTypes.h"
00034 #include "rtxsrc/OSRTOutputStreamIF.h"
00035 #include "rtbersrc/asn1berStream.h"
00036
00048 class EXTERNBER ASN1BEREncodeStream : public ASN1MessageBuffer
00049 {
00050 protected:
00051 OSRTOutputStreamIF* mpStream;
00052 OSBOOL mbOwnStream;
00053 public:
00058 ASN1BEREncodeStream (OSRTOutputStreamIF& os);
00059
00060 ASN1BEREncodeStream (OSRTOutputStreamIF* pos, OSBOOL bOwnStream = TRUE);
00061
00062 ~ASN1BEREncodeStream ();
00063
00067 virtual void* getAppInfo() { return ASN1MessageBuffer::getAppInfo (); }
00068
00076 virtual OSRTCtxtPtr getContext() { return ASN1MessageBuffer::getContext(); }
00077
00084 virtual OSCTXT* getCtxtPtr () { return ASN1MessageBuffer::getCtxtPtr (); }
00085
00093 virtual char* getErrorInfo () { return ASN1MessageBuffer::getErrorInfo (); }
00094
00111 virtual char* getErrorInfo (char* pBuf, size_t& bufSize) {
00112 return ASN1MessageBuffer::getErrorInfo (pBuf, bufSize);
00113 }
00114
00128 virtual int getStatus () const { return ASN1MessageBuffer::getStatus (); }
00129
00134 virtual void printErrorInfo () { ASN1MessageBuffer::printErrorInfo (); }
00135
00140 virtual void resetErrorInfo () { ASN1MessageBuffer::resetErrorInfo (); }
00141
00145 virtual void setAppInfo (void* pAppInfo) {
00146 ASN1MessageBuffer::setAppInfo (pAppInfo);
00147 }
00148
00154 virtual void setDiag (OSBOOL value=TRUE) {
00155 ASN1MessageBuffer::setDiag (value);
00156 }
00157
00158
00169 virtual int close () { return mpStream->close (); }
00170
00179 virtual int flush () { return mpStream->flush (); }
00180
00186 virtual OSBOOL isOpened () { return mpStream->isOpened (); }
00187
00199 virtual long write (const OSOCTET* pdata, size_t size) {
00200 return mpStream->write (pdata, size);
00201 }
00202
00212 ASN1BEREncodeStream& operator << (ASN1CType& val);
00213
00214
00215
00239 int encodeBMPStr
00240 (const Asn116BitCharString& val, ASN1TagType tagging = ASN1EXPL);
00241
00261 int encodeBigInt (const char *pval, ASN1TagType tagging = ASN1EXPL);
00262
00283 int encodeBigIntNchars
00284 (const char *pval, size_t nchars, ASN1TagType tagging = ASN1EXPL);
00285
00308 int encodeBitStr (const OSOCTET* pbits, OSUINT32 numbits,
00309 ASN1TagType tagging = ASN1EXPL);
00310
00329 int encodeBitStr (const ASN1DynBitStr& val, ASN1TagType tagging = ASN1EXPL);
00330
00350 int encodeBool (OSBOOL val, ASN1TagType tagging = ASN1EXPL);
00351
00374 int encodeCharStr (const char* pval, ASN1TagType tagging = ASN1EXPL,
00375 ASN1TAG tag = 0);
00376
00397 int encodeEnum (OSINT32 val, ASN1TagType tagging = ASN1EXPL);
00398
00411 int encodeEoc ();
00412
00423 int encodeIndefLen ();
00424
00441 int encodeInt (OSINT32 val, ASN1TagType tagging = ASN1EXPL);
00442
00459 int encodeInt8 (OSINT8 val, ASN1TagType tagging = ASN1EXPL);
00460
00477 int encodeInt16 (OSINT16 val, ASN1TagType tagging = ASN1EXPL);
00478
00495 int encodeInt64 (OSINT64 val, ASN1TagType tagging = ASN1EXPL);
00496
00506 int encodeLen (size_t len);
00507
00523 int encodeNull (ASN1TagType tagging = ASN1EXPL);
00524
00533 int encodeObj (ASN1CType& val);
00534
00556 int encodeObjId (const ASN1OBJID& val, ASN1TagType tagging = ASN1EXPL);
00557
00580 int encodeObjId64 (const ASN1OID64& val, ASN1TagType tagging = ASN1EXPL);
00581
00601 int encodeOctStr (const OSOCTET* pocts, OSUINT32 numocts,
00602 ASN1TagType tagging = ASN1EXPL);
00603
00622 int encodeOctStr (const ASN1DynOctStr& val, ASN1TagType tagging = ASN1EXPL);
00623
00649 int encodeReal (OSREAL val, ASN1TagType tagging = ASN1EXPL);
00650
00672 int encodeRelativeOID (const ASN1OBJID& val, ASN1TagType tagging = ASN1EXPL);
00673
00689 int encodeTag (ASN1TAG tag);
00690
00706 int encodeTagAndIndefLen (ASN1TAG tag);
00707
00728 int encodeTagAndLen (ASN1TAG tag, OSINT32 len);
00729
00746 int encodeUInt (OSUINT32 val, ASN1TagType tagging = ASN1EXPL);
00747
00765 int encodeUInt8 (OSUINT8 val, ASN1TagType tagging = ASN1EXPL);
00766
00784 int encodeUInt16 (OSUINT16 val, ASN1TagType tagging = ASN1EXPL);
00785
00803 int encodeUInt64 (OSUINT64 val, ASN1TagType tagging = ASN1EXPL);
00804
00828 int encodeUnivStr
00829 (const Asn132BitCharString& val, ASN1TagType tagging = ASN1EXPL);
00830
00845 OSBOOL isA (int bufferType);
00846 } ;
00847
00849 #endif
00850