Lines Matching refs:pcb
110 debugnet_get_gw_mac(const struct debugnet_pcb *pcb) in debugnet_get_gw_mac() argument
112 MPASS(g_debugnet_pcb_inuse && pcb == &g_dnet_pcb && in debugnet_get_gw_mac()
113 pcb->dp_state >= DN_STATE_HAVE_GW_MAC); in debugnet_get_gw_mac()
114 return (pcb->dp_gw_mac.octet); in debugnet_get_gw_mac()
175 debugnet_udp_output(struct debugnet_pcb *pcb, struct mbuf *m) in debugnet_udp_output() argument
179 MPASS(pcb->dp_state >= DN_STATE_HAVE_GW_MAC); in debugnet_udp_output()
190 udp->uh_sport = htons(pcb->dp_client_port); in debugnet_udp_output()
191 udp->uh_dport = htons(pcb->dp_server_port); in debugnet_udp_output()
195 return (debugnet_ip_output(pcb, m)); in debugnet_udp_output()
199 debugnet_ack_output(struct debugnet_pcb *pcb, uint32_t seqno /* net endian */) in debugnet_ack_output() argument
217 return (debugnet_udp_output(pcb, m)); in debugnet_ack_output()
244 debugnet_send(struct debugnet_pcb *pcb, uint32_t type, const void *data, in debugnet_send() argument
253 if (pcb->dp_state == DN_STATE_REMOTE_CLOSED) in debugnet_send()
257 pcb->dp_rcvd_acks = 0; in debugnet_send()
267 pktlen = min(pktlen, pcb->dp_ifp->if_mtu - in debugnet_send()
274 if ((pcb->dp_rcvd_acks & (1 << i)) != 0) { in debugnet_send()
292 dn_msg_hdr->mh_seqno = htonl(pcb->dp_seqno + i); in debugnet_send()
320 error = debugnet_udp_output(pcb, m); in debugnet_send()
338 while (pcb->dp_rcvd_acks != want_acks) { in debugnet_send()
345 debugnet_network_poll(pcb); in debugnet_send()
347 if (pcb->dp_state == DN_STATE_REMOTE_CLOSED) in debugnet_send()
350 pcb->dp_seqno += i; in debugnet_send()
363 debugnet_handle_rx_msg(struct debugnet_pcb *pcb, struct mbuf **mb) in debugnet_handle_rx_msg() argument
397 error = debugnet_ack_output(pcb, dnh->mh_seqno); in debugnet_handle_rx_msg()
403 pcb->dp_state = DN_STATE_REMOTE_CLOSED; in debugnet_handle_rx_msg()
411 pcb->dp_rx_handler(pcb, mb); in debugnet_handle_rx_msg()
415 debugnet_handle_ack(struct debugnet_pcb *pcb, struct mbuf **mb, uint16_t sport) in debugnet_handle_ack() argument
440 if (pcb->dp_state < DN_STATE_GOT_HERALD_PORT) { in debugnet_handle_ack()
441 pcb->dp_server_port = sport; in debugnet_handle_ack()
442 pcb->dp_state = DN_STATE_GOT_HERALD_PORT; in debugnet_handle_ack()
444 if (rcv_ackno >= pcb->dp_seqno + DEBUGNET_MAX_IN_FLIGHT) in debugnet_handle_ack()
446 else if (rcv_ackno >= pcb->dp_seqno) { in debugnet_handle_ack()
448 pcb->dp_rcvd_acks |= 1 << (rcv_ackno - pcb->dp_seqno); in debugnet_handle_ack()
453 debugnet_handle_udp(struct debugnet_pcb *pcb, struct mbuf **mb) in debugnet_handle_udp() argument
479 if (ntohs(udp->uh_dport) != pcb->dp_client_port) { in debugnet_handle_udp()
497 debugnet_handle_ack(pcb, mb, sport); in debugnet_handle_udp()
501 if (pcb->dp_rx_handler == NULL) { in debugnet_handle_udp()
510 debugnet_handle_rx_msg(pcb, mb); in debugnet_handle_udp()
592 debugnet_network_poll(struct debugnet_pcb *pcb) in debugnet_network_poll() argument
596 ifp = pcb->dp_ifp; in debugnet_network_poll()
604 debugnet_free(struct debugnet_pcb *pcb) in debugnet_free() argument
609 MPASS(pcb == &g_dnet_pcb); in debugnet_free()
611 ifp = pcb->dp_ifp; in debugnet_free()
613 if (pcb->dp_drv_input != NULL) in debugnet_free()
614 ifp->if_input = pcb->dp_drv_input; in debugnet_free()
615 if (pcb->dp_event_started) in debugnet_free()
629 struct debugnet_pcb *pcb; in debugnet_connect() local
638 pcb = &g_dnet_pcb; in debugnet_connect()
639 *pcb = (struct debugnet_pcb) { in debugnet_connect()
655 if (pcb->dp_client == INADDR_ANY || pcb->dp_gateway == INADDR_ANY || in debugnet_connect()
656 pcb->dp_ifp == NULL) { in debugnet_connect()
665 .sin_addr.s_addr = pcb->dp_server, in debugnet_connect()
694 if (pcb->dp_client == INADDR_ANY) in debugnet_connect()
695 pcb->dp_client = local_sin->sin_addr.s_addr; in debugnet_connect()
696 if (pcb->dp_gateway == INADDR_ANY && gw_sin != NULL) in debugnet_connect()
697 pcb->dp_gateway = gw_sin->sin_addr.s_addr; in debugnet_connect()
698 if (pcb->dp_ifp == NULL) in debugnet_connect()
699 pcb->dp_ifp = rt_ifp; in debugnet_connect()
702 ifp = pcb->dp_ifp; in debugnet_connect()
707 inet_ntop(AF_INET, &pcb->dp_server, serbuf, sizeof(serbuf)); in debugnet_connect()
708 inet_ntop(AF_INET, &pcb->dp_client, clibuf, sizeof(clibuf)); in debugnet_connect()
709 if (pcb->dp_gateway != INADDR_ANY) in debugnet_connect()
710 inet_ntop(AF_INET, &pcb->dp_gateway, gwbuf, sizeof(gwbuf)); in debugnet_connect()
712 serbuf, pcb->dp_server_port, in debugnet_connect()
713 (pcb->dp_gateway == INADDR_ANY) ? "" : " via ", in debugnet_connect()
714 (pcb->dp_gateway == INADDR_ANY) ? "" : gwbuf, in debugnet_connect()
715 clibuf, pcb->dp_client_port, if_name(ifp)); in debugnet_connect()
733 pcb->dp_event_started = true; in debugnet_connect()
743 pcb->dp_drv_input = ifp->if_input; in debugnet_connect()
749 error = debugnet_arp_gw(pcb); in debugnet_connect()
754 MPASS(pcb->dp_state == DN_STATE_HAVE_GW_MAC); in debugnet_connect()
760 error = debugnet_send(pcb, DEBUGNET_HERALD, dcp->dc_herald_data, in debugnet_connect()
767 *pcb_out = pcb; in debugnet_connect()
771 debugnet_free(pcb); in debugnet_connect()