Free (GPLv2) TCP/IP stack developed by TASS Belgium
Dependents: lpc1768-picotcp-demo ZeroMQ_PicoTCP_Publisher_demo TCPSocket_HelloWorld_PicoTCP Pico_TCP_UDP_Test ... more
PicoTCP. Copyright (c) 2013 TASS Belgium NV.
Released under the GNU General Public License, version 2.
Different licensing models may exist, at the sole discretion of the Copyright holders.
Official homepage: http://www.picotcp.com
Bug tracker: https://github.com/tass-belgium/picotcp/issues
Development steps:
initial integration with mbed RTOSgeneric mbed Ethernet driverhigh performance NXP LPC1768 specific Ethernet driverMulti-threading support for mbed RTOSBerkeley sockets and integration with the New Socket APIFork of the apps running on top of the New Socket APIScheduling optimizations- Debugging/benchmarking/testing
Demo application (measuring TCP sender performance):
Import programlpc1768-picotcp-demo
A PicoTCP demo app testing the ethernet throughput on the lpc1768 mbed board.
Diff: modules/pico_dns_client.c
- Revision:
- 70:cd218dd180e5
- Parent:
- 68:0847e35d08a6
- Child:
- 73:dfb737147f6e
--- a/modules/pico_dns_client.c Wed Sep 25 12:20:39 2013 +0000 +++ b/modules/pico_dns_client.c Thu Sep 26 07:05:22 2013 +0000 @@ -63,7 +63,7 @@ #define PICO_DNS_POINTER 3 /* Label len */ -#define PICO_DNS_LABEL_INITIAL 1 +#define PICO_DNS_LABEL_INITIAL 1u #define PICO_DNS_LABEL_ROOT 1 /* TTL values */ @@ -73,7 +73,7 @@ #define PICO_DNS_IPV4_ADDR_LEN 16 static void pico_dns_client_callback(uint16_t ev, struct pico_socket *s); -static void pico_dns_client_retransmission(unsigned long now, void *arg); +static void pico_dns_client_retransmission(uint64_t now, void *arg); /* RFC 1035 section 4. MESSAGES */ struct __attribute__((packed)) pico_dns_name @@ -307,12 +307,12 @@ /* mirror ip address numbers * f.e. 192.168.0.1 => 1.0.168.192 */ -static int pico_dns_client_mirror(char *ptr) +static int8_t pico_dns_client_mirror(char *ptr) { const unsigned char *addr = NULL; char *m = ptr; uint32_t ip = 0; - int i = 0; + int8_t i = 0; if (pico_string_to_ipv4(ptr, &ip) < 0) return -1; @@ -321,14 +321,14 @@ addr = (unsigned char *)&ip; for (i = 3; i >= 0; i--) { if (addr[i] > 99) { - *ptr++ = '0' + (addr[i] / 100); - *ptr++ = '0' + ((addr[i] % 100) / 10); - *ptr++ = '0' + ((addr[i] % 100) % 10); + *ptr++ = (char)('0' + (addr[i] / 100)); + *ptr++ = (char)('0' + ((addr[i] % 100) / 10)); + *ptr++ = (char)('0' + ((addr[i] % 100) % 10)); } else if(addr[i] > 9) { - *ptr++ = '0' + (addr[i] / 10); - *ptr++ = '0' + (addr[i] % 10); + *ptr++ = (char)('0' + (addr[i] / 10)); + *ptr++ = (char)('0' + (addr[i] % 10)); } else { - *ptr++ = '0' + addr[i]; + *ptr++ = (char)('0' + addr[i]); } if(i > 0) *ptr++ = '.'; @@ -395,14 +395,14 @@ label = ptr++; while ((p = *ptr++) != 0){ if (p == '.') { - *label = len; + *label = (char)len; label = ptr - 1; len = 0; } else { len++; } } - *label = len; + *label = (char)len; return 0; } @@ -516,7 +516,7 @@ return 0; } -static void pico_dns_client_retransmission(unsigned long now, void *arg) +static void pico_dns_client_retransmission(uint64_t now, void *arg) { struct pico_dns_query *q = NULL; struct pico_dns_query dummy; @@ -559,7 +559,7 @@ case PICO_DNS_TYPE_PTR: pico_dns_client_answer_domain((char *)asuffix->rdata); - str = pico_zalloc(asuffix->rdlength - PICO_DNS_LABEL_INITIAL); + str = pico_zalloc((size_t)(asuffix->rdlength - PICO_DNS_LABEL_INITIAL)); memcpy(str, asuffix->rdata + PICO_DNS_LABEL_INITIAL, short_be(asuffix->rdlength) - PICO_DNS_LABEL_INITIAL); break; @@ -635,8 +635,8 @@ } strlen = pico_dns_client_strlen(url); - lblen = PICO_DNS_LABEL_INITIAL + strlen + PICO_DNS_LABEL_ROOT; - len = sizeof(struct pico_dns_prefix) + lblen + sizeof(struct pico_dns_query_suffix); + lblen = (uint16_t)(PICO_DNS_LABEL_INITIAL + strlen + PICO_DNS_LABEL_ROOT); + len = (uint16_t)(sizeof(struct pico_dns_prefix) + lblen + sizeof(struct pico_dns_query_suffix)); msg = pico_zalloc(len); if (!msg) { pico_err = PICO_ERR_ENOMEM; @@ -682,8 +682,8 @@ strlen = pico_dns_client_strlen(ip); arpalen = pico_dns_client_strlen(inaddr_arpa); - lblen = PICO_DNS_LABEL_INITIAL + strlen + arpalen + PICO_DNS_LABEL_ROOT; - len = sizeof(struct pico_dns_prefix) + lblen + sizeof(struct pico_dns_query_suffix); + lblen = (uint16_t)(PICO_DNS_LABEL_INITIAL + strlen + arpalen + PICO_DNS_LABEL_ROOT); + len = (uint16_t)(sizeof(struct pico_dns_prefix) + lblen + sizeof(struct pico_dns_query_suffix)); msg = pico_zalloc(len); if (!msg) { pico_err = PICO_ERR_ENOMEM;