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
tcpip_priv.h
00001 /** 00002 * @file 00003 * TCPIP API internal implementations (do not use in application code) 00004 */ 00005 00006 /* 00007 * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without modification, 00011 * are permitted provided that the following conditions are met: 00012 * 00013 * 1. Redistributions of source code must retain the above copyright notice, 00014 * this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright notice, 00016 * this list of conditions and the following disclaimer in the documentation 00017 * and/or other materials provided with the distribution. 00018 * 3. The name of the author may not be used to endorse or promote products 00019 * derived from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00022 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00024 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00025 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00026 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00027 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00028 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00029 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00030 * OF SUCH DAMAGE. 00031 * 00032 * This file is part of the lwIP TCP/IP stack. 00033 * 00034 * Author: Adam Dunkels <adam@sics.se> 00035 * 00036 */ 00037 #ifndef LWIP_HDR_TCPIP_PRIV_H 00038 #define LWIP_HDR_TCPIP_PRIV_H 00039 00040 #include "lwip/opt.h" 00041 00042 #if !NO_SYS /* don't build if not configured for use in lwipopts.h */ 00043 00044 #include "lwip/tcpip.h" 00045 #include "lwip/sys.h" 00046 #include "lwip/timeouts.h" 00047 00048 #ifdef __cplusplus 00049 extern "C" { 00050 #endif 00051 00052 struct pbuf; 00053 struct netif; 00054 00055 #if LWIP_MPU_COMPATIBLE 00056 #define API_VAR_REF(name) (*(name)) 00057 #define API_VAR_DECLARE(type, name) type * name 00058 #define API_VAR_ALLOC_EXT(type, pool, name, errorblock) do { \ 00059 name = (type *)memp_malloc(pool); \ 00060 if (name == NULL) { \ 00061 errorblock; \ 00062 } \ 00063 } while(0) 00064 #define API_VAR_ALLOC(type, pool, name, errorval) API_VAR_ALLOC_EXT(type, pool, name, return errorval) 00065 #define API_VAR_ALLOC_POOL(type, pool, name, errorval) do { \ 00066 name = (type *)LWIP_MEMPOOL_ALLOC(pool); \ 00067 if (name == NULL) { \ 00068 return errorval; \ 00069 } \ 00070 } while(0) 00071 #define API_VAR_FREE(pool, name) memp_free(pool, name) 00072 #define API_VAR_FREE_POOL(pool, name) LWIP_MEMPOOL_FREE(pool, name) 00073 #define API_EXPR_REF(expr) (&(expr)) 00074 #if LWIP_NETCONN_SEM_PER_THREAD 00075 #define API_EXPR_REF_SEM(expr) (expr) 00076 #else 00077 #define API_EXPR_REF_SEM(expr) API_EXPR_REF(expr) 00078 #endif 00079 #define API_EXPR_DEREF(expr) expr 00080 #define API_MSG_M_DEF(m) m 00081 #define API_MSG_M_DEF_C(t, m) t m 00082 #else /* LWIP_MPU_COMPATIBLE */ 00083 #define API_VAR_REF(name) name 00084 #define API_VAR_DECLARE(type, name) type name 00085 #define API_VAR_ALLOC_EXT(type, pool, name, errorblock) 00086 #define API_VAR_ALLOC(type, pool, name, errorval) 00087 #define API_VAR_ALLOC_POOL(type, pool, name, errorval) 00088 #define API_VAR_FREE(pool, name) 00089 #define API_VAR_FREE_POOL(pool, name) 00090 #define API_EXPR_REF(expr) expr 00091 #define API_EXPR_REF_SEM(expr) API_EXPR_REF(expr) 00092 #define API_EXPR_DEREF(expr) (*(expr)) 00093 #define API_MSG_M_DEF(m) *m 00094 #define API_MSG_M_DEF_C(t, m) const t * m 00095 #endif /* LWIP_MPU_COMPATIBLE */ 00096 00097 err_t tcpip_send_msg_wait_sem(tcpip_callback_fn fn, void *apimsg, sys_sem_t* sem); 00098 00099 struct tcpip_api_call_data 00100 { 00101 #if !LWIP_TCPIP_CORE_LOCKING 00102 err_t err; 00103 #if !LWIP_NETCONN_SEM_PER_THREAD 00104 sys_sem_t sem; 00105 #endif /* LWIP_NETCONN_SEM_PER_THREAD */ 00106 #else /* !LWIP_TCPIP_CORE_LOCKING */ 00107 u8_t dummy; /* avoid empty struct :-( */ 00108 #endif /* !LWIP_TCPIP_CORE_LOCKING */ 00109 }; 00110 typedef err_t (*tcpip_api_call_fn)(struct tcpip_api_call_data* call); 00111 err_t tcpip_api_call(tcpip_api_call_fn fn, struct tcpip_api_call_data *call); 00112 00113 enum tcpip_msg_type { 00114 #if !LWIP_TCPIP_CORE_LOCKING 00115 TCPIP_MSG_API, 00116 TCPIP_MSG_API_CALL, 00117 #endif /* !LWIP_TCPIP_CORE_LOCKING */ 00118 #if !LWIP_TCPIP_CORE_LOCKING_INPUT 00119 TCPIP_MSG_INPKT, 00120 #endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */ 00121 #if LWIP_TCPIP_TIMEOUT && LWIP_TIMERS 00122 TCPIP_MSG_TIMEOUT, 00123 TCPIP_MSG_UNTIMEOUT, 00124 #endif /* LWIP_TCPIP_TIMEOUT && LWIP_TIMERS */ 00125 TCPIP_MSG_CALLBACK, 00126 TCPIP_MSG_CALLBACK_STATIC 00127 }; 00128 00129 struct tcpip_msg { 00130 enum tcpip_msg_type type; 00131 union { 00132 #if !LWIP_TCPIP_CORE_LOCKING 00133 struct { 00134 tcpip_callback_fn function; 00135 void* msg; 00136 } api_msg; 00137 struct { 00138 tcpip_api_call_fn function; 00139 struct tcpip_api_call_data *arg; 00140 sys_sem_t *sem; 00141 } api_call; 00142 #endif /* LWIP_TCPIP_CORE_LOCKING */ 00143 #if !LWIP_TCPIP_CORE_LOCKING_INPUT 00144 struct { 00145 struct pbuf *p; 00146 struct netif *netif; 00147 netif_input_fn input_fn; 00148 } inp; 00149 #endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */ 00150 struct { 00151 tcpip_callback_fn function; 00152 void *ctx; 00153 } cb; 00154 #if LWIP_TCPIP_TIMEOUT && LWIP_TIMERS 00155 struct { 00156 u32_t msecs; 00157 sys_timeout_handler h; 00158 void *arg; 00159 } tmo; 00160 #endif /* LWIP_TCPIP_TIMEOUT && LWIP_TIMERS */ 00161 } msg; 00162 }; 00163 00164 #ifdef __cplusplus 00165 } 00166 #endif 00167 00168 #endif /* !NO_SYS */ 00169 00170 #endif /* LWIP_HDR_TCPIP_PRIV_H */
Generated on Tue Jul 12 2022 13:54:55 by
