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
01214 EXTERNBER int berDecStrmFindTag
01215 (OSCTXT* pctxt, ASN1TAG tag, int* len_p, OSBOOL advance);
01216
01227 EXTERNBER int berDecStrmGetTLVLength (OSCTXT* pctxt);
01228
01250 EXTERNBER int berDecStrmInt (OSCTXT *pctxt, OSINT32 *object_p,
01251 ASN1TagType tagging, int length);
01252
01274 EXTERNBER int berDecStrmInt8 (OSCTXT *pctxt, OSINT8 *object_p,
01275 ASN1TagType tagging, int length);
01276
01298 EXTERNBER int berDecStrmInt16 (OSCTXT *pctxt, OSINT16 *object_p,
01299 ASN1TagType tagging, int length);
01300
01322 EXTERNBER int berDecStrmInt64 (OSCTXT *pctxt, OSINT64 *object_p,
01323 ASN1TagType tagging, int length);
01324
01338 EXTERNBER int berDecStrmLength (OSCTXT *pctxt, int *len_p);
01339
01355 EXTERNBER int berDecStrmMatchEOC (OSCTXT* pctxt);
01356
01379 EXTERNBER int berDecStrmMatchTag (OSCTXT* pctxt, ASN1TAG tag, int *len_p,
01380 OSBOOL advance);
01381
01393 EXTERNBER int berDecStrmNextElement (OSCTXT *pctxt);
01394
01409 EXTERNBER int berDecStrmNull (OSCTXT *pctxt, ASN1TagType tagging);
01410
01434 EXTERNBER int berDecStrmObjId (OSCTXT *pctxt, ASN1OBJID *object_p,
01435 ASN1TagType tagging,
01436 int length);
01437
01462 EXTERNBER int berDecStrmObjId64 (OSCTXT *pctxt, ASN1OID64 *object_p,
01463 ASN1TagType tagging,
01464 int length);
01465
01497 EXTERNBER int berDecStrmOctStr (OSCTXT *pctxt, OSOCTET* pvalue,
01498 OSUINT32* pnocts,
01499 ASN1TagType tagging,
01500 int length);
01501
01524 EXTERNBER int berDecStrmOpenType (OSCTXT *pctxt,
01525 const OSOCTET** object_p2,
01526 OSUINT32* pnumocts);
01527
01543 EXTERNBER int berDecStrmOpenTypeAppend (OSCTXT *pctxt,
01544 OSRTDList *pElemList);
01545
01571 EXTERNBER int berDecStrmOpenTypeExt (OSCTXT *pctxt, ASN1CCB* ccb_p,
01572 ASN1TAG* tags, int tagCount,
01573 OSRTDList *pElemList);
01574
01592 EXTERNBER int berDecStrmPeekTagAndLen
01593 (OSCTXT* pctxt, ASN1TAG* ptag, int* plen);
01594
01609 EXTERNBER int berDecStrmReadDynTLV (OSCTXT* pctxt, OSOCTET** ppbuf);
01610
01623 EXTERNBER int berDecStrmReadTLV (OSCTXT* pctxt, OSOCTET* buf, size_t bufsiz);
01624
01645 EXTERNBER int berDecStrmReal (OSCTXT *pctxt, OSREAL *object_p,
01646 ASN1TagType tagging, int length);
01647
01670 EXTERNBER int berDecStrmReal10 (OSCTXT *pctxt, const char** object_p,
01671 ASN1TagType tagging, int length);
01672
01696 EXTERNBER int berDecStrmRelativeOID (OSCTXT *pctxt, ASN1OBJID *object_p,
01697 ASN1TagType tagging,
01698 int length);
01699
01712 EXTERNBER int berDecStrmTag (OSCTXT* pctxt, ASN1TAG *tag_p);
01713
01730 EXTERNBER int berDecStrmTagAndLen (OSCTXT *pctxt, ASN1TAG *tag_p,
01731 int *len_p);
01732
01749 EXTERNBER OSBOOL berDecStrmTestEOC (OSCTXT* pctxt, ASN1CCB* ccb_p);
01750
01775 EXTERNBER int berDecStrmTestTag (OSCTXT* pctxt, ASN1TAG tag, int *len_p,
01776 OSBOOL advance);
01777
01800 EXTERNBER int berDecStrmUInt (OSCTXT *pctxt, OSUINT32 *object_p,
01801 ASN1TagType tagging, int length);
01802
01825 EXTERNBER int berDecStrmUInt8 (OSCTXT *pctxt, OSUINT8 *object_p,
01826 ASN1TagType tagging, int length);
01827
01850 EXTERNBER int berDecStrmUInt16 (OSCTXT *pctxt, OSUINT16 *object_p,
01851 ASN1TagType tagging, int length);
01852
01875 EXTERNBER int berDecStrmUInt64 (OSCTXT *pctxt, OSUINT64 *object_p,
01876 ASN1TagType tagging, int length);
01877
01902 EXTERNBER int berDecStrmUnivStr (OSCTXT* pctxt,
01903 Asn132BitCharString* object_p,
01904 ASN1TagType tagging, int length);
01907 EXTERNBER int cerEncCanonicalSort (OSCTXT* pctxt,
01908 OSCTXT* pMemCtxt,
01909 OSRTSList* pList);
01910 EXTERNBER void cerGetBufLocDescr (OSCTXT *pctxt, Asn1BufLocDescr* pDescr);
01911 EXTERNBER void cerAddBufLocDescr (OSCTXT *pctxt, OSRTSList* pElemList,
01912 Asn1BufLocDescr* pDescr);
01913
01914 #ifdef __cplusplus
01915 }
01916 #endif
01917
01918
01919
01920 #define BS_CHKEOB(pctxt) \
01921 (((pctxt)->buffer.byteIndex + 2 > (pctxt)->buffer.size) ? TRUE : \
01922 (((pctxt)->buffer.data[(pctxt)->buffer.byteIndex] == 0 && \
01923 (pctxt)->buffer.data[(pctxt)->buffer.byteIndex + 1] == 0 ) ? \
01924 TRUE : FALSE))
01925
01926
01927
01928 #define BS_CHKEND(pctxt,ccb_p) \
01929 ((ccb_p)->stat = 0, \
01930 (((ccb_p)->len == ASN_K_INDEFLEN) ? berDecStrmTestEOC (pctxt,ccb_p) : \
01931 (((int)(OSRTSTREAM_BYTEINDEX(pctxt) - (ccb_p)->bytes) >= (ccb_p)->len))))
01932
01935 #endif