00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00071 #ifndef _ASN1BER_H_
00072 #define _ASN1BER_H_
00073
00074 #include "rtsrc/asn1type.h"
00075 #include "rtbersrc/berMacros.h"
00076 #include "rtxsrc/rtxBuffer.h"
00077
00078 typedef OSRTBufLocDescr Asn1BufLocDescr;
00079
00080
00081 #ifdef __cplusplus
00082 extern "C" {
00083
00084 #endif
00085
00086 #if defined(_WIN32) || defined(_WIN64)
00087 #ifndef EXTERNBER
00088 #ifdef BUILDASN1BERDLL
00089 #define EXTERNBER __declspec(dllexport)
00090 #elif defined (USEASN1BERDLL)
00091 #define EXTERNBER __declspec(dllimport)
00092 #else
00093 #define EXTERNBER
00094 #endif
00095 #endif
00096 #else
00097 #ifndef EXTERNBER
00098 #define EXTERNBER
00099 #endif
00100 #endif
00101
00102
00135 EXTERNBER int xd_tag (OSCTXT* pctxt, ASN1TAG *tag_p);
00136
00157 EXTERNBER int xd_tag_len (OSCTXT *pctxt, ASN1TAG *tag_p,
00158 int *len_p, OSOCTET flags);
00174 EXTERNBER int xd_tag_len_64 (OSCTXT *pctxt, ASN1TAG *tag_p,
00175 OSSIZE *len_p, OSBOOL* pIndefLen, OSOCTET flags);
00176
00201 EXTERNBER int xd_match (OSCTXT *pctxt, ASN1TAG tag,
00202 int *len_p, OSOCTET flags);
00203
00231 EXTERNBER int xd_match64 (OSCTXT *pctxt, ASN1TAG tag, OSSIZE* len_p,
00232 OSBOOL* pindef, OSOCTET flags);
00233
00259 EXTERNBER int xd_boolean (OSCTXT *pctxt, OSBOOL *object_p,
00260 ASN1TagType tagging, int length);
00261
00285 EXTERNBER int xd_integer (OSCTXT *pctxt, OSINT32 *object_p,
00286 ASN1TagType tagging, int length);
00287
00305 EXTERNBER int xd_int8 (OSCTXT *pctxt, OSINT8 *object_p,
00306 ASN1TagType tagging, int length);
00307
00325 EXTERNBER int xd_int16 (OSCTXT *pctxt, OSINT16 *object_p,
00326 ASN1TagType tagging, int length);
00327
00352 EXTERNBER int xd_unsigned (OSCTXT *pctxt, OSUINT32 *object_p,
00353 ASN1TagType tagging, int length);
00354
00373 EXTERNBER int xd_uint8 (OSCTXT *pctxt, OSUINT8 *object_p,
00374 ASN1TagType tagging, int length);
00375
00394 EXTERNBER int xd_uint16 (OSCTXT *pctxt, OSUINT16 *object_p,
00395 ASN1TagType tagging, int length);
00396
00417 EXTERNBER int xd_int64 (OSCTXT *pctxt, OSINT64 *object_p,
00418 ASN1TagType tagging, int length);
00419
00441 EXTERNBER int xd_uint64 (OSCTXT *pctxt, OSUINT64 *object_p,
00442 ASN1TagType tagging, int length);
00443
00473 EXTERNBER int xd_bigint (OSCTXT *pctxt, const char** object_p,
00474 ASN1TagType tagging, int length);
00475
00503 EXTERNBER int xd_bitstr_s (OSCTXT *pctxt, OSOCTET* object_p,
00504 OSUINT32* numbits_p, ASN1TagType tagging,
00505 int length);
00506
00535 EXTERNBER int xd_bitstr64_s (OSCTXT* pctxt,
00536 OSOCTET* object_p, OSSIZE* numbits_p,
00537 ASN1TagType tagging, OSSIZE length,
00538 OSBOOL indefLen);
00539
00562 EXTERNBER int xd_bitstr (OSCTXT *pctxt, const OSOCTET** object_p2,
00563 OSUINT32* numbits_p, ASN1TagType tagging, int length);
00564
00589 EXTERNBER int xd_bitstr64 (OSCTXT* pctxt,
00590 const OSOCTET** object_p2, OSSIZE* numbits_p,
00591 ASN1TagType tagging, OSSIZE length,
00592 OSBOOL indefLen);
00612 EXTERNBER int xd_octstr_s (OSCTXT *pctxt, OSOCTET* object_p,
00613 OSUINT32* pnumocts, ASN1TagType tagging,
00614 int length);
00615
00636 EXTERNBER int xd_octstr64_s
00637 (OSCTXT* pctxt, OSOCTET* object_p, OSSIZE* pnumocts,
00638 ASN1TagType tagging, OSSIZE length, OSBOOL indefLen);
00639
00659 EXTERNBER int xd_octstr (OSCTXT *pctxt, const OSOCTET** object_p2,
00660 OSUINT32* pnumocts, ASN1TagType tagging, int length);
00661
00684 EXTERNBER int xd_octstr64
00685 (OSCTXT* pctxt, OSOCTET** object_p2, OSSIZE* pnumocts,
00686 ASN1TagType tagging, OSSIZE length, OSBOOL indefLen);
00687
00709 EXTERNBER int xd_charstr (OSCTXT* pctxt, const char** object_p,
00710 ASN1TagType tagging, ASN1TAG tag, int length);
00711
00736 EXTERNBER int xd_charstr64 (OSCTXT* pctxt, char** object_p,
00737 ASN1TagType tagging, ASN1TAG tag,
00738 OSSIZE length, OSBOOL indefLen);
00739
00761 EXTERNBER int xd_datestr(OSCTXT* pctxt, const char** object_p,
00762 ASN1TagType tagging, ASN1TAG tag, int length);
00763
00785 EXTERNBER int xd_timestr(OSCTXT* pctxt, const char** object_p,
00786 ASN1TagType tagging, ASN1TAG tag, int length);
00787
00809 EXTERNBER int xd_datetimestr(OSCTXT* pctxt, const char** object_p,
00810 ASN1TagType tagging, ASN1TAG tag, int length);
00811
00833 EXTERNBER int xd_timeofdaystr(OSCTXT* pctxt, const char** object_p,
00834 ASN1TagType tagging, ASN1TAG tag, int length);
00835
00857 EXTERNBER int xd_durationstr(OSCTXT* pctxt, const char** object_p,
00858 ASN1TagType tagging, ASN1TAG tag, int length);
00859
00880 EXTERNBER int berDecCharArray (OSCTXT* pctxt, char* charArray,
00881 OSSIZE arraySize, ASN1TagType tagging,
00882 ASN1TAG tag, int length);
00883
00904 #define xd_utf8str(pctxt,object_p,tagging,length) \
00905 xd_charstr (pctxt, (const char**)object_p, tagging, ASN_ID_UTF8String, length)
00906
00929 EXTERNBER int xd_16BitCharStr (OSCTXT* pctxt, Asn116BitCharString* object_p,
00930 ASN1TagType tagging, ASN1TAG tag, int length);
00931
00957 EXTERNBER int xd_16BitCharStr64 (OSCTXT* pctxt, Asn116BitCharString* object_p,
00958 ASN1TagType tagging, ASN1TAG tag,
00959 OSSIZE length, OSBOOL indefLen);
00960
00983 EXTERNBER int xd_32BitCharStr (OSCTXT* pctxt, Asn132BitCharString* object_p,
00984 ASN1TagType tagging, ASN1TAG tag, int length);
00985
01007 EXTERNBER int xd_32BitCharStr64 (OSCTXT* pctxt, Asn132BitCharString* object_p,
01008 ASN1TagType tagging, ASN1TAG tag,
01009 OSSIZE length, OSBOOL indefLen);
01010
01025 EXTERNBER int xd_null (OSCTXT *pctxt, ASN1TagType tagging);
01026
01043 EXTERNBER int xd_objid (OSCTXT *pctxt, ASN1OBJID *object_p,
01044 ASN1TagType tagging, int length);
01045
01063 EXTERNBER int xd_oid64 (OSCTXT *pctxt, ASN1OID64 *object_p,
01064 ASN1TagType tagging, int length);
01065
01082 EXTERNBER int xd_reloid (OSCTXT *pctxt, ASN1OBJID *object_p,
01083 ASN1TagType tagging, int length);
01084
01100 EXTERNBER int xd_real (OSCTXT *pctxt, OSREAL *object_p,
01101 ASN1TagType tagging, int length);
01102
01118 EXTERNBER int xd_enum (OSCTXT *pctxt, OSINT32 *object_p,
01119 ASN1TagType tagging, int length);
01120
01136 EXTERNBER int xd_enumUnsigned (OSCTXT *pctxt, OSUINT32 *object_p,
01137 ASN1TagType tagging, int length);
01138
01154 EXTERNBER int xd_OpenType (OSCTXT* pctxt, const OSOCTET** object_p2,
01155 OSSIZE* pnumocts);
01156
01177 EXTERNBER int xd_OpenTypeExt (OSCTXT* pctxt, ASN1CCB* ccb_p, ASN1TAG* tags,
01178 int tagCount, OSRTDList *pElemList);
01179
01198 EXTERNBER int xd_OpenTypeExt64 (OSCTXT* pctxt, const OSOCTET* consptr,
01199 OSSIZE conslen, OSBOOL indefLen, ASN1TAG* tags,
01200 OSSIZE tagCount, OSRTDList *pElemList);
01201
01214 EXTERNBER int xd_OpenTypeAppend (OSCTXT *pctxt, OSRTDList *pElemList);
01215
01231 EXTERNBER int xd_real10 (OSCTXT *pctxt, const char** object_p,
01232 ASN1TagType tagging, int length);
01233
01264 EXTERNBER int xd_setp (OSCTXT *pctxt, const OSOCTET* msg_p,
01265 int msglen, ASN1TAG *tag_p, int *len_p);
01266
01299 EXTERNBER int xd_setp64 (OSCTXT *pctxt, const OSOCTET* msg_p, OSSIZE msglen,
01300 ASN1TAG *tag_p, OSSIZE *len_p, OSBOOL* pIndefLen);
01301
01311 EXTERNBER int xd_indeflen_ex (const OSOCTET* msg_p, int bufSize);
01312
01313
01314 #define xd_indeflen(m) xd_indeflen_ex(m, INT_MAX)
01315
01328 EXTERNBER int xd_indeflen64
01329 (const OSOCTET* msg_p, OSSIZE bufSize, OSSIZE* plength);
01330
01342 EXTERNBER int xd_len (OSCTXT *pctxt, int *len_p);
01343
01357 EXTERNBER int xd_len64 (OSCTXT *pctxt, OSSIZE* len_p, OSBOOL* pindef);
01358
01373 EXTERNBER OSBOOL xd_chkend (OSCTXT* pctxt, const ASN1CCB* ccb_p);
01374
01387 EXTERNBER OSBOOL xd_chkend64 (OSCTXT* pctxt, const OSOCTET* consptr,
01388 OSSIZE conslen, OSBOOL indef);
01389
01401 EXTERNBER int xd_count (OSCTXT *pctxt, int length, int *count_p);
01402
01416 EXTERNBER int xd_count64
01417 (OSCTXT *pctxt, OSSIZE length, OSBOOL indefLen, OSSIZE *count_p);
01418
01427 EXTERNBER int xd_NextElement (OSCTXT* pctxt);
01428
01443 EXTERNBER int xd_Tag1AndLen (OSCTXT* pctxt, OSINT32* len_p);
01444
01445
01460 EXTERNBER int xd_memcpy (OSCTXT* pctxt, OSOCTET *object_p, int length) ;
01461
01480 EXTERNBER int xd_match1 (OSCTXT *pctxt, OSOCTET tag, int *len_p);
01481
01482 EXTERNBER int xd_match1_64
01483 (OSCTXT *pctxt, OSOCTET tag, OSSIZE* len_p, OSBOOL *pindef);
01484
01485
01488
01489
01525 EXTERNBER int xdf_tag (FILE* fp, ASN1TAG* ptag, OSOCTET* buffer, int* pbufidx);
01526
01545 EXTERNBER int xdf_len (FILE* fp, OSINT32* plen, OSOCTET* buffer, int* pbufidx);
01546
01567 EXTERNBER int xdf_TagAndLen (FILE* fp, ASN1TAG* ptag, OSINT32* plen,
01568 OSOCTET* buffer, int* pbufidx);
01569
01591 EXTERNBER int xdf_ReadPastEOC (FILE* fp, OSOCTET* buffer,
01592 int bufsiz, int* pbufidx);
01593
01617 EXTERNBER int xdf_ReadContents (FILE* fp, int len, OSOCTET* buffer,
01618 int bufsiz, int* pbufidx);
01623
01655 EXTERNBER int xe_identifier (OSCTXT *pctxt, OSUINT32 ident);
01656
01671 EXTERNBER int xe_tag (OSCTXT *pctxt, ASN1TAG tag);
01672
01699 EXTERNBER int xe_tag_len (OSCTXT *pctxt, ASN1TAG tag, int length) ;
01700
01724 EXTERNBER int xe_boolean (OSCTXT* pctxt, OSBOOL* object_p,
01725 ASN1TagType tagging);
01726
01747 EXTERNBER int xe_integer (OSCTXT* pctxt, int *object_p, ASN1TagType tagging);
01748
01770 EXTERNBER int xe_unsigned (OSCTXT* pctxt, OSUINT32 *object_p,
01771 ASN1TagType tagging);
01772
01793 EXTERNBER int xe_int8 (OSCTXT* pctxt, OSINT8 *object_p, ASN1TagType tagging);
01794
01815 EXTERNBER int xe_int16 (OSCTXT* pctxt, OSINT16 *object_p, ASN1TagType tagging);
01816
01839 EXTERNBER int xe_int64 (OSCTXT* pctxt, OSINT64 *object_p,
01840 ASN1TagType tagging);
01841
01865 EXTERNBER int xe_uint64 (OSCTXT* pctxt, OSUINT64 *object_p,
01866 ASN1TagType tagging);
01867
01889 EXTERNBER int xe_uint8 (OSCTXT* pctxt, OSUINT8 *object_p, ASN1TagType tagging);
01890
01912 EXTERNBER int xe_uint16 (OSCTXT* pctxt, OSUINT16 *object_p, ASN1TagType tagging);
01913
01940 EXTERNBER int xe_bigint (OSCTXT* pctxt, const char* object_p,
01941 ASN1TagType tagging);
01942
01964 EXTERNBER int xe_bitstr (OSCTXT* pctxt, const OSOCTET* object_p,
01965 OSSIZE numbits, ASN1TagType tagging);
01966
01989 EXTERNBER int xe_octstr (OSCTXT* pctxt, const OSOCTET* object_p,
01990 OSSIZE numocts, ASN1TagType tagging);
01991
02018 EXTERNBER int xe_charstr (OSCTXT* pctxt, const char* object_p,
02019 ASN1TagType tagging, ASN1TAG tag);
02020
02040 #define xe_utf8str(pctxt,object_p,tagging) \
02041 xe_charstr (pctxt, (const char*)object_p, tagging, ASN_ID_UTF8String)
02042
02072 EXTERNBER int xe_16BitCharStr (OSCTXT* pctxt, Asn116BitCharString* object_p,
02073 ASN1TagType tagging, ASN1TAG tag);
02074
02104 EXTERNBER int xe_32BitCharStr (OSCTXT* pctxt, Asn132BitCharString* object_p,
02105 ASN1TagType tagging, ASN1TAG tag);
02106
02132 EXTERNBER int xe_datestr(OSCTXT* pctxt, const char* object_p,
02133 ASN1TagType tagging, ASN1TAG tag);
02134
02160 EXTERNBER int xe_timestr(OSCTXT* pctxt, const char* object_p,
02161 ASN1TagType tagging, ASN1TAG tag);
02162
02188 EXTERNBER int xe_datetimestr(OSCTXT* pctxt, const char* object_p,
02189 ASN1TagType tagging, ASN1TAG tag);
02190
02216 EXTERNBER int xe_timeofdaystr(OSCTXT* pctxt, const char* object_p,
02217 ASN1TagType tagging, ASN1TAG tag);
02218
02244 EXTERNBER int xe_durationstr(OSCTXT* pctxt, const char* object_p,
02245 ASN1TagType tagging, ASN1TAG tag);
02246
02263 EXTERNBER int xe_null (OSCTXT* pctxt, ASN1TagType tagging);
02264
02282 EXTERNBER int xe_objid (OSCTXT* pctxt, ASN1OBJID *object_p,
02283 ASN1TagType tagging);
02284
02303 EXTERNBER int xe_oid64 (OSCTXT* pctxt, ASN1OID64 *object_p,
02304 ASN1TagType tagging);
02305
02323 EXTERNBER int xe_reloid (OSCTXT* pctxt, ASN1OBJID *object_p,
02324 ASN1TagType tagging);
02325
02346 EXTERNBER int xe_enum (OSCTXT* pctxt, OSINT32 *object_p, ASN1TagType tagging);
02347
02368 EXTERNBER int xe_enumUnsigned (OSCTXT* pctxt, OSUINT32 *object_p,
02369 ASN1TagType tagging);
02370
02395 EXTERNBER int xe_real (OSCTXT* pctxt, OSREAL *object_p, ASN1TagType tagging);
02396
02416 EXTERNBER int xe_OpenType (OSCTXT* pctxt, const OSOCTET* object_p,
02417 OSSIZE numocts);
02418
02425 EXTERNBER int xe_OpenTypeExt (OSCTXT* pctxt, OSRTDList* pElemList);
02426
02445 EXTERNBER int xe_real10 (OSCTXT *pctxt, const char* object_p,
02446 ASN1TagType tagging);
02447
02466 EXTERNBER int xe_derReal10 (OSCTXT *pctxt, const char* object_p,
02467 ASN1TagType tagging);
02468
02486 EXTERNBER int xe_setp (OSCTXT* pctxt, OSOCTET *buf_p, int bufsiz);
02487
02501 EXTERNBER OSOCTET* xe_getp (OSCTXT* pctxt);
02502
02520 EXTERNBER void xe_free (OSCTXT* pctxt);
02521
02545 EXTERNBER int xe_expandBuffer (OSCTXT *pctxt, size_t length);
02546
02567 EXTERNBER int xe_memcpy (OSCTXT *pctxt, const OSOCTET* object_p,
02568 size_t length) ;
02569
02582 EXTERNBER int xe_len (OSCTXT *pctxt, int length) ;
02583
02602 EXTERNBER int xe_derCanonicalSort (OSCTXT* pctxt, OSRTSList* pList);
02603
02619 EXTERNBER int xe_TagAndIndefLen (OSCTXT *pctxt, ASN1TAG tag, int length) ;
02620
02628 EXTERNBER void xe_getBufLocDescr (OSCTXT *pctxt, OSSIZE length,
02629 Asn1BufLocDescr* pDescr);
02630
02650 EXTERNBER int derEncBitString
02651 (OSCTXT* pctxt, const OSOCTET* pvalue, OSUINT32 numbits,
02652 ASN1TagType tagging);
02653
02656
02657
02680 EXTERNBER int berDefToIndefLen (OSCTXT *pSrcCtxt, OSCTXT *pDstCtxt);
02681
02692 EXTERNBER int berIndefToDefLen (OSCTXT *pSrcCtxt, OSCTXT *pDstCtxt);
02693
02701 EXTERNBER OSBOOL berErrAddTagParm (OSCTXT* pctxt, ASN1TAG tag);
02702
02703
02704
02705 #define xu_addTagErrParm berErrAddTagParm
02706
02716 EXTERNBER int berErrUnexpTag (OSCTXT* pctxt, ASN1TAG exptag);
02717
02722 EXTERNBER int berGetLibVersion (OSVOIDARG);
02723
02729 EXTERNBER const char *berGetLibInfo (OSVOIDARG);
02730
02749 EXTERNBER int berParseTagLen
02750 (const OSOCTET* buffer, size_t bufidx, size_t bufsiz,
02751 ASN1TAG* ptag, size_t* plen);
02752
02762 EXTERNBER const char* berTagToString
02763 (ASN1TAG tag, char* buffer, size_t bufsiz);
02764
02775 EXTERNBER const char* berTagToDynStr (OSCTXT* pctxt, ASN1TAG tag);
02776
02777
02793 EXTERNBER int berValidateIso8601DateStr(OSCTXT* pctxt, const char** ppvalue);
02794
02810 EXTERNBER int berValidateIso8601DurationStr(OSCTXT* pctxt, const char** ppvalue);
02811
02827 EXTERNBER int berValidateIso8601TimeStr(OSCTXT* pctxt, const char** ppvalue);
02828
02829
02830 EXTERNBER int xu_verify_len (OSOCTET *msg_p);
02831 EXTERNBER void *xu_parse_mmbuf (
02832 OSOCTET **buf_p2, int *buflen_p, OSOCTET *start_p, int bufsiz);
02833
02857 EXTERNBER void xu_alloc_array (
02858 OSCTXT* pctxt, ASN1SeqOf* seqOf_p, int recSize, int recCount);
02859
02860 EXTERNBER void xu_octscpy_s (
02861 OSUINT32* nocts_p, OSOCTET *data_p, char *cstr, char zterm);
02862
02863 EXTERNBER void xu_octscpy_ss (ASN1OctStr *octStr_p, char *cstring, char zterm);
02864
02865 EXTERNBER void xu_octscpy_d (
02866 OSCTXT* pctxt, OSUINT32* nocts_p, const OSOCTET** data_p2,
02867 char* cstring, char zterm);
02868
02869 EXTERNBER void xu_octscpy_ds (
02870 OSCTXT* pctxt, ASN1DynOctStr *octStr_p, char *cstring, char zterm);
02871
02872 EXTERNBER void xu_octmcpy_s (ASN1OctStr *octStr_p, void* data_p, int datalen);
02873
02874 EXTERNBER void xu_octmcpy_d (
02875 OSCTXT* pctxt, ASN1DynOctStr *octStr_p, void* data_p, int datalen);
02876
02877 EXTERNBER char* xu_fetchstr (int numocts, char *data);
02878
02879 EXTERNBER int xu_hexstrcpy (char *data, char *hstring);
02880 EXTERNBER int xu_binstrcpy (char *data, char *bstring);
02881
02907 EXTERNBER int xu_dump (const OSOCTET *msgptr, ASN1DumpCbFunc cb, void* cbArg_p);
02908
02920 EXTERNBER int xu_fdump (FILE *file_p, const OSOCTET *msgptr);
02921
02937 #define xu_hex_dump(msg,numoct,hdr) rtxHexDump(msg,numoct)
02938
02959 EXTERNBER int xu_dump2 (OSCTXT *pctxt, const OSOCTET *msgptr);
02960
02961 EXTERNBER void xu_fmt_tag (
02962 ASN1TAG *tag_p, char *class_p, char *form_p, char *id_code);
02963
02964 EXTERNBER char* xu_fmt_tag2 (ASN1TAG *tag_p, char* bufp);
02965
02966 EXTERNBER char* xu_fmt_contents (OSCTXT* pctxt, int len, int *count);
02967
02968 EXTERNBER int xu_fread (FILE* fp, OSOCTET* bufp, int bufsiz);
02969
02976 EXTERNBER void xu_SaveBufferState (OSCTXT* pCtxt, OSRTBufSave* pSavedInfo);
02977
02985 EXTERNBER void xu_RestoreBufferState (OSCTXT* pCtxt, OSRTBufSave* pSavedInfo);
02986
02989 int xd_MovePastEOC (OSCTXT* pctxt);
02990
02991 int xd_consStrIndefLenAndSize
02992 (OSCTXT* pctxt, ASN1TAG expectedTag, OSSIZE* length, OSSIZE* size);
02993
02994 #ifdef __cplusplus
02995 }
02996 #endif
02997
02998 #endif