This is lwip library for WlanBP3595 library. We forked lwip library. We extended TCP/IP thread stack size.
Fork of lwip by
include/lwip/tcpip.h@0:51ac1d130fd4, 2012-06-22 (annotated)
- Committer:
- mbed_official
- Date:
- Fri Jun 22 09:25:39 2012 +0000
- Revision:
- 0:51ac1d130fd4
Initial import from lwip-1.4.0: http://download.savannah.gnu.org/releases/lwip/lwip-1.4.0.zip
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 0:51ac1d130fd4 | 1 | /* |
mbed_official | 0:51ac1d130fd4 | 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. |
mbed_official | 0:51ac1d130fd4 | 3 | * All rights reserved. |
mbed_official | 0:51ac1d130fd4 | 4 | * |
mbed_official | 0:51ac1d130fd4 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 0:51ac1d130fd4 | 6 | * are permitted provided that the following conditions are met: |
mbed_official | 0:51ac1d130fd4 | 7 | * |
mbed_official | 0:51ac1d130fd4 | 8 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 0:51ac1d130fd4 | 9 | * this list of conditions and the following disclaimer. |
mbed_official | 0:51ac1d130fd4 | 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 0:51ac1d130fd4 | 11 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 0:51ac1d130fd4 | 12 | * and/or other materials provided with the distribution. |
mbed_official | 0:51ac1d130fd4 | 13 | * 3. The name of the author may not be used to endorse or promote products |
mbed_official | 0:51ac1d130fd4 | 14 | * derived from this software without specific prior written permission. |
mbed_official | 0:51ac1d130fd4 | 15 | * |
mbed_official | 0:51ac1d130fd4 | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
mbed_official | 0:51ac1d130fd4 | 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
mbed_official | 0:51ac1d130fd4 | 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
mbed_official | 0:51ac1d130fd4 | 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
mbed_official | 0:51ac1d130fd4 | 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
mbed_official | 0:51ac1d130fd4 | 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
mbed_official | 0:51ac1d130fd4 | 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
mbed_official | 0:51ac1d130fd4 | 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
mbed_official | 0:51ac1d130fd4 | 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
mbed_official | 0:51ac1d130fd4 | 25 | * OF SUCH DAMAGE. |
mbed_official | 0:51ac1d130fd4 | 26 | * |
mbed_official | 0:51ac1d130fd4 | 27 | * This file is part of the lwIP TCP/IP stack. |
mbed_official | 0:51ac1d130fd4 | 28 | * |
mbed_official | 0:51ac1d130fd4 | 29 | * Author: Adam Dunkels <adam@sics.se> |
mbed_official | 0:51ac1d130fd4 | 30 | * |
mbed_official | 0:51ac1d130fd4 | 31 | */ |
mbed_official | 0:51ac1d130fd4 | 32 | #ifndef __LWIP_TCPIP_H__ |
mbed_official | 0:51ac1d130fd4 | 33 | #define __LWIP_TCPIP_H__ |
mbed_official | 0:51ac1d130fd4 | 34 | |
mbed_official | 0:51ac1d130fd4 | 35 | #include "lwip/opt.h" |
mbed_official | 0:51ac1d130fd4 | 36 | |
mbed_official | 0:51ac1d130fd4 | 37 | #if !NO_SYS /* don't build if not configured for use in lwipopts.h */ |
mbed_official | 0:51ac1d130fd4 | 38 | |
mbed_official | 0:51ac1d130fd4 | 39 | #include "lwip/api_msg.h" |
mbed_official | 0:51ac1d130fd4 | 40 | #include "lwip/netifapi.h" |
mbed_official | 0:51ac1d130fd4 | 41 | #include "lwip/pbuf.h" |
mbed_official | 0:51ac1d130fd4 | 42 | #include "lwip/api.h" |
mbed_official | 0:51ac1d130fd4 | 43 | #include "lwip/sys.h" |
mbed_official | 0:51ac1d130fd4 | 44 | #include "lwip/timers.h" |
mbed_official | 0:51ac1d130fd4 | 45 | #include "lwip/netif.h" |
mbed_official | 0:51ac1d130fd4 | 46 | |
mbed_official | 0:51ac1d130fd4 | 47 | #ifdef __cplusplus |
mbed_official | 0:51ac1d130fd4 | 48 | extern "C" { |
mbed_official | 0:51ac1d130fd4 | 49 | #endif |
mbed_official | 0:51ac1d130fd4 | 50 | |
mbed_official | 0:51ac1d130fd4 | 51 | /** Define this to something that triggers a watchdog. This is called from |
mbed_official | 0:51ac1d130fd4 | 52 | * tcpip_thread after processing a message. */ |
mbed_official | 0:51ac1d130fd4 | 53 | #ifndef LWIP_TCPIP_THREAD_ALIVE |
mbed_official | 0:51ac1d130fd4 | 54 | #define LWIP_TCPIP_THREAD_ALIVE() |
mbed_official | 0:51ac1d130fd4 | 55 | #endif |
mbed_official | 0:51ac1d130fd4 | 56 | |
mbed_official | 0:51ac1d130fd4 | 57 | #if LWIP_TCPIP_CORE_LOCKING |
mbed_official | 0:51ac1d130fd4 | 58 | /** The global semaphore to lock the stack. */ |
mbed_official | 0:51ac1d130fd4 | 59 | extern sys_mutex_t lock_tcpip_core; |
mbed_official | 0:51ac1d130fd4 | 60 | #define LOCK_TCPIP_CORE() sys_mutex_lock(&lock_tcpip_core) |
mbed_official | 0:51ac1d130fd4 | 61 | #define UNLOCK_TCPIP_CORE() sys_mutex_unlock(&lock_tcpip_core) |
mbed_official | 0:51ac1d130fd4 | 62 | #define TCPIP_APIMSG(m) tcpip_apimsg_lock(m) |
mbed_official | 0:51ac1d130fd4 | 63 | #define TCPIP_APIMSG_ACK(m) |
mbed_official | 0:51ac1d130fd4 | 64 | #define TCPIP_NETIFAPI(m) tcpip_netifapi_lock(m) |
mbed_official | 0:51ac1d130fd4 | 65 | #define TCPIP_NETIFAPI_ACK(m) |
mbed_official | 0:51ac1d130fd4 | 66 | #else /* LWIP_TCPIP_CORE_LOCKING */ |
mbed_official | 0:51ac1d130fd4 | 67 | #define LOCK_TCPIP_CORE() |
mbed_official | 0:51ac1d130fd4 | 68 | #define UNLOCK_TCPIP_CORE() |
mbed_official | 0:51ac1d130fd4 | 69 | #define TCPIP_APIMSG(m) tcpip_apimsg(m) |
mbed_official | 0:51ac1d130fd4 | 70 | #define TCPIP_APIMSG_ACK(m) sys_sem_signal(&m->conn->op_completed) |
mbed_official | 0:51ac1d130fd4 | 71 | #define TCPIP_NETIFAPI(m) tcpip_netifapi(m) |
mbed_official | 0:51ac1d130fd4 | 72 | #define TCPIP_NETIFAPI_ACK(m) sys_sem_signal(&m->sem) |
mbed_official | 0:51ac1d130fd4 | 73 | #endif /* LWIP_TCPIP_CORE_LOCKING */ |
mbed_official | 0:51ac1d130fd4 | 74 | |
mbed_official | 0:51ac1d130fd4 | 75 | /** Function prototype for the init_done function passed to tcpip_init */ |
mbed_official | 0:51ac1d130fd4 | 76 | typedef void (*tcpip_init_done_fn)(void *arg); |
mbed_official | 0:51ac1d130fd4 | 77 | /** Function prototype for functions passed to tcpip_callback() */ |
mbed_official | 0:51ac1d130fd4 | 78 | typedef void (*tcpip_callback_fn)(void *ctx); |
mbed_official | 0:51ac1d130fd4 | 79 | |
mbed_official | 0:51ac1d130fd4 | 80 | void tcpip_init(tcpip_init_done_fn tcpip_init_done, void *arg); |
mbed_official | 0:51ac1d130fd4 | 81 | |
mbed_official | 0:51ac1d130fd4 | 82 | #if LWIP_NETCONN |
mbed_official | 0:51ac1d130fd4 | 83 | err_t tcpip_apimsg(struct api_msg *apimsg); |
mbed_official | 0:51ac1d130fd4 | 84 | #if LWIP_TCPIP_CORE_LOCKING |
mbed_official | 0:51ac1d130fd4 | 85 | err_t tcpip_apimsg_lock(struct api_msg *apimsg); |
mbed_official | 0:51ac1d130fd4 | 86 | #endif /* LWIP_TCPIP_CORE_LOCKING */ |
mbed_official | 0:51ac1d130fd4 | 87 | #endif /* LWIP_NETCONN */ |
mbed_official | 0:51ac1d130fd4 | 88 | |
mbed_official | 0:51ac1d130fd4 | 89 | err_t tcpip_input(struct pbuf *p, struct netif *inp); |
mbed_official | 0:51ac1d130fd4 | 90 | |
mbed_official | 0:51ac1d130fd4 | 91 | #if LWIP_NETIF_API |
mbed_official | 0:51ac1d130fd4 | 92 | err_t tcpip_netifapi(struct netifapi_msg *netifapimsg); |
mbed_official | 0:51ac1d130fd4 | 93 | #if LWIP_TCPIP_CORE_LOCKING |
mbed_official | 0:51ac1d130fd4 | 94 | err_t tcpip_netifapi_lock(struct netifapi_msg *netifapimsg); |
mbed_official | 0:51ac1d130fd4 | 95 | #endif /* LWIP_TCPIP_CORE_LOCKING */ |
mbed_official | 0:51ac1d130fd4 | 96 | #endif /* LWIP_NETIF_API */ |
mbed_official | 0:51ac1d130fd4 | 97 | |
mbed_official | 0:51ac1d130fd4 | 98 | err_t tcpip_callback_with_block(tcpip_callback_fn function, void *ctx, u8_t block); |
mbed_official | 0:51ac1d130fd4 | 99 | #define tcpip_callback(f, ctx) tcpip_callback_with_block(f, ctx, 1) |
mbed_official | 0:51ac1d130fd4 | 100 | |
mbed_official | 0:51ac1d130fd4 | 101 | /* free pbufs or heap memory from another context without blocking */ |
mbed_official | 0:51ac1d130fd4 | 102 | err_t pbuf_free_callback(struct pbuf *p); |
mbed_official | 0:51ac1d130fd4 | 103 | err_t mem_free_callback(void *m); |
mbed_official | 0:51ac1d130fd4 | 104 | |
mbed_official | 0:51ac1d130fd4 | 105 | #if LWIP_TCPIP_TIMEOUT |
mbed_official | 0:51ac1d130fd4 | 106 | err_t tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg); |
mbed_official | 0:51ac1d130fd4 | 107 | err_t tcpip_untimeout(sys_timeout_handler h, void *arg); |
mbed_official | 0:51ac1d130fd4 | 108 | #endif /* LWIP_TCPIP_TIMEOUT */ |
mbed_official | 0:51ac1d130fd4 | 109 | |
mbed_official | 0:51ac1d130fd4 | 110 | enum tcpip_msg_type { |
mbed_official | 0:51ac1d130fd4 | 111 | #if LWIP_NETCONN |
mbed_official | 0:51ac1d130fd4 | 112 | TCPIP_MSG_API, |
mbed_official | 0:51ac1d130fd4 | 113 | #endif /* LWIP_NETCONN */ |
mbed_official | 0:51ac1d130fd4 | 114 | TCPIP_MSG_INPKT, |
mbed_official | 0:51ac1d130fd4 | 115 | #if LWIP_NETIF_API |
mbed_official | 0:51ac1d130fd4 | 116 | TCPIP_MSG_NETIFAPI, |
mbed_official | 0:51ac1d130fd4 | 117 | #endif /* LWIP_NETIF_API */ |
mbed_official | 0:51ac1d130fd4 | 118 | #if LWIP_TCPIP_TIMEOUT |
mbed_official | 0:51ac1d130fd4 | 119 | TCPIP_MSG_TIMEOUT, |
mbed_official | 0:51ac1d130fd4 | 120 | TCPIP_MSG_UNTIMEOUT, |
mbed_official | 0:51ac1d130fd4 | 121 | #endif /* LWIP_TCPIP_TIMEOUT */ |
mbed_official | 0:51ac1d130fd4 | 122 | TCPIP_MSG_CALLBACK |
mbed_official | 0:51ac1d130fd4 | 123 | }; |
mbed_official | 0:51ac1d130fd4 | 124 | |
mbed_official | 0:51ac1d130fd4 | 125 | struct tcpip_msg { |
mbed_official | 0:51ac1d130fd4 | 126 | enum tcpip_msg_type type; |
mbed_official | 0:51ac1d130fd4 | 127 | sys_sem_t *sem; |
mbed_official | 0:51ac1d130fd4 | 128 | union { |
mbed_official | 0:51ac1d130fd4 | 129 | #if LWIP_NETCONN |
mbed_official | 0:51ac1d130fd4 | 130 | struct api_msg *apimsg; |
mbed_official | 0:51ac1d130fd4 | 131 | #endif /* LWIP_NETCONN */ |
mbed_official | 0:51ac1d130fd4 | 132 | #if LWIP_NETIF_API |
mbed_official | 0:51ac1d130fd4 | 133 | struct netifapi_msg *netifapimsg; |
mbed_official | 0:51ac1d130fd4 | 134 | #endif /* LWIP_NETIF_API */ |
mbed_official | 0:51ac1d130fd4 | 135 | struct { |
mbed_official | 0:51ac1d130fd4 | 136 | struct pbuf *p; |
mbed_official | 0:51ac1d130fd4 | 137 | struct netif *netif; |
mbed_official | 0:51ac1d130fd4 | 138 | } inp; |
mbed_official | 0:51ac1d130fd4 | 139 | struct { |
mbed_official | 0:51ac1d130fd4 | 140 | tcpip_callback_fn function; |
mbed_official | 0:51ac1d130fd4 | 141 | void *ctx; |
mbed_official | 0:51ac1d130fd4 | 142 | } cb; |
mbed_official | 0:51ac1d130fd4 | 143 | #if LWIP_TCPIP_TIMEOUT |
mbed_official | 0:51ac1d130fd4 | 144 | struct { |
mbed_official | 0:51ac1d130fd4 | 145 | u32_t msecs; |
mbed_official | 0:51ac1d130fd4 | 146 | sys_timeout_handler h; |
mbed_official | 0:51ac1d130fd4 | 147 | void *arg; |
mbed_official | 0:51ac1d130fd4 | 148 | } tmo; |
mbed_official | 0:51ac1d130fd4 | 149 | #endif /* LWIP_TCPIP_TIMEOUT */ |
mbed_official | 0:51ac1d130fd4 | 150 | } msg; |
mbed_official | 0:51ac1d130fd4 | 151 | }; |
mbed_official | 0:51ac1d130fd4 | 152 | |
mbed_official | 0:51ac1d130fd4 | 153 | #ifdef __cplusplus |
mbed_official | 0:51ac1d130fd4 | 154 | } |
mbed_official | 0:51ac1d130fd4 | 155 | #endif |
mbed_official | 0:51ac1d130fd4 | 156 | |
mbed_official | 0:51ac1d130fd4 | 157 | #endif /* !NO_SYS */ |
mbed_official | 0:51ac1d130fd4 | 158 | |
mbed_official | 0:51ac1d130fd4 | 159 | #endif /* __LWIP_TCPIP_H__ */ |