www.pudn.com > map.rar > MAP-SS-DataTypesDec.c, change:2007-05-15,size:93309b


/** 
 * This file was generated by the Objective Systems ASN1C Compiler 
 * (http://www.obj-sys.com).  Version: 6.02, Date: 15-May-2007. 
 */ 
#include "MAP-SS-DataTypes.h" 
#include "rtxsrc/rtxCommon.h" 
 
/**************************************************************/ 
/*                                                            */ 
/*  CliRestrictionOption                                      */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_CliRestrictionOption (OSCTXT* pctxt,  
   CliRestrictionOption *pvalue, ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
 
   stat = xd_enum (pctxt, (OSINT32*)pvalue, tagging, length); 
   if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
   if(*pvalue < 0 || *pvalue > 2) 
      return LOG_RTERR (pctxt, RTERR_INVENUM); 
 
   return (stat); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  OverrideCategory                                          */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_OverrideCategory (OSCTXT* pctxt, OverrideCategory *pvalue,  
   ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
 
   stat = xd_enum (pctxt, (OSINT32*)pvalue, tagging, length); 
   if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
   if(*pvalue < 0 || *pvalue > 1) 
      return LOG_RTERR (pctxt, RTERR_INVENUM); 
 
   return (stat); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  SS_SubscriptionOption                                     */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_SS_SubscriptionOption (OSCTXT* pctxt,  
   SS_SubscriptionOption *pvalue, ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
   ASN1TAG ctag; 
   ASN1CCB ccb; 
 
   /* decode CHOICE */ 
 
   stat = xd_tag_len (pctxt, &ctag, &length, XM_ADVANCE); 
   if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
   ccb.len = length; 
   ccb.ptr = OSRTBUFPTR(pctxt); 
 
   switch (ctag) 
   { 
      case (TM_CTXT|TM_PRIM|1): 
         stat = asn1D_OverrideCategory (pctxt,  
            &pvalue->u.overrideCategory, ASN1IMPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         if(pvalue->u.overrideCategory < 0 || pvalue->u.overrideCategory > 1) 
            return LOG_RTERR (pctxt, RTERR_INVENUM); 
 
         pvalue->t = 1; 
         break; 
 
      case (TM_CTXT|TM_PRIM|2): 
         stat = asn1D_CliRestrictionOption (pctxt,  
            &pvalue->u.cliRestrictionOption, ASN1IMPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         if(pvalue->u.cliRestrictionOption < 0 || pvalue->u.cliRestrictionOption > 2) 
            return LOG_RTERR (pctxt, RTERR_INVENUM); 
 
         pvalue->t = 2; 
         break; 
 
      default: 
         berErrAddTagParm (pctxt, ctag); 
         return LOG_RTERR (pctxt, RTERR_INVOPT); 
   } 
 
   if (ccb.len == ASN_K_INDEFLEN) { 
      if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); 
      else return LOG_RTERR (pctxt, ASN_E_INVLEN); 
   } 
 
   return (stat); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  SS_List                                                   */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_SS_List (OSCTXT* pctxt, SS_List *pvalue, ASN1TagType tagging,  
   int length) 
{ 
   int stat = 0; 
   int xx1; 
   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 */ 
 
   xx1 = 0; 
   ccb.len = length; 
   ccb.ptr = OSRTBUFPTR(pctxt); 
 
   while (!XD_CHKEND (pctxt, &ccb)) 
   { 
      if (xx1 >= 30) return LOG_RTERR (pctxt, RTERR_SEQOVFLW); 
 
      stat = asn1D_SS_Code (pctxt,  
         &pvalue->elem[xx1], ASN1EXPL, length); 
      if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
      xx1++; 
   } 
   pvalue->n = xx1; 
 
   if (!((pvalue->n >= 1 && pvalue->n <= 30))) { 
      rtxErrAddStrParm (pctxt, "SS_List.n"); 
      rtxErrAddIntParm (pctxt, (int)pvalue->n); 
      return LOG_RTERR (pctxt, RTERR_CONSVIO); 
   } 
 
   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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  SS_ForBS_Code                                             */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_SS_ForBS_Code (OSCTXT* pctxt, SS_ForBS_Code *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 ss_Code */ 
         stat = asn1D_SS_Code (pctxt,  
            &pvalue->ss_Code, ASN1EXPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         reqcnt++; 
         break; 
 
      case 1: 
         /* decode basicService */ 
         stat = asn1D_BasicServiceCode (pctxt,  
            &pvalue->basicService, ASN1EXPL, length); 
         if (stat == 0) { 
            pvalue->m.basicServicePresent = TRUE; 
         } 
         else if (stat == RTERR_INVOPT) { 
            OSRTBUFRESTORE (pctxt); 
            stat = rtxErrReset (pctxt); 
         } 
         else if (stat == RTERR_IDNOTFOU || stat == RTERR_ENDOFBUF) { 
            stat = rtxErrReset (pctxt); 
         } 
         break; 
 
      case 2: 
         /* decode longFTN_Supported */ 
         if (XD_PEEKTAG (pctxt, 0x84)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = xd_null (pctxt, ASN1IMPL); 
            if (stat == 0) { 
               pvalue->m.longFTN_SupportedPresent = TRUE; 
            } 
         } 
         break; 
 
      case 3: 
         /* decode extElem1 */ 
         { ASN1TAG tag; 
         int len; 
         stat = xd_tag_len (pctxt, &tag, &len, 0); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
         switch (tag) { 
         case (TM_UNIV|TM_PRIM|4): 
         case (TM_UNIV|TM_CONS|4): 
         case (TM_CTXT|TM_PRIM|2): 
         case (TM_CTXT|TM_PRIM|3): 
         case (TM_CTXT|TM_PRIM|4): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  Password                                                  */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_Password (OSCTXT* pctxt, Password *pvalue,  
   ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
 
   stat = xd_charstr (pctxt, pvalue, tagging, (TM_UNIV|TM_PRIM|18), length); 
   if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
   { size_t nchars = strlen (*pvalue); 
   if (!(nchars == 4)) { 
      rtxErrAddStrParm (pctxt, "Password"); 
      rtxErrAddIntParm (pctxt, (int)nchars); 
      return LOG_RTERR (pctxt, RTERR_CONSVIO); 
   } 
 
   } 
   return (stat); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  ForwardingOptions                                         */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_ForwardingOptions (OSCTXT* pctxt, ForwardingOptions *pvalue,  
   ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
 
   pvalue->numocts = 1; 
   stat = xd_octstr_s (pctxt, pvalue->data, &pvalue->numocts, tagging, length); 
   if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
   if (!(pvalue->numocts == 1)) { 
      rtxErrAddStrParm (pctxt, "ForwardingOptions.numocts"); 
      rtxErrAddIntParm (pctxt, (int)pvalue->numocts); 
      return LOG_RTERR (pctxt, RTERR_CONSVIO); 
   } 
 
   return (stat); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  CCBS_Index                                                */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_CCBS_Index (OSCTXT* pctxt, CCBS_Index *pvalue,  
   ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
 
   stat = xd_uint8 (pctxt, pvalue, tagging, length); 
   if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
   if (!((*pvalue >= OSUINTCONST(1) && *pvalue <= OSUINTCONST(5)))) { 
      rtxErrAddStrParm (pctxt, "CCBS_Index"); 
      rtxErrAddIntParm (pctxt, (int)*pvalue); 
      return LOG_RTERR (pctxt, RTERR_CONSVIO); 
   } 
 
   return (stat); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  CCBS_Feature                                              */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_CCBS_Feature (OSCTXT* pctxt, CCBS_Feature *pvalue,  
   ASN1TagType tagging, int length) 
{ 
   int stat = 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 ccbs_Index */ 
         if (XD_PEEKTAG (pctxt, 0x80)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_CCBS_Index (pctxt,  
               &pvalue->ccbs_Index, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.ccbs_IndexPresent = TRUE; 
            } 
         } 
         break; 
 
      case 1: 
         /* decode b_subscriberNumber */ 
         if (XD_PEEKTAG (pctxt, 0x81)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_ISDN_AddressString (pctxt,  
               &pvalue->b_subscriberNumber, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.b_subscriberNumberPresent = TRUE; 
            } 
         } 
         break; 
 
      case 2: 
         /* decode b_subscriberSubaddress */ 
         if (XD_PEEKTAG (pctxt, 0x82)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_ISDN_SubaddressString (pctxt,  
               &pvalue->b_subscriberSubaddress, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.b_subscriberSubaddressPresent = TRUE; 
            } 
         } 
         break; 
 
      case 3: 
         /* decode basicServiceGroup */ 
         if (XD_PEEKTAG (pctxt, 0x83)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_BasicServiceCode (pctxt,  
               &pvalue->basicServiceGroup, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.basicServiceGroupPresent = 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 extElem1 */ 
         { 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_PRIM|1): 
         case (TM_CTXT|TM_CONS|1): 
         case (TM_CTXT|TM_PRIM|2): 
         case (TM_CTXT|TM_CONS|2): 
         case (TM_CTXT|TM_CONS|3): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      if (stat != 0) return LOG_RTERR (pctxt, stat); 
      else ccb.seqx++; 
   } 
 
   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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  NoReplyConditionTime                                      */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_NoReplyConditionTime (OSCTXT* pctxt,  
   NoReplyConditionTime *pvalue, ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
 
   stat = xd_uint8 (pctxt, pvalue, tagging, length); 
   if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
   if (!((*pvalue >= OSUINTCONST(5) && *pvalue <= OSUINTCONST(30)))) { 
      rtxErrAddStrParm (pctxt, "NoReplyConditionTime"); 
      rtxErrAddIntParm (pctxt, (int)*pvalue); 
      return LOG_RTERR (pctxt, RTERR_CONSVIO); 
   } 
 
   return (stat); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  SS_Status                                                 */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_SS_Status (OSCTXT* pctxt, SS_Status *pvalue,  
   ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
 
   pvalue->numocts = 1; 
   stat = xd_octstr_s (pctxt, pvalue->data, &pvalue->numocts, tagging, length); 
   if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
   if (!(pvalue->numocts == 1)) { 
      rtxErrAddStrParm (pctxt, "SS_Status.numocts"); 
      rtxErrAddIntParm (pctxt, (int)pvalue->numocts); 
      return LOG_RTERR (pctxt, RTERR_CONSVIO); 
   } 
 
   return (stat); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  USSD_DataCodingScheme                                     */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_USSD_DataCodingScheme (OSCTXT* pctxt,  
   USSD_DataCodingScheme *pvalue, ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
 
   pvalue->numocts = 1; 
   stat = xd_octstr_s (pctxt, pvalue->data, &pvalue->numocts, tagging, length); 
   if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
   if (!(pvalue->numocts == 1)) { 
      rtxErrAddStrParm (pctxt, "USSD_DataCodingScheme.numocts"); 
      rtxErrAddIntParm (pctxt, (int)pvalue->numocts); 
      return LOG_RTERR (pctxt, RTERR_CONSVIO); 
   } 
 
   return (stat); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  USSD_String                                               */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_USSD_String (OSCTXT* pctxt, USSD_String *pvalue,  
   ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
 
   pvalue->numocts = 160; 
   stat = xd_octstr_s (pctxt, pvalue->data, &pvalue->numocts, tagging, length); 
   if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
   if (!((pvalue->numocts >= 1 && pvalue->numocts <= 160))) { 
      rtxErrAddStrParm (pctxt, "USSD_String.numocts"); 
      rtxErrAddIntParm (pctxt, (int)pvalue->numocts); 
      return LOG_RTERR (pctxt, RTERR_CONSVIO); 
   } 
 
   return (stat); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  GuidanceInfo                                              */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_GuidanceInfo (OSCTXT* pctxt, GuidanceInfo *pvalue,  
   ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
 
   stat = xd_enum (pctxt, (OSINT32*)pvalue, tagging, length); 
   if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
   if(*pvalue < 0 || *pvalue > 2) 
      return LOG_RTERR (pctxt, RTERR_INVENUM); 
 
   return (stat); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  CCBS_RequestState                                         */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_CCBS_RequestState (OSCTXT* pctxt, CCBS_RequestState *pvalue,  
   ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
 
   stat = xd_enum (pctxt, (OSINT32*)pvalue, tagging, length); 
   if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
   if(*pvalue < 0 || *pvalue > 6) 
      return LOG_RTERR (pctxt, RTERR_INVENUM); 
 
   return (stat); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  ServiceIndicator                                          */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_ServiceIndicator (OSCTXT* pctxt, ServiceIndicator *pvalue,  
   ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
 
   pvalue->numbits = 32; 
   stat = xd_bitstr_s (pctxt, pvalue->data, &pvalue->numbits, tagging, length); 
   if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
   if (!((pvalue->numbits >= 2 && pvalue->numbits <= 32))) { 
      rtxErrAddStrParm (pctxt, "ServiceIndicator.numbits"); 
      rtxErrAddIntParm (pctxt, (int)pvalue->numbits); 
      return LOG_RTERR (pctxt, RTERR_CONSVIO); 
   } 
 
   return (stat); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  RegisterSS_Arg                                            */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_RegisterSS_Arg (OSCTXT* pctxt, RegisterSS_Arg *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 ss_Code */ 
         stat = asn1D_SS_Code (pctxt,  
            &pvalue->ss_Code, ASN1EXPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         reqcnt++; 
         break; 
 
      case 1: 
         /* decode basicService */ 
         stat = asn1D_BasicServiceCode (pctxt,  
            &pvalue->basicService, ASN1EXPL, length); 
         if (stat == 0) { 
            pvalue->m.basicServicePresent = TRUE; 
         } 
         else if (stat == RTERR_INVOPT) { 
            OSRTBUFRESTORE (pctxt); 
            stat = rtxErrReset (pctxt); 
         } 
         else if (stat == RTERR_IDNOTFOU || stat == RTERR_ENDOFBUF) { 
            stat = rtxErrReset (pctxt); 
         } 
         break; 
 
      case 2: 
         /* decode forwardedToNumber */ 
         if (XD_PEEKTAG (pctxt, 0x84)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_AddressString (pctxt,  
               &pvalue->forwardedToNumber, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.forwardedToNumberPresent = TRUE; 
            } 
         } 
         break; 
 
      case 3: 
         /* decode forwardedToSubaddress */ 
         if (XD_PEEKTAG (pctxt, 0x86)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_ISDN_SubaddressString (pctxt,  
               &pvalue->forwardedToSubaddress, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.forwardedToSubaddressPresent = TRUE; 
            } 
         } 
         break; 
 
      case 4: 
         /* decode noReplyConditionTime */ 
         if (XD_PEEKTAG (pctxt, 0x85)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_NoReplyConditionTime (pctxt,  
               &pvalue->noReplyConditionTime, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.noReplyConditionTimePresent = TRUE; 
            } 
         } 
         break; 
 
      case 5: 
         /* decode defaultPriority */ 
         if (XD_PEEKTAG (pctxt, 0x87)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_EMLPP_Priority (pctxt,  
               &pvalue->defaultPriority, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.defaultPriorityPresent = TRUE; 
            } 
         } 
         break; 
 
      case 6: 
         /* decode nbrUser */ 
         if (XD_PEEKTAG (pctxt, 0x88)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_MC_Bearers (pctxt,  
               &pvalue->nbrUser, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.nbrUserPresent = TRUE; 
            } 
         } 
         break; 
 
      case 7: 
         /* decode longFTN_Supported */ 
         if (XD_PEEKTAG (pctxt, 0x89)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = xd_null (pctxt, ASN1IMPL); 
            if (stat == 0) { 
               pvalue->m.longFTN_SupportedPresent = TRUE; 
            } 
         } 
         break; 
 
      case 8: 
         /* decode extElem1 */ 
         { ASN1TAG tag; 
         int len; 
         stat = xd_tag_len (pctxt, &tag, &len, 0); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
         switch (tag) { 
         case (TM_UNIV|TM_PRIM|4): 
         case (TM_UNIV|TM_CONS|4): 
         case (TM_CTXT|TM_PRIM|2): 
         case (TM_CTXT|TM_PRIM|3): 
         case (TM_CTXT|TM_PRIM|4): 
         case (TM_CTXT|TM_CONS|4): 
         case (TM_CTXT|TM_PRIM|6): 
         case (TM_CTXT|TM_CONS|6): 
         case (TM_CTXT|TM_PRIM|5): 
         case (TM_CTXT|TM_PRIM|7): 
         case (TM_CTXT|TM_PRIM|8): 
         case (TM_CTXT|TM_PRIM|9): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  ForwardingFeature                                         */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_ForwardingFeature (OSCTXT* pctxt, ForwardingFeature *pvalue,  
   ASN1TagType tagging, int length) 
{ 
   int stat = 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 basicService */ 
         stat = asn1D_BasicServiceCode (pctxt,  
            &pvalue->basicService, ASN1EXPL, length); 
         if (stat == 0) { 
            pvalue->m.basicServicePresent = TRUE; 
         } 
         else if (stat == RTERR_INVOPT) { 
            OSRTBUFRESTORE (pctxt); 
            stat = rtxErrReset (pctxt); 
         } 
         else if (stat == RTERR_IDNOTFOU || stat == RTERR_ENDOFBUF) { 
            stat = rtxErrReset (pctxt); 
         } 
         break; 
 
      case 1: 
         /* decode ss_Status */ 
         if (XD_PEEKTAG (pctxt, 0x84)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_SS_Status (pctxt,  
               &pvalue->ss_Status, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.ss_StatusPresent = TRUE; 
            } 
         } 
         break; 
 
      case 2: 
         /* decode forwardedToNumber */ 
         if (XD_PEEKTAG (pctxt, 0x85)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_ISDN_AddressString (pctxt,  
               &pvalue->forwardedToNumber, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.forwardedToNumberPresent = TRUE; 
            } 
         } 
         break; 
 
      case 3: 
         /* decode forwardedToSubaddress */ 
         if (XD_PEEKTAG (pctxt, 0x88)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_ISDN_SubaddressString (pctxt,  
               &pvalue->forwardedToSubaddress, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.forwardedToSubaddressPresent = TRUE; 
            } 
         } 
         break; 
 
      case 4: 
         /* decode forwardingOptions */ 
         if (XD_PEEKTAG (pctxt, 0x86)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_ForwardingOptions (pctxt,  
               &pvalue->forwardingOptions, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.forwardingOptionsPresent = TRUE; 
            } 
         } 
         break; 
 
      case 5: 
         /* decode noReplyConditionTime */ 
         if (XD_PEEKTAG (pctxt, 0x87)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_NoReplyConditionTime (pctxt,  
               &pvalue->noReplyConditionTime, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.noReplyConditionTimePresent = TRUE; 
            } 
         } 
         break; 
 
      case 6: 
         /* decode longForwardedToNumber */ 
         if (XD_PEEKTAG (pctxt, 0x89)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_FTN_AddressString (pctxt,  
               &pvalue->longForwardedToNumber, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.longForwardedToNumberPresent = TRUE; 
            } 
         } 
         break; 
 
      case 7: 
         /* decode extElem1 */ 
         { 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|2): 
         case (TM_CTXT|TM_PRIM|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|8): 
         case (TM_CTXT|TM_CONS|8): 
         case (TM_CTXT|TM_PRIM|6): 
         case (TM_CTXT|TM_CONS|6): 
         case (TM_CTXT|TM_PRIM|7): 
         case (TM_CTXT|TM_PRIM|9): 
         case (TM_CTXT|TM_CONS|9): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      if (stat != 0) return LOG_RTERR (pctxt, stat); 
      else ccb.seqx++; 
   } 
 
   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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  ForwardingFeatureList                                     */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_ForwardingFeatureList (OSCTXT* pctxt,  
   ForwardingFeatureList *pvalue, ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
   ForwardingFeature* pdata1; 
   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)) 
   { 
      if (pvalue->count >= 13) return LOG_RTERR (pctxt, RTERR_SEQOVFLW); 
 
      rtxDListAllocNodeAndData (pctxt, ForwardingFeature, &pnode, &pdata1); 
 
      if (pnode == NULL) 
         return LOG_RTERR (pctxt, RTERR_NOMEM); 
 
      stat = asn1D_ForwardingFeature (pctxt,  
         pdata1, ASN1EXPL, length); 
      if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
      rtxDListAppendNode (pvalue, pnode); 
   } 
 
   if (!((pvalue->count >= 1 && pvalue->count <= 13))) { 
      rtxErrAddStrParm (pctxt, "ForwardingFeatureList.count"); 
      rtxErrAddIntParm (pctxt, (int)pvalue->count); 
      return LOG_RTERR (pctxt, RTERR_CONSVIO); 
   } 
 
   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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  ForwardingInfo                                            */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_ForwardingInfo (OSCTXT* pctxt, ForwardingInfo *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 ss_Code */ 
         stat = asn1D_SS_Code (pctxt,  
            &pvalue->ss_Code, ASN1EXPL, length); 
         if (stat == 0) { 
            pvalue->m.ss_CodePresent = TRUE; 
         } 
         else if (stat == RTERR_IDNOTFOU) { 
            stat = rtxErrReset (pctxt); 
         } 
         break; 
 
      case 1: 
         /* decode forwardingFeatureList */ 
         stat = asn1D_ForwardingFeatureList (pctxt,  
            &pvalue->forwardingFeatureList, ASN1EXPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         reqcnt++; 
         break; 
 
      case 2: 
         /* decode extElem1 */ 
         { ASN1TAG tag; 
         int len; 
         stat = xd_tag_len (pctxt, &tag, &len, 0); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
         switch (tag) { 
         case (TM_UNIV|TM_PRIM|4): 
         case (TM_UNIV|TM_CONS|4): 
         case (TM_UNIV|TM_CONS|16): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  CallBarringFeature                                        */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_CallBarringFeature (OSCTXT* pctxt,  
   CallBarringFeature *pvalue, ASN1TagType tagging, int length) 
{ 
   int stat = 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 basicService */ 
         stat = asn1D_BasicServiceCode (pctxt,  
            &pvalue->basicService, ASN1EXPL, length); 
         if (stat == 0) { 
            pvalue->m.basicServicePresent = TRUE; 
         } 
         else if (stat == RTERR_INVOPT) { 
            OSRTBUFRESTORE (pctxt); 
            stat = rtxErrReset (pctxt); 
         } 
         else if (stat == RTERR_IDNOTFOU || stat == RTERR_ENDOFBUF) { 
            stat = rtxErrReset (pctxt); 
         } 
         break; 
 
      case 1: 
         /* decode ss_Status */ 
         if (XD_PEEKTAG (pctxt, 0x84)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_SS_Status (pctxt,  
               &pvalue->ss_Status, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.ss_StatusPresent = TRUE; 
            } 
         } 
         break; 
 
      case 2: 
         /* decode extElem1 */ 
         { 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|2): 
         case (TM_CTXT|TM_PRIM|3): 
         case (TM_CTXT|TM_PRIM|4): 
         case (TM_CTXT|TM_CONS|4): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      if (stat != 0) return LOG_RTERR (pctxt, stat); 
      else ccb.seqx++; 
   } 
 
   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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  CallBarringFeatureList                                    */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_CallBarringFeatureList (OSCTXT* pctxt,  
   CallBarringFeatureList *pvalue, ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
   CallBarringFeature* pdata1; 
   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)) 
   { 
      if (pvalue->count >= 13) return LOG_RTERR (pctxt, RTERR_SEQOVFLW); 
 
      rtxDListAllocNodeAndData (pctxt, CallBarringFeature, &pnode, &pdata1); 
 
      if (pnode == NULL) 
         return LOG_RTERR (pctxt, RTERR_NOMEM); 
 
      stat = asn1D_CallBarringFeature (pctxt,  
         pdata1, ASN1EXPL, length); 
      if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
      rtxDListAppendNode (pvalue, pnode); 
   } 
 
   if (!((pvalue->count >= 1 && pvalue->count <= 13))) { 
      rtxErrAddStrParm (pctxt, "CallBarringFeatureList.count"); 
      rtxErrAddIntParm (pctxt, (int)pvalue->count); 
      return LOG_RTERR (pctxt, RTERR_CONSVIO); 
   } 
 
   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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  CallBarringInfo                                           */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_CallBarringInfo (OSCTXT* pctxt, CallBarringInfo *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 ss_Code */ 
         stat = asn1D_SS_Code (pctxt,  
            &pvalue->ss_Code, ASN1EXPL, length); 
         if (stat == 0) { 
            pvalue->m.ss_CodePresent = TRUE; 
         } 
         else if (stat == RTERR_IDNOTFOU) { 
            stat = rtxErrReset (pctxt); 
         } 
         break; 
 
      case 1: 
         /* decode callBarringFeatureList */ 
         stat = asn1D_CallBarringFeatureList (pctxt,  
            &pvalue->callBarringFeatureList, ASN1EXPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         reqcnt++; 
         break; 
 
      case 2: 
         /* decode extElem1 */ 
         { ASN1TAG tag; 
         int len; 
         stat = xd_tag_len (pctxt, &tag, &len, 0); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
         switch (tag) { 
         case (TM_UNIV|TM_PRIM|4): 
         case (TM_UNIV|TM_CONS|4): 
         case (TM_UNIV|TM_CONS|16): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  BasicServiceGroupList                                     */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_BasicServiceGroupList (OSCTXT* pctxt,  
   BasicServiceGroupList *pvalue, ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
   BasicServiceCode* pdata1; 
   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)) 
   { 
      if (pvalue->count >= 13) return LOG_RTERR (pctxt, RTERR_SEQOVFLW); 
 
      rtxDListAllocNodeAndData (pctxt, BasicServiceCode, &pnode, &pdata1); 
 
      if (pnode == NULL) 
         return LOG_RTERR (pctxt, RTERR_NOMEM); 
 
      stat = asn1D_BasicServiceCode (pctxt,  
         pdata1, ASN1EXPL, length); 
      if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
      rtxDListAppendNode (pvalue, pnode); 
   } 
 
   if (!((pvalue->count >= 1 && pvalue->count <= 13))) { 
      rtxErrAddStrParm (pctxt, "BasicServiceGroupList.count"); 
      rtxErrAddIntParm (pctxt, (int)pvalue->count); 
      return LOG_RTERR (pctxt, RTERR_CONSVIO); 
   } 
 
   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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  SS_Data                                                   */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_SS_Data (OSCTXT* pctxt, SS_Data *pvalue, ASN1TagType tagging,  
   int length) 
{ 
   int stat = 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 ss_Code */ 
         stat = asn1D_SS_Code (pctxt,  
            &pvalue->ss_Code, ASN1EXPL, length); 
         if (stat == 0) { 
            pvalue->m.ss_CodePresent = TRUE; 
         } 
         else if (stat == RTERR_IDNOTFOU) { 
            stat = rtxErrReset (pctxt); 
         } 
         break; 
 
      case 1: 
         /* decode ss_Status */ 
         if (XD_PEEKTAG (pctxt, 0x84)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_SS_Status (pctxt,  
               &pvalue->ss_Status, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.ss_StatusPresent = TRUE; 
            } 
         } 
         break; 
 
      case 2: 
         /* decode ss_SubscriptionOption */ 
         stat = asn1D_SS_SubscriptionOption (pctxt,  
            &pvalue->ss_SubscriptionOption, ASN1EXPL, length); 
         if (stat == 0) { 
            pvalue->m.ss_SubscriptionOptionPresent = TRUE; 
         } 
         else if (stat == RTERR_INVOPT) { 
            OSRTBUFRESTORE (pctxt); 
            stat = rtxErrReset (pctxt); 
         } 
         else if (stat == RTERR_IDNOTFOU || stat == RTERR_ENDOFBUF) { 
            stat = rtxErrReset (pctxt); 
         } 
         break; 
 
      case 3: 
         /* decode basicServiceGroupList */ 
         stat = asn1D_BasicServiceGroupList (pctxt,  
            &pvalue->basicServiceGroupList, ASN1EXPL, length); 
         if (stat == 0) { 
            pvalue->m.basicServiceGroupListPresent = TRUE; 
         } 
         else if (stat == RTERR_IDNOTFOU) { 
            stat = rtxErrReset (pctxt); 
         } 
         break; 
 
      case 4: 
         /* decode defaultPriority */ 
         stat = asn1D_EMLPP_Priority (pctxt,  
            &pvalue->defaultPriority, ASN1EXPL, length); 
         if (stat == 0) { 
            pvalue->m.defaultPriorityPresent = TRUE; 
         } 
         else if (stat == RTERR_IDNOTFOU) { 
            stat = rtxErrReset (pctxt); 
         } 
         break; 
 
      case 5: 
         /* decode nbrUser */ 
         if (XD_PEEKTAG (pctxt, 0x85)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_MC_Bearers (pctxt,  
               &pvalue->nbrUser, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.nbrUserPresent = TRUE; 
            } 
         } 
         break; 
 
      case 6: 
         /* decode extElem1 */ 
         { ASN1TAG tag; 
         int len; 
         stat = xd_tag_len (pctxt, &tag, &len, 0); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
         switch (tag) { 
         case (TM_UNIV|TM_PRIM|4): 
         case (TM_UNIV|TM_CONS|4): 
         case (TM_CTXT|TM_PRIM|4): 
         case (TM_CTXT|TM_CONS|4): 
         case (TM_CTXT|TM_PRIM|1): 
         case (TM_CTXT|TM_PRIM|2): 
         case (TM_UNIV|TM_CONS|16): 
         case (TM_UNIV|TM_PRIM|2): 
         case (TM_CTXT|TM_PRIM|5): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      if (stat != 0) return LOG_RTERR (pctxt, stat); 
      else ccb.seqx++; 
   } 
 
   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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  SS_Info                                                   */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_SS_Info (OSCTXT* pctxt, SS_Info *pvalue, ASN1TagType tagging,  
   int length) 
{ 
   int stat = 0; 
   ASN1TAG ctag; 
   ASN1CCB ccb; 
 
   /* decode CHOICE */ 
 
   stat = xd_tag_len (pctxt, &ctag, &length, XM_ADVANCE); 
   if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
   ccb.len = length; 
   ccb.ptr = OSRTBUFPTR(pctxt); 
 
   switch (ctag) 
   { 
      case (TM_CTXT|TM_CONS|0): 
         pvalue->u.forwardingInfo = rtxMemAllocTypeZ (pctxt, ForwardingInfo); 
 
         if (pvalue->u.forwardingInfo == NULL) 
            return LOG_RTERR (pctxt, RTERR_NOMEM); 
 
         stat = asn1D_ForwardingInfo (pctxt,  
            pvalue->u.forwardingInfo, ASN1IMPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         pvalue->t = 1; 
         break; 
 
      case (TM_CTXT|TM_CONS|1): 
         pvalue->u.callBarringInfo = rtxMemAllocTypeZ (pctxt,  
            CallBarringInfo); 
 
         if (pvalue->u.callBarringInfo == NULL) 
            return LOG_RTERR (pctxt, RTERR_NOMEM); 
 
         stat = asn1D_CallBarringInfo (pctxt,  
            pvalue->u.callBarringInfo, ASN1IMPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         pvalue->t = 2; 
         break; 
 
      case (TM_CTXT|TM_CONS|3): 
         pvalue->u.ss_Data = rtxMemAllocTypeZ (pctxt, SS_Data); 
 
         if (pvalue->u.ss_Data == NULL) 
            return LOG_RTERR (pctxt, RTERR_NOMEM); 
 
         stat = asn1D_SS_Data (pctxt,  
            pvalue->u.ss_Data, ASN1IMPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         pvalue->t = 3; 
         break; 
 
      default: 
         berErrAddTagParm (pctxt, ctag); 
         return LOG_RTERR (pctxt, RTERR_INVOPT); 
   } 
 
   if (ccb.len == ASN_K_INDEFLEN) { 
      if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); 
      else return LOG_RTERR (pctxt, ASN_E_INVLEN); 
   } 
 
   return (stat); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  CCBS_FeatureList                                          */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_CCBS_FeatureList (OSCTXT* pctxt, CCBS_FeatureList *pvalue,  
   ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
   CCBS_Feature* pdata1; 
   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)) 
   { 
      if (pvalue->count >= 5) return LOG_RTERR (pctxt, RTERR_SEQOVFLW); 
 
      rtxDListAllocNodeAndData (pctxt, CCBS_Feature, &pnode, &pdata1); 
 
      if (pnode == NULL) 
         return LOG_RTERR (pctxt, RTERR_NOMEM); 
 
      stat = asn1D_CCBS_Feature (pctxt,  
         pdata1, ASN1EXPL, length); 
      if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
      rtxDListAppendNode (pvalue, pnode); 
   } 
 
   if (!((pvalue->count >= 1 && pvalue->count <= 5))) { 
      rtxErrAddStrParm (pctxt, "CCBS_FeatureList.count"); 
      rtxErrAddIntParm (pctxt, (int)pvalue->count); 
      return LOG_RTERR (pctxt, RTERR_CONSVIO); 
   } 
 
   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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  GenericServiceInfo                                        */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_GenericServiceInfo (OSCTXT* pctxt,  
   GenericServiceInfo *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 ss_Status */ 
         stat = asn1D_SS_Status (pctxt,  
            &pvalue->ss_Status, ASN1EXPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         reqcnt++; 
         break; 
 
      case 1: 
         /* decode cliRestrictionOption */ 
         stat = asn1D_CliRestrictionOption (pctxt,  
            &pvalue->cliRestrictionOption, ASN1EXPL, length); 
         if (stat == 0) { 
            if(pvalue->cliRestrictionOption < 0 || pvalue->cliRestrictionOption > 2) 
               return LOG_RTERR (pctxt, RTERR_INVENUM); 
 
            pvalue->m.cliRestrictionOptionPresent = TRUE; 
         } 
         else if (stat == RTERR_IDNOTFOU) { 
            stat = rtxErrReset (pctxt); 
         } 
         break; 
 
      case 2: 
         /* decode maximumEntitledPriority */ 
         if (XD_PEEKTAG (pctxt, 0x80)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_EMLPP_Priority (pctxt,  
               &pvalue->maximumEntitledPriority, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.maximumEntitledPriorityPresent = TRUE; 
            } 
         } 
         break; 
 
      case 3: 
         /* decode defaultPriority */ 
         if (XD_PEEKTAG (pctxt, 0x81)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_EMLPP_Priority (pctxt,  
               &pvalue->defaultPriority, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.defaultPriorityPresent = TRUE; 
            } 
         } 
         break; 
 
      case 4: 
         /* decode ccbs_FeatureList */ 
         if (XD_PEEKTAG (pctxt, 0x82)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_CCBS_FeatureList (pctxt,  
               &pvalue->ccbs_FeatureList, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.ccbs_FeatureListPresent = 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 nbrSB */ 
         if (XD_PEEKTAG (pctxt, 0x83)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_MaxMC_Bearers (pctxt,  
               &pvalue->nbrSB, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.nbrSBPresent = TRUE; 
            } 
         } 
         break; 
 
      case 6: 
         /* decode nbrUser */ 
         if (XD_PEEKTAG (pctxt, 0x84)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_MC_Bearers (pctxt,  
               &pvalue->nbrUser, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.nbrUserPresent = TRUE; 
            } 
         } 
         break; 
 
      case 7: 
         /* decode nbrSN */ 
         if (XD_PEEKTAG (pctxt, 0x85)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_MC_Bearers (pctxt,  
               &pvalue->nbrSN, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.nbrSNPresent = TRUE; 
            } 
         } 
         break; 
 
      case 8: 
         /* decode extElem1 */ 
         { ASN1TAG tag; 
         int len; 
         stat = xd_tag_len (pctxt, &tag, &len, 0); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
         switch (tag) { 
         case (TM_UNIV|TM_PRIM|4): 
         case (TM_UNIV|TM_CONS|4): 
         case (TM_UNIV|TM_PRIM|10): 
         case (TM_CTXT|TM_PRIM|0): 
         case (TM_CTXT|TM_PRIM|1): 
         case (TM_CTXT|TM_CONS|2): 
         case (TM_CTXT|TM_PRIM|3): 
         case (TM_CTXT|TM_PRIM|4): 
         case (TM_CTXT|TM_PRIM|5): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  InterrogateSS_Res                                         */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_InterrogateSS_Res (OSCTXT* pctxt, InterrogateSS_Res *pvalue,  
   ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
   ASN1TAG ctag; 
   ASN1CCB ccb; 
 
   /* decode CHOICE */ 
 
   stat = xd_tag_len (pctxt, &ctag, &length, XM_ADVANCE); 
   if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
   ccb.len = length; 
   ccb.ptr = OSRTBUFPTR(pctxt); 
 
   switch (ctag) 
   { 
      case (TM_CTXT|TM_PRIM|0): 
      case (TM_CTXT|TM_CONS|0): 
         pvalue->u.ss_Status = rtxMemAllocTypeZ (pctxt, SS_Status); 
 
         if (pvalue->u.ss_Status == NULL) 
            return LOG_RTERR (pctxt, RTERR_NOMEM); 
 
         stat = asn1D_SS_Status (pctxt,  
            pvalue->u.ss_Status, ASN1IMPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         pvalue->t = 1; 
         ccb.len = 0; 
         break; 
 
      case (TM_CTXT|TM_CONS|2): 
         pvalue->u.basicServiceGroupList = rtxMemAllocTypeZ (pctxt,  
            BasicServiceGroupList); 
 
         if (pvalue->u.basicServiceGroupList == NULL) 
            return LOG_RTERR (pctxt, RTERR_NOMEM); 
 
         stat = asn1D_BasicServiceGroupList (pctxt,  
            pvalue->u.basicServiceGroupList, ASN1IMPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         pvalue->t = 2; 
         break; 
 
      case (TM_CTXT|TM_CONS|3): 
         pvalue->u.forwardingFeatureList = rtxMemAllocTypeZ (pctxt,  
            ForwardingFeatureList); 
 
         if (pvalue->u.forwardingFeatureList == NULL) 
            return LOG_RTERR (pctxt, RTERR_NOMEM); 
 
         stat = asn1D_ForwardingFeatureList (pctxt,  
            pvalue->u.forwardingFeatureList, ASN1IMPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         pvalue->t = 3; 
         break; 
 
      case (TM_CTXT|TM_CONS|4): 
         pvalue->u.genericServiceInfo = rtxMemAllocTypeZ (pctxt,  
            GenericServiceInfo); 
 
         if (pvalue->u.genericServiceInfo == NULL) 
            return LOG_RTERR (pctxt, RTERR_NOMEM); 
 
         stat = asn1D_GenericServiceInfo (pctxt,  
            pvalue->u.genericServiceInfo, ASN1IMPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         pvalue->t = 4; 
         break; 
 
      default: 
         berErrAddTagParm (pctxt, ctag); 
         return LOG_RTERR (pctxt, RTERR_INVOPT); 
   } 
 
   if (ccb.len == ASN_K_INDEFLEN) { 
      if (XD_MATCHEOC (pctxt)) XD_BUMPIDX (pctxt, 2); 
      else return LOG_RTERR (pctxt, ASN_E_INVLEN); 
   } 
 
   return (stat); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  USSD_Arg                                                  */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_USSD_Arg (OSCTXT* pctxt, USSD_Arg *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 ussd_DataCodingScheme */ 
         stat = asn1D_USSD_DataCodingScheme (pctxt,  
            &pvalue->ussd_DataCodingScheme, ASN1EXPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         reqcnt++; 
         break; 
 
      case 1: 
         /* decode ussd_String */ 
         stat = asn1D_USSD_String (pctxt,  
            &pvalue->ussd_String, ASN1EXPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         reqcnt++; 
         break; 
 
      case 2: 
         /* decode alertingPattern */ 
         stat = asn1D_AlertingPattern (pctxt,  
            &pvalue->alertingPattern, ASN1EXPL, length); 
         if (stat == 0) { 
            pvalue->m.alertingPatternPresent = TRUE; 
         } 
         else if (stat == RTERR_IDNOTFOU) { 
            stat = rtxErrReset (pctxt); 
         } 
         break; 
 
      case 3: 
         /* decode msisdn */ 
         if (XD_PEEKTAG (pctxt, 0x80)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_ISDN_AddressString (pctxt,  
               &pvalue->msisdn, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.msisdnPresent = TRUE; 
            } 
         } 
         break; 
 
      case 4: 
         /* decode extElem1 */ 
         { ASN1TAG tag; 
         int len; 
         stat = xd_tag_len (pctxt, &tag, &len, 0); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
         switch (tag) { 
         case (TM_UNIV|TM_PRIM|4): 
         case (TM_UNIV|TM_CONS|4): 
         case (TM_CTXT|TM_PRIM|0): 
         case (TM_CTXT|TM_CONS|0): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  USSD_Res                                                  */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_USSD_Res (OSCTXT* pctxt, USSD_Res *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 ussd_DataCodingScheme */ 
         stat = asn1D_USSD_DataCodingScheme (pctxt,  
            &pvalue->ussd_DataCodingScheme, ASN1EXPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         reqcnt++; 
         break; 
 
      case 1: 
         /* decode ussd_String */ 
         stat = asn1D_USSD_String (pctxt,  
            &pvalue->ussd_String, ASN1EXPL, length); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
         reqcnt++; 
         break; 
 
      case 2: 
         /* decode extElem1 */ 
         { ASN1TAG tag; 
         int len; 
         stat = xd_tag_len (pctxt, &tag, &len, 0); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
         switch (tag) { 
         case (TM_UNIV|TM_PRIM|4): 
         case (TM_UNIV|TM_CONS|4): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  SS_InfoList                                               */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_SS_InfoList (OSCTXT* pctxt, SS_InfoList *pvalue,  
   ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
   SS_Info* pdata1; 
   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)) 
   { 
      if (pvalue->count >= 30) return LOG_RTERR (pctxt, RTERR_SEQOVFLW); 
 
      rtxDListAllocNodeAndData (pctxt, SS_Info, &pnode, &pdata1); 
 
      if (pnode == NULL) 
         return LOG_RTERR (pctxt, RTERR_NOMEM); 
 
      stat = asn1D_SS_Info (pctxt,  
         pdata1, ASN1EXPL, length); 
      if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
      rtxDListAppendNode (pvalue, pnode); 
   } 
 
   if (!((pvalue->count >= 1 && pvalue->count <= 30))) { 
      rtxErrAddStrParm (pctxt, "SS_InfoList.count"); 
      rtxErrAddIntParm (pctxt, (int)pvalue->count); 
      return LOG_RTERR (pctxt, RTERR_CONSVIO); 
   } 
 
   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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  SS_EventSpecification                                     */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_SS_EventSpecification (OSCTXT* pctxt,  
   SS_EventSpecification *pvalue, ASN1TagType tagging, int length) 
{ 
   int stat = 0; 
   int xx1; 
   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 */ 
 
   xx1 = 0; 
   ccb.len = length; 
   ccb.ptr = OSRTBUFPTR(pctxt); 
 
   while (!XD_CHKEND (pctxt, &ccb)) 
   { 
      if (xx1 >= 2) return LOG_RTERR (pctxt, RTERR_SEQOVFLW); 
 
      stat = asn1D_AddressString (pctxt,  
         &pvalue->elem[xx1], ASN1EXPL, length); 
      if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
      xx1++; 
   } 
   pvalue->n = xx1; 
 
   if (!((pvalue->n >= 1 && pvalue->n <= 2))) { 
      rtxErrAddStrParm (pctxt, "SS_EventSpecification.n"); 
      rtxErrAddIntParm (pctxt, (int)pvalue->n); 
      return LOG_RTERR (pctxt, RTERR_CONSVIO); 
   } 
 
   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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  SS_InvocationNotificationArg                              */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_SS_InvocationNotificationArg (OSCTXT* pctxt,  
   SS_InvocationNotificationArg *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 imsi */ 
         if (XD_PEEKTAG (pctxt, 0x80)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_IMSI (pctxt,  
               &pvalue->imsi, ASN1IMPL, length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            reqcnt++; 
         } 
         break; 
 
      case 1: 
         /* decode msisdn */ 
         if (XD_PEEKTAG (pctxt, 0x81)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_ISDN_AddressString (pctxt,  
               &pvalue->msisdn, ASN1IMPL, length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            reqcnt++; 
         } 
         break; 
 
      case 2: 
         /* decode ss_Event */ 
         if (XD_PEEKTAG (pctxt, 0x82)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_SS_Code (pctxt,  
               &pvalue->ss_Event, ASN1IMPL, length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            reqcnt++; 
         } 
         break; 
 
      case 3: 
         /* decode ss_EventSpecification */ 
         if (XD_PEEKTAG (pctxt, 0x83)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_SS_EventSpecification (pctxt,  
               &pvalue->ss_EventSpecification, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.ss_EventSpecificationPresent = 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 extensionContainer */ 
         if (XD_PEEKTAG (pctxt, 0x84)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_ExtensionContainer (pctxt,  
               &pvalue->extensionContainer, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.extensionContainerPresent = 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 b_subscriberNumber */ 
         if (XD_PEEKTAG (pctxt, 0x85)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_ISDN_AddressString (pctxt,  
               &pvalue->b_subscriberNumber, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.b_subscriberNumberPresent = TRUE; 
            } 
         } 
         break; 
 
      case 6: 
         /* decode ccbs_RequestState */ 
         if (XD_PEEKTAG (pctxt, 0x86)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_CCBS_RequestState (pctxt,  
               &pvalue->ccbs_RequestState, ASN1IMPL, length); 
            if (stat == 0) { 
               if(pvalue->ccbs_RequestState < 0 || pvalue->ccbs_RequestState > 6) 
                  return LOG_RTERR (pctxt, RTERR_INVENUM); 
 
               pvalue->m.ccbs_RequestStatePresent = TRUE; 
            } 
         } 
         break; 
 
      case 7: 
         /* decode extElem1 */ 
         { 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_CONS|3): 
         case (TM_CTXT|TM_CONS|4): 
         case (TM_CTXT|TM_PRIM|5): 
         case (TM_CTXT|TM_CONS|5): 
         case (TM_CTXT|TM_PRIM|6): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  SS_InvocationNotificationRes                              */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_SS_InvocationNotificationRes (OSCTXT* pctxt,  
   SS_InvocationNotificationRes *pvalue, ASN1TagType tagging, int length) 
{ 
   int stat = 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 extensionContainer */ 
         stat = asn1D_ExtensionContainer (pctxt,  
            &pvalue->extensionContainer, ASN1EXPL, length); 
         if (stat == 0) { 
            pvalue->m.extensionContainerPresent = TRUE; 
         } 
         else if (stat == RTERR_IDNOTFOU) { 
            stat = rtxErrReset (pctxt); 
         } 
         break; 
 
      case 1: 
         /* decode extElem1 */ 
         { ASN1TAG tag; 
         int len; 
         stat = xd_tag_len (pctxt, &tag, &len, 0); 
         if (stat != 0) return LOG_RTERR (pctxt, stat); 
         switch (tag) { 
         case (TM_UNIV|TM_CONS|16): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      if (stat != 0) return LOG_RTERR (pctxt, stat); 
      else ccb.seqx++; 
   } 
 
   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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  CCBS_Data                                                 */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_CCBS_Data (OSCTXT* pctxt, CCBS_Data *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 ccbs_Feature */ 
         if (XD_PEEKTAG (pctxt, 0x80)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_CCBS_Feature (pctxt,  
               &pvalue->ccbs_Feature, 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 translatedB_Number */ 
         if (XD_PEEKTAG (pctxt, 0x81)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_ISDN_AddressString (pctxt,  
               &pvalue->translatedB_Number, ASN1IMPL, length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            reqcnt++; 
         } 
         break; 
 
      case 2: 
         /* decode serviceIndicator */ 
         if (XD_PEEKTAG (pctxt, 0x82)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_ServiceIndicator (pctxt,  
               &pvalue->serviceIndicator, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.serviceIndicatorPresent = TRUE; 
            } 
         } 
         break; 
 
      case 3: 
         /* decode callInfo */ 
         if (XD_PEEKTAG (pctxt, 0x83)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_ExternalSignalInfo (pctxt,  
               &pvalue->callInfo, 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 networkSignalInfo */ 
         if (XD_PEEKTAG (pctxt, 0x84)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_ExternalSignalInfo (pctxt,  
               &pvalue->networkSignalInfo, 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 extElem1 */ 
         { 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_PRIM|1): 
         case (TM_CTXT|TM_CONS|1): 
         case (TM_CTXT|TM_PRIM|2): 
         case (TM_CTXT|TM_CONS|2): 
         case (TM_CTXT|TM_CONS|3): 
         case (TM_CTXT|TM_CONS|4): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  RegisterCC_EntryArg                                       */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_RegisterCC_EntryArg (OSCTXT* pctxt,  
   RegisterCC_EntryArg *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 ss_Code */ 
         if (XD_PEEKTAG (pctxt, 0x80)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_SS_Code (pctxt,  
               &pvalue->ss_Code, ASN1IMPL, length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            reqcnt++; 
         } 
         break; 
 
      case 1: 
         /* decode ccbs_Data */ 
         if (XD_PEEKTAG (pctxt, 0x81)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_CCBS_Data (pctxt,  
               &pvalue->ccbs_Data, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.ccbs_DataPresent = 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 extElem1 */ 
         { 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_CONS|1): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  RegisterCC_EntryRes                                       */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_RegisterCC_EntryRes (OSCTXT* pctxt,  
   RegisterCC_EntryRes *pvalue, ASN1TagType tagging, int length) 
{ 
   int stat = 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 ccbs_Feature */ 
         if (XD_PEEKTAG (pctxt, 0x80)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_CCBS_Feature (pctxt,  
               &pvalue->ccbs_Feature, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.ccbs_FeaturePresent = 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 extElem1 */ 
         { 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): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      if (stat != 0) return LOG_RTERR (pctxt, stat); 
      else ccb.seqx++; 
   } 
 
   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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  EraseCC_EntryArg                                          */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_EraseCC_EntryArg (OSCTXT* pctxt, EraseCC_EntryArg *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 ss_Code */ 
         if (XD_PEEKTAG (pctxt, 0x80)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_SS_Code (pctxt,  
               &pvalue->ss_Code, ASN1IMPL, length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            reqcnt++; 
         } 
         break; 
 
      case 1: 
         /* decode ccbs_Index */ 
         if (XD_PEEKTAG (pctxt, 0x81)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_CCBS_Index (pctxt,  
               &pvalue->ccbs_Index, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.ccbs_IndexPresent = TRUE; 
            } 
         } 
         break; 
 
      case 2: 
         /* decode extElem1 */ 
         { 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): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      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); 
} 
 
/**************************************************************/ 
/*                                                            */ 
/*  EraseCC_EntryRes                                          */ 
/*                                                            */ 
/**************************************************************/ 
 
EXTERN int asn1D_EraseCC_EntryRes (OSCTXT* pctxt, EraseCC_EntryRes *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 ss_Code */ 
         if (XD_PEEKTAG (pctxt, 0x80)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_SS_Code (pctxt,  
               &pvalue->ss_Code, ASN1IMPL, length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            reqcnt++; 
         } 
         break; 
 
      case 1: 
         /* decode ss_Status */ 
         if (XD_PEEKTAG (pctxt, 0x81)) { 
            stat = xd_Tag1AndLen (pctxt, &length); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            stat = asn1D_SS_Status (pctxt,  
               &pvalue->ss_Status, ASN1IMPL, length); 
            if (stat == 0) { 
               pvalue->m.ss_StatusPresent = TRUE; 
            } 
         } 
         break; 
 
      case 2: 
         /* decode extElem1 */ 
         { 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): 
            stat = RTERR_SEQORDER; 
            break; 
         default: 
            stat = xd_OpenTypeExt (pctxt, &ccb, ASN_K_NOTAG, 0); 
            if (stat != 0) return LOG_RTERR (pctxt, stat); 
 
            break; 
         }} 
         break; 
 
      default: 
         stat = RTERR_SEQOVFLW; 
      } 
 
      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); 
}