asn1BerCppTypes.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00034
00039 #ifndef _ASN1BERCPPTYPES_H_
00040 #define _ASN1BERCPPTYPES_H_
00041
00042 #include "rtsrc/asn1CppTypes.h"
00043 #include "rtbersrc/asn1ber.h"
00044 #include "rtxsrc/rtxPrint.h"
00045
00057
00058
00068 class EXTERNBER ASN1BERMessageBuffer : public ASN1MessageBuffer {
00069 protected:
00078 ASN1BERMessageBuffer (Type bufferType) : ASN1MessageBuffer(bufferType) {}
00079
00080 public:
00096 inline int calcIndefLen (OSOCTET* buf_p, int bufSize = INT_MAX) {
00097 return xd_indeflen_ex (buf_p, bufSize);
00098 }
00099
00110 inline void binDump () {
00111 int stat = xu_dump ((OSOCTET*)getMsgPtr(), 0, 0);
00112 if (stat != 0) setStatus (stat);
00113 }
00114
00125 inline void hexDump (int numocts) {
00126 rtxHexDump (getMsgPtr(), numocts);
00127 }
00128
00129
00130 inline int CalcIndefLen (OSOCTET* buf_p) { return calcIndefLen(buf_p); }
00131 inline void BinDump () { binDump(); }
00132 inline void HexDump (int numocts) { hexDump (numocts); }
00133 } ;
00134
00135
00142 class EXTERNBER ASN1BEREncodeBuffer : public ASN1BERMessageBuffer {
00143 public:
00149 ASN1BEREncodeBuffer ();
00150
00160 ASN1BEREncodeBuffer (OSOCTET* pMsgBuf, size_t msgBufLen);
00161
00177 virtual OSOCTET* getMsgCopy ();
00178
00189 virtual const OSOCTET* getMsgPtr ();
00190
00208 int init ();
00209
00219 virtual OSBOOL isA (int bufferType) {
00220 return bufferType == BEREncode;
00221 }
00222
00240 int setBuffer (OSOCTET* pMsgBuf, size_t msgBufLen);
00241
00247 ASN1BEREncodeBuffer& operator << (ASN1CType& val);
00248 } ;
00249
00250
00251
00259 class EXTERNBER ASN1BERDecodeBuffer : public ASN1BERMessageBuffer {
00260 protected:
00261 const OSOCTET* mpMsgBuf;
00262 size_t mMsgBufLen;
00263 OSBOOL mBufSetFlag;
00264
00265 public:
00270 ASN1BERDecodeBuffer ();
00271
00288 ASN1BERDecodeBuffer (const OSOCTET* pMsgBuf, size_t msgBufLen);
00289
00313 OSOCTET* findElement
00314 (ASN1TAG tag, OSINT32& elemLen, OSBOOL firstFlag = TRUE);
00315
00322 virtual const OSOCTET* getMsgPtr() {
00323
00324
00325 return mpMsgBuf;
00326 }
00327
00335 int init ();
00336
00346 virtual OSBOOL isA (int bufferType) {
00347 return bufferType == BERDecode;
00348 }
00368 inline int parseTagLen (ASN1TAG& tag, int& msglen) {
00369 mBufSetFlag = TRUE;
00370 return xd_setp (mpContext->getPtr(),
00371 mpMsgBuf, (int)mMsgBufLen, &tag, &msglen);
00372 }
00373
00384 int readBinaryFile (const char* filePath);
00385
00397 int setBuffer (const OSOCTET* pMsgBuf, size_t msgBufLen);
00398
00399
00400 inline OSOCTET* FindElement (ASN1TAG tag, int& elemLen,
00401 int firstFlag = 1) {
00402 return findElement (tag, elemLen, firstFlag);
00403 }
00404 inline int ParseTagLen (ASN1TAG& tag, int& msglen) {
00405 return parseTagLen (tag, msglen);
00406 }
00407
00413 ASN1BERDecodeBuffer& operator >> (ASN1CType& val);
00414 } ;
00415
00423 #endif