api.h, api_lib.c, api_msg.c, sockets.c, opt.h: add SO_RCVBUF option for UDP & RAW netconn. You need to set LWIP_SO_RCVBUF=1 in your lwipopts.h (it's disabled by default). Netconn API users can use the netconn_recv_bufsize macro to access it. This is a first release which have to be improve for TCP. Note it used the netconn::recv_avail which need to be more "thread-safe" (note there is already the problem for FIONREAD with lwip_ioctl/ioctlsocket).

This commit is contained in:
fbernon
2007-11-02 10:37:08 +00:00
parent 4a6f60937a
commit ecce865cfe
6 changed files with 53 additions and 4 deletions

View File

@@ -114,6 +114,9 @@ struct netconn {
#if LWIP_SO_RCVTIMEO
int recv_timeout;
#endif /* LWIP_SO_RCVTIMEO */
#if LWIP_SO_RCVBUF
int recv_bufsize;
#endif /* LWIP_SO_RCVBUF */
u16_t recv_avail;
/** TCP: when data passed to netconn_write doesn't fit into the send buffer,
this temporarily stores the message. */
@@ -176,7 +179,8 @@ err_t netconn_join_leave_group (struct netconn *conn,
enum netconn_igmp join_or_leave);
#endif /* LWIP_IGMP */
#define netconn_err(conn) ((conn)->err)
#define netconn_err(conn) ((conn)->err)
#define netconn_recv_bufsize(conn) ((conn)->recv_bufsize)
#ifdef __cplusplus
}

View File

@@ -927,6 +927,13 @@
#define LWIP_SO_RCVTIMEO 0
#endif
/**
* LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
*/
#ifndef LWIP_SO_RCVBUF
#define LWIP_SO_RCVBUF 0
#endif
/**
* SO_REUSE==1: Enable SO_REUSEADDR and SO_REUSEPORT options. DO NOT USE!
*/