Skip to content

Commit f32ccfc

Browse files
committed
update to lwIP-2.1.0rc1: partial SACK support
fix esp8266#4176
1 parent 622569c commit f32ccfc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+3586
-1062
lines changed

tools/sdk/lib/liblwip2.a

189 KB
Binary file not shown.

tools/sdk/lib/liblwip2_1460.a

189 KB
Binary file not shown.

tools/sdk/lwip2/include/arch/cc.h

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ typedef uint32_t sys_prot_t; // not really used
6262
#define SYS_ARCH_DECL_PROTECT(lev)
6363
#define SYS_ARCH_PROTECT(lev) os_intr_lock()
6464
#define SYS_ARCH_UNPROTECT(lev) os_intr_unlock()
65+
#define LWIP_NO_CTYPE_H 1
6566

6667
///////////////////////////////
6768
//// DEBUG
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// generated by makefiles/make-lwip2-hash
22
#ifndef LWIP_HASH_H
33
#define LWIP_HASH_H
4-
#define LWIP_HASH_STR "STABLE-2_0_3_RELEASE/glue:arduino-2.4.1-13-g163bb82"
4+
#define LWIP_HASH_STR "/glue:arduino-2.4.2-8-gcd0eeed"
55
#endif // LWIP_HASH_H

tools/sdk/lwip2/include/lwip/api.h

+58-27
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,25 @@ extern "C" {
5858
*/
5959

6060
/* Flags for netconn_write (u8_t) */
61-
#define NETCONN_NOFLAG 0x00
62-
#define NETCONN_NOCOPY 0x00 /* Only for source code compatibility */
63-
#define NETCONN_COPY 0x01
64-
#define NETCONN_MORE 0x02
65-
#define NETCONN_DONTBLOCK 0x04
61+
#define NETCONN_NOFLAG 0x00
62+
#define NETCONN_NOCOPY 0x00 /* Only for source code compatibility */
63+
#define NETCONN_COPY 0x01
64+
#define NETCONN_MORE 0x02
65+
#define NETCONN_DONTBLOCK 0x04
66+
#define NETCONN_NOAUTORCVD 0x08 /* prevent netconn_recv_data_tcp() from updating the tcp window - must be done manually via netconn_tcp_recvd() */
67+
#define NETCONN_NOFIN 0x10 /* upper layer already received data, leave FIN in queue until called again */
6668

6769
/* Flags for struct netconn.flags (u8_t) */
70+
/** This netconn had an error, don't block on recvmbox/acceptmbox any more */
71+
#define NETCONN_FLAG_MBOXCLOSED 0x01
6872
/** Should this netconn avoid blocking? */
6973
#define NETCONN_FLAG_NON_BLOCKING 0x02
7074
/** Was the last connect action a non-blocking one? */
7175
#define NETCONN_FLAG_IN_NONBLOCKING_CONNECT 0x04
76+
#if LWIP_NETCONN_FULLDUPLEX
77+
/** The mbox of this netconn is being deallocated, don't use it anymore */
78+
#define NETCONN_FLAG_MBOXINVALID 0x08
79+
#endif /* LWIP_NETCONN_FULLDUPLEX */
7280
/** If a nonblocking write has been rejected before, poll_tcp needs to
7381
check if the netconn is writable again */
7482
#define NETCONN_FLAG_CHECK_WRITESPACE 0x10
@@ -78,7 +86,12 @@ extern "C" {
7886
dual-stack usage by default. */
7987
#define NETCONN_FLAG_IPV6_V6ONLY 0x20
8088
#endif /* LWIP_IPV6 */
81-
89+
#if LWIP_NETBUF_RECVINFO
90+
/** Received packet info will be recorded for this netconn */
91+
#define NETCONN_FLAG_PKTINFO 0x40
92+
#endif /* LWIP_NETBUF_RECVINFO */
93+
/** A FIN has been received but not passed to the application yet */
94+
#define NETCONN_FIN_RX_PENDING 0x80
8295

8396
/* Helpers to process several netconn_types by the same code */
8497
#define NETCONNTYPE_GROUP(t) ((t)&0xF0)
@@ -214,8 +227,8 @@ struct netconn {
214227
struct udp_pcb *udp;
215228
struct raw_pcb *raw;
216229
} pcb;
217-
/** the last error this netconn had */
218-
err_t last_err;
230+
/** the last asynchronous unreported error this netconn had */
231+
err_t pending_err;
219232
#if !LWIP_NETCONN_SEM_PER_THREAD
220233
/** sem that is used to synchronously execute functions in the core context */
221234
sys_sem_t op_completed;
@@ -228,6 +241,11 @@ struct netconn {
228241
by the application thread */
229242
sys_mbox_t acceptmbox;
230243
#endif /* LWIP_TCP */
244+
#if LWIP_NETCONN_FULLDUPLEX
245+
/** number of threads waiting on an mbox. This is required to unblock
246+
all threads when closing while threads are waiting. */
247+
int mbox_threads_waiting;
248+
#endif
231249
/** only used for socket layer */
232250
#if LWIP_SOCKET
233251
int socket;
@@ -240,7 +258,7 @@ struct netconn {
240258
#if LWIP_SO_RCVTIMEO
241259
/** timeout in milliseconds to wait for new data to be received
242260
(or connections to arrive for listening netconns) */
243-
int recv_timeout;
261+
u32_t recv_timeout;
244262
#endif /* LWIP_SO_RCVTIMEO */
245263
#if LWIP_SO_RCVBUF
246264
/** maximum amount of bytes queued in recvmbox
@@ -258,9 +276,6 @@ struct netconn {
258276
/** flags holding more netconn-internal state, see NETCONN_FLAG_* defines */
259277
u8_t flags;
260278
#if LWIP_TCP
261-
/** TCP: when data passed to netconn_write doesn't fit into the send buffer,
262-
this temporarily stores how much is already sent. */
263-
size_t write_offset;
264279
/** TCP: when data passed to netconn_write doesn't fit into the send buffer,
265280
this temporarily stores the message.
266281
Also used during connect and close. */
@@ -270,21 +285,23 @@ struct netconn {
270285
netconn_callback callback;
271286
};
272287

288+
/** This vector type is passed to @ref netconn_write_vectors_partly to send
289+
* multiple buffers at once.
290+
* ATTENTION: This type has to directly map struct iovec since one is casted
291+
* into the other!
292+
*/
293+
struct netvector {
294+
/** pointer to the application buffer that contains the data to send */
295+
const void *ptr;
296+
/** size of the application data to send */
297+
size_t len;
298+
};
299+
273300
/** Register an Network connection event */
274301
#define API_EVENT(c,e,l) if (c->callback) { \
275302
(*c->callback)(c, e, l); \
276303
}
277304

278-
/** Set conn->last_err to err but don't overwrite fatal errors */
279-
#define NETCONN_SET_SAFE_ERR(conn, err) do { if ((conn) != NULL) { \
280-
SYS_ARCH_DECL_PROTECT(netconn_set_safe_err_lev); \
281-
SYS_ARCH_PROTECT(netconn_set_safe_err_lev); \
282-
if (!ERR_IS_FATAL((conn)->last_err)) { \
283-
(conn)->last_err = err; \
284-
} \
285-
SYS_ARCH_UNPROTECT(netconn_set_safe_err_lev); \
286-
}} while(0);
287-
288305
/* Network connection functions: */
289306

290307
/** @ingroup netconn_common
@@ -294,6 +311,7 @@ struct netconn {
294311
#define netconn_new_with_callback(t, c) netconn_new_with_proto_and_callback(t, 0, c)
295312
struct netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u8_t proto,
296313
netconn_callback callback);
314+
err_t netconn_prepare_delete(struct netconn *conn);
297315
err_t netconn_delete(struct netconn *conn);
298316
/** Get the type of a netconn (as enum netconn_type). */
299317
#define netconn_type(conn) (conn->type)
@@ -306,19 +324,26 @@ err_t netconn_getaddr(struct netconn *conn, ip_addr_t *addr,
306324
#define netconn_addr(c,i,p) netconn_getaddr(c,i,p,1)
307325

308326
err_t netconn_bind(struct netconn *conn, const ip_addr_t *addr, u16_t port);
327+
err_t netconn_bind_if(struct netconn *conn, u8_t if_idx);
309328
err_t netconn_connect(struct netconn *conn, const ip_addr_t *addr, u16_t port);
310329
err_t netconn_disconnect (struct netconn *conn);
311330
err_t netconn_listen_with_backlog(struct netconn *conn, u8_t backlog);
312331
/** @ingroup netconn_tcp */
313332
#define netconn_listen(conn) netconn_listen_with_backlog(conn, TCP_DEFAULT_LISTEN_BACKLOG)
314333
err_t netconn_accept(struct netconn *conn, struct netconn **new_conn);
315334
err_t netconn_recv(struct netconn *conn, struct netbuf **new_buf);
335+
err_t netconn_recv_udp_raw_netbuf(struct netconn *conn, struct netbuf **new_buf);
336+
err_t netconn_recv_udp_raw_netbuf_flags(struct netconn *conn, struct netbuf **new_buf, u8_t apiflags);
316337
err_t netconn_recv_tcp_pbuf(struct netconn *conn, struct pbuf **new_buf);
338+
err_t netconn_recv_tcp_pbuf_flags(struct netconn *conn, struct pbuf **new_buf, u8_t apiflags);
339+
err_t netconn_tcp_recvd(struct netconn *conn, size_t len);
317340
err_t netconn_sendto(struct netconn *conn, struct netbuf *buf,
318341
const ip_addr_t *addr, u16_t port);
319342
err_t netconn_send(struct netconn *conn, struct netbuf *buf);
320343
err_t netconn_write_partly(struct netconn *conn, const void *dataptr, size_t size,
321344
u8_t apiflags, size_t *bytes_written);
345+
err_t netconn_write_vectors_partly(struct netconn *conn, struct netvector *vectors, u16_t vectorcnt,
346+
u8_t apiflags, size_t *bytes_written);
322347
/** @ingroup netconn_tcp */
323348
#define netconn_write(conn, dataptr, size, apiflags) \
324349
netconn_write_partly(conn, dataptr, size, apiflags, NULL)
@@ -328,6 +353,8 @@ err_t netconn_shutdown(struct netconn *conn, u8_t shut_rx, u8_t shut_tx);
328353
#if LWIP_IGMP || (LWIP_IPV6 && LWIP_IPV6_MLD)
329354
err_t netconn_join_leave_group(struct netconn *conn, const ip_addr_t *multiaddr,
330355
const ip_addr_t *netif_addr, enum netconn_igmp join_or_leave);
356+
err_t netconn_join_leave_group_netif(struct netconn *conn, const ip_addr_t *multiaddr,
357+
u8_t if_idx, enum netconn_igmp join_or_leave);
331358
#endif /* LWIP_IGMP || (LWIP_IPV6 && LWIP_IPV6_MLD) */
332359
#if LWIP_DNS
333360
#if LWIP_IPV4 && LWIP_IPV6
@@ -339,14 +366,18 @@ err_t netconn_gethostbyname(const char *name, ip_addr_t *addr);
339366
#endif /* LWIP_IPV4 && LWIP_IPV6 */
340367
#endif /* LWIP_DNS */
341368

342-
#define netconn_err(conn) ((conn)->last_err)
369+
err_t netconn_err(struct netconn *conn);
343370
#define netconn_recv_bufsize(conn) ((conn)->recv_bufsize)
344371

372+
#define netconn_set_flags(conn, set_flags) do { (conn)->flags = (u8_t)((conn)->flags | (set_flags)); } while(0)
373+
#define netconn_clear_flags(conn, clr_flags) do { (conn)->flags = (u8_t)((conn)->flags & (u8_t)(~(clr_flags) & 0xff)); } while(0)
374+
#define netconn_is_flag_set(conn, flag) (((conn)->flags & (flag)) != 0)
375+
345376
/** Set the blocking status of netconn calls (@todo: write/send is missing) */
346377
#define netconn_set_nonblocking(conn, val) do { if(val) { \
347-
(conn)->flags |= NETCONN_FLAG_NON_BLOCKING; \
378+
netconn_set_flags(conn, NETCONN_FLAG_NON_BLOCKING); \
348379
} else { \
349-
(conn)->flags &= ~ NETCONN_FLAG_NON_BLOCKING; }} while(0)
380+
netconn_clear_flags(conn, NETCONN_FLAG_NON_BLOCKING); }} while(0)
350381
/** Get the blocking status of netconn calls (@todo: write/send is missing) */
351382
#define netconn_is_nonblocking(conn) (((conn)->flags & NETCONN_FLAG_NON_BLOCKING) != 0)
352383

@@ -355,9 +386,9 @@ err_t netconn_gethostbyname(const char *name, ip_addr_t *addr);
355386
* TCP: Set the IPv6 ONLY status of netconn calls (see NETCONN_FLAG_IPV6_V6ONLY)
356387
*/
357388
#define netconn_set_ipv6only(conn, val) do { if(val) { \
358-
(conn)->flags |= NETCONN_FLAG_IPV6_V6ONLY; \
389+
netconn_set_flags(conn, NETCONN_FLAG_IPV6_V6ONLY); \
359390
} else { \
360-
(conn)->flags &= ~ NETCONN_FLAG_IPV6_V6ONLY; }} while(0)
391+
netconn_clear_flags(conn, NETCONN_FLAG_IPV6_V6ONLY); }} while(0)
361392
/** @ingroup netconn_common
362393
* TCP: Get the IPv6 ONLY status of netconn calls (see NETCONN_FLAG_IPV6_V6ONLY)
363394
*/

tools/sdk/lwip2/include/lwip/apps/fs.h

+24-1
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,23 @@ struct fsdata_chksum {
5252

5353
#define FS_FILE_FLAGS_HEADER_INCLUDED 0x01
5454
#define FS_FILE_FLAGS_HEADER_PERSISTENT 0x02
55+
#define FS_FILE_FLAGS_HEADER_HTTPVER_1_1 0x04
56+
#define FS_FILE_FLAGS_SSI 0x08
57+
58+
/** Define FS_FILE_EXTENSION_T_DEFINED if you have typedef'ed to your private
59+
* pointer type (defaults to 'void' so the default usage is 'void*')
60+
*/
61+
#ifndef FS_FILE_EXTENSION_T_DEFINED
62+
typedef void fs_file_extension;
63+
#endif
5564

5665
struct fs_file {
5766
const char *data;
5867
int len;
5968
int index;
60-
void *pextension;
69+
/* pextension is free for implementations to hold private (extensional)
70+
arbitrary data, e.g. holding some file state or file system handle */
71+
fs_file_extension *pextension;
6172
#if HTTPD_PRECALCULATED_CHECKSUM
6273
const struct fsdata_chksum *chksum;
6374
u16_t chksum_count;
@@ -96,6 +107,18 @@ void *fs_state_init(struct fs_file *file, const char *name);
96107
void fs_state_free(struct fs_file *file, void *state);
97108
#endif /* #if LWIP_HTTPD_FILE_STATE */
98109

110+
struct fsdata_file {
111+
const struct fsdata_file *next;
112+
const unsigned char *name;
113+
const unsigned char *data;
114+
int len;
115+
u8_t flags;
116+
#if HTTPD_PRECALCULATED_CHECKSUM
117+
u16_t chksum_count;
118+
const struct fsdata_chksum *chksum;
119+
#endif /* HTTPD_PRECALCULATED_CHECKSUM */
120+
};
121+
99122
#ifdef __cplusplus
100123
}
101124
#endif

0 commit comments

Comments
 (0)