Changeset 58592 in vbox for trunk/src/VBox/Devices/Network/lwip-new
- Timestamp:
- Nov 6, 2015 1:43:02 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 103951
- Location:
- trunk/src/VBox/Devices/Network/lwip-new/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/lwip-new/src/core/tcp.c
r58581 r58592 543 543 #endif /* LWIP_CALLBACK_API */ 544 544 545 #if LWIP_CONNECTION_PROXY 546 /** 547 * Default proxy accept syn callback if no accept callback is specified by the user. 548 */ 549 err_t 550 tcp_accept_syn_null(void *arg, struct tcp_pcb *newpcb, struct pbuf *syn) 551 { 552 LWIP_UNUSED_ARG(arg); 553 LWIP_UNUSED_ARG(syn); 554 555 tcp_abort(newpcb); 556 return ERR_ABRT; 557 } 558 #endif /* LWIP_CONNECTION_PROXY */ 559 545 560 /** 546 561 * Set the state of the connection to be LISTEN, which means that it … … 1559 1574 */ 1560 1575 void 1561 tcp_proxy_accept(tcp_accept_ fn accept)1562 { 1563 tcp_proxy_accept_callback = accept ;1576 tcp_proxy_accept(tcp_accept_syn_fn accept_syn) 1577 { 1578 tcp_proxy_accept_callback = accept_syn; 1564 1579 } 1565 1580 … … 1571 1586 */ 1572 1587 void 1573 tcp_accept_syn(struct tcp_pcb *pcb, tcp_accept_ fn accept)1588 tcp_accept_syn(struct tcp_pcb *pcb, tcp_accept_syn_fn accept_syn) 1574 1589 { 1575 1590 struct tcp_pcb_listen *lpcb; … … 1578 1593 lpcb = (struct tcp_pcb_listen *)pcb; 1579 1594 1580 lpcb->accept = accept;1595 lpcb->accept = (tcp_accept_fn)accept_syn; 1581 1596 lpcb->accept_on_syn = 1; 1582 1597 } -
trunk/src/VBox/Devices/Network/lwip-new/src/core/tcp_in.c
r58589 r58592 64 64 65 65 #if LWIP_CONNECTION_PROXY 66 tcp_accept_ fn tcp_proxy_accept_callback = tcp_accept_null;66 tcp_accept_syn_fn tcp_proxy_accept_callback = tcp_accept_syn_null; 67 67 #endif 68 68 … … 90 90 static void tcp_parseopt(struct tcp_pcb *pcb); 91 91 92 static err_t tcp_listen_input(struct tcp_pcb_listen *pcb );92 static err_t tcp_listen_input(struct tcp_pcb_listen *pcb, struct pbuf *syn); 93 93 static err_t tcp_timewait_input(struct tcp_pcb *pcb); 94 94 95 95 #if LWIP_CONNECTION_PROXY 96 static err_t tcp_proxy_listen_input(struct pbuf * p);96 static err_t tcp_proxy_listen_input(struct pbuf *syn); 97 97 static void tcp_restore_pbuf(struct pbuf *p); 98 98 … … 314 314 315 315 LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packed for LISTENing connection.\n")); 316 tcp_listen_input(lpcb );316 tcp_listen_input(lpcb, p); 317 317 pbuf_free(p); 318 318 return; … … 498 498 */ 499 499 static err_t 500 tcp_listen_input(struct tcp_pcb_listen *pcb )500 tcp_listen_input(struct tcp_pcb_listen *pcb, struct pbuf *syn) 501 501 { 502 502 struct tcp_pcb *npcb; … … 572 572 /* Early accept on SYN, like we do in tcp_proxy_listen_input() */ 573 573 if (pcb->accept_on_syn) { 574 tcp_accept_syn_fn accept_syn; 574 575 err_t err; 575 576 … … 578 579 579 580 /* 580 * XXX: TODO: how to pass syn pbuf? Need to be consistent with 581 * proxy version, but can't abuse callback_arg here since it's 582 * actually used in this case. 581 * Call the accept syn function. Note, that it comes from the 582 * listening pcb and we reset the normal accept callback of the 583 * new pcb. The latter should be set by the client along with 584 * other callbacks if necessary. 583 585 */ 584 /* Call the accept function. */ 585 TCP_EVENT_ACCEPT(npcb, ERR_OK, err); 586 accept_syn = (tcp_accept_syn_fn)npcb->accept; 587 npcb->accept = tcp_accept_null; 588 589 /* TCP_EVENT_ACCEPT_SYN */ 590 if (accept_syn != NULL) 591 err = (*accept_syn)(npcb->callback_arg, npcb, syn); 592 else 593 err = ERR_ARG; 594 586 595 if (err != ERR_OK) { 587 596 /* If the accept function returns with an error, we abort … … 645 654 */ 646 655 static err_t 647 tcp_proxy_listen_input(struct pbuf * p)656 tcp_proxy_listen_input(struct pbuf *syn) 648 657 { 649 658 struct tcp_pcb *npcb; … … 700 709 npcb->callback_arg = /* pcb->callback_arg */ NULL; 701 710 #if LWIP_CALLBACK_API 702 npcb->accept = /* pcb->accept */ tcp_ proxy_accept_callback;711 npcb->accept = /* pcb->accept */ tcp_accept_null; 703 712 #endif /* LWIP_CALLBACK_API */ 704 713 /* inherit socket options */ … … 733 742 */ 734 743 735 tcp_restore_pbuf(p); 736 npcb->callback_arg = (void *)p; 737 738 /* Call the accept function. */ 739 TCP_EVENT_ACCEPT(npcb, ERR_OK, err); 744 tcp_restore_pbuf(syn); 745 746 /* TCP_EVENT_ACCEPT_SYN */ 747 if (tcp_proxy_accept_callback != NULL) 748 err = (*tcp_proxy_accept_callback)(NULL, npcb, syn); 749 else 750 err = ERR_ARG; 751 740 752 if (err != ERR_OK) { 741 753 /* If the accept function returns with an error, we abort -
trunk/src/VBox/Devices/Network/lwip-new/src/include/lwip/tcp.h
r58555 r58592 61 61 */ 62 62 typedef err_t (*tcp_accept_fn)(void *arg, struct tcp_pcb *newpcb, err_t err); 63 64 #if LWIP_CONNECTION_PROXY 65 /** Function prototype for tcp accept callback functions. Called when 66 * a new connection is about to be accepted by the proxy or on a 67 * listening pcb that requested proxy-like accept on syn. 68 * 69 * @param arg Additional argument to pass to the callback function (@see tcp_arg()) 70 * @param newpcb The new connection pcb 71 * @param syn The pbuf with the SYN segment (may be used to reply with ICMP). 72 */ 73 typedef err_t (*tcp_accept_syn_fn)(void *arg, struct tcp_pcb *newpcb, struct pbuf *syn); 74 #endif /* LWIP_CONNECTION_PROXY */ 63 75 64 76 /** Function prototype for tcp receive callback functions. Called when data has … … 333 345 /* when proxied connection is accepted there's no listening pcb */ 334 346 void tcp_proxy_arg(void *arg); 335 void tcp_proxy_accept(tcp_accept_ fn accept);347 void tcp_proxy_accept(tcp_accept_syn_fn accept); 336 348 /* but we also provide proxy-like early accept for listening pcbs */ 337 void tcp_accept_syn(struct tcp_pcb *lpcb, tcp_accept_ fn accept);349 void tcp_accept_syn(struct tcp_pcb *lpcb, tcp_accept_syn_fn accept); 338 350 #endif 339 351 void tcp_recv (struct tcp_pcb *pcb, tcp_recv_fn recv); -
trunk/src/VBox/Devices/Network/lwip-new/src/include/lwip/tcp_impl.h
r58581 r58592 314 314 315 315 #if LWIP_CONNECTION_PROXY 316 extern tcp_accept_ fn tcp_proxy_accept_callback;316 extern tcp_accept_syn_fn tcp_proxy_accept_callback; 317 317 #endif 318 318 … … 489 489 #endif /* LWIP_CALLBACK_API */ 490 490 491 #if LWIP_CONNECTION_PROXY 492 err_t tcp_accept_syn_null(void *arg, struct tcp_pcb *newpcb, struct pbuf *syn); 493 #endif /* LWIP_CONNECTION_PROXY */ 494 491 495 #if TCP_DEBUG || TCP_INPUT_DEBUG || TCP_OUTPUT_DEBUG 492 496 void tcp_debug_print(struct tcp_hdr *tcphdr);
Note:
See TracChangeset
for help on using the changeset viewer.