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/rtxBuffer.h"
00035 #include "rtxsrc/rtxStream.h"
00036
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040
00068 #ifndef berStrmInitContext
00069 EXTERNBER int berStrmInitContext (OSCTXT* pctxt);
00070 #endif
00071
00072 EXTERNBER int berStrmInitContextUsingKey
00073 (OSCTXT* pctxt, const OSOCTET* key, size_t keylen);
00074
00085 EXTERNBER int berStrmFreeContext (OSCTXT* pctxt);
00086
00121 EXTERNBER int berEncStrmBigInt (OSCTXT* pctxt,
00122 const char* pvalue,
00123 ASN1TagType tagging);
00124
00144 EXTERNBER int berEncStrmBigIntNchars
00145 (OSCTXT* pctxt, const char* pvalue, size_t nchars, ASN1TagType tagging);
00146
00166 EXTERNBER int berEncStrmBitStr (OSCTXT* pctxt,
00167 const OSOCTET* object_p,
00168 OSUINT32 numbits,
00169 ASN1TagType tagging);
00170
00191 EXTERNBER int berEncStrmBMPStr (OSCTXT* pctxt,
00192 const Asn116BitCharString* object_p,
00193 ASN1TagType tagging);
00194
00212 EXTERNBER int berEncStrmBool (OSCTXT* pctxt, OSBOOL value,
00213 ASN1TagType tagging);
00214
00237 EXTERNBER int berEncStrmCharStr (OSCTXT* pctxt, const char* object_p,
00238 ASN1TagType tagging, ASN1TAG tag);
00239
00261 EXTERNBER int berEncStrmDateStr (OSCTXT* pctxt, const char* object_p,
00262 ASN1TagType tagging, ASN1TAG tag);
00263
00285 EXTERNBER int berEncStrmDateTimeStr (OSCTXT* pctxt, const char* object_p,
00286 ASN1TagType tagging, ASN1TAG tag);
00287
00309 EXTERNBER int berEncStrmDurationStr (OSCTXT* pctxt, const char* object_p,
00310 ASN1TagType tagging, ASN1TAG tag);
00311
00333 EXTERNBER int berEncStrmTimeStr (OSCTXT* pctxt, const char* object_p,
00334 ASN1TagType tagging, ASN1TAG tag);
00335
00357 EXTERNBER int berEncStrmTimeOfDayStr (OSCTXT* pctxt, const char* object_p,
00358 ASN1TagType tagging, ASN1TAG tag);
00359
00370 EXTERNBER int berEncStrmDefLength (OSCTXT* pctxt, size_t length);
00371
00384 EXTERNBER int berEncStrmEOC (OSCTXT *pctxt);
00385
00405 EXTERNBER int berEncStrmEnum (OSCTXT* pctxt, OSINT32 value,
00406 ASN1TagType tagging);
00407
00425 EXTERNBER int berEncStrmInt (OSCTXT* pctxt, OSINT32 value,
00426 ASN1TagType tagging);
00427
00446 EXTERNBER int berEncStrmInt8 (OSCTXT* pctxt, OSINT8 value,
00447 ASN1TagType tagging);
00448
00467 EXTERNBER int berEncStrmInt16 (OSCTXT* pctxt, OSINT16 value,
00468 ASN1TagType tagging);
00469
00489 EXTERNBER int berEncStrmInt64 (OSCTXT* pctxt, OSINT64 value,
00490 ASN1TagType tagging);
00491
00504 EXTERNBER int berEncStrmLength (OSCTXT *pctxt, int length);
00505
00520 EXTERNBER int berEncStrmNull (OSCTXT* pctxt, ASN1TagType tagging);
00521
00540 EXTERNBER int berEncStrmObjId (OSCTXT* pctxt, const ASN1OBJID *object_p,
00541 ASN1TagType tagging);
00542
00562 EXTERNBER int berEncStrmObjId64 (OSCTXT* pctxt, const ASN1OID64 *object_p,
00563 ASN1TagType tagging);
00564
00583 EXTERNBER int berEncStrmOctStr (OSCTXT* pctxt,
00584 const OSOCTET* object_p,
00585 OSSIZE numocts,
00586 ASN1TagType tagging);
00587
00604 EXTERNBER int berEncStrmOpenTypeExt (OSCTXT* pctxt, OSRTDList* pElemList);
00605
00628 EXTERNBER int berEncStrmReal (OSCTXT* pctxt, OSREAL value,
00629 ASN1TagType tagging);
00630
00648 EXTERNBER int berEncStrmReal10 (OSCTXT *pctxt, const char* object_p,
00649 ASN1TagType tagging);
00650
00668 EXTERNBER int cerEncStrmReal10 (OSCTXT *pctxt, const char* object_p,
00669 ASN1TagType tagging);
00670
00689 EXTERNBER int berEncStrmRelativeOID (OSCTXT* pctxt,
00690 const ASN1OBJID *object_p,
00691 ASN1TagType tagging);
00692
00708 EXTERNBER int berEncStrmTag (OSCTXT *pctxt, ASN1TAG tag);
00709
00732 EXTERNBER int berEncStrmTagAndLen (OSCTXT *pctxt, ASN1TAG tag, int length);
00733
00754 EXTERNBER int berEncStrmTagAndDefLen
00755 (OSCTXT *pctxt, ASN1TAG tag, OSSIZE length);
00756
00772 EXTERNBER int berEncStrmTagAndIndefLen (OSCTXT *pctxt, ASN1TAG tag);
00773
00792 EXTERNBER int berEncStrmUInt (OSCTXT* pctxt, OSUINT32 value,
00793 ASN1TagType tagging);
00794
00813 EXTERNBER int berEncStrmUInt8 (OSCTXT* pctxt, OSUINT8 value,
00814 ASN1TagType tagging);
00815
00834 EXTERNBER int berEncStrmUInt16 (OSCTXT* pctxt, OSUINT16 value,
00835 ASN1TagType tagging);
00836
00857 EXTERNBER int berEncStrmUInt64 (OSCTXT* pctxt, OSUINT64 value,
00858 ASN1TagType tagging);
00859
00880 EXTERNBER int berEncStrmUnivStr (OSCTXT* pctxt,
00881 const Asn132BitCharString* object_p,
00882 ASN1TagType tagging);
00883
00904 EXTERNBER int berEncStrmXSDAny
00905 (OSCTXT* pctxt, OSXSDAny* pvalue, ASN1TagType tagging);
00906
00919 EXTERNBER int berEncStrmWriteOctet (OSCTXT* pctxt, OSOCTET octet);
00920
00934 EXTERNBER int berEncStrmWriteOctets (OSCTXT* pctxt,
00935 const OSOCTET* poctets,
00936 size_t numocts);
00937
00938
00960 EXTERNBER int cerEncStrmBMPStr (OSCTXT* pctxt,
00961 const Asn116BitCharString* object_p,
00962 ASN1TagType tagging);
00963
00984 EXTERNBER int cerEncStrmBitStr (OSCTXT* pctxt,
00985 const OSOCTET* object_p,
00986 OSUINT32 numbits,
00987 ASN1TagType tagging);
00988
01012 EXTERNBER int cerEncStrmCharStr (OSCTXT* pctxt, const char* object_p,
01013 ASN1TagType tagging, ASN1TAG tag);
01014
01034 EXTERNBER int cerEncStrmOctStr (OSCTXT* pctxt,
01035 const OSOCTET* object_p,
01036 OSUINT32 numocts,
01037 ASN1TagType tagging);
01038
01060 EXTERNBER int cerEncStrmUnivStr (OSCTXT* pctxt,
01061 const Asn132BitCharString* object_p,
01062 ASN1TagType tagging);
01063
01099 EXTERNBER int berDecStrmBMPStr (OSCTXT* pctxt, Asn116BitCharString* object_p,
01100 ASN1TagType tagging, int length);
01101
01133 EXTERNBER int berDecStrmBigInt (OSCTXT *pctxt, const char** object_p,
01134 ASN1TagType tagging, int length);
01135
01136 EXTERNBER int berDecStrmBigEnum (OSCTXT *pctxt, const char** object_p,
01137 ASN1TagType tagging, int length);
01138
01171 EXTERNBER int berDecStrmBitStr (OSCTXT *pctxt, OSOCTET* pvalue,
01172 OSUINT32* pnbits,
01173 ASN1TagType tagging,
01174 int length);
01175
01197 EXTERNBER int berDecStrmBool (OSCTXT *pctxt, OSBOOL *object_p,
01198 ASN1TagType tagging, int length);
01199
01230 EXTERNBER int berDecStrmCharStr (OSCTXT *pctxt, const char** ppvalue,
01231 ASN1TagType tagging, ASN1TAG tag, int length);
01232
01262 EXTERNBER int berDecStrmDateStr (OSCTXT *pctxt, const char** ppvalue,
01263 ASN1TagType tagging, ASN1TAG tag, int length);
01264
01294 EXTERNBER int berDecStrmDateTimeStr (OSCTXT *pctxt, const char** ppvalue,
01295 ASN1TagType tagging, ASN1TAG tag, int length);
01296
01326 EXTERNBER int berDecStrmDurationStr (OSCTXT *pctxt, const char** ppvalue,
01327 ASN1TagType tagging, ASN1TAG tag, int length);
01328
01358 EXTERNBER int berDecStrmTimeStr (OSCTXT *pctxt, const char** ppvalue,
01359 ASN1TagType tagging, ASN1TAG tag, int length);
01360
01390 EXTERNBER int berDecStrmTimeOfDayStr (OSCTXT *pctxt, const char** ppvalue,
01391 ASN1TagType tagging, ASN1TAG tag, int length);
01392
01409 EXTERNBER OSBOOL berDecStrmCheckEnd (OSCTXT* pctxt, ASN1CCB* pccb);
01410
01436 EXTERNBER int berDecStrmDynBitStr (OSCTXT *pctxt, const OSOCTET** ppvalue,
01437 OSUINT32* pnbits,
01438 ASN1TagType tagging, int length);
01439
01465 EXTERNBER int berDecStrmDynBitStr64 (OSCTXT *pctxt, const OSOCTET** ppvalue,
01466 OSSIZE* pnbits, ASN1TagType tagging,
01467 OSSIZE length, OSBOOL indefLen);
01468
01494 EXTERNBER int berDecStrmDynOctStr (OSCTXT *pctxt, const OSOCTET** ppvalue,
01495 OSUINT32* pnocts,
01496 ASN1TagType tagging, int length);
01497
01526 EXTERNBER int berDecStrmDynOctStr64 (OSCTXT* pctxt, OSOCTET** ppvalue,
01527 OSSIZE* pnocts, ASN1TagType tagging,
01528 OSSIZE length, OSBOOL indefLen);
01529
01551 EXTERNBER int berDecStrmEnum (OSCTXT *pctxt, OSINT32 *object_p,
01552 ASN1TagType tagging, int length);
01553
01579 EXTERNBER int berDecStrmFindTag
01580 (OSCTXT* pctxt, ASN1TAG tag, int* len_p, OSBOOL advance);
01581
01605 EXTERNBER int berDecStrmFindTag2
01606 (OSCTXT* pctxt, ASN1TAG tag, OSSIZE* len_p, OSBOOL* pIndefLen, OSBOOL advance);
01607
01618 EXTERNBER int berDecStrmGetTLVLength (OSCTXT* pctxt);
01619
01641 EXTERNBER int berDecStrmInt (OSCTXT *pctxt, OSINT32 *object_p,
01642 ASN1TagType tagging, int length);
01643
01665 EXTERNBER int berDecStrmInt8 (OSCTXT *pctxt, OSINT8 *object_p,
01666 ASN1TagType tagging, int length);
01667
01689 EXTERNBER int berDecStrmInt16 (OSCTXT *pctxt, OSINT16 *object_p,
01690 ASN1TagType tagging, int length);
01691
01713 EXTERNBER int berDecStrmInt64 (OSCTXT *pctxt, OSINT64 *object_p,
01714 ASN1TagType tagging, int length);
01715
01729 EXTERNBER int berDecStrmLength (OSCTXT *pctxt, int *len_p);
01730
01747 EXTERNBER int berDecStrmLength2
01748 (OSCTXT* pctxt, OSSIZE* pLength, OSBOOL* pIndefLen);
01749
01765 EXTERNBER int berDecStrmMatchEOC (OSCTXT* pctxt);
01766
01789 EXTERNBER int berDecStrmMatchTag (OSCTXT* pctxt, ASN1TAG tag, int *len_p,
01790 OSBOOL advance);
01791
01819 EXTERNBER int berDecStrmMatchTag2
01820 (OSCTXT* pctxt, ASN1TAG tag, OSSIZE *len_p, OSBOOL* pIndefLen, OSBOOL advance);
01821
01833 EXTERNBER int berDecStrmNextElement (OSCTXT *pctxt);
01834
01849 EXTERNBER int berDecStrmNull (OSCTXT *pctxt, ASN1TagType tagging);
01850
01874 EXTERNBER int berDecStrmObjId (OSCTXT *pctxt, ASN1OBJID *object_p,
01875 ASN1TagType tagging,
01876 int length);
01877
01902 EXTERNBER int berDecStrmObjId64 (OSCTXT *pctxt, ASN1OID64 *object_p,
01903 ASN1TagType tagging,
01904 int length);
01905
01937 EXTERNBER int berDecStrmOctStr (OSCTXT *pctxt, OSOCTET* pvalue,
01938 OSUINT32* pnocts,
01939 ASN1TagType tagging,
01940 int length);
01941
01964 EXTERNBER int berDecStrmOpenType (OSCTXT *pctxt,
01965 const OSOCTET** object_p2,
01966 OSSIZE* pnumocts);
01967
01983 EXTERNBER int berDecStrmOpenTypeAppend (OSCTXT *pctxt,
01984 OSRTDList *pElemList);
01985
02011 EXTERNBER int berDecStrmOpenTypeExt (OSCTXT *pctxt, ASN1CCB* ccb_p,
02012 ASN1TAG* tags, int tagCount,
02013 OSRTDList *pElemList);
02014
02032 EXTERNBER int berDecStrmPeekTagAndLen
02033 (OSCTXT* pctxt, ASN1TAG* ptag, int* plen);
02034
02049 EXTERNBER int berDecStrmReadDynTLV (OSCTXT* pctxt, OSOCTET** ppbuf);
02050
02063 EXTERNBER int berDecStrmReadTLV (OSCTXT* pctxt, OSOCTET* buf, OSSIZE bufsiz);
02064
02085 EXTERNBER int berDecStrmReal (OSCTXT *pctxt, OSREAL *object_p,
02086 ASN1TagType tagging, int length);
02087
02110 EXTERNBER int berDecStrmReal10 (OSCTXT *pctxt, const char** object_p,
02111 ASN1TagType tagging, int length);
02112
02136 EXTERNBER int berDecStrmRelativeOID (OSCTXT *pctxt, ASN1OBJID *object_p,
02137 ASN1TagType tagging,
02138 int length);
02139
02152 EXTERNBER int berDecStrmTag (OSCTXT* pctxt, ASN1TAG *tag_p);
02153
02170 EXTERNBER int berDecStrmTagAndLen (OSCTXT *pctxt, ASN1TAG *tag_p,
02171 int *len_p);
02172
02194 EXTERNBER int berDecStrmTagAndLen2
02195 (OSCTXT* pctxt, ASN1TAG* tag_p, OSSIZE* len_p, OSBOOL* pIndefLen);
02196
02213 EXTERNBER OSBOOL berDecStrmTestEOC (OSCTXT* pctxt, ASN1CCB* ccb_p);
02214
02215 EXTERNBER OSBOOL berDecStrmTestEOC2 (OSCTXT* pctxt);
02216
02241 EXTERNBER int berDecStrmTestTag (OSCTXT* pctxt, ASN1TAG tag, int *len_p,
02242 OSBOOL advance);
02243
02266 EXTERNBER int berDecStrmUInt (OSCTXT *pctxt, OSUINT32 *object_p,
02267 ASN1TagType tagging, int length);
02268
02291 EXTERNBER int berDecStrmUInt8 (OSCTXT *pctxt, OSUINT8 *object_p,
02292 ASN1TagType tagging, int length);
02293
02316 EXTERNBER int berDecStrmUInt16 (OSCTXT *pctxt, OSUINT16 *object_p,
02317 ASN1TagType tagging, int length);
02318
02341 EXTERNBER int berDecStrmUInt64 (OSCTXT *pctxt, OSUINT64 *object_p,
02342 ASN1TagType tagging, int length);
02343
02368 EXTERNBER int berDecStrmUnivStr (OSCTXT* pctxt,
02369 Asn132BitCharString* object_p,
02370 ASN1TagType tagging, int length);
02372 #define cerEncCanonicalSort (pctxt, pMemCtxt, pList) \
02373 rtxEncCanonicalSort(pctxt, pMemCtxt, pList)
02374
02375 #define cerGetBufLocDescr (pctxt, pDescr) \
02376 rtxGetBufLocDescr(pctxt, pDescr)
02377
02378 #define cerAddBufLocDescr (pctxt, pElemList, pDescr) \
02379 rtxAddBufLocDescr(pctxt, pElemList, pDescr)
02380
02381 #ifdef __cplusplus
02382 }
02383 #endif
02384
02385
02386
02387 #define BS_CHKEOB(pctxt) \
02388 (((pctxt)->buffer.byteIndex + 2 > (pctxt)->buffer.size) ? TRUE : \
02389 (((pctxt)->buffer.data[(pctxt)->buffer.byteIndex] == 0 && \
02390 (pctxt)->buffer.data[(pctxt)->buffer.byteIndex + 1] == 0 ) ? \
02391 TRUE : FALSE))
02392
02393
02394
02395 #define BS_CHKEND(pctxt,ccb_p) \
02396 ((ccb_p)->stat = 0, \
02397 (((ccb_p)->len == ASN_K_INDEFLEN) ? berDecStrmTestEOC (pctxt,ccb_p) : \
02398 (((int)(OSRTSTREAM_BYTEINDEX(pctxt) - (ccb_p)->bytes) >= (ccb_p)->len))))
02399
02402 #endif