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
lwip_altcp_alloc.c
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 * This file contains allocation implementation that combine several layers. 00010 */ 00011 00012 /* 00013 * Copyright (c) 2017 Simon Goldschmidt 00014 * All rights reserved. 00015 * 00016 * Redistribution and use in source and binary forms, with or without modification, 00017 * are permitted provided that the following conditions are met: 00018 * 00019 * 1. Redistributions of source code must retain the above copyright notice, 00020 * this list of conditions and the following disclaimer. 00021 * 2. Redistributions in binary form must reproduce the above copyright notice, 00022 * this list of conditions and the following disclaimer in the documentation 00023 * and/or other materials provided with the distribution. 00024 * 3. The name of the author may not be used to endorse or promote products 00025 * derived from this software without specific prior written permission. 00026 * 00027 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00028 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00029 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00030 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00031 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00032 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00033 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00034 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00035 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00036 * OF SUCH DAMAGE. 00037 * 00038 * This file is part of the lwIP TCP/IP stack. 00039 * 00040 * Author: Simon Goldschmidt <goldsimon@gmx.de> 00041 * 00042 */ 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/altcp_tcp.h" 00050 #include "lwip/altcp_tls.h" 00051 #include "lwip/priv/altcp_priv.h" 00052 #include "lwip/mem.h" 00053 00054 #include <string.h> 00055 00056 #if LWIP_ALTCP_TLS 00057 00058 /** This standard allocator function creates an altcp pcb for 00059 * TLS over TCP */ 00060 struct altcp_pcb * 00061 altcp_tls_new(struct altcp_tls_config *config, u8_t ip_type) 00062 { 00063 struct altcp_pcb *inner_conn, *ret; 00064 LWIP_UNUSED_ARG(ip_type); 00065 00066 inner_conn = altcp_tcp_new_ip_type(ip_type); 00067 if (inner_conn == NULL) { 00068 return NULL; 00069 } 00070 ret = altcp_tls_wrap(config, inner_conn); 00071 if (ret == NULL) { 00072 altcp_close (inner_conn); 00073 } 00074 return ret; 00075 } 00076 00077 /** This standard allocator function creates an altcp pcb for 00078 * TLS over TCP */ 00079 struct altcp_pcb * 00080 altcp_tls_alloc(void *arg, u8_t ip_type) 00081 { 00082 return altcp_tls_new((struct altcp_tls_config *)arg, ip_type); 00083 } 00084 00085 #endif /* LWIP_ALTCP_TLS */ 00086 00087 #endif /* LWIP_ALTCP */
Generated on Tue Jul 12 2022 13:54:27 by
