Ethernetwebsoc

Dependencies:   C12832_lcd LM75B WebSocketClient mbed-rtos mbed Socket lwip-eth lwip-sys lwip

Committer:
GordonSin
Date:
Fri May 31 04:09:54 2013 +0000
Revision:
0:0ed2a7c7190c
31/5/2013;

Who changed what in which revision?

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