From 490581a0eb30c4e0f7262dcf45175d0d3c2e3597 Mon Sep 17 00:00:00 2001 From: sg Date: Tue, 6 Oct 2015 21:08:28 +0200 Subject: [PATCH] minor/coding style: removed spaces before line ending --- src/api/api_lib.c | 2 +- src/api/api_msg.c | 6 ++-- src/api/err.c | 3 +- src/api/netdb.c | 4 +-- src/api/sockets.c | 10 +++---- src/api/tcpip.c | 6 ++-- src/core/def.c | 2 +- src/core/dhcp.c | 4 +-- src/core/inet_chksum.c | 16 +++++------ src/core/init.c | 2 +- src/core/ipv4/autoip.c | 6 ++-- src/core/ipv4/icmp.c | 2 +- src/core/ipv4/igmp.c | 4 +-- src/core/ipv4/ip4.c | 2 +- src/core/ipv4/ip4_addr.c | 4 +-- src/core/ipv4/ip_frag.c | 15 +++++----- src/core/ipv6/ip6.c | 1 - src/core/mem.c | 2 +- src/core/memp.c | 14 ++++----- src/core/netif.c | 11 ++++---- src/core/pbuf.c | 4 +-- src/core/raw.c | 6 ++-- src/core/tcp.c | 50 ++++++++++++++++----------------- src/core/tcp_in.c | 41 +++++++++++++-------------- src/core/tcp_out.c | 35 +++++++++++------------ src/core/udp.c | 6 ++-- src/include/lwip/arch.h | 2 +- src/include/lwip/autoip.h | 2 +- src/include/lwip/debug.h | 4 +-- src/include/lwip/def.h | 2 +- src/include/lwip/dhcp.h | 16 +++++------ src/include/lwip/igmp.h | 2 +- src/include/lwip/memp_std.h | 2 +- src/include/lwip/netif.h | 2 +- src/include/lwip/netifapi.h | 1 - src/include/lwip/opt.h | 32 ++++++++++----------- src/include/lwip/pbuf.h | 2 +- src/include/lwip/sio.h | 22 +++++++-------- src/include/lwip/snmp_structs.h | 6 ++-- src/include/lwip/sockets.h | 2 +- src/include/lwip/stats.h | 2 +- src/include/lwip/sys.h | 4 +-- src/include/lwip/tcp.h | 6 ++-- src/include/lwip/tcp_impl.h | 6 ++-- src/include/netif/slipif.h | 2 +- src/netif/etharp.c | 38 ++++++++++++------------- src/netif/ethernetif.c | 22 +++++++-------- src/netif/slipif.c | 4 +-- 48 files changed, 215 insertions(+), 224 deletions(-) diff --git a/src/api/api_lib.c b/src/api/api_lib.c index 7437e35c..05c7ed09 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -3,7 +3,7 @@ * Sequential API External module * */ - + /* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. * All rights reserved. diff --git a/src/api/api_msg.c b/src/api/api_msg.c index b327e1b8..58cc3366 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -350,7 +350,7 @@ sent_tcp(void *arg, struct tcp_pcb *pcb, u16_t len) API_EVENT(conn, NETCONN_EVT_SENDPLUS, len); } } - + return ERR_OK; } @@ -1466,7 +1466,7 @@ lwip_netconn_do_writemore(struct netconn *conn WRITE_DELAYED_PARAM) if (available < len) { /* don't try to write more than sendbuf */ len = available; - if (dontblock) { + if (dontblock) { if (!len) { err = ERR_WOULDBLOCK; goto err_mem; @@ -1760,7 +1760,7 @@ lwip_netconn_do_close(struct api_msg_msg *msg) */ void lwip_netconn_do_join_leave_group(struct api_msg_msg *msg) -{ +{ if (ERR_IS_FATAL(msg->conn->last_err)) { msg->err = msg->conn->last_err; } else { diff --git a/src/api/err.c b/src/api/err.c index d8f0e6ca..9adec6fd 100644 --- a/src/api/err.c +++ b/src/api/err.c @@ -57,7 +57,7 @@ static const char *err_strerr[] = { "Connection reset.", /* ERR_RST -13 */ "Connection closed.", /* ERR_CLSD -14 */ "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) { return err_strerr[-err]; - } #endif /* LWIP_DEBUG */ diff --git a/src/api/netdb.c b/src/api/netdb.c index eb918acf..6bca2b76 100644 --- a/src/api/netdb.c +++ b/src/api/netdb.c @@ -256,7 +256,7 @@ lwip_freeaddrinfo(struct addrinfo *ai) * * @param nodename descriptive name or address string of the host * (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 res pointer to a pointer where to store the result (set to NULL 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) { ai_family = hints->ai_family; - if ((ai_family != AF_UNSPEC) + if ((ai_family != AF_UNSPEC) #if LWIP_IPV4 && (ai_family != AF_INET) #endif /* LWIP_IPV4 */ diff --git a/src/api/sockets.c b/src/api/sockets.c index a5b8095b..20d49410 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -771,7 +771,7 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags, buf = sock->lastdata; } else { /* 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)) { if (off > 0) { /* 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) { LWIP_ASSERT("invalid copylen, len would underflow", len >= copylen); len -= copylen; - if ( (len <= 0) || - (p->flags & PBUF_FLAG_PUSH) || - (sock->rcvevent <= 0) || + if ( (len <= 0) || + (p->flags & PBUF_FLAG_PUSH) || + (sock->rcvevent <= 0) || ((flags & MSG_PEEK)!=0)) { done = 1; } @@ -1274,7 +1274,7 @@ int lwip_writev(int s, const struct iovec *iov, int iovcnt) { struct msghdr msg; - + msg.msg_name = NULL; msg.msg_namelen = 0; /* Hack: we have to cast via number to cast from 'const' pointer to non-const. diff --git a/src/api/tcpip.c b/src/api/tcpip.c index 34ec5013..a2ca5338 100644 --- a/src/api/tcpip.c +++ b/src/api/tcpip.c @@ -374,7 +374,7 @@ tcpip_apimsg(struct api_msg *apimsg) /* catch functions that don't set err */ apimsg->msg.err = ERR_VAL; #endif - + if (sys_mbox_valid_val(mbox)) { TCPIP_MSG_VAR_ALLOC(msg); TCPIP_MSG_VAR_REF(msg).type = TCPIP_MSG_API; @@ -417,7 +417,7 @@ tcpip_netifapi(struct netifapi_msg* netifapimsg) netifapimsg->msg.err = err; return err; } - + TCPIP_MSG_VAR_REF(msg).type = TCPIP_MSG_NETIFAPI; TCPIP_MSG_VAR_REF(msg).msg.netifapimsg = netifapimsg; sys_mbox_post(&mbox, &TCPIP_MSG_VAR_REF(msg)); @@ -440,7 +440,7 @@ tcpip_netifapi(struct netifapi_msg* netifapimsg) err_t tcpip_netifapi_lock(struct netifapi_msg* netifapimsg) { - LOCK_TCPIP_CORE(); + LOCK_TCPIP_CORE(); netifapimsg->function(&(netifapimsg->msg)); UNLOCK_TCPIP_CORE(); return netifapimsg->msg.err; diff --git a/src/core/def.c b/src/core/def.c index 352b5524..bb4b8e01 100644 --- a/src/core/def.c +++ b/src/core/def.c @@ -44,7 +44,7 @@ * Again with the aim of being simple, correct and fully portable. * 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: - * + * * #define LWIP_PLATFORM_BYTESWAP 1 * #define LWIP_PLATFORM_HTONS(x) * #define LWIP_PLATFORM_HTONL(x) diff --git a/src/core/dhcp.c b/src/core/dhcp.c index 8d656cea..c423b26f 100644 --- a/src/core/dhcp.c +++ b/src/core/dhcp.c @@ -211,7 +211,7 @@ static void dhcp_handle_nak(struct netif *netif) { 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)); /* 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); @@ -394,7 +394,7 @@ dhcp_fine_tmr(void) while (netif != NULL) { /* only act on DHCP configured interfaces */ 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) { netif->dhcp->request_timeout--; } diff --git a/src/core/inet_chksum.c b/src/core/inet_chksum.c index 662d3c71..d25a0d32 100644 --- a/src/core/inet_chksum.c +++ b/src/core/inet_chksum.c @@ -49,8 +49,8 @@ * aim of being simple, correct and fully portable. Checksumming is the * 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: - * - * #define LWIP_CHKSUM + * + * #define LWIP_CHKSUM * * Or you can select from the implementations below by defining * 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 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 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 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 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 * 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. * @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 */ - u16_t lwip_standard_chksum(const void *dataptr, int len) { diff --git a/src/core/init.c b/src/core/init.c index 91328fe0..50c34c3d 100644 --- a/src/core/init.c +++ b/src/core/init.c @@ -228,7 +228,7 @@ #if NETCONN_MORE != TCP_WRITE_FLAG_MORE #error "NETCONN_MORE != TCP_WRITE_FLAG_MORE" #endif -#endif /* LWIP_NETCONN && LWIP_TCP */ +#endif /* LWIP_NETCONN && LWIP_TCP */ #if LWIP_SOCKET /* Check that the SO_* socket options and SOF_* lwIP-internal flags match */ #if SO_REUSEADDR != SOF_REUSEADDR diff --git a/src/core/ipv4/autoip.c b/src/core/ipv4/autoip.c index 6d1c7a5b..ccfdf5bf 100644 --- a/src/core/ipv4/autoip.c +++ b/src/core/ipv4/autoip.c @@ -202,7 +202,7 @@ autoip_create_addr(struct netif *netif, ip4_addr_t *ipaddr) u32_t addr = ntohl(LWIP_AUTOIP_CREATE_SEED_ADDR(netif)); addr += netif->autoip->tried_llipaddr; 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) { 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) && (addr <= AUTOIP_RANGE_END)); ip4_addr_set_u32(ipaddr, htonl(addr)); - + 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", (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(&dipaddr, &hdr->dipaddr); - + if ((netif->autoip->state == AUTOIP_STATE_PROBING) || ((netif->autoip->state == AUTOIP_STATE_ANNOUNCING) && (netif->autoip->sent_num == 0))) { diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c index eec9ee9e..ca475274 100644 --- a/src/core/ipv4/icmp.c +++ b/src/core/ipv4/icmp.c @@ -256,7 +256,7 @@ icmp_input(struct pbuf *p, struct netif *inp) } else if(type == ICMP_AMR) { 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)); ICMP_STATS_INC(icmp.proterr); ICMP_STATS_INC(icmp.drop); diff --git a/src/core/ipv4/igmp.c b/src/core/ipv4/igmp.c index 7f018b9d..2e934a0c 100644 --- a/src/core/ipv4/igmp.c +++ b/src/core/ipv4/igmp.c @@ -92,7 +92,7 @@ Steve Reynolds #include "string.h" -/* +/* * IGMP constants */ #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); - /* 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) { pbuf_free(p); IGMP_STATS_INC(igmp.lenerr); diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c index 17944b49..810b1660 100644 --- a/src/core/ipv4/ip4.c +++ b/src/core/ipv4/ip4.c @@ -380,7 +380,7 @@ ip_input(struct pbuf *p, struct netif *inp) * forwarded (using ip_forward). The IP checksum is always checked. * * 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 inp the netif on which this packet was received * @return ERR_OK if the packet was processed (could return ERR_* if it wasn't diff --git a/src/core/ipv4/ip4_addr.c b/src/core/ipv4/ip4_addr.c index 31b737c2..b947dd5b 100644 --- a/src/core/ipv4/ip4_addr.c +++ b/src/core/ipv4/ip4_addr.c @@ -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); /** - * 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 netif the network interface against which the address is checked * @return returns non-zero if the address is a broadcast address diff --git a/src/core/ipv4/ip_frag.c b/src/core/ipv4/ip_frag.c index a278ffe8..d4a5316f 100644 --- a/src/core/ipv4/ip_frag.c +++ b/src/core/ipv4/ip_frag.c @@ -187,7 +187,7 @@ ip_reass_free_complete_datagram(struct ip_reassdata *ipr, struct ip_reassdata *p } #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 */ p = ipr->p; while (p != NULL) { @@ -308,7 +308,6 @@ ip_reass_enqueue_new_datagram(struct ip_hdr *fraghdr, int clen) static void ip_reass_dequeue_datagram(struct ip_reassdata *ipr, struct ip_reassdata *prev) { - /* dequeue the reass struct */ if (reassdatagrams == ipr) { /* 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; /* 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; offset = (ntohs(IPH_OFFSET(fraghdr)) & IP_OFFMASK) * 8; @@ -489,7 +488,7 @@ ip4_reass(struct pbuf *p) IPFRAG_STATS_INC(ip_frag.recv); MIB2_STATS_INC(mib2.ipreasmreqds); - + fraghdr = (struct ip_hdr*)p->payload; if ((IPH_HL(fraghdr) * 4) != IP_HLEN) { @@ -541,7 +540,7 @@ ip4_reass(struct pbuf *p) goto nullreturn; } } 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)) { /* 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 @@ -550,11 +549,11 @@ ip4_reass(struct pbuf *p) 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 */ 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 */ /* 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 * there will be zero memory penalty. */ - + pbuf_free(rambuf); #endif /* IP_FRAG_USES_STATIC_BUF */ left -= cop; diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c index fb776da0..59b92b68 100644 --- a/src/core/ipv6/ip6.c +++ b/src/core/ipv6/ip6.c @@ -39,7 +39,6 @@ * */ - #include "lwip/opt.h" #if LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */ diff --git a/src/core/mem.c b/src/core/mem.c index 634e7604..936a2552 100644 --- a/src/core/mem.c +++ b/src/core/mem.c @@ -489,7 +489,7 @@ mem_trim(void *rmem, mem_size_t newsize) /* else { next struct mem is used but size between mem and mem2 is not big enough to create another struct mem - -> don't do anyhting. + -> don't do anyhting. -> the remaining space stays unused since it is too small } */ #if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT diff --git a/src/core/memp.c b/src/core/memp.c index 0902b441..db22244d 100644 --- a/src/core/memp.c +++ b/src/core/memp.c @@ -163,19 +163,19 @@ static const char *memp_desc[MEMP_MAX] = { * 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 \ - [((num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size)))]; + [((num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size)))]; #include "lwip/memp_std.h" /** This array holds the base of each memory pool. */ -static u8_t *const memp_bases[] = { -#define LWIP_MEMPOOL(name,num,size,desc) memp_memory_ ## name ## _base, +static u8_t *const memp_bases[] = { +#define LWIP_MEMPOOL(name,num,size,desc) memp_memory_ ## name ## _base, #include "lwip/memp_std.h" }; #else /* MEMP_SEPARATE_POOLS */ /** 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) ) ) #include "lwip/memp_std.h" ]; @@ -351,7 +351,7 @@ memp_overflow_init(void) /** * Initialize this module. - * + * * Carves out memp_memory into linked lists for each pool-type. */ void @@ -414,7 +414,7 @@ memp_malloc_fn(memp_t type, const char* file, const int line) { struct memp *memp; SYS_ARCH_DECL_PROTECT(old_level); - + LWIP_ERROR("memp_malloc: type < MEMP_MAX", (type < MEMP_MAX), return NULL;); 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 */ memp = memp_tab[type]; - + if (memp != NULL) { memp_tab[type] = memp->next; #if MEMP_OVERFLOW_CHECK diff --git a/src/core/netif.c b/src/core/netif.c index 51b206c0..803da5e6 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -73,13 +73,13 @@ #define NETIF_STATUS_CALLBACK(n) do{ if (n->status_callback) { (n->status_callback)(n); }}while(0) #else #define NETIF_STATUS_CALLBACK(n) -#endif /* LWIP_NETIF_STATUS_CALLBACK */ +#endif /* LWIP_NETIF_STATUS_CALLBACK */ #if LWIP_NETIF_LINK_CALLBACK #define NETIF_LINK_CALLBACK(n) do{ if (n->link_callback) { (n->link_callback)(n); }}while(0) #else #define NETIF_LINK_CALLBACK(n) -#endif /* LWIP_NETIF_LINK_CALLBACK */ +#endif /* LWIP_NETIF_LINK_CALLBACK */ struct netif *netif_list; struct netif *netif_default; @@ -524,7 +524,7 @@ netif_set_default(struct netif *netif) /** * Bring an interface up, available for processing * traffic. - */ + */ void netif_set_up(struct netif *netif) { 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. - */ + */ void netif_set_down(struct netif *netif) { 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 */ -void netif_set_link_up(struct netif *netif ) +void +netif_set_link_up(struct netif *netif) { if (!(netif->flags & NETIF_FLAG_LINK_UP)) { netif->flags |= NETIF_FLAG_LINK_UP; diff --git a/src/core/pbuf.c b/src/core/pbuf.c index 82b51d60..326b62de 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -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)) { return 0; } - + if (header_size_increment < 0){ increment_magnitude = -header_size_increment; /* 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 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 */ - 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); /* Check that we aren't going to move off the beginning of the pbuf */ LWIP_ASSERT("p->payload - increment_magnitude >= p + SIZEOF_STRUCT_PBUF", diff --git a/src/core/raw.c b/src/core/raw.c index 4fd49553..0bc144a1 100644 --- a/src/core/raw.c +++ b/src/core/raw.c @@ -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 - * raw PCB's protocol and binding. - * + * raw PCB's protocol and binding. + * * The callback function MUST either * - 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. * - not free the packet, and return zero. The packet will be matched * against further PCBs and/or forwarded to another protocol layers. - * + * * @return non-zero if the packet was free()d, zero if the packet remains * available for others. */ diff --git a/src/core/tcp.c b/src/core/tcp.c index ff6411e0..a77e5046 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -120,7 +120,7 @@ struct tcp_pcb *tcp_tmp_pcb; 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_ctr; 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 * 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) - * 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 * been freed, and so any remaining handles are bogus. */ err = ERR_OK; @@ -716,7 +716,7 @@ tcp_new_port(void) u8_t i; u16_t n = 0; struct tcp_pcb *pcb; - + again: if (tcp_port++ == TCP_LOCAL_PORT_RANGE_END) { 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 ")); ip_addr_debug_print(TCP_DEBUG, &pcb->remote_ip); LWIP_DEBUGF(TCP_DEBUG, ("\n")); - + ++pcb_remove; ++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)) / TCP_SLOW_INTERVAL) { @@ -1080,7 +1080,7 @@ tcp_slowtmr_start: } } - + /* Steps through all of the TIME-WAIT PCBs. */ prev = NULL; pcb = tcp_tw_pcbs; @@ -1092,8 +1092,6 @@ tcp_slowtmr_start: if ((u32_t)(tcp_ticks - pcb->tmr) > 2 * TCP_MSL / TCP_SLOW_INTERVAL) { ++pcb_remove; } - - /* If the PCB should be removed, do it. */ if (pcb_remove) { @@ -1290,7 +1288,7 @@ tcp_setprio(struct tcp_pcb *pcb, u8_t prio) * * @param seg the old tcp_seg * @return a copy of seg - */ + */ struct tcp_seg * tcp_seg_copy(struct tcp_seg *seg) { @@ -1300,7 +1298,7 @@ tcp_seg_copy(struct tcp_seg *seg) if (cseg == 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); return cseg; } @@ -1339,7 +1337,7 @@ tcp_kill_prio(u8_t prio) u8_t mprio; mprio = TCP_PRIO_MAX; - + /* We kill the oldest active connection that has lower priority than prio. */ inactivity = 0; inactive = NULL; @@ -1501,7 +1499,7 @@ tcp_alloc(u8_t prio) pcb->snd_wl2 = iss; pcb->snd_nxt = iss; pcb->lastack = iss; - pcb->snd_lbb = iss; + pcb->snd_lbb = iss; pcb->tmr = tcp_ticks; pcb->last_timer = tcp_timer_ctr; @@ -1509,11 +1507,11 @@ tcp_alloc(u8_t prio) #if LWIP_CALLBACK_API pcb->recv = tcp_recv_null; -#endif /* LWIP_CALLBACK_API */ - +#endif /* LWIP_CALLBACK_API */ + /* Init KEEPALIVE timer */ pcb->keep_idle = TCP_KEEPIDLE_DEFAULT; - + #if LWIP_TCP_KEEPALIVE pcb->keep_intvl = TCP_KEEPINTVL_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 arg void pointer argument to pass to callback functions - */ + */ void 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 recv callback function to call for this pcb when data is received - */ + */ void 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 sent callback function to call for this pcb when data is successfully sent - */ + */ void 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 err callback function to call for this pcb when a fatal error * has occurred on the connection - */ + */ void 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 accept callback function to call for this pcb when LISTENing * connection has been connected to another host - */ + */ void 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 * timer interval, which is called twice a second. * - */ + */ void tcp_poll(struct tcp_pcb *pcb, tcp_poll_fn poll, u8_t interval) { LWIP_ASSERT("invalid socket state for poll", pcb->state != LISTEN); #if LWIP_CALLBACK_API pcb->poll = poll; -#else /* LWIP_CALLBACK_API */ +#else /* LWIP_CALLBACK_API */ LWIP_UNUSED_ARG(poll); -#endif /* LWIP_CALLBACK_API */ +#endif /* LWIP_CALLBACK_API */ pcb->pollinterval = interval; } @@ -1771,7 +1769,7 @@ u32_t tcp_next_iss(void) { static u32_t iss = 6510; - + iss += tcp_ticks; /* XXX */ return iss; } @@ -2004,14 +2002,14 @@ tcp_debug_print_pcbs(void) pcb->local_port, pcb->remote_port, pcb->snd_nxt, pcb->rcv_nxt)); tcp_debug_print_state(pcb->state); - } + } LWIP_DEBUGF(TCP_DEBUG, ("Listen PCB states:\n")); 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" ", pcb->local_port, pcb->remote_port, pcb->snd_nxt, pcb->rcv_nxt)); tcp_debug_print_state(pcb->state); - } + } LWIP_DEBUGF(TCP_DEBUG, ("TIME-WAIT PCB states:\n")); 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" ", diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index 05fc31e5..e217973a 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -209,7 +209,6 @@ tcp_input(struct pbuf *p, struct netif *inp) for an active connection. */ prev = NULL; - 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 != TIME-WAIT", pcb->state != TIME_WAIT); @@ -308,7 +307,7 @@ tcp_input(struct pbuf *p, struct netif *inp) } else { TCP_STATS_INC(tcp.cachehit); } - + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packed for LISTENing connection.\n")); tcp_listen_input(lpcb); 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 */ tcp_ack_now(pcb); return ERR_OK; } - + if ((pcb->flags & TF_RXCLOSED) == 0) { /* Update the PCB (in)activity timer unless rx is closed (see tcp_shutdown) */ pcb->tmr = tcp_ticks; @@ -980,11 +979,11 @@ tcp_receive(struct tcp_pcb *pcb) if (TCP_SEQ_LT(pcb->snd_wl1, seqno) || (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_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 the maximum segment size */ 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_wl2 = ackno; @@ -1012,17 +1011,17 @@ tcp_receive(struct tcp_pcb *pcb) /* (From Stevens TCP/IP Illustrated Vol II, p970.) Its only a * duplicate ack if: - * 1) It doesn't ACK new data - * 2) length of received packet is zero (i.e. no payload) - * 3) the advertised window hasn't changed + * 1) It doesn't ACK new data + * 2) length of received packet is zero (i.e. no payload) + * 3) the advertised window hasn't changed * 4) There is outstanding unacknowledged data (retransmission timer running) * 5) The ACK is == biggest ACK sequence number so far seen (snd_una) - * - * If it passes all five, should process as a dupack: - * a) dupacks < 3: do nothing - * b) dupacks == 3: fast retransmit - * c) dupacks > 3: increase cwnd - * + * + * If it passes all five, should process as a dupack: + * a) dupacks < 3: do nothing + * b) dupacks == 3: fast retransmit + * c) dupacks > 3: increase cwnd + * * If it only passes 1-3, should reset dupack counter (and add to * 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 in fact have been sent once. */ 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)) { 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) + @@ -1185,7 +1184,7 @@ tcp_receive(struct tcp_pcb *pcb) if (pcb->unsent == NULL) { 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_ASSERT("pcb->snd_queuelen >= pbuf_clen(next->p)", (pcb->snd_queuelen >= pbuf_clen(next->p))); /* Prevent ACK for FIN to generate a sent event */ @@ -1366,7 +1365,7 @@ tcp_receive(struct tcp_pcb *pcb) - inseq overlaps with ooseq */ if (pcb->ooseq != NULL) { 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")); /* Received in-order FIN means anything that was received * 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; if (pcb->state == ESTABLISHED) { /* force passive close or we can move to active close */ pcb->state = CLOSE_WAIT; - } + } } pcb->ooseq = cseg->next; @@ -1596,12 +1595,12 @@ tcp_receive(struct tcp_pcb *pcb) } /* 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)) { - LWIP_DEBUGF(TCP_INPUT_DEBUG, + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: other end overran receive window" "seqno %"U32_F" len %"U16_F" right edge %"U32_F"\n", seqno, tcplen, pcb->rcv_nxt + pcb->rcv_wnd)); 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 */ TCPH_FLAGS_SET(next->next->tcphdr, TCPH_FLAGS(next->next->tcphdr) & ~TCP_FIN); } diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index 91c11275..78770355 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -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 */ seg->tcphdr->urgp = 0; return seg; -} +} /** * 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 apiflags API flags given to tcp_write. * @param first_seg true when this pbuf will be used in the first enqueued segment. - * @param */ #if TCP_OVERSIZE 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", (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;); 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 tcphdr = (struct tcp_hdr *)p->payload; #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)); /* 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", pcb->snd_wnd, pcb->cwnd, wnd, pcb->lastack)); } else { - LWIP_DEBUGF(TCP_CWND_DEBUG, + LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_output: snd_wnd %"TCPWNDSIZE_F", cwnd %"TCPWNDSIZE_F", wnd %"U32_F ", effwnd %"U32_F", seq %"U32_F", ack %"U32_F"\n", 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? */ while (seg != NULL && 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); /* Stop sending if the nagle algorithm would prevent it * Don't stop: @@ -1183,8 +1182,8 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb) opts += 1; } #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. */ if (pcb->rtime == -1) { 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 */ -void +void tcp_rexmit_fast(struct tcp_pcb *pcb) { if (pcb->unacked != NULL && !(pcb->flags & TF_INFR)) { /* 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 "), fast retransmit %"U32_F"\n", (u16_t)pcb->dupacks, pcb->lastack, @@ -1450,19 +1449,19 @@ tcp_rexmit_fast(struct tcp_pcb *pcb) } else { pcb->ssthresh = pcb->cwnd / 2; } - + /* The minimum value for ssthresh should be 2 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 " should be min 2 mss %"U16_F"...\n", pcb->ssthresh, 2*pcb->mss)); pcb->ssthresh = 2*pcb->mss; } - + pcb->cwnd = pcb->ssthresh + 3 * pcb->mss; pcb->flags |= TF_INFR; - } + } } @@ -1485,9 +1484,9 @@ tcp_keepalive(struct tcp_pcb *pcb) ip_addr_debug_print(TCP_DEBUG, &pcb->remote_ip); 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)); - + p = tcp_output_alloc_header(pcb, 0, 0, htonl(pcb->snd_nxt - 1)); if(p == NULL) { 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); LWIP_DEBUGF(TCP_DEBUG, ("\n")); - LWIP_DEBUGF(TCP_DEBUG, + LWIP_DEBUGF(TCP_DEBUG, ("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)); seg = pcb->unacked; diff --git a/src/core/udp.c b/src/core/udp.c index 9cba6254..516c932c 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -103,7 +103,7 @@ udp_new_port(void) { u16_t n = 0; struct udp_pcb *pcb; - + again: if (udp_port++ == UDP_LOCAL_PORT_RANGE_END) { udp_port = UDP_LOCAL_PORT_RANGE_START; @@ -276,7 +276,7 @@ udp_input(struct pbuf *p, struct netif *inp) #endif /* LWIP_IPV4 */ ) { local_match = 1; - if ((uncon_pcb == NULL) && + if ((uncon_pcb == NULL) && ((pcb->flags & UDP_FLAGS_CONNECTED) == 0)) { /* the first unconnected matching 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 * be restored after the data is sent. - * + * * @return lwIP error code (@see udp_send for possible error codes) * * @see udp_disconnect() udp_send() diff --git a/src/include/lwip/arch.h b/src/include/lwip/arch.h index 4cdb764a..e180c799 100644 --- a/src/include/lwip/arch.h +++ b/src/include/lwip/arch.h @@ -87,7 +87,7 @@ extern "C" { #ifndef LWIP_UNUSED_ARG #define LWIP_UNUSED_ARG(x) (void)x -#endif /* LWIP_UNUSED_ARG */ +#endif /* LWIP_UNUSED_ARG */ #ifdef LWIP_PROVIDE_ERRNO diff --git a/src/include/lwip/autoip.h b/src/include/lwip/autoip.h index 392622ea..c89fe3ff 100644 --- a/src/include/lwip/autoip.h +++ b/src/include/lwip/autoip.h @@ -40,7 +40,7 @@ * Please coordinate changes and requests with Dominik Spies * */ - + #ifndef LWIP_HDR_AUTOIP_H #define LWIP_HDR_AUTOIP_H diff --git a/src/include/lwip/debug.h b/src/include/lwip/debug.h index b559944e..9bfd97c1 100644 --- a/src/include/lwip/debug.h +++ b/src/include/lwip/debug.h @@ -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" #endif #else /* LWIP_NOASSERT */ -#define LWIP_ASSERT(message, assertion) +#define LWIP_ASSERT(message, assertion) #endif /* LWIP_NOASSERT */ /** if "expression" isn't true, then print "message" and execute "handler" expression */ @@ -110,7 +110,7 @@ } while(0) #else /* LWIP_DEBUG */ -#define LWIP_DEBUGF(debug, message) +#define LWIP_DEBUGF(debug, message) #endif /* LWIP_DEBUG */ #endif /* LWIP_HDR_DEBUG_H */ diff --git a/src/include/lwip/def.h b/src/include/lwip/def.h index b96172fd..21241ad5 100644 --- a/src/include/lwip/def.h +++ b/src/include/lwip/def.h @@ -61,7 +61,7 @@ extern "C" { #define LWIP_MAKE_U16(a, b) ((a << 8) | b) #else #define LWIP_MAKE_U16(a, b) ((b << 8) | a) -#endif +#endif #ifndef LWIP_PLATFORM_BYTESWAP #define LWIP_PLATFORM_BYTESWAP 0 diff --git a/src/include/lwip/dhcp.h b/src/include/lwip/dhcp.h index 2ef03486..df495811 100644 --- a/src/include/lwip/dhcp.h +++ b/src/include/lwip/dhcp.h @@ -45,11 +45,11 @@ extern "C" { #endif /** 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() */ #define DHCP_COARSE_TIMER_MSECS (DHCP_COARSE_TIMER_SECS * 1000UL) /** 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_SNAME_LEN 64U @@ -57,9 +57,9 @@ extern "C" { struct dhcp { - /** transaction identifier of last sent request */ + /** transaction identifier of last sent request */ u32_t xid; - /** our connection to the DHCP server */ + /** our connection to the DHCP server */ struct udp_pcb *pcb; /** incoming msg */ struct dhcp_msg *msg_in; @@ -86,7 +86,7 @@ struct dhcp ip4_addr_t offered_ip_addr; ip4_addr_t offered_sn_mask; ip4_addr_t offered_gw_addr; - + 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_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); /** to be called every half second */ void dhcp_fine_tmr(void); - + /** DHCP message item offsets and length */ #define DHCP_OP_OFS 0 #define DHCP_HTYPE_OFS 1 @@ -207,7 +207,7 @@ void dhcp_fine_tmr(void); /** AUTOIP cooperation flags */ #define DHCP_AUTOIP_COOP_STATE_OFF 0 #define DHCP_AUTOIP_COOP_STATE_ON 1 - + #define DHCP_BOOTREQUEST 1 #define DHCP_BOOTREPLY 2 @@ -232,7 +232,7 @@ void dhcp_fine_tmr(void); #define DHCP_OPTION_PAD 0 #define DHCP_OPTION_SUBNET_MASK 1 /* RFC 2132 3.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_IP_TTL 23 #define DHCP_OPTION_MTU 26 diff --git a/src/include/lwip/igmp.h b/src/include/lwip/igmp.h index fb85285e..c7718d43 100644 --- a/src/include/lwip/igmp.h +++ b/src/include/lwip/igmp.h @@ -64,7 +64,7 @@ extern "C" { * these should really be linked from the interface, but * if we keep them separate we will not affect the lwip original code * too much - * + * * 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 * from all the other groups diff --git a/src/include/lwip/memp_std.h b/src/include/lwip/memp_std.h index 4f7d4d76..2841404a 100644 --- a/src/include/lwip/memp_std.h +++ b/src/include/lwip/memp_std.h @@ -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_START #define LWIP_MALLOC_MEMPOOL_END -#endif /* LWIP_MALLOC_MEMPOOL */ +#endif /* LWIP_MALLOC_MEMPOOL */ #ifndef LWIP_PBUF_MEMPOOL /* This treats "pbuf pools" just like any other pool. diff --git a/src/include/lwip/netif.h b/src/include/lwip/netif.h index 1fa79df3..cdf78b76 100644 --- a/src/include/lwip/netif.h +++ b/src/include/lwip/netif.h @@ -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_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) #if LWIP_NETIF_LINK_CALLBACK diff --git a/src/include/lwip/netifapi.h b/src/include/lwip/netifapi.h index 5a74d9ee..696e956d 100644 --- a/src/include/lwip/netifapi.h +++ b/src/include/lwip/netifapi.h @@ -24,7 +24,6 @@ * This file is part of the lwIP TCP/IP stack. * */ - #ifndef LWIP_HDR_NETIFAPI_H #define LWIP_HDR_NETIFAPI_H diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 01c51529..46ab94e4 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -60,7 +60,7 @@ #define SYS_LIGHTWEIGHT_PROT 0 #endif -/** +/** * NO_SYS==1: Provides VERY minimal functionality. Otherwise, * use lwIP facilities. */ @@ -193,7 +193,7 @@ /** * MEMP_USE_CUSTOM_POOLS==1: whether to include a user file lwippools.h * 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. */ #ifndef MEMP_USE_CUSTOM_POOLS @@ -343,7 +343,7 @@ /** * 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) */ #ifndef MEMP_NUM_TCPIP_MSG_API @@ -352,7 +352,7 @@ /** * 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) */ #ifndef MEMP_NUM_TCPIP_MSG_INPKT @@ -443,7 +443,7 @@ #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 #define PBUF_POOL_SIZE 16 @@ -509,7 +509,7 @@ /** The maximum number of packets which may be queued for each * unresolved address by other network layers. Defaults to 3, 0 means disabled. * Old packets are dropped, new packets are queued. - */ + */ #ifndef ARP_QUEUE_LEN #define ARP_QUEUE_LEN 3 #endif @@ -903,7 +903,7 @@ #endif /** - * SNMP_PRIVATE_MIB: + * SNMP_PRIVATE_MIB: * 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. */ @@ -1121,12 +1121,12 @@ #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 */ #ifndef TCP_WND #define TCP_WND (4 * TCP_MSS) -#endif +#endif /** * 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 * explicitly set to 0, using included lwIP 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 * using our cleaned PolarSSL library. */ @@ -2495,14 +2495,14 @@ #ifndef CHECKSUM_GEN_IP #define CHECKSUM_GEN_IP 1 #endif - + /** * CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets. */ #ifndef CHECKSUM_GEN_UDP #define CHECKSUM_GEN_UDP 1 #endif - + /** * CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets. */ @@ -2516,21 +2516,21 @@ #ifndef CHECKSUM_GEN_ICMP #define CHECKSUM_GEN_ICMP 1 #endif - + /** * CHECKSUM_GEN_ICMP6==1: Generate checksums in software for outgoing ICMP6 packets. */ #ifndef CHECKSUM_GEN_ICMP6 #define CHECKSUM_GEN_ICMP6 1 #endif - + /** * CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets. */ #ifndef CHECKSUM_CHECK_IP #define CHECKSUM_CHECK_IP 1 #endif - + /** * CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets. */ diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h index c396849f..b4350998 100644 --- a/src/include/lwip/pbuf.h +++ b/src/include/lwip/pbuf.h @@ -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); void pbuf_ref(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_chain(struct pbuf *head, struct pbuf *tail); struct pbuf *pbuf_dechain(struct pbuf *p); diff --git a/src/include/lwip/sio.h b/src/include/lwip/sio.h index 23d116b3..43c4f218 100644 --- a/src/include/lwip/sio.h +++ b/src/include/lwip/sio.h @@ -53,7 +53,7 @@ typedef void * sio_fd_t; #ifndef sio_open /** * Opens a serial device for communication. - * + * * @param devnum device number * @return handle to serial device if successful, NULL otherwise */ @@ -63,10 +63,10 @@ sio_fd_t sio_open(u8_t devnum); #ifndef sio_send /** * Sends a single character to the serial device. - * + * * @param c character to send * @param fd serial device handle - * + * * @note This function will block until the character can be sent. */ 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 /** * Receives a single character from the serial device. - * + * * @param fd serial device handle - * + * * @note This function will block until a character is received. */ u8_t sio_recv(sio_fd_t fd); @@ -86,12 +86,12 @@ u8_t sio_recv(sio_fd_t fd); #ifndef sio_read /** * Reads from the serial device. - * + * * @param fd serial device handle * @param data pointer to data buffer for receiving * @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 - * + * * @note This function will block until data can be received. The blocking * 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 * immediately if no data is available and never blocks. - * + * * @param fd serial device handle * @param data pointer to data buffer for receiving * @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 /** * Writes to the serial device. - * + * * @param fd serial device handle * @param data pointer to data to send * @param len length (in bytes) of data to send * @return number of bytes actually 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); @@ -128,7 +128,7 @@ u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len); #ifndef sio_read_abort /** * Aborts a blocking sio_read() call. - * + * * @param fd serial device handle */ void sio_read_abort(sio_fd_t fd); diff --git a/src/include/lwip/snmp_structs.h b/src/include/lwip/snmp_structs.h index b75f9afc..ec3bf568 100644 --- a/src/include/lwip/snmp_structs.h +++ b/src/include/lwip/snmp_structs.h @@ -54,7 +54,7 @@ extern "C" { #endif /* MIB object instance */ -#define MIB_OBJECT_NONE 0 +#define MIB_OBJECT_NONE 0 #define MIB_OBJECT_SCALAR 1 #define MIB_OBJECT_TAB 2 @@ -117,7 +117,7 @@ struct mib_scalar_node /** tests length and/or range BEFORE setting */ u8_t (*set_test)(struct obj_def *od, u16_t len, void *value); /** 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) */ @@ -191,7 +191,7 @@ struct mib_external_node 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); 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) */ 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); diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h index c71bd2b2..81e7a723 100644 --- a/src/include/lwip/sockets.h +++ b/src/include/lwip/sockets.h @@ -425,7 +425,7 @@ typedef struct fd_set #endif /* FD_SET */ /** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided - * by your system, set this to 0 and include in cc.h */ + * by your system, set this to 0 and include in cc.h */ #ifndef LWIP_TIMEVAL_PRIVATE #define LWIP_TIMEVAL_PRIVATE 1 #endif diff --git a/src/include/lwip/stats.h b/src/include/lwip/stats.h index 8086c1c1..971dd884 100644 --- a/src/include/lwip/stats.h +++ b/src/include/lwip/stats.h @@ -53,7 +53,7 @@ extern "C" { #else #define STAT_COUNTER u16_t #define STAT_COUNTER_F U16_F -#endif +#endif struct stats_proto { STAT_COUNTER xmit; /* Transmitted packets. */ diff --git a/src/include/lwip/sys.h b/src/include/lwip/sys.h index d78ddd0f..2d921e9f 100644 --- a/src/include/lwip/sys.h +++ b/src/include/lwip/sys.h @@ -84,7 +84,7 @@ typedef u8_t sys_mbox_t; /** 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. */ -#define SYS_MBOX_EMPTY SYS_ARCH_TIMEOUT +#define SYS_MBOX_EMPTY SYS_ARCH_TIMEOUT #include "lwip/err.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); /** Delete a semaphore * @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 /** Check if a mutex is valid/allocated: return 1 for valid, 0 for invalid */ int sys_mutex_valid(sys_mutex_t *mutex); diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h index e0616c2e..aa72d84d 100644 --- a/src/include/lwip/tcp.h +++ b/src/include/lwip/tcp.h @@ -191,7 +191,7 @@ struct tcp_pcb { /* ports are in host byte order */ u16_t remote_port; - + tcpflags_t flags; #define TF_ACK_DELAY 0x01U /* Delayed ACK. */ #define TF_ACK_NOW 0x02U /* Immediate ACK. */ @@ -262,7 +262,7 @@ struct tcp_pcb { /* These are ordered by sequence number: */ struct tcp_seg *unsent; /* Unsent (queued) 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. */ #endif /* TCP_QUEUE_OOSEQ */ @@ -292,7 +292,7 @@ struct tcp_pcb { u32_t keep_intvl; u32_t keep_cnt; #endif /* LWIP_TCP_KEEPALIVE */ - + /* Persist timer counter */ u8_t persist_cnt; /* Persist timer back-off */ diff --git a/src/include/lwip/tcp_impl.h b/src/include/lwip/tcp_impl.h index 8c53cc47..40be82b4 100644 --- a/src/include/lwip/tcp_impl.h +++ b/src/include/lwip/tcp_impl.h @@ -289,7 +289,7 @@ struct tcp_seg { u16_t oversize_left; /* Extra bytes available at the end of the last pbuf in unsent (used for asserting vs. tcp_pcb.unsent_oversized only) */ -#endif /* TCP_OVERSIZE_DBGCHECK */ +#endif /* TCP_OVERSIZE_DBGCHECK */ #if TCP_CHECKSUM_ON_COPY u16_t chksum; u8_t chksum_swapped; @@ -350,7 +350,7 @@ extern u8_t tcp_active_pcbs_changed; /* The TCP PCB lists. */ 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; }; 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. */ -/* Axioms about the above lists: +/* Axioms about the above 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. 3) All PCBs in the tcp_listen_pcbs list is in LISTEN state. diff --git a/src/include/netif/slipif.h b/src/include/netif/slipif.h index dc40d301..95b7b30a 100644 --- a/src/include/netif/slipif.h +++ b/src/include/netif/slipif.h @@ -76,6 +76,6 @@ void slipif_received_bytes(struct netif *netif, u8_t *data, u8_t len); #ifdef __cplusplus } #endif - + #endif /* LWIP_HDR_NETIF_SLIPIF_H */ diff --git a/src/netif/etharp.c b/src/netif/etharp.c index fed9de62..0905acf2 100644 --- a/src/netif/etharp.c +++ b/src/netif/etharp.c @@ -42,7 +42,7 @@ * This file is part of the lwIP TCP/IP stack. * */ - + #include "lwip/opt.h" #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, * for ARP_TMR_INTERVAL = 1000, this is * 10 seconds. - * + * * @internal Keep this number at least 2, otherwise it might * 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. - * + * * 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, * but in state ETHARP_EMPTY. The caller must check and possibly change the * state of the returned entry. - * + * * 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 * empty entries are available and ETHARP_FLAG_TRY_HARD flag is set, recycle * 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 flags @see definition of ETHARP_FLAG_* * @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 * 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 */ - + /* don't create new entry, only search? */ if (((flags & ETHARP_FLAG_FIND_ONLY) != 0) || /* 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")); return (s8_t)ERR_MEM; } - + /* b) choose the least destructive entry to recycle: * 1) empty entry * 2) oldest stable entry * 3) oldest pending entry without queued packets * 4) oldest pending entry with queued packets - * + * * { ETHARP_FLAG_TRY_HARD is set at this point } - */ + */ /* 1) empty entry available? */ 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 * at this point. - * + * * @param netif netif related to this entry (used for NETIF_ADDRHINT) * @param ipaddr IP 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 */ /** - * 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. * * 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), &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. * * 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 * given, an ARP request is sent out. - * + * * @param netif The lwIP network interface on which ipaddr * must be queried for. * @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; int copy_needed = 0; /* 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. */ p = q; 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->dhwaddr, hwdst_addr); /* 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->dipaddr, ipdst_addr); @@ -1479,7 +1479,7 @@ ethernet_input(struct pbuf *p, struct netif *netif) ip4_input(p, netif); } break; - + case PP_HTONS(ETHTYPE_ARP): if (!(netif->flags & NETIF_FLAG_ETHARP)) { goto free_and_return; diff --git a/src/netif/ethernetif.c b/src/netif/ethernetif.c index 76766cef..978b3f0f 100644 --- a/src/netif/ethernetif.c +++ b/src/netif/ethernetif.c @@ -85,7 +85,7 @@ static void low_level_init(struct netif *netif) { struct ethernetif *ethernetif = netif->state; - + /* set MAC hardware address length */ netif->hwaddr_len = ETHARP_HWADDR_LEN; @@ -96,11 +96,11 @@ low_level_init(struct netif *netif) /* maximum transfer unit */ netif->mtu = 1500; - + /* device capabilities */ /* 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; - + #if LWIP_IPV6 && LWIP_IPV6_MLD /* * For hardware/netifs that implement MAC filtering. @@ -114,7 +114,7 @@ low_level_init(struct netif *netif) } #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; initiate transfer(); - + #if ETH_PAD_SIZE pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */ #endif @@ -157,7 +157,7 @@ low_level_output(struct netif *netif, struct pbuf *p) #if ETH_PAD_SIZE pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */ #endif - + LINK_STATS_INC(link.xmit); return ERR_OK; @@ -188,7 +188,7 @@ low_level_input(struct netif *netif) /* We allocate a pbuf chain of pbufs from the pool. */ p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL); - + if (p != NULL) { #if ETH_PAD_SIZE @@ -221,7 +221,7 @@ low_level_input(struct netif *netif) LINK_STATS_INC(link.drop); } - return p; + return p; } /** @@ -292,7 +292,7 @@ ethernetif_init(struct netif *netif) struct ethernetif *ethernetif; LWIP_ASSERT("netif != NULL", (netif != NULL)); - + ethernetif = mem_malloc(sizeof(struct ethernetif)); if (ethernetif == NULL) { LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_init: out of memory\n")); @@ -323,9 +323,9 @@ ethernetif_init(struct netif *netif) netif->output_ip6 = ethip6_output; #endif /* LWIP_IPV6 */ netif->linkoutput = low_level_output; - + ethernetif->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]); - + /* initialize the hardware */ low_level_init(netif); diff --git a/src/netif/slipif.c b/src/netif/slipif.c index 83212087..be793e5e 100644 --- a/src/netif/slipif.c +++ b/src/netif/slipif.c @@ -47,10 +47,10 @@ * packets and puts completed packets on a queue which is fed into * the stack from the main loop (needs SYS_LIGHTWEIGHT_PROT for * pbuf_alloc to work on ISR level!). - * + * */ -/* +/* * 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 */