minor/coding style: removed spaces before line ending

This commit is contained in:
sg 2015-10-06 21:08:28 +02:00
parent 0737cfb84e
commit 490581a0eb
48 changed files with 215 additions and 224 deletions

View File

@ -3,7 +3,7 @@
* Sequential API External module * Sequential API External module
* *
*/ */
/* /*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.

View File

@ -350,7 +350,7 @@ sent_tcp(void *arg, struct tcp_pcb *pcb, u16_t len)
API_EVENT(conn, NETCONN_EVT_SENDPLUS, len); API_EVENT(conn, NETCONN_EVT_SENDPLUS, len);
} }
} }
return ERR_OK; return ERR_OK;
} }
@ -1466,7 +1466,7 @@ lwip_netconn_do_writemore(struct netconn *conn WRITE_DELAYED_PARAM)
if (available < len) { if (available < len) {
/* don't try to write more than sendbuf */ /* don't try to write more than sendbuf */
len = available; len = available;
if (dontblock) { if (dontblock) {
if (!len) { if (!len) {
err = ERR_WOULDBLOCK; err = ERR_WOULDBLOCK;
goto err_mem; goto err_mem;
@ -1760,7 +1760,7 @@ lwip_netconn_do_close(struct api_msg_msg *msg)
*/ */
void void
lwip_netconn_do_join_leave_group(struct api_msg_msg *msg) lwip_netconn_do_join_leave_group(struct api_msg_msg *msg)
{ {
if (ERR_IS_FATAL(msg->conn->last_err)) { if (ERR_IS_FATAL(msg->conn->last_err)) {
msg->err = msg->conn->last_err; msg->err = msg->conn->last_err;
} else { } else {

View File

@ -57,7 +57,7 @@ static const char *err_strerr[] = {
"Connection reset.", /* ERR_RST -13 */ "Connection reset.", /* ERR_RST -13 */
"Connection closed.", /* ERR_CLSD -14 */ "Connection closed.", /* ERR_CLSD -14 */
"Illegal argument.", /* ERR_ARG -15 */ "Illegal argument.", /* ERR_ARG -15 */
"Low-level netif error.", /* ERR_IF -16 */ "Low-level netif error." /* ERR_IF -16 */
}; };
/** /**
@ -70,7 +70,6 @@ const char *
lwip_strerr(err_t err) lwip_strerr(err_t err)
{ {
return err_strerr[-err]; return err_strerr[-err];
} }
#endif /* LWIP_DEBUG */ #endif /* LWIP_DEBUG */

View File

@ -256,7 +256,7 @@ lwip_freeaddrinfo(struct addrinfo *ai)
* *
* @param nodename descriptive name or address string of the host * @param nodename descriptive name or address string of the host
* (may be NULL -> local address) * (may be NULL -> local address)
* @param servname port number as string of NULL * @param servname port number as string of NULL
* @param hints structure containing input values that set socktype and protocol * @param hints structure containing input values that set socktype and protocol
* @param res pointer to a pointer where to store the result (set to NULL on failure) * @param res pointer to a pointer where to store the result (set to NULL on failure)
* @return 0 on success, non-zero on failure * @return 0 on success, non-zero on failure
@ -286,7 +286,7 @@ lwip_getaddrinfo(const char *nodename, const char *servname,
if (hints != NULL) { if (hints != NULL) {
ai_family = hints->ai_family; ai_family = hints->ai_family;
if ((ai_family != AF_UNSPEC) if ((ai_family != AF_UNSPEC)
#if LWIP_IPV4 #if LWIP_IPV4
&& (ai_family != AF_INET) && (ai_family != AF_INET)
#endif /* LWIP_IPV4 */ #endif /* LWIP_IPV4 */

View File

@ -771,7 +771,7 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
buf = sock->lastdata; buf = sock->lastdata;
} else { } else {
/* If this is non-blocking call, then check first */ /* If this is non-blocking call, then check first */
if (((flags & MSG_DONTWAIT) || netconn_is_nonblocking(sock->conn)) && if (((flags & MSG_DONTWAIT) || netconn_is_nonblocking(sock->conn)) &&
(sock->rcvevent <= 0)) { (sock->rcvevent <= 0)) {
if (off > 0) { if (off > 0) {
/* update receive window */ /* update receive window */
@ -847,9 +847,9 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP) { if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP) {
LWIP_ASSERT("invalid copylen, len would underflow", len >= copylen); LWIP_ASSERT("invalid copylen, len would underflow", len >= copylen);
len -= copylen; len -= copylen;
if ( (len <= 0) || if ( (len <= 0) ||
(p->flags & PBUF_FLAG_PUSH) || (p->flags & PBUF_FLAG_PUSH) ||
(sock->rcvevent <= 0) || (sock->rcvevent <= 0) ||
((flags & MSG_PEEK)!=0)) { ((flags & MSG_PEEK)!=0)) {
done = 1; done = 1;
} }
@ -1274,7 +1274,7 @@ int
lwip_writev(int s, const struct iovec *iov, int iovcnt) lwip_writev(int s, const struct iovec *iov, int iovcnt)
{ {
struct msghdr msg; struct msghdr msg;
msg.msg_name = NULL; msg.msg_name = NULL;
msg.msg_namelen = 0; msg.msg_namelen = 0;
/* Hack: we have to cast via number to cast from 'const' pointer to non-const. /* Hack: we have to cast via number to cast from 'const' pointer to non-const.

View File

@ -374,7 +374,7 @@ tcpip_apimsg(struct api_msg *apimsg)
/* catch functions that don't set err */ /* catch functions that don't set err */
apimsg->msg.err = ERR_VAL; apimsg->msg.err = ERR_VAL;
#endif #endif
if (sys_mbox_valid_val(mbox)) { if (sys_mbox_valid_val(mbox)) {
TCPIP_MSG_VAR_ALLOC(msg); TCPIP_MSG_VAR_ALLOC(msg);
TCPIP_MSG_VAR_REF(msg).type = TCPIP_MSG_API; TCPIP_MSG_VAR_REF(msg).type = TCPIP_MSG_API;
@ -417,7 +417,7 @@ tcpip_netifapi(struct netifapi_msg* netifapimsg)
netifapimsg->msg.err = err; netifapimsg->msg.err = err;
return err; return err;
} }
TCPIP_MSG_VAR_REF(msg).type = TCPIP_MSG_NETIFAPI; TCPIP_MSG_VAR_REF(msg).type = TCPIP_MSG_NETIFAPI;
TCPIP_MSG_VAR_REF(msg).msg.netifapimsg = netifapimsg; TCPIP_MSG_VAR_REF(msg).msg.netifapimsg = netifapimsg;
sys_mbox_post(&mbox, &TCPIP_MSG_VAR_REF(msg)); sys_mbox_post(&mbox, &TCPIP_MSG_VAR_REF(msg));
@ -440,7 +440,7 @@ tcpip_netifapi(struct netifapi_msg* netifapimsg)
err_t err_t
tcpip_netifapi_lock(struct netifapi_msg* netifapimsg) tcpip_netifapi_lock(struct netifapi_msg* netifapimsg)
{ {
LOCK_TCPIP_CORE(); LOCK_TCPIP_CORE();
netifapimsg->function(&(netifapimsg->msg)); netifapimsg->function(&(netifapimsg->msg));
UNLOCK_TCPIP_CORE(); UNLOCK_TCPIP_CORE();
return netifapimsg->msg.err; return netifapimsg->msg.err;

View File

@ -44,7 +44,7 @@
* Again with the aim of being simple, correct and fully portable. * Again with the aim of being simple, correct and fully portable.
* Byte swapping is the second thing you would want to optimize. You will * Byte swapping is the second thing you would want to optimize. You will
* need to port it to your architecture and in your cc.h: * need to port it to your architecture and in your cc.h:
* *
* #define LWIP_PLATFORM_BYTESWAP 1 * #define LWIP_PLATFORM_BYTESWAP 1
* #define LWIP_PLATFORM_HTONS(x) <your_htons> * #define LWIP_PLATFORM_HTONS(x) <your_htons>
* #define LWIP_PLATFORM_HTONL(x) <your_htonl> * #define LWIP_PLATFORM_HTONL(x) <your_htonl>

View File

@ -211,7 +211,7 @@ static void
dhcp_handle_nak(struct netif *netif) dhcp_handle_nak(struct netif *netif)
{ {
struct dhcp *dhcp = netif->dhcp; struct dhcp *dhcp = netif->dhcp;
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_handle_nak(netif=%p) %c%c%"U16_F"\n", LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_handle_nak(netif=%p) %c%c%"U16_F"\n",
(void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num)); (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num));
/* remove IP address from interface (must no longer be used, as per RFC2131) */ /* remove IP address from interface (must no longer be used, as per RFC2131) */
netif_set_addr(netif, IP4_ADDR_ANY, IP4_ADDR_ANY, IP4_ADDR_ANY); netif_set_addr(netif, IP4_ADDR_ANY, IP4_ADDR_ANY, IP4_ADDR_ANY);
@ -394,7 +394,7 @@ dhcp_fine_tmr(void)
while (netif != NULL) { while (netif != NULL) {
/* only act on DHCP configured interfaces */ /* only act on DHCP configured interfaces */
if (netif->dhcp != NULL) { if (netif->dhcp != NULL) {
/* timer is active (non zero), and is about to trigger now */ /* timer is active (non zero), and is about to trigger now */
if (netif->dhcp->request_timeout > 1) { if (netif->dhcp->request_timeout > 1) {
netif->dhcp->request_timeout--; netif->dhcp->request_timeout--;
} }

View File

@ -49,8 +49,8 @@
* aim of being simple, correct and fully portable. Checksumming is the * aim of being simple, correct and fully portable. Checksumming is the
* first thing you would want to optimize for your platform. If you create * first thing you would want to optimize for your platform. If you create
* your own version, link it in and in your cc.h put: * your own version, link it in and in your cc.h put:
* *
* #define LWIP_CHKSUM <your_checksum_routine> * #define LWIP_CHKSUM <your_checksum_routine>
* *
* Or you can select from the implementations below by defining * Or you can select from the implementations below by defining
* LWIP_CHKSUM_ALGORITHM to 1, 2 or 3. * LWIP_CHKSUM_ALGORITHM to 1, 2 or 3.
@ -74,7 +74,7 @@ u16_t lwip_standard_chksum(const void *dataptr, int len);
* *
* @param dataptr points to start of data to be summed at any boundary * @param dataptr points to start of data to be summed at any boundary
* @param len length of data to be summed * @param len length of data to be summed
* @return host order (!) lwip checksum (non-inverted Internet sum) * @return host order (!) lwip checksum (non-inverted Internet sum)
* *
* @note accumulator size limits summable length to 64k * @note accumulator size limits summable length to 64k
* @note host endianess is irrelevant (p3 RFC1071) * @note host endianess is irrelevant (p3 RFC1071)
@ -130,9 +130,8 @@ lwip_standard_chksum(const void *dataptr, int len)
* *
* @param dataptr points to start of data to be summed at any boundary * @param dataptr points to start of data to be summed at any boundary
* @param len length of data to be summed * @param len length of data to be summed
* @return host order (!) lwip checksum (non-inverted Internet sum) * @return host order (!) lwip checksum (non-inverted Internet sum)
*/ */
u16_t u16_t
lwip_standard_chksum(const void *dataptr, int len) lwip_standard_chksum(const void *dataptr, int len)
{ {
@ -181,15 +180,14 @@ lwip_standard_chksum(const void *dataptr, int len)
/** /**
* An optimized checksum routine. Basically, it uses loop-unrolling on * An optimized checksum routine. Basically, it uses loop-unrolling on
* the checksum loop, treating the head and tail bytes specially, whereas * the checksum loop, treating the head and tail bytes specially, whereas
* the inner loop acts on 8 bytes at a time. * the inner loop acts on 8 bytes at a time.
* *
* @arg start of buffer to be checksummed. May be an odd byte address. * @arg start of buffer to be checksummed. May be an odd byte address.
* @len number of bytes in the buffer to be checksummed. * @len number of bytes in the buffer to be checksummed.
* @return host order (!) lwip checksum (non-inverted Internet sum) * @return host order (!) lwip checksum (non-inverted Internet sum)
* *
* by Curt McDowell, Broadcom Corp. December 8th, 2005 * by Curt McDowell, Broadcom Corp. December 8th, 2005
*/ */
u16_t u16_t
lwip_standard_chksum(const void *dataptr, int len) lwip_standard_chksum(const void *dataptr, int len)
{ {

View File

@ -228,7 +228,7 @@
#if NETCONN_MORE != TCP_WRITE_FLAG_MORE #if NETCONN_MORE != TCP_WRITE_FLAG_MORE
#error "NETCONN_MORE != TCP_WRITE_FLAG_MORE" #error "NETCONN_MORE != TCP_WRITE_FLAG_MORE"
#endif #endif
#endif /* LWIP_NETCONN && LWIP_TCP */ #endif /* LWIP_NETCONN && LWIP_TCP */
#if LWIP_SOCKET #if LWIP_SOCKET
/* Check that the SO_* socket options and SOF_* lwIP-internal flags match */ /* Check that the SO_* socket options and SOF_* lwIP-internal flags match */
#if SO_REUSEADDR != SOF_REUSEADDR #if SO_REUSEADDR != SOF_REUSEADDR

View File

@ -202,7 +202,7 @@ autoip_create_addr(struct netif *netif, ip4_addr_t *ipaddr)
u32_t addr = ntohl(LWIP_AUTOIP_CREATE_SEED_ADDR(netif)); u32_t addr = ntohl(LWIP_AUTOIP_CREATE_SEED_ADDR(netif));
addr += netif->autoip->tried_llipaddr; addr += netif->autoip->tried_llipaddr;
addr = AUTOIP_NET | (addr & 0xffff); addr = AUTOIP_NET | (addr & 0xffff);
/* Now, 169.254.0.0 <= addr <= 169.254.255.255 */ /* Now, 169.254.0.0 <= addr <= 169.254.255.255 */
if (addr < AUTOIP_RANGE_START) { if (addr < AUTOIP_RANGE_START) {
addr += AUTOIP_RANGE_END - AUTOIP_RANGE_START + 1; addr += AUTOIP_RANGE_END - AUTOIP_RANGE_START + 1;
@ -213,7 +213,7 @@ autoip_create_addr(struct netif *netif, ip4_addr_t *ipaddr)
LWIP_ASSERT("AUTOIP address not in range", (addr >= AUTOIP_RANGE_START) && LWIP_ASSERT("AUTOIP address not in range", (addr >= AUTOIP_RANGE_START) &&
(addr <= AUTOIP_RANGE_END)); (addr <= AUTOIP_RANGE_END));
ip4_addr_set_u32(ipaddr, htonl(addr)); ip4_addr_set_u32(ipaddr, htonl(addr));
LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE,
("autoip_create_addr(): tried_llipaddr=%"U16_F", %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", ("autoip_create_addr(): tried_llipaddr=%"U16_F", %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
(u16_t)(netif->autoip->tried_llipaddr), ip4_addr1_16(ipaddr), ip4_addr2_16(ipaddr), (u16_t)(netif->autoip->tried_llipaddr), ip4_addr1_16(ipaddr), ip4_addr2_16(ipaddr),
@ -492,7 +492,7 @@ autoip_arp_reply(struct netif *netif, struct etharp_hdr *hdr)
*/ */
IPADDR2_COPY(&sipaddr, &hdr->sipaddr); IPADDR2_COPY(&sipaddr, &hdr->sipaddr);
IPADDR2_COPY(&dipaddr, &hdr->dipaddr); IPADDR2_COPY(&dipaddr, &hdr->dipaddr);
if ((netif->autoip->state == AUTOIP_STATE_PROBING) || if ((netif->autoip->state == AUTOIP_STATE_PROBING) ||
((netif->autoip->state == AUTOIP_STATE_ANNOUNCING) && ((netif->autoip->state == AUTOIP_STATE_ANNOUNCING) &&
(netif->autoip->sent_num == 0))) { (netif->autoip->sent_num == 0))) {

View File

@ -256,7 +256,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
} else if(type == ICMP_AMR) { } else if(type == ICMP_AMR) {
MIB2_STATS_INC(mib2.icmpinaddrmaskreps); MIB2_STATS_INC(mib2.icmpinaddrmaskreps);
} }
LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ICMP type %"S16_F" code %"S16_F" not supported.\n", LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ICMP type %"S16_F" code %"S16_F" not supported.\n",
(s16_t)type, (s16_t)code)); (s16_t)type, (s16_t)code));
ICMP_STATS_INC(icmp.proterr); ICMP_STATS_INC(icmp.proterr);
ICMP_STATS_INC(icmp.drop); ICMP_STATS_INC(icmp.drop);

View File

@ -92,7 +92,7 @@ Steve Reynolds
#include "string.h" #include "string.h"
/* /*
* IGMP constants * IGMP constants
*/ */
#define IGMP_TTL 1 #define IGMP_TTL 1
@ -371,7 +371,7 @@ igmp_input(struct pbuf *p, struct netif *inp, const ip4_addr_t *dest)
IGMP_STATS_INC(igmp.recv); IGMP_STATS_INC(igmp.recv);
/* Note that the length CAN be greater than 8 but only 8 are used - All are included in the checksum */ /* Note that the length CAN be greater than 8 but only 8 are used - All are included in the checksum */
if (p->len < IGMP_MINLEN) { if (p->len < IGMP_MINLEN) {
pbuf_free(p); pbuf_free(p);
IGMP_STATS_INC(igmp.lenerr); IGMP_STATS_INC(igmp.lenerr);

View File

@ -380,7 +380,7 @@ ip_input(struct pbuf *p, struct netif *inp)
* forwarded (using ip_forward). The IP checksum is always checked. * forwarded (using ip_forward). The IP checksum is always checked.
* *
* Finally, the packet is sent to the upper layer protocol input function. * Finally, the packet is sent to the upper layer protocol input function.
* *
* @param p the received IP packet (p->payload points to IP header) * @param p the received IP packet (p->payload points to IP header)
* @param inp the netif on which this packet was received * @param inp the netif on which this packet was received
* @return ERR_OK if the packet was processed (could return ERR_* if it wasn't * @return ERR_OK if the packet was processed (could return ERR_* if it wasn't

View File

@ -48,8 +48,8 @@ const ip_addr_t ip_addr_any = IPADDR4_INIT(IPADDR_ANY);
const ip_addr_t ip_addr_broadcast = IPADDR4_INIT(IPADDR_BROADCAST); const ip_addr_t ip_addr_broadcast = IPADDR4_INIT(IPADDR_BROADCAST);
/** /**
* Determine if an address is a broadcast address on a network interface * Determine if an address is a broadcast address on a network interface
* *
* @param addr address to be checked * @param addr address to be checked
* @param netif the network interface against which the address is checked * @param netif the network interface against which the address is checked
* @return returns non-zero if the address is a broadcast address * @return returns non-zero if the address is a broadcast address

View File

@ -187,7 +187,7 @@ ip_reass_free_complete_datagram(struct ip_reassdata *ipr, struct ip_reassdata *p
} }
#endif /* LWIP_ICMP */ #endif /* LWIP_ICMP */
/* First, free all received pbufs. The individual pbufs need to be released /* First, free all received pbufs. The individual pbufs need to be released
separately as they have not yet been chained */ separately as they have not yet been chained */
p = ipr->p; p = ipr->p;
while (p != NULL) { while (p != NULL) {
@ -308,7 +308,6 @@ ip_reass_enqueue_new_datagram(struct ip_hdr *fraghdr, int clen)
static void static void
ip_reass_dequeue_datagram(struct ip_reassdata *ipr, struct ip_reassdata *prev) ip_reass_dequeue_datagram(struct ip_reassdata *ipr, struct ip_reassdata *prev)
{ {
/* dequeue the reass struct */ /* dequeue the reass struct */
if (reassdatagrams == ipr) { if (reassdatagrams == ipr) {
/* it was the first in the list */ /* it was the first in the list */
@ -342,7 +341,7 @@ ip_reass_chain_frag_into_datagram_and_validate(struct ip_reassdata *ipr, struct
int valid = 1; int valid = 1;
/* Extract length and fragment offset from current fragment */ /* Extract length and fragment offset from current fragment */
fraghdr = (struct ip_hdr*)new_p->payload; fraghdr = (struct ip_hdr*)new_p->payload;
len = ntohs(IPH_LEN(fraghdr)) - IPH_HL(fraghdr) * 4; len = ntohs(IPH_LEN(fraghdr)) - IPH_HL(fraghdr) * 4;
offset = (ntohs(IPH_OFFSET(fraghdr)) & IP_OFFMASK) * 8; offset = (ntohs(IPH_OFFSET(fraghdr)) & IP_OFFMASK) * 8;
@ -489,7 +488,7 @@ ip4_reass(struct pbuf *p)
IPFRAG_STATS_INC(ip_frag.recv); IPFRAG_STATS_INC(ip_frag.recv);
MIB2_STATS_INC(mib2.ipreasmreqds); MIB2_STATS_INC(mib2.ipreasmreqds);
fraghdr = (struct ip_hdr*)p->payload; fraghdr = (struct ip_hdr*)p->payload;
if ((IPH_HL(fraghdr) * 4) != IP_HLEN) { if ((IPH_HL(fraghdr) * 4) != IP_HLEN) {
@ -541,7 +540,7 @@ ip4_reass(struct pbuf *p)
goto nullreturn; goto nullreturn;
} }
} else { } else {
if (((ntohs(IPH_OFFSET(fraghdr)) & IP_OFFMASK) == 0) && if (((ntohs(IPH_OFFSET(fraghdr)) & IP_OFFMASK) == 0) &&
((ntohs(IPH_OFFSET(&ipr->iphdr)) & IP_OFFMASK) != 0)) { ((ntohs(IPH_OFFSET(&ipr->iphdr)) & IP_OFFMASK) != 0)) {
/* ipr->iphdr is not the header from the first fragment, but fraghdr is /* ipr->iphdr is not the header from the first fragment, but fraghdr is
* -> copy fraghdr into ipr->iphdr since we want to have the header * -> copy fraghdr into ipr->iphdr since we want to have the header
@ -550,11 +549,11 @@ ip4_reass(struct pbuf *p)
SMEMCPY(&ipr->iphdr, fraghdr, IP_HLEN); SMEMCPY(&ipr->iphdr, fraghdr, IP_HLEN);
} }
} }
/* Track the current number of pbufs current 'in-flight', in order to limit /* Track the current number of pbufs current 'in-flight', in order to limit
the number of fragments that may be enqueued at any one time */ the number of fragments that may be enqueued at any one time */
ip_reass_pbufcount += clen; ip_reass_pbufcount += clen;
/* At this point, we have either created a new entry or pointing /* At this point, we have either created a new entry or pointing
* to an existing one */ * to an existing one */
/* check for 'no more fragments', and update queue entry*/ /* check for 'no more fragments', and update queue entry*/
@ -874,7 +873,7 @@ ip4_frag(struct pbuf *p, struct netif *netif, const ip4_addr_t *dest)
* will have already sent the packet, the free will really free, and * will have already sent the packet, the free will really free, and
* there will be zero memory penalty. * there will be zero memory penalty.
*/ */
pbuf_free(rambuf); pbuf_free(rambuf);
#endif /* IP_FRAG_USES_STATIC_BUF */ #endif /* IP_FRAG_USES_STATIC_BUF */
left -= cop; left -= cop;

View File

@ -39,7 +39,6 @@
* <delamer@inicotech.com> * <delamer@inicotech.com>
*/ */
#include "lwip/opt.h" #include "lwip/opt.h"
#if LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */ #if LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */

View File

@ -489,7 +489,7 @@ mem_trim(void *rmem, mem_size_t newsize)
/* else { /* else {
next struct mem is used but size between mem and mem2 is not big enough next struct mem is used but size between mem and mem2 is not big enough
to create another struct mem to create another struct mem
-> don't do anyhting. -> don't do anyhting.
-> the remaining space stays unused since it is too small -> the remaining space stays unused since it is too small
} */ } */
#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT #if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT

View File

@ -163,19 +163,19 @@ static const char *memp_desc[MEMP_MAX] = {
* extern u8_t __attribute__((section(".onchip_mem"))) memp_memory_UDP_PCB_base[]; * extern u8_t __attribute__((section(".onchip_mem"))) memp_memory_UDP_PCB_base[];
*/ */
#define LWIP_MEMPOOL(name,num,size,desc) u8_t memp_memory_ ## name ## _base \ #define LWIP_MEMPOOL(name,num,size,desc) u8_t memp_memory_ ## name ## _base \
[((num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size)))]; [((num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size)))];
#include "lwip/memp_std.h" #include "lwip/memp_std.h"
/** This array holds the base of each memory pool. */ /** This array holds the base of each memory pool. */
static u8_t *const memp_bases[] = { static u8_t *const memp_bases[] = {
#define LWIP_MEMPOOL(name,num,size,desc) memp_memory_ ## name ## _base, #define LWIP_MEMPOOL(name,num,size,desc) memp_memory_ ## name ## _base,
#include "lwip/memp_std.h" #include "lwip/memp_std.h"
}; };
#else /* MEMP_SEPARATE_POOLS */ #else /* MEMP_SEPARATE_POOLS */
/** This is the actual memory used by the pools (all pools in one big block). */ /** This is the actual memory used by the pools (all pools in one big block). */
static u8_t memp_memory[MEM_ALIGNMENT - 1 static u8_t memp_memory[MEM_ALIGNMENT - 1
#define LWIP_MEMPOOL(name,num,size,desc) + ( (num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size) ) ) #define LWIP_MEMPOOL(name,num,size,desc) + ( (num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size) ) )
#include "lwip/memp_std.h" #include "lwip/memp_std.h"
]; ];
@ -351,7 +351,7 @@ memp_overflow_init(void)
/** /**
* Initialize this module. * Initialize this module.
* *
* Carves out memp_memory into linked lists for each pool-type. * Carves out memp_memory into linked lists for each pool-type.
*/ */
void void
@ -414,7 +414,7 @@ memp_malloc_fn(memp_t type, const char* file, const int line)
{ {
struct memp *memp; struct memp *memp;
SYS_ARCH_DECL_PROTECT(old_level); SYS_ARCH_DECL_PROTECT(old_level);
LWIP_ERROR("memp_malloc: type < MEMP_MAX", (type < MEMP_MAX), return NULL;); LWIP_ERROR("memp_malloc: type < MEMP_MAX", (type < MEMP_MAX), return NULL;);
SYS_ARCH_PROTECT(old_level); SYS_ARCH_PROTECT(old_level);
@ -423,7 +423,7 @@ memp_malloc_fn(memp_t type, const char* file, const int line)
#endif /* MEMP_OVERFLOW_CHECK >= 2 */ #endif /* MEMP_OVERFLOW_CHECK >= 2 */
memp = memp_tab[type]; memp = memp_tab[type];
if (memp != NULL) { if (memp != NULL) {
memp_tab[type] = memp->next; memp_tab[type] = memp->next;
#if MEMP_OVERFLOW_CHECK #if MEMP_OVERFLOW_CHECK

View File

@ -73,13 +73,13 @@
#define NETIF_STATUS_CALLBACK(n) do{ if (n->status_callback) { (n->status_callback)(n); }}while(0) #define NETIF_STATUS_CALLBACK(n) do{ if (n->status_callback) { (n->status_callback)(n); }}while(0)
#else #else
#define NETIF_STATUS_CALLBACK(n) #define NETIF_STATUS_CALLBACK(n)
#endif /* LWIP_NETIF_STATUS_CALLBACK */ #endif /* LWIP_NETIF_STATUS_CALLBACK */
#if LWIP_NETIF_LINK_CALLBACK #if LWIP_NETIF_LINK_CALLBACK
#define NETIF_LINK_CALLBACK(n) do{ if (n->link_callback) { (n->link_callback)(n); }}while(0) #define NETIF_LINK_CALLBACK(n) do{ if (n->link_callback) { (n->link_callback)(n); }}while(0)
#else #else
#define NETIF_LINK_CALLBACK(n) #define NETIF_LINK_CALLBACK(n)
#endif /* LWIP_NETIF_LINK_CALLBACK */ #endif /* LWIP_NETIF_LINK_CALLBACK */
struct netif *netif_list; struct netif *netif_list;
struct netif *netif_default; struct netif *netif_default;
@ -524,7 +524,7 @@ netif_set_default(struct netif *netif)
/** /**
* Bring an interface up, available for processing * Bring an interface up, available for processing
* traffic. * traffic.
*/ */
void netif_set_up(struct netif *netif) void netif_set_up(struct netif *netif)
{ {
if (!(netif->flags & NETIF_FLAG_UP)) { if (!(netif->flags & NETIF_FLAG_UP)) {
@ -580,7 +580,7 @@ netif_issue_reports(struct netif* netif, u8_t report_type)
/** /**
* Bring an interface down, disabling any traffic processing. * Bring an interface down, disabling any traffic processing.
*/ */
void netif_set_down(struct netif *netif) void netif_set_down(struct netif *netif)
{ {
if (netif->flags & NETIF_FLAG_UP) { if (netif->flags & NETIF_FLAG_UP) {
@ -624,7 +624,8 @@ netif_set_remove_callback(struct netif *netif, netif_status_callback_fn remove_c
/** /**
* Called by a driver when its link goes up * Called by a driver when its link goes up
*/ */
void netif_set_link_up(struct netif *netif ) void
netif_set_link_up(struct netif *netif)
{ {
if (!(netif->flags & NETIF_FLAG_LINK_UP)) { if (!(netif->flags & NETIF_FLAG_LINK_UP)) {
netif->flags |= NETIF_FLAG_LINK_UP; netif->flags |= NETIF_FLAG_LINK_UP;

View File

@ -521,7 +521,7 @@ pbuf_header_impl(struct pbuf *p, s16_t header_size_increment, u8_t force)
if ((header_size_increment == 0) || (p == NULL)) { if ((header_size_increment == 0) || (p == NULL)) {
return 0; return 0;
} }
if (header_size_increment < 0){ if (header_size_increment < 0){
increment_magnitude = -header_size_increment; increment_magnitude = -header_size_increment;
/* Check that we aren't going to move off the end of the pbuf */ /* Check that we aren't going to move off the end of the pbuf */
@ -532,7 +532,7 @@ pbuf_header_impl(struct pbuf *p, s16_t header_size_increment, u8_t force)
/* Can't assert these as some callers speculatively call /* Can't assert these as some callers speculatively call
pbuf_header() to see if it's OK. Will return 1 below instead. */ pbuf_header() to see if it's OK. Will return 1 below instead. */
/* Check that we've got the correct type of pbuf to work with */ /* Check that we've got the correct type of pbuf to work with */
LWIP_ASSERT("p->type == PBUF_RAM || p->type == PBUF_POOL", LWIP_ASSERT("p->type == PBUF_RAM || p->type == PBUF_POOL",
p->type == PBUF_RAM || p->type == PBUF_POOL); p->type == PBUF_RAM || p->type == PBUF_POOL);
/* Check that we aren't going to move off the beginning of the pbuf */ /* Check that we aren't going to move off the beginning of the pbuf */
LWIP_ASSERT("p->payload - increment_magnitude >= p + SIZEOF_STRUCT_PBUF", LWIP_ASSERT("p->payload - increment_magnitude >= p + SIZEOF_STRUCT_PBUF",

View File

@ -201,14 +201,14 @@ raw_connect(struct raw_pcb *pcb, const ip_addr_t *ipaddr)
/** /**
* Set the callback function for received packets that match the * Set the callback function for received packets that match the
* raw PCB's protocol and binding. * raw PCB's protocol and binding.
* *
* The callback function MUST either * The callback function MUST either
* - eat the packet by calling pbuf_free() and returning non-zero. The * - eat the packet by calling pbuf_free() and returning non-zero. The
* packet will not be passed to other raw PCBs or other protocol layers. * packet will not be passed to other raw PCBs or other protocol layers.
* - not free the packet, and return zero. The packet will be matched * - not free the packet, and return zero. The packet will be matched
* against further PCBs and/or forwarded to another protocol layers. * against further PCBs and/or forwarded to another protocol layers.
* *
* @return non-zero if the packet was free()d, zero if the packet remains * @return non-zero if the packet was free()d, zero if the packet remains
* available for others. * available for others.
*/ */

View File

@ -120,7 +120,7 @@ struct tcp_pcb *tcp_tmp_pcb;
u8_t tcp_active_pcbs_changed; u8_t tcp_active_pcbs_changed;
/** Timer counter to handle calling slow-timer from tcp_tmr() */ /** Timer counter to handle calling slow-timer from tcp_tmr() */
static u8_t tcp_timer; static u8_t tcp_timer;
static u8_t tcp_timer_ctr; static u8_t tcp_timer_ctr;
static u16_t tcp_new_port(void); static u16_t tcp_new_port(void);
@ -209,7 +209,7 @@ tcp_close_shutdown(struct tcp_pcb *pcb, u8_t rst_on_unacked_data)
* however, it is in this state once allocated and as yet unused * however, it is in this state once allocated and as yet unused
* and the user needs some way to free it should the need arise. * and the user needs some way to free it should the need arise.
* Calling tcp_close() with a pcb that has already been closed, (i.e. twice) * Calling tcp_close() with a pcb that has already been closed, (i.e. twice)
* or for a pcb that has been used and then entered the CLOSED state * or for a pcb that has been used and then entered the CLOSED state
* is erroneous, but this should never happen as the pcb has in those cases * is erroneous, but this should never happen as the pcb has in those cases
* been freed, and so any remaining handles are bogus. */ * been freed, and so any remaining handles are bogus. */
err = ERR_OK; err = ERR_OK;
@ -716,7 +716,7 @@ tcp_new_port(void)
u8_t i; u8_t i;
u16_t n = 0; u16_t n = 0;
struct tcp_pcb *pcb; struct tcp_pcb *pcb;
again: again:
if (tcp_port++ == TCP_LOCAL_PORT_RANGE_END) { if (tcp_port++ == TCP_LOCAL_PORT_RANGE_END) {
tcp_port = TCP_LOCAL_PORT_RANGE_START; tcp_port = TCP_LOCAL_PORT_RANGE_START;
@ -981,11 +981,11 @@ tcp_slowtmr_start:
LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: KEEPALIVE timeout. Aborting connection to ")); LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: KEEPALIVE timeout. Aborting connection to "));
ip_addr_debug_print(TCP_DEBUG, &pcb->remote_ip); ip_addr_debug_print(TCP_DEBUG, &pcb->remote_ip);
LWIP_DEBUGF(TCP_DEBUG, ("\n")); LWIP_DEBUGF(TCP_DEBUG, ("\n"));
++pcb_remove; ++pcb_remove;
++pcb_reset; ++pcb_reset;
} }
else if((u32_t)(tcp_ticks - pcb->tmr) > else if((u32_t)(tcp_ticks - pcb->tmr) >
(pcb->keep_idle + pcb->keep_cnt_sent * TCP_KEEP_INTVL(pcb)) (pcb->keep_idle + pcb->keep_cnt_sent * TCP_KEEP_INTVL(pcb))
/ TCP_SLOW_INTERVAL) / TCP_SLOW_INTERVAL)
{ {
@ -1080,7 +1080,7 @@ tcp_slowtmr_start:
} }
} }
/* Steps through all of the TIME-WAIT PCBs. */ /* Steps through all of the TIME-WAIT PCBs. */
prev = NULL; prev = NULL;
pcb = tcp_tw_pcbs; pcb = tcp_tw_pcbs;
@ -1092,8 +1092,6 @@ tcp_slowtmr_start:
if ((u32_t)(tcp_ticks - pcb->tmr) > 2 * TCP_MSL / TCP_SLOW_INTERVAL) { if ((u32_t)(tcp_ticks - pcb->tmr) > 2 * TCP_MSL / TCP_SLOW_INTERVAL) {
++pcb_remove; ++pcb_remove;
} }
/* If the PCB should be removed, do it. */ /* If the PCB should be removed, do it. */
if (pcb_remove) { if (pcb_remove) {
@ -1290,7 +1288,7 @@ tcp_setprio(struct tcp_pcb *pcb, u8_t prio)
* *
* @param seg the old tcp_seg * @param seg the old tcp_seg
* @return a copy of seg * @return a copy of seg
*/ */
struct tcp_seg * struct tcp_seg *
tcp_seg_copy(struct tcp_seg *seg) tcp_seg_copy(struct tcp_seg *seg)
{ {
@ -1300,7 +1298,7 @@ tcp_seg_copy(struct tcp_seg *seg)
if (cseg == NULL) { if (cseg == NULL) {
return NULL; return NULL;
} }
SMEMCPY((u8_t *)cseg, (const u8_t *)seg, sizeof(struct tcp_seg)); SMEMCPY((u8_t *)cseg, (const u8_t *)seg, sizeof(struct tcp_seg));
pbuf_ref(cseg->p); pbuf_ref(cseg->p);
return cseg; return cseg;
} }
@ -1339,7 +1337,7 @@ tcp_kill_prio(u8_t prio)
u8_t mprio; u8_t mprio;
mprio = TCP_PRIO_MAX; mprio = TCP_PRIO_MAX;
/* We kill the oldest active connection that has lower priority than prio. */ /* We kill the oldest active connection that has lower priority than prio. */
inactivity = 0; inactivity = 0;
inactive = NULL; inactive = NULL;
@ -1501,7 +1499,7 @@ tcp_alloc(u8_t prio)
pcb->snd_wl2 = iss; pcb->snd_wl2 = iss;
pcb->snd_nxt = iss; pcb->snd_nxt = iss;
pcb->lastack = iss; pcb->lastack = iss;
pcb->snd_lbb = iss; pcb->snd_lbb = iss;
pcb->tmr = tcp_ticks; pcb->tmr = tcp_ticks;
pcb->last_timer = tcp_timer_ctr; pcb->last_timer = tcp_timer_ctr;
@ -1509,11 +1507,11 @@ tcp_alloc(u8_t prio)
#if LWIP_CALLBACK_API #if LWIP_CALLBACK_API
pcb->recv = tcp_recv_null; pcb->recv = tcp_recv_null;
#endif /* LWIP_CALLBACK_API */ #endif /* LWIP_CALLBACK_API */
/* Init KEEPALIVE timer */ /* Init KEEPALIVE timer */
pcb->keep_idle = TCP_KEEPIDLE_DEFAULT; pcb->keep_idle = TCP_KEEPIDLE_DEFAULT;
#if LWIP_TCP_KEEPALIVE #if LWIP_TCP_KEEPALIVE
pcb->keep_intvl = TCP_KEEPINTVL_DEFAULT; pcb->keep_intvl = TCP_KEEPINTVL_DEFAULT;
pcb->keep_cnt = TCP_KEEPCNT_DEFAULT; pcb->keep_cnt = TCP_KEEPCNT_DEFAULT;
@ -1568,7 +1566,7 @@ tcp_new_ip6(void)
* *
* @param pcb tcp_pcb to set the callback argument * @param pcb tcp_pcb to set the callback argument
* @param arg void pointer argument to pass to callback functions * @param arg void pointer argument to pass to callback functions
*/ */
void void
tcp_arg(struct tcp_pcb *pcb, void *arg) tcp_arg(struct tcp_pcb *pcb, void *arg)
{ {
@ -1584,7 +1582,7 @@ tcp_arg(struct tcp_pcb *pcb, void *arg)
* *
* @param pcb tcp_pcb to set the recv callback * @param pcb tcp_pcb to set the recv callback
* @param recv callback function to call for this pcb when data is received * @param recv callback function to call for this pcb when data is received
*/ */
void void
tcp_recv(struct tcp_pcb *pcb, tcp_recv_fn recv) tcp_recv(struct tcp_pcb *pcb, tcp_recv_fn recv)
{ {
@ -1598,7 +1596,7 @@ tcp_recv(struct tcp_pcb *pcb, tcp_recv_fn recv)
* *
* @param pcb tcp_pcb to set the sent callback * @param pcb tcp_pcb to set the sent callback
* @param sent callback function to call for this pcb when data is successfully sent * @param sent callback function to call for this pcb when data is successfully sent
*/ */
void void
tcp_sent(struct tcp_pcb *pcb, tcp_sent_fn sent) tcp_sent(struct tcp_pcb *pcb, tcp_sent_fn sent)
{ {
@ -1613,7 +1611,7 @@ tcp_sent(struct tcp_pcb *pcb, tcp_sent_fn sent)
* @param pcb tcp_pcb to set the err callback * @param pcb tcp_pcb to set the err callback
* @param err callback function to call for this pcb when a fatal error * @param err callback function to call for this pcb when a fatal error
* has occurred on the connection * has occurred on the connection
*/ */
void void
tcp_err(struct tcp_pcb *pcb, tcp_err_fn err) tcp_err(struct tcp_pcb *pcb, tcp_err_fn err)
{ {
@ -1628,7 +1626,7 @@ tcp_err(struct tcp_pcb *pcb, tcp_err_fn err)
* @param pcb tcp_pcb to set the accept callback * @param pcb tcp_pcb to set the accept callback
* @param accept callback function to call for this pcb when LISTENing * @param accept callback function to call for this pcb when LISTENing
* connection has been connected to another host * connection has been connected to another host
*/ */
void void
tcp_accept(struct tcp_pcb *pcb, tcp_accept_fn accept) tcp_accept(struct tcp_pcb *pcb, tcp_accept_fn accept)
{ {
@ -1644,16 +1642,16 @@ tcp_accept(struct tcp_pcb *pcb, tcp_accept_fn accept)
* from TCP. The interval is specified in terms of the TCP coarse * from TCP. The interval is specified in terms of the TCP coarse
* timer interval, which is called twice a second. * timer interval, which is called twice a second.
* *
*/ */
void void
tcp_poll(struct tcp_pcb *pcb, tcp_poll_fn poll, u8_t interval) tcp_poll(struct tcp_pcb *pcb, tcp_poll_fn poll, u8_t interval)
{ {
LWIP_ASSERT("invalid socket state for poll", pcb->state != LISTEN); LWIP_ASSERT("invalid socket state for poll", pcb->state != LISTEN);
#if LWIP_CALLBACK_API #if LWIP_CALLBACK_API
pcb->poll = poll; pcb->poll = poll;
#else /* LWIP_CALLBACK_API */ #else /* LWIP_CALLBACK_API */
LWIP_UNUSED_ARG(poll); LWIP_UNUSED_ARG(poll);
#endif /* LWIP_CALLBACK_API */ #endif /* LWIP_CALLBACK_API */
pcb->pollinterval = interval; pcb->pollinterval = interval;
} }
@ -1771,7 +1769,7 @@ u32_t
tcp_next_iss(void) tcp_next_iss(void)
{ {
static u32_t iss = 6510; static u32_t iss = 6510;
iss += tcp_ticks; /* XXX */ iss += tcp_ticks; /* XXX */
return iss; return iss;
} }
@ -2004,14 +2002,14 @@ tcp_debug_print_pcbs(void)
pcb->local_port, pcb->remote_port, pcb->local_port, pcb->remote_port,
pcb->snd_nxt, pcb->rcv_nxt)); pcb->snd_nxt, pcb->rcv_nxt));
tcp_debug_print_state(pcb->state); tcp_debug_print_state(pcb->state);
} }
LWIP_DEBUGF(TCP_DEBUG, ("Listen PCB states:\n")); LWIP_DEBUGF(TCP_DEBUG, ("Listen PCB states:\n"));
for(pcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs; pcb != NULL; pcb = pcb->next) { for(pcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs; pcb != NULL; pcb = pcb->next) {
LWIP_DEBUGF(TCP_DEBUG, ("Local port %"U16_F", foreign port %"U16_F" snd_nxt %"U32_F" rcv_nxt %"U32_F" ", LWIP_DEBUGF(TCP_DEBUG, ("Local port %"U16_F", foreign port %"U16_F" snd_nxt %"U32_F" rcv_nxt %"U32_F" ",
pcb->local_port, pcb->remote_port, pcb->local_port, pcb->remote_port,
pcb->snd_nxt, pcb->rcv_nxt)); pcb->snd_nxt, pcb->rcv_nxt));
tcp_debug_print_state(pcb->state); tcp_debug_print_state(pcb->state);
} }
LWIP_DEBUGF(TCP_DEBUG, ("TIME-WAIT PCB states:\n")); LWIP_DEBUGF(TCP_DEBUG, ("TIME-WAIT PCB states:\n"));
for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) { for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {
LWIP_DEBUGF(TCP_DEBUG, ("Local port %"U16_F", foreign port %"U16_F" snd_nxt %"U32_F" rcv_nxt %"U32_F" ", LWIP_DEBUGF(TCP_DEBUG, ("Local port %"U16_F", foreign port %"U16_F" snd_nxt %"U32_F" rcv_nxt %"U32_F" ",

View File

@ -209,7 +209,6 @@ tcp_input(struct pbuf *p, struct netif *inp)
for an active connection. */ for an active connection. */
prev = NULL; prev = NULL;
for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) { for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
LWIP_ASSERT("tcp_input: active pcb->state != CLOSED", pcb->state != CLOSED); LWIP_ASSERT("tcp_input: active pcb->state != CLOSED", pcb->state != CLOSED);
LWIP_ASSERT("tcp_input: active pcb->state != TIME-WAIT", pcb->state != TIME_WAIT); LWIP_ASSERT("tcp_input: active pcb->state != TIME-WAIT", pcb->state != TIME_WAIT);
@ -308,7 +307,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
} else { } else {
TCP_STATS_INC(tcp.cachehit); TCP_STATS_INC(tcp.cachehit);
} }
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packed for LISTENing connection.\n")); LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packed for LISTENing connection.\n"));
tcp_listen_input(lpcb); tcp_listen_input(lpcb);
pbuf_free(p); pbuf_free(p);
@ -710,12 +709,12 @@ tcp_process(struct tcp_pcb *pcb)
} }
} }
if ((flags & TCP_SYN) && (pcb->state != SYN_SENT && pcb->state != SYN_RCVD)) { if ((flags & TCP_SYN) && (pcb->state != SYN_SENT && pcb->state != SYN_RCVD)) {
/* Cope with new connection attempt after remote end crashed */ /* Cope with new connection attempt after remote end crashed */
tcp_ack_now(pcb); tcp_ack_now(pcb);
return ERR_OK; return ERR_OK;
} }
if ((pcb->flags & TF_RXCLOSED) == 0) { if ((pcb->flags & TF_RXCLOSED) == 0) {
/* Update the PCB (in)activity timer unless rx is closed (see tcp_shutdown) */ /* Update the PCB (in)activity timer unless rx is closed (see tcp_shutdown) */
pcb->tmr = tcp_ticks; pcb->tmr = tcp_ticks;
@ -980,11 +979,11 @@ tcp_receive(struct tcp_pcb *pcb)
if (TCP_SEQ_LT(pcb->snd_wl1, seqno) || if (TCP_SEQ_LT(pcb->snd_wl1, seqno) ||
(pcb->snd_wl1 == seqno && TCP_SEQ_LT(pcb->snd_wl2, ackno)) || (pcb->snd_wl1 == seqno && TCP_SEQ_LT(pcb->snd_wl2, ackno)) ||
(pcb->snd_wl2 == ackno && (u32_t)SND_WND_SCALE(pcb, tcphdr->wnd) > pcb->snd_wnd)) { (pcb->snd_wl2 == ackno && (u32_t)SND_WND_SCALE(pcb, tcphdr->wnd) > pcb->snd_wnd)) {
pcb->snd_wnd = SND_WND_SCALE(pcb, tcphdr->wnd); pcb->snd_wnd = SND_WND_SCALE(pcb, tcphdr->wnd);
/* keep track of the biggest window announced by the remote host to calculate /* keep track of the biggest window announced by the remote host to calculate
the maximum segment size */ the maximum segment size */
if (pcb->snd_wnd_max < pcb->snd_wnd) { if (pcb->snd_wnd_max < pcb->snd_wnd) {
pcb->snd_wnd_max = pcb->snd_wnd; pcb->snd_wnd_max = pcb->snd_wnd;
} }
pcb->snd_wl1 = seqno; pcb->snd_wl1 = seqno;
pcb->snd_wl2 = ackno; pcb->snd_wl2 = ackno;
@ -1012,17 +1011,17 @@ tcp_receive(struct tcp_pcb *pcb)
/* (From Stevens TCP/IP Illustrated Vol II, p970.) Its only a /* (From Stevens TCP/IP Illustrated Vol II, p970.) Its only a
* duplicate ack if: * duplicate ack if:
* 1) It doesn't ACK new data * 1) It doesn't ACK new data
* 2) length of received packet is zero (i.e. no payload) * 2) length of received packet is zero (i.e. no payload)
* 3) the advertised window hasn't changed * 3) the advertised window hasn't changed
* 4) There is outstanding unacknowledged data (retransmission timer running) * 4) There is outstanding unacknowledged data (retransmission timer running)
* 5) The ACK is == biggest ACK sequence number so far seen (snd_una) * 5) The ACK is == biggest ACK sequence number so far seen (snd_una)
* *
* If it passes all five, should process as a dupack: * If it passes all five, should process as a dupack:
* a) dupacks < 3: do nothing * a) dupacks < 3: do nothing
* b) dupacks == 3: fast retransmit * b) dupacks == 3: fast retransmit
* c) dupacks > 3: increase cwnd * c) dupacks > 3: increase cwnd
* *
* If it only passes 1-3, should reset dupack counter (and add to * If it only passes 1-3, should reset dupack counter (and add to
* stats, which we don't do in lwIP) * stats, which we don't do in lwIP)
* *
@ -1173,7 +1172,7 @@ tcp_receive(struct tcp_pcb *pcb)
->unsent list after a retransmission, so these segments may ->unsent list after a retransmission, so these segments may
in fact have been sent once. */ in fact have been sent once. */
while (pcb->unsent != NULL && while (pcb->unsent != NULL &&
TCP_SEQ_BETWEEN(ackno, ntohl(pcb->unsent->tcphdr->seqno) + TCP_SEQ_BETWEEN(ackno, ntohl(pcb->unsent->tcphdr->seqno) +
TCP_TCPLEN(pcb->unsent), pcb->snd_nxt)) { TCP_TCPLEN(pcb->unsent), pcb->snd_nxt)) {
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: removing %"U32_F":%"U32_F" from pcb->unsent\n", LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: removing %"U32_F":%"U32_F" from pcb->unsent\n",
ntohl(pcb->unsent->tcphdr->seqno), ntohl(pcb->unsent->tcphdr->seqno) + ntohl(pcb->unsent->tcphdr->seqno), ntohl(pcb->unsent->tcphdr->seqno) +
@ -1185,7 +1184,7 @@ tcp_receive(struct tcp_pcb *pcb)
if (pcb->unsent == NULL) { if (pcb->unsent == NULL) {
pcb->unsent_oversize = 0; pcb->unsent_oversize = 0;
} }
#endif /* TCP_OVERSIZE */ #endif /* TCP_OVERSIZE */
LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_receive: queuelen %"TCPWNDSIZE_F" ... ", (tcpwnd_size_t)pcb->snd_queuelen)); LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_receive: queuelen %"TCPWNDSIZE_F" ... ", (tcpwnd_size_t)pcb->snd_queuelen));
LWIP_ASSERT("pcb->snd_queuelen >= pbuf_clen(next->p)", (pcb->snd_queuelen >= pbuf_clen(next->p))); LWIP_ASSERT("pcb->snd_queuelen >= pbuf_clen(next->p)", (pcb->snd_queuelen >= pbuf_clen(next->p)));
/* Prevent ACK for FIN to generate a sent event */ /* Prevent ACK for FIN to generate a sent event */
@ -1366,7 +1365,7 @@ tcp_receive(struct tcp_pcb *pcb)
- inseq overlaps with ooseq */ - inseq overlaps with ooseq */
if (pcb->ooseq != NULL) { if (pcb->ooseq != NULL) {
if (TCPH_FLAGS(inseg.tcphdr) & TCP_FIN) { if (TCPH_FLAGS(inseg.tcphdr) & TCP_FIN) {
LWIP_DEBUGF(TCP_INPUT_DEBUG, LWIP_DEBUGF(TCP_INPUT_DEBUG,
("tcp_receive: received in-order FIN, binning ooseq queue\n")); ("tcp_receive: received in-order FIN, binning ooseq queue\n"));
/* Received in-order FIN means anything that was received /* Received in-order FIN means anything that was received
* out of order must now have been received in-order, so * out of order must now have been received in-order, so
@ -1476,7 +1475,7 @@ tcp_receive(struct tcp_pcb *pcb)
recv_flags |= TF_GOT_FIN; recv_flags |= TF_GOT_FIN;
if (pcb->state == ESTABLISHED) { /* force passive close or we can move to active close */ if (pcb->state == ESTABLISHED) { /* force passive close or we can move to active close */
pcb->state = CLOSE_WAIT; pcb->state = CLOSE_WAIT;
} }
} }
pcb->ooseq = cseg->next; pcb->ooseq = cseg->next;
@ -1596,12 +1595,12 @@ tcp_receive(struct tcp_pcb *pcb)
} }
/* check if the remote side overruns our receive window */ /* check if the remote side overruns our receive window */
if (TCP_SEQ_GT((u32_t)tcplen + seqno, pcb->rcv_nxt + (u32_t)pcb->rcv_wnd)) { if (TCP_SEQ_GT((u32_t)tcplen + seqno, pcb->rcv_nxt + (u32_t)pcb->rcv_wnd)) {
LWIP_DEBUGF(TCP_INPUT_DEBUG, LWIP_DEBUGF(TCP_INPUT_DEBUG,
("tcp_receive: other end overran receive window" ("tcp_receive: other end overran receive window"
"seqno %"U32_F" len %"U16_F" right edge %"U32_F"\n", "seqno %"U32_F" len %"U16_F" right edge %"U32_F"\n",
seqno, tcplen, pcb->rcv_nxt + pcb->rcv_wnd)); seqno, tcplen, pcb->rcv_nxt + pcb->rcv_wnd));
if (TCPH_FLAGS(next->next->tcphdr) & TCP_FIN) { if (TCPH_FLAGS(next->next->tcphdr) & TCP_FIN) {
/* Must remove the FIN from the header as we're trimming /* Must remove the FIN from the header as we're trimming
* that byte of sequence-space from the packet */ * that byte of sequence-space from the packet */
TCPH_FLAGS_SET(next->next->tcphdr, TCPH_FLAGS(next->next->tcphdr) & ~TCP_FIN); TCPH_FLAGS_SET(next->next->tcphdr, TCPH_FLAGS(next->next->tcphdr) & ~TCP_FIN);
} }

View File

@ -213,7 +213,7 @@ tcp_create_segment(struct tcp_pcb *pcb, struct pbuf *p, u8_t flags, u32_t seqno,
/* wnd and chksum are set in tcp_output */ /* wnd and chksum are set in tcp_output */
seg->tcphdr->urgp = 0; seg->tcphdr->urgp = 0;
return seg; return seg;
} }
/** /**
* Allocate a PBUF_RAM pbuf, perhaps with extra space at the end. * Allocate a PBUF_RAM pbuf, perhaps with extra space at the end.
@ -228,7 +228,6 @@ tcp_create_segment(struct tcp_pcb *pcb, struct pbuf *p, u8_t flags, u32_t seqno,
* @param pcb The TCP connection that willo enqueue the pbuf. * @param pcb The TCP connection that willo enqueue the pbuf.
* @param apiflags API flags given to tcp_write. * @param apiflags API flags given to tcp_write.
* @param first_seg true when this pbuf will be used in the first enqueued segment. * @param first_seg true when this pbuf will be used in the first enqueued segment.
* @param
*/ */
#if TCP_OVERSIZE #if TCP_OVERSIZE
static struct pbuf * static struct pbuf *
@ -396,7 +395,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
LWIP_DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_write(pcb=%p, data=%p, len=%"U16_F", apiflags=%"U16_F")\n", LWIP_DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_write(pcb=%p, data=%p, len=%"U16_F", apiflags=%"U16_F")\n",
(void *)pcb, arg, len, (u16_t)apiflags)); (void *)pcb, arg, len, (u16_t)apiflags));
LWIP_ERROR("tcp_write: arg == NULL (programmer violates API)", LWIP_ERROR("tcp_write: arg == NULL (programmer violates API)",
arg != NULL, return ERR_ARG;); arg != NULL, return ERR_ARG;);
err = tcp_write_checks(pcb, len); err = tcp_write_checks(pcb, len);
@ -919,7 +918,7 @@ tcp_send_empty_ack(struct tcp_pcb *pcb)
#if LWIP_TCP_TIMESTAMPS || CHECKSUM_GEN_TCP #if LWIP_TCP_TIMESTAMPS || CHECKSUM_GEN_TCP
tcphdr = (struct tcp_hdr *)p->payload; tcphdr = (struct tcp_hdr *)p->payload;
#endif /* LWIP_TCP_TIMESTAMPS || CHECKSUM_GEN_TCP */ #endif /* LWIP_TCP_TIMESTAMPS || CHECKSUM_GEN_TCP */
LWIP_DEBUGF(TCP_OUTPUT_DEBUG, LWIP_DEBUGF(TCP_OUTPUT_DEBUG,
("tcp_output: sending ACK for %"U32_F"\n", pcb->rcv_nxt)); ("tcp_output: sending ACK for %"U32_F"\n", pcb->rcv_nxt));
/* NB. MSS and window scale options are only sent on SYNs, so ignore them here */ /* NB. MSS and window scale options are only sent on SYNs, so ignore them here */
@ -1023,7 +1022,7 @@ tcp_output(struct tcp_pcb *pcb)
", seg == NULL, ack %"U32_F"\n", ", seg == NULL, ack %"U32_F"\n",
pcb->snd_wnd, pcb->cwnd, wnd, pcb->lastack)); pcb->snd_wnd, pcb->cwnd, wnd, pcb->lastack));
} else { } else {
LWIP_DEBUGF(TCP_CWND_DEBUG, LWIP_DEBUGF(TCP_CWND_DEBUG,
("tcp_output: snd_wnd %"TCPWNDSIZE_F", cwnd %"TCPWNDSIZE_F", wnd %"U32_F ("tcp_output: snd_wnd %"TCPWNDSIZE_F", cwnd %"TCPWNDSIZE_F", wnd %"U32_F
", effwnd %"U32_F", seq %"U32_F", ack %"U32_F"\n", ", effwnd %"U32_F", seq %"U32_F", ack %"U32_F"\n",
pcb->snd_wnd, pcb->cwnd, wnd, pcb->snd_wnd, pcb->cwnd, wnd,
@ -1034,7 +1033,7 @@ tcp_output(struct tcp_pcb *pcb)
/* data available and window allows it to be sent? */ /* data available and window allows it to be sent? */
while (seg != NULL && while (seg != NULL &&
ntohl(seg->tcphdr->seqno) - pcb->lastack + seg->len <= wnd) { ntohl(seg->tcphdr->seqno) - pcb->lastack + seg->len <= wnd) {
LWIP_ASSERT("RST not expected here!", LWIP_ASSERT("RST not expected here!",
(TCPH_FLAGS(seg->tcphdr) & TCP_RST) == 0); (TCPH_FLAGS(seg->tcphdr) & TCP_RST) == 0);
/* Stop sending if the nagle algorithm would prevent it /* Stop sending if the nagle algorithm would prevent it
* Don't stop: * Don't stop:
@ -1183,8 +1182,8 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb)
opts += 1; opts += 1;
} }
#endif #endif
/* Set retransmission timer running if it is not currently enabled /* Set retransmission timer running if it is not currently enabled
This must be set before checking the route. */ This must be set before checking the route. */
if (pcb->rtime == -1) { if (pcb->rtime == -1) {
pcb->rtime = 0; pcb->rtime = 0;
@ -1431,12 +1430,12 @@ tcp_rexmit(struct tcp_pcb *pcb)
* *
* @param pcb the tcp_pcb for which to retransmit the first unacked segment * @param pcb the tcp_pcb for which to retransmit the first unacked segment
*/ */
void void
tcp_rexmit_fast(struct tcp_pcb *pcb) tcp_rexmit_fast(struct tcp_pcb *pcb)
{ {
if (pcb->unacked != NULL && !(pcb->flags & TF_INFR)) { if (pcb->unacked != NULL && !(pcb->flags & TF_INFR)) {
/* This is fast retransmit. Retransmit the first unacked segment. */ /* This is fast retransmit. Retransmit the first unacked segment. */
LWIP_DEBUGF(TCP_FR_DEBUG, LWIP_DEBUGF(TCP_FR_DEBUG,
("tcp_receive: dupacks %"U16_F" (%"U32_F ("tcp_receive: dupacks %"U16_F" (%"U32_F
"), fast retransmit %"U32_F"\n", "), fast retransmit %"U32_F"\n",
(u16_t)pcb->dupacks, pcb->lastack, (u16_t)pcb->dupacks, pcb->lastack,
@ -1450,19 +1449,19 @@ tcp_rexmit_fast(struct tcp_pcb *pcb)
} else { } else {
pcb->ssthresh = pcb->cwnd / 2; pcb->ssthresh = pcb->cwnd / 2;
} }
/* The minimum value for ssthresh should be 2 MSS */ /* The minimum value for ssthresh should be 2 MSS */
if (pcb->ssthresh < (2U * pcb->mss)) { if (pcb->ssthresh < (2U * pcb->mss)) {
LWIP_DEBUGF(TCP_FR_DEBUG, LWIP_DEBUGF(TCP_FR_DEBUG,
("tcp_receive: The minimum value for ssthresh %"TCPWNDSIZE_F ("tcp_receive: The minimum value for ssthresh %"TCPWNDSIZE_F
" should be min 2 mss %"U16_F"...\n", " should be min 2 mss %"U16_F"...\n",
pcb->ssthresh, 2*pcb->mss)); pcb->ssthresh, 2*pcb->mss));
pcb->ssthresh = 2*pcb->mss; pcb->ssthresh = 2*pcb->mss;
} }
pcb->cwnd = pcb->ssthresh + 3 * pcb->mss; pcb->cwnd = pcb->ssthresh + 3 * pcb->mss;
pcb->flags |= TF_INFR; pcb->flags |= TF_INFR;
} }
} }
@ -1485,9 +1484,9 @@ tcp_keepalive(struct tcp_pcb *pcb)
ip_addr_debug_print(TCP_DEBUG, &pcb->remote_ip); ip_addr_debug_print(TCP_DEBUG, &pcb->remote_ip);
LWIP_DEBUGF(TCP_DEBUG, ("\n")); LWIP_DEBUGF(TCP_DEBUG, ("\n"));
LWIP_DEBUGF(TCP_DEBUG, ("tcp_keepalive: tcp_ticks %"U32_F" pcb->tmr %"U32_F" pcb->keep_cnt_sent %"U16_F"\n", LWIP_DEBUGF(TCP_DEBUG, ("tcp_keepalive: tcp_ticks %"U32_F" pcb->tmr %"U32_F" pcb->keep_cnt_sent %"U16_F"\n",
tcp_ticks, pcb->tmr, pcb->keep_cnt_sent)); tcp_ticks, pcb->tmr, pcb->keep_cnt_sent));
p = tcp_output_alloc_header(pcb, 0, 0, htonl(pcb->snd_nxt - 1)); p = tcp_output_alloc_header(pcb, 0, 0, htonl(pcb->snd_nxt - 1));
if(p == NULL) { if(p == NULL) {
LWIP_DEBUGF(TCP_DEBUG, LWIP_DEBUGF(TCP_DEBUG,
@ -1544,9 +1543,9 @@ tcp_zero_window_probe(struct tcp_pcb *pcb)
ip_addr_debug_print(TCP_DEBUG, &pcb->remote_ip); ip_addr_debug_print(TCP_DEBUG, &pcb->remote_ip);
LWIP_DEBUGF(TCP_DEBUG, ("\n")); LWIP_DEBUGF(TCP_DEBUG, ("\n"));
LWIP_DEBUGF(TCP_DEBUG, LWIP_DEBUGF(TCP_DEBUG,
("tcp_zero_window_probe: tcp_ticks %"U32_F ("tcp_zero_window_probe: tcp_ticks %"U32_F
" pcb->tmr %"U32_F" pcb->keep_cnt_sent %"U16_F"\n", " pcb->tmr %"U32_F" pcb->keep_cnt_sent %"U16_F"\n",
tcp_ticks, pcb->tmr, pcb->keep_cnt_sent)); tcp_ticks, pcb->tmr, pcb->keep_cnt_sent));
seg = pcb->unacked; seg = pcb->unacked;

View File

@ -103,7 +103,7 @@ udp_new_port(void)
{ {
u16_t n = 0; u16_t n = 0;
struct udp_pcb *pcb; struct udp_pcb *pcb;
again: again:
if (udp_port++ == UDP_LOCAL_PORT_RANGE_END) { if (udp_port++ == UDP_LOCAL_PORT_RANGE_END) {
udp_port = UDP_LOCAL_PORT_RANGE_START; udp_port = UDP_LOCAL_PORT_RANGE_START;
@ -276,7 +276,7 @@ udp_input(struct pbuf *p, struct netif *inp)
#endif /* LWIP_IPV4 */ #endif /* LWIP_IPV4 */
) { ) {
local_match = 1; local_match = 1;
if ((uncon_pcb == NULL) && if ((uncon_pcb == NULL) &&
((pcb->flags & UDP_FLAGS_CONNECTED) == 0)) { ((pcb->flags & UDP_FLAGS_CONNECTED) == 0)) {
/* the first unconnected matching PCB */ /* the first unconnected matching PCB */
uncon_pcb = pcb; uncon_pcb = pcb;
@ -549,7 +549,7 @@ udp_send_chksum(struct udp_pcb *pcb, struct pbuf *p,
* *
* If the PCB already has a remote address association, it will * If the PCB already has a remote address association, it will
* be restored after the data is sent. * be restored after the data is sent.
* *
* @return lwIP error code (@see udp_send for possible error codes) * @return lwIP error code (@see udp_send for possible error codes)
* *
* @see udp_disconnect() udp_send() * @see udp_disconnect() udp_send()

View File

@ -87,7 +87,7 @@ extern "C" {
#ifndef LWIP_UNUSED_ARG #ifndef LWIP_UNUSED_ARG
#define LWIP_UNUSED_ARG(x) (void)x #define LWIP_UNUSED_ARG(x) (void)x
#endif /* LWIP_UNUSED_ARG */ #endif /* LWIP_UNUSED_ARG */
#ifdef LWIP_PROVIDE_ERRNO #ifdef LWIP_PROVIDE_ERRNO

View File

@ -40,7 +40,7 @@
* Please coordinate changes and requests with Dominik Spies * Please coordinate changes and requests with Dominik Spies
* <kontakt@dspies.de> * <kontakt@dspies.de>
*/ */
#ifndef LWIP_HDR_AUTOIP_H #ifndef LWIP_HDR_AUTOIP_H
#define LWIP_HDR_AUTOIP_H #define LWIP_HDR_AUTOIP_H

View File

@ -73,7 +73,7 @@
#error "If you want to use LWIP_ASSERT, LWIP_PLATFORM_ASSERT(message) needs to be defined in your arch/cc.h" #error "If you want to use LWIP_ASSERT, LWIP_PLATFORM_ASSERT(message) needs to be defined in your arch/cc.h"
#endif #endif
#else /* LWIP_NOASSERT */ #else /* LWIP_NOASSERT */
#define LWIP_ASSERT(message, assertion) #define LWIP_ASSERT(message, assertion)
#endif /* LWIP_NOASSERT */ #endif /* LWIP_NOASSERT */
/** if "expression" isn't true, then print "message" and execute "handler" expression */ /** if "expression" isn't true, then print "message" and execute "handler" expression */
@ -110,7 +110,7 @@
} while(0) } while(0)
#else /* LWIP_DEBUG */ #else /* LWIP_DEBUG */
#define LWIP_DEBUGF(debug, message) #define LWIP_DEBUGF(debug, message)
#endif /* LWIP_DEBUG */ #endif /* LWIP_DEBUG */
#endif /* LWIP_HDR_DEBUG_H */ #endif /* LWIP_HDR_DEBUG_H */

View File

@ -61,7 +61,7 @@ extern "C" {
#define LWIP_MAKE_U16(a, b) ((a << 8) | b) #define LWIP_MAKE_U16(a, b) ((a << 8) | b)
#else #else
#define LWIP_MAKE_U16(a, b) ((b << 8) | a) #define LWIP_MAKE_U16(a, b) ((b << 8) | a)
#endif #endif
#ifndef LWIP_PLATFORM_BYTESWAP #ifndef LWIP_PLATFORM_BYTESWAP
#define LWIP_PLATFORM_BYTESWAP 0 #define LWIP_PLATFORM_BYTESWAP 0

View File

@ -45,11 +45,11 @@ extern "C" {
#endif #endif
/** period (in seconds) of the application calling dhcp_coarse_tmr() */ /** period (in seconds) of the application calling dhcp_coarse_tmr() */
#define DHCP_COARSE_TIMER_SECS 60 #define DHCP_COARSE_TIMER_SECS 60
/** period (in milliseconds) of the application calling dhcp_coarse_tmr() */ /** period (in milliseconds) of the application calling dhcp_coarse_tmr() */
#define DHCP_COARSE_TIMER_MSECS (DHCP_COARSE_TIMER_SECS * 1000UL) #define DHCP_COARSE_TIMER_MSECS (DHCP_COARSE_TIMER_SECS * 1000UL)
/** period (in milliseconds) of the application calling dhcp_fine_tmr() */ /** period (in milliseconds) of the application calling dhcp_fine_tmr() */
#define DHCP_FINE_TIMER_MSECS 500 #define DHCP_FINE_TIMER_MSECS 500
#define DHCP_CHADDR_LEN 16U #define DHCP_CHADDR_LEN 16U
#define DHCP_SNAME_LEN 64U #define DHCP_SNAME_LEN 64U
@ -57,9 +57,9 @@ extern "C" {
struct dhcp struct dhcp
{ {
/** transaction identifier of last sent request */ /** transaction identifier of last sent request */
u32_t xid; u32_t xid;
/** our connection to the DHCP server */ /** our connection to the DHCP server */
struct udp_pcb *pcb; struct udp_pcb *pcb;
/** incoming msg */ /** incoming msg */
struct dhcp_msg *msg_in; struct dhcp_msg *msg_in;
@ -86,7 +86,7 @@ struct dhcp
ip4_addr_t offered_ip_addr; ip4_addr_t offered_ip_addr;
ip4_addr_t offered_sn_mask; ip4_addr_t offered_sn_mask;
ip4_addr_t offered_gw_addr; ip4_addr_t offered_gw_addr;
u32_t offered_t0_lease; /* lease period (in seconds) */ u32_t offered_t0_lease; /* lease period (in seconds) */
u32_t offered_t1_renew; /* recommended renew time (usually 50% of lease period) */ u32_t offered_t1_renew; /* recommended renew time (usually 50% of lease period) */
u32_t offered_t2_rebind; /* recommended rebind time (usually 87.5 of lease period) */ u32_t offered_t2_rebind; /* recommended rebind time (usually 87.5 of lease period) */
@ -165,7 +165,7 @@ u8_t dhcp_supplied_address(struct netif *netif);
void dhcp_coarse_tmr(void); void dhcp_coarse_tmr(void);
/** to be called every half second */ /** to be called every half second */
void dhcp_fine_tmr(void); void dhcp_fine_tmr(void);
/** DHCP message item offsets and length */ /** DHCP message item offsets and length */
#define DHCP_OP_OFS 0 #define DHCP_OP_OFS 0
#define DHCP_HTYPE_OFS 1 #define DHCP_HTYPE_OFS 1
@ -207,7 +207,7 @@ void dhcp_fine_tmr(void);
/** AUTOIP cooperation flags */ /** AUTOIP cooperation flags */
#define DHCP_AUTOIP_COOP_STATE_OFF 0 #define DHCP_AUTOIP_COOP_STATE_OFF 0
#define DHCP_AUTOIP_COOP_STATE_ON 1 #define DHCP_AUTOIP_COOP_STATE_ON 1
#define DHCP_BOOTREQUEST 1 #define DHCP_BOOTREQUEST 1
#define DHCP_BOOTREPLY 2 #define DHCP_BOOTREPLY 2
@ -232,7 +232,7 @@ void dhcp_fine_tmr(void);
#define DHCP_OPTION_PAD 0 #define DHCP_OPTION_PAD 0
#define DHCP_OPTION_SUBNET_MASK 1 /* RFC 2132 3.3 */ #define DHCP_OPTION_SUBNET_MASK 1 /* RFC 2132 3.3 */
#define DHCP_OPTION_ROUTER 3 #define DHCP_OPTION_ROUTER 3
#define DHCP_OPTION_DNS_SERVER 6 #define DHCP_OPTION_DNS_SERVER 6
#define DHCP_OPTION_HOSTNAME 12 #define DHCP_OPTION_HOSTNAME 12
#define DHCP_OPTION_IP_TTL 23 #define DHCP_OPTION_IP_TTL 23
#define DHCP_OPTION_MTU 26 #define DHCP_OPTION_MTU 26

View File

@ -64,7 +64,7 @@ extern "C" {
* these should really be linked from the interface, but * these should really be linked from the interface, but
* if we keep them separate we will not affect the lwip original code * if we keep them separate we will not affect the lwip original code
* too much * too much
* *
* There will be a group for the all systems group address but this * There will be a group for the all systems group address but this
* will not run the state machine as it is used to kick off reports * will not run the state machine as it is used to kick off reports
* from all the other groups * from all the other groups

View File

@ -15,7 +15,7 @@
#define LWIP_MALLOC_MEMPOOL(num, size) LWIP_MEMPOOL(POOL_##size, num, (size + LWIP_MEM_ALIGN_SIZE(sizeof(struct memp_malloc_helper))), "MALLOC_"#size) #define LWIP_MALLOC_MEMPOOL(num, size) LWIP_MEMPOOL(POOL_##size, num, (size + LWIP_MEM_ALIGN_SIZE(sizeof(struct memp_malloc_helper))), "MALLOC_"#size)
#define LWIP_MALLOC_MEMPOOL_START #define LWIP_MALLOC_MEMPOOL_START
#define LWIP_MALLOC_MEMPOOL_END #define LWIP_MALLOC_MEMPOOL_END
#endif /* LWIP_MALLOC_MEMPOOL */ #endif /* LWIP_MALLOC_MEMPOOL */
#ifndef LWIP_PBUF_MEMPOOL #ifndef LWIP_PBUF_MEMPOOL
/* This treats "pbuf pools" just like any other pool. /* This treats "pbuf pools" just like any other pool.

View File

@ -364,7 +364,7 @@ void netif_set_remove_callback(struct netif *netif, netif_status_callback_fn rem
void netif_set_link_up(struct netif *netif); void netif_set_link_up(struct netif *netif);
void netif_set_link_down(struct netif *netif); void netif_set_link_down(struct netif *netif);
/** Ask if a link is up */ /** Ask if a link is up */
#define netif_is_link_up(netif) (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0) #define netif_is_link_up(netif) (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0)
#if LWIP_NETIF_LINK_CALLBACK #if LWIP_NETIF_LINK_CALLBACK

View File

@ -24,7 +24,6 @@
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
*/ */
#ifndef LWIP_HDR_NETIFAPI_H #ifndef LWIP_HDR_NETIFAPI_H
#define LWIP_HDR_NETIFAPI_H #define LWIP_HDR_NETIFAPI_H

View File

@ -60,7 +60,7 @@
#define SYS_LIGHTWEIGHT_PROT 0 #define SYS_LIGHTWEIGHT_PROT 0
#endif #endif
/** /**
* NO_SYS==1: Provides VERY minimal functionality. Otherwise, * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
* use lwIP facilities. * use lwIP facilities.
*/ */
@ -193,7 +193,7 @@
/** /**
* MEMP_USE_CUSTOM_POOLS==1: whether to include a user file lwippools.h * MEMP_USE_CUSTOM_POOLS==1: whether to include a user file lwippools.h
* that defines additional pools beyond the "standard" ones required * that defines additional pools beyond the "standard" ones required
* by lwIP. If you set this to 1, you must have lwippools.h in your * by lwIP. If you set this to 1, you must have lwippools.h in your
* include path somewhere. * include path somewhere.
*/ */
#ifndef MEMP_USE_CUSTOM_POOLS #ifndef MEMP_USE_CUSTOM_POOLS
@ -343,7 +343,7 @@
/** /**
* MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used * MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used
* for callback/timeout API communication. * for callback/timeout API communication.
* (only needed if you use tcpip.c) * (only needed if you use tcpip.c)
*/ */
#ifndef MEMP_NUM_TCPIP_MSG_API #ifndef MEMP_NUM_TCPIP_MSG_API
@ -352,7 +352,7 @@
/** /**
* MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used
* for incoming packets. * for incoming packets.
* (only needed if you use tcpip.c) * (only needed if you use tcpip.c)
*/ */
#ifndef MEMP_NUM_TCPIP_MSG_INPKT #ifndef MEMP_NUM_TCPIP_MSG_INPKT
@ -443,7 +443,7 @@
#endif #endif
/** /**
* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. * PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
*/ */
#ifndef PBUF_POOL_SIZE #ifndef PBUF_POOL_SIZE
#define PBUF_POOL_SIZE 16 #define PBUF_POOL_SIZE 16
@ -509,7 +509,7 @@
/** The maximum number of packets which may be queued for each /** The maximum number of packets which may be queued for each
* unresolved address by other network layers. Defaults to 3, 0 means disabled. * unresolved address by other network layers. Defaults to 3, 0 means disabled.
* Old packets are dropped, new packets are queued. * Old packets are dropped, new packets are queued.
*/ */
#ifndef ARP_QUEUE_LEN #ifndef ARP_QUEUE_LEN
#define ARP_QUEUE_LEN 3 #define ARP_QUEUE_LEN 3
#endif #endif
@ -903,7 +903,7 @@
#endif #endif
/** /**
* SNMP_PRIVATE_MIB: * SNMP_PRIVATE_MIB:
* When using a private MIB, you have to create a file 'private_mib.h' that contains * When using a private MIB, you have to create a file 'private_mib.h' that contains
* a 'struct mib_array_node mib_private' which contains your MIB. * a 'struct mib_array_node mib_private' which contains your MIB.
*/ */
@ -1121,12 +1121,12 @@
#endif #endif
/** /**
* TCP_WND: The size of a TCP window. This must be at least * TCP_WND: The size of a TCP window. This must be at least
* (2 * TCP_MSS) for things to work well * (2 * TCP_MSS) for things to work well
*/ */
#ifndef TCP_WND #ifndef TCP_WND
#define TCP_WND (4 * TCP_MSS) #define TCP_WND (4 * TCP_MSS)
#endif #endif
/** /**
* TCP_MAXRTX: Maximum number of retransmissions of data segments. * TCP_MAXRTX: Maximum number of retransmissions of data segments.
@ -2225,9 +2225,9 @@
* *
* If set (=1), the default if required by another enabled PPP feature unless * If set (=1), the default if required by another enabled PPP feature unless
* explicitly set to 0, using included lwIP PolarSSL. * explicitly set to 0, using included lwIP PolarSSL.
* *
* If clear (=0), not needed or using external PolarSSL. * If clear (=0), not needed or using external PolarSSL.
* *
* Beware of the stack requirements which can be a lot larger if you are not * Beware of the stack requirements which can be a lot larger if you are not
* using our cleaned PolarSSL library. * using our cleaned PolarSSL library.
*/ */
@ -2495,14 +2495,14 @@
#ifndef CHECKSUM_GEN_IP #ifndef CHECKSUM_GEN_IP
#define CHECKSUM_GEN_IP 1 #define CHECKSUM_GEN_IP 1
#endif #endif
/** /**
* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets. * CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.
*/ */
#ifndef CHECKSUM_GEN_UDP #ifndef CHECKSUM_GEN_UDP
#define CHECKSUM_GEN_UDP 1 #define CHECKSUM_GEN_UDP 1
#endif #endif
/** /**
* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets. * CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.
*/ */
@ -2516,21 +2516,21 @@
#ifndef CHECKSUM_GEN_ICMP #ifndef CHECKSUM_GEN_ICMP
#define CHECKSUM_GEN_ICMP 1 #define CHECKSUM_GEN_ICMP 1
#endif #endif
/** /**
* CHECKSUM_GEN_ICMP6==1: Generate checksums in software for outgoing ICMP6 packets. * CHECKSUM_GEN_ICMP6==1: Generate checksums in software for outgoing ICMP6 packets.
*/ */
#ifndef CHECKSUM_GEN_ICMP6 #ifndef CHECKSUM_GEN_ICMP6
#define CHECKSUM_GEN_ICMP6 1 #define CHECKSUM_GEN_ICMP6 1
#endif #endif
/** /**
* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets. * CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.
*/ */
#ifndef CHECKSUM_CHECK_IP #ifndef CHECKSUM_CHECK_IP
#define CHECKSUM_CHECK_IP 1 #define CHECKSUM_CHECK_IP 1
#endif #endif
/** /**
* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets. * CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.
*/ */

View File

@ -196,7 +196,7 @@ u8_t pbuf_header(struct pbuf *p, s16_t header_size);
u8_t pbuf_header_force(struct pbuf *p, s16_t header_size); u8_t pbuf_header_force(struct pbuf *p, s16_t header_size);
void pbuf_ref(struct pbuf *p); void pbuf_ref(struct pbuf *p);
u8_t pbuf_free(struct pbuf *p); u8_t pbuf_free(struct pbuf *p);
u8_t pbuf_clen(struct pbuf *p); u8_t pbuf_clen(struct pbuf *p);
void pbuf_cat(struct pbuf *head, struct pbuf *tail); void pbuf_cat(struct pbuf *head, struct pbuf *tail);
void pbuf_chain(struct pbuf *head, struct pbuf *tail); void pbuf_chain(struct pbuf *head, struct pbuf *tail);
struct pbuf *pbuf_dechain(struct pbuf *p); struct pbuf *pbuf_dechain(struct pbuf *p);

View File

@ -53,7 +53,7 @@ typedef void * sio_fd_t;
#ifndef sio_open #ifndef sio_open
/** /**
* Opens a serial device for communication. * Opens a serial device for communication.
* *
* @param devnum device number * @param devnum device number
* @return handle to serial device if successful, NULL otherwise * @return handle to serial device if successful, NULL otherwise
*/ */
@ -63,10 +63,10 @@ sio_fd_t sio_open(u8_t devnum);
#ifndef sio_send #ifndef sio_send
/** /**
* Sends a single character to the serial device. * Sends a single character to the serial device.
* *
* @param c character to send * @param c character to send
* @param fd serial device handle * @param fd serial device handle
* *
* @note This function will block until the character can be sent. * @note This function will block until the character can be sent.
*/ */
void sio_send(u8_t c, sio_fd_t fd); void sio_send(u8_t c, sio_fd_t fd);
@ -75,9 +75,9 @@ void sio_send(u8_t c, sio_fd_t fd);
#ifndef sio_recv #ifndef sio_recv
/** /**
* Receives a single character from the serial device. * Receives a single character from the serial device.
* *
* @param fd serial device handle * @param fd serial device handle
* *
* @note This function will block until a character is received. * @note This function will block until a character is received.
*/ */
u8_t sio_recv(sio_fd_t fd); u8_t sio_recv(sio_fd_t fd);
@ -86,12 +86,12 @@ u8_t sio_recv(sio_fd_t fd);
#ifndef sio_read #ifndef sio_read
/** /**
* Reads from the serial device. * Reads from the serial device.
* *
* @param fd serial device handle * @param fd serial device handle
* @param data pointer to data buffer for receiving * @param data pointer to data buffer for receiving
* @param len maximum length (in bytes) of data to receive * @param len maximum length (in bytes) of data to receive
* @return number of bytes actually received - may be 0 if aborted by sio_read_abort * @return number of bytes actually received - may be 0 if aborted by sio_read_abort
* *
* @note This function will block until data can be received. The blocking * @note This function will block until data can be received. The blocking
* can be cancelled by calling sio_read_abort(). * can be cancelled by calling sio_read_abort().
*/ */
@ -102,7 +102,7 @@ u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len);
/** /**
* Tries to read from the serial device. Same as sio_read but returns * Tries to read from the serial device. Same as sio_read but returns
* immediately if no data is available and never blocks. * immediately if no data is available and never blocks.
* *
* @param fd serial device handle * @param fd serial device handle
* @param data pointer to data buffer for receiving * @param data pointer to data buffer for receiving
* @param len maximum length (in bytes) of data to receive * @param len maximum length (in bytes) of data to receive
@ -114,12 +114,12 @@ u32_t sio_tryread(sio_fd_t fd, u8_t *data, u32_t len);
#ifndef sio_write #ifndef sio_write
/** /**
* Writes to the serial device. * Writes to the serial device.
* *
* @param fd serial device handle * @param fd serial device handle
* @param data pointer to data to send * @param data pointer to data to send
* @param len length (in bytes) of data to send * @param len length (in bytes) of data to send
* @return number of bytes actually sent * @return number of bytes actually sent
* *
* @note This function will block until all data can be sent. * @note This function will block until all data can be sent.
*/ */
u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len); u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len);
@ -128,7 +128,7 @@ u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len);
#ifndef sio_read_abort #ifndef sio_read_abort
/** /**
* Aborts a blocking sio_read() call. * Aborts a blocking sio_read() call.
* *
* @param fd serial device handle * @param fd serial device handle
*/ */
void sio_read_abort(sio_fd_t fd); void sio_read_abort(sio_fd_t fd);

View File

@ -54,7 +54,7 @@ extern "C" {
#endif #endif
/* MIB object instance */ /* MIB object instance */
#define MIB_OBJECT_NONE 0 #define MIB_OBJECT_NONE 0
#define MIB_OBJECT_SCALAR 1 #define MIB_OBJECT_SCALAR 1
#define MIB_OBJECT_TAB 2 #define MIB_OBJECT_TAB 2
@ -117,7 +117,7 @@ struct mib_scalar_node
/** tests length and/or range BEFORE setting */ /** tests length and/or range BEFORE setting */
u8_t (*set_test)(struct obj_def *od, u16_t len, void *value); u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
/** sets object value, only to be called when set_test() */ /** sets object value, only to be called when set_test() */
void (*set_value)(struct obj_def *od, u16_t len, void *value); void (*set_value)(struct obj_def *od, u16_t len, void *value);
}; };
/** describes an array entry (objid/node pair) */ /** describes an array entry (objid/node pair) */
@ -191,7 +191,7 @@ struct mib_external_node
u16_t (*get_value_a)(u8_t rid, struct obj_def *od, void *value); u16_t (*get_value_a)(u8_t rid, struct obj_def *od, void *value);
u8_t (*set_test_a)(u8_t rid, struct obj_def *od, u16_t len, void *value); u8_t (*set_test_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
void (*set_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value); void (*set_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
/** async Panic Close (agent returns error reply, /** async Panic Close (agent returns error reply,
e.g. used for external transaction cleanup) */ e.g. used for external transaction cleanup) */
void (*get_object_def_pc)(u8_t rid, u8_t ident_len, s32_t *ident); void (*get_object_def_pc)(u8_t rid, u8_t ident_len, s32_t *ident);
void (*get_value_pc)(u8_t rid, struct obj_def *od); void (*get_value_pc)(u8_t rid, struct obj_def *od);

View File

@ -425,7 +425,7 @@ typedef struct fd_set
#endif /* FD_SET */ #endif /* FD_SET */
/** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided /** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided
* by your system, set this to 0 and include <sys/time.h> in cc.h */ * by your system, set this to 0 and include <sys/time.h> in cc.h */
#ifndef LWIP_TIMEVAL_PRIVATE #ifndef LWIP_TIMEVAL_PRIVATE
#define LWIP_TIMEVAL_PRIVATE 1 #define LWIP_TIMEVAL_PRIVATE 1
#endif #endif

View File

@ -53,7 +53,7 @@ extern "C" {
#else #else
#define STAT_COUNTER u16_t #define STAT_COUNTER u16_t
#define STAT_COUNTER_F U16_F #define STAT_COUNTER_F U16_F
#endif #endif
struct stats_proto { struct stats_proto {
STAT_COUNTER xmit; /* Transmitted packets. */ STAT_COUNTER xmit; /* Transmitted packets. */

View File

@ -84,7 +84,7 @@ typedef u8_t sys_mbox_t;
/** sys_mbox_tryfetch() returns SYS_MBOX_EMPTY if appropriate. /** sys_mbox_tryfetch() returns SYS_MBOX_EMPTY if appropriate.
* For now we use the same magic value, but we allow this to change in future. * For now we use the same magic value, but we allow this to change in future.
*/ */
#define SYS_MBOX_EMPTY SYS_ARCH_TIMEOUT #define SYS_MBOX_EMPTY SYS_ARCH_TIMEOUT
#include "lwip/err.h" #include "lwip/err.h"
#include "arch/sys_arch.h" #include "arch/sys_arch.h"
@ -123,7 +123,7 @@ void sys_mutex_lock(sys_mutex_t *mutex);
void sys_mutex_unlock(sys_mutex_t *mutex); void sys_mutex_unlock(sys_mutex_t *mutex);
/** Delete a semaphore /** Delete a semaphore
* @param mutex the mutex to delete */ * @param mutex the mutex to delete */
void sys_mutex_free(sys_mutex_t *mutex); void sys_mutex_free(sys_mutex_t *mutex);
#ifndef sys_mutex_valid #ifndef sys_mutex_valid
/** Check if a mutex is valid/allocated: return 1 for valid, 0 for invalid */ /** Check if a mutex is valid/allocated: return 1 for valid, 0 for invalid */
int sys_mutex_valid(sys_mutex_t *mutex); int sys_mutex_valid(sys_mutex_t *mutex);

View File

@ -191,7 +191,7 @@ struct tcp_pcb {
/* ports are in host byte order */ /* ports are in host byte order */
u16_t remote_port; u16_t remote_port;
tcpflags_t flags; tcpflags_t flags;
#define TF_ACK_DELAY 0x01U /* Delayed ACK. */ #define TF_ACK_DELAY 0x01U /* Delayed ACK. */
#define TF_ACK_NOW 0x02U /* Immediate ACK. */ #define TF_ACK_NOW 0x02U /* Immediate ACK. */
@ -262,7 +262,7 @@ struct tcp_pcb {
/* These are ordered by sequence number: */ /* These are ordered by sequence number: */
struct tcp_seg *unsent; /* Unsent (queued) segments. */ struct tcp_seg *unsent; /* Unsent (queued) segments. */
struct tcp_seg *unacked; /* Sent but unacknowledged segments. */ struct tcp_seg *unacked; /* Sent but unacknowledged segments. */
#if TCP_QUEUE_OOSEQ #if TCP_QUEUE_OOSEQ
struct tcp_seg *ooseq; /* Received out of sequence segments. */ struct tcp_seg *ooseq; /* Received out of sequence segments. */
#endif /* TCP_QUEUE_OOSEQ */ #endif /* TCP_QUEUE_OOSEQ */
@ -292,7 +292,7 @@ struct tcp_pcb {
u32_t keep_intvl; u32_t keep_intvl;
u32_t keep_cnt; u32_t keep_cnt;
#endif /* LWIP_TCP_KEEPALIVE */ #endif /* LWIP_TCP_KEEPALIVE */
/* Persist timer counter */ /* Persist timer counter */
u8_t persist_cnt; u8_t persist_cnt;
/* Persist timer back-off */ /* Persist timer back-off */

View File

@ -289,7 +289,7 @@ struct tcp_seg {
u16_t oversize_left; /* Extra bytes available at the end of the last u16_t oversize_left; /* Extra bytes available at the end of the last
pbuf in unsent (used for asserting vs. pbuf in unsent (used for asserting vs.
tcp_pcb.unsent_oversized only) */ tcp_pcb.unsent_oversized only) */
#endif /* TCP_OVERSIZE_DBGCHECK */ #endif /* TCP_OVERSIZE_DBGCHECK */
#if TCP_CHECKSUM_ON_COPY #if TCP_CHECKSUM_ON_COPY
u16_t chksum; u16_t chksum;
u8_t chksum_swapped; u8_t chksum_swapped;
@ -350,7 +350,7 @@ extern u8_t tcp_active_pcbs_changed;
/* The TCP PCB lists. */ /* The TCP PCB lists. */
union tcp_listen_pcbs_t { /* List of all TCP PCBs in LISTEN state. */ union tcp_listen_pcbs_t { /* List of all TCP PCBs in LISTEN state. */
struct tcp_pcb_listen *listen_pcbs; struct tcp_pcb_listen *listen_pcbs;
struct tcp_pcb *pcbs; struct tcp_pcb *pcbs;
}; };
extern struct tcp_pcb *tcp_bound_pcbs; extern struct tcp_pcb *tcp_bound_pcbs;
@ -362,7 +362,7 @@ extern struct tcp_pcb *tcp_tw_pcbs; /* List of all TCP PCBs in TIME-WAIT. *
extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */ extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */
/* Axioms about the above lists: /* Axioms about the above lists:
1) Every TCP PCB that is not CLOSED is in one of the lists. 1) Every TCP PCB that is not CLOSED is in one of the lists.
2) A PCB is only in one of the lists. 2) A PCB is only in one of the lists.
3) All PCBs in the tcp_listen_pcbs list is in LISTEN state. 3) All PCBs in the tcp_listen_pcbs list is in LISTEN state.

View File

@ -76,6 +76,6 @@ void slipif_received_bytes(struct netif *netif, u8_t *data, u8_t len);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* LWIP_HDR_NETIF_SLIPIF_H */ #endif /* LWIP_HDR_NETIF_SLIPIF_H */

View File

@ -42,7 +42,7 @@
* This file is part of the lwIP TCP/IP stack. * This file is part of the lwIP TCP/IP stack.
* *
*/ */
#include "lwip/opt.h" #include "lwip/opt.h"
#if LWIP_ARP || LWIP_ETHERNET #if LWIP_ARP || LWIP_ETHERNET
@ -87,7 +87,7 @@ const struct eth_addr ethzero = {{0,0,0,0,0,0}};
/** the time an ARP entry stays pending after first request, /** the time an ARP entry stays pending after first request,
* for ARP_TMR_INTERVAL = 1000, this is * for ARP_TMR_INTERVAL = 1000, this is
* 10 seconds. * 10 seconds.
* *
* @internal Keep this number at least 2, otherwise it might * @internal Keep this number at least 2, otherwise it might
* run out instantly if the timeout occurs directly after a request. * run out instantly if the timeout occurs directly after a request.
*/ */
@ -249,14 +249,14 @@ etharp_tmr(void)
/** /**
* Search the ARP table for a matching or new entry. * Search the ARP table for a matching or new entry.
* *
* If an IP address is given, return a pending or stable ARP entry that matches * If an IP address is given, return a pending or stable ARP entry that matches
* the address. If no match is found, create a new entry with this address set, * the address. If no match is found, create a new entry with this address set,
* but in state ETHARP_EMPTY. The caller must check and possibly change the * but in state ETHARP_EMPTY. The caller must check and possibly change the
* state of the returned entry. * state of the returned entry.
* *
* If ipaddr is NULL, return a initialized new entry in state ETHARP_EMPTY. * If ipaddr is NULL, return a initialized new entry in state ETHARP_EMPTY.
* *
* In all cases, attempt to create new entries from an empty entry. If no * In all cases, attempt to create new entries from an empty entry. If no
* empty entries are available and ETHARP_FLAG_TRY_HARD flag is set, recycle * empty entries are available and ETHARP_FLAG_TRY_HARD flag is set, recycle
* old entries. Heuristic choose the least important entry for recycling. * old entries. Heuristic choose the least important entry for recycling.
@ -264,7 +264,7 @@ etharp_tmr(void)
* @param ipaddr IP address to find in ARP cache, or to add if not found. * @param ipaddr IP address to find in ARP cache, or to add if not found.
* @param flags @see definition of ETHARP_FLAG_* * @param flags @see definition of ETHARP_FLAG_*
* @param netif netif related to this address (used for NETIF_HWADDRHINT) * @param netif netif related to this address (used for NETIF_HWADDRHINT)
* *
* @return The ARP entry index that matched or is created, ERR_MEM if no * @return The ARP entry index that matched or is created, ERR_MEM if no
* entry is found or could be recycled. * entry is found or could be recycled.
*/ */
@ -349,7 +349,7 @@ etharp_find_entry(const ip4_addr_t *ipaddr, u8_t flags, struct netif* netif)
} }
} }
/* { we have no match } => try to create a new entry */ /* { we have no match } => try to create a new entry */
/* don't create new entry, only search? */ /* don't create new entry, only search? */
if (((flags & ETHARP_FLAG_FIND_ONLY) != 0) || if (((flags & ETHARP_FLAG_FIND_ONLY) != 0) ||
/* or no empty entry found and not allowed to recycle? */ /* or no empty entry found and not allowed to recycle? */
@ -357,15 +357,15 @@ etharp_find_entry(const ip4_addr_t *ipaddr, u8_t flags, struct netif* netif)
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_find_entry: no empty entry found and not allowed to recycle\n")); LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_find_entry: no empty entry found and not allowed to recycle\n"));
return (s8_t)ERR_MEM; return (s8_t)ERR_MEM;
} }
/* b) choose the least destructive entry to recycle: /* b) choose the least destructive entry to recycle:
* 1) empty entry * 1) empty entry
* 2) oldest stable entry * 2) oldest stable entry
* 3) oldest pending entry without queued packets * 3) oldest pending entry without queued packets
* 4) oldest pending entry with queued packets * 4) oldest pending entry with queued packets
* *
* { ETHARP_FLAG_TRY_HARD is set at this point } * { ETHARP_FLAG_TRY_HARD is set at this point }
*/ */
/* 1) empty entry available? */ /* 1) empty entry available? */
if (empty < ARP_TABLE_SIZE) { if (empty < ARP_TABLE_SIZE) {
@ -462,7 +462,7 @@ etharp_send_ip(struct netif *netif, struct pbuf *p, struct eth_addr *src, const
* *
* If a pending entry is resolved, any queued packets will be sent * If a pending entry is resolved, any queued packets will be sent
* at this point. * at this point.
* *
* @param netif netif related to this entry (used for NETIF_ADDRHINT) * @param netif netif related to this entry (used for NETIF_ADDRHINT)
* @param ipaddr IP address of the inserted ARP entry. * @param ipaddr IP address of the inserted ARP entry.
* @param ethaddr Ethernet address of the inserted ARP entry. * @param ethaddr Ethernet address of the inserted ARP entry.
@ -701,7 +701,7 @@ etharp_ip_input(struct netif *netif, struct pbuf *p)
#endif /* ETHARP_TRUST_IP_MAC */ #endif /* ETHARP_TRUST_IP_MAC */
/** /**
* Responds to ARP requests to us. Upon ARP replies to us, add entry to cache * Responds to ARP requests to us. Upon ARP replies to us, add entry to cache
* send out queued IP packets. Updates cache with snooped address pairs. * send out queued IP packets. Updates cache with snooped address pairs.
* *
* Should be called for incoming ARP packets. The pbuf in the argument * Should be called for incoming ARP packets. The pbuf in the argument
@ -890,7 +890,7 @@ etharp_output_to_arp_index(struct netif *netif, struct pbuf *q, u8_t arp_idx)
} }
} }
} }
return etharp_send_ip(netif, q, (struct eth_addr*)(netif->hwaddr), return etharp_send_ip(netif, q, (struct eth_addr*)(netif->hwaddr),
&arp_table[arp_idx].ethaddr); &arp_table[arp_idx].ethaddr);
} }
@ -1043,11 +1043,11 @@ etharp_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr)
* is sent for the given address. The packet is queued on this entry. * is sent for the given address. The packet is queued on this entry.
* *
* If the IP address was already stable in the cache, and a packet is * If the IP address was already stable in the cache, and a packet is
* given, it is directly sent and no ARP request is sent out. * given, it is directly sent and no ARP request is sent out.
* *
* If the IP address was already stable in the cache, and no packet is * If the IP address was already stable in the cache, and no packet is
* given, an ARP request is sent out. * given, an ARP request is sent out.
* *
* @param netif The lwIP network interface on which ipaddr * @param netif The lwIP network interface on which ipaddr
* must be queried for. * must be queried for.
* @param ipaddr The IP address to be resolved. * @param ipaddr The IP address to be resolved.
@ -1136,7 +1136,7 @@ etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q)
struct pbuf *p; struct pbuf *p;
int copy_needed = 0; int copy_needed = 0;
/* IF q includes a PBUF_REF, PBUF_POOL or PBUF_RAM, we have no choice but /* IF q includes a PBUF_REF, PBUF_POOL or PBUF_RAM, we have no choice but
* to copy the whole queue into a new PBUF_RAM (see bug #11400) * to copy the whole queue into a new PBUF_RAM (see bug #11400)
* PBUF_ROMs can be left as they are, since ROM must not get changed. */ * PBUF_ROMs can be left as they are, since ROM must not get changed. */
p = q; p = q;
while (p) { while (p) {
@ -1294,7 +1294,7 @@ etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr,
ETHADDR16_COPY(&hdr->shwaddr, hwsrc_addr); ETHADDR16_COPY(&hdr->shwaddr, hwsrc_addr);
ETHADDR16_COPY(&hdr->dhwaddr, hwdst_addr); ETHADDR16_COPY(&hdr->dhwaddr, hwdst_addr);
/* Copy struct ip4_addr2 to aligned ip4_addr, to support compilers without /* Copy struct ip4_addr2 to aligned ip4_addr, to support compilers without
* structure packing. */ * structure packing. */
IPADDR2_COPY(&hdr->sipaddr, ipsrc_addr); IPADDR2_COPY(&hdr->sipaddr, ipsrc_addr);
IPADDR2_COPY(&hdr->dipaddr, ipdst_addr); IPADDR2_COPY(&hdr->dipaddr, ipdst_addr);
@ -1479,7 +1479,7 @@ ethernet_input(struct pbuf *p, struct netif *netif)
ip4_input(p, netif); ip4_input(p, netif);
} }
break; break;
case PP_HTONS(ETHTYPE_ARP): case PP_HTONS(ETHTYPE_ARP):
if (!(netif->flags & NETIF_FLAG_ETHARP)) { if (!(netif->flags & NETIF_FLAG_ETHARP)) {
goto free_and_return; goto free_and_return;

View File

@ -85,7 +85,7 @@ static void
low_level_init(struct netif *netif) low_level_init(struct netif *netif)
{ {
struct ethernetif *ethernetif = netif->state; struct ethernetif *ethernetif = netif->state;
/* set MAC hardware address length */ /* set MAC hardware address length */
netif->hwaddr_len = ETHARP_HWADDR_LEN; netif->hwaddr_len = ETHARP_HWADDR_LEN;
@ -96,11 +96,11 @@ low_level_init(struct netif *netif)
/* maximum transfer unit */ /* maximum transfer unit */
netif->mtu = 1500; netif->mtu = 1500;
/* device capabilities */ /* device capabilities */
/* don't set NETIF_FLAG_ETHARP if this device is not an ethernet one */ /* don't set NETIF_FLAG_ETHARP if this device is not an ethernet one */
netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP; netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP;
#if LWIP_IPV6 && LWIP_IPV6_MLD #if LWIP_IPV6 && LWIP_IPV6_MLD
/* /*
* For hardware/netifs that implement MAC filtering. * For hardware/netifs that implement MAC filtering.
@ -114,7 +114,7 @@ low_level_init(struct netif *netif)
} }
#endif /* LWIP_IPV6 && LWIP_IPV6_MLD */ #endif /* LWIP_IPV6 && LWIP_IPV6_MLD */
/* Do whatever else is needed to initialize interface. */ /* Do whatever else is needed to initialize interface. */
} }
/** /**
@ -140,7 +140,7 @@ low_level_output(struct netif *netif, struct pbuf *p)
struct pbuf *q; struct pbuf *q;
initiate transfer(); initiate transfer();
#if ETH_PAD_SIZE #if ETH_PAD_SIZE
pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */ pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
#endif #endif
@ -157,7 +157,7 @@ low_level_output(struct netif *netif, struct pbuf *p)
#if ETH_PAD_SIZE #if ETH_PAD_SIZE
pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */ pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */
#endif #endif
LINK_STATS_INC(link.xmit); LINK_STATS_INC(link.xmit);
return ERR_OK; return ERR_OK;
@ -188,7 +188,7 @@ low_level_input(struct netif *netif)
/* We allocate a pbuf chain of pbufs from the pool. */ /* We allocate a pbuf chain of pbufs from the pool. */
p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL); p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
if (p != NULL) { if (p != NULL) {
#if ETH_PAD_SIZE #if ETH_PAD_SIZE
@ -221,7 +221,7 @@ low_level_input(struct netif *netif)
LINK_STATS_INC(link.drop); LINK_STATS_INC(link.drop);
} }
return p; return p;
} }
/** /**
@ -292,7 +292,7 @@ ethernetif_init(struct netif *netif)
struct ethernetif *ethernetif; struct ethernetif *ethernetif;
LWIP_ASSERT("netif != NULL", (netif != NULL)); LWIP_ASSERT("netif != NULL", (netif != NULL));
ethernetif = mem_malloc(sizeof(struct ethernetif)); ethernetif = mem_malloc(sizeof(struct ethernetif));
if (ethernetif == NULL) { if (ethernetif == NULL) {
LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_init: out of memory\n")); LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_init: out of memory\n"));
@ -323,9 +323,9 @@ ethernetif_init(struct netif *netif)
netif->output_ip6 = ethip6_output; netif->output_ip6 = ethip6_output;
#endif /* LWIP_IPV6 */ #endif /* LWIP_IPV6 */
netif->linkoutput = low_level_output; netif->linkoutput = low_level_output;
ethernetif->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]); ethernetif->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]);
/* initialize the hardware */ /* initialize the hardware */
low_level_init(netif); low_level_init(netif);

View File

@ -47,10 +47,10 @@
* packets and puts completed packets on a queue which is fed into * packets and puts completed packets on a queue which is fed into
* the stack from the main loop (needs SYS_LIGHTWEIGHT_PROT for * the stack from the main loop (needs SYS_LIGHTWEIGHT_PROT for
* pbuf_alloc to work on ISR level!). * pbuf_alloc to work on ISR level!).
* *
*/ */
/* /*
* This is an arch independent SLIP netif. The specific serial hooks must be * This is an arch independent SLIP netif. The specific serial hooks must be
* provided by another file. They are sio_open, sio_read/sio_tryread and sio_send * provided by another file. They are sio_open, sio_read/sio_tryread and sio_send
*/ */