mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-11 06:40:28 +00:00
Minor changes in lwip folder: fix some warnings, coding style, and rename "internal" netconn_alloc function.
This commit is contained in:
parent
32005617b9
commit
9c4daa312d
@ -71,7 +71,7 @@ netconn_new_with_proto_and_callback(enum netconn_type t, u8_t proto,
|
|||||||
struct netconn *conn;
|
struct netconn *conn;
|
||||||
struct api_msg msg;
|
struct api_msg msg;
|
||||||
|
|
||||||
conn = netconn_alloc_with_proto_and_callback(t, proto, callback);
|
conn = netconn_alloc(t, callback);
|
||||||
if (conn != NULL ) {
|
if (conn != NULL ) {
|
||||||
msg.function = do_newconn;
|
msg.function = do_newconn;
|
||||||
msg.msg.msg.n.proto = proto;
|
msg.msg.msg.n.proto = proto;
|
||||||
|
@ -338,7 +338,7 @@ accept_function(void *arg, struct tcp_pcb *newpcb, err_t err)
|
|||||||
|
|
||||||
/* We have to set the callback here even though
|
/* We have to set the callback here even though
|
||||||
* the new socket is unknown. conn->socket is marked as -1. */
|
* 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) {
|
if (newconn == NULL) {
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
}
|
}
|
||||||
@ -446,7 +446,7 @@ do_newconn(struct api_msg_msg *msg)
|
|||||||
* NULL on memory error
|
* NULL on memory error
|
||||||
*/
|
*/
|
||||||
struct netconn*
|
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))
|
void (*callback)(struct netconn *, enum netconn_evt, u16_t len))
|
||||||
{
|
{
|
||||||
struct netconn *conn;
|
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);
|
memp_free(MEMP_NETCONN, conn);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
conn->acceptmbox = SYS_MBOX_NULL;
|
conn->acceptmbox = SYS_MBOX_NULL;
|
||||||
conn->state = NETCONN_NONE;
|
conn->state = NETCONN_NONE;
|
||||||
/* initialize socket to -1 since 0 is a valid socket */
|
/* initialize socket to -1 since 0 is a valid socket */
|
||||||
conn->socket = -1;
|
conn->socket = -1;
|
||||||
|
@ -269,7 +269,7 @@ lwip_getaddrinfo(const char *nodename, const char *servname,
|
|||||||
err_t err;
|
err_t err;
|
||||||
struct ip_addr addr;
|
struct ip_addr addr;
|
||||||
struct addrinfo *ai;
|
struct addrinfo *ai;
|
||||||
struct sockaddr_in *sa;
|
struct sockaddr_in *sa = NULL;
|
||||||
int port_nr = 0;
|
int port_nr = 0;
|
||||||
|
|
||||||
if (res == NULL) {
|
if (res == NULL) {
|
||||||
|
@ -563,7 +563,7 @@ dns_check_entries(void)
|
|||||||
* @params see udp.h
|
* @params see udp.h
|
||||||
*/
|
*/
|
||||||
static void
|
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;
|
u8_t i;
|
||||||
char *pHostname;
|
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;
|
u8_t* dns_payload;
|
||||||
#endif /* (DNS_USES_STATIC_BUF == 2) */
|
#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 ? */
|
/* is the dns message too big ? */
|
||||||
if (p->tot_len > DNS_MSG_SIZE) {
|
if (p->tot_len > DNS_MSG_SIZE) {
|
||||||
LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: pbuf too big\n"));
|
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
|
#if DNS_DOES_NAME_CHECK
|
||||||
/* Check if the name in the "question" part match with the name in the entry. */
|
/* 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));
|
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 */
|
/* call callback to indicate error, clean up memory and return */
|
||||||
goto responseerr;
|
goto responseerr;
|
||||||
@ -709,7 +714,7 @@ dns_enqueue(const char *name, dns_found_callback found, void *callback_arg)
|
|||||||
{
|
{
|
||||||
u8_t i;
|
u8_t i;
|
||||||
u8_t lseq, lseqi;
|
u8_t lseq, lseqi;
|
||||||
struct dns_table_entry *pEntry;
|
struct dns_table_entry *pEntry = NULL;
|
||||||
|
|
||||||
/* search an unused entry, or the oldest one */
|
/* search an unused entry, or the oldest one */
|
||||||
lseq = lseqi = 0;
|
lseq = lseqi = 0;
|
||||||
|
@ -103,7 +103,7 @@
|
|||||||
#if (LWIP_TCP && ((TCP_MAXRTX > 12) || (TCP_SYNMAXRTX > 12)))
|
#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"
|
#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
|
#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"
|
#error "If you want to use TCP backlog, TCP_DEFAULT_LISTEN_BACKLOG must fit into an u8_t"
|
||||||
#endif
|
#endif
|
||||||
#if (LWIP_IGMP && (MEMP_NUM_IGMP_GROUP<=1))
|
#if (LWIP_IGMP && (MEMP_NUM_IGMP_GROUP<=1))
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* MEM_USE_CUSTOM_POOLS to 1 and create a file "lwippools.h" that includes a list
|
* 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):
|
* 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_START
|
||||||
* LWIP_MALLOC_MEMPOOL(20, 256)
|
* LWIP_MALLOC_MEMPOOL(20, 256)
|
||||||
* LWIP_MALLOC_MEMPOOL(10, 512)
|
* LWIP_MALLOC_MEMPOOL(10, 512)
|
||||||
|
@ -347,6 +347,7 @@ tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog)
|
|||||||
{
|
{
|
||||||
struct tcp_pcb_listen *lpcb;
|
struct tcp_pcb_listen *lpcb;
|
||||||
|
|
||||||
|
LWIP_UNUSED_ARG(backlog);
|
||||||
LWIP_ERROR("tcp_listen: pcb already connected", pcb->state == CLOSED, return NULL);
|
LWIP_ERROR("tcp_listen: pcb already connected", pcb->state == CLOSED, return NULL);
|
||||||
|
|
||||||
/* already listening? */
|
/* already listening? */
|
||||||
|
@ -148,8 +148,8 @@ void do_join_leave_group( struct api_msg_msg *msg);
|
|||||||
void do_gethostbyname(void *arg);
|
void do_gethostbyname(void *arg);
|
||||||
#endif /* LWIP_DNS */
|
#endif /* LWIP_DNS */
|
||||||
|
|
||||||
struct netconn* netconn_alloc_with_proto_and_callback(
|
struct netconn* netconn_alloc(
|
||||||
enum netconn_type t, u8_t proto,
|
enum netconn_type t,
|
||||||
void (*callback)(struct netconn *, enum netconn_evt, u16_t len));
|
void (*callback)(struct netconn *, enum netconn_evt, u16_t len));
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
x
Reference in New Issue
Block a user