/*---------------------------------------------------------------------------* * Q.921 timer T200 timeout function *---------------------------------------------------------------------------*/ static void i4b_T200_timeout(l2_softc_t *l2sc) { NDBGL2(L2_T_ERR, "bri %d, RC = %d", l2sc->drv->bri, l2sc->RC); i4b_next_l2state(l2sc, l2sc->drv, EV_T200EXP); }
/*---------------------------------------------------------------------------* * process a received U-frame *---------------------------------------------------------------------------*/ void i4b_rxd_u_frame(int unit, struct mbuf *m) { l2_softc_t *l2sc = &l2_softc[unit]; u_char *ptr = m->m_data; int sapi = GETSAPI(*(ptr + OFF_SAPI)); int tei = GETTEI(*(ptr + OFF_TEI)); int pfbit = GETUPF(*(ptr + OFF_CNTL)); switch(*(ptr + OFF_CNTL) & ~UPFBIT) { /* commands */ case SABME: if((l2sc->tei_valid == TEI_VALID) && (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) { l2sc->stat.rx_sabme++; NDBGL2(L2_U_MSG, "SABME, sapi = %d, tei = %d", sapi, tei); l2sc->rxd_PF = pfbit; i4b_next_l2state(l2sc, EV_RXSABME); } i4b_Dfreembuf(m); break; case UI: if(sapi == SAPI_L2M && tei == GROUP_TEI && *(ptr + OFF_MEI) == MEI) { /* layer 2 management (SAPI = 63) */ l2sc->stat.rx_tei++; i4b_tei_rxframe(unit, m); } else if(sapi == SAPI_CCP && tei == GROUP_TEI) { /* call control (SAPI = 0) */ l2sc->stat.rx_ui++; /* strip ui header */ m_adj(m, UI_HDR_LEN); /* to upper layer */ DL_Unit_Data_Ind(unit, m); } else { l2sc->stat.err_rx_badui++; NDBGL2(L2_U_ERR, "unknown UI frame!"); i4b_Dfreembuf(m); } break; case DISC: if((l2sc->tei_valid == TEI_VALID) && (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) { l2sc->stat.rx_disc++; NDBGL2(L2_U_MSG, "DISC, sapi = %d, tei = %d", sapi, tei); l2sc->rxd_PF = pfbit; i4b_next_l2state(l2sc, EV_RXDISC); } i4b_Dfreembuf(m); break; case XID: if((l2sc->tei_valid == TEI_VALID) && (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) { l2sc->stat.rx_xid++; NDBGL2(L2_U_MSG, "XID, sapi = %d, tei = %d", sapi, tei); } i4b_Dfreembuf(m); break; /* responses */ case DM: if((l2sc->tei_valid == TEI_VALID) && (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) { l2sc->stat.rx_dm++; NDBGL2(L2_U_MSG, "DM, sapi = %d, tei = %d", sapi, tei); i4b_print_frame(m->m_len, m->m_data); l2sc->rxd_PF = pfbit; i4b_next_l2state(l2sc, EV_RXDM); } i4b_Dfreembuf(m); break; case UA: if((l2sc->tei_valid == TEI_VALID) && (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) { l2sc->stat.rx_ua++; NDBGL2(L2_U_MSG, "UA, sapi = %d, tei = %d", sapi, tei); l2sc->rxd_PF = pfbit; i4b_next_l2state(l2sc, EV_RXUA); } i4b_Dfreembuf(m); break; case FRMR: if((l2sc->tei_valid == TEI_VALID) && (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) { l2sc->stat.rx_frmr++; NDBGL2(L2_U_MSG, "FRMR, sapi = %d, tei = %d", sapi, tei); l2sc->rxd_PF = pfbit; i4b_next_l2state(l2sc, EV_RXFRMR); } i4b_Dfreembuf(m); break; default: if((l2sc->tei_valid == TEI_VALID) && (l2sc->tei == GETTEI(*(ptr+OFF_TEI)))) { NDBGL2(L2_U_ERR, "UNKNOWN TYPE ERROR, sapi = %d, tei = %d, frame = ", sapi, tei); i4b_print_frame(m->m_len, m->m_data); } else { NDBGL2(L2_U_ERR, "not mine - UNKNOWN TYPE ERROR, sapi = %d, tei = %d, frame = ", sapi, tei); i4b_print_frame(m->m_len, m->m_data); } l2sc->stat.err_rx_badui++; i4b_Dfreembuf(m); break; } }
static void i4b_T203_timeout(l2_softc_t *l2sc) { NDBGL2(L2_T_ERR, "bri %d", l2sc->bri); i4b_next_l2state(l2sc, EV_T203EXP); }