int xd_32BitCharStr (OSCTXT* pctxt, Asn132BitCharString* object_p, ASN1TagType tagging, ASN1TAG tag, int length) { OSUINT32 i; OSINT32 stat = 0, isConstructedTag; OSOCTET* data = 0; OSUINT32 nchars = 0; OS32BITCHAR* data32 = 0; if (tagging == ASN1EXPL) { if ((stat = xd_match1 (pctxt, ASN1TAG2BYTE(tag), &length)) < 0) /* RTERR_IDNOTFOU will be logged later, by the generated code, or reset by rtxErrReset (for optional seq elements). */ return (stat == RTERR_IDNOTFOU) ? stat : LOG_RTERR (pctxt, stat); } isConstructedTag = (int)((pctxt->flags & ASN1CONSTAG) != 0); if (0 == length) { nchars = 0; data32 = 0; } else { int size, ll = 0; /* For an indefinite length message, need to get the actual */ /* length by parsing tags until the end of the message is */ /* reached.. */ if (length == ASN_K_INDEFLEN) { /* indefinite length message */ if ((stat = xd_consStrIndefLenAndSize (pctxt, TM_UNIV|ASN_ID_OCTSTR, &ll, &size)) != 0) return LOG_RTERR (pctxt, stat); } else ll = size = length; data = (OSOCTET*) rtxMemAlloc (pctxt, ll); data32 = (OS32BITCHAR*)data; if (0 != data) { ll = size; if ((stat = xd_octstr_s (pctxt, data, (OSUINT32*) &ll, ASN1IMPL, size)) != 0) return LOG_RTERR_AND_FREE_MEM (pctxt, stat, data); nchars = ll / 4; for (i = 0; i < nchars; i++, data += 4) { data32[i] = (OS32BITCHAR) (((data[0] * 256) + data[1]) * 65536UL + (((data[2] * 256) + data[3]))); } } else return LOG_RTERR (pctxt, RTERR_NOMEM); } if (isConstructedTag && length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR_AND_FREE_MEM (pctxt, ASN_E_INVLEN, data); } object_p->data = data32; object_p->nchars = nchars; return 0; }
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); }
/*********************************************************************** * * Routine name: xd_bitstr_s (decode static bit string) * * Description: This routine decodes the bit string at the current * message pointer location and returns its value. The * value is returned in the "ASNBITSTR" structure. This * structure contains a value for the number of bits and * a pointer to the decoded bit string. The routine * also advances the message pointer to the start of the * the next field. * * The routine first checks to see if explicit tagging * is specified. If yes, it calls xd_match to match * the universal tag for this message type. If the * match is not successful, a negative value is returned * to indicate the parse was not successful. * * If the match is successful or implicit tagging is * specified, the first byte of the data value is fetched. * This byte contains a value indicating the number of bits * in the last octet that are unused. Dynamic memory is * then allocated for the bit string and xd_memcpy * is called to copy the string from the message to the * allocated memory. The number of bits is calculated by * multiplying the number of octets times eight bits/octet * and then subtracting the number of unused bits obtained * above. The number of bits and dynamic memory pointer * are passed back to the caller via the "ASNBITSTR" * structure. The actual length of the string in bytes is * returned as the function result. * * Inputs: * * Name Type Description * ---- ---- ----------- * pctxt struct Pointer to ASN.1 context block structure * tagging enum Specifies whether element is implicitly or * explicitly tagged. * length int Length of data to retrieve. Valid for implicit * case only. * * Outputs: * * Name Type Description * ---- ---- ----------- * stat int Status of operation. Returned as function result. * object char* Decoded bit string value. * numbits int Number of bits in string. * **********************************************************************/ int xd_bitstr_s (OSCTXT* pctxt, OSOCTET* object_p, OSUINT32* numbits_p, ASN1TagType tagging, int length) { int bufsiz = (*numbits_p - 1) / 8 + 1; int stat = 0; OSOCTET b = 8; if (tagging == ASN1EXPL) { if (!XD_MATCH1 (pctxt, ASN_ID_BITSTR)) { return berErrUnexpTag (pctxt, ASN_ID_BITSTR); } stat = XD_LEN (pctxt, &length); if (stat != 0) LOG_RTERR (pctxt, stat); } if (pctxt->flags & ASN1CONSTAG) { /* constructed case */ ASN1CCB ccb; int idx = 0, oidx = -1, len; ccb.len = length; ccb.ptr = OSRTBUFPTR(pctxt); while (!XD_CHKEND (pctxt, &ccb)) { if ((stat = xd_match1 (pctxt, ASN_ID_BITSTR, &len)) != 0) return LOG_RTERR (pctxt, stat); if ((int)(idx + len) == bufsiz + 1) { /* last segment detection */ if ((stat = XD_MEMCPY1 (pctxt, &b)) != 0) /* read unused bit count */ return LOG_RTERR (pctxt, stat); len --; oidx = -1; } else oidx = idx; if (idx + len <= bufsiz) stat = xd_memcpy (pctxt, object_p + idx, len); else stat = RTERR_STROVFLW; if (stat != 0) return LOG_RTERR (pctxt, stat); else idx += len; } if (oidx >= 0 && idx - oidx > 0) { /* if unused bit count wasn't fetched... */ b = object_p [oidx]; memcpy (object_p + oidx, object_p + oidx + 1, idx - oidx - 1); idx --; } if (b <= 7) { /* initial octet should be 0..7, !AB (11/06/02) */ *numbits_p = (idx * 8) - b; /* If not indefinite length, make sure we consumed exactly as */ /* many bytes as specified in the constructed length field.. */ if (length != ASN_K_INDEFLEN) { size_t usedBytes = OSRTBUFPTR(pctxt) - ccb.ptr; if (usedBytes != (size_t)length) return LOG_RTERR (pctxt, ASN_E_INVLEN); } } else return LOG_RTERR (pctxt, RTERR_BADVALUE); } else if (length > 0) { /* primitive case */ if ((stat = XD_MEMCPY1 (pctxt, &b)) == 0) { length--; /* adjust by 1; first byte is unused bit count */ if (length == 0) { if (0 == b) *numbits_p = 0; else stat = ASN_E_INVLEN; } if (stat == 0) { if (b <= 7) { /* initial octet should be 0..7, !AB (11/05/02) */ if (length <= bufsiz) { stat = xd_memcpy (pctxt, object_p, length); *numbits_p = (length * 8) - b; } else stat = RTERR_STROVFLW; } else stat = RTERR_BADVALUE; } } if (stat != 0) return LOG_RTERR (pctxt, stat); } else if (length == 0) *numbits_p = 0; else return LOG_RTERR (pctxt, ASN_E_INVLEN); return 0; }
EXTERN int asn1D_LatitudeDirectionCodeType (OSCTXT* pctxt, LatitudeDirectionCodeType *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 codeListAgencyID */ if (XD_PEEKTAG (pctxt, 0x80)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_utf8str (pctxt, &pvalue->codeListAgencyID, ASN1IMPL, length); if (stat == 0) { pvalue->m.codeListAgencyIDPresent = TRUE; } } break; case 1: /* decode codeListAgencyName */ if (XD_PEEKTAG (pctxt, 0x81)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_utf8str (pctxt, &pvalue->codeListAgencyName, ASN1IMPL, length); if (stat == 0) { pvalue->m.codeListAgencyNamePresent = TRUE; } } break; case 2: /* decode codeListID */ if (XD_PEEKTAG (pctxt, 0x82)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_utf8str (pctxt, &pvalue->codeListID, ASN1IMPL, length); if (stat == 0) { pvalue->m.codeListIDPresent = TRUE; } } break; case 3: /* decode codeListName */ if (XD_PEEKTAG (pctxt, 0x83)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_utf8str (pctxt, &pvalue->codeListName, ASN1IMPL, length); if (stat == 0) { pvalue->m.codeListNamePresent = TRUE; } } break; case 4: /* decode codeListSchemeURI */ if (XD_PEEKTAG (pctxt, 0x84)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_utf8str (pctxt, &pvalue->codeListSchemeURI, ASN1IMPL, length); if (stat == 0) { pvalue->m.codeListSchemeURIPresent = TRUE; } } break; case 5: /* decode codeListURI */ if (XD_PEEKTAG (pctxt, 0x85)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_utf8str (pctxt, &pvalue->codeListURI, ASN1IMPL, length); if (stat == 0) { pvalue->m.codeListURIPresent = TRUE; } } break; case 6: /* decode codeListVersionID */ if (XD_PEEKTAG (pctxt, 0x86)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_utf8str (pctxt, &pvalue->codeListVersionID, ASN1IMPL, length); if (stat == 0) { pvalue->m.codeListVersionIDPresent = TRUE; } } break; case 7: /* decode languageID */ if (XD_PEEKTAG (pctxt, 0x87)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_utf8str (pctxt, &pvalue->languageID, ASN1IMPL, length); if (stat == 0) { pvalue->m.languageIDPresent = TRUE; } } break; case 8: /* decode name */ if (XD_PEEKTAG (pctxt, 0x88)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_utf8str (pctxt, &pvalue->name, ASN1IMPL, length); if (stat == 0) { pvalue->m.namePresent = TRUE; } } break; case 9: /* decode base */ if (XD_PEEKTAG (pctxt, 0x89)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_LatitudeDirectionCodeContentType (pctxt, &pvalue->base, ASN1IMPL, length); if (stat != 0) 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_PRIM|0): case (TM_CTXT|TM_CONS|0): case (TM_CTXT|TM_PRIM|1): case (TM_CTXT|TM_CONS|1): case (TM_CTXT|TM_PRIM|2): case (TM_CTXT|TM_CONS|2): case (TM_CTXT|TM_PRIM|3): case (TM_CTXT|TM_CONS|3): case (TM_CTXT|TM_PRIM|4): case (TM_CTXT|TM_CONS|4): case (TM_CTXT|TM_PRIM|5): case (TM_CTXT|TM_CONS|5): case (TM_CTXT|TM_PRIM|6): case (TM_CTXT|TM_CONS|6): case (TM_CTXT|TM_PRIM|7): case (TM_CTXT|TM_CONS|7): case (TM_CTXT|TM_PRIM|8): case (TM_CTXT|TM_CONS|8): case (TM_CTXT|TM_PRIM|9): stat = RTERR_SEQORDER; break; default: stat = RTERR_SEQOVFLW; break; }} } if (stat != 0) return LOG_RTERR (pctxt, stat); else ccb.seqx++; } if (reqcnt < 1) { 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_OrderResponseSimpleType (OSCTXT* pctxt, OrderResponseSimpleType *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 iD */ if (XD_PEEKTAG (pctxt, 0x80)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_UBL_UnspecializedDatatypes_1_0_IdentifierType (pctxt, &pvalue->iD, 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 copyIndicator */ if (XD_PEEKTAG (pctxt, 0x81)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_CopyIndicator (pctxt, &pvalue->copyIndicator, ASN1IMPL, length); if (stat == 0) { pvalue->m.copyIndicatorPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 2: /* decode gUID */ if (XD_PEEKTAG (pctxt, 0x82)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_UBL_UnspecializedDatatypes_1_0_IdentifierType (pctxt, &pvalue->gUID, ASN1IMPL, length); if (stat == 0) { pvalue->m.gUIDPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 3: /* decode issueDate */ if (XD_PEEKTAG (pctxt, 0x83)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_IssueDate (pctxt, &pvalue->issueDate, 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 4: /* decode documentStatusCode */ if (XD_PEEKTAG (pctxt, 0x84)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_DocumentStatusCodeType (pctxt, &pvalue->documentStatusCode, ASN1IMPL, length); if (stat == 0) { pvalue->m.documentStatusCodePresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 5: /* decode note */ if (XD_PEEKTAG (pctxt, 0x85)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_Note (pctxt, &pvalue->note, ASN1IMPL, length); if (stat == 0) { pvalue->m.notePresent = 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 acceptedIndicator */ if (XD_PEEKTAG (pctxt, 0x86)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_UBL_OrderResponseSimple_1_0_AcceptedIndicator (pctxt, &pvalue->acceptedIndicator, 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 7: /* decode rejectionNote */ if (XD_PEEKTAG (pctxt, 0x87)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_RejectionNote (pctxt, &pvalue->rejectionNote, ASN1IMPL, length); if (stat == 0) { pvalue->m.rejectionNotePresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 8: /* decode orderReference */ if (XD_PEEKTAG (pctxt, 0x88)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_OrderReference (pctxt, &pvalue->orderReference, 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 9: /* decode buyerParty */ if (XD_PEEKTAG (pctxt, 0x89)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_BuyerParty (pctxt, &pvalue->buyerParty, 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 10: /* decode sellerParty */ if (XD_PEEKTAG (pctxt, 0x8a)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_SellerParty (pctxt, &pvalue->sellerParty, 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): case (TM_CTXT|TM_CONS|3): case (TM_CTXT|TM_CONS|4): case (TM_CTXT|TM_CONS|5): case (TM_CTXT|TM_CONS|6): case (TM_CTXT|TM_CONS|7): case (TM_CTXT|TM_CONS|8): case (TM_CTXT|TM_CONS|9): case (TM_CTXT|TM_CONS|10): stat = RTERR_SEQORDER; break; default: stat = RTERR_SEQOVFLW; break; }} } if (stat != 0) return LOG_RTERR (pctxt, stat); else ccb.seqx++; } if (reqcnt < 6) { 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_UBL_OrderResponseSimple_1_0_AcceptedIndicatorType (OSCTXT* pctxt, UBL_OrderResponseSimple_1_0_AcceptedIndicatorType *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 base */ if (XD_PEEKTAG (pctxt, 0x80)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_boolean (pctxt, &pvalue->base, ASN1IMPL, length); if (stat != 0) 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_PRIM|0): stat = RTERR_SEQORDER; break; default: stat = RTERR_SEQOVFLW; break; }} } if (stat != 0) return LOG_RTERR (pctxt, stat); else ccb.seqx++; } if (reqcnt < 1) { 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_RejectionNoteType (OSCTXT* pctxt, RejectionNoteType *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 languageLocaleID */ if (XD_PEEKTAG (pctxt, 0x80)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_utf8str (pctxt, &pvalue->languageLocaleID, ASN1IMPL, length); if (stat == 0) { pvalue->m.languageLocaleIDPresent = TRUE; } } break; case 1: /* decode languageID */ if (XD_PEEKTAG (pctxt, 0x81)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_utf8str (pctxt, &pvalue->languageID, ASN1IMPL, length); if (stat == 0) { pvalue->m.languageIDPresent = TRUE; } } break; case 2: /* decode base */ if (XD_PEEKTAG (pctxt, 0x82)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_utf8str (pctxt, &pvalue->base, ASN1IMPL, length); if (stat != 0) 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_PRIM|0): case (TM_CTXT|TM_CONS|0): case (TM_CTXT|TM_PRIM|1): case (TM_CTXT|TM_CONS|1): case (TM_CTXT|TM_PRIM|2): 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 < 1) { 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_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_InvoiceLineItemType (OSCTXT* pctxt, InvoiceLineItemType *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 lineID */ if (XD_PEEKTAG (pctxt, 0x80)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_CCT_IdentifierType (pctxt, &pvalue->lineID, 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 item */ if (XD_PEEKTAG (pctxt, 0x81)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_ItemType (pctxt, &pvalue->item, 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 orderStatus */ if (XD_PEEKTAG (pctxt, 0x82)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_CCT_CodeType (pctxt, &pvalue->orderStatus, ASN1IMPL, length); if (stat == 0) { pvalue->m.orderStatusPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 3: /* decode pricing */ if (XD_PEEKTAG (pctxt, 0x83)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_PricingType (pctxt, &pvalue->pricing, 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 4: /* decode pricingVariation */ if (XD_PEEKTAG (pctxt, 0x84)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_PricingVariationType (pctxt, &pvalue->pricingVariation, ASN1IMPL, length); if (stat == 0) { pvalue->m.pricingVariationPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 5: /* decode itemTax */ if (XD_PEEKTAG (pctxt, 0x85)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_CCT_AmountType (pctxt, &pvalue->itemTax, ASN1IMPL, length); if (stat == 0) { pvalue->m.itemTaxPresent = 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 totalAmount */ if (XD_PEEKTAG (pctxt, 0x86)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_CCT_AmountType (pctxt, &pvalue->totalAmount, 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): 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 < 4) { 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_InvoiceHeaderType (OSCTXT* pctxt, InvoiceHeaderType *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 issueDateTime */ if (XD_PEEKTAG (pctxt, 0x80)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_CCT_DateTimeType (pctxt, &pvalue->issueDateTime, 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 identifier */ if (XD_PEEKTAG (pctxt, 0x81)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_CCT_IdentifierType (pctxt, &pvalue->identifier, 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 pOIdentifier */ if (XD_PEEKTAG (pctxt, 0x82)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_CCT_IdentifierType (pctxt, &pvalue->pOIdentifier, 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 3: /* decode currencyCode */ if (XD_PEEKTAG (pctxt, 0x83)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_CCT_CodeType (pctxt, &pvalue->currencyCode, ASN1IMPL, length); if (stat == 0) { pvalue->m.currencyCodePresent = 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 language */ if (XD_PEEKTAG (pctxt, 0x84)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_LanguageType (pctxt, &pvalue->language, ASN1IMPL, length); if (stat == 0) { pvalue->m.languagePresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 5: /* decode buyerParty */ if (XD_PEEKTAG (pctxt, 0x85)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_PartyType (pctxt, &pvalue->buyerParty, 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 6: /* decode sellerParty */ if (XD_PEEKTAG (pctxt, 0x86)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_PartyType (pctxt, &pvalue->sellerParty, 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 7: /* decode consigneeParty */ if (XD_PEEKTAG (pctxt, 0x87)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_PartyType (pctxt, &pvalue->consigneeParty, ASN1IMPL, length); if (stat == 0) { pvalue->m.consigneePartyPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 8: /* decode despatchParty */ if (XD_PEEKTAG (pctxt, 0x88)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_PartyType (pctxt, &pvalue->despatchParty, ASN1IMPL, length); if (stat == 0) { pvalue->m.despatchPartyPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 9: /* decode shipment */ if (XD_PEEKTAG (pctxt, 0x89)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_ShipmentType (pctxt, &pvalue->shipment, ASN1IMPL, length); if (stat == 0) { pvalue->m.shipmentPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 10: /* decode paymentMeans */ if (XD_PEEKTAG (pctxt, 0x8a)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_PaymentMeansType (pctxt, &pvalue->paymentMeans, 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 11: /* decode lineItemCountValue */ if (XD_PEEKTAG (pctxt, 0x8b)) { 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; 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): case (TM_CTXT|TM_CONS|7): case (TM_CTXT|TM_CONS|8): case (TM_CTXT|TM_CONS|9): case (TM_CTXT|TM_CONS|10): case (TM_CTXT|TM_CONS|11): stat = RTERR_SEQORDER; break; default: stat = RTERR_SEQOVFLW; break; }} } if (stat != 0) return LOG_RTERR (pctxt, stat); else ccb.seqx++; } if (reqcnt < 6) { 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_OrderResponseType (OSCTXT* pctxt, OrderResponseType *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 buyersID */ if (XD_PEEKTAG (pctxt, 0x80)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_UBL_UnspecializedDatatypes_1_0_IdentifierType (pctxt, &pvalue->buyersID, ASN1IMPL, length); if (stat == 0) { pvalue->m.buyersIDPresent = 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 sellersID */ if (XD_PEEKTAG (pctxt, 0x81)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_UBL_UnspecializedDatatypes_1_0_IdentifierType (pctxt, &pvalue->sellersID, ASN1IMPL, length); if (stat == 0) { pvalue->m.sellersIDPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 2: /* decode copyIndicator */ if (XD_PEEKTAG (pctxt, 0x82)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_CopyIndicator (pctxt, &pvalue->copyIndicator, ASN1IMPL, length); if (stat == 0) { pvalue->m.copyIndicatorPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 3: /* decode gUID */ if (XD_PEEKTAG (pctxt, 0x83)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_UBL_UnspecializedDatatypes_1_0_IdentifierType (pctxt, &pvalue->gUID, ASN1IMPL, length); if (stat == 0) { pvalue->m.gUIDPresent = 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 issueDate */ if (XD_PEEKTAG (pctxt, 0x84)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_IssueDate (pctxt, &pvalue->issueDate, 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 documentStatusCode */ if (XD_PEEKTAG (pctxt, 0x85)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_DocumentStatusCodeType (pctxt, &pvalue->documentStatusCode, ASN1IMPL, length); if (stat == 0) { pvalue->m.documentStatusCodePresent = 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 note */ if (XD_PEEKTAG (pctxt, 0x86)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_Note (pctxt, &pvalue->note, ASN1IMPL, length); if (stat == 0) { pvalue->m.notePresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 7: /* decode transactionCurrencyCode */ if (XD_PEEKTAG (pctxt, 0x87)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_CurrencyCodeType (pctxt, &pvalue->transactionCurrencyCode, ASN1IMPL, length); if (stat == 0) { pvalue->m.transactionCurrencyCodePresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 8: /* decode pricingCurrencyCode */ if (XD_PEEKTAG (pctxt, 0x88)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_CurrencyCodeType (pctxt, &pvalue->pricingCurrencyCode, ASN1IMPL, length); if (stat == 0) { pvalue->m.pricingCurrencyCodePresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 9: /* decode earliestDate */ if (XD_PEEKTAG (pctxt, 0x89)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_UBL_OrderResponse_1_0_EarliestDate (pctxt, &pvalue->earliestDate, ASN1IMPL, length); if (stat == 0) { pvalue->m.earliestDatePresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 10: /* decode expiryDate */ if (XD_PEEKTAG (pctxt, 0x8a)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_ExpiryDate (pctxt, &pvalue->expiryDate, ASN1IMPL, length); if (stat == 0) { pvalue->m.expiryDatePresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 11: /* decode validityDurationMeasure */ if (XD_PEEKTAG (pctxt, 0x8b)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_UBL_OrderResponse_1_0_ValidityDurationMeasure (pctxt, &pvalue->validityDurationMeasure, ASN1IMPL, length); if (stat == 0) { pvalue->m.validityDurationMeasurePresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 12: /* decode taxTotalAmount */ if (XD_PEEKTAG (pctxt, 0x8c)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_TaxTotalAmount (pctxt, &pvalue->taxTotalAmount, ASN1IMPL, length); if (stat == 0) { pvalue->m.taxTotalAmountPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 13: /* decode lineExtensionTotalAmount */ if (XD_PEEKTAG (pctxt, 0x8d)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_LineExtensionTotalAmount (pctxt, &pvalue->lineExtensionTotalAmount, ASN1IMPL, length); if (stat == 0) { pvalue->m.lineExtensionTotalAmountPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 14: /* decode totalPackagesCountQuantity */ if (XD_PEEKTAG (pctxt, 0x8e)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_UBL_OrderResponse_1_0_TotalPackagesCountQuantity (pctxt, &pvalue->totalPackagesCountQuantity, ASN1IMPL, length); if (stat == 0) { pvalue->m.totalPackagesCountQuantityPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 15: /* decode grossWeightMeasure */ if (XD_PEEKTAG (pctxt, 0x8f)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_GrossWeightMeasure (pctxt, &pvalue->grossWeightMeasure, ASN1IMPL, length); if (stat == 0) { pvalue->m.grossWeightMeasurePresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 16: /* decode netWeightMeasure */ if (XD_PEEKTAG (pctxt, 0x90)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_NetWeightMeasure (pctxt, &pvalue->netWeightMeasure, ASN1IMPL, length); if (stat == 0) { pvalue->m.netWeightMeasurePresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 17: /* decode netNetWeightMeasure */ if (XD_PEEKTAG (pctxt, 0x91)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_NetNetWeightMeasure (pctxt, &pvalue->netNetWeightMeasure, ASN1IMPL, length); if (stat == 0) { pvalue->m.netNetWeightMeasurePresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 18: /* decode grossVolumeMeasure */ if (XD_PEEKTAG (pctxt, 0x92)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_GrossVolumeMeasure (pctxt, &pvalue->grossVolumeMeasure, ASN1IMPL, length); if (stat == 0) { pvalue->m.grossVolumeMeasurePresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 19: /* decode netVolumeMeasure */ if (XD_PEEKTAG (pctxt, 0x93)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_NetVolumeMeasure (pctxt, &pvalue->netVolumeMeasure, ASN1IMPL, length); if (stat == 0) { pvalue->m.netVolumeMeasurePresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 20: /* decode lineItemCountNumeric */ if (XD_PEEKTAG (pctxt, 0x94)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_UBL_OrderResponse_1_0_LineItemCountNumeric (pctxt, &pvalue->lineItemCountNumeric, ASN1IMPL, length); if (stat == 0) { pvalue->m.lineItemCountNumericPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 21: /* decode orderReference_list */ if (XD_PEEKTAG (pctxt, 0x95)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_OrderResponseType_orderReference_list (pctxt, &pvalue->orderReference_list, 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 22: /* decode buyerParty */ if (XD_PEEKTAG (pctxt, 0x96)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_BuyerParty (pctxt, &pvalue->buyerParty, 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 23: /* decode sellerParty */ if (XD_PEEKTAG (pctxt, 0x97)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_SellerParty (pctxt, &pvalue->sellerParty, 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 24: /* decode originatorParty */ if (XD_PEEKTAG (pctxt, 0x98)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_UBL_OrderResponse_1_0_OriginatorParty (pctxt, &pvalue->originatorParty, ASN1IMPL, length); if (stat == 0) { pvalue->m.originatorPartyPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 25: /* decode freightForwarderParty */ if (XD_PEEKTAG (pctxt, 0x99)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_UBL_OrderResponse_1_0_FreightForwarderParty (pctxt, &pvalue->freightForwarderParty, ASN1IMPL, length); if (stat == 0) { pvalue->m.freightForwarderPartyPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 26: /* decode delivery_list */ if (XD_PEEKTAG (pctxt, 0x9a)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D__SeqOfDelivery (pctxt, &pvalue->delivery_list, 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 27: /* decode deliveryTerms */ if (XD_PEEKTAG (pctxt, 0x9b)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_DeliveryTerms (pctxt, &pvalue->deliveryTerms, ASN1IMPL, length); if (stat == 0) { pvalue->m.deliveryTermsPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 28: /* decode allowanceCharge_list */ if (XD_PEEKTAG (pctxt, 0x9c)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D__SeqOfAllowanceCharge (pctxt, &pvalue->allowanceCharge_list, 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 29: /* decode salesConditions */ if (XD_PEEKTAG (pctxt, 0x9d)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_SalesConditions (pctxt, &pvalue->salesConditions, ASN1IMPL, length); if (stat == 0) { pvalue->m.salesConditionsPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 30: /* decode destinationCountry */ if (XD_PEEKTAG (pctxt, 0x9e)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = asn1D_UBL_OrderResponse_1_0_DestinationCountry (pctxt, &pvalue->destinationCountry, ASN1IMPL, length); if (stat == 0) { pvalue->m.destinationCountryPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } break; case 31: /* decode respondedOrderLine_list */ if ((stat = xd_match (pctxt, TM_CTXT|TM_CONS|31, &length, XM_ADVANCE)) == 0) { stat = asn1D_OrderResponseType_respondedOrderLine_list (pctxt, &pvalue->respondedOrderLine_list, 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 32: /* decode paymentMeans */ if ((stat = xd_match (pctxt, TM_CTXT|TM_CONS|32, &length, XM_ADVANCE)) == 0) { stat = asn1D_PaymentMeans (pctxt, &pvalue->paymentMeans, ASN1IMPL, length); if (stat == 0) { pvalue->m.paymentMeansPresent = TRUE; if (length == ASN_K_INDEFLEN) { if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); else return LOG_RTERR (pctxt, ASN_E_INVLEN); } } } else if (stat == RTERR_IDNOTFOU) { stat = rtxErrReset (pctxt); } 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): case (TM_CTXT|TM_CONS|7): case (TM_CTXT|TM_CONS|8): case (TM_CTXT|TM_CONS|9): case (TM_CTXT|TM_CONS|10): case (TM_CTXT|TM_CONS|11): case (TM_CTXT|TM_CONS|12): case (TM_CTXT|TM_CONS|13): case (TM_CTXT|TM_CONS|14): case (TM_CTXT|TM_CONS|15): case (TM_CTXT|TM_CONS|16): case (TM_CTXT|TM_CONS|17): case (TM_CTXT|TM_CONS|18): case (TM_CTXT|TM_CONS|19): case (TM_CTXT|TM_CONS|20): case (TM_CTXT|TM_CONS|21): case (TM_CTXT|TM_CONS|22): case (TM_CTXT|TM_CONS|23): case (TM_CTXT|TM_CONS|24): case (TM_CTXT|TM_CONS|25): case (TM_CTXT|TM_CONS|26): case (TM_CTXT|TM_CONS|27): case (TM_CTXT|TM_CONS|28): case (TM_CTXT|TM_CONS|29): case (TM_CTXT|TM_CONS|30): case (TM_CTXT|TM_CONS|31): case (TM_CTXT|TM_CONS|32): stat = RTERR_SEQORDER; break; default: stat = RTERR_SEQOVFLW; break; }} } if (stat != 0) return LOG_RTERR (pctxt, stat); else ccb.seqx++; } if (reqcnt < 7) { 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_UBL_OrderResponse_1_0_PackagesCountQuantityType (OSCTXT* pctxt, UBL_OrderResponse_1_0_PackagesCountQuantityType *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 quantityUnitCode */ if (XD_PEEKTAG (pctxt, 0x80)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_utf8str (pctxt, &pvalue->quantityUnitCode, ASN1IMPL, length); if (stat != 0) return LOG_RTERR (pctxt, stat); reqcnt++; } break; case 1: /* decode quantityUnitCodeListAgencyID */ if (XD_PEEKTAG (pctxt, 0x81)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_utf8str (pctxt, &pvalue->quantityUnitCodeListAgencyID, ASN1IMPL, length); if (stat == 0) { pvalue->m.quantityUnitCodeListAgencyIDPresent = TRUE; } } break; case 2: /* decode quantityUnitCodeListAgencyName */ if (XD_PEEKTAG (pctxt, 0x82)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_utf8str (pctxt, &pvalue->quantityUnitCodeListAgencyName, ASN1IMPL, length); if (stat == 0) { pvalue->m.quantityUnitCodeListAgencyNamePresent = TRUE; } } break; case 3: /* decode quantityUnitCodeListID */ if (XD_PEEKTAG (pctxt, 0x83)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_utf8str (pctxt, &pvalue->quantityUnitCodeListID, ASN1IMPL, length); if (stat == 0) { pvalue->m.quantityUnitCodeListIDPresent = TRUE; } } break; case 4: /* decode base */ if (XD_PEEKTAG (pctxt, 0x84)) { stat = xd_Tag1AndLen (pctxt, &length); if (stat != 0) return LOG_RTERR (pctxt, stat); stat = xd_real (pctxt, &pvalue->base, ASN1IMPL, length); if (stat != 0) 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_PRIM|0): case (TM_CTXT|TM_CONS|0): case (TM_CTXT|TM_PRIM|1): case (TM_CTXT|TM_CONS|1): case (TM_CTXT|TM_PRIM|2): case (TM_CTXT|TM_CONS|2): case (TM_CTXT|TM_PRIM|3): case (TM_CTXT|TM_CONS|3): case (TM_CTXT|TM_PRIM|4): 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); }
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); }