EXTERN int asn1PD_HnbPrivateMessage (OSCTXT* pctxt, HnbPrivateMessage* pvalue) { int stat = 0; OSCTXT lctxt; ASN1OpenType openType; ASN1OpenType* pOpenType; OSUINT32 bitcnt; OSUINT32 i; OSBOOL optbit = FALSE; OSBOOL extbit = FALSE; /* extension bit */ stat = PD_BIT (pctxt, &extbit); if (stat != 0) return LOG_RTERR (pctxt, stat); rtxDListInit (&pvalue->extElem1); /* decode privateIEs */ asn1Init_PrivateIE_Container (&pvalue->privateIEs); stat = asn1PD_PrivateIE_Container (pctxt, &pvalue->privateIEs); if (stat != 0) return LOG_RTERR (pctxt, stat); if (extbit) { /* decode extension optional bits length */ stat = pd_SmallNonNegWholeNumber (pctxt, &bitcnt); if (stat != 0) return LOG_RTERR (pctxt, stat); bitcnt += 1; rtxPreInitContext (&lctxt); rtxCopyContext (&lctxt, pctxt); stat = pd_moveBitCursor (pctxt, bitcnt); if (stat != 0) return LOG_RTERR (pctxt, stat); for (i = 0; i < bitcnt; i++) { PD_BIT (&lctxt, &optbit); if (optbit) { stat = pd_OpenType (pctxt, &openType.data, &openType.numocts); if (stat != 0) return LOG_RTERR (pctxt, stat); pOpenType = rtxMemAllocType (pctxt, ASN1OpenType); pOpenType->numocts = openType.numocts; pOpenType->data = openType.data; rtxDListAppend (pctxt, &pvalue->extElem1, pOpenType); } else { /* unknown element */ rtxDListAppend (pctxt, &pvalue->extElem1, 0); } } } return (stat); }
EXTRTMETHOD OSBOOL rtCopyOpenTypeExt (OSCTXT* pctxt, OSRTDList* srcList, OSRTDList* dstList) { OSRTDListNode* pnode; if (srcList == NULL || dstList == NULL) return FALSE; pnode = srcList->head; rtxDListInit (dstList); /* Check all the octets are equal */ while (0 != pnode) { if (0 != pnode->data) { ASN1OpenType* pSrcOT = (ASN1OpenType*) pnode->data; ASN1OpenType* pDestOT = (ASN1OpenType*) rtxMemAlloc (pctxt, sizeof (ASN1OpenType)); if (pDestOT == NULL) return FALSE; if (!rtCopyOpenType (pctxt, pSrcOT, pDestOT)) return FALSE; rtxDListAppend (pctxt, dstList, pDestOT); } pnode = pnode->next; } return TRUE; }
EXTERN int asn1D_OrderResponseType_respondedOrderLine_list (OSCTXT* pctxt, OrderResponseType_respondedOrderLine_list *pvalue, ASN1TagType tagging, int length) { int stat = 0; RespondedOrderLine* pdata; OSRTDListNode* pnode; ASN1CCB ccb; if (tagging == ASN1EXPL) { stat = xd_match1 (pctxt, 0x10, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); } /* decode SEQUENCE OF or SET OF */ rtxDListInit (pvalue); ccb.len = length; ccb.ptr = OSRTBUFPTR(pctxt); while (!XD_CHKEND (pctxt, &ccb)) { rtxDListAllocNodeAndData (pctxt, RespondedOrderLine, &pnode, &pdata); if (pnode == NULL) return LOG_RTERR (pctxt, RTERR_NOMEM); asn1Init_RespondedOrderLine (pdata); stat = asn1D_RespondedOrderLine (pctxt, pdata, ASN1EXPL, length); if (stat != 0) return LOG_RTERR (pctxt, stat); rtxDListAppendNode (pvalue, pnode); } if (tagging == ASN1EXPL && ccb.len == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } return (stat); }
EXTERN int asn1PD_RUA_CriticalityDiagnostics_IE_List (OSCTXT* pctxt, RUA_CriticalityDiagnostics_IE_List* pvalue) { static Asn1SizeCnst lsize1 = { 0, OSUINTCONST(1), OSUINTCONST(256), 0 }; int stat = 0; RUA_CriticalityDiagnostics_IE_List_element* pdata; OSRTDListNode* pnode; OSUINT32 count = 0; OSUINT32 xx1 = 0; /* decode length determinant */ stat = pu_addSizeConstraint (pctxt, &lsize1); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = pd_Length (pctxt, &count); if (stat != 0) return LOG_RTERR (pctxt, stat); /* decode elements */ rtxDListInit (pvalue); for (xx1 = 0; xx1 < count; xx1++) { rtxDListAllocNodeAndData (pctxt, RUA_CriticalityDiagnostics_IE_List_element, &pnode, &pdata); if (pnode == NULL) return LOG_RTERR (pctxt, RTERR_NOMEM); asn1Init_RUA_CriticalityDiagnostics_IE_List_element (pdata); stat = asn1PD_RUA_CriticalityDiagnostics_IE_List_element (pctxt, pdata); if (stat != 0) return LOG_RTERR (pctxt, stat); rtxDListAppendNode (pvalue, pnode); } return (stat); }
EXTERN int asn1PD_RUA_CriticalityDiagnostics (OSCTXT* pctxt, RUA_CriticalityDiagnostics* pvalue) { int stat = 0; OSCTXT lctxt; ASN1OpenType openType; ASN1OpenType* pOpenType; OSUINT32 bitcnt; OSUINT32 i; OSBOOL optbit = FALSE; OSBOOL extbit = FALSE; /* extension bit */ stat = PD_BIT (pctxt, &extbit); if (stat != 0) return LOG_RTERR (pctxt, stat); /* optional bits */ memset (&pvalue->m, 0, sizeof(pvalue->m)); rtxDListInit (&pvalue->extElem1); stat = PD_BIT (pctxt, &optbit); if (stat != 0) return LOG_RTERR (pctxt, stat); pvalue->m.procedureCodePresent = optbit; stat = PD_BIT (pctxt, &optbit); if (stat != 0) return LOG_RTERR (pctxt, stat); pvalue->m.triggeringMessagePresent = optbit; stat = PD_BIT (pctxt, &optbit); if (stat != 0) return LOG_RTERR (pctxt, stat); pvalue->m.procedureCriticalityPresent = optbit; stat = PD_BIT (pctxt, &optbit); if (stat != 0) return LOG_RTERR (pctxt, stat); pvalue->m.iEsCriticalityDiagnosticsPresent = optbit; stat = PD_BIT (pctxt, &optbit); if (stat != 0) return LOG_RTERR (pctxt, stat); pvalue->m.iE_ExtensionsPresent = optbit; /* decode procedureCode */ if (pvalue->m.procedureCodePresent) { stat = asn1PD_RUA_ProcedureCode (pctxt, &pvalue->procedureCode); if (stat != 0) return LOG_RTERR (pctxt, stat); } /* decode triggeringMessage */ if (pvalue->m.triggeringMessagePresent) { stat = asn1PD_RUA_TriggeringMessage (pctxt, &pvalue->triggeringMessage); if (stat != 0) return LOG_RTERR (pctxt, stat); } /* decode procedureCriticality */ if (pvalue->m.procedureCriticalityPresent) { stat = asn1PD_RUA_Criticality (pctxt, &pvalue->procedureCriticality); if (stat != 0) return LOG_RTERR (pctxt, stat); } /* decode iEsCriticalityDiagnostics */ if (pvalue->m.iEsCriticalityDiagnosticsPresent) { asn1Init_RUA_CriticalityDiagnostics_IE_List (&pvalue->iEsCriticalityDiagnostics); stat = asn1PD_RUA_CriticalityDiagnostics_IE_List (pctxt, &pvalue->iEsCriticalityDiagnostics); if (stat != 0) return LOG_RTERR (pctxt, stat); } /* decode iE_Extensions */ if (pvalue->m.iE_ExtensionsPresent) { asn1Init_RUA_ProtocolExtensionContainer (&pvalue->iE_Extensions); stat = asn1PD_RUA_ProtocolExtensionContainer (pctxt, &pvalue->iE_Extensions); if (stat != 0) return LOG_RTERR (pctxt, stat); } if (extbit) { /* decode extension optional bits length */ stat = pd_SmallNonNegWholeNumber (pctxt, &bitcnt); if (stat != 0) return LOG_RTERR (pctxt, stat); bitcnt += 1; rtxPreInitContext (&lctxt); rtxCopyContext (&lctxt, pctxt); stat = pd_moveBitCursor (pctxt, bitcnt); if (stat != 0) return LOG_RTERR (pctxt, stat); for (i = 0; i < bitcnt; i++) { PD_BIT (&lctxt, &optbit); if (optbit) { stat = pd_OpenType (pctxt, &openType.data, &openType.numocts); if (stat != 0) return LOG_RTERR (pctxt, stat); pOpenType = rtxMemAllocType (pctxt, ASN1OpenType); pOpenType->numocts = openType.numocts; pOpenType->data = openType.data; rtxDListAppend (pctxt, &pvalue->extElem1, pOpenType); } else { /* unknown element */ rtxDListAppend (pctxt, &pvalue->extElem1, 0); } } } return (stat); }
EXTERN int asn1D_InvoiceSummaryType (OSCTXT* pctxt, InvoiceSummaryType *pvalue, ASN1TagType tagging, int length) { int stat = 0; int reqcnt = 0; ASN1CCB ccb; if (tagging == ASN1EXPL) { stat = xd_match1 (pctxt, 0x10, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); } /* decode SEQUENCE */ memset (&pvalue->m, 0, sizeof(pvalue->m)); ccb.len = length; ccb.ptr = OSRTBUFPTR(pctxt); ccb.seqx = 0; while (!XD_CHKEND (pctxt, &ccb)) { switch (ccb.seqx) { case 0: /* decode lineItemCountValue */ if (XD_PEEKTAG (pctxt, 0x80)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_CCT_NumericType (pctxt, &pvalue->lineItemCountValue, ASN1IMPL, length); if (stat == 0) { pvalue->m.lineItemCountValuePresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 1: /* decode subtotalAmount */ if (XD_PEEKTAG (pctxt, 0x81)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_CCT_AmountType (pctxt, &pvalue->subtotalAmount, ASN1IMPL, length); if (stat == 0) { if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } else return LOG_RTERR (pctxt, stat); reqcnt++; } break; case 2: /* decode pricingVariation_list */ if (XD_PEEKTAG (pctxt, 0x82)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); /* decode inline SEQUENCE OF type */ { int stat = 0; PricingVariationType* pdata2; OSRTDListNode* pnode; ASN1CCB ccb; /* decode SEQUENCE OF or SET OF */ rtxDListInit (&pvalue->pricingVariation_list); ccb.len = length; ccb.ptr = OSRTBUFPTR(pctxt); while (!XD_CHKEND (pctxt, &ccb)) { rtxDListAllocNodeAndData (pctxt, PricingVariationType, &pnode, &pdata2); if (pnode == NULL) return LOG_RTERR (pctxt, RTERR_NOMEM); asn1Init_PricingVariationType (pdata2); stat = asn1D_PricingVariationType (pctxt, pdata2, ASN1EXPL, length); if (stat != 0) return LOG_RTERR (pctxt, stat); rtxDListAppendNode (&pvalue->pricingVariation_list, pnode); } } if (stat == 0) { if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } else return LOG_RTERR (pctxt, stat); reqcnt++; } break; case 3: /* decode totalTax */ if (XD_PEEKTAG (pctxt, 0x83)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_TaxType (pctxt, &pvalue->totalTax, ASN1IMPL, length); if (stat == 0) { pvalue->m.totalTaxPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 4: /* decode priceAmount */ if (XD_PEEKTAG (pctxt, 0x84)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_CCT_AmountType (pctxt, &pvalue->priceAmount, ASN1IMPL, length); if (stat == 0) { if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } else return LOG_RTERR (pctxt, stat); reqcnt++; } break; case 5: /* decode packingSlipIdentifier */ if (XD_PEEKTAG (pctxt, 0x85)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_CCT_IdentifierType (pctxt, &pvalue->packingSlipIdentifier, ASN1IMPL, length); if (stat == 0) { pvalue->m.packingSlipIdentifierPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 6: /* decode summaryNote */ if (XD_PEEKTAG (pctxt, 0x86)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_NoteType (pctxt, &pvalue->summaryNote, ASN1IMPL, length); if (stat == 0) { pvalue->m.summaryNotePresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; default: { ASN1TAG tag; int len; stat = xd_tag_len (pctxt, &tag, &len, 0); if (stat != 0) return LOG_RTERR (pctxt, stat); switch (tag) { case (TM_CTXT|TM_CONS|0): case (TM_CTXT|TM_CONS|1): case (TM_CTXT|TM_CONS|2): case (TM_CTXT|TM_CONS|3): case (TM_CTXT|TM_CONS|4): case (TM_CTXT|TM_CONS|5): case (TM_CTXT|TM_CONS|6): stat = RTERR_SEQORDER; break; default: stat = RTERR_SEQOVFLW; break; }} } if (stat != 0) return LOG_RTERR (pctxt, stat); else ccb.seqx++; } if (reqcnt < 3) { return LOG_RTERR (pctxt, RTERR_SETMISRQ); } if (tagging == ASN1EXPL && ccb.len == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } return (stat); }
EXTERN int asn1D_InvoiceType (OSCTXT* pctxt, InvoiceType *pvalue, ASN1TagType tagging, int length) { int stat = 0; int reqcnt = 0; ASN1CCB ccb; if (tagging == ASN1EXPL) { stat = xd_match1 (pctxt, 0x10, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); } /* decode SEQUENCE */ ccb.len = length; ccb.ptr = OSRTBUFPTR(pctxt); ccb.seqx = 0; while (!XD_CHKEND (pctxt, &ccb)) { switch (ccb.seqx) { case 0: /* decode header */ if (XD_PEEKTAG (pctxt, 0x80)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_InvoiceHeaderType (pctxt, &pvalue->header, ASN1IMPL, length); if (stat == 0) { if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } else return LOG_RTERR (pctxt, stat); reqcnt++; } break; case 1: /* decode lineItem_list */ if (XD_PEEKTAG (pctxt, 0x81)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); /* decode inline SEQUENCE OF type */ { int stat = 0; InvoiceLineItemType* pdata2; OSRTDListNode* pnode; ASN1CCB ccb; /* decode SEQUENCE OF or SET OF */ rtxDListInit (&pvalue->lineItem_list); ccb.len = length; ccb.ptr = OSRTBUFPTR(pctxt); while (!XD_CHKEND (pctxt, &ccb)) { rtxDListAllocNodeAndData (pctxt, InvoiceLineItemType, &pnode, &pdata2); if (pnode == NULL) return LOG_RTERR (pctxt, RTERR_NOMEM); asn1Init_InvoiceLineItemType (pdata2); stat = asn1D_InvoiceLineItemType (pctxt, pdata2, ASN1EXPL, length); if (stat != 0) return LOG_RTERR (pctxt, stat); rtxDListAppendNode (&pvalue->lineItem_list, pnode); } if (!(pvalue->lineItem_list.count >= 1U)) { rtxErrAddStrParm (pctxt, "InvoiceType.lineItem_list.count"); rtxErrAddIntParm (pctxt, (int)pvalue->lineItem_list.count); return LOG_RTERR (pctxt, RTERR_CONSVIO); } } if (stat == 0) { if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } else return LOG_RTERR (pctxt, stat); reqcnt++; } break; case 2: /* decode summary */ if (XD_PEEKTAG (pctxt, 0x82)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_InvoiceSummaryType (pctxt, &pvalue->summary, ASN1IMPL, length); if (stat == 0) { if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } else return LOG_RTERR (pctxt, stat); reqcnt++; } break; default: { ASN1TAG tag; int len; stat = xd_tag_len (pctxt, &tag, &len, 0); if (stat != 0) return LOG_RTERR (pctxt, stat); switch (tag) { case (TM_CTXT|TM_CONS|0): case (TM_CTXT|TM_CONS|1): case (TM_CTXT|TM_CONS|2): stat = RTERR_SEQORDER; break; default: stat = RTERR_SEQOVFLW; break; }} } if (stat != 0) return LOG_RTERR (pctxt, stat); else ccb.seqx++; } if (reqcnt < 3) { return LOG_RTERR (pctxt, RTERR_SETMISRQ); } if (tagging == ASN1EXPL && ccb.len == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } return (stat); }
EXTERN int asn1D_Math (OSCTXT* pctxt, Math *pvalue, ASN1TagType tagging, int length) { int stat = 0; int reqcnt = 0; ASN1CCB ccb; if (tagging == ASN1EXPL) { stat = xd_match1 (pctxt, 0x10, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); } /* decode SEQUENCE */ ccb.len = length; ccb.ptr = OSRTBUFPTR(pctxt); ccb.seqx = 0; while (!XD_CHKEND (pctxt, &ccb)) { switch (ccb.seqx) { case 0: /* decode attr */ if (XD_PEEKTAG (pctxt, 0x80)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); /* decode inline SEQUENCE OF type */ { int stat = 0; const OSUTF8CHAR* pdata2; OSRTDListNode* pnode; ASN1CCB ccb; /* decode SEQUENCE OF or SET OF */ rtxDListInit (&pvalue->attr); ccb.len = length; ccb.ptr = OSRTBUFPTR(pctxt); while (!XD_CHKEND (pctxt, &ccb)) { pnode = rtxMemAllocTypeZ (pctxt, OSRTDListNode); if (pnode == NULL) return LOG_RTERR (pctxt, RTERR_NOMEM); stat = xd_utf8str (pctxt, &pdata2, ASN1EXPL, length); if (stat != 0) return LOG_RTERR (pctxt, stat); pnode->data = (void*)pdata2; rtxDListAppendNode (&pvalue->attr, pnode); } } if (stat == 0) { if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } else return LOG_RTERR (pctxt, stat); reqcnt++; } break; case 1: /* decode element446_list */ if (XD_PEEKTAG (pctxt, 0x81)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); /* decode inline SEQUENCE OF type */ { int stat = 0; Odf_Element446* pdata2; OSRTDListNode* pnode; ASN1CCB ccb; /* decode SEQUENCE OF or SET OF */ rtxDListInit (&pvalue->element446_list); ccb.len = length; ccb.ptr = OSRTBUFPTR(pctxt); while (!XD_CHKEND (pctxt, &ccb)) { rtxDListAllocNodeAndData (pctxt, Odf_Element446, &pnode, &pdata2); if (pnode == NULL) return LOG_RTERR (pctxt, RTERR_NOMEM); stat = asn1D_Odf_Element446 (pctxt, (Odf_Element446*)pdata2, ASN1EXPL, length); if (stat != 0) return LOG_RTERR (pctxt, stat); rtxDListAppendNode (&pvalue->element446_list, pnode); } } if (stat == 0) { if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } else return LOG_RTERR (pctxt, stat); reqcnt++; } break; default: { ASN1TAG tag; int len; stat = xd_tag_len (pctxt, &tag, &len, 0); if (stat != 0) return LOG_RTERR (pctxt, stat); switch (tag) { case (TM_CTXT|TM_CONS|0): case (TM_CTXT|TM_CONS|1): stat = RTERR_SEQORDER; break; default: stat = RTERR_SEQOVFLW; break; }} } if (stat != 0) return LOG_RTERR (pctxt, stat); else ccb.seqx++; } if (reqcnt < 2) { return LOG_RTERR (pctxt, RTERR_SETMISRQ); } if (tagging == ASN1EXPL && ccb.len == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } return (stat); }