Lines Matching refs:btpan_cb
89 btpan_cb_t btpan_cb; variable
132 … BTIF_TRACE_DEBUG("jni_initialized = %d, btpan_cb.enabled:%d", jni_initialized, btpan_cb.enabled); in btif_pan_init()
135 if (jni_initialized && !btpan_cb.enabled) in btif_pan_init()
138 memset(&btpan_cb, 0, sizeof(btpan_cb)); in btif_pan_init()
139 btpan_cb.tap_fd = INVALID_FD; in btif_pan_init()
140 btpan_cb.flow = 1; in btif_pan_init()
142 btpan_cleanup_conn(&btpan_cb.conns[i]); in btif_pan_init()
144 btpan_cb.enabled = 1; in btif_pan_init()
151 if (btpan_cb.enabled) in pan_disable()
153 btpan_cb.enabled = 0; in pan_disable()
155 if (btpan_cb.tap_fd != INVALID_FD) in pan_disable()
157 btpan_tap_close(btpan_cb.tap_fd); in pan_disable()
158 btpan_cb.tap_fd = INVALID_FD; in pan_disable()
170 btpan_cleanup_conn(&btpan_cb.conns[i]); in btif_pan_cleanup()
179 …BTIF_TRACE_DEBUG("stack_initialized = %d, btpan_cb.enabled:%d", stack_initialized, btpan_cb.enable… in btpan_jni_init()
182 if (stack_initialized && !btpan_cb.enabled) in btpan_jni_init()
391 if (btpan_cb.tap_fd == -1) in btpan_set_flow_control()
394 btpan_cb.flow = enable; in btpan_set_flow_control()
396 btsock_thread_add_fd(pan_pth, btpan_cb.tap_fd, 0, SOCK_THREAD_FD_RD, 0); in btpan_set_flow_control()
397 bta_dmexecutecallback(btu_exec_tap_fd_read, INT_TO_PTR(btpan_cb.tap_fd)); in btpan_set_flow_control()
481 if (btpan_cb.conns[i].handle == handle) in btpan_find_conn_handle()
482 return &btpan_cb.conns[i]; in btpan_find_conn_handle()
491 if (memcmp(btpan_cb.conns[i].peer, addr, sizeof(BD_ADDR)) == 0) in btpan_find_conn_addr()
492 return &btpan_cb.conns[i]; in btpan_find_conn_addr()
509 btpan_cb.tap_fd, btpan_cb.open_count, conn->handle, p_data->open.handle, in btpan_open_conn()
512 btpan_cb.open_count++; in btpan_open_conn()
514 if (btpan_cb.tap_fd < 0) in btpan_open_conn()
516 btpan_cb.tap_fd = btpan_tap_open(); in btpan_open_conn()
517 if(btpan_cb.tap_fd >= 0) in btpan_open_conn()
518 create_tap_read_thread(btpan_cb.tap_fd); in btpan_open_conn()
521 if (btpan_cb.tap_fd >= 0) in btpan_open_conn()
523 btpan_cb.flow = 1; in btpan_open_conn()
538 btpan_cb.open_count--; in btpan_close_conn()
540 if (btpan_cb.open_count == 0) in btpan_close_conn()
543 if (btpan_cb.tap_fd != INVALID_FD) in btpan_close_conn()
545 btpan_tap_close(btpan_cb.tap_fd); in btpan_close_conn()
546 btpan_cb.tap_fd = INVALID_FD; in btpan_close_conn()
569 BTIF_TRACE_DEBUG("conns[%d]:%d", i, btpan_cb.conns[i].handle); in btpan_new_conn()
570 if (btpan_cb.conns[i].handle == -1) in btpan_new_conn()
574 btpan_cb.conns[i].handle = handle; in btpan_new_conn()
575 bdcpy(btpan_cb.conns[i].peer, addr); in btpan_new_conn()
576 btpan_cb.conns[i].local_role = local_role; in btpan_new_conn()
577 btpan_cb.conns[i].remote_role = remote_role; in btpan_new_conn()
578 return &btpan_cb.conns[i]; in btpan_new_conn()
609 UINT16 handle = btpan_cb.conns[i].handle; in forward_bnep()
611 … (broadcast || memcmp(btpan_cb.conns[i].eth_addr, eth_hdr->h_dest, sizeof(BD_ADDR)) == 0 in forward_bnep()
612 || memcmp(btpan_cb.conns[i].peer, eth_hdr->h_dest, sizeof(BD_ADDR)) == 0)) { in forward_bnep()
727 if (fd == INVALID_FD || fd != btpan_cb.tap_fd) in btu_exec_tap_fd_read()
733 for (int i = 0; i < PAN_BUF_MAX && btif_is_enabled() && btpan_cb.flow; i++) { in btu_exec_tap_fd_read()
743 if (!btpan_cb.congest_packet_size) { in btu_exec_tap_fd_read()
745 OSI_NO_INTR(ret = read(fd, btpan_cb.congest_packet, in btu_exec_tap_fd_read()
746 sizeof(btpan_cb.congest_packet))); in btu_exec_tap_fd_read()
761 btpan_cb.congest_packet_size = ret; in btu_exec_tap_fd_read()
766 memcpy(packet, btpan_cb.congest_packet, MIN(btpan_cb.congest_packet_size, buffer->len)); in btu_exec_tap_fd_read()
767 buffer->len = MIN(btpan_cb.congest_packet_size, buffer->len); in btu_exec_tap_fd_read()
779 btpan_cb.congest_packet_size = 0; in btu_exec_tap_fd_read()
782 btpan_cb.congest_packet_size = 0; in btu_exec_tap_fd_read()
797 if (btpan_cb.flow) { in btu_exec_tap_fd_read()
809 if (btpan_cb.conns[i].handle != -1) in btif_pan_close_all_conns()
810 BTA_PanClose(btpan_cb.conns[i].handle); in btif_pan_close_all_conns()
815 assert(btpan_cb.tap_fd == INVALID_FD || btpan_cb.tap_fd == fd); in btpan_tap_fd_signaled()
817 if (btpan_cb.tap_fd != fd) { in btpan_tap_fd_signaled()
819 __func__, btpan_cb.tap_fd, fd); in btpan_tap_fd_signaled()
824 btpan_cb.tap_fd = INVALID_FD; in btpan_tap_fd_signaled()