Lines Matching defs:pcb
249 struct altcp_pcb *pcb;
308 static err_t http_close_conn(struct altcp_pcb *pcb, struct http_state *hs);
309 static err_t http_close_or_abort_conn(struct altcp_pcb *pcb, struct http_state *hs, u8_t abort_conn);
312 static err_t http_poll(void *arg, struct altcp_pcb *pcb);
313 static u8_t http_check_eof(struct altcp_pcb *pcb, struct http_state *hs);
403 LWIP_ASSERT("hs_free_next->next->pcb != NULL", hs_free_next->next->pcb != NULL);
405 http_close_or_abort_conn(hs_free_next->next->pcb, hs_free_next->next, 1); /* this also unlinks the http_state from the list */
525 * @param pcb altcp_pcb to send
533 http_write(struct altcp_pcb *pcb, const void *ptr, u16_t *length, u8_t apiflags)
543 max_len = altcp_sndbuf(pcb);
549 max_len = HTTPD_MAX_WRITE_LEN(pcb);
556 err = altcp_write(pcb, ptr, len, apiflags);
558 if ((altcp_sndbuf(pcb) == 0) ||
559 (altcp_sndqueuelen(pcb) >= TCP_SND_QUEUELEN)) {
582 altcp_nagle_enable(pcb);
592 * @param pcb the tcp pcb to reset callbacks
596 http_close_or_abort_conn(struct altcp_pcb *pcb, struct http_state *hs, u8_t abort_conn)
599 LWIP_DEBUGF(HTTPD_DEBUG, ("Closing connection %p\n", (void *)pcb));
616 altcp_arg(pcb, NULL);
617 altcp_recv(pcb, NULL);
618 altcp_err(pcb, NULL);
619 altcp_poll(pcb, NULL, 0);
620 altcp_sent(pcb, NULL);
626 altcp_abort(pcb);
629 err = altcp_close(pcb);
631 LWIP_DEBUGF(HTTPD_DEBUG, ("Error %d closing %p\n", err, (void *)pcb));
633 altcp_poll(pcb, http_poll, HTTPD_POLL_INTERVAL);
642 * @param pcb the tcp pcb to reset callbacks
646 http_close_conn(struct altcp_pcb *pcb, struct http_state *hs)
648 return http_close_or_abort_conn(pcb, hs, 0);
655 http_eof(struct altcp_pcb *pcb, struct http_state *hs)
665 hs->pcb = pcb;
669 altcp_nagle_disable(pcb);
673 http_close_conn(pcb, hs);
995 * - HTTP_DATA_TO_SEND_FREED: http_state and pcb are already freed
998 http_send_headers(struct altcp_pcb *pcb, struct http_state *hs)
1011 len = altcp_sndbuf(pcb);
1036 err = http_write(pcb, ptr, &sendlen, apiflags);
1066 if (http_check_eof(pcb, hs)) {
1070 pcb is closed. */
1093 http_check_eof(struct altcp_pcb *pcb, struct http_state *hs)
1106 http_eof(pcb, hs);
1113 http_eof(pcb, hs);
1123 count = altcp_sndbuf(pcb);
1129 max_write_len = HTTPD_MAX_WRITE_LEN(pcb);
1166 http_eof(pcb, hs);
1192 http_send_data_nonssi(struct altcp_pcb *pcb, struct http_state *hs)
1202 err = http_write(pcb, hs->file, &len, HTTP_IS_DATA_VOLATILE(hs));
1219 http_send_data_ssi(struct altcp_pcb *pcb, struct http_state *hs)
1234 len = altcp_sndbuf(pcb);
1240 err = http_write(pcb, hs->file, &len, HTTP_IS_DATA_VOLATILE(hs));
1248 if (altcp_sndbuf(pcb) == 0) {
1432 err = http_write(pcb, hs->file, &len, HTTP_IS_DATA_VOLATILE(hs));
1473 err = http_write(pcb, hs->file, &len, HTTP_IS_DATA_VOLATILE(hs));
1510 err = http_write(pcb, &(ssi->tag_insert[ssi->tag_index]), &len,
1557 err = http_write(pcb, hs->file, &len, HTTP_IS_DATA_VOLATILE(hs));
1569 * Try to send more data on this pcb.
1571 * @param pcb the pcb to send data
1575 http_send(struct altcp_pcb *pcb, struct http_state *hs)
1579 LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("http_send: pcb=%p hs=%p left=%d\n", (void *)pcb,
1604 data_to_send = http_send_headers(pcb, hs);
1616 if (!http_check_eof(pcb, hs)) {
1623 data_to_send = http_send_data_ssi(pcb, hs);
1627 data_to_send = http_send_data_nonssi(pcb, hs);
1634 http_eof(pcb, hs);
1918 if (hs->pcb != NULL) {
1920 altcp_recved(hs->pcb, len);
1925 http_send(hs->pcb, hs);
1944 if (hs && (hs->pcb) && (hs->handle)) {
1945 LWIP_ASSERT("hs->pcb != NULL", hs->pcb != NULL);
1947 if (http_send(hs->pcb, hs)) {
1950 altcp_output(hs->pcb);
1962 * @param pcb the altcp_pcb which received this packet
1968 http_parse_request(struct pbuf *inp, struct http_state *hs, struct altcp_pcb *pcb)
1981 LWIP_UNUSED_ARG(pcb); /* only used for post */
2436 * The pcb had an error and is already deallocated.
2457 http_sent(void *arg, struct altcp_pcb *pcb, u16_t len)
2461 LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("http_sent %p\n", (void *)pcb));
2471 http_send(pcb, hs);
2484 http_poll(void *arg, struct altcp_pcb *pcb)
2487 LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("http_poll: pcb=%p hs=%p pcb_state=%s\n",
2488 (void *)pcb, (void *)hs, tcp_debug_state_str(altcp_dbg_get_tcp_state(pcb))));
2494 closed = http_close_conn(pcb, NULL);
2498 altcp_abort(pcb);
2507 http_close_conn(pcb, hs);
2516 if (http_send(pcb, hs)) {
2519 altcp_output(pcb);
2528 * Data has been received on this pcb.
2532 http_recv(void *arg, struct altcp_pcb *pcb, struct pbuf *p, err_t err)
2535 LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("http_recv: pcb=%p pbuf=%p err=%s\n", (void *)pcb,
2542 altcp_recved(pcb, p->tot_len);
2549 http_close_conn(pcb, hs);
2560 altcp_recved(pcb, p->tot_len);
2572 http_send(pcb, hs);
2579 err_t parsed = http_parse_request(p, hs, pcb);
2598 http_send(pcb, hs);
2602 http_close_conn(pcb, hs);
2617 http_accept(void *arg, struct altcp_pcb *pcb, err_t err)
2622 LWIP_DEBUGF(HTTPD_DEBUG, ("http_accept %p / %p\n", (void *)pcb, arg));
2624 if ((err != ERR_OK) || (pcb == NULL)) {
2629 altcp_setprio(pcb, HTTPD_TCP_PRIO);
2638 hs->pcb = pcb;
2642 altcp_arg(pcb, hs);
2645 altcp_recv(pcb, http_recv);
2646 altcp_err(pcb, http_err);
2647 altcp_poll(pcb, http_poll, HTTPD_POLL_INTERVAL);
2648 altcp_sent(pcb, http_sent);
2654 httpd_init_pcb(struct altcp_pcb *pcb, u16_t port)
2658 if (pcb) {
2659 altcp_setprio(pcb, HTTPD_TCP_PRIO);
2661 err = altcp_bind(pcb, IP_ANY_TYPE, port);
2664 pcb = altcp_listen(pcb);
2665 LWIP_ASSERT("httpd_init: tcp_listen failed", pcb != NULL);
2666 altcp_accept(pcb, http_accept);
2677 struct altcp_pcb *pcb;
2689 pcb = altcp_tcp_new_ip_type(IPADDR_TYPE_ANY);
2690 LWIP_ASSERT("httpd_init: tcp_new failed", pcb != NULL);
2691 httpd_init_pcb(pcb, HTTPD_SERVER_PORT);