Objective Systems, Inc.  
Home
About ASN.1
Products
Free Software
Open Source
Documents
Services
Resources
Resellers
Customers
Careers
About Us
Contact Us
 

Google


Objective Systems, Inc.

asn1BerCppTypes.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 1997-2005 by Objective Systems, Inc.
00003  *
00004  * This software is furnished under a license and may be used and copied
00005  * only in accordance with the terms of such license and with the
00006  * inclusion of the above copyright notice. This software or any other
00007  * copies thereof may not be provided or otherwise made available to any
00008  * other person. No title to and ownership of the software is hereby
00009  * transferred.
00010  *
00011  * The information in this software is subject to change without notice
00012  * and should not be construed as a commitment by Objective Systems, Inc.
00013  *
00014  * PROPRIETARY NOTICE
00015  *
00016  * This software is an unpublished work subject to a confidentiality agreement
00017  * and is protected by copyright and trade secret law.  Unauthorized copying,
00018  * redistribution or other use of this work is prohibited.
00019  *
00020  * The above notice of copyright on this source code product does not indicate
00021  * any actual or intended publication of such source code.
00022  *
00023  *****************************************************************************/
00024 //
00025 // CHANGE LOG
00026 // Date         Init    Description
00027 // 07/14/02     ED      Changed all methods to being with lowercase 
00028 //                      char for consistency.  Added deprecated inline 
00029 //                      methods for those that did not to maintain 
00030 //                      backward compatibility.
00031 // 10/30/03    CZ      Added Doxygen code.
00032 //
00034 
00039 #ifndef _ASN1BERCPPTYPES_H_
00040 #define _ASN1BERCPPTYPES_H_
00041 
00042 #include "asn1CppTypes.h"
00043 #include "asn1ber.h"
00044 
00055 // ASN.1 BER message buffer class
00056 
00066 class EXTERNBER ASN1BERMessageBuffer : public ASN1MessageBuffer {
00067  protected:
00076    ASN1BERMessageBuffer (Type bufferType) : ASN1MessageBuffer(bufferType) {}
00077 
00078  public:
00094    inline int calcIndefLen (ASN1OCTET* buf_p, int bufSize = INT_MAX) {
00095       return xd_indeflen_ex (buf_p, bufSize);
00096    }
00097 
00108    inline void binDump () { 
00109       int stat = xu_dump ((ASN1OCTET*)getMsgPtr(), 0, 0); 
00110       if (stat != ASN_OK) setStatus (stat);
00111    }
00112 
00123    inline void hexDump (int numocts) { 
00124       xu_hex_dump ((ASN1OCTET*)getMsgPtr(), numocts, TRUE); 
00125    }
00126 
00127    // deprecated methods
00128    inline int  CalcIndefLen (ASN1OCTET* buf_p) { return calcIndefLen(buf_p); }
00129    inline void BinDump () { binDump(); }
00130    inline void HexDump (int numocts) { hexDump (numocts); }
00131 } ;
00132 
00133 // ASN.1 BER encode message buffer class
00140 class EXTERNBER ASN1BEREncodeBuffer : public ASN1BERMessageBuffer {
00141  public:
00149    ASN1BEREncodeBuffer ();
00160    ASN1BEREncodeBuffer (ASN1OCTET* pMsgBuf, size_t msgBufLen);
00161 
00177    virtual ASN1OCTET* getMsgCopy ();
00178 
00189    virtual const ASN1OCTET* getMsgPtr ();
00190 
00208    int init ();
00209 
00219    virtual ASN1BOOL isA (Type bufferType) {
00220       return bufferType == BEREncode;
00221    }
00222 
00240    int setBuffer (ASN1OCTET* pMsgBuf, size_t msgBufLen);
00241 
00247    ASN1BEREncodeBuffer& operator << (ASN1CType& val); 
00248 } ;
00249 
00250 
00251 // ASN.1 BER decode message buffer class
00259 class EXTERNBER ASN1BERDecodeBuffer : public ASN1BERMessageBuffer {
00260  protected:
00261    const ASN1OCTET* mpMsgBuf;
00262    size_t mMsgBufLen;
00263    ASN1BOOL mBufSetFlag;
00264 
00265  public:
00270    ASN1BERDecodeBuffer ();
00271 
00288    ASN1BERDecodeBuffer (const ASN1OCTET* pMsgBuf, size_t msgBufLen);
00289 
00313    ASN1OCTET* findElement (ASN1TAG tag, int& elemLen, int firstFlag = 1);
00314 
00321    virtual const ASN1OCTET* getMsgPtr() {
00322       // Note: return message buffer pointer from object, not from context, 
00323       // because may not yet be set in context (ED, 9/30/04)..
00324       return mpMsgBuf;
00325    }
00326 
00334    int init ();
00335 
00345    virtual ASN1BOOL isA (Type bufferType) {
00346       return bufferType == BERDecode;
00347    }
00367    inline int parseTagLen (ASN1TAG& tag, int& msglen) {
00368       mBufSetFlag = TRUE;
00369       return xd_setp (mpContext->getPtr(), 
00370                       mpMsgBuf, (int)mMsgBufLen, &tag, &msglen);
00371    }
00372 
00383    int readBinaryFile (const char* filePath);
00384 
00396    int setBuffer (const ASN1OCTET* pMsgBuf, size_t msgBufLen);
00397 
00398    // deprecated methods
00399    inline ASN1OCTET* FindElement (ASN1TAG tag, int& elemLen, 
00400                                   int firstFlag = 1) {
00401       return findElement (tag, elemLen, firstFlag);
00402    }
00403    inline int ParseTagLen (ASN1TAG& tag, int& msglen) {
00404       return parseTagLen (tag, msglen);
00405    }
00406 
00412    ASN1BERDecodeBuffer& operator >> (ASN1CType& val); 
00413 } ;
00414 
00422 #endif

Copyright © 1997-2005 Objective Systems,Inc.
All Rights Reserved.
This document may be distributed in any form, electronic
or otherwise, provided that it is distributed in its entirety
and that the copyright and this notice are included.

This file was last modified on 8 Sep 2005.
ASN1C BER Runtime, ASN1C v5.8x