asn1-generator-pass.h revision 067467bad896150ed0ae5877b1ff1b7415d84b8a
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * IPRT - ASN.1 Code Generator, One Pass.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Copyright (C) 2006-2014 Oracle Corporation
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * available from http://www.virtualbox.org. This file is free software;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * you can redistribute it and/or modify it under the terms of the GNU
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * General Public License (GPL) as published by the Free Software
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * The contents of this file may alternatively be used under the terms
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * of the Common Development and Distribution License Version 1.0
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * VirtualBox OSE distribution, in which case the provisions of the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * CDDL are applicable instead of those of the GPL.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * You may elect to license modified versions of this file under the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * terms and conditions of either the GPL or the CDDL or both.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/** @def RTASN1TMPL_MEMBER_OPT_ANY
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Used for optional entries without any specific type at the end of a
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * structure.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * For example PolicyQualifierInfo's qualifier member which is defined as:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * ANY DEFINED BY policyQualifierId
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Defaults to RTASN1TMPL_MEMBER_EX.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/** @def RTASN1TMPL_MEMBER_OPT_ITAG_EX
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Optional member with implict tag, extended version.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * This is what all the other RTASN1TMPL_MEMBER_OPT_ITAG* macros defere to.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/** @def RTASN1TMPL_MEMBER_OPT_ITAG_CP
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Optional member of a typical primitive type with an implicit context tag.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Examples of this can be found in AuthorityKeyIdentifier where the first and
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * last member are primitive types (normally anyways).:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * keyIdentifier [1] OCTET STRING OPTIONAL,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * authorityCertSerialNumber [3] INTEGER OPTIONAL
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/** @def RTASN1TMPL_MEMBER_OPT_ITAG_UC
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Optional member of a constructed type from the universal tag class.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/** @def RTASN1TMPL_MEMBER_OPT_ITAG_UP
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Optional member of a primitive type from the universal tag class.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/** @name Expansion Passes (RTASN1TMPL_PASS values)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/** @name ITAG clues
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#define RTASN1TMPL_ITAG_F_CC 1 /**< context, constructed. */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#define RTASN1TMPL_ITAG_F_CP 2 /**< context, probably primary. (w/ numeric value) */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#define RTASN1TMPL_ITAG_F_UP 3 /**< universal, probably primary. (w/ ASN1_TAG_XXX value) */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#define RTASN1TMPL_ITAG_F_UC 4 /**< universal, constructed. (w/ ASN1_TAG_XXX value) */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/** Expands the ITAG clues into tag flag and tag class. */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ( a_fClue == RTASN1TMPL_ITAG_F_CC ? (ASN1_TAGCLASS_CONTEXT | ASN1_TAGFLAG_CONSTRUCTED ) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync : a_fClue == RTASN1TMPL_ITAG_F_CP ? (ASN1_TAGCLASS_CONTEXT | ASN1_TAGFLAG_PRIMITIVE) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync : a_fClue == RTASN1TMPL_ITAG_F_UP ? (ASN1_TAGCLASS_UNIVERSAL | ASN1_TAGFLAG_PRIMITIVE) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync : a_fClue == RTASN1TMPL_ITAG_F_UC ? (ASN1_TAGCLASS_UNIVERSAL | ASN1_TAGFLAG_CONSTRUCTED) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#define RTASN1TMPL_SEMICOLON_DUMMY() typedef unsigned RTASN1TMPLSEMICOLONDUMMY
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#endif /* !___iprt_asn1_generator_pass_h */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#if RTASN1TMPL_PASS == RTASN1TMPL_PASS_INTERNAL_HEADER
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Internal header file.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_COMMON() extern DECLHIDDEN(RTASN1COREVTABLE const) RT_CONCAT3(g_,RTASN1TMPL_INT_NAME,_Vtable)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_SEQCORE() RTASN1TMPL_BEGIN_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_SETCORE() RTASN1TMPL_BEGIN_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_EX(a_Name, a_Type, a_Api, a_Constraints) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_BEGIN(a_enmType, a_enmMembNm, a_Allocation) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_END(a_enmType, a_enmMembNm, a_Allocation) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SEQCORE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SETCORE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_PCHOICE() RTASN1TMPL_BEGIN_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_ITAG_EX(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api, a_fClue, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_XTAG_EX(a_uTag, a_enmChoice, a_PtrTnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_PCHOICE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SEQ_OF(a_ItemType, a_ItemApi) RTASN1TMPL_BEGIN_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SET_OF(a_ItemType, a_ItemApi) RTASN1TMPL_BEGIN_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Internal header file.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_COMMON(a_uDefaultTag, a_fDefaultClass) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync DECL_HIDDEN_CONST(RTASN1COREVTABLE const) RT_CONCAT3(g_,RTASN1TMPL_INT_NAME,_Vtable) = \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync /* When the Asn1Core is at the start of the structure, we can reuse the _Delete and _Enum APIs here. */ \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync /* .uReserved = */ 0, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync (PFNRTASN1COREVTDTOR)RT_CONCAT(RTASN1TMPL_EXT_NAME,_Delete), \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync (PFNRTASN1COREVTENUM)RT_CONCAT(RTASN1TMPL_EXT_NAME,_Enum), \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync (PFNRTASN1COREVTCLONE)RT_CONCAT(RTASN1TMPL_EXT_NAME,_Clone), \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync (PFNRTASN1COREVTCOMPARE)RT_CONCAT(RTASN1TMPL_EXT_NAME,_Compare), \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync (PFNRTASN1COREVTCHECKSANITY)RT_CONCAT(RTASN1TMPL_EXT_NAME,_CheckSanity), \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync AssertCompileMemberOffset(RTASN1TMPL_TYPE, SeqCore, 0); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_BEGIN_COMMON(ASN1_TAG_SEQUENCE, ASN1_TAGCLASS_UNIVERSAL | ASN1_TAGFLAG_CONSTRUCTED)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync AssertCompileMemberOffset(RTASN1TMPL_TYPE, SetCore, 0); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_BEGIN_COMMON(ASN1_TAG_SET, ASN1_TAGCLASS_UNIVERSAL | ASN1_TAGFLAG_CONSTRUCTED)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_EX(a_Name, a_Type, a_Api, a_Constraints) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_BEGIN(a_enmType, a_enmMembNm, a_Allocation) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_END(a_enmType, a_enmMembNm, a_Allocation) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SEQCORE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SETCORE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync AssertCompileMemberOffset(RTASN1TMPL_TYPE, Dummy, 0); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_ITAG_EX(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api, a_fClue, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_XTAG_EX(a_uTag, a_enmChoice, a_PtrTnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_PCHOICE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync AssertCompileMemberOffset(RTASN1TMPL_TYPE, SeqCore, 0); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_BEGIN_COMMON(ASN1_TAG_SEQUENCE, ASN1_TAGCLASS_UNIVERSAL | ASN1_TAGFLAG_CONSTRUCTED)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync AssertCompileMemberOffset(RTASN1TMPL_TYPE, SetCore, 0); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_BEGIN_COMMON(ASN1_TAG_SET, ASN1_TAGCLASS_UNIVERSAL | ASN1_TAGFLAG_CONSTRUCTED)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Initialization to standard / default values.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncRTASN1TMPL_DECL(int) RT_CONCAT(RTASN1TMPL_EXT_NAME,_Init)(RT_CONCAT(P,RTASN1TMPL_TYPE) pThis, PCRTASN1ALLOCATORVTABLE pAllocator) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync int rc = RTAsn1SequenceCore_Init(&pThis->SeqCore, &RT_CONCAT3(g_,RTASN1TMPL_INT_NAME,_Vtable))
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync int rc = RTAsn1SetCore_Init(&pThis->SetCore, &RT_CONCAT3(g_,RTASN1TMPL_INT_NAME,_Vtable))
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_EX(a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_Init)(&pThis->a_Name, pAllocator)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_BEGIN(a_enmType, a_enmMembNm, a_Allocation) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTAsn1MemInitAllocation(&pThis->Allocation, pAllocator); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync pThis->a_enmMembNm = RT_CONCAT(a_enmType,_NOT_PRESENT)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_COMMON(a_UnionNm, a_PtrName, a_Type, a_Api, a_Allocation, a_enmMembNm, a_enmValue, a_IfStmt) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync do { } while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_END(a_enmType, a_enmMembNm, a_Allocation) do { } while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DEF_ITAG_EX(a_Name, a_Type, a_Api, a_uTag, a_fClue, a_DefVal, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_InitDefault)(&pThis->a_Name, a_DefVal, pAllocator); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTAsn1Core_SetTagAndFlags(RT_CONCAT(a_Api,_GetAsn1Core)(&pThis->a_Name), \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_EX(a_Name, a_Type, a_Api, a_Constraints) do { } while (0) /* All optional members are left as not-present. */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SETCORE() RTASN1TMPL_END_SEQCORE()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/* No choice, just an empty, non-present structure. */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_PCHOICE() RTASN1TMPL_BEGIN_COMMON(); int rc = VINF_SUCCESS
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_ITAG_EX(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api, a_fClue, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync do { } while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_XTAG_EX(a_uTag, a_enmChoice, a_PtrTnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync do { } while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_PCHOICE() RTASN1TMPL_END_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi, a_OfApi, a_OfMember) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTAsn1MemInitAllocation(&pThis->Allocation, pAllocator); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync int rc = RT_CONCAT(a_OfApi,_Init)(&pThis->a_OfMember, &RT_CONCAT3(g_,RTASN1TMPL_INT_NAME,_Vtable)); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SEQ_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi, RTAsn1SeqOfCore, SeqCore)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SET_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi, RTAsn1SetOfCore, SetCore)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Decode ASN.1.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncRTASN1TMPL_DECL(int) RT_CONCAT(RTASN1TMPL_EXT_NAME,_DecodeAsn1)(PRTASN1CURSOR pCursor, uint32_t fFlags, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RT_CONCAT(P,RTASN1TMPL_TYPE) pThis, const char *pszErrorTag) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync int rc = RTAsn1CursorGetSequenceCursor(pCursor, fFlags, &pThis->SeqCore, &ThisCursor, pszErrorTag); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync pThis->SeqCore.Asn1Core.pOps = &RT_CONCAT3(g_,RTASN1TMPL_INT_NAME,_Vtable)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync int rc = RTAsn1CursorGetSetCursor(pCursor, fFlags, &pThis->SetCore, &ThisCursor, pszErrorTag); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync pThis->SetCore.Asn1Core.pOps = &RT_CONCAT3(g_,RTASN1TMPL_INT_NAME,_Vtable)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_EX(a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_DecodeAsn1)(pCursor, 0, &pThis->a_Name, #a_Name)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_BEGIN(a_enmType, a_enmMembNm, a_Allocation) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTAsn1CursorInitAllocation(pCursor, &pThis->a_Allocation); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync pThis->a_enmMembNm = RT_CONCAT(a_enmType, _INVALID); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (false) do { /*nothing*/ } while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_COMMON(a_UnionNm, a_PtrName, a_Type, a_Api, a_Allocation, a_enmMembNm, a_enmValue, a_IfStmt) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc2 = RTAsn1MemAllocZ(&pThis->a_Allocation, (void **)&pThis->a_UnionNm.a_PtrName, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc2 = RT_CONCAT(a_Api,_DecodeAsn1)(pCursor, 0, pThis->a_UnionNm.a_PtrName, #a_UnionNm "." #a_PtrName); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync } while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_END(a_enmType, a_enmMembNm, a_Allocation) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = rc2; /* Should trigger warning if a _DEFAULT is missing. */ \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_EX(a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DEF_ITAG_EX(a_Name, a_Type, a_Api, a_uTag, a_fClue, a_DefVal, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RTAsn1CursorIsNextEx(pCursor, a_uTag, RTASN1TMPL_ITAG_F_EXPAND(a_fClue))) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_DecodeAsn1)(pCursor, 0, &pThis->a_Name, #a_Name); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_InitDefault)(&pThis->a_Name, a_DefVal, pCursor->pPrimary->pAllocator); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTAsn1Core_SetTagAndFlags(RT_CONCAT(a_Api,_GetAsn1Core)(&pThis->a_Name), \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync } do {} while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_UTF8_STRING_EX(a_Name, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RT_SUCCESS(rc) && RTAsn1CursorIsNextEx(pCursor, ASN1_TAG_UTF8_STRING, ASN1_TAGCLASS_CONTEXT | ASN1_TAGFLAG_PRIMITIVE)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTAsn1CursorGetUtf8String(pCursor, 0, &pThis->a_Name, #a_Name)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_ITAG_EX(a_Name, a_Type, a_Api, a_uTag, a_fClue, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RT_SUCCESS(rc) && RTAsn1CursorIsNextEx(pCursor, a_uTag, RTASN1TMPL_ITAG_F_EXPAND(a_fClue)) /** @todo || CER */) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_DecodeAsn1)(pCursor, RTASN1CURSOR_GET_F_IMPLICIT, &pThis->a_Name, #a_Name)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_ITAG_BITSTRING(a_Name, a_cMaxBits, a_uTag) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RT_SUCCESS(rc) && RTAsn1CursorIsNextEx(pCursor, a_uTag, ASN1_TAGCLASS_CONTEXT | ASN1_TAGFLAG_CONSTRUCTED)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTAsn1CursorGetBitStringEx(pCursor, RTASN1CURSOR_GET_F_IMPLICIT, a_cMaxBits, &pThis->a_Name, #a_Name)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_XTAG_EX(a_TnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_uTag, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RT_SUCCESS(rc) && RTAsn1CursorIsNextEx(pCursor, a_uTag, ASN1_TAGCLASS_CONTEXT | ASN1_TAGFLAG_CONSTRUCTED)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT3(RTAsn1CursorGetContextTag,a_uTag,Cursor)(pCursor, 0, &pThis->a_TnNm.a_CtxTagN, &CtxCursor, #a_TnNm); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_DecodeAsn1)(&CtxCursor, 0, &pThis->a_TnNm.a_Name, #a_Name); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync } do { } while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_ANY(a_Name, a_Type, a_Api) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_EX(a_Name, a_Type, a_Api, RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SETCORE() RTASN1TMPL_END_SEQCORE()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync pThis->Dummy.Asn1Core.pOps = &RT_CONCAT3(g_,RTASN1TMPL_INT_NAME,_Vtable); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTAsn1CursorInitAllocation(pCursor, &pThis->Allocation); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (false) do {} while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_ITAG_EX(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api, a_fClue, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync && (Asn1Peek.fClass == RTASN1TMPL_ITAG_F_EXPAND(a_fClue) /** @todo || CER */ ) ) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTAsn1MemAllocZ(&pThis->Allocation, (void **)&pThis->a_PtrName, sizeof(*pThis->a_PtrName)); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_DecodeAsn1)(pCursor, RTASN1CURSOR_GET_F_IMPLICIT, pThis->a_PtrName, #a_PtrName); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync } while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_XTAG_EX(a_uTag, a_enmChoice, a_PtrTnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync else if (Asn1Peek.uTag == (a_uTag) && Asn1Peek.fClass == (ASN1_TAGCLASS_CONTEXT | ASN1_TAGFLAG_CONSTRUCTED)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTAsn1MemAllocZ(&pThis->Allocation, (void **)&pThis->a_PtrTnNm, sizeof(*pThis->a_PtrTnNm)); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT3(RTAsn1CursorGetContextTag,a_uTag,Cursor)(pCursor, 0, &pThis->a_PtrTnNm->a_CtxTagN, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_DecodeAsn1)(&CtxCursor, RTASN1CURSOR_GET_F_IMPLICIT, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync } while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTAsn1CursorSetInfo(pCursor, VERR_GENERAL_FAILURE, "%s: Unknown choice: tag=%#x fClass=%#x", \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi, a_OfApi, a_OfMember, a_fnGetCursor) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync int rc = a_fnGetCursor(pCursor, fFlags, &pThis->a_OfMember, &ThisCursor, pszErrorTag); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync pThis->a_OfMember.Asn1Core.pOps = &RT_CONCAT3(g_,RTASN1TMPL_INT_NAME,_Vtable); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTAsn1CursorInitAllocation(pCursor, &pThis->Allocation); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_ItemApi,_DecodeAsn1)(pCursor, 0, &pThis->paItems[i], "paItems[#]"); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync continue; \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi, RTAsn1SeqOfCore, SeqCore, RTAsn1CursorGetSequenceCursor)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi, RTAsn1SetOfCore, SetCore, RTAsn1CursorGetSetCursor)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_EXEC_DECODE(a_Expr) if (RT_SUCCESS(rc)) { a_Expr; }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Enumeration.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncRTASN1TMPL_DECL(int) RT_CONCAT(RTASN1TMPL_EXT_NAME,_Enum)(RT_CONCAT(P,RTASN1TMPL_TYPE) pThis, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (!RT_CONCAT(RTASN1TMPL_EXT_NAME,_IsPresent)(pThis)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_SEQCORE() RTASN1TMPL_BEGIN_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_SETCORE() RTASN1TMPL_BEGIN_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_EX(a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = pfnCallback(RT_CONCAT(a_Api,_GetAsn1Core)(&pThis->a_Name), #a_Name, uDepth, pvUser)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_BEGIN(a_enmType, a_enmMembNm, a_Allocation) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_COMMON(a_UnionNm, a_PtrName, a_Type, a_Api, a_Allocation, a_enmMembNm, a_enmValue, a_IfStmt) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = pfnCallback(RT_CONCAT(a_Api,_GetAsn1Core)(pThis->a_UnionNm.a_PtrName), #a_UnionNm "." #a_PtrName, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_END(a_enmType, a_enmMembNm, a_Allocation) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_EX(a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (rc == VINF_SUCCESS && RT_CONCAT(a_Api,_IsPresent)(&pThis->a_Name)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = pfnCallback(RT_CONCAT(a_Api,_GetAsn1Core)(&pThis->a_Name), #a_Name, uDepth, pvUser)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_XTAG_EX(a_TnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_uTag, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (rc == VINF_SUCCESS && RTASN1CORE_IS_PRESENT(&pThis->a_TnNm.a_CtxTagN.Asn1Core)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = pfnCallback(&pThis->a_TnNm.a_CtxTagN.Asn1Core, #a_Name, uDepth, pvUser); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = pfnCallback(RT_CONCAT(a_Api,_GetAsn1Core)(&pThis->a_TnNm.a_Name), #a_TnNm "." #a_Name, uDepth, pvUser); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync } do {} while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SEQCORE() RTASN1TMPL_END_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SETCORE() RTASN1TMPL_END_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_ITAG_EX(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api, a_fClue, a_Constraints) \
30d5bd8604e5b514b0e4f6360c0384ab1c7851fevboxsync case a_enmChoice: rc = pfnCallback(RT_CONCAT(a_Api,_GetAsn1Core)(pThis->a_PtrName), #a_PtrName, uDepth, pvUser); break
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_XTAG_EX(a_uTag, a_enmChoice, a_PtrTnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = pfnCallback(&pThis->a_PtrTnNm->a_CtxTagN.Asn1Core, "T" #a_uTag "." #a_CtxTagN, uDepth, pvUser); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = pfnCallback(RT_CONCAT(a_Api, _GetAsn1Core)(&pThis->a_PtrTnNm->a_Name), \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync for (uint32_t i = 0; i < pThis->cItems && rc == VINF_SUCCESS; i++) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = pfnCallback(RT_CONCAT(a_ItemApi,_GetAsn1Core)(&pThis->paItems[i]), "paItems[#]", uDepth, pvUser); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SEQ_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SET_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Clone another instance of the type.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncRTASN1TMPL_DECL(int) RT_CONCAT(RTASN1TMPL_EXT_NAME,_Clone)(RT_CONCAT(P,RTASN1TMPL_TYPE) pThis, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (!RT_CONCAT(RTASN1TMPL_EXT_NAME,_IsPresent)(pSrc)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync int rc = RTAsn1SequenceCore_Clone(&pThis->SeqCore, &RT_CONCAT3(g_, RTASN1TMPL_INT_NAME, _Vtable), &pSrc->SeqCore)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync int rc = RTAsn1SetCore_Clone(&pThis->SetCore, &RT_CONCAT3(g_, RTASN1TMPL_INT_NAME, _Vtable), &pSrc->SetCore)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_EX(a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_Clone)(&pThis->a_Name, &pSrc->a_Name, pAllocator); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_BEGIN(a_enmType, a_enmMembNm, a_Allocation) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTAsn1MemInitAllocation(&pThis->Allocation, pAllocator); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_COMMON(a_UnionNm, a_PtrName, a_Type, a_Api, a_Allocation, a_enmMembNm, a_enmValue, a_IfStmt) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTAsn1MemAllocZ(&pThis->a_Allocation, (void **)&pThis->a_UnionNm.a_PtrName, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_Clone)(pThis->a_UnionNm.a_PtrName, pSrc->a_UnionNm.a_PtrName, pAllocator); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_END(a_enmType, a_enmMembNm, a_Allocation) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/* Optional members and members with defaults are the same as a normal member when cloning. */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_UTF8_STRING_EX(a_Name, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_OPT_EX(a_Name, RTASN1STRING, RTAsn1Utf8String, a_Constraints RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_XTAG_EX(a_TnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_uTag, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RTASN1CORE_IS_PRESENT(&pSrc->a_TnNm.a_CtxTagN.Asn1Core) && RT_SUCCESS(rc)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT3(RTAsn1ContextTag,a_uTag,_Clone)(&pThis->a_TnNm.a_CtxTagN, &pSrc->a_TnNm.a_CtxTagN); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_Clone)(&pThis->a_TnNm.a_Name, &pSrc->a_TnNm.a_Name, pAllocator); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync } do { } while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SETCORE() RTASN1TMPL_END_SEQCORE()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTAsn1MemInitAllocation(&pThis->Allocation, pAllocator); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_ITAG_EX(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api, a_fClue, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTAsn1MemAllocZ(&pThis->Allocation, (void **)&pThis->a_PtrName, sizeof(*pThis->a_PtrName)); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_Clone)(pThis->a_PtrName, pSrc->a_PtrName, pAllocator); break
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_XTAG_EX(a_uTag, a_enmChoice, a_PtrTnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case a_enmChoice: /* A bit of presence paranoia here, but better safe than sorry... */ \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTAsn1MemAllocZ(&pThis->Allocation, (void **)&pThis->a_PtrTnNm, sizeof(*pThis->a_PtrTnNm)); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RT_SUCCESS(rc) && RTASN1CORE_IS_PRESENT(&pSrc->a_PtrTnNm->a_CtxTagN.Asn1Core)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RT_CONCAT3(RTAsn1ContextTag,a_uTag,_Clone)(&pThis->a_PtrTnNm->a_CtxTagN, &pSrc->a_PtrTnNm->a_CtxTagN); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_Clone)(&pThis->a_PtrTnNm->a_Name, &pSrc->a_PtrTnNm->a_Name, pAllocator); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi, a_OfApi, a_OfMember) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync int rc = RT_CONCAT(a_OfApi,_Clone)(&pThis->a_OfMember, &RT_CONCAT3(g_,RTASN1TMPL_INT_NAME,_Vtable), &pSrc->a_OfMember); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTAsn1MemInitAllocation(&pThis->Allocation, pAllocator); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTAsn1MemGrowArray(&pThis->Allocation, (void **)&pThis->paItems, sizeof(pThis->paItems[0]), 0, cItems); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync while (i < cItems) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_ItemApi,_Clone)(&pThis->paItems[i], &pSrc->paItems[i], pAllocator); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SEQ_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi, RTAsn1SeqOfCore, SeqCore)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SET_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi, RTAsn1SetOfCore, SetCore)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_EXEC_CLONE(a_Expr) if (RT_SUCCESS(rc)) { a_Expr; }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Member setter helpers.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_SEQCORE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_SETCORE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_EX(a_Name, a_Type, a_Api, a_Constraints) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_EX(a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTDECL(int) RT_CONCAT3(RTASN1TMPL_EXT_NAME,_Set,a_Name)(RTASN1TMPL_TYPE *pThis, a_Type const *pValue, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync return RT_CONCAT(a_Api,_Clone)(&pThis->a_Name, pValue, pAllocator, true /* fResetImplicit */); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_BEGIN(a_enmType, a_enmMembNm, a_Allocation) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_END(a_enmType, a_enmMembNm, a_Allocation) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SEQCORE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SETCORE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_PCHOICE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_ITAG_EX(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api, a_fClue, a_Constraints) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_XTAG_EX(a_uTag, a_enmChoice, a_PtrTnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_Constraints) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_PCHOICE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SEQ_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SET_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Member setters.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_SEQCORE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_SETCORE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_EX(a_Name, a_Type, a_Api, a_Constraints) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_BEGIN(a_enmType, a_enmMembNm, a_Allocation) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_END(a_enmType, a_enmMembNm, a_Allocation) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SEQCORE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SETCORE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_PCHOICE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_ITAG_EX(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api, a_fClue, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncRTASN1TMPL_DECL(int) RT_CONCAT3(RTASN1TMPL_EXT_NAME,_Set,a_Name)(RT_CONCAT(P,RTASN1TMPL_TYPE) pThis, RT_CONCAT(PC,a_Type) pSrc,\
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RT_CONCAT(RTASN1TMPL_EXT_NAME,_Delete)(pThis); /* See _Init. */ \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTAsn1MemInitAllocation(&pThis->Allocation, pAllocator); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync int rc = RTAsn1MemAllocZ(&pThis->Allocation, (void **)&pThis->a_PtrName, sizeof(*pThis->a_PtrName)); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_Clone)(pThis->a_PtrName, pSrc, pAllocator); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTAsn1Core_ResetImplict(RT_CONCAT(a_Api,_GetAsn1Core)(pThis->a_PtrName)); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTAsn1Core_SetTagAndFlags(RT_CONCAT(a_Api,_GetAsn1Core)(pThis->a_PtrName), \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_XTAG_EX(a_uTag, a_enmChoice, a_PtrTnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncRTASN1TMPL_DECL(int) RT_CONCAT3(RTASN1TMPL_EXT_NAME,_Set,a_Name)(RT_CONCAT(P,RTASN1TMPL_TYPE) pThis, RT_CONCAT(PC,a_Type) pSrc,\
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync AssertPtr(pThis); AssertPtr(pSrc); Assert(RT_CONCAT(a_Api,_IsPresent)(pSrc)); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RT_CONCAT(RTASN1TMPL_EXT_NAME,_Delete)(pThis); /* See _Init. */ \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTAsn1MemInitAllocation(&pThis->Allocation, pAllocator); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync int rc = RTAsn1MemAllocZ(&pThis->Allocation, (void **)&pThis->a_PtrTnNm, sizeof(*pThis->a_PtrTnNm)); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT3(RTAsn1ContextTag,a_uTag,_Init)(&pThis->a_PtrTnNm->a_CtxTagN, pAllocator); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_Clone)(&pThis->a_PtrTnNm->a_Name, pSrc, pAllocator); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTAsn1Core_ResetImplict(RT_CONCAT(a_Api,_GetAsn1Core)(&pThis->a_PtrTnNm->a_Name)); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#define RTASN1TMPL_END_PCHOICE() RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SEQ_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SET_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SEMICOLON_DUMMY()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Compare two instances of the type.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncRTASN1TMPL_DECL(int) RT_CONCAT(RTASN1TMPL_EXT_NAME,_Compare)(RT_CONCAT(PC,RTASN1TMPL_TYPE) pLeft, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (!RT_CONCAT(RTASN1TMPL_EXT_NAME,_IsPresent)(pLeft)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync return 0 - (int)RT_CONCAT(RTASN1TMPL_EXT_NAME,_IsPresent)(pRight); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (!RT_CONCAT(RTASN1TMPL_EXT_NAME,_IsPresent)(pRight)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync return -1; \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_SEQCORE() RTASN1TMPL_BEGIN_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_SETCORE() RTASN1TMPL_BEGIN_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_EX(a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync iDiff = RT_CONCAT(a_Api,_Compare)(&pLeft->a_Name, &pRight->a_Name)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_BEGIN(a_enmType, a_enmMembNm, a_Allocation) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (!iDiff && pLeft->a_enmMembNm != pRight->a_enmMembNm) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync iDiff = pLeft->a_enmMembNm < pRight->a_enmMembNm ? -1 : 1; \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync else if (!iDiff) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync default: break
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_COMMON(a_UnionNm, a_PtrName, a_Type, a_Api, a_Allocation, a_enmMembNm, a_enmValue, a_IfStmt) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case a_enmValue: iDiff = RT_CONCAT(a_Api,_Compare)(pLeft->a_UnionNm.a_PtrName, pRight->a_UnionNm.a_PtrName); break
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_END(a_enmType, a_enmMembNm, a_Allocation) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_XTAG_EX(a_TnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_uTag, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RTASN1CORE_IS_PRESENT(&pLeft->a_TnNm.a_CtxTagN.Asn1Core)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RTASN1CORE_IS_PRESENT(&pRight->a_TnNm.a_CtxTagN.Asn1Core)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync iDiff = RT_CONCAT(a_Api,_Compare)(&pLeft->a_TnNm.a_Name, &pRight->a_TnNm.a_Name); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync iDiff = 0 - (int)RTASN1CORE_IS_PRESENT(&pRight->a_TnNm.a_CtxTagN.Asn1Core); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync } do { } while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SEQCORE() RTASN1TMPL_END_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SETCORE() RTASN1TMPL_END_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync return pLeft->enmChoice < pRight->enmChoice ? -1 : 1; \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync default: break
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_ITAG_EX(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api, a_fClue, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case a_enmChoice: iDiff = RT_CONCAT(a_Api,_Compare)(pLeft->a_PtrName, pRight->a_PtrName); break
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_XTAG_EX(a_uTag, a_enmChoice, a_PtrTnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case a_enmChoice: iDiff = RT_CONCAT(a_Api,_Compare)(&pLeft->a_PtrTnNm->a_Name, &pRight->a_PtrTnNm->a_Name); break
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync for (uint32_t i = 0; iDiff == 0 && i < cItems; i++) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync iDiff = RT_CONCAT(a_ItemApi,_Compare)(&pLeft->paItems[i], &pRight->paItems[i]); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SEQ_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SET_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#elif RTASN1TMPL_PASS == RTASN1TMPL_PASS_CHECK_SANITY
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Checks the sanity of the type.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SANITY_CHECK_EXPR() VINF_SUCCESS
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncRTASN1TMPL_DECL(int) RT_CONCAT(RTASN1TMPL_EXT_NAME,_CheckSanity)(RT_CONCAT(PC,RTASN1TMPL_TYPE) pThis, uint32_t fFlags, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RT_UNLIKELY(!RT_CONCAT(RTASN1TMPL_EXT_NAME,_IsPresent)(pThis))) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync return RTErrInfoSetF(pErrInfo, VERR_GENERAL_FAILURE, "%s: Missing (%s).", pszErrorTag, RT_XSTR(RTASN1TMPL_TYPE)); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_SEQCORE() RTASN1TMPL_BEGIN_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_SETCORE() RTASN1TMPL_BEGIN_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_EX(a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RT_LIKELY(RT_CONCAT(a_Api,_IsPresent)(&pThis->a_Name))) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_CheckSanity)(&pThis->a_Name, fFlags & RTASN1_CHECK_SANITY_F_COMMON_MASK, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync pErrInfo, RT_XSTR(RTASN1TMPL_TYPE) "::" #a_Name); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTErrInfoSetF(pErrInfo, VERR_GENERAL_FAILURE, "%s: Missing member %s (%s).", \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync } do {} while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_BEGIN(a_enmType, a_enmMembNm, a_Allocation) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTErrInfoSetF(pErrInfo, VERR_GENERAL_FAILURE, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync "%s: Invalid " #a_enmMembNm " value: %d", pszErrorTag, pThis->a_enmMembNm); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_COMMON(a_UnionNm, a_PtrName, a_Type, a_Api, a_Allocation, a_enmMembNm, a_enmValue, a_IfStmt) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_CheckSanity)(pThis->a_UnionNm.a_PtrName, fFlags & RTASN1_CHECK_SANITY_F_COMMON_MASK, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync pErrInfo, RT_XSTR(RTASN1TMPL_TYPE) "::" #a_UnionNm "." #a_PtrName); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_END(a_enmType, a_enmMembNm, a_Allocation) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTErrInfoSetF(pErrInfo, VERR_GENERAL_FAILURE, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync "%s: Invalid " #a_enmMembNm " value: " #a_enmType "_NOT_PRESENT", \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_EX(a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RT_SUCCESS(rc) && RT_CONCAT(a_Api,_IsPresent)(&pThis->a_Name)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_CheckSanity)(&pThis->a_Name, fFlags & RTASN1_CHECK_SANITY_F_COMMON_MASK, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync pErrInfo, RT_XSTR(RTASN1TMPL_TYPE) "::" #a_Name); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_XTAG_EX(a_TnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_uTag, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync bool const fOuterPresent = RTASN1CORE_IS_PRESENT(&pThis->a_TnNm.a_CtxTagN.Asn1Core); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync bool const fInnerPresent = RT_CONCAT(a_Api,_IsPresent)(&pThis->a_TnNm.a_Name); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_CheckSanity)(&pThis->a_TnNm.a_Name, fFlags & RTASN1_CHECK_SANITY_F_COMMON_MASK, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync pErrInfo, RT_XSTR(RTASN1TMPL_TYPE) "::" #a_Name); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync else if (RT_UNLIKELY(RTASN1CORE_IS_PRESENT(&pThis->a_TnNm.a_CtxTagN.Asn1Core) != fInnerPresent)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTErrInfoSetF(pErrInfo, VERR_GENERAL_FAILURE, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync "%s::" #a_TnNm "." #a_Name ": Explict tag precense mixup; " #a_CtxTagN "=%d " #a_Name "=%d.", \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync } do { } while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SEQCORE() RTASN1TMPL_END_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SETCORE() RTASN1TMPL_END_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTErrInfoSetF(pErrInfo, VERR_GENERAL_FAILURE, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync "%s: Invalid enmChoice value: %d", pszErrorTag, pThis->enmChoice); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_ITAG_EX(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api, a_fClue, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (pThis->a_PtrName && RT_CONCAT(a_Api,_IsPresent)(pThis->a_PtrName)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync PCRTASN1CORE pCore = RT_CONCAT(a_Api,_GetAsn1Core)(pThis->a_PtrName); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (pCore->uTag == a_uTag && pCore->fClass == RTASN1TMPL_ITAG_F_EXPAND(a_fClue)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_CheckSanity)(pThis->a_PtrName, fFlags & RTASN1_CHECK_SANITY_F_COMMON_MASK, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync pErrInfo, RT_XSTR(RTASN1TMPL_TYPE) "::" #a_Name); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTErrInfoSetF(pErrInfo, VERR_GENERAL_FAILURE, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync "%s::" #a_Name ": Tag/class mismatch: expected %#x/%#x, actual %#x/%x.", \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync pszErrorTag, a_uTag, RTASN1TMPL_ITAG_F_EXPAND(a_fClue), pCore->uTag, pCore->fClass); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTErrInfoSetF(pErrInfo, VERR_GENERAL_FAILURE, "%s::" #a_Name ": Not present.", pszErrorTag); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_XTAG_EX(a_uTag, a_enmChoice, a_PtrTnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync && RTASN1CORE_IS_PRESENT(&(pThis->a_PtrTnNm->a_CtxTagN.Asn1Core)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync && RT_CONCAT(a_Api,_IsPresent)(&pThis->a_PtrTnNm->a_Name) ) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_Api,_CheckSanity)(&pThis->a_PtrTnNm->a_Name, fFlags & RTASN1_CHECK_SANITY_F_COMMON_MASK, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync pErrInfo, RT_XSTR(RTASN1TMPL_TYPE) "::" #a_Name); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTErrInfoSetF(pErrInfo, VERR_GENERAL_FAILURE, "%s::" #a_Name ": Not present.", pszErrorTag); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync for (uint32_t i = 0; RT_SUCCESS(rc) && i < pThis->cItems; i++) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RT_CONCAT(a_ItemApi,_CheckSanity)(&pThis->paItems[i], fFlags & RTASN1_CHECK_SANITY_F_COMMON_MASK, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync pErrInfo, RT_XSTR(RTASN1TMPL_TYPE) "::paItems[#]"); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RT_SUCCESS(rc)) { RTASN1TMPL_SET_SEQ_EXEC_CHECK_SANITY(); } \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SEQ_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SET_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/* The constraints. */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_CONSTR_MIN_MAX(a_Name, a_Type, a_Api, cbMin, cbMax, a_MoreConstraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RT_SUCCESS(rc) && ((cbMin) != 0 || (cbMax) != UINT32_MAX)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync PCRTASN1CORE pCore = RT_CONCAT(a_Api,_GetAsn1Core)(&pThis->a_Name); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RT_UNLIKELY(pCore->cb < (cbMin) || pCore->cb > (cbMax))) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTErrInfoSetF(pErrInfo, VERR_GENERAL_FAILURE, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync "%s::" #a_Name ": Content size is out of range: %#x not in {%#x..%#x}", \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_CONSTR_BITSTRING_MIN_MAX(a_Name, cMinBits, cMaxBits, a_MoreConstraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RT_SUCCESS(rc) && ((cMinBits) != 0 || (cMaxBits) != UINT32_MAX)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RT_UNLIKELY( ((cMinBits) == 0 ? false : pThis->a_Name.cBits + 1U < (cMinBits) + 1U /* warning avoiding */) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync || ((cMaxBits) == UINT32_MAX ? false : pThis->a_Name.cBits + 1U > (cMaxBits) + 1U /* ditto */) ) ) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTErrInfoSetF(pErrInfo, VERR_GENERAL_FAILURE, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync "%s::" #a_Name ": Bit size is out of range: %#x not in {%#x..%#x}", \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync pszErrorTag, pThis->a_Name.cBits, cMinBits, cMaxBits); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_CONSTR_PRESENT(a_Name, a_Api, a_MoreConstraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RT_SUCCESS(rc) && RT_UNLIKELY(!RT_CONCAT(a_Api,_IsPresent)(&pThis->a_Name))) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = RTErrInfoSetF(pErrInfo, VERR_GENERAL_FAILURE, "%s::" #a_Name ": Missing.", pszErrorTag); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_EXEC_CHECK_SANITY(a_Expr) if (RT_SUCCESS(rc)) { a_Expr; }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Delete wrappers.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncRTASN1TMPL_DECL(void) RT_CONCAT(RTASN1TMPL_EXT_NAME,_Delete)(RT_CONCAT(P,RTASN1TMPL_TYPE) pThis) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (RT_CONCAT(RTASN1TMPL_EXT_NAME,_IsPresent)(pThis)) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync { do { } while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_SEQCORE() RTASN1TMPL_BEGIN_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_BEGIN_SETCORE() RTASN1TMPL_BEGIN_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_EX(a_Name, a_Type, a_Api, a_Constraints) RT_CONCAT(a_Api,_Delete)(&pThis->a_Name)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_BEGIN(a_enmType, a_enmMembNm, a_Allocation) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync default: break
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_COMMON(a_UnionNm, a_PtrName, a_Type, a_Api, a_Allocation, a_enmMembNm, a_enmValue, a_IfStmt) \
067467bad896150ed0ae5877b1ff1b7415d84b8avboxsync RT_CONCAT(a_Api,_Delete)(pThis->a_UnionNm.a_PtrName); \
067467bad896150ed0ae5877b1ff1b7415d84b8avboxsync RTAsn1MemFree(&pThis->Allocation, pThis->a_UnionNm.a_PtrName); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_END(a_enmType, a_enmMembNm, a_Allocation) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SEQCORE() RTASN1TMPL_END_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_END_SETCORE() RTASN1TMPL_END_COMMON()
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync default: break
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_ITAG_EX(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api, a_fClue, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTAsn1MemFree(&pThis->Allocation, pThis->a_PtrName); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_XTAG_EX(a_uTag, a_enmChoice, a_PtrTnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RT_CONCAT(a_Api,_Delete)(&pThis->a_PtrTnNm->a_Name); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTAsn1MemFree(&pThis->Allocation, pThis->a_PtrTnNm); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync while (i-- > 0) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RT_CONCAT(a_ItemApi,_Delete)(&pThis->paItems[i]); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTAsn1MemFree(&pThis->Allocation, pThis->paItems); \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SEQ_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_SET_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Default aliases for simplified versions of macros if no specialization
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * was required above.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/* Non-optional members. */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_EX(a_Name, a_Type, a_Api, RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_UTF8_STRING_MIN_MAX(a_Name) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER(a_Name, RTASN1STRING, RTAsn1String)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_UTF8_STRING_MIN_MAX(a_Name, 0, UINT32_MAX)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_STRING_MIN_MAX(a_Name, a_cbMin, a_cbMax) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER(a_Name, RTASN1STRING, RTAsn1String)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_STRING_MIN_MAX(a_Name, 0, UINT32_MAX)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_XTAG_EX(a_TnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_uTag, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_EX(a_TnNm.a_Name, a_Type, a_Api, a_Constraints RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/* Any/dynamic members. */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_BEGIN(a_enmType, a_enmMembNm, a_Allocation) do { } while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_END(a_enmType, a_enmMembNm, a_Allocation) do { } while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_COMMON(a_UnionNm, a_PtrName, a_Type, a_Api, a_Allocation, a_enmMembNm, a_enmValue, a_IfStmt) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER(a_UnionNm.a_PtrName, a_Type, a_Api)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN(a_UnionNm, a_PtrName, a_Type, a_Api, a_Allocation, a_enmMembNm, a_enmValue, a_WhenExpr) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_DYN_COMMON(a_UnionNm, a_PtrName, a_Type, a_Api, a_Allocation, a_enmMembNm, a_enmValue, if (a_WhenExpr))
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DYN_DEFAULT(a_UnionNm, a_PtrName, a_Type, a_Api, a_Allocation, a_enmMembNm, a_enmValue) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_DYN_COMMON(a_UnionNm, a_PtrName, a_Type, a_Api, a_Allocation, a_enmMembNm, a_enmValue, RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/* Optional members. */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_EX(a_Name, a_Type, a_Api, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_EX(a_Name, a_Type, a_Api, a_Constraints RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT(a_Name, a_Type, a_Api) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_OPT_EX(a_Name, a_Type, a_Api, RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_XTAG_EX(a_TnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_uTag, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_OPT_EX(a_TnNm.a_Name, a_Type, a_Api, a_Constraints RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_XTAG(a_TnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_uTag) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_OPT_XTAG_EX(a_TnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_uTag, RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_ITAG_EX(a_Name, a_Type, a_Api, a_uTag, a_fClue, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_OPT_EX(a_Name, a_Type, a_Api, a_Constraints RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_ITAG_UP(a_Name, a_Type, a_Api, a_uTag) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_OPT_ITAG_EX(a_Name, a_Type, a_Api, a_uTag, RTASN1TMPL_ITAG_F_UP, RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_ITAG_UC(a_Name, a_Type, a_Api, a_uTag) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_OPT_ITAG_EX(a_Name, a_Type, a_Api, a_uTag, RTASN1TMPL_ITAG_F_UC, RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_ITAG_CP(a_Name, a_Type, a_Api, a_uTag) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_OPT_ITAG_EX(a_Name, a_Type, a_Api, a_uTag, RTASN1TMPL_ITAG_F_CP, RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_ITAG(a_Name, a_Type, a_Api, a_uTag) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_OPT_ITAG_EX(a_Name, a_Type, a_Api, a_uTag, RTASN1TMPL_ITAG_F_CC, RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_ANY(a_Name, a_Type, a_Api) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_OPT_EX(a_Name, a_Type, a_Api, RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DEF_ITAG_EX(a_Name, a_Type, a_Api, a_uTag, a_fClue, a_DefVal, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_OPT_ITAG_EX(a_Name, a_Type, a_Api, a_uTag, a_fClue, a_Constraints RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_DEF_ITAG_UP(a_Name, a_Type, a_Api, a_uTag, a_DefVal) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_DEF_ITAG_EX(a_Name, a_Type, a_Api, a_uTag, RTASN1TMPL_ITAG_F_UP, a_DefVal, RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_ITAG_BITSTRING(a_Name, a_cMaxBits, a_uTag) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_OPT_ITAG_EX(a_Name, RTASN1BITSTRING, RTAsn1BitString, a_uTag, RTASN1TMPL_ITAG_F_CP, \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_CONSTR_BITSTRING_MIN_MAX(a_Name, 0, a_cMaxBits, RT_NOTHING))
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_UTF8_STRING_EX(a_Name, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_OPT_EX(a_Name, RTASN1STRING, RTAsn1String, a_Constraints RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_UTF8_STRING(a_Name) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_OPT_UTF8_STRING_EX(a_Name, RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_OPT_STRING_EX(a_Name, a_Constraints) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_OPT_EX(a_Name, RTASN1STRING, RTAsn1String, a_Constraints RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_MEMBER_OPT_STRING_EX(a_Name, RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/* Pointer choices. */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_ITAG_UP(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_PCHOICE_ITAG_EX(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api, RTASN1TMPL_ITAG_F_UP, RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_ITAG_CP(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_PCHOICE_ITAG_EX(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api, RTASN1TMPL_ITAG_F_CP, RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_ITAG(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_PCHOICE_ITAG_EX(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api, RTASN1TMPL_ITAG_F_CC, RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_PCHOICE_XTAG(a_uTag, a_enmChoice, a_PtrTnNm, a_CtxTagN, a_Name, a_Type, a_Api) \
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTASN1TMPL_PCHOICE_XTAG_EX(a_uTag, a_enmChoice, a_PtrTnNm, a_CtxTagN, a_Name, a_Type, a_Api, RT_NOTHING)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Constraints are only used in the sanity check pass, so provide subs for the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * others passes.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_CONSTR_MIN_MAX(a_Name, a_Type, a_Api, cbMin, cbMax, a_MoreConstraints)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_CONSTR_BITSTRING_MIN_MAX(a_Name, cMinBits, cMaxBits, a_MoreConstraints)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_MEMBER_CONSTR_PRESENT(a_Name, a_Api, a_MoreConstraints)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Stub exec hacks.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_EXEC_DECODE(a_Expr) /* no semi colon allowed after this */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_EXEC_CLONE(a_Expr) /* no semi colon allowed after this */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# define RTASN1TMPL_EXEC_CHECK_SANITY(a_Expr) /* no semi colon allowed after this */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#define RTASN1TMPL_SET_SEQ_EXEC_CHECK_SANITY() do { } while (0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Generate the requested code.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync# error "No template file (RTASN1TMPL_TEMPLATE_FILE) is specified."
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Undo all the macros.