ProjetoBB

Dependencies:   F7_Ethernet WebSocketClient mbed mcp3008

Fork of Nucleo_F746ZG_Ethernet by Dieter Graef

Committer:
DieterGraef
Date:
Sat Jun 18 10:49:12 2016 +0000
Revision:
0:f9b6112278fe
Ethernet for the NUCLEO STM32F746 Board Testprogram uses DHCP and NTP to set the clock

Who changed what in which revision?

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