From d73262a0e5c10ef22643889e7b3e94a25c319c4e Mon Sep 17 00:00:00 2001 From: goldsimon Date: Thu, 29 Jul 2010 19:25:50 +0000 Subject: [PATCH] Fixed compilation with TCP or UDP disabled. --- CHANGELOG | 4 ++++ src/api/api_lib.c | 11 +++++++++++ src/api/api_msg.c | 8 +++----- src/api/sockets.c | 5 +++++ src/core/snmp/mib2.c | 2 ++ 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index b3cafde1..f02ddd0d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -229,6 +229,10 @@ HISTORY ++ Bugfixes: + 2010-07-28: Simon Goldschmidt + * api_lib.c, api_msg.c, sockets.c, mib2.c: Fixed compilation with TCP or UDP + disabled. + 2010-07-27: Simon Goldschmidt * tcp.c: Fixed bug #30565 (tcp_connect() check bound list): that check did no harm but never did anything diff --git a/src/api/api_lib.c b/src/api/api_lib.c index 04f6d306..f731a2bc 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -240,6 +240,7 @@ netconn_disconnect(struct netconn *conn) err_t netconn_listen_with_backlog(struct netconn *conn, u8_t backlog) { +#if LWIP_TCP struct api_msg msg; err_t err; @@ -257,6 +258,11 @@ netconn_listen_with_backlog(struct netconn *conn, u8_t backlog) NETCONN_SET_SAFE_ERR(conn, err); return err; +#else /* LWIP_TCP */ + LWIP_UNUSED_ARG(conn); + LWIP_UNUSED_ARG(backlog); + return ERR_ARG; +#endif /* LWIP_TCP */ } /** @@ -499,6 +505,7 @@ netconn_recv(struct netconn *conn, struct netbuf **new_buf) void netconn_recved(struct netconn *conn, u32_t length) { +#if LWIP_TCP if ((conn != NULL) && (conn->type == NETCONN_TCP) && (netconn_get_noautorecved(conn))) { struct api_msg msg; @@ -511,6 +518,10 @@ netconn_recved(struct netconn *conn, u32_t length) /* don't care for the return value of do_recv */ TCPIP_APIMSG(&msg); } +#else /* LWIP_TCP */ + LWIP_UNUSED_ARG(conn); + LWIP_UNUSED_ARG(length); +#endif /* LWIP_TCP */ } /** diff --git a/src/api/api_msg.c b/src/api/api_msg.c index 366f5d9a..7f03e2de 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -1040,6 +1040,7 @@ do_disconnect(struct api_msg_msg *msg) TCPIP_APIMSG_ACK(msg); } +#if LWIP_TCP /** * Set a TCP pcb contained in a netconn into listen mode * Called from netconn_listen. @@ -1049,7 +1050,6 @@ do_disconnect(struct api_msg_msg *msg) void do_listen(struct api_msg_msg *msg) { -#if LWIP_TCP if (ERR_IS_FATAL(msg->conn->last_err)) { msg->err = msg->conn->last_err; } else { @@ -1091,9 +1091,9 @@ do_listen(struct api_msg_msg *msg) } } } -#endif /* LWIP_TCP */ TCPIP_APIMSG_ACK(msg); } +#endif /* LWIP_TCP */ /** * Send some data on a RAW or UDP pcb contained in a netconn @@ -1147,6 +1147,7 @@ do_send(struct api_msg_msg *msg) TCPIP_APIMSG_ACK(msg); } +#if LWIP_TCP /** * Indicate data has been received from a TCP pcb contained in a netconn * Called from netconn_recv @@ -1156,7 +1157,6 @@ do_send(struct api_msg_msg *msg) void do_recv(struct api_msg_msg *msg) { -#if LWIP_TCP msg->err = ERR_OK; if (msg->conn->pcb.tcp != NULL) { if (msg->conn->type == NETCONN_TCP) { @@ -1175,11 +1175,9 @@ do_recv(struct api_msg_msg *msg) } } } -#endif /* LWIP_TCP */ TCPIP_APIMSG_ACK(msg); } -#if LWIP_TCP /** * See if more data needs to be written from a previous call to netconn_write. * Called initially from do_write. If the first call can't send all data diff --git a/src/api/sockets.c b/src/api/sockets.c index 9919b611..6d1cc800 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -804,6 +804,7 @@ lwip_sendto(int s, const void *data, size_t size, int flags, #if LWIP_TCP return lwip_send(s, data, size, flags); #else /* LWIP_TCP */ + LWIP_UNUSED_ARG(flags); sock_set_errno(sock, err_to_errno(ERR_ARG)); return -1; #endif /* LWIP_TCP */ @@ -852,6 +853,7 @@ lwip_sendto(int s, const void *data, size_t size, int flags, if (sock->conn->type == NETCONN_RAW) { err = sock->conn->last_err = raw_sendto(sock->conn->pcb.raw, p, remote_addr); } else { +#if LWIP_UDP #if LWIP_CHECKSUM_ON_COPY && LWIP_NETIF_TX_SINGLE_PBUF err = sock->conn->last_err = udp_sendto_chksum(sock->conn->pcb.udp, p, remote_addr, remote_port, 1, chksum); @@ -859,6 +861,9 @@ lwip_sendto(int s, const void *data, size_t size, int flags, err = sock->conn->last_err = udp_sendto(sock->conn->pcb.udp, p, remote_addr, remote_port); #endif /* LWIP_CHECKSUM_ON_COPY && LWIP_NETIF_TX_SINGLE_PBUF */ +#else /* LWIP_UDP */ + err = ERR_ARG; +#endif /* LWIP_UDP */ } UNLOCK_TCPIP_CORE(); diff --git a/src/core/snmp/mib2.c b/src/core/snmp/mib2.c index 5ed9fcd6..29decd30 100644 --- a/src/core/snmp/mib2.c +++ b/src/core/snmp/mib2.c @@ -43,10 +43,12 @@ #include "lwip/netif.h" #include "lwip/ip.h" #include "lwip/ip_frag.h" +#include "lwip/mem.h" #include "lwip/tcp_impl.h" #include "lwip/udp.h" #include "lwip/snmp_asn1.h" #include "lwip/snmp_structs.h" +#include "lwip/sys.h" #include "netif/etharp.h" /**