altcp_tcp.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. * @file
  3. * Application layered TCP connection API (to be used from TCPIP thread)<br>
  4. * This interface mimics the tcp callback API to the application while preventing
  5. * direct linking (much like virtual functions).
  6. * This way, an application can make use of other application layer protocols
  7. * on top of TCP without knowing the details (e.g. TLS, proxy connection).
  8. *
  9. * This file contains the base implementation calling into tcp.
  10. */
  11. /*
  12. * Copyright (c) 2017 Simon Goldschmidt
  13. * All rights reserved.
  14. *
  15. * Redistribution and use in source and binary forms, with or without modification,
  16. * are permitted provided that the following conditions are met:
  17. *
  18. * 1. Redistributions of source code must retain the above copyright notice,
  19. * this list of conditions and the following disclaimer.
  20. * 2. Redistributions in binary form must reproduce the above copyright notice,
  21. * this list of conditions and the following disclaimer in the documentation
  22. * and/or other materials provided with the distribution.
  23. * 3. The name of the author may not be used to endorse or promote products
  24. * derived from this software without specific prior written permission.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
  27. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  28. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
  29. * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  30. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
  31. * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  32. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  33. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  34. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  35. * OF SUCH DAMAGE.
  36. *
  37. * This file is part of the lwIP TCP/IP stack.
  38. *
  39. * Author: Simon Goldschmidt <goldsimon@gmx.de>
  40. *
  41. */
  42. #ifndef LWIP_HDR_ALTCP_TCP_H
  43. #define LWIP_HDR_ALTCP_TCP_H
  44. #include "lwip/opt.h"
  45. #if LWIP_ALTCP /* don't build if not configured for use in lwipopts.h */
  46. #include "lwip/altcp.h"
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50. struct altcp_pcb *altcp_tcp_new_ip_type(u8_t ip_type);
  51. #define altcp_tcp_new() altcp_tcp_new_ip_type(IPADDR_TYPE_V4)
  52. #define altcp_tcp_new_ip6() altcp_tcp_new_ip_type(IPADDR_TYPE_V6)
  53. struct altcp_pcb *altcp_tcp_alloc(void *arg, u8_t ip_type);
  54. struct tcp_pcb;
  55. struct altcp_pcb *altcp_tcp_wrap(struct tcp_pcb *tpcb);
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif /* LWIP_ALTCP */
  60. #endif /* LWIP_HDR_ALTCP_TCP_H */