#if HISAX_DE_AOC 
#ifdef HISAX_DE_AOC 
l3dss1_parse_facility(struct PStack *st, struct l3_process *pc,                      int cr, u_char * p){	int qd_len = 0;	unsigned char nlen = 0, ilen, cp_tag;	int ident, id;	ulong err_ret;	if (pc) 		st = pc->st; /* valid Stack */	else		if ((!st) || (cr >= 0)) return; /* neither pc nor st specified */	p++;	qd_len = *p++;	if (qd_len == 0) {		l3_debug(st, "qd_len == 0");		return;	}	if ((*p & 0x1F) != 0x11) {	/* Service discriminator, supplementary service */		l3_debug(st, "supplementary service != 0x11");		return;	}	while (qd_len > 0 && !(*p & 0x80)) {	/* extension ? */		p++;		qd_len--;	}	if (qd_len < 2) {		l3_debug(st, "qd_len < 2");		return;	}	p++;	qd_len--;	if ((*p & 0xE0) != 0xA0) {	/* class and form */		l3_debug(st, "class and form != 0xA0");		return;	}               cp_tag = *p & 0x1F; /* remember tag value */        p++;	qd_len--;	if (qd_len < 1)           { l3_debug(st, "qd_len < 1");	    return;	  }	if (*p & 0x80)           { /* length format indefinite or limited */	    nlen = *p++ & 0x7F; /* number of len bytes or indefinite */            if ((qd_len-- < ((!nlen) ? 3 : (1 + nlen))) ||                (nlen > 1))   	     { l3_debug(st, "length format error or not implemented");	       return;             }            if (nlen == 1)	     { nlen = *p++; /* complete length */               qd_len--;             }             else	     { qd_len -= 2; /* trailing null bytes */               if ((*(p+qd_len)) || (*(p+qd_len+1)))		{ l3_debug(st,"length format indefinite error");                  return;                }               nlen = qd_len;             }	  }        else	  { nlen = *p++;	    qd_len--;          } 	if (qd_len < nlen)           { l3_debug(st, "qd_len < nlen");	    return;	  }	qd_len -= nlen;	if (nlen < 2)           { l3_debug(st, "nlen < 2");	    return;	  }        if (*p != 0x02)           {  /* invoke identifier tag */	     l3_debug(st, "invoke identifier tag !=0x02");	     return;	  }	p++;	nlen--;	if (*p & 0x80)           { /* length format */	    l3_debug(st, "invoke id length format 2");	    return;	  }	ilen = *p++;	nlen--;	if (ilen > nlen || ilen == 0)           { l3_debug(st, "ilen > nlen || ilen == 0");	    return;	  }	nlen -= ilen;	id = 0;	while (ilen > 0)           { id = (id << 8) | (*p++ & 0xFF);	/* invoke identifier */	    ilen--;	  }	switch (cp_tag) {	/* component tag */		case 1:	/* invoke */				if (nlen < 2) {					l3_debug(st, "nlen < 2 22");					return;				}				if (*p != 0x02) {	/* operation value */					l3_debug(st, "operation value !=0x02");					return;				}				p++;				nlen--;				ilen = *p++;				nlen--;				if (ilen > nlen || ilen == 0) {					l3_debug(st, "ilen > nlen || ilen == 0 22");					return;				}				nlen -= ilen;				ident = 0;				while (ilen > 0) {					ident = (ident << 8) | (*p++ & 0xFF);					ilen--;				}                                if (!pc) 			         { l3dss1_dummy_invoke(st, cr, id, ident, p, nlen);                                   return;                                 } #if HISAX_DE_AOC			{#define FOO1(s,a,b) \	    while(nlen > 1) {		\		    int ilen = p[1];	\		    if(nlen < ilen+2) {	\			    l3_debug(st, "FOO1  nlen < ilen+2"); \			    return;		\		    }			\		    nlen -= ilen+2;		\		    if((*p & 0xFF) == (a)) {	\			    int nlen = ilen;	\			    p += 2;		\			    b;		\		    } else {		\			    p += ilen+2;	\		    }			\	    }				switch (ident) {					case 0x22:	/* during */						FOO1("1A", 0x30, FOO1("1C", 0xA1, FOO1("1D", 0x30, FOO1("1E", 0x02, ( {							       ident = 0;							nlen = (nlen)?nlen:0; /* Make gcc happy */							while (ilen > 0) {														     ident = (ident << 8) | *p++;								  ilen--;									}														     if (ident > pc->para.chargeinfo) {														     pc->para.chargeinfo = ident;														     st->l3.l3l4(st, CC_CHARGE | INDICATION, pc);									}														     if (st->l3.debug & L3_DEB_CHARGE) {														     if (*(p + 2) == 0) {														     l3_debug(st, "charging info during %d", pc->para.chargeinfo);									}								   else {														     l3_debug(st, "charging info final %d", pc->para.chargeinfo);									}									}									}								    )))))							break;					case 0x24:	/* final */						FOO1("2A", 0x30, FOO1("2B", 0x30, FOO1("2C", 0xA1, FOO1("2D", 0x30, FOO1("2E", 0x02, ( {							       ident = 0;							nlen = (nlen)?nlen:0; /* Make gcc happy */							while (ilen > 0) {																      ident = (ident << 8) | *p++;								  ilen--;									}																      if (ident > pc->para.chargeinfo) {																      pc->para.chargeinfo = ident;																      st->l3.l3l4(st, CC_CHARGE | INDICATION, pc);									}																      if (st->l3.debug & L3_DEB_CHARGE) {																      l3_debug(st, "charging info final %d", pc->para.chargeinfo);									}									}								   ))))))							break;					default:                                                       l3_debug(st, "invoke break invalid ident %02x",ident);						break;				}#undef FOO1			}#else  /* not HISAX_DE_AOC */                        l3_debug(st, "invoke break");#endif /* not HISAX_DE_AOC */			break;		case 2:	/* return result */			 /* if no process available handle separately */                         if (!pc)			 { if (cr == -1)                              l3dss1_dummy_return_result(st, id, p, nlen);                           return;                          }                           if ((pc->prot.dss1.invoke_id) && (pc->prot.dss1.invoke_id == id))                          { /* Diversion successful */                            free_invoke_id(st,pc->prot.dss1.invoke_id);                            pc->prot.dss1.remote_result = 0; /* success */                                 pc->prot.dss1.invoke_id = 0;                            pc->redir_result = pc->prot.dss1.remote_result;                             st->l3.l3l4(st, CC_REDIR | INDICATION, pc);                                  } /* Diversion successful */                        else                          l3_debug(st,"return error unknown identifier");			break;		case 3:	/* return error */                            err_ret = 0;	                    if (nlen < 2)                               { l3_debug(st, "return error nlen < 2");	                        return;	                      }                            if (*p != 0x02)                               { /* result tag */	                        l3_debug(st, "invoke error tag !=0x02");	                        return;	                      }	                    p++;	                    nlen--;	                    if (*p > 4)                               { /* length format */	                        l3_debug(st, "invoke return errlen > 4 ");	                        return;	                      }	                    ilen = *p++;	                    nlen--;	                    if (ilen > nlen || ilen == 0)                               { l3_debug(st, "error return ilen > nlen || ilen == 0");	                        return;	                       }	                    nlen -= ilen;	                    while (ilen > 0)                              { err_ret = (err_ret << 8) | (*p++ & 0xFF);	/* error value */	                       ilen--;	                     }			 /* if no process available handle separately */                         if (!pc)			 { if (cr == -1)                             l3dss1_dummy_error_return(st, id, err_ret);                           return;                          }                           if ((pc->prot.dss1.invoke_id) && (pc->prot.dss1.invoke_id == id))                          { /* Deflection error */                            free_invoke_id(st,pc->prot.dss1.invoke_id);                            pc->prot.dss1.remote_result = err_ret; /* result */                            pc->prot.dss1.invoke_id = 0;                             pc->redir_result = pc->prot.dss1.remote_result;                             st->l3.l3l4(st, CC_REDIR | INDICATION, pc);                            } /* Deflection error */                        else                          l3_debug(st,"return result unknown identifier");			break;		default:			l3_debug(st, "facility default break tag=0x%02x",cp_tag);			break;	}}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/44456d37b59d8e541936ed26d8b6e08d27e88ac1/l3dss1.c/buggy/drivers/isdn/hisax/l3dss1.c