mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
minor: fixed coding style (lwip style)
This commit is contained in:
parent
2949449e25
commit
b401f42520
@ -1396,7 +1396,7 @@ lwip_netconn_do_recv(struct api_msg_msg *msg)
|
|||||||
u16_t recved = (remaining > 0xffff) ? 0xffff : (u16_t)remaining;
|
u16_t recved = (remaining > 0xffff) ? 0xffff : (u16_t)remaining;
|
||||||
tcp_recved(msg->conn->pcb.tcp, recved);
|
tcp_recved(msg->conn->pcb.tcp, recved);
|
||||||
remaining -= recved;
|
remaining -= recved;
|
||||||
}while(remaining != 0);
|
} while (remaining != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -847,10 +847,10 @@ 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;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1004,7 +1004,7 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags)
|
|||||||
((flags & MSG_MORE) ? NETCONN_MORE : 0) |
|
((flags & MSG_MORE) ? NETCONN_MORE : 0) |
|
||||||
((flags & MSG_DONTWAIT) ? NETCONN_DONTBLOCK : 0);
|
((flags & MSG_DONTWAIT) ? NETCONN_DONTBLOCK : 0);
|
||||||
|
|
||||||
for(i = 0; i < msg->msg_iovlen; i++) {
|
for (i = 0; i < msg->msg_iovlen; i++) {
|
||||||
written = 0;
|
written = 0;
|
||||||
err = netconn_write_partly(sock->conn, msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len, write_flags, &written);
|
err = netconn_write_partly(sock->conn, msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len, write_flags, &written);
|
||||||
if (err == ERR_OK) {
|
if (err == ERR_OK) {
|
||||||
@ -1049,7 +1049,7 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags)
|
|||||||
netbuf_fromport(chain_buf) = remote_port;
|
netbuf_fromport(chain_buf) = remote_port;
|
||||||
}
|
}
|
||||||
#if LWIP_NETIF_TX_SINGLE_PBUF
|
#if LWIP_NETIF_TX_SINGLE_PBUF
|
||||||
for(i = 0; i < msg->msg_iovlen; i++) {
|
for (i = 0; i < msg->msg_iovlen; i++) {
|
||||||
size += msg->msg_iov[i].iov_len;
|
size += msg->msg_iov[i].iov_len;
|
||||||
}
|
}
|
||||||
/* Allocate a new netbuf and copy the data into it. */
|
/* Allocate a new netbuf and copy the data into it. */
|
||||||
@ -1059,7 +1059,7 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags)
|
|||||||
else {
|
else {
|
||||||
/* flatten the IO vectors */
|
/* flatten the IO vectors */
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
for(i = 0; i < msg->msg_iovlen; i++ ) {
|
for (i = 0; i < msg->msg_iovlen; i++) {
|
||||||
MEMCPY(&((u8_t*)chain_buf->p->payload)[offset], msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len);
|
MEMCPY(&((u8_t*)chain_buf->p->payload)[offset], msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len);
|
||||||
offset += msg->msg_iov[i].iov_len;
|
offset += msg->msg_iov[i].iov_len;
|
||||||
}
|
}
|
||||||
@ -1078,7 +1078,7 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags)
|
|||||||
if (err == ERR_OK) {
|
if (err == ERR_OK) {
|
||||||
struct netbuf *tail_buf;
|
struct netbuf *tail_buf;
|
||||||
size = msg->msg_iov[0].iov_len;
|
size = msg->msg_iov[0].iov_len;
|
||||||
for(i = 1; i < msg->msg_iovlen; i++) {
|
for (i = 1; i < msg->msg_iovlen; i++) {
|
||||||
tail_buf = netbuf_new();
|
tail_buf = netbuf_new();
|
||||||
if (!tail_buf) {
|
if (!tail_buf) {
|
||||||
err = ERR_MEM;
|
err = ERR_MEM;
|
||||||
@ -1318,7 +1318,7 @@ lwip_selscan(int maxfdp1, fd_set *readset_in, fd_set *writeset_in, fd_set *excep
|
|||||||
|
|
||||||
/* Go through each socket in each list to count number of sockets which
|
/* Go through each socket in each list to count number of sockets which
|
||||||
currently match */
|
currently match */
|
||||||
for(i = LWIP_SOCKET_OFFSET; i < maxfdp1; i++) {
|
for (i = LWIP_SOCKET_OFFSET; i < maxfdp1; i++) {
|
||||||
void* lastdata = NULL;
|
void* lastdata = NULL;
|
||||||
s16_t rcvevent = 0;
|
s16_t rcvevent = 0;
|
||||||
u16_t sendevent = 0;
|
u16_t sendevent = 0;
|
||||||
|
@ -584,7 +584,7 @@ dhcp_handle_ack(struct netif *netif)
|
|||||||
|
|
||||||
#if LWIP_DHCP_GET_NTP_SRV
|
#if LWIP_DHCP_GET_NTP_SRV
|
||||||
/* NTP servers */
|
/* NTP servers */
|
||||||
for(n = 0; (n < LWIP_DHCP_MAX_NTP_SERVERS) && dhcp_option_given(dhcp, DHCP_OPTION_IDX_NTP_SERVER + n); n++) {
|
for (n = 0; (n < LWIP_DHCP_MAX_NTP_SERVERS) && dhcp_option_given(dhcp, DHCP_OPTION_IDX_NTP_SERVER + n); n++) {
|
||||||
ip4_addr_set_u32(&ntp_server_addrs[n], htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_NTP_SERVER + n)));
|
ip4_addr_set_u32(&ntp_server_addrs[n], htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_NTP_SERVER + n)));
|
||||||
}
|
}
|
||||||
dhcp_set_ntp_servers(n, ntp_server_addrs);
|
dhcp_set_ntp_servers(n, ntp_server_addrs);
|
||||||
@ -592,7 +592,7 @@ dhcp_handle_ack(struct netif *netif)
|
|||||||
|
|
||||||
#if LWIP_DNS
|
#if LWIP_DNS
|
||||||
/* DNS servers */
|
/* DNS servers */
|
||||||
for(n = 0; (n < DNS_MAX_SERVERS) && dhcp_option_given(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n); n++) {
|
for (n = 0; (n < DNS_MAX_SERVERS) && dhcp_option_given(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n); n++) {
|
||||||
ip_addr_t dns_addr;
|
ip_addr_t dns_addr;
|
||||||
ip_addr_set_ip4_u32(&dns_addr, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n)));
|
ip_addr_set_ip4_u32(&dns_addr, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n)));
|
||||||
dns_setserver(n, &dns_addr);
|
dns_setserver(n, &dns_addr);
|
||||||
@ -1404,7 +1404,7 @@ dhcp_parse_reply(struct dhcp *dhcp, struct pbuf *p)
|
|||||||
options_idx_max = p->tot_len;
|
options_idx_max = p->tot_len;
|
||||||
again:
|
again:
|
||||||
q = p;
|
q = p;
|
||||||
while((q != NULL) && (options_idx >= q->len)) {
|
while ((q != NULL) && (options_idx >= q->len)) {
|
||||||
options_idx -= q->len;
|
options_idx -= q->len;
|
||||||
options_idx_max -= q->len;
|
options_idx_max -= q->len;
|
||||||
q = q->next;
|
q = q->next;
|
||||||
@ -1416,7 +1416,7 @@ again:
|
|||||||
offset_max = options_idx_max;
|
offset_max = options_idx_max;
|
||||||
options = (u8_t*)q->payload;
|
options = (u8_t*)q->payload;
|
||||||
/* at least 1 byte to read and no end marker, then at least 3 bytes to read? */
|
/* at least 1 byte to read and no end marker, then at least 3 bytes to read? */
|
||||||
while((q != NULL) && (options[offset] != DHCP_OPTION_END) && (offset < offset_max)) {
|
while ((q != NULL) && (options[offset] != DHCP_OPTION_END) && (offset < offset_max)) {
|
||||||
u8_t op = options[offset];
|
u8_t op = options[offset];
|
||||||
u8_t len;
|
u8_t len;
|
||||||
u8_t decode_len = 0;
|
u8_t decode_len = 0;
|
||||||
|
@ -494,7 +494,7 @@ dns_lookup_local(const char *hostname, ip_addr_t *addr LWIP_DNS_ADDRTYPE_ARG(u8_
|
|||||||
{
|
{
|
||||||
#if DNS_LOCAL_HOSTLIST_IS_DYNAMIC
|
#if DNS_LOCAL_HOSTLIST_IS_DYNAMIC
|
||||||
struct local_hostlist_entry *entry = local_hostlist_dynamic;
|
struct local_hostlist_entry *entry = local_hostlist_dynamic;
|
||||||
while(entry != NULL) {
|
while (entry != NULL) {
|
||||||
if ((LWIP_DNS_STRICMP(entry->name, hostname) == 0) &&
|
if ((LWIP_DNS_STRICMP(entry->name, hostname) == 0) &&
|
||||||
LWIP_DNS_ADDRTYPE_MATCH_IP(dns_addrtype, entry->addr)) {
|
LWIP_DNS_ADDRTYPE_MATCH_IP(dns_addrtype, entry->addr)) {
|
||||||
if (addr) {
|
if (addr) {
|
||||||
@ -756,14 +756,14 @@ dns_send(u8_t idx)
|
|||||||
do {
|
do {
|
||||||
++hostname;
|
++hostname;
|
||||||
hostname_part = hostname;
|
hostname_part = hostname;
|
||||||
for(n = 0; *hostname != '.' && *hostname != 0; ++hostname) {
|
for (n = 0; *hostname != '.' && *hostname != 0; ++hostname) {
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
copy_len = (u16_t)(hostname - hostname_part);
|
copy_len = (u16_t)(hostname - hostname_part);
|
||||||
pbuf_put_at(p, query_idx, n);
|
pbuf_put_at(p, query_idx, n);
|
||||||
pbuf_take_at(p, hostname_part, copy_len, query_idx + 1);
|
pbuf_take_at(p, hostname_part, copy_len, query_idx + 1);
|
||||||
query_idx += n + 1;
|
query_idx += n + 1;
|
||||||
} while(*hostname != 0);
|
} while (*hostname != 0);
|
||||||
pbuf_put_at(p, query_idx, 0);
|
pbuf_put_at(p, query_idx, 0);
|
||||||
query_idx++;
|
query_idx++;
|
||||||
|
|
||||||
@ -815,7 +815,7 @@ dns_alloc_random_port(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
err = udp_bind(ret, IP_ADDR_ANY, port);
|
err = udp_bind(ret, IP_ADDR_ANY, port);
|
||||||
} while(err == ERR_USE);
|
} while (err == ERR_USE);
|
||||||
if ((err != ERR_OK) && (err != ERR_USE)) {
|
if ((err != ERR_OK) && (err != ERR_USE)) {
|
||||||
udp_remove(ret);
|
udp_remove(ret);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -266,7 +266,7 @@ inet_cksum_pseudo_base(struct pbuf *p, u8_t proto, u16_t proto_len, u32_t acc)
|
|||||||
u8_t swapped = 0;
|
u8_t swapped = 0;
|
||||||
|
|
||||||
/* iterate through all pbuf in chain */
|
/* iterate through all pbuf in chain */
|
||||||
for(q = p; q != NULL; q = q->next) {
|
for (q = p; q != NULL; q = q->next) {
|
||||||
LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): checksumming pbuf %p (has next %p) \n",
|
LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): checksumming pbuf %p (has next %p) \n",
|
||||||
(void *)q, (void *)q->next));
|
(void *)q, (void *)q->next));
|
||||||
acc += LWIP_CHKSUM(q->payload, q->len);
|
acc += LWIP_CHKSUM(q->payload, q->len);
|
||||||
@ -407,7 +407,7 @@ inet_cksum_pseudo_partial_base(struct pbuf *p, u8_t proto, u16_t proto_len,
|
|||||||
u16_t chklen;
|
u16_t chklen;
|
||||||
|
|
||||||
/* iterate through all pbuf in chain */
|
/* iterate through all pbuf in chain */
|
||||||
for(q = p; (q != NULL) && (chksum_len > 0); q = q->next) {
|
for (q = p; (q != NULL) && (chksum_len > 0); q = q->next) {
|
||||||
LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): checksumming pbuf %p (has next %p) \n",
|
LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): checksumming pbuf %p (has next %p) \n",
|
||||||
(void *)q, (void *)q->next));
|
(void *)q, (void *)q->next));
|
||||||
chklen = q->len;
|
chklen = q->len;
|
||||||
@ -576,7 +576,7 @@ inet_chksum_pbuf(struct pbuf *p)
|
|||||||
|
|
||||||
acc = 0;
|
acc = 0;
|
||||||
swapped = 0;
|
swapped = 0;
|
||||||
for(q = p; q != NULL; q = q->next) {
|
for (q = p; q != NULL; q = q->next) {
|
||||||
acc += LWIP_CHKSUM(q->payload, q->len);
|
acc += LWIP_CHKSUM(q->payload, q->len);
|
||||||
acc = FOLD_U32T(acc);
|
acc = FOLD_U32T(acc);
|
||||||
if (q->len % 2 != 0) {
|
if (q->len % 2 != 0) {
|
||||||
|
@ -538,7 +538,7 @@ ip4_input(struct pbuf *p, struct netif *inp)
|
|||||||
if (netif == inp) {
|
if (netif == inp) {
|
||||||
netif = netif->next;
|
netif = netif->next;
|
||||||
}
|
}
|
||||||
} while(netif != NULL);
|
} while (netif != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if IP_ACCEPT_LINK_LAYER_ADDRESSING
|
#if IP_ACCEPT_LINK_LAYER_ADDRESSING
|
||||||
|
@ -305,14 +305,14 @@ ip4addr_ntoa_r(const ip4_addr_t *addr, char *buf, int buflen)
|
|||||||
|
|
||||||
rp = buf;
|
rp = buf;
|
||||||
ap = (u8_t *)&s_addr;
|
ap = (u8_t *)&s_addr;
|
||||||
for(n = 0; n < 4; n++) {
|
for (n = 0; n < 4; n++) {
|
||||||
i = 0;
|
i = 0;
|
||||||
do {
|
do {
|
||||||
rem = *ap % (u8_t)10;
|
rem = *ap % (u8_t)10;
|
||||||
*ap /= (u8_t)10;
|
*ap /= (u8_t)10;
|
||||||
inv[i++] = '0' + rem;
|
inv[i++] = '0' + rem;
|
||||||
} while(*ap);
|
} while (*ap);
|
||||||
while(i--) {
|
while (i--) {
|
||||||
if (len++ >= buflen) {
|
if (len++ >= buflen) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -591,7 +591,7 @@ ip4_reass(struct pbuf *p)
|
|||||||
p = ipr->p;
|
p = ipr->p;
|
||||||
|
|
||||||
/* chain together the pbufs contained within the reass_data list. */
|
/* chain together the pbufs contained within the reass_data list. */
|
||||||
while(r != NULL) {
|
while (r != NULL) {
|
||||||
iprh = (struct ip_reass_helper*)r->payload;
|
iprh = (struct ip_reass_helper*)r->payload;
|
||||||
|
|
||||||
/* hide the ip header for every succeeding fragment */
|
/* hide the ip header for every succeeding fragment */
|
||||||
|
@ -112,7 +112,7 @@ ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Try to find the netif for the source address, checking that link is up. */
|
/* Try to find the netif for the source address, checking that link is up. */
|
||||||
for(netif = netif_list; netif != NULL; netif = netif->next) {
|
for (netif = netif_list; netif != NULL; netif = netif->next) {
|
||||||
if (!netif_is_up(netif) || !netif_is_link_up(netif)) {
|
if (!netif_is_up(netif) || !netif_is_link_up(netif)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* See if the destination subnet matches a configured address. */
|
/* See if the destination subnet matches a configured address. */
|
||||||
for(netif = netif_list; netif != NULL; netif = netif->next) {
|
for (netif = netif_list; netif != NULL; netif = netif->next) {
|
||||||
if (!netif_is_up(netif) || !netif_is_link_up(netif)) {
|
if (!netif_is_up(netif) || !netif_is_link_up(netif)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest)
|
|||||||
|
|
||||||
/* try with the netif that matches the source address. */
|
/* try with the netif that matches the source address. */
|
||||||
if (!ip6_addr_isany(src)) {
|
if (!ip6_addr_isany(src)) {
|
||||||
for(netif = netif_list; netif != NULL; netif = netif->next) {
|
for (netif = netif_list; netif != NULL; netif = netif->next) {
|
||||||
if (!netif_is_up(netif) || !netif_is_link_up(netif)) {
|
if (!netif_is_up(netif) || !netif_is_link_up(netif)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -529,7 +529,7 @@ ip6_input(struct pbuf *p, struct netif *inp)
|
|||||||
if (netif == inp) {
|
if (netif == inp) {
|
||||||
netif = netif->next;
|
netif = netif->next;
|
||||||
}
|
}
|
||||||
} while(netif != NULL);
|
} while (netif != NULL);
|
||||||
netif_found:
|
netif_found:
|
||||||
LWIP_DEBUGF(IP6_DEBUG, ("ip6_input: packet accepted on interface %c%c\n",
|
LWIP_DEBUGF(IP6_DEBUG, ("ip6_input: packet accepted on interface %c%c\n",
|
||||||
netif ? netif->name[0] : 'X', netif? netif->name[1] : 'X'));
|
netif ? netif->name[0] : 'X', netif? netif->name[1] : 'X'));
|
||||||
|
@ -514,7 +514,7 @@ ip6_reass(struct pbuf *p)
|
|||||||
|
|
||||||
/* chain together the pbufs contained within the ip6_reassdata list. */
|
/* chain together the pbufs contained within the ip6_reassdata list. */
|
||||||
iprh = (struct ip6_reass_helper*) ipr->p->payload;
|
iprh = (struct ip6_reass_helper*) ipr->p->payload;
|
||||||
while(iprh != NULL) {
|
while (iprh != NULL) {
|
||||||
struct pbuf* next_pbuf = iprh->next_pbuf;
|
struct pbuf* next_pbuf = iprh->next_pbuf;
|
||||||
if (next_pbuf != NULL) {
|
if (next_pbuf != NULL) {
|
||||||
/* Save next helper struct (will be hidden in next step). */
|
/* Save next helper struct (will be hidden in next step). */
|
||||||
|
@ -331,7 +331,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
i = nd6_find_neighbor_cache_entry(ip6_current_src_addr());
|
i = nd6_find_neighbor_cache_entry(ip6_current_src_addr());
|
||||||
if ( i>= 0) {
|
if (i>= 0) {
|
||||||
/* We already have a record for the solicitor. */
|
/* We already have a record for the solicitor. */
|
||||||
if (neighbor_cache[i].state == ND6_INCOMPLETE) {
|
if (neighbor_cache[i].state == ND6_INCOMPLETE) {
|
||||||
neighbor_cache[i].netif = inp;
|
neighbor_cache[i].netif = inp;
|
||||||
|
@ -641,7 +641,7 @@ mem_malloc_adjust_lfree:
|
|||||||
}
|
}
|
||||||
#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT
|
#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT
|
||||||
/* if we got interrupted by a mem_free, try again */
|
/* if we got interrupted by a mem_free, try again */
|
||||||
} while(local_mem_free_count != 0);
|
} while (local_mem_free_count != 0);
|
||||||
#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */
|
#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */
|
||||||
LWIP_DEBUGF(MEM_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("mem_malloc: could not allocate %"S16_F" bytes\n", (s16_t)size));
|
LWIP_DEBUGF(MEM_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("mem_malloc: could not allocate %"S16_F" bytes\n", (s16_t)size));
|
||||||
MEM_STATS_INC(err);
|
MEM_STATS_INC(err);
|
||||||
|
@ -396,7 +396,7 @@ netif_find(const char *name)
|
|||||||
|
|
||||||
num = name[2] - '0';
|
num = name[2] - '0';
|
||||||
|
|
||||||
for(netif = netif_list; netif != NULL; netif = netif->next) {
|
for (netif = netif_list; netif != NULL; netif = netif->next) {
|
||||||
if (num == netif->num &&
|
if (num == netif->num &&
|
||||||
name[0] == netif->name[0] &&
|
name[0] == netif->name[0] &&
|
||||||
name[1] == netif->name[1]) {
|
name[1] == netif->name[1]) {
|
||||||
|
@ -973,7 +973,7 @@ pbuf_copy_partial(struct pbuf *buf, void *dataptr, u16_t len, u16_t offset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Note some systems use byte copy if dataptr or one of the pbuf payload pointers are unaligned. */
|
/* Note some systems use byte copy if dataptr or one of the pbuf payload pointers are unaligned. */
|
||||||
for(p = buf; len != 0 && p != NULL; p = p->next) {
|
for (p = buf; len != 0 && p != NULL; p = p->next) {
|
||||||
if ((offset != 0) && (offset >= p->len)) {
|
if ((offset != 0) && (offset >= p->len)) {
|
||||||
/* don't copy from this buffer -> on to the next */
|
/* don't copy from this buffer -> on to the next */
|
||||||
offset -= p->len;
|
offset -= p->len;
|
||||||
@ -1095,7 +1095,7 @@ pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Note some systems use byte copy if dataptr or one of the pbuf payload pointers are unaligned. */
|
/* Note some systems use byte copy if dataptr or one of the pbuf payload pointers are unaligned. */
|
||||||
for(p = buf; total_copy_len != 0; p = p->next) {
|
for (p = buf; total_copy_len != 0; p = p->next) {
|
||||||
LWIP_ASSERT("pbuf_take: invalid pbuf", p != NULL);
|
LWIP_ASSERT("pbuf_take: invalid pbuf", p != NULL);
|
||||||
buf_copy_len = total_copy_len;
|
buf_copy_len = total_copy_len;
|
||||||
if (buf_copy_len > p->len) {
|
if (buf_copy_len > p->len) {
|
||||||
@ -1277,7 +1277,7 @@ pbuf_memcmp(struct pbuf* p, u16_t offset, const void* s2, u16_t n)
|
|||||||
/* return requested data if pbuf is OK */
|
/* return requested data if pbuf is OK */
|
||||||
if ((q != NULL) && (q->len > start)) {
|
if ((q != NULL) && (q->len > start)) {
|
||||||
u16_t i;
|
u16_t i;
|
||||||
for(i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
u8_t a = pbuf_get_at(q, start + i);
|
u8_t a = pbuf_get_at(q, start + i);
|
||||||
u8_t b = ((const u8_t*)s2)[i];
|
u8_t b = ((const u8_t*)s2)[i];
|
||||||
if (a != b) {
|
if (a != b) {
|
||||||
@ -1305,7 +1305,7 @@ pbuf_memfind(struct pbuf* p, const void* mem, u16_t mem_len, u16_t start_offset)
|
|||||||
u16_t i;
|
u16_t i;
|
||||||
u16_t max = p->tot_len - mem_len;
|
u16_t max = p->tot_len - mem_len;
|
||||||
if (p->tot_len >= mem_len + start_offset) {
|
if (p->tot_len >= mem_len + start_offset) {
|
||||||
for(i = start_offset; i <= max; i++) {
|
for (i = start_offset; i <= max; i++) {
|
||||||
u16_t plus = pbuf_memcmp(p, i, mem, mem_len);
|
u16_t plus = pbuf_memcmp(p, i, mem, mem_len);
|
||||||
if (plus == 0) {
|
if (plus == 0) {
|
||||||
return i;
|
return i;
|
||||||
|
@ -378,7 +378,7 @@ raw_remove(struct raw_pcb *pcb)
|
|||||||
raw_pcbs = raw_pcbs->next;
|
raw_pcbs = raw_pcbs->next;
|
||||||
/* pcb not 1st in list */
|
/* pcb not 1st in list */
|
||||||
} else {
|
} else {
|
||||||
for(pcb2 = raw_pcbs; pcb2 != NULL; pcb2 = pcb2->next) {
|
for (pcb2 = raw_pcbs; pcb2 != NULL; pcb2 = pcb2->next) {
|
||||||
/* find pcb in raw_pcbs list */
|
/* find pcb in raw_pcbs list */
|
||||||
if (pcb2->next != NULL && pcb2->next == pcb) {
|
if (pcb2->next != NULL && pcb2->next == pcb) {
|
||||||
/* remove pcb from list */
|
/* remove pcb from list */
|
||||||
|
@ -475,7 +475,7 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
|
|||||||
|
|
||||||
/* Check if the address already is in use (on all lists) */
|
/* Check if the address already is in use (on all lists) */
|
||||||
for (i = 0; i < max_pcb_list; i++) {
|
for (i = 0; i < max_pcb_list; i++) {
|
||||||
for(cpcb = *tcp_pcb_lists[i]; cpcb != NULL; cpcb = cpcb->next) {
|
for (cpcb = *tcp_pcb_lists[i]; cpcb != NULL; cpcb = cpcb->next) {
|
||||||
if (cpcb->local_port == port) {
|
if (cpcb->local_port == port) {
|
||||||
#if SO_REUSE
|
#if SO_REUSE
|
||||||
/* Omit checking for the same port if both pcbs have REUSEADDR set.
|
/* Omit checking for the same port if both pcbs have REUSEADDR set.
|
||||||
@ -551,7 +551,7 @@ tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog)
|
|||||||
/* Since SOF_REUSEADDR allows reusing a local address before the pcb's usage
|
/* Since SOF_REUSEADDR allows reusing a local address before the pcb's usage
|
||||||
is declared (listen-/connection-pcb), we have to make sure now that
|
is declared (listen-/connection-pcb), we have to make sure now that
|
||||||
this port is only used once for every local IP. */
|
this port is only used once for every local IP. */
|
||||||
for(lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
|
for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
|
||||||
if ((lpcb->local_port == pcb->local_port) &&
|
if ((lpcb->local_port == pcb->local_port) &&
|
||||||
IP_PCB_IPVER_EQ(pcb, lpcb)) {
|
IP_PCB_IPVER_EQ(pcb, lpcb)) {
|
||||||
if (ip_addr_cmp(&lpcb->local_ip, &pcb->local_ip)) {
|
if (ip_addr_cmp(&lpcb->local_ip, &pcb->local_ip)) {
|
||||||
@ -607,7 +607,7 @@ tcp_listen_dual_with_backlog(struct tcp_pcb *pcb, u8_t backlog)
|
|||||||
if (pcb->local_port != 0) {
|
if (pcb->local_port != 0) {
|
||||||
/* Check that there's noone listening on this port already
|
/* Check that there's noone listening on this port already
|
||||||
(don't check the IP address since we'll set it to ANY */
|
(don't check the IP address since we'll set it to ANY */
|
||||||
for(l = tcp_listen_pcbs.listen_pcbs; l != NULL; l = l->next) {
|
for (l = tcp_listen_pcbs.listen_pcbs; l != NULL; l = l->next) {
|
||||||
if (l->local_port == pcb->local_port) {
|
if (l->local_port == pcb->local_port) {
|
||||||
/* this port is already used */
|
/* this port is already used */
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -723,7 +723,7 @@ again:
|
|||||||
}
|
}
|
||||||
/* Check all PCB lists. */
|
/* Check all PCB lists. */
|
||||||
for (i = 0; i < NUM_TCP_PCB_LISTS; i++) {
|
for (i = 0; i < NUM_TCP_PCB_LISTS; i++) {
|
||||||
for(pcb = *tcp_pcb_lists[i]; pcb != NULL; pcb = pcb->next) {
|
for (pcb = *tcp_pcb_lists[i]; pcb != NULL; pcb = pcb->next) {
|
||||||
if (pcb->local_port == tcp_port) {
|
if (pcb->local_port == tcp_port) {
|
||||||
if (++n > (TCP_LOCAL_PORT_RANGE_END - TCP_LOCAL_PORT_RANGE_START)) {
|
if (++n > (TCP_LOCAL_PORT_RANGE_END - TCP_LOCAL_PORT_RANGE_START)) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -800,7 +800,7 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port,
|
|||||||
int i;
|
int i;
|
||||||
/* Don't check listen- and bound-PCBs, check active- and TIME-WAIT PCBs. */
|
/* Don't check listen- and bound-PCBs, check active- and TIME-WAIT PCBs. */
|
||||||
for (i = 2; i < NUM_TCP_PCB_LISTS; i++) {
|
for (i = 2; i < NUM_TCP_PCB_LISTS; i++) {
|
||||||
for(cpcb = *tcp_pcb_lists[i]; cpcb != NULL; cpcb = cpcb->next) {
|
for (cpcb = *tcp_pcb_lists[i]; cpcb != NULL; cpcb = cpcb->next) {
|
||||||
if ((cpcb->local_port == pcb->local_port) &&
|
if ((cpcb->local_port == pcb->local_port) &&
|
||||||
(cpcb->remote_port == port) &&
|
(cpcb->remote_port == port) &&
|
||||||
IP_PCB_IPVER_EQ(cpcb, pcb) &&
|
IP_PCB_IPVER_EQ(cpcb, pcb) &&
|
||||||
@ -1131,7 +1131,7 @@ tcp_fasttmr(void)
|
|||||||
tcp_fasttmr_start:
|
tcp_fasttmr_start:
|
||||||
pcb = tcp_active_pcbs;
|
pcb = tcp_active_pcbs;
|
||||||
|
|
||||||
while(pcb != NULL) {
|
while (pcb != NULL) {
|
||||||
if (pcb->last_timer != tcp_timer_ctr) {
|
if (pcb->last_timer != tcp_timer_ctr) {
|
||||||
struct tcp_pcb *next;
|
struct tcp_pcb *next;
|
||||||
pcb->last_timer = tcp_timer_ctr;
|
pcb->last_timer = tcp_timer_ctr;
|
||||||
@ -1340,7 +1340,7 @@ tcp_kill_prio(u8_t prio)
|
|||||||
/* 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;
|
||||||
for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
|
for (pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
|
||||||
if (pcb->prio <= prio &&
|
if (pcb->prio <= prio &&
|
||||||
pcb->prio <= mprio &&
|
pcb->prio <= mprio &&
|
||||||
(u32_t)(tcp_ticks - pcb->tmr) >= inactivity) {
|
(u32_t)(tcp_ticks - pcb->tmr) >= inactivity) {
|
||||||
@ -1372,7 +1372,7 @@ tcp_kill_state(enum tcp_state state)
|
|||||||
inactive = NULL;
|
inactive = NULL;
|
||||||
/* Go through the list of active pcbs and get the oldest pcb that is in state
|
/* Go through the list of active pcbs and get the oldest pcb that is in state
|
||||||
CLOSING/LAST_ACK. */
|
CLOSING/LAST_ACK. */
|
||||||
for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
|
for (pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
|
||||||
if (pcb->state == state) {
|
if (pcb->state == state) {
|
||||||
if ((u32_t)(tcp_ticks - pcb->tmr) >= inactivity) {
|
if ((u32_t)(tcp_ticks - pcb->tmr) >= inactivity) {
|
||||||
inactivity = tcp_ticks - pcb->tmr;
|
inactivity = tcp_ticks - pcb->tmr;
|
||||||
@ -1401,7 +1401,7 @@ tcp_kill_timewait(void)
|
|||||||
inactivity = 0;
|
inactivity = 0;
|
||||||
inactive = NULL;
|
inactive = NULL;
|
||||||
/* Go through the list of TIME_WAIT pcbs and get the oldest pcb. */
|
/* Go through the list of TIME_WAIT pcbs and get the oldest pcb. */
|
||||||
for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {
|
for (pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {
|
||||||
if ((u32_t)(tcp_ticks - pcb->tmr) >= inactivity) {
|
if ((u32_t)(tcp_ticks - pcb->tmr) >= inactivity) {
|
||||||
inactivity = tcp_ticks - pcb->tmr;
|
inactivity = tcp_ticks - pcb->tmr;
|
||||||
inactive = pcb;
|
inactive = pcb;
|
||||||
@ -1996,21 +1996,21 @@ tcp_debug_print_pcbs(void)
|
|||||||
{
|
{
|
||||||
struct tcp_pcb *pcb;
|
struct tcp_pcb *pcb;
|
||||||
LWIP_DEBUGF(TCP_DEBUG, ("Active PCB states:\n"));
|
LWIP_DEBUGF(TCP_DEBUG, ("Active PCB states:\n"));
|
||||||
for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
|
for (pcb = tcp_active_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, ("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" ",
|
||||||
pcb->local_port, pcb->remote_port,
|
pcb->local_port, pcb->remote_port,
|
||||||
pcb->snd_nxt, pcb->rcv_nxt));
|
pcb->snd_nxt, pcb->rcv_nxt));
|
||||||
@ -2025,12 +2025,12 @@ s16_t
|
|||||||
tcp_pcbs_sane(void)
|
tcp_pcbs_sane(void)
|
||||||
{
|
{
|
||||||
struct tcp_pcb *pcb;
|
struct tcp_pcb *pcb;
|
||||||
for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
|
for (pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
|
||||||
LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != CLOSED", pcb->state != CLOSED);
|
LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != CLOSED", pcb->state != CLOSED);
|
||||||
LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != LISTEN", pcb->state != LISTEN);
|
LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != LISTEN", pcb->state != LISTEN);
|
||||||
LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != TIME-WAIT", pcb->state != TIME_WAIT);
|
LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != TIME-WAIT", pcb->state != TIME_WAIT);
|
||||||
}
|
}
|
||||||
for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {
|
for (pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {
|
||||||
LWIP_ASSERT("tcp_pcbs_sane: tw pcb->state == TIME-WAIT", pcb->state == TIME_WAIT);
|
LWIP_ASSERT("tcp_pcbs_sane: tw pcb->state == TIME-WAIT", pcb->state == TIME_WAIT);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -209,7 +209,7 @@ 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);
|
||||||
LWIP_ASSERT("tcp_input: active pcb->state != LISTEN", pcb->state != LISTEN);
|
LWIP_ASSERT("tcp_input: active pcb->state != LISTEN", pcb->state != LISTEN);
|
||||||
@ -237,7 +237,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
|||||||
if (pcb == NULL) {
|
if (pcb == NULL) {
|
||||||
/* If it did not go to an active connection, we check the connections
|
/* If it did not go to an active connection, we check the connections
|
||||||
in the TIME-WAIT state. */
|
in the TIME-WAIT state. */
|
||||||
for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {
|
for (pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {
|
||||||
LWIP_ASSERT("tcp_input: TIME-WAIT pcb->state == TIME-WAIT", pcb->state == TIME_WAIT);
|
LWIP_ASSERT("tcp_input: TIME-WAIT pcb->state == TIME-WAIT", pcb->state == TIME_WAIT);
|
||||||
if (pcb->remote_port == tcphdr->src &&
|
if (pcb->remote_port == tcphdr->src &&
|
||||||
pcb->local_port == tcphdr->dest &&
|
pcb->local_port == tcphdr->dest &&
|
||||||
@ -256,7 +256,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
|||||||
/* Finally, if we still did not get a match, we check all PCBs that
|
/* Finally, if we still did not get a match, we check all PCBs that
|
||||||
are LISTENing for incoming connections. */
|
are LISTENing for incoming connections. */
|
||||||
prev = NULL;
|
prev = NULL;
|
||||||
for(lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
|
for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
|
||||||
if (lpcb->local_port == tcphdr->dest) {
|
if (lpcb->local_port == tcphdr->dest) {
|
||||||
#if LWIP_IPV4 && LWIP_IPV6
|
#if LWIP_IPV4 && LWIP_IPV6
|
||||||
if (lpcb->accept_any_ip_version) {
|
if (lpcb->accept_any_ip_version) {
|
||||||
@ -378,7 +378,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
|||||||
/* pcb->acked is u32_t but the sent callback only takes a u16_t,
|
/* pcb->acked is u32_t but the sent callback only takes a u16_t,
|
||||||
so we might have to call it multiple times. */
|
so we might have to call it multiple times. */
|
||||||
u32_t pcb_acked = pcb->acked;
|
u32_t pcb_acked = pcb->acked;
|
||||||
while(pcb_acked > 0) {
|
while (pcb_acked > 0) {
|
||||||
acked = (u16_t)LWIP_MIN(pcb_acked, 0xffffu);
|
acked = (u16_t)LWIP_MIN(pcb_acked, 0xffffu);
|
||||||
pcb_acked -= acked;
|
pcb_acked -= acked;
|
||||||
#else
|
#else
|
||||||
@ -1514,7 +1514,7 @@ tcp_receive(struct tcp_pcb *pcb)
|
|||||||
contains less data. */
|
contains less data. */
|
||||||
|
|
||||||
prev = NULL;
|
prev = NULL;
|
||||||
for(next = pcb->ooseq; next != NULL; next = next->next) {
|
for (next = pcb->ooseq; next != NULL; next = next->next) {
|
||||||
if (seqno == next->tcphdr->seqno) {
|
if (seqno == next->tcphdr->seqno) {
|
||||||
/* The sequence number of the incoming segment is the
|
/* The sequence number of the incoming segment is the
|
||||||
same as the sequence number of the segment on
|
same as the sequence number of the segment on
|
||||||
@ -1623,7 +1623,7 @@ tcp_receive(struct tcp_pcb *pcb)
|
|||||||
ooseq_blen = 0;
|
ooseq_blen = 0;
|
||||||
ooseq_qlen = 0;
|
ooseq_qlen = 0;
|
||||||
prev = NULL;
|
prev = NULL;
|
||||||
for(next = pcb->ooseq; next != NULL; prev = next, next = next->next) {
|
for (next = pcb->ooseq; next != NULL; prev = next, next = next->next) {
|
||||||
struct pbuf *p = next->p;
|
struct pbuf *p = next->p;
|
||||||
ooseq_blen += p->tot_len;
|
ooseq_blen += p->tot_len;
|
||||||
ooseq_qlen += pbuf_clen(p);
|
ooseq_qlen += pbuf_clen(p);
|
||||||
|
@ -374,7 +374,7 @@ sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg)
|
|||||||
timeout->next = next_timeout;
|
timeout->next = next_timeout;
|
||||||
next_timeout = timeout;
|
next_timeout = timeout;
|
||||||
} else {
|
} else {
|
||||||
for(t = next_timeout; t != NULL; t = t->next) {
|
for (t = next_timeout; t != NULL; t = t->next) {
|
||||||
timeout->time -= t->time;
|
timeout->time -= t->time;
|
||||||
if (t->next == NULL || t->next->time > timeout->time) {
|
if (t->next == NULL || t->next->time > timeout->time) {
|
||||||
if (t->next != NULL) {
|
if (t->next != NULL) {
|
||||||
@ -473,7 +473,7 @@ sys_check_timeouts(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* repeat until all expired timers have been called */
|
/* repeat until all expired timers have been called */
|
||||||
} while(had_one);
|
} while (had_one);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ again:
|
|||||||
udp_port = UDP_LOCAL_PORT_RANGE_START;
|
udp_port = UDP_LOCAL_PORT_RANGE_START;
|
||||||
}
|
}
|
||||||
/* Check all PCBs. */
|
/* Check all PCBs. */
|
||||||
for(pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) {
|
for (pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) {
|
||||||
if (pcb->local_port == udp_port) {
|
if (pcb->local_port == udp_port) {
|
||||||
if (++n > (UDP_LOCAL_PORT_RANGE_END - UDP_LOCAL_PORT_RANGE_START)) {
|
if (++n > (UDP_LOCAL_PORT_RANGE_END - UDP_LOCAL_PORT_RANGE_START)) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -735,7 +735,7 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d
|
|||||||
#if LWIP_IPV6
|
#if LWIP_IPV6
|
||||||
!PCB_ISIPV6(pcb) &&
|
!PCB_ISIPV6(pcb) &&
|
||||||
#endif /* LWIP_IPV6 */
|
#endif /* LWIP_IPV6 */
|
||||||
ip_addr_isbroadcast(dst_ip, netif) ) {
|
ip_addr_isbroadcast(dst_ip, netif)) {
|
||||||
LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_LEVEL_SERIOUS,
|
LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_LEVEL_SERIOUS,
|
||||||
("udp_sendto_if: SOF_BROADCAST not enabled on pcb %p\n", (void *)pcb));
|
("udp_sendto_if: SOF_BROADCAST not enabled on pcb %p\n", (void *)pcb));
|
||||||
return ERR_VAL;
|
return ERR_VAL;
|
||||||
|
@ -376,7 +376,7 @@ extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */
|
|||||||
#if TCP_DEBUG_PCB_LISTS
|
#if TCP_DEBUG_PCB_LISTS
|
||||||
#define TCP_REG(pcbs, npcb) do {\
|
#define TCP_REG(pcbs, npcb) do {\
|
||||||
LWIP_DEBUGF(TCP_DEBUG, ("TCP_REG %p local port %d\n", (npcb), (npcb)->local_port)); \
|
LWIP_DEBUGF(TCP_DEBUG, ("TCP_REG %p local port %d\n", (npcb), (npcb)->local_port)); \
|
||||||
for(tcp_tmp_pcb = *(pcbs); \
|
for (tcp_tmp_pcb = *(pcbs); \
|
||||||
tcp_tmp_pcb != NULL; \
|
tcp_tmp_pcb != NULL; \
|
||||||
tcp_tmp_pcb = tcp_tmp_pcb->next) { \
|
tcp_tmp_pcb = tcp_tmp_pcb->next) { \
|
||||||
LWIP_ASSERT("TCP_REG: already registered\n", tcp_tmp_pcb != (npcb)); \
|
LWIP_ASSERT("TCP_REG: already registered\n", tcp_tmp_pcb != (npcb)); \
|
||||||
@ -393,7 +393,7 @@ extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */
|
|||||||
LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removing %p from %p\n", (npcb), *(pcbs))); \
|
LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removing %p from %p\n", (npcb), *(pcbs))); \
|
||||||
if(*(pcbs) == (npcb)) { \
|
if(*(pcbs) == (npcb)) { \
|
||||||
*(pcbs) = (*pcbs)->next; \
|
*(pcbs) = (*pcbs)->next; \
|
||||||
} else for(tcp_tmp_pcb = *(pcbs); tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \
|
} else for (tcp_tmp_pcb = *(pcbs); tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \
|
||||||
if(tcp_tmp_pcb->next == (npcb)) { \
|
if(tcp_tmp_pcb->next == (npcb)) { \
|
||||||
tcp_tmp_pcb->next = (npcb)->next; \
|
tcp_tmp_pcb->next = (npcb)->next; \
|
||||||
break; \
|
break; \
|
||||||
@ -419,7 +419,7 @@ extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */
|
|||||||
(*(pcbs)) = (*pcbs)->next; \
|
(*(pcbs)) = (*pcbs)->next; \
|
||||||
} \
|
} \
|
||||||
else { \
|
else { \
|
||||||
for(tcp_tmp_pcb = *pcbs; \
|
for (tcp_tmp_pcb = *pcbs; \
|
||||||
tcp_tmp_pcb != NULL; \
|
tcp_tmp_pcb != NULL; \
|
||||||
tcp_tmp_pcb = tcp_tmp_pcb->next) { \
|
tcp_tmp_pcb = tcp_tmp_pcb->next) { \
|
||||||
if(tcp_tmp_pcb->next == (npcb)) { \
|
if(tcp_tmp_pcb->next == (npcb)) { \
|
||||||
|
@ -145,7 +145,7 @@ low_level_output(struct netif *netif, struct pbuf *p)
|
|||||||
pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
|
pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(q = p; q != NULL; q = q->next) {
|
for (q = p; q != NULL; q = q->next) {
|
||||||
/* Send the data from the pbuf to the interface, one pbuf at a
|
/* Send the data from the pbuf to the interface, one pbuf at a
|
||||||
time. The size of the data in each pbuf is kept in the ->len
|
time. The size of the data in each pbuf is kept in the ->len
|
||||||
variable. */
|
variable. */
|
||||||
@ -197,7 +197,7 @@ low_level_input(struct netif *netif)
|
|||||||
|
|
||||||
/* We iterate over the pbuf chain until we have read the entire
|
/* We iterate over the pbuf chain until we have read the entire
|
||||||
* packet into the pbuf. */
|
* packet into the pbuf. */
|
||||||
for(q = p; q != NULL; q = q->next) {
|
for (q = p; q != NULL; q = q->next) {
|
||||||
/* Read enough bytes to fill this pbuf in the chain. The
|
/* Read enough bytes to fill this pbuf in the chain. The
|
||||||
* available data in the pbuf is given by the q->len
|
* available data in the pbuf is given by the q->len
|
||||||
* variable.
|
* variable.
|
||||||
|
@ -485,7 +485,7 @@ slipif_rxbyte_enqueue(struct netif *netif, u8_t data)
|
|||||||
#if SLIP_RX_QUEUE
|
#if SLIP_RX_QUEUE
|
||||||
/* queue multiple pbufs */
|
/* queue multiple pbufs */
|
||||||
struct pbuf *q = p;
|
struct pbuf *q = p;
|
||||||
while(q->next != NULL) {
|
while (q->next != NULL) {
|
||||||
q = q->next;
|
q = q->next;
|
||||||
}
|
}
|
||||||
q->next = p;
|
q->next = p;
|
||||||
|
Loading…
Reference in New Issue
Block a user