Пример #1
0
int berDecStrmReal (OSCTXT *pctxt, OSREAL *object_p, 
                    ASN1TagType tagging, int length) 
{ 
   OSRTBuffer savedBuf;
   OSOCTET tmpbuf[16];
   register int stat = 0;

   if (tagging == ASN1EXPL) {
      if ((stat = berDecStrmMatchTag (pctxt, ASN_ID_REAL, &length, TRUE)) != 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);
   }

   /* Read encoded value into memory */

   if (length > sizeof(tmpbuf)) {
      return LOG_RTERR (pctxt, RTERR_TOOBIG);
   }
   stat = rtxStreamRead (pctxt, tmpbuf, length);
   if (stat < 0) return LOG_RTERR (pctxt, stat);

   /* Decode */

   memcpy (&savedBuf, &pctxt->buffer, sizeof(OSRTBuffer));
   rtxInitContextBuffer (pctxt, tmpbuf, length);

   stat = xd_real (pctxt, object_p, ASN1IMPL, length);

   /* Reset context buffer */

   memcpy (&pctxt->buffer, &savedBuf, sizeof(OSRTBuffer));

   return stat;
} 
Пример #2
0
int xe_setp (OSCTXT* pctxt, OSOCTET *buf_p, int bufsiz)
{
    int stat = rtxInitContextBuffer (pctxt, buf_p, bufsiz);

    if (stat == 0) {
        pctxt->buffer.byteIndex = pctxt->buffer.size - 1;
        return 0;
    }
    else return LOG_RTERR (pctxt, stat);
}
void asn1DOMTest_ResponseRequiredIndicatorType (OSCTXT* pctxt, 
   ResponseRequiredIndicatorType* pvalue, xmlNodePtr pXmlNode, OSBOOL setChild)
{
   xmlAttrPtr pXmlAttr = pXmlNode->properties;

   /* Populate attributes */
   for ( ; 0 != pXmlAttr; pXmlAttr = pXmlAttr->next) {
      if (pXmlAttr->type == XML_ATTRIBUTE_NODE) {
      }
   }
   /* Populate elements */
   if (0 != pXmlNode->children) {
      OSUTF8CHAR* pcontent = pXmlNode->children->content;
      rtxInitContextBuffer (pctxt, pcontent, rtxUTF8LenBytes(pcontent));
      rtXmlDecBool (pctxt, &pvalue->base);
   }
}
Пример #4
0
int xd_setp (OSCTXT *pctxt, const OSOCTET* msg_p, 
             int msglen, ASN1TAG *tag_p, int *len_p)
{ 
   int	stat, ll;
   ASN1TAG ltag;

   /* Initialize the context for decoding */

   stat = rtxInitContextBuffer 
      (pctxt, (OSOCTET*)msg_p, (msglen > 0) ? msglen : INT_MAX);

   if (stat != 0) return LOG_RTERR (pctxt, stat);

   /* Reset BER indefinite length and last EOC flags (ED, 1/29/2002) */

   pctxt->flags &= (~(ASN1INDEFLEN | ASN1LASTEOC));

   /* If message is fixed length, add length of ID and length fields 	*/
   /* onto contents field length to get total message length; else set	*/
   /* global message length to indefinite length indicator value...	*/

   stat = xd_tag_len (pctxt, &ltag, &ll, XM_ADVANCE);
   if (stat != 0) return LOG_RTERR (pctxt, stat);

   if (ll == ASN_K_INDEFLEN) {
      pctxt->flags |= ASN1INDEFLEN;
      if (len_p) *len_p = ASN_K_INDEFLEN;
   }
   else {
      pctxt->buffer.size = (size_t)ll + pctxt->buffer.byteIndex;
      if (len_p) *len_p = (int)pctxt->buffer.size;
      if (msglen > 0 && pctxt->buffer.size > (OSUINT32)msglen) {
         stat = ASN_E_INVLEN;
      }
   }

   pctxt->buffer.byteIndex = 0;

   if (tag_p) *tag_p = ltag;

   if (stat != 0) return LOG_RTERR (pctxt, stat);
   return 0;
}