dlc                60 netbt/hci_ioctl.c 	struct rfcomm_dlc *dlc;
dlc               107 netbt/hci_ioctl.c 		LIST_FOREACH(dlc, &rs->rs_dlcs, rd_next) {
dlc               111 netbt/hci_ioctl.c 			    dlc->rd_raddr.bt_channel, dlc->rd_dlci,
dlc               112 netbt/hci_ioctl.c 			    dlc->rd_state, dlc->rd_flags,
dlc               113 netbt/hci_ioctl.c 			    dlc->rd_rxcred, (unsigned long)dlc->rd_rxsize,
dlc               114 netbt/hci_ioctl.c 			    dlc->rd_txcred, dlc->rd_pending,
dlc               115 netbt/hci_ioctl.c 			    (dlc->rd_txbuf ? dlc->rd_txbuf->m_pkthdr.len : 0));
dlc               125 netbt/hci_ioctl.c 		LIST_FOREACH(dlc, &rs->rs_dlcs, rd_next)
dlc               126 netbt/hci_ioctl.c 			printf("+DLC channel=%d\n", dlc->rd_laddr.bt_channel);
dlc                56 netbt/rfcomm_dlc.c 	struct rfcomm_dlc *dlc;
dlc                58 netbt/rfcomm_dlc.c 	LIST_FOREACH(dlc, &rs->rs_dlcs, rd_next) {
dlc                59 netbt/rfcomm_dlc.c 		if (dlc->rd_dlci == dlci)
dlc                63 netbt/rfcomm_dlc.c 	return dlc;
dlc                75 netbt/rfcomm_dlc.c 	struct rfcomm_dlc *new, *dlc, *any, *best;
dlc                99 netbt/rfcomm_dlc.c 			LIST_FOREACH(dlc, &ls->rs_dlcs, rd_next) {
dlc               100 netbt/rfcomm_dlc.c 				if (dlc->rd_laddr.bt_channel == chan)
dlc               101 netbt/rfcomm_dlc.c 					best = dlc;
dlc               106 netbt/rfcomm_dlc.c 			LIST_FOREACH(dlc, &ls->rs_dlcs, rd_next) {
dlc               107 netbt/rfcomm_dlc.c 				if (dlc->rd_laddr.bt_channel == chan)
dlc               108 netbt/rfcomm_dlc.c 					any = dlc;
dlc               113 netbt/rfcomm_dlc.c 	dlc = best ? best : any;
dlc               120 netbt/rfcomm_dlc.c 	if (dlc != NULL)
dlc               121 netbt/rfcomm_dlc.c 		new = (*dlc->rd_proto->newconn)(dlc->rd_upper, &laddr, &raddr);
dlc               130 netbt/rfcomm_dlc.c 	new->rd_mode = dlc->rd_mode;
dlc               151 netbt/rfcomm_dlc.c rfcomm_dlc_close(struct rfcomm_dlc *dlc, int err)
dlc               156 netbt/rfcomm_dlc.c 	KASSERT(dlc->rd_state != RFCOMM_DLC_CLOSED);
dlc               159 netbt/rfcomm_dlc.c 	rs = dlc->rd_session;
dlc               161 netbt/rfcomm_dlc.c 		if (credit->rc_dlc == dlc)
dlc               164 netbt/rfcomm_dlc.c 	timeout_del(&dlc->rd_timeout);
dlc               166 netbt/rfcomm_dlc.c 	LIST_REMOVE(dlc, rd_next);
dlc               167 netbt/rfcomm_dlc.c 	dlc->rd_session = NULL;
dlc               168 netbt/rfcomm_dlc.c 	dlc->rd_state = RFCOMM_DLC_CLOSED;
dlc               170 netbt/rfcomm_dlc.c 	(*dlc->rd_proto->disconnected)(dlc->rd_upper, err);
dlc               197 netbt/rfcomm_dlc.c 	struct rfcomm_dlc *dlc = arg;
dlc               202 netbt/rfcomm_dlc.c 	if (dlc->rd_state != RFCOMM_DLC_CLOSED)
dlc               203 netbt/rfcomm_dlc.c 		rfcomm_dlc_close(dlc, ETIMEDOUT);
dlc               204 netbt/rfcomm_dlc.c 	else if (dlc->rd_flags & RFCOMM_DLC_DETACH)
dlc               205 netbt/rfcomm_dlc.c 		free(dlc, M_BLUETOOTH);
dlc               218 netbt/rfcomm_dlc.c rfcomm_dlc_setmode(struct rfcomm_dlc *dlc)
dlc               222 netbt/rfcomm_dlc.c 	KASSERT(dlc->rd_session != NULL);
dlc               223 netbt/rfcomm_dlc.c 	KASSERT(dlc->rd_session->rs_state == RFCOMM_SESSION_OPEN);
dlc               225 netbt/rfcomm_dlc.c 	DPRINTF("dlci %d, auth %s, encrypt %s, secure %s\n", dlc->rd_dlci,
dlc               226 netbt/rfcomm_dlc.c 		(dlc->rd_mode & RFCOMM_LM_AUTH ? "yes" : "no"),
dlc               227 netbt/rfcomm_dlc.c 		(dlc->rd_mode & RFCOMM_LM_ENCRYPT ? "yes" : "no"),
dlc               228 netbt/rfcomm_dlc.c 		(dlc->rd_mode & RFCOMM_LM_SECURE ? "yes" : "no"));
dlc               230 netbt/rfcomm_dlc.c 	if (dlc->rd_mode & RFCOMM_LM_AUTH)
dlc               233 netbt/rfcomm_dlc.c 	if (dlc->rd_mode & RFCOMM_LM_ENCRYPT)
dlc               236 netbt/rfcomm_dlc.c 	if (dlc->rd_mode & RFCOMM_LM_SECURE)
dlc               239 netbt/rfcomm_dlc.c 	return l2cap_setopt(dlc->rd_session->rs_l2cap, SO_L2CAP_LM, &mode);
dlc               248 netbt/rfcomm_dlc.c rfcomm_dlc_connect(struct rfcomm_dlc *dlc)
dlc               253 netbt/rfcomm_dlc.c 	KASSERT(dlc->rd_session != NULL);
dlc               254 netbt/rfcomm_dlc.c 	KASSERT(dlc->rd_session->rs_state == RFCOMM_SESSION_OPEN);
dlc               255 netbt/rfcomm_dlc.c 	KASSERT(dlc->rd_state == RFCOMM_DLC_WAIT_SESSION);
dlc               264 netbt/rfcomm_dlc.c 	pn.dlci = dlc->rd_dlci;
dlc               265 netbt/rfcomm_dlc.c 	pn.priority = dlc->rd_dlci | 0x07;
dlc               266 netbt/rfcomm_dlc.c 	pn.mtu = htole16(dlc->rd_mtu);
dlc               269 netbt/rfcomm_dlc.c 	dlc->rd_rxcred = (dlc->rd_rxsize / dlc->rd_mtu);
dlc               270 netbt/rfcomm_dlc.c 	dlc->rd_rxcred = min(dlc->rd_rxcred, RFCOMM_CREDITS_DEFAULT);
dlc               271 netbt/rfcomm_dlc.c 	pn.credits = dlc->rd_rxcred;
dlc               273 netbt/rfcomm_dlc.c 	err = rfcomm_session_send_mcc(dlc->rd_session, 1,
dlc               278 netbt/rfcomm_dlc.c 	dlc->rd_state = RFCOMM_DLC_WAIT_CONNECT;
dlc               279 netbt/rfcomm_dlc.c 	timeout_add(&dlc->rd_timeout, rfcomm_mcc_timeout * hz);
dlc               290 netbt/rfcomm_dlc.c rfcomm_dlc_open(struct rfcomm_dlc *dlc)
dlc               295 netbt/rfcomm_dlc.c 	KASSERT(dlc->rd_session != NULL);
dlc               296 netbt/rfcomm_dlc.c 	KASSERT(dlc->rd_session->rs_state == RFCOMM_SESSION_OPEN);
dlc               299 netbt/rfcomm_dlc.c 	msc.address = RFCOMM_MKADDRESS(1, dlc->rd_dlci);
dlc               300 netbt/rfcomm_dlc.c 	msc.modem = dlc->rd_lmodem & 0xfe;	/* EA = 0 */
dlc               303 netbt/rfcomm_dlc.c 	err = rfcomm_session_send_mcc(dlc->rd_session, 1,
dlc               308 netbt/rfcomm_dlc.c 	timeout_add(&dlc->rd_timeout, rfcomm_mcc_timeout * hz);
dlc               310 netbt/rfcomm_dlc.c 	dlc->rd_state = RFCOMM_DLC_OPEN;
dlc               311 netbt/rfcomm_dlc.c 	(*dlc->rd_proto->connected)(dlc->rd_upper);
dlc               327 netbt/rfcomm_dlc.c rfcomm_dlc_start(struct rfcomm_dlc *dlc)
dlc               329 netbt/rfcomm_dlc.c 	struct rfcomm_session *rs = dlc->rd_session;
dlc               335 netbt/rfcomm_dlc.c 	KASSERT(dlc->rd_state == RFCOMM_DLC_OPEN);
dlc               339 netbt/rfcomm_dlc.c 		len = dlc->rd_mtu;
dlc               341 netbt/rfcomm_dlc.c 			credits = (dlc->rd_rxsize / dlc->rd_mtu);
dlc               342 netbt/rfcomm_dlc.c 			credits -= dlc->rd_rxcred;
dlc               348 netbt/rfcomm_dlc.c 			if (dlc->rd_txcred == 0)
dlc               354 netbt/rfcomm_dlc.c 			if (dlc->rd_rmodem & RFCOMM_MSC_FC)
dlc               357 netbt/rfcomm_dlc.c 			if (dlc->rd_pending > RFCOMM_CREDITS_DEFAULT)
dlc               361 netbt/rfcomm_dlc.c 		if (dlc->rd_txbuf == NULL)
dlc               373 netbt/rfcomm_dlc.c 			    && dlc->rd_rxcred > RFCOMM_CREDITS_DEFAULT)
dlc               381 netbt/rfcomm_dlc.c 			m = dlc->rd_txbuf;
dlc               383 netbt/rfcomm_dlc.c 				dlc->rd_txbuf = m_split(m, len, M_DONTWAIT);
dlc               384 netbt/rfcomm_dlc.c 				if (dlc->rd_txbuf == NULL) {
dlc               385 netbt/rfcomm_dlc.c 					dlc->rd_txbuf = m;
dlc               389 netbt/rfcomm_dlc.c 				dlc->rd_txbuf = NULL;
dlc               395 netbt/rfcomm_dlc.c 			dlc->rd_dlci, len, credits, dlc->rd_rxcred);
dlc               397 netbt/rfcomm_dlc.c 		if (rfcomm_session_send_uih(rs, dlc, credits, m)) {
dlc               399 netbt/rfcomm_dlc.c 				__func__, len, dlc->rd_dlci);
dlc               404 netbt/rfcomm_dlc.c 		dlc->rd_pending++;
dlc               408 netbt/rfcomm_dlc.c 				dlc->rd_txcred--;
dlc               411 netbt/rfcomm_dlc.c 				dlc->rd_rxcred += credits;
dlc               303 netbt/rfcomm_session.c 	struct rfcomm_dlc *dlc;
dlc               315 netbt/rfcomm_session.c 			dlc = LIST_FIRST(&rs->rs_dlcs);
dlc               317 netbt/rfcomm_session.c 			rfcomm_dlc_close(dlc, ETIMEDOUT);
dlc               381 netbt/rfcomm_session.c 	struct rfcomm_dlc *dlc;
dlc               388 netbt/rfcomm_session.c 		dlc = LIST_FIRST(&rs->rs_dlcs);
dlc               390 netbt/rfcomm_session.c 		rfcomm_dlc_close(dlc, err);
dlc               435 netbt/rfcomm_session.c 	struct rfcomm_dlc *dlc;
dlc               451 netbt/rfcomm_session.c 		dlc = credit->rc_dlc;
dlc               452 netbt/rfcomm_session.c 		if (dlc != NULL) {
dlc               453 netbt/rfcomm_session.c 			dlc->rd_pending--;
dlc               454 netbt/rfcomm_session.c 			(*dlc->rd_proto->complete)
dlc               455 netbt/rfcomm_session.c 					(dlc->rd_upper, credit->rc_len);
dlc               462 netbt/rfcomm_session.c 			    && dlc->rd_state == RFCOMM_DLC_OPEN) {
dlc               463 netbt/rfcomm_session.c 				rfcomm_dlc_start(dlc);
dlc               470 netbt/rfcomm_session.c 			if ((dlc->rd_flags & RFCOMM_DLC_SHUTDOWN)
dlc               471 netbt/rfcomm_session.c 			    && dlc->rd_txbuf == NULL && dlc->rd_pending == 0) {
dlc               472 netbt/rfcomm_session.c 				dlc->rd_state = RFCOMM_DLC_WAIT_DISCONNECT;
dlc               474 netbt/rfcomm_session.c 							    dlc->rd_dlci);
dlc               475 netbt/rfcomm_session.c 				timeout_add(&dlc->rd_timeout,
dlc               503 netbt/rfcomm_session.c 	struct rfcomm_dlc *dlc, *next;
dlc               521 netbt/rfcomm_session.c 	while ((dlc = next) != NULL) {
dlc               522 netbt/rfcomm_session.c 		next = LIST_NEXT(dlc, rd_next);
dlc               524 netbt/rfcomm_session.c 		switch (dlc->rd_state) {
dlc               526 netbt/rfcomm_session.c 			if ((mode & dlc->rd_mode) != dlc->rd_mode) {
dlc               527 netbt/rfcomm_session.c 				rfcomm_dlc_close(dlc, ECONNABORTED);
dlc               530 netbt/rfcomm_session.c 					    RFCOMM_FRAME_SABM, dlc->rd_dlci);
dlc               532 netbt/rfcomm_session.c 					rfcomm_dlc_close(dlc, err);
dlc               534 netbt/rfcomm_session.c 					dlc->rd_state = RFCOMM_DLC_WAIT_RECV_UA;
dlc               535 netbt/rfcomm_session.c 					timeout_add(&dlc->rd_timeout,
dlc               554 netbt/rfcomm_session.c 			if ((mode & dlc->rd_mode) != dlc->rd_mode) {
dlc               556 netbt/rfcomm_session.c 					    RFCOMM_FRAME_DM, dlc->rd_dlci);
dlc               557 netbt/rfcomm_session.c 				rfcomm_dlc_close(dlc, ECONNABORTED);
dlc               562 netbt/rfcomm_session.c 					    RFCOMM_FRAME_UA, dlc->rd_dlci);
dlc               565 netbt/rfcomm_session.c 						RFCOMM_FRAME_DM, dlc->rd_dlci);
dlc               566 netbt/rfcomm_session.c 				rfcomm_dlc_close(dlc, err);
dlc               570 netbt/rfcomm_session.c 			err = rfcomm_dlc_open(dlc);
dlc               573 netbt/rfcomm_session.c 						RFCOMM_FRAME_DM, dlc->rd_dlci);
dlc               574 netbt/rfcomm_session.c 				rfcomm_dlc_close(dlc, err);
dlc               582 netbt/rfcomm_session.c 			(*dlc->rd_proto->linkmode)(dlc->rd_upper, mode);
dlc               710 netbt/rfcomm_session.c 	struct rfcomm_dlc *dlc;
dlc               718 netbt/rfcomm_session.c 		LIST_FOREACH(dlc, &rs->rs_dlcs, rd_next) {
dlc               719 netbt/rfcomm_session.c 			if (dlc->rd_state == RFCOMM_DLC_WAIT_SESSION)
dlc               720 netbt/rfcomm_session.c 				rfcomm_dlc_connect(dlc);
dlc               741 netbt/rfcomm_session.c 	dlc = rfcomm_dlc_lookup(rs, dlci);
dlc               742 netbt/rfcomm_session.c 	if (dlc == NULL) {
dlc               743 netbt/rfcomm_session.c 		dlc = rfcomm_dlc_newconn(rs, dlci);
dlc               744 netbt/rfcomm_session.c 		if (dlc == NULL)
dlc               752 netbt/rfcomm_session.c 	if (dlc->rd_state != RFCOMM_DLC_WAIT_CONNECT)
dlc               756 netbt/rfcomm_session.c 	err = rfcomm_dlc_setmode(dlc);
dlc               758 netbt/rfcomm_session.c 		dlc->rd_state = RFCOMM_DLC_WAIT_SEND_UA;
dlc               759 netbt/rfcomm_session.c 		(*dlc->rd_proto->connecting)(dlc->rd_upper);
dlc               770 netbt/rfcomm_session.c 	err = rfcomm_dlc_open(dlc);
dlc               777 netbt/rfcomm_session.c 	rfcomm_dlc_close(dlc, err);
dlc               786 netbt/rfcomm_session.c 	struct rfcomm_dlc *dlc;
dlc               806 netbt/rfcomm_session.c 	dlc = rfcomm_dlc_lookup(rs, dlci);
dlc               807 netbt/rfcomm_session.c 	if (dlc == NULL) {
dlc               812 netbt/rfcomm_session.c 	rfcomm_dlc_close(dlc, ECONNRESET);
dlc               825 netbt/rfcomm_session.c 	struct rfcomm_dlc *dlc;
dlc               834 netbt/rfcomm_session.c 			LIST_FOREACH(dlc, &rs->rs_dlcs, rd_next) {
dlc               835 netbt/rfcomm_session.c 				if (dlc->rd_state == RFCOMM_DLC_WAIT_SESSION)
dlc               836 netbt/rfcomm_session.c 					rfcomm_dlc_connect(dlc);
dlc               859 netbt/rfcomm_session.c 	dlc = rfcomm_dlc_lookup(rs, dlci);
dlc               860 netbt/rfcomm_session.c 	if (dlc == NULL)
dlc               863 netbt/rfcomm_session.c 	switch (dlc->rd_state) {
dlc               865 netbt/rfcomm_session.c 		rfcomm_dlc_open(dlc);
dlc               869 netbt/rfcomm_session.c 		rfcomm_dlc_close(dlc, 0);
dlc               893 netbt/rfcomm_session.c 	struct rfcomm_dlc *dlc;
dlc               897 netbt/rfcomm_session.c 	dlc = rfcomm_dlc_lookup(rs, dlci);
dlc               898 netbt/rfcomm_session.c 	if (dlc == NULL)
dlc               901 netbt/rfcomm_session.c 	if (dlc->rd_state == RFCOMM_DLC_WAIT_CONNECT)
dlc               902 netbt/rfcomm_session.c 		rfcomm_dlc_close(dlc, ECONNREFUSED);
dlc               904 netbt/rfcomm_session.c 		rfcomm_dlc_close(dlc, ECONNRESET);
dlc               914 netbt/rfcomm_session.c 	struct rfcomm_dlc *dlc;
dlc               931 netbt/rfcomm_session.c 	dlc = rfcomm_dlc_lookup(rs, dlci);
dlc               932 netbt/rfcomm_session.c 	if (dlc == NULL) {
dlc               938 netbt/rfcomm_session.c 	if (dlc->rd_state != RFCOMM_DLC_OPEN) {
dlc               940 netbt/rfcomm_session.c 				dlc->rd_state);
dlc               955 netbt/rfcomm_session.c 			dlc->rd_txcred += credits;
dlc               957 netbt/rfcomm_session.c 			if (credits > 0 && dlc->rd_txbuf != NULL)
dlc               958 netbt/rfcomm_session.c 				rfcomm_dlc_start(dlc);
dlc               964 netbt/rfcomm_session.c 		if (dlc->rd_rxcred == 0) {
dlc               969 netbt/rfcomm_session.c 		if (len > dlc->rd_rxsize) {
dlc               974 netbt/rfcomm_session.c 		dlc->rd_rxcred--;
dlc               975 netbt/rfcomm_session.c 		dlc->rd_rxsize -= len;
dlc               978 netbt/rfcomm_session.c 	(*dlc->rd_proto->input)(dlc->rd_upper, m);
dlc              1151 netbt/rfcomm_session.c 	struct rfcomm_dlc *dlc;
dlc              1162 netbt/rfcomm_session.c 	dlc = rfcomm_dlc_lookup(rs, RFCOMM_DLCI(msc.address));
dlc              1165 netbt/rfcomm_session.c 		if (dlc != NULL)
dlc              1166 netbt/rfcomm_session.c 			timeout_del(&dlc->rd_timeout);
dlc              1171 netbt/rfcomm_session.c 	if (dlc == NULL) {
dlc              1185 netbt/rfcomm_session.c 	dlc->rd_rmodem = msc.modem;
dlc              1301 netbt/rfcomm_session.c 	struct rfcomm_dlc *dlc;
dlc              1315 netbt/rfcomm_session.c 	dlc = rfcomm_dlc_lookup(rs, pn.dlci);
dlc              1321 netbt/rfcomm_session.c 		if (dlc == NULL) {
dlc              1322 netbt/rfcomm_session.c 			dlc = rfcomm_dlc_newconn(rs, pn.dlci);
dlc              1323 netbt/rfcomm_session.c 			if (dlc == NULL)
dlc              1331 netbt/rfcomm_session.c 		dlc->rd_mtu = pn.mtu;
dlc              1335 netbt/rfcomm_session.c 		if (dlc->rd_state == RFCOMM_DLC_WAIT_CONNECT
dlc              1338 netbt/rfcomm_session.c 			dlc->rd_txcred = pn.credits & 0x07;
dlc              1340 netbt/rfcomm_session.c 			dlc->rd_rxcred = (dlc->rd_rxsize / dlc->rd_mtu);
dlc              1341 netbt/rfcomm_session.c 			dlc->rd_rxcred = min(dlc->rd_rxcred,
dlc              1345 netbt/rfcomm_session.c 			pn.credits = dlc->rd_rxcred;
dlc              1363 netbt/rfcomm_session.c 		if (dlc == NULL)
dlc              1366 netbt/rfcomm_session.c 		timeout_del(&dlc->rd_timeout);
dlc              1368 netbt/rfcomm_session.c 		if (pn.mtu > RFCOMM_MTU_MAX || pn.mtu > dlc->rd_mtu) {
dlc              1369 netbt/rfcomm_session.c 			dlc->rd_state = RFCOMM_DLC_WAIT_DISCONNECT;
dlc              1375 netbt/rfcomm_session.c 			timeout_add(&dlc->rd_timeout,
dlc              1379 netbt/rfcomm_session.c 		dlc->rd_mtu = pn.mtu;
dlc              1382 netbt/rfcomm_session.c 		if (dlc->rd_state != RFCOMM_DLC_WAIT_CONNECT)
dlc              1388 netbt/rfcomm_session.c 			dlc->rd_txcred = (pn.credits & 0x07);
dlc              1391 netbt/rfcomm_session.c 		timeout_add(&dlc->rd_timeout, rfcomm_ack_timeout * hz);
dlc              1394 netbt/rfcomm_session.c 		err = rfcomm_dlc_setmode(dlc);
dlc              1396 netbt/rfcomm_session.c 			dlc->rd_state = RFCOMM_DLC_WAIT_SEND_SABM;
dlc              1397 netbt/rfcomm_session.c 			(*dlc->rd_proto->connecting)(dlc->rd_upper);
dlc              1408 netbt/rfcomm_session.c 		dlc->rd_state = RFCOMM_DLC_WAIT_RECV_UA;
dlc              1413 netbt/rfcomm_session.c 	rfcomm_dlc_close(dlc, err);
dlc              1423 netbt/rfcomm_session.c 	struct rfcomm_dlc *dlc, *next;
dlc              1431 netbt/rfcomm_session.c 	while ((dlc = next) != NULL) {
dlc              1432 netbt/rfcomm_session.c 		next = LIST_NEXT(dlc, rd_next);
dlc              1433 netbt/rfcomm_session.c 		rfcomm_dlc_close(dlc, ECONNABORTED);
dlc              1510 netbt/rfcomm_session.c rfcomm_session_send_uih(struct rfcomm_session *rs, struct rfcomm_dlc *dlc,
dlc              1531 netbt/rfcomm_session.c 	credit->rc_dlc = dlc;
dlc              1558 netbt/rfcomm_session.c 				(dlc ? dlc->rd_dlci : 0));
dlc              1593 netbt/rfcomm_session.c 		dlc ? dlc->rd_dlci : 0, m0->m_pkthdr.len, credit->rc_len,
dlc                66 netbt/rfcomm_upper.c 	struct rfcomm_dlc *dlc;
dlc                72 netbt/rfcomm_upper.c 	dlc = malloc(sizeof(struct rfcomm_dlc), M_BLUETOOTH, M_NOWAIT);
dlc                73 netbt/rfcomm_upper.c 	if (dlc == NULL)
dlc                75 netbt/rfcomm_upper.c 	bzero(dlc, sizeof *dlc);
dlc                77 netbt/rfcomm_upper.c 	dlc->rd_state = RFCOMM_DLC_CLOSED;
dlc                78 netbt/rfcomm_upper.c 	dlc->rd_mtu = rfcomm_mtu_default;
dlc                80 netbt/rfcomm_upper.c 	dlc->rd_proto = proto;
dlc                81 netbt/rfcomm_upper.c 	dlc->rd_upper = upper;
dlc                83 netbt/rfcomm_upper.c 	dlc->rd_laddr.bt_len = sizeof(struct sockaddr_bt);
dlc                84 netbt/rfcomm_upper.c 	dlc->rd_laddr.bt_family = AF_BLUETOOTH;
dlc                85 netbt/rfcomm_upper.c 	dlc->rd_laddr.bt_psm = L2CAP_PSM_RFCOMM;
dlc                87 netbt/rfcomm_upper.c 	dlc->rd_raddr.bt_len = sizeof(struct sockaddr_bt);
dlc                88 netbt/rfcomm_upper.c 	dlc->rd_raddr.bt_family = AF_BLUETOOTH;
dlc                89 netbt/rfcomm_upper.c 	dlc->rd_raddr.bt_psm = L2CAP_PSM_RFCOMM;
dlc                91 netbt/rfcomm_upper.c 	dlc->rd_lmodem = RFCOMM_MSC_RTC | RFCOMM_MSC_RTR | RFCOMM_MSC_DV;
dlc                93 netbt/rfcomm_upper.c 	timeout_set(&dlc->rd_timeout, rfcomm_dlc_timeout, dlc);
dlc                95 netbt/rfcomm_upper.c 	*handle = dlc;
dlc               105 netbt/rfcomm_upper.c rfcomm_bind(struct rfcomm_dlc *dlc, struct sockaddr_bt *addr)
dlc               108 netbt/rfcomm_upper.c 	memcpy(&dlc->rd_laddr, addr, sizeof(struct sockaddr_bt));
dlc               118 netbt/rfcomm_upper.c rfcomm_sockaddr(struct rfcomm_dlc *dlc, struct sockaddr_bt *addr)
dlc               121 netbt/rfcomm_upper.c 	memcpy(addr, &dlc->rd_laddr, sizeof(struct sockaddr_bt));
dlc               131 netbt/rfcomm_upper.c rfcomm_connect(struct rfcomm_dlc *dlc, struct sockaddr_bt *dest)
dlc               136 netbt/rfcomm_upper.c 	if (dlc->rd_state != RFCOMM_DLC_CLOSED)
dlc               139 netbt/rfcomm_upper.c 	memcpy(&dlc->rd_raddr, dest, sizeof(struct sockaddr_bt));
dlc               141 netbt/rfcomm_upper.c 	if (dlc->rd_raddr.bt_channel < RFCOMM_CHANNEL_MIN
dlc               142 netbt/rfcomm_upper.c 	    || dlc->rd_raddr.bt_channel > RFCOMM_CHANNEL_MAX
dlc               143 netbt/rfcomm_upper.c 	    || bdaddr_any(&dlc->rd_raddr.bt_bdaddr))
dlc               146 netbt/rfcomm_upper.c 	if (dlc->rd_raddr.bt_psm == L2CAP_PSM_ANY)
dlc               147 netbt/rfcomm_upper.c 		dlc->rd_raddr.bt_psm = L2CAP_PSM_RFCOMM;
dlc               148 netbt/rfcomm_upper.c 	else if (dlc->rd_raddr.bt_psm != L2CAP_PSM_RFCOMM
dlc               149 netbt/rfcomm_upper.c 	    && (dlc->rd_raddr.bt_psm < 0x1001
dlc               150 netbt/rfcomm_upper.c 	    || L2CAP_PSM_INVALID(dlc->rd_raddr.bt_psm)))
dlc               158 netbt/rfcomm_upper.c 	rs = rfcomm_session_lookup(&dlc->rd_laddr, &dlc->rd_raddr);
dlc               161 netbt/rfcomm_upper.c 						&dlc->rd_laddr);
dlc               168 netbt/rfcomm_upper.c 		err = l2cap_connect(rs->rs_l2cap, &dlc->rd_raddr);
dlc               181 netbt/rfcomm_upper.c 	dlc->rd_dlci = RFCOMM_MKDLCI(IS_INITIATOR(rs) ? 0:1, dest->bt_channel);
dlc               182 netbt/rfcomm_upper.c 	if (rfcomm_dlc_lookup(rs, dlc->rd_dlci))
dlc               185 netbt/rfcomm_upper.c 	l2cap_sockaddr(rs->rs_l2cap, &dlc->rd_laddr);
dlc               190 netbt/rfcomm_upper.c 	dlc->rd_session = rs;
dlc               191 netbt/rfcomm_upper.c 	dlc->rd_state = RFCOMM_DLC_WAIT_SESSION;
dlc               192 netbt/rfcomm_upper.c 	LIST_INSERT_HEAD(&rs->rs_dlcs, dlc, rd_next);
dlc               195 netbt/rfcomm_upper.c 		err = rfcomm_dlc_connect(dlc);
dlc               206 netbt/rfcomm_upper.c rfcomm_peeraddr(struct rfcomm_dlc *dlc, struct sockaddr_bt *addr)
dlc               209 netbt/rfcomm_upper.c 	memcpy(addr, &dlc->rd_raddr, sizeof(struct sockaddr_bt));
dlc               219 netbt/rfcomm_upper.c rfcomm_disconnect(struct rfcomm_dlc *dlc, int linger)
dlc               221 netbt/rfcomm_upper.c 	struct rfcomm_session *rs = dlc->rd_session;
dlc               224 netbt/rfcomm_upper.c 	KASSERT(dlc != NULL);
dlc               226 netbt/rfcomm_upper.c 	switch (dlc->rd_state) {
dlc               233 netbt/rfcomm_upper.c 				RFCOMM_FRAME_DM, dlc->rd_dlci);
dlc               239 netbt/rfcomm_upper.c 		rfcomm_dlc_close(dlc, 0);
dlc               243 netbt/rfcomm_upper.c 		if (dlc->rd_txbuf != NULL && linger != 0) {
dlc               244 netbt/rfcomm_upper.c 			dlc->rd_flags |= RFCOMM_DLC_SHUTDOWN;
dlc               250 netbt/rfcomm_upper.c 		dlc->rd_state = RFCOMM_DLC_WAIT_DISCONNECT;
dlc               252 netbt/rfcomm_upper.c 							dlc->rd_dlci);
dlc               253 netbt/rfcomm_upper.c 		timeout_add(&dlc->rd_timeout, rfcomm_ack_timeout * hz);
dlc               261 netbt/rfcomm_upper.c 		UNKNOWN(dlc->rd_state);
dlc               276 netbt/rfcomm_upper.c 	struct rfcomm_dlc *dlc = *handle;
dlc               278 netbt/rfcomm_upper.c 	if (dlc->rd_state != RFCOMM_DLC_CLOSED)
dlc               279 netbt/rfcomm_upper.c 		rfcomm_dlc_close(dlc, 0);
dlc               281 netbt/rfcomm_upper.c 	if (dlc->rd_txbuf != NULL) {
dlc               282 netbt/rfcomm_upper.c 		m_freem(dlc->rd_txbuf);
dlc               283 netbt/rfcomm_upper.c 		dlc->rd_txbuf = NULL;
dlc               286 netbt/rfcomm_upper.c 	dlc->rd_upper = NULL;
dlc               293 netbt/rfcomm_upper.c 	if (timeout_triggered(&dlc->rd_timeout))
dlc               294 netbt/rfcomm_upper.c 		dlc->rd_flags |= RFCOMM_DLC_DETACH;
dlc               296 netbt/rfcomm_upper.c 		free(dlc, M_BLUETOOTH);
dlc               309 netbt/rfcomm_upper.c rfcomm_listen(struct rfcomm_dlc *dlc)
dlc               315 netbt/rfcomm_upper.c 	if (dlc->rd_state != RFCOMM_DLC_CLOSED)
dlc               318 netbt/rfcomm_upper.c 	if (dlc->rd_laddr.bt_channel < RFCOMM_CHANNEL_MIN
dlc               319 netbt/rfcomm_upper.c 	    || dlc->rd_laddr.bt_channel > RFCOMM_CHANNEL_MAX)
dlc               322 netbt/rfcomm_upper.c 	if (dlc->rd_laddr.bt_psm == L2CAP_PSM_ANY)
dlc               323 netbt/rfcomm_upper.c 		dlc->rd_laddr.bt_psm = L2CAP_PSM_RFCOMM;
dlc               324 netbt/rfcomm_upper.c 	else if (dlc->rd_laddr.bt_psm != L2CAP_PSM_RFCOMM
dlc               325 netbt/rfcomm_upper.c 	    && (dlc->rd_laddr.bt_psm < 0x1001
dlc               326 netbt/rfcomm_upper.c 	    || L2CAP_PSM_INVALID(dlc->rd_laddr.bt_psm)))
dlc               333 netbt/rfcomm_upper.c 		if (addr.bt_psm != dlc->rd_laddr.bt_psm)
dlc               336 netbt/rfcomm_upper.c 		if (bdaddr_same(&dlc->rd_laddr.bt_bdaddr, &addr.bt_bdaddr))
dlc               346 netbt/rfcomm_upper.c 						&dlc->rd_laddr);
dlc               359 netbt/rfcomm_upper.c 	dlc->rd_session = rs;
dlc               360 netbt/rfcomm_upper.c 	dlc->rd_state = RFCOMM_DLC_LISTEN;
dlc               361 netbt/rfcomm_upper.c 	LIST_INSERT_HEAD(&rs->rs_dlcs, dlc, rd_next);
dlc               374 netbt/rfcomm_upper.c rfcomm_send(struct rfcomm_dlc *dlc, struct mbuf *m)
dlc               377 netbt/rfcomm_upper.c 	if (dlc->rd_txbuf != NULL) {
dlc               378 netbt/rfcomm_upper.c 		dlc->rd_txbuf->m_pkthdr.len += m->m_pkthdr.len;
dlc               379 netbt/rfcomm_upper.c 		m_cat(dlc->rd_txbuf, m);
dlc               381 netbt/rfcomm_upper.c 		dlc->rd_txbuf = m;
dlc               384 netbt/rfcomm_upper.c 	if (dlc->rd_state == RFCOMM_DLC_OPEN)
dlc               385 netbt/rfcomm_upper.c 		rfcomm_dlc_start(dlc);
dlc               400 netbt/rfcomm_upper.c rfcomm_rcvd(struct rfcomm_dlc *dlc, size_t space)
dlc               403 netbt/rfcomm_upper.c 	KASSERT(dlc != NULL);
dlc               405 netbt/rfcomm_upper.c 	dlc->rd_rxsize = space;
dlc               411 netbt/rfcomm_upper.c 	if (dlc->rd_state == RFCOMM_DLC_OPEN
dlc               412 netbt/rfcomm_upper.c 	    && (dlc->rd_session->rs_flags & RFCOMM_SESSION_CFC))
dlc               413 netbt/rfcomm_upper.c 		rfcomm_dlc_start(dlc);
dlc               424 netbt/rfcomm_upper.c rfcomm_setopt(struct rfcomm_dlc *dlc, int opt, void *addr)
dlc               434 netbt/rfcomm_upper.c 		else if (dlc->rd_state == RFCOMM_DLC_CLOSED)
dlc               435 netbt/rfcomm_upper.c 			dlc->rd_mtu = mtu;
dlc               451 netbt/rfcomm_upper.c 		dlc->rd_mode = mode;
dlc               453 netbt/rfcomm_upper.c 		if (dlc->rd_state == RFCOMM_DLC_OPEN)
dlc               454 netbt/rfcomm_upper.c 			err = rfcomm_dlc_setmode(dlc);
dlc               471 netbt/rfcomm_upper.c rfcomm_getopt(struct rfcomm_dlc *dlc, int opt, void *addr)
dlc               477 netbt/rfcomm_upper.c 		*(uint16_t *)addr = dlc->rd_mtu;
dlc               483 netbt/rfcomm_upper.c 		fc->lmodem = dlc->rd_lmodem;
dlc               484 netbt/rfcomm_upper.c 		fc->rmodem = dlc->rd_rmodem;
dlc               485 netbt/rfcomm_upper.c 		fc->tx_cred = max(dlc->rd_txcred, 0xff);
dlc               486 netbt/rfcomm_upper.c 		fc->rx_cred = max(dlc->rd_rxcred, 0xff);
dlc               487 netbt/rfcomm_upper.c 		if (dlc->rd_session
dlc               488 netbt/rfcomm_upper.c 		    && (dlc->rd_session->rs_flags & RFCOMM_SESSION_CFC))
dlc               494 netbt/rfcomm_upper.c 		*(int *)addr = dlc->rd_mode;