Lines Matching refs:pcb
102 debugnet_get_gw_mac(const struct debugnet_pcb *pcb) in debugnet_get_gw_mac() argument
104 MPASS(g_debugnet_pcb_inuse && pcb == &g_dnet_pcb && in debugnet_get_gw_mac()
105 pcb->dp_state >= DN_STATE_HAVE_GW_MAC); in debugnet_get_gw_mac()
106 return (pcb->dp_gw_mac.octet); in debugnet_get_gw_mac()
167 debugnet_udp_output(struct debugnet_pcb *pcb, struct mbuf *m) in debugnet_udp_output() argument
171 MPASS(pcb->dp_state >= DN_STATE_HAVE_GW_MAC); in debugnet_udp_output()
182 udp->uh_sport = htons(pcb->dp_client_port); in debugnet_udp_output()
183 udp->uh_dport = htons(pcb->dp_server_port); in debugnet_udp_output()
187 return (debugnet_ip_output(pcb, m)); in debugnet_udp_output()
191 debugnet_ack_output(struct debugnet_pcb *pcb, uint32_t seqno /* net endian */) in debugnet_ack_output() argument
209 return (debugnet_udp_output(pcb, m)); in debugnet_ack_output()
236 debugnet_send(struct debugnet_pcb *pcb, uint32_t type, const void *data, in debugnet_send() argument
245 if (pcb->dp_state == DN_STATE_REMOTE_CLOSED) in debugnet_send()
249 pcb->dp_rcvd_acks = 0; in debugnet_send()
259 pktlen = min(pktlen, pcb->dp_ifp->if_mtu - in debugnet_send()
266 if ((pcb->dp_rcvd_acks & (1 << i)) != 0) { in debugnet_send()
284 dn_msg_hdr->mh_seqno = htonl(pcb->dp_seqno + i); in debugnet_send()
312 error = debugnet_udp_output(pcb, m); in debugnet_send()
330 while (pcb->dp_rcvd_acks != want_acks) { in debugnet_send()
337 debugnet_network_poll(pcb); in debugnet_send()
339 if (pcb->dp_state == DN_STATE_REMOTE_CLOSED) in debugnet_send()
342 pcb->dp_seqno += i; in debugnet_send()
355 debugnet_handle_rx_msg(struct debugnet_pcb *pcb, struct mbuf **mb) in debugnet_handle_rx_msg() argument
389 error = debugnet_ack_output(pcb, dnh->mh_seqno); in debugnet_handle_rx_msg()
395 pcb->dp_state = DN_STATE_REMOTE_CLOSED; in debugnet_handle_rx_msg()
403 pcb->dp_rx_handler(pcb, mb); in debugnet_handle_rx_msg()
407 debugnet_handle_ack(struct debugnet_pcb *pcb, struct mbuf **mb, uint16_t sport) in debugnet_handle_ack() argument
432 if (pcb->dp_state < DN_STATE_GOT_HERALD_PORT) { in debugnet_handle_ack()
433 pcb->dp_server_port = sport; in debugnet_handle_ack()
434 pcb->dp_state = DN_STATE_GOT_HERALD_PORT; in debugnet_handle_ack()
436 if (rcv_ackno >= pcb->dp_seqno + DEBUGNET_MAX_IN_FLIGHT) in debugnet_handle_ack()
438 else if (rcv_ackno >= pcb->dp_seqno) { in debugnet_handle_ack()
440 pcb->dp_rcvd_acks |= 1 << (rcv_ackno - pcb->dp_seqno); in debugnet_handle_ack()
445 debugnet_handle_udp(struct debugnet_pcb *pcb, struct mbuf **mb) in debugnet_handle_udp() argument
471 if (ntohs(udp->uh_dport) != pcb->dp_client_port) { in debugnet_handle_udp()
489 debugnet_handle_ack(pcb, mb, sport); in debugnet_handle_udp()
493 if (pcb->dp_rx_handler == NULL) { in debugnet_handle_udp()
502 debugnet_handle_rx_msg(pcb, mb); in debugnet_handle_udp()
584 debugnet_network_poll(struct debugnet_pcb *pcb) in debugnet_network_poll() argument
588 ifp = pcb->dp_ifp; in debugnet_network_poll()
596 debugnet_free(struct debugnet_pcb *pcb) in debugnet_free() argument
601 MPASS(pcb == &g_dnet_pcb); in debugnet_free()
603 ifp = pcb->dp_ifp; in debugnet_free()
605 if (pcb->dp_drv_input != NULL) in debugnet_free()
606 ifp->if_input = pcb->dp_drv_input; in debugnet_free()
607 if (pcb->dp_event_started) in debugnet_free()
621 struct debugnet_pcb *pcb; in debugnet_connect() local
630 pcb = &g_dnet_pcb; in debugnet_connect()
631 *pcb = (struct debugnet_pcb) { in debugnet_connect()
647 if (pcb->dp_client == INADDR_ANY || pcb->dp_gateway == INADDR_ANY || in debugnet_connect()
648 pcb->dp_ifp == NULL) { in debugnet_connect()
657 .sin_addr.s_addr = pcb->dp_server, in debugnet_connect()
685 if (pcb->dp_client == INADDR_ANY) in debugnet_connect()
686 pcb->dp_client = local_sin->sin_addr.s_addr; in debugnet_connect()
687 if (pcb->dp_gateway == INADDR_ANY && gw_sin != NULL) in debugnet_connect()
688 pcb->dp_gateway = gw_sin->sin_addr.s_addr; in debugnet_connect()
689 if (pcb->dp_ifp == NULL) in debugnet_connect()
690 pcb->dp_ifp = rt_ifp; in debugnet_connect()
693 ifp = pcb->dp_ifp; in debugnet_connect()
698 inet_ntop(AF_INET, &pcb->dp_server, serbuf, sizeof(serbuf)); in debugnet_connect()
699 inet_ntop(AF_INET, &pcb->dp_client, clibuf, sizeof(clibuf)); in debugnet_connect()
700 if (pcb->dp_gateway != INADDR_ANY) in debugnet_connect()
701 inet_ntop(AF_INET, &pcb->dp_gateway, gwbuf, sizeof(gwbuf)); in debugnet_connect()
703 serbuf, pcb->dp_server_port, in debugnet_connect()
704 (pcb->dp_gateway == INADDR_ANY) ? "" : " via ", in debugnet_connect()
705 (pcb->dp_gateway == INADDR_ANY) ? "" : gwbuf, in debugnet_connect()
706 clibuf, pcb->dp_client_port, if_name(ifp)); in debugnet_connect()
724 pcb->dp_event_started = true; in debugnet_connect()
734 pcb->dp_drv_input = ifp->if_input; in debugnet_connect()
740 error = debugnet_arp_gw(pcb); in debugnet_connect()
745 MPASS(pcb->dp_state == DN_STATE_HAVE_GW_MAC); in debugnet_connect()
751 error = debugnet_send(pcb, DEBUGNET_HERALD, dcp->dc_herald_data, in debugnet_connect()
758 *pcb_out = pcb; in debugnet_connect()
762 debugnet_free(pcb); in debugnet_connect()