mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-19 05:10:40 +00:00
opt.h, sockets.h: add new configuration options (LWIP_POSIX_SOCKETS_IO_NAMES, ETHARP_TRUST_IP_MAC, review SO_REUSE).
Also include directly tcp.h in sockets.h to improve application independancy from ip stack (avoid to include directly in application the "unknown" tcp.h if you need options like TCP_NODELAY and TCP_KEEPALIVE in application.
This commit is contained in:
parent
7b54ddd828
commit
ddf0982d0f
@ -42,6 +42,9 @@ HISTORY
|
|||||||
|
|
||||||
++ Bug fixes:
|
++ Bug fixes:
|
||||||
|
|
||||||
|
2007-03-05 Frédéric Bernon
|
||||||
|
* opt.h, sockets.h: add new configuration options (LWIP_POSIX_SOCKETS_IO_NAMES, ETHARP_TRUST_IP_MAC, review SO_REUSE)
|
||||||
|
|
||||||
2007-03-04 Frédéric Bernon
|
2007-03-04 Frédéric Bernon
|
||||||
* api_msg.c: Remove some compiler warnings : parameter "pcb" was never referenced.
|
* api_msg.c: Remove some compiler warnings : parameter "pcb" was never referenced.
|
||||||
|
|
||||||
|
@ -187,6 +187,19 @@ a lot of data that needs to be copied, this should be set high. */
|
|||||||
#define ARP_QUEUEING 1
|
#define ARP_QUEUEING 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* If enabled, incoming IP packets cause the ARP table to be updated
|
||||||
|
* with the source MAC and IP addresses supplied in the packet. You may
|
||||||
|
* want to disable this if you do not trust LAN peers to have the
|
||||||
|
* correct addresses, or as a limited approach to attempt to handle
|
||||||
|
* spoofing. If disabled, lwIP will need to make a new ARP request if
|
||||||
|
* the peer is not already in the ARP table, adding a little latency.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ETHARP_TRUST_IP_MAC
|
||||||
|
#define ETHARP_TRUST_IP_MAC 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* This option is deprecated */
|
/* This option is deprecated */
|
||||||
#ifdef ETHARP_QUEUE_FIRST
|
#ifdef ETHARP_QUEUE_FIRST
|
||||||
#error ETHARP_QUEUE_FIRST option is deprecated. Remove it from your lwipopts.h.
|
#error ETHARP_QUEUE_FIRST option is deprecated. Remove it from your lwipopts.h.
|
||||||
@ -316,15 +329,16 @@ a lot of data that needs to be copied, this should be set high. */
|
|||||||
#define TCP_WND 2048
|
#define TCP_WND 2048
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Maximum number of retransmissions of data segments. */
|
||||||
#ifndef TCP_MAXRTX
|
#ifndef TCP_MAXRTX
|
||||||
#define TCP_MAXRTX 12
|
#define TCP_MAXRTX 12
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Maximum number of retransmissions of SYN segments. */
|
||||||
#ifndef TCP_SYNMAXRTX
|
#ifndef TCP_SYNMAXRTX
|
||||||
#define TCP_SYNMAXRTX 6
|
#define TCP_SYNMAXRTX 6
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Controls if TCP should queue segments that arrive out of
|
/* Controls if TCP should queue segments that arrive out of
|
||||||
order. Define to 0 if your device is low on memory. */
|
order. Define to 0 if your device is low on memory. */
|
||||||
#ifndef TCP_QUEUE_OOSEQ
|
#ifndef TCP_QUEUE_OOSEQ
|
||||||
@ -347,11 +361,6 @@ a lot of data that needs to be copied, this should be set high. */
|
|||||||
#define TCP_SND_QUEUELEN 4 * TCP_SND_BUF/TCP_MSS
|
#define TCP_SND_QUEUELEN 4 * TCP_SND_BUF/TCP_MSS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Maximum number of retransmissions of data segments. */
|
|
||||||
|
|
||||||
/* Maximum number of retransmissions of SYN segments. */
|
|
||||||
|
|
||||||
/* TCP writable space (bytes). This must be less than or equal
|
/* TCP writable space (bytes). This must be less than or equal
|
||||||
to TCP_SND_BUF. It is the amount of space which must be
|
to TCP_SND_BUF. It is the amount of space which must be
|
||||||
available in the tcp snd_buf for select to return writable */
|
available in the tcp snd_buf for select to return writable */
|
||||||
@ -372,11 +381,6 @@ a lot of data that needs to be copied, this should be set high. */
|
|||||||
#define LWIP_CALLBACK_API 0
|
#define LWIP_CALLBACK_API 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LWIP_COMPAT_SOCKETS
|
|
||||||
#define LWIP_COMPAT_SOCKETS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef TCPIP_THREAD_PRIO
|
#ifndef TCPIP_THREAD_PRIO
|
||||||
#define TCPIP_THREAD_PRIO 1
|
#define TCPIP_THREAD_PRIO 1
|
||||||
#endif
|
#endif
|
||||||
@ -395,8 +399,23 @@ a lot of data that needs to be copied, this should be set high. */
|
|||||||
|
|
||||||
|
|
||||||
/* ---------- Socket Options ---------- */
|
/* ---------- Socket Options ---------- */
|
||||||
|
/* Enable BSD-style sockets functions names */
|
||||||
|
#ifndef LWIP_COMPAT_SOCKETS
|
||||||
|
#define LWIP_COMPAT_SOCKETS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Enable POSIX-style sockets functions names
|
||||||
|
Disable it if you use a POSIX operating system using same names (read, write & close) */
|
||||||
|
#ifndef LWIP_POSIX_SOCKETS_IO_NAMES
|
||||||
|
#define LWIP_POSIX_SOCKETS_IO_NAMES 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Enable SO_REUSEADDR and SO_REUSEPORT options */
|
/* Enable SO_REUSEADDR and SO_REUSEPORT options */
|
||||||
#ifdef SO_REUSE
|
#ifndef SO_REUSE
|
||||||
|
#define SO_REUSE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if SO_REUSE
|
||||||
/* I removed the lot since this was an ugly hack. It broke the raw-API.
|
/* I removed the lot since this was an ugly hack. It broke the raw-API.
|
||||||
It also came with many ugly goto's, Christiaan Simons. */
|
It also came with many ugly goto's, Christiaan Simons. */
|
||||||
#error "SO_REUSE currently unavailable, this was a hack"
|
#error "SO_REUSE currently unavailable, this was a hack"
|
||||||
|
@ -34,6 +34,8 @@
|
|||||||
#ifndef __LWIP_SOCKETS_H__
|
#ifndef __LWIP_SOCKETS_H__
|
||||||
#define __LWIP_SOCKETS_H__
|
#define __LWIP_SOCKETS_H__
|
||||||
#include "lwip/ip_addr.h"
|
#include "lwip/ip_addr.h"
|
||||||
|
#include "opt.h"
|
||||||
|
#include "tcp.h"
|
||||||
|
|
||||||
struct sockaddr_in {
|
struct sockaddr_in {
|
||||||
u8_t sin_len;
|
u8_t sin_len;
|
||||||
@ -223,6 +225,7 @@ struct linger {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void lwip_socket_init(void);
|
void lwip_socket_init(void);
|
||||||
|
|
||||||
int lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
|
int lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
|
||||||
int lwip_bind(int s, struct sockaddr *name, socklen_t namelen);
|
int lwip_bind(int s, struct sockaddr *name, socklen_t namelen);
|
||||||
int lwip_shutdown(int s, int how);
|
int lwip_shutdown(int s, int how);
|
||||||
@ -250,7 +253,7 @@ int lwip_ioctl(int s, long cmd, void *argp);
|
|||||||
#define accept(a,b,c) lwip_accept(a,b,c)
|
#define accept(a,b,c) lwip_accept(a,b,c)
|
||||||
#define bind(a,b,c) lwip_bind(a,b,c)
|
#define bind(a,b,c) lwip_bind(a,b,c)
|
||||||
#define shutdown(a,b) lwip_shutdown(a,b)
|
#define shutdown(a,b) lwip_shutdown(a,b)
|
||||||
#define close(s) lwip_close(s)
|
#define closesocket(s) lwip_close(s)
|
||||||
#define connect(a,b,c) lwip_connect(a,b,c)
|
#define connect(a,b,c) lwip_connect(a,b,c)
|
||||||
#define getsockname(a,b,c) lwip_getsockname(a,b,c)
|
#define getsockname(a,b,c) lwip_getsockname(a,b,c)
|
||||||
#define getpeername(a,b,c) lwip_getpeername(a,b,c)
|
#define getpeername(a,b,c) lwip_getpeername(a,b,c)
|
||||||
@ -258,14 +261,19 @@ int lwip_ioctl(int s, long cmd, void *argp);
|
|||||||
#define getsockopt(a,b,c,d,e) lwip_getsockopt(a,b,c,d,e)
|
#define getsockopt(a,b,c,d,e) lwip_getsockopt(a,b,c,d,e)
|
||||||
#define listen(a,b) lwip_listen(a,b)
|
#define listen(a,b) lwip_listen(a,b)
|
||||||
#define recv(a,b,c,d) lwip_recv(a,b,c,d)
|
#define recv(a,b,c,d) lwip_recv(a,b,c,d)
|
||||||
#define read(a,b,c) lwip_read(a,b,c)
|
|
||||||
#define recvfrom(a,b,c,d,e,f) lwip_recvfrom(a,b,c,d,e,f)
|
#define recvfrom(a,b,c,d,e,f) lwip_recvfrom(a,b,c,d,e,f)
|
||||||
#define send(a,b,c,d) lwip_send(a,b,c,d)
|
#define send(a,b,c,d) lwip_send(a,b,c,d)
|
||||||
#define sendto(a,b,c,d,e,f) lwip_sendto(a,b,c,d,e,f)
|
#define sendto(a,b,c,d,e,f) lwip_sendto(a,b,c,d,e,f)
|
||||||
#define socket(a,b,c) lwip_socket(a,b,c)
|
#define socket(a,b,c) lwip_socket(a,b,c)
|
||||||
#define write(a,b,c) lwip_write(a,b,c)
|
|
||||||
#define select(a,b,c,d,e) lwip_select(a,b,c,d,e)
|
#define select(a,b,c,d,e) lwip_select(a,b,c,d,e)
|
||||||
#define ioctlsocket(a,b,c) lwip_ioctl(a,b,c)
|
#define ioctlsocket(a,b,c) lwip_ioctl(a,b,c)
|
||||||
|
|
||||||
|
#if LWIP_POSIX_SOCKETS_IO_NAMES
|
||||||
|
#define read(a,b,c) lwip_read(a,b,c)
|
||||||
|
#define write(a,b,c) lwip_write(a,b,c)
|
||||||
|
#define close(s) lwip_close(s)
|
||||||
|
#endif /* LWIP_POSIX_SOCKETS_IO_NAMES */
|
||||||
|
|
||||||
#endif /* LWIP_COMPAT_SOCKETS */
|
#endif /* LWIP_COMPAT_SOCKETS */
|
||||||
|
|
||||||
#endif /* __LWIP_SOCKETS_H__ */
|
#endif /* __LWIP_SOCKETS_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user