Lines Matching defs:pcb

159 recv_raw(void *arg, struct raw_pcb *pcb, struct pbuf *p,
190 buf->port = pcb->protocol;
218 recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
228 LWIP_UNUSED_ARG(pcb); /* only used for asserts... */
229 LWIP_ASSERT("recv_udp must have a pcb argument", pcb != NULL);
238 LWIP_ASSERT("recv_udp: recv for wrong pcb!", conn->pcb.udp == pcb);
293 recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
299 LWIP_UNUSED_ARG(pcb);
300 LWIP_ASSERT("recv_tcp must have a pcb argument", pcb != NULL);
309 LWIP_ASSERT("recv_tcp: recv for wrong pcb!", conn->pcb.tcp == pcb);
314 tcp_recved(pcb, p->tot_len);
357 poll_tcp(void *arg, struct tcp_pcb *pcb)
361 LWIP_UNUSED_ARG(pcb);
379 let select mark this pcb as writable again. */
380 if ((conn->pcb.tcp != NULL) && (tcp_sndbuf(conn->pcb.tcp) > TCP_SNDLOWAT) &&
381 (tcp_sndqueuelen(conn->pcb.tcp) < TCP_SNDQUEUELOWAT)) {
393 poll_tcp_needed(void *arg, struct tcp_pcb *pcb)
398 LWIP_UNUSED_ARG(pcb);
409 let select mark this pcb as writable again. */
410 if ((conn->pcb.tcp != NULL) && (tcp_sndbuf(conn->pcb.tcp) > TCP_SNDLOWAT) &&
411 (tcp_sndqueuelen(conn->pcb.tcp) < TCP_SNDQUEUELOWAT)) {
427 sent_tcp(void *arg, struct tcp_pcb *pcb, u16_t len)
431 LWIP_UNUSED_ARG(pcb);
442 let select mark this pcb as writable again. */
443 if ((conn->pcb.tcp != NULL) && (tcp_sndbuf(conn->pcb.tcp) > TCP_SNDLOWAT) &&
444 (tcp_sndqueuelen(conn->pcb.tcp) < TCP_SNDQUEUELOWAT)) {
473 /* when err is called, the pcb is deallocated, so delete the reference */
474 conn->pcb.tcp = NULL;
508 since the pcb has already been deleted! */
545 struct tcp_pcb *pcb;
547 pcb = conn->pcb.tcp;
548 tcp_arg(pcb, conn);
549 tcp_recv(pcb, recv_tcp);
550 tcp_sent(pcb, sent_tcp);
551 tcp_poll(pcb, poll_tcp, NETCONN_TCP_POLL_INTERVAL);
552 tcp_err(pcb, err_tcp);
599 newconn->pcb.tcp = newpcb;
606 /* When returning != ERR_OK, the pcb is aborted in tcp_process(),
608 /* remove all references to this netconn from the pcb */
609 struct tcp_pcb *pcb = newconn->pcb.tcp;
610 tcp_arg(pcb, NULL);
611 tcp_recv(pcb, NULL);
612 tcp_sent(pcb, NULL);
613 tcp_poll(pcb, NULL, 0);
614 tcp_err(pcb, NULL);
615 /* remove reference from to the pcb from this netconn */
616 newconn->pcb.tcp = NULL;
632 * Create a new pcb of a specific type.
646 LWIP_ASSERT("pcb_new: pcb already allocated", msg->conn->pcb.tcp == NULL);
659 msg->conn->pcb.raw = raw_new_ip_type(iptype, msg->msg.n.proto);
660 if (msg->conn->pcb.raw != NULL) {
662 set_raw_pcb_net_group(msg->conn->pcb.raw, group);
666 if (NETCONNTYPE_ISIPV6(msg->conn->type) && msg->conn->pcb.raw->protocol == IP6_NEXTH_ICMP6) {
667 msg->conn->pcb.raw->chksum_reqd = 1;
668 msg->conn->pcb.raw->chksum_offset = 2;
671 raw_recv(msg->conn->pcb.raw, recv_raw, msg->conn);
677 msg->conn->pcb.udp = udp_new_ip_type(iptype);
678 if (msg->conn->pcb.udp != NULL) {
680 set_udp_pcb_net_group(msg->conn->pcb.udp, group);
684 udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_UDPLITE);
688 udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_NOCHKSUM);
690 udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
696 msg->conn->pcb.tcp = tcp_new_ip_type(iptype);
697 if (msg->conn->pcb.tcp != NULL) {
699 set_tcp_pcb_net_group(msg->conn->pcb.tcp, group);
710 if (msg->conn->pcb.ip == NULL) {
716 * Create a new pcb of a specific type inside a netconn.
727 if (msg->conn->pcb.tcp == NULL) {
743 * The corresponding pcb is NOT created!
764 conn->pcb.tcp = NULL;
838 * The pcb is NOT freed (since we might not be in the right thread context do this).
845 LWIP_ASSERT("PCB must be deallocated outside this function", conn->pcb.tcp == NULL);
922 /* pcb might be set to NULL already by err_tcp() */
925 if (newconn->pcb.tcp != NULL) {
926 tcp_abort(newconn->pcb.tcp);
927 newconn->pcb.tcp = NULL;
982 LWIP_ASSERT("pcb already closed", (conn->pcb.tcp != NULL));
985 tpcb = conn->pcb.tcp;
1030 if ((conn->linger >= 0) && (conn->pcb.tcp->unsent || conn->pcb.tcp->unacked)) {
1114 conn->pcb.tcp = NULL;
1137 /* Closing of listen pcb will never fail! */
1138 LWIP_ASSERT("Closing a listen pcb may not fail!", (tpcb->state != LISTEN));
1156 * Delete the pcb inside a netconn.
1205 if (msg->conn->pcb.tcp != NULL) {
1210 raw_remove(msg->conn->pcb.raw);
1215 msg->conn->pcb.udp->recv_arg = NULL;
1216 udp_remove(msg->conn->pcb.udp);
1243 msg->conn->pcb.tcp = NULL;
1258 * Bind a pcb contained in a netconn
1270 if (msg->conn->pcb.tcp != NULL) {
1274 err = raw_bind(msg->conn->pcb.raw, API_EXPR_REF(msg->msg.bc.ipaddr));
1279 err = udp_bind(msg->conn->pcb.udp, API_EXPR_REF(msg->msg.bc.ipaddr), msg->msg.bc.port);
1284 err = tcp_bind(msg->conn->pcb.tcp, API_EXPR_REF(msg->msg.bc.ipaddr), msg->msg.bc.port);
1299 * Bind a pcb contained in a netconn to an interface
1312 struct net_group *group = get_net_group_from_ippcb(msg->conn->pcb.ip);
1323 if ((netif != NULL) && (msg->conn->pcb.tcp != NULL)) {
1328 raw_bind_netif(msg->conn->pcb.raw, netif);
1333 udp_bind_netif(msg->conn->pcb.udp, netif);
1338 tcp_bind_netif(msg->conn->pcb.tcp, netif);
1360 lwip_netconn_do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
1366 LWIP_UNUSED_ARG(pcb);
1402 * Connect a pcb contained inside a netconn
1414 if (msg->conn->pcb.tcp == NULL) {
1421 err = raw_connect(msg->conn->pcb.raw, API_EXPR_REF(msg->msg.bc.ipaddr));
1426 err = udp_connect(msg->conn->pcb.udp, API_EXPR_REF(msg->msg.bc.ipaddr), msg->msg.bc.port);
1438 err = tcp_connect(msg->conn->pcb.tcp, API_EXPR_REF(msg->msg.bc.ipaddr),
1477 * Disconnect a pcb contained inside a netconn
1490 udp_disconnect(msg->conn->pcb.udp);
1502 * Set a TCP pcb contained in a netconn into listen mode
1513 if (msg->conn->pcb.tcp != NULL) {
1517 if (msg->conn->pcb.tcp->state != CLOSED) {
1531 if (ip_addr_cmp(&msg->conn->pcb.ip->local_ip, IP6_ADDR_ANY) &&
1534 IP_SET_TYPE_VAL(msg->conn->pcb.tcp->local_ip, IPADDR_TYPE_ANY);
1535 IP_SET_TYPE_VAL(msg->conn->pcb.tcp->remote_ip, IPADDR_TYPE_ANY);
1539 lpcb = tcp_listen_with_backlog_and_err(msg->conn->pcb.tcp, backlog, &err);
1542 /* in this case, the old pcb is still allocated */
1556 msg->conn->pcb.tcp = lpcb;
1557 tcp_arg(msg->conn->pcb.tcp, msg->conn);
1558 tcp_accept(msg->conn->pcb.tcp, accept_function);
1560 /* since the old pcb is already deallocated, free lpcb now */
1562 msg->conn->pcb.tcp = NULL;
1569 tcp_backlog_set(msg->conn->pcb.tcp, msg->msg.lb.backlog);
1585 * Send some data on a RAW or UDP pcb contained in a netconn
1597 if (msg->conn->pcb.tcp != NULL) {
1602 err = raw_send(msg->conn->pcb.raw, msg->msg.b->p);
1604 err = raw_sendto(msg->conn->pcb.raw, msg->msg.b->p, &msg->msg.b->addr);
1612 err = udp_send_chksum(msg->conn->pcb.udp, msg->msg.b->p,
1615 err = udp_sendto_chksum(msg->conn->pcb.udp, msg->msg.b->p,
1621 err = udp_send(msg->conn->pcb.udp, msg->msg.b->p);
1623 err = udp_sendto(msg->conn->pcb.udp, msg->msg.b->p, &msg->msg.b->addr, msg->msg.b->port);
1642 * Indicate data has been received from a TCP pcb contained in a netconn
1653 if (msg->conn->pcb.tcp != NULL) {
1658 tcp_recved(msg->conn->pcb.tcp, recved);
1667 /** Indicate that a TCP pcb has been accepted
1678 if (msg->conn->pcb.tcp != NULL) {
1680 tcp_backlog_accepted(msg->conn->pcb.tcp);
1713 LWIP_ASSERT("conn->pcb.tcp != NULL", conn->pcb.tcp != NULL);
1744 available = tcp_sndbuf(conn->pcb.tcp);
1771 err = tcp_write(conn->pcb.tcp, dataptr, len, apiflags);
1790 /* non-blocking write did not write everything: mark the pcb non-writable
1791 and let poll_tcp check writable space to mark the pcb writable again */
1794 } else if ((tcp_sndbuf(conn->pcb.tcp) <= TCP_SNDLOWAT) ||
1795 (tcp_sndqueuelen(conn->pcb.tcp) >= TCP_SNDQUEUELOWAT)) {
1797 let select mark this pcb as non-writable. */
1808 out_err = tcp_output(conn->pcb.tcp);
1823 err_t out_err = tcp_output(conn->pcb.tcp);
1866 * Send some data on a TCP pcb contained in a netconn
1883 } else if (msg->conn->pcb.tcp != NULL) {
1930 if (msg->conn->pcb.ip != NULL) {
1933 msg->conn->pcb.ip->local_ip);
1936 msg->conn->pcb.ip->remote_ip);
1944 API_EXPR_DEREF(msg->msg.ad.port) = msg->conn->pcb.raw->protocol;
1954 API_EXPR_DEREF(msg->msg.ad.port) = msg->conn->pcb.udp->local_port;
1956 if ((msg->conn->pcb.udp->flags & UDP_FLAGS_CONNECTED) == 0) {
1959 API_EXPR_DEREF(msg->msg.ad.port) = msg->conn->pcb.udp->remote_port;
1967 ((msg->conn->pcb.tcp->state == CLOSED) || (msg->conn->pcb.tcp->state == LISTEN))) {
1968 /* pcb is not connected and remote name is requested */
1971 API_EXPR_DEREF(msg->msg.ad.port) = (msg->msg.ad.local ? msg->conn->pcb.tcp->local_port : msg->conn->pcb.tcp->remote_port);
1986 * Close or half-shutdown a TCP pcb contained in a netconn
2001 if ((msg->conn->pcb.tcp != NULL) &&
2024 msg->err = tcp_shutdown(msg->conn->pcb.tcp, 1, 0);
2078 if (msg->conn->pcb.tcp != NULL) {
2124 struct net_group *group = get_net_group_from_ippcb(msg->conn->pcb.ip);
2141 if (msg->conn->pcb.tcp != NULL) {