This is lwip library for WlanBP3595 library. We forked lwip library. We extended TCP/IP thread stack size.
Fork of lwip by
include/lwip/api.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_API_H__ |
mbed_official | 0:51ac1d130fd4 | 33 | #define __LWIP_API_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 LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */ |
mbed_official | 0:51ac1d130fd4 | 38 | |
mbed_official | 0:51ac1d130fd4 | 39 | #include <stddef.h> /* for size_t */ |
mbed_official | 0:51ac1d130fd4 | 40 | |
mbed_official | 0:51ac1d130fd4 | 41 | #include "lwip/netbuf.h" |
mbed_official | 0:51ac1d130fd4 | 42 | #include "lwip/sys.h" |
mbed_official | 0:51ac1d130fd4 | 43 | #include "lwip/ip_addr.h" |
mbed_official | 0:51ac1d130fd4 | 44 | #include "lwip/err.h" |
mbed_official | 0:51ac1d130fd4 | 45 | |
mbed_official | 0:51ac1d130fd4 | 46 | #ifdef __cplusplus |
mbed_official | 0:51ac1d130fd4 | 47 | extern "C" { |
mbed_official | 0:51ac1d130fd4 | 48 | #endif |
mbed_official | 0:51ac1d130fd4 | 49 | |
mbed_official | 0:51ac1d130fd4 | 50 | /* Throughout this file, IP addresses and port numbers are expected to be in |
mbed_official | 0:51ac1d130fd4 | 51 | * the same byte order as in the corresponding pcb. |
mbed_official | 0:51ac1d130fd4 | 52 | */ |
mbed_official | 0:51ac1d130fd4 | 53 | |
mbed_official | 0:51ac1d130fd4 | 54 | /* Flags for netconn_write (u8_t) */ |
mbed_official | 0:51ac1d130fd4 | 55 | #define NETCONN_NOFLAG 0x00 |
mbed_official | 0:51ac1d130fd4 | 56 | #define NETCONN_NOCOPY 0x00 /* Only for source code compatibility */ |
mbed_official | 0:51ac1d130fd4 | 57 | #define NETCONN_COPY 0x01 |
mbed_official | 0:51ac1d130fd4 | 58 | #define NETCONN_MORE 0x02 |
mbed_official | 0:51ac1d130fd4 | 59 | #define NETCONN_DONTBLOCK 0x04 |
mbed_official | 0:51ac1d130fd4 | 60 | |
mbed_official | 0:51ac1d130fd4 | 61 | /* Flags for struct netconn.flags (u8_t) */ |
mbed_official | 0:51ac1d130fd4 | 62 | /** TCP: when data passed to netconn_write doesn't fit into the send buffer, |
mbed_official | 0:51ac1d130fd4 | 63 | this temporarily stores whether to wake up the original application task |
mbed_official | 0:51ac1d130fd4 | 64 | if data couldn't be sent in the first try. */ |
mbed_official | 0:51ac1d130fd4 | 65 | #define NETCONN_FLAG_WRITE_DELAYED 0x01 |
mbed_official | 0:51ac1d130fd4 | 66 | /** Should this netconn avoid blocking? */ |
mbed_official | 0:51ac1d130fd4 | 67 | #define NETCONN_FLAG_NON_BLOCKING 0x02 |
mbed_official | 0:51ac1d130fd4 | 68 | /** Was the last connect action a non-blocking one? */ |
mbed_official | 0:51ac1d130fd4 | 69 | #define NETCONN_FLAG_IN_NONBLOCKING_CONNECT 0x04 |
mbed_official | 0:51ac1d130fd4 | 70 | /** If this is set, a TCP netconn must call netconn_recved() to update |
mbed_official | 0:51ac1d130fd4 | 71 | the TCP receive window (done automatically if not set). */ |
mbed_official | 0:51ac1d130fd4 | 72 | #define NETCONN_FLAG_NO_AUTO_RECVED 0x08 |
mbed_official | 0:51ac1d130fd4 | 73 | /** If a nonblocking write has been rejected before, poll_tcp needs to |
mbed_official | 0:51ac1d130fd4 | 74 | check if the netconn is writable again */ |
mbed_official | 0:51ac1d130fd4 | 75 | #define NETCONN_FLAG_CHECK_WRITESPACE 0x10 |
mbed_official | 0:51ac1d130fd4 | 76 | |
mbed_official | 0:51ac1d130fd4 | 77 | |
mbed_official | 0:51ac1d130fd4 | 78 | /* Helpers to process several netconn_types by the same code */ |
mbed_official | 0:51ac1d130fd4 | 79 | #define NETCONNTYPE_GROUP(t) (t&0xF0) |
mbed_official | 0:51ac1d130fd4 | 80 | #define NETCONNTYPE_DATAGRAM(t) (t&0xE0) |
mbed_official | 0:51ac1d130fd4 | 81 | |
mbed_official | 0:51ac1d130fd4 | 82 | /** Protocol family and type of the netconn */ |
mbed_official | 0:51ac1d130fd4 | 83 | enum netconn_type { |
mbed_official | 0:51ac1d130fd4 | 84 | NETCONN_INVALID = 0, |
mbed_official | 0:51ac1d130fd4 | 85 | /* NETCONN_TCP Group */ |
mbed_official | 0:51ac1d130fd4 | 86 | NETCONN_TCP = 0x10, |
mbed_official | 0:51ac1d130fd4 | 87 | /* NETCONN_UDP Group */ |
mbed_official | 0:51ac1d130fd4 | 88 | NETCONN_UDP = 0x20, |
mbed_official | 0:51ac1d130fd4 | 89 | NETCONN_UDPLITE = 0x21, |
mbed_official | 0:51ac1d130fd4 | 90 | NETCONN_UDPNOCHKSUM= 0x22, |
mbed_official | 0:51ac1d130fd4 | 91 | /* NETCONN_RAW Group */ |
mbed_official | 0:51ac1d130fd4 | 92 | NETCONN_RAW = 0x40 |
mbed_official | 0:51ac1d130fd4 | 93 | }; |
mbed_official | 0:51ac1d130fd4 | 94 | |
mbed_official | 0:51ac1d130fd4 | 95 | /** Current state of the netconn. Non-TCP netconns are always |
mbed_official | 0:51ac1d130fd4 | 96 | * in state NETCONN_NONE! */ |
mbed_official | 0:51ac1d130fd4 | 97 | enum netconn_state { |
mbed_official | 0:51ac1d130fd4 | 98 | NETCONN_NONE, |
mbed_official | 0:51ac1d130fd4 | 99 | NETCONN_WRITE, |
mbed_official | 0:51ac1d130fd4 | 100 | NETCONN_LISTEN, |
mbed_official | 0:51ac1d130fd4 | 101 | NETCONN_CONNECT, |
mbed_official | 0:51ac1d130fd4 | 102 | NETCONN_CLOSE |
mbed_official | 0:51ac1d130fd4 | 103 | }; |
mbed_official | 0:51ac1d130fd4 | 104 | |
mbed_official | 0:51ac1d130fd4 | 105 | /** Use to inform the callback function about changes */ |
mbed_official | 0:51ac1d130fd4 | 106 | enum netconn_evt { |
mbed_official | 0:51ac1d130fd4 | 107 | NETCONN_EVT_RCVPLUS, |
mbed_official | 0:51ac1d130fd4 | 108 | NETCONN_EVT_RCVMINUS, |
mbed_official | 0:51ac1d130fd4 | 109 | NETCONN_EVT_SENDPLUS, |
mbed_official | 0:51ac1d130fd4 | 110 | NETCONN_EVT_SENDMINUS, |
mbed_official | 0:51ac1d130fd4 | 111 | NETCONN_EVT_ERROR |
mbed_official | 0:51ac1d130fd4 | 112 | }; |
mbed_official | 0:51ac1d130fd4 | 113 | |
mbed_official | 0:51ac1d130fd4 | 114 | #if LWIP_IGMP |
mbed_official | 0:51ac1d130fd4 | 115 | /** Used for netconn_join_leave_group() */ |
mbed_official | 0:51ac1d130fd4 | 116 | enum netconn_igmp { |
mbed_official | 0:51ac1d130fd4 | 117 | NETCONN_JOIN, |
mbed_official | 0:51ac1d130fd4 | 118 | NETCONN_LEAVE |
mbed_official | 0:51ac1d130fd4 | 119 | }; |
mbed_official | 0:51ac1d130fd4 | 120 | #endif /* LWIP_IGMP */ |
mbed_official | 0:51ac1d130fd4 | 121 | |
mbed_official | 0:51ac1d130fd4 | 122 | /* forward-declare some structs to avoid to include their headers */ |
mbed_official | 0:51ac1d130fd4 | 123 | struct ip_pcb; |
mbed_official | 0:51ac1d130fd4 | 124 | struct tcp_pcb; |
mbed_official | 0:51ac1d130fd4 | 125 | struct udp_pcb; |
mbed_official | 0:51ac1d130fd4 | 126 | struct raw_pcb; |
mbed_official | 0:51ac1d130fd4 | 127 | struct netconn; |
mbed_official | 0:51ac1d130fd4 | 128 | struct api_msg_msg; |
mbed_official | 0:51ac1d130fd4 | 129 | |
mbed_official | 0:51ac1d130fd4 | 130 | /** A callback prototype to inform about events for a netconn */ |
mbed_official | 0:51ac1d130fd4 | 131 | typedef void (* netconn_callback)(struct netconn *, enum netconn_evt, u16_t len); |
mbed_official | 0:51ac1d130fd4 | 132 | |
mbed_official | 0:51ac1d130fd4 | 133 | /** A netconn descriptor */ |
mbed_official | 0:51ac1d130fd4 | 134 | struct netconn { |
mbed_official | 0:51ac1d130fd4 | 135 | /** type of the netconn (TCP, UDP or RAW) */ |
mbed_official | 0:51ac1d130fd4 | 136 | enum netconn_type type; |
mbed_official | 0:51ac1d130fd4 | 137 | /** current state of the netconn */ |
mbed_official | 0:51ac1d130fd4 | 138 | enum netconn_state state; |
mbed_official | 0:51ac1d130fd4 | 139 | /** the lwIP internal protocol control block */ |
mbed_official | 0:51ac1d130fd4 | 140 | union { |
mbed_official | 0:51ac1d130fd4 | 141 | struct ip_pcb *ip; |
mbed_official | 0:51ac1d130fd4 | 142 | struct tcp_pcb *tcp; |
mbed_official | 0:51ac1d130fd4 | 143 | struct udp_pcb *udp; |
mbed_official | 0:51ac1d130fd4 | 144 | struct raw_pcb *raw; |
mbed_official | 0:51ac1d130fd4 | 145 | } pcb; |
mbed_official | 0:51ac1d130fd4 | 146 | /** the last error this netconn had */ |
mbed_official | 0:51ac1d130fd4 | 147 | err_t last_err; |
mbed_official | 0:51ac1d130fd4 | 148 | /** sem that is used to synchroneously execute functions in the core context */ |
mbed_official | 0:51ac1d130fd4 | 149 | sys_sem_t op_completed; |
mbed_official | 0:51ac1d130fd4 | 150 | /** mbox where received packets are stored until they are fetched |
mbed_official | 0:51ac1d130fd4 | 151 | by the netconn application thread (can grow quite big) */ |
mbed_official | 0:51ac1d130fd4 | 152 | sys_mbox_t recvmbox; |
mbed_official | 0:51ac1d130fd4 | 153 | #if LWIP_TCP |
mbed_official | 0:51ac1d130fd4 | 154 | /** mbox where new connections are stored until processed |
mbed_official | 0:51ac1d130fd4 | 155 | by the application thread */ |
mbed_official | 0:51ac1d130fd4 | 156 | sys_mbox_t acceptmbox; |
mbed_official | 0:51ac1d130fd4 | 157 | #endif /* LWIP_TCP */ |
mbed_official | 0:51ac1d130fd4 | 158 | /** only used for socket layer */ |
mbed_official | 0:51ac1d130fd4 | 159 | #if LWIP_SOCKET |
mbed_official | 0:51ac1d130fd4 | 160 | int socket; |
mbed_official | 0:51ac1d130fd4 | 161 | #endif /* LWIP_SOCKET */ |
mbed_official | 0:51ac1d130fd4 | 162 | #if LWIP_SO_RCVTIMEO |
mbed_official | 0:51ac1d130fd4 | 163 | /** timeout to wait for new data to be received |
mbed_official | 0:51ac1d130fd4 | 164 | (or connections to arrive for listening netconns) */ |
mbed_official | 0:51ac1d130fd4 | 165 | int recv_timeout; |
mbed_official | 0:51ac1d130fd4 | 166 | #endif /* LWIP_SO_RCVTIMEO */ |
mbed_official | 0:51ac1d130fd4 | 167 | #if LWIP_SO_RCVBUF |
mbed_official | 0:51ac1d130fd4 | 168 | /** maximum amount of bytes queued in recvmbox |
mbed_official | 0:51ac1d130fd4 | 169 | not used for TCP: adjust TCP_WND instead! */ |
mbed_official | 0:51ac1d130fd4 | 170 | int recv_bufsize; |
mbed_official | 0:51ac1d130fd4 | 171 | /** number of bytes currently in recvmbox to be received, |
mbed_official | 0:51ac1d130fd4 | 172 | tested against recv_bufsize to limit bytes on recvmbox |
mbed_official | 0:51ac1d130fd4 | 173 | for UDP and RAW, used for FIONREAD */ |
mbed_official | 0:51ac1d130fd4 | 174 | s16_t recv_avail; |
mbed_official | 0:51ac1d130fd4 | 175 | #endif /* LWIP_SO_RCVBUF */ |
mbed_official | 0:51ac1d130fd4 | 176 | /** flags holding more netconn-internal state, see NETCONN_FLAG_* defines */ |
mbed_official | 0:51ac1d130fd4 | 177 | u8_t flags; |
mbed_official | 0:51ac1d130fd4 | 178 | #if LWIP_TCP |
mbed_official | 0:51ac1d130fd4 | 179 | /** TCP: when data passed to netconn_write doesn't fit into the send buffer, |
mbed_official | 0:51ac1d130fd4 | 180 | this temporarily stores how much is already sent. */ |
mbed_official | 0:51ac1d130fd4 | 181 | size_t write_offset; |
mbed_official | 0:51ac1d130fd4 | 182 | /** TCP: when data passed to netconn_write doesn't fit into the send buffer, |
mbed_official | 0:51ac1d130fd4 | 183 | this temporarily stores the message. |
mbed_official | 0:51ac1d130fd4 | 184 | Also used during connect and close. */ |
mbed_official | 0:51ac1d130fd4 | 185 | struct api_msg_msg *current_msg; |
mbed_official | 0:51ac1d130fd4 | 186 | #endif /* LWIP_TCP */ |
mbed_official | 0:51ac1d130fd4 | 187 | /** A callback function that is informed about events for this netconn */ |
mbed_official | 0:51ac1d130fd4 | 188 | netconn_callback callback; |
mbed_official | 0:51ac1d130fd4 | 189 | }; |
mbed_official | 0:51ac1d130fd4 | 190 | |
mbed_official | 0:51ac1d130fd4 | 191 | /** Register an Network connection event */ |
mbed_official | 0:51ac1d130fd4 | 192 | #define API_EVENT(c,e,l) if (c->callback) { \ |
mbed_official | 0:51ac1d130fd4 | 193 | (*c->callback)(c, e, l); \ |
mbed_official | 0:51ac1d130fd4 | 194 | } |
mbed_official | 0:51ac1d130fd4 | 195 | |
mbed_official | 0:51ac1d130fd4 | 196 | /** Set conn->last_err to err but don't overwrite fatal errors */ |
mbed_official | 0:51ac1d130fd4 | 197 | #define NETCONN_SET_SAFE_ERR(conn, err) do { \ |
mbed_official | 0:51ac1d130fd4 | 198 | SYS_ARCH_DECL_PROTECT(lev); \ |
mbed_official | 0:51ac1d130fd4 | 199 | SYS_ARCH_PROTECT(lev); \ |
mbed_official | 0:51ac1d130fd4 | 200 | if (!ERR_IS_FATAL((conn)->last_err)) { \ |
mbed_official | 0:51ac1d130fd4 | 201 | (conn)->last_err = err; \ |
mbed_official | 0:51ac1d130fd4 | 202 | } \ |
mbed_official | 0:51ac1d130fd4 | 203 | SYS_ARCH_UNPROTECT(lev); \ |
mbed_official | 0:51ac1d130fd4 | 204 | } while(0); |
mbed_official | 0:51ac1d130fd4 | 205 | |
mbed_official | 0:51ac1d130fd4 | 206 | /* Network connection functions: */ |
mbed_official | 0:51ac1d130fd4 | 207 | #define netconn_new(t) netconn_new_with_proto_and_callback(t, 0, NULL) |
mbed_official | 0:51ac1d130fd4 | 208 | #define netconn_new_with_callback(t, c) netconn_new_with_proto_and_callback(t, 0, c) |
mbed_official | 0:51ac1d130fd4 | 209 | struct |
mbed_official | 0:51ac1d130fd4 | 210 | netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u8_t proto, |
mbed_official | 0:51ac1d130fd4 | 211 | netconn_callback callback); |
mbed_official | 0:51ac1d130fd4 | 212 | err_t netconn_delete(struct netconn *conn); |
mbed_official | 0:51ac1d130fd4 | 213 | /** Get the type of a netconn (as enum netconn_type). */ |
mbed_official | 0:51ac1d130fd4 | 214 | #define netconn_type(conn) (conn->type) |
mbed_official | 0:51ac1d130fd4 | 215 | |
mbed_official | 0:51ac1d130fd4 | 216 | err_t netconn_getaddr(struct netconn *conn, ip_addr_t *addr, |
mbed_official | 0:51ac1d130fd4 | 217 | u16_t *port, u8_t local); |
mbed_official | 0:51ac1d130fd4 | 218 | #define netconn_peer(c,i,p) netconn_getaddr(c,i,p,0) |
mbed_official | 0:51ac1d130fd4 | 219 | #define netconn_addr(c,i,p) netconn_getaddr(c,i,p,1) |
mbed_official | 0:51ac1d130fd4 | 220 | |
mbed_official | 0:51ac1d130fd4 | 221 | err_t netconn_bind(struct netconn *conn, ip_addr_t *addr, u16_t port); |
mbed_official | 0:51ac1d130fd4 | 222 | err_t netconn_connect(struct netconn *conn, ip_addr_t *addr, u16_t port); |
mbed_official | 0:51ac1d130fd4 | 223 | err_t netconn_disconnect (struct netconn *conn); |
mbed_official | 0:51ac1d130fd4 | 224 | err_t netconn_listen_with_backlog(struct netconn *conn, u8_t backlog); |
mbed_official | 0:51ac1d130fd4 | 225 | #define netconn_listen(conn) netconn_listen_with_backlog(conn, TCP_DEFAULT_LISTEN_BACKLOG) |
mbed_official | 0:51ac1d130fd4 | 226 | err_t netconn_accept(struct netconn *conn, struct netconn **new_conn); |
mbed_official | 0:51ac1d130fd4 | 227 | err_t netconn_recv(struct netconn *conn, struct netbuf **new_buf); |
mbed_official | 0:51ac1d130fd4 | 228 | err_t netconn_recv_tcp_pbuf(struct netconn *conn, struct pbuf **new_buf); |
mbed_official | 0:51ac1d130fd4 | 229 | void netconn_recved(struct netconn *conn, u32_t length); |
mbed_official | 0:51ac1d130fd4 | 230 | err_t netconn_sendto(struct netconn *conn, struct netbuf *buf, |
mbed_official | 0:51ac1d130fd4 | 231 | ip_addr_t *addr, u16_t port); |
mbed_official | 0:51ac1d130fd4 | 232 | err_t netconn_send(struct netconn *conn, struct netbuf *buf); |
mbed_official | 0:51ac1d130fd4 | 233 | err_t netconn_write(struct netconn *conn, const void *dataptr, size_t size, |
mbed_official | 0:51ac1d130fd4 | 234 | u8_t apiflags); |
mbed_official | 0:51ac1d130fd4 | 235 | err_t netconn_close(struct netconn *conn); |
mbed_official | 0:51ac1d130fd4 | 236 | err_t netconn_shutdown(struct netconn *conn, u8_t shut_rx, u8_t shut_tx); |
mbed_official | 0:51ac1d130fd4 | 237 | |
mbed_official | 0:51ac1d130fd4 | 238 | #if LWIP_IGMP |
mbed_official | 0:51ac1d130fd4 | 239 | err_t netconn_join_leave_group(struct netconn *conn, ip_addr_t *multiaddr, |
mbed_official | 0:51ac1d130fd4 | 240 | ip_addr_t *netif_addr, enum netconn_igmp join_or_leave); |
mbed_official | 0:51ac1d130fd4 | 241 | #endif /* LWIP_IGMP */ |
mbed_official | 0:51ac1d130fd4 | 242 | #if LWIP_DNS |
mbed_official | 0:51ac1d130fd4 | 243 | err_t netconn_gethostbyname(const char *name, ip_addr_t *addr); |
mbed_official | 0:51ac1d130fd4 | 244 | #endif /* LWIP_DNS */ |
mbed_official | 0:51ac1d130fd4 | 245 | |
mbed_official | 0:51ac1d130fd4 | 246 | #define netconn_err(conn) ((conn)->last_err) |
mbed_official | 0:51ac1d130fd4 | 247 | #define netconn_recv_bufsize(conn) ((conn)->recv_bufsize) |
mbed_official | 0:51ac1d130fd4 | 248 | |
mbed_official | 0:51ac1d130fd4 | 249 | /** Set the blocking status of netconn calls (@todo: write/send is missing) */ |
mbed_official | 0:51ac1d130fd4 | 250 | #define netconn_set_nonblocking(conn, val) do { if(val) { \ |
mbed_official | 0:51ac1d130fd4 | 251 | (conn)->flags |= NETCONN_FLAG_NON_BLOCKING; \ |
mbed_official | 0:51ac1d130fd4 | 252 | } else { \ |
mbed_official | 0:51ac1d130fd4 | 253 | (conn)->flags &= ~ NETCONN_FLAG_NON_BLOCKING; }} while(0) |
mbed_official | 0:51ac1d130fd4 | 254 | /** Get the blocking status of netconn calls (@todo: write/send is missing) */ |
mbed_official | 0:51ac1d130fd4 | 255 | #define netconn_is_nonblocking(conn) (((conn)->flags & NETCONN_FLAG_NON_BLOCKING) != 0) |
mbed_official | 0:51ac1d130fd4 | 256 | |
mbed_official | 0:51ac1d130fd4 | 257 | /** TCP: Set the no-auto-recved status of netconn calls (see NETCONN_FLAG_NO_AUTO_RECVED) */ |
mbed_official | 0:51ac1d130fd4 | 258 | #define netconn_set_noautorecved(conn, val) do { if(val) { \ |
mbed_official | 0:51ac1d130fd4 | 259 | (conn)->flags |= NETCONN_FLAG_NO_AUTO_RECVED; \ |
mbed_official | 0:51ac1d130fd4 | 260 | } else { \ |
mbed_official | 0:51ac1d130fd4 | 261 | (conn)->flags &= ~ NETCONN_FLAG_NO_AUTO_RECVED; }} while(0) |
mbed_official | 0:51ac1d130fd4 | 262 | /** TCP: Get the no-auto-recved status of netconn calls (see NETCONN_FLAG_NO_AUTO_RECVED) */ |
mbed_official | 0:51ac1d130fd4 | 263 | #define netconn_get_noautorecved(conn) (((conn)->flags & NETCONN_FLAG_NO_AUTO_RECVED) != 0) |
mbed_official | 0:51ac1d130fd4 | 264 | |
mbed_official | 0:51ac1d130fd4 | 265 | #if LWIP_SO_RCVTIMEO |
mbed_official | 0:51ac1d130fd4 | 266 | /** Set the receive timeout in milliseconds */ |
mbed_official | 0:51ac1d130fd4 | 267 | #define netconn_set_recvtimeout(conn, timeout) ((conn)->recv_timeout = (timeout)) |
mbed_official | 0:51ac1d130fd4 | 268 | /** Get the receive timeout in milliseconds */ |
mbed_official | 0:51ac1d130fd4 | 269 | #define netconn_get_recvtimeout(conn) ((conn)->recv_timeout) |
mbed_official | 0:51ac1d130fd4 | 270 | #endif /* LWIP_SO_RCVTIMEO */ |
mbed_official | 0:51ac1d130fd4 | 271 | #if LWIP_SO_RCVBUF |
mbed_official | 0:51ac1d130fd4 | 272 | /** Set the receive buffer in bytes */ |
mbed_official | 0:51ac1d130fd4 | 273 | #define netconn_set_recvbufsize(conn, recvbufsize) ((conn)->recv_bufsize = (recvbufsize)) |
mbed_official | 0:51ac1d130fd4 | 274 | /** Get the receive buffer in bytes */ |
mbed_official | 0:51ac1d130fd4 | 275 | #define netconn_get_recvbufsize(conn) ((conn)->recv_bufsize) |
mbed_official | 0:51ac1d130fd4 | 276 | #endif /* LWIP_SO_RCVBUF*/ |
mbed_official | 0:51ac1d130fd4 | 277 | |
mbed_official | 0:51ac1d130fd4 | 278 | #ifdef __cplusplus |
mbed_official | 0:51ac1d130fd4 | 279 | } |
mbed_official | 0:51ac1d130fd4 | 280 | #endif |
mbed_official | 0:51ac1d130fd4 | 281 | |
mbed_official | 0:51ac1d130fd4 | 282 | #endif /* LWIP_NETCONN */ |
mbed_official | 0:51ac1d130fd4 | 283 | |
mbed_official | 0:51ac1d130fd4 | 284 | #endif /* __LWIP_API_H__ */ |