Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
altcp_priv.h
00001 /** 00002 * @file 00003 * Application layered TCP connection API (to be used from TCPIP thread)\n 00004 * This interface mimics the tcp callback API to the application while preventing 00005 * direct linking (much like virtual functions). 00006 * This way, an application can make use of other application layer protocols 00007 * on top of TCP without knowing the details (e.g. TLS, proxy connection). 00008 */ 00009 00010 /* 00011 * Copyright (c) 2017 Simon Goldschmidt 00012 * All rights reserved. 00013 * 00014 * Redistribution and use in source and binary forms, with or without modification, 00015 * are permitted provided that the following conditions are met: 00016 * 00017 * 1. Redistributions of source code must retain the above copyright notice, 00018 * this list of conditions and the following disclaimer. 00019 * 2. Redistributions in binary form must reproduce the above copyright notice, 00020 * this list of conditions and the following disclaimer in the documentation 00021 * and/or other materials provided with the distribution. 00022 * 3. The name of the author may not be used to endorse or promote products 00023 * derived from this software without specific prior written permission. 00024 * 00025 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00026 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00027 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00028 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00029 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00030 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00031 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00032 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00033 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00034 * OF SUCH DAMAGE. 00035 * 00036 * This file is part of the lwIP TCP/IP stack. 00037 * 00038 * Author: Simon Goldschmidt <goldsimon@gmx.de> 00039 * 00040 */ 00041 #ifndef LWIP_HDR_ALTCP_PRIV_H 00042 #define LWIP_HDR_ALTCP_PRIV_H 00043 00044 #include "lwip/opt.h" 00045 00046 #if LWIP_ALTCP /* don't build if not configured for use in lwipopts.h */ 00047 00048 #include "lwip/altcp.h" 00049 #include "lwip/ip_addr.h" 00050 00051 #ifdef __cplusplus 00052 extern "C" { 00053 #endif 00054 00055 struct altcp_pcb *altcp_alloc(void); 00056 void altcp_free(struct altcp_pcb *conn); 00057 00058 /* Function prototypes for application layers */ 00059 typedef void (*altcp_set_poll_fn)(struct altcp_pcb *conn, u8_t interval); 00060 typedef void (*altcp_recved_fn)(struct altcp_pcb *conn, u16_t len); 00061 typedef err_t (*altcp_bind_fn)(struct altcp_pcb *conn, const ip_addr_t *ipaddr, u16_t port); 00062 typedef err_t (*altcp_connect_fn)(struct altcp_pcb *conn, const ip_addr_t *ipaddr, u16_t port, altcp_connected_fn connected); 00063 00064 typedef struct altcp_pcb *(*altcp_listen_fn)(struct altcp_pcb *conn, u8_t backlog, err_t *err); 00065 00066 typedef void (*altcp_abort_fn)(struct altcp_pcb *conn); 00067 typedef err_t (*altcp_close_fn)(struct altcp_pcb *conn); 00068 typedef err_t (*altcp_shutdown_fn)(struct altcp_pcb *conn, int shut_rx, int shut_tx); 00069 00070 typedef err_t (*altcp_write_fn)(struct altcp_pcb *conn, const void *dataptr, u16_t len, u8_t apiflags); 00071 typedef err_t (*altcp_output_fn)(struct altcp_pcb *conn); 00072 00073 typedef u16_t (*altcp_mss_fn)(struct altcp_pcb *conn); 00074 typedef u16_t (*altcp_sndbuf_fn)(struct altcp_pcb *conn); 00075 typedef u16_t (*altcp_sndqueuelen_fn)(struct altcp_pcb *conn); 00076 typedef void (*altcp_nagle_disable_fn)(struct altcp_pcb *conn); 00077 typedef void (*altcp_nagle_enable_fn)(struct altcp_pcb *conn); 00078 typedef int (*altcp_nagle_disabled_fn)(struct altcp_pcb *conn); 00079 00080 typedef void (*altcp_setprio_fn)(struct altcp_pcb *conn, u8_t prio); 00081 00082 typedef void (*altcp_dealloc_fn)(struct altcp_pcb *conn); 00083 00084 typedef err_t (*altcp_get_tcp_addrinfo_fn)(struct altcp_pcb *conn, int local, ip_addr_t *addr, u16_t *port); 00085 typedef ip_addr_t *(*altcp_get_ip_fn)(struct altcp_pcb *conn, int local); 00086 typedef u16_t (*altcp_get_port_fn)(struct altcp_pcb *conn, int local); 00087 00088 #ifdef LWIP_DEBUG 00089 typedef enum tcp_state (*altcp_dbg_get_tcp_state_fn)(struct altcp_pcb *conn); 00090 #endif 00091 00092 struct altcp_functions { 00093 altcp_set_poll_fn set_poll; 00094 altcp_recved_fn recved; 00095 altcp_bind_fn bind; 00096 altcp_connect_fn connect; 00097 altcp_listen_fn listen; 00098 altcp_abort_fn abort; 00099 altcp_close_fn close; 00100 altcp_shutdown_fn shutdown; 00101 altcp_write_fn write; 00102 altcp_output_fn output; 00103 altcp_mss_fn mss; 00104 altcp_sndbuf_fn sndbuf; 00105 altcp_sndqueuelen_fn sndqueuelen; 00106 altcp_nagle_disable_fn nagle_disable; 00107 altcp_nagle_enable_fn nagle_enable; 00108 altcp_nagle_disabled_fn nagle_disabled; 00109 altcp_setprio_fn setprio; 00110 altcp_dealloc_fn dealloc; 00111 altcp_get_tcp_addrinfo_fn addrinfo; 00112 altcp_get_ip_fn getip; 00113 altcp_get_port_fn getport; 00114 #ifdef LWIP_DEBUG 00115 altcp_dbg_get_tcp_state_fn dbg_get_tcp_state; 00116 #endif 00117 }; 00118 00119 void altcp_default_set_poll(struct altcp_pcb *conn, u8_t interval); 00120 void altcp_default_recved(struct altcp_pcb *conn, u16_t len); 00121 err_t altcp_default_bind(struct altcp_pcb *conn, const ip_addr_t *ipaddr, u16_t port); 00122 err_t altcp_default_shutdown(struct altcp_pcb *conn, int shut_rx, int shut_tx); 00123 err_t altcp_default_write(struct altcp_pcb *conn, const void *dataptr, u16_t len, u8_t apiflags); 00124 err_t altcp_default_output(struct altcp_pcb *conn); 00125 u16_t altcp_default_mss(struct altcp_pcb *conn); 00126 u16_t altcp_default_sndbuf(struct altcp_pcb *conn); 00127 u16_t altcp_default_sndqueuelen(struct altcp_pcb *conn); 00128 void altcp_default_nagle_disable(struct altcp_pcb *conn); 00129 void altcp_default_nagle_enable(struct altcp_pcb *conn); 00130 int altcp_default_nagle_disabled(struct altcp_pcb *conn); 00131 void altcp_default_setprio(struct altcp_pcb *conn, u8_t prio); 00132 void altcp_default_dealloc(struct altcp_pcb *conn); 00133 err_t altcp_default_get_tcp_addrinfo(struct altcp_pcb *conn, int local, ip_addr_t *addr, u16_t *port); 00134 ip_addr_t *altcp_default_get_ip(struct altcp_pcb *conn, int local); 00135 u16_t altcp_default_get_port(struct altcp_pcb *conn, int local); 00136 #ifdef LWIP_DEBUG 00137 enum tcp_state altcp_default_dbg_get_tcp_state(struct altcp_pcb *conn); 00138 #endif 00139 00140 #ifdef __cplusplus 00141 } 00142 #endif 00143 00144 #endif /* LWIP_ALTCP */ 00145 00146 #endif /* LWIP_HDR_ALTCP_PRIV_H */
Generated on Tue Jul 12 2022 13:54:00 by
