Lines Matching defs:p_port
38 static void rfc_port_sm_state_closed (tPORT *p_port, UINT16 event, void *p_data);
39 static void rfc_port_sm_sabme_wait_ua (tPORT *p_port, UINT16 event, void *p_data);
40 static void rfc_port_sm_opened (tPORT *p_port, UINT16 event, void *p_data);
41 static void rfc_port_sm_orig_wait_sec_check (tPORT *p_port, UINT16 event, void *p_data);
42 static void rfc_port_sm_term_wait_sec_check (tPORT *p_port, UINT16 event, void *p_data);
43 static void rfc_port_sm_disc_wait_ua (tPORT *p_port, UINT16 event, void *p_data);
45 static void rfc_port_uplink_data (tPORT *p_port, BT_HDR *p_buf);
60 void rfc_port_sm_execute (tPORT *p_port, UINT16 event, void *p_data)
62 if (!p_port)
68 switch (p_port->rfc.state)
71 rfc_port_sm_state_closed (p_port, event, p_data);
75 rfc_port_sm_sabme_wait_ua (p_port, event, p_data);
79 rfc_port_sm_orig_wait_sec_check (p_port, event, p_data);
83 rfc_port_sm_term_wait_sec_check (p_port, event, p_data);
87 rfc_port_sm_opened (p_port, event, p_data);
91 rfc_port_sm_disc_wait_ua (p_port, event, p_data);
108 void rfc_port_sm_state_closed (tPORT *p_port, UINT16 event, void *p_data)
113 p_port->rfc.state = RFC_STATE_ORIG_WAIT_SEC_CHECK;
114 btm_sec_mx_access_request (p_port->rfc.p_mcb->bd_addr, BT_PSM_RFCOMM, TRUE,
115 BTM_SEC_PROTO_RFCOMM, (UINT32)(p_port->dlci / 2),
116 &rfc_sec_check_complete, p_port);
131 rfc_timer_stop(p_port->rfc.p_mcb );
134 p_port->rfc.state = RFC_STATE_TERM_WAIT_SEC_CHECK;
135 btm_sec_mx_access_request (p_port->rfc.p_mcb->bd_addr, BT_PSM_RFCOMM, FALSE,
136 BTM_SEC_PROTO_RFCOMM, (UINT32)(p_port->dlci / 2),
137 &rfc_sec_check_complete, p_port);
144 rfc_port_closed (p_port);
149 rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, FALSE);
153 rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, FALSE);
157 Port_TimeOutCloseMux( p_port->rfc.p_mcb ) ;
158 RFCOMM_TRACE_ERROR2 ("Port error state %d event %d", p_port->rfc.state, event);
176 void rfc_port_sm_sabme_wait_ua (tPORT *p_port, UINT16 event, void *p_data)
182 RFCOMM_TRACE_ERROR2 ("Port error state %d event %d", p_port->rfc.state, event);
186 rfc_port_timer_start (p_port, RFC_DISC_TIMEOUT);
187 rfc_send_disc (p_port->rfc.p_mcb, p_port->dlci);
188 p_port->rfc.expected_rsp = 0;
189 p_port->rfc.state = RFC_STATE_DISC_WAIT_UA;
193 rfc_port_closed (p_port);
201 rfc_port_timer_stop (p_port);
202 p_port->rfc.state = RFC_STATE_OPENED;
203 PORT_DlcEstablishCnf (p_port->rfc.p_mcb, p_port->dlci, p_port->rfc.p_mcb->peer_l2cap_mtu, RFCOMM_SUCCESS);
207 p_port->rfc.p_mcb->is_disc_initiator = TRUE;
208 PORT_DlcEstablishCnf (p_port->rfc.p_mcb, p_port->dlci, p_port->rfc.p_mcb->peer_l2cap_mtu, RFCOMM_ERROR);
209 rfc_port_closed (p_port);
213 rfc_send_ua (p_port->rfc.p_mcb, p_port->dlci);
214 PORT_DlcEstablishCnf (p_port->rfc.p_mcb, p_port->dlci, p_port->rfc.p_mcb->peer_l2cap_mtu, RFCOMM_ERROR);
215 rfc_port_closed (p_port);
220 rfc_send_ua (p_port->rfc.p_mcb, p_port->dlci);
228 p_port->rfc.state = RFC_STATE_CLOSED;
229 PORT_DlcEstablishCnf (p_port->rfc.p_mcb, p_port->dlci, p_port->rfc.p_mcb->peer_l2cap_mtu, RFCOMM_ERROR);
248 void rfc_port_sm_term_wait_sec_check (tPORT *p_port, UINT16 event, void *p_data)
257 if (p_port->rfc.p_mcb)
259 rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, TRUE);
260 p_port->rfc.p_mcb->is_disc_initiator = TRUE;
261 port_rfc_closed (p_port, PORT_SEC_FAILED);
266 PORT_DlcEstablishInd (p_port->rfc.p_mcb, p_port->dlci, p_port->rfc.p_mcb->peer_l2cap_mtu);
272 RFCOMM_TRACE_ERROR2 ("Port error state %d event %d", p_port->rfc.state, event);
276 btm_sec_abort_access_req (p_port->rfc.p_mcb->bd_addr);
277 rfc_port_closed (p_port);
290 btm_sec_abort_access_req (p_port->rfc.p_mcb->bd_addr);
291 p_port->rfc.state = RFC_STATE_CLOSED;
292 rfc_send_ua (p_port->rfc.p_mcb, p_port->dlci);
294 PORT_DlcReleaseInd (p_port->rfc.p_mcb, p_port->dlci);
304 if (p_port->rfc.p_mcb)
305 rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, TRUE);
309 rfc_send_ua (p_port->rfc.p_mcb, p_port->dlci);
310 p_port->rfc.state = RFC_STATE_OPENED;
329 void rfc_port_sm_orig_wait_sec_check (tPORT *p_port, UINT16 event, void *p_data)
336 p_port->rfc.p_mcb->is_disc_initiator = TRUE;
337 PORT_DlcEstablishCnf (p_port->rfc.p_mcb, p_port->dlci, 0, RFCOMM_SECURITY_ERR);
338 rfc_port_closed (p_port);
341 rfc_send_sabme (p_port->rfc.p_mcb, p_port->dlci);
342 rfc_port_timer_start (p_port, RFC_PORT_T1_TIMEOUT);
343 p_port->rfc.state = RFC_STATE_SABME_WAIT_UA;
348 RFCOMM_TRACE_ERROR2 ("Port error state %d event %d", p_port->rfc.state, event);
352 btm_sec_abort_access_req (p_port->rfc.p_mcb->bd_addr);
353 rfc_port_closed (p_port);
379 void rfc_port_sm_opened (tPORT *p_port, UINT16 event, void *p_data)
384 RFCOMM_TRACE_ERROR2 ("Port error state %d event %d", p_port->rfc.state, event);
388 rfc_port_timer_start (p_port, RFC_DISC_TIMEOUT);
389 rfc_send_disc (p_port->rfc.p_mcb, p_port->dlci);
390 p_port->rfc.expected_rsp = 0;
391 p_port->rfc.state = RFC_STATE_DISC_WAIT_UA;
395 rfc_port_closed (p_port);
402 if ((p_port->rfc.p_mcb->flow == PORT_FC_CREDIT)
403 && (((BT_HDR *)p_data)->len < p_port->peer_mtu)
404 && (!p_port->rx.user_fc)
405 && (p_port->credit_rx_max > p_port->credit_rx))
407 ((BT_HDR *)p_data)->layer_specific = (UINT8) (p_port->credit_rx_max - p_port->credit_rx);
408 p_port->credit_rx = p_port->credit_rx_max;
414 rfc_send_buf_uih (p_port->rfc.p_mcb, p_port->dlci, (BT_HDR *)p_data);
415 rfc_dec_credit (p_port);
422 rfc_send_ua (p_port->rfc.p_mcb, p_port->dlci);
426 PORT_DlcReleaseInd (p_port->rfc.p_mcb, p_port->dlci);
427 rfc_port_closed (p_port);
431 p_port->rfc.state = RFC_STATE_CLOSED;
432 rfc_send_ua (p_port->rfc.p_mcb, p_port->dlci);
433 if(p_port->rx.queue.count)
437 rfc_port_timer_start (p_port, RFC_DISC_TIMEOUT);
440 PORT_DlcReleaseInd (p_port->rfc.p_mcb, p_port->dlci);
444 rfc_port_uplink_data (p_port, (BT_HDR *)p_data);
448 Port_TimeOutCloseMux( p_port->rfc.p_mcb ) ;
449 RFCOMM_TRACE_ERROR2 ("Port error state %d event %d", p_port->rfc.state, event);
466 void rfc_port_sm_disc_wait_ua (tPORT *p_port, UINT16 event, void *p_data)
472 RFCOMM_TRACE_ERROR2 ("Port error state %d event %d", p_port->rfc.state, event);
476 rfc_port_closed (p_port);
484 p_port->rfc.p_mcb->is_disc_initiator = TRUE;
488 rfc_port_closed (p_port);
492 rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, TRUE);
496 rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, TRUE);
501 rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, FALSE);
505 rfc_port_closed (p_port);
520 void rfc_port_uplink_data (tPORT *p_port, BT_HDR *p_buf)
522 PORT_DataInd (p_port->rfc.p_mcb, p_port->dlci, p_buf);
536 tPORT *p_port;
556 p_port = port_find_mcb_dlci_port (p_mcb, dlci);
557 if ((p_port == NULL) || !(p_port->rfc.expected_rsp & RFC_RSP_PN))
560 p_port->rfc.expected_rsp &= ~RFC_RSP_PN;
562 rfc_port_timer_stop (p_port);
581 tPORT *p_port;
583 if ((p_port = port_find_mcb_dlci_port (p_mcb, p_frame->dlci)) == NULL)
600 port_pars = p_port->peer_port_pars;
601 rfc_send_rpn (p_mcb, p_frame->dlci, FALSE, &p_port->peer_port_pars, 0);
605 port_pars = p_port->peer_port_pars;
616 p_port = port_find_mcb_dlci_port (p_mcb, p_frame->dlci);
617 if ((p_port == NULL) || !(p_port->rfc.expected_rsp & (RFC_RSP_RPN | RFC_RSP_RPN_REPLY)))
622 rfc_port_timer_stop (p_port);
624 if (p_port->rfc.expected_rsp & RFC_RSP_RPN_REPLY)
626 p_port->rfc.expected_rsp &= ~RFC_RSP_RPN_REPLY;
628 p_port->peer_port_pars = port_pars;
639 p_port->peer_port_pars.fc_type = (RFCOMM_FC_RTR_ON_INPUT | RFCOMM_FC_RTR_ON_OUTPUT);
641 p_port->rfc.expected_rsp |= RFC_RSP_RPN;
642 rfc_send_rpn (p_mcb, p_frame->dlci, TRUE, &p_port->peer_port_pars,
644 rfc_port_timer_start (p_port, RFC_T2_TIMEOUT) ;
649 p_port->rfc.expected_rsp &= ~RFC_RSP_RPN;
657 PORT_PortNegCnf (p_mcb, p_port->dlci, &port_pars, RFCOMM_SUCCESS);
664 if (p_port->peer_port_pars.fc_type == (RFCOMM_FC_RTR_ON_INPUT | RFCOMM_FC_RTR_ON_OUTPUT))
667 p_port->peer_port_pars.fc_type = (RFCOMM_FC_RTC_ON_INPUT | RFCOMM_FC_RTC_ON_OUTPUT);
669 p_port->rfc.expected_rsp |= RFC_RSP_RPN;
671 rfc_send_rpn (p_mcb, p_frame->dlci, TRUE, &p_port->peer_port_pars,
673 rfc_port_timer_start (p_port, RFC_T2_TIMEOUT) ;
678 if (p_port->peer_port_pars.fc_type == (RFCOMM_FC_RTC_ON_INPUT | RFCOMM_FC_RTC_ON_OUTPUT))
680 p_port->peer_port_pars.fc_type = RFCOMM_FC_OFF;
681 PORT_PortNegCnf (p_mcb, p_port->dlci, &port_pars, RFCOMM_SUCCESS);
697 tPORT *p_port;
701 p_port = port_find_mcb_dlci_port (p_mcb, p_frame->dlci);
702 if (p_port == NULL)
731 if (p_port->rfc.p_mcb->flow != PORT_FC_CREDIT)
734 p_port->peer_ctrl.fc = new_peer_fc = pars.fc;
736 if (new_peer_fc != p_port->tx.peer_fc)
746 if (!(p_port->rfc.expected_rsp & RFC_RSP_MSC))
749 p_port->rfc.expected_rsp &= ~RFC_RSP_MSC;
751 rfc_port_timer_stop (p_port);
753 PORT_ControlCnf (p_port->rfc.p_mcb, p_port->dlci, &pars);
767 tPORT *p_port;
776 p_port = port_find_mcb_dlci_port (p_mcb, p_frame->dlci);
779 if (!p_port || !(p_port->rfc.expected_rsp & RFC_RSP_RLS))
782 p_port->rfc.expected_rsp &= ~RFC_RSP_RLS;
784 rfc_port_timer_stop (p_port);