Integrating the ublox LISA C200 modem

Fork of SprintUSBModemHTTPClientTest by Donatien Garnier

Committer:
sam_grove
Date:
Thu Sep 26 00:44:20 2013 -0500
Revision:
5:3f93dd1d4cb3
Exported program and replaced contents of the repo with the source
to build and debug using keil mdk. Libs NOT upto date are lwip, lwip-sys
and socket. these have newer versions under mbed_official but were starting
from a know working point

Who changed what in which revision?

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