Dependents: TimeZoneDemo EthernetJackTestCode MMEx_Challenge ntp_mem ... more
lwip/include/lwip/api.h@0:ac1725ba162c, 2010-11-09 (annotated)
- Committer:
- segundo
- Date:
- Tue Nov 09 20:54:15 2010 +0000
- Revision:
- 0:ac1725ba162c
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
segundo | 0:ac1725ba162c | 1 | /* |
segundo | 0:ac1725ba162c | 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. |
segundo | 0:ac1725ba162c | 3 | * All rights reserved. |
segundo | 0:ac1725ba162c | 4 | * |
segundo | 0:ac1725ba162c | 5 | * Redistribution and use in source and binary forms, with or without modification, |
segundo | 0:ac1725ba162c | 6 | * are permitted provided that the following conditions are met: |
segundo | 0:ac1725ba162c | 7 | * |
segundo | 0:ac1725ba162c | 8 | * 1. Redistributions of source code must retain the above copyright notice, |
segundo | 0:ac1725ba162c | 9 | * this list of conditions and the following disclaimer. |
segundo | 0:ac1725ba162c | 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
segundo | 0:ac1725ba162c | 11 | * this list of conditions and the following disclaimer in the documentation |
segundo | 0:ac1725ba162c | 12 | * and/or other materials provided with the distribution. |
segundo | 0:ac1725ba162c | 13 | * 3. The name of the author may not be used to endorse or promote products |
segundo | 0:ac1725ba162c | 14 | * derived from this software without specific prior written permission. |
segundo | 0:ac1725ba162c | 15 | * |
segundo | 0:ac1725ba162c | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
segundo | 0:ac1725ba162c | 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
segundo | 0:ac1725ba162c | 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
segundo | 0:ac1725ba162c | 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
segundo | 0:ac1725ba162c | 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
segundo | 0:ac1725ba162c | 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
segundo | 0:ac1725ba162c | 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
segundo | 0:ac1725ba162c | 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
segundo | 0:ac1725ba162c | 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
segundo | 0:ac1725ba162c | 25 | * OF SUCH DAMAGE. |
segundo | 0:ac1725ba162c | 26 | * |
segundo | 0:ac1725ba162c | 27 | * This file is part of the lwIP TCP/IP stack. |
segundo | 0:ac1725ba162c | 28 | * |
segundo | 0:ac1725ba162c | 29 | * Author: Adam Dunkels <adam@sics.se> |
segundo | 0:ac1725ba162c | 30 | * |
segundo | 0:ac1725ba162c | 31 | */ |
segundo | 0:ac1725ba162c | 32 | #ifndef __LWIP_API_H__ |
segundo | 0:ac1725ba162c | 33 | #define __LWIP_API_H__ |
segundo | 0:ac1725ba162c | 34 | |
segundo | 0:ac1725ba162c | 35 | #include "lwip/opt.h" |
segundo | 0:ac1725ba162c | 36 | |
segundo | 0:ac1725ba162c | 37 | #if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */ |
segundo | 0:ac1725ba162c | 38 | |
segundo | 0:ac1725ba162c | 39 | #include <stddef.h> /* for size_t */ |
segundo | 0:ac1725ba162c | 40 | |
segundo | 0:ac1725ba162c | 41 | #include "lwip/netbuf.h" |
segundo | 0:ac1725ba162c | 42 | #include "lwip/sys.h" |
segundo | 0:ac1725ba162c | 43 | #include "lwip/ip_addr.h" |
segundo | 0:ac1725ba162c | 44 | #include "lwip/err.h" |
segundo | 0:ac1725ba162c | 45 | |
segundo | 0:ac1725ba162c | 46 | #ifdef __cplusplus |
segundo | 0:ac1725ba162c | 47 | extern "C" { |
segundo | 0:ac1725ba162c | 48 | #endif |
segundo | 0:ac1725ba162c | 49 | |
segundo | 0:ac1725ba162c | 50 | /* Throughout this file, IP addresses and port numbers are expected to be in |
segundo | 0:ac1725ba162c | 51 | * the same byte order as in the corresponding pcb. |
segundo | 0:ac1725ba162c | 52 | */ |
segundo | 0:ac1725ba162c | 53 | |
segundo | 0:ac1725ba162c | 54 | /* Flags for netconn_write (u8_t) */ |
segundo | 0:ac1725ba162c | 55 | #define NETCONN_NOFLAG 0x00 |
segundo | 0:ac1725ba162c | 56 | #define NETCONN_NOCOPY 0x00 /* Only for source code compatibility */ |
segundo | 0:ac1725ba162c | 57 | #define NETCONN_COPY 0x01 |
segundo | 0:ac1725ba162c | 58 | #define NETCONN_MORE 0x02 |
segundo | 0:ac1725ba162c | 59 | #define NETCONN_DONTBLOCK 0x04 |
segundo | 0:ac1725ba162c | 60 | |
segundo | 0:ac1725ba162c | 61 | /* Flags for struct netconn.flags (u8_t) */ |
segundo | 0:ac1725ba162c | 62 | /** TCP: when data passed to netconn_write doesn't fit into the send buffer, |
segundo | 0:ac1725ba162c | 63 | this temporarily stores whether to wake up the original application task |
segundo | 0:ac1725ba162c | 64 | if data couldn't be sent in the first try. */ |
segundo | 0:ac1725ba162c | 65 | #define NETCONN_FLAG_WRITE_DELAYED 0x01 |
segundo | 0:ac1725ba162c | 66 | /** Should this netconn avoid blocking? */ |
segundo | 0:ac1725ba162c | 67 | #define NETCONN_FLAG_NON_BLOCKING 0x02 |
segundo | 0:ac1725ba162c | 68 | /** Was the last connect action a non-blocking one? */ |
segundo | 0:ac1725ba162c | 69 | #define NETCONN_FLAG_IN_NONBLOCKING_CONNECT 0x04 |
segundo | 0:ac1725ba162c | 70 | /** If this is set, a TCP netconn must call netconn_recved() to update |
segundo | 0:ac1725ba162c | 71 | the TCP receive window (done automatically if not set). */ |
segundo | 0:ac1725ba162c | 72 | #define NETCONN_FLAG_NO_AUTO_RECVED 0x08 |
segundo | 0:ac1725ba162c | 73 | /** If a nonblocking write has been rejected before, poll_tcp needs to |
segundo | 0:ac1725ba162c | 74 | check if the netconn is writable again */ |
segundo | 0:ac1725ba162c | 75 | #define NETCONN_FLAG_CHECK_WRITESPACE 0x10 |
segundo | 0:ac1725ba162c | 76 | |
segundo | 0:ac1725ba162c | 77 | |
segundo | 0:ac1725ba162c | 78 | /* Helpers to process several netconn_types by the same code */ |
segundo | 0:ac1725ba162c | 79 | #define NETCONNTYPE_GROUP(t) (t&0xF0) |
segundo | 0:ac1725ba162c | 80 | #define NETCONNTYPE_DATAGRAM(t) (t&0xE0) |
segundo | 0:ac1725ba162c | 81 | |
segundo | 0:ac1725ba162c | 82 | /** Protocol family and type of the netconn */ |
segundo | 0:ac1725ba162c | 83 | enum netconn_type { |
segundo | 0:ac1725ba162c | 84 | NETCONN_INVALID = 0, |
segundo | 0:ac1725ba162c | 85 | /* NETCONN_TCP Group */ |
segundo | 0:ac1725ba162c | 86 | NETCONN_TCP = 0x10, |
segundo | 0:ac1725ba162c | 87 | /* NETCONN_UDP Group */ |
segundo | 0:ac1725ba162c | 88 | NETCONN_UDP = 0x20, |
segundo | 0:ac1725ba162c | 89 | NETCONN_UDPLITE = 0x21, |
segundo | 0:ac1725ba162c | 90 | NETCONN_UDPNOCHKSUM= 0x22, |
segundo | 0:ac1725ba162c | 91 | /* NETCONN_RAW Group */ |
segundo | 0:ac1725ba162c | 92 | NETCONN_RAW = 0x40 |
segundo | 0:ac1725ba162c | 93 | }; |
segundo | 0:ac1725ba162c | 94 | |
segundo | 0:ac1725ba162c | 95 | /** Current state of the netconn. Non-TCP netconns are always |
segundo | 0:ac1725ba162c | 96 | * in state NETCONN_NONE! */ |
segundo | 0:ac1725ba162c | 97 | enum netconn_state { |
segundo | 0:ac1725ba162c | 98 | NETCONN_NONE, |
segundo | 0:ac1725ba162c | 99 | NETCONN_WRITE, |
segundo | 0:ac1725ba162c | 100 | NETCONN_LISTEN, |
segundo | 0:ac1725ba162c | 101 | NETCONN_CONNECT, |
segundo | 0:ac1725ba162c | 102 | NETCONN_CLOSE |
segundo | 0:ac1725ba162c | 103 | }; |
segundo | 0:ac1725ba162c | 104 | |
segundo | 0:ac1725ba162c | 105 | /** Use to inform the callback function about changes */ |
segundo | 0:ac1725ba162c | 106 | enum netconn_evt { |
segundo | 0:ac1725ba162c | 107 | NETCONN_EVT_RCVPLUS, |
segundo | 0:ac1725ba162c | 108 | NETCONN_EVT_RCVMINUS, |
segundo | 0:ac1725ba162c | 109 | NETCONN_EVT_SENDPLUS, |
segundo | 0:ac1725ba162c | 110 | NETCONN_EVT_SENDMINUS, |
segundo | 0:ac1725ba162c | 111 | NETCONN_EVT_ERROR |
segundo | 0:ac1725ba162c | 112 | }; |
segundo | 0:ac1725ba162c | 113 | |
segundo | 0:ac1725ba162c | 114 | #if LWIP_IGMP |
segundo | 0:ac1725ba162c | 115 | /** Used for netconn_join_leave_group() */ |
segundo | 0:ac1725ba162c | 116 | enum netconn_igmp { |
segundo | 0:ac1725ba162c | 117 | NETCONN_JOIN, |
segundo | 0:ac1725ba162c | 118 | NETCONN_LEAVE |
segundo | 0:ac1725ba162c | 119 | }; |
segundo | 0:ac1725ba162c | 120 | #endif /* LWIP_IGMP */ |
segundo | 0:ac1725ba162c | 121 | |
segundo | 0:ac1725ba162c | 122 | /* forward-declare some structs to avoid to include their headers */ |
segundo | 0:ac1725ba162c | 123 | struct ip_pcb; |
segundo | 0:ac1725ba162c | 124 | struct tcp_pcb; |
segundo | 0:ac1725ba162c | 125 | struct udp_pcb; |
segundo | 0:ac1725ba162c | 126 | struct raw_pcb; |
segundo | 0:ac1725ba162c | 127 | struct netconn; |
segundo | 0:ac1725ba162c | 128 | struct api_msg_msg; |
segundo | 0:ac1725ba162c | 129 | |
segundo | 0:ac1725ba162c | 130 | /** A callback prototype to inform about events for a netconn */ |
segundo | 0:ac1725ba162c | 131 | typedef void (* netconn_callback)(struct netconn *, enum netconn_evt, u16_t len); |
segundo | 0:ac1725ba162c | 132 | |
segundo | 0:ac1725ba162c | 133 | /** A netconn descriptor */ |
segundo | 0:ac1725ba162c | 134 | struct netconn { |
segundo | 0:ac1725ba162c | 135 | /** type of the netconn (TCP, UDP or RAW) */ |
segundo | 0:ac1725ba162c | 136 | enum netconn_type type; |
segundo | 0:ac1725ba162c | 137 | /** current state of the netconn */ |
segundo | 0:ac1725ba162c | 138 | enum netconn_state state; |
segundo | 0:ac1725ba162c | 139 | /** the lwIP internal protocol control block */ |
segundo | 0:ac1725ba162c | 140 | union { |
segundo | 0:ac1725ba162c | 141 | struct ip_pcb *ip; |
segundo | 0:ac1725ba162c | 142 | struct tcp_pcb *tcp; |
segundo | 0:ac1725ba162c | 143 | struct udp_pcb *udp; |
segundo | 0:ac1725ba162c | 144 | struct raw_pcb *raw; |
segundo | 0:ac1725ba162c | 145 | } pcb; |
segundo | 0:ac1725ba162c | 146 | /** the last error this netconn had */ |
segundo | 0:ac1725ba162c | 147 | err_t last_err; |
segundo | 0:ac1725ba162c | 148 | /** sem that is used to synchroneously execute functions in the core context */ |
segundo | 0:ac1725ba162c | 149 | sys_sem_t op_completed; |
segundo | 0:ac1725ba162c | 150 | /** mbox where received packets are stored until they are fetched |
segundo | 0:ac1725ba162c | 151 | by the netconn application thread (can grow quite big) */ |
segundo | 0:ac1725ba162c | 152 | sys_mbox_t recvmbox; |
segundo | 0:ac1725ba162c | 153 | #if LWIP_TCP |
segundo | 0:ac1725ba162c | 154 | /** mbox where new connections are stored until processed |
segundo | 0:ac1725ba162c | 155 | by the application thread */ |
segundo | 0:ac1725ba162c | 156 | sys_mbox_t acceptmbox; |
segundo | 0:ac1725ba162c | 157 | #endif /* LWIP_TCP */ |
segundo | 0:ac1725ba162c | 158 | /** only used for socket layer */ |
segundo | 0:ac1725ba162c | 159 | #if LWIP_SOCKET |
segundo | 0:ac1725ba162c | 160 | int socket; |
segundo | 0:ac1725ba162c | 161 | #endif /* LWIP_SOCKET */ |
segundo | 0:ac1725ba162c | 162 | #if LWIP_SO_RCVTIMEO |
segundo | 0:ac1725ba162c | 163 | /** timeout to wait for new data to be received |
segundo | 0:ac1725ba162c | 164 | (or connections to arrive for listening netconns) */ |
segundo | 0:ac1725ba162c | 165 | int recv_timeout; |
segundo | 0:ac1725ba162c | 166 | #endif /* LWIP_SO_RCVTIMEO */ |
segundo | 0:ac1725ba162c | 167 | #if LWIP_SO_RCVBUF |
segundo | 0:ac1725ba162c | 168 | /** maximum amount of bytes queued in recvmbox |
segundo | 0:ac1725ba162c | 169 | not used for TCP: adjust TCP_WND instead! */ |
segundo | 0:ac1725ba162c | 170 | int recv_bufsize; |
segundo | 0:ac1725ba162c | 171 | #endif /* LWIP_SO_RCVBUF */ |
segundo | 0:ac1725ba162c | 172 | /** number of bytes currently in recvmbox to be received, |
segundo | 0:ac1725ba162c | 173 | tested against recv_bufsize to limit bytes on recvmbox |
segundo | 0:ac1725ba162c | 174 | for UDP and RAW |
segundo | 0:ac1725ba162c | 175 | @todo: should only be necessary with LWIP_SO_RCVBUF==1 */ |
segundo | 0:ac1725ba162c | 176 | s16_t recv_avail; |
segundo | 0:ac1725ba162c | 177 | /** flags holding more netconn-internal state, see NETCONN_FLAG_* defines */ |
segundo | 0:ac1725ba162c | 178 | u8_t flags; |
segundo | 0:ac1725ba162c | 179 | #if LWIP_TCP |
segundo | 0:ac1725ba162c | 180 | /** TCP: when data passed to netconn_write doesn't fit into the send buffer, |
segundo | 0:ac1725ba162c | 181 | this temporarily stores how much is already sent. */ |
segundo | 0:ac1725ba162c | 182 | size_t write_offset; |
segundo | 0:ac1725ba162c | 183 | /** TCP: when data passed to netconn_write doesn't fit into the send buffer, |
segundo | 0:ac1725ba162c | 184 | this temporarily stores the message. |
segundo | 0:ac1725ba162c | 185 | Also used during connect and close. */ |
segundo | 0:ac1725ba162c | 186 | struct api_msg_msg *current_msg; |
segundo | 0:ac1725ba162c | 187 | #endif /* LWIP_TCP */ |
segundo | 0:ac1725ba162c | 188 | /** A callback function that is informed about events for this netconn */ |
segundo | 0:ac1725ba162c | 189 | netconn_callback callback; |
segundo | 0:ac1725ba162c | 190 | }; |
segundo | 0:ac1725ba162c | 191 | |
segundo | 0:ac1725ba162c | 192 | /** Register an Network connection event */ |
segundo | 0:ac1725ba162c | 193 | #define API_EVENT(c,e,l) if (c->callback) { \ |
segundo | 0:ac1725ba162c | 194 | (*c->callback)(c, e, l); \ |
segundo | 0:ac1725ba162c | 195 | } |
segundo | 0:ac1725ba162c | 196 | |
segundo | 0:ac1725ba162c | 197 | /** Set conn->last_err to err but don't overwrite fatal errors */ |
segundo | 0:ac1725ba162c | 198 | #define NETCONN_SET_SAFE_ERR(conn, err) do { \ |
segundo | 0:ac1725ba162c | 199 | SYS_ARCH_DECL_PROTECT(lev); \ |
segundo | 0:ac1725ba162c | 200 | SYS_ARCH_PROTECT(lev); \ |
segundo | 0:ac1725ba162c | 201 | if (!ERR_IS_FATAL((conn)->last_err)) { \ |
segundo | 0:ac1725ba162c | 202 | (conn)->last_err = err; \ |
segundo | 0:ac1725ba162c | 203 | } \ |
segundo | 0:ac1725ba162c | 204 | SYS_ARCH_UNPROTECT(lev); \ |
segundo | 0:ac1725ba162c | 205 | } while(0); |
segundo | 0:ac1725ba162c | 206 | |
segundo | 0:ac1725ba162c | 207 | /* Network connection functions: */ |
segundo | 0:ac1725ba162c | 208 | #define netconn_new(t) netconn_new_with_proto_and_callback(t, 0, NULL) |
segundo | 0:ac1725ba162c | 209 | #define netconn_new_with_callback(t, c) netconn_new_with_proto_and_callback(t, 0, c) |
segundo | 0:ac1725ba162c | 210 | struct |
segundo | 0:ac1725ba162c | 211 | netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u8_t proto, |
segundo | 0:ac1725ba162c | 212 | netconn_callback callback); |
segundo | 0:ac1725ba162c | 213 | err_t netconn_delete(struct netconn *conn); |
segundo | 0:ac1725ba162c | 214 | /** Get the type of a netconn (as enum netconn_type). */ |
segundo | 0:ac1725ba162c | 215 | #define netconn_type(conn) (conn->type) |
segundo | 0:ac1725ba162c | 216 | |
segundo | 0:ac1725ba162c | 217 | err_t netconn_getaddr(struct netconn *conn, ip_addr_t *addr, |
segundo | 0:ac1725ba162c | 218 | u16_t *port, u8_t local); |
segundo | 0:ac1725ba162c | 219 | #define netconn_peer(c,i,p) netconn_getaddr(c,i,p,0) |
segundo | 0:ac1725ba162c | 220 | #define netconn_addr(c,i,p) netconn_getaddr(c,i,p,1) |
segundo | 0:ac1725ba162c | 221 | |
segundo | 0:ac1725ba162c | 222 | err_t netconn_bind(struct netconn *conn, ip_addr_t *addr, u16_t port); |
segundo | 0:ac1725ba162c | 223 | err_t netconn_connect(struct netconn *conn, ip_addr_t *addr, u16_t port); |
segundo | 0:ac1725ba162c | 224 | err_t netconn_disconnect (struct netconn *conn); |
segundo | 0:ac1725ba162c | 225 | err_t netconn_listen_with_backlog(struct netconn *conn, u8_t backlog); |
segundo | 0:ac1725ba162c | 226 | #define netconn_listen(conn) netconn_listen_with_backlog(conn, TCP_DEFAULT_LISTEN_BACKLOG) |
segundo | 0:ac1725ba162c | 227 | err_t netconn_accept(struct netconn *conn, struct netconn **new_conn); |
segundo | 0:ac1725ba162c | 228 | err_t netconn_recv(struct netconn *conn, struct netbuf **new_buf); |
segundo | 0:ac1725ba162c | 229 | err_t netconn_recv_tcp_pbuf(struct netconn *conn, struct pbuf **new_buf); |
segundo | 0:ac1725ba162c | 230 | void netconn_recved(struct netconn *conn, u32_t length); |
segundo | 0:ac1725ba162c | 231 | err_t netconn_sendto(struct netconn *conn, struct netbuf *buf, |
segundo | 0:ac1725ba162c | 232 | ip_addr_t *addr, u16_t port); |
segundo | 0:ac1725ba162c | 233 | err_t netconn_send(struct netconn *conn, struct netbuf *buf); |
segundo | 0:ac1725ba162c | 234 | err_t netconn_write(struct netconn *conn, const void *dataptr, size_t size, |
segundo | 0:ac1725ba162c | 235 | u8_t apiflags); |
segundo | 0:ac1725ba162c | 236 | err_t netconn_close(struct netconn *conn); |
segundo | 0:ac1725ba162c | 237 | err_t netconn_shutdown(struct netconn *conn, u8_t shut_rx, u8_t shut_tx); |
segundo | 0:ac1725ba162c | 238 | |
segundo | 0:ac1725ba162c | 239 | #if LWIP_IGMP |
segundo | 0:ac1725ba162c | 240 | err_t netconn_join_leave_group(struct netconn *conn, ip_addr_t *multiaddr, |
segundo | 0:ac1725ba162c | 241 | ip_addr_t *netif_addr, enum netconn_igmp join_or_leave); |
segundo | 0:ac1725ba162c | 242 | #endif /* LWIP_IGMP */ |
segundo | 0:ac1725ba162c | 243 | #if LWIP_DNS |
segundo | 0:ac1725ba162c | 244 | err_t netconn_gethostbyname(const char *name, ip_addr_t *addr); |
segundo | 0:ac1725ba162c | 245 | #endif /* LWIP_DNS */ |
segundo | 0:ac1725ba162c | 246 | |
segundo | 0:ac1725ba162c | 247 | #define netconn_err(conn) ((conn)->last_err) |
segundo | 0:ac1725ba162c | 248 | #define netconn_recv_bufsize(conn) ((conn)->recv_bufsize) |
segundo | 0:ac1725ba162c | 249 | |
segundo | 0:ac1725ba162c | 250 | /** Set the blocking status of netconn calls (@todo: write/send is missing) */ |
segundo | 0:ac1725ba162c | 251 | #define netconn_set_nonblocking(conn, val) do { if(val) { \ |
segundo | 0:ac1725ba162c | 252 | (conn)->flags |= NETCONN_FLAG_NON_BLOCKING; \ |
segundo | 0:ac1725ba162c | 253 | } else { \ |
segundo | 0:ac1725ba162c | 254 | (conn)->flags &= ~ NETCONN_FLAG_NON_BLOCKING; }} while(0) |
segundo | 0:ac1725ba162c | 255 | /** Get the blocking status of netconn calls (@todo: write/send is missing) */ |
segundo | 0:ac1725ba162c | 256 | #define netconn_is_nonblocking(conn) (((conn)->flags & NETCONN_FLAG_NON_BLOCKING) != 0) |
segundo | 0:ac1725ba162c | 257 | |
segundo | 0:ac1725ba162c | 258 | /** TCP: Set the no-auto-recved status of netconn calls (see NETCONN_FLAG_NO_AUTO_RECVED) */ |
segundo | 0:ac1725ba162c | 259 | #define netconn_set_noautorecved(conn, val) do { if(val) { \ |
segundo | 0:ac1725ba162c | 260 | (conn)->flags |= NETCONN_FLAG_NO_AUTO_RECVED; \ |
segundo | 0:ac1725ba162c | 261 | } else { \ |
segundo | 0:ac1725ba162c | 262 | (conn)->flags &= ~ NETCONN_FLAG_NO_AUTO_RECVED; }} while(0) |
segundo | 0:ac1725ba162c | 263 | /** TCP: Get the no-auto-recved status of netconn calls (see NETCONN_FLAG_NO_AUTO_RECVED) */ |
segundo | 0:ac1725ba162c | 264 | #define netconn_get_noautorecved(conn) (((conn)->flags & NETCONN_FLAG_NO_AUTO_RECVED) != 0) |
segundo | 0:ac1725ba162c | 265 | |
segundo | 0:ac1725ba162c | 266 | #if LWIP_SO_RCVTIMEO |
segundo | 0:ac1725ba162c | 267 | /** Set the receive timeout in milliseconds */ |
segundo | 0:ac1725ba162c | 268 | #define netconn_set_recvtimeout(conn, timeout) ((conn)->recv_timeout = (timeout)) |
segundo | 0:ac1725ba162c | 269 | /** Get the receive timeout in milliseconds */ |
segundo | 0:ac1725ba162c | 270 | #define netconn_get_recvtimeout(conn) ((conn)->recv_timeout) |
segundo | 0:ac1725ba162c | 271 | #endif /* LWIP_SO_RCVTIMEO */ |
segundo | 0:ac1725ba162c | 272 | #if LWIP_SO_RCVBUF |
segundo | 0:ac1725ba162c | 273 | /** Set the receive buffer in bytes */ |
segundo | 0:ac1725ba162c | 274 | #define netconn_set_recvbufsize(conn, recvbufsize) ((conn)->recv_bufsize = (recvbufsize)) |
segundo | 0:ac1725ba162c | 275 | /** Get the receive buffer in bytes */ |
segundo | 0:ac1725ba162c | 276 | #define netconn_get_recvbufsize(conn) ((conn)->recv_bufsize) |
segundo | 0:ac1725ba162c | 277 | #endif /* LWIP_SO_RCVBUF*/ |
segundo | 0:ac1725ba162c | 278 | |
segundo | 0:ac1725ba162c | 279 | #ifdef __cplusplus |
segundo | 0:ac1725ba162c | 280 | } |
segundo | 0:ac1725ba162c | 281 | #endif |
segundo | 0:ac1725ba162c | 282 | |
segundo | 0:ac1725ba162c | 283 | #endif /* LWIP_NETCONN */ |
segundo | 0:ac1725ba162c | 284 | |
segundo | 0:ac1725ba162c | 285 | #endif /* __LWIP_API_H__ */ |