mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-08 00:23:39 +08:00
rawapi.txt, api.h, api_lib.c, api_msg.h, api_msg.c, sockets.c, tcp.h, tcp.c, tcp_in.c, init.c, opt.h: rename backlog options with TCP_ prefix, limit the "backlog" parameter in an u8_t, 0 is interpreted as "smallest queue", add documentation in the rawapi.txt file.
This commit is contained in:
@@ -180,7 +180,7 @@ err_t netconn_connect (struct netconn *conn,
|
||||
u16_t port);
|
||||
err_t netconn_disconnect (struct netconn *conn);
|
||||
err_t netconn_listen_with_backlog(struct netconn *conn, u8_t backlog);
|
||||
#define netconn_listen(conn) netconn_listen_with_backlog(conn, LWIP_DEFAULT_LISTEN_BACKLOG);
|
||||
#define netconn_listen(conn) netconn_listen_with_backlog(conn, TCP_DEFAULT_LISTEN_BACKLOG)
|
||||
struct netconn * netconn_accept (struct netconn *conn);
|
||||
struct netbuf * netconn_recv (struct netconn *conn);
|
||||
err_t netconn_sendto (struct netconn *conn,
|
||||
|
||||
@@ -93,11 +93,11 @@ struct api_msg_msg {
|
||||
enum netconn_igmp join_or_leave;
|
||||
} jl;
|
||||
#endif /* LWIP_IGMP */
|
||||
#if LWIP_LISTEN_BACKLOG
|
||||
#if TCP_LISTEN_BACKLOG
|
||||
struct {
|
||||
u8_t backlog;
|
||||
} lb;
|
||||
#endif /* LWIP_LISTEN_BACKLOG */
|
||||
#endif /* TCP_LISTEN_BACKLOG */
|
||||
} msg;
|
||||
};
|
||||
|
||||
|
||||
@@ -713,6 +713,22 @@
|
||||
#define TCP_SNDLOWAT (TCP_SND_BUF/2)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* TCP_LISTEN_BACKLOG: Enable the backlog option for tcp listen pcb.
|
||||
*/
|
||||
#ifndef TCP_LISTEN_BACKLOG
|
||||
#define TCP_LISTEN_BACKLOG 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The maximum allowed backlog for TCP listen netconns.
|
||||
* This backlog is used unless another is explicitly specified.
|
||||
* 0xff is the maximum (u8_t).
|
||||
*/
|
||||
#ifndef TCP_DEFAULT_LISTEN_BACKLOG
|
||||
#define TCP_DEFAULT_LISTEN_BACKLOG 0xff
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LWIP_EVENT_API and LWIP_CALLBACK_API: Only one of these should be set to 1.
|
||||
* LWIP_EVENT_API==1: The user defines lwip_tcp_event() to receive all
|
||||
@@ -728,22 +744,6 @@
|
||||
#define LWIP_CALLBACK_API 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LWIP_LISTEN_BACKLOG: Enable the backlog option for tcp listen pcb.
|
||||
*/
|
||||
#ifndef LWIP_LISTEN_BACKLOG
|
||||
#define LWIP_LISTEN_BACKLOG 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The maximum allowed backlog for TCP listen netconns.
|
||||
* This backlog is used unless another is explicitly specified.
|
||||
* 0xff is the maximum (u8_t).
|
||||
*/
|
||||
#ifndef LWIP_DEFAULT_LISTEN_BACKLOG
|
||||
#define LWIP_DEFAULT_LISTEN_BACKLOG 0xff
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------
|
||||
|
||||
@@ -79,10 +79,11 @@ void tcp_err (struct tcp_pcb *pcb,
|
||||
#define tcp_mss(pcb) ((pcb)->mss)
|
||||
#define tcp_sndbuf(pcb) ((pcb)->snd_buf)
|
||||
|
||||
#if LWIP_LISTEN_BACKLOG
|
||||
#define tcp_accepted(pcb) (((struct tcp_pcb_listen *)(pcb))->accepts_pending--)
|
||||
#define tcp_backlog(pcb, bklog) (((struct tcp_pcb_listen *)(pcb))->backlog = bklog)
|
||||
#endif /* LWIP_LISTEN_BACKLOG */
|
||||
#if TCP_LISTEN_BACKLOG
|
||||
#define tcp_accepted(pcb) (((struct tcp_pcb_listen *)(pcb))->accepts_pending--)
|
||||
#else /* TCP_LISTEN_BACKLOG */
|
||||
#define tcp_accepted(pcb)
|
||||
#endif /* TCP_LISTEN_BACKLOG */
|
||||
|
||||
void tcp_recved (struct tcp_pcb *pcb, u16_t len);
|
||||
err_t tcp_bind (struct tcp_pcb *pcb, struct ip_addr *ipaddr,
|
||||
@@ -91,7 +92,10 @@ err_t tcp_connect (struct tcp_pcb *pcb, struct ip_addr *ipaddr,
|
||||
u16_t port, err_t (* connected)(void *arg,
|
||||
struct tcp_pcb *tpcb,
|
||||
err_t err));
|
||||
struct tcp_pcb * tcp_listen (struct tcp_pcb *pcb);
|
||||
|
||||
struct tcp_pcb * tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog);
|
||||
#define tcp_listen(pcb) tcp_listen_with_backlog(pcb, TCP_DEFAULT_LISTEN_BACKLOG)
|
||||
|
||||
void tcp_abort (struct tcp_pcb *pcb);
|
||||
err_t tcp_close (struct tcp_pcb *pcb);
|
||||
|
||||
@@ -422,10 +426,10 @@ struct tcp_pcb_listen {
|
||||
*/
|
||||
err_t (* accept)(void *arg, struct tcp_pcb *newpcb, err_t err);
|
||||
#endif /* LWIP_CALLBACK_API */
|
||||
#if LWIP_LISTEN_BACKLOG
|
||||
#if TCP_LISTEN_BACKLOG
|
||||
u8_t backlog;
|
||||
u8_t accepts_pending;
|
||||
#endif /* LWIP_LISTEN_BACKLOG */
|
||||
#endif /* TCP_LISTEN_BACKLOG */
|
||||
};
|
||||
|
||||
#if LWIP_EVENT_API
|
||||
|
||||
Reference in New Issue
Block a user