Minor changes in lwip folder: fix some warnings, coding style, and rename "internal" netconn_alloc function.

This commit is contained in:
fbernon 2008-01-04 23:07:44 +00:00
parent 32005617b9
commit 9c4daa312d
8 changed files with 18 additions and 12 deletions

View File

@ -71,7 +71,7 @@ netconn_new_with_proto_and_callback(enum netconn_type t, u8_t proto,
struct netconn *conn;
struct api_msg msg;
conn = netconn_alloc_with_proto_and_callback(t, proto, callback);
conn = netconn_alloc(t, callback);
if (conn != NULL ) {
msg.function = do_newconn;
msg.msg.msg.n.proto = proto;

View File

@ -338,7 +338,7 @@ accept_function(void *arg, struct tcp_pcb *newpcb, err_t err)
/* We have to set the callback here even though
* the new socket is unknown. conn->socket is marked as -1. */
newconn = netconn_alloc_with_proto_and_callback(conn->type, 0, conn->callback);
newconn = netconn_alloc(conn->type, conn->callback);
if (newconn == NULL) {
return ERR_MEM;
}
@ -446,7 +446,7 @@ do_newconn(struct api_msg_msg *msg)
* NULL on memory error
*/
struct netconn*
netconn_alloc_with_proto_and_callback(enum netconn_type t, u8_t proto,
netconn_alloc(enum netconn_type t,
void (*callback)(struct netconn *, enum netconn_evt, u16_t len))
{
struct netconn *conn;
@ -469,7 +469,7 @@ netconn_alloc_with_proto_and_callback(enum netconn_type t, u8_t proto,
memp_free(MEMP_NETCONN, conn);
return NULL;
}
conn->acceptmbox = SYS_MBOX_NULL;
conn->acceptmbox = SYS_MBOX_NULL;
conn->state = NETCONN_NONE;
/* initialize socket to -1 since 0 is a valid socket */
conn->socket = -1;

View File

@ -269,7 +269,7 @@ lwip_getaddrinfo(const char *nodename, const char *servname,
err_t err;
struct ip_addr addr;
struct addrinfo *ai;
struct sockaddr_in *sa;
struct sockaddr_in *sa = NULL;
int port_nr = 0;
if (res == NULL) {

View File

@ -563,7 +563,7 @@ dns_check_entries(void)
* @params see udp.h
*/
static void
dns_recv(void *s, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port)
dns_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port)
{
u8_t i;
char *pHostname;
@ -578,6 +578,11 @@ dns_recv(void *s, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16
u8_t* dns_payload;
#endif /* (DNS_USES_STATIC_BUF == 2) */
LWIP_UNUSED_ARG(arg);
LWIP_UNUSED_ARG(pcb);
LWIP_UNUSED_ARG(addr);
LWIP_UNUSED_ARG(port);
/* is the dns message too big ? */
if (p->tot_len > DNS_MSG_SIZE) {
LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: pbuf too big\n"));
@ -627,7 +632,7 @@ dns_recv(void *s, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16
#if DNS_DOES_NAME_CHECK
/* Check if the name in the "question" part match with the name in the entry. */
if (dns_compare_name(pEntry->name, (unsigned char *)dns_payload + sizeof(struct dns_hdr)) != 0) {
if (dns_compare_name((unsigned char *)(pEntry->name), (unsigned char *)dns_payload + sizeof(struct dns_hdr)) != 0) {
LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: \"%s\": response not match to query\n", pEntry->name));
/* call callback to indicate error, clean up memory and return */
goto responseerr;
@ -709,7 +714,7 @@ dns_enqueue(const char *name, dns_found_callback found, void *callback_arg)
{
u8_t i;
u8_t lseq, lseqi;
struct dns_table_entry *pEntry;
struct dns_table_entry *pEntry = NULL;
/* search an unused entry, or the oldest one */
lseq = lseqi = 0;

View File

@ -103,7 +103,7 @@
#if (LWIP_TCP && ((TCP_MAXRTX > 12) || (TCP_SYNMAXRTX > 12)))
#error "If you want to use TCP, TCP_MAXRTX and TCP_SYNMAXRTX must less or equal to 12 (due to tcp_backoff table), so, you have to reduce them in your lwipopts.h"
#endif
#if (LWIP_TCP && TCP_LISTEN_BACKLOG && (TCP_DEFAULT_LISTEN_BACKLOG < 0) || (TCP_DEFAULT_LISTEN_BACKLOG > 255))
#if (LWIP_TCP && TCP_LISTEN_BACKLOG && (TCP_DEFAULT_LISTEN_BACKLOG < 0) || (TCP_DEFAULT_LISTEN_BACKLOG > 0xff))
#error "If you want to use TCP backlog, TCP_DEFAULT_LISTEN_BACKLOG must fit into an u8_t"
#endif
#if (LWIP_IGMP && (MEMP_NUM_IGMP_GROUP<=1))

View File

@ -12,7 +12,7 @@
* MEM_USE_CUSTOM_POOLS to 1 and create a file "lwippools.h" that includes a list
* of pools like the this (more pools can be added between _START and _END):
*
* /* Define three pools with sizes 256, 512, and 1512 bytes
* Define three pools with sizes 256, 512, and 1512 bytes
* LWIP_MALLOC_MEMPOOL_START
* LWIP_MALLOC_MEMPOOL(20, 256)
* LWIP_MALLOC_MEMPOOL(10, 512)

View File

@ -347,6 +347,7 @@ tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog)
{
struct tcp_pcb_listen *lpcb;
LWIP_UNUSED_ARG(backlog);
LWIP_ERROR("tcp_listen: pcb already connected", pcb->state == CLOSED, return NULL);
/* already listening? */

View File

@ -148,8 +148,8 @@ void do_join_leave_group( struct api_msg_msg *msg);
void do_gethostbyname(void *arg);
#endif /* LWIP_DNS */
struct netconn* netconn_alloc_with_proto_and_callback(
enum netconn_type t, u8_t proto,
struct netconn* netconn_alloc(
enum netconn_type t,
void (*callback)(struct netconn *, enum netconn_evt, u16_t len));
#ifdef __cplusplus