/******************************************************************************* ** ** Function rfc_process_l2cap_congestion ** ** Description This function handles L2CAP congestion messages ** *******************************************************************************/ void rfc_process_l2cap_congestion (tRFC_MCB *p_mcb, BOOLEAN is_congested) { p_mcb->l2cap_congested = is_congested; if (!is_congested) { rfc_check_send_cmd(p_mcb, NULL); } if (!rfc_cb.rfc.peer_rx_disabled) { if (!is_congested) { PORT_FlowInd (p_mcb, 0, TRUE); } else { PORT_FlowInd (p_mcb, 0, FALSE); } } }
/******************************************************************************* ** ** Function rfc_process_fcoff ** ** Description This function handles FCOFF frame. The peer entity is unable ** to receive new information ** *******************************************************************************/ void rfc_process_fcoff (tRFC_MCB *p_mcb, BOOLEAN is_command) { if (is_command) { rfc_cb.rfc.peer_rx_disabled = TRUE; if (!p_mcb->l2cap_congested) { PORT_FlowInd (p_mcb, 0, FALSE); } rfc_send_fcoff (p_mcb, FALSE); } }
/******************************************************************************* ** ** Function rfc_inc_credit ** ** Description The function is called when a credit is received in a UIH ** frame. It increments the TX credit count, and if data ** flow had halted, it restarts it. ** ** Returns void ** *******************************************************************************/ void rfc_inc_credit (tPORT *p_port, UINT8 credit) { if (p_port->rfc.p_mcb->flow == PORT_FC_CREDIT) { p_port->credit_tx += credit; RFCOMM_TRACE_EVENT ("rfc_inc_credit:%d", p_port->credit_tx); if (p_port->tx.peer_fc == TRUE) { PORT_FlowInd(p_port->rfc.p_mcb, p_port->dlci, TRUE); } } }
/******************************************************************************* ** ** Function rfc_process_msc ** ** Description This function handles Modem Status Command. ** Pass command to the user. ** *******************************************************************************/ void rfc_process_msc (tRFC_MCB *p_mcb, BOOLEAN is_command, MX_FRAME *p_frame) { tPORT_CTRL pars; tPORT *p_port; UINT8 modem_signals = p_frame->u.msc.signals; BOOLEAN new_peer_fc = FALSE; p_port = port_find_mcb_dlci_port (p_mcb, p_frame->dlci); if (p_port == NULL) { return; } pars.modem_signal = 0; if (modem_signals & RFCOMM_MSC_RTC) { pars.modem_signal |= MODEM_SIGNAL_DTRDSR; } if (modem_signals & RFCOMM_MSC_RTR) { pars.modem_signal |= MODEM_SIGNAL_RTSCTS; } if (modem_signals & RFCOMM_MSC_IC) { pars.modem_signal |= MODEM_SIGNAL_RI; } if (modem_signals & RFCOMM_MSC_DV) { pars.modem_signal |= MODEM_SIGNAL_DCD; } pars.fc = ((modem_signals & RFCOMM_MSC_FC) == RFCOMM_MSC_FC); pars.break_signal = (p_frame->u.msc.break_present) ? p_frame->u.msc.break_duration : 0; pars.discard_buffers = 0; pars.break_signal_seq = RFCOMM_CTRL_BREAK_IN_SEQ; /* this is default */ /* Check if this command is passed only to indicate flow control */ if (is_command) { rfc_send_msc (p_mcb, p_frame->dlci, FALSE, &pars); if (p_port->rfc.p_mcb->flow != PORT_FC_CREDIT) { /* Spec 1.1 indicates that only FC bit is used for flow control */ p_port->peer_ctrl.fc = new_peer_fc = pars.fc; if (new_peer_fc != p_port->tx.peer_fc) { PORT_FlowInd (p_mcb, p_frame->dlci, (BOOLEAN)!new_peer_fc); } } PORT_ControlInd (p_mcb, p_frame->dlci, &pars); return; } /* If we are not awaiting response just ignore it */ if (!(p_port->rfc.expected_rsp & RFC_RSP_MSC)) { return; } p_port->rfc.expected_rsp &= ~RFC_RSP_MSC; rfc_port_timer_stop (p_port); PORT_ControlCnf (p_port->rfc.p_mcb, p_port->dlci, &pars); }