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.

ASN1BERInputStream.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 
00030 #ifndef _ASN1BERINPUTSTREAM_H_
00031 #define _ASN1BERINPUTSTREAM_H_
00032 
00033 #include "asn1berStream.h"
00034 #include "ASN1Stream.h"
00035 #include "OSCSocket.h"
00036 
00052 struct EXTERNBER OSDecStrmTag {
00053    ASN1TAG& value; 
00054 
00056    OSDecStrmTag (ASN1TAG& val) : value (val) { }
00058    OSDecStrmTag (OSDecStrmTag& val) : value (val.value) { }
00059 } ;
00060 
00064 struct EXTERNBER OSDecStrmLength {
00065    ASN1INT& value; 
00066 
00068    OSDecStrmLength (ASN1INT& val) : value (val) { }
00070    OSDecStrmLength (OSDecStrmLength& val) : value (val.value) { }
00071 } ;
00072 
00076 struct EXTERNBER OSDecStrmTagAndLen {
00077    ASN1TAG& tag; 
00078    ASN1INT& len; 
00079 
00081    OSDecStrmTagAndLen (ASN1TAG& _tag, ASN1INT& _len) : tag (_tag), len (_len) {}
00083    OSDecStrmTagAndLen (OSDecStrmTagAndLen& val) : 
00084       tag (val.tag), len (val.len) { }
00085 } ;
00086 
00090 struct EXTERNBER OSDecStrmEoc {
00092    OSDecStrmEoc () {}
00093 } ;
00094 
00095 #define OSDECSTRMEOC OSDecStrmEoc()
00096 
00100 struct EXTERNBER OSDecStrmImplInt : public OSDecStrmInt {
00101    ASN1INT len; 
00102 
00104    OSDecStrmImplInt (ASN1INT& val, ASN1INT _len) : 
00105       OSDecStrmInt (val), len (_len) { }
00106 } ;
00107 
00111 struct EXTERNBER OSDecStrmImplInt8 : public OSDecStrmInt8 {
00112    ASN1INT len; 
00113 
00115    OSDecStrmImplInt8 (ASN1INT8& val, ASN1INT _len) : 
00116       OSDecStrmInt8 (val), len (_len) { }
00117 } ;
00118 
00122 struct EXTERNBER OSDecStrmImplInt16 : public OSDecStrmInt16 {
00123    ASN1INT len; 
00124 
00126    OSDecStrmImplInt16 (ASN1SINT& val, ASN1INT _len) : 
00127       OSDecStrmInt16 (val), len (_len) { }
00128 } ;
00129 
00133 struct EXTERNBER OSDecStrmImplInt64 : public OSDecStrmInt64 {
00134    ASN1INT len; 
00135 
00137    OSDecStrmImplInt64 (ASN1INT64& val, ASN1INT _len) : 
00138       OSDecStrmInt64 (val), len (_len) { }
00139 } ;
00140 
00144 struct EXTERNBER OSDecStrmImplUInt : public OSDecStrmUInt {
00145    ASN1INT len; 
00146 
00148    OSDecStrmImplUInt (ASN1UINT& val, ASN1INT _len) : 
00149       OSDecStrmUInt (val), len (_len) { }
00150 } ;
00151 
00155 struct EXTERNBER OSDecStrmImplUInt8 : public OSDecStrmUInt8 {
00156    ASN1INT len; 
00157 
00159    OSDecStrmImplUInt8 (ASN1UINT8& val, ASN1INT _len) : 
00160       OSDecStrmUInt8 (val), len (_len) { }
00161 } ;
00162 
00166 struct EXTERNBER OSDecStrmImplUInt16 : public OSDecStrmUInt16 {
00167    ASN1INT len; 
00168 
00170    OSDecStrmImplUInt16 (ASN1USINT& val, ASN1INT _len) : 
00171       OSDecStrmUInt16 (val), len (_len) { }
00172 } ;
00173 
00177 struct EXTERNBER OSDecStrmImplUInt64 : public OSDecStrmUInt64 {
00178    ASN1INT len; 
00179 
00181    OSDecStrmImplUInt64 (ASN1UINT64& val, ASN1INT _len) : 
00182       OSDecStrmUInt64 (val), len (_len) { }
00183 } ;
00184 
00188 struct EXTERNBER OSDecStrmImplEnum : public OSDecStrmEnum {
00189    ASN1INT len; 
00190 
00192    OSDecStrmImplEnum (ASN1ENUM& val, ASN1INT _len) : 
00193       OSDecStrmEnum (val), len (_len) { }
00194 } ;
00195 
00199 struct EXTERNBER OSDecStrmImplBigInt : public OSDecStrmBigInt {
00200    ASN1INT len; 
00201 
00203    OSDecStrmImplBigInt (const char*& pval, ASN1INT _len) : 
00204       OSDecStrmBigInt (pval), len (_len) { }
00205 } ;
00206 
00210 struct EXTERNBER OSDecStrmImplReal : public OSDecStrmReal {
00211    ASN1INT len; 
00212 
00214    OSDecStrmImplReal (ASN1REAL& val, ASN1INT _len) : 
00215       OSDecStrmReal (val), len (_len) { }
00216 } ;
00217 
00221 struct EXTERNBER OSDecStrmImplBitStr : public OSDecStrmBitStr {
00222    ASN1INT len; 
00223 
00225    OSDecStrmImplBitStr (ASN1UINT _numbits, ASN1OCTET*& _data, ASN1INT _len) : 
00226       OSDecStrmBitStr (_numbits, _data), len (_len) { }
00227 } ;
00228 
00232 struct EXTERNBER OSDecStrmImplDynBitStr : public OSDecStrmDynBitStr {
00233    ASN1INT len; 
00234 
00236    OSDecStrmImplDynBitStr (ASN1DynBitStr& _bs, ASN1INT _len) : 
00237       OSDecStrmDynBitStr (_bs), len (_len) { }
00238 } ;
00239 
00243 struct EXTERNBER OSDecStrmImplOctStr : public OSDecStrmOctStr {
00244    ASN1INT len; 
00245 
00247    OSDecStrmImplOctStr (ASN1UINT _numocts, ASN1OCTET*& _data, ASN1INT _len) :
00248       OSDecStrmOctStr (_numocts, _data), len (_len) { }
00249 } ;
00250 
00254 struct EXTERNBER OSDecStrmImplDynOctStr : public OSDecStrmDynOctStr {
00255    ASN1INT len; 
00256 
00258    OSDecStrmImplDynOctStr (ASN1DynOctStr& _os, ASN1INT _len) : 
00259       OSDecStrmDynOctStr (_os), len (_len) { }
00260 
00261 } ;
00262 
00266 struct EXTERNBER OSDecStrmImplBool : public OSDecStrmBool {
00267    ASN1INT len; 
00268 
00270    OSDecStrmImplBool (ASN1BOOL& val, ASN1INT _len) : 
00271       OSDecStrmBool (val), len (_len) { }
00272 } ;
00273 
00277 struct EXTERNBER OSDecStrmImplCharStr : public OSDecStrmCharStr {
00278    ASN1INT len; 
00279 
00281    OSDecStrmImplCharStr (const char*& pval, ASN1TAG tag, ASN1INT _len) : 
00282       OSDecStrmCharStr (pval, tag), len (_len) { }
00283 } ;
00284 
00288 struct EXTERNBER OSDecStrmImplObjId : public OSDecStrmObjId {
00289    ASN1INT len; 
00290 
00292    OSDecStrmImplObjId (ASN1OBJID& oid, ASN1INT _len) : 
00293       OSDecStrmObjId (oid), len (_len) { }
00294 } ;
00295 
00299 struct EXTERNBER OSDecStrmImplRelativeOID : public OSDecStrmObjId {
00300    ASN1INT len; 
00301 
00303    OSDecStrmImplRelativeOID (ASN1OBJID& oid, ASN1INT _len) : 
00304       OSDecStrmObjId (oid), len (_len) { }
00305 } ;
00306 
00310 struct EXTERNBER OSDecStrmImplNull {};
00311 
00315 struct EXTERNBER OSDecStrmImplBMPString : public OSDecStrmBMPString {
00316    ASN1INT len; 
00317 
00319    OSDecStrmImplBMPString (Asn116BitCharString& val, ASN1INT _len) :
00320       OSDecStrmBMPString (val), len (_len) { }
00321 } ;
00322 
00326 struct EXTERNBER OSDecStrmImplUnivString : public OSDecStrmUnivString {
00327    ASN1INT len; 
00328 
00330    OSDecStrmImplUnivString (Asn132BitCharString& val, ASN1INT _len) :
00331       OSDecStrmUnivString (val), len (_len) { }
00332 } ;
00333 
00342 class EXTERNBER ASN1BERInputStream : public ASN1Stream {
00343  protected:
00348    ASN1BERInputStream () { }
00349  public:
00359    ASN1BERInputStream& operator >> (ASN1CType& val); 
00360 
00371    ASN1BERInputStream& operator >> (OSDecStrmTag& val); 
00372 
00383    ASN1BERInputStream& operator >> (OSDecStrmLength& val); 
00384 
00395    ASN1BERInputStream& operator >> (OSDecStrmTagAndLen& val); 
00396 
00405    ASN1BERInputStream& operator >> (OSDecStrmEoc&); 
00406 
00417    ASN1BERInputStream& operator >> (OSDecStrmInt& val); 
00418 
00429    ASN1BERInputStream& operator >> (OSDecStrmInt8& val); 
00430 
00441    ASN1BERInputStream& operator >> (OSDecStrmInt16& val); 
00442 
00453    ASN1BERInputStream& operator >> (OSDecStrmInt64& val); 
00454 
00465    ASN1BERInputStream& operator >> (OSDecStrmUInt& val); 
00466 
00477    ASN1BERInputStream& operator >> (OSDecStrmUInt8& val); 
00478 
00489    ASN1BERInputStream& operator >> (OSDecStrmUInt16& val); 
00490 
00501    ASN1BERInputStream& operator >> (OSDecStrmUInt64& val); 
00502 
00513    ASN1BERInputStream& operator >> (OSDecStrmBigInt& val); 
00514 
00525    ASN1BERInputStream& operator >> (OSDecStrmEnum& val); 
00526 
00537    ASN1BERInputStream& operator >> (OSDecStrmBool& val); 
00538 
00549    ASN1BERInputStream& operator >> (OSDecStrmReal& val); 
00550 
00561    ASN1BERInputStream& operator >> (OSDecStrmBitStr& val); 
00562 
00573    ASN1BERInputStream& operator >> (OSDecStrmOctStr& val); 
00574 
00585    ASN1BERInputStream& operator >> (OSDecStrmDynBitStr& val); 
00586 
00597    ASN1BERInputStream& operator >> (OSDecStrmDynOctStr& val); 
00598 
00609    ASN1BERInputStream& operator >> (OSDecStrmCharStr& val); 
00610 
00621    ASN1BERInputStream& operator >> (OSDecStrmObjId& val); 
00622 
00633    ASN1BERInputStream& operator >> (OSDecStrmRelativeOID& val); 
00634 
00645    ASN1BERInputStream& operator >> (OSDecStrmNull& val); 
00646 
00657    ASN1BERInputStream& operator >> (OSDecStrmBMPString& val); 
00658 
00669    ASN1BERInputStream& operator >> (OSDecStrmUnivString& val); 
00670 
00671    // Implicit operators
00682    ASN1BERInputStream& operator >> (OSDecStrmImplInt& val); 
00683 
00694    ASN1BERInputStream& operator >> (OSDecStrmImplInt8& val); 
00695 
00706    ASN1BERInputStream& operator >> (OSDecStrmImplInt16& val); 
00707 
00718    ASN1BERInputStream& operator >> (OSDecStrmImplInt64& val); 
00719 
00730    ASN1BERInputStream& operator >> (OSDecStrmImplUInt& val); 
00731 
00742    ASN1BERInputStream& operator >> (OSDecStrmImplUInt8& val); 
00743 
00754    ASN1BERInputStream& operator >> (OSDecStrmImplUInt16& val); 
00755 
00766    ASN1BERInputStream& operator >> (OSDecStrmImplUInt64& val); 
00767 
00778    ASN1BERInputStream& operator >> (OSDecStrmImplBigInt& val); 
00779 
00790    ASN1BERInputStream& operator >> (OSDecStrmImplEnum& val); 
00791 
00802    ASN1BERInputStream& operator >> (OSDecStrmImplBool& val); 
00803 
00814    ASN1BERInputStream& operator >> (OSDecStrmImplReal& val); 
00815 
00826    ASN1BERInputStream& operator >> (OSDecStrmImplBitStr& val); 
00827 
00838    ASN1BERInputStream& operator >> (OSDecStrmImplOctStr& val); 
00839 
00850    ASN1BERInputStream& operator >> (OSDecStrmImplDynBitStr& val); 
00851 
00862    ASN1BERInputStream& operator >> (OSDecStrmImplDynOctStr& val); 
00863 
00874    ASN1BERInputStream& operator >> (OSDecStrmImplCharStr& val); 
00875 
00886    ASN1BERInputStream& operator >> (OSDecStrmImplObjId& val); 
00887 
00898    ASN1BERInputStream& operator >> (OSDecStrmImplRelativeOID& val); 
00899 
00910    ASN1BERInputStream& operator >> (OSDecStrmImplNull& val); 
00911 
00922    ASN1BERInputStream& operator >> (OSDecStrmImplBMPString& val); 
00923 
00934    ASN1BERInputStream& operator >> (OSDecStrmImplUnivString& val); 
00935 
00943    size_t byteIndex ();
00944 
00957    ASN1BOOL chkend (ASN1CCB& ccb);
00958 
00984    int decodeBigInt (const char*& pval, ASN1TagType tagging = ASN1EXPL, 
00985                      int length = 0);
00986 
01024    int decodeBitStr (ASN1OCTET* pbits, ASN1UINT& numbits, 
01025                      ASN1TagType tagging = ASN1EXPL, int length = 0);
01026 
01051    int decodeBitStr (ASN1DynBitStr& val, ASN1TagType tagging = ASN1EXPL, 
01052                      int length = 0);
01053 
01077    int decodeBMPStr (Asn116BitCharString& val, ASN1TagType tagging = ASN1EXPL, 
01078                      int length = 0);
01079 
01103    int decodeBool (ASN1BOOL& val, ASN1TagType tagging = ASN1EXPL, 
01104                    int length = 0);
01105 
01142    int decodeCharStr (const char*& pval, ASN1TagType tagging = ASN1EXPL, 
01143                       ASN1TAG tag = 0, int length = 0);
01144 
01168    int decodeEnum (ASN1ENUM& val, ASN1TagType tagging = ASN1EXPL, 
01169                    int length = 0);
01170 
01179    int decodeEoc ();
01180 
01204    int decodeInt (ASN1INT& val, ASN1TagType tagging = ASN1EXPL, 
01205                   int length = 0);
01206 
01230    int decodeInt8 (ASN1INT8& val, ASN1TagType tagging = ASN1EXPL, 
01231                    int length = 0);
01232 
01256    int decodeInt16 (ASN1SINT& val, ASN1TagType tagging = ASN1EXPL, 
01257                     int length = 0);
01258 
01282    int decodeInt64 (ASN1INT64& val, ASN1TagType tagging = ASN1EXPL, 
01283                     int length = 0);
01284 
01299    int decodeLength (ASN1INT& length);
01300    
01316    int decodeNull (ASN1TagType tagging = ASN1EXPL);
01317 
01326    int decodeObj (ASN1CType& val);
01327 
01351    int decodeObjId (ASN1OBJID& val, ASN1TagType tagging = ASN1EXPL, 
01352                     int length = 0);
01353 
01379    int decodeObjId64 (ASN1OID64& val, ASN1TagType tagging = ASN1EXPL, 
01380                       int length = 0);
01381 
01419    int decodeOctStr (ASN1OCTET* pocts, ASN1UINT& numocts, 
01420                      ASN1TagType tagging = ASN1EXPL, int length = 0);
01421 
01446    int decodeOctStr (ASN1DynOctStr& val, ASN1TagType tagging = ASN1EXPL, 
01447                      int length = 0);
01448 
01472    int decodeReal (ASN1REAL& val, ASN1TagType tagging = ASN1EXPL, 
01473                    int length = 0);
01474 
01498    int decodeRelativeOID (ASN1OBJID& val, ASN1TagType tagging = ASN1EXPL, 
01499                           int length = 0);
01500 
01512    int decodeTag (ASN1TAG& tag);
01513 
01531    int decodeTagAndLen (ASN1TAG& tag, ASN1INT& len);
01532 
01557    int decodeUInt (ASN1UINT& val, ASN1TagType tagging = ASN1EXPL, 
01558                    int length = 0);
01559 
01584    int decodeUInt8 (ASN1UINT8& val, ASN1TagType tagging = ASN1EXPL, 
01585                     int length = 0);
01586 
01611    int decodeUInt16 (ASN1USINT& val, ASN1TagType tagging = ASN1EXPL, 
01612                      int length = 0);
01613 
01638    int decodeUInt64 (ASN1UINT64& val, ASN1TagType tagging = ASN1EXPL, 
01639                      int length = 0);
01640 
01664    int decodeUnivStr (Asn132BitCharString& val, ASN1TagType tagging = ASN1EXPL, 
01665                       int length = 0);
01666 
01682    int mark (int readAheadLimit);
01683 
01702    int peekTagAndLen (ASN1TAG& tag, int& len);
01703 
01713    int reset ();
01714 } ;
01715 
01720 class EXTERNBER ASN1BERFileInputStream : public ASN1BERInputStream {
01721  public:
01730    ASN1BERFileInputStream (const char* pFilename);
01731 
01740    ASN1BERFileInputStream (FILE* file);
01741 } ;
01742 
01747 class EXTERNBER ASN1BERSocketInputStream : public ASN1BERInputStream {
01748  protected:
01749    OSCSocket mSocket; 
01750  public:
01762    ASN1BERSocketInputStream (OSRTSOCKET socket, ASN1BOOL ownership = FALSE);
01763 
01771    ASN1BERSocketInputStream (OSCSocket& socket);
01772 
01790    int recvMessage (ASN1OCTET* buffer, int bufsiz, 
01791                     ASN1OCTET** ppDestBuffer, int* pMsgSize);
01792 
01801    void setSocketOwnership (ASN1BOOL ownership);
01802 } ;
01803 
01807 class EXTERNBER ASN1BERMemoryInputStream : public ASN1BERInputStream {
01808  public:
01818    ASN1BERMemoryInputStream (ASN1OCTET* pMemBuf, size_t bufSize);
01819 } ;
01820 
01823 #endif /* _ASN1BERINPUTCPPSTREAM_H_ */
01824 

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