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
00081 typedef struct _Asn1BufLocDescr {
00082 OSUINT32 numocts;
00083 OSINT32 offset;
00084 } Asn1BufLocDescr;
00085
00086 #ifdef __cplusplus
00087 extern "C" {
00088
00089 #endif
00090
00091 #if defined(_WIN32) || defined(_WIN64)
00092 #ifndef EXTERNBER
00093 #ifdef BUILDASN1BERDLL
00094 #define EXTERNBER __declspec(dllexport)
00095 #elif defined (USEASN1BERDLL)
00096 #define EXTERNBER __declspec(dllimport)
00097 #else
00098 #define EXTERNBER
00099 #endif
00100 #endif
00101 #else
00102 #ifndef EXTERNBER
00103 #define EXTERNBER
00104 #endif
00105 #endif
00106
00107
00140 EXTERNBER int xd_tag (OSCTXT* pctxt, ASN1TAG *tag_p);
00141
00162 EXTERNBER int xd_tag_len (OSCTXT *pctxt, ASN1TAG *tag_p,
00163 int *len_p, OSOCTET flags);
00164
00189 EXTERNBER int xd_match (OSCTXT *pctxt, ASN1TAG tag,
00190 int *len_p, OSOCTET flags);
00191
00217 EXTERNBER int xd_boolean (OSCTXT *pctxt, OSBOOL *object_p,
00218 ASN1TagType tagging, int length);
00219
00243 EXTERNBER int xd_integer (OSCTXT *pctxt, OSINT32 *object_p,
00244 ASN1TagType tagging, int length);
00245
00263 EXTERNBER int xd_int8 (OSCTXT *pctxt, OSINT8 *object_p,
00264 ASN1TagType tagging, int length);
00265
00283 EXTERNBER int xd_int16 (OSCTXT *pctxt, OSINT16 *object_p,
00284 ASN1TagType tagging, int length);
00285
00310 EXTERNBER int xd_unsigned (OSCTXT *pctxt, OSUINT32 *object_p,
00311 ASN1TagType tagging, int length);
00312
00331 EXTERNBER int xd_uint8 (OSCTXT *pctxt, OSUINT8 *object_p,
00332 ASN1TagType tagging, int length);
00333
00352 EXTERNBER int xd_uint16 (OSCTXT *pctxt, OSUINT16 *object_p,
00353 ASN1TagType tagging, int length);
00354
00375 EXTERNBER int xd_int64 (OSCTXT *pctxt, OSINT64 *object_p,
00376 ASN1TagType tagging, int length);
00377
00399 EXTERNBER int xd_uint64 (OSCTXT *pctxt, OSUINT64 *object_p,
00400 ASN1TagType tagging, int length);
00401
00431 EXTERNBER int xd_bigint (OSCTXT *pctxt, const char** object_p,
00432 ASN1TagType tagging, int length);
00433
00461 EXTERNBER int xd_bitstr_s (OSCTXT *pctxt, OSOCTET* object_p,
00462 OSUINT32* numbits_p, ASN1TagType tagging,
00463 int length);
00464
00487 EXTERNBER int xd_bitstr (OSCTXT *pctxt, const OSOCTET** object_p2,
00488 OSUINT32* numbits_p, ASN1TagType tagging, int length);
00489
00509 EXTERNBER int xd_octstr_s (OSCTXT *pctxt, OSOCTET* object_p,
00510 OSUINT32* pnumocts, ASN1TagType tagging,
00511 int length);
00512
00532 EXTERNBER int xd_octstr (OSCTXT *pctxt, const OSOCTET** object_p2,
00533 OSUINT32* pnumocts, ASN1TagType tagging, int length);
00534
00556 EXTERNBER int xd_charstr (OSCTXT* pctxt, const char** object_p,
00557 ASN1TagType tagging, ASN1TAG tag, int length);
00558
00579 EXTERNBER int berDecCharArray (OSCTXT* pctxt, char* charArray,
00580 OSSIZE arraySize, ASN1TagType tagging,
00581 ASN1TAG tag, int length);
00582
00603 #define xd_utf8str(pctxt,object_p,tagging,length) \
00604 xd_charstr (pctxt, (const char**)object_p, tagging, ASN_ID_UTF8String, length)
00605
00628 EXTERNBER int xd_16BitCharStr (OSCTXT* pctxt, Asn116BitCharString* object_p,
00629 ASN1TagType tagging, ASN1TAG tag, int length);
00630
00653 EXTERNBER int xd_32BitCharStr (OSCTXT* pctxt, Asn132BitCharString* object_p,
00654 ASN1TagType tagging, ASN1TAG tag, int length);
00655
00670 EXTERNBER int xd_null (OSCTXT *pctxt, ASN1TagType tagging);
00671
00688 EXTERNBER int xd_objid (OSCTXT *pctxt, ASN1OBJID *object_p,
00689 ASN1TagType tagging, int length);
00690
00708 EXTERNBER int xd_oid64 (OSCTXT *pctxt, ASN1OID64 *object_p,
00709 ASN1TagType tagging, int length);
00710
00727 EXTERNBER int xd_reloid (OSCTXT *pctxt, ASN1OBJID *object_p,
00728 ASN1TagType tagging, int length);
00729
00745 EXTERNBER int xd_real (OSCTXT *pctxt, OSREAL *object_p,
00746 ASN1TagType tagging, int length);
00747
00763 EXTERNBER int xd_enum (OSCTXT *pctxt, OSINT32 *object_p,
00764 ASN1TagType tagging, int length);
00765
00781 EXTERNBER int xd_enumUnsigned (OSCTXT *pctxt, OSUINT32 *object_p,
00782 ASN1TagType tagging, int length);
00783
00799 EXTERNBER int xd_OpenType (OSCTXT *pctxt, const OSOCTET** object_p2,
00800 OSUINT32* pnumocts);
00801
00822 EXTERNBER int xd_OpenTypeExt (OSCTXT* pctxt, ASN1CCB* ccb_p, ASN1TAG* tags,
00823 int tagCount, OSRTDList *pElemList);
00824
00837 EXTERNBER int xd_OpenTypeAppend (OSCTXT *pctxt, OSRTDList *pElemList);
00838
00854 EXTERNBER int xd_real10 (OSCTXT *pctxt, const char** object_p,
00855 ASN1TagType tagging, int length);
00856
00887 EXTERNBER int xd_setp (OSCTXT *pctxt, const OSOCTET* msg_p,
00888 int msglen, ASN1TAG *tag_p, int *len_p);
00889
00897 EXTERNBER int xd_indeflen_ex (const OSOCTET* msg_p, int bufSize);
00898
00899
00900 #define xd_indeflen(m) xd_indeflen_ex(m, INT_MAX)
00901
00913 EXTERNBER int xd_len (OSCTXT *pctxt, int *len_p);
00914
00929 EXTERNBER int xd_chkend (OSCTXT *pctxt, ASN1CCB* ccb_p);
00930
00942 EXTERNBER int xd_count (OSCTXT *pctxt, int length, int *count_p);
00943
00952 EXTERNBER int xd_NextElement (OSCTXT* pctxt);
00953
00968 EXTERNBER int xd_Tag1AndLen (OSCTXT* pctxt, OSINT32* len_p);
00969
00970
00985 EXTERNBER int xd_memcpy (OSCTXT* pctxt, OSOCTET *object_p, int length) ;
00986
01005 EXTERNBER int xd_match1 (OSCTXT *pctxt, OSOCTET tag, int *len_p);
01006
01007
01010
01011
01047 EXTERNBER int xdf_tag (FILE* fp, ASN1TAG* ptag, OSOCTET* buffer, int* pbufidx);
01048
01067 EXTERNBER int xdf_len (FILE* fp, OSINT32* plen, OSOCTET* buffer, int* pbufidx);
01068
01089 EXTERNBER int xdf_TagAndLen (FILE* fp, ASN1TAG* ptag, OSINT32* plen,
01090 OSOCTET* buffer, int* pbufidx);
01091
01113 EXTERNBER int xdf_ReadPastEOC (FILE* fp, OSOCTET* buffer,
01114 int bufsiz, int* pbufidx);
01115
01139 EXTERNBER int xdf_ReadContents (FILE* fp, int len, OSOCTET* buffer,
01140 int bufsiz, int* pbufidx);
01145
01177 EXTERNBER int xe_identifier (OSCTXT *pctxt, OSUINT32 ident);
01178
01193 EXTERNBER int xe_tag (OSCTXT *pctxt, ASN1TAG tag);
01194
01221 EXTERNBER int xe_tag_len (OSCTXT *pctxt, ASN1TAG tag, int length) ;
01222
01246 EXTERNBER int xe_boolean (OSCTXT* pctxt, OSBOOL* object_p,
01247 ASN1TagType tagging);
01248
01269 EXTERNBER int xe_integer (OSCTXT* pctxt, int *object_p, ASN1TagType tagging);
01270
01292 EXTERNBER int xe_unsigned (OSCTXT* pctxt, OSUINT32 *object_p,
01293 ASN1TagType tagging);
01294
01315 EXTERNBER int xe_int8 (OSCTXT* pctxt, OSINT8 *object_p, ASN1TagType tagging);
01316
01337 EXTERNBER int xe_int16 (OSCTXT* pctxt, OSINT16 *object_p, ASN1TagType tagging);
01338
01361 EXTERNBER int xe_int64 (OSCTXT* pctxt, OSINT64 *object_p,
01362 ASN1TagType tagging);
01363
01387 EXTERNBER int xe_uint64 (OSCTXT* pctxt, OSUINT64 *object_p,
01388 ASN1TagType tagging);
01389
01411 EXTERNBER int xe_uint8 (OSCTXT* pctxt, OSUINT8 *object_p, ASN1TagType tagging);
01412
01434 EXTERNBER int xe_uint16 (OSCTXT* pctxt, OSUINT16 *object_p, ASN1TagType tagging);
01435
01462 EXTERNBER int xe_bigint (OSCTXT* pctxt, const char* object_p,
01463 ASN1TagType tagging);
01464
01486 EXTERNBER int xe_bitstr (OSCTXT* pctxt, const OSOCTET* object_p,
01487 OSUINT32 numbits, ASN1TagType tagging);
01488
01511 EXTERNBER int xe_octstr (OSCTXT* pctxt, const OSOCTET* object_p,
01512 OSUINT32 numocts, ASN1TagType tagging);
01513
01540 EXTERNBER int xe_charstr (OSCTXT* pctxt, const char* object_p,
01541 ASN1TagType tagging, ASN1TAG tag);
01542
01562 #define xe_utf8str(pctxt,object_p,tagging) \
01563 xe_charstr (pctxt, (const char*)object_p, tagging, ASN_ID_UTF8String)
01564
01594 EXTERNBER int xe_16BitCharStr (OSCTXT* pctxt, Asn116BitCharString* object_p,
01595 ASN1TagType tagging, ASN1TAG tag);
01596
01626 EXTERNBER int xe_32BitCharStr (OSCTXT* pctxt, Asn132BitCharString* object_p,
01627 ASN1TagType tagging, ASN1TAG tag);
01628
01645 EXTERNBER int xe_null (OSCTXT* pctxt, ASN1TagType tagging);
01646
01664 EXTERNBER int xe_objid (OSCTXT* pctxt, ASN1OBJID *object_p,
01665 ASN1TagType tagging);
01666
01685 EXTERNBER int xe_oid64 (OSCTXT* pctxt, ASN1OID64 *object_p,
01686 ASN1TagType tagging);
01687
01705 EXTERNBER int xe_reloid (OSCTXT* pctxt, ASN1OBJID *object_p,
01706 ASN1TagType tagging);
01707
01728 EXTERNBER int xe_enum (OSCTXT* pctxt, OSINT32 *object_p, ASN1TagType tagging);
01729
01750 EXTERNBER int xe_enumUnsigned (OSCTXT* pctxt, OSUINT32 *object_p,
01751 ASN1TagType tagging);
01752
01777 EXTERNBER int xe_real (OSCTXT* pctxt, OSREAL *object_p, ASN1TagType tagging);
01778
01798 EXTERNBER int xe_OpenType (OSCTXT* pctxt, const OSOCTET* object_p,
01799 OSUINT32 numocts);
01800
01807 EXTERNBER int xe_OpenTypeExt (OSCTXT* pctxt, OSRTDList* pElemList);
01808
01827 EXTERNBER int xe_real10 (OSCTXT *pctxt, const char* object_p,
01828 ASN1TagType tagging);
01829
01848 EXTERNBER int xe_derReal10 (OSCTXT *pctxt, const char* object_p,
01849 ASN1TagType tagging);
01850
01868 EXTERNBER int xe_setp (OSCTXT* pctxt, OSOCTET *buf_p, int bufsiz);
01869
01883 EXTERNBER OSOCTET* xe_getp (OSCTXT* pctxt);
01884
01902 EXTERNBER void xe_free (OSCTXT* pctxt);
01903
01927 EXTERNBER int xe_expandBuffer (OSCTXT *pctxt, size_t length);
01928
01949 EXTERNBER int xe_memcpy (OSCTXT *pctxt, const OSOCTET* object_p,
01950 size_t length) ;
01951
01964 EXTERNBER int xe_len (OSCTXT *pctxt, int length) ;
01965
01984 EXTERNBER int xe_derCanonicalSort (OSCTXT* pctxt, OSRTSList* pList);
01985
02001 EXTERNBER int xe_TagAndIndefLen (OSCTXT *pctxt, ASN1TAG tag, int length) ;
02002
02010 EXTERNBER void xe_getBufLocDescr (OSCTXT *pctxt, OSUINT32 length,
02011 Asn1BufLocDescr* pDescr);
02012
02032 EXTERNBER int derEncBitString
02033 (OSCTXT* pctxt, const OSOCTET* pvalue, OSUINT32 numbits,
02034 ASN1TagType tagging);
02035
02038
02039
02062 EXTERNBER int berDefToIndefLen (OSCTXT *pSrcCtxt, OSCTXT *pDstCtxt);
02063
02074 EXTERNBER int berIndefToDefLen (OSCTXT *pSrcCtxt, OSCTXT *pDstCtxt);
02075
02083 EXTERNBER OSBOOL berErrAddTagParm (OSCTXT* pctxt, ASN1TAG tag);
02084
02085
02086
02087 #define xu_addTagErrParm berErrAddTagParm
02088
02098 EXTERNBER int berErrUnexpTag (OSCTXT* pctxt, ASN1TAG exptag);
02099
02104 EXTERNBER int berGetLibVersion (OSVOIDARG);
02105
02111 EXTERNBER const char *berGetLibInfo (OSVOIDARG);
02112
02131 EXTERNBER int berParseTagLen
02132 (const OSOCTET* buffer, size_t bufidx, size_t bufsiz,
02133 ASN1TAG* ptag, size_t* plen);
02134
02144 EXTERNBER const char* berTagToString
02145 (ASN1TAG tag, char* buffer, size_t bufsiz);
02146
02157 EXTERNBER const char* berTagToDynStr (OSCTXT* pctxt, ASN1TAG tag);
02158
02159 EXTERNBER int xu_verify_len (OSOCTET *msg_p);
02160 EXTERNBER void *xu_parse_mmbuf (
02161 OSOCTET **buf_p2, int *buflen_p, OSOCTET *start_p, int bufsiz);
02162
02186 EXTERNBER void xu_alloc_array (
02187 OSCTXT* pctxt, ASN1SeqOf* seqOf_p, int recSize, int recCount);
02188
02189 EXTERNBER void xu_octscpy_s (
02190 OSUINT32* nocts_p, OSOCTET *data_p, char *cstr, char zterm);
02191
02192 EXTERNBER void xu_octscpy_ss (ASN1OctStr *octStr_p, char *cstring, char zterm);
02193
02194 EXTERNBER void xu_octscpy_d (
02195 OSCTXT* pctxt, OSUINT32* nocts_p, const OSOCTET** data_p2,
02196 char* cstring, char zterm);
02197
02198 EXTERNBER void xu_octscpy_ds (
02199 OSCTXT* pctxt, ASN1DynOctStr *octStr_p, char *cstring, char zterm);
02200
02201 EXTERNBER void xu_octmcpy_s (ASN1OctStr *octStr_p, void* data_p, int datalen);
02202
02203 EXTERNBER void xu_octmcpy_d (
02204 OSCTXT* pctxt, ASN1DynOctStr *octStr_p, void* data_p, int datalen);
02205
02206 EXTERNBER char* xu_fetchstr (int numocts, char *data);
02207
02208 EXTERNBER int xu_hexstrcpy (char *data, char *hstring);
02209 EXTERNBER int xu_binstrcpy (char *data, char *bstring);
02210
02236 EXTERNBER int xu_dump (const OSOCTET *msgptr, ASN1DumpCbFunc cb, void* cbArg_p);
02237
02249 EXTERNBER int xu_fdump (FILE *file_p, const OSOCTET *msgptr);
02250
02266 #define xu_hex_dump(msg,numoct,hdr) rtxHexDump(msg,numoct)
02267
02288 EXTERNBER int xu_dump2 (OSCTXT *pctxt, const OSOCTET *msgptr);
02289
02290 EXTERNBER void xu_fmt_tag (
02291 ASN1TAG *tag_p, char *class_p, char *form_p, char *id_code);
02292
02293 EXTERNBER char* xu_fmt_tag2 (ASN1TAG *tag_p, char* bufp);
02294
02295 EXTERNBER char* xu_fmt_contents (OSCTXT* pctxt, int len, int *count);
02296
02297 EXTERNBER int xu_fread (FILE* fp, OSOCTET* bufp, int bufsiz);
02298
02305 EXTERNBER void xu_SaveBufferState (OSCTXT* pCtxt, OSRTBufSave* pSavedInfo);
02306
02314 EXTERNBER void xu_RestoreBufferState (OSCTXT* pCtxt, OSRTBufSave* pSavedInfo);
02315
02318 #ifdef __cplusplus
02319 }
02320 #endif
02321
02322 #endif