mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
Sockets: Unit tests and apps corrections
* Include lwip/inet.h in some unit tests and apps * Since they use htons() and pals. * test/unit/api/test_sockets.c: * write() could be declared by external socket headers * Call lwip_write() instead. * Code expects fcntl() to return 6 * But O_RDWR could have another value if external socket headers are present * Replace 6 by O_RDWR. * apps/tftp/tftp.c: * recv() could be declared by external socket headers * Rename it to tftp_recv()
This commit is contained in:
parent
f92d6702bc
commit
785b7aba3c
@ -53,6 +53,7 @@
|
|||||||
|
|
||||||
#include "lwip/tcp.h"
|
#include "lwip/tcp.h"
|
||||||
#include "lwip/sys.h"
|
#include "lwip/sys.h"
|
||||||
|
#include "lwip/inet.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ send_data(const ip_addr_t *addr, u16_t port)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16_t port)
|
tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16_t port)
|
||||||
{
|
{
|
||||||
u16_t *sbuf = (u16_t *) p->payload;
|
u16_t *sbuf = (u16_t *) p->payload;
|
||||||
int opcode;
|
int opcode;
|
||||||
@ -468,7 +468,7 @@ tftp_init_common(u8_t mode, const struct tftp_context *ctx)
|
|||||||
tftp_state.upcb = pcb;
|
tftp_state.upcb = pcb;
|
||||||
tftp_state.tftp_mode = mode;
|
tftp_state.tftp_mode = mode;
|
||||||
|
|
||||||
udp_recv(pcb, recv, NULL);
|
udp_recv(pcb, tftp_recv, NULL);
|
||||||
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ static void test_sockets_allfunctions_basic_domain(int domain)
|
|||||||
fail_unless(errno == EISCONN);
|
fail_unless(errno == EISCONN);
|
||||||
|
|
||||||
/* write from server to client */
|
/* write from server to client */
|
||||||
ret = write(s3, "test", 4);
|
ret = lwip_write(s3, "test", 4);
|
||||||
fail_unless(ret == 4);
|
fail_unless(ret == 4);
|
||||||
|
|
||||||
ret = lwip_shutdown(s3, SHUT_WR);
|
ret = lwip_shutdown(s3, SHUT_WR);
|
||||||
@ -330,7 +330,7 @@ static void test_sockets_msgapi_tcp(int domain)
|
|||||||
|
|
||||||
/* set s2 to non-blocking, not inherited from listener */
|
/* set s2 to non-blocking, not inherited from listener */
|
||||||
opt = lwip_fcntl(s2, F_GETFL, 0);
|
opt = lwip_fcntl(s2, F_GETFL, 0);
|
||||||
fail_unless(opt == 6);
|
fail_unless(opt == O_RDWR);
|
||||||
opt = O_NONBLOCK;
|
opt = O_NONBLOCK;
|
||||||
ret = lwip_fcntl(s2, F_SETFL, opt);
|
ret = lwip_fcntl(s2, F_SETFL, opt);
|
||||||
fail_unless(ret == 0);
|
fail_unless(ret == 0);
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "lwip/dhcp.h"
|
#include "lwip/dhcp.h"
|
||||||
#include "lwip/prot/dhcp.h"
|
#include "lwip/prot/dhcp.h"
|
||||||
#include "lwip/etharp.h"
|
#include "lwip/etharp.h"
|
||||||
|
#include "lwip/inet.h"
|
||||||
#include "netif/ethernet.h"
|
#include "netif/ethernet.h"
|
||||||
|
|
||||||
#if LWIP_ACD
|
#if LWIP_ACD
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "lwip/udp.h"
|
#include "lwip/udp.h"
|
||||||
#include "lwip/etharp.h"
|
#include "lwip/etharp.h"
|
||||||
|
#include "lwip/inet.h"
|
||||||
#include "netif/ethernet.h"
|
#include "netif/ethernet.h"
|
||||||
#include "lwip/stats.h"
|
#include "lwip/stats.h"
|
||||||
#include "lwip/prot/iana.h"
|
#include "lwip/prot/iana.h"
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "lwip/priv/tcp_priv.h"
|
#include "lwip/priv/tcp_priv.h"
|
||||||
#include "lwip/stats.h"
|
#include "lwip/stats.h"
|
||||||
#include "lwip/pbuf.h"
|
#include "lwip/pbuf.h"
|
||||||
|
#include "lwip/inet.h"
|
||||||
#include "lwip/inet_chksum.h"
|
#include "lwip/inet_chksum.h"
|
||||||
#include "lwip/ip_addr.h"
|
#include "lwip/ip_addr.h"
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "lwip/priv/tcp_priv.h"
|
#include "lwip/priv/tcp_priv.h"
|
||||||
#include "lwip/stats.h"
|
#include "lwip/stats.h"
|
||||||
|
#include "lwip/inet.h"
|
||||||
#include "tcp_helper.h"
|
#include "tcp_helper.h"
|
||||||
#include "lwip/inet_chksum.h"
|
#include "lwip/inet_chksum.h"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user