00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00030 #ifndef _ASN1BERSTREAM_H_
00031 #define _ASN1BERSTREAM_H_
00032
00033 #include "rtbersrc/asn1ber.h"
00034 #include "rtxsrc/rtxStream.h"
00035
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039
00067 #ifndef berStrmInitContext
00068 EXTERNBER int berStrmInitContext (OSCTXT* pctxt);
00069 #endif
00070
00071 EXTERNBER int berStrmInitContextUsingKey
00072 (OSCTXT* pctxt, const OSOCTET* key, size_t keylen);
00073
00084 EXTERNBER int berStrmFreeContext (OSCTXT* pctxt);
00085
00120 EXTERNBER int berEncStrmBigInt (OSCTXT* pctxt,
00121 const char* pvalue,
00122 ASN1TagType tagging);
00123
00143 EXTERNBER int berEncStrmBigIntNchars
00144 (OSCTXT* pctxt, const char* pvalue, size_t nchars, ASN1TagType tagging);
00145
00165 EXTERNBER int berEncStrmBitStr (OSCTXT* pctxt,
00166 const OSOCTET* object_p,
00167 OSUINT32 numbits,
00168 ASN1TagType tagging);
00169
00190 EXTERNBER int berEncStrmBMPStr (OSCTXT* pctxt,
00191 const Asn116BitCharString* object_p,
00192 ASN1TagType tagging);
00193
00211 EXTERNBER int berEncStrmBool (OSCTXT* pctxt, OSBOOL value,
00212 ASN1TagType tagging);
00213
00236 EXTERNBER int berEncStrmCharStr (OSCTXT* pctxt, const char* object_p,
00237 ASN1TagType tagging, ASN1TAG tag);
00238
00249 EXTERNBER int berEncStrmDefLength (OSCTXT* pctxt, size_t length);
00250
00263 EXTERNBER int berEncStrmEOC (OSCTXT *pctxt);
00264
00284 EXTERNBER int berEncStrmEnum (OSCTXT* pctxt, OSINT32 value,
00285 ASN1TagType tagging);
00286
00304 EXTERNBER int berEncStrmInt (OSCTXT* pctxt, OSINT32 value,
00305 ASN1TagType tagging);
00306
00325 EXTERNBER int berEncStrmInt8 (OSCTXT* pctxt, OSINT8 value,
00326 ASN1TagType tagging);
00327
00346 EXTERNBER int berEncStrmInt16 (OSCTXT* pctxt, OSINT16 value,
00347 ASN1TagType tagging);
00348
00368 EXTERNBER int berEncStrmInt64 (OSCTXT* pctxt, OSINT64 value,
00369 ASN1TagType tagging);
00370
00383 EXTERNBER int berEncStrmLength (OSCTXT *pctxt, int length);
00384
00399 EXTERNBER int berEncStrmNull (OSCTXT* pctxt, ASN1TagType tagging);
00400
00419 EXTERNBER int berEncStrmObjId (OSCTXT* pctxt, const ASN1OBJID *object_p,
00420 ASN1TagType tagging);
00421
00441 EXTERNBER int berEncStrmObjId64 (OSCTXT* pctxt, const ASN1OID64 *object_p,
00442 ASN1TagType tagging);
00443
00462 EXTERNBER int berEncStrmOctStr (OSCTXT* pctxt,
00463 const OSOCTET* object_p,
00464 OSUINT32 numocts,
00465 ASN1TagType tagging);
00466
00483 EXTERNBER int berEncStrmOpenTypeExt (OSCTXT* pctxt, OSRTDList* pElemList);
00484
00507 EXTERNBER int berEncStrmReal (OSCTXT* pctxt, OSREAL value,
00508 ASN1TagType tagging);
00509
00527 EXTERNBER int berEncStrmReal10 (OSCTXT *pctxt, const char* object_p,
00528 ASN1TagType tagging);
00529
00547 EXTERNBER int cerEncStrmReal10 (OSCTXT *pctxt, const char* object_p,
00548 ASN1TagType tagging);
00549
00568 EXTERNBER int berEncStrmRelativeOID (OSCTXT* pctxt,
00569 const ASN1OBJID *object_p,
00570 ASN1TagType tagging);
00571
00587 EXTERNBER int berEncStrmTag (OSCTXT *pctxt, ASN1TAG tag);
00588
00611 EXTERNBER int berEncStrmTagAndLen (OSCTXT *pctxt, ASN1TAG tag, int length);
00612
00628 EXTERNBER int berEncStrmTagAndIndefLen (OSCTXT *pctxt, ASN1TAG tag);
00629
00648 EXTERNBER int berEncStrmUInt (OSCTXT* pctxt, OSUINT32 value,
00649 ASN1TagType tagging);
00650
00669 EXTERNBER int berEncStrmUInt8 (OSCTXT* pctxt, OSUINT8 value,
00670 ASN1TagType tagging);
00671
00690 EXTERNBER int berEncStrmUInt16 (OSCTXT* pctxt, OSUINT16 value,
00691 ASN1TagType tagging);
00692
00713 EXTERNBER int berEncStrmUInt64 (OSCTXT* pctxt, OSUINT64 value,
00714 ASN1TagType tagging);
00715
00736 EXTERNBER int berEncStrmUnivStr (OSCTXT* pctxt,
00737 const Asn132BitCharString* object_p,
00738 ASN1TagType tagging);
00739
00760 EXTERNBER int berEncStrmXSDAny
00761 (OSCTXT* pctxt, OSXSDAny* pvalue, ASN1TagType tagging);
00762
00775 EXTERNBER int berEncStrmWriteOctet (OSCTXT* pctxt, OSOCTET octet);
00776
00790 EXTERNBER int berEncStrmWriteOctets (OSCTXT* pctxt,
00791 const OSOCTET* poctets,
00792 size_t numocts);
00793
00794
00816 EXTERNBER int cerEncStrmBMPStr (OSCTXT* pctxt,
00817 const Asn116BitCharString* object_p,
00818 ASN1TagType tagging);
00819
00840 EXTERNBER int cerEncStrmBitStr (OSCTXT* pctxt,
00841 const OSOCTET* object_p,
00842 OSUINT32 numbits,
00843 ASN1TagType tagging);
00844
00868 EXTERNBER int cerEncStrmCharStr (OSCTXT* pctxt, const char* object_p,
00869 ASN1TagType tagging, ASN1TAG tag);
00870
00890 EXTERNBER int cerEncStrmOctStr (OSCTXT* pctxt,
00891 const OSOCTET* object_p,
00892 OSUINT32 numocts,
00893 ASN1TagType tagging);
00894
00916 EXTERNBER int cerEncStrmUnivStr (OSCTXT* pctxt,
00917 const Asn132BitCharString* object_p,
00918 ASN1TagType tagging);
00919
00955 EXTERNBER int berDecStrmBMPStr (OSCTXT* pctxt, Asn116BitCharString* object_p,
00956 ASN1TagType tagging, int length);
00957
00989 EXTERNBER int berDecStrmBigInt (OSCTXT *pctxt, const char** object_p,
00990 ASN1TagType tagging, int length);
00991
00992 EXTERNBER int berDecStrmBigEnum (OSCTXT *pctxt, const char** object_p,
00993 ASN1TagType tagging, int length);
00994
01027 EXTERNBER int berDecStrmBitStr (OSCTXT *pctxt, OSOCTET* pvalue,
01028 OSUINT32* pnbits,
01029 ASN1TagType tagging,
01030 int length);
01031
01053 EXTERNBER int berDecStrmBool (OSCTXT *pctxt, OSBOOL *object_p,
01054 ASN1TagType tagging, int length);
01055
01086 EXTERNBER int berDecStrmCharStr (OSCTXT *pctxt, const char** ppvalue,
01087 ASN1TagType tagging, ASN1TAG tag, int length);
01088
01105 EXTERNBER OSBOOL berDecStrmCheckEnd (OSCTXT* pctxt, ASN1CCB* pccb);
01106
01132 EXTERNBER int berDecStrmDynBitStr (OSCTXT *pctxt, const OSOCTET** ppvalue,
01133 OSUINT32* pnbits,
01134 ASN1TagType tagging, int length);
01135
01161 EXTERNBER int berDecStrmDynOctStr (OSCTXT *pctxt, const OSOCTET** ppvalue,
01162 OSUINT32* pnocts,
01163 ASN1TagType tagging, int length);
01164
01186 EXTERNBER int berDecStrmEnum (OSCTXT *pctxt, OSINT32 *object_p,
01187 ASN1TagType tagging, int length);
01188
01199 EXTERNBER int berDecStrmGetTLVLength (OSCTXT* pctxt);
01200
01222 EXTERNBER int berDecStrmInt (OSCTXT *pctxt, OSINT32 *object_p,
01223 ASN1TagType tagging, int length);
01224
01246 EXTERNBER int berDecStrmInt8 (OSCTXT *pctxt, OSINT8 *object_p,
01247 ASN1TagType tagging, int length);
01248
01270 EXTERNBER int berDecStrmInt16 (OSCTXT *pctxt, OSINT16 *object_p,
01271 ASN1TagType tagging, int length);
01272
01294 EXTERNBER int berDecStrmInt64 (OSCTXT *pctxt, OSINT64 *object_p,
01295 ASN1TagType tagging, int length);
01296
01310 EXTERNBER int berDecStrmLength (OSCTXT *pctxt, int *len_p);
01311
01327 EXTERNBER int berDecStrmMatchEOC (OSCTXT* pctxt);
01328
01351 EXTERNBER int berDecStrmMatchTag (OSCTXT* pctxt, ASN1TAG tag, int *len_p,
01352 OSBOOL advance);
01353
01365 EXTERNBER int berDecStrmNextElement (OSCTXT *pctxt);
01366
01381 EXTERNBER int berDecStrmNull (OSCTXT *pctxt, ASN1TagType tagging);
01382
01406 EXTERNBER int berDecStrmObjId (OSCTXT *pctxt, ASN1OBJID *object_p,
01407 ASN1TagType tagging,
01408 int length);
01409
01434 EXTERNBER int berDecStrmObjId64 (OSCTXT *pctxt, ASN1OID64 *object_p,
01435 ASN1TagType tagging,
01436 int length);
01437
01469 EXTERNBER int berDecStrmOctStr (OSCTXT *pctxt, OSOCTET* pvalue,
01470 OSUINT32* pnocts,
01471 ASN1TagType tagging,
01472 int length);
01473
01496 EXTERNBER int berDecStrmOpenType (OSCTXT *pctxt,
01497 const OSOCTET** object_p2,
01498 OSUINT32* pnumocts);
01499
01515 EXTERNBER int berDecStrmOpenTypeAppend (OSCTXT *pctxt,
01516 OSRTDList *pElemList);
01517
01542 EXTERNBER int berDecStrmOpenTypeExt (OSCTXT *pctxt, ASN1CCB* ccb_p,
01543 ASN1TAG tag,
01544 OSRTDList *pElemList);
01545
01563 EXTERNBER int berDecStrmPeekTagAndLen
01564 (OSCTXT* pctxt, ASN1TAG* ptag, int* plen);
01565
01580 EXTERNBER int berDecStrmReadDynTLV (OSCTXT* pctxt, OSOCTET** ppbuf);
01581
01594 EXTERNBER int berDecStrmReadTLV (OSCTXT* pctxt, OSOCTET* buf, size_t bufsiz);
01595
01616 EXTERNBER int berDecStrmReal (OSCTXT *pctxt, OSREAL *object_p,
01617 ASN1TagType tagging, int length);
01618
01641 EXTERNBER int berDecStrmReal10 (OSCTXT *pctxt, const char** object_p,
01642 ASN1TagType tagging, int length);
01643
01667 EXTERNBER int berDecStrmRelativeOID (OSCTXT *pctxt, ASN1OBJID *object_p,
01668 ASN1TagType tagging,
01669 int length);
01670
01683 EXTERNBER int berDecStrmTag (OSCTXT* pctxt, ASN1TAG *tag_p);
01684
01701 EXTERNBER int berDecStrmTagAndLen (OSCTXT *pctxt, ASN1TAG *tag_p,
01702 int *len_p);
01703
01720 EXTERNBER OSBOOL berDecStrmTestEOC (OSCTXT* pctxt, ASN1CCB* ccb_p);
01721
01746 EXTERNBER int berDecStrmTestTag (OSCTXT* pctxt, ASN1TAG tag, int *len_p,
01747 OSBOOL advance);
01748
01771 EXTERNBER int berDecStrmUInt (OSCTXT *pctxt, OSUINT32 *object_p,
01772 ASN1TagType tagging, int length);
01773
01796 EXTERNBER int berDecStrmUInt8 (OSCTXT *pctxt, OSUINT8 *object_p,
01797 ASN1TagType tagging, int length);
01798
01821 EXTERNBER int berDecStrmUInt16 (OSCTXT *pctxt, OSUINT16 *object_p,
01822 ASN1TagType tagging, int length);
01823
01846 EXTERNBER int berDecStrmUInt64 (OSCTXT *pctxt, OSUINT64 *object_p,
01847 ASN1TagType tagging, int length);
01848
01873 EXTERNBER int berDecStrmUnivStr (OSCTXT* pctxt,
01874 Asn132BitCharString* object_p,
01875 ASN1TagType tagging, int length);
01878 EXTERNBER int cerEncCanonicalSort (OSCTXT* pctxt,
01879 OSCTXT* pMemCtxt,
01880 OSRTSList* pList);
01881 EXTERNBER void cerGetBufLocDescr (OSCTXT *pctxt, Asn1BufLocDescr* pDescr);
01882 EXTERNBER void cerAddBufLocDescr (OSCTXT *pctxt, OSRTSList* pElemList,
01883 Asn1BufLocDescr* pDescr);
01884
01885 #ifdef __cplusplus
01886 }
01887 #endif
01888
01889
01890
01891 #define BS_CHKEOB(pctxt) \
01892 (((pctxt)->buffer.byteIndex + 2 > (pctxt)->buffer.size) ? TRUE : \
01893 (((pctxt)->buffer.data[(pctxt)->buffer.byteIndex] == 0 && \
01894 (pctxt)->buffer.data[(pctxt)->buffer.byteIndex + 1] == 0 ) ? \
01895 TRUE : FALSE))
01896
01897
01898
01899 #define BS_CHKEND(pctxt,ccb_p) \
01900 ((ccb_p)->stat = 0, \
01901 (((ccb_p)->len == ASN_K_INDEFLEN) ? berDecStrmTestEOC (pctxt,ccb_p) : \
01902 (((int)(OSRTSTREAM_BYTEINDEX(pctxt) - (ccb_p)->bytes) >= (ccb_p)->len))))
01903
01906 #endif