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 len);
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
01024 EXTERNBER int berDecStrmBitStr (OSCTXT *pctxt, OSOCTET* pvalue,
01025 OSUINT32* pnbits,
01026 ASN1TagType tagging,
01027 int length);
01028
01050 EXTERNBER int berDecStrmBool (OSCTXT *pctxt, OSBOOL *object_p,
01051 ASN1TagType tagging, int length);
01052
01083 EXTERNBER int berDecStrmCharStr (OSCTXT *pctxt, const char** ppvalue,
01084 ASN1TagType tagging, ASN1TAG tag, int length);
01085
01102 EXTERNBER OSBOOL berDecStrmCheckEnd (OSCTXT* pctxt, ASN1CCB* pccb);
01103
01129 EXTERNBER int berDecStrmDynBitStr (OSCTXT *pctxt, const OSOCTET** ppvalue,
01130 OSUINT32* pnbits,
01131 ASN1TagType tagging, int length);
01132
01158 EXTERNBER int berDecStrmDynOctStr (OSCTXT *pctxt, const OSOCTET** ppvalue,
01159 OSUINT32* pnocts,
01160 ASN1TagType tagging, int length);
01161
01183 EXTERNBER int berDecStrmEnum (OSCTXT *pctxt, OSINT32 *object_p,
01184 ASN1TagType tagging, int length);
01185
01196 EXTERNBER int berDecStrmGetTLVLength (OSCTXT* pctxt);
01197
01219 EXTERNBER int berDecStrmInt (OSCTXT *pctxt, OSINT32 *object_p,
01220 ASN1TagType tagging, int length);
01221
01243 EXTERNBER int berDecStrmInt8 (OSCTXT *pctxt, OSINT8 *object_p,
01244 ASN1TagType tagging, int length);
01245
01267 EXTERNBER int berDecStrmInt16 (OSCTXT *pctxt, OSINT16 *object_p,
01268 ASN1TagType tagging, int length);
01269
01291 EXTERNBER int berDecStrmInt64 (OSCTXT *pctxt, OSINT64 *object_p,
01292 ASN1TagType tagging, int length);
01293
01307 EXTERNBER int berDecStrmLength (OSCTXT *pctxt, int *len_p);
01308
01324 EXTERNBER int berDecStrmMatchEOC (OSCTXT* pctxt);
01325
01348 EXTERNBER int berDecStrmMatchTag (OSCTXT* pctxt, ASN1TAG tag, int *len_p,
01349 OSBOOL advance);
01350
01362 EXTERNBER int berDecStrmNextElement (OSCTXT *pctxt);
01363
01378 EXTERNBER int berDecStrmNull (OSCTXT *pctxt, ASN1TagType tagging);
01379
01403 EXTERNBER int berDecStrmObjId (OSCTXT *pctxt, ASN1OBJID *object_p,
01404 ASN1TagType tagging,
01405 int length);
01406
01431 EXTERNBER int berDecStrmObjId64 (OSCTXT *pctxt, ASN1OID64 *object_p,
01432 ASN1TagType tagging,
01433 int length);
01434
01466 EXTERNBER int berDecStrmOctStr (OSCTXT *pctxt, OSOCTET* pvalue,
01467 OSUINT32* pnocts,
01468 ASN1TagType tagging,
01469 int length);
01470
01493 EXTERNBER int berDecStrmOpenType (OSCTXT *pctxt,
01494 const OSOCTET** object_p2,
01495 OSUINT32* pnumocts);
01496
01512 EXTERNBER int berDecStrmOpenTypeAppend (OSCTXT *pctxt,
01513 OSRTDList *pElemList);
01514
01539 EXTERNBER int berDecStrmOpenTypeExt (OSCTXT *pctxt, ASN1CCB* ccb_p,
01540 ASN1TAG tag,
01541 OSRTDList *pElemList);
01542
01560 EXTERNBER int berDecStrmPeekTagAndLen
01561 (OSCTXT* pctxt, ASN1TAG* ptag, int* plen);
01562
01577 EXTERNBER int berDecStrmReadDynTLV (OSCTXT* pctxt, OSOCTET** ppbuf);
01578
01591 EXTERNBER int berDecStrmReadTLV (OSCTXT* pctxt, OSOCTET* buf, size_t bufsiz);
01592
01613 EXTERNBER int berDecStrmReal (OSCTXT *pctxt, OSREAL *object_p,
01614 ASN1TagType tagging, int length);
01615
01638 EXTERNBER int berDecStrmReal10 (OSCTXT *pctxt, const char** object_p,
01639 ASN1TagType tagging, int length);
01640
01664 EXTERNBER int berDecStrmRelativeOID (OSCTXT *pctxt, ASN1OBJID *object_p,
01665 ASN1TagType tagging,
01666 int length);
01667
01680 EXTERNBER int berDecStrmTag (OSCTXT* pctxt, ASN1TAG *tag_p);
01681
01698 EXTERNBER int berDecStrmTagAndLen (OSCTXT *pctxt, ASN1TAG *tag_p,
01699 int *len_p);
01700
01717 EXTERNBER OSBOOL berDecStrmTestEOC (OSCTXT* pctxt, ASN1CCB* ccb_p);
01718
01743 EXTERNBER int berDecStrmTestTag (OSCTXT* pctxt, ASN1TAG tag, int *len_p,
01744 OSBOOL advance);
01745
01768 EXTERNBER int berDecStrmUInt (OSCTXT *pctxt, OSUINT32 *object_p,
01769 ASN1TagType tagging, int length);
01770
01793 EXTERNBER int berDecStrmUInt8 (OSCTXT *pctxt, OSUINT8 *object_p,
01794 ASN1TagType tagging, int length);
01795
01818 EXTERNBER int berDecStrmUInt16 (OSCTXT *pctxt, OSUINT16 *object_p,
01819 ASN1TagType tagging, int length);
01820
01843 EXTERNBER int berDecStrmUInt64 (OSCTXT *pctxt, OSUINT64 *object_p,
01844 ASN1TagType tagging, int length);
01845
01870 EXTERNBER int berDecStrmUnivStr (OSCTXT* pctxt,
01871 Asn132BitCharString* object_p,
01872 ASN1TagType tagging, int length);
01875 EXTERNBER int cerEncCanonicalSort (OSCTXT* pctxt,
01876 OSCTXT* pMemCtxt,
01877 OSRTSList* pList);
01878 EXTERNBER void cerGetBufLocDescr (OSCTXT *pctxt, Asn1BufLocDescr* pDescr);
01879 EXTERNBER void cerAddBufLocDescr (OSCTXT *pctxt, OSRTSList* pElemList,
01880 Asn1BufLocDescr* pDescr);
01881
01882 #ifdef __cplusplus
01883 }
01884 #endif
01885
01886
01887
01888 #define BS_CHKEOB(pctxt) \
01889 (((pctxt)->buffer.byteIndex + 2 > (pctxt)->buffer.size) ? TRUE : \
01890 (((pctxt)->buffer.data[(pctxt)->buffer.byteIndex] == 0 && \
01891 (pctxt)->buffer.data[(pctxt)->buffer.byteIndex + 1] == 0 ) ? \
01892 TRUE : FALSE))
01893
01894
01895
01896 #define BS_CHKEND(pctxt,ccb_p) \
01897 ((ccb_p)->stat = 0, \
01898 (((ccb_p)->len == ASN_K_INDEFLEN) ? berDecStrmTestEOC (pctxt,ccb_p) : \
01899 (((int)(OSRTSTREAM_BYTEINDEX(pctxt) - (ccb_p)->bytes) >= (ccb_p)->len))))
01900
01903 #endif