Improve LWIP_EVENT_API compilation

This commit is contained in:
goldsimon 2016-08-08 08:49:14 +02:00
parent fc66fb830c
commit 08378b7d4b
3 changed files with 24 additions and 17 deletions

View File

@ -2,15 +2,6 @@
* @file
* Transmission Control Protocol for IP
* See also @ref tcp_raw
*
* @defgroup tcp_raw TCP
* @ingroup callbackstyle_api
* Transmission Control Protocol for IP\n
* @see @ref raw_api and @ref netconn
*
* Common functions for the TCP implementation, such as functinos
* for manipulating the data structures and the TCP timer functions. TCP functions
* related to input and output is found in tcp_in.c and tcp_out.c respectively.\n
*/
/*
@ -45,6 +36,17 @@
*
*/
/**
* @defgroup tcp_raw TCP
* @ingroup raw_api
* Transmission Control Protocol for IP\n
* @see @ref raw_api and @ref netconn
*
* Common functions for the TCP implementation, such as functinos
* for manipulating the data structures and the TCP timer functions. TCP functions
* related to input and output is found in tcp_in.c and tcp_out.c respectively.\n
*/
#include "lwip/opt.h"
#if LWIP_TCP /* don't build if not configured for use in lwipopts.h */
@ -1095,7 +1097,7 @@ tcp_slowtmr_start:
if (pcb_remove) {
struct tcp_pcb *pcb2;
#if LWIP_CALLBACK_API
tcp_err_fn err_fn;
tcp_err_fn err_fn = pcb->errf;
#endif /* LWIP_CALLBACK_API */
void *err_arg;
tcp_pcb_purge(pcb);
@ -1114,9 +1116,6 @@ tcp_slowtmr_start:
pcb->local_port, pcb->remote_port);
}
#if LWIP_CALLBACK_API
err_fn = pcb->errf;
#endif /* LWIP_CALLBACK_API */
err_arg = pcb->callback_arg;
pcb2 = pcb;
pcb = pcb->next;
@ -1681,7 +1680,6 @@ tcp_sent(struct tcp_pcb *pcb, tcp_sent_fn sent)
* @ingroup tcp_raw
* Used to specify the function that should be called when a fatal error
* has occurred on the connection.
* @note The corresponding pcb is already freed when this callback is called!
*
* @param pcb tcp_pcb to set the err callback
* @param err callback function to call for this pcb when a fatal error

View File

@ -1325,6 +1325,13 @@
#if !defined(LWIP_EVENT_API) && !defined(LWIP_CALLBACK_API) || defined __DOXYGEN__
#define LWIP_EVENT_API 0
#define LWIP_CALLBACK_API 1
#else
#ifndef LWIP_EVENT_API
#define LWIP_EVENT_API 0
#endif
#ifndef LWIP_CALLBACK_API
#define LWIP_CALLBACK_API 0
#endif
#endif
/**
@ -1359,7 +1366,7 @@
* Ethernet.
*/
#if !defined PBUF_LINK_HLEN || defined __DOXYGEN__
#if defined LWIP_HOOK_VLAN_SET
#if defined LWIP_HOOK_VLAN_SET || defined __DOXYGEN__
#define PBUF_LINK_HLEN (18 + ETH_PAD_SIZE)
#else /* LWIP_HOOK_VLAN_SET */
#define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE)

View File

@ -350,11 +350,13 @@ struct tcp_pcb * tcp_new (void);
struct tcp_pcb * tcp_new_ip_type (u8_t type);
void tcp_arg (struct tcp_pcb *pcb, void *arg);
void tcp_accept (struct tcp_pcb *pcb, tcp_accept_fn accept);
#if LWIP_CALLBACK_API
void tcp_recv (struct tcp_pcb *pcb, tcp_recv_fn recv);
void tcp_sent (struct tcp_pcb *pcb, tcp_sent_fn sent);
void tcp_poll (struct tcp_pcb *pcb, tcp_poll_fn poll, u8_t interval);
void tcp_err (struct tcp_pcb *pcb, tcp_err_fn err);
void tcp_accept (struct tcp_pcb *pcb, tcp_accept_fn accept);
#endif /* LWIP_CALLBACK_API */
void tcp_poll (struct tcp_pcb *pcb, tcp_poll_fn poll, u8_t interval);
#define tcp_mss(pcb) (((pcb)->flags & TF_TIMESTAMP) ? ((pcb)->mss - 12) : (pcb)->mss)
#define tcp_sndbuf(pcb) (TCPWND16((pcb)->snd_buf))