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:
Joan Lledó
2019-08-10 11:31:24 +02:00
committed by Simon Goldschmidt
parent f92d6702bc
commit 785b7aba3c
7 changed files with 9 additions and 4 deletions

View File

@@ -53,6 +53,7 @@
#include "lwip/tcp.h"
#include "lwip/sys.h"
#include "lwip/inet.h"
#include <string.h>

View File

@@ -240,7 +240,7 @@ send_data(const ip_addr_t *addr, u16_t port)
}
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;
int opcode;
@@ -468,7 +468,7 @@ tftp_init_common(u8_t mode, const struct tftp_context *ctx)
tftp_state.upcb = pcb;
tftp_state.tftp_mode = mode;
udp_recv(pcb, recv, NULL);
udp_recv(pcb, tftp_recv, NULL);
return ERR_OK;
}